summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--AUTHORS.md3
-rw-r--r--COPYRIGHT.txt5
-rw-r--r--DONORS.md39
-rw-r--r--SConstruct2
-rw-r--r--core/SCsub4
-rw-r--r--core/allocators.h3
-rw-r--r--core/array.cpp8
-rw-r--r--core/array.h3
-rw-r--r--core/bind/core_bind.cpp14
-rw-r--r--core/bind/core_bind.h18
-rw-r--r--core/class_db.cpp6
-rw-r--r--core/class_db.h8
-rw-r--r--core/color.cpp8
-rw-r--r--core/color.h4
-rw-r--r--core/color_names.inc2
-rw-r--r--core/command_queue_mt.cpp2
-rw-r--r--core/command_queue_mt.h10
-rw-r--r--core/compressed_translation.cpp2
-rw-r--r--core/compressed_translation.h2
-rw-r--r--core/core_string_names.h2
-rw-r--r--core/cowdata.h4
-rw-r--r--core/dictionary.cpp6
-rw-r--r--core/dictionary.h7
-rw-r--r--core/dvector.h12
-rw-r--r--core/engine.cpp10
-rw-r--r--core/engine.h8
-rw-r--r--core/error_macros.cpp2
-rw-r--r--core/error_macros.h2
-rw-r--r--core/func_ref.h2
-rw-r--r--core/global_constants.cpp8
-rw-r--r--core/global_constants.h2
-rw-r--r--core/hash_map.h12
-rw-r--r--core/hashfuncs.h12
-rw-r--r--core/helper/math_fieldwise.cpp2
-rw-r--r--core/image.cpp10
-rw-r--r--core/image.h8
-rw-r--r--core/input_map.cpp4
-rw-r--r--core/input_map.h4
-rw-r--r--core/io/compression.cpp7
-rw-r--r--core/io/compression.h2
-rw-r--r--core/io/config_file.cpp7
-rw-r--r--core/io/config_file.h2
-rw-r--r--core/io/file_access_buffered.cpp4
-rw-r--r--core/io/file_access_buffered.h7
-rw-r--r--core/io/file_access_compressed.cpp4
-rw-r--r--core/io/file_access_compressed.h4
-rw-r--r--core/io/file_access_encrypted.cpp4
-rw-r--r--core/io/file_access_encrypted.h2
-rw-r--r--core/io/file_access_memory.cpp8
-rw-r--r--core/io/file_access_memory.h2
-rw-r--r--core/io/file_access_network.cpp11
-rw-r--r--core/io/file_access_network.h8
-rw-r--r--core/io/file_access_pack.cpp3
-rw-r--r--core/io/file_access_pack.h10
-rw-r--r--core/io/file_access_zip.h2
-rw-r--r--core/io/http_client.cpp40
-rw-r--r--core/io/http_client.h8
-rw-r--r--core/io/image_loader.cpp3
-rw-r--r--core/io/image_loader.h10
-rw-r--r--core/io/ip.cpp7
-rw-r--r--core/io/ip.h4
-rw-r--r--core/io/ip_address.h2
-rw-r--r--core/io/json.cpp3
-rw-r--r--core/io/json.h2
-rw-r--r--core/io/logger.cpp6
-rw-r--r--core/io/logger.h9
-rw-r--r--core/io/marshalls.cpp8
-rw-r--r--core/io/marshalls.h6
-rw-r--r--core/io/multiplayer_api.cpp3
-rw-r--r--core/io/net_socket.cpp (renamed from drivers/windows/tcp_server_winsock.h)37
-rw-r--r--core/io/net_socket.h (renamed from drivers/unix/stream_peer_tcp_posix.h)95
-rw-r--r--core/io/networked_multiplayer_peer.h2
-rw-r--r--core/io/packet_peer.cpp5
-rw-r--r--core/io/packet_peer.h7
-rw-r--r--core/io/packet_peer_udp.cpp197
-rw-r--r--core/io/packet_peer_udp.h42
-rw-r--r--core/io/pck_packer.cpp3
-rw-r--r--core/io/resource_format_binary.h6
-rw-r--r--core/io/resource_import.cpp4
-rw-r--r--core/io/resource_import.h3
-rw-r--r--core/io/resource_loader.cpp18
-rw-r--r--core/io/resource_loader.h2
-rw-r--r--core/io/resource_saver.cpp9
-rw-r--r--core/io/resource_saver.h2
-rw-r--r--core/io/stream_peer.cpp3
-rw-r--r--core/io/stream_peer.h2
-rw-r--r--core/io/stream_peer_ssl.cpp5
-rw-r--r--core/io/stream_peer_ssl.h2
-rw-r--r--core/io/stream_peer_tcp.cpp294
-rw-r--r--core/io/stream_peer_tcp.h45
-rw-r--r--core/io/tcp_server.cpp97
-rw-r--r--core/io/tcp_server.h25
-rw-r--r--core/io/translation_loader_po.cpp5
-rw-r--r--core/io/translation_loader_po.h7
-rw-r--r--core/io/xml_parser.cpp4
-rw-r--r--core/io/xml_parser.h8
-rw-r--r--core/io/zip_io.h4
-rw-r--r--core/list.h4
-rw-r--r--core/map.h2
-rw-r--r--core/math/a_star.cpp5
-rw-r--r--core/math/a_star.h5
-rw-r--r--core/math/aabb.cpp2
-rw-r--r--core/math/aabb.h6
-rw-r--r--core/math/audio_frame.h2
-rw-r--r--core/math/bsp_tree.cpp5
-rw-r--r--core/math/bsp_tree.h14
-rw-r--r--core/math/camera_matrix.cpp5
-rw-r--r--core/math/camera_matrix.h5
-rw-r--r--core/math/delaunay.h2
-rw-r--r--core/math/expression.cpp14
-rw-r--r--core/math/face3.cpp3
-rw-r--r--core/math/face3.h8
-rw-r--r--core/math/geometry.cpp3
-rw-r--r--core/math/geometry.h17
-rw-r--r--core/math/math_funcs.h4
-rw-r--r--core/math/matrix3.cpp8
-rw-r--r--core/math/matrix3.h6
-rw-r--r--core/math/octree.h14
-rw-r--r--core/math/plane.cpp2
-rw-r--r--core/math/plane.h2
-rw-r--r--core/math/quat.cpp5
-rw-r--r--core/math/quat.h10
-rw-r--r--core/math/quick_hull.cpp3
-rw-r--r--core/math/quick_hull.h8
-rw-r--r--core/math/rect2.cpp2
-rw-r--r--core/math/rect2.h2
-rw-r--r--core/math/transform.cpp7
-rw-r--r--core/math/transform.h8
-rw-r--r--core/math/transform_2d.h2
-rw-r--r--core/math/triangle_mesh.cpp3
-rw-r--r--core/math/triangle_mesh.h5
-rw-r--r--core/math/triangulate.cpp2
-rw-r--r--core/math/triangulate.h2
-rw-r--r--core/math/vector2.h4
-rw-r--r--core/math/vector3.cpp3
-rw-r--r--core/math/vector3.h19
-rw-r--r--core/message_queue.cpp4
-rw-r--r--core/message_queue.h6
-rw-r--r--core/method_bind.cpp2
-rw-r--r--core/method_bind.h11
-rw-r--r--core/method_ptrcall.h6
-rw-r--r--core/node_path.cpp2
-rw-r--r--core/node_path.h5
-rw-r--r--core/oa_hash_map.h8
-rw-r--r--core/object.cpp16
-rw-r--r--core/object.h16
-rw-r--r--core/ordered_hash_map.h6
-rw-r--r--core/os/copymem.h2
-rw-r--r--core/os/dir_access.cpp9
-rw-r--r--core/os/dir_access.h6
-rw-r--r--core/os/file_access.cpp4
-rw-r--r--core/os/file_access.h9
-rw-r--r--core/os/input.cpp8
-rw-r--r--core/os/input.h6
-rw-r--r--core/os/input_event.cpp4
-rw-r--r--core/os/input_event.h11
-rw-r--r--core/os/keyboard.cpp3
-rw-r--r--core/os/keyboard.h7
-rw-r--r--core/os/main_loop.cpp3
-rw-r--r--core/os/main_loop.h8
-rw-r--r--core/os/memory.cpp6
-rw-r--r--core/os/memory.h3
-rw-r--r--core/os/midi_driver.cpp2
-rw-r--r--core/os/midi_driver.h3
-rw-r--r--core/os/mutex.cpp4
-rw-r--r--core/os/mutex.h2
-rw-r--r--core/os/os.cpp12
-rw-r--r--core/os/os.h17
-rw-r--r--core/os/rw_lock.cpp2
-rw-r--r--core/os/rw_lock.h2
-rw-r--r--core/os/semaphore.cpp3
-rw-r--r--core/os/semaphore.h3
-rw-r--r--core/os/shell.h4
-rw-r--r--core/os/thread.h6
-rw-r--r--core/os/thread_dummy.cpp2
-rw-r--r--core/os/thread_dummy.h8
-rw-r--r--core/os/thread_safe.cpp5
-rw-r--r--core/os/thread_safe.h2
-rw-r--r--core/os/threaded_array_processor.h10
-rw-r--r--core/packed_data_container.cpp4
-rw-r--r--core/packed_data_container.h2
-rw-r--r--core/pool_allocator.cpp8
-rw-r--r--core/pool_allocator.h2
-rw-r--r--core/print_string.cpp2
-rw-r--r--core/print_string.h2
-rw-r--r--core/project_settings.cpp23
-rw-r--r--core/project_settings.h7
-rw-r--r--core/ref_ptr.cpp4
-rw-r--r--core/ref_ptr.h2
-rw-r--r--core/reference.cpp2
-rw-r--r--core/reference.h8
-rw-r--r--core/register_core_types.cpp73
-rw-r--r--core/resource.cpp9
-rw-r--r--core/resource.h12
-rw-r--r--core/rid.h10
-rw-r--r--core/ring_buffer.h2
-rw-r--r--core/safe_refcount.h6
-rw-r--r--core/script_debugger_local.cpp4
-rw-r--r--core/script_debugger_local.h4
-rw-r--r--core/script_debugger_remote.cpp21
-rw-r--r--core/script_debugger_remote.h10
-rw-r--r--core/script_language.cpp3
-rw-r--r--core/script_language.h9
-rw-r--r--core/self_list.h2
-rw-r--r--core/set.h4
-rw-r--r--core/sort.h5
-rw-r--r--core/string_buffer.h3
-rw-r--r--core/string_db.cpp4
-rw-r--r--core/string_db.h6
-rw-r--r--core/translation.cpp6
-rw-r--r--core/translation.h2
-rw-r--r--core/typedefs.h7
-rw-r--r--core/undo_redo.cpp2
-rw-r--r--core/undo_redo.h4
-rw-r--r--core/ustring.cpp15
-rw-r--r--core/ustring.h16
-rw-r--r--core/variant.cpp12
-rw-r--r--core/variant.h34
-rw-r--r--core/variant_call.cpp10
-rw-r--r--core/variant_op.cpp6
-rw-r--r--core/variant_parser.cpp10
-rw-r--r--core/variant_parser.h6
-rw-r--r--core/vector.h9
-rw-r--r--core/version.h2
-rw-r--r--core/vmap.h4
-rw-r--r--core/vset.h4
-rw-r--r--doc/classes/@GDScript.xml2
-rw-r--r--doc/classes/Array.xml2
-rw-r--r--doc/classes/CanvasItem.xml6
-rw-r--r--doc/classes/ColorPicker.xml2
-rw-r--r--doc/classes/ColorPickerButton.xml2
-rw-r--r--doc/classes/Control.xml2
-rw-r--r--doc/classes/Curve.xml7
-rw-r--r--doc/classes/EditorFileSystemDirectory.xml2
-rw-r--r--doc/classes/Input.xml1
-rw-r--r--doc/classes/MainLoop.xml4
-rw-r--r--doc/classes/MultiMesh.xml26
-rw-r--r--doc/classes/Object.xml2
-rw-r--r--doc/classes/PoolByteArray.xml2
-rw-r--r--doc/classes/PoolColorArray.xml2
-rw-r--r--doc/classes/PoolIntArray.xml2
-rw-r--r--doc/classes/PoolRealArray.xml2
-rw-r--r--doc/classes/PoolStringArray.xml2
-rw-r--r--doc/classes/PoolVector2Array.xml2
-rw-r--r--doc/classes/PoolVector3Array.xml2
-rw-r--r--doc/classes/ProceduralSky.xml2
-rw-r--r--doc/classes/ProjectSettings.xml2
-rw-r--r--doc/classes/RemoteTransform.xml12
-rw-r--r--doc/classes/RemoteTransform2D.xml12
-rw-r--r--doc/classes/SceneTree.xml2
-rw-r--r--doc/classes/Shader.xml2
-rw-r--r--doc/classes/Spatial.xml6
-rw-r--r--doc/classes/StreamPeerTCP.xml2
-rw-r--r--doc/classes/Tree.xml2
-rwxr-xr-xdoc/tools/makerst.py222
-rw-r--r--drivers/alsa/audio_driver_alsa.cpp4
-rw-r--r--drivers/alsamidi/alsa_midi.cpp9
-rw-r--r--drivers/alsamidi/alsa_midi.h8
-rw-r--r--drivers/convex_decomp/b2d_decompose.h5
-rw-r--r--drivers/coreaudio/audio_driver_coreaudio.cpp3
-rw-r--r--drivers/coremidi/core_midi.cpp3
-rw-r--r--drivers/coremidi/core_midi.h7
-rw-r--r--drivers/dummy/rasterizer_dummy.h6
-rw-r--r--drivers/dummy/texture_loader_dummy.cpp4
-rw-r--r--drivers/gl_context/context_gl.h2
-rw-r--r--drivers/gles2/rasterizer_canvas_gles2.cpp9
-rw-r--r--drivers/gles2/rasterizer_gles2.cpp6
-rw-r--r--drivers/gles2/rasterizer_gles2.h1
-rw-r--r--drivers/gles2/rasterizer_scene_gles2.cpp13
-rw-r--r--drivers/gles2/rasterizer_scene_gles2.h1
-rw-r--r--drivers/gles2/rasterizer_storage_gles2.cpp9
-rw-r--r--drivers/gles2/rasterizer_storage_gles2.h5
-rw-r--r--drivers/gles2/shader_compiler_gles2.cpp7
-rw-r--r--drivers/gles2/shader_compiler_gles2.h6
-rw-r--r--drivers/gles2/shader_gles2.cpp10
-rw-r--r--drivers/gles2/shader_gles2.h15
-rw-r--r--drivers/gles3/rasterizer_canvas_gles3.cpp8
-rw-r--r--drivers/gles3/rasterizer_canvas_gles3.h1
-rw-r--r--drivers/gles3/rasterizer_gles3.cpp6
-rw-r--r--drivers/gles3/rasterizer_scene_gles3.cpp41
-rw-r--r--drivers/gles3/rasterizer_scene_gles3.h1
-rw-r--r--drivers/gles3/rasterizer_storage_gles3.cpp5
-rw-r--r--drivers/gles3/rasterizer_storage_gles3.h3
-rw-r--r--drivers/gles3/shader_compiler_gles3.cpp2
-rw-r--r--drivers/gles3/shader_compiler_gles3.h2
-rw-r--r--drivers/gles3/shader_gles3.cpp2
-rw-r--r--drivers/gles3/shader_gles3.h10
-rw-r--r--drivers/gles3/shaders/tonemap.glsl2
-rw-r--r--drivers/png/image_loader_png.cpp4
-rw-r--r--drivers/png/image_loader_png.h2
-rw-r--r--drivers/png/resource_saver_png.cpp4
-rw-r--r--drivers/png/resource_saver_png.h4
-rw-r--r--drivers/pulseaudio/audio_driver_pulseaudio.cpp6
-rw-r--r--drivers/rtaudio/audio_driver_rtaudio.cpp4
-rw-r--r--drivers/unix/dir_access_unix.cpp15
-rw-r--r--drivers/unix/dir_access_unix.h5
-rw-r--r--drivers/unix/file_access_unix.cpp3
-rw-r--r--drivers/unix/file_access_unix.h5
-rw-r--r--drivers/unix/ip_unix.h2
-rw-r--r--drivers/unix/mutex_posix.cpp3
-rw-r--r--drivers/unix/mutex_posix.h3
-rw-r--r--drivers/unix/net_socket_posix.cpp535
-rw-r--r--drivers/unix/net_socket_posix.h (renamed from drivers/windows/stream_peer_tcp_winsock.h)93
-rw-r--r--drivers/unix/os_unix.cpp28
-rw-r--r--drivers/unix/os_unix.h2
-rw-r--r--drivers/unix/packet_peer_udp_posix.cpp317
-rw-r--r--drivers/unix/rw_lock_posix.cpp4
-rw-r--r--drivers/unix/rw_lock_posix.h2
-rw-r--r--drivers/unix/semaphore_posix.cpp2
-rw-r--r--drivers/unix/semaphore_posix.h2
-rw-r--r--drivers/unix/stream_peer_tcp_posix.cpp411
-rw-r--r--drivers/unix/syslog_logger.cpp2
-rw-r--r--drivers/unix/syslog_logger.h4
-rw-r--r--drivers/unix/tcp_server_posix.cpp207
-rw-r--r--drivers/unix/thread_posix.cpp4
-rw-r--r--drivers/unix/thread_posix.h2
-rw-r--r--drivers/wasapi/audio_driver_wasapi.cpp9
-rw-r--r--drivers/windows/dir_access_windows.cpp4
-rw-r--r--drivers/windows/dir_access_windows.h2
-rw-r--r--drivers/windows/file_access_windows.h6
-rw-r--r--drivers/windows/mutex_windows.cpp3
-rw-r--r--drivers/windows/mutex_windows.h5
-rw-r--r--drivers/windows/packet_peer_udp_winsock.cpp298
-rw-r--r--drivers/windows/rw_lock_windows.cpp5
-rw-r--r--drivers/windows/rw_lock_windows.h3
-rw-r--r--drivers/windows/semaphore_windows.cpp2
-rw-r--r--drivers/windows/semaphore_windows.h4
-rw-r--r--drivers/windows/shell_windows.h4
-rw-r--r--drivers/windows/stream_peer_tcp_winsock.cpp375
-rw-r--r--drivers/windows/tcp_server_winsock.cpp189
-rw-r--r--drivers/windows/thread_windows.cpp2
-rw-r--r--drivers/windows/thread_windows.h13
-rw-r--r--drivers/winmidi/win_midi.cpp3
-rw-r--r--drivers/winmidi/win_midi.h6
-rw-r--r--drivers/xaudio2/audio_driver_xaudio2.cpp4
-rw-r--r--editor/animation_track_editor.cpp2
-rw-r--r--editor/audio_stream_preview.h2
-rw-r--r--editor/code_editor.cpp2
-rw-r--r--editor/collada/collada.h6
-rw-r--r--editor/connections_dialog.cpp7
-rw-r--r--editor/connections_dialog.h6
-rw-r--r--editor/create_dialog.cpp16
-rw-r--r--editor/dependency_editor.cpp4
-rw-r--r--editor/doc/doc_data.cpp16
-rw-r--r--editor/doc/doc_data.h6
-rw-r--r--editor/doc/doc_dump.cpp4
-rw-r--r--editor/doc/doc_dump.h2
-rw-r--r--editor/editor_asset_installer.cpp6
-rw-r--r--editor/editor_audio_buses.cpp4
-rw-r--r--editor/editor_autoload_settings.cpp4
-rw-r--r--editor/editor_data.cpp8
-rw-r--r--editor/editor_data.h6
-rw-r--r--editor/editor_dir_dialog.cpp4
-rw-r--r--editor/editor_dir_dialog.h2
-rw-r--r--editor/editor_export.cpp16
-rw-r--r--editor/editor_export.h4
-rw-r--r--editor/editor_file_dialog.cpp8
-rw-r--r--editor/editor_file_dialog.h2
-rw-r--r--editor/editor_file_system.cpp30
-rw-r--r--editor/editor_file_system.h8
-rw-r--r--editor/editor_help.cpp58
-rw-r--r--editor/editor_initialize_ssl.cpp4
-rw-r--r--editor/editor_inspector.cpp20
-rw-r--r--editor/editor_inspector.h3
-rw-r--r--editor/editor_log.cpp2
-rw-r--r--editor/editor_log.h2
-rw-r--r--editor/editor_name_dialog.cpp4
-rw-r--r--editor/editor_node.cpp28
-rw-r--r--editor/editor_plugin.h4
-rw-r--r--editor/editor_plugin_settings.cpp8
-rw-r--r--editor/editor_plugin_settings.h2
-rw-r--r--editor/editor_profiler.cpp2
-rw-r--r--editor/editor_properties.cpp10
-rw-r--r--editor/editor_resource_preview.cpp10
-rw-r--r--editor/editor_resource_preview.h4
-rw-r--r--editor/editor_run.cpp2
-rw-r--r--editor/editor_run.h2
-rw-r--r--editor/editor_run_script.h2
-rw-r--r--editor/editor_scale.cpp2
-rw-r--r--editor/editor_settings.h8
-rw-r--r--editor/editor_spin_slider.cpp6
-rw-r--r--editor/export_template_manager.cpp8
-rw-r--r--editor/file_type_cache.cpp4
-rw-r--r--editor/file_type_cache.h2
-rw-r--r--editor/fileserver/editor_file_server.cpp4
-rw-r--r--editor/fileserver/editor_file_server.h10
-rw-r--r--editor/filesystem_dock.cpp10
-rw-r--r--editor/filesystem_dock.h4
-rw-r--r--editor/find_in_files.cpp2
-rw-r--r--editor/groups_editor.h2
-rw-r--r--editor/icons/README.md2
-rw-r--r--editor/import/editor_import_collada.cpp2
-rw-r--r--editor/import/editor_import_plugin.h2
-rw-r--r--editor/import/editor_scene_importer_gltf.cpp14
-rw-r--r--editor/import/resource_importer_bitmask.cpp4
-rw-r--r--editor/import/resource_importer_bitmask.h4
-rw-r--r--editor/import/resource_importer_csv_translation.cpp8
-rw-r--r--editor/import/resource_importer_csv_translation.h2
-rw-r--r--editor/import/resource_importer_image.cpp6
-rw-r--r--editor/import/resource_importer_image.h4
-rw-r--r--editor/import/resource_importer_layered_texture.cpp6
-rw-r--r--editor/import/resource_importer_layered_texture.h4
-rw-r--r--editor/import/resource_importer_obj.cpp4
-rw-r--r--editor/import/resource_importer_scene.cpp2
-rw-r--r--editor/import/resource_importer_scene.h2
-rw-r--r--editor/import/resource_importer_texture.cpp6
-rw-r--r--editor/import/resource_importer_texture.h4
-rw-r--r--editor/import/resource_importer_wav.cpp6
-rw-r--r--editor/import/resource_importer_wav.h2
-rw-r--r--editor/inspector_dock.cpp4
-rw-r--r--editor/output_strings.h2
-rw-r--r--editor/plugins/animation_blend_space_1d_editor.cpp2
-rw-r--r--editor/plugins/animation_blend_space_2d_editor.cpp6
-rw-r--r--editor/plugins/animation_blend_tree_editor_plugin.cpp8
-rw-r--r--editor/plugins/animation_player_editor_plugin.cpp10
-rw-r--r--editor/plugins/animation_state_machine_editor.cpp8
-rw-r--r--editor/plugins/animation_tree_editor_plugin.cpp6
-rw-r--r--editor/plugins/animation_tree_player_editor_plugin.cpp4
-rw-r--r--editor/plugins/audio_stream_editor_plugin.cpp4
-rw-r--r--editor/plugins/canvas_item_editor_plugin.cpp571
-rw-r--r--editor/plugins/canvas_item_editor_plugin.h17
-rw-r--r--editor/plugins/collision_polygon_editor_plugin.cpp6
-rw-r--r--editor/plugins/curve_editor_plugin.cpp6
-rw-r--r--editor/plugins/editor_preview_plugins.cpp6
-rw-r--r--editor/plugins/item_list_editor_plugin.cpp24
-rw-r--r--editor/plugins/item_list_editor_plugin.h4
-rw-r--r--editor/plugins/light_occluder_2d_editor_plugin.cpp2
-rw-r--r--editor/plugins/particles_2d_editor_plugin.cpp2
-rw-r--r--editor/plugins/particles_editor_plugin.cpp2
-rw-r--r--editor/plugins/path_2d_editor_plugin.cpp4
-rw-r--r--editor/plugins/polygon_2d_editor_plugin.cpp6
-rw-r--r--editor/plugins/resource_preloader_editor_plugin.cpp4
-rw-r--r--editor/plugins/root_motion_editor_plugin.cpp4
-rw-r--r--editor/plugins/script_editor_plugin.cpp61
-rw-r--r--editor/plugins/script_editor_plugin.h2
-rw-r--r--editor/plugins/script_text_editor.cpp6
-rw-r--r--editor/plugins/shader_editor_plugin.cpp2
-rw-r--r--editor/plugins/sprite_frames_editor_plugin.cpp4
-rw-r--r--editor/plugins/text_editor.cpp2
-rw-r--r--editor/plugins/texture_editor_plugin.cpp4
-rw-r--r--editor/plugins/texture_region_editor_plugin.cpp4
-rw-r--r--editor/plugins/theme_editor_plugin.cpp4
-rw-r--r--editor/plugins/tile_map_editor_plugin.cpp4
-rw-r--r--editor/plugins/visual_shader_editor_plugin.cpp8
-rw-r--r--editor/progress_dialog.cpp4
-rw-r--r--editor/project_export.cpp16
-rw-r--r--editor/project_manager.cpp22
-rw-r--r--editor/project_settings_editor.cpp3
-rw-r--r--editor/property_editor.cpp2684
-rw-r--r--editor/property_editor.h174
-rw-r--r--editor/property_selector.cpp2
-rw-r--r--editor/pvrtc_compress.cpp8
-rw-r--r--editor/pvrtc_compress.h2
-rw-r--r--editor/quick_open.cpp2
-rw-r--r--editor/quick_open.h2
-rw-r--r--editor/rename_dialog.cpp2
-rw-r--r--editor/rename_dialog.h2
-rw-r--r--editor/reparent_dialog.cpp2
-rw-r--r--editor/scene_tree_dock.cpp19
-rw-r--r--editor/scene_tree_editor.cpp4
-rw-r--r--editor/scene_tree_editor.h2
-rw-r--r--editor/script_create_dialog.cpp17
-rw-r--r--editor/script_editor_debugger.cpp263
-rw-r--r--editor/script_editor_debugger.h18
-rw-r--r--editor/settings_config_dialog.cpp4
-rw-r--r--editor/spatial_editor_gizmos.cpp57
-rwxr-xr-xeditor/translations/extract.py2
-rw-r--r--main/input_default.cpp6
-rw-r--r--main/input_default.h2
-rw-r--r--main/main.cpp67
-rw-r--r--main/main.h4
-rw-r--r--main/main_builders.py4
-rw-r--r--main/performance.cpp6
-rw-r--r--main/performance.h2
-rw-r--r--main/tests/test_gdscript.cpp6
-rw-r--r--main/tests/test_gdscript.h2
-rw-r--r--main/tests/test_gui.cpp8
-rw-r--r--main/tests/test_gui.h2
-rw-r--r--main/tests/test_image.cpp8
-rw-r--r--main/tests/test_image.h2
-rw-r--r--main/tests/test_io.cpp14
-rw-r--r--main/tests/test_io.h2
-rw-r--r--main/tests/test_main.cpp4
-rw-r--r--main/tests/test_main.h4
-rw-r--r--main/tests/test_math.cpp24
-rw-r--r--main/tests/test_math.h2
-rw-r--r--main/tests/test_oa_hash_map.h2
-rw-r--r--main/tests/test_ordered_hash_map.cpp10
-rw-r--r--main/tests/test_physics.cpp12
-rw-r--r--main/tests/test_physics.h2
-rw-r--r--main/tests/test_physics_2d.cpp8
-rw-r--r--main/tests/test_physics_2d.h2
-rw-r--r--main/tests/test_render.cpp12
-rw-r--r--main/tests/test_render.h2
-rw-r--r--main/tests/test_shader_lang.cpp8
-rw-r--r--main/tests/test_shader_lang.h2
-rw-r--r--main/tests/test_string.cpp6
-rw-r--r--main/tests/test_string.h4
-rw-r--r--main/timer_sync.cpp2
-rw-r--r--modules/bmp/image_loader_bmp.h2
-rw-r--r--modules/bullet/SCsub2
-rw-r--r--modules/bullet/area_bullet.cpp7
-rw-r--r--modules/bullet/btRayShape.cpp2
-rw-r--r--modules/bullet/bullet_physics_server.cpp2
-rw-r--r--modules/bullet/bullet_physics_server.h4
-rw-r--r--modules/bullet/collision_object_bullet.h6
-rw-r--r--modules/bullet/godot_collision_dispatcher.h2
-rw-r--r--modules/bullet/godot_result_callbacks.h5
-rw-r--r--modules/bullet/register_types.cpp4
-rw-r--r--modules/bullet/rigid_body_bullet.cpp22
-rw-r--r--modules/bullet/shape_bullet.h2
-rw-r--r--modules/bullet/space_bullet.cpp4
-rw-r--r--modules/csg/csg.cpp18
-rw-r--r--modules/csg/csg.h16
-rw-r--r--modules/cvtt/image_compress_cvtt.cpp6
-rw-r--r--modules/cvtt/image_compress_cvtt.h2
-rw-r--r--modules/dds/texture_loader_dds.cpp2
-rw-r--r--modules/dds/texture_loader_dds.h2
-rw-r--r--modules/enet/doc_classes/NetworkedMultiplayerENet.xml2
-rw-r--r--modules/enet/networked_multiplayer_enet.cpp18
-rw-r--r--modules/enet/networked_multiplayer_enet.h4
-rw-r--r--modules/enet/register_types.cpp2
-rw-r--r--modules/etc/image_etc.cpp8
-rw-r--r--modules/etc/texture_loader_pkm.cpp2
-rw-r--r--modules/etc/texture_loader_pkm.h2
-rw-r--r--modules/freetype/SCsub2
-rw-r--r--modules/gdnative/gdnative.cpp12
-rw-r--r--modules/gdnative/gdnative.h10
-rw-r--r--modules/gdnative/gdnative/gdnative.cpp12
-rw-r--r--modules/gdnative/gdnative/pool_arrays.cpp4
-rw-r--r--modules/gdnative/nativescript/api_generator.cpp2
-rw-r--r--modules/gdnative/nativescript/godot_nativescript.cpp10
-rw-r--r--modules/gdnative/nativescript/nativescript.cpp8
-rw-r--r--modules/gdnative/nativescript/nativescript.h12
-rw-r--r--modules/gdnative/nativescript/register_types.cpp4
-rw-r--r--modules/gdnative/pluginscript/pluginscript_loader.cpp2
-rw-r--r--modules/gdnative/pluginscript/pluginscript_loader.h4
-rw-r--r--modules/gdnative/pluginscript/register_types.cpp8
-rw-r--r--modules/gdnative/register_types.cpp4
-rw-r--r--modules/gdscript/editor/gdscript_highlighter.cpp4
-rw-r--r--modules/gdscript/gdscript.cpp31
-rw-r--r--modules/gdscript/gdscript.h8
-rw-r--r--modules/gdscript/gdscript_compiler.cpp2
-rw-r--r--modules/gdscript/gdscript_editor.cpp8
-rw-r--r--modules/gdscript/gdscript_function.cpp2
-rw-r--r--modules/gdscript/gdscript_function.h14
-rw-r--r--modules/gdscript/gdscript_functions.cpp16
-rw-r--r--modules/gdscript/gdscript_functions.h2
-rw-r--r--modules/gdscript/gdscript_parser.cpp27
-rw-r--r--modules/gdscript/gdscript_parser.h6
-rw-r--r--modules/gdscript/gdscript_tokenizer.cpp6
-rw-r--r--modules/gdscript/gdscript_tokenizer.h8
-rw-r--r--modules/gdscript/register_types.cpp6
-rw-r--r--modules/gridmap/doc_classes/GridMap.xml2
-rw-r--r--modules/gridmap/grid_map.cpp6
-rw-r--r--modules/gridmap/grid_map_editor_plugin.cpp6
-rw-r--r--modules/gridmap/register_types.cpp2
-rw-r--r--modules/hdr/image_loader_hdr.cpp4
-rw-r--r--modules/hdr/image_loader_hdr.h2
-rw-r--r--modules/jpg/image_loader_jpegd.cpp4
-rw-r--r--modules/jpg/image_loader_jpegd.h2
-rwxr-xr-xmodules/mbedtls/stream_peer_mbed_tls.cpp2
-rwxr-xr-xmodules/mbedtls/stream_peer_mbed_tls.h2
-rw-r--r--modules/mono/SCsub44
-rw-r--r--modules/mono/csharp_script.cpp469
-rw-r--r--modules/mono/csharp_script.h40
-rw-r--r--modules/mono/editor/bindings_generator.cpp452
-rw-r--r--modules/mono/editor/bindings_generator.h10
-rw-r--r--modules/mono/editor/csharp_project.cpp4
-rw-r--r--modules/mono/editor/csharp_project.h2
-rw-r--r--modules/mono/editor/godotsharp_builds.cpp24
-rw-r--r--modules/mono/editor/mono_bottom_panel.cpp6
-rw-r--r--modules/mono/editor/monodevelop_instance.h2
-rw-r--r--modules/mono/editor/net_solution.cpp4
-rw-r--r--modules/mono/editor/net_solution.h4
-rw-r--r--modules/mono/glue/Managed/Files/AABB.cs (renamed from modules/mono/glue/cs_files/AABB.cs)72
-rw-r--r--modules/mono/glue/Managed/Files/Array.cs (renamed from modules/mono/glue/cs_files/Array.cs)83
-rw-r--r--modules/mono/glue/Managed/Files/Attributes/ExportAttribute.cs (renamed from modules/mono/glue/cs_files/Attributes/ExportAttribute.cs)0
-rw-r--r--modules/mono/glue/Managed/Files/Attributes/GodotMethodAttribute.cs (renamed from modules/mono/glue/cs_files/Attributes/GodotMethodAttribute.cs)0
-rw-r--r--modules/mono/glue/Managed/Files/Attributes/RPCAttributes.cs (renamed from modules/mono/glue/cs_files/Attributes/RPCAttributes.cs)0
-rw-r--r--modules/mono/glue/Managed/Files/Attributes/SignalAttribute.cs (renamed from modules/mono/glue/cs_files/Attributes/SignalAttribute.cs)0
-rw-r--r--modules/mono/glue/Managed/Files/Attributes/ToolAttribute.cs (renamed from modules/mono/glue/cs_files/Attributes/ToolAttribute.cs)0
-rw-r--r--modules/mono/glue/Managed/Files/Basis.cs (renamed from modules/mono/glue/cs_files/Basis.cs)90
-rw-r--r--modules/mono/glue/Managed/Files/Color.cs (renamed from modules/mono/glue/cs_files/Color.cs)28
-rw-r--r--modules/mono/glue/Managed/Files/DebuggingUtils.cs (renamed from modules/mono/glue/cs_files/DebuggingUtils.cs)0
-rw-r--r--modules/mono/glue/Managed/Files/Dictionary.cs (renamed from modules/mono/glue/cs_files/Dictionary.cs)90
-rw-r--r--modules/mono/glue/Managed/Files/Extensions/NodeExtensions.cs (renamed from modules/mono/glue/cs_files/Extensions/NodeExtensions.cs)0
-rw-r--r--modules/mono/glue/Managed/Files/Extensions/ObjectExtensions.cs (renamed from modules/mono/glue/cs_files/Extensions/ObjectExtensions.cs)6
-rw-r--r--modules/mono/glue/Managed/Files/Extensions/ResourceLoaderExtensions.cs (renamed from modules/mono/glue/cs_files/Extensions/ResourceLoaderExtensions.cs)0
-rw-r--r--modules/mono/glue/Managed/Files/GD.cs (renamed from modules/mono/glue/cs_files/GD.cs)78
-rw-r--r--modules/mono/glue/Managed/Files/GodotSynchronizationContext.cs25
-rw-r--r--modules/mono/glue/Managed/Files/GodotTaskScheduler.cs94
-rw-r--r--modules/mono/glue/Managed/Files/Interfaces/IAwaitable.cs (renamed from modules/mono/glue/cs_files/Interfaces/IAwaitable.cs)0
-rw-r--r--modules/mono/glue/Managed/Files/Interfaces/IAwaiter.cs (renamed from modules/mono/glue/cs_files/Interfaces/IAwaiter.cs)0
-rw-r--r--modules/mono/glue/Managed/Files/MarshalUtils.cs (renamed from modules/mono/glue/cs_files/MarshalUtils.cs)0
-rw-r--r--modules/mono/glue/Managed/Files/Mathf.cs (renamed from modules/mono/glue/cs_files/Mathf.cs)0
-rw-r--r--modules/mono/glue/Managed/Files/MathfEx.cs (renamed from modules/mono/glue/cs_files/MathfEx.cs)0
-rw-r--r--modules/mono/glue/Managed/Files/NodePath.cs147
-rw-r--r--modules/mono/glue/Managed/Files/Object.base.cs88
-rw-r--r--modules/mono/glue/Managed/Files/Plane.cs (renamed from modules/mono/glue/cs_files/Plane.cs)0
-rw-r--r--modules/mono/glue/Managed/Files/Quat.cs (renamed from modules/mono/glue/cs_files/Quat.cs)0
-rw-r--r--modules/mono/glue/Managed/Files/RID.cs76
-rw-r--r--modules/mono/glue/Managed/Files/Rect2.cs (renamed from modules/mono/glue/cs_files/Rect2.cs)0
-rw-r--r--modules/mono/glue/Managed/Files/SignalAwaiter.cs (renamed from modules/mono/glue/cs_files/SignalAwaiter.cs)9
-rw-r--r--modules/mono/glue/Managed/Files/StringExtensions.cs (renamed from modules/mono/glue/cs_files/StringExtensions.cs)235
-rw-r--r--modules/mono/glue/Managed/Files/Transform.cs (renamed from modules/mono/glue/cs_files/Transform.cs)0
-rw-r--r--modules/mono/glue/Managed/Files/Transform2D.cs (renamed from modules/mono/glue/cs_files/Transform2D.cs)0
-rw-r--r--modules/mono/glue/Managed/Files/Vector2.cs (renamed from modules/mono/glue/cs_files/Vector2.cs)0
-rw-r--r--modules/mono/glue/Managed/Files/Vector3.cs (renamed from modules/mono/glue/cs_files/Vector3.cs)0
-rw-r--r--modules/mono/glue/Managed/IgnoredFiles/Enums.cs21
-rw-r--r--modules/mono/glue/Managed/IgnoredFiles/FuncRef.cs17
-rw-r--r--modules/mono/glue/Managed/IgnoredFiles/Node.cs28
-rw-r--r--modules/mono/glue/Managed/IgnoredFiles/Resource.cs7
-rw-r--r--modules/mono/glue/Managed/IgnoredFiles/ResourceLoader.cs12
-rw-r--r--modules/mono/glue/Managed/IgnoredFiles/WeakRef.cs7
-rw-r--r--modules/mono/glue/Managed/Managed.csproj40
-rw-r--r--modules/mono/glue/Managed/Managed.sln17
-rw-r--r--modules/mono/glue/Managed/Properties/AssemblyInfo.cs26
-rw-r--r--modules/mono/glue/Managed/README.md5
-rw-r--r--modules/mono/glue/base_object_glue.cpp154
-rw-r--r--modules/mono/glue/base_object_glue.h59
-rw-r--r--modules/mono/glue/collections_glue.cpp5
-rw-r--r--modules/mono/glue/collections_glue.h4
-rw-r--r--modules/mono/glue/cs_files/GodotSynchronizationContext.cs25
-rw-r--r--modules/mono/glue/cs_files/GodotTaskScheduler.cs94
-rw-r--r--modules/mono/glue/gd_glue.cpp202
-rw-r--r--modules/mono/glue/gd_glue.h (renamed from drivers/unix/packet_peer_udp_posix.h)72
-rw-r--r--modules/mono/glue/glue_header.h306
-rw-r--r--modules/mono/glue/nodepath_glue.cpp (renamed from modules/mono/glue/builtin_types_glue.h)51
-rw-r--r--modules/mono/glue/nodepath_glue.h (renamed from drivers/windows/packet_peer_udp_winsock.h)65
-rw-r--r--modules/mono/glue/rid_glue.cpp61
-rw-r--r--modules/mono/glue/rid_glue.h (renamed from drivers/unix/tcp_server_posix.h)35
-rw-r--r--modules/mono/glue/string_glue.cpp79
-rw-r--r--modules/mono/glue/string_glue.h56
-rw-r--r--modules/mono/godotsharp_dirs.cpp8
-rw-r--r--modules/mono/godotsharp_dirs.h2
-rw-r--r--modules/mono/mono_gc_handle.cpp20
-rw-r--r--modules/mono/mono_gc_handle.h9
-rw-r--r--modules/mono/mono_gd/gd_mono.cpp184
-rw-r--r--modules/mono/mono_gd/gd_mono.h22
-rw-r--r--modules/mono/mono_gd/gd_mono_assembly.h6
-rw-r--r--modules/mono/mono_gd/gd_mono_class.h4
-rw-r--r--modules/mono/mono_gd/gd_mono_header.h2
-rw-r--r--modules/mono/mono_gd/gd_mono_log.cpp4
-rw-r--r--modules/mono/mono_gd/gd_mono_log.h2
-rw-r--r--modules/mono/mono_gd/gd_mono_marshal.h2
-rw-r--r--modules/mono/mono_gd/gd_mono_utils.cpp83
-rw-r--r--modules/mono/mono_gd/gd_mono_utils.h8
-rw-r--r--modules/mono/register_types.cpp2
-rw-r--r--modules/mono/signal_awaiter_utils.cpp2
-rw-r--r--modules/mono/signal_awaiter_utils.h2
-rw-r--r--modules/mono/utils/mono_reg_utils.cpp2
-rw-r--r--modules/mono/utils/mono_reg_utils.h2
-rw-r--r--modules/mono/utils/path_utils.cpp8
-rw-r--r--modules/mono/utils/path_utils.h2
-rw-r--r--modules/mono/utils/string_utils.h4
-rw-r--r--modules/opus/audio_stream_opus.cpp4
-rw-r--r--modules/opus/audio_stream_opus.h4
-rw-r--r--modules/pvr/texture_loader_pvr.cpp2
-rw-r--r--modules/pvr/texture_loader_pvr.h2
-rw-r--r--modules/recast/navigation_mesh_editor_plugin.cpp4
-rw-r--r--modules/recast/navigation_mesh_generator.h2
-rw-r--r--modules/regex/register_types.cpp2
-rw-r--r--modules/squish/image_compress_squish.cpp2
-rw-r--r--modules/squish/image_compress_squish.h2
-rw-r--r--modules/stb_vorbis/audio_stream_ogg_vorbis.cpp2
-rw-r--r--modules/stb_vorbis/audio_stream_ogg_vorbis.h2
-rw-r--r--modules/stb_vorbis/resource_importer_ogg_vorbis.cpp4
-rw-r--r--modules/stb_vorbis/resource_importer_ogg_vorbis.h2
-rw-r--r--modules/svg/image_loader_svg.cpp7
-rw-r--r--modules/svg/image_loader_svg.h4
-rw-r--r--modules/tga/image_loader_tga.cpp4
-rw-r--r--modules/tga/image_loader_tga.h2
-rw-r--r--modules/thekla_unwrap/register_types.cpp2
-rw-r--r--modules/theora/video_stream_theora.cpp4
-rw-r--r--modules/theora/video_stream_theora.h10
-rw-r--r--modules/tinyexr/image_loader_tinyexr.cpp4
-rw-r--r--modules/tinyexr/image_loader_tinyexr.h2
-rw-r--r--modules/upnp/doc_classes/UPNP.xml2
-rw-r--r--modules/upnp/register_types.cpp4
-rw-r--r--modules/upnp/upnp.cpp6
-rw-r--r--modules/upnp/upnp.h6
-rw-r--r--modules/upnp/upnpdevice.cpp4
-rw-r--r--modules/upnp/upnpdevice.h2
-rw-r--r--modules/visual_script/register_types.cpp2
-rw-r--r--modules/visual_script/visual_script.cpp4
-rw-r--r--modules/visual_script/visual_script.h4
-rw-r--r--modules/visual_script/visual_script_builtin_funcs.cpp14
-rw-r--r--modules/visual_script/visual_script_editor.cpp26
-rw-r--r--modules/visual_script/visual_script_editor.h4
-rw-r--r--modules/visual_script/visual_script_flow_control.cpp6
-rw-r--r--modules/visual_script/visual_script_func_nodes.cpp6
-rw-r--r--modules/visual_script/visual_script_nodes.cpp10
-rw-r--r--modules/visual_script/visual_script_property_selector.cpp2
-rw-r--r--modules/visual_script/visual_script_yield_nodes.cpp2
-rw-r--r--modules/vorbis/audio_stream_ogg_vorbis.h6
-rw-r--r--modules/webm/video_stream_webm.cpp6
-rw-r--r--modules/webm/video_stream_webm.h2
-rw-r--r--modules/webp/image_loader_webp.cpp6
-rw-r--r--modules/webp/image_loader_webp.h2
-rw-r--r--modules/websocket/doc_classes/WebSocketClient.xml2
-rw-r--r--modules/websocket/register_types.cpp2
-rw-r--r--platform/android/audio_driver_jandroid.cpp4
-rw-r--r--platform/android/audio_driver_opensl.h2
-rw-r--r--platform/android/dir_access_android.h2
-rw-r--r--platform/android/dir_access_jandroid.cpp2
-rw-r--r--platform/android/dir_access_jandroid.h2
-rw-r--r--platform/android/export/export.cpp28
-rw-r--r--platform/android/file_access_android.cpp2
-rw-r--r--platform/android/file_access_android.h2
-rw-r--r--platform/android/file_access_jandroid.cpp2
-rw-r--r--platform/android/file_access_jandroid.h2
-rw-r--r--platform/android/globals/global_defaults.cpp2
-rw-r--r--platform/android/godot_android.cpp4
-rw-r--r--platform/android/java/src/org/godotengine/godot/Godot.java23
-rw-r--r--platform/android/java_class_wrapper.h2
-rw-r--r--platform/android/java_glue.cpp23
-rw-r--r--platform/android/os_android.cpp27
-rw-r--r--platform/android/os_android.h17
-rw-r--r--platform/android/power_android.h2
-rw-r--r--platform/android/thread_jandroid.cpp4
-rw-r--r--platform/android/thread_jandroid.h2
-rw-r--r--platform/haiku/audio_driver_media_kit.cpp2
-rw-r--r--platform/haiku/haiku_direct_window.cpp2
-rw-r--r--platform/haiku/key_mapping_haiku.cpp2
-rw-r--r--platform/iphone/export/export.cpp14
-rw-r--r--platform/iphone/globals/global_defaults.cpp2
-rw-r--r--platform/iphone/godot_iphone.cpp2
-rw-r--r--platform/iphone/os_iphone.h2
-rw-r--r--platform/iphone/platform_refcount.h2
-rw-r--r--platform/iphone/sem_iphone.cpp2
-rw-r--r--platform/iphone/sem_iphone.h2
-rw-r--r--platform/javascript/api/api.cpp2
-rw-r--r--platform/javascript/api/javascript_eval.h2
-rw-r--r--platform/javascript/dom_keys.inc2
-rw-r--r--platform/javascript/export/export.cpp2
-rw-r--r--platform/javascript/http_client_javascript.cpp2
-rw-r--r--platform/javascript/javascript_main.cpp2
-rw-r--r--platform/javascript/os_javascript.cpp4
-rw-r--r--platform/osx/crash_handler_osx.mm2
-rw-r--r--platform/osx/dir_access_osx.h2
-rw-r--r--platform/osx/export/export.cpp14
-rw-r--r--platform/osx/os_osx.h2
-rw-r--r--platform/osx/os_osx.mm6
-rw-r--r--platform/osx/power_osx.h4
-rw-r--r--platform/osx/sem_osx.cpp2
-rw-r--r--platform/osx/sem_osx.h2
-rw-r--r--platform/server/os_server.cpp2
-rw-r--r--platform/uwp/export/export.cpp14
-rw-r--r--platform/uwp/gl_context_egl.h4
-rw-r--r--platform/uwp/os_uwp.cpp14
-rw-r--r--platform/uwp/os_uwp.h6
-rw-r--r--platform/uwp/power_uwp.h6
-rw-r--r--platform/uwp/thread_uwp.cpp2
-rw-r--r--platform/uwp/thread_uwp.h2
-rw-r--r--platform/windows/context_gl_win.h4
-rw-r--r--platform/windows/crash_handler_win.cpp2
-rw-r--r--platform/windows/detect.py4
-rw-r--r--platform/windows/export/export.cpp4
-rw-r--r--platform/windows/key_mapping_win.cpp2
-rw-r--r--platform/windows/key_mapping_win.h2
-rw-r--r--platform/windows/os_windows.cpp26
-rw-r--r--platform/windows/os_windows.h6
-rw-r--r--platform/windows/power_windows.h6
-rw-r--r--platform/windows/windows_terminal_logger.h4
-rw-r--r--platform/x11/context_gl_x11.h2
-rw-r--r--platform/x11/crash_handler_x11.cpp4
-rw-r--r--platform/x11/joypad_linux.h4
-rw-r--r--platform/x11/key_mapping_x11.h2
-rw-r--r--platform/x11/os_x11.cpp63
-rw-r--r--platform/x11/os_x11.h3
-rw-r--r--platform/x11/power_x11.h6
-rw-r--r--scene/2d/animated_sprite.cpp2
-rw-r--r--scene/2d/area_2d.h2
-rw-r--r--scene/2d/audio_stream_player_2d.cpp2
-rw-r--r--scene/2d/canvas_item.cpp4
-rw-r--r--scene/2d/canvas_item.h2
-rw-r--r--scene/2d/collision_polygon_2d.cpp2
-rw-r--r--scene/2d/collision_shape_2d.cpp2
-rw-r--r--scene/2d/cpu_particles_2d.h2
-rw-r--r--scene/2d/joints_2d.cpp2
-rw-r--r--scene/2d/light_2d.cpp2
-rw-r--r--scene/2d/light_occluder_2d.cpp2
-rw-r--r--scene/2d/line_2d.cpp2
-rw-r--r--scene/2d/line_builder.h4
-rw-r--r--scene/2d/navigation_polygon.cpp4
-rw-r--r--scene/2d/node_2d.cpp2
-rw-r--r--scene/2d/parallax_layer.cpp2
-rw-r--r--scene/2d/particles_2d.h2
-rw-r--r--scene/2d/path_2d.cpp2
-rw-r--r--scene/2d/physics_body_2d.cpp4
-rw-r--r--scene/2d/physics_body_2d.h2
-rw-r--r--scene/2d/position_2d.cpp2
-rw-r--r--scene/2d/ray_cast_2d.cpp2
-rw-r--r--scene/2d/screen_button.cpp6
-rw-r--r--scene/2d/sprite.cpp2
-rw-r--r--scene/2d/tile_map.cpp6
-rw-r--r--scene/2d/tile_map.h4
-rw-r--r--scene/2d/visibility_notifier_2d.cpp2
-rw-r--r--scene/3d/area.h2
-rw-r--r--scene/3d/audio_stream_player_3d.cpp2
-rw-r--r--scene/3d/baked_lightmap.cpp6
-rw-r--r--scene/3d/camera.cpp4
-rw-r--r--scene/3d/collision_shape.cpp2
-rw-r--r--scene/3d/cpu_particles.h2
-rw-r--r--scene/3d/interpolated_camera.cpp2
-rw-r--r--scene/3d/light.cpp6
-rw-r--r--scene/3d/mesh_instance.cpp2
-rw-r--r--scene/3d/particles.h2
-rw-r--r--scene/3d/path.cpp2
-rw-r--r--scene/3d/physics_body.cpp4
-rw-r--r--scene/3d/physics_body.h2
-rw-r--r--scene/3d/portal.cpp2
-rw-r--r--scene/3d/proximity_group.cpp2
-rw-r--r--scene/3d/ray_cast.cpp2
-rw-r--r--scene/3d/room_instance.cpp4
-rw-r--r--scene/3d/skeleton.cpp2
-rw-r--r--scene/3d/skeleton.h2
-rw-r--r--scene/3d/soft_body.cpp2
-rw-r--r--scene/3d/spatial.cpp4
-rw-r--r--scene/3d/spatial_velocity_tracker.cpp2
-rw-r--r--scene/3d/spring_arm.cpp2
-rw-r--r--scene/3d/sprite_3d.cpp2
-rw-r--r--scene/3d/vehicle_body.cpp2
-rw-r--r--scene/3d/visibility_notifier.cpp2
-rw-r--r--scene/3d/visual_instance.h4
-rw-r--r--scene/3d/voxel_light_baker.cpp4
-rw-r--r--scene/animation/animation_blend_space_2d.cpp2
-rw-r--r--scene/animation/animation_node_state_machine.cpp2
-rw-r--r--scene/animation/animation_player.cpp65
-rw-r--r--scene/animation/animation_tree.cpp11
-rw-r--r--scene/animation/root_motion_view.cpp2
-rw-r--r--scene/animation/tween.cpp7
-rw-r--r--scene/animation/tween_interpolaters.cpp6
-rw-r--r--scene/audio/audio_player.cpp2
-rw-r--r--scene/gui/base_button.cpp2
-rw-r--r--scene/gui/button.cpp2
-rw-r--r--scene/gui/check_button.cpp2
-rw-r--r--scene/gui/color_picker.cpp6
-rw-r--r--scene/gui/container.cpp2
-rw-r--r--scene/gui/control.cpp12
-rw-r--r--scene/gui/control.h6
-rw-r--r--scene/gui/dialogs.cpp4
-rw-r--r--scene/gui/file_dialog.cpp4
-rw-r--r--scene/gui/file_dialog.h2
-rw-r--r--scene/gui/gradient_edit.cpp2
-rw-r--r--scene/gui/graph_edit.cpp6
-rw-r--r--scene/gui/graph_node.cpp3
-rw-r--r--scene/gui/item_list.cpp4
-rw-r--r--scene/gui/label.cpp6
-rw-r--r--scene/gui/line_edit.cpp10
-rw-r--r--scene/gui/menu_button.cpp2
-rw-r--r--scene/gui/option_button.cpp2
-rw-r--r--scene/gui/panel.cpp2
-rw-r--r--scene/gui/popup.cpp4
-rw-r--r--scene/gui/popup_menu.cpp8
-rw-r--r--scene/gui/reference_rect.cpp2
-rw-r--r--scene/gui/rich_text_label.cpp26
-rw-r--r--scene/gui/scroll_bar.cpp6
-rw-r--r--scene/gui/scroll_container.cpp2
-rw-r--r--scene/gui/shortcut.cpp2
-rw-r--r--scene/gui/shortcut.h4
-rw-r--r--scene/gui/slider.cpp2
-rw-r--r--scene/gui/spin_box.cpp2
-rw-r--r--scene/gui/tab_container.cpp2
-rw-r--r--scene/gui/tabs.cpp2
-rw-r--r--scene/gui/text_edit.cpp104
-rw-r--r--scene/gui/text_edit.h2
-rw-r--r--scene/gui/texture_progress.cpp8
-rw-r--r--scene/gui/tree.cpp14
-rw-r--r--scene/gui/tree.h2
-rw-r--r--scene/gui/video_player.cpp2
-rw-r--r--scene/main/http_request.cpp17
-rw-r--r--scene/main/http_request.h6
-rw-r--r--scene/main/instance_placeholder.cpp2
-rw-r--r--scene/main/node.cpp6
-rw-r--r--scene/main/node.h12
-rw-r--r--scene/main/scene_tree.cpp14
-rw-r--r--scene/main/scene_tree.h8
-rwxr-xr-xscene/main/timer.cpp2
-rw-r--r--scene/main/viewport.cpp6
-rw-r--r--scene/main/viewport.h2
-rw-r--r--scene/resources/animation.cpp4
-rw-r--r--scene/resources/animation.h2
-rw-r--r--scene/resources/audio_stream_sample.cpp4
-rw-r--r--scene/resources/bit_mask.cpp2
-rw-r--r--scene/resources/bit_mask.h6
-rw-r--r--scene/resources/bounds.h4
-rw-r--r--scene/resources/canvas.h2
-rw-r--r--scene/resources/color_ramp.cpp2
-rw-r--r--scene/resources/color_ramp.h2
-rw-r--r--scene/resources/convex_polygon_shape.cpp2
-rw-r--r--scene/resources/convex_polygon_shape_2d.cpp2
-rw-r--r--scene/resources/curve.cpp3
-rw-r--r--scene/resources/curve.h2
-rw-r--r--scene/resources/default_theme/default_theme.cpp2
-rw-r--r--scene/resources/dynamic_font.cpp4
-rw-r--r--scene/resources/dynamic_font.h8
-rw-r--r--scene/resources/dynamic_font_stb.cpp2
-rw-r--r--scene/resources/dynamic_font_stb.h2
-rw-r--r--scene/resources/environment.cpp2
-rw-r--r--scene/resources/environment.h2
-rw-r--r--scene/resources/font.cpp2
-rw-r--r--scene/resources/font.h4
-rw-r--r--scene/resources/material.h4
-rw-r--r--scene/resources/mesh.cpp40
-rw-r--r--scene/resources/mesh.h9
-rw-r--r--scene/resources/mesh_library.h4
-rw-r--r--scene/resources/packed_scene.cpp6
-rw-r--r--scene/resources/packed_scene.h2
-rw-r--r--scene/resources/particles_material.cpp4
-rw-r--r--scene/resources/particles_material.h2
-rw-r--r--scene/resources/physics_material.h2
-rw-r--r--scene/resources/polygon_path_finder.cpp2
-rw-r--r--scene/resources/polygon_path_finder.h2
-rw-r--r--scene/resources/primitive_meshes.cpp2
-rw-r--r--scene/resources/room.h4
-rw-r--r--scene/resources/scene_format_text.cpp20
-rw-r--r--scene/resources/scene_format_text.h8
-rw-r--r--scene/resources/shader.cpp2
-rw-r--r--scene/resources/shader.h6
-rw-r--r--scene/resources/shape.cpp2
-rw-r--r--scene/resources/shape.h2
-rw-r--r--scene/resources/shape_2d.h2
-rw-r--r--scene/resources/sky_box.cpp2
-rw-r--r--scene/resources/sky_box.h2
-rw-r--r--scene/resources/space_2d.h2
-rw-r--r--scene/resources/style_box.h2
-rw-r--r--scene/resources/surface_tool.cpp3
-rw-r--r--scene/resources/text_file.cpp2
-rw-r--r--scene/resources/text_file.h4
-rw-r--r--scene/resources/texture.cpp7
-rw-r--r--scene/resources/texture.h12
-rw-r--r--scene/resources/theme.cpp4
-rw-r--r--scene/resources/theme.h4
-rw-r--r--scene/resources/tile_set.cpp2
-rw-r--r--scene/resources/tile_set.h2
-rw-r--r--scene/resources/visual_shader.cpp2
-rw-r--r--scene/resources/visual_shader.h2
-rw-r--r--scene/resources/world.cpp4
-rw-r--r--scene/resources/world.h2
-rw-r--r--scene/resources/world_2d.cpp2
-rw-r--r--scene/resources/world_2d.h4
-rw-r--r--scene/scene_string_names.h4
-rw-r--r--servers/arvr/arvr_interface.h2
-rw-r--r--servers/arvr/arvr_positional_tracker.h2
-rw-r--r--servers/arvr_server.cpp2
-rw-r--r--servers/arvr_server.h12
-rw-r--r--servers/audio/audio_driver_dummy.cpp4
-rw-r--r--servers/audio/audio_effect.h4
-rw-r--r--servers/audio/audio_filter_sw.h2
-rw-r--r--servers/audio/audio_rb_resampler.cpp2
-rw-r--r--servers/audio/audio_rb_resampler.h4
-rw-r--r--servers/audio/audio_stream.cpp4
-rw-r--r--servers/audio/audio_stream.h4
-rw-r--r--servers/audio/effects/audio_effect_chorus.cpp2
-rw-r--r--servers/audio/effects/audio_effect_delay.cpp2
-rw-r--r--servers/audio/effects/audio_effect_distortion.cpp2
-rw-r--r--servers/audio/effects/audio_effect_phaser.cpp2
-rw-r--r--servers/audio/effects/audio_effect_pitch_shift.cpp2
-rw-r--r--servers/audio/effects/audio_effect_record.h6
-rw-r--r--servers/audio/effects/eq.cpp4
-rw-r--r--servers/audio/effects/eq.h4
-rw-r--r--servers/audio/effects/reverb.cpp2
-rw-r--r--servers/audio/effects/reverb.h6
-rw-r--r--servers/audio/reverb_sw.cpp2
-rw-r--r--servers/audio/reverb_sw.h4
-rw-r--r--servers/audio/voice_rb_sw.h2
-rw-r--r--servers/audio_server.cpp8
-rw-r--r--servers/audio_server.h8
-rw-r--r--servers/physics/area_sw.h2
-rw-r--r--servers/physics/body_pair_sw.cpp2
-rw-r--r--servers/physics/body_sw.h2
-rw-r--r--servers/physics/broad_phase_basic.cpp4
-rw-r--r--servers/physics/broad_phase_basic.h2
-rw-r--r--servers/physics/broad_phase_octree.h2
-rw-r--r--servers/physics/broad_phase_sw.h4
-rw-r--r--servers/physics/collision_object_sw.h2
-rw-r--r--servers/physics/collision_solver_sat.cpp2
-rw-r--r--servers/physics/joints/jacobian_entry_sw.h2
-rw-r--r--servers/physics/physics_server_sw.cpp4
-rw-r--r--servers/physics/shape_sw.cpp6
-rw-r--r--servers/physics/shape_sw.h4
-rw-r--r--servers/physics/space_sw.cpp4
-rw-r--r--servers/physics/space_sw.h6
-rw-r--r--servers/physics/step_sw.cpp2
-rw-r--r--servers/physics_2d/area_2d_sw.h2
-rw-r--r--servers/physics_2d/body_2d_sw.h2
-rw-r--r--servers/physics_2d/broad_phase_2d_basic.h2
-rw-r--r--servers/physics_2d/broad_phase_2d_hash_grid.cpp2
-rw-r--r--servers/physics_2d/broad_phase_2d_hash_grid.h2
-rw-r--r--servers/physics_2d/broad_phase_2d_sw.h4
-rw-r--r--servers/physics_2d/collision_object_2d_sw.h2
-rw-r--r--servers/physics_2d/collision_solver_2d_sat.cpp2
-rw-r--r--servers/physics_2d/physics_2d_server_sw.cpp6
-rw-r--r--servers/physics_2d/physics_2d_server_wrap_mt.cpp2
-rw-r--r--servers/physics_2d/physics_2d_server_wrap_mt.h6
-rw-r--r--servers/physics_2d/shape_2d_sw.cpp4
-rw-r--r--servers/physics_2d/space_2d_sw.cpp4
-rw-r--r--servers/physics_2d/space_2d_sw.h6
-rw-r--r--servers/physics_2d/step_2d_sw.cpp2
-rw-r--r--servers/physics_2d_server.cpp27
-rw-r--r--servers/physics_2d_server.h6
-rw-r--r--servers/physics_server.cpp78
-rw-r--r--servers/physics_server.h4
-rw-r--r--servers/register_server_types.cpp6
-rw-r--r--servers/visual/rasterizer.cpp4
-rw-r--r--servers/visual/rasterizer.h4
-rw-r--r--servers/visual/shader_language.cpp4
-rw-r--r--servers/visual/shader_language.h12
-rw-r--r--servers/visual/shader_types.h2
-rw-r--r--servers/visual/visual_server_raster.cpp8
-rw-r--r--servers/visual/visual_server_raster.h4
-rw-r--r--servers/visual/visual_server_scene.cpp2
-rw-r--r--servers/visual/visual_server_scene.h12
-rw-r--r--servers/visual/visual_server_viewport.cpp4
-rw-r--r--servers/visual/visual_server_viewport.h2
-rw-r--r--servers/visual/visual_server_wrap_mt.cpp4
-rw-r--r--servers/visual/visual_server_wrap_mt.h4
-rw-r--r--servers/visual_server.cpp4
-rw-r--r--servers/visual_server.h14
-rw-r--r--thirdparty/README.md4
-rw-r--r--thirdparty/b2d_convexdecomp/b2Glue.h3
-rw-r--r--thirdparty/enet/godot.cpp9
-rw-r--r--thirdparty/libogg/ogg/config_types.h2
-rw-r--r--thirdparty/libwebsockets/plat/lws-plat-win.c20
-rw-r--r--thirdparty/libwebsockets/uwp_fixes.diff47
-rw-r--r--thirdparty/miniupnpc/miniupnpcstrings.h2
-rw-r--r--thirdparty/misc/aes256.h2
-rw-r--r--thirdparty/misc/hq2x.cpp2
-rw-r--r--thirdparty/misc/hq2x.h2
-rw-r--r--thirdparty/misc/md5.h2
-rw-r--r--thirdparty/misc/pcg.h2
-rw-r--r--thirdparty/misc/triangulator.h8
-rw-r--r--thirdparty/misc/yuv2rgb.h2
-rw-r--r--thirdparty/pvrtccompressor/BitScale.h2
-rw-r--r--thirdparty/zstd/1314.diff13
-rw-r--r--thirdparty/zstd/common/cpu.h2
1038 files changed, 7343 insertions, 9381 deletions
diff --git a/AUTHORS.md b/AUTHORS.md
index e1171392d5..9666145582 100644
--- a/AUTHORS.md
+++ b/AUTHORS.md
@@ -27,6 +27,7 @@ name is available.
(in alphabetical order, with 10 commits or more excluding merges)
+ Aaron Franke (aaronfranke)
Alexander Holland (AlexHolly)
Alexey Velikiy (jonyrock)
Alket Rexhepi (alketii)
@@ -48,6 +49,7 @@ name is available.
Daniel J. Ramirez (djrm)
Dmitry Koteroff (Krakean)
Emmanuel Leblond (touilleMan)
+ Eric Lasota (elasota)
est31
Fabio Alessandrelli (Faless)
Ferenc Arn (tagcup)
@@ -85,6 +87,7 @@ name is available.
Marcin Zawiejski (dragmz)
Mariano Javier Suligoy (MarianoGnu)
Mario Schlack (hurikhan)
+ Martin Capitanio (capnm)
Martin Sjursen (binbitten)
marynate
Masoud BH (masoudbh3)
diff --git a/COPYRIGHT.txt b/COPYRIGHT.txt
index 49c602eb84..cf08225a40 100644
--- a/COPYRIGHT.txt
+++ b/COPYRIGHT.txt
@@ -96,6 +96,11 @@ Copyright: 1997-2017, Sam Lantinga
2014-2018, Godot Engine contributors.
License: Expat and Zlib
+Files: ./scene/animation/tween_interpolaters.cpp
+Comment: Penner Easing
+Copyright: 2001, Robert Penner
+License: BSD-3-clause
+
Files: ./servers/physics/gjk_epa.cpp
./servers/physics/joints/generic_6dof_joint_sw.cpp
./servers/physics/joints/generic_6dof_joint_sw.h
diff --git a/DONORS.md b/DONORS.md
index 6153043318..41d24c5fbb 100644
--- a/DONORS.md
+++ b/DONORS.md
@@ -25,12 +25,10 @@ generous deed immortalized in the next stable release of Godot Engine.
Christian Uldall Pedersen
Christopher Igoe
Christoph Woinke
- E Hewert
GameDev.net
Hein-Pieter van Braam
Jamal Alyafei
Jay Sistar
- Loreshaper Games
Matthieu Huvé
Mike King
Nathan Warden
@@ -39,7 +37,6 @@ generous deed immortalized in the next stable release of Godot Engine.
Patrick Aarstad
rottis
Ruslan Mustakov
- Sébastien Manin
Slobodan Milnovic
Stephan Lanfermann
Stoney Meyerhoeffer
@@ -49,7 +46,6 @@ generous deed immortalized in the next stable release of Godot Engine.
## Gold donors
3Dexplorer
- Alexander Otto
Asdf
cheese65536
K9Kraken
@@ -62,17 +58,16 @@ generous deed immortalized in the next stable release of Godot Engine.
Allen Schade
Andreas Schüle
Austen McRae
+ Daniel Lynn
David Gehrig
- DeepSquid
- Fidget Sinner
Florian Breisch
Gary Oberbrunner
Johannes Wuensch
Josep G. Camarasa
Joshua Lesperance
+ Krzysztof Dluzniewski
Kyle Szklenski
- Libre-Dépanne
- Matthew Bennett
+ Mohammad Taleb
Paul LaMotte
Ranoller
Sergey
@@ -108,25 +103,23 @@ generous deed immortalized in the next stable release of Godot Engine.
Alexey Dyadchenko
Amanda Haldy
Anthony Ryan
+ Branwen Danielle Zakariasen
Chris Brown
Chris Petrich
- Chris Wilson
Cody Parker
- Corey Auger
D
Deadly Lampshade
E.G.
Eric
Eric Monson
+ Fidget Sinner
flesk
- floopf
G Barnes
GGGames.org
Giovanni Solimeno
Guilherme Felipe de C. G. da Silva
Hasen Judy
Heath Hayes
- Jan ÄŒejka
Jay Horton
Jeppe Zapp
joe513
@@ -134,15 +127,15 @@ generous deed immortalized in the next stable release of Godot Engine.
Justin Arnold
Lars Wuethrich
Leandro Voltolino
- Lisandro Lorea
Markus Wiesner
Marvin
- Mohammad Taleb
+ Nahuel Sacchetti
Neal Barry
Nick Nikitin
Pablo Cholaky
Patrick Schnorbus
Pete Goodwin
+ ray-tracer
Ruben Soares Luis
Rufus Xavier Sarsaparilla
Sindre Sømme
@@ -150,7 +143,8 @@ generous deed immortalized in the next stable release of Godot Engine.
Stoned Xander
Tim Dalporto
Trent McPheron
- Wyatt Walker
+ Wilfrid ARNOLD
+ WytRabbit
## Silver donors
@@ -168,6 +162,7 @@ generous deed immortalized in the next stable release of Godot Engine.
Artur Barichello
Aubrey Falconer
Avencherus
+ Bailey
Bastian Böhm
Benedikt
Benjamin Beshara
@@ -182,38 +177,36 @@ generous deed immortalized in the next stable release of Godot Engine.
Christian Baune
Christian Winter
Christopher Schmitt
+ Chris Wilson
Collin Shooltz
Daniel Johnson
Daniel Kaplan
DanielMaximiano
- Daniel Mircea
David
David Cravens
David May
Disktra
Dominik Wetzel
+ dRez Games
Duy Kevin Nguyen
Edward Herbert
Elias Nykrem
Eric Martini
+ Eugenio Hugo Salgüero Jáñez
+ Extarys
Fabian Becker
fengjiongmax
Francesco Lisi
G3Dev sàrl
Gerrit Großkopf
- Gerrit Procee
Gilberto K. Otubo
Greg Olson
- Guillaume Laforte
Guldoman
- Gumichan01
Heribert Hirth
Hunter Jones
ialex32x
- Ivan Vodopiviz
Jahn Johansen
Jaime Ruiz-Borau Vizárraga
- Jake Huxell
Jed
Jeff Hungerford
Joel Fivat
@@ -223,6 +216,7 @@ generous deed immortalized in the next stable release of Godot Engine.
Jonathan Martin
Jonathan Nieto
Jonathon
+ Jon Bonazza
Jon Sully
Josh 'Cheeseness' Bush
Juanfran
@@ -236,6 +230,7 @@ generous deed immortalized in the next stable release of Godot Engine.
Klavdij Voncina
Krzysztof Jankowski
Linus Lind Lundgren
+ Loreshaper Games
Luc Magitem
Luis Moraes
Macil
@@ -272,6 +267,7 @@ generous deed immortalized in the next stable release of Godot Engine.
Pierre-Igor Berthet
Pietro Vertechi
Piotr Kaczmarski
+ Prokhorenko Leonid
Rémi Verschelde
Richman Stewart
Roger Burgess
@@ -288,6 +284,7 @@ generous deed immortalized in the next stable release of Godot Engine.
Thomas Holmes
Thomas Kurz
tiansheng li
+ Tim
Tom Larrow
Tristan Crawford
Trym Nilsen
diff --git a/SConstruct b/SConstruct
index 3bbe97bfe7..3f3976555d 100644
--- a/SConstruct
+++ b/SConstruct
@@ -224,7 +224,7 @@ Help(opts.GenerateHelpText(env_base)) # generate help
# add default include paths
-env_base.Append(CPPPATH=['#core', '#core/math', '#editor', '#drivers', '#'])
+env_base.Append(CPPPATH=['#editor', '#drivers', '#'])
# configure ENV for platform
env_base.platform_exporters = platform_exporters
diff --git a/core/SCsub b/core/SCsub
index c8e2e10b9f..a6365bf925 100644
--- a/core/SCsub
+++ b/core/SCsub
@@ -18,7 +18,7 @@ for x in env.global_defaults:
gd_inc += '#include "platform/' + x + '/globals/global_defaults.h"\n'
gd_call += "\tregister_" + x + "_global_defaults();\n"
-gd_cpp = '#include "project_settings.h"\n'
+gd_cpp = '#include "core/project_settings.h"\n'
gd_cpp += gd_inc
gd_cpp += "void ProjectSettings::register_global_defaults() {\n" + gd_call + "\n}\n"
@@ -52,7 +52,7 @@ if ("SCRIPT_AES256_ENCRYPTION_KEY" in os.environ):
# NOTE: It is safe to generate this file here, since this is still executed serially
with open("script_encryption_key.gen.cpp", "w") as f:
- f.write("#include \"project_settings.h\"\nuint8_t script_encryption_key[32]={" + txt + "};\n")
+ f.write("#include \"core/project_settings.h\"\nuint8_t script_encryption_key[32]={" + txt + "};\n")
# Add required thirdparty code. Header paths are hardcoded, we don't need to append
diff --git a/core/allocators.h b/core/allocators.h
index e17ab298d6..840b117958 100644
--- a/core/allocators.h
+++ b/core/allocators.h
@@ -31,7 +31,8 @@
#ifndef ALLOCATORS_H
#define ALLOCATORS_H
-#include "os/memory.h"
+#include "core/os/memory.h"
+
template <int PREALLOC_COUNT = 64, int MAX_HANDS = 8>
class BalloonAllocator {
diff --git a/core/array.cpp b/core/array.cpp
index ebad0df126..9708452850 100644
--- a/core/array.cpp
+++ b/core/array.cpp
@@ -30,10 +30,10 @@
#include "array.h"
-#include "hashfuncs.h"
-#include "object.h"
-#include "variant.h"
-#include "vector.h"
+#include "core/hashfuncs.h"
+#include "core/object.h"
+#include "core/variant.h"
+#include "core/vector.h"
class ArrayPrivate {
public:
diff --git a/core/array.h b/core/array.h
index c824c9b4f7..fa5113a376 100644
--- a/core/array.h
+++ b/core/array.h
@@ -31,7 +31,8 @@
#ifndef ARRAY_H
#define ARRAY_H
-#include "typedefs.h"
+#include "core/typedefs.h"
+
class Variant;
class ArrayPrivate;
class Object;
diff --git a/core/bind/core_bind.cpp b/core/bind/core_bind.cpp
index 2bd271205a..57654e96dc 100644
--- a/core/bind/core_bind.cpp
+++ b/core/bind/core_bind.cpp
@@ -30,14 +30,14 @@
#include "core_bind.h"
+#include "core/io/file_access_compressed.h"
+#include "core/io/file_access_encrypted.h"
+#include "core/io/json.h"
+#include "core/io/marshalls.h"
+#include "core/math/geometry.h"
+#include "core/os/keyboard.h"
+#include "core/os/os.h"
#include "core/project_settings.h"
-#include "geometry.h"
-#include "io/file_access_compressed.h"
-#include "io/file_access_encrypted.h"
-#include "io/json.h"
-#include "io/marshalls.h"
-#include "os/keyboard.h"
-#include "os/os.h"
#include "thirdparty/misc/base64.h"
diff --git a/core/bind/core_bind.h b/core/bind/core_bind.h
index 21aea12b23..3a913e01ed 100644
--- a/core/bind/core_bind.h
+++ b/core/bind/core_bind.h
@@ -31,15 +31,15 @@
#ifndef CORE_BIND_H
#define CORE_BIND_H
-#include "image.h"
-#include "io/compression.h"
-#include "io/resource_loader.h"
-#include "io/resource_saver.h"
-#include "os/dir_access.h"
-#include "os/file_access.h"
-#include "os/os.h"
-#include "os/semaphore.h"
-#include "os/thread.h"
+#include "core/image.h"
+#include "core/io/compression.h"
+#include "core/io/resource_loader.h"
+#include "core/io/resource_saver.h"
+#include "core/os/dir_access.h"
+#include "core/os/file_access.h"
+#include "core/os/os.h"
+#include "core/os/semaphore.h"
+#include "core/os/thread.h"
class _ResourceLoader : public Object {
GDCLASS(_ResourceLoader, Object);
diff --git a/core/class_db.cpp b/core/class_db.cpp
index eceefa1ee4..dcc07f8f41 100644
--- a/core/class_db.cpp
+++ b/core/class_db.cpp
@@ -30,9 +30,9 @@
#include "class_db.h"
-#include "engine.h"
-#include "os/mutex.h"
-#include "version.h"
+#include "core/engine.h"
+#include "core/os/mutex.h"
+#include "core/version.h"
#define OBJTYPE_RLOCK RWLockRead _rw_lockr_(lock);
#define OBJTYPE_WLOCK RWLockWrite _rw_lockw_(lock);
diff --git a/core/class_db.h b/core/class_db.h
index 66a67f6c9f..11cc3033cf 100644
--- a/core/class_db.h
+++ b/core/class_db.h
@@ -31,16 +31,16 @@
#ifndef CLASS_DB_H
#define CLASS_DB_H
-#include "method_bind.h"
-#include "object.h"
-#include "print_string.h"
+#include "core/method_bind.h"
+#include "core/object.h"
+#include "core/print_string.h"
/**
@author Juan Linietsky <reduzio@gmail.com>
*/
/** To bind more then 6 parameters include this:
- * #include "method_bind_ext.gen.inc"
+ * #include "core/method_bind_ext.gen.inc"
*/
#define DEFVAL(m_defval) (m_defval)
diff --git a/core/color.cpp b/core/color.cpp
index 17c9e2daeb..55dd1ec6b9 100644
--- a/core/color.cpp
+++ b/core/color.cpp
@@ -30,10 +30,10 @@
#include "color.h"
-#include "color_names.inc"
-#include "map.h"
-#include "math_funcs.h"
-#include "print_string.h"
+#include "core/color_names.inc"
+#include "core/map.h"
+#include "core/math/math_funcs.h"
+#include "core/print_string.h"
uint32_t Color::to_argb32() const {
diff --git a/core/color.h b/core/color.h
index 00f4c9e9e8..add61343ff 100644
--- a/core/color.h
+++ b/core/color.h
@@ -31,8 +31,8 @@
#ifndef COLOR_H
#define COLOR_H
-#include "math_funcs.h"
-#include "ustring.h"
+#include "core/math/math_funcs.h"
+#include "core/ustring.h"
/**
@author Juan Linietsky <reduzio@gmail.com>
*/
diff --git a/core/color_names.inc b/core/color_names.inc
index 3ae42648d0..e126bfe0f8 100644
--- a/core/color_names.inc
+++ b/core/color_names.inc
@@ -1,5 +1,5 @@
// Names from https://en.wikipedia.org/wiki/List_of_colors (through https://raw.githubusercontent.com/SuperUserNameMan/color_to_name/616a7cddafefda91478b7bc26167de97fb5badb1/godot_version.gd), slightly edited and normalized
-#include "map.h"
+#include "core/map.h"
static Map<String, Color> _named_colors;
static void _populate_named_colors() {
diff --git a/core/command_queue_mt.cpp b/core/command_queue_mt.cpp
index a39c920dfa..1b3a74bd0d 100644
--- a/core/command_queue_mt.cpp
+++ b/core/command_queue_mt.cpp
@@ -30,7 +30,7 @@
#include "command_queue_mt.h"
-#include "os/os.h"
+#include "core/os/os.h"
void CommandQueueMT::lock() {
diff --git a/core/command_queue_mt.h b/core/command_queue_mt.h
index 7978eaa7bf..5911cf5006 100644
--- a/core/command_queue_mt.h
+++ b/core/command_queue_mt.h
@@ -31,11 +31,11 @@
#ifndef COMMAND_QUEUE_MT_H
#define COMMAND_QUEUE_MT_H
-#include "os/memory.h"
-#include "os/mutex.h"
-#include "os/semaphore.h"
-#include "simple_type.h"
-#include "typedefs.h"
+#include "core/os/memory.h"
+#include "core/os/mutex.h"
+#include "core/os/semaphore.h"
+#include "core/simple_type.h"
+#include "core/typedefs.h"
/**
@author Juan Linietsky <reduzio@gmail.com>
*/
diff --git a/core/compressed_translation.cpp b/core/compressed_translation.cpp
index 46df63066b..7dd5308fab 100644
--- a/core/compressed_translation.cpp
+++ b/core/compressed_translation.cpp
@@ -30,7 +30,7 @@
#include "compressed_translation.h"
-#include "pair.h"
+#include "core/pair.h"
extern "C" {
#include "thirdparty/misc/smaz.h"
diff --git a/core/compressed_translation.h b/core/compressed_translation.h
index ccc47d0bf6..b3d193b478 100644
--- a/core/compressed_translation.h
+++ b/core/compressed_translation.h
@@ -31,7 +31,7 @@
#ifndef COMPRESSED_TRANSLATION_H
#define COMPRESSED_TRANSLATION_H
-#include "translation.h"
+#include "core/translation.h"
class PHashTranslation : public Translation {
diff --git a/core/core_string_names.h b/core/core_string_names.h
index dcbce14aac..3fdb240408 100644
--- a/core/core_string_names.h
+++ b/core/core_string_names.h
@@ -31,7 +31,7 @@
#ifndef CORE_STRING_NAMES_H
#define CORE_STRING_NAMES_H
-#include "string_db.h"
+#include "core/string_db.h"
class CoreStringNames {
diff --git a/core/cowdata.h b/core/cowdata.h
index 6a8f644d53..9e75d4ed55 100644
--- a/core/cowdata.h
+++ b/core/cowdata.h
@@ -31,8 +31,8 @@
#ifndef COWDATA_H_
#define COWDATA_H_
-#include "os/memory.h"
-#include "safe_refcount.h"
+#include "core/os/memory.h"
+#include "core/safe_refcount.h"
template <class T>
class Vector;
diff --git a/core/dictionary.cpp b/core/dictionary.cpp
index 9cc913fa0d..ba32606819 100644
--- a/core/dictionary.cpp
+++ b/core/dictionary.cpp
@@ -30,9 +30,9 @@
#include "dictionary.h"
-#include "ordered_hash_map.h"
-#include "safe_refcount.h"
-#include "variant.h"
+#include "core/ordered_hash_map.h"
+#include "core/safe_refcount.h"
+#include "core/variant.h"
struct DictionaryPrivate {
diff --git a/core/dictionary.h b/core/dictionary.h
index dbf2233819..9950fb6361 100644
--- a/core/dictionary.h
+++ b/core/dictionary.h
@@ -31,9 +31,10 @@
#ifndef DICTIONARY_H
#define DICTIONARY_H
-#include "array.h"
-#include "list.h"
-#include "ustring.h"
+#include "core/array.h"
+#include "core/list.h"
+#include "core/ustring.h"
+
class Variant;
struct DictionaryPrivate;
diff --git a/core/dvector.h b/core/dvector.h
index e03a755e6c..0d0848a19a 100644
--- a/core/dvector.h
+++ b/core/dvector.h
@@ -31,12 +31,12 @@
#ifndef DVECTOR_H
#define DVECTOR_H
-#include "os/copymem.h"
-#include "os/memory.h"
-#include "os/rw_lock.h"
-#include "pool_allocator.h"
-#include "safe_refcount.h"
-#include "ustring.h"
+#include "core/os/copymem.h"
+#include "core/os/memory.h"
+#include "core/os/rw_lock.h"
+#include "core/pool_allocator.h"
+#include "core/safe_refcount.h"
+#include "core/ustring.h"
struct MemoryPool {
diff --git a/core/engine.cpp b/core/engine.cpp
index 7c8024b946..fceb602dcf 100644
--- a/core/engine.cpp
+++ b/core/engine.cpp
@@ -30,11 +30,11 @@
#include "engine.h"
-#include "authors.gen.h"
-#include "donors.gen.h"
-#include "license.gen.h"
-#include "version.h"
-#include "version_hash.gen.h"
+#include "core/authors.gen.h"
+#include "core/donors.gen.h"
+#include "core/license.gen.h"
+#include "core/version.h"
+#include "core/version_hash.gen.h"
void Engine::set_iterations_per_second(int p_ips) {
diff --git a/core/engine.h b/core/engine.h
index 031ba29cd6..b3c385c9f8 100644
--- a/core/engine.h
+++ b/core/engine.h
@@ -31,10 +31,10 @@
#ifndef ENGINE_H
#define ENGINE_H
-#include "list.h"
-#include "os/main_loop.h"
-#include "ustring.h"
-#include "vector.h"
+#include "core/list.h"
+#include "core/os/main_loop.h"
+#include "core/ustring.h"
+#include "core/vector.h"
class Engine {
diff --git a/core/error_macros.cpp b/core/error_macros.cpp
index 5786802930..c1a0dd0dfc 100644
--- a/core/error_macros.cpp
+++ b/core/error_macros.cpp
@@ -30,7 +30,7 @@
#include "error_macros.h"
-#include "io/logger.h"
+#include "core/io/logger.h"
#include "os/os.h"
bool _err_error_exists = false;
diff --git a/core/error_macros.h b/core/error_macros.h
index bee738ceea..8cec18d24f 100644
--- a/core/error_macros.h
+++ b/core/error_macros.h
@@ -31,7 +31,7 @@
#ifndef ERROR_MACROS_H
#define ERROR_MACROS_H
-#include "typedefs.h"
+#include "core/typedefs.h"
/**
* Error macros. Unlike exceptions and asserts, these macros try to maintain consistency and stability
* inside the code. It is recommended to always return processable data, so in case of an error, the
diff --git a/core/func_ref.h b/core/func_ref.h
index 681fe747d6..930c376abf 100644
--- a/core/func_ref.h
+++ b/core/func_ref.h
@@ -31,7 +31,7 @@
#ifndef FUNC_REF_H
#define FUNC_REF_H
-#include "reference.h"
+#include "core/reference.h"
class FuncRef : public Reference {
diff --git a/core/global_constants.cpp b/core/global_constants.cpp
index 962881e720..c70f960a66 100644
--- a/core/global_constants.cpp
+++ b/core/global_constants.cpp
@@ -30,10 +30,10 @@
#include "global_constants.h"
-#include "object.h"
-#include "os/input_event.h"
-#include "os/keyboard.h"
-#include "variant.h"
+#include "core/object.h"
+#include "core/os/input_event.h"
+#include "core/os/keyboard.h"
+#include "core/variant.h"
struct _GlobalConstant {
diff --git a/core/global_constants.h b/core/global_constants.h
index 76f618989c..48f16934a3 100644
--- a/core/global_constants.h
+++ b/core/global_constants.h
@@ -31,7 +31,7 @@
#ifndef GLOBAL_CONSTANTS_H
#define GLOBAL_CONSTANTS_H
-#include "string_db.h"
+#include "core/string_db.h"
class GlobalConstants {
public:
diff --git a/core/hash_map.h b/core/hash_map.h
index 2df743ba7d..8620edba73 100644
--- a/core/hash_map.h
+++ b/core/hash_map.h
@@ -31,12 +31,12 @@
#ifndef HASH_MAP_H
#define HASH_MAP_H
-#include "error_macros.h"
-#include "hashfuncs.h"
-#include "list.h"
-#include "math_funcs.h"
-#include "os/memory.h"
-#include "ustring.h"
+#include "core/error_macros.h"
+#include "core/hashfuncs.h"
+#include "core/list.h"
+#include "core/math/math_funcs.h"
+#include "core/os/memory.h"
+#include "core/ustring.h"
/**
* @class HashMap
diff --git a/core/hashfuncs.h b/core/hashfuncs.h
index 735e679d1e..457cfadc9c 100644
--- a/core/hashfuncs.h
+++ b/core/hashfuncs.h
@@ -31,12 +31,12 @@
#ifndef HASHFUNCS_H
#define HASHFUNCS_H
-#include "math_defs.h"
-#include "math_funcs.h"
-#include "node_path.h"
-#include "string_db.h"
-#include "typedefs.h"
-#include "ustring.h"
+#include "core/math/math_defs.h"
+#include "core/math/math_funcs.h"
+#include "core/node_path.h"
+#include "core/string_db.h"
+#include "core/typedefs.h"
+#include "core/ustring.h"
/**
* Hashing functions
diff --git a/core/helper/math_fieldwise.cpp b/core/helper/math_fieldwise.cpp
index ff3f8b3520..20b2341ab0 100644
--- a/core/helper/math_fieldwise.cpp
+++ b/core/helper/math_fieldwise.cpp
@@ -30,7 +30,7 @@
#ifdef TOOLS_ENABLED
-#include "core/helper/math_fieldwise.h"
+#include "math_fieldwise.h"
#define SETUP_TYPE(m_type) \
m_type source = p_source; \
diff --git a/core/image.cpp b/core/image.cpp
index 08bb9a35c3..c0002e0cd6 100644
--- a/core/image.cpp
+++ b/core/image.cpp
@@ -30,15 +30,15 @@
#include "image.h"
+#include "core/hash_map.h"
#include "core/io/image_loader.h"
+#include "core/io/resource_loader.h"
+#include "core/math/math_funcs.h"
#include "core/os/copymem.h"
-#include "hash_map.h"
-#include "math_funcs.h"
-#include "print_string.h"
+#include "core/print_string.h"
-#include "io/resource_loader.h"
-#include "math_funcs.h"
#include "thirdparty/misc/hq2x.h"
+
#include <stdio.h>
const char *Image::format_names[Image::FORMAT_MAX] = {
diff --git a/core/image.h b/core/image.h
index 6af55ca8d9..11f9380c3c 100644
--- a/core/image.h
+++ b/core/image.h
@@ -31,10 +31,10 @@
#ifndef IMAGE_H
#define IMAGE_H
-#include "color.h"
-#include "dvector.h"
-#include "rect2.h"
-#include "resource.h"
+#include "core/color.h"
+#include "core/dvector.h"
+#include "core/math/rect2.h"
+#include "core/resource.h"
/**
* @author Juan Linietsky <reduzio@gmail.com>
diff --git a/core/input_map.cpp b/core/input_map.cpp
index ffc8a39da5..51e3f311a9 100644
--- a/core/input_map.cpp
+++ b/core/input_map.cpp
@@ -30,8 +30,8 @@
#include "input_map.h"
-#include "os/keyboard.h"
-#include "project_settings.h"
+#include "core/os/keyboard.h"
+#include "core/project_settings.h"
InputMap *InputMap::singleton = NULL;
diff --git a/core/input_map.h b/core/input_map.h
index bdec75c65b..8f286277d1 100644
--- a/core/input_map.h
+++ b/core/input_map.h
@@ -31,8 +31,8 @@
#ifndef INPUT_MAP_H
#define INPUT_MAP_H
-#include "object.h"
-#include "os/input_event.h"
+#include "core/object.h"
+#include "core/os/input_event.h"
class InputMap : public Object {
diff --git a/core/io/compression.cpp b/core/io/compression.cpp
index bc3bfcf356..e456a85c65 100644
--- a/core/io/compression.cpp
+++ b/core/io/compression.cpp
@@ -29,9 +29,10 @@
/*************************************************************************/
#include "compression.h"
-#include "os/copymem.h"
-#include "project_settings.h"
-#include "zip_io.h"
+
+#include "core/io/zip_io.h"
+#include "core/os/copymem.h"
+#include "core/project_settings.h"
#include "thirdparty/misc/fastlz.h"
diff --git a/core/io/compression.h b/core/io/compression.h
index a0ccd539cb..2f770e6aee 100644
--- a/core/io/compression.h
+++ b/core/io/compression.h
@@ -31,7 +31,7 @@
#ifndef COMPRESSION_H
#define COMPRESSION_H
-#include "typedefs.h"
+#include "core/typedefs.h"
class Compression {
diff --git a/core/io/config_file.cpp b/core/io/config_file.cpp
index aa06ae5cc0..e2bc0f5d8f 100644
--- a/core/io/config_file.cpp
+++ b/core/io/config_file.cpp
@@ -29,9 +29,10 @@
/*************************************************************************/
#include "config_file.h"
-#include "os/file_access.h"
-#include "os/keyboard.h"
-#include "variant_parser.h"
+
+#include "core/os/file_access.h"
+#include "core/os/keyboard.h"
+#include "core/variant_parser.h"
PoolStringArray ConfigFile::_get_sections() const {
diff --git a/core/io/config_file.h b/core/io/config_file.h
index ac749bed76..2bc439d413 100644
--- a/core/io/config_file.h
+++ b/core/io/config_file.h
@@ -32,7 +32,7 @@
#define CONFIG_FILE_H
#include "core/ordered_hash_map.h"
-#include "reference.h"
+#include "core/reference.h"
class ConfigFile : public Reference {
diff --git a/core/io/file_access_buffered.cpp b/core/io/file_access_buffered.cpp
index dcaf99e24a..d44c8a9585 100644
--- a/core/io/file_access_buffered.cpp
+++ b/core/io/file_access_buffered.cpp
@@ -30,9 +30,7 @@
#include "file_access_buffered.h"
-#include <string.h>
-
-#include "error_macros.h"
+#include "core/error_macros.h"
Error FileAccessBuffered::set_error(Error p_error) const {
diff --git a/core/io/file_access_buffered.h b/core/io/file_access_buffered.h
index f4ed47d6bc..a36a9a4603 100644
--- a/core/io/file_access_buffered.h
+++ b/core/io/file_access_buffered.h
@@ -31,10 +31,9 @@
#ifndef FILE_ACCESS_BUFFERED_H
#define FILE_ACCESS_BUFFERED_H
-#include "os/file_access.h"
-
-#include "dvector.h"
-#include "ustring.h"
+#include "core/dvector.h"
+#include "core/os/file_access.h"
+#include "core/ustring.h"
class FileAccessBuffered : public FileAccess {
diff --git a/core/io/file_access_compressed.cpp b/core/io/file_access_compressed.cpp
index d6547ba19f..6290913503 100644
--- a/core/io/file_access_compressed.cpp
+++ b/core/io/file_access_compressed.cpp
@@ -29,7 +29,9 @@
/*************************************************************************/
#include "file_access_compressed.h"
-#include "print_string.h"
+
+#include "core/print_string.h"
+
void FileAccessCompressed::configure(const String &p_magic, Compression::Mode p_mode, int p_block_size) {
magic = p_magic.ascii().get_data();
diff --git a/core/io/file_access_compressed.h b/core/io/file_access_compressed.h
index 587f58a7c6..5be42a6d32 100644
--- a/core/io/file_access_compressed.h
+++ b/core/io/file_access_compressed.h
@@ -31,8 +31,8 @@
#ifndef FILE_ACCESS_COMPRESSED_H
#define FILE_ACCESS_COMPRESSED_H
-#include "io/compression.h"
-#include "os/file_access.h"
+#include "core/io/compression.h"
+#include "core/os/file_access.h"
class FileAccessCompressed : public FileAccess {
diff --git a/core/io/file_access_encrypted.cpp b/core/io/file_access_encrypted.cpp
index 812e881114..28bf55b962 100644
--- a/core/io/file_access_encrypted.cpp
+++ b/core/io/file_access_encrypted.cpp
@@ -30,9 +30,9 @@
#include "file_access_encrypted.h"
+#include "core/os/copymem.h"
+#include "core/print_string.h"
#include "core/variant.h"
-#include "os/copymem.h"
-#include "print_string.h"
#include "thirdparty/misc/aes256.h"
#include "thirdparty/misc/md5.h"
diff --git a/core/io/file_access_encrypted.h b/core/io/file_access_encrypted.h
index b9365a9fd0..873dbfa7e8 100644
--- a/core/io/file_access_encrypted.h
+++ b/core/io/file_access_encrypted.h
@@ -31,7 +31,7 @@
#ifndef FILE_ACCESS_ENCRYPTED_H
#define FILE_ACCESS_ENCRYPTED_H
-#include "os/file_access.h"
+#include "core/os/file_access.h"
class FileAccessEncrypted : public FileAccess {
public:
diff --git a/core/io/file_access_memory.cpp b/core/io/file_access_memory.cpp
index c4eb2848b1..4c2aa4294d 100644
--- a/core/io/file_access_memory.cpp
+++ b/core/io/file_access_memory.cpp
@@ -30,10 +30,10 @@
#include "file_access_memory.h"
-#include "map.h"
-#include "os/copymem.h"
-#include "os/dir_access.h"
-#include "project_settings.h"
+#include "core/map.h"
+#include "core/os/copymem.h"
+#include "core/os/dir_access.h"
+#include "core/project_settings.h"
static Map<String, Vector<uint8_t> > *files = NULL;
diff --git a/core/io/file_access_memory.h b/core/io/file_access_memory.h
index 2136f4cc0c..e474fb0d05 100644
--- a/core/io/file_access_memory.h
+++ b/core/io/file_access_memory.h
@@ -31,7 +31,7 @@
#ifndef FILE_ACCESS_MEMORY_H
#define FILE_ACCESS_MEMORY_H
-#include "os/file_access.h"
+#include "core/os/file_access.h"
class FileAccessMemory : public FileAccess {
diff --git a/core/io/file_access_network.cpp b/core/io/file_access_network.cpp
index d72d3ca9f1..6b6856dcc8 100644
--- a/core/io/file_access_network.cpp
+++ b/core/io/file_access_network.cpp
@@ -29,10 +29,11 @@
/*************************************************************************/
#include "file_access_network.h"
-#include "io/ip.h"
-#include "marshalls.h"
-#include "os/os.h"
-#include "project_settings.h"
+
+#include "core/io/ip.h"
+#include "core/io/marshalls.h"
+#include "core/os/os.h"
+#include "core/project_settings.h"
//#define DEBUG_PRINT(m_p) print_line(m_p)
//#define DEBUG_TIME(m_what) printf("MS: %s - %lli\n",m_what,OS::get_singleton()->get_ticks_usec());
@@ -226,7 +227,7 @@ FileAccessNetworkClient::FileAccessNetworkClient() {
quit = false;
singleton = this;
last_id = 0;
- client = Ref<StreamPeerTCP>(StreamPeerTCP::create_ref());
+ client.instance();
sem = Semaphore::create();
lockcount = 0;
}
diff --git a/core/io/file_access_network.h b/core/io/file_access_network.h
index be9bdb1af6..7e4669ffd5 100644
--- a/core/io/file_access_network.h
+++ b/core/io/file_access_network.h
@@ -31,10 +31,10 @@
#ifndef FILE_ACCESS_NETWORK_H
#define FILE_ACCESS_NETWORK_H
-#include "io/stream_peer_tcp.h"
-#include "os/file_access.h"
-#include "os/semaphore.h"
-#include "os/thread.h"
+#include "core/io/stream_peer_tcp.h"
+#include "core/os/file_access.h"
+#include "core/os/semaphore.h"
+#include "core/os/thread.h"
class FileAccessNetwork;
diff --git a/core/io/file_access_pack.cpp b/core/io/file_access_pack.cpp
index efb4c7a073..e3c8fb9eb8 100644
--- a/core/io/file_access_pack.cpp
+++ b/core/io/file_access_pack.cpp
@@ -29,7 +29,8 @@
/*************************************************************************/
#include "file_access_pack.h"
-#include "version.h"
+
+#include "core/version.h"
#include <stdio.h>
diff --git a/core/io/file_access_pack.h b/core/io/file_access_pack.h
index f29e431d9a..9e31bcf88a 100644
--- a/core/io/file_access_pack.h
+++ b/core/io/file_access_pack.h
@@ -31,11 +31,11 @@
#ifndef FILE_ACCESS_PACK_H
#define FILE_ACCESS_PACK_H
-#include "list.h"
-#include "map.h"
-#include "os/dir_access.h"
-#include "os/file_access.h"
-#include "print_string.h"
+#include "core/list.h"
+#include "core/map.h"
+#include "core/os/dir_access.h"
+#include "core/os/file_access.h"
+#include "core/print_string.h"
class PackSource;
diff --git a/core/io/file_access_zip.h b/core/io/file_access_zip.h
index df83575f6a..4fe0651a55 100644
--- a/core/io/file_access_zip.h
+++ b/core/io/file_access_zip.h
@@ -34,7 +34,7 @@
#define FILE_ACCESS_ZIP_H
#include "core/io/file_access_pack.h"
-#include "map.h"
+#include "core/map.h"
#include "thirdparty/minizip/unzip.h"
diff --git a/core/io/http_client.cpp b/core/io/http_client.cpp
index 2425bb6d69..de0b6860f9 100644
--- a/core/io/http_client.cpp
+++ b/core/io/http_client.cpp
@@ -29,8 +29,9 @@
/*************************************************************************/
#include "http_client.h"
-#include "io/stream_peer_ssl.h"
-#include "version.h"
+
+#include "core/io/stream_peer_ssl.h"
+#include "core/version.h"
const char *HTTPClient::_methods[METHOD_MAX] = {
"GET",
@@ -274,7 +275,7 @@ void HTTPClient::close() {
response_headers.clear();
response_str.clear();
- body_size = 0;
+ body_size = -1;
body_left = 0;
chunk_left = 0;
read_until_eof = false;
@@ -348,7 +349,7 @@ Error HTTPClient::poll() {
}
if (ssl->get_status() == StreamPeerSSL::STATUS_CONNECTED) {
- // Handshake has been successfull
+ // Handshake has been successful
handshaking = false;
status = STATUS_CONNECTED;
return OK;
@@ -403,7 +404,7 @@ Error HTTPClient::poll() {
String response;
response.parse_utf8((const char *)response_str.ptr());
Vector<String> responses = response.split("\n");
- body_size = 0;
+ body_size = -1;
chunked = false;
body_left = 0;
chunk_left = 0;
@@ -447,7 +448,7 @@ Error HTTPClient::poll() {
}
}
- if (body_size || chunked) {
+ if (body_size != -1 || chunked) {
status = STATUS_BODY;
} else if (!keep_alive) {
@@ -664,11 +665,24 @@ Error HTTPClient::_get_http_data(uint8_t *p_buffer, int p_bytes, int &r_received
if (blocking) {
- Error err = connection->get_data(p_buffer, p_bytes);
- if (err == OK)
- r_received = p_bytes;
- else
- r_received = 0;
+ // We can't use StreamPeer.get_data, since when reaching EOF we will get an
+ // error without knowing how many bytes we received.
+ Error err = ERR_FILE_EOF;
+ int read;
+ int left = p_bytes;
+ r_received = 0;
+ while (left > 0) {
+ err = connection->get_partial_data(p_buffer, left, read);
+ if (err == OK) {
+ r_received += read;
+ } else if (err == ERR_FILE_EOF) {
+ r_received += read;
+ return err;
+ } else {
+ return err;
+ }
+ left -= read;
+ }
return err;
} else {
return connection->get_partial_data(p_buffer, p_bytes, r_received);
@@ -682,11 +696,11 @@ void HTTPClient::set_read_chunk_size(int p_size) {
HTTPClient::HTTPClient() {
- tcp_connection = StreamPeerTCP::create_ref();
+ tcp_connection.instance();
resolving = IP::RESOLVER_INVALID_ID;
status = STATUS_DISCONNECTED;
conn_port = -1;
- body_size = 0;
+ body_size = -1;
chunked = false;
body_left = 0;
read_until_eof = false;
diff --git a/core/io/http_client.h b/core/io/http_client.h
index 82b56b01db..9e674e4c1d 100644
--- a/core/io/http_client.h
+++ b/core/io/http_client.h
@@ -31,10 +31,10 @@
#ifndef HTTP_CLIENT_H
#define HTTP_CLIENT_H
-#include "io/ip.h"
-#include "io/stream_peer.h"
-#include "io/stream_peer_tcp.h"
-#include "reference.h"
+#include "core/io/ip.h"
+#include "core/io/stream_peer.h"
+#include "core/io/stream_peer_tcp.h"
+#include "core/reference.h"
class HTTPClient : public Reference {
diff --git a/core/io/image_loader.cpp b/core/io/image_loader.cpp
index b8fd13d67c..f202320043 100644
--- a/core/io/image_loader.cpp
+++ b/core/io/image_loader.cpp
@@ -30,7 +30,8 @@
#include "image_loader.h"
-#include "print_string.h"
+#include "core/print_string.h"
+
bool ImageFormatLoader::recognize(const String &p_extension) const {
List<String> extensions;
diff --git a/core/io/image_loader.h b/core/io/image_loader.h
index fbb654c326..561f275e0c 100644
--- a/core/io/image_loader.h
+++ b/core/io/image_loader.h
@@ -31,11 +31,11 @@
#ifndef IMAGE_LOADER_H
#define IMAGE_LOADER_H
-#include "image.h"
-#include "io/resource_loader.h"
-#include "list.h"
-#include "os/file_access.h"
-#include "ustring.h"
+#include "core/image.h"
+#include "core/io/resource_loader.h"
+#include "core/list.h"
+#include "core/os/file_access.h"
+#include "core/ustring.h"
/**
@author Juan Linietsky <reduzio@gmail.com>
diff --git a/core/io/ip.cpp b/core/io/ip.cpp
index 82c94ca0b2..f56e850796 100644
--- a/core/io/ip.cpp
+++ b/core/io/ip.cpp
@@ -29,9 +29,10 @@
/*************************************************************************/
#include "ip.h"
-#include "hash_map.h"
-#include "os/semaphore.h"
-#include "os/thread.h"
+
+#include "core/hash_map.h"
+#include "core/os/semaphore.h"
+#include "core/os/thread.h"
VARIANT_ENUM_CAST(IP::ResolverStatus);
diff --git a/core/io/ip.h b/core/io/ip.h
index d55b05b6fe..967f04a4bd 100644
--- a/core/io/ip.h
+++ b/core/io/ip.h
@@ -31,8 +31,8 @@
#ifndef IP_H
#define IP_H
-#include "io/ip_address.h"
-#include "os/os.h"
+#include "core/io/ip_address.h"
+#include "core/os/os.h"
struct _IP_ResolverPrivate;
diff --git a/core/io/ip_address.h b/core/io/ip_address.h
index d7b031b960..607ce81ef4 100644
--- a/core/io/ip_address.h
+++ b/core/io/ip_address.h
@@ -31,7 +31,7 @@
#ifndef IP_ADDRESS_H
#define IP_ADDRESS_H
-#include "ustring.h"
+#include "core/ustring.h"
struct IP_Address {
diff --git a/core/io/json.cpp b/core/io/json.cpp
index 7b2c5a62df..26e18828e5 100644
--- a/core/io/json.cpp
+++ b/core/io/json.cpp
@@ -29,7 +29,8 @@
/*************************************************************************/
#include "json.h"
-#include "print_string.h"
+
+#include "core/print_string.h"
const char *JSON::tk_name[TK_MAX] = {
"'{'",
diff --git a/core/io/json.h b/core/io/json.h
index 9c12423798..af6c463331 100644
--- a/core/io/json.h
+++ b/core/io/json.h
@@ -31,7 +31,7 @@
#ifndef JSON_H
#define JSON_H
-#include "variant.h"
+#include "core/variant.h"
class JSON {
diff --git a/core/io/logger.cpp b/core/io/logger.cpp
index 786bec461b..051c02ab32 100644
--- a/core/io/logger.cpp
+++ b/core/io/logger.cpp
@@ -30,9 +30,9 @@
#include "logger.h"
-#include "os/dir_access.h"
-#include "os/os.h"
-#include "print_string.h"
+#include "core/os/dir_access.h"
+#include "core/os/os.h"
+#include "core/print_string.h"
// va_copy was defined in the C99, but not in C++ standards before C++11.
// When you compile C++ without --std=c++<XX> option, compilers still define
diff --git a/core/io/logger.h b/core/io/logger.h
index 631e7a0589..d32b43b030 100644
--- a/core/io/logger.h
+++ b/core/io/logger.h
@@ -31,9 +31,10 @@
#ifndef LOGGER_H
#define LOGGER_H
-#include "os/file_access.h"
-#include "ustring.h"
-#include "vector.h"
+#include "core/os/file_access.h"
+#include "core/ustring.h"
+#include "core/vector.h"
+
#include <stdarg.h>
class Logger {
@@ -106,4 +107,4 @@ public:
virtual ~CompositeLogger();
};
-#endif \ No newline at end of file
+#endif
diff --git a/core/io/marshalls.cpp b/core/io/marshalls.cpp
index e97df0c261..e15519da47 100644
--- a/core/io/marshalls.cpp
+++ b/core/io/marshalls.cpp
@@ -29,9 +29,11 @@
/*************************************************************************/
#include "marshalls.h"
-#include "os/keyboard.h"
-#include "print_string.h"
-#include "reference.h"
+
+#include "core/os/keyboard.h"
+#include "core/print_string.h"
+#include "core/reference.h"
+
#include <limits.h>
#include <stdio.h>
diff --git a/core/io/marshalls.h b/core/io/marshalls.h
index 381e4e3d20..1284520945 100644
--- a/core/io/marshalls.h
+++ b/core/io/marshalls.h
@@ -31,10 +31,10 @@
#ifndef MARSHALLS_H
#define MARSHALLS_H
-#include "typedefs.h"
+#include "core/reference.h"
+#include "core/typedefs.h"
+#include "core/variant.h"
-#include "reference.h"
-#include "variant.h"
/**
* Miscellaneous helpers for marshalling data types, and encoding
* in an endian independent way
diff --git a/core/io/multiplayer_api.cpp b/core/io/multiplayer_api.cpp
index 8e67f1c97a..1179b1bfd6 100644
--- a/core/io/multiplayer_api.cpp
+++ b/core/io/multiplayer_api.cpp
@@ -28,7 +28,8 @@
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
/*************************************************************************/
-#include "core/io/multiplayer_api.h"
+#include "multiplayer_api.h"
+
#include "core/io/marshalls.h"
#include "scene/main/node.h"
diff --git a/drivers/windows/tcp_server_winsock.h b/core/io/net_socket.cpp
index a6979db42d..10bcf62eda 100644
--- a/drivers/windows/tcp_server_winsock.h
+++ b/core/io/net_socket.cpp
@@ -1,5 +1,5 @@
/*************************************************************************/
-/* tcp_server_winsock.h */
+/* net_socket.cpp */
/*************************************************************************/
/* This file is part of: */
/* GODOT ENGINE */
@@ -28,34 +28,15 @@
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
/*************************************************************************/
-#ifdef WINDOWS_ENABLED
+#include "net_socket.h"
-#ifndef TCP_SERVER_WINSOCK_H
-#define TCP_SERVER_WINSOCK_H
+NetSocket *(*NetSocket::_create)() = NULL;
-#include "core/io/tcp_server.h"
+NetSocket *NetSocket::create() {
-class TCPServerWinsock : public TCP_Server {
+ if (_create)
+ return _create();
- int listen_sockfd;
- IP::Type sock_type;
-
- static TCP_Server *_create();
-
-public:
- virtual Error listen(uint16_t p_port, const IP_Address &p_bind_address = IP_Address("*"));
- virtual bool is_connection_available() const;
- virtual Ref<StreamPeerTCP> take_connection();
-
- virtual void stop(); //stop listening
-
- static void make_default();
- static void cleanup();
-
- TCPServerWinsock();
- ~TCPServerWinsock();
-};
-
-#endif
-
-#endif
+ ERR_PRINT("Unable to create network socket, platform not supported");
+ return NULL;
+}
diff --git a/drivers/unix/stream_peer_tcp_posix.h b/core/io/net_socket.h
index bcebe57771..0665bec9fd 100644
--- a/drivers/unix/stream_peer_tcp_posix.h
+++ b/core/io/net_socket.h
@@ -1,5 +1,5 @@
/*************************************************************************/
-/* stream_peer_tcp_posix.h */
+/* net_socket.h */
/*************************************************************************/
/* This file is part of: */
/* GODOT ENGINE */
@@ -28,63 +28,52 @@
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
/*************************************************************************/
-#ifdef UNIX_ENABLED
+#ifndef NET_SOCKET_H
+#define NET_SOCKET_H
-#ifndef STREAM_PEER_TCP_POSIX_H
-#define STREAM_PEER_TCP_POSIX_H
+#include "core/io/ip.h"
+#include "core/reference.h"
-#include "core/io/ip_address.h"
-#include "core/io/stream_peer_tcp.h"
-#include "error_list.h"
-
-class StreamPeerTCPPosix : public StreamPeerTCP {
+class NetSocket : public Reference {
protected:
- mutable Status status;
-
- IP::Type sock_type;
- int sockfd;
-
- Error _block(int p_sockfd, bool p_read, bool p_write) const;
-
- Error _poll_connection() const;
-
- IP_Address peer_host;
- int peer_port;
-
- Error write(const uint8_t *p_data, int p_bytes, int &r_sent, bool p_block);
- Error read(uint8_t *p_buffer, int p_bytes, int &r_received, bool p_block);
-
- static StreamPeerTCP *_create();
+ static NetSocket *(*_create)();
public:
- virtual Error connect_to_host(const IP_Address &p_host, uint16_t p_port);
-
- virtual Error put_data(const uint8_t *p_data, int p_bytes);
- virtual Error put_partial_data(const uint8_t *p_data, int p_bytes, int &r_sent);
-
- virtual Error get_data(uint8_t *p_buffer, int p_bytes);
- virtual Error get_partial_data(uint8_t *p_buffer, int p_bytes, int &r_received);
-
- virtual int get_available_bytes() const;
-
- void set_socket(int p_sockfd, IP_Address p_host, int p_port, IP::Type p_sock_type);
-
- virtual IP_Address get_connected_host() const;
- virtual uint16_t get_connected_port() const;
-
- virtual bool is_connected_to_host() const;
- virtual Status get_status() const;
- virtual void disconnect_from_host();
-
- virtual void set_no_delay(bool p_enabled);
-
- static void make_default();
-
- StreamPeerTCPPosix();
- ~StreamPeerTCPPosix();
+ static NetSocket *create();
+
+ enum PollType {
+ POLL_TYPE_IN,
+ POLL_TYPE_OUT,
+ POLL_TYPE_IN_OUT
+ };
+
+ enum Type {
+ TYPE_NONE,
+ TYPE_TCP,
+ TYPE_UDP,
+ };
+
+ virtual Error open(Type p_type, IP::Type &ip_type) = 0;
+ virtual void close() = 0;
+ virtual Error bind(IP_Address p_addr, uint16_t p_port) = 0;
+ virtual Error listen(int p_max_pending) = 0;
+ virtual Error connect_to_host(IP_Address p_addr, uint16_t p_port) = 0;
+ virtual Error poll(PollType p_type, int timeout) const = 0;
+ virtual Error recv(uint8_t *p_buffer, int p_len, int &r_read) = 0;
+ virtual Error recvfrom(uint8_t *p_buffer, int p_len, int &r_read, IP_Address &r_ip, uint16_t &r_port) = 0;
+ virtual Error send(const uint8_t *p_buffer, int p_len, int &r_sent) = 0;
+ virtual Error sendto(const uint8_t *p_buffer, int p_len, int &r_sent, IP_Address p_ip, uint16_t p_port) = 0;
+ virtual Ref<NetSocket> accept(IP_Address &r_ip, uint16_t &r_port) = 0;
+
+ virtual bool is_open() const = 0;
+ virtual int get_available_bytes() const = 0;
+
+ virtual void set_broadcasting_enabled(bool p_enabled) = 0;
+ virtual void set_blocking_enabled(bool p_enabled) = 0;
+ virtual void set_ipv6_only_enabled(bool p_enabled) = 0;
+ virtual void set_tcp_no_delay_enabled(bool p_enabled) = 0;
+ virtual void set_reuse_address_enabled(bool p_enabled) = 0;
};
-#endif // TCP_CLIENT_POSIX_H
-
-#endif
+#endif // NET_SOCKET_H
diff --git a/core/io/networked_multiplayer_peer.h b/core/io/networked_multiplayer_peer.h
index 66089c27b9..8e83c528a0 100644
--- a/core/io/networked_multiplayer_peer.h
+++ b/core/io/networked_multiplayer_peer.h
@@ -31,7 +31,7 @@
#ifndef NETWORKED_MULTIPLAYER_PEER_H
#define NETWORKED_MULTIPLAYER_PEER_H
-#include "io/packet_peer.h"
+#include "core/io/packet_peer.h"
class NetworkedMultiplayerPeer : public PacketPeer {
diff --git a/core/io/packet_peer.cpp b/core/io/packet_peer.cpp
index dc4997dfc2..b6dd4eaf6f 100644
--- a/core/io/packet_peer.cpp
+++ b/core/io/packet_peer.cpp
@@ -30,8 +30,9 @@
#include "packet_peer.h"
-#include "io/marshalls.h"
-#include "project_settings.h"
+#include "core/io/marshalls.h"
+#include "core/project_settings.h"
+
/* helpers / binders */
PacketPeer::PacketPeer() {
diff --git a/core/io/packet_peer.h b/core/io/packet_peer.h
index b10152e96b..a6559df460 100644
--- a/core/io/packet_peer.h
+++ b/core/io/packet_peer.h
@@ -31,9 +31,10 @@
#ifndef PACKET_PEER_H
#define PACKET_PEER_H
-#include "io/stream_peer.h"
-#include "object.h"
-#include "ring_buffer.h"
+#include "core/io/stream_peer.h"
+#include "core/object.h"
+#include "core/ring_buffer.h"
+
class PacketPeer : public Reference {
GDCLASS(PacketPeer, Reference);
diff --git a/core/io/packet_peer_udp.cpp b/core/io/packet_peer_udp.cpp
index bfbea15582..d33ba6f855 100644
--- a/core/io/packet_peer_udp.cpp
+++ b/core/io/packet_peer_udp.cpp
@@ -29,9 +29,8 @@
/*************************************************************************/
#include "packet_peer_udp.h"
-#include "io/ip.h"
-PacketPeerUDP *(*PacketPeerUDP::_create)() = NULL;
+#include "core/io/ip.h"
void PacketPeerUDP::set_blocking_mode(bool p_enable) {
@@ -58,6 +57,177 @@ Error PacketPeerUDP::_set_dest_address(const String &p_address, int p_port) {
return OK;
}
+int PacketPeerUDP::get_available_packet_count() const {
+
+ // TODO we should deprecate this, and expose poll instead!
+ Error err = const_cast<PacketPeerUDP *>(this)->_poll();
+ if (err != OK)
+ return -1;
+
+ return queue_count;
+}
+
+Error PacketPeerUDP::get_packet(const uint8_t **r_buffer, int &r_buffer_size) {
+
+ Error err = _poll();
+ if (err != OK)
+ return err;
+ if (queue_count == 0)
+ return ERR_UNAVAILABLE;
+
+ uint32_t size = 0;
+ uint8_t ipv6[16];
+ rb.read(ipv6, 16, true);
+ packet_ip.set_ipv6(ipv6);
+ rb.read((uint8_t *)&packet_port, 4, true);
+ rb.read((uint8_t *)&size, 4, true);
+ rb.read(packet_buffer, size, true);
+ --queue_count;
+ *r_buffer = packet_buffer;
+ r_buffer_size = size;
+ return OK;
+}
+
+Error PacketPeerUDP::put_packet(const uint8_t *p_buffer, int p_buffer_size) {
+
+ ERR_FAIL_COND_V(!_sock.is_valid(), ERR_UNAVAILABLE);
+ ERR_FAIL_COND_V(!peer_addr.is_valid(), ERR_UNCONFIGURED);
+
+ Error err;
+ int sent = -1;
+
+ if (!_sock->is_open()) {
+ IP::Type ip_type = peer_addr.is_ipv4() ? IP::TYPE_IPV4 : IP::TYPE_IPV6;
+ err = _sock->open(NetSocket::TYPE_UDP, ip_type);
+ ERR_FAIL_COND_V(err != OK, err);
+ _sock->set_blocking_enabled(false);
+ }
+
+ do {
+ err = _sock->sendto(p_buffer, p_buffer_size, sent, peer_addr, peer_port);
+ if (err != OK) {
+ if (err != ERR_BUSY)
+ return FAILED;
+ else if (!blocking)
+ return ERR_BUSY;
+ // Keep trying to send full packet
+ continue;
+ }
+ return OK;
+
+ } while (sent != p_buffer_size);
+
+ return OK;
+}
+
+int PacketPeerUDP::get_max_packet_size() const {
+
+ return 512; // uhm maybe not
+}
+
+Error PacketPeerUDP::listen(int p_port, const IP_Address &p_bind_address, int p_recv_buffer_size) {
+
+ ERR_FAIL_COND_V(!_sock.is_valid(), ERR_UNAVAILABLE);
+ ERR_FAIL_COND_V(_sock->is_open(), ERR_ALREADY_IN_USE);
+ ERR_FAIL_COND_V(!p_bind_address.is_valid() && !p_bind_address.is_wildcard(), ERR_INVALID_PARAMETER);
+
+ Error err;
+ IP::Type ip_type = IP::TYPE_ANY;
+
+ if (p_bind_address.is_valid())
+ ip_type = p_bind_address.is_ipv4() ? IP::TYPE_IPV4 : IP::TYPE_IPV6;
+
+ err = _sock->open(NetSocket::TYPE_UDP, ip_type);
+
+ if (err != OK)
+ return ERR_CANT_CREATE;
+
+ _sock->set_blocking_enabled(false);
+ _sock->set_reuse_address_enabled(true);
+ err = _sock->bind(p_bind_address, p_port);
+
+ if (err != OK) {
+ _sock->close();
+ return err;
+ }
+ rb.resize(nearest_shift(p_recv_buffer_size));
+ return OK;
+}
+
+void PacketPeerUDP::close() {
+
+ if (_sock.is_valid())
+ _sock->close();
+ rb.resize(16);
+ queue_count = 0;
+}
+
+Error PacketPeerUDP::wait() {
+
+ ERR_FAIL_COND_V(!_sock.is_valid(), ERR_UNAVAILABLE);
+ return _sock->poll(NetSocket::POLL_TYPE_IN, -1);
+}
+
+Error PacketPeerUDP::_poll() {
+
+ ERR_FAIL_COND_V(!_sock.is_valid(), ERR_UNAVAILABLE);
+
+ if (!_sock->is_open()) {
+ return FAILED;
+ }
+
+ Error err;
+ int read;
+ IP_Address ip;
+ uint16_t port;
+
+ while (true) {
+ err = _sock->recvfrom(recv_buffer, sizeof(recv_buffer), read, ip, port);
+
+ if (err != OK) {
+ if (err == ERR_BUSY)
+ break;
+ return FAILED;
+ }
+
+ if (rb.space_left() < read + 24) {
+#ifdef TOOLS_ENABLED
+ WARN_PRINTS("Buffer full, dropping packets!");
+#endif
+ continue;
+ }
+
+ uint32_t port32 = port;
+ rb.write(ip.get_ipv6(), 16);
+ rb.write((uint8_t *)&port32, 4);
+ rb.write((uint8_t *)&read, 4);
+ rb.write(recv_buffer, read);
+ ++queue_count;
+ }
+
+ return OK;
+}
+bool PacketPeerUDP::is_listening() const {
+
+ return _sock.is_valid() && _sock->is_open();
+}
+
+IP_Address PacketPeerUDP::get_packet_address() const {
+
+ return packet_ip;
+}
+
+int PacketPeerUDP::get_packet_port() const {
+
+ return packet_port;
+}
+
+void PacketPeerUDP::set_dest_address(const IP_Address &p_address, int p_port) {
+
+ peer_addr = p_address;
+ peer_port = p_port;
+}
+
void PacketPeerUDP::_bind_methods() {
ClassDB::bind_method(D_METHOD("listen", "port", "bind_address", "recv_buf_size"), &PacketPeerUDP::listen, DEFVAL("*"), DEFVAL(65536));
@@ -65,26 +235,21 @@ void PacketPeerUDP::_bind_methods() {
ClassDB::bind_method(D_METHOD("wait"), &PacketPeerUDP::wait);
ClassDB::bind_method(D_METHOD("is_listening"), &PacketPeerUDP::is_listening);
ClassDB::bind_method(D_METHOD("get_packet_ip"), &PacketPeerUDP::_get_packet_ip);
- //ClassDB::bind_method(D_METHOD("get_packet_address"),&PacketPeerUDP::_get_packet_address);
ClassDB::bind_method(D_METHOD("get_packet_port"), &PacketPeerUDP::get_packet_port);
ClassDB::bind_method(D_METHOD("set_dest_address", "host", "port"), &PacketPeerUDP::_set_dest_address);
}
-Ref<PacketPeerUDP> PacketPeerUDP::create_ref() {
-
- if (!_create)
- return Ref<PacketPeerUDP>();
- return Ref<PacketPeerUDP>(_create());
-}
-
-PacketPeerUDP *PacketPeerUDP::create() {
+PacketPeerUDP::PacketPeerUDP() {
- if (!_create)
- return NULL;
- return _create();
+ _sock = Ref<NetSocket>(NetSocket::create());
+ blocking = true;
+ packet_port = 0;
+ queue_count = 0;
+ peer_port = 0;
+ rb.resize(16);
}
-PacketPeerUDP::PacketPeerUDP() {
+PacketPeerUDP::~PacketPeerUDP() {
- blocking = true;
+ close();
}
diff --git a/core/io/packet_peer_udp.h b/core/io/packet_peer_udp.h
index 035f4ad1c9..4366b0eb82 100644
--- a/core/io/packet_peer_udp.h
+++ b/core/io/packet_peer_udp.h
@@ -31,37 +31,55 @@
#ifndef PACKET_PEER_UDP_H
#define PACKET_PEER_UDP_H
-#include "io/ip.h"
-#include "io/packet_peer.h"
+#include "core/io/ip.h"
+#include "core/io/net_socket.h"
+#include "core/io/packet_peer.h"
class PacketPeerUDP : public PacketPeer {
GDCLASS(PacketPeerUDP, PacketPeer);
protected:
+ enum {
+ PACKET_BUFFER_SIZE = 65536
+ };
+
+ RingBuffer<uint8_t> rb;
+ uint8_t recv_buffer[PACKET_BUFFER_SIZE];
+ uint8_t packet_buffer[PACKET_BUFFER_SIZE];
+ IP_Address packet_ip;
+ int packet_port;
+ int queue_count;
+
+ IP_Address peer_addr;
+ int peer_port;
bool blocking;
+ Ref<NetSocket> _sock;
- static PacketPeerUDP *(*_create)();
static void _bind_methods();
String _get_packet_ip() const;
Error _set_dest_address(const String &p_address, int p_port);
+ Error _poll();
public:
void set_blocking_mode(bool p_enable);
- virtual Error listen(int p_port, const IP_Address &p_bind_address = IP_Address("*"), int p_recv_buffer_size = 65536) = 0;
- virtual void close() = 0;
- virtual Error wait() = 0;
- virtual bool is_listening() const = 0;
- virtual IP_Address get_packet_address() const = 0;
- virtual int get_packet_port() const = 0;
- virtual void set_dest_address(const IP_Address &p_address, int p_port) = 0;
+ Error listen(int p_port, const IP_Address &p_bind_address = IP_Address("*"), int p_recv_buffer_size = 65536);
+ void close();
+ Error wait();
+ bool is_listening() const;
+ IP_Address get_packet_address() const;
+ int get_packet_port() const;
+ void set_dest_address(const IP_Address &p_address, int p_port);
- static Ref<PacketPeerUDP> create_ref();
- static PacketPeerUDP *create();
+ Error put_packet(const uint8_t *p_buffer, int p_buffer_size);
+ Error get_packet(const uint8_t **r_buffer, int &r_buffer_size);
+ int get_available_packet_count() const;
+ int get_max_packet_size() const;
PacketPeerUDP();
+ ~PacketPeerUDP();
};
#endif // PACKET_PEER_UDP_H
diff --git a/core/io/pck_packer.cpp b/core/io/pck_packer.cpp
index 2fd73db27d..3df8c01760 100644
--- a/core/io/pck_packer.cpp
+++ b/core/io/pck_packer.cpp
@@ -29,8 +29,9 @@
/*************************************************************************/
#include "pck_packer.h"
+
#include "core/os/file_access.h"
-#include "version.h"
+#include "core/version.h"
static uint64_t _align(uint64_t p_n, int p_alignment) {
diff --git a/core/io/resource_format_binary.h b/core/io/resource_format_binary.h
index 021f7f6a2f..35d594f228 100644
--- a/core/io/resource_format_binary.h
+++ b/core/io/resource_format_binary.h
@@ -31,9 +31,9 @@
#ifndef RESOURCE_FORMAT_BINARY_H
#define RESOURCE_FORMAT_BINARY_H
-#include "io/resource_loader.h"
-#include "io/resource_saver.h"
-#include "os/file_access.h"
+#include "core/io/resource_loader.h"
+#include "core/io/resource_saver.h"
+#include "core/os/file_access.h"
class ResourceInteractiveLoaderBinary : public ResourceInteractiveLoader {
diff --git a/core/io/resource_import.cpp b/core/io/resource_import.cpp
index cfe6655504..ffea43b6bf 100644
--- a/core/io/resource_import.cpp
+++ b/core/io/resource_import.cpp
@@ -30,8 +30,8 @@
#include "resource_import.h"
-#include "os/os.h"
-#include "variant_parser.h"
+#include "core/os/os.h"
+#include "core/variant_parser.h"
Error ResourceFormatImporter::_get_path_and_type(const String &p_path, PathAndType &r_path_and_type, bool *r_valid) const {
diff --git a/core/io/resource_import.h b/core/io/resource_import.h
index 80e0743eda..53718bd789 100644
--- a/core/io/resource_import.h
+++ b/core/io/resource_import.h
@@ -31,7 +31,8 @@
#ifndef RESOURCE_IMPORT_H
#define RESOURCE_IMPORT_H
-#include "io/resource_loader.h"
+#include "core/io/resource_loader.h"
+
class ResourceImporter;
class ResourceFormatImporter : public ResourceFormatLoader {
diff --git a/core/io/resource_loader.cpp b/core/io/resource_loader.cpp
index 66dc9730c5..8c56d55e85 100644
--- a/core/io/resource_loader.cpp
+++ b/core/io/resource_loader.cpp
@@ -29,14 +29,16 @@
/*************************************************************************/
#include "resource_loader.h"
-#include "io/resource_import.h"
-#include "os/file_access.h"
-#include "os/os.h"
-#include "path_remap.h"
-#include "print_string.h"
-#include "project_settings.h"
-#include "translation.h"
-#include "variant_parser.h"
+
+#include "core/io/resource_import.h"
+#include "core/os/file_access.h"
+#include "core/os/os.h"
+#include "core/path_remap.h"
+#include "core/print_string.h"
+#include "core/project_settings.h"
+#include "core/translation.h"
+#include "core/variant_parser.h"
+
ResourceFormatLoader *ResourceLoader::loader[MAX_LOADERS];
int ResourceLoader::loader_count = 0;
diff --git a/core/io/resource_loader.h b/core/io/resource_loader.h
index f78464ef0c..de0981350d 100644
--- a/core/io/resource_loader.h
+++ b/core/io/resource_loader.h
@@ -31,7 +31,7 @@
#ifndef RESOURCE_LOADER_H
#define RESOURCE_LOADER_H
-#include "resource.h"
+#include "core/resource.h"
/**
@author Juan Linietsky <reduzio@gmail.com>
diff --git a/core/io/resource_saver.cpp b/core/io/resource_saver.cpp
index 3dcd94880a..5c8188f735 100644
--- a/core/io/resource_saver.cpp
+++ b/core/io/resource_saver.cpp
@@ -29,10 +29,11 @@
/*************************************************************************/
#include "resource_saver.h"
-#include "os/file_access.h"
-#include "project_settings.h"
-#include "resource_loader.h"
-#include "script_language.h"
+
+#include "core/io/resource_loader.h"
+#include "core/os/file_access.h"
+#include "core/project_settings.h"
+#include "core/script_language.h"
ResourceFormatSaver *ResourceSaver::saver[MAX_SAVERS];
diff --git a/core/io/resource_saver.h b/core/io/resource_saver.h
index 396f37d414..7ed580f2d6 100644
--- a/core/io/resource_saver.h
+++ b/core/io/resource_saver.h
@@ -31,7 +31,7 @@
#ifndef RESOURCE_SAVER_H
#define RESOURCE_SAVER_H
-#include "resource.h"
+#include "core/resource.h"
/**
@author Juan Linietsky <reduzio@gmail.com>
diff --git a/core/io/stream_peer.cpp b/core/io/stream_peer.cpp
index 3e0ee088c2..156a842e35 100644
--- a/core/io/stream_peer.cpp
+++ b/core/io/stream_peer.cpp
@@ -29,7 +29,8 @@
/*************************************************************************/
#include "stream_peer.h"
-#include "io/marshalls.h"
+
+#include "core/io/marshalls.h"
Error StreamPeer::_put_data(const PoolVector<uint8_t> &p_data) {
diff --git a/core/io/stream_peer.h b/core/io/stream_peer.h
index 605b0a7980..9d2e0340b0 100644
--- a/core/io/stream_peer.h
+++ b/core/io/stream_peer.h
@@ -31,7 +31,7 @@
#ifndef STREAM_PEER_H
#define STREAM_PEER_H
-#include "reference.h"
+#include "core/reference.h"
class StreamPeer : public Reference {
GDCLASS(StreamPeer, Reference);
diff --git a/core/io/stream_peer_ssl.cpp b/core/io/stream_peer_ssl.cpp
index 25adb6a6ee..1f59021938 100644
--- a/core/io/stream_peer_ssl.cpp
+++ b/core/io/stream_peer_ssl.cpp
@@ -29,8 +29,9 @@
/*************************************************************************/
#include "stream_peer_ssl.h"
-#include "os/file_access.h"
-#include "project_settings.h"
+
+#include "core/os/file_access.h"
+#include "core/project_settings.h"
StreamPeerSSL *(*StreamPeerSSL::_create)() = NULL;
diff --git a/core/io/stream_peer_ssl.h b/core/io/stream_peer_ssl.h
index 870704e875..f66c1c7de9 100644
--- a/core/io/stream_peer_ssl.h
+++ b/core/io/stream_peer_ssl.h
@@ -31,7 +31,7 @@
#ifndef STREAM_PEER_SSL_H
#define STREAM_PEER_SSL_H
-#include "io/stream_peer.h"
+#include "core/io/stream_peer.h"
class StreamPeerSSL : public StreamPeer {
GDCLASS(StreamPeerSSL, StreamPeer);
diff --git a/core/io/stream_peer_tcp.cpp b/core/io/stream_peer_tcp.cpp
index 54ebb3ae0d..f4bf8a13ae 100644
--- a/core/io/stream_peer_tcp.cpp
+++ b/core/io/stream_peer_tcp.cpp
@@ -30,7 +30,277 @@
#include "stream_peer_tcp.h"
-StreamPeerTCP *(*StreamPeerTCP::_create)() = NULL;
+Error StreamPeerTCP::_poll_connection() {
+
+ ERR_FAIL_COND_V(status != STATUS_CONNECTING || !_sock.is_valid() || !_sock->is_open(), FAILED);
+
+ Error err = _sock->connect_to_host(peer_host, peer_port);
+
+ if (err == OK) {
+ status = STATUS_CONNECTED;
+ return OK;
+ } else if (err == ERR_BUSY) {
+ // Still trying to connect
+ return OK;
+ }
+
+ disconnect_from_host();
+ status = STATUS_ERROR;
+ return ERR_CONNECTION_ERROR;
+}
+
+void StreamPeerTCP::accept_socket(Ref<NetSocket> p_sock, IP_Address p_host, uint16_t p_port) {
+
+ _sock = p_sock;
+ _sock->set_blocking_enabled(false);
+
+ status = STATUS_CONNECTING;
+
+ peer_host = p_host;
+ peer_port = p_port;
+}
+
+Error StreamPeerTCP::connect_to_host(const IP_Address &p_host, uint16_t p_port) {
+
+ ERR_FAIL_COND_V(!_sock.is_valid(), ERR_UNAVAILABLE);
+ ERR_FAIL_COND_V(_sock->is_open(), ERR_ALREADY_IN_USE);
+ ERR_FAIL_COND_V(!p_host.is_valid(), ERR_INVALID_PARAMETER);
+
+ Error err;
+ IP::Type ip_type = p_host.is_ipv4() ? IP::TYPE_IPV4 : IP::TYPE_IPV6;
+
+ err = _sock->open(NetSocket::TYPE_TCP, ip_type);
+ ERR_FAIL_COND_V(err != OK, FAILED);
+
+ _sock->set_blocking_enabled(false);
+
+ err = _sock->connect_to_host(p_host, p_port);
+
+ if (err == OK) {
+ status = STATUS_CONNECTED;
+ } else if (err == ERR_BUSY) {
+ status = STATUS_CONNECTING;
+ } else {
+ ERR_PRINT("Connection to remote host failed!");
+ disconnect_from_host();
+ return FAILED;
+ }
+
+ peer_host = p_host;
+ peer_port = p_port;
+
+ return OK;
+}
+
+Error StreamPeerTCP::write(const uint8_t *p_data, int p_bytes, int &r_sent, bool p_block) {
+
+ ERR_FAIL_COND_V(!_sock.is_valid(), ERR_UNAVAILABLE);
+
+ if (status == STATUS_NONE || status == STATUS_ERROR) {
+
+ return FAILED;
+ }
+
+ if (status != STATUS_CONNECTED) {
+
+ if (_poll_connection() != OK) {
+
+ return FAILED;
+ }
+
+ if (status != STATUS_CONNECTED) {
+ r_sent = 0;
+ return OK;
+ }
+ }
+
+ if (!_sock->is_open())
+ return FAILED;
+
+ Error err;
+ int data_to_send = p_bytes;
+ const uint8_t *offset = p_data;
+ int total_sent = 0;
+
+ while (data_to_send) {
+
+ int sent_amount = 0;
+ err = _sock->send(offset, data_to_send, sent_amount);
+
+ if (err != OK) {
+
+ if (err != ERR_BUSY) {
+ disconnect_from_host();
+ return FAILED;
+ }
+
+ if (!p_block) {
+ r_sent = total_sent;
+ return OK;
+ }
+
+ // Block and wait for the socket to accept more data
+ err = _sock->poll(NetSocket::POLL_TYPE_OUT, -1);
+ if (err != OK) {
+ disconnect_from_host();
+ return FAILED;
+ }
+ } else {
+
+ data_to_send -= sent_amount;
+ offset += sent_amount;
+ total_sent += sent_amount;
+ }
+ }
+
+ r_sent = total_sent;
+
+ return OK;
+}
+
+Error StreamPeerTCP::read(uint8_t *p_buffer, int p_bytes, int &r_received, bool p_block) {
+
+ if (!is_connected_to_host()) {
+
+ return FAILED;
+ }
+
+ if (status == STATUS_CONNECTING) {
+
+ if (_poll_connection() != OK) {
+
+ return FAILED;
+ }
+
+ if (status != STATUS_CONNECTED) {
+ r_received = 0;
+ return OK;
+ }
+ }
+
+ Error err;
+ int to_read = p_bytes;
+ int total_read = 0;
+ r_received = 0;
+
+ while (to_read) {
+
+ int read = 0;
+ err = _sock->recv(p_buffer + total_read, to_read, read);
+
+ if (err != OK) {
+
+ if (err != ERR_BUSY) {
+ disconnect_from_host();
+ return FAILED;
+ }
+
+ if (!p_block) {
+ r_received = total_read;
+ return OK;
+ }
+
+ err = _sock->poll(NetSocket::POLL_TYPE_IN, -1);
+
+ if (err != OK) {
+ disconnect_from_host();
+ return FAILED;
+ }
+
+ } else if (read == 0) {
+
+ disconnect_from_host();
+ r_received = total_read;
+ return ERR_FILE_EOF;
+
+ } else {
+
+ to_read -= read;
+ total_read += read;
+ }
+ }
+
+ r_received = total_read;
+
+ return OK;
+}
+
+void StreamPeerTCP::set_no_delay(bool p_enabled) {
+
+ ERR_FAIL_COND(!is_connected_to_host());
+ _sock->set_tcp_no_delay_enabled(p_enabled);
+}
+
+bool StreamPeerTCP::is_connected_to_host() const {
+
+ if (status == STATUS_NONE || status == STATUS_ERROR) {
+
+ return false;
+ }
+
+ if (status != STATUS_CONNECTED) {
+ return true;
+ }
+
+ return _sock.is_valid() && _sock->is_open();
+}
+
+StreamPeerTCP::Status StreamPeerTCP::get_status() {
+
+ if (status == STATUS_CONNECTING) {
+ _poll_connection();
+ }
+
+ return status;
+}
+
+void StreamPeerTCP::disconnect_from_host() {
+
+ if (_sock.is_valid() && _sock->is_open())
+ _sock->close();
+
+ status = STATUS_NONE;
+ peer_host = IP_Address();
+ peer_port = 0;
+}
+
+Error StreamPeerTCP::put_data(const uint8_t *p_data, int p_bytes) {
+
+ int total;
+ return write(p_data, p_bytes, total, true);
+}
+
+Error StreamPeerTCP::put_partial_data(const uint8_t *p_data, int p_bytes, int &r_sent) {
+
+ return write(p_data, p_bytes, r_sent, false);
+}
+
+Error StreamPeerTCP::get_data(uint8_t *p_buffer, int p_bytes) {
+
+ int total;
+ return read(p_buffer, p_bytes, total, true);
+}
+
+Error StreamPeerTCP::get_partial_data(uint8_t *p_buffer, int p_bytes, int &r_received) {
+
+ return read(p_buffer, p_bytes, r_received, false);
+}
+
+int StreamPeerTCP::get_available_bytes() const {
+
+ ERR_FAIL_COND_V(!_sock.is_valid(), -1);
+ return _sock->get_available_bytes();
+}
+
+IP_Address StreamPeerTCP::get_connected_host() const {
+
+ return peer_host;
+}
+
+uint16_t StreamPeerTCP::get_connected_port() const {
+
+ return peer_port;
+}
Error StreamPeerTCP::_connect(const String &p_address, int p_port) {
@@ -62,23 +332,15 @@ void StreamPeerTCP::_bind_methods() {
BIND_ENUM_CONSTANT(STATUS_ERROR);
}
-Ref<StreamPeerTCP> StreamPeerTCP::create_ref() {
+StreamPeerTCP::StreamPeerTCP() {
- if (!_create)
- return Ref<StreamPeerTCP>();
- return Ref<StreamPeerTCP>(_create());
+ _sock = Ref<NetSocket>(NetSocket::create());
+ status = STATUS_NONE;
+ peer_host = IP_Address();
+ peer_port = 0;
}
-StreamPeerTCP *StreamPeerTCP::create() {
+StreamPeerTCP::~StreamPeerTCP() {
- if (!_create)
- return NULL;
- return _create();
+ disconnect_from_host();
}
-
-StreamPeerTCP::StreamPeerTCP() {
-}
-
-StreamPeerTCP::~StreamPeerTCP(){
-
-};
diff --git a/core/io/stream_peer_tcp.h b/core/io/stream_peer_tcp.h
index 8a16d820f2..de364915cd 100644
--- a/core/io/stream_peer_tcp.h
+++ b/core/io/stream_peer_tcp.h
@@ -31,10 +31,10 @@
#ifndef STREAM_PEER_TCP_H
#define STREAM_PEER_TCP_H
-#include "stream_peer.h"
-
-#include "io/ip.h"
-#include "ip_address.h"
+#include "core/io/ip.h"
+#include "core/io/ip_address.h"
+#include "core/io/net_socket.h"
+#include "core/io/stream_peer.h"
class StreamPeerTCP : public StreamPeer {
@@ -51,24 +51,37 @@ public:
};
protected:
- virtual Error _connect(const String &p_address, int p_port);
- static StreamPeerTCP *(*_create)();
+ Ref<NetSocket> _sock;
+ Status status;
+ IP_Address peer_host;
+ uint16_t peer_port;
+
+ Error _connect(const String &p_address, int p_port);
+ Error _poll_connection();
+ Error write(const uint8_t *p_data, int p_bytes, int &r_sent, bool p_block);
+ Error read(uint8_t *p_buffer, int p_bytes, int &r_received, bool p_block);
+
static void _bind_methods();
public:
- virtual Error connect_to_host(const IP_Address &p_host, uint16_t p_port) = 0;
+ void accept_socket(Ref<NetSocket> p_sock, IP_Address p_host, uint16_t p_port);
+
+ Error connect_to_host(const IP_Address &p_host, uint16_t p_port);
+ bool is_connected_to_host() const;
+ IP_Address get_connected_host() const;
+ uint16_t get_connected_port() const;
+ void disconnect_from_host();
- //read/write from streampeer
+ int get_available_bytes() const;
+ Status get_status();
- virtual bool is_connected_to_host() const = 0;
- virtual Status get_status() const = 0;
- virtual void disconnect_from_host() = 0;
- virtual IP_Address get_connected_host() const = 0;
- virtual uint16_t get_connected_port() const = 0;
- virtual void set_no_delay(bool p_enabled) = 0;
+ void set_no_delay(bool p_enabled);
- static Ref<StreamPeerTCP> create_ref();
- static StreamPeerTCP *create();
+ // Read/Write from StreamPeer
+ Error put_data(const uint8_t *p_data, int p_bytes);
+ Error put_partial_data(const uint8_t *p_data, int p_bytes, int &r_sent);
+ Error get_data(uint8_t *p_buffer, int p_bytes);
+ Error get_partial_data(uint8_t *p_buffer, int p_bytes, int &r_received);
StreamPeerTCP();
~StreamPeerTCP();
diff --git a/core/io/tcp_server.cpp b/core/io/tcp_server.cpp
index 5916d58390..b8194cb17f 100644
--- a/core/io/tcp_server.cpp
+++ b/core/io/tcp_server.cpp
@@ -30,29 +30,98 @@
#include "tcp_server.h"
-TCP_Server *(*TCP_Server::_create)() = NULL;
+void TCP_Server::_bind_methods() {
+
+ ClassDB::bind_method(D_METHOD("listen", "port", "bind_address"), &TCP_Server::listen, DEFVAL("*"));
+ ClassDB::bind_method(D_METHOD("is_connection_available"), &TCP_Server::is_connection_available);
+ ClassDB::bind_method(D_METHOD("take_connection"), &TCP_Server::take_connection);
+ ClassDB::bind_method(D_METHOD("stop"), &TCP_Server::stop);
+}
+
+Error TCP_Server::listen(uint16_t p_port, const IP_Address &p_bind_address) {
+
+ ERR_FAIL_COND_V(!_sock.is_valid(), ERR_UNAVAILABLE);
+ ERR_FAIL_COND_V(_sock->is_open(), ERR_ALREADY_IN_USE);
+ ERR_FAIL_COND_V(!p_bind_address.is_valid() && !p_bind_address.is_wildcard(), ERR_INVALID_PARAMETER);
+
+ Error err;
+ IP::Type ip_type = IP::TYPE_ANY;
+
+ // If the bind address is valid use its type as the socket type
+ if (p_bind_address.is_valid())
+ ip_type = p_bind_address.is_ipv4() ? IP::TYPE_IPV4 : IP::TYPE_IPV6;
+
+ err = _sock->open(NetSocket::TYPE_TCP, ip_type);
+
+ ERR_FAIL_COND_V(err != OK, ERR_CANT_CREATE);
+
+ _sock->set_blocking_enabled(false);
+ _sock->set_reuse_address_enabled(true);
+
+ err = _sock->bind(p_bind_address, p_port);
+
+ if (err != OK) {
+
+ _sock->close();
+ return ERR_ALREADY_IN_USE;
+ }
-Ref<TCP_Server> TCP_Server::create_ref() {
+ err = _sock->listen(MAX_PENDING_CONNECTIONS);
- if (!_create)
- return NULL;
- return Ref<TCP_Server>(_create());
+ if (err != OK) {
+ _sock->close();
+ return FAILED;
+ }
+ return OK;
}
-TCP_Server *TCP_Server::create() {
+bool TCP_Server::is_connection_available() const {
- if (!_create)
- return NULL;
- return _create();
+ ERR_FAIL_COND_V(!_sock.is_valid(), false);
+
+ if (!_sock->is_open())
+ return false;
+
+ Error err = _sock->poll(NetSocket::POLL_TYPE_IN, 0);
+ if (err != OK) {
+ return false;
+ }
+
+ return true;
}
-void TCP_Server::_bind_methods() {
+Ref<StreamPeerTCP> TCP_Server::take_connection() {
- ClassDB::bind_method(D_METHOD("listen", "port", "bind_address"), &TCP_Server::listen, DEFVAL("*"));
- ClassDB::bind_method(D_METHOD("is_connection_available"), &TCP_Server::is_connection_available);
- ClassDB::bind_method(D_METHOD("take_connection"), &TCP_Server::take_connection);
- ClassDB::bind_method(D_METHOD("stop"), &TCP_Server::stop);
+ Ref<StreamPeerTCP> conn;
+ if (!is_connection_available()) {
+ return conn;
+ }
+
+ Ref<NetSocket> ns;
+ IP_Address ip;
+ uint16_t port = 0;
+ ns = _sock->accept(ip, port);
+ if (!ns.is_valid())
+ return conn;
+
+ conn = Ref<StreamPeerTCP>(memnew(StreamPeerTCP));
+ conn->accept_socket(ns, ip, port);
+ return conn;
+}
+
+void TCP_Server::stop() {
+
+ if (_sock.is_valid()) {
+ _sock->close();
+ }
}
TCP_Server::TCP_Server() {
+
+ _sock = Ref<NetSocket>(NetSocket::create());
+}
+
+TCP_Server::~TCP_Server() {
+
+ stop();
}
diff --git a/core/io/tcp_server.h b/core/io/tcp_server.h
index a250e8b249..4c89197d9a 100644
--- a/core/io/tcp_server.h
+++ b/core/io/tcp_server.h
@@ -31,31 +31,32 @@
#ifndef TCP_SERVER_H
#define TCP_SERVER_H
-#include "io/ip.h"
-#include "io/stream_peer.h"
-#include "stream_peer_tcp.h"
+#include "core/io/ip.h"
+#include "core/io/net_socket.h"
+#include "core/io/stream_peer.h"
+#include "core/io/stream_peer_tcp.h"
class TCP_Server : public Reference {
GDCLASS(TCP_Server, Reference);
protected:
- static TCP_Server *(*_create)();
+ enum {
+ MAX_PENDING_CONNECTIONS = 8
+ };
- //bind helper
+ Ref<NetSocket> _sock;
static void _bind_methods();
public:
- virtual Error listen(uint16_t p_port, const IP_Address &p_bind_address = IP_Address("*")) = 0;
- virtual bool is_connection_available() const = 0;
- virtual Ref<StreamPeerTCP> take_connection() = 0;
+ Error listen(uint16_t p_port, const IP_Address &p_bind_address = IP_Address("*"));
+ bool is_connection_available() const;
+ Ref<StreamPeerTCP> take_connection();
- virtual void stop() = 0; //stop listening
-
- static Ref<TCP_Server> create_ref();
- static TCP_Server *create();
+ void stop(); // Stop listening
TCP_Server();
+ ~TCP_Server();
};
#endif // TCP_SERVER_H
diff --git a/core/io/translation_loader_po.cpp b/core/io/translation_loader_po.cpp
index 85c1fc5ddf..830c2b6694 100644
--- a/core/io/translation_loader_po.cpp
+++ b/core/io/translation_loader_po.cpp
@@ -29,8 +29,9 @@
/*************************************************************************/
#include "translation_loader_po.h"
-#include "os/file_access.h"
-#include "translation.h"
+
+#include "core/os/file_access.h"
+#include "core/translation.h"
RES TranslationLoaderPO::load_translation(FileAccess *f, Error *r_error, const String &p_path) {
diff --git a/core/io/translation_loader_po.h b/core/io/translation_loader_po.h
index 33cf9bd8b4..670a9fdd7e 100644
--- a/core/io/translation_loader_po.h
+++ b/core/io/translation_loader_po.h
@@ -31,9 +31,10 @@
#ifndef TRANSLATION_LOADER_PO_H
#define TRANSLATION_LOADER_PO_H
-#include "io/resource_loader.h"
-#include "os/file_access.h"
-#include "translation.h"
+#include "core/io/resource_loader.h"
+#include "core/os/file_access.h"
+#include "core/translation.h"
+
class TranslationLoaderPO : public ResourceFormatLoader {
public:
static RES load_translation(FileAccess *f, Error *r_error, const String &p_path = String());
diff --git a/core/io/xml_parser.cpp b/core/io/xml_parser.cpp
index 33c9b56d5a..8c0cbd6e55 100644
--- a/core/io/xml_parser.cpp
+++ b/core/io/xml_parser.cpp
@@ -29,7 +29,9 @@
/*************************************************************************/
#include "xml_parser.h"
-#include "print_string.h"
+
+#include "core/print_string.h"
+
//#define DEBUG_XML
VARIANT_ENUM_CAST(XMLParser::NodeType);
diff --git a/core/io/xml_parser.h b/core/io/xml_parser.h
index 297b57ffdc..bbc7671a0e 100644
--- a/core/io/xml_parser.h
+++ b/core/io/xml_parser.h
@@ -31,10 +31,10 @@
#ifndef XML_PARSER_H
#define XML_PARSER_H
-#include "os/file_access.h"
-#include "reference.h"
-#include "ustring.h"
-#include "vector.h"
+#include "core/os/file_access.h"
+#include "core/reference.h"
+#include "core/ustring.h"
+#include "core/vector.h"
/*
Based on irrXML (see their zlib license). Added mainly for compatibility with their Collada loader.
diff --git a/core/io/zip_io.h b/core/io/zip_io.h
index 3a7fdb0302..c3314a8990 100644
--- a/core/io/zip_io.h
+++ b/core/io/zip_io.h
@@ -31,8 +31,8 @@
#ifndef ZIP_IO_H
#define ZIP_IO_H
-#include "os/copymem.h"
-#include "os/file_access.h"
+#include "core/os/copymem.h"
+#include "core/os/file_access.h"
#include "thirdparty/minizip/unzip.h"
#include "thirdparty/minizip/zip.h"
diff --git a/core/list.h b/core/list.h
index f977df4634..281f253a59 100644
--- a/core/list.h
+++ b/core/list.h
@@ -31,8 +31,8 @@
#ifndef GLOBALS_LIST_H
#define GLOBALS_LIST_H
-#include "os/memory.h"
-#include "sort.h"
+#include "core/os/memory.h"
+#include "core/sort.h"
/**
* Generic Templatized Linked List Implementation.
diff --git a/core/map.h b/core/map.h
index 700d4b8693..cab8965bb3 100644
--- a/core/map.h
+++ b/core/map.h
@@ -31,7 +31,7 @@
#ifndef MAP_H
#define MAP_H
-#include "set.h"
+#include "core/set.h"
/**
@author Juan Linietsky <reduzio@gmail.com>
diff --git a/core/math/a_star.cpp b/core/math/a_star.cpp
index 021391da83..e4f93289e9 100644
--- a/core/math/a_star.cpp
+++ b/core/math/a_star.cpp
@@ -29,9 +29,10 @@
/*************************************************************************/
#include "a_star.h"
-#include "geometry.h"
+
+#include "core/math/geometry.h"
+#include "core/script_language.h"
#include "scene/scene_string_names.h"
-#include "script_language.h"
int AStar::get_available_point_id() const {
diff --git a/core/math/a_star.h b/core/math/a_star.h
index 8c1b5f64cb..d2ef765006 100644
--- a/core/math/a_star.h
+++ b/core/math/a_star.h
@@ -31,8 +31,9 @@
#ifndef ASTAR_H
#define ASTAR_H
-#include "reference.h"
-#include "self_list.h"
+#include "core/reference.h"
+#include "core/self_list.h"
+
/**
A* pathfinding algorithm
diff --git a/core/math/aabb.cpp b/core/math/aabb.cpp
index e2e71dda92..d0cb2b5195 100644
--- a/core/math/aabb.cpp
+++ b/core/math/aabb.cpp
@@ -30,7 +30,7 @@
#include "aabb.h"
-#include "print_string.h"
+#include "core/print_string.h"
real_t AABB::get_area() const {
diff --git a/core/math/aabb.h b/core/math/aabb.h
index cdb8eb48a3..0b03b7d314 100644
--- a/core/math/aabb.h
+++ b/core/math/aabb.h
@@ -31,9 +31,9 @@
#ifndef AABB_H
#define AABB_H
-#include "math_defs.h"
-#include "plane.h"
-#include "vector3.h"
+#include "core/math/math_defs.h"
+#include "core/math/plane.h"
+#include "core/math/vector3.h"
/**
* AABB / AABB (Axis Aligned Bounding Box)
diff --git a/core/math/audio_frame.h b/core/math/audio_frame.h
index 67ba025e1c..fde26e8056 100644
--- a/core/math/audio_frame.h
+++ b/core/math/audio_frame.h
@@ -31,7 +31,7 @@
#ifndef AUDIOFRAME_H
#define AUDIOFRAME_H
-#include "typedefs.h"
+#include "core/typedefs.h"
static inline float undenormalise(volatile float f) {
union {
diff --git a/core/math/bsp_tree.cpp b/core/math/bsp_tree.cpp
index 24096de551..6e51c56357 100644
--- a/core/math/bsp_tree.cpp
+++ b/core/math/bsp_tree.cpp
@@ -29,8 +29,9 @@
/*************************************************************************/
#include "bsp_tree.h"
-#include "error_macros.h"
-#include "print_string.h"
+
+#include "core/error_macros.h"
+#include "core/print_string.h"
void BSP_Tree::from_aabb(const AABB &p_aabb) {
diff --git a/core/math/bsp_tree.h b/core/math/bsp_tree.h
index fb16818ae7..b06e6b8539 100644
--- a/core/math/bsp_tree.h
+++ b/core/math/bsp_tree.h
@@ -31,13 +31,13 @@
#ifndef BSP_TREE_H
#define BSP_TREE_H
-#include "aabb.h"
-#include "dvector.h"
-#include "face3.h"
-#include "method_ptrcall.h"
-#include "plane.h"
-#include "variant.h"
-#include "vector.h"
+#include "core/dvector.h"
+#include "core/math/aabb.h"
+#include "core/math/face3.h"
+#include "core/math/plane.h"
+#include "core/method_ptrcall.h"
+#include "core/variant.h"
+#include "core/vector.h"
/**
@author Juan Linietsky <reduzio@gmail.com>
*/
diff --git a/core/math/camera_matrix.cpp b/core/math/camera_matrix.cpp
index 1ab9b3532e..3a082d5720 100644
--- a/core/math/camera_matrix.cpp
+++ b/core/math/camera_matrix.cpp
@@ -29,8 +29,9 @@
/*************************************************************************/
#include "camera_matrix.h"
-#include "math_funcs.h"
-#include "print_string.h"
+
+#include "core/math/math_funcs.h"
+#include "core/print_string.h"
void CameraMatrix::set_identity() {
diff --git a/core/math/camera_matrix.h b/core/math/camera_matrix.h
index a689c7238a..bd20908ad9 100644
--- a/core/math/camera_matrix.h
+++ b/core/math/camera_matrix.h
@@ -31,8 +31,9 @@
#ifndef CAMERA_MATRIX_H
#define CAMERA_MATRIX_H
-#include "rect2.h"
-#include "transform.h"
+#include "core/math/rect2.h"
+#include "core/math/transform.h"
+
/**
@author Juan Linietsky <reduzio@gmail.com>
*/
diff --git a/core/math/delaunay.h b/core/math/delaunay.h
index d47dc5240b..9c5eef9069 100644
--- a/core/math/delaunay.h
+++ b/core/math/delaunay.h
@@ -31,7 +31,7 @@
#ifndef DELAUNAY_H
#define DELAUNAY_H
-#include "rect2.h"
+#include "core/math/rect2.h"
class Delaunay2D {
public:
diff --git a/core/math/expression.cpp b/core/math/expression.cpp
index 53e6aae36c..c0d7f874d2 100644
--- a/core/math/expression.cpp
+++ b/core/math/expression.cpp
@@ -30,13 +30,13 @@
#include "expression.h"
-#include "class_db.h"
-#include "func_ref.h"
-#include "io/marshalls.h"
-#include "math_funcs.h"
-#include "os/os.h"
-#include "reference.h"
-#include "variant_parser.h"
+#include "core/class_db.h"
+#include "core/func_ref.h"
+#include "core/io/marshalls.h"
+#include "core/math/math_funcs.h"
+#include "core/os/os.h"
+#include "core/reference.h"
+#include "core/variant_parser.h"
const char *Expression::func_name[Expression::FUNC_MAX] = {
"sin",
diff --git a/core/math/face3.cpp b/core/math/face3.cpp
index 801f2a3b4d..aa46fde7f7 100644
--- a/core/math/face3.cpp
+++ b/core/math/face3.cpp
@@ -29,7 +29,8 @@
/*************************************************************************/
#include "face3.h"
-#include "geometry.h"
+
+#include "core/math/geometry.h"
int Face3::split_by_plane(const Plane &p_plane, Face3 p_res[3], bool p_is_point_over[3]) const {
diff --git a/core/math/face3.h b/core/math/face3.h
index faed0fa8d4..b41daf04d4 100644
--- a/core/math/face3.h
+++ b/core/math/face3.h
@@ -31,10 +31,10 @@
#ifndef FACE3_H
#define FACE3_H
-#include "aabb.h"
-#include "plane.h"
-#include "transform.h"
-#include "vector3.h"
+#include "core/math/aabb.h"
+#include "core/math/plane.h"
+#include "core/math/transform.h"
+#include "core/math/vector3.h"
class Face3 {
public:
diff --git a/core/math/geometry.cpp b/core/math/geometry.cpp
index d8cb657b5e..be5e40e4e6 100644
--- a/core/math/geometry.cpp
+++ b/core/math/geometry.cpp
@@ -29,7 +29,8 @@
/*************************************************************************/
#include "geometry.h"
-#include "print_string.h"
+
+#include "core/print_string.h"
bool Geometry::is_point_in_polygon(const Vector2 &p_point, const Vector<Vector2> &p_polygon) {
diff --git a/core/math/geometry.h b/core/math/geometry.h
index 83b9467a30..a813a90774 100644
--- a/core/math/geometry.h
+++ b/core/math/geometry.h
@@ -31,14 +31,15 @@
#ifndef GEOMETRY_H
#define GEOMETRY_H
-#include "dvector.h"
-#include "face3.h"
-#include "object.h"
-#include "print_string.h"
-#include "rect2.h"
-#include "triangulate.h"
-#include "vector.h"
-#include "vector3.h"
+#include "core/dvector.h"
+#include "core/math/face3.h"
+#include "core/math/rect2.h"
+#include "core/math/triangulate.h"
+#include "core/math/vector3.h"
+#include "core/object.h"
+#include "core/print_string.h"
+#include "core/vector.h"
+
/**
@author Juan Linietsky <reduzio@gmail.com>
*/
diff --git a/core/math/math_funcs.h b/core/math/math_funcs.h
index 992084a653..472baf0484 100644
--- a/core/math/math_funcs.h
+++ b/core/math/math_funcs.h
@@ -31,8 +31,8 @@
#ifndef MATH_FUNCS_H
#define MATH_FUNCS_H
-#include "math_defs.h"
-#include "typedefs.h"
+#include "core/math/math_defs.h"
+#include "core/typedefs.h"
#include "thirdparty/misc/pcg.h"
diff --git a/core/math/matrix3.cpp b/core/math/matrix3.cpp
index 7db41756ed..fca54b1556 100644
--- a/core/math/matrix3.cpp
+++ b/core/math/matrix3.cpp
@@ -29,9 +29,11 @@
/*************************************************************************/
#include "matrix3.h"
-#include "math_funcs.h"
-#include "os/copymem.h"
-#include "print_string.h"
+
+#include "core/math/math_funcs.h"
+#include "core/os/copymem.h"
+#include "core/print_string.h"
+
#define cofac(row1, col1, row2, col2) \
(elements[row1][col1] * elements[row2][col2] - elements[row1][col2] * elements[row2][col1])
diff --git a/core/math/matrix3.h b/core/math/matrix3.h
index 9ff1a97dc9..35bf75bbe4 100644
--- a/core/math/matrix3.h
+++ b/core/math/matrix3.h
@@ -28,16 +28,18 @@
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
/*************************************************************************/
-#include "vector3.h"
+// Circular dependency between Vector3 and Basis :/
+#include "core/math/vector3.h"
#ifndef MATRIX3_H
#define MATRIX3_H
-#include "quat.h"
+#include "core/math/quat.h"
/**
@author Juan Linietsky <reduzio@gmail.com>
*/
+
class Basis {
public:
Vector3 elements[3];
diff --git a/core/math/octree.h b/core/math/octree.h
index 4e3d6257f0..cd89743a5a 100644
--- a/core/math/octree.h
+++ b/core/math/octree.h
@@ -31,12 +31,12 @@
#ifndef OCTREE_H
#define OCTREE_H
-#include "aabb.h"
-#include "list.h"
-#include "map.h"
-#include "print_string.h"
-#include "variant.h"
-#include "vector3.h"
+#include "core/list.h"
+#include "core/map.h"
+#include "core/math/aabb.h"
+#include "core/math/vector3.h"
+#include "core/print_string.h"
+#include "core/variant.h"
/**
@author Juan Linietsky <reduzio@gmail.com>
@@ -478,7 +478,7 @@ void Octree<T, use_pairs, AL>::_insert_element(Element *p_element, Octant *p_oct
splits++;
}
} else {
- /* check againt AABB where child should be */
+ /* check against AABB where child should be */
AABB aabb = p_octant->aabb;
aabb.size *= 0.5;
diff --git a/core/math/plane.cpp b/core/math/plane.cpp
index 78bb1771a4..3c597d57f8 100644
--- a/core/math/plane.cpp
+++ b/core/math/plane.cpp
@@ -30,7 +30,7 @@
#include "plane.h"
-#include "math_funcs.h"
+#include "core/math/math_funcs.h"
#define _PLANE_EQ_DOT_EPSILON 0.999
#define _PLANE_EQ_D_EPSILON 0.0001
diff --git a/core/math/plane.h b/core/math/plane.h
index e567422dd0..4eedebb79e 100644
--- a/core/math/plane.h
+++ b/core/math/plane.h
@@ -31,7 +31,7 @@
#ifndef PLANE_H
#define PLANE_H
-#include "vector3.h"
+#include "core/math/vector3.h"
class Plane {
public:
diff --git a/core/math/quat.cpp b/core/math/quat.cpp
index 2251571146..d660ce4553 100644
--- a/core/math/quat.cpp
+++ b/core/math/quat.cpp
@@ -29,8 +29,9 @@
/*************************************************************************/
#include "quat.h"
-#include "matrix3.h"
-#include "print_string.h"
+
+#include "core/math/matrix3.h"
+#include "core/print_string.h"
// set_euler_xyz expects a vector containing the Euler angles in the format
// (ax,ay,az), where ax is the angle of rotation around x axis,
diff --git a/core/math/quat.h b/core/math/quat.h
index 6dc8d66f60..10d3846c87 100644
--- a/core/math/quat.h
+++ b/core/math/quat.h
@@ -28,18 +28,20 @@
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
/*************************************************************************/
-#include "vector3.h"
+// Circular dependency between Vector3 and Basis :/
+#include "core/math/vector3.h"
#ifndef QUAT_H
#define QUAT_H
-#include "math_defs.h"
-#include "math_funcs.h"
-#include "ustring.h"
+#include "core/math/math_defs.h"
+#include "core/math/math_funcs.h"
+#include "core/ustring.h"
/**
@author Juan Linietsky <reduzio@gmail.com>
*/
+
class Quat {
public:
real_t x, y, z, w;
diff --git a/core/math/quick_hull.cpp b/core/math/quick_hull.cpp
index 9d4f4f66b7..23823b339a 100644
--- a/core/math/quick_hull.cpp
+++ b/core/math/quick_hull.cpp
@@ -29,7 +29,8 @@
/*************************************************************************/
#include "quick_hull.h"
-#include "map.h"
+
+#include "core/map.h"
uint32_t QuickHull::debug_stop_after = 0xFFFFFFFF;
diff --git a/core/math/quick_hull.h b/core/math/quick_hull.h
index eef4a9adff..0ac2758323 100644
--- a/core/math/quick_hull.h
+++ b/core/math/quick_hull.h
@@ -31,10 +31,10 @@
#ifndef QUICK_HULL_H
#define QUICK_HULL_H
-#include "aabb.h"
-#include "geometry.h"
-#include "list.h"
-#include "set.h"
+#include "core/list.h"
+#include "core/math/aabb.h"
+#include "core/math/geometry.h"
+#include "core/set.h"
class QuickHull {
diff --git a/core/math/rect2.cpp b/core/math/rect2.cpp
index 480bccdff1..24c1c8c984 100644
--- a/core/math/rect2.cpp
+++ b/core/math/rect2.cpp
@@ -28,7 +28,7 @@
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
/*************************************************************************/
-#include "transform_2d.h" // Includes rect2.h but Rect2 needs Transform2D
+#include "core/math/transform_2d.h" // Includes rect2.h but Rect2 needs Transform2D
bool Rect2::intersects_segment(const Point2 &p_from, const Point2 &p_to, Point2 *r_pos, Point2 *r_normal) const {
diff --git a/core/math/rect2.h b/core/math/rect2.h
index 20329bee0d..96c0e177d3 100644
--- a/core/math/rect2.h
+++ b/core/math/rect2.h
@@ -31,7 +31,7 @@
#ifndef RECT2_H
#define RECT2_H
-#include "vector2.h" // also includes math_funcs and ustring
+#include "core/math/vector2.h" // also includes math_funcs and ustring
struct Transform2D;
diff --git a/core/math/transform.cpp b/core/math/transform.cpp
index 976e0f174e..75257a6e60 100644
--- a/core/math/transform.cpp
+++ b/core/math/transform.cpp
@@ -29,9 +29,10 @@
/*************************************************************************/
#include "transform.h"
-#include "math_funcs.h"
-#include "os/copymem.h"
-#include "print_string.h"
+
+#include "core/math/math_funcs.h"
+#include "core/os/copymem.h"
+#include "core/print_string.h"
void Transform::affine_invert() {
diff --git a/core/math/transform.h b/core/math/transform.h
index c06eaec604..97c8bf9ab0 100644
--- a/core/math/transform.h
+++ b/core/math/transform.h
@@ -31,12 +31,14 @@
#ifndef TRANSFORM_H
#define TRANSFORM_H
-#include "aabb.h"
-#include "matrix3.h"
-#include "plane.h"
+#include "core/math/aabb.h"
+#include "core/math/matrix3.h"
+#include "core/math/plane.h"
+
/**
@author Juan Linietsky <reduzio@gmail.com>
*/
+
class Transform {
public:
Basis basis;
diff --git a/core/math/transform_2d.h b/core/math/transform_2d.h
index bf73755f0d..c8fc3c39e3 100644
--- a/core/math/transform_2d.h
+++ b/core/math/transform_2d.h
@@ -31,7 +31,7 @@
#ifndef TRANSFORM_2D_H
#define TRANSFORM_2D_H
-#include "rect2.h" // also includes vector2, math_funcs, and ustring
+#include "core/math/rect2.h" // also includes vector2, math_funcs, and ustring
struct Transform2D {
// Warning #1: basis of Transform2D is stored differently from Basis. In terms of elements array, the basis matrix looks like "on paper":
diff --git a/core/math/triangle_mesh.cpp b/core/math/triangle_mesh.cpp
index 5475f733c3..6b8dc5eeb3 100644
--- a/core/math/triangle_mesh.cpp
+++ b/core/math/triangle_mesh.cpp
@@ -29,7 +29,8 @@
/*************************************************************************/
#include "triangle_mesh.h"
-#include "sort.h"
+
+#include "core/sort.h"
int TriangleMesh::_create_bvh(BVH *p_bvh, BVH **p_bb, int p_from, int p_size, int p_depth, int &max_depth, int &max_alloc) {
diff --git a/core/math/triangle_mesh.h b/core/math/triangle_mesh.h
index bf793fc50f..e5f181fba7 100644
--- a/core/math/triangle_mesh.h
+++ b/core/math/triangle_mesh.h
@@ -31,8 +31,9 @@
#ifndef TRIANGLE_MESH_H
#define TRIANGLE_MESH_H
-#include "face3.h"
-#include "reference.h"
+#include "core/math/face3.h"
+#include "core/reference.h"
+
class TriangleMesh : public Reference {
GDCLASS(TriangleMesh, Reference);
diff --git a/core/math/triangulate.cpp b/core/math/triangulate.cpp
index 0edc0ea039..69ffc95946 100644
--- a/core/math/triangulate.cpp
+++ b/core/math/triangulate.cpp
@@ -186,7 +186,7 @@ bool Triangulate::triangulate(const Vector<Vector2> &contour, Vector<int> &resul
nv--;
- /* resest error detection counter */
+ /* reset error detection counter */
count = 2 * nv;
}
}
diff --git a/core/math/triangulate.h b/core/math/triangulate.h
index a0f56f5f27..2b0557ee55 100644
--- a/core/math/triangulate.h
+++ b/core/math/triangulate.h
@@ -31,7 +31,7 @@
#ifndef TRIANGULATE_H
#define TRIANGULATE_H
-#include "vector2.h"
+#include "core/math/vector2.h"
/*
http://www.flipcode.com/archives/Efficient_Polygon_Triangulation.shtml
diff --git a/core/math/vector2.h b/core/math/vector2.h
index fbcdc80b60..df49484aaf 100644
--- a/core/math/vector2.h
+++ b/core/math/vector2.h
@@ -31,8 +31,8 @@
#ifndef VECTOR2_H
#define VECTOR2_H
-#include "math_funcs.h"
-#include "ustring.h"
+#include "core/math/math_funcs.h"
+#include "core/ustring.h"
struct Vector2i;
diff --git a/core/math/vector3.cpp b/core/math/vector3.cpp
index 78d52d5cd1..5dbb01493d 100644
--- a/core/math/vector3.cpp
+++ b/core/math/vector3.cpp
@@ -29,7 +29,8 @@
/*************************************************************************/
#include "vector3.h"
-#include "matrix3.h"
+
+#include "core/math/matrix3.h"
void Vector3::rotate(const Vector3 &p_axis, real_t p_phi) {
diff --git a/core/math/vector3.h b/core/math/vector3.h
index 5f0e8919ff..5302832eeb 100644
--- a/core/math/vector3.h
+++ b/core/math/vector3.h
@@ -31,10 +31,10 @@
#ifndef VECTOR3_H
#define VECTOR3_H
-#include "math_defs.h"
-#include "math_funcs.h"
-#include "typedefs.h"
-#include "ustring.h"
+#include "core/math/math_defs.h"
+#include "core/math/math_funcs.h"
+#include "core/typedefs.h"
+#include "core/ustring.h"
class Basis;
@@ -150,13 +150,8 @@ struct Vector3 {
}
};
-#ifdef VECTOR3_IMPL_OVERRIDE
-
-#include "vector3_inline.h"
-
-#else
-
-#include "matrix3.h"
+// Should be included after class definition, otherwise we get circular refs
+#include "core/math/matrix3.h"
Vector3 Vector3::cross(const Vector3 &p_b) const {
@@ -451,6 +446,4 @@ Vector3 Vector3::reflect(const Vector3 &p_normal) const {
return 2.0 * p_normal * this->dot(p_normal) - *this;
}
-#endif
-
#endif // VECTOR3_H
diff --git a/core/message_queue.cpp b/core/message_queue.cpp
index 97ee236a46..7f788c90a7 100644
--- a/core/message_queue.cpp
+++ b/core/message_queue.cpp
@@ -30,8 +30,8 @@
#include "message_queue.h"
-#include "project_settings.h"
-#include "script_language.h"
+#include "core/project_settings.h"
+#include "core/script_language.h"
MessageQueue *MessageQueue::singleton = NULL;
diff --git a/core/message_queue.h b/core/message_queue.h
index be5ffe4fae..f51da3c7a3 100644
--- a/core/message_queue.h
+++ b/core/message_queue.h
@@ -31,9 +31,9 @@
#ifndef MESSAGE_QUEUE_H
#define MESSAGE_QUEUE_H
-#include "object.h"
-#include "os/mutex.h"
-#include "os/thread_safe.h"
+#include "core/object.h"
+#include "core/os/mutex.h"
+#include "core/os/thread_safe.h"
class MessageQueue {
diff --git a/core/method_bind.cpp b/core/method_bind.cpp
index 52ee9e0848..fa5b88b5ac 100644
--- a/core/method_bind.cpp
+++ b/core/method_bind.cpp
@@ -30,7 +30,7 @@
// object.h needs to be the first include *before* method_bind.h
// FIXME: Find out why and fix potential cyclical dependencies.
-#include "object.h"
+#include "core/object.h"
#include "method_bind.h"
diff --git a/core/method_bind.h b/core/method_bind.h
index 7ee687ee40..7788de919c 100644
--- a/core/method_bind.h
+++ b/core/method_bind.h
@@ -31,10 +31,11 @@
#ifndef METHOD_BIND_H
#define METHOD_BIND_H
-#include "list.h"
-#include "method_ptrcall.h"
-#include "object.h"
-#include "variant.h"
+#include "core/list.h"
+#include "core/method_ptrcall.h"
+#include "core/object.h"
+#include "core/variant.h"
+
#include <stdio.h>
/**
@@ -45,7 +46,7 @@
#define DEBUG_METHODS_ENABLED
#endif
-#include "type_info.h"
+#include "core/type_info.h"
enum MethodFlags {
diff --git a/core/method_ptrcall.h b/core/method_ptrcall.h
index 6a33cf4d70..b706e65d53 100644
--- a/core/method_ptrcall.h
+++ b/core/method_ptrcall.h
@@ -31,9 +31,9 @@
#ifndef METHOD_PTRCALL_H
#define METHOD_PTRCALL_H
-#include "transform_2d.h"
-#include "typedefs.h"
-#include "variant.h"
+#include "core/math/transform_2d.h"
+#include "core/typedefs.h"
+#include "core/variant.h"
#ifdef PTRCALL_ENABLED
diff --git a/core/node_path.cpp b/core/node_path.cpp
index 7d4116fa1e..35d6fdcf10 100644
--- a/core/node_path.cpp
+++ b/core/node_path.cpp
@@ -30,7 +30,7 @@
#include "node_path.h"
-#include "print_string.h"
+#include "core/print_string.h"
void NodePath::_update_hash_cache() const {
diff --git a/core/node_path.h b/core/node_path.h
index 71235029af..4a72d4a4d5 100644
--- a/core/node_path.h
+++ b/core/node_path.h
@@ -31,8 +31,9 @@
#ifndef NODE_PATH_H
#define NODE_PATH_H
-#include "string_db.h"
-#include "ustring.h"
+#include "core/string_db.h"
+#include "core/ustring.h"
+
/**
@author Juan Linietsky <reduzio@gmail.com>
*/
diff --git a/core/oa_hash_map.h b/core/oa_hash_map.h
index 3a17fc21f3..a2d76381ca 100644
--- a/core/oa_hash_map.h
+++ b/core/oa_hash_map.h
@@ -31,10 +31,10 @@
#ifndef OA_HASH_MAP_H
#define OA_HASH_MAP_H
-#include "hashfuncs.h"
-#include "math_funcs.h"
-#include "os/copymem.h"
-#include "os/memory.h"
+#include "core/hashfuncs.h"
+#include "core/math/math_funcs.h"
+#include "core/os/copymem.h"
+#include "core/os/memory.h"
/**
* A HashMap implementation that uses open addressing with robinhood hashing.
diff --git a/core/object.cpp b/core/object.cpp
index 24a31930a0..96914fe141 100644
--- a/core/object.cpp
+++ b/core/object.cpp
@@ -30,14 +30,14 @@
#include "object.h"
-#include "class_db.h"
-#include "core_string_names.h"
-#include "message_queue.h"
-#include "os/os.h"
-#include "print_string.h"
-#include "resource.h"
-#include "script_language.h"
-#include "translation.h"
+#include "core/class_db.h"
+#include "core/core_string_names.h"
+#include "core/message_queue.h"
+#include "core/os/os.h"
+#include "core/print_string.h"
+#include "core/resource.h"
+#include "core/script_language.h"
+#include "core/translation.h"
#ifdef DEBUG_ENABLED
diff --git a/core/object.h b/core/object.h
index 43e1cf4785..be405a47a6 100644
--- a/core/object.h
+++ b/core/object.h
@@ -31,13 +31,13 @@
#ifndef OBJECT_H
#define OBJECT_H
-#include "hash_map.h"
-#include "list.h"
-#include "map.h"
-#include "os/rw_lock.h"
-#include "set.h"
-#include "variant.h"
-#include "vmap.h"
+#include "core/hash_map.h"
+#include "core/list.h"
+#include "core/map.h"
+#include "core/os/rw_lock.h"
+#include "core/set.h"
+#include "core/variant.h"
+#include "core/vmap.h"
#define VARIANT_ARG_LIST const Variant &p_arg1 = Variant(), const Variant &p_arg2 = Variant(), const Variant &p_arg3 = Variant(), const Variant &p_arg4 = Variant(), const Variant &p_arg5 = Variant()
#define VARIANT_ARG_PASS p_arg1, p_arg2, p_arg3, p_arg4, p_arg5
@@ -779,6 +779,6 @@ public:
};
//needed by macros
-#include "class_db.h"
+#include "core/class_db.h"
#endif
diff --git a/core/ordered_hash_map.h b/core/ordered_hash_map.h
index 93ce9a90a7..092bf314d0 100644
--- a/core/ordered_hash_map.h
+++ b/core/ordered_hash_map.h
@@ -31,9 +31,9 @@
#ifndef ORDERED_HASH_MAP_H
#define ORDERED_HASH_MAP_H
-#include "hash_map.h"
-#include "list.h"
-#include "pair.h"
+#include "core/hash_map.h"
+#include "core/list.h"
+#include "core/pair.h"
/**
* A hash map which allows to iterate elements in insertion order.
diff --git a/core/os/copymem.h b/core/os/copymem.h
index 87d77bd426..999c770e85 100644
--- a/core/os/copymem.h
+++ b/core/os/copymem.h
@@ -31,7 +31,7 @@
#ifndef COPYMEM_H
#define COPYMEM_H
-#include "typedefs.h"
+#include "core/typedefs.h"
#ifdef PLATFORM_COPYMEM
diff --git a/core/os/dir_access.cpp b/core/os/dir_access.cpp
index e631d6e994..dbd62cb3bb 100644
--- a/core/os/dir_access.cpp
+++ b/core/os/dir_access.cpp
@@ -29,10 +29,11 @@
/*************************************************************************/
#include "dir_access.h"
-#include "os/file_access.h"
-#include "os/memory.h"
-#include "os/os.h"
-#include "project_settings.h"
+
+#include "core/os/file_access.h"
+#include "core/os/memory.h"
+#include "core/os/os.h"
+#include "core/project_settings.h"
String DirAccess::_get_root_path() const {
diff --git a/core/os/dir_access.h b/core/os/dir_access.h
index 4df0618021..773f0bcd41 100644
--- a/core/os/dir_access.h
+++ b/core/os/dir_access.h
@@ -31,14 +31,14 @@
#ifndef DIR_ACCESS_H
#define DIR_ACCESS_H
-#include "typedefs.h"
-#include "ustring.h"
+#include "core/typedefs.h"
+#include "core/ustring.h"
/**
@author Juan Linietsky <reduzio@gmail.com>
*/
-//@ TOOD, excellent candidate for THREAD_SAFE MACRO, should go through all these and add THREAD_SAFE where it applies
+//@ TODO, excellent candidate for THREAD_SAFE MACRO, should go through all these and add THREAD_SAFE where it applies
class DirAccess {
public:
enum AccessType {
diff --git a/core/os/file_access.cpp b/core/os/file_access.cpp
index 59f07c03e7..224dea3343 100644
--- a/core/os/file_access.cpp
+++ b/core/os/file_access.cpp
@@ -32,8 +32,8 @@
#include "core/io/file_access_pack.h"
#include "core/io/marshalls.h"
-#include "os/os.h"
-#include "project_settings.h"
+#include "core/os/os.h"
+#include "core/project_settings.h"
#include "thirdparty/misc/md5.h"
#include "thirdparty/misc/sha256.h"
diff --git a/core/os/file_access.h b/core/os/file_access.h
index c4635fdfbb..b7d93e9f5d 100644
--- a/core/os/file_access.h
+++ b/core/os/file_access.h
@@ -31,10 +31,11 @@
#ifndef FILE_ACCESS_H
#define FILE_ACCESS_H
-#include "math_defs.h"
-#include "os/memory.h"
-#include "typedefs.h"
-#include "ustring.h"
+#include "core/math/math_defs.h"
+#include "core/os/memory.h"
+#include "core/typedefs.h"
+#include "core/ustring.h"
+
/**
* Multi-Platform abstraction for accessing to files.
*/
diff --git a/core/os/input.cpp b/core/os/input.cpp
index a5b0f91e63..6830df7e81 100644
--- a/core/os/input.cpp
+++ b/core/os/input.cpp
@@ -29,9 +29,11 @@
/*************************************************************************/
#include "input.h"
-#include "input_map.h"
-#include "os/os.h"
-#include "project_settings.h"
+
+#include "core/input_map.h"
+#include "core/os/os.h"
+#include "core/project_settings.h"
+
Input *Input::singleton = NULL;
Input *Input::get_singleton() {
diff --git a/core/os/input.h b/core/os/input.h
index 001871c5dc..db523d6789 100644
--- a/core/os/input.h
+++ b/core/os/input.h
@@ -31,9 +31,9 @@
#ifndef INPUT_H
#define INPUT_H
-#include "object.h"
-#include "os/main_loop.h"
-#include "os/thread_safe.h"
+#include "core/object.h"
+#include "core/os/main_loop.h"
+#include "core/os/thread_safe.h"
class Input : public Object {
diff --git a/core/os/input_event.cpp b/core/os/input_event.cpp
index 12c6ef7d3b..cc359ef2ac 100644
--- a/core/os/input_event.cpp
+++ b/core/os/input_event.cpp
@@ -30,8 +30,8 @@
#include "input_event.h"
-#include "input_map.h"
-#include "os/keyboard.h"
+#include "core/input_map.h"
+#include "core/os/keyboard.h"
void InputEvent::set_device(int p_device) {
device = p_device;
diff --git a/core/os/input_event.h b/core/os/input_event.h
index 8732c7e377..cb61e61e7c 100644
--- a/core/os/input_event.h
+++ b/core/os/input_event.h
@@ -31,11 +31,12 @@
#ifndef INPUT_EVENT_H
#define INPUT_EVENT_H
-#include "os/copymem.h"
-#include "resource.h"
-#include "transform_2d.h"
-#include "typedefs.h"
-#include "ustring.h"
+#include "core/math/transform_2d.h"
+#include "core/os/copymem.h"
+#include "core/resource.h"
+#include "core/typedefs.h"
+#include "core/ustring.h"
+
/**
@author Juan Linietsky <reduzio@gmail.com>
*/
diff --git a/core/os/keyboard.cpp b/core/os/keyboard.cpp
index 9dfc91e308..abc579c58d 100644
--- a/core/os/keyboard.cpp
+++ b/core/os/keyboard.cpp
@@ -29,7 +29,8 @@
/*************************************************************************/
#include "keyboard.h"
-#include "os/os.h"
+
+#include "core/os/os.h"
struct _KeyCodeText {
int code;
diff --git a/core/os/keyboard.h b/core/os/keyboard.h
index a0e6f8b2ef..17bf5eaa48 100644
--- a/core/os/keyboard.h
+++ b/core/os/keyboard.h
@@ -31,13 +31,10 @@
#ifndef KEYBOARD_H
#define KEYBOARD_H
-#include "ustring.h"
-/**
- @author Juan Linietsky <reduzio@gmail.com>
-*/
+#include "core/ustring.h"
/**
-@author Juan Linietsky <reduzio@gmail.com>
+ @author Juan Linietsky <reduzio@gmail.com>
*/
/*
diff --git a/core/os/main_loop.cpp b/core/os/main_loop.cpp
index 6dba77ec9a..0945cdd512 100644
--- a/core/os/main_loop.cpp
+++ b/core/os/main_loop.cpp
@@ -29,7 +29,8 @@
/*************************************************************************/
#include "main_loop.h"
-#include "script_language.h"
+
+#include "core/script_language.h"
void MainLoop::_bind_methods() {
diff --git a/core/os/main_loop.h b/core/os/main_loop.h
index f96e46141e..43f74302a8 100644
--- a/core/os/main_loop.h
+++ b/core/os/main_loop.h
@@ -31,12 +31,14 @@
#ifndef MAIN_LOOP_H
#define MAIN_LOOP_H
-#include "os/input_event.h"
-#include "reference.h"
-#include "script_language.h"
+#include "core/os/input_event.h"
+#include "core/reference.h"
+#include "core/script_language.h"
+
/**
@author Juan Linietsky <reduzio@gmail.com>
*/
+
class MainLoop : public Object {
GDCLASS(MainLoop, Object);
diff --git a/core/os/memory.cpp b/core/os/memory.cpp
index 3eab4343a9..041371a6e2 100644
--- a/core/os/memory.cpp
+++ b/core/os/memory.cpp
@@ -29,9 +29,11 @@
/*************************************************************************/
#include "memory.h"
-#include "copymem.h"
+
+#include "core/error_macros.h"
+#include "core/os/copymem.h"
#include "core/safe_refcount.h"
-#include "error_macros.h"
+
#include <stdio.h>
#include <stdlib.h>
diff --git a/core/os/memory.h b/core/os/memory.h
index f5c6c0b38a..3501c3f14e 100644
--- a/core/os/memory.h
+++ b/core/os/memory.h
@@ -31,7 +31,8 @@
#ifndef MEMORY_H
#define MEMORY_H
-#include "safe_refcount.h"
+#include "core/safe_refcount.h"
+
#include <stddef.h>
/**
diff --git a/core/os/midi_driver.cpp b/core/os/midi_driver.cpp
index 7b4f84473c..2b20a708ed 100644
--- a/core/os/midi_driver.cpp
+++ b/core/os/midi_driver.cpp
@@ -30,8 +30,8 @@
#include "midi_driver.h"
+#include "core/os/os.h"
#include "main/input_default.h"
-#include "os/os.h"
MIDIDriver *MIDIDriver::singleton = NULL;
MIDIDriver *MIDIDriver::get_singleton() {
diff --git a/core/os/midi_driver.h b/core/os/midi_driver.h
index 1a3a67a411..ceb4e71d66 100644
--- a/core/os/midi_driver.h
+++ b/core/os/midi_driver.h
@@ -31,8 +31,9 @@
#ifndef MIDI_DRIVER_H
#define MIDI_DRIVER_H
+#include "core/typedefs.h"
#include "core/variant.h"
-#include "typedefs.h"
+
/**
* Multi-Platform abstraction for accessing to MIDI.
*/
diff --git a/core/os/mutex.cpp b/core/os/mutex.cpp
index 7c4ea2323c..0c01b06bd6 100644
--- a/core/os/mutex.cpp
+++ b/core/os/mutex.cpp
@@ -29,7 +29,9 @@
/*************************************************************************/
#include "mutex.h"
-#include "error_macros.h"
+
+#include "core/error_macros.h"
+
#include <stddef.h>
Mutex *(*Mutex::create_func)(bool) = 0;
diff --git a/core/os/mutex.h b/core/os/mutex.h
index 9debe7f41b..788cc00397 100644
--- a/core/os/mutex.h
+++ b/core/os/mutex.h
@@ -31,7 +31,7 @@
#ifndef MUTEX_H
#define MUTEX_H
-#include "error_list.h"
+#include "core/error_list.h"
/**
* @class Mutex
diff --git a/core/os/os.cpp b/core/os/os.cpp
index 0e6251a4fb..7547b6a042 100644
--- a/core/os/os.cpp
+++ b/core/os/os.cpp
@@ -30,13 +30,13 @@
#include "os.h"
-#include "dir_access.h"
-#include "input.h"
-#include "os/file_access.h"
-#include "os/midi_driver.h"
-#include "project_settings.h"
+#include "core/os/dir_access.h"
+#include "core/os/file_access.h"
+#include "core/os/input.h"
+#include "core/os/midi_driver.h"
+#include "core/project_settings.h"
+#include "core/version_generated.gen.h"
#include "servers/audio_server.h"
-#include "version_generated.gen.h"
#include <stdarg.h>
diff --git a/core/os/os.h b/core/os/os.h
index 100af95ef1..7786ffb26e 100644
--- a/core/os/os.h
+++ b/core/os/os.h
@@ -31,13 +31,14 @@
#ifndef OS_H
#define OS_H
-#include "engine.h"
-#include "image.h"
-#include "io/logger.h"
-#include "list.h"
-#include "os/main_loop.h"
-#include "ustring.h"
-#include "vector.h"
+#include "core/engine.h"
+#include "core/image.h"
+#include "core/io/logger.h"
+#include "core/list.h"
+#include "core/os/main_loop.h"
+#include "core/ustring.h"
+#include "core/vector.h"
+
#include <stdarg.h>
/**
@@ -128,7 +129,7 @@ protected:
RenderThreadMode _render_thread_mode;
- // functions used by main to initialize/deintialize the OS
+ // functions used by main to initialize/deinitialize the OS
void add_logger(Logger *p_logger);
virtual void initialize_core() = 0;
diff --git a/core/os/rw_lock.cpp b/core/os/rw_lock.cpp
index 35489490ed..5e51a1dbce 100644
--- a/core/os/rw_lock.cpp
+++ b/core/os/rw_lock.cpp
@@ -30,7 +30,7 @@
#include "rw_lock.h"
-#include "error_macros.h"
+#include "core/error_macros.h"
#include <stddef.h>
diff --git a/core/os/rw_lock.h b/core/os/rw_lock.h
index 3e53300c9f..8d1029723b 100644
--- a/core/os/rw_lock.h
+++ b/core/os/rw_lock.h
@@ -31,7 +31,7 @@
#ifndef RWLOCK_H
#define RWLOCK_H
-#include "error_list.h"
+#include "core/error_list.h"
class RWLock {
protected:
diff --git a/core/os/semaphore.cpp b/core/os/semaphore.cpp
index 0377aeeb29..448d17dd14 100644
--- a/core/os/semaphore.cpp
+++ b/core/os/semaphore.cpp
@@ -29,7 +29,8 @@
/*************************************************************************/
#include "semaphore.h"
-#include "error_macros.h"
+
+#include "core/error_macros.h"
Semaphore *(*Semaphore::create_func)() = 0;
diff --git a/core/os/semaphore.h b/core/os/semaphore.h
index f3021bf74c..6cec06ea28 100644
--- a/core/os/semaphore.h
+++ b/core/os/semaphore.h
@@ -31,11 +31,12 @@
#ifndef SEMAPHORE_H
#define SEMAPHORE_H
-#include "error_list.h"
+#include "core/error_list.h"
/**
@author Juan Linietsky <reduzio@gmail.com>
*/
+
class Semaphore {
protected:
static Semaphore *(*create_func)();
diff --git a/core/os/shell.h b/core/os/shell.h
index d3d92028ea..146c35cbc8 100644
--- a/core/os/shell.h
+++ b/core/os/shell.h
@@ -31,8 +31,8 @@
#ifndef SHELL_H
#define SHELL_H
-#include "typedefs.h"
-#include "ustring.h"
+#include "core/typedefs.h"
+#include "core/ustring.h"
/**
@author Juan Linietsky <reduzio@gmail.com>
diff --git a/core/os/thread.h b/core/os/thread.h
index c2947bccab..97e97652a5 100644
--- a/core/os/thread.h
+++ b/core/os/thread.h
@@ -31,13 +31,13 @@
#ifndef THREAD_H
#define THREAD_H
-#include "typedefs.h"
+#include "core/typedefs.h"
+#include "core/ustring.h"
+
/**
@author Juan Linietsky <reduzio@gmail.com>
*/
-#include "ustring.h"
-
typedef void (*ThreadCreateCallback)(void *p_userdata);
class Thread {
diff --git a/core/os/thread_dummy.cpp b/core/os/thread_dummy.cpp
index b6371235c4..9e0adf9994 100644
--- a/core/os/thread_dummy.cpp
+++ b/core/os/thread_dummy.cpp
@@ -30,7 +30,7 @@
#include "thread_dummy.h"
-#include "memory.h"
+#include "core/os/memory.h"
Thread *ThreadDummy::create(ThreadCreateCallback p_callback, void *p_user, const Thread::Settings &p_settings) {
return memnew(ThreadDummy);
diff --git a/core/os/thread_dummy.h b/core/os/thread_dummy.h
index 74957b95fe..6f46a4a20c 100644
--- a/core/os/thread_dummy.h
+++ b/core/os/thread_dummy.h
@@ -31,10 +31,10 @@
#ifndef THREAD_DUMMY_H
#define THREAD_DUMMY_H
-#include "mutex.h"
-#include "rw_lock.h"
-#include "semaphore.h"
-#include "thread.h"
+#include "core/os/mutex.h"
+#include "core/os/rw_lock.h"
+#include "core/os/semaphore.h"
+#include "core/os/thread.h"
class ThreadDummy : public Thread {
diff --git a/core/os/thread_safe.cpp b/core/os/thread_safe.cpp
index acb37df02b..3fe039e1b6 100644
--- a/core/os/thread_safe.cpp
+++ b/core/os/thread_safe.cpp
@@ -29,8 +29,9 @@
/*************************************************************************/
#include "thread_safe.h"
-#include "error_macros.h"
-#include "os/memory.h"
+
+#include "core/error_macros.h"
+#include "core/os/memory.h"
ThreadSafe::ThreadSafe() {
diff --git a/core/os/thread_safe.h b/core/os/thread_safe.h
index f0876f38a1..a17ceeed1d 100644
--- a/core/os/thread_safe.h
+++ b/core/os/thread_safe.h
@@ -31,7 +31,7 @@
#ifndef THREAD_SAFE_H
#define THREAD_SAFE_H
-#include "os/mutex.h"
+#include "core/os/mutex.h"
class ThreadSafe {
diff --git a/core/os/threaded_array_processor.h b/core/os/threaded_array_processor.h
index 3ff7db2a44..89c3b7cec3 100644
--- a/core/os/threaded_array_processor.h
+++ b/core/os/threaded_array_processor.h
@@ -31,11 +31,11 @@
#ifndef THREADED_ARRAY_PROCESSOR_H
#define THREADED_ARRAY_PROCESSOR_H
-#include "os/mutex.h"
-#include "os/os.h"
-#include "os/thread.h"
-#include "safe_refcount.h"
-#include "thread_safe.h"
+#include "core/os/mutex.h"
+#include "core/os/os.h"
+#include "core/os/thread.h"
+#include "core/os/thread_safe.h"
+#include "core/safe_refcount.h"
template <class C, class U>
struct ThreadArrayProcessData {
diff --git a/core/packed_data_container.cpp b/core/packed_data_container.cpp
index 45e060fa4a..e4ca8fafa5 100644
--- a/core/packed_data_container.cpp
+++ b/core/packed_data_container.cpp
@@ -30,8 +30,8 @@
#include "packed_data_container.h"
-#include "core_string_names.h"
-#include "io/marshalls.h"
+#include "core/core_string_names.h"
+#include "core/io/marshalls.h"
Variant PackedDataContainer::getvar(const Variant &p_key, bool *r_valid) const {
diff --git a/core/packed_data_container.h b/core/packed_data_container.h
index fe36417000..0e1dff1f70 100644
--- a/core/packed_data_container.h
+++ b/core/packed_data_container.h
@@ -31,7 +31,7 @@
#ifndef PACKED_DATA_CONTAINER_H
#define PACKED_DATA_CONTAINER_H
-#include "resource.h"
+#include "core/resource.h"
class PackedDataContainer : public Resource {
diff --git a/core/pool_allocator.cpp b/core/pool_allocator.cpp
index 8952314212..6997c993f4 100644
--- a/core/pool_allocator.cpp
+++ b/core/pool_allocator.cpp
@@ -30,11 +30,11 @@
#include "pool_allocator.h"
+#include "core/error_macros.h"
+#include "core/os/copymem.h"
+#include "core/os/memory.h"
#include "core/os/os.h"
-#include "error_macros.h"
-#include "os/copymem.h"
-#include "os/memory.h"
-#include "print_string.h"
+#include "core/print_string.h"
#include <assert.h>
diff --git a/core/pool_allocator.h b/core/pool_allocator.h
index d9731aa3eb..12e2b597db 100644
--- a/core/pool_allocator.h
+++ b/core/pool_allocator.h
@@ -31,7 +31,7 @@
#ifndef POOL_ALLOCATOR_H
#define POOL_ALLOCATOR_H
-#include "typedefs.h"
+#include "core/typedefs.h"
/**
@author Juan Linietsky <reduzio@gmail.com>
diff --git a/core/print_string.cpp b/core/print_string.cpp
index e1e42d2b56..f53d50e078 100644
--- a/core/print_string.cpp
+++ b/core/print_string.cpp
@@ -30,7 +30,7 @@
#include "print_string.h"
-#include "os/os.h"
+#include "core/os/os.h"
#include <stdio.h>
diff --git a/core/print_string.h b/core/print_string.h
index c1d2d0ff3a..8f4fbb1f7b 100644
--- a/core/print_string.h
+++ b/core/print_string.h
@@ -31,7 +31,7 @@
#ifndef PRINT_STRING_H
#define PRINT_STRING_H
-#include "ustring.h"
+#include "core/ustring.h"
extern void (*_print_func)(String);
diff --git a/core/project_settings.cpp b/core/project_settings.cpp
index 890789ec6f..99a23bbee1 100644
--- a/core/project_settings.cpp
+++ b/core/project_settings.cpp
@@ -30,16 +30,17 @@
#include "project_settings.h"
-#include "bind/core_bind.h"
-#include "core_string_names.h"
-#include "io/file_access_network.h"
-#include "io/file_access_pack.h"
-#include "io/marshalls.h"
-#include "os/dir_access.h"
-#include "os/file_access.h"
-#include "os/keyboard.h"
-#include "os/os.h"
-#include "variant_parser.h"
+#include "core/bind/core_bind.h"
+#include "core/core_string_names.h"
+#include "core/io/file_access_network.h"
+#include "core/io/file_access_pack.h"
+#include "core/io/marshalls.h"
+#include "core/os/dir_access.h"
+#include "core/os/file_access.h"
+#include "core/os/keyboard.h"
+#include "core/os/os.h"
+#include "core/variant_parser.h"
+
#include <zlib.h>
#define FORMAT_VERSION 4
@@ -59,7 +60,7 @@ String ProjectSettings::get_resource_path() const {
String ProjectSettings::localize_path(const String &p_path) const {
if (resource_path == "")
- return p_path; //not initialied yet
+ return p_path; //not initialized yet
if (p_path.begins_with("res://") || p_path.begins_with("user://") ||
(p_path.is_abs_path() && !p_path.begins_with(resource_path)))
diff --git a/core/project_settings.h b/core/project_settings.h
index 75ebc5acc8..611355f2ef 100644
--- a/core/project_settings.h
+++ b/core/project_settings.h
@@ -31,9 +31,10 @@
#ifndef GLOBAL_CONFIG_H
#define GLOBAL_CONFIG_H
-#include "object.h"
-#include "os/thread_safe.h"
-#include "set.h"
+#include "core/object.h"
+#include "core/os/thread_safe.h"
+#include "core/set.h"
+
/**
@author Juan Linietsky <reduzio@gmail.com>
*/
diff --git a/core/ref_ptr.cpp b/core/ref_ptr.cpp
index e3ef817df1..7f0cc0cd75 100644
--- a/core/ref_ptr.cpp
+++ b/core/ref_ptr.cpp
@@ -30,8 +30,8 @@
#include "ref_ptr.h"
-#include "reference.h"
-#include "resource.h"
+#include "core/reference.h"
+#include "core/resource.h"
void RefPtr::operator=(const RefPtr &p_other) {
diff --git a/core/ref_ptr.h b/core/ref_ptr.h
index a074718d22..3f15c680b8 100644
--- a/core/ref_ptr.h
+++ b/core/ref_ptr.h
@@ -36,7 +36,7 @@
* It's basically an opaque container of a Reference reference, so Variant can use it.
*/
-#include "rid.h"
+#include "core/rid.h"
class RefPtr {
diff --git a/core/reference.cpp b/core/reference.cpp
index 6e1520d81d..b79ad0bf3d 100644
--- a/core/reference.cpp
+++ b/core/reference.cpp
@@ -30,7 +30,7 @@
#include "reference.h"
-#include "script_language.h"
+#include "core/script_language.h"
bool Reference::init_ref() {
diff --git a/core/reference.h b/core/reference.h
index 25e02180fa..4c607fed87 100644
--- a/core/reference.h
+++ b/core/reference.h
@@ -31,10 +31,10 @@
#ifndef REFERENCE_H
#define REFERENCE_H
-#include "class_db.h"
-#include "object.h"
-#include "ref_ptr.h"
-#include "safe_refcount.h"
+#include "core/class_db.h"
+#include "core/object.h"
+#include "core/ref_ptr.h"
+#include "core/safe_refcount.h"
/**
@author Juan Linietsky <reduzio@gmail.com>
diff --git a/core/register_core_types.cpp b/core/register_core_types.cpp
index 859015f44b..b0023b4c26 100644
--- a/core/register_core_types.cpp
+++ b/core/register_core_types.cpp
@@ -30,40 +30,40 @@
#include "register_core_types.h"
-#include "bind/core_bind.h"
-#include "class_db.h"
-#include "compressed_translation.h"
+#include "core/bind/core_bind.h"
+#include "core/class_db.h"
+#include "core/compressed_translation.h"
+#include "core/core_string_names.h"
+#include "core/engine.h"
+#include "core/func_ref.h"
+#include "core/input_map.h"
+#include "core/io/config_file.h"
+#include "core/io/http_client.h"
+#include "core/io/image_loader.h"
+#include "core/io/marshalls.h"
+#include "core/io/multiplayer_api.h"
+#include "core/io/networked_multiplayer_peer.h"
+#include "core/io/packet_peer.h"
+#include "core/io/packet_peer_udp.h"
+#include "core/io/pck_packer.h"
+#include "core/io/resource_format_binary.h"
+#include "core/io/resource_import.h"
+#include "core/io/stream_peer_ssl.h"
+#include "core/io/tcp_server.h"
+#include "core/io/translation_loader_po.h"
#include "core/io/xml_parser.h"
-#include "core_string_names.h"
-#include "engine.h"
-#include "func_ref.h"
-#include "geometry.h"
-#include "input_map.h"
-#include "io/config_file.h"
-#include "io/http_client.h"
-#include "io/image_loader.h"
-#include "io/marshalls.h"
-#include "io/multiplayer_api.h"
-#include "io/networked_multiplayer_peer.h"
-#include "io/packet_peer.h"
-#include "io/packet_peer_udp.h"
-#include "io/pck_packer.h"
-#include "io/resource_format_binary.h"
-#include "io/resource_import.h"
-#include "io/stream_peer_ssl.h"
-#include "io/tcp_server.h"
-#include "io/translation_loader_po.h"
-#include "math/a_star.h"
-#include "math/expression.h"
-#include "math/triangle_mesh.h"
-#include "os/input.h"
-#include "os/main_loop.h"
-#include "packed_data_container.h"
-#include "path_remap.h"
-#include "project_settings.h"
-#include "translation.h"
-
-#include "undo_redo.h"
+#include "core/math/a_star.h"
+#include "core/math/expression.h"
+#include "core/math/geometry.h"
+#include "core/math/triangle_mesh.h"
+#include "core/os/input.h"
+#include "core/os/main_loop.h"
+#include "core/packed_data_container.h"
+#include "core/path_remap.h"
+#include "core/project_settings.h"
+#include "core/translation.h"
+#include "core/undo_redo.h"
+
static ResourceFormatSaverBinary *resource_saver_binary = NULL;
static ResourceFormatLoaderBinary *resource_loader_binary = NULL;
static ResourceFormatImporter *resource_format_importer = NULL;
@@ -146,9 +146,9 @@ void register_core_types() {
ClassDB::register_class<FuncRef>();
ClassDB::register_virtual_class<StreamPeer>();
ClassDB::register_class<StreamPeerBuffer>();
- ClassDB::register_custom_instance_class<StreamPeerTCP>();
- ClassDB::register_custom_instance_class<TCP_Server>();
- ClassDB::register_custom_instance_class<PacketPeerUDP>();
+ ClassDB::register_class<StreamPeerTCP>();
+ ClassDB::register_class<TCP_Server>();
+ ClassDB::register_class<PacketPeerUDP>();
ClassDB::register_custom_instance_class<StreamPeerSSL>();
ClassDB::register_virtual_class<IP>();
ClassDB::register_virtual_class<PacketPeer>();
@@ -156,7 +156,6 @@ void register_core_types() {
ClassDB::register_virtual_class<NetworkedMultiplayerPeer>();
ClassDB::register_class<MultiplayerAPI>();
ClassDB::register_class<MainLoop>();
- //ClassDB::register_type<OptimizedSaver>();
ClassDB::register_class<Translation>();
ClassDB::register_class<PHashTranslation>();
ClassDB::register_class<UndoRedo>();
diff --git a/core/resource.cpp b/core/resource.cpp
index f447f785b1..4dcd338e94 100644
--- a/core/resource.cpp
+++ b/core/resource.cpp
@@ -30,11 +30,12 @@
#include "resource.h"
-#include "core_string_names.h"
-#include "io/resource_loader.h"
-#include "os/file_access.h"
+#include "core/core_string_names.h"
+#include "core/io/resource_loader.h"
+#include "core/os/file_access.h"
+#include "core/script_language.h"
#include "scene/main/node.h" //only so casting works
-#include "script_language.h"
+
#include <stdio.h>
void Resource::emit_changed() {
diff --git a/core/resource.h b/core/resource.h
index 60c63bfe7f..b2812c11e1 100644
--- a/core/resource.h
+++ b/core/resource.h
@@ -31,12 +31,12 @@
#ifndef RESOURCE_H
#define RESOURCE_H
-#include "class_db.h"
-#include "object.h"
-#include "ref_ptr.h"
-#include "reference.h"
-#include "safe_refcount.h"
-#include "self_list.h"
+#include "core/class_db.h"
+#include "core/object.h"
+#include "core/ref_ptr.h"
+#include "core/reference.h"
+#include "core/safe_refcount.h"
+#include "core/self_list.h"
/**
@author Juan Linietsky <reduzio@gmail.com>
diff --git a/core/rid.h b/core/rid.h
index 42306aea36..fbb3e443fc 100644
--- a/core/rid.h
+++ b/core/rid.h
@@ -31,11 +31,11 @@
#ifndef RID_H
#define RID_H
-#include "list.h"
-#include "os/memory.h"
-#include "safe_refcount.h"
-#include "set.h"
-#include "typedefs.h"
+#include "core/list.h"
+#include "core/os/memory.h"
+#include "core/safe_refcount.h"
+#include "core/set.h"
+#include "core/typedefs.h"
/**
@author Juan Linietsky <reduzio@gmail.com>
diff --git a/core/ring_buffer.h b/core/ring_buffer.h
index 00628a4ab3..2516880064 100644
--- a/core/ring_buffer.h
+++ b/core/ring_buffer.h
@@ -31,7 +31,7 @@
#ifndef RINGBUFFER_H
#define RINGBUFFER_H
-#include "vector.h"
+#include "core/vector.h"
template <typename T>
class RingBuffer {
diff --git a/core/safe_refcount.h b/core/safe_refcount.h
index 36bcf5e576..940d31b2cb 100644
--- a/core/safe_refcount.h
+++ b/core/safe_refcount.h
@@ -31,11 +31,9 @@
#ifndef SAFE_REFCOUNT_H
#define SAFE_REFCOUNT_H
-#include "os/mutex.h"
-/* x86/x86_64 GCC */
-
+#include "core/os/mutex.h"
+#include "core/typedefs.h"
#include "platform_config.h"
-#include "typedefs.h"
// Atomic functions, these are used for multithread safe reference counters!
diff --git a/core/script_debugger_local.cpp b/core/script_debugger_local.cpp
index 6949b5802b..7093c3ebdb 100644
--- a/core/script_debugger_local.cpp
+++ b/core/script_debugger_local.cpp
@@ -29,9 +29,9 @@
/*************************************************************************/
#include "script_debugger_local.h"
-#include "scene/main/scene_tree.h"
-#include "os/os.h"
+#include "core/os/os.h"
+#include "scene/main/scene_tree.h"
void ScriptDebuggerLocal::debug(ScriptLanguage *p_script, bool p_can_continue) {
diff --git a/core/script_debugger_local.h b/core/script_debugger_local.h
index 7eea6ef215..1f7b5c590c 100644
--- a/core/script_debugger_local.h
+++ b/core/script_debugger_local.h
@@ -31,8 +31,8 @@
#ifndef SCRIPT_DEBUGGER_LOCAL_H
#define SCRIPT_DEBUGGER_LOCAL_H
-#include "list.h"
-#include "script_language.h"
+#include "core/list.h"
+#include "core/script_language.h"
class ScriptDebuggerLocal : public ScriptDebugger {
diff --git a/core/script_debugger_remote.cpp b/core/script_debugger_remote.cpp
index 2b9b5d6037..704b4d1fdc 100644
--- a/core/script_debugger_remote.cpp
+++ b/core/script_debugger_remote.cpp
@@ -30,12 +30,12 @@
#include "script_debugger_remote.h"
-#include "engine.h"
-#include "io/ip.h"
-#include "io/marshalls.h"
-#include "os/input.h"
-#include "os/os.h"
-#include "project_settings.h"
+#include "core/engine.h"
+#include "core/io/ip.h"
+#include "core/io/marshalls.h"
+#include "core/os/input.h"
+#include "core/os/os.h"
+#include "core/project_settings.h"
#include "scene/main/node.h"
#include "scene/resources/packed_scene.h"
@@ -77,18 +77,19 @@ Error ScriptDebuggerRemote::connect_to_host(const String &p_host, uint16_t p_por
for (int i = 0; i < tries; i++) {
if (tcp_client->get_status() == StreamPeerTCP::STATUS_CONNECTED) {
+ print_verbose("Remote Debugger: Connected!");
break;
} else {
const int ms = waits[i];
OS::get_singleton()->delay_usec(ms * 1000);
- ERR_PRINTS("Remote Debugger: Connection failed with status: '" + String::num(tcp_client->get_status()) + "', retrying in " + String::num(ms) + " msec.");
+ print_verbose("Remote Debugger: Connection failed with status: '" + String::num(tcp_client->get_status()) + "', retrying in " + String::num(ms) + " msec.");
};
};
if (tcp_client->get_status() != StreamPeerTCP::STATUS_CONNECTED) {
- ERR_PRINTS("Remote Debugger: Unable to connect.");
+ ERR_PRINTS("Remote Debugger: Unable to connect. Status: " + String::num(tcp_client->get_status()));
return FAILED;
};
@@ -661,7 +662,7 @@ void ScriptDebuggerRemote::_send_object_id(ObjectID p_id) {
prop.push_back(Variant());
} else {
prop.push_back(pi.hint);
- if (res.is_null())
+ if (res.is_null() || res->get_path().empty())
prop.push_back(pi.hint_string);
else
prop.push_back(String("RES:") + res->get_path());
@@ -1084,7 +1085,7 @@ ScriptDebuggerRemote::ScriptDebuggerRemote() :
max_frame_functions(16),
skip_profile_frame(false),
reload_all_scripts(false),
- tcp_client(StreamPeerTCP::create_ref()),
+ tcp_client(Ref<StreamPeerTCP>(memnew(StreamPeerTCP))),
packet_peer_stream(Ref<PacketPeerStream>(memnew(PacketPeerStream))),
last_perf_time(0),
performance(Engine::get_singleton()->get_singleton_object("Performance")),
diff --git a/core/script_debugger_remote.h b/core/script_debugger_remote.h
index b68fc4f9c9..5cd3a23a37 100644
--- a/core/script_debugger_remote.h
+++ b/core/script_debugger_remote.h
@@ -31,11 +31,11 @@
#ifndef SCRIPT_DEBUGGER_REMOTE_H
#define SCRIPT_DEBUGGER_REMOTE_H
-#include "io/packet_peer.h"
-#include "io/stream_peer_tcp.h"
-#include "list.h"
-#include "os/os.h"
-#include "script_language.h"
+#include "core/io/packet_peer.h"
+#include "core/io/stream_peer_tcp.h"
+#include "core/list.h"
+#include "core/os/os.h"
+#include "core/script_language.h"
class ScriptDebuggerRemote : public ScriptDebugger {
diff --git a/core/script_language.cpp b/core/script_language.cpp
index e146fb773c..5b65da9ef1 100644
--- a/core/script_language.cpp
+++ b/core/script_language.cpp
@@ -29,7 +29,8 @@
/*************************************************************************/
#include "script_language.h"
-#include "project_settings.h"
+
+#include "core/project_settings.h"
ScriptLanguage *ScriptServer::_languages[MAX_LANGUAGES];
int ScriptServer::_language_count = 0;
diff --git a/core/script_language.h b/core/script_language.h
index 573e7b4fa1..bcd9c2c5ea 100644
--- a/core/script_language.h
+++ b/core/script_language.h
@@ -31,10 +31,11 @@
#ifndef SCRIPT_LANGUAGE_H
#define SCRIPT_LANGUAGE_H
-#include "io/multiplayer_api.h"
-#include "map.h"
-#include "pair.h"
-#include "resource.h"
+#include "core/io/multiplayer_api.h"
+#include "core/map.h"
+#include "core/pair.h"
+#include "core/resource.h"
+
/**
@author Juan Linietsky <reduzio@gmail.com>
*/
diff --git a/core/self_list.h b/core/self_list.h
index 6e84e1cd5f..9a4ecdeef9 100644
--- a/core/self_list.h
+++ b/core/self_list.h
@@ -31,7 +31,7 @@
#ifndef SELF_LIST_H
#define SELF_LIST_H
-#include "typedefs.h"
+#include "core/typedefs.h"
template <class T>
class SelfList {
diff --git a/core/set.h b/core/set.h
index d79dd81644..744019d5b4 100644
--- a/core/set.h
+++ b/core/set.h
@@ -31,8 +31,8 @@
#ifndef SET_H
#define SET_H
-#include "os/memory.h"
-#include "typedefs.h"
+#include "core/os/memory.h"
+#include "core/typedefs.h"
/**
@author Juan Linietsky <reduzio@gmail.com>
diff --git a/core/sort.h b/core/sort.h
index 97983829e1..e112304d1b 100644
--- a/core/sort.h
+++ b/core/sort.h
@@ -31,10 +31,7 @@
#ifndef SORT_H
#define SORT_H
-#include "typedefs.h"
-/**
- @author ,,, <red@lunatea>
-*/
+#include "core/typedefs.h"
#define ERR_BAD_COMPARE(cond) \
if (unlikely(cond)) { \
diff --git a/core/string_buffer.h b/core/string_buffer.h
index 5d3be0ecf1..38dce5e6bf 100644
--- a/core/string_buffer.h
+++ b/core/string_buffer.h
@@ -31,8 +31,7 @@
#ifndef STRING_BUFFER_H
#define STRING_BUFFER_H
-#include "ustring.h"
-#include <string.h>
+#include "core/ustring.h"
template <int SHORT_BUFFER_SIZE = 64>
class StringBuffer {
diff --git a/core/string_db.cpp b/core/string_db.cpp
index 067e4493a1..a798df8795 100644
--- a/core/string_db.cpp
+++ b/core/string_db.cpp
@@ -30,8 +30,8 @@
#include "string_db.h"
-#include "os/os.h"
-#include "print_string.h"
+#include "core/os/os.h"
+#include "core/print_string.h"
StaticCString StaticCString::create(const char *p_ptr) {
StaticCString scs;
diff --git a/core/string_db.h b/core/string_db.h
index 965385b136..46bb77df93 100644
--- a/core/string_db.h
+++ b/core/string_db.h
@@ -31,9 +31,9 @@
#ifndef STRING_DB_H
#define STRING_DB_H
-#include "os/mutex.h"
-#include "safe_refcount.h"
-#include "ustring.h"
+#include "core/os/mutex.h"
+#include "core/safe_refcount.h"
+#include "core/ustring.h"
/**
@author Juan Linietsky <reduzio@gmail.com>
*/
diff --git a/core/translation.cpp b/core/translation.cpp
index 82a16d0b17..ce9b338ef6 100644
--- a/core/translation.cpp
+++ b/core/translation.cpp
@@ -30,9 +30,9 @@
#include "translation.h"
-#include "io/resource_loader.h"
-#include "os/os.h"
-#include "project_settings.h"
+#include "core/io/resource_loader.h"
+#include "core/os/os.h"
+#include "core/project_settings.h"
// ISO 639-1 language codes, with the addition of glibc locales with their
// regional identifiers. This list must match the language names (in English)
diff --git a/core/translation.h b/core/translation.h
index e7c0dcbc07..be626f4eb9 100644
--- a/core/translation.h
+++ b/core/translation.h
@@ -31,7 +31,7 @@
#ifndef TRANSLATION_H
#define TRANSLATION_H
-#include "resource.h"
+#include "core/resource.h"
class Translation : public Resource {
diff --git a/core/typedefs.h b/core/typedefs.h
index 094f1bbfd5..76778429b0 100644
--- a/core/typedefs.h
+++ b/core/typedefs.h
@@ -32,6 +32,7 @@
#define TYPEDEFS_H
#include <stddef.h>
+
/**
* Basic definitions and simple functions to be used everywhere.
*/
@@ -96,10 +97,10 @@ T *_nullptr() {
#undef CONNECT_DEFERRED // override from Windows SDK, clashes with Object enum
#endif
-#include "int_types.h"
+#include "core/int_types.h"
-#include "error_list.h"
-#include "error_macros.h"
+#include "core/error_list.h"
+#include "core/error_macros.h"
/** Generic ABS function, for math uses please use Math::abs */
diff --git a/core/undo_redo.cpp b/core/undo_redo.cpp
index 3d90608dd7..7d67076df5 100644
--- a/core/undo_redo.cpp
+++ b/core/undo_redo.cpp
@@ -30,7 +30,7 @@
#include "undo_redo.h"
-#include "os/os.h"
+#include "core/os/os.h"
void UndoRedo::_discard_redo() {
diff --git a/core/undo_redo.h b/core/undo_redo.h
index 3a17c78851..22dcd60472 100644
--- a/core/undo_redo.h
+++ b/core/undo_redo.h
@@ -31,8 +31,8 @@
#ifndef UNDO_REDO_H
#define UNDO_REDO_H
-#include "object.h"
-#include "resource.h"
+#include "core/object.h"
+#include "core/resource.h"
class UndoRedo : public Object {
diff --git a/core/ustring.cpp b/core/ustring.cpp
index 96e3a3d784..e46896ca85 100644
--- a/core/ustring.cpp
+++ b/core/ustring.cpp
@@ -30,12 +30,13 @@
#include "ustring.h"
-#include "color.h"
-#include "math_funcs.h"
-#include "os/memory.h"
-#include "print_string.h"
-#include "ucaps.h"
-#include "variant.h"
+#include "core/color.h"
+#include "core/math/math_funcs.h"
+#include "core/os/memory.h"
+#include "core/print_string.h"
+#include "core/translation.h"
+#include "core/ucaps.h"
+#include "core/variant.h"
#include "thirdparty/misc/md5.h"
#include "thirdparty/misc/sha256.h"
@@ -4204,8 +4205,6 @@ String String::unquote() const {
return substr(1, length() - 2);
}
-#include "translation.h"
-
#ifdef TOOLS_ENABLED
String TTR(const String &p_text) {
diff --git a/core/ustring.h b/core/ustring.h
index 01397f6912..d2766ec7a3 100644
--- a/core/ustring.h
+++ b/core/ustring.h
@@ -28,16 +28,16 @@
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
/*************************************************************************/
-#ifndef RSTRING_H
-#define RSTRING_H
+#ifndef USTRING_H
+#define USTRING_H
-#include "array.h"
-#include "cowdata.h"
-#include "typedefs.h"
-#include "vector.h"
+#include "core/array.h"
+#include "core/cowdata.h"
+#include "core/typedefs.h"
+#include "core/vector.h"
/**
- @author red <red@killy>
+ @author Juan Linietsky <reduzio@gmail.com>
*/
class CharString {
@@ -366,4 +366,4 @@ String RTR(const String &);
bool is_symbol(CharType c);
bool select_word(const String &p_s, int p_col, int &r_beg, int &r_end);
-#endif
+#endif // USTRING_H
diff --git a/core/variant.cpp b/core/variant.cpp
index b0e97900a2..7d75c2243b 100644
--- a/core/variant.cpp
+++ b/core/variant.cpp
@@ -30,14 +30,14 @@
#include "variant.h"
-#include "core_string_names.h"
-#include "io/marshalls.h"
-#include "math_funcs.h"
-#include "print_string.h"
-#include "resource.h"
+#include "core/core_string_names.h"
+#include "core/io/marshalls.h"
+#include "core/math/math_funcs.h"
+#include "core/print_string.h"
+#include "core/resource.h"
+#include "core/variant_parser.h"
#include "scene/gui/control.h"
#include "scene/main/node.h"
-#include "variant_parser.h"
String Variant::get_type_name(Variant::Type p_type) {
diff --git a/core/variant.h b/core/variant.h
index 577a33aa4d..2fffb31de6 100644
--- a/core/variant.h
+++ b/core/variant.h
@@ -35,23 +35,23 @@
@author Juan Linietsky <reduzio@gmail.com>
*/
-#include "aabb.h"
-#include "array.h"
-#include "color.h"
-#include "dictionary.h"
-#include "dvector.h"
-#include "face3.h"
-#include "io/ip_address.h"
-#include "matrix3.h"
-#include "node_path.h"
-#include "plane.h"
-#include "quat.h"
-#include "ref_ptr.h"
-#include "rid.h"
-#include "transform.h"
-#include "transform_2d.h"
-#include "ustring.h"
-#include "vector3.h"
+#include "core/array.h"
+#include "core/color.h"
+#include "core/dictionary.h"
+#include "core/dvector.h"
+#include "core/io/ip_address.h"
+#include "core/math/aabb.h"
+#include "core/math/face3.h"
+#include "core/math/matrix3.h"
+#include "core/math/plane.h"
+#include "core/math/quat.h"
+#include "core/math/transform.h"
+#include "core/math/transform_2d.h"
+#include "core/math/vector3.h"
+#include "core/node_path.h"
+#include "core/ref_ptr.h"
+#include "core/rid.h"
+#include "core/ustring.h"
class RefPtr;
class Object;
diff --git a/core/variant_call.cpp b/core/variant_call.cpp
index 8b18b274b6..f7fa2ebc70 100644
--- a/core/variant_call.cpp
+++ b/core/variant_call.cpp
@@ -31,11 +31,11 @@
#include "variant.h"
#include "core/color_names.inc"
-#include "core_string_names.h"
-#include "io/compression.h"
-#include "object.h"
-#include "os/os.h"
-#include "script_language.h"
+#include "core/core_string_names.h"
+#include "core/io/compression.h"
+#include "core/object.h"
+#include "core/os/os.h"
+#include "core/script_language.h"
typedef void (*VariantFunc)(Variant &r_ret, Variant &p_self, const Variant **p_args);
typedef void (*VariantConstructFunc)(Variant &r_ret, const Variant **p_args);
diff --git a/core/variant_op.cpp b/core/variant_op.cpp
index bfa69b1fde..2edf33ec1c 100644
--- a/core/variant_op.cpp
+++ b/core/variant_op.cpp
@@ -30,9 +30,9 @@
#include "variant.h"
-#include "core_string_names.h"
-#include "object.h"
-#include "script_language.h"
+#include "core/core_string_names.h"
+#include "core/object.h"
+#include "core/script_language.h"
#define CASE_TYPE_ALL(PREFIX, OP) \
CASE_TYPE(PREFIX, OP, INT) \
diff --git a/core/variant_parser.cpp b/core/variant_parser.cpp
index 446aee286d..3d5ae74e92 100644
--- a/core/variant_parser.cpp
+++ b/core/variant_parser.cpp
@@ -30,10 +30,10 @@
#include "variant_parser.h"
+#include "core/io/resource_loader.h"
+#include "core/os/input_event.h"
+#include "core/os/keyboard.h"
#include "core/string_buffer.h"
-#include "io/resource_loader.h"
-#include "os/input_event.h"
-#include "os/keyboard.h"
CharType VariantParser::StreamFile::get_char() {
@@ -1429,10 +1429,10 @@ Error VariantParser::_parse_tag(Token &token, Stream *p_stream, int &line, Strin
break;
if (parsing_tag && token.type == TK_PERIOD) {
- r_tag.name += "."; //support tags such as [someprop.Anroid] for specific platforms
+ r_tag.name += "."; //support tags such as [someprop.Android] for specific platforms
get_token(p_stream, token, line, r_err_str);
} else if (parsing_tag && token.type == TK_COLON) {
- r_tag.name += ":"; //support tags such as [someprop.Anroid] for specific platforms
+ r_tag.name += ":"; //support tags such as [someprop.Android] for specific platforms
get_token(p_stream, token, line, r_err_str);
} else {
parsing_tag = false;
diff --git a/core/variant_parser.h b/core/variant_parser.h
index 8d95595234..531c1d59cd 100644
--- a/core/variant_parser.h
+++ b/core/variant_parser.h
@@ -31,9 +31,9 @@
#ifndef VARIANT_PARSER_H
#define VARIANT_PARSER_H
-#include "os/file_access.h"
-#include "resource.h"
-#include "variant.h"
+#include "core/os/file_access.h"
+#include "core/resource.h"
+#include "core/variant.h"
class VariantParser {
public:
diff --git a/core/vector.h b/core/vector.h
index 52e8758f9b..38a1082407 100644
--- a/core/vector.h
+++ b/core/vector.h
@@ -36,10 +36,11 @@
* @author Juan Linietsky
* Vector container. Regular Vector Container. Use with care and for smaller arrays when possible. Use PoolVector for large arrays.
*/
-#include "cowdata.h"
-#include "error_macros.h"
-#include "os/memory.h"
-#include "sort.h"
+
+#include "core/cowdata.h"
+#include "core/error_macros.h"
+#include "core/os/memory.h"
+#include "core/sort.h"
template <class T>
class VectorWriteProxy {
diff --git a/core/version.h b/core/version.h
index d39172865a..2a3a282d82 100644
--- a/core/version.h
+++ b/core/version.h
@@ -28,7 +28,7 @@
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
/*************************************************************************/
-#include "version_generated.gen.h"
+#include "core/version_generated.gen.h"
// Godot versions are of the form <major>.<minor> for the initial release,
// and then <major>.<minor>.<patch> for subsequent bugfix releases where <patch> != 0
diff --git a/core/vmap.h b/core/vmap.h
index ce0ddc4ec6..9fc99e636d 100644
--- a/core/vmap.h
+++ b/core/vmap.h
@@ -31,8 +31,8 @@
#ifndef VMAP_H
#define VMAP_H
-#include "cowdata.h"
-#include "typedefs.h"
+#include "core/cowdata.h"
+#include "core/typedefs.h"
template <class T, class V>
class VMap {
diff --git a/core/vset.h b/core/vset.h
index 7f4d8e7f62..9ec329b45f 100644
--- a/core/vset.h
+++ b/core/vset.h
@@ -31,8 +31,8 @@
#ifndef VSET_H
#define VSET_H
-#include "typedefs.h"
-#include "vector.h"
+#include "core/typedefs.h"
+#include "core/vector.h"
template <class T>
class VSet {
diff --git a/doc/classes/@GDScript.xml b/doc/classes/@GDScript.xml
index 2cfdfafea1..3e46dc4e92 100644
--- a/doc/classes/@GDScript.xml
+++ b/doc/classes/@GDScript.xml
@@ -412,7 +412,7 @@
</description>
</method>
<method name="get_stack">
- <return type="void">
+ <return type="Array">
</return>
<description>
</description>
diff --git a/doc/classes/Array.xml b/doc/classes/Array.xml
index 7097fd8bf0..3bd621799a 100644
--- a/doc/classes/Array.xml
+++ b/doc/classes/Array.xml
@@ -221,7 +221,7 @@
</method>
<method name="invert">
<description>
- Reverse the order of the elements in the array (so first element will now be the last) and return reference to the array.
+ Reverse the order of the elements in the array.
</description>
</method>
<method name="max">
diff --git a/doc/classes/CanvasItem.xml b/doc/classes/CanvasItem.xml
index a04e38af5c..98404478f4 100644
--- a/doc/classes/CanvasItem.xml
+++ b/doc/classes/CanvasItem.xml
@@ -330,6 +330,12 @@
Draws a textured rectangle region at a given position, optionally modulated by a color. Transpose swaps the x and y coordinates when reading the texture.
</description>
</method>
+ <method name="force_update_transform">
+ <return type="void">
+ </return>
+ <description>
+ </description>
+ </method>
<method name="get_canvas" qualifiers="const">
<return type="RID">
</return>
diff --git a/doc/classes/ColorPicker.xml b/doc/classes/ColorPicker.xml
index 4d52eacba8..554e6b5632 100644
--- a/doc/classes/ColorPicker.xml
+++ b/doc/classes/ColorPicker.xml
@@ -26,7 +26,7 @@
The currently selected color.
</member>
<member name="deferred_mode" type="bool" setter="set_deferred_mode" getter="is_deferred_mode">
- If [code]true[/code] the color will apply only after the user releases the mouse button, otherwise it will apply immediatly even in mouse motion event (which can cause performance issues).
+ If [code]true[/code] the color will apply only after the user releases the mouse button, otherwise it will apply immediately even in mouse motion event (which can cause performance issues).
</member>
<member name="edit_alpha" type="bool" setter="set_edit_alpha" getter="is_editing_alpha">
If [code]true[/code] shows an alpha channel slider (transparency).
diff --git a/doc/classes/ColorPickerButton.xml b/doc/classes/ColorPickerButton.xml
index 6ac2911c11..8bc6d05bd4 100644
--- a/doc/classes/ColorPickerButton.xml
+++ b/doc/classes/ColorPickerButton.xml
@@ -4,7 +4,7 @@
Button that pops out a [ColorPicker].
</brief_description>
<description>
- Encapsulates a [ColorPicker] making it accesible by pressing a button. Pressing the button will toggle the [ColorPicker] visibility.
+ Encapsulates a [ColorPicker] making it accessible by pressing a button. Pressing the button will toggle the [ColorPicker] visibility.
</description>
<tutorials>
</tutorials>
diff --git a/doc/classes/Control.xml b/doc/classes/Control.xml
index bbd0441a0b..05b2c2704e 100644
--- a/doc/classes/Control.xml
+++ b/doc/classes/Control.xml
@@ -723,7 +723,7 @@
</description>
</signal>
<signal name="gui_input">
- <argument index="0" name="ev" type="InputEvent">
+ <argument index="0" name="event" type="InputEvent">
</argument>
<description>
Emitted when the node receives an [InputEvent].
diff --git a/doc/classes/Curve.xml b/doc/classes/Curve.xml
index c7f2f7bb8d..490772e400 100644
--- a/doc/classes/Curve.xml
+++ b/doc/classes/Curve.xml
@@ -49,6 +49,13 @@
Removes all points from the curve.
</description>
</method>
+ <method name="get_point_count" qualifiers="const">
+ <return type="int">
+ </return>
+ <description>
+ Returns the number of points describing the curve.
+ </description>
+ </method>
<method name="get_point_left_mode" qualifiers="const">
<return type="int" enum="Curve.TangentMode">
</return>
diff --git a/doc/classes/EditorFileSystemDirectory.xml b/doc/classes/EditorFileSystemDirectory.xml
index bb3ff91639..9dd28d2400 100644
--- a/doc/classes/EditorFileSystemDirectory.xml
+++ b/doc/classes/EditorFileSystemDirectory.xml
@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="UTF-8" ?>
<class name="EditorFileSystemDirectory" inherits="Object" category="Core" version="3.1">
<brief_description>
- A diretory for the resource filesystem.
+ A directory for the resource filesystem.
</brief_description>
<description>
A more generalized, low-level variation of the directory concept.
diff --git a/doc/classes/Input.xml b/doc/classes/Input.xml
index 1eb74446c6..a0bb585583 100644
--- a/doc/classes/Input.xml
+++ b/doc/classes/Input.xml
@@ -46,6 +46,7 @@
</return>
<description>
If the device has an accelerometer, this will return the acceleration. Otherwise, it returns an empty [Vector3].
+ Note this method returns an empty [Vector3] when running from the editor even when your device has an accelerometer. You must export your project to a supported device to read values from the accelerometer.
</description>
</method>
<method name="get_action_strength" qualifiers="const">
diff --git a/doc/classes/MainLoop.xml b/doc/classes/MainLoop.xml
index 9454a16988..ad763e6532 100644
--- a/doc/classes/MainLoop.xml
+++ b/doc/classes/MainLoop.xml
@@ -47,7 +47,7 @@
<method name="_input_event" qualifiers="virtual">
<return type="void">
</return>
- <argument index="0" name="ev" type="InputEvent">
+ <argument index="0" name="event" type="InputEvent">
</argument>
<description>
</description>
@@ -91,7 +91,7 @@
<method name="input_event">
<return type="void">
</return>
- <argument index="0" name="ev" type="InputEvent">
+ <argument index="0" name="event" type="InputEvent">
</argument>
<description>
</description>
diff --git a/doc/classes/MultiMesh.xml b/doc/classes/MultiMesh.xml
index b78d82199c..1908fdd684 100644
--- a/doc/classes/MultiMesh.xml
+++ b/doc/classes/MultiMesh.xml
@@ -30,6 +30,14 @@
Get the color of a specific instance.
</description>
</method>
+ <method name="get_instance_custom_data" qualifiers="const">
+ <return type="Color">
+ </return>
+ <argument index="0" name="instance" type="int">
+ </argument>
+ <description>
+ </description>
+ </method>
<method name="get_instance_transform" qualifiers="const">
<return type="Transform">
</return>
@@ -50,6 +58,16 @@
Set the color of a specific instance.
</description>
</method>
+ <method name="set_instance_custom_data">
+ <return type="void">
+ </return>
+ <argument index="0" name="instance" type="int">
+ </argument>
+ <argument index="1" name="custom_data" type="Color">
+ </argument>
+ <description>
+ </description>
+ </method>
<method name="set_instance_transform">
<return type="void">
</return>
@@ -65,6 +83,8 @@
<members>
<member name="color_format" type="int" setter="set_color_format" getter="get_color_format" enum="MultiMesh.ColorFormat">
</member>
+ <member name="custom_data_format" type="int" setter="set_custom_data_format" getter="get_custom_data_format" enum="MultiMesh.CustomDataFormat">
+ </member>
<member name="instance_count" type="int" setter="set_instance_count" getter="get_instance_count">
</member>
<member name="mesh" type="Mesh" setter="set_mesh" getter="get_mesh">
@@ -83,5 +103,11 @@
</constant>
<constant name="COLOR_FLOAT" value="2" enum="ColorFormat">
</constant>
+ <constant name="CUSTOM_DATA_NONE" value="0" enum="CustomDataFormat">
+ </constant>
+ <constant name="CUSTOM_DATA_8BIT" value="1" enum="CustomDataFormat">
+ </constant>
+ <constant name="CUSTOM_DATA_FLOAT" value="2" enum="CustomDataFormat">
+ </constant>
</constants>
</class>
diff --git a/doc/classes/Object.xml b/doc/classes/Object.xml
index f4ad196ad2..fcd105d66b 100644
--- a/doc/classes/Object.xml
+++ b/doc/classes/Object.xml
@@ -185,7 +185,7 @@
</argument>
<description>
Get indexed object property by String.
- Property indices get accessed with colon seperation, for example: [code]position:x[/code]
+ Property indices get accessed with colon separation, for example: [code]position:x[/code]
</description>
</method>
<method name="get_instance_id" qualifiers="const">
diff --git a/doc/classes/PoolByteArray.xml b/doc/classes/PoolByteArray.xml
index 120d80ba39..765e68a623 100644
--- a/doc/classes/PoolByteArray.xml
+++ b/doc/classes/PoolByteArray.xml
@@ -81,7 +81,7 @@
</method>
<method name="invert">
<description>
- Reverse the order of the elements in the array (so first element will now be the last).
+ Reverse the order of the elements in the array.
</description>
</method>
<method name="push_back">
diff --git a/doc/classes/PoolColorArray.xml b/doc/classes/PoolColorArray.xml
index 0c93a565f5..021d5f5089 100644
--- a/doc/classes/PoolColorArray.xml
+++ b/doc/classes/PoolColorArray.xml
@@ -47,7 +47,7 @@
</method>
<method name="invert">
<description>
- Reverse the order of the elements in the array (so first element will now be the last).
+ Reverse the order of the elements in the array.
</description>
</method>
<method name="push_back">
diff --git a/doc/classes/PoolIntArray.xml b/doc/classes/PoolIntArray.xml
index 43cb5d77de..347dcb09f2 100644
--- a/doc/classes/PoolIntArray.xml
+++ b/doc/classes/PoolIntArray.xml
@@ -47,7 +47,7 @@
</method>
<method name="invert">
<description>
- Reverse the order of the elements in the array (so first element will now be the last).
+ Reverse the order of the elements in the array.
</description>
</method>
<method name="push_back">
diff --git a/doc/classes/PoolRealArray.xml b/doc/classes/PoolRealArray.xml
index 0808b44104..c0c6ef8700 100644
--- a/doc/classes/PoolRealArray.xml
+++ b/doc/classes/PoolRealArray.xml
@@ -47,7 +47,7 @@
</method>
<method name="invert">
<description>
- Reverse the order of the elements in the array (so first element will now be the last).
+ Reverse the order of the elements in the array.
</description>
</method>
<method name="push_back">
diff --git a/doc/classes/PoolStringArray.xml b/doc/classes/PoolStringArray.xml
index 9f6c4306cb..8b3ac4c16a 100644
--- a/doc/classes/PoolStringArray.xml
+++ b/doc/classes/PoolStringArray.xml
@@ -47,7 +47,7 @@
</method>
<method name="invert">
<description>
- Reverse the order of the elements in the array (so first element will now be the last).
+ Reverse the order of the elements in the array.
</description>
</method>
<method name="join">
diff --git a/doc/classes/PoolVector2Array.xml b/doc/classes/PoolVector2Array.xml
index 072281158c..ecf8f5a6ba 100644
--- a/doc/classes/PoolVector2Array.xml
+++ b/doc/classes/PoolVector2Array.xml
@@ -47,7 +47,7 @@
</method>
<method name="invert">
<description>
- Reverse the order of the elements in the array (so first element will now be the last).
+ Reverse the order of the elements in the array.
</description>
</method>
<method name="push_back">
diff --git a/doc/classes/PoolVector3Array.xml b/doc/classes/PoolVector3Array.xml
index 7aa5dfc090..456b54d209 100644
--- a/doc/classes/PoolVector3Array.xml
+++ b/doc/classes/PoolVector3Array.xml
@@ -47,7 +47,7 @@
</method>
<method name="invert">
<description>
- Reverse the order of the elements in the array (so first element will now be the last).
+ Reverse the order of the elements in the array.
</description>
</method>
<method name="push_back">
diff --git a/doc/classes/ProceduralSky.xml b/doc/classes/ProceduralSky.xml
index df0519b2ad..090b626433 100644
--- a/doc/classes/ProceduralSky.xml
+++ b/doc/classes/ProceduralSky.xml
@@ -5,7 +5,7 @@
</brief_description>
<description>
ProceduralSky provides a way to create an effective background quickly by defining procedural parameters for the sun, the sky and the ground. The sky and ground are very similar, they are defined by a color at the horizon, another color, and finally an easing curve to interpolate between these two colors. Similarly the sun is described by a position in the sky, a color, and an easing curve. However, the sun also defines a minimum and maximum angle, these two values define at what distance the easing curve begins and ends from the sun, and thus end up defining the size of the sun in the sky.
- The ProceduralSky is updated on the CPU after the parameters change and stored in a texture and then displayed as a background in the scene. This makes it relatively unsuitable for realtime updates during gameplay. But with a small texture size it is still feasible to update relatively frequently becuase it is updated on a background thread when multi-threading is available.
+ The ProceduralSky is updated on the CPU after the parameters change and stored in a texture and then displayed as a background in the scene. This makes it relatively unsuitable for realtime updates during gameplay. But with a small texture size it is still feasible to update relatively frequently because it is updated on a background thread when multi-threading is available.
</description>
<tutorials>
</tutorials>
diff --git a/doc/classes/ProjectSettings.xml b/doc/classes/ProjectSettings.xml
index ad8c5f68da..1bf2e6d83c 100644
--- a/doc/classes/ProjectSettings.xml
+++ b/doc/classes/ProjectSettings.xml
@@ -208,7 +208,7 @@
<member name="audio/output_latency" type="int" setter="" getter="">
</member>
<member name="audio/video_delay_compensation_ms" type="int" setter="" getter="">
- Setting to harcode audio delay when playing video. Best to leave this untouched unless you know what you are doing.
+ Setting to hardcode audio delay when playing video. Best to leave this untouched unless you know what you are doing.
</member>
<member name="compression/formats/gzip/compression_level" type="int" setter="" getter="">
Default compression level for gzip. Affects compressed scenes and resources.
diff --git a/doc/classes/RemoteTransform.xml b/doc/classes/RemoteTransform.xml
index a7deb273b6..1a5d1eb907 100644
--- a/doc/classes/RemoteTransform.xml
+++ b/doc/classes/RemoteTransform.xml
@@ -1,11 +1,11 @@
<?xml version="1.0" encoding="UTF-8" ?>
<class name="RemoteTransform" inherits="Spatial" category="Core" version="3.1">
<brief_description>
- RemoteTransform leads the [Transform] of another [Spatial] derived Node in the scene.
+ RemoteTransform pushes its own [Transform] to another [Spatial] derived Node in the scene.
</brief_description>
<description>
- RemoteTransform leads the [Transform] of another [Spatial] derived Node (called the remote node) in the scene.
- It can be set to track another Node's position, rotation and/or scale. It can update using either global or local coordinates.
+ RemoteTransform pushes its own [Transform] to another [Spatial] derived Node (called the remote node) in the scene.
+ It can be set to update another Node's position, rotation and/or scale. It can use either global or local coordinates.
</description>
<tutorials>
</tutorials>
@@ -18,13 +18,13 @@
The [NodePath] to the remote node, relative to the RemoteTransform's position in the scene.
</member>
<member name="update_position" type="bool" setter="set_update_position" getter="get_update_position">
- If [code]true[/code] the remote node's position is tracked. Default value: [code]true[/code].
+ If [code]true[/code] the remote node's position is updated. Default value: [code]true[/code].
</member>
<member name="update_rotation" type="bool" setter="set_update_rotation" getter="get_update_rotation">
- If [code]true[/code] the remote node's rotation is tracked. Default value: [code]true[/code].
+ If [code]true[/code] the remote node's rotation is updated. Default value: [code]true[/code].
</member>
<member name="update_scale" type="bool" setter="set_update_scale" getter="get_update_scale">
- If [code]true[/code] the remote node's scale is tracked. Default value: [code]true[/code].
+ If [code]true[/code] the remote node's scale is updated. Default value: [code]true[/code].
</member>
<member name="use_global_coordinates" type="bool" setter="set_use_global_coordinates" getter="get_use_global_coordinates">
If [code]true[/code] global coordinates are used. If [code]false[/code] local coordinates are used. Default value: [code]true[/code].
diff --git a/doc/classes/RemoteTransform2D.xml b/doc/classes/RemoteTransform2D.xml
index bc562dcdad..d83ec9f6b1 100644
--- a/doc/classes/RemoteTransform2D.xml
+++ b/doc/classes/RemoteTransform2D.xml
@@ -1,11 +1,11 @@
<?xml version="1.0" encoding="UTF-8" ?>
<class name="RemoteTransform2D" inherits="Node2D" category="Core" version="3.1">
<brief_description>
- RemoteTransform2D leads the [Transform2D] of another [CanvasItem] derived Node in the scene.
+ RemoteTransform2D pushes its own [Transform2D] to another [CanvasItem] derived Node in the scene.
</brief_description>
<description>
- RemoteTransform2D leads the [Transform2D] of another [CanvasItem] derived Node (called the remote node) in the scene.
- It can be set to track another Node's position, rotation and/or scale. It can update using either global or local coordinates.
+ RemoteTransform2D pushes its own [Transform2D] to another [CanvasItem] derived Node (called the remote node) in the scene.
+ It can be set to update another Node's position, rotation and/or scale. It can use either global or local coordinates.
</description>
<tutorials>
</tutorials>
@@ -18,13 +18,13 @@
The [NodePath] to the remote node, relative to the RemoteTransform2D's position in the scene.
</member>
<member name="update_position" type="bool" setter="set_update_position" getter="get_update_position">
- If [code]true[/code] the remote node's position is tracked. Default value: [code]true[/code].
+ If [code]true[/code] the remote node's position is updated. Default value: [code]true[/code].
</member>
<member name="update_rotation" type="bool" setter="set_update_rotation" getter="get_update_rotation">
- If [code]true[/code] the remote node's rotation is tracked. Default value: [code]true[/code].
+ If [code]true[/code] the remote node's rotation is updated. Default value: [code]true[/code].
</member>
<member name="update_scale" type="bool" setter="set_update_scale" getter="get_update_scale">
- If [code]true[/code] the remote node's scale is tracked. Default value: [code]true[/code].
+ If [code]true[/code] the remote node's scale is updated. Default value: [code]true[/code].
</member>
<member name="use_global_coordinates" type="bool" setter="set_use_global_coordinates" getter="get_use_global_coordinates">
If [code]true[/code] global coordinates are used. If [code]false[/code] local coordinates are used. Default value: [code]true[/code].
diff --git a/doc/classes/SceneTree.xml b/doc/classes/SceneTree.xml
index 11362ee680..a447294fea 100644
--- a/doc/classes/SceneTree.xml
+++ b/doc/classes/SceneTree.xml
@@ -271,7 +271,7 @@
</member>
<member name="multiplayer_poll" type="bool" setter="set_multiplayer_poll_enabled" getter="is_multiplayer_poll_enabled">
If [code]true[/code] (default) enable the automatic polling of the [MultiplayerAPI] for this SceneTree during [signal idle_frame].
- When [code]false[/code] you need to manually call [method MultiplayerAPI.poll] for processing network packets and delivering RPCs/RSETs. This allows to run RPCs/RSETs in a different loop (e.g. physics, thread, specific time step) and for manual [Mutex] protecion when accessing the [MultiplayerAPI] from threads.
+ When [code]false[/code] you need to manually call [method MultiplayerAPI.poll] for processing network packets and delivering RPCs/RSETs. This allows to run RPCs/RSETs in a different loop (e.g. physics, thread, specific time step) and for manual [Mutex] protection when accessing the [MultiplayerAPI] from threads.
</member>
<member name="network_peer" type="NetworkedMultiplayerPeer" setter="set_network_peer" getter="get_network_peer">
The peer object to handle the RPC system (effectively enabling networking when set). Depending on the peer itself, the SceneTree will become a network server (check with [method is_network_server()]) and will set root node's network mode to master (see NETWORK_MODE_* constants in [Node]), or it will become a regular peer with root node set to slave. All child nodes are set to inherit the network mode by default. Handling of networking-related events (connection, disconnection, new clients) is done by connecting to SceneTree's signals.
diff --git a/doc/classes/Shader.xml b/doc/classes/Shader.xml
index 76049d8947..7f9a124683 100644
--- a/doc/classes/Shader.xml
+++ b/doc/classes/Shader.xml
@@ -24,7 +24,7 @@
<return type="int" enum="Shader.Mode">
</return>
<description>
- Returns the shader mode for the shader, eiter [code]MODE_CANVAS_ITEM[/code], [code]MODE_SPATIAL[/code] or [code]MODE_PARTICLES[/code]
+ Returns the shader mode for the shader, either [code]MODE_CANVAS_ITEM[/code], [code]MODE_SPATIAL[/code] or [code]MODE_PARTICLES[/code]
</description>
</method>
<method name="has_param" qualifiers="const">
diff --git a/doc/classes/Spatial.xml b/doc/classes/Spatial.xml
index 4fa60b2e44..7fd7b5deed 100644
--- a/doc/classes/Spatial.xml
+++ b/doc/classes/Spatial.xml
@@ -13,6 +13,12 @@
<demos>
</demos>
<methods>
+ <method name="force_update_transform">
+ <return type="void">
+ </return>
+ <description>
+ </description>
+ </method>
<method name="get_parent_spatial" qualifiers="const">
<return type="Spatial">
</return>
diff --git a/doc/classes/StreamPeerTCP.xml b/doc/classes/StreamPeerTCP.xml
index 5fc8e99ced..e1f1dcb8fa 100644
--- a/doc/classes/StreamPeerTCP.xml
+++ b/doc/classes/StreamPeerTCP.xml
@@ -78,7 +78,7 @@
A status representing a [code]StreamPeerTCP[/code] that is connected to a host.
</constant>
<constant name="STATUS_ERROR" value="3" enum="Status">
- A staus representing a [code]StreamPeerTCP[/code] in error state.
+ A status representing a [code]StreamPeerTCP[/code] in error state.
</constant>
</constants>
</class>
diff --git a/doc/classes/Tree.xml b/doc/classes/Tree.xml
index 5c24df5be2..ae8bdace73 100644
--- a/doc/classes/Tree.xml
+++ b/doc/classes/Tree.xml
@@ -37,7 +37,7 @@
</description>
</method>
<method name="create_item">
- <return type="Object">
+ <return type="TreeItem">
</return>
<argument index="0" name="parent" type="Object" default="null">
</argument>
diff --git a/doc/tools/makerst.py b/doc/tools/makerst.py
index 93ad823d42..ad6601b18b 100755
--- a/doc/tools/makerst.py
+++ b/doc/tools/makerst.py
@@ -309,10 +309,41 @@ def rstize_text(text, cclass):
return text
+def format_table(f, pp):
+ longest_t = 0
+ longest_s = 0
+ for s in pp:
+ sl = len(s[0])
+ if (sl > longest_s):
+ longest_s = sl
+ tl = len(s[1])
+ if (tl > longest_t):
+ longest_t = tl
+
+ sep = "+"
+ for i in range(longest_s + 2):
+ sep += "-"
+ sep += "+"
+ for i in range(longest_t + 2):
+ sep += "-"
+ sep += "+\n"
+ f.write(sep)
+ for s in pp:
+ rt = s[0]
+ while (len(rt) < longest_s):
+ rt += " "
+ st = s[1]
+ while (len(st) < longest_t):
+ st += " "
+ f.write("| " + rt + " | " + st + " |\n")
+ f.write(sep)
+ f.write('\n')
+
+
def make_type(t):
global class_names
if t in class_names:
- return ':ref:`' + t + '<class_' + t.lower() + '>`'
+ return ':ref:`' + t + '<class_' + t + '>`'
return t
@@ -332,16 +363,15 @@ def make_enum(t):
c = "@GlobalScope"
e = t
if c in class_names:
- return ':ref:`' + e + '<enum_' + c.lower() + '_' + e.lower() + '>`'
+ return ':ref:`' + e + '<enum_' + c + '_' + e + '>`'
return t
def make_method(
f,
- name,
- m,
- declare,
cname,
+ method_data,
+ declare,
event=False,
pp=None
):
@@ -351,7 +381,7 @@ def make_method(
t = ""
ret_type = 'void'
- args = list(m)
+ args = list(method_data)
mdata = {}
mdata['argidx'] = []
for a in args:
@@ -377,9 +407,9 @@ def make_method(
if declare or pp == None:
- s = '**' + m.attrib['name'] + '** '
+ s = '**' + method_data.attrib['name'] + '** '
else:
- s = ':ref:`' + m.attrib['name'] + '<class_' + cname + "_" + m.attrib['name'] + '>` '
+ s = ':ref:`' + method_data.attrib['name'] + '<class_' + cname + "_" + method_data.attrib['name'] + '>` '
s += '**(**'
argfound = False
@@ -406,8 +436,8 @@ def make_method(
s += ' **)**'
- if 'qualifiers' in m.attrib:
- s += ' ' + m.attrib['qualifiers']
+ if 'qualifiers' in method_data.attrib:
+ s += ' ' + method_data.attrib['qualifiers']
if (not declare):
if (pp != None):
@@ -418,6 +448,37 @@ def make_method(
f.write(t + s + "\n")
+def make_properties(
+ f,
+ cname,
+ prop_data,
+ description=False,
+ pp=None
+):
+ t = ""
+ if 'enum' in prop_data.attrib:
+ t += make_enum(prop_data.attrib['enum'])
+ else:
+ t += make_type(prop_data.attrib['type'])
+
+ if description:
+ s = '**' + prop_data.attrib['name'] + '**'
+ setget = []
+ if 'setter' in prop_data.attrib and prop_data.attrib['setter'] != '' and not prop_data.attrib['setter'].startswith('_'):
+ setget.append(("*Setter*", prop_data.attrib['setter'] + '(value)'))
+ if 'getter' in prop_data.attrib and prop_data.attrib['getter'] != '' and not prop_data.attrib['getter'].startswith('_'):
+ setget.append(('*Getter*', prop_data.attrib['getter'] + '()'))
+ else:
+ s = ':ref:`' + prop_data.attrib['name'] + '<class_' + cname + "_" + prop_data.attrib['name'] + '>`'
+
+ if (pp != None):
+ pp.append((t, s))
+ elif description:
+ f.write('- ' + t + ' ' + s + '\n\n')
+ if len(setget) > 0:
+ format_table(f, setget)
+
+
def make_heading(title, underline):
return title + '\n' + underline * len(title) + "\n\n"
@@ -435,6 +496,8 @@ def make_rst_class(node):
f.write(".. _class_" + name + ":\n\n")
f.write(make_heading(name, '='))
+ # Inheritance tree
+ # Ascendents
if 'inherits' in node.attrib:
inh = node.attrib['inherits'].strip()
f.write('**Inherits:** ')
@@ -451,16 +514,15 @@ def make_rst_class(node):
inh = inode.attrib['inherits'].strip()
else:
inh = None
-
f.write("\n\n")
+ # Descendents
inherited = []
for cn in classes:
c = classes[cn]
if 'inherits' in c.attrib:
if (c.attrib['inherits'].strip() == name):
inherited.append(c.attrib['name'])
-
if (len(inherited)):
f.write('**Inherited By:** ')
for i in range(len(inherited)):
@@ -468,56 +530,51 @@ def make_rst_class(node):
f.write(", ")
f.write(make_type(inherited[i]))
f.write("\n\n")
+
+ # Category
if 'category' in node.attrib:
f.write('**Category:** ' + node.attrib['category'].strip() + "\n\n")
+ # Brief description
f.write(make_heading('Brief Description', '-'))
briefd = node.find('brief_description')
if briefd != None:
f.write(rstize_text(briefd.text.strip(), name) + "\n\n")
- methods = node.find('methods')
+ # Properties overview
+ members = node.find('members')
+ if members != None and len(list(members)) > 0:
+ f.write(make_heading('Properties', '-'))
+ ml = []
+ for m in list(members):
+ make_properties(f, name, m, False, ml)
+ format_table(f, ml)
+ # Methods overview
+ methods = node.find('methods')
if methods != None and len(list(methods)) > 0:
- f.write(make_heading('Member Functions', '-'))
+ f.write(make_heading('Methods', '-'))
ml = []
for m in list(methods):
- make_method(f, node.attrib['name'], m, False, name, False, ml)
- longest_t = 0
- longest_s = 0
- for s in ml:
- sl = len(s[0])
- if (sl > longest_s):
- longest_s = sl
- tl = len(s[1])
- if (tl > longest_t):
- longest_t = tl
-
- sep = "+"
- for i in range(longest_s + 2):
- sep += "-"
- sep += "+"
- for i in range(longest_t + 2):
- sep += "-"
- sep += "+\n"
- f.write(sep)
- for s in ml:
- rt = s[0]
- while (len(rt) < longest_s):
- rt += " "
- st = s[1]
- while (len(st) < longest_t):
- st += " "
- f.write("| " + rt + " | " + st + " |\n")
- f.write(sep)
- f.write('\n')
+ make_method(f, name, m, False, False, ml)
+ format_table(f, ml)
+ # Theme properties
+ theme_items = node.find('theme_items')
+ if theme_items != None and len(list(theme_items)) > 0:
+ f.write(make_heading('Theme Properties', '-'))
+ ml = []
+ for m in list(theme_items):
+ make_properties(f, name, m, False, ml)
+ format_table(f, ml)
+
+ # Signals
events = node.find('signals')
if events != None and len(list(events)) > 0:
f.write(make_heading('Signals', '-'))
for m in list(events):
- f.write(".. _class_" + name + "_" + m.attrib['name'] + ":\n\n")
- make_method(f, node.attrib['name'], m, True, name, True)
+ f.write(" .. _class_" + name + "_" + m.attrib['name'] + ":\n\n")
+ make_method(f, name, m, True, True)
f.write('\n')
d = m.find('description')
if d == None or d.text.strip() == '':
@@ -525,26 +582,7 @@ def make_rst_class(node):
f.write(rstize_text(d.text.strip(), name))
f.write("\n\n")
- f.write('\n')
-
- members = node.find('members')
- if members != None and len(list(members)) > 0:
- f.write(make_heading('Member Variables', '-'))
-
- for c in list(members):
- # Leading two spaces necessary to prevent breaking the <ul>
- f.write(" .. _class_" + name + "_" + c.attrib['name'] + ":\n\n")
- s = '- '
- if 'enum' in c.attrib:
- s += make_enum(c.attrib['enum']) + ' '
- else:
- s += make_type(c.attrib['type']) + ' '
- s += '**' + c.attrib['name'] + '**'
- if c.text.strip() != '':
- s += ' - ' + rstize_text(c.text.strip(), name)
- f.write(s + '\n\n')
- f.write('\n')
-
+ # Constants and enums
constants = node.find('constants')
consts = []
enum_names = set()
@@ -557,23 +595,12 @@ def make_rst_class(node):
else:
consts.append(c)
- if len(consts) > 0:
- f.write(make_heading('Numeric Constants', '-'))
- for c in list(consts):
- s = '- '
- s += '**' + c.attrib['name'] + '**'
- if 'value' in c.attrib:
- s += ' = **' + c.attrib['value'] + '**'
- if c.text.strip() != '':
- s += ' --- ' + rstize_text(c.text.strip(), name)
- f.write(s + '\n')
- f.write('\n')
-
+ # Enums
if len(enum_names) > 0:
- f.write(make_heading('Enums', '-'))
+ f.write(make_heading('Enumerations', '-'))
for e in enum_names:
f.write(" .. _enum_" + name + "_" + e + ":\n\n")
- f.write("enum **" + e + "**\n\n")
+ f.write("enum **" + e + "**:\n\n")
for c in enums:
if c.attrib['enum'] != e:
continue
@@ -585,13 +612,26 @@ def make_rst_class(node):
s += ' --- ' + rstize_text(c.text.strip(), name)
f.write(s + '\n')
f.write('\n')
- f.write('\n')
+ # Constants
+ if len(consts) > 0:
+ f.write(make_heading('Constants', '-'))
+ for c in list(consts):
+ s = '- '
+ s += '**' + c.attrib['name'] + '**'
+ if 'value' in c.attrib:
+ s += ' = **' + c.attrib['value'] + '**'
+ if c.text.strip() != '':
+ s += ' --- ' + rstize_text(c.text.strip(), name)
+ f.write(s + '\n')
+
+ # Class description
descr = node.find('description')
if descr != None and descr.text.strip() != '':
f.write(make_heading('Description', '-'))
f.write(rstize_text(descr.text.strip(), name) + "\n\n")
+ # Online tutorials
global godot_docs_pattern
tutorials = node.find('tutorials')
if tutorials != None and len(tutorials) > 0:
@@ -616,23 +656,31 @@ def make_rst_class(node):
# External link, for example:
# `http://enet.bespin.org/usergroup0.html`
f.write("- `" + link + " <" + link + ">`_\n")
- f.write("\n")
+ # Property descriptions
+ members = node.find('members')
+ if members != None and len(list(members)) > 0:
+ f.write(make_heading('Property Descriptions', '-'))
+ for m in list(members):
+ f.write(" .. _class_" + name + "_" + m.attrib['name'] + ":\n\n")
+ make_properties(f, name, m, True)
+ if m.text.strip() != '':
+ f.write(rstize_text(m.text.strip(), name))
+ f.write('\n\n')
+
+ # Method descriptions
methods = node.find('methods')
if methods != None and len(list(methods)) > 0:
- f.write(make_heading('Member Function Description', '-'))
+ f.write(make_heading('Method Descriptions', '-'))
for m in list(methods):
- f.write(".. _class_" + name + "_" + m.attrib['name'] + ":\n\n")
- make_method(f, node.attrib['name'], m, True, name)
+ f.write(" .. _class_" + name + "_" + m.attrib['name'] + ":\n\n")
+ make_method(f, name, m, True)
f.write('\n')
d = m.find('description')
if d == None or d.text.strip() == '':
continue
f.write(rstize_text(d.text.strip(), name))
f.write("\n\n")
- f.write('\n')
-
- f.close()
file_list = []
diff --git a/drivers/alsa/audio_driver_alsa.cpp b/drivers/alsa/audio_driver_alsa.cpp
index 1f53d52951..50697b8834 100644
--- a/drivers/alsa/audio_driver_alsa.cpp
+++ b/drivers/alsa/audio_driver_alsa.cpp
@@ -32,8 +32,8 @@
#ifdef ALSA_ENABLED
-#include "os/os.h"
-#include "project_settings.h"
+#include "core/os/os.h"
+#include "core/project_settings.h"
#include <errno.h>
diff --git a/drivers/alsamidi/alsa_midi.cpp b/drivers/alsamidi/alsa_midi.cpp
index 599470d7e0..33ad7e3f17 100644
--- a/drivers/alsamidi/alsa_midi.cpp
+++ b/drivers/alsamidi/alsa_midi.cpp
@@ -30,11 +30,12 @@
#ifdef ALSAMIDI_ENABLED
-#include <errno.h>
-
#include "alsa_midi.h"
-#include "os/os.h"
-#include "print_string.h"
+
+#include "core/os/os.h"
+#include "core/print_string.h"
+
+#include <errno.h>
static int get_message_size(uint8_t message) {
switch (message & 0xF0) {
diff --git a/drivers/alsamidi/alsa_midi.h b/drivers/alsamidi/alsa_midi.h
index 90e458a365..5741036166 100644
--- a/drivers/alsamidi/alsa_midi.h
+++ b/drivers/alsamidi/alsa_midi.h
@@ -33,13 +33,13 @@
#ifndef ALSA_MIDI_H
#define ALSA_MIDI_H
-#include <alsa/asoundlib.h>
-#include <stdio.h>
-
+#include "core/os/midi_driver.h"
#include "core/os/mutex.h"
#include "core/os/thread.h"
#include "core/vector.h"
-#include "os/midi_driver.h"
+
+#include <alsa/asoundlib.h>
+#include <stdio.h>
class MIDIDriverALSAMidi : public MIDIDriver {
diff --git a/drivers/convex_decomp/b2d_decompose.h b/drivers/convex_decomp/b2d_decompose.h
index b21792047e..f6b08b957c 100644
--- a/drivers/convex_decomp/b2d_decompose.h
+++ b/drivers/convex_decomp/b2d_decompose.h
@@ -31,8 +31,9 @@
#ifndef B2D_DECOMPOSE_H
#define B2D_DECOMPOSE_H
-#include "vector.h"
-#include "vector2.h"
+#include "core/math/vector2.h"
+#include "core/vector.h"
+
Vector<Vector<Vector2> > b2d_decompose(const Vector<Vector2> &p_polygon);
#endif // B2D_DECOMPOSE_H
diff --git a/drivers/coreaudio/audio_driver_coreaudio.cpp b/drivers/coreaudio/audio_driver_coreaudio.cpp
index 45d62e797f..09e50e4aaa 100644
--- a/drivers/coreaudio/audio_driver_coreaudio.cpp
+++ b/drivers/coreaudio/audio_driver_coreaudio.cpp
@@ -31,8 +31,9 @@
#ifdef COREAUDIO_ENABLED
#include "audio_driver_coreaudio.h"
+
+#include "core/os/os.h"
#include "core/project_settings.h"
-#include "os/os.h"
#define kOutputBus 0
#define kInputBus 1
diff --git a/drivers/coremidi/core_midi.cpp b/drivers/coremidi/core_midi.cpp
index 6d4624e05b..e8106c4543 100644
--- a/drivers/coremidi/core_midi.cpp
+++ b/drivers/coremidi/core_midi.cpp
@@ -31,7 +31,8 @@
#ifdef COREMIDI_ENABLED
#include "core_midi.h"
-#include "print_string.h"
+
+#include "core/print_string.h"
#include <CoreAudio/HostTime.h>
#include <CoreServices/CoreServices.h>
diff --git a/drivers/coremidi/core_midi.h b/drivers/coremidi/core_midi.h
index c6b443764f..ea6b0fcb06 100644
--- a/drivers/coremidi/core_midi.h
+++ b/drivers/coremidi/core_midi.h
@@ -33,12 +33,11 @@
#ifndef CORE_MIDI_H
#define CORE_MIDI_H
-#include <stdio.h>
+#include "core/os/midi_driver.h"
+#include "core/vector.h"
#include <CoreMIDI/CoreMIDI.h>
-
-#include "core/vector.h"
-#include "os/midi_driver.h"
+#include <stdio.h>
class MIDIDriverCoreMidi : public MIDIDriver {
diff --git a/drivers/dummy/rasterizer_dummy.h b/drivers/dummy/rasterizer_dummy.h
index 0381d3f0c1..bb4511ecc3 100644
--- a/drivers/dummy/rasterizer_dummy.h
+++ b/drivers/dummy/rasterizer_dummy.h
@@ -27,16 +27,16 @@
/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
/*************************************************************************/
+
#ifndef RASTERIZER_DUMMY_H
#define RASTERIZER_DUMMY_H
-#include "camera_matrix.h"
+#include "core/math/camera_matrix.h"
+#include "core/self_list.h"
#include "scene/resources/mesh.h"
#include "servers/visual/rasterizer.h"
#include "servers/visual_server.h"
-#include "self_list.h"
-
class RasterizerSceneDummy : public RasterizerScene {
public:
/* SHADOW ATLAS API */
diff --git a/drivers/dummy/texture_loader_dummy.cpp b/drivers/dummy/texture_loader_dummy.cpp
index b099019d17..8153fbd10b 100644
--- a/drivers/dummy/texture_loader_dummy.cpp
+++ b/drivers/dummy/texture_loader_dummy.cpp
@@ -29,8 +29,10 @@
/*************************************************************************/
#include "texture_loader_dummy.h"
+
#include "core/os/file_access.h"
-#include "print_string.h"
+#include "core/print_string.h"
+
#include <string.h>
RES ResourceFormatDummyTexture::load(const String &p_path, const String &p_original_path, Error *r_error) {
diff --git a/drivers/gl_context/context_gl.h b/drivers/gl_context/context_gl.h
index 60781a3453..37f334454b 100644
--- a/drivers/gl_context/context_gl.h
+++ b/drivers/gl_context/context_gl.h
@@ -33,7 +33,7 @@
#if defined(OPENGL_ENABLED) || defined(GLES_ENABLED)
-#include "typedefs.h"
+#include "core/typedefs.h"
/**
@author Juan Linietsky <reduzio@gmail.com>
diff --git a/drivers/gles2/rasterizer_canvas_gles2.cpp b/drivers/gles2/rasterizer_canvas_gles2.cpp
index 9a9ede761a..4ae4441462 100644
--- a/drivers/gles2/rasterizer_canvas_gles2.cpp
+++ b/drivers/gles2/rasterizer_canvas_gles2.cpp
@@ -27,11 +27,14 @@
/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
/*************************************************************************/
+
#include "rasterizer_canvas_gles2.h"
-#include "os/os.h"
-#include "project_settings.h"
+
+#include "core/os/os.h"
+#include "core/project_settings.h"
#include "rasterizer_scene_gles2.h"
#include "servers/visual/visual_server_raster.h"
+
#ifndef GLES_OVER_GL
#define glClearDepth glClearDepthf
#endif
@@ -562,7 +565,7 @@ void RasterizerCanvasGLES2::_canvas_item_render_commands(Item *p_item, Item *cur
buffer[(1 * 4 * 4) + 14] = (source.position.x + source.size.x) * texpixel_size.x;
buffer[(1 * 4 * 4) + 15] = (source.position.y + np->margin[MARGIN_TOP]) * texpixel_size.y;
- // thrid row
+ // third row
buffer[(2 * 4 * 4) + 0] = np->rect.position.x;
buffer[(2 * 4 * 4) + 1] = np->rect.position.y + np->rect.size.y - np->margin[MARGIN_BOTTOM];
diff --git a/drivers/gles2/rasterizer_gles2.cpp b/drivers/gles2/rasterizer_gles2.cpp
index efeab48ea2..bd03bd71f6 100644
--- a/drivers/gles2/rasterizer_gles2.cpp
+++ b/drivers/gles2/rasterizer_gles2.cpp
@@ -27,12 +27,12 @@
/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
/*************************************************************************/
+
#include "rasterizer_gles2.h"
+#include "core/os/os.h"
+#include "core/project_settings.h"
#include "gl_context/context_gl.h"
-#include "os/os.h"
-#include "project_settings.h"
-#include <string.h>
#define _EXT_DEBUG_OUTPUT_SYNCHRONOUS_ARB 0x8242
#define _EXT_DEBUG_NEXT_LOGGED_MESSAGE_LENGTH_ARB 0x8243
diff --git a/drivers/gles2/rasterizer_gles2.h b/drivers/gles2/rasterizer_gles2.h
index 98c73b776b..c76d5f7f20 100644
--- a/drivers/gles2/rasterizer_gles2.h
+++ b/drivers/gles2/rasterizer_gles2.h
@@ -27,6 +27,7 @@
/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
/*************************************************************************/
+
#ifndef RASTERIZERGLES2_H
#define RASTERIZERGLES2_H
diff --git a/drivers/gles2/rasterizer_scene_gles2.cpp b/drivers/gles2/rasterizer_scene_gles2.cpp
index e21998d55e..ca9f6dcbf8 100644
--- a/drivers/gles2/rasterizer_scene_gles2.cpp
+++ b/drivers/gles2/rasterizer_scene_gles2.cpp
@@ -27,16 +27,17 @@
/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
/*************************************************************************/
+
#include "rasterizer_scene_gles2.h"
-#include "math/transform.h"
-#include "math_funcs.h"
-#include "os/os.h"
-#include "project_settings.h"
+
+#include "core/math/math_funcs.h"
+#include "core/math/transform.h"
+#include "core/os/os.h"
+#include "core/project_settings.h"
+#include "core/vmap.h"
#include "rasterizer_canvas_gles2.h"
#include "servers/visual/visual_server_raster.h"
-#include "vmap.h"
-
#ifndef GLES_OVER_GL
#define glClearDepth glClearDepthf
#endif
diff --git a/drivers/gles2/rasterizer_scene_gles2.h b/drivers/gles2/rasterizer_scene_gles2.h
index 72dbe14387..c5d28e55f4 100644
--- a/drivers/gles2/rasterizer_scene_gles2.h
+++ b/drivers/gles2/rasterizer_scene_gles2.h
@@ -27,6 +27,7 @@
/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
/*************************************************************************/
+
#ifndef RASTERIZERSCENEGLES2_H
#define RASTERIZERSCENEGLES2_H
diff --git a/drivers/gles2/rasterizer_storage_gles2.cpp b/drivers/gles2/rasterizer_storage_gles2.cpp
index 5b5ab987d1..fdc110be9e 100644
--- a/drivers/gles2/rasterizer_storage_gles2.cpp
+++ b/drivers/gles2/rasterizer_storage_gles2.cpp
@@ -27,14 +27,13 @@
/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
/*************************************************************************/
+
#include "rasterizer_storage_gles2.h"
-#include "project_settings.h"
+#include "core/math/transform.h"
+#include "core/project_settings.h"
#include "rasterizer_canvas_gles2.h"
#include "rasterizer_scene_gles2.h"
-
-#include "math/transform.h"
-
#include "servers/visual/shader_language.h"
GLuint RasterizerStorageGLES2::system_fbo = 0;
@@ -1552,7 +1551,7 @@ void RasterizerStorageGLES2::_update_material(Material *p_material) {
}
}
- // uniforms and other thigns will be set in the use_material method in ShaderGLES2
+ // uniforms and other things will be set in the use_material method in ShaderGLES2
if (p_material->shader && p_material->shader->texture_count > 0) {
diff --git a/drivers/gles2/rasterizer_storage_gles2.h b/drivers/gles2/rasterizer_storage_gles2.h
index 88783d7160..e42eb67d3d 100644
--- a/drivers/gles2/rasterizer_storage_gles2.h
+++ b/drivers/gles2/rasterizer_storage_gles2.h
@@ -27,11 +27,12 @@
/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
/*************************************************************************/
+
#ifndef RASTERIZERSTORAGEGLES2_H
#define RASTERIZERSTORAGEGLES2_H
-#include "dvector.h"
-#include "self_list.h"
+#include "core/dvector.h"
+#include "core/self_list.h"
#include "servers/visual/rasterizer.h"
#include "servers/visual/shader_language.h"
#include "shader_compiler_gles2.h"
diff --git a/drivers/gles2/shader_compiler_gles2.cpp b/drivers/gles2/shader_compiler_gles2.cpp
index 1c87b3ffb5..83b61dc288 100644
--- a/drivers/gles2/shader_compiler_gles2.cpp
+++ b/drivers/gles2/shader_compiler_gles2.cpp
@@ -27,11 +27,12 @@
/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
/*************************************************************************/
+
#include "shader_compiler_gles2.h"
-#include "os/os.h"
-#include "string_buffer.h"
-#include "string_builder.h"
+#include "core/os/os.h"
+#include "core/string_buffer.h"
+#include "core/string_builder.h"
#define SL ShaderLanguage
diff --git a/drivers/gles2/shader_compiler_gles2.h b/drivers/gles2/shader_compiler_gles2.h
index 804ead2172..5e9e295204 100644
--- a/drivers/gles2/shader_compiler_gles2.h
+++ b/drivers/gles2/shader_compiler_gles2.h
@@ -27,16 +27,16 @@
/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
/*************************************************************************/
+
#ifndef SHADERCOMPILERGLES2_H
#define SHADERCOMPILERGLES2_H
-#include "pair.h"
+#include "core/pair.h"
+#include "core/string_builder.h"
#include "servers/visual/shader_language.h"
#include "servers/visual/shader_types.h"
#include "servers/visual_server.h"
-#include "string_builder.h"
-
class ShaderCompilerGLES2 {
public:
struct IdentifierActions {
diff --git a/drivers/gles2/shader_gles2.cpp b/drivers/gles2/shader_gles2.cpp
index 3b2a29d3ee..445428acc5 100644
--- a/drivers/gles2/shader_gles2.cpp
+++ b/drivers/gles2/shader_gles2.cpp
@@ -27,12 +27,12 @@
/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
/*************************************************************************/
-#include "shader_gles2.h"
-#include "memory.h"
-#include "print_string.h"
-#include "string_builder.h"
+#include "shader_gles2.h"
+#include "core/os/memory.h"
+#include "core/print_string.h"
+#include "core/string_builder.h"
#include "rasterizer_gles2.h"
#include "rasterizer_storage_gles2.h"
@@ -293,7 +293,7 @@ ShaderGLES2::Version *ShaderGLES2::get_current_version() {
}
}
- // keep them around during the functino
+ // keep them around during the function
CharString code_string;
CharString code_string2;
CharString code_globals;
diff --git a/drivers/gles2/shader_gles2.h b/drivers/gles2/shader_gles2.h
index cb515c199c..8e274b4f57 100644
--- a/drivers/gles2/shader_gles2.h
+++ b/drivers/gles2/shader_gles2.h
@@ -27,11 +27,11 @@
/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
/*************************************************************************/
+
#ifndef SHADER_GLES2_H
#define SHADER_GLES2_H
-#include <stdio.h>
-
+// This must come first to avoid windows.h mess
#include "platform_config.h"
#ifndef GLES2_INCLUDE_H
#include <GLES2/gl2.h>
@@ -39,14 +39,15 @@
#include GLES2_INCLUDE_H
#endif
-#include "camera_matrix.h"
-#include "hash_map.h"
-#include "map.h"
-#include "variant.h"
-
+#include "core/hash_map.h"
+#include "core/map.h"
+#include "core/math/camera_matrix.h"
#include "core/pair.h"
+#include "core/variant.h"
#include "servers/visual/shader_language.h"
+#include <stdio.h>
+
class RasterizerStorageGLES2;
class ShaderGLES2 {
diff --git a/drivers/gles3/rasterizer_canvas_gles3.cpp b/drivers/gles3/rasterizer_canvas_gles3.cpp
index fc41f17164..c9bdc6f5c3 100644
--- a/drivers/gles3/rasterizer_canvas_gles3.cpp
+++ b/drivers/gles3/rasterizer_canvas_gles3.cpp
@@ -29,10 +29,12 @@
/*************************************************************************/
#include "rasterizer_canvas_gles3.h"
-#include "os/os.h"
-#include "project_settings.h"
+
+#include "core/os/os.h"
+#include "core/project_settings.h"
#include "rasterizer_scene_gles3.h"
#include "servers/visual/visual_server_raster.h"
+
#ifndef GLES_OVER_GL
#define glClearDepth glClearDepthf
#endif
@@ -1418,7 +1420,7 @@ void RasterizerCanvasGLES3::canvas_render_items(Item *p_item_list, int p_z, cons
if (blend_mode == RasterizerStorageGLES3::Shader::CanvasItem::BLEND_MODE_DISABLED && (!storage->frame.current_rt || !storage->frame.current_rt->flags[RasterizerStorage::RENDER_TARGET_TRANSPARENT])) {
blend_mode = RasterizerStorageGLES3::Shader::CanvasItem::BLEND_MODE_MIX;
}
- bool unshaded = shader_cache && (shader_cache->canvas_item.light_mode == RasterizerStorageGLES3::Shader::CanvasItem::LIGHT_MODE_UNSHADED || blend_mode != RasterizerStorageGLES3::Shader::CanvasItem::BLEND_MODE_MIX);
+ bool unshaded = shader_cache && (shader_cache->canvas_item.light_mode == RasterizerStorageGLES3::Shader::CanvasItem::LIGHT_MODE_UNSHADED || (blend_mode != RasterizerStorageGLES3::Shader::CanvasItem::BLEND_MODE_MIX && blend_mode != RasterizerStorageGLES3::Shader::CanvasItem::BLEND_MODE_PMALPHA));
bool reclip = false;
if (last_blend_mode != blend_mode) {
diff --git a/drivers/gles3/rasterizer_canvas_gles3.h b/drivers/gles3/rasterizer_canvas_gles3.h
index c7f2e54efb..bc4ea80328 100644
--- a/drivers/gles3/rasterizer_canvas_gles3.h
+++ b/drivers/gles3/rasterizer_canvas_gles3.h
@@ -33,6 +33,7 @@
#include "rasterizer_storage_gles3.h"
#include "servers/visual/rasterizer.h"
+
#include "shaders/canvas_shadow.glsl.gen.h"
class RasterizerSceneGLES3;
diff --git a/drivers/gles3/rasterizer_gles3.cpp b/drivers/gles3/rasterizer_gles3.cpp
index e4824695d5..d3f6dcd497 100644
--- a/drivers/gles3/rasterizer_gles3.cpp
+++ b/drivers/gles3/rasterizer_gles3.cpp
@@ -30,11 +30,9 @@
#include "rasterizer_gles3.h"
+#include "core/os/os.h"
+#include "core/project_settings.h"
#include "gl_context/context_gl.h"
-#include "os/os.h"
-#include "project_settings.h"
-
-#include <string.h>
RasterizerStorage *RasterizerGLES3::get_storage() {
diff --git a/drivers/gles3/rasterizer_scene_gles3.cpp b/drivers/gles3/rasterizer_scene_gles3.cpp
index 88f14890ef..1e43651d54 100644
--- a/drivers/gles3/rasterizer_scene_gles3.cpp
+++ b/drivers/gles3/rasterizer_scene_gles3.cpp
@@ -29,9 +29,10 @@
/*************************************************************************/
#include "rasterizer_scene_gles3.h"
-#include "math_funcs.h"
-#include "os/os.h"
-#include "project_settings.h"
+
+#include "core/math/math_funcs.h"
+#include "core/os/os.h"
+#include "core/project_settings.h"
#include "rasterizer_canvas_gles3.h"
#include "servers/visual/visual_server_raster.h"
@@ -3097,40 +3098,6 @@ void RasterizerSceneGLES3::_copy_screen(bool p_invalidate_color, bool p_invalida
glBindVertexArray(0);
}
-void RasterizerSceneGLES3::_copy_to_front_buffer(Environment *env) {
-
- //copy to front buffer
- glBindFramebuffer(GL_FRAMEBUFFER, storage->frame.current_rt->fbo);
-
- glDepthMask(GL_FALSE);
- glDisable(GL_DEPTH_TEST);
- glDisable(GL_CULL_FACE);
- glDisable(GL_BLEND);
- glDepthFunc(GL_LEQUAL);
- glColorMask(1, 1, 1, 1);
-
- glActiveTexture(GL_TEXTURE0);
- glBindTexture(GL_TEXTURE_2D, storage->frame.current_rt->buffers.diffuse);
-
- storage->shaders.copy.set_conditional(CopyShaderGLES3::DISABLE_ALPHA, true);
-
- if (!env) {
- //no environment, simply convert from linear to srgb
- storage->shaders.copy.set_conditional(CopyShaderGLES3::LINEAR_TO_SRGB, true);
- } else {
- /* FIXME: Why are both statements equal? */
- storage->shaders.copy.set_conditional(CopyShaderGLES3::LINEAR_TO_SRGB, true);
- }
-
- storage->shaders.copy.bind();
-
- _copy_screen();
-
- //turn off everything used
- storage->shaders.copy.set_conditional(CopyShaderGLES3::LINEAR_TO_SRGB, false);
- storage->shaders.copy.set_conditional(CopyShaderGLES3::DISABLE_ALPHA, false);
-}
-
void RasterizerSceneGLES3::_copy_texture_to_front_buffer(GLuint p_texture) {
//copy to front buffer
diff --git a/drivers/gles3/rasterizer_scene_gles3.h b/drivers/gles3/rasterizer_scene_gles3.h
index cf387a69bc..b4c4a0558f 100644
--- a/drivers/gles3/rasterizer_scene_gles3.h
+++ b/drivers/gles3/rasterizer_scene_gles3.h
@@ -837,7 +837,6 @@ public:
void _setup_reflections(RID *p_reflection_probe_cull_result, int p_reflection_probe_cull_count, const Transform &p_camera_inverse_transform, const CameraMatrix &p_camera_projection, RID p_reflection_atlas, Environment *p_env);
void _copy_screen(bool p_invalidate_color = false, bool p_invalidate_depth = false);
- void _copy_to_front_buffer(Environment *env);
void _copy_texture_to_front_buffer(GLuint p_texture); //used for debug
void _fill_render_list(InstanceBase **p_cull_result, int p_cull_count, bool p_depth_pass, bool p_shadow_pass);
diff --git a/drivers/gles3/rasterizer_storage_gles3.cpp b/drivers/gles3/rasterizer_storage_gles3.cpp
index 83f731f610..c05f4cfbe3 100644
--- a/drivers/gles3/rasterizer_storage_gles3.cpp
+++ b/drivers/gles3/rasterizer_storage_gles3.cpp
@@ -29,8 +29,9 @@
/*************************************************************************/
#include "rasterizer_storage_gles3.h"
-#include "engine.h"
-#include "project_settings.h"
+
+#include "core/engine.h"
+#include "core/project_settings.h"
#include "rasterizer_canvas_gles3.h"
#include "rasterizer_scene_gles3.h"
diff --git a/drivers/gles3/rasterizer_storage_gles3.h b/drivers/gles3/rasterizer_storage_gles3.h
index b74dd77e26..33f0853d60 100644
--- a/drivers/gles3/rasterizer_storage_gles3.h
+++ b/drivers/gles3/rasterizer_storage_gles3.h
@@ -31,11 +31,12 @@
#ifndef RASTERIZERSTORAGEGLES3_H
#define RASTERIZERSTORAGEGLES3_H
-#include "self_list.h"
+#include "core/self_list.h"
#include "servers/visual/rasterizer.h"
#include "servers/visual/shader_language.h"
#include "shader_compiler_gles3.h"
#include "shader_gles3.h"
+
#include "shaders/blend_shape.glsl.gen.h"
#include "shaders/canvas.glsl.gen.h"
#include "shaders/copy.glsl.gen.h"
diff --git a/drivers/gles3/shader_compiler_gles3.cpp b/drivers/gles3/shader_compiler_gles3.cpp
index a78a392cbd..11c84e7db8 100644
--- a/drivers/gles3/shader_compiler_gles3.cpp
+++ b/drivers/gles3/shader_compiler_gles3.cpp
@@ -30,7 +30,7 @@
#include "shader_compiler_gles3.h"
-#include "os/os.h"
+#include "core/os/os.h"
#define SL ShaderLanguage
diff --git a/drivers/gles3/shader_compiler_gles3.h b/drivers/gles3/shader_compiler_gles3.h
index 7a32057741..1f903b8935 100644
--- a/drivers/gles3/shader_compiler_gles3.h
+++ b/drivers/gles3/shader_compiler_gles3.h
@@ -31,7 +31,7 @@
#ifndef SHADERCOMPILERGLES3_H
#define SHADERCOMPILERGLES3_H
-#include "pair.h"
+#include "core/pair.h"
#include "servers/visual/shader_language.h"
#include "servers/visual/shader_types.h"
#include "servers/visual_server.h"
diff --git a/drivers/gles3/shader_gles3.cpp b/drivers/gles3/shader_gles3.cpp
index 007600bb42..2a3b8a9b91 100644
--- a/drivers/gles3/shader_gles3.cpp
+++ b/drivers/gles3/shader_gles3.cpp
@@ -30,7 +30,7 @@
#include "shader_gles3.h"
-#include "print_string.h"
+#include "core/print_string.h"
//#define DEBUG_OPENGL
diff --git a/drivers/gles3/shader_gles3.h b/drivers/gles3/shader_gles3.h
index 996655615e..ca74317218 100644
--- a/drivers/gles3/shader_gles3.h
+++ b/drivers/gles3/shader_gles3.h
@@ -31,7 +31,10 @@
#ifndef SHADER_GLES3_H
#define SHADER_GLES3_H
-#include <stdio.h>
+#include "core/hash_map.h"
+#include "core/map.h"
+#include "core/math/camera_matrix.h"
+#include "core/variant.h"
#include "platform_config.h"
#ifndef GLES3_INCLUDE_H
@@ -40,10 +43,7 @@
#include GLES3_INCLUDE_H
#endif
-#include "camera_matrix.h"
-#include "hash_map.h"
-#include "map.h"
-#include "variant.h"
+#include <stdio.h>
/**
@author Juan Linietsky <reduzio@gmail.com>
diff --git a/drivers/gles3/shaders/tonemap.glsl b/drivers/gles3/shaders/tonemap.glsl
index e4aa8d5730..dd6d78849b 100644
--- a/drivers/gles3/shaders/tonemap.glsl
+++ b/drivers/gles3/shaders/tonemap.glsl
@@ -173,7 +173,7 @@ vec3 apply_tonemapping(vec3 color, float white) { // inputs are LINEAR, always o
return tonemap_aces(color, white);
#endif
- return clamp(color, vec3(0.0f), vec3(1.0f)); // no other seleced -> linear
+ return clamp(color, vec3(0.0f), vec3(1.0f)); // no other selected -> linear
}
vec3 gather_glow(sampler2D tex, vec2 uv) { // sample all selected glow levels
diff --git a/drivers/png/image_loader_png.cpp b/drivers/png/image_loader_png.cpp
index b08688892e..04acb9387e 100644
--- a/drivers/png/image_loader_png.cpp
+++ b/drivers/png/image_loader_png.cpp
@@ -30,8 +30,8 @@
#include "image_loader_png.h"
-#include "os/os.h"
-#include "print_string.h"
+#include "core/os/os.h"
+#include "core/print_string.h"
#include <string.h>
diff --git a/drivers/png/image_loader_png.h b/drivers/png/image_loader_png.h
index 48f48e6bea..5dff7e3902 100644
--- a/drivers/png/image_loader_png.h
+++ b/drivers/png/image_loader_png.h
@@ -31,7 +31,7 @@
#ifndef IMAGE_LOADER_PNG_H
#define IMAGE_LOADER_PNG_H
-#include "io/image_loader.h"
+#include "core/io/image_loader.h"
#include <png.h>
diff --git a/drivers/png/resource_saver_png.cpp b/drivers/png/resource_saver_png.cpp
index 270ae36e1e..c5729f70b2 100644
--- a/drivers/png/resource_saver_png.cpp
+++ b/drivers/png/resource_saver_png.cpp
@@ -31,8 +31,8 @@
#include "resource_saver_png.h"
#include "core/image.h"
-#include "os/file_access.h"
-#include "project_settings.h"
+#include "core/os/file_access.h"
+#include "core/project_settings.h"
#include "scene/resources/texture.h"
#include <png.h>
diff --git a/drivers/png/resource_saver_png.h b/drivers/png/resource_saver_png.h
index 109b4801da..34950f6723 100644
--- a/drivers/png/resource_saver_png.h
+++ b/drivers/png/resource_saver_png.h
@@ -31,8 +31,8 @@
#ifndef RESOURCE_SAVER_PNG_H
#define RESOURCE_SAVER_PNG_H
-#include "image.h"
-#include "io/resource_saver.h"
+#include "core/image.h"
+#include "core/io/resource_saver.h"
class ResourceSaverPNG : public ResourceFormatSaver {
public:
diff --git a/drivers/pulseaudio/audio_driver_pulseaudio.cpp b/drivers/pulseaudio/audio_driver_pulseaudio.cpp
index 744b3a35e6..7578fbc0a0 100644
--- a/drivers/pulseaudio/audio_driver_pulseaudio.cpp
+++ b/drivers/pulseaudio/audio_driver_pulseaudio.cpp
@@ -32,10 +32,8 @@
#ifdef PULSEAUDIO_ENABLED
-#include <pulse/pulseaudio.h>
-
-#include "os/os.h"
-#include "project_settings.h"
+#include "core/os/os.h"
+#include "core/project_settings.h"
void AudioDriverPulseAudio::pa_state_cb(pa_context *c, void *userdata) {
AudioDriverPulseAudio *ad = (AudioDriverPulseAudio *)userdata;
diff --git a/drivers/rtaudio/audio_driver_rtaudio.cpp b/drivers/rtaudio/audio_driver_rtaudio.cpp
index 69830b542b..10ba0663f2 100644
--- a/drivers/rtaudio/audio_driver_rtaudio.cpp
+++ b/drivers/rtaudio/audio_driver_rtaudio.cpp
@@ -30,8 +30,8 @@
#include "audio_driver_rtaudio.h"
-#include "os/os.h"
-#include "project_settings.h"
+#include "core/os/os.h"
+#include "core/project_settings.h"
#ifdef RTAUDIO_ENABLED
diff --git a/drivers/unix/dir_access_unix.cpp b/drivers/unix/dir_access_unix.cpp
index 5a4be6df4f..a5a9258c4a 100644
--- a/drivers/unix/dir_access_unix.cpp
+++ b/drivers/unix/dir_access_unix.cpp
@@ -32,18 +32,19 @@
#if defined(UNIX_ENABLED) || defined(LIBC_FILEIO_ENABLED)
-#ifndef ANDROID_ENABLED
-#include <sys/statvfs.h>
-#endif
-
#include "core/list.h"
-#include "os/memory.h"
-#include "print_string.h"
+#include "core/os/memory.h"
+#include "core/print_string.h"
+
#include <errno.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
+#ifndef ANDROID_ENABLED
+#include <sys/statvfs.h>
+#endif
+
#ifdef HAVE_MNTENT
#include <mntent.h>
#endif
@@ -59,7 +60,7 @@ Error DirAccessUnix::list_dir_begin() {
//char real_current_dir_name[2048]; //is this enough?!
//getcwd(real_current_dir_name,2048);
- //chdir(curent_path.utf8().get_data());
+ //chdir(current_path.utf8().get_data());
dir_stream = opendir(current_dir.utf8().get_data());
//chdir(real_current_dir_name);
if (!dir_stream)
diff --git a/drivers/unix/dir_access_unix.h b/drivers/unix/dir_access_unix.h
index a55acdbd34..26978930bd 100644
--- a/drivers/unix/dir_access_unix.h
+++ b/drivers/unix/dir_access_unix.h
@@ -33,16 +33,17 @@
#if defined(UNIX_ENABLED) || defined(LIBC_FILEIO_ENABLED)
+#include "core/os/dir_access.h"
+
#include <dirent.h>
#include <sys/stat.h>
#include <sys/types.h>
#include <unistd.h>
-#include "os/dir_access.h"
-
/**
@author Juan Linietsky <reduzio@gmail.com>
*/
+
class DirAccessUnix : public DirAccess {
DIR *dir_stream;
diff --git a/drivers/unix/file_access_unix.cpp b/drivers/unix/file_access_unix.cpp
index ca16c6fcae..3b97b95f7c 100644
--- a/drivers/unix/file_access_unix.cpp
+++ b/drivers/unix/file_access_unix.cpp
@@ -33,7 +33,8 @@
#if defined(UNIX_ENABLED) || defined(LIBC_FILEIO_ENABLED)
#include "core/os/os.h"
-#include "print_string.h"
+#include "core/print_string.h"
+
#include <sys/stat.h>
#include <sys/types.h>
diff --git a/drivers/unix/file_access_unix.h b/drivers/unix/file_access_unix.h
index 88bb39fbd1..d4a4f8230c 100644
--- a/drivers/unix/file_access_unix.h
+++ b/drivers/unix/file_access_unix.h
@@ -31,8 +31,9 @@
#ifndef FILE_ACCESS_UNIX_H
#define FILE_ACCESS_UNIX_H
-#include "os/file_access.h"
-#include "os/memory.h"
+#include "core/os/file_access.h"
+#include "core/os/memory.h"
+
#include <stdio.h>
#if defined(UNIX_ENABLED) || defined(LIBC_FILEIO_ENABLED)
diff --git a/drivers/unix/ip_unix.h b/drivers/unix/ip_unix.h
index d3d1ccfa85..83535045b1 100644
--- a/drivers/unix/ip_unix.h
+++ b/drivers/unix/ip_unix.h
@@ -31,7 +31,7 @@
#ifndef IP_UNIX_H
#define IP_UNIX_H
-#include "io/ip.h"
+#include "core/io/ip.h"
#if defined(UNIX_ENABLED) || defined(WINDOWS_ENABLED)
diff --git a/drivers/unix/mutex_posix.cpp b/drivers/unix/mutex_posix.cpp
index 1f13720f1e..e0004c5730 100644
--- a/drivers/unix/mutex_posix.cpp
+++ b/drivers/unix/mutex_posix.cpp
@@ -29,7 +29,8 @@
/*************************************************************************/
#include "mutex_posix.h"
-#include "os/memory.h"
+
+#include "core/os/memory.h"
#if defined(UNIX_ENABLED) || defined(PTHREAD_ENABLED)
diff --git a/drivers/unix/mutex_posix.h b/drivers/unix/mutex_posix.h
index a4de1603f3..80d85eee61 100644
--- a/drivers/unix/mutex_posix.h
+++ b/drivers/unix/mutex_posix.h
@@ -33,7 +33,8 @@
#if defined(UNIX_ENABLED) || defined(PTHREAD_ENABLED)
-#include "os/mutex.h"
+#include "core/os/mutex.h"
+
#include <pthread.h>
class MutexPosix : public Mutex {
diff --git a/drivers/unix/net_socket_posix.cpp b/drivers/unix/net_socket_posix.cpp
new file mode 100644
index 0000000000..ea19b6a700
--- /dev/null
+++ b/drivers/unix/net_socket_posix.cpp
@@ -0,0 +1,535 @@
+/*************************************************************************/
+/* net_socket_posix.cpp */
+/*************************************************************************/
+/* This file is part of: */
+/* GODOT ENGINE */
+/* https://godotengine.org */
+/*************************************************************************/
+/* Copyright (c) 2007-2018 Juan Linietsky, Ariel Manzur. */
+/* Copyright (c) 2014-2018 Godot Engine contributors (cf. AUTHORS.md) */
+/* */
+/* Permission is hereby granted, free of charge, to any person obtaining */
+/* a copy of this software and associated documentation files (the */
+/* "Software"), to deal in the Software without restriction, including */
+/* without limitation the rights to use, copy, modify, merge, publish, */
+/* distribute, sublicense, and/or sell copies of the Software, and to */
+/* permit persons to whom the Software is furnished to do so, subject to */
+/* the following conditions: */
+/* */
+/* The above copyright notice and this permission notice shall be */
+/* included in all copies or substantial portions of the Software. */
+/* */
+/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */
+/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */
+/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.*/
+/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */
+/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */
+/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */
+/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
+/*************************************************************************/
+
+#include "net_socket_posix.h"
+
+#if defined(UNIX_ENABLED)
+
+#include <errno.h>
+#include <netdb.h>
+#include <poll.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <sys/ioctl.h>
+#include <sys/types.h>
+#include <unistd.h>
+#ifndef NO_FCNTL
+#ifdef __HAIKU__
+#include <fcntl.h>
+#else
+#include <sys/fcntl.h>
+#endif
+#else
+#include <sys/ioctl.h>
+#endif
+#include <netinet/in.h>
+
+#include <sys/socket.h>
+#ifdef JAVASCRIPT_ENABLED
+#include <arpa/inet.h>
+#endif
+
+#include <netinet/tcp.h>
+
+#if defined(OSX_ENABLED) || defined(IPHONE_ENABLED)
+#define MSG_NOSIGNAL SO_NOSIGPIPE
+#endif
+
+// Some custom defines to minimize ifdefs
+#define SOCK_EMPTY -1
+#define SOCK_BUF(x) x
+#define SOCK_CBUF(x) x
+#define SOCK_IOCTL ioctl
+#define SOCK_POLL ::poll
+#define SOCK_CLOSE ::close
+
+/* Windows */
+#elif defined(WINDOWS_ENABLED)
+#include <winsock2.h>
+#include <ws2tcpip.h>
+// Some custom defines to minimize ifdefs
+#define SOCK_EMPTY INVALID_SOCKET
+#define SOCK_BUF(x) (char *)(x)
+#define SOCK_CBUF(x) (const char *)(x)
+#define SOCK_IOCTL ioctlsocket
+#define SOCK_POLL WSAPoll
+#define SOCK_CLOSE closesocket
+
+// Windows doesn't have this flag
+#ifndef MSG_NOSIGNAL
+#define MSG_NOSIGNAL 0
+#endif
+
+#endif
+
+static size_t _set_addr_storage(struct sockaddr_storage *p_addr, const IP_Address &p_ip, uint16_t p_port, IP::Type p_ip_type) {
+
+ memset(p_addr, 0, sizeof(struct sockaddr_storage));
+ if (p_ip_type == IP::TYPE_IPV6 || p_ip_type == IP::TYPE_ANY) { // IPv6 socket
+
+ // IPv6 only socket with IPv4 address
+ ERR_FAIL_COND_V(!p_ip.is_wildcard() && p_ip_type == IP::TYPE_IPV6 && p_ip.is_ipv4(), 0);
+
+ struct sockaddr_in6 *addr6 = (struct sockaddr_in6 *)p_addr;
+ addr6->sin6_family = AF_INET6;
+ addr6->sin6_port = htons(p_port);
+ if (p_ip.is_valid()) {
+ copymem(&addr6->sin6_addr.s6_addr, p_ip.get_ipv6(), 16);
+ } else {
+ addr6->sin6_addr = in6addr_any;
+ }
+ return sizeof(sockaddr_in6);
+ } else { // IPv4 socket
+
+ // IPv4 socket with IPv6 address
+ ERR_FAIL_COND_V(!p_ip.is_ipv4(), 0);
+
+ struct sockaddr_in *addr4 = (struct sockaddr_in *)p_addr;
+ addr4->sin_family = AF_INET;
+ addr4->sin_port = htons(p_port); // short, network byte order
+
+ if (p_ip.is_valid()) {
+ copymem(&addr4->sin_addr.s_addr, p_ip.get_ipv4(), 4);
+ } else {
+ addr4->sin_addr.s_addr = INADDR_ANY;
+ }
+
+ copymem(&addr4->sin_addr.s_addr, p_ip.get_ipv4(), 16);
+ return sizeof(sockaddr_in);
+ }
+}
+
+static void _set_ip_port(IP_Address &r_ip, uint16_t &r_port, struct sockaddr_storage *p_addr) {
+
+ if (p_addr->ss_family == AF_INET) {
+
+ struct sockaddr_in *addr4 = (struct sockaddr_in *)p_addr;
+ r_ip.set_ipv4((uint8_t *)&(addr4->sin_addr.s_addr));
+
+ r_port = ntohs(addr4->sin_port);
+
+ } else if (p_addr->ss_family == AF_INET6) {
+
+ struct sockaddr_in6 *addr6 = (struct sockaddr_in6 *)p_addr;
+ r_ip.set_ipv6(addr6->sin6_addr.s6_addr);
+
+ r_port = ntohs(addr6->sin6_port);
+ };
+}
+
+NetSocket *NetSocketPosix::_create_func() {
+ return memnew(NetSocketPosix);
+}
+
+void NetSocketPosix::make_default() {
+ _create = _create_func;
+}
+
+NetSocketPosix::NetSocketPosix() {
+ _sock = SOCK_EMPTY;
+ _ip_type = IP::TYPE_NONE;
+ _is_stream = false;
+}
+
+NetSocketPosix::~NetSocketPosix() {
+ close();
+}
+
+NetSocketPosix::NetError NetSocketPosix::_get_socket_error() {
+#if defined(WINDOWS_ENABLED)
+ int err = WSAGetLastError();
+
+ if (err == WSAEISCONN)
+ return ERR_NET_IS_CONNECTED;
+ if (err == WSAEINPROGRESS || errno == WSAEALREADY)
+ return ERR_NET_IN_PROGRESS;
+ if (err == WSAEWOULDBLOCK)
+ return ERR_NET_WOULD_BLOCK;
+ return ERR_NET_OTHER;
+#else
+ if (errno == EISCONN)
+ return ERR_NET_IS_CONNECTED;
+ if (errno == EINPROGRESS || errno == EALREADY)
+ return ERR_NET_IN_PROGRESS;
+ if (errno == EAGAIN || errno == EWOULDBLOCK)
+ return ERR_NET_WOULD_BLOCK;
+ return ERR_NET_OTHER;
+#endif
+}
+
+bool NetSocketPosix::_can_use_ip(const IP_Address p_ip, const bool p_for_bind) const {
+
+ if (p_for_bind && !(p_ip.is_valid() || p_ip.is_wildcard())) {
+ return false;
+ } else if (!p_for_bind && !p_ip.is_valid()) {
+ return false;
+ }
+ // Check if socket support this IP type.
+ IP::Type type = p_ip.is_ipv4() ? IP::TYPE_IPV4 : IP::TYPE_IPV6;
+ if (_ip_type != IP::TYPE_ANY && !p_ip.is_wildcard() && _ip_type != type) {
+ return false;
+ }
+ return true;
+}
+
+void NetSocketPosix::_set_socket(SOCKET_TYPE p_sock, IP::Type p_ip_type, bool p_is_stream) {
+ _sock = p_sock;
+ _ip_type = p_ip_type;
+ _is_stream = p_is_stream;
+}
+
+Error NetSocketPosix::open(Type p_sock_type, IP::Type &ip_type) {
+ ERR_FAIL_COND_V(is_open(), ERR_ALREADY_IN_USE);
+ ERR_FAIL_COND_V(ip_type > IP::TYPE_ANY || ip_type < IP::TYPE_NONE, ERR_INVALID_PARAMETER);
+
+#if defined(__OpenBSD__)
+ // OpenBSD does not support dual stacking, fallback to IPv4 only.
+ if (ip_type == IP::TYPE_ANY)
+ ip_type = IP::TYPE_IPV4;
+#endif
+
+ int family = ip_type == IP::TYPE_IPV4 ? AF_INET : AF_INET6;
+ int protocol = p_sock_type == TYPE_TCP ? IPPROTO_TCP : IPPROTO_UDP;
+ int type = p_sock_type == TYPE_TCP ? SOCK_STREAM : SOCK_DGRAM;
+ _sock = socket(family, type, protocol);
+
+ if (_sock == SOCK_EMPTY && ip_type == IP::TYPE_ANY) {
+ // Careful here, changing the referenced parameter so the caller knows that we are using an IPv4 socket
+ // in place of a dual stack one, and further calls to _set_sock_addr will work as expected.
+ ip_type = IP::TYPE_IPV4;
+ family = AF_INET;
+ _sock = socket(family, type, protocol);
+ }
+
+ ERR_FAIL_COND_V(_sock == SOCK_EMPTY, FAILED);
+ _ip_type = ip_type;
+
+ if (family == AF_INET6) {
+ // Select IPv4 over IPv6 mapping
+ set_ipv6_only_enabled(ip_type != IP::TYPE_ANY);
+ }
+
+ if (protocol == IPPROTO_UDP && ip_type != IP::TYPE_IPV6) {
+ // Enable broadcasting for UDP sockets if it's not IPv6 only (IPv6 has no broadcast option).
+ set_broadcasting_enabled(true);
+ }
+
+ _is_stream = p_sock_type == TYPE_TCP;
+ return OK;
+}
+
+void NetSocketPosix::close() {
+
+ if (_sock != SOCK_EMPTY)
+ SOCK_CLOSE(_sock);
+
+ _sock = SOCK_EMPTY;
+ _ip_type = IP::TYPE_NONE;
+ _is_stream = false;
+}
+
+Error NetSocketPosix::bind(IP_Address p_addr, uint16_t p_port) {
+
+ ERR_FAIL_COND_V(!is_open(), ERR_UNCONFIGURED);
+ ERR_FAIL_COND_V(!_can_use_ip(p_addr, true), ERR_INVALID_PARAMETER);
+
+ sockaddr_storage addr;
+ size_t addr_size = _set_addr_storage(&addr, p_addr, p_port, _ip_type);
+
+ if (::bind(_sock, (struct sockaddr *)&addr, addr_size) == SOCK_EMPTY) {
+ close();
+ ERR_FAIL_V(ERR_UNAVAILABLE);
+ }
+
+ return OK;
+}
+
+Error NetSocketPosix::listen(int p_max_pending) {
+ ERR_FAIL_COND_V(!is_open(), ERR_UNCONFIGURED);
+
+ if (::listen(_sock, p_max_pending) == SOCK_EMPTY) {
+
+ close();
+ ERR_FAIL_V(FAILED);
+ };
+
+ return OK;
+}
+
+Error NetSocketPosix::connect_to_host(IP_Address p_host, uint16_t p_port) {
+
+ ERR_FAIL_COND_V(!is_open(), ERR_UNCONFIGURED);
+ ERR_FAIL_COND_V(!_can_use_ip(p_host, false), ERR_INVALID_PARAMETER);
+
+ struct sockaddr_storage addr;
+ size_t addr_size = _set_addr_storage(&addr, p_host, p_port, _ip_type);
+
+ if (::connect(_sock, (struct sockaddr *)&addr, addr_size) == SOCK_EMPTY) {
+
+ NetError err = _get_socket_error();
+
+ switch (err) {
+ // We are already connected
+ case ERR_NET_IS_CONNECTED:
+ return OK;
+ // Still waiting to connect, try again in a while
+ case ERR_NET_WOULD_BLOCK:
+ case ERR_NET_IN_PROGRESS:
+ return ERR_BUSY;
+ default:
+ ERR_PRINT("Connection to remote host failed!");
+ close();
+ return FAILED;
+ }
+ }
+
+ return OK;
+}
+
+Error NetSocketPosix::poll(PollType p_type, int timeout) const {
+
+ ERR_FAIL_COND_V(!is_open(), ERR_UNCONFIGURED);
+
+ struct pollfd pfd;
+ pfd.fd = _sock;
+ pfd.events = POLLIN;
+ pfd.revents = 0;
+
+ switch (p_type) {
+ case POLL_TYPE_IN:
+ pfd.events = POLLIN;
+ break;
+ case POLL_TYPE_OUT:
+ pfd.events = POLLOUT;
+ break;
+ case POLL_TYPE_IN_OUT:
+ pfd.events = POLLOUT || POLLIN;
+ }
+
+ int ret = SOCK_POLL(&pfd, 1, timeout);
+
+ ERR_FAIL_COND_V(ret < 0, FAILED);
+
+ if (ret == 0)
+ return ERR_BUSY;
+
+ return OK;
+}
+
+Error NetSocketPosix::recv(uint8_t *p_buffer, int p_len, int &r_read) {
+ ERR_FAIL_COND_V(!is_open(), ERR_UNCONFIGURED);
+
+ r_read = ::recv(_sock, SOCK_BUF(p_buffer), p_len, 0);
+
+ if (r_read < 0) {
+ NetError err = _get_socket_error();
+ if (err == ERR_NET_WOULD_BLOCK)
+ return ERR_BUSY;
+
+ return FAILED;
+ }
+
+ return OK;
+}
+
+Error NetSocketPosix::recvfrom(uint8_t *p_buffer, int p_len, int &r_read, IP_Address &r_ip, uint16_t &r_port) {
+ ERR_FAIL_COND_V(!is_open(), ERR_UNCONFIGURED);
+
+ struct sockaddr_storage from;
+ socklen_t len = sizeof(struct sockaddr_storage);
+ memset(&from, 0, len);
+
+ r_read = ::recvfrom(_sock, SOCK_BUF(p_buffer), p_len, 0, (struct sockaddr *)&from, &len);
+
+ if (r_read < 0) {
+ NetError err = _get_socket_error();
+ if (err == ERR_NET_WOULD_BLOCK)
+ return ERR_BUSY;
+
+ return FAILED;
+ }
+
+ if (from.ss_family == AF_INET) {
+ struct sockaddr_in *sin_from = (struct sockaddr_in *)&from;
+ r_ip.set_ipv4((uint8_t *)&sin_from->sin_addr);
+ r_port = ntohs(sin_from->sin_port);
+ } else if (from.ss_family == AF_INET6) {
+ struct sockaddr_in6 *s6_from = (struct sockaddr_in6 *)&from;
+ r_ip.set_ipv6((uint8_t *)&s6_from->sin6_addr);
+ r_port = ntohs(s6_from->sin6_port);
+ } else {
+ // Unsupported socket family, should never happen.
+ ERR_FAIL_V(FAILED);
+ }
+
+ return OK;
+}
+
+Error NetSocketPosix::send(const uint8_t *p_buffer, int p_len, int &r_sent) {
+ ERR_FAIL_COND_V(!is_open(), ERR_UNCONFIGURED);
+
+ int flags = 0;
+ if (_is_stream)
+ flags = MSG_NOSIGNAL;
+ r_sent = ::send(_sock, SOCK_CBUF(p_buffer), p_len, flags);
+
+ if (r_sent < 0) {
+ NetError err = _get_socket_error();
+ if (err == ERR_NET_WOULD_BLOCK)
+ return ERR_BUSY;
+
+ return FAILED;
+ }
+
+ return OK;
+}
+
+Error NetSocketPosix::sendto(const uint8_t *p_buffer, int p_len, int &r_sent, IP_Address p_ip, uint16_t p_port) {
+ ERR_FAIL_COND_V(!is_open(), ERR_UNCONFIGURED);
+
+ struct sockaddr_storage addr;
+ size_t addr_size = _set_addr_storage(&addr, p_ip, p_port, _ip_type);
+ r_sent = ::sendto(_sock, SOCK_CBUF(p_buffer), p_len, 0, (struct sockaddr *)&addr, addr_size);
+
+ if (r_sent < 0) {
+ NetError err = _get_socket_error();
+ if (err == ERR_NET_WOULD_BLOCK)
+ return ERR_BUSY;
+
+ return FAILED;
+ }
+
+ return OK;
+}
+
+void NetSocketPosix::set_broadcasting_enabled(bool p_enabled) {
+ ERR_FAIL_COND(!is_open());
+ // IPv6 has no broadcast support.
+ ERR_FAIL_COND(_ip_type == IP::TYPE_IPV6);
+
+ int par = p_enabled ? 1 : 0;
+ if (setsockopt(_sock, SOL_SOCKET, SO_BROADCAST, SOCK_CBUF(&par), sizeof(int)) != 0) {
+ WARN_PRINT("Unable to change broadcast setting");
+ }
+}
+
+void NetSocketPosix::set_blocking_enabled(bool p_enabled) {
+ ERR_FAIL_COND(!is_open());
+
+ int ret = 0;
+#if defined(WINDOWS_ENABLED) || defined(NO_FCNTL)
+ unsigned long par = p_enabled ? 0 : 1;
+ ret = SOCK_IOCTL(_sock, FIONBIO, &par);
+#else
+ int opts = fcntl(_sock, F_GETFL);
+ if (p_enabled)
+ ret = fcntl(_sock, F_SETFL, opts & ~O_NONBLOCK);
+ else
+ ret = fcntl(_sock, F_SETFL, opts | O_NONBLOCK);
+#endif
+
+ if (ret != 0)
+ WARN_PRINT("Unable to change non-block mode");
+}
+
+void NetSocketPosix::set_ipv6_only_enabled(bool p_enabled) {
+ ERR_FAIL_COND(!is_open());
+ // This option is only avaiable in IPv6 sockets.
+ ERR_FAIL_COND(_ip_type == IP::TYPE_IPV4);
+
+ int par = p_enabled ? 1 : 0;
+ if (setsockopt(_sock, IPPROTO_IPV6, IPV6_V6ONLY, SOCK_CBUF(&par), sizeof(int)) != 0) {
+ WARN_PRINT("Unable to change IPv4 address mapping over IPv6 option");
+ }
+}
+
+void NetSocketPosix::set_tcp_no_delay_enabled(bool p_enabled) {
+ ERR_FAIL_COND(!is_open());
+ ERR_FAIL_COND(_ip_type != TYPE_TCP);
+
+ int par = p_enabled ? 1 : 0;
+ if (setsockopt(_sock, IPPROTO_TCP, TCP_NODELAY, SOCK_CBUF(&par), sizeof(int)) < 0) {
+ ERR_PRINT("Unable to set TCP no delay option");
+ }
+}
+
+void NetSocketPosix::set_reuse_address_enabled(bool p_enabled) {
+ ERR_FAIL_COND(!is_open());
+
+ int par = p_enabled ? 1 : 0;
+ if (setsockopt(_sock, SOL_SOCKET, SO_REUSEADDR, SOCK_CBUF(&par), sizeof(int)) < 0) {
+ WARN_PRINT("Unable to set socket REUSEADDR option!");
+ }
+}
+
+void NetSocketPosix::set_reuse_port_enabled(bool p_enabled) {
+// Windows does not have this option, as it is always ON when setting REUSEADDR.
+#ifndef WINDOWS_ENABLED
+ ERR_FAIL_COND(!is_open());
+
+ int par = p_enabled ? 1 : 0;
+ if (setsockopt(_sock, SOL_SOCKET, SO_REUSEPORT, SOCK_CBUF(&par), sizeof(int)) < 0) {
+ WARN_PRINT("Unable to set socket REUSEPORT option!");
+ }
+#endif
+}
+
+bool NetSocketPosix::is_open() const {
+ return _sock != SOCK_EMPTY;
+}
+
+int NetSocketPosix::get_available_bytes() const {
+
+ ERR_FAIL_COND_V(_sock == SOCK_EMPTY, -1);
+
+ unsigned long len;
+ int ret = SOCK_IOCTL(_sock, FIONREAD, &len);
+ ERR_FAIL_COND_V(ret == -1, 0);
+ return len;
+}
+
+Ref<NetSocket> NetSocketPosix::accept(IP_Address &r_ip, uint16_t &r_port) {
+
+ Ref<NetSocket> out;
+ ERR_FAIL_COND_V(!is_open(), out);
+
+ struct sockaddr_storage their_addr;
+ socklen_t size = sizeof(their_addr);
+ SOCKET_TYPE fd = ::accept(_sock, (struct sockaddr *)&their_addr, &size);
+ ERR_FAIL_COND_V(fd == SOCK_EMPTY, out);
+
+ _set_ip_port(r_ip, r_port, &their_addr);
+
+ NetSocketPosix *ns = memnew(NetSocketPosix);
+ ns->_set_socket(fd, _ip_type, _is_stream);
+ ns->set_blocking_enabled(false);
+ return Ref<NetSocket>(ns);
+}
diff --git a/drivers/windows/stream_peer_tcp_winsock.h b/drivers/unix/net_socket_posix.h
index a0177d374e..ee178136f3 100644
--- a/drivers/windows/stream_peer_tcp_winsock.h
+++ b/drivers/unix/net_socket_posix.h
@@ -1,5 +1,5 @@
/*************************************************************************/
-/* stream_peer_tcp_winsock.h */
+/* net_socket_posix.h */
/*************************************************************************/
/* This file is part of: */
/* GODOT ENGINE */
@@ -28,65 +28,70 @@
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
/*************************************************************************/
-#ifdef WINDOWS_ENABLED
+#ifndef NET_SOCKET_UNIX_H
+#define NET_SOCKET_UNIX_H
-#ifndef STREAM_PEER_TCP_WINSOCK_H
-#define STREAM_PEER_TCP_WINSOCK_H
+#include "core/io/net_socket.h"
-#include "error_list.h"
+#if defined(WINDOWS_ENABLED)
+#include <winsock2.h>
+#include <ws2tcpip.h>
+#define SOCKET_TYPE SOCKET
-#include "core/io/ip_address.h"
-#include "core/io/stream_peer_tcp.h"
+#else
+#define SOCKET_TYPE int
-class StreamPeerTCPWinsock : public StreamPeerTCP {
-
-protected:
- mutable Status status;
- IP::Type sock_type;
+#endif
- int sockfd;
+class NetSocketPosix : public NetSocket {
- Error _block(int p_sockfd, bool p_read, bool p_write) const;
+private:
+ SOCKET_TYPE _sock;
+ IP::Type _ip_type;
+ bool _is_stream;
- Error _poll_connection() const;
+ enum NetError {
+ ERR_NET_WOULD_BLOCK,
+ ERR_NET_IS_CONNECTED,
+ ERR_NET_IN_PROGRESS,
+ ERR_NET_OTHER
+ };
- IP_Address peer_host;
- int peer_port;
+ NetError _get_socket_error();
+ void _set_socket(SOCKET_TYPE p_sock, IP::Type p_ip_type, bool p_is_stream);
- Error write(const uint8_t *p_data, int p_bytes, int &r_sent, bool p_block);
- Error read(uint8_t *p_buffer, int p_bytes, int &r_received, bool p_block);
+protected:
+ static NetSocket *_create_func();
- static StreamPeerTCP *_create();
+ bool _can_use_ip(const IP_Address p_ip, const bool p_for_bind) const;
public:
- virtual Error connect_to_host(const IP_Address &p_host, uint16_t p_port);
-
- virtual Error put_data(const uint8_t *p_data, int p_bytes);
- virtual Error put_partial_data(const uint8_t *p_data, int p_bytes, int &r_sent);
-
- virtual Error get_data(uint8_t *p_buffer, int p_bytes);
- virtual Error get_partial_data(uint8_t *p_buffer, int p_bytes, int &r_received);
+ static void make_default();
+ virtual Error open(Type p_sock_type, IP::Type &ip_type);
+ virtual void close();
+ virtual Error bind(IP_Address p_addr, uint16_t p_port);
+ virtual Error listen(int p_max_pending);
+ virtual Error connect_to_host(IP_Address p_addr, uint16_t p_port);
+ virtual Error poll(PollType p_type, int timeout) const;
+ virtual Error recv(uint8_t *p_buffer, int p_len, int &r_read);
+ virtual Error recvfrom(uint8_t *p_buffer, int p_len, int &r_read, IP_Address &r_ip, uint16_t &r_port);
+ virtual Error send(const uint8_t *p_buffer, int p_len, int &r_sent);
+ virtual Error sendto(const uint8_t *p_buffer, int p_len, int &r_sent, IP_Address p_ip, uint16_t p_port);
+ virtual Ref<NetSocket> accept(IP_Address &r_ip, uint16_t &r_port);
+
+ virtual bool is_open() const;
virtual int get_available_bytes() const;
- void set_socket(int p_sockfd, IP_Address p_host, int p_port, IP::Type p_sock_type);
+ virtual void set_broadcasting_enabled(bool p_enabled);
+ virtual void set_blocking_enabled(bool p_enabled);
+ virtual void set_ipv6_only_enabled(bool p_enabled);
+ virtual void set_tcp_no_delay_enabled(bool p_enabled);
+ virtual void set_reuse_address_enabled(bool p_enabled);
+ virtual void set_reuse_port_enabled(bool p_enabled);
- virtual IP_Address get_connected_host() const;
- virtual uint16_t get_connected_port() const;
-
- virtual bool is_connected_to_host() const;
- virtual Status get_status() const;
- virtual void disconnect_from_host();
-
- static void make_default();
- static void cleanup();
-
- virtual void set_no_delay(bool p_enabled);
-
- StreamPeerTCPWinsock();
- ~StreamPeerTCPWinsock();
+ NetSocketPosix();
+ ~NetSocketPosix();
};
-#endif // STREAM_PEER_TCP_WINSOCK_H
-
#endif
diff --git a/drivers/unix/os_unix.cpp b/drivers/unix/os_unix.cpp
index 05dfd69f58..1225d00aad 100644
--- a/drivers/unix/os_unix.cpp
+++ b/drivers/unix/os_unix.cpp
@@ -32,20 +32,16 @@
#ifdef UNIX_ENABLED
-#include "servers/visual_server.h"
-
#include "core/os/thread_dummy.h"
-#include "mutex_posix.h"
-#include "rw_lock_posix.h"
-#include "semaphore_posix.h"
-#include "thread_posix.h"
-
-//#include "core/io/file_access_buffered_fa.h"
-#include "dir_access_unix.h"
-#include "file_access_unix.h"
-#include "packet_peer_udp_posix.h"
-#include "stream_peer_tcp_posix.h"
-#include "tcp_server_posix.h"
+#include "core/project_settings.h"
+#include "drivers/unix/dir_access_unix.h"
+#include "drivers/unix/file_access_unix.h"
+#include "drivers/unix/mutex_posix.h"
+#include "drivers/unix/net_socket_posix.h"
+#include "drivers/unix/rw_lock_posix.h"
+#include "drivers/unix/semaphore_posix.h"
+#include "drivers/unix/thread_posix.h"
+#include "servers/visual_server.h"
#ifdef __APPLE__
#include <mach-o/dyld.h>
@@ -55,7 +51,7 @@
#include <sys/param.h>
#include <sys/sysctl.h>
#endif
-#include "project_settings.h"
+
#include <assert.h>
#include <dlfcn.h>
#include <errno.h>
@@ -126,9 +122,7 @@ void OS_Unix::initialize_core() {
DirAccess::make_default<DirAccessUnix>(DirAccess::ACCESS_FILESYSTEM);
#ifndef NO_NETWORK
- TCPServerPosix::make_default();
- StreamPeerTCPPosix::make_default();
- PacketPeerUDPPosix::make_default();
+ NetSocketPosix::make_default();
IP_Unix::make_default();
#endif
diff --git a/drivers/unix/os_unix.h b/drivers/unix/os_unix.h
index 95b74d23ff..f4abfa2dd4 100644
--- a/drivers/unix/os_unix.h
+++ b/drivers/unix/os_unix.h
@@ -37,8 +37,8 @@
#ifdef UNIX_ENABLED
+#include "core/os/os.h"
#include "drivers/unix/ip_unix.h"
-#include "os/os.h"
class OS_Unix : public OS {
diff --git a/drivers/unix/packet_peer_udp_posix.cpp b/drivers/unix/packet_peer_udp_posix.cpp
deleted file mode 100644
index 1380c1d88b..0000000000
--- a/drivers/unix/packet_peer_udp_posix.cpp
+++ /dev/null
@@ -1,317 +0,0 @@
-/*************************************************************************/
-/* packet_peer_udp_posix.cpp */
-/*************************************************************************/
-/* This file is part of: */
-/* GODOT ENGINE */
-/* https://godotengine.org */
-/*************************************************************************/
-/* Copyright (c) 2007-2018 Juan Linietsky, Ariel Manzur. */
-/* Copyright (c) 2014-2018 Godot Engine contributors (cf. AUTHORS.md) */
-/* */
-/* Permission is hereby granted, free of charge, to any person obtaining */
-/* a copy of this software and associated documentation files (the */
-/* "Software"), to deal in the Software without restriction, including */
-/* without limitation the rights to use, copy, modify, merge, publish, */
-/* distribute, sublicense, and/or sell copies of the Software, and to */
-/* permit persons to whom the Software is furnished to do so, subject to */
-/* the following conditions: */
-/* */
-/* The above copyright notice and this permission notice shall be */
-/* included in all copies or substantial portions of the Software. */
-/* */
-/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */
-/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */
-/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.*/
-/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */
-/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */
-/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */
-/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
-/*************************************************************************/
-
-#include "packet_peer_udp_posix.h"
-
-#ifdef UNIX_ENABLED
-
-#include <errno.h>
-#include <netdb.h>
-#include <sys/socket.h>
-#include <sys/types.h>
-#include <unistd.h>
-
-#include <netinet/in.h>
-#include <stdio.h>
-
-#ifndef NO_FCNTL
-#ifdef __HAIKU__
-#include <fcntl.h>
-#else
-#include <sys/fcntl.h>
-#endif
-#else
-#include <sys/ioctl.h>
-#endif
-
-#ifdef JAVASCRIPT_ENABLED
-#include <arpa/inet.h>
-#endif
-
-#include "drivers/unix/socket_helpers.h"
-
-int PacketPeerUDPPosix::get_available_packet_count() const {
-
- Error err = const_cast<PacketPeerUDPPosix *>(this)->_poll(false);
- if (err != OK)
- return 0;
-
- return queue_count;
-}
-
-Error PacketPeerUDPPosix::get_packet(const uint8_t **r_buffer, int &r_buffer_size) {
-
- Error err = const_cast<PacketPeerUDPPosix *>(this)->_poll(false);
- if (err != OK)
- return err;
- if (queue_count == 0)
- return ERR_UNAVAILABLE;
-
- uint32_t size = 0;
- uint8_t type = IP::TYPE_NONE;
- rb.read(&type, 1, true);
- if (type == IP::TYPE_IPV4) {
- uint8_t ip[4];
- rb.read(ip, 4, true);
- packet_ip.set_ipv4(ip);
- } else {
- uint8_t ipv6[16];
- rb.read(ipv6, 16, true);
- packet_ip.set_ipv6(ipv6);
- };
- rb.read((uint8_t *)&packet_port, 4, true);
- rb.read((uint8_t *)&size, 4, true);
- rb.read(packet_buffer, size, true);
- --queue_count;
- *r_buffer = packet_buffer;
- r_buffer_size = size;
- return OK;
-}
-Error PacketPeerUDPPosix::put_packet(const uint8_t *p_buffer, int p_buffer_size) {
-
- ERR_FAIL_COND_V(!peer_addr.is_valid(), ERR_UNCONFIGURED);
-
- if (sock_type == IP::TYPE_NONE)
- sock_type = peer_addr.is_ipv4() ? IP::TYPE_IPV4 : IP::TYPE_IPV6;
-
- int sock = _get_socket();
- ERR_FAIL_COND_V(sock == -1, FAILED);
- struct sockaddr_storage addr;
- size_t addr_size = _set_sockaddr(&addr, peer_addr, peer_port, sock_type);
-
- errno = 0;
- int err;
-
- _set_sock_blocking(blocking);
-
- while ((err = sendto(sock, p_buffer, p_buffer_size, 0, (struct sockaddr *)&addr, addr_size)) != p_buffer_size) {
-
- if (errno != EAGAIN) {
- return FAILED;
- } else if (!blocking) {
- return ERR_UNAVAILABLE;
- }
- }
-
- return OK;
-}
-
-int PacketPeerUDPPosix::get_max_packet_size() const {
-
- return 512; // uhm maybe not
-}
-
-Error PacketPeerUDPPosix::listen(int p_port, const IP_Address &p_bind_address, int p_recv_buffer_size) {
-
- ERR_FAIL_COND_V(sockfd != -1, ERR_ALREADY_IN_USE);
- ERR_FAIL_COND_V(!p_bind_address.is_valid() && !p_bind_address.is_wildcard(), ERR_INVALID_PARAMETER);
-
-#ifdef __OpenBSD__
- sock_type = IP::TYPE_IPV4; // OpenBSD does not support dual stacking, fallback to IPv4 only.
-#else
- sock_type = IP::TYPE_ANY;
-#endif
-
- if (p_bind_address.is_valid())
- sock_type = p_bind_address.is_ipv4() ? IP::TYPE_IPV4 : IP::TYPE_IPV6;
-
- int sock = _get_socket();
-
- if (sock == -1)
- return ERR_CANT_CREATE;
-
- sockaddr_storage addr = { 0 };
- size_t addr_size = _set_listen_sockaddr(&addr, p_port, sock_type, IP_Address());
-
- if (bind(sock, (struct sockaddr *)&addr, addr_size) == -1) {
- close();
- return ERR_UNAVAILABLE;
- }
- rb.resize(nearest_shift(p_recv_buffer_size));
- return OK;
-}
-
-void PacketPeerUDPPosix::close() {
-
- if (sockfd != -1)
- ::close(sockfd);
- sockfd = -1;
- sock_type = IP::TYPE_NONE;
- rb.resize(16);
- queue_count = 0;
-}
-
-Error PacketPeerUDPPosix::wait() {
-
- return _poll(true);
-}
-
-Error PacketPeerUDPPosix::_poll(bool p_block) {
-
- if (sockfd == -1) {
- return FAILED;
- }
-
- _set_sock_blocking(p_block);
-
- struct sockaddr_storage from = { 0 };
- socklen_t len = sizeof(struct sockaddr_storage);
- int ret;
- while ((ret = recvfrom(sockfd, recv_buffer, MIN((int)sizeof(recv_buffer), MAX(rb.space_left() - 24, 0)), 0, (struct sockaddr *)&from, &len)) > 0) {
-
- uint32_t port = 0;
-
- if (from.ss_family == AF_INET) {
- uint8_t type = (uint8_t)IP::TYPE_IPV4;
- rb.write(&type, 1);
- struct sockaddr_in *sin_from = (struct sockaddr_in *)&from;
- rb.write((uint8_t *)&sin_from->sin_addr, 4);
- port = ntohs(sin_from->sin_port);
-
- } else if (from.ss_family == AF_INET6) {
-
- uint8_t type = (uint8_t)IP::TYPE_IPV6;
- rb.write(&type, 1);
-
- struct sockaddr_in6 *s6_from = (struct sockaddr_in6 *)&from;
- rb.write((uint8_t *)&s6_from->sin6_addr, 16);
-
- port = ntohs(s6_from->sin6_port);
-
- } else {
- // WARN_PRINT("Ignoring packet with unknown address family");
- uint8_t type = (uint8_t)IP::TYPE_NONE;
- rb.write(&type, 1);
- };
-
- rb.write((uint8_t *)&port, 4);
- rb.write((uint8_t *)&ret, 4);
- rb.write(recv_buffer, ret);
-
- len = sizeof(struct sockaddr_storage);
- ++queue_count;
- if (p_block)
- break;
- };
-
- // TODO: Should ECONNRESET be handled here?
- if (ret == 0 || (ret == -1 && errno != EAGAIN)) {
- close();
- return FAILED;
- };
-
- return OK;
-}
-bool PacketPeerUDPPosix::is_listening() const {
-
- return sockfd != -1;
-}
-
-IP_Address PacketPeerUDPPosix::get_packet_address() const {
-
- return packet_ip;
-}
-
-int PacketPeerUDPPosix::get_packet_port() const {
-
- return packet_port;
-}
-
-int PacketPeerUDPPosix::_get_socket() {
-
- ERR_FAIL_COND_V(sock_type == IP::TYPE_NONE, -1);
-
- if (sockfd != -1)
- return sockfd;
-
- sockfd = _socket_create(sock_type, SOCK_DGRAM, IPPROTO_UDP);
-
- if (sockfd != -1)
- _set_sock_blocking(false);
-
- return sockfd;
-}
-
-void PacketPeerUDPPosix::_set_sock_blocking(bool p_blocking) {
-
- if (sock_blocking == p_blocking)
- return;
-
- sock_blocking = p_blocking;
-
-#ifndef NO_FCNTL
- int opts = fcntl(sockfd, F_GETFL);
- int ret = 0;
- if (sock_blocking)
- ret = fcntl(sockfd, F_SETFL, opts & ~O_NONBLOCK);
- else
- ret = fcntl(sockfd, F_SETFL, opts | O_NONBLOCK);
- if (ret == -1)
- perror("setting non-block mode");
-#else
- int bval = sock_blocking ? 0 : 1;
- if (ioctl(sockfd, FIONBIO, &bval) == -1)
- perror("setting non-block mode");
-#endif
-}
-
-void PacketPeerUDPPosix::set_dest_address(const IP_Address &p_address, int p_port) {
-
- peer_addr = p_address;
- peer_port = p_port;
-}
-
-PacketPeerUDP *PacketPeerUDPPosix::_create() {
-
- return memnew(PacketPeerUDPPosix);
-};
-
-void PacketPeerUDPPosix::make_default() {
-
- PacketPeerUDP::_create = PacketPeerUDPPosix::_create;
-};
-
-PacketPeerUDPPosix::PacketPeerUDPPosix() {
-
- blocking = true;
- sock_blocking = true;
- sockfd = -1;
- packet_port = 0;
- queue_count = 0;
- peer_port = 0;
- sock_type = IP::TYPE_NONE;
- rb.resize(16);
-}
-
-PacketPeerUDPPosix::~PacketPeerUDPPosix() {
-
- close();
-}
-#endif
diff --git a/drivers/unix/rw_lock_posix.cpp b/drivers/unix/rw_lock_posix.cpp
index 4df965cabb..27b19c30d5 100644
--- a/drivers/unix/rw_lock_posix.cpp
+++ b/drivers/unix/rw_lock_posix.cpp
@@ -32,8 +32,8 @@
#include "rw_lock_posix.h"
-#include "error_macros.h"
-#include "os/memory.h"
+#include "core/error_macros.h"
+#include "core/os/memory.h"
#include <stdio.h>
void RWLockPosix::read_lock() {
diff --git a/drivers/unix/rw_lock_posix.h b/drivers/unix/rw_lock_posix.h
index 617b9705da..897b617f98 100644
--- a/drivers/unix/rw_lock_posix.h
+++ b/drivers/unix/rw_lock_posix.h
@@ -33,7 +33,7 @@
#if defined(UNIX_ENABLED) || defined(PTHREAD_ENABLED)
-#include "os/rw_lock.h"
+#include "core/os/rw_lock.h"
#include <pthread.h>
class RWLockPosix : public RWLock {
diff --git a/drivers/unix/semaphore_posix.cpp b/drivers/unix/semaphore_posix.cpp
index 5cabfe4937..26c2aeab28 100644
--- a/drivers/unix/semaphore_posix.cpp
+++ b/drivers/unix/semaphore_posix.cpp
@@ -32,7 +32,7 @@
#if defined(UNIX_ENABLED) || defined(PTHREAD_ENABLED)
-#include "os/memory.h"
+#include "core/os/memory.h"
#include <errno.h>
#include <stdio.h>
diff --git a/drivers/unix/semaphore_posix.h b/drivers/unix/semaphore_posix.h
index 283174bb2e..025b87c0d7 100644
--- a/drivers/unix/semaphore_posix.h
+++ b/drivers/unix/semaphore_posix.h
@@ -31,7 +31,7 @@
#ifndef SEMAPHORE_POSIX_H
#define SEMAPHORE_POSIX_H
-#include "os/semaphore.h"
+#include "core/os/semaphore.h"
#if defined(UNIX_ENABLED) || defined(PTHREAD_ENABLED)
diff --git a/drivers/unix/stream_peer_tcp_posix.cpp b/drivers/unix/stream_peer_tcp_posix.cpp
deleted file mode 100644
index 44b9ef1d7c..0000000000
--- a/drivers/unix/stream_peer_tcp_posix.cpp
+++ /dev/null
@@ -1,411 +0,0 @@
-/*************************************************************************/
-/* stream_peer_tcp_posix.cpp */
-/*************************************************************************/
-/* This file is part of: */
-/* GODOT ENGINE */
-/* https://godotengine.org */
-/*************************************************************************/
-/* Copyright (c) 2007-2018 Juan Linietsky, Ariel Manzur. */
-/* Copyright (c) 2014-2018 Godot Engine contributors (cf. AUTHORS.md) */
-/* */
-/* Permission is hereby granted, free of charge, to any person obtaining */
-/* a copy of this software and associated documentation files (the */
-/* "Software"), to deal in the Software without restriction, including */
-/* without limitation the rights to use, copy, modify, merge, publish, */
-/* distribute, sublicense, and/or sell copies of the Software, and to */
-/* permit persons to whom the Software is furnished to do so, subject to */
-/* the following conditions: */
-/* */
-/* The above copyright notice and this permission notice shall be */
-/* included in all copies or substantial portions of the Software. */
-/* */
-/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */
-/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */
-/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.*/
-/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */
-/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */
-/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */
-/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
-/*************************************************************************/
-
-#ifdef UNIX_ENABLED
-
-#include "stream_peer_tcp_posix.h"
-
-#include <errno.h>
-#include <netdb.h>
-#include <poll.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-#include <sys/ioctl.h>
-#include <sys/types.h>
-#include <unistd.h>
-#ifndef NO_FCNTL
-#ifdef __HAIKU__
-#include <fcntl.h>
-#else
-#include <sys/fcntl.h>
-#endif
-#else
-#include <sys/ioctl.h>
-#endif
-#include <netinet/in.h>
-
-#include <sys/socket.h>
-#ifdef JAVASCRIPT_ENABLED
-#include <arpa/inet.h>
-#endif
-
-#include <netinet/tcp.h>
-
-#if defined(OSX_ENABLED) || defined(IPHONE_ENABLED)
-#define MSG_NOSIGNAL SO_NOSIGPIPE
-#endif
-
-#include "drivers/unix/socket_helpers.h"
-
-StreamPeerTCP *StreamPeerTCPPosix::_create() {
-
- return memnew(StreamPeerTCPPosix);
-};
-
-void StreamPeerTCPPosix::make_default() {
-
- StreamPeerTCP::_create = StreamPeerTCPPosix::_create;
-};
-
-Error StreamPeerTCPPosix::_block(int p_sockfd, bool p_read, bool p_write) const {
-
- struct pollfd pfd;
- pfd.fd = p_sockfd;
- pfd.events = 0;
- if (p_read)
- pfd.events |= POLLIN;
- if (p_write)
- pfd.events |= POLLOUT;
- pfd.revents = 0;
-
- int ret = poll(&pfd, 1, -1);
- return ret < 0 ? FAILED : OK;
-};
-
-Error StreamPeerTCPPosix::_poll_connection() const {
-
- ERR_FAIL_COND_V(status != STATUS_CONNECTING || sockfd == -1, FAILED);
-
- struct sockaddr_storage their_addr;
- size_t addr_size = _set_sockaddr(&their_addr, peer_host, peer_port, sock_type);
-
- if (::connect(sockfd, (struct sockaddr *)&their_addr, addr_size) == -1) {
-
- if (errno == EISCONN) {
- status = STATUS_CONNECTED;
- return OK;
- };
-
- if (errno == EINPROGRESS || errno == EALREADY) {
- return OK;
- }
-
- status = STATUS_ERROR;
- return ERR_CONNECTION_ERROR;
- } else {
-
- status = STATUS_CONNECTED;
- return OK;
- };
-
- return OK;
-};
-
-void StreamPeerTCPPosix::set_socket(int p_sockfd, IP_Address p_host, int p_port, IP::Type p_sock_type) {
-
- sock_type = p_sock_type;
- sockfd = p_sockfd;
-#ifndef NO_FCNTL
- if (fcntl(sockfd, F_SETFL, O_NONBLOCK) < 0) {
- WARN_PRINT("Error setting socket as non blocking");
- }
-#else
- int bval = 1;
- if (ioctl(sockfd, FIONBIO, &bval) < 0) {
- WARN_PRINT("Error setting socket as non blocking");
- }
-#endif
- status = STATUS_CONNECTING;
-
- peer_host = p_host;
- peer_port = p_port;
-};
-
-Error StreamPeerTCPPosix::connect_to_host(const IP_Address &p_host, uint16_t p_port) {
-
- ERR_FAIL_COND_V(!p_host.is_valid(), ERR_INVALID_PARAMETER);
-
- sock_type = p_host.is_ipv4() ? IP::TYPE_IPV4 : IP::TYPE_IPV6;
- sockfd = _socket_create(sock_type, SOCK_STREAM, IPPROTO_TCP);
- if (sockfd == -1) {
- ERR_PRINT("Socket creation failed!");
- disconnect_from_host();
- //perror("socket");
- return FAILED;
- };
-
-#ifndef NO_FCNTL
- if (fcntl(sockfd, F_SETFL, O_NONBLOCK) < 0) {
- WARN_PRINT("Error setting socket as non blocking");
- }
-#else
- int bval = 1;
- if (ioctl(sockfd, FIONBIO, &bval) < 0) {
- WARN_PRINT("Error setting socket as non blocking");
- }
-#endif
-
- struct sockaddr_storage their_addr;
- size_t addr_size = _set_sockaddr(&their_addr, p_host, p_port, sock_type);
-
- errno = 0;
- if (::connect(sockfd, (struct sockaddr *)&their_addr, addr_size) == -1 && errno != EINPROGRESS) {
-
- ERR_PRINT("Connection to remote host failed!");
- disconnect_from_host();
- return FAILED;
- };
-
- if (errno == EINPROGRESS) {
- status = STATUS_CONNECTING;
- } else {
- status = STATUS_CONNECTED;
- };
-
- peer_host = p_host;
- peer_port = p_port;
-
- return OK;
-};
-
-Error StreamPeerTCPPosix::write(const uint8_t *p_data, int p_bytes, int &r_sent, bool p_block) {
-
- if (status == STATUS_NONE || status == STATUS_ERROR) {
-
- return FAILED;
- };
-
- if (status != STATUS_CONNECTED) {
-
- if (_poll_connection() != OK) {
-
- return FAILED;
- };
-
- if (status != STATUS_CONNECTED) {
- r_sent = 0;
- return OK;
- };
- };
-
- int data_to_send = p_bytes;
- const uint8_t *offset = p_data;
- if (sockfd == -1) return FAILED;
- errno = 0;
- int total_sent = 0;
-
- while (data_to_send) {
-
- int sent_amount = send(sockfd, offset, data_to_send, MSG_NOSIGNAL);
- //printf("Sent TCP data of %d bytes, errno %d\n", sent_amount, errno);
-
- if (sent_amount == -1) {
-
- if (errno != EAGAIN) {
-
- perror("Nothing sent");
- disconnect_from_host();
- ERR_PRINT("Server disconnected!\n");
- return FAILED;
- };
-
- if (!p_block) {
- r_sent = total_sent;
- return OK;
- };
-
- _block(sockfd, false, true);
- } else {
-
- data_to_send -= sent_amount;
- offset += sent_amount;
- total_sent += sent_amount;
- };
- }
-
- r_sent = total_sent;
-
- return OK;
-};
-
-Error StreamPeerTCPPosix::read(uint8_t *p_buffer, int p_bytes, int &r_received, bool p_block) {
-
- if (!is_connected_to_host()) {
-
- return FAILED;
- };
-
- if (status == STATUS_CONNECTING) {
-
- if (_poll_connection() != OK) {
-
- return FAILED;
- };
-
- if (status != STATUS_CONNECTED) {
- r_received = 0;
- return OK;
- };
- };
-
- int to_read = p_bytes;
- int total_read = 0;
- errno = 0;
-
- while (to_read) {
-
- int read = recv(sockfd, p_buffer + total_read, to_read, 0);
-
- if (read == -1) {
-
- if (errno != EAGAIN) {
-
- perror("Nothing read");
- disconnect_from_host();
- ERR_PRINT("Server disconnected!\n");
- return FAILED;
- };
-
- if (!p_block) {
-
- r_received = total_read;
- return OK;
- };
- _block(sockfd, true, false);
-
- } else if (read == 0) {
-
- sockfd = -1;
- status = STATUS_NONE;
- peer_port = 0;
- peer_host = IP_Address();
- r_received = total_read;
- return ERR_FILE_EOF;
-
- } else {
-
- to_read -= read;
- total_read += read;
- };
- };
-
- r_received = total_read;
-
- return OK;
-};
-
-void StreamPeerTCPPosix::set_no_delay(bool p_enabled) {
-
- ERR_FAIL_COND(!is_connected_to_host());
- int flag = p_enabled ? 1 : 0;
- if (setsockopt(sockfd, IPPROTO_TCP, TCP_NODELAY, (char *)&flag, sizeof(int)) < 0) {
- ERR_PRINT("Unable to set TCP no delay option");
- }
-}
-
-bool StreamPeerTCPPosix::is_connected_to_host() const {
-
- if (status == STATUS_NONE || status == STATUS_ERROR) {
-
- return false;
- };
- if (status != STATUS_CONNECTED) {
- return true;
- };
-
- return (sockfd != -1);
-};
-
-StreamPeerTCP::Status StreamPeerTCPPosix::get_status() const {
-
- if (status == STATUS_CONNECTING) {
- _poll_connection();
- };
-
- return status;
-};
-
-void StreamPeerTCPPosix::disconnect_from_host() {
-
- if (sockfd != -1)
- close(sockfd);
-
- sock_type = IP::TYPE_NONE;
- sockfd = -1;
-
- status = STATUS_NONE;
- peer_port = 0;
- peer_host = IP_Address();
-};
-
-Error StreamPeerTCPPosix::put_data(const uint8_t *p_data, int p_bytes) {
-
- int total;
- return write(p_data, p_bytes, total, true);
-};
-
-Error StreamPeerTCPPosix::put_partial_data(const uint8_t *p_data, int p_bytes, int &r_sent) {
-
- return write(p_data, p_bytes, r_sent, false);
-};
-
-Error StreamPeerTCPPosix::get_data(uint8_t *p_buffer, int p_bytes) {
-
- int total;
- return read(p_buffer, p_bytes, total, true);
-};
-
-Error StreamPeerTCPPosix::get_partial_data(uint8_t *p_buffer, int p_bytes, int &r_received) {
-
- return read(p_buffer, p_bytes, r_received, false);
-};
-
-int StreamPeerTCPPosix::get_available_bytes() const {
-
- unsigned long len;
- int ret = ioctl(sockfd, FIONREAD, &len);
- ERR_FAIL_COND_V(ret == -1, 0)
- return len;
-}
-IP_Address StreamPeerTCPPosix::get_connected_host() const {
-
- return peer_host;
-};
-
-uint16_t StreamPeerTCPPosix::get_connected_port() const {
-
- return peer_port;
-};
-
-StreamPeerTCPPosix::StreamPeerTCPPosix() {
-
- sock_type = IP::TYPE_NONE;
- sockfd = -1;
- status = STATUS_NONE;
- peer_port = 0;
-};
-
-StreamPeerTCPPosix::~StreamPeerTCPPosix() {
-
- disconnect_from_host();
-};
-
-#endif
diff --git a/drivers/unix/syslog_logger.cpp b/drivers/unix/syslog_logger.cpp
index 727672458c..c7b4daf4ad 100644
--- a/drivers/unix/syslog_logger.cpp
+++ b/drivers/unix/syslog_logger.cpp
@@ -31,7 +31,7 @@
#ifdef UNIX_ENABLED
#include "syslog_logger.h"
-#include "print_string.h"
+#include "core/print_string.h"
#include <syslog.h>
void SyslogLogger::logv(const char *p_format, va_list p_list, bool p_err) {
diff --git a/drivers/unix/syslog_logger.h b/drivers/unix/syslog_logger.h
index 40bf26cee1..745264ab6f 100644
--- a/drivers/unix/syslog_logger.h
+++ b/drivers/unix/syslog_logger.h
@@ -33,7 +33,7 @@
#ifdef UNIX_ENABLED
-#include "io/logger.h"
+#include "core/io/logger.h"
class SyslogLogger : public Logger {
public:
@@ -45,4 +45,4 @@ public:
#endif
-#endif \ No newline at end of file
+#endif
diff --git a/drivers/unix/tcp_server_posix.cpp b/drivers/unix/tcp_server_posix.cpp
deleted file mode 100644
index 67ab981f46..0000000000
--- a/drivers/unix/tcp_server_posix.cpp
+++ /dev/null
@@ -1,207 +0,0 @@
-/*************************************************************************/
-/* tcp_server_posix.cpp */
-/*************************************************************************/
-/* This file is part of: */
-/* GODOT ENGINE */
-/* https://godotengine.org */
-/*************************************************************************/
-/* Copyright (c) 2007-2018 Juan Linietsky, Ariel Manzur. */
-/* Copyright (c) 2014-2018 Godot Engine contributors (cf. AUTHORS.md) */
-/* */
-/* Permission is hereby granted, free of charge, to any person obtaining */
-/* a copy of this software and associated documentation files (the */
-/* "Software"), to deal in the Software without restriction, including */
-/* without limitation the rights to use, copy, modify, merge, publish, */
-/* distribute, sublicense, and/or sell copies of the Software, and to */
-/* permit persons to whom the Software is furnished to do so, subject to */
-/* the following conditions: */
-/* */
-/* The above copyright notice and this permission notice shall be */
-/* included in all copies or substantial portions of the Software. */
-/* */
-/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */
-/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */
-/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.*/
-/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */
-/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */
-/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */
-/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
-/*************************************************************************/
-
-#include "tcp_server_posix.h"
-#include "stream_peer_tcp_posix.h"
-
-#ifdef UNIX_ENABLED
-
-#include <poll.h>
-
-#include <errno.h>
-#include <netdb.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-#include <sys/types.h>
-#include <unistd.h>
-#ifndef NO_FCNTL
-#ifdef __HAIKU__
-#include <fcntl.h>
-#else
-#include <sys/fcntl.h>
-#endif
-#else
-#include <sys/ioctl.h>
-#endif
-#ifdef JAVASCRIPT_ENABLED
-#include <arpa/inet.h>
-#endif
-#include <assert.h>
-#include <netinet/in.h>
-#include <sys/socket.h>
-
-#include "drivers/unix/socket_helpers.h"
-
-TCP_Server *TCPServerPosix::_create() {
-
- return memnew(TCPServerPosix);
-};
-
-void TCPServerPosix::make_default() {
-
- TCP_Server::_create = TCPServerPosix::_create;
-};
-
-Error TCPServerPosix::listen(uint16_t p_port, const IP_Address &p_bind_address) {
-
- ERR_FAIL_COND_V(listen_sockfd != -1, ERR_ALREADY_IN_USE);
- ERR_FAIL_COND_V(!p_bind_address.is_valid() && !p_bind_address.is_wildcard(), ERR_INVALID_PARAMETER);
-
- int sockfd;
-#ifdef __OpenBSD__
- sock_type = IP::TYPE_IPV4; // OpenBSD does not support dual stacking, fallback to IPv4 only.
-#else
- sock_type = IP::TYPE_ANY;
-#endif
-
- // If the bind address is valid use its type as the socket type
- if (p_bind_address.is_valid())
- sock_type = p_bind_address.is_ipv4() ? IP::TYPE_IPV4 : IP::TYPE_IPV6;
-
- sockfd = _socket_create(sock_type, SOCK_STREAM, IPPROTO_TCP);
-
- ERR_FAIL_COND_V(sockfd == -1, FAILED);
-
-#ifndef NO_FCNTL
- if (fcntl(sockfd, F_SETFL, O_NONBLOCK) < 0) {
- WARN_PRINT("Error setting socket as non blocking");
- }
-#else
- int bval = 1;
- if (ioctl(sockfd, FIONBIO, &bval) < 0) {
- WARN_PRINT("Error setting socket as non blocking");
- }
-#endif
-
- int reuse = 1;
- if (setsockopt(sockfd, SOL_SOCKET, SO_REUSEADDR, (char *)&reuse, sizeof(reuse)) < 0) {
- WARN_PRINT("REUSEADDR failed!")
- }
-
- struct sockaddr_storage addr;
- size_t addr_size = _set_listen_sockaddr(&addr, p_port, sock_type, p_bind_address);
-
- if (bind(sockfd, (struct sockaddr *)&addr, addr_size) != -1) {
-
- if (::listen(sockfd, 1) == -1) {
-
- close(sockfd);
- ERR_FAIL_V(FAILED);
- };
- } else {
- close(sockfd);
- return ERR_ALREADY_IN_USE;
- };
-
- if (listen_sockfd != -1) {
- stop();
- };
-
- listen_sockfd = sockfd;
-
- return OK;
-};
-
-bool TCPServerPosix::is_connection_available() const {
-
- if (listen_sockfd == -1) {
- return false;
- };
-
- struct pollfd pfd;
- pfd.fd = listen_sockfd;
- pfd.events = POLLIN;
- pfd.revents = 0;
-
- int ret = poll(&pfd, 1, 0);
- ERR_FAIL_COND_V(ret < 0, FAILED);
-
- if (ret && (pfd.revents & POLLIN)) {
- return true;
- };
-
- return false;
-};
-
-Ref<StreamPeerTCP> TCPServerPosix::take_connection() {
-
- if (!is_connection_available()) {
- return Ref<StreamPeerTCP>();
- };
-
- struct sockaddr_storage their_addr;
- socklen_t size = sizeof(their_addr);
- int fd = accept(listen_sockfd, (struct sockaddr *)&their_addr, &size);
- ERR_FAIL_COND_V(fd == -1, Ref<StreamPeerTCP>());
-#ifndef NO_FCNTL
- if (fcntl(fd, F_SETFL, O_NONBLOCK) < 0) {
- WARN_PRINT("Error setting socket as non blocking");
- }
-#else
- int bval = 1;
- if (ioctl(fd, FIONBIO, &bval) < 0) {
- WARN_PRINT("Error setting socket as non blocking");
- }
-#endif
-
- Ref<StreamPeerTCPPosix> conn = memnew(StreamPeerTCPPosix);
- IP_Address ip;
-
- int port = 0;
- _set_ip_addr_port(ip, port, &their_addr);
-
- conn->set_socket(fd, ip, port, sock_type);
-
- return conn;
-};
-
-void TCPServerPosix::stop() {
-
- if (listen_sockfd != -1) {
- int ret = close(listen_sockfd);
- ERR_FAIL_COND(ret != 0);
- };
-
- listen_sockfd = -1;
- sock_type = IP::TYPE_NONE;
-};
-
-TCPServerPosix::TCPServerPosix() {
-
- listen_sockfd = -1;
- sock_type = IP::TYPE_NONE;
-};
-
-TCPServerPosix::~TCPServerPosix() {
-
- stop();
-};
-#endif
diff --git a/drivers/unix/thread_posix.cpp b/drivers/unix/thread_posix.cpp
index a73b40a6f2..fcefe0a3b3 100644
--- a/drivers/unix/thread_posix.cpp
+++ b/drivers/unix/thread_posix.cpp
@@ -29,7 +29,7 @@
/*************************************************************************/
#include "thread_posix.h"
-#include "script_language.h"
+#include "core/script_language.h"
#if (defined(UNIX_ENABLED) || defined(PTHREAD_ENABLED)) && !defined(NO_THREADS)
@@ -37,8 +37,8 @@
#include <pthread_np.h>
#endif
+#include "core/os/memory.h"
#include "core/safe_refcount.h"
-#include "os/memory.h"
static pthread_key_t _create_thread_id_key() {
pthread_key_t key;
diff --git a/drivers/unix/thread_posix.h b/drivers/unix/thread_posix.h
index ea2de61bd5..20d103232e 100644
--- a/drivers/unix/thread_posix.h
+++ b/drivers/unix/thread_posix.h
@@ -37,7 +37,7 @@
#if (defined(UNIX_ENABLED) || defined(PTHREAD_ENABLED)) && !defined(NO_THREADS)
-#include "os/thread.h"
+#include "core/os/thread.h"
#include <pthread.h>
#include <sys/types.h>
diff --git a/drivers/wasapi/audio_driver_wasapi.cpp b/drivers/wasapi/audio_driver_wasapi.cpp
index 11abe3256e..3d4979175b 100644
--- a/drivers/wasapi/audio_driver_wasapi.cpp
+++ b/drivers/wasapi/audio_driver_wasapi.cpp
@@ -32,8 +32,8 @@
#include "audio_driver_wasapi.h"
-#include "os/os.h"
-#include "project_settings.h"
+#include "core/os/os.h"
+#include "core/project_settings.h"
#include <functiondiscoverykeys.h>
@@ -65,7 +65,6 @@ const IID IID_IAudioCaptureClient = __uuidof(IAudioCaptureClient);
#define CAPTURE_BUFFER_CHANNELS 2
-static StringName capture_device_id;
static bool default_render_device_changed = false;
static bool default_capture_device_changed = false;
@@ -128,7 +127,6 @@ public:
default_render_device_changed = true;
} else if (flow == eCapture) {
default_capture_device_changed = true;
- capture_device_id = String(pwstrDeviceId);
}
}
@@ -659,6 +657,9 @@ void AudioDriverWASAPI::thread_func(void *p_udata) {
if (err == OK) {
ad->start();
}
+
+ avail_frames = 0;
+ write_ofs = 0;
}
if (ad->audio_input.active) {
diff --git a/drivers/windows/dir_access_windows.cpp b/drivers/windows/dir_access_windows.cpp
index cf4d82fb07..589e9e0870 100644
--- a/drivers/windows/dir_access_windows.cpp
+++ b/drivers/windows/dir_access_windows.cpp
@@ -32,9 +32,9 @@
#include "dir_access_windows.h"
-#include "os/memory.h"
+#include "core/os/memory.h"
+#include "core/print_string.h"
-#include "print_string.h"
#include <stdio.h>
#include <wchar.h>
#include <windows.h>
diff --git a/drivers/windows/dir_access_windows.h b/drivers/windows/dir_access_windows.h
index b18c8f5b5d..9f5d0b6d93 100644
--- a/drivers/windows/dir_access_windows.h
+++ b/drivers/windows/dir_access_windows.h
@@ -33,7 +33,7 @@
#ifdef WINDOWS_ENABLED
-#include "os/dir_access.h"
+#include "core/os/dir_access.h"
/**
@author Juan Linietsky <reduz@gmail.com>
diff --git a/drivers/windows/file_access_windows.h b/drivers/windows/file_access_windows.h
index 0462c1e942..6f985e68b4 100644
--- a/drivers/windows/file_access_windows.h
+++ b/drivers/windows/file_access_windows.h
@@ -33,13 +33,15 @@
#ifdef WINDOWS_ENABLED
-#include "os/file_access.h"
-#include "os/memory.h"
+#include "core/os/file_access.h"
+#include "core/os/memory.h"
+
#include <stdio.h>
/**
@author Juan Linietsky <reduzio@gmail.com>
*/
+
class FileAccessWindows : public FileAccess {
FILE *f;
diff --git a/drivers/windows/mutex_windows.cpp b/drivers/windows/mutex_windows.cpp
index 359a79209c..9fc6485be3 100644
--- a/drivers/windows/mutex_windows.cpp
+++ b/drivers/windows/mutex_windows.cpp
@@ -29,7 +29,8 @@
/*************************************************************************/
#include "mutex_windows.h"
-#include "os/memory.h"
+
+#include "core/os/memory.h"
#ifdef WINDOWS_ENABLED
diff --git a/drivers/windows/mutex_windows.h b/drivers/windows/mutex_windows.h
index 4dff2c2456..5c3a8eb331 100644
--- a/drivers/windows/mutex_windows.h
+++ b/drivers/windows/mutex_windows.h
@@ -33,11 +33,14 @@
#ifdef WINDOWS_ENABLED
-#include "os/mutex.h"
+#include "core/os/mutex.h"
+
#include <windows.h>
+
/**
@author Juan Linietsky <reduzio@gmail.com>
*/
+
class MutexWindows : public Mutex {
#ifdef WINDOWS_USE_MUTEX
diff --git a/drivers/windows/packet_peer_udp_winsock.cpp b/drivers/windows/packet_peer_udp_winsock.cpp
deleted file mode 100644
index 609096d02e..0000000000
--- a/drivers/windows/packet_peer_udp_winsock.cpp
+++ /dev/null
@@ -1,298 +0,0 @@
-/*************************************************************************/
-/* packet_peer_udp_winsock.cpp */
-/*************************************************************************/
-/* This file is part of: */
-/* GODOT ENGINE */
-/* https://godotengine.org */
-/*************************************************************************/
-/* Copyright (c) 2007-2018 Juan Linietsky, Ariel Manzur. */
-/* Copyright (c) 2014-2018 Godot Engine contributors (cf. AUTHORS.md) */
-/* */
-/* Permission is hereby granted, free of charge, to any person obtaining */
-/* a copy of this software and associated documentation files (the */
-/* "Software"), to deal in the Software without restriction, including */
-/* without limitation the rights to use, copy, modify, merge, publish, */
-/* distribute, sublicense, and/or sell copies of the Software, and to */
-/* permit persons to whom the Software is furnished to do so, subject to */
-/* the following conditions: */
-/* */
-/* The above copyright notice and this permission notice shall be */
-/* included in all copies or substantial portions of the Software. */
-/* */
-/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */
-/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */
-/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.*/
-/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */
-/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */
-/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */
-/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
-/*************************************************************************/
-
-#ifdef WINDOWS_ENABLED
-
-#include "packet_peer_udp_winsock.h"
-
-#include <winsock2.h>
-#include <ws2tcpip.h>
-
-#include "drivers/unix/socket_helpers.h"
-
-int PacketPeerUDPWinsock::get_available_packet_count() const {
-
- Error err = const_cast<PacketPeerUDPWinsock *>(this)->_poll(false);
- if (err != OK)
- return 0;
-
- return queue_count;
-}
-
-Error PacketPeerUDPWinsock::get_packet(const uint8_t **r_buffer, int &r_buffer_size) {
-
- Error err = const_cast<PacketPeerUDPWinsock *>(this)->_poll(false);
- if (err != OK)
- return err;
- if (queue_count == 0)
- return ERR_UNAVAILABLE;
-
- uint32_t size;
- uint8_t type;
- rb.read(&type, 1, true);
- if (type == IP::TYPE_IPV4) {
- uint8_t ip[4];
- rb.read(ip, 4, true);
- packet_ip.set_ipv4(ip);
- } else {
- uint8_t ip[16];
- rb.read(ip, 16, true);
- packet_ip.set_ipv6(ip);
- };
- rb.read((uint8_t *)&packet_port, 4, true);
- rb.read((uint8_t *)&size, 4, true);
- rb.read(packet_buffer, size, true);
- --queue_count;
- *r_buffer = packet_buffer;
- r_buffer_size = size;
- return OK;
-}
-Error PacketPeerUDPWinsock::put_packet(const uint8_t *p_buffer, int p_buffer_size) {
-
- ERR_FAIL_COND_V(!peer_addr.is_valid(), ERR_UNCONFIGURED);
-
- if (sock_type == IP::TYPE_NONE)
- sock_type = peer_addr.is_ipv4() ? IP::TYPE_IPV4 : IP::TYPE_IPV6;
-
- int sock = _get_socket();
- ERR_FAIL_COND_V(sock == -1, FAILED);
- struct sockaddr_storage addr;
- size_t addr_size = _set_sockaddr(&addr, peer_addr, peer_port, sock_type);
-
- _set_sock_blocking(blocking);
-
- errno = 0;
- int err;
- while ((err = sendto(sock, (const char *)p_buffer, p_buffer_size, 0, (struct sockaddr *)&addr, addr_size)) != p_buffer_size) {
-
- if (WSAGetLastError() != WSAEWOULDBLOCK) {
- return FAILED;
- } else if (!blocking) {
- return ERR_UNAVAILABLE;
- }
- }
-
- return OK;
-}
-
-int PacketPeerUDPWinsock::get_max_packet_size() const {
-
- return 512; // uhm maybe not
-}
-
-void PacketPeerUDPWinsock::_set_sock_blocking(bool p_blocking) {
-
- if (sock_blocking == p_blocking)
- return;
-
- sock_blocking = p_blocking;
- unsigned long par = sock_blocking ? 0 : 1;
- if (ioctlsocket(sockfd, FIONBIO, &par)) {
- perror("setting non-block mode");
- //close();
- //return -1;
- };
-}
-
-Error PacketPeerUDPWinsock::listen(int p_port, const IP_Address &p_bind_address, int p_recv_buffer_size) {
-
- ERR_FAIL_COND_V(sockfd != -1, ERR_ALREADY_IN_USE);
- ERR_FAIL_COND_V(!p_bind_address.is_valid() && !p_bind_address.is_wildcard(), ERR_INVALID_PARAMETER);
-
- sock_type = IP::TYPE_ANY;
-
- if (p_bind_address.is_valid())
- sock_type = p_bind_address.is_ipv4() ? IP::TYPE_IPV4 : IP::TYPE_IPV6;
-
- int sock = _get_socket();
- if (sock == -1)
- return ERR_CANT_CREATE;
-
- struct sockaddr_storage addr = { 0 };
- size_t addr_size = _set_listen_sockaddr(&addr, p_port, sock_type, IP_Address());
-
- if (bind(sock, (struct sockaddr *)&addr, addr_size) == -1) {
- close();
- return ERR_UNAVAILABLE;
- }
-
- printf("UDP Connection listening on port %i\n", p_port);
- rb.resize(nearest_shift(p_recv_buffer_size));
- return OK;
-}
-
-void PacketPeerUDPWinsock::close() {
-
- if (sockfd != -1)
- ::closesocket(sockfd);
- sockfd = -1;
- sock_type = IP::TYPE_NONE;
- rb.resize(16);
- queue_count = 0;
-}
-
-Error PacketPeerUDPWinsock::wait() {
-
- return _poll(true);
-}
-Error PacketPeerUDPWinsock::_poll(bool p_wait) {
-
- if (sockfd == -1) {
- return FAILED;
- }
-
- _set_sock_blocking(p_wait);
-
- struct sockaddr_storage from = { 0 };
- int len = sizeof(struct sockaddr_storage);
- int ret;
- while ((ret = recvfrom(sockfd, (char *)recv_buffer, MIN((int)sizeof(recv_buffer), MAX(rb.space_left() - 24, 0)), 0, (struct sockaddr *)&from, &len)) > 0) {
-
- uint32_t port = 0;
-
- if (from.ss_family == AF_INET) {
- uint8_t type = (uint8_t)IP::TYPE_IPV4;
- rb.write(&type, 1);
- struct sockaddr_in *sin_from = (struct sockaddr_in *)&from;
- rb.write((uint8_t *)&sin_from->sin_addr, 4);
- port = ntohs(sin_from->sin_port);
-
- } else if (from.ss_family == AF_INET6) {
-
- uint8_t type = (uint8_t)IP::TYPE_IPV6;
- rb.write(&type, 1);
-
- struct sockaddr_in6 *s6_from = (struct sockaddr_in6 *)&from;
- rb.write((uint8_t *)&s6_from->sin6_addr, 16);
-
- port = ntohs(s6_from->sin6_port);
-
- } else {
- // WARN_PRINT("Ignoring packet with unknown address family");
- uint8_t type = (uint8_t)IP::TYPE_NONE;
- rb.write(&type, 1);
- };
-
- rb.write((uint8_t *)&port, 4);
- rb.write((uint8_t *)&ret, 4);
- rb.write(recv_buffer, ret);
-
- len = sizeof(struct sockaddr_storage);
- ++queue_count;
- if (p_wait)
- break;
- };
-
- if (ret == SOCKET_ERROR) {
- int error = WSAGetLastError();
-
- if (error == WSAEWOULDBLOCK) {
- // Expected when doing non-blocking sockets, retry later.
- } else if (error == WSAECONNRESET) {
- // If the remote target does not accept messages, this error may occur, but is harmless.
- // Once the remote target gets available, this message will disappear for new messages.
- } else {
- close();
- return FAILED;
- }
- }
-
- if (ret == 0) {
- close();
- return FAILED;
- };
-
- return OK;
-}
-
-bool PacketPeerUDPWinsock::is_listening() const {
-
- return sockfd != -1;
-}
-
-IP_Address PacketPeerUDPWinsock::get_packet_address() const {
-
- return packet_ip;
-}
-
-int PacketPeerUDPWinsock::get_packet_port() const {
-
- return packet_port;
-}
-
-int PacketPeerUDPWinsock::_get_socket() {
-
- ERR_FAIL_COND_V(sock_type == IP::TYPE_NONE, -1);
-
- if (sockfd != -1)
- return sockfd;
-
- sockfd = _socket_create(sock_type, SOCK_DGRAM, IPPROTO_UDP);
-
- if (sockfd != -1)
- _set_sock_blocking(false);
-
- return sockfd;
-}
-
-void PacketPeerUDPWinsock::set_dest_address(const IP_Address &p_address, int p_port) {
-
- peer_addr = p_address;
- peer_port = p_port;
-}
-
-void PacketPeerUDPWinsock::make_default() {
-
- PacketPeerUDP::_create = PacketPeerUDPWinsock::_create;
-};
-
-PacketPeerUDP *PacketPeerUDPWinsock::_create() {
-
- return memnew(PacketPeerUDPWinsock);
-};
-
-PacketPeerUDPWinsock::PacketPeerUDPWinsock() {
-
- blocking = true;
- sock_blocking = true;
- sockfd = -1;
- packet_port = 0;
- queue_count = 0;
- peer_port = 0;
- sock_type = IP::TYPE_NONE;
- rb.resize(16);
-}
-
-PacketPeerUDPWinsock::~PacketPeerUDPWinsock() {
-
- close();
-}
-
-#endif
diff --git a/drivers/windows/rw_lock_windows.cpp b/drivers/windows/rw_lock_windows.cpp
index 29c24d3d02..ef00141928 100644
--- a/drivers/windows/rw_lock_windows.cpp
+++ b/drivers/windows/rw_lock_windows.cpp
@@ -32,8 +32,9 @@
#include "rw_lock_windows.h"
-#include "error_macros.h"
-#include "os/memory.h"
+#include "core/error_macros.h"
+#include "core/os/memory.h"
+
#include <stdio.h>
void RWLockWindows::read_lock() {
diff --git a/drivers/windows/rw_lock_windows.h b/drivers/windows/rw_lock_windows.h
index fdce28574a..742a0930d4 100644
--- a/drivers/windows/rw_lock_windows.h
+++ b/drivers/windows/rw_lock_windows.h
@@ -33,7 +33,8 @@
#if defined(WINDOWS_ENABLED)
-#include "os/rw_lock.h"
+#include "core/os/rw_lock.h"
+
#include <windows.h>
class RWLockWindows : public RWLock {
diff --git a/drivers/windows/semaphore_windows.cpp b/drivers/windows/semaphore_windows.cpp
index 25fced93ce..34dd387705 100644
--- a/drivers/windows/semaphore_windows.cpp
+++ b/drivers/windows/semaphore_windows.cpp
@@ -32,7 +32,7 @@
#if defined(WINDOWS_ENABLED)
-#include "os/memory.h"
+#include "core/os/memory.h"
Error SemaphoreWindows::wait() {
diff --git a/drivers/windows/semaphore_windows.h b/drivers/windows/semaphore_windows.h
index e099ee437a..1e2f9c152e 100644
--- a/drivers/windows/semaphore_windows.h
+++ b/drivers/windows/semaphore_windows.h
@@ -31,14 +31,16 @@
#ifndef SEMAPHORE_WINDOWS_H
#define SEMAPHORE_WINDOWS_H
-#include "os/semaphore.h"
+#include "core/os/semaphore.h"
#ifdef WINDOWS_ENABLED
#include <windows.h>
+
/**
@author Juan Linietsky <reduzio@gmail.com>
*/
+
class SemaphoreWindows : public Semaphore {
mutable HANDLE semaphore;
diff --git a/drivers/windows/shell_windows.h b/drivers/windows/shell_windows.h
index 41cc6b72a2..98972a9bb1 100644
--- a/drivers/windows/shell_windows.h
+++ b/drivers/windows/shell_windows.h
@@ -31,12 +31,14 @@
#ifndef SHELL_WINDOWS_H
#define SHELL_WINDOWS_H
-#include "os/shell.h"
+#include "core/os/shell.h"
#ifdef WINDOWS_ENABLED
+
/**
@author Juan Linietsky <reduzio@gmail.com>
*/
+
class ShellWindows : public Shell {
public:
virtual void execute(String p_path);
diff --git a/drivers/windows/stream_peer_tcp_winsock.cpp b/drivers/windows/stream_peer_tcp_winsock.cpp
deleted file mode 100644
index 19c937170b..0000000000
--- a/drivers/windows/stream_peer_tcp_winsock.cpp
+++ /dev/null
@@ -1,375 +0,0 @@
-/*************************************************************************/
-/* stream_peer_tcp_winsock.cpp */
-/*************************************************************************/
-/* This file is part of: */
-/* GODOT ENGINE */
-/* https://godotengine.org */
-/*************************************************************************/
-/* Copyright (c) 2007-2018 Juan Linietsky, Ariel Manzur. */
-/* Copyright (c) 2014-2018 Godot Engine contributors (cf. AUTHORS.md) */
-/* */
-/* Permission is hereby granted, free of charge, to any person obtaining */
-/* a copy of this software and associated documentation files (the */
-/* "Software"), to deal in the Software without restriction, including */
-/* without limitation the rights to use, copy, modify, merge, publish, */
-/* distribute, sublicense, and/or sell copies of the Software, and to */
-/* permit persons to whom the Software is furnished to do so, subject to */
-/* the following conditions: */
-/* */
-/* The above copyright notice and this permission notice shall be */
-/* included in all copies or substantial portions of the Software. */
-/* */
-/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */
-/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */
-/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.*/
-/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */
-/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */
-/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */
-/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
-/*************************************************************************/
-
-#ifdef WINDOWS_ENABLED
-
-#include "stream_peer_tcp_winsock.h"
-
-#include <winsock2.h>
-#include <ws2tcpip.h>
-
-#include "drivers/unix/socket_helpers.h"
-
-int winsock_refcount = 0;
-
-StreamPeerTCP *StreamPeerTCPWinsock::_create() {
-
- return memnew(StreamPeerTCPWinsock);
-};
-
-void StreamPeerTCPWinsock::make_default() {
-
- StreamPeerTCP::_create = StreamPeerTCPWinsock::_create;
-
- if (winsock_refcount == 0) {
- WSADATA data;
- WSAStartup(MAKEWORD(2, 2), &data);
- };
- ++winsock_refcount;
-};
-
-void StreamPeerTCPWinsock::cleanup() {
-
- --winsock_refcount;
- if (winsock_refcount == 0) {
-
- WSACleanup();
- };
-};
-
-Error StreamPeerTCPWinsock::_block(int p_sockfd, bool p_read, bool p_write) const {
-
- fd_set read, write;
- FD_ZERO(&read);
- FD_ZERO(&write);
-
- if (p_read)
- FD_SET(p_sockfd, &read);
- if (p_write)
- FD_SET(p_sockfd, &write);
-
- int ret = select(p_sockfd + 1, &read, &write, NULL, NULL); // block forever
- return ret < 0 ? FAILED : OK;
-};
-
-Error StreamPeerTCPWinsock::_poll_connection() const {
-
- ERR_FAIL_COND_V(status != STATUS_CONNECTING || sockfd == INVALID_SOCKET, FAILED);
-
- struct sockaddr_storage their_addr;
- size_t addr_size = _set_sockaddr(&their_addr, peer_host, peer_port, sock_type);
-
- if (::connect(sockfd, (struct sockaddr *)&their_addr, addr_size) == SOCKET_ERROR) {
-
- int err = WSAGetLastError();
- if (err == WSAEISCONN) {
- status = STATUS_CONNECTED;
- return OK;
- };
-
- if (err == WSAEINPROGRESS || err == WSAEALREADY) {
- return OK;
- }
-
- status = STATUS_ERROR;
- return ERR_CONNECTION_ERROR;
- } else {
-
- status = STATUS_CONNECTED;
- return OK;
- };
-
- return OK;
-};
-
-Error StreamPeerTCPWinsock::write(const uint8_t *p_data, int p_bytes, int &r_sent, bool p_block) {
-
- if (status == STATUS_NONE || status == STATUS_ERROR) {
-
- return FAILED;
- };
-
- if (status != STATUS_CONNECTED) {
-
- if (_poll_connection() != OK) {
-
- return FAILED;
- };
-
- if (status != STATUS_CONNECTED) {
- r_sent = 0;
- return OK;
- };
- };
-
- int data_to_send = p_bytes;
- const uint8_t *offset = p_data;
- if (sockfd == -1) return FAILED;
- int total_sent = 0;
-
- while (data_to_send) {
-
- int sent_amount = send(sockfd, (const char *)offset, data_to_send, 0);
-
- if (sent_amount == -1) {
-
- if (WSAGetLastError() != WSAEWOULDBLOCK) {
-
- perror("Nothing sent");
- disconnect_from_host();
- ERR_PRINT("Server disconnected!\n");
- return FAILED;
- };
-
- if (!p_block) {
- r_sent = total_sent;
- return OK;
- };
-
- _block(sockfd, false, true);
- } else {
-
- data_to_send -= sent_amount;
- offset += sent_amount;
- total_sent += sent_amount;
- };
- }
-
- r_sent = total_sent;
-
- return OK;
-};
-
-Error StreamPeerTCPWinsock::read(uint8_t *p_buffer, int p_bytes, int &r_received, bool p_block) {
-
- if (!is_connected_to_host()) {
-
- return FAILED;
- };
-
- if (status != STATUS_CONNECTED) {
-
- if (_poll_connection() != OK) {
-
- return FAILED;
- };
-
- if (status != STATUS_CONNECTED) {
- r_received = 0;
- return OK;
- };
- };
-
- int to_read = p_bytes;
- int total_read = 0;
-
- while (to_read) {
-
- int read = recv(sockfd, (char *)p_buffer + total_read, to_read, 0);
-
- if (read == -1) {
-
- if (WSAGetLastError() != WSAEWOULDBLOCK) {
-
- perror("Nothing read");
- disconnect_from_host();
- ERR_PRINT("Server disconnected!\n");
- return FAILED;
- };
-
- if (!p_block) {
-
- r_received = total_read;
- return OK;
- };
- _block(sockfd, true, false);
- } else if (read == 0) {
- disconnect_from_host();
- r_received = total_read;
- return ERR_FILE_EOF;
- } else {
-
- to_read -= read;
- total_read += read;
- };
- };
-
- r_received = total_read;
-
- return OK;
-};
-
-Error StreamPeerTCPWinsock::put_data(const uint8_t *p_data, int p_bytes) {
-
- int total;
- return write(p_data, p_bytes, total, true);
-};
-
-Error StreamPeerTCPWinsock::put_partial_data(const uint8_t *p_data, int p_bytes, int &r_sent) {
-
- return write(p_data, p_bytes, r_sent, false);
-};
-
-Error StreamPeerTCPWinsock::get_data(uint8_t *p_buffer, int p_bytes) {
-
- int total;
- return read(p_buffer, p_bytes, total, true);
-};
-
-Error StreamPeerTCPWinsock::get_partial_data(uint8_t *p_buffer, int p_bytes, int &r_received) {
-
- return read(p_buffer, p_bytes, r_received, false);
-};
-
-StreamPeerTCP::Status StreamPeerTCPWinsock::get_status() const {
-
- if (status == STATUS_CONNECTING) {
- _poll_connection();
- };
-
- return status;
-};
-
-bool StreamPeerTCPWinsock::is_connected_to_host() const {
-
- if (status == STATUS_NONE || status == STATUS_ERROR) {
-
- return false;
- };
- if (status != STATUS_CONNECTED) {
- return true;
- };
-
- return (sockfd != INVALID_SOCKET);
-};
-
-void StreamPeerTCPWinsock::disconnect_from_host() {
-
- if (sockfd != INVALID_SOCKET)
- closesocket(sockfd);
- sockfd = INVALID_SOCKET;
- sock_type = IP::TYPE_NONE;
-
- status = STATUS_NONE;
-
- peer_host = IP_Address();
- peer_port = 0;
-};
-
-void StreamPeerTCPWinsock::set_socket(int p_sockfd, IP_Address p_host, int p_port, IP::Type p_sock_type) {
-
- sockfd = p_sockfd;
- sock_type = p_sock_type;
- status = STATUS_CONNECTING;
- peer_host = p_host;
- peer_port = p_port;
-};
-
-Error StreamPeerTCPWinsock::connect_to_host(const IP_Address &p_host, uint16_t p_port) {
-
- ERR_FAIL_COND_V(!p_host.is_valid(), ERR_INVALID_PARAMETER);
-
- sock_type = p_host.is_ipv4() ? IP::TYPE_IPV4 : IP::TYPE_IPV6;
- sockfd = _socket_create(sock_type, SOCK_STREAM, IPPROTO_TCP);
- if (sockfd == INVALID_SOCKET) {
- ERR_PRINT("Socket creation failed!");
- disconnect_from_host();
- //perror("socket");
- return FAILED;
- };
-
- unsigned long par = 1;
- if (ioctlsocket(sockfd, FIONBIO, &par)) {
- perror("setting non-block mode");
- disconnect_from_host();
- return FAILED;
- };
-
- struct sockaddr_storage their_addr;
- size_t addr_size = _set_sockaddr(&their_addr, p_host, p_port, sock_type);
-
- if (::connect(sockfd, (struct sockaddr *)&their_addr, addr_size) == SOCKET_ERROR) {
-
- if (WSAGetLastError() != WSAEWOULDBLOCK) {
- ERR_PRINT("Connection to remote host failed!");
- disconnect_from_host();
- return FAILED;
- };
- status = STATUS_CONNECTING;
- } else {
- status = STATUS_CONNECTED;
- };
-
- peer_host = p_host;
- peer_port = p_port;
-
- return OK;
-};
-
-void StreamPeerTCPWinsock::set_no_delay(bool p_enabled) {
- ERR_FAIL_COND(!is_connected_to_host());
- int flag = p_enabled ? 1 : 0;
- if (setsockopt(sockfd, IPPROTO_TCP, TCP_NODELAY, (char *)&flag, sizeof(int)) != 0) {
- ERR_PRINT("Unable to set TCP no delay option");
- }
-}
-
-int StreamPeerTCPWinsock::get_available_bytes() const {
-
- unsigned long len;
- int ret = ioctlsocket(sockfd, FIONREAD, &len);
- ERR_FAIL_COND_V(ret == -1, 0)
- return len;
-}
-
-IP_Address StreamPeerTCPWinsock::get_connected_host() const {
-
- return peer_host;
-};
-
-uint16_t StreamPeerTCPWinsock::get_connected_port() const {
-
- return peer_port;
-};
-
-StreamPeerTCPWinsock::StreamPeerTCPWinsock() {
-
- sock_type = IP::TYPE_NONE;
- sockfd = INVALID_SOCKET;
- status = STATUS_NONE;
- peer_port = 0;
-};
-
-StreamPeerTCPWinsock::~StreamPeerTCPWinsock() {
-
- disconnect_from_host();
-};
-
-#endif
diff --git a/drivers/windows/tcp_server_winsock.cpp b/drivers/windows/tcp_server_winsock.cpp
deleted file mode 100644
index ddb955549f..0000000000
--- a/drivers/windows/tcp_server_winsock.cpp
+++ /dev/null
@@ -1,189 +0,0 @@
-/*************************************************************************/
-/* tcp_server_winsock.cpp */
-/*************************************************************************/
-/* This file is part of: */
-/* GODOT ENGINE */
-/* https://godotengine.org */
-/*************************************************************************/
-/* Copyright (c) 2007-2018 Juan Linietsky, Ariel Manzur. */
-/* Copyright (c) 2014-2018 Godot Engine contributors (cf. AUTHORS.md) */
-/* */
-/* Permission is hereby granted, free of charge, to any person obtaining */
-/* a copy of this software and associated documentation files (the */
-/* "Software"), to deal in the Software without restriction, including */
-/* without limitation the rights to use, copy, modify, merge, publish, */
-/* distribute, sublicense, and/or sell copies of the Software, and to */
-/* permit persons to whom the Software is furnished to do so, subject to */
-/* the following conditions: */
-/* */
-/* The above copyright notice and this permission notice shall be */
-/* included in all copies or substantial portions of the Software. */
-/* */
-/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */
-/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */
-/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.*/
-/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */
-/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */
-/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */
-/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
-/*************************************************************************/
-
-#ifdef WINDOWS_ENABLED
-
-#include "tcp_server_winsock.h"
-
-#include "stream_peer_tcp_winsock.h"
-
-#include <winsock2.h>
-#include <ws2tcpip.h>
-
-#include "drivers/unix/socket_helpers.h"
-
-extern int winsock_refcount;
-
-TCP_Server *TCPServerWinsock::_create() {
-
- return memnew(TCPServerWinsock);
-};
-
-void TCPServerWinsock::make_default() {
-
- TCP_Server::_create = TCPServerWinsock::_create;
-
- if (winsock_refcount == 0) {
- WSADATA data;
- WSAStartup(MAKEWORD(2, 2), &data);
- };
- ++winsock_refcount;
-};
-
-void TCPServerWinsock::cleanup() {
-
- --winsock_refcount;
- if (winsock_refcount == 0) {
-
- WSACleanup();
- };
-};
-
-Error TCPServerWinsock::listen(uint16_t p_port, const IP_Address &p_bind_address) {
-
- ERR_FAIL_COND_V(listen_sockfd != -1, ERR_ALREADY_IN_USE);
- ERR_FAIL_COND_V(!p_bind_address.is_valid() && !p_bind_address.is_wildcard(), ERR_INVALID_PARAMETER);
-
- int sockfd;
- sock_type = IP::TYPE_ANY;
-
- // If the bind address is valid use its type as the socket type
- if (p_bind_address.is_valid())
- sock_type = p_bind_address.is_ipv4() ? IP::TYPE_IPV4 : IP::TYPE_IPV6;
-
- sockfd = _socket_create(sock_type, SOCK_STREAM, IPPROTO_TCP);
- ERR_FAIL_COND_V(sockfd == INVALID_SOCKET, FAILED);
-
- unsigned long par = 1;
- if (ioctlsocket(sockfd, FIONBIO, &par)) {
- perror("setting non-block mode");
- stop();
- return FAILED;
- };
-
- struct sockaddr_storage my_addr;
- size_t addr_size = _set_listen_sockaddr(&my_addr, p_port, sock_type, p_bind_address);
-
- int reuse = 1;
- if (setsockopt(sockfd, SOL_SOCKET, SO_REUSEADDR, (char *)&reuse, sizeof(reuse)) < 0) {
-
- printf("REUSEADDR failed!");
- }
-
- if (bind(sockfd, (struct sockaddr *)&my_addr, addr_size) != SOCKET_ERROR) {
-
- if (::listen(sockfd, SOMAXCONN) == SOCKET_ERROR) {
-
- closesocket(sockfd);
- ERR_FAIL_V(FAILED);
- };
- } else {
- closesocket(sockfd);
- return ERR_ALREADY_IN_USE;
- };
-
- if (listen_sockfd != INVALID_SOCKET) {
-
- stop();
- };
-
- listen_sockfd = sockfd;
-
- return OK;
-};
-
-bool TCPServerWinsock::is_connection_available() const {
-
- if (listen_sockfd == -1) {
- return false;
- };
-
- timeval timeout;
- timeout.tv_sec = 0;
- timeout.tv_usec = 0;
-
- fd_set pfd;
- FD_ZERO(&pfd);
- FD_SET(listen_sockfd, &pfd);
-
- int ret = select(listen_sockfd + 1, &pfd, NULL, NULL, &timeout);
- ERR_FAIL_COND_V(ret < 0, 0);
-
- if (ret && (FD_ISSET(listen_sockfd, &pfd))) {
-
- return true;
- };
-
- return false;
-};
-
-Ref<StreamPeerTCP> TCPServerWinsock::take_connection() {
-
- if (!is_connection_available()) {
- return NULL;
- };
-
- struct sockaddr_storage their_addr;
- int sin_size = sizeof(their_addr);
- int fd = accept(listen_sockfd, (struct sockaddr *)&their_addr, &sin_size);
- ERR_FAIL_COND_V(fd == INVALID_SOCKET, NULL);
-
- Ref<StreamPeerTCPWinsock> conn = memnew(StreamPeerTCPWinsock);
- IP_Address ip;
- int port;
- _set_ip_addr_port(ip, port, &their_addr);
-
- conn->set_socket(fd, ip, port, sock_type);
-
- return conn;
-};
-
-void TCPServerWinsock::stop() {
-
- if (listen_sockfd != INVALID_SOCKET) {
- closesocket(listen_sockfd);
- };
-
- listen_sockfd = -1;
- sock_type = IP::TYPE_NONE;
-};
-
-TCPServerWinsock::TCPServerWinsock() {
-
- listen_sockfd = INVALID_SOCKET;
- sock_type = IP::TYPE_NONE;
-};
-
-TCPServerWinsock::~TCPServerWinsock() {
-
- stop();
-};
-
-#endif
diff --git a/drivers/windows/thread_windows.cpp b/drivers/windows/thread_windows.cpp
index 5e0b017a5c..52dcfacdf8 100644
--- a/drivers/windows/thread_windows.cpp
+++ b/drivers/windows/thread_windows.cpp
@@ -32,7 +32,7 @@
#if defined(WINDOWS_ENABLED) && !defined(UWP_ENABLED)
-#include "os/memory.h"
+#include "core/os/memory.h"
Thread::ID ThreadWindows::get_id() const {
diff --git a/drivers/windows/thread_windows.h b/drivers/windows/thread_windows.h
index d7a8389d9e..5d2838e54f 100644
--- a/drivers/windows/thread_windows.h
+++ b/drivers/windows/thread_windows.h
@@ -31,16 +31,17 @@
#ifndef THREAD_WINDOWS_H
#define THREAD_WINDOWS_H
-/**
- @author Juan Linietsky <reduzio@gmail.com>
-*/
-
#ifdef WINDOWS_ENABLED
-#include "os/thread.h"
-#include "script_language.h"
+#include "core/os/thread.h"
+#include "core/script_language.h"
+
#include <windows.h>
+/**
+ @author Juan Linietsky <reduzio@gmail.com>
+*/
+
class ThreadWindows : public Thread {
ThreadCreateCallback callback;
diff --git a/drivers/winmidi/win_midi.cpp b/drivers/winmidi/win_midi.cpp
index 63f7f13685..1d4bf1a1e2 100644
--- a/drivers/winmidi/win_midi.cpp
+++ b/drivers/winmidi/win_midi.cpp
@@ -31,7 +31,8 @@
#ifdef WINMIDI_ENABLED
#include "win_midi.h"
-#include "print_string.h"
+
+#include "core/print_string.h"
void MIDIDriverWinMidi::read(HMIDIIN hMidiIn, UINT wMsg, DWORD_PTR dwInstance, DWORD_PTR dwParam1, DWORD_PTR dwParam2) {
diff --git a/drivers/winmidi/win_midi.h b/drivers/winmidi/win_midi.h
index 1cf9b19b5d..87a349d5d1 100644
--- a/drivers/winmidi/win_midi.h
+++ b/drivers/winmidi/win_midi.h
@@ -33,14 +33,14 @@
#ifndef WIN_MIDI_H
#define WIN_MIDI_H
+#include "core/os/midi_driver.h"
+#include "core/vector.h"
+
#include <stdio.h>
#include <windows.h>
#include <mmsystem.h>
-#include "core/vector.h"
-#include "os/midi_driver.h"
-
class MIDIDriverWinMidi : public MIDIDriver {
Vector<HMIDIIN> connected_sources;
diff --git a/drivers/xaudio2/audio_driver_xaudio2.cpp b/drivers/xaudio2/audio_driver_xaudio2.cpp
index a1002ef4f9..452a1105ca 100644
--- a/drivers/xaudio2/audio_driver_xaudio2.cpp
+++ b/drivers/xaudio2/audio_driver_xaudio2.cpp
@@ -30,8 +30,8 @@
#include "audio_driver_xaudio2.h"
-#include "os/os.h"
-#include "project_settings.h"
+#include "core/os/os.h"
+#include "core/project_settings.h"
const char *AudioDriverXAudio2::get_name() const {
return "XAudio2";
diff --git a/editor/animation_track_editor.cpp b/editor/animation_track_editor.cpp
index 4c4830ad7a..ac28fb9b99 100644
--- a/editor/animation_track_editor.cpp
+++ b/editor/animation_track_editor.cpp
@@ -30,11 +30,11 @@
#include "animation_track_editor.h"
#include "animation_track_editor_plugins.h"
+#include "core/os/keyboard.h"
#include "editor/animation_bezier_editor.h"
#include "editor/plugins/animation_player_editor_plugin.h"
#include "editor_node.h"
#include "editor_scale.h"
-#include "os/keyboard.h"
#include "scene/main/viewport.h"
#include "servers/audio/audio_stream.h"
diff --git a/editor/audio_stream_preview.h b/editor/audio_stream_preview.h
index a014f2f571..1a8f2eaa15 100644
--- a/editor/audio_stream_preview.h
+++ b/editor/audio_stream_preview.h
@@ -31,7 +31,7 @@
#ifndef AUDIO_STREAM_PREVIEW_H
#define AUDIO_STREAM_PREVIEW_H
-#include "os/thread.h"
+#include "core/os/thread.h"
#include "scene/main/node.h"
#include "servers/audio/audio_stream.h"
diff --git a/editor/code_editor.cpp b/editor/code_editor.cpp
index 2fecf24d7d..80bc73bc12 100644
--- a/editor/code_editor.cpp
+++ b/editor/code_editor.cpp
@@ -30,10 +30,10 @@
#include "code_editor.h"
+#include "core/os/keyboard.h"
#include "editor/editor_scale.h"
#include "editor_node.h"
#include "editor_settings.h"
-#include "os/keyboard.h"
#include "scene/gui/margin_container.h"
#include "scene/gui/separator.h"
#include "scene/resources/dynamic_font.h"
diff --git a/editor/collada/collada.h b/editor/collada/collada.h
index 7535162f74..b777fa04c2 100644
--- a/editor/collada/collada.h
+++ b/editor/collada/collada.h
@@ -33,9 +33,9 @@
#ifndef COLLADA_H
#define COLLADA_H
-#include "io/xml_parser.h"
-#include "map.h"
-#include "project_settings.h"
+#include "core/io/xml_parser.h"
+#include "core/map.h"
+#include "core/project_settings.h"
#include "scene/resources/material.h"
class Collada {
diff --git a/editor/connections_dialog.cpp b/editor/connections_dialog.cpp
index 85965768cc..456e2fa1f0 100644
--- a/editor/connections_dialog.cpp
+++ b/editor/connections_dialog.cpp
@@ -30,10 +30,10 @@
#include "connections_dialog.h"
+#include "core/print_string.h"
#include "editor_node.h"
#include "editor_settings.h"
#include "plugins/script_editor_plugin.h"
-#include "print_string.h"
#include "scene/gui/label.h"
#include "scene/gui/popup_menu.h"
@@ -341,8 +341,7 @@ ConnectDialog::ConnectDialog() {
vbc_right->add_margin_child(TTR("Add Extra Call Argument:"), add_bind_hb);
- bind_editor = memnew(PropertyEditor);
- bind_editor->hide_top_label();
+ bind_editor = memnew(EditorInspector);
vbc_right->add_margin_child(TTR("Extra Call Arguments:"), bind_editor, true);
@@ -498,7 +497,7 @@ void ConnectionsDock::_disconnect(TreeItem &item) {
}
/*
-Break all conections of currently selected signal.
+Break all connections of currently selected signal.
Can undo-redo as a single action.
*/
void ConnectionsDock::_disconnect_all() {
diff --git a/editor/connections_dialog.h b/editor/connections_dialog.h
index 932ff693e4..c2fd1f1d09 100644
--- a/editor/connections_dialog.h
+++ b/editor/connections_dialog.h
@@ -35,7 +35,8 @@
#ifndef CONNECTIONS_DIALOG_H
#define CONNECTIONS_DIALOG_H
-#include "editor/property_editor.h"
+#include "core/undo_redo.h"
+#include "editor/editor_inspector.h"
#include "editor/scene_tree_editor.h"
#include "scene/gui/button.h"
#include "scene/gui/check_button.h"
@@ -44,7 +45,6 @@
#include "scene/gui/menu_button.h"
#include "scene/gui/popup.h"
#include "scene/gui/tree.h"
-#include "undo_redo.h"
class PopupMenu;
class ConnectDialogBinds;
@@ -62,7 +62,7 @@ class ConnectDialog : public ConfirmationDialog {
SceneTreeEditor *tree;
ConfirmationDialog *error;
- PropertyEditor *bind_editor;
+ EditorInspector *bind_editor;
OptionButton *type_list;
CheckButton *deferred;
CheckButton *oneshot;
diff --git a/editor/create_dialog.cpp b/editor/create_dialog.cpp
index fd607e5b63..8bef94d8a8 100644
--- a/editor/create_dialog.cpp
+++ b/editor/create_dialog.cpp
@@ -30,12 +30,12 @@
#include "create_dialog.h"
-#include "class_db.h"
+#include "core/class_db.h"
+#include "core/os/keyboard.h"
+#include "core/print_string.h"
#include "editor_help.h"
#include "editor_node.h"
#include "editor_settings.h"
-#include "os/keyboard.h"
-#include "print_string.h"
#include "scene/gui/box_container.h"
void CreateDialog::popup_create(bool p_dont_clear, bool p_replace_mode) {
@@ -244,17 +244,17 @@ void CreateDialog::add_type(const String &p_type, HashMap<String, TreeItem *> &p
bool is_search_subsequence = search_box->get_text().is_subsequence_ofi(p_type);
String to_select_type = *to_select ? (*to_select)->get_text(0) : "";
to_select_type = to_select_type.split(" ")[0];
- bool current_item_is_preffered;
+ bool current_item_is_preferred;
if (cpp_type) {
- current_item_is_preffered = ClassDB::is_parent_class(p_type, preferred_search_result_type) && !ClassDB::is_parent_class(to_select_type, preferred_search_result_type);
+ current_item_is_preferred = ClassDB::is_parent_class(p_type, preferred_search_result_type) && !ClassDB::is_parent_class(to_select_type, preferred_search_result_type) && search_box->get_text() != to_select_type;
} else {
- current_item_is_preffered = ed.script_class_is_parent(p_type, preferred_search_result_type) && !ed.script_class_is_parent(to_select_type, preferred_search_result_type);
+ current_item_is_preferred = ed.script_class_is_parent(p_type, preferred_search_result_type) && !ed.script_class_is_parent(to_select_type, preferred_search_result_type) && search_box->get_text() != to_select_type;
}
if (*to_select && p_type.length() < (*to_select)->get_text(0).length()) {
- current_item_is_preffered = true;
+ current_item_is_preferred = true;
}
- if (((!*to_select || current_item_is_preffered) && is_search_subsequence) || search_box->get_text() == p_type) {
+ if (((!*to_select || current_item_is_preferred) && is_search_subsequence) || search_box->get_text() == p_type) {
*to_select = item;
}
}
diff --git a/editor/dependency_editor.cpp b/editor/dependency_editor.cpp
index 62ae14c988..9f04d40763 100644
--- a/editor/dependency_editor.cpp
+++ b/editor/dependency_editor.cpp
@@ -30,9 +30,9 @@
#include "dependency_editor.h"
+#include "core/io/resource_loader.h"
+#include "core/os/file_access.h"
#include "editor_node.h"
-#include "io/resource_loader.h"
-#include "os/file_access.h"
#include "scene/gui/margin_container.h"
void DependencyEditor::_notification(int p_what) {
diff --git a/editor/doc/doc_data.cpp b/editor/doc/doc_data.cpp
index c90b2b14b3..599f46d6d9 100644
--- a/editor/doc/doc_data.cpp
+++ b/editor/doc/doc_data.cpp
@@ -30,15 +30,15 @@
#include "doc_data.h"
-#include "engine.h"
-#include "global_constants.h"
-#include "io/compression.h"
-#include "io/marshalls.h"
-#include "os/dir_access.h"
-#include "project_settings.h"
+#include "core/engine.h"
+#include "core/global_constants.h"
+#include "core/io/compression.h"
+#include "core/io/marshalls.h"
+#include "core/os/dir_access.h"
+#include "core/project_settings.h"
+#include "core/script_language.h"
+#include "core/version.h"
#include "scene/resources/theme.h"
-#include "script_language.h"
-#include "version.h"
void DocData::merge_from(const DocData &p_data) {
diff --git a/editor/doc/doc_data.h b/editor/doc/doc_data.h
index c7b70b5fb9..6633c123e6 100644
--- a/editor/doc/doc_data.h
+++ b/editor/doc/doc_data.h
@@ -31,9 +31,9 @@
#ifndef DOC_DATA_H
#define DOC_DATA_H
-#include "io/xml_parser.h"
-#include "map.h"
-#include "variant.h"
+#include "core/io/xml_parser.h"
+#include "core/map.h"
+#include "core/variant.h"
class DocData {
public:
diff --git a/editor/doc/doc_dump.cpp b/editor/doc/doc_dump.cpp
index 06d35c4d3a..86fd9b436b 100644
--- a/editor/doc/doc_dump.cpp
+++ b/editor/doc/doc_dump.cpp
@@ -30,9 +30,9 @@
#include "doc_dump.h"
-#include "os/file_access.h"
+#include "core/os/file_access.h"
+#include "core/version.h"
#include "scene/main/node.h"
-#include "version.h"
static void _write_string(FileAccess *f, int p_tablevel, const String &p_string) {
diff --git a/editor/doc/doc_dump.h b/editor/doc/doc_dump.h
index 48cf1a587b..99398b5d96 100644
--- a/editor/doc/doc_dump.h
+++ b/editor/doc/doc_dump.h
@@ -31,7 +31,7 @@
#ifndef DOC_DUMP_H
#define DOC_DUMP_H
-#include "class_db.h"
+#include "core/class_db.h"
class DocDump {
public:
diff --git a/editor/editor_asset_installer.cpp b/editor/editor_asset_installer.cpp
index d99908a3c3..6af45f26ae 100644
--- a/editor/editor_asset_installer.cpp
+++ b/editor/editor_asset_installer.cpp
@@ -30,10 +30,10 @@
#include "editor_asset_installer.h"
+#include "core/io/zip_io.h"
+#include "core/os/dir_access.h"
+#include "core/os/file_access.h"
#include "editor_node.h"
-#include "io/zip_io.h"
-#include "os/dir_access.h"
-#include "os/file_access.h"
void EditorAssetInstaller::_update_subitems(TreeItem *p_item, bool p_check, bool p_first) {
diff --git a/editor/editor_audio_buses.cpp b/editor/editor_audio_buses.cpp
index 9c775be87e..96110b61ab 100644
--- a/editor/editor_audio_buses.cpp
+++ b/editor/editor_audio_buses.cpp
@@ -30,10 +30,10 @@
#include "editor_audio_buses.h"
+#include "core/io/resource_saver.h"
+#include "core/os/keyboard.h"
#include "editor_node.h"
#include "filesystem_dock.h"
-#include "io/resource_saver.h"
-#include "os/keyboard.h"
#include "servers/audio_server.h"
void EditorAudioBus::_notification(int p_what) {
diff --git a/editor/editor_autoload_settings.cpp b/editor/editor_autoload_settings.cpp
index d12c85861b..1374c8c9aa 100644
--- a/editor/editor_autoload_settings.cpp
+++ b/editor/editor_autoload_settings.cpp
@@ -30,9 +30,9 @@
#include "editor_autoload_settings.h"
+#include "core/global_constants.h"
+#include "core/project_settings.h"
#include "editor_node.h"
-#include "global_constants.h"
-#include "project_settings.h"
#include "scene/main/viewport.h"
#include "scene/resources/packed_scene.h"
diff --git a/editor/editor_data.cpp b/editor/editor_data.cpp
index 69c120bb3c..6187c6b318 100644
--- a/editor/editor_data.cpp
+++ b/editor/editor_data.cpp
@@ -30,12 +30,12 @@
#include "editor_data.h"
+#include "core/io/resource_loader.h"
+#include "core/os/dir_access.h"
+#include "core/os/file_access.h"
+#include "core/project_settings.h"
#include "editor_node.h"
#include "editor_settings.h"
-#include "io/resource_loader.h"
-#include "os/dir_access.h"
-#include "os/file_access.h"
-#include "project_settings.h"
#include "scene/resources/packed_scene.h"
void EditorHistory::cleanup_history() {
diff --git a/editor/editor_data.h b/editor/editor_data.h
index 285769aa78..9f5d3e2a15 100644
--- a/editor/editor_data.h
+++ b/editor/editor_data.h
@@ -31,12 +31,12 @@
#ifndef EDITOR_DATA_H
#define EDITOR_DATA_H
+#include "core/list.h"
+#include "core/pair.h"
+#include "core/undo_redo.h"
#include "editor/editor_plugin.h"
#include "editor/plugins/script_editor_plugin.h"
-#include "list.h"
-#include "pair.h"
#include "scene/resources/texture.h"
-#include "undo_redo.h"
class EditorHistory {
diff --git a/editor/editor_dir_dialog.cpp b/editor/editor_dir_dialog.cpp
index c094b2b559..6f80b6bea4 100644
--- a/editor/editor_dir_dialog.cpp
+++ b/editor/editor_dir_dialog.cpp
@@ -30,11 +30,11 @@
#include "editor_dir_dialog.h"
+#include "core/os/keyboard.h"
+#include "core/os/os.h"
#include "editor/editor_file_system.h"
#include "editor/editor_settings.h"
#include "editor_scale.h"
-#include "os/keyboard.h"
-#include "os/os.h"
void EditorDirDialog::_update_dir(TreeItem *p_item, EditorFileSystemDirectory *p_dir, const String &p_select_path) {
updating = true;
diff --git a/editor/editor_dir_dialog.h b/editor/editor_dir_dialog.h
index 7c19e7de38..a9dc7accfe 100644
--- a/editor/editor_dir_dialog.h
+++ b/editor/editor_dir_dialog.h
@@ -31,8 +31,8 @@
#ifndef EDITOR_DIR_DIALOG_H
#define EDITOR_DIR_DIALOG_H
+#include "core/os/dir_access.h"
#include "editor/editor_file_system.h"
-#include "os/dir_access.h"
#include "scene/gui/dialogs.h"
#include "scene/gui/tree.h"
diff --git a/editor/editor_export.cpp b/editor/editor_export.cpp
index 441c09620e..455c889224 100644
--- a/editor/editor_export.cpp
+++ b/editor/editor_export.cpp
@@ -30,20 +30,20 @@
#include "editor_export.h"
+#include "core/io/config_file.h"
+#include "core/io/resource_loader.h"
+#include "core/io/resource_saver.h"
+#include "core/io/zip_io.h"
+#include "core/os/file_access.h"
+#include "core/project_settings.h"
+#include "core/script_language.h"
+#include "core/version.h"
#include "editor/editor_file_system.h"
#include "editor/plugins/script_editor_plugin.h"
#include "editor_node.h"
#include "editor_settings.h"
-#include "io/config_file.h"
-#include "io/resource_loader.h"
-#include "io/resource_saver.h"
-#include "io/zip_io.h"
-#include "os/file_access.h"
-#include "project_settings.h"
#include "scene/resources/scene_format_text.h"
-#include "script_language.h"
#include "thirdparty/misc/md5.h"
-#include "version.h"
static int _get_pad(int p_alignment, int p_n) {
diff --git a/editor/editor_export.h b/editor/editor_export.h
index b984d66a1b..420f383f95 100644
--- a/editor/editor_export.h
+++ b/editor/editor_export.h
@@ -31,8 +31,8 @@
#ifndef EDITOR_EXPORT_H
#define EDITOR_EXPORT_H
-#include "os/dir_access.h"
-#include "resource.h"
+#include "core/os/dir_access.h"
+#include "core/resource.h"
#include "scene/main/node.h"
#include "scene/main/timer.h"
#include "scene/resources/texture.h"
diff --git a/editor/editor_file_dialog.cpp b/editor/editor_file_dialog.cpp
index d240f4ed25..3659a06bb7 100644
--- a/editor/editor_file_dialog.cpp
+++ b/editor/editor_file_dialog.cpp
@@ -29,14 +29,14 @@
/*************************************************************************/
#include "editor_file_dialog.h"
+#include "core/os/file_access.h"
+#include "core/os/keyboard.h"
+#include "core/os/os.h"
+#include "core/print_string.h"
#include "dependency_editor.h"
#include "editor_resource_preview.h"
#include "editor_scale.h"
#include "editor_settings.h"
-#include "os/file_access.h"
-#include "os/keyboard.h"
-#include "os/os.h"
-#include "print_string.h"
#include "scene/gui/center_container.h"
#include "scene/gui/label.h"
#include "scene/gui/margin_container.h"
diff --git a/editor/editor_file_dialog.h b/editor/editor_file_dialog.h
index b1f8f1108c..61eeff9162 100644
--- a/editor/editor_file_dialog.h
+++ b/editor/editor_file_dialog.h
@@ -31,7 +31,7 @@
#ifndef EDITORFILEDIALOG_H
#define EDITORFILEDIALOG_H
-#include "os/dir_access.h"
+#include "core/os/dir_access.h"
#include "scene/gui/box_container.h"
#include "scene/gui/dialogs.h"
#include "scene/gui/item_list.h"
diff --git a/editor/editor_file_system.cpp b/editor/editor_file_system.cpp
index 9562a8c63c..3d034989ed 100644
--- a/editor/editor_file_system.cpp
+++ b/editor/editor_file_system.cpp
@@ -30,16 +30,16 @@
#include "editor_file_system.h"
+#include "core/io/resource_import.h"
+#include "core/io/resource_loader.h"
+#include "core/io/resource_saver.h"
+#include "core/os/file_access.h"
+#include "core/os/os.h"
+#include "core/project_settings.h"
+#include "core/variant_parser.h"
#include "editor_node.h"
#include "editor_resource_preview.h"
#include "editor_settings.h"
-#include "io/resource_import.h"
-#include "io/resource_loader.h"
-#include "io/resource_saver.h"
-#include "os/file_access.h"
-#include "os/os.h"
-#include "project_settings.h"
-#include "variant_parser.h"
EditorFileSystem *EditorFileSystem::singleton = NULL;
@@ -389,7 +389,7 @@ bool EditorFileSystem::_test_for_reimport(const String &p_path, bool p_only_impo
memdelete(f);
- // Read the md5's from a separate file (so the import parameters aren't dependant on the file version
+ // Read the md5's from a separate file (so the import parameters aren't dependent on the file version
String base_path = ResourceFormatImporter::get_singleton()->get_import_base_path(p_path);
FileAccess *md5s = FileAccess::open(base_path + ".md5", FileAccess::READ, &err);
if (!md5s) { // No md5's stored for this resource
@@ -1479,12 +1479,16 @@ void EditorFileSystem::_reimport_file(const String &p_file) {
cf.instance();
Error err = cf->load(p_file + ".import");
if (err == OK) {
- List<String> sk;
- cf->get_section_keys("params", &sk);
- for (List<String>::Element *E = sk.front(); E; E = E->next()) {
- params[E->get()] = cf->get_value("params", E->get());
+ if (cf->has_section("params")) {
+ List<String> sk;
+ cf->get_section_keys("params", &sk);
+ for (List<String>::Element *E = sk.front(); E; E = E->next()) {
+ params[E->get()] = cf->get_value("params", E->get());
+ }
+ }
+ if (cf->has_section("remap")) {
+ importer_name = cf->get_value("remap", "importer");
}
- importer_name = cf->get_value("remap", "importer");
}
} else {
diff --git a/editor/editor_file_system.h b/editor/editor_file_system.h
index 75ca79932f..f2f72eddbd 100644
--- a/editor/editor_file_system.h
+++ b/editor/editor_file_system.h
@@ -31,11 +31,11 @@
#ifndef EDITOR_FILE_SYSTEM_H
#define EDITOR_FILE_SYSTEM_H
-#include "os/dir_access.h"
-#include "os/thread.h"
-#include "os/thread_safe.h"
+#include "core/os/dir_access.h"
+#include "core/os/thread.h"
+#include "core/os/thread_safe.h"
+#include "core/set.h"
#include "scene/main/node.h"
-#include "set.h"
class FileAccess;
struct EditorProgressBG;
diff --git a/editor/editor_help.cpp b/editor/editor_help.cpp
index d84b9bff91..5b9e7b29a9 100644
--- a/editor/editor_help.cpp
+++ b/editor/editor_help.cpp
@@ -30,11 +30,11 @@
#include "editor_help.h"
+#include "core/os/keyboard.h"
#include "doc_data_compressed.gen.h"
#include "editor/plugins/script_editor_plugin.h"
#include "editor_node.h"
#include "editor_settings.h"
-#include "os/keyboard.h"
#define CONTRIBUTE_URL "http://docs.godotengine.org/en/latest/community/contributing/updating_the_class_reference.html"
#define CONTRIBUTE2_URL "https://github.com/godotengine/godot-docs"
@@ -776,6 +776,7 @@ void EditorHelp::_update_doc() {
Ref<Font> doc_code_font = get_font("doc_source", "EditorFonts");
String link_color_text = title_color.to_html(false);
+ // Class name
section_line.push_back(Pair<String, int>(TTR("Top"), 0));
class_desc->push_font(doc_title_font);
class_desc->push_color(title_color);
@@ -787,18 +788,18 @@ void EditorHelp::_update_doc() {
class_desc->pop();
class_desc->add_newline();
+ // Inheritance tree
+
+ // Ascendents
if (cd.inherits != "") {
class_desc->push_color(title_color);
- class_desc->push_font(doc_title_font);
+ class_desc->push_font(doc_font);
class_desc->add_text(TTR("Inherits:") + " ");
class_desc->pop();
- class_desc->pop();
String inherits = cd.inherits;
- class_desc->push_font(doc_font);
-
while (inherits != "") {
_add_type(inherits);
@@ -813,6 +814,7 @@ void EditorHelp::_update_doc() {
class_desc->add_newline();
}
+ // Descendents
if (ClassDB::class_exists(cd.name)) {
bool found = false;
@@ -824,13 +826,10 @@ void EditorHelp::_update_doc() {
if (!found) {
class_desc->push_color(title_color);
- class_desc->push_font(doc_title_font);
+ class_desc->push_font(doc_font);
class_desc->add_text(TTR("Inherited by:") + " ");
class_desc->pop();
- class_desc->pop();
-
found = true;
- class_desc->push_font(doc_font);
}
if (prev) {
@@ -853,6 +852,7 @@ void EditorHelp::_update_doc() {
class_desc->add_newline();
class_desc->add_newline();
+ // Brief description
if (cd.brief_description != "") {
class_desc->push_color(title_color);
@@ -874,15 +874,16 @@ void EditorHelp::_update_doc() {
class_desc->add_newline();
}
+ // Properties overview
Set<String> skip_methods;
bool property_descr = false;
if (cd.properties.size()) {
- section_line.push_back(Pair<String, int>(TTR("Members"), class_desc->get_line_count() - 2));
+ section_line.push_back(Pair<String, int>(TTR("Properties"), class_desc->get_line_count() - 2));
class_desc->push_color(title_color);
class_desc->push_font(doc_title_font);
- class_desc->add_text(TTR("Members:"));
+ class_desc->add_text(TTR("Properties:"));
class_desc->pop();
class_desc->pop();
@@ -940,6 +941,7 @@ void EditorHelp::_update_doc() {
class_desc->add_newline();
}
+ // Methods overview
bool method_descr = false;
bool sort_methods = EditorSettings::get_singleton()->get("text_editor/help/sort_functions_alphabetically");
@@ -956,10 +958,10 @@ void EditorHelp::_update_doc() {
if (sort_methods)
methods.sort();
- section_line.push_back(Pair<String, int>(TTR("Public Methods"), class_desc->get_line_count() - 2));
+ section_line.push_back(Pair<String, int>(TTR("Methods"), class_desc->get_line_count() - 2));
class_desc->push_color(title_color);
class_desc->push_font(doc_title_font);
- class_desc->add_text(TTR("Public Methods:"));
+ class_desc->add_text(TTR("Methods:"));
class_desc->pop();
class_desc->pop();
@@ -1024,22 +1026,20 @@ void EditorHelp::_update_doc() {
class_desc->add_newline();
}
+ // Theme properties
if (cd.theme_properties.size()) {
- section_line.push_back(Pair<String, int>(TTR("GUI Theme Items"), class_desc->get_line_count() - 2));
+ section_line.push_back(Pair<String, int>(TTR("Theme Properties"), class_desc->get_line_count() - 2));
class_desc->push_color(title_color);
class_desc->push_font(doc_title_font);
- class_desc->add_text(TTR("GUI Theme Items:"));
+ class_desc->add_text(TTR("Theme Properties:"));
class_desc->pop();
class_desc->pop();
- // class_desc->add_newline();
class_desc->push_indent(1);
class_desc->push_table(2);
class_desc->set_table_column_expand(1, 1);
- //class_desc->add_newline();
-
for (int i = 0; i < cd.theme_properties.size(); i++) {
theme_property_line[cd.theme_properties[i].name] = class_desc->get_line_count() - 2; //gets overridden if description
@@ -1076,6 +1076,7 @@ void EditorHelp::_update_doc() {
class_desc->add_newline();
}
+ // Signals
if (cd.signals.size()) {
if (sort_methods) {
@@ -1144,6 +1145,7 @@ void EditorHelp::_update_doc() {
class_desc->add_newline();
}
+ // Constants and enums
if (cd.constants.size()) {
Map<String, Vector<DocData::ConstantDoc> > enums;
@@ -1163,6 +1165,7 @@ void EditorHelp::_update_doc() {
}
}
+ // Enums
if (enums.size()) {
section_line.push_back(Pair<String, int>(TTR("Enumerations"), class_desc->get_line_count() - 2));
@@ -1245,6 +1248,7 @@ void EditorHelp::_update_doc() {
class_desc->add_newline();
}
+ // Constants
if (constants.size()) {
section_line.push_back(Pair<String, int>(TTR("Constants"), class_desc->get_line_count() - 2));
@@ -1303,13 +1307,14 @@ void EditorHelp::_update_doc() {
}
}
+ // Class description
if (cd.description != "") {
- section_line.push_back(Pair<String, int>(TTR("Description"), class_desc->get_line_count() - 2));
+ section_line.push_back(Pair<String, int>(TTR("Class Description"), class_desc->get_line_count() - 2));
description_line = class_desc->get_line_count() - 2;
class_desc->push_color(title_color);
class_desc->push_font(doc_title_font);
- class_desc->add_text(TTR("Description:"));
+ class_desc->add_text(TTR("Class Description:"));
class_desc->pop();
class_desc->pop();
@@ -1326,8 +1331,8 @@ void EditorHelp::_update_doc() {
class_desc->add_newline();
}
+ // Online tutorials
{
-
class_desc->push_color(title_color);
class_desc->push_font(doc_title_font);
class_desc->add_text(TTR("Online Tutorials:"));
@@ -1365,12 +1370,14 @@ void EditorHelp::_update_doc() {
class_desc->add_newline();
class_desc->add_newline();
}
+
+ // Property descriptions
if (property_descr) {
- section_line.push_back(Pair<String, int>(TTR("Properties"), class_desc->get_line_count() - 2));
+ section_line.push_back(Pair<String, int>(TTR("Property Descriptions"), class_desc->get_line_count() - 2));
class_desc->push_color(title_color);
class_desc->push_font(doc_title_font);
- class_desc->add_text(TTR("Property Description:"));
+ class_desc->add_text(TTR("Property Descriptions:"));
class_desc->pop();
class_desc->pop();
@@ -1458,12 +1465,13 @@ void EditorHelp::_update_doc() {
}
}
+ // Method descriptions
if (method_descr) {
- section_line.push_back(Pair<String, int>(TTR("Methods"), class_desc->get_line_count() - 2));
+ section_line.push_back(Pair<String, int>(TTR("Method Descriptions"), class_desc->get_line_count() - 2));
class_desc->push_color(title_color);
class_desc->push_font(doc_title_font);
- class_desc->add_text(TTR("Method Description:"));
+ class_desc->add_text(TTR("Method Descriptions:"));
class_desc->pop();
class_desc->pop();
diff --git a/editor/editor_initialize_ssl.cpp b/editor/editor_initialize_ssl.cpp
index aedbfb7bd7..9f7537cc9a 100644
--- a/editor/editor_initialize_ssl.cpp
+++ b/editor/editor_initialize_ssl.cpp
@@ -31,8 +31,8 @@
#include "editor_initialize_ssl.h"
#include "certs_compressed.gen.h"
-#include "io/compression.h"
-#include "io/stream_peer_ssl.h"
+#include "core/io/compression.h"
+#include "core/io/stream_peer_ssl.h"
void editor_initialize_certificates() {
diff --git a/editor/editor_inspector.cpp b/editor/editor_inspector.cpp
index 852e1930d2..b64570f312 100644
--- a/editor/editor_inspector.cpp
+++ b/editor/editor_inspector.cpp
@@ -38,7 +38,6 @@
// TODO:
// arrays and dictionary
-// replace property editor in sectionedpropertyeditor
Size2 EditorProperty::get_minimum_size() const {
@@ -1138,7 +1137,6 @@ void EditorInspectorSection::_gui_input(const Ref<InputEvent> &p_event) {
return;
#ifdef TOOLS_ENABLED
-
Ref<InputEventMouseButton> mb = p_event;
if (mb.is_valid() && mb->is_pressed() && mb->get_button_index() == BUTTON_LEFT) {
@@ -1167,7 +1165,6 @@ void EditorInspectorSection::unfold() {
_test_unfold();
#ifdef TOOLS_ENABLED
-
object->editor_set_section_unfold(section, true);
vbox->show();
update();
@@ -1180,8 +1177,8 @@ void EditorInspectorSection::fold() {
if (!vbox_added)
return; //kinda pointless
-#ifdef TOOLS_ENABLED
+#ifdef TOOLS_ENABLED
object->editor_set_section_unfold(section, false);
vbox->hide();
update();
@@ -1202,7 +1199,6 @@ EditorInspectorSection::EditorInspectorSection() {
foldable = false;
vbox = memnew(VBoxContainer);
vbox_added = false;
- //add_child(vbox);
}
EditorInspectorSection::~EditorInspectorSection() {
@@ -1607,12 +1603,6 @@ void EditorInspector::update_tree() {
doc_hint = descr;
}
-#if 0
- if (p.name == selected_property) {
-
- item->select(1);
- }
-#endif
for (List<Ref<EditorInspectorPlugin> >::Element *E = valid_plugins.front(); E; E = E->next()) {
Ref<EditorInspectorPlugin> ped = E->get();
bool exclusive = ped->parse_property(object, p.type, p.name, p.hint, p.hint_string, p.usage);
@@ -1752,7 +1742,7 @@ void EditorInspector::edit(Object *p_object) {
if (object) {
update_scroll_request = 0; //reset
if (scroll_cache.has(object->get_instance_id())) { //if exists, set something else
- update_scroll_request = scroll_cache[object->get_instance_id()]; //done this way because wait until full size is accomodated
+ update_scroll_request = scroll_cache[object->get_instance_id()]; //done this way because wait until full size is accommodated
}
object->add_change_receptor(this);
update_tree();
@@ -1812,12 +1802,6 @@ void EditorInspector::_filter_changed(const String &p_text) {
update_tree();
}
-void EditorInspector::set_subsection_selectable(bool p_selectable) {
-}
-
-void EditorInspector::set_property_selectable(bool p_selectable) {
-}
-
void EditorInspector::set_use_folding(bool p_enable) {
use_folding = p_enable;
update_tree();
diff --git a/editor/editor_inspector.h b/editor/editor_inspector.h
index ebe2124a40..dccbdb9a73 100644
--- a/editor/editor_inspector.h
+++ b/editor/editor_inspector.h
@@ -349,9 +349,6 @@ public:
void set_use_filter(bool p_use);
void register_text_enter(Node *p_line_edit);
- void set_subsection_selectable(bool p_selectable);
- void set_property_selectable(bool p_selectable);
-
void set_use_folding(bool p_enable);
bool is_using_folding();
diff --git a/editor/editor_log.cpp b/editor/editor_log.cpp
index b3ec717d85..3fc35810df 100644
--- a/editor/editor_log.cpp
+++ b/editor/editor_log.cpp
@@ -31,10 +31,10 @@
#include "editor_log.h"
#include "core/os/keyboard.h"
+#include "core/version.h"
#include "editor_node.h"
#include "scene/gui/center_container.h"
#include "scene/resources/dynamic_font.h"
-#include "version.h"
void EditorLog::_error_handler(void *p_self, const char *p_func, const char *p_file, int p_line, const char *p_error, const char *p_errorexp, ErrorHandlerType p_type) {
diff --git a/editor/editor_log.h b/editor/editor_log.h
index 8d0310d914..78a5671d29 100644
--- a/editor/editor_log.h
+++ b/editor/editor_log.h
@@ -36,7 +36,7 @@
#include "scene/gui/rich_text_label.h"
#include "scene/gui/texture_button.h"
//#include "scene/gui/empty_control.h"
-#include "os/thread.h"
+#include "core/os/thread.h"
#include "pane_drag.h"
#include "scene/gui/box_container.h"
#include "scene/gui/panel_container.h"
diff --git a/editor/editor_name_dialog.cpp b/editor/editor_name_dialog.cpp
index bacb288273..1ef61802c4 100644
--- a/editor/editor_name_dialog.cpp
+++ b/editor/editor_name_dialog.cpp
@@ -30,8 +30,8 @@
#include "editor_name_dialog.h"
-#include "class_db.h"
-#include "os/keyboard.h"
+#include "core/class_db.h"
+#include "core/os/keyboard.h"
void EditorNameDialog::_line_gui_input(const Ref<InputEvent> &p_event) {
diff --git a/editor/editor_node.cpp b/editor/editor_node.cpp
index 353dce5b20..bef754853c 100644
--- a/editor/editor_node.cpp
+++ b/editor/editor_node.cpp
@@ -1174,6 +1174,16 @@ void EditorNode::_dialog_action(String p_file) {
int scene_idx = (current_option == FILE_SAVE_SCENE || current_option == FILE_SAVE_AS_SCENE) ? -1 : tab_closing;
if (file->get_mode() == EditorFileDialog::MODE_SAVE_FILE) {
+ bool same_open_scene = false;
+ for (int i = 0; i < editor_data.get_edited_scene_count(); i++) {
+ if (editor_data.get_scene_path(i) == p_file && i != scene_idx)
+ same_open_scene = true;
+ }
+
+ if (same_open_scene) {
+ show_warning(TTR("Can't overwrite scene that is still open!"));
+ return;
+ }
_save_default_environment();
_save_scene_with_preview(p_file, scene_idx);
@@ -2068,7 +2078,7 @@ void EditorNode::_menu_option_confirm(int p_option, bool p_confirmed) {
} break;
case RUN_PROJECT_DATA_FOLDER: {
- OS::get_singleton()->shell_open(OS::get_singleton()->get_user_data_dir());
+ OS::get_singleton()->shell_open(String("file://") + OS::get_singleton()->get_user_data_dir());
} break;
case FILE_QUIT:
case RUN_PROJECT_MANAGER: {
@@ -2204,11 +2214,11 @@ void EditorNode::_menu_option_confirm(int p_option, bool p_confirmed) {
} break;
case SETTINGS_EDITOR_DATA_FOLDER: {
- OS::get_singleton()->shell_open(EditorSettings::get_singleton()->get_data_dir());
+ OS::get_singleton()->shell_open(String("file://") + EditorSettings::get_singleton()->get_data_dir());
} break;
case SETTINGS_EDITOR_CONFIG_FOLDER: {
- OS::get_singleton()->shell_open(EditorSettings::get_singleton()->get_settings_dir());
+ OS::get_singleton()->shell_open(String("file://") + EditorSettings::get_singleton()->get_settings_dir());
} break;
case SETTINGS_MANAGE_EXPORT_TEMPLATES: {
@@ -2747,6 +2757,8 @@ void EditorNode::set_current_scene(int p_idx) {
Dictionary state = editor_data.restore_edited_scene_state(editor_selection, &editor_history);
_edit_current();
+ _update_title();
+
call_deferred("_set_main_scene_state", state, get_edited_scene()); //do after everything else is done setting up
}
@@ -3577,7 +3589,7 @@ void EditorNode::_update_dock_slots_visibility() {
void EditorNode::_dock_tab_changed(int p_tab) {
- // update visibility but dont set current tab
+ // update visibility but don't set current tab
VSplitContainer *splits[DOCK_SLOT_MAX / 2] = {
left_l_vsplit,
left_r_vsplit,
@@ -4595,7 +4607,7 @@ EditorNode::EditorNode() {
Physics2DServer::get_singleton()->set_active(false); // no physics by default if editor
ScriptServer::set_scripting_enabled(false); // no scripting by default if editor
- EditorHelp::generate_doc(); //before any editor classes are crated
+ EditorHelp::generate_doc(); //before any editor classes are created
SceneState::set_disable_placeholders(true);
ResourceLoader::clear_translation_remaps(); //no remaps using during editor
ResourceLoader::clear_path_remaps();
@@ -5634,10 +5646,6 @@ EditorNode::EditorNode() {
add_editor_plugin(memnew(SkeletonIKEditorPlugin(this)));
add_editor_plugin(memnew(PhysicalBonePlugin(this)));
- // FIXME: Disabled as (according to reduz) users were complaining that it gets in the way
- // Waiting for PropertyEditor rewrite (planned for 3.1) to be refactored.
- //add_editor_plugin(memnew(MaterialEditorPlugin(this)));
-
for (int i = 0; i < EditorPlugins::get_plugin_count(); i++)
add_editor_plugin(EditorPlugins::create(i, this));
@@ -5780,7 +5788,7 @@ EditorNode::EditorNode() {
#else
ED_SHORTCUT("editor/editor_2d", TTR("Open 2D Editor"), KEY_F1);
ED_SHORTCUT("editor/editor_3d", TTR("Open 3D Editor"), KEY_F2);
- ED_SHORTCUT("editor/editor_script", TTR("Open Script Editor"), KEY_F3); //hack neded for script editor F3 search to work :) Assign like this or don't use F3
+ ED_SHORTCUT("editor/editor_script", TTR("Open Script Editor"), KEY_F3); //hack needed for script editor F3 search to work :) Assign like this or don't use F3
ED_SHORTCUT("editor/editor_help", TTR("Search Help"), KEY_F4);
#endif
ED_SHORTCUT("editor/editor_assetlib", TTR("Open Asset Library"));
diff --git a/editor/editor_plugin.h b/editor/editor_plugin.h
index 1ebddbe2b0..6c385abf9b 100644
--- a/editor/editor_plugin.h
+++ b/editor/editor_plugin.h
@@ -31,15 +31,15 @@
#ifndef EDITOR_PLUGIN_H
#define EDITOR_PLUGIN_H
+#include "core/io/config_file.h"
+#include "core/undo_redo.h"
#include "editor/editor_inspector.h"
#include "editor/import/editor_import_plugin.h"
#include "editor/import/resource_importer_scene.h"
#include "editor/script_create_dialog.h"
-#include "io/config_file.h"
#include "scene/gui/tool_button.h"
#include "scene/main/node.h"
#include "scene/resources/texture.h"
-#include "undo_redo.h"
/**
@author Juan Linietsky <reduzio@gmail.com>
diff --git a/editor/editor_plugin_settings.cpp b/editor/editor_plugin_settings.cpp
index 68f8ed6d94..ef0b61e882 100644
--- a/editor/editor_plugin_settings.cpp
+++ b/editor/editor_plugin_settings.cpp
@@ -30,11 +30,11 @@
#include "editor_plugin_settings.h"
+#include "core/io/config_file.h"
+#include "core/os/file_access.h"
+#include "core/os/main_loop.h"
+#include "core/project_settings.h"
#include "editor_node.h"
-#include "io/config_file.h"
-#include "os/file_access.h"
-#include "os/main_loop.h"
-#include "project_settings.h"
#include "scene/gui/margin_container.h"
void EditorPluginSettings::_notification(int p_what) {
diff --git a/editor/editor_plugin_settings.h b/editor/editor_plugin_settings.h
index 194fac6b92..fe14f87cfc 100644
--- a/editor/editor_plugin_settings.h
+++ b/editor/editor_plugin_settings.h
@@ -31,11 +31,11 @@
#ifndef EDITORPLUGINSETTINGS_H
#define EDITORPLUGINSETTINGS_H
+#include "core/undo_redo.h"
#include "editor/plugin_config_dialog.h"
#include "editor_data.h"
#include "property_editor.h"
#include "scene/gui/dialogs.h"
-#include "undo_redo.h"
class EditorPluginSettings : public VBoxContainer {
diff --git a/editor/editor_profiler.cpp b/editor/editor_profiler.cpp
index 223bb9df84..b57e3826c6 100644
--- a/editor/editor_profiler.cpp
+++ b/editor/editor_profiler.cpp
@@ -30,9 +30,9 @@
#include "editor_profiler.h"
+#include "core/os/os.h"
#include "editor_scale.h"
#include "editor_settings.h"
-#include "os/os.h"
void EditorProfiler::_make_metric_ptrs(Metric &m) {
diff --git a/editor/editor_properties.cpp b/editor/editor_properties.cpp
index 069b9147ce..f932aa9927 100644
--- a/editor/editor_properties.cpp
+++ b/editor/editor_properties.cpp
@@ -1905,7 +1905,7 @@ EditorPropertyNodePath::EditorPropertyNodePath() {
clear->connect("pressed", this, "_node_clear");
hbc->add_child(clear);
- scene_tree = NULL; //do not allocate unnecesarily
+ scene_tree = NULL; //do not allocate unnecessarily
}
////////////// RESOURCE //////////////////////
@@ -2670,7 +2670,7 @@ bool EditorInspectorDefaultPlugin::parse_property(Object *p_object, Variant::Typ
case PROPERTY_HINT_LAYERS_3D_PHYSICS:
lt = EditorPropertyLayers::LAYER_PHYSICS_3D;
break;
- default: {} //compiler could be smarter here and realize this cant happen
+ default: {} //compiler could be smarter here and realize this can't happen
}
EditorPropertyLayers *editor = memnew(EditorPropertyLayers);
editor->setup(lt);
@@ -2687,7 +2687,7 @@ bool EditorInspectorDefaultPlugin::parse_property(Object *p_object, Variant::Typ
bool greater = true, lesser = true;
if (p_hint == PROPERTY_HINT_RANGE && p_hint_text.get_slice_count(",") >= 2) {
- greater = false; //if using ranged, asume false by default
+ greater = false; //if using ranged, assume false by default
lesser = false;
min = p_hint_text.get_slice(",", 0).to_int();
max = p_hint_text.get_slice(",", 1).to_int();
@@ -2735,7 +2735,7 @@ bool EditorInspectorDefaultPlugin::parse_property(Object *p_object, Variant::Typ
bool greater = true, lesser = true;
if ((p_hint == PROPERTY_HINT_RANGE || p_hint == PROPERTY_HINT_EXP_RANGE) && p_hint_text.get_slice_count(",") >= 2) {
- greater = false; //if using ranged, asume false by default
+ greater = false; //if using ranged, assume false by default
lesser = false;
min = p_hint_text.get_slice(",", 0).to_double();
max = p_hint_text.get_slice(",", 1).to_double();
@@ -3068,7 +3068,7 @@ bool EditorInspectorDefaultPlugin::parse_property(Object *p_object, Variant::Typ
default: {}
}
- return false; //can be overriden, although it will most likely be last anyway
+ return false; //can be overridden, although it will most likely be last anyway
}
void EditorInspectorDefaultPlugin::parse_end() {
diff --git a/editor/editor_resource_preview.cpp b/editor/editor_resource_preview.cpp
index bc56a95b47..edfee595ea 100644
--- a/editor/editor_resource_preview.cpp
+++ b/editor/editor_resource_preview.cpp
@@ -30,13 +30,13 @@
#include "editor_resource_preview.h"
+#include "core/io/resource_loader.h"
+#include "core/io/resource_saver.h"
+#include "core/message_queue.h"
+#include "core/os/file_access.h"
+#include "core/project_settings.h"
#include "editor_scale.h"
#include "editor_settings.h"
-#include "io/resource_loader.h"
-#include "io/resource_saver.h"
-#include "message_queue.h"
-#include "os/file_access.h"
-#include "project_settings.h"
bool EditorResourcePreviewGenerator::handles(const String &p_type) const {
diff --git a/editor/editor_resource_preview.h b/editor/editor_resource_preview.h
index 74841b1a1e..434b26e901 100644
--- a/editor/editor_resource_preview.h
+++ b/editor/editor_resource_preview.h
@@ -31,8 +31,8 @@
#ifndef EDITORRESOURCEPREVIEW_H
#define EDITORRESOURCEPREVIEW_H
-#include "os/semaphore.h"
-#include "os/thread.h"
+#include "core/os/semaphore.h"
+#include "core/os/thread.h"
#include "scene/main/node.h"
#include "scene/resources/texture.h"
diff --git a/editor/editor_run.cpp b/editor/editor_run.cpp
index 62870ab35c..ad5cf49f3f 100644
--- a/editor/editor_run.cpp
+++ b/editor/editor_run.cpp
@@ -30,8 +30,8 @@
#include "editor_run.h"
+#include "core/project_settings.h"
#include "editor_settings.h"
-#include "project_settings.h"
EditorRun::Status EditorRun::get_status() const {
diff --git a/editor/editor_run.h b/editor/editor_run.h
index 8da607e6dc..df2324efd7 100644
--- a/editor/editor_run.h
+++ b/editor/editor_run.h
@@ -31,7 +31,7 @@
#ifndef EDITOR_RUN_H
#define EDITOR_RUN_H
-#include "os/os.h"
+#include "core/os/os.h"
#include "scene/main/node.h"
class EditorRun {
public:
diff --git a/editor/editor_run_script.h b/editor/editor_run_script.h
index 027fdd428d..892d5151a0 100644
--- a/editor/editor_run_script.h
+++ b/editor/editor_run_script.h
@@ -31,8 +31,8 @@
#ifndef EDITOR_RUN_SCRIPT_H
#define EDITOR_RUN_SCRIPT_H
+#include "core/reference.h"
#include "editor_plugin.h"
-#include "reference.h"
class EditorNode;
class EditorScript : public Reference {
diff --git a/editor/editor_scale.cpp b/editor/editor_scale.cpp
index 365ea95e3e..ba1607b408 100644
--- a/editor/editor_scale.cpp
+++ b/editor/editor_scale.cpp
@@ -30,7 +30,7 @@
#include "editor_scale.h"
-#include "os/os.h"
+#include "core/os/os.h"
static float scale = 1.0;
diff --git a/editor/editor_settings.h b/editor/editor_settings.h
index e5b61abf54..8165c36e67 100644
--- a/editor/editor_settings.h
+++ b/editor/editor_settings.h
@@ -31,13 +31,13 @@
#ifndef EDITOR_SETTINGS_H
#define EDITOR_SETTINGS_H
-#include "object.h"
+#include "core/object.h"
#include "core/io/config_file.h"
-#include "os/thread_safe.h"
-#include "resource.h"
+#include "core/os/thread_safe.h"
+#include "core/resource.h"
+#include "core/translation.h"
#include "scene/gui/shortcut.h"
-#include "translation.h"
class EditorPlugin;
diff --git a/editor/editor_spin_slider.cpp b/editor/editor_spin_slider.cpp
index b2c9f9865a..b6e4375ce9 100644
--- a/editor/editor_spin_slider.cpp
+++ b/editor/editor_spin_slider.cpp
@@ -29,9 +29,9 @@
/*************************************************************************/
#include "editor_spin_slider.h"
+#include "core/math/expression.h"
+#include "core/os/input.h"
#include "editor_scale.h"
-#include "math/expression.h"
-#include "os/input.h"
String EditorSpinSlider::get_tooltip(const Point2 &p_pos) const {
return rtos(get_value());
@@ -274,7 +274,7 @@ void EditorSpinSlider::_notification(int p_what) {
update();
}
if (p_what == NOTIFICATION_FOCUS_ENTER) {
- /* Sorry, I dont like this, it makes navigating the different fields with arrows more difficult.
+ /* Sorry, I don't like this, it makes navigating the different fields with arrows more difficult.
* Just press enter to edit.
* if (Input::get_singleton()->is_mouse_button_pressed(BUTTON_LEFT) && !value_input_just_closed) {
_focus_entered();
diff --git a/editor/export_template_manager.cpp b/editor/export_template_manager.cpp
index 6c9d1568fa..52611367f6 100644
--- a/editor/export_template_manager.cpp
+++ b/editor/export_template_manager.cpp
@@ -30,14 +30,14 @@
#include "export_template_manager.h"
+#include "core/io/json.h"
+#include "core/io/zip_io.h"
+#include "core/os/dir_access.h"
#include "core/os/input.h"
#include "core/os/keyboard.h"
+#include "core/version.h"
#include "editor_node.h"
#include "editor_scale.h"
-#include "io/json.h"
-#include "io/zip_io.h"
-#include "os/dir_access.h"
-#include "version.h"
void ExportTemplateManager::_update_template_list() {
diff --git a/editor/file_type_cache.cpp b/editor/file_type_cache.cpp
index 02e647b733..0e328247ac 100644
--- a/editor/file_type_cache.cpp
+++ b/editor/file_type_cache.cpp
@@ -30,8 +30,8 @@
#include "file_type_cache.h"
-#include "os/file_access.h"
-#include "project_settings.h"
+#include "core/os/file_access.h"
+#include "core/project_settings.h"
FileTypeCache *FileTypeCache::singleton = NULL;
diff --git a/editor/file_type_cache.h b/editor/file_type_cache.h
index 33b50cb1c4..aa2d78f763 100644
--- a/editor/file_type_cache.h
+++ b/editor/file_type_cache.h
@@ -31,7 +31,7 @@
#ifndef FILE_TYPE_CACHE_H
#define FILE_TYPE_CACHE_H
-#include "object.h"
+#include "core/object.h"
class FileTypeCache : Object {
diff --git a/editor/fileserver/editor_file_server.cpp b/editor/fileserver/editor_file_server.cpp
index 28b1095256..27fe716855 100644
--- a/editor/fileserver/editor_file_server.cpp
+++ b/editor/fileserver/editor_file_server.cpp
@@ -31,7 +31,7 @@
#include "editor_file_server.h"
#include "../editor_settings.h"
-#include "io/marshalls.h"
+#include "core/io/marshalls.h"
//#define DEBUG_PRINT(m_p) print_line(m_p)
//#define DEBUG_TIME(m_what) printf("MS: %s - %lu\n", m_what, OS::get_singleton()->get_ticks_usec());
@@ -330,7 +330,7 @@ void EditorFileServer::stop() {
EditorFileServer::EditorFileServer() {
- server = TCP_Server::create_ref();
+ server.instance();
wait_mutex = Mutex::create();
quit = false;
active = false;
diff --git a/editor/fileserver/editor_file_server.h b/editor/fileserver/editor_file_server.h
index d73c78ee70..8e32c3c82f 100644
--- a/editor/fileserver/editor_file_server.h
+++ b/editor/fileserver/editor_file_server.h
@@ -31,11 +31,11 @@
#ifndef EDITOR_FILE_SERVER_H
#define EDITOR_FILE_SERVER_H
-#include "io/file_access_network.h"
-#include "io/packet_peer.h"
-#include "io/tcp_server.h"
-#include "object.h"
-#include "os/thread.h"
+#include "core/io/file_access_network.h"
+#include "core/io/packet_peer.h"
+#include "core/io/tcp_server.h"
+#include "core/object.h"
+#include "core/os/thread.h"
class EditorFileServer : public Object {
diff --git a/editor/filesystem_dock.cpp b/editor/filesystem_dock.cpp
index cb38c2f85e..3a55966e7b 100644
--- a/editor/filesystem_dock.cpp
+++ b/editor/filesystem_dock.cpp
@@ -30,14 +30,14 @@
#include "filesystem_dock.h"
+#include "core/io/resource_loader.h"
+#include "core/os/dir_access.h"
+#include "core/os/file_access.h"
#include "core/os/keyboard.h"
+#include "core/os/os.h"
+#include "core/project_settings.h"
#include "editor_node.h"
#include "editor_settings.h"
-#include "io/resource_loader.h"
-#include "os/dir_access.h"
-#include "os/file_access.h"
-#include "os/os.h"
-#include "project_settings.h"
#include "scene/main/viewport.h"
bool FileSystemDock::_create_tree(TreeItem *p_parent, EditorFileSystemDirectory *p_dir, Vector<String> &uncollapsed_paths) {
diff --git a/editor/filesystem_dock.h b/editor/filesystem_dock.h
index fbbe87fc16..40be645bf7 100644
--- a/editor/filesystem_dock.h
+++ b/editor/filesystem_dock.h
@@ -44,8 +44,8 @@
#include "scene/gui/tree.h"
#include "scene/main/timer.h"
-#include "os/dir_access.h"
-#include "os/thread.h"
+#include "core/os/dir_access.h"
+#include "core/os/thread.h"
#include "create_dialog.h"
diff --git a/editor/find_in_files.cpp b/editor/find_in_files.cpp
index 9ede8a05bc..11d0b67bd6 100644
--- a/editor/find_in_files.cpp
+++ b/editor/find_in_files.cpp
@@ -864,7 +864,7 @@ void FindInFilesPanel::apply_replaces_in_file(String fpath, const Vector<Result>
// If the file is already open, I assume the editor will reload it.
// If there are unsaved changes, the user will be asked on focus,
- // however that means either loosing changes or loosing replaces.
+ // however that means either losing changes or losing replaces.
FileAccess *f = FileAccess::open(fpath, FileAccess::READ);
ERR_FAIL_COND(f == NULL);
diff --git a/editor/groups_editor.h b/editor/groups_editor.h
index 461cf0f8c2..7705b3b6fb 100644
--- a/editor/groups_editor.h
+++ b/editor/groups_editor.h
@@ -31,6 +31,7 @@
#ifndef GROUPS_EDITOR_H
#define GROUPS_EDITOR_H
+#include "core/undo_redo.h"
#include "editor/scene_tree_editor.h"
#include "scene/gui/button.h"
#include "scene/gui/dialogs.h"
@@ -39,7 +40,6 @@
#include "scene/gui/popup.h"
#include "scene/gui/tool_button.h"
#include "scene/gui/tree.h"
-#include "undo_redo.h"
/**
@author Juan Linietsky <reduzio@gmail.com>
diff --git a/editor/icons/README.md b/editor/icons/README.md
index 3a2aba5b07..5f652e47ab 100644
--- a/editor/icons/README.md
+++ b/editor/icons/README.md
@@ -9,4 +9,4 @@ There you can find the optimizer script.
If you add a new icon, please make a pull request to this repo:
https://github.com/godotengine/godot-design/
-and store the the optimized SVG version here.
+and store the optimized SVG version here.
diff --git a/editor/import/editor_import_collada.cpp b/editor/import/editor_import_collada.cpp
index d4bd4f85e6..31c1886d32 100644
--- a/editor/import/editor_import_collada.cpp
+++ b/editor/import/editor_import_collada.cpp
@@ -30,9 +30,9 @@
#include "editor_import_collada.h"
+#include "core/os/os.h"
#include "editor/collada/collada.h"
#include "editor/editor_node.h"
-#include "os/os.h"
#include "scene/3d/camera.h"
#include "scene/3d/light.h"
#include "scene/3d/mesh_instance.h"
diff --git a/editor/import/editor_import_plugin.h b/editor/import/editor_import_plugin.h
index 92d83158ef..b850c0605b 100644
--- a/editor/import/editor_import_plugin.h
+++ b/editor/import/editor_import_plugin.h
@@ -31,7 +31,7 @@
#ifndef EDITOR_IMPORT_PLUGIN_H
#define EDITOR_IMPORT_PLUGIN_H
-#include "io/resource_import.h"
+#include "core/io/resource_import.h"
class EditorImportPlugin : public ResourceImporter {
GDCLASS(EditorImportPlugin, Reference)
diff --git a/editor/import/editor_scene_importer_gltf.cpp b/editor/import/editor_scene_importer_gltf.cpp
index 3d3dc978bc..85383fd69d 100644
--- a/editor/import/editor_scene_importer_gltf.cpp
+++ b/editor/import/editor_scene_importer_gltf.cpp
@@ -29,10 +29,10 @@
/*************************************************************************/
#include "editor_scene_importer_gltf.h"
-#include "io/json.h"
-#include "math_defs.h"
-#include "os/file_access.h"
-#include "os/os.h"
+#include "core/io/json.h"
+#include "core/math/math_defs.h"
+#include "core/os/file_access.h"
+#include "core/os/os.h"
#include "scene/3d/camera.h"
#include "scene/3d/mesh_instance.h"
#include "scene/animation/animation_player.h"
@@ -1876,9 +1876,9 @@ T EditorSceneImporterGLTF::_interpolate_track(const Vector<float> &p_times, cons
float c = (p_time - p_times[idx]) / (p_times[idx + 1] - p_times[idx]);
T from = p_values[idx * 3 + 1];
- T c1 = from + p_values[idx * 3 + 0];
- T to = p_values[idx * 3 + 3];
- T c2 = to + p_values[idx * 3 + 2];
+ T c1 = from + p_values[idx * 3 + 2];
+ T to = p_values[idx * 3 + 4];
+ T c2 = to + p_values[idx * 3 + 3];
return interp.bezier(from, c1, c2, to, c);
diff --git a/editor/import/resource_importer_bitmask.cpp b/editor/import/resource_importer_bitmask.cpp
index 7b330936f6..917d6d1bcc 100644
--- a/editor/import/resource_importer_bitmask.cpp
+++ b/editor/import/resource_importer_bitmask.cpp
@@ -30,10 +30,10 @@
#include "resource_importer_bitmask.h"
#include "core/image.h"
+#include "core/io/config_file.h"
+#include "core/io/image_loader.h"
#include "editor/editor_file_system.h"
#include "editor/editor_node.h"
-#include "io/config_file.h"
-#include "io/image_loader.h"
#include "scene/resources/bit_mask.h"
#include "scene/resources/texture.h"
diff --git a/editor/import/resource_importer_bitmask.h b/editor/import/resource_importer_bitmask.h
index f3537df819..1b97152099 100644
--- a/editor/import/resource_importer_bitmask.h
+++ b/editor/import/resource_importer_bitmask.h
@@ -31,8 +31,8 @@
#ifndef RESOURCE_IMPORTER_BITMASK_H
#define RESOURCE_IMPORTER_BITMASK_H
-#include "image.h"
-#include "io/resource_import.h"
+#include "core/image.h"
+#include "core/io/resource_import.h"
class StreamBitMap;
diff --git a/editor/import/resource_importer_csv_translation.cpp b/editor/import/resource_importer_csv_translation.cpp
index cf850eef03..e7f9e1afe6 100644
--- a/editor/import/resource_importer_csv_translation.cpp
+++ b/editor/import/resource_importer_csv_translation.cpp
@@ -30,10 +30,10 @@
#include "resource_importer_csv_translation.h"
-#include "compressed_translation.h"
-#include "io/resource_saver.h"
-#include "os/file_access.h"
-#include "translation.h"
+#include "core/compressed_translation.h"
+#include "core/io/resource_saver.h"
+#include "core/os/file_access.h"
+#include "core/translation.h"
String ResourceImporterCSVTranslation::get_importer_name() const {
diff --git a/editor/import/resource_importer_csv_translation.h b/editor/import/resource_importer_csv_translation.h
index f5f230c6bd..370c182f65 100644
--- a/editor/import/resource_importer_csv_translation.h
+++ b/editor/import/resource_importer_csv_translation.h
@@ -31,7 +31,7 @@
#ifndef RESOURCEIMPORTERCSVTRANSLATION_H
#define RESOURCEIMPORTERCSVTRANSLATION_H
-#include "io/resource_import.h"
+#include "core/io/resource_import.h"
class ResourceImporterCSVTranslation : public ResourceImporter {
GDCLASS(ResourceImporterCSVTranslation, ResourceImporter)
diff --git a/editor/import/resource_importer_image.cpp b/editor/import/resource_importer_image.cpp
index e42f9eaf51..923a9a20ec 100644
--- a/editor/import/resource_importer_image.cpp
+++ b/editor/import/resource_importer_image.cpp
@@ -30,9 +30,9 @@
#include "resource_importer_image.h"
-#include "io/image_loader.h"
-#include "io/resource_saver.h"
-#include "os/file_access.h"
+#include "core/io/image_loader.h"
+#include "core/io/resource_saver.h"
+#include "core/os/file_access.h"
#include "scene/resources/texture.h"
String ResourceImporterImage::get_importer_name() const {
diff --git a/editor/import/resource_importer_image.h b/editor/import/resource_importer_image.h
index 5df1231239..d282ac482d 100644
--- a/editor/import/resource_importer_image.h
+++ b/editor/import/resource_importer_image.h
@@ -31,8 +31,8 @@
#ifndef RESOURCE_IMPORTER_IMAGE_H
#define RESOURCE_IMPORTER_IMAGE_H
-#include "image.h"
-#include "io/resource_import.h"
+#include "core/image.h"
+#include "core/io/resource_import.h"
class ResourceImporterImage : public ResourceImporter {
GDCLASS(ResourceImporterImage, ResourceImporter)
diff --git a/editor/import/resource_importer_layered_texture.cpp b/editor/import/resource_importer_layered_texture.cpp
index eeaa002f04..afda07c1c2 100644
--- a/editor/import/resource_importer_layered_texture.cpp
+++ b/editor/import/resource_importer_layered_texture.cpp
@@ -32,10 +32,10 @@
#include "resource_importer_texture.h"
+#include "core/io/config_file.h"
+#include "core/io/image_loader.h"
#include "editor/editor_file_system.h"
#include "editor/editor_node.h"
-#include "io/config_file.h"
-#include "io/image_loader.h"
#include "scene/resources/texture.h"
String ResourceImporterLayeredTexture::get_importer_name() const {
@@ -304,7 +304,7 @@ Error ResourceImporterLayeredTexture::import(const String &p_source_file, const
}
if (!ok_on_pc) {
- EditorNode::add_io_error("Warning, no suitable PC VRAM compression enabled in Project Settings. This texture will not display correcly on PC.");
+ EditorNode::add_io_error("Warning, no suitable PC VRAM compression enabled in Project Settings. This texture will not display correctly on PC.");
}
} else {
//import normally
diff --git a/editor/import/resource_importer_layered_texture.h b/editor/import/resource_importer_layered_texture.h
index d3a3b6d1ad..a4b83bf56c 100644
--- a/editor/import/resource_importer_layered_texture.h
+++ b/editor/import/resource_importer_layered_texture.h
@@ -31,8 +31,8 @@
#ifndef RESOURCE_IMPORTER_LAYERED_TEXTURE_H
#define RESOURCE_IMPORTER_LAYERED_TEXTURE_H
-#include "image.h"
-#include "io/resource_import.h"
+#include "core/image.h"
+#include "core/io/resource_import.h"
class StreamTexture;
diff --git a/editor/import/resource_importer_obj.cpp b/editor/import/resource_importer_obj.cpp
index 3f101cd04d..b18bbc8ce9 100644
--- a/editor/import/resource_importer_obj.cpp
+++ b/editor/import/resource_importer_obj.cpp
@@ -30,8 +30,8 @@
#include "resource_importer_obj.h"
-#include "io/resource_saver.h"
-#include "os/file_access.h"
+#include "core/io/resource_saver.h"
+#include "core/os/file_access.h"
#include "scene/3d/mesh_instance.h"
#include "scene/3d/spatial.h"
#include "scene/resources/mesh.h"
diff --git a/editor/import/resource_importer_scene.cpp b/editor/import/resource_importer_scene.cpp
index f544811eb0..6d72cb4909 100644
--- a/editor/import/resource_importer_scene.cpp
+++ b/editor/import/resource_importer_scene.cpp
@@ -30,8 +30,8 @@
#include "resource_importer_scene.h"
+#include "core/io/resource_saver.h"
#include "editor/editor_node.h"
-#include "io/resource_saver.h"
#include "scene/resources/packed_scene.h"
#include "scene/3d/collision_shape.h"
diff --git a/editor/import/resource_importer_scene.h b/editor/import/resource_importer_scene.h
index 2bde9432fc..b046e2e975 100644
--- a/editor/import/resource_importer_scene.h
+++ b/editor/import/resource_importer_scene.h
@@ -31,7 +31,7 @@
#ifndef RESOURCEIMPORTERSCENE_H
#define RESOURCEIMPORTERSCENE_H
-#include "io/resource_import.h"
+#include "core/io/resource_import.h"
#include "scene/resources/animation.h"
#include "scene/resources/mesh.h"
#include "scene/resources/shape.h"
diff --git a/editor/import/resource_importer_texture.cpp b/editor/import/resource_importer_texture.cpp
index af2615f9cf..5eb1a42f9f 100644
--- a/editor/import/resource_importer_texture.cpp
+++ b/editor/import/resource_importer_texture.cpp
@@ -30,10 +30,10 @@
#include "resource_importer_texture.h"
+#include "core/io/config_file.h"
+#include "core/io/image_loader.h"
#include "editor/editor_file_system.h"
#include "editor/editor_node.h"
-#include "io/config_file.h"
-#include "io/image_loader.h"
#include "scene/resources/texture.h"
void ResourceImporterTexture::_texture_reimport_srgb(const Ref<StreamTexture> &p_tex) {
@@ -499,7 +499,7 @@ Error ResourceImporterTexture::import(const String &p_source_file, const String
}
if (!ok_on_pc) {
- EditorNode::add_io_error("Warning, no suitable PC VRAM compression enabled in Project Settings. This texture will not display correcly on PC.");
+ EditorNode::add_io_error("Warning, no suitable PC VRAM compression enabled in Project Settings. This texture will not display correctly on PC.");
}
} else {
//import normally
diff --git a/editor/import/resource_importer_texture.h b/editor/import/resource_importer_texture.h
index fd6f75c3f4..b49b29874d 100644
--- a/editor/import/resource_importer_texture.h
+++ b/editor/import/resource_importer_texture.h
@@ -31,8 +31,8 @@
#ifndef RESOURCEIMPORTTEXTURE_H
#define RESOURCEIMPORTTEXTURE_H
-#include "image.h"
-#include "io/resource_import.h"
+#include "core/image.h"
+#include "core/io/resource_import.h"
class StreamTexture;
diff --git a/editor/import/resource_importer_wav.cpp b/editor/import/resource_importer_wav.cpp
index d04f29ea5e..55f4cc7439 100644
--- a/editor/import/resource_importer_wav.cpp
+++ b/editor/import/resource_importer_wav.cpp
@@ -30,9 +30,9 @@
#include "resource_importer_wav.h"
-#include "io/marshalls.h"
-#include "io/resource_saver.h"
-#include "os/file_access.h"
+#include "core/io/marshalls.h"
+#include "core/io/resource_saver.h"
+#include "core/os/file_access.h"
#include "scene/resources/audio_stream_sample.h"
String ResourceImporterWAV::get_importer_name() const {
diff --git a/editor/import/resource_importer_wav.h b/editor/import/resource_importer_wav.h
index f78ab09e9b..a630ff732e 100644
--- a/editor/import/resource_importer_wav.h
+++ b/editor/import/resource_importer_wav.h
@@ -31,7 +31,7 @@
#ifndef RESOURCEIMPORTWAV_H
#define RESOURCEIMPORTWAV_H
-#include "io/resource_import.h"
+#include "core/io/resource_import.h"
class ResourceImporterWAV : public ResourceImporter {
GDCLASS(ResourceImporterWAV, ResourceImporter)
diff --git a/editor/inspector_dock.cpp b/editor/inspector_dock.cpp
index 9145a66510..7aad973a96 100644
--- a/editor/inspector_dock.cpp
+++ b/editor/inspector_dock.cpp
@@ -405,8 +405,8 @@ void InspectorDock::update(Object *p_object) {
PopupMenu *p = object_menu->get_popup();
p->clear();
- p->add_shortcut(ED_SHORTCUT("property_editor/expand_all", TTR("Expand all properties")), EXPAND_ALL);
- p->add_shortcut(ED_SHORTCUT("property_editor/collapse_all", TTR("Collapse all properties")), COLLAPSE_ALL);
+ p->add_shortcut(ED_SHORTCUT("property_editor/expand_all", TTR("Expand All Properties")), EXPAND_ALL);
+ p->add_shortcut(ED_SHORTCUT("property_editor/collapse_all", TTR("Collapse All Properties")), COLLAPSE_ALL);
p->add_separator();
if (is_resource) {
p->add_item(TTR("Save"), RESOURCE_SAVE);
diff --git a/editor/output_strings.h b/editor/output_strings.h
index 0729971704..4833f2067e 100644
--- a/editor/output_strings.h
+++ b/editor/output_strings.h
@@ -31,7 +31,7 @@
#ifndef OUTPUT_STRINGS_H
#define OUTPUT_STRINGS_H
-#include "map.h"
+#include "core/map.h"
#include "scene/gui/control.h"
#include "scene/gui/scroll_bar.h"
diff --git a/editor/plugins/animation_blend_space_1d_editor.cpp b/editor/plugins/animation_blend_space_1d_editor.cpp
index 10c19d8173..4b1e710705 100644
--- a/editor/plugins/animation_blend_space_1d_editor.cpp
+++ b/editor/plugins/animation_blend_space_1d_editor.cpp
@@ -30,7 +30,7 @@
#include "animation_blend_space_1d_editor.h"
-#include "os/keyboard.h"
+#include "core/os/keyboard.h"
#include "scene/animation/animation_blend_tree.h"
StringName AnimationNodeBlendSpace1DEditor::get_blend_position_path() const {
diff --git a/editor/plugins/animation_blend_space_2d_editor.cpp b/editor/plugins/animation_blend_space_2d_editor.cpp
index 6dbba2ba80..c4f8cdc3d7 100644
--- a/editor/plugins/animation_blend_space_2d_editor.cpp
+++ b/editor/plugins/animation_blend_space_2d_editor.cpp
@@ -31,10 +31,10 @@
#include "animation_blend_space_2d_editor.h"
#include "core/io/resource_loader.h"
+#include "core/math/delaunay.h"
+#include "core/os/input.h"
+#include "core/os/keyboard.h"
#include "core/project_settings.h"
-#include "math/delaunay.h"
-#include "os/input.h"
-#include "os/keyboard.h"
#include "scene/animation/animation_blend_tree.h"
#include "scene/animation/animation_player.h"
#include "scene/gui/menu_button.h"
diff --git a/editor/plugins/animation_blend_tree_editor_plugin.cpp b/editor/plugins/animation_blend_tree_editor_plugin.cpp
index 66142a1e05..abf703cfd4 100644
--- a/editor/plugins/animation_blend_tree_editor_plugin.cpp
+++ b/editor/plugins/animation_blend_tree_editor_plugin.cpp
@@ -31,10 +31,10 @@
#include "animation_blend_tree_editor_plugin.h"
#include "core/io/resource_loader.h"
+#include "core/os/input.h"
+#include "core/os/keyboard.h"
#include "core/project_settings.h"
#include "editor/editor_inspector.h"
-#include "os/input.h"
-#include "os/keyboard.h"
#include "scene/animation/animation_player.h"
#include "scene/gui/menu_button.h"
#include "scene/gui/panel.h"
@@ -241,7 +241,7 @@ void AnimationNodeBlendTreeEditor::_update_graph() {
mb->get_popup()->connect("index_pressed", this, "_anim_selected", varray(options, E->get()), CONNECT_DEFERRED);
}
- /* should be no longer necesary, as the boolean works
+ /* should be no longer necessary, as the boolean works
Ref<AnimationNodeOneShot> oneshot = agnode;
if (oneshot.is_valid()) {
@@ -559,7 +559,7 @@ bool AnimationNodeBlendTreeEditor::_update_filters(const Ref<AnimationNode> &ano
node = base->get_node(accum);
}
if (!node)
- continue; //no node, cant edit
+ continue; //no node, can't edit
if (path.get_subname_count()) {
diff --git a/editor/plugins/animation_player_editor_plugin.cpp b/editor/plugins/animation_player_editor_plugin.cpp
index 9ab5436de8..bf7603bd86 100644
--- a/editor/plugins/animation_player_editor_plugin.cpp
+++ b/editor/plugins/animation_player_editor_plugin.cpp
@@ -30,12 +30,12 @@
#include "animation_player_editor_plugin.h"
+#include "core/io/resource_loader.h"
+#include "core/io/resource_saver.h"
+#include "core/os/keyboard.h"
+#include "core/project_settings.h"
#include "editor/animation_track_editor.h"
#include "editor/editor_settings.h"
-#include "io/resource_loader.h"
-#include "io/resource_saver.h"
-#include "os/keyboard.h"
-#include "project_settings.h"
// For onion skinning
#include "editor/plugins/canvas_item_editor_plugin.h"
@@ -1515,7 +1515,7 @@ void AnimationPlayerEditor::_prepare_onion_layers_2() {
void AnimationPlayerEditor::_start_onion_skinning() {
- // FIXME: Using "idle_frame" makes onion layers update one frame behing the current
+ // FIXME: Using "idle_frame" makes onion layers update one frame behind the current
if (!get_tree()->is_connected("idle_frame", this, "call_deferred")) {
get_tree()->connect("idle_frame", this, "call_deferred", varray("_prepare_onion_layers_1"));
}
diff --git a/editor/plugins/animation_state_machine_editor.cpp b/editor/plugins/animation_state_machine_editor.cpp
index 0788921910..e83773257b 100644
--- a/editor/plugins/animation_state_machine_editor.cpp
+++ b/editor/plugins/animation_state_machine_editor.cpp
@@ -31,10 +31,10 @@
#include "animation_state_machine_editor.h"
#include "core/io/resource_loader.h"
+#include "core/math/delaunay.h"
+#include "core/os/input.h"
+#include "core/os/keyboard.h"
#include "core/project_settings.h"
-#include "math/delaunay.h"
-#include "os/input.h"
-#include "os/keyboard.h"
#include "scene/animation/animation_blend_tree.h"
#include "scene/animation/animation_player.h"
#include "scene/gui/menu_button.h"
@@ -663,7 +663,7 @@ void AnimationNodeStateMachineEditor::_state_machine_draw() {
transition_lines.clear();
- //draw conecting line for potential new transition
+ //draw connecting line for potential new transition
if (connecting) {
Vector2 from = (state_machine->get_node_position(connecting_from) * EDSCALE) - state_machine->get_graph_offset() * EDSCALE;
Vector2 to;
diff --git a/editor/plugins/animation_tree_editor_plugin.cpp b/editor/plugins/animation_tree_editor_plugin.cpp
index 90e5adc680..24787a78e9 100644
--- a/editor/plugins/animation_tree_editor_plugin.cpp
+++ b/editor/plugins/animation_tree_editor_plugin.cpp
@@ -35,10 +35,10 @@
#include "animation_blend_tree_editor_plugin.h"
#include "animation_state_machine_editor.h"
#include "core/io/resource_loader.h"
+#include "core/math/delaunay.h"
+#include "core/os/input.h"
+#include "core/os/keyboard.h"
#include "core/project_settings.h"
-#include "math/delaunay.h"
-#include "os/input.h"
-#include "os/keyboard.h"
#include "scene/animation/animation_blend_tree.h"
#include "scene/animation/animation_player.h"
#include "scene/gui/menu_button.h"
diff --git a/editor/plugins/animation_tree_player_editor_plugin.cpp b/editor/plugins/animation_tree_player_editor_plugin.cpp
index 36d10ab99e..c79e3a436d 100644
--- a/editor/plugins/animation_tree_player_editor_plugin.cpp
+++ b/editor/plugins/animation_tree_player_editor_plugin.cpp
@@ -31,9 +31,9 @@
#include "animation_tree_player_editor_plugin.h"
#include "core/io/resource_loader.h"
+#include "core/os/input.h"
+#include "core/os/keyboard.h"
#include "core/project_settings.h"
-#include "os/input.h"
-#include "os/keyboard.h"
#include "scene/gui/menu_button.h"
#include "scene/gui/panel.h"
#include "scene/main/viewport.h"
diff --git a/editor/plugins/audio_stream_editor_plugin.cpp b/editor/plugins/audio_stream_editor_plugin.cpp
index 454a5d72f2..06ca5833e2 100644
--- a/editor/plugins/audio_stream_editor_plugin.cpp
+++ b/editor/plugins/audio_stream_editor_plugin.cpp
@@ -30,9 +30,9 @@
#include "audio_stream_editor_plugin.h"
+#include "core/io/resource_loader.h"
+#include "core/project_settings.h"
#include "editor/editor_settings.h"
-#include "io/resource_loader.h"
-#include "project_settings.h"
void AudioStreamEditor::_notification(int p_what) {
diff --git a/editor/plugins/canvas_item_editor_plugin.cpp b/editor/plugins/canvas_item_editor_plugin.cpp
index 72248b62a3..eae3775e6b 100644
--- a/editor/plugins/canvas_item_editor_plugin.cpp
+++ b/editor/plugins/canvas_item_editor_plugin.cpp
@@ -30,15 +30,15 @@
#include "canvas_item_editor_plugin.h"
+#include "core/os/input.h"
+#include "core/os/keyboard.h"
+#include "core/print_string.h"
+#include "core/project_settings.h"
#include "editor/editor_node.h"
#include "editor/editor_settings.h"
#include "editor/plugins/animation_player_editor_plugin.h"
#include "editor/plugins/script_editor_plugin.h"
#include "editor/script_editor_debugger.h"
-#include "os/input.h"
-#include "os/keyboard.h"
-#include "print_string.h"
-#include "project_settings.h"
#include "scene/2d/light_2d.h"
#include "scene/2d/particles_2d.h"
#include "scene/2d/polygon_2d.h"
@@ -55,6 +55,7 @@
#define MAX_ZOOM 100
#define RULER_WIDTH 15 * EDSCALE
+#define SCALE_HANDLE_DISTANCE 25
class SnapDialog : public ConfirmationDialog {
@@ -335,10 +336,11 @@ void CanvasItemEditor::_unhandled_key_input(const Ref<InputEvent> &p_ev) {
if (!is_visible_in_tree() || get_viewport()->gui_has_modal_stack())
return;
- if (k->get_control())
- return;
+ if (k->get_scancode() == KEY_CONTROL || k->get_scancode() == KEY_ALT || k->get_scancode() == KEY_SHIFT) {
+ viewport->update();
+ }
- if (k->is_pressed() && !k->is_echo()) {
+ if (k->is_pressed() && !k->get_control() && !k->is_echo()) {
if ((snap_grid || show_grid) && multiply_grid_step_shortcut.is_valid() && multiply_grid_step_shortcut->is_shortcut(p_ev)) {
// Multiply the grid size
grid_step_multiplier = MIN(grid_step_multiplier + 1, 12);
@@ -667,7 +669,7 @@ List<CanvasItem *> CanvasItemEditor::_get_edited_canvas_items(bool retreive_lock
List<CanvasItem *> selection;
for (Map<Node *, Object *>::Element *E = editor_selection->get_selection().front(); E; E = E->next()) {
CanvasItem *canvas_item = Object::cast_to<CanvasItem>(E->key());
- if (canvas_item && canvas_item->is_visible_in_tree() && canvas_item->get_viewport() == EditorNode::get_singleton()->get_scene_root() && (!retreive_locked || !canvas_item->has_meta("_edit_lock_"))) {
+ if (canvas_item && canvas_item->is_visible_in_tree() && canvas_item->get_viewport() == EditorNode::get_singleton()->get_scene_root() && (retreive_locked || !canvas_item->has_meta("_edit_lock_"))) {
CanvasItemEditorSelectedItem *se = editor_selection->get_node_editor_data<CanvasItemEditorSelectedItem>(canvas_item);
if (se) {
selection.push_back(canvas_item);
@@ -1267,7 +1269,7 @@ bool CanvasItemEditor::_gui_input_rotate(const Ref<InputEvent> &p_event) {
if (drag_type == DRAG_NONE) {
if (b.is_valid() && b->get_button_index() == BUTTON_LEFT && b->is_pressed()) {
drag_selection = _get_edited_canvas_items();
- if (drag_selection.size() > 0 && ((b->get_control() && tool == TOOL_SELECT) || tool == TOOL_ROTATE)) {
+ if (drag_selection.size() > 0 && ((b->get_control() && !b->get_alt() && tool == TOOL_SELECT) || tool == TOOL_ROTATE)) {
drag_type = DRAG_ROTATE;
drag_from = transform.affine_inverse().xform(b->get_position());
CanvasItem *canvas_item = drag_selection[0];
@@ -1615,6 +1617,89 @@ bool CanvasItemEditor::_gui_input_resize(const Ref<InputEvent> &p_event) {
return false;
}
+bool CanvasItemEditor::_gui_input_scale(const Ref<InputEvent> &p_event) {
+
+ Ref<InputEventMouseButton> b = p_event;
+ Ref<InputEventMouseMotion> m = p_event;
+
+ // Drag resize handles
+ if (drag_type == DRAG_NONE) {
+ if (b.is_valid() && b->get_button_index() == BUTTON_LEFT && b->is_pressed() && ((b->get_alt() && b->get_control()) || tool == TOOL_SCALE)) {
+ List<CanvasItem *> selection = _get_edited_canvas_items();
+ if (selection.size() == 1) {
+ CanvasItem *canvas_item = selection[0];
+
+ Transform2D xform = transform * canvas_item->get_global_transform_with_canvas();
+ Transform2D unscaled_transform = (xform * canvas_item->get_transform().affine_inverse() * Transform2D(canvas_item->_edit_get_rotation(), canvas_item->_edit_get_position())).orthonormalized();
+ Transform2D simple_xform = viewport->get_transform() * unscaled_transform;
+
+ Size2 scale_factor = Size2(SCALE_HANDLE_DISTANCE, SCALE_HANDLE_DISTANCE);
+ Rect2 x_handle_rect = Rect2(scale_factor.x * EDSCALE, -5 * EDSCALE, 10 * EDSCALE, 10 * EDSCALE);
+ if (x_handle_rect.has_point(simple_xform.affine_inverse().xform(b->get_position()))) {
+ drag_type = DRAG_SCALE_X;
+ }
+ Rect2 y_handle_rect = Rect2(-5 * EDSCALE, -(scale_factor.y + 10) * EDSCALE, 10 * EDSCALE, 10 * EDSCALE);
+ if (y_handle_rect.has_point(simple_xform.affine_inverse().xform(b->get_position()))) {
+ drag_type = DRAG_SCALE_Y;
+ }
+ if (drag_type == DRAG_SCALE_X || drag_type == DRAG_SCALE_Y) {
+ drag_from = transform.affine_inverse().xform(b->get_position());
+ drag_selection = List<CanvasItem *>();
+ drag_selection.push_back(canvas_item);
+ _save_canvas_item_state(drag_selection);
+ return true;
+ }
+ }
+ }
+ }
+
+ if (drag_type == DRAG_SCALE_X || drag_type == DRAG_SCALE_Y) {
+ // Resize the node
+ if (m.is_valid()) {
+ _restore_canvas_item_state(drag_selection, true);
+ CanvasItem *canvas_item = drag_selection[0];
+
+ drag_to = transform.affine_inverse().xform(m->get_position());
+
+ bool uniform = m->get_shift();
+ Point2 offset = drag_to - drag_from;
+ Size2 scale = canvas_item->call("get_scale");
+ float ratio = scale.y / scale.x;
+ if (drag_type == DRAG_SCALE_X) {
+ scale.x += offset.x / SCALE_HANDLE_DISTANCE;
+ if (uniform) {
+ scale.y = scale.x * ratio;
+ }
+ canvas_item->call("set_scale", scale);
+
+ } else if (drag_type == DRAG_SCALE_Y) {
+ scale.y -= offset.y / SCALE_HANDLE_DISTANCE;
+ if (uniform) {
+ scale.x = scale.y / ratio;
+ }
+ canvas_item->call("set_scale", scale);
+ }
+ }
+
+ // Confirm resize
+ if (b.is_valid() && b->get_button_index() == BUTTON_LEFT && !b->is_pressed()) {
+ _commit_canvas_item_state(drag_selection, TTR("Scale CanvasItem"));
+ drag_type = DRAG_NONE;
+ viewport->update();
+ return true;
+ }
+
+ // Cancel a drag
+ if (b.is_valid() && b->get_button_index() == BUTTON_RIGHT && b->is_pressed()) {
+ _restore_canvas_item_state(drag_selection);
+ drag_type = DRAG_NONE;
+ viewport->update();
+ return true;
+ }
+ }
+ return false;
+}
+
bool CanvasItemEditor::_gui_input_move(const Ref<InputEvent> &p_event) {
Ref<InputEventMouseButton> b = p_event;
Ref<InputEventMouseMotion> m = p_event;
@@ -1624,8 +1709,8 @@ bool CanvasItemEditor::_gui_input_move(const Ref<InputEvent> &p_event) {
//Start moving the nodes
if (b.is_valid() && b->get_button_index() == BUTTON_LEFT && b->is_pressed()) {
List<CanvasItem *> selection = _get_edited_canvas_items();
- if ((b->get_alt() || tool == TOOL_MOVE) && selection.size() > 0) {
- drag_type = DRAG_ALL;
+ if (((b->get_alt() && !b->get_control()) || tool == TOOL_MOVE) && selection.size() > 0) {
+ drag_type = DRAG_MOVE;
drag_from = transform.affine_inverse().xform(b->get_position());
drag_selection = selection;
_save_canvas_item_state(drag_selection);
@@ -1634,7 +1719,7 @@ bool CanvasItemEditor::_gui_input_move(const Ref<InputEvent> &p_event) {
}
}
- if (drag_type == DRAG_ALL) {
+ if (drag_type == DRAG_MOVE) {
// Move the nodes
if (m.is_valid()) {
_restore_canvas_item_state(drag_selection, true);
@@ -1674,7 +1759,7 @@ bool CanvasItemEditor::_gui_input_move(const Ref<InputEvent> &p_event) {
}
// Confirm the move (only if it was moved)
- if (b.is_valid() && !b->is_pressed() && b->get_button_index() == BUTTON_LEFT && (drag_type == DRAG_ALL)) {
+ if (b.is_valid() && !b->is_pressed() && b->get_button_index() == BUTTON_LEFT && (drag_type == DRAG_MOVE)) {
if (transform.affine_inverse().xform(b->get_position()) != drag_from) {
_commit_canvas_item_state(drag_selection, TTR("Move CanvasItem"), true);
}
@@ -1858,22 +1943,9 @@ bool CanvasItemEditor::_gui_input_select(const Ref<InputEvent> &p_event) {
// Retrieve the bones
_get_bones_at_pos(click, selection);
- for (int i = 0; i < selection.size(); i++) {
- if (editor_selection->is_selected(selection[i].item)) {
- // Drag the node(s) if requested
- List<CanvasItem *> selection = _get_edited_canvas_items();
-
- drag_type = DRAG_ALL;
- drag_selection = selection;
- drag_from = click;
- _save_canvas_item_state(drag_selection);
-
- return true;
- }
- }
-
- if (!selection.empty())
+ if (!selection.empty()) {
canvas_item = selection[0].item;
+ }
if (!canvas_item) {
// Start a box selection
@@ -1894,7 +1966,7 @@ bool CanvasItemEditor::_gui_input_select(const Ref<InputEvent> &p_event) {
// Drag the node(s) if requested
List<CanvasItem *> selection = _get_edited_canvas_items();
- drag_type = DRAG_ALL;
+ drag_type = DRAG_MOVE;
drag_selection = selection;
drag_from = click;
_save_canvas_item_state(drag_selection);
@@ -2019,6 +2091,8 @@ void CanvasItemEditor::_gui_input_viewport(const Ref<InputEvent> &p_event) {
//printf("Open scene on double click\n");
} else if ((accepted = _gui_input_anchors(p_event))) {
//printf("Anchors\n");
+ } else if ((accepted = _gui_input_scale(p_event))) {
+ //printf("Set scale\n");
} else if ((accepted = _gui_input_pivot(p_event))) {
//printf("Set pivot\n");
} else if ((accepted = _gui_input_resize(p_event))) {
@@ -2073,7 +2147,7 @@ void CanvasItemEditor::_gui_input_viewport(const Ref<InputEvent> &p_event) {
case DRAG_BOTTOM_LEFT:
c = CURSOR_BDIAGSIZE;
break;
- case DRAG_ALL:
+ case DRAG_MOVE:
c = CURSOR_MOVE;
break;
case DRAG_PAN:
@@ -2301,6 +2375,188 @@ void CanvasItemEditor::_draw_grid() {
}
}
+void CanvasItemEditor::_draw_control_helpers(Control *control) {
+ Transform2D xform = transform * control->get_global_transform_with_canvas();
+ RID ci = viewport->get_canvas_item();
+ if (tool == TOOL_SELECT && show_helpers && !Object::cast_to<Container>(control->get_parent())) {
+ // Draw the helpers
+ Color color_base = Color(0.8, 0.8, 0.8, 0.5);
+
+ float anchors_values[4];
+ anchors_values[0] = control->get_anchor(MARGIN_LEFT);
+ anchors_values[1] = control->get_anchor(MARGIN_TOP);
+ anchors_values[2] = control->get_anchor(MARGIN_RIGHT);
+ anchors_values[3] = control->get_anchor(MARGIN_BOTTOM);
+
+ // Draw the anchors
+ Vector2 anchors[4];
+ Vector2 anchors_pos[4];
+ for (int i = 0; i < 4; i++) {
+ anchors[i] = Vector2((i % 2 == 0) ? anchors_values[i] : anchors_values[(i + 1) % 4], (i % 2 == 1) ? anchors_values[i] : anchors_values[(i + 1) % 4]);
+ anchors_pos[i] = xform.xform(_anchor_to_position(control, anchors[i]));
+ }
+
+ // Get which anchor is dragged
+ int dragged_anchor = -1;
+ switch (drag_type) {
+ case DRAG_ANCHOR_ALL:
+ case DRAG_ANCHOR_TOP_LEFT:
+ dragged_anchor = 0;
+ break;
+ case DRAG_ANCHOR_TOP_RIGHT:
+ dragged_anchor = 1;
+ break;
+ case DRAG_ANCHOR_BOTTOM_RIGHT:
+ dragged_anchor = 2;
+ break;
+ case DRAG_ANCHOR_BOTTOM_LEFT:
+ dragged_anchor = 3;
+ break;
+ default:
+ break;
+ }
+
+ if (dragged_anchor >= 0) {
+ // Draw the 4 lines when dragged
+ bool snapped;
+ Color color_snapped = Color(0.64, 0.93, 0.67, 0.5);
+
+ Vector2 corners_pos[4];
+ for (int i = 0; i < 4; i++) {
+ corners_pos[i] = xform.xform(_anchor_to_position(control, Vector2((i == 0 || i == 3) ? ANCHOR_BEGIN : ANCHOR_END, (i <= 1) ? ANCHOR_BEGIN : ANCHOR_END)));
+ }
+
+ Vector2 line_starts[4];
+ Vector2 line_ends[4];
+ for (int i = 0; i < 4; i++) {
+ float anchor_val = (i >= 2) ? ANCHOR_END - anchors_values[i] : anchors_values[i];
+ line_starts[i] = Vector2::linear_interpolate(corners_pos[i], corners_pos[(i + 1) % 4], anchor_val);
+ line_ends[i] = Vector2::linear_interpolate(corners_pos[(i + 3) % 4], corners_pos[(i + 2) % 4], anchor_val);
+ snapped = anchors_values[i] == 0.0 || anchors_values[i] == 0.5 || anchors_values[i] == 1.0;
+ viewport->draw_line(line_starts[i], line_ends[i], snapped ? color_snapped : color_base, (i == dragged_anchor || (i + 3) % 4 == dragged_anchor) ? 2 : 1);
+ }
+
+ // Display the percentages next to the lines
+ float percent_val;
+ percent_val = anchors_values[(dragged_anchor + 2) % 4] - anchors_values[dragged_anchor];
+ percent_val = (dragged_anchor >= 2) ? -percent_val : percent_val;
+ _draw_percentage_at_position(percent_val, (anchors_pos[dragged_anchor] + anchors_pos[(dragged_anchor + 1) % 4]) / 2, (Margin)((dragged_anchor + 1) % 4));
+
+ percent_val = anchors_values[(dragged_anchor + 3) % 4] - anchors_values[(dragged_anchor + 1) % 4];
+ percent_val = ((dragged_anchor + 1) % 4 >= 2) ? -percent_val : percent_val;
+ _draw_percentage_at_position(percent_val, (anchors_pos[dragged_anchor] + anchors_pos[(dragged_anchor + 3) % 4]) / 2, (Margin)(dragged_anchor));
+
+ percent_val = anchors_values[(dragged_anchor + 1) % 4];
+ percent_val = ((dragged_anchor + 1) % 4 >= 2) ? ANCHOR_END - percent_val : percent_val;
+ _draw_percentage_at_position(percent_val, (line_starts[dragged_anchor] + anchors_pos[dragged_anchor]) / 2, (Margin)(dragged_anchor));
+
+ percent_val = anchors_values[dragged_anchor];
+ percent_val = (dragged_anchor >= 2) ? ANCHOR_END - percent_val : percent_val;
+ _draw_percentage_at_position(percent_val, (line_ends[(dragged_anchor + 1) % 4] + anchors_pos[dragged_anchor]) / 2, (Margin)((dragged_anchor + 1) % 4));
+ }
+
+ Rect2 anchor_rects[4];
+ anchor_rects[0] = Rect2(anchors_pos[0] - anchor_handle->get_size(), anchor_handle->get_size());
+ anchor_rects[1] = Rect2(anchors_pos[1] - Vector2(0.0, anchor_handle->get_size().y), Point2(-anchor_handle->get_size().x, anchor_handle->get_size().y));
+ anchor_rects[2] = Rect2(anchors_pos[2], -anchor_handle->get_size());
+ anchor_rects[3] = Rect2(anchors_pos[3] - Vector2(anchor_handle->get_size().x, 0.0), Point2(anchor_handle->get_size().x, -anchor_handle->get_size().y));
+
+ for (int i = 0; i < 4; i++) {
+ anchor_handle->draw_rect(ci, anchor_rects[i]);
+ }
+
+ // Draw the margin values and the node width/height when dragging control side
+ float ratio = 0.33;
+ Transform2D parent_transform = xform * control->get_transform().affine_inverse();
+ float node_pos_in_parent[4];
+
+ Rect2 parent_rect = control->get_parent_anchorable_rect();
+
+ node_pos_in_parent[0] = control->get_anchor(MARGIN_LEFT) * parent_rect.size.width + control->get_margin(MARGIN_LEFT) + parent_rect.position.x;
+ node_pos_in_parent[1] = control->get_anchor(MARGIN_TOP) * parent_rect.size.height + control->get_margin(MARGIN_TOP) + parent_rect.position.y;
+ node_pos_in_parent[2] = control->get_anchor(MARGIN_RIGHT) * parent_rect.size.width + control->get_margin(MARGIN_RIGHT) + parent_rect.position.x;
+ node_pos_in_parent[3] = control->get_anchor(MARGIN_BOTTOM) * parent_rect.size.height + control->get_margin(MARGIN_BOTTOM) + parent_rect.position.y;
+
+ Point2 start, end;
+ switch (drag_type) {
+ case DRAG_LEFT:
+ case DRAG_TOP_LEFT:
+ case DRAG_BOTTOM_LEFT:
+ _draw_margin_at_position(control->get_size().width, parent_transform.xform(Vector2((node_pos_in_parent[0] + node_pos_in_parent[2]) / 2, node_pos_in_parent[3])) + Vector2(0, 5), MARGIN_BOTTOM);
+ case DRAG_MOVE:
+ start = Vector2(node_pos_in_parent[0], Math::lerp(node_pos_in_parent[1], node_pos_in_parent[3], ratio));
+ end = start - Vector2(control->get_margin(MARGIN_LEFT), 0);
+ _draw_margin_at_position(control->get_margin(MARGIN_LEFT), parent_transform.xform((start + end) / 2), MARGIN_TOP);
+ viewport->draw_line(parent_transform.xform(start), parent_transform.xform(end), color_base, 1);
+ break;
+ default:
+ break;
+ }
+ switch (drag_type) {
+ case DRAG_RIGHT:
+ case DRAG_TOP_RIGHT:
+ case DRAG_BOTTOM_RIGHT:
+ _draw_margin_at_position(control->get_size().width, parent_transform.xform(Vector2((node_pos_in_parent[0] + node_pos_in_parent[2]) / 2, node_pos_in_parent[3])) + Vector2(0, 5), MARGIN_BOTTOM);
+ case DRAG_MOVE:
+ start = Vector2(node_pos_in_parent[2], Math::lerp(node_pos_in_parent[3], node_pos_in_parent[1], ratio));
+ end = start - Vector2(control->get_margin(MARGIN_RIGHT), 0);
+ _draw_margin_at_position(control->get_margin(MARGIN_RIGHT), parent_transform.xform((start + end) / 2), MARGIN_BOTTOM);
+ viewport->draw_line(parent_transform.xform(start), parent_transform.xform(end), color_base, 1);
+ break;
+ default:
+ break;
+ }
+ switch (drag_type) {
+ case DRAG_TOP:
+ case DRAG_TOP_LEFT:
+ case DRAG_TOP_RIGHT:
+ _draw_margin_at_position(control->get_size().height, parent_transform.xform(Vector2(node_pos_in_parent[2], (node_pos_in_parent[1] + node_pos_in_parent[3]) / 2)) + Vector2(5, 0), MARGIN_RIGHT);
+ case DRAG_MOVE:
+ start = Vector2(Math::lerp(node_pos_in_parent[0], node_pos_in_parent[2], ratio), node_pos_in_parent[1]);
+ end = start - Vector2(0, control->get_margin(MARGIN_TOP));
+ _draw_margin_at_position(control->get_margin(MARGIN_TOP), parent_transform.xform((start + end) / 2), MARGIN_LEFT);
+ viewport->draw_line(parent_transform.xform(start), parent_transform.xform(end), color_base, 1);
+ break;
+ default:
+ break;
+ }
+ switch (drag_type) {
+ case DRAG_BOTTOM:
+ case DRAG_BOTTOM_LEFT:
+ case DRAG_BOTTOM_RIGHT:
+ _draw_margin_at_position(control->get_size().height, parent_transform.xform(Vector2(node_pos_in_parent[2], (node_pos_in_parent[1] + node_pos_in_parent[3]) / 2) + Vector2(5, 0)), MARGIN_RIGHT);
+ case DRAG_MOVE:
+ start = Vector2(Math::lerp(node_pos_in_parent[2], node_pos_in_parent[0], ratio), node_pos_in_parent[3]);
+ end = start - Vector2(0, control->get_margin(MARGIN_BOTTOM));
+ _draw_margin_at_position(control->get_margin(MARGIN_BOTTOM), parent_transform.xform((start + end) / 2), MARGIN_RIGHT);
+ viewport->draw_line(parent_transform.xform(start), parent_transform.xform(end), color_base, 1);
+ break;
+ default:
+ break;
+ }
+
+ switch (drag_type) {
+ //Draw the ghost rect if the node if rotated/scaled
+ case DRAG_LEFT:
+ case DRAG_TOP_LEFT:
+ case DRAG_TOP:
+ case DRAG_TOP_RIGHT:
+ case DRAG_RIGHT:
+ case DRAG_BOTTOM_RIGHT:
+ case DRAG_BOTTOM:
+ case DRAG_BOTTOM_LEFT:
+ case DRAG_MOVE:
+ if (control->get_rotation() != 0.0 || control->get_scale() != Vector2(1, 1)) {
+ Rect2 rect = Rect2(Vector2(node_pos_in_parent[0], node_pos_in_parent[1]), control->get_size());
+ viewport->draw_rect(parent_transform.xform(rect), color_base, false);
+ }
+ break;
+ default:
+ break;
+ }
+ }
+}
+
void CanvasItemEditor::_draw_selection() {
Ref<Texture> pivot_icon = get_icon("EditorPivot", "EditorIcons");
Ref<Texture> position_icon = get_icon("EditorPosition", "EditorIcons");
@@ -2317,7 +2573,7 @@ void CanvasItemEditor::_draw_selection() {
// Draw the previous position if we are dragging the node
if (show_helpers &&
- (drag_type == DRAG_ALL || drag_type == DRAG_ROTATE ||
+ (drag_type == DRAG_MOVE || drag_type == DRAG_ROTATE ||
drag_type == DRAG_LEFT || drag_type == DRAG_RIGHT || drag_type == DRAG_TOP || drag_type == DRAG_BOTTOM ||
drag_type == DRAG_TOP_LEFT || drag_type == DRAG_TOP_RIGHT || drag_type == DRAG_BOTTOM_LEFT || drag_type == DRAG_BOTTOM_RIGHT)) {
const Transform2D pre_drag_xform = transform * se->pre_drag_xform;
@@ -2359,199 +2615,26 @@ void CanvasItemEditor::_draw_selection() {
}
} else {
- Transform2D transform = Transform2D(xform.get_rotation(), xform.get_origin());
- viewport->draw_set_transform_matrix(transform);
+ Transform2D unscaled_transform = (xform * canvas_item->get_transform().affine_inverse() * Transform2D(canvas_item->_edit_get_rotation(), canvas_item->_edit_get_position())).orthonormalized();
+ Transform2D simple_xform = viewport->get_transform() * unscaled_transform;
+ viewport->draw_set_transform_matrix(simple_xform);
viewport->draw_texture(position_icon, -(position_icon->get_size() / 2));
- viewport->draw_set_transform_matrix(Transform2D());
+ viewport->draw_set_transform_matrix(viewport->get_transform());
}
- if (single && (tool == TOOL_SELECT || tool == TOOL_MOVE || tool == TOOL_ROTATE || tool == TOOL_EDIT_PIVOT)) { //kind of sucks
+ if (single && (tool == TOOL_SELECT || tool == TOOL_MOVE || tool == TOOL_SCALE || tool == TOOL_ROTATE || tool == TOOL_EDIT_PIVOT)) { //kind of sucks
// Draw the pivot
if (canvas_item->_edit_get_pivot() != Vector2() || drag_type == DRAG_PIVOT || tool == TOOL_EDIT_PIVOT) { // This is not really clean :/
viewport->draw_texture(pivot_icon, (xform.xform(canvas_item->_edit_get_pivot()) - (pivot_icon->get_size() / 2)).floor());
}
+ // Draw control-related helpers
Control *control = Object::cast_to<Control>(canvas_item);
if (control) {
- if (tool == TOOL_SELECT && show_helpers && !Object::cast_to<Container>(control->get_parent())) {
- // Draw the helpers
- Color color_base = Color(0.8, 0.8, 0.8, 0.5);
-
- float anchors_values[4];
- anchors_values[0] = control->get_anchor(MARGIN_LEFT);
- anchors_values[1] = control->get_anchor(MARGIN_TOP);
- anchors_values[2] = control->get_anchor(MARGIN_RIGHT);
- anchors_values[3] = control->get_anchor(MARGIN_BOTTOM);
-
- // Draw the anchors
- Vector2 anchors[4];
- Vector2 anchors_pos[4];
- for (int i = 0; i < 4; i++) {
- anchors[i] = Vector2((i % 2 == 0) ? anchors_values[i] : anchors_values[(i + 1) % 4], (i % 2 == 1) ? anchors_values[i] : anchors_values[(i + 1) % 4]);
- anchors_pos[i] = xform.xform(_anchor_to_position(control, anchors[i]));
- }
-
- // Get which anchor is dragged
- int dragged_anchor = -1;
- switch (drag_type) {
- case DRAG_ANCHOR_ALL:
- case DRAG_ANCHOR_TOP_LEFT:
- dragged_anchor = 0;
- break;
- case DRAG_ANCHOR_TOP_RIGHT:
- dragged_anchor = 1;
- break;
- case DRAG_ANCHOR_BOTTOM_RIGHT:
- dragged_anchor = 2;
- break;
- case DRAG_ANCHOR_BOTTOM_LEFT:
- dragged_anchor = 3;
- break;
- default:
- break;
- }
-
- if (dragged_anchor >= 0) {
- // Draw the 4 lines when dragged
- bool snapped;
- Color color_snapped = Color(0.64, 0.93, 0.67, 0.5);
-
- Vector2 corners_pos[4];
- for (int i = 0; i < 4; i++) {
- corners_pos[i] = xform.xform(_anchor_to_position(control, Vector2((i == 0 || i == 3) ? ANCHOR_BEGIN : ANCHOR_END, (i <= 1) ? ANCHOR_BEGIN : ANCHOR_END)));
- }
-
- Vector2 line_starts[4];
- Vector2 line_ends[4];
- for (int i = 0; i < 4; i++) {
- float anchor_val = (i >= 2) ? ANCHOR_END - anchors_values[i] : anchors_values[i];
- line_starts[i] = Vector2::linear_interpolate(corners_pos[i], corners_pos[(i + 1) % 4], anchor_val);
- line_ends[i] = Vector2::linear_interpolate(corners_pos[(i + 3) % 4], corners_pos[(i + 2) % 4], anchor_val);
- snapped = anchors_values[i] == 0.0 || anchors_values[i] == 0.5 || anchors_values[i] == 1.0;
- viewport->draw_line(line_starts[i], line_ends[i], snapped ? color_snapped : color_base, (i == dragged_anchor || (i + 3) % 4 == dragged_anchor) ? 2 : 1);
- }
-
- // Display the percentages next to the lines
- float percent_val;
- percent_val = anchors_values[(dragged_anchor + 2) % 4] - anchors_values[dragged_anchor];
- percent_val = (dragged_anchor >= 2) ? -percent_val : percent_val;
- _draw_percentage_at_position(percent_val, (anchors_pos[dragged_anchor] + anchors_pos[(dragged_anchor + 1) % 4]) / 2, (Margin)((dragged_anchor + 1) % 4));
-
- percent_val = anchors_values[(dragged_anchor + 3) % 4] - anchors_values[(dragged_anchor + 1) % 4];
- percent_val = ((dragged_anchor + 1) % 4 >= 2) ? -percent_val : percent_val;
- _draw_percentage_at_position(percent_val, (anchors_pos[dragged_anchor] + anchors_pos[(dragged_anchor + 3) % 4]) / 2, (Margin)(dragged_anchor));
-
- percent_val = anchors_values[(dragged_anchor + 1) % 4];
- percent_val = ((dragged_anchor + 1) % 4 >= 2) ? ANCHOR_END - percent_val : percent_val;
- _draw_percentage_at_position(percent_val, (line_starts[dragged_anchor] + anchors_pos[dragged_anchor]) / 2, (Margin)(dragged_anchor));
-
- percent_val = anchors_values[dragged_anchor];
- percent_val = (dragged_anchor >= 2) ? ANCHOR_END - percent_val : percent_val;
- _draw_percentage_at_position(percent_val, (line_ends[(dragged_anchor + 1) % 4] + anchors_pos[dragged_anchor]) / 2, (Margin)((dragged_anchor + 1) % 4));
- }
-
- Rect2 anchor_rects[4];
- anchor_rects[0] = Rect2(anchors_pos[0] - anchor_handle->get_size(), anchor_handle->get_size());
- anchor_rects[1] = Rect2(anchors_pos[1] - Vector2(0.0, anchor_handle->get_size().y), Point2(-anchor_handle->get_size().x, anchor_handle->get_size().y));
- anchor_rects[2] = Rect2(anchors_pos[2], -anchor_handle->get_size());
- anchor_rects[3] = Rect2(anchors_pos[3] - Vector2(anchor_handle->get_size().x, 0.0), Point2(anchor_handle->get_size().x, -anchor_handle->get_size().y));
-
- for (int i = 0; i < 4; i++) {
- anchor_handle->draw_rect(ci, anchor_rects[i]);
- }
-
- // Draw the margin values and the node width/height when dragging control side
- float ratio = 0.33;
- Transform2D parent_transform = xform * control->get_transform().affine_inverse();
- float node_pos_in_parent[4];
-
- Rect2 parent_rect = control->get_parent_anchorable_rect();
-
- node_pos_in_parent[0] = control->get_anchor(MARGIN_LEFT) * parent_rect.size.width + control->get_margin(MARGIN_LEFT) + parent_rect.position.x;
- node_pos_in_parent[1] = control->get_anchor(MARGIN_TOP) * parent_rect.size.height + control->get_margin(MARGIN_TOP) + parent_rect.position.y;
- node_pos_in_parent[2] = control->get_anchor(MARGIN_RIGHT) * parent_rect.size.width + control->get_margin(MARGIN_RIGHT) + parent_rect.position.x;
- node_pos_in_parent[3] = control->get_anchor(MARGIN_BOTTOM) * parent_rect.size.height + control->get_margin(MARGIN_BOTTOM) + parent_rect.position.y;
-
- Point2 start, end;
- switch (drag_type) {
- case DRAG_LEFT:
- case DRAG_TOP_LEFT:
- case DRAG_BOTTOM_LEFT:
- _draw_margin_at_position(control->get_size().width, parent_transform.xform(Vector2((node_pos_in_parent[0] + node_pos_in_parent[2]) / 2, node_pos_in_parent[3])) + Vector2(0, 5), MARGIN_BOTTOM);
- case DRAG_ALL:
- start = Vector2(node_pos_in_parent[0], Math::lerp(node_pos_in_parent[1], node_pos_in_parent[3], ratio));
- end = start - Vector2(control->get_margin(MARGIN_LEFT), 0);
- _draw_margin_at_position(control->get_margin(MARGIN_LEFT), parent_transform.xform((start + end) / 2), MARGIN_TOP);
- viewport->draw_line(parent_transform.xform(start), parent_transform.xform(end), color_base, 1);
- break;
- default:
- break;
- }
- switch (drag_type) {
- case DRAG_RIGHT:
- case DRAG_TOP_RIGHT:
- case DRAG_BOTTOM_RIGHT:
- _draw_margin_at_position(control->get_size().width, parent_transform.xform(Vector2((node_pos_in_parent[0] + node_pos_in_parent[2]) / 2, node_pos_in_parent[3])) + Vector2(0, 5), MARGIN_BOTTOM);
- case DRAG_ALL:
- start = Vector2(node_pos_in_parent[2], Math::lerp(node_pos_in_parent[3], node_pos_in_parent[1], ratio));
- end = start - Vector2(control->get_margin(MARGIN_RIGHT), 0);
- _draw_margin_at_position(control->get_margin(MARGIN_RIGHT), parent_transform.xform((start + end) / 2), MARGIN_BOTTOM);
- viewport->draw_line(parent_transform.xform(start), parent_transform.xform(end), color_base, 1);
- break;
- default:
- break;
- }
- switch (drag_type) {
- case DRAG_TOP:
- case DRAG_TOP_LEFT:
- case DRAG_TOP_RIGHT:
- _draw_margin_at_position(control->get_size().height, parent_transform.xform(Vector2(node_pos_in_parent[2], (node_pos_in_parent[1] + node_pos_in_parent[3]) / 2)) + Vector2(5, 0), MARGIN_RIGHT);
- case DRAG_ALL:
- start = Vector2(Math::lerp(node_pos_in_parent[0], node_pos_in_parent[2], ratio), node_pos_in_parent[1]);
- end = start - Vector2(0, control->get_margin(MARGIN_TOP));
- _draw_margin_at_position(control->get_margin(MARGIN_TOP), parent_transform.xform((start + end) / 2), MARGIN_LEFT);
- viewport->draw_line(parent_transform.xform(start), parent_transform.xform(end), color_base, 1);
- break;
- default:
- break;
- }
- switch (drag_type) {
- case DRAG_BOTTOM:
- case DRAG_BOTTOM_LEFT:
- case DRAG_BOTTOM_RIGHT:
- _draw_margin_at_position(control->get_size().height, parent_transform.xform(Vector2(node_pos_in_parent[2], (node_pos_in_parent[1] + node_pos_in_parent[3]) / 2) + Vector2(5, 0)), MARGIN_RIGHT);
- case DRAG_ALL:
- start = Vector2(Math::lerp(node_pos_in_parent[2], node_pos_in_parent[0], ratio), node_pos_in_parent[3]);
- end = start - Vector2(0, control->get_margin(MARGIN_BOTTOM));
- _draw_margin_at_position(control->get_margin(MARGIN_BOTTOM), parent_transform.xform((start + end) / 2), MARGIN_RIGHT);
- viewport->draw_line(parent_transform.xform(start), parent_transform.xform(end), color_base, 1);
- break;
- default:
- break;
- }
-
- switch (drag_type) {
- //Draw the ghost rect if the node if rotated/scaled
- case DRAG_LEFT:
- case DRAG_TOP_LEFT:
- case DRAG_TOP:
- case DRAG_TOP_RIGHT:
- case DRAG_RIGHT:
- case DRAG_BOTTOM_RIGHT:
- case DRAG_BOTTOM:
- case DRAG_BOTTOM_LEFT:
- case DRAG_ALL:
- if (control->get_rotation() != 0.0 || control->get_scale() != Vector2(1, 1)) {
- Rect2 rect = Rect2(Vector2(node_pos_in_parent[0], node_pos_in_parent[1]), control->get_size());
- viewport->draw_rect(parent_transform.xform(rect), color_base, false);
- }
- break;
- default:
- break;
- }
- }
+ _draw_control_helpers(control);
}
+ // Draw the resize handles
if (tool == TOOL_SELECT && canvas_item->_edit_use_rect()) {
Rect2 rect = canvas_item->_edit_get_rect();
Vector2 endpoints[4] = {
@@ -2561,7 +2644,6 @@ void CanvasItemEditor::_draw_selection() {
xform.xform(rect.position + Vector2(0, rect.size.y))
};
for (int i = 0; i < 4; i++) {
- // Draw the resize handles
int prev = (i + 3) % 4;
int next = (i + 1) % 4;
@@ -2576,6 +2658,46 @@ void CanvasItemEditor::_draw_selection() {
select_handle->draw(ci, (ofs - (select_handle->get_size() / 2)).floor());
}
}
+
+ // Draw the rescale handles
+ bool is_ctrl = Input::get_singleton()->is_key_pressed(KEY_CONTROL);
+ bool is_alt = Input::get_singleton()->is_key_pressed(KEY_ALT);
+ if ((is_alt && is_ctrl) || tool == TOOL_SCALE || drag_type == DRAG_SCALE_X || drag_type == DRAG_SCALE_Y) {
+
+ Transform2D unscaled_transform = (xform * canvas_item->get_transform().affine_inverse() * Transform2D(canvas_item->_edit_get_rotation(), canvas_item->_edit_get_position())).orthonormalized();
+ Transform2D simple_xform = viewport->get_transform() * unscaled_transform;
+
+ Size2 scale_factor = Size2(SCALE_HANDLE_DISTANCE, SCALE_HANDLE_DISTANCE);
+ bool uniform = Input::get_singleton()->is_key_pressed(KEY_SHIFT);
+ Point2 offset = (simple_xform.affine_inverse().xform(drag_to) - simple_xform.affine_inverse().xform(drag_from)) * zoom;
+
+ if (drag_type == DRAG_SCALE_X) {
+ scale_factor.x += offset.x;
+ if (uniform) {
+ scale_factor.y += offset.x;
+ }
+ } else if (drag_type == DRAG_SCALE_Y) {
+ scale_factor.y -= offset.y;
+ if (uniform) {
+ scale_factor.x -= offset.y;
+ }
+ }
+
+ //scale_factor *= zoom;
+
+ viewport->draw_set_transform_matrix(simple_xform);
+ Rect2 x_handle_rect = Rect2(scale_factor.x * EDSCALE, -5 * EDSCALE, 10 * EDSCALE, 10 * EDSCALE);
+ Color x_axis_color(1.0, 0.4, 0.4, 0.6);
+ viewport->draw_rect(x_handle_rect, x_axis_color);
+ viewport->draw_line(Point2(), Point2(scale_factor.x * EDSCALE, 0), x_axis_color);
+
+ Rect2 y_handle_rect = Rect2(-5 * EDSCALE, -(scale_factor.y + 10) * EDSCALE, 10 * EDSCALE, 10 * EDSCALE);
+ Color y_axis_color(0.4, 1.0, 0.4, 0.6);
+ viewport->draw_rect(y_handle_rect, y_axis_color);
+ viewport->draw_line(Point2(), Point2(0, -scale_factor.y * EDSCALE), y_axis_color);
+
+ viewport->draw_set_transform_matrix(viewport->get_transform());
+ }
}
}
@@ -2750,15 +2872,16 @@ void CanvasItemEditor::_draw_invisible_nodes_positions(Node *p_node, const Trans
_draw_invisible_nodes_positions(p_node->get_child(i), parent_xform, canvas_xform);
}
- if (canvas_item && !canvas_item->_edit_use_rect() && !editor_selection->is_selected(canvas_item)) {
+ if (canvas_item && !canvas_item->_edit_use_rect() && (!editor_selection->is_selected(canvas_item) || (canvas_item->has_meta("_edit_lock_") && canvas_item->get_meta("_edit_lock_")))) {
Transform2D xform = transform * canvas_xform * parent_xform;
// Draw the node's position
Ref<Texture> position_icon = get_icon("EditorPositionUnselected", "EditorIcons");
- Transform2D transform = Transform2D(xform.get_rotation(), xform.get_origin());
- viewport->draw_set_transform_matrix(transform);
+ Transform2D unscaled_transform = (xform * canvas_item->get_transform().affine_inverse() * Transform2D(canvas_item->_edit_get_rotation(), canvas_item->_edit_get_position())).orthonormalized();
+ Transform2D simple_xform = viewport->get_transform() * unscaled_transform;
+ viewport->draw_set_transform_matrix(simple_xform);
viewport->draw_texture(position_icon, -position_icon->get_size() / 2, Color(1.0, 1.0, 1.0, 0.5));
- viewport->draw_set_transform_matrix(Transform2D());
+ viewport->draw_set_transform_matrix(viewport->get_transform());
}
}
@@ -2775,7 +2898,7 @@ void CanvasItemEditor::_draw_hover() {
Size2 item_size = Size2(node_icon->get_size().x + 4 + node_name_size.x, MAX(node_icon->get_size().y, node_name_size.y - 3));
Point2 pos = transform.xform(hovering_results[i].position) - Point2(0, item_size.y) + (Point2(node_icon->get_size().x, -node_icon->get_size().y) / 4);
- // Rectify the position to avoid overlaping items
+ // Rectify the position to avoid overlapping items
for (List<Rect2>::Element *E = previous_rects.front(); E; E = E->next()) {
if (E->get().intersects(Rect2(pos, item_size))) {
pos.y = E->get().get_position().y - item_size.y;
@@ -3086,6 +3209,7 @@ void CanvasItemEditor::_notification(int p_what) {
select_button->set_icon(get_icon("ToolSelect", "EditorIcons"));
list_select_button->set_icon(get_icon("ListSelect", "EditorIcons"));
move_button->set_icon(get_icon("ToolMove", "EditorIcons"));
+ scale_button->set_icon(get_icon("ToolScale", "EditorIcons"));
rotate_button->set_icon(get_icon("ToolRotate", "EditorIcons"));
snap_button->set_icon(get_icon("Snap", "EditorIcons"));
snap_config_menu->set_icon(get_icon("GuiMiniTabMenu", "EditorIcons"));
@@ -3394,7 +3518,7 @@ void CanvasItemEditor::_button_toggle_snap(bool p_status) {
void CanvasItemEditor::_button_tool_select(int p_index) {
- ToolButton *tb[TOOL_MAX] = { select_button, list_select_button, move_button, rotate_button, pivot_button, pan_button };
+ ToolButton *tb[TOOL_MAX] = { select_button, list_select_button, move_button, scale_button, rotate_button, pivot_button, pan_button };
for (int i = 0; i < TOOL_MAX; i++) {
tb[i]->set_pressed(i == p_index);
}
@@ -4286,6 +4410,8 @@ CanvasItemEditor::CanvasItemEditor(EditorNode *p_editor) {
select_button->set_shortcut(ED_SHORTCUT("canvas_item_editor/select_mode", TTR("Select Mode"), KEY_Q));
select_button->set_tooltip(keycode_get_string(KEY_MASK_CMD) + TTR("Drag: Rotate") + "\n" + TTR("Alt+Drag: Move") + "\n" + TTR("Press 'v' to Change Pivot, 'Shift+v' to Drag Pivot (while moving).") + "\n" + TTR("Alt+RMB: Depth list selection"));
+ hb->add_child(memnew(VSeparator));
+
move_button = memnew(ToolButton);
hb->add_child(move_button);
move_button->set_toggle_mode(true);
@@ -4293,6 +4419,13 @@ CanvasItemEditor::CanvasItemEditor(EditorNode *p_editor) {
move_button->set_shortcut(ED_SHORTCUT("canvas_item_editor/move_mode", TTR("Move Mode"), KEY_W));
move_button->set_tooltip(TTR("Move Mode"));
+ scale_button = memnew(ToolButton);
+ hb->add_child(scale_button);
+ scale_button->set_toggle_mode(true);
+ scale_button->connect("pressed", this, "_button_tool_select", make_binds(TOOL_SCALE));
+ scale_button->set_shortcut(ED_SHORTCUT("canvas_item_editor/scale_mode", TTR("Scale Mode"), KEY_S));
+ scale_button->set_tooltip(TTR("Scale Mode"));
+
rotate_button = memnew(ToolButton);
hb->add_child(rotate_button);
rotate_button->set_toggle_mode(true);
diff --git a/editor/plugins/canvas_item_editor_plugin.h b/editor/plugins/canvas_item_editor_plugin.h
index 2c943385ad..61d77581d3 100644
--- a/editor/plugins/canvas_item_editor_plugin.h
+++ b/editor/plugins/canvas_item_editor_plugin.h
@@ -77,6 +77,7 @@ class CanvasItemEditor : public VBoxContainer {
TOOL_SELECT,
TOOL_LIST_SELECT,
TOOL_MOVE,
+ TOOL_SCALE,
TOOL_ROTATE,
TOOL_EDIT_PIVOT,
TOOL_PAN,
@@ -188,7 +189,9 @@ class CanvasItemEditor : public VBoxContainer {
DRAG_ANCHOR_BOTTOM_RIGHT,
DRAG_ANCHOR_BOTTOM_LEFT,
DRAG_ANCHOR_ALL,
- DRAG_ALL,
+ DRAG_MOVE,
+ DRAG_SCALE_X,
+ DRAG_SCALE_Y,
DRAG_ROTATE,
DRAG_PIVOT,
DRAG_V_GUIDE,
@@ -298,17 +301,19 @@ class CanvasItemEditor : public VBoxContainer {
List<PoseClipboard> pose_clipboard;
ToolButton *select_button;
- ToolButton *list_select_button;
+
ToolButton *move_button;
+ ToolButton *scale_button;
ToolButton *rotate_button;
+ ToolButton *list_select_button;
+ ToolButton *pivot_button;
+ ToolButton *pan_button;
+
ToolButton *snap_button;
MenuButton *snap_config_menu;
PopupMenu *smartsnap_config_popup;
- ToolButton *pivot_button;
- ToolButton *pan_button;
-
ToolButton *lock_button;
ToolButton *unlock_button;
@@ -408,6 +413,7 @@ class CanvasItemEditor : public VBoxContainer {
void _draw_guides();
void _draw_focus();
void _draw_grid();
+ void _draw_control_helpers(Control *control);
void _draw_selection();
void _draw_axis();
void _draw_bones();
@@ -420,6 +426,7 @@ class CanvasItemEditor : public VBoxContainer {
bool _gui_input_anchors(const Ref<InputEvent> &p_event);
bool _gui_input_move(const Ref<InputEvent> &p_event);
bool _gui_input_open_scene_on_double_click(const Ref<InputEvent> &p_event);
+ bool _gui_input_scale(const Ref<InputEvent> &p_event);
bool _gui_input_pivot(const Ref<InputEvent> &p_event);
bool _gui_input_resize(const Ref<InputEvent> &p_event);
bool _gui_input_rotate(const Ref<InputEvent> &p_event);
diff --git a/editor/plugins/collision_polygon_editor_plugin.cpp b/editor/plugins/collision_polygon_editor_plugin.cpp
index 5109379add..805a7d3835 100644
--- a/editor/plugins/collision_polygon_editor_plugin.cpp
+++ b/editor/plugins/collision_polygon_editor_plugin.cpp
@@ -31,10 +31,10 @@
#include "collision_polygon_editor_plugin.h"
#include "canvas_item_editor_plugin.h"
+#include "core/os/file_access.h"
+#include "core/os/input.h"
+#include "core/os/keyboard.h"
#include "editor/editor_settings.h"
-#include "os/file_access.h"
-#include "os/input.h"
-#include "os/keyboard.h"
#include "scene/3d/camera.h"
#include "spatial_editor_plugin.h"
diff --git a/editor/plugins/curve_editor_plugin.cpp b/editor/plugins/curve_editor_plugin.cpp
index f5bdf77973..79169d3183 100644
--- a/editor/plugins/curve_editor_plugin.cpp
+++ b/editor/plugins/curve_editor_plugin.cpp
@@ -31,9 +31,9 @@
#include "curve_editor_plugin.h"
#include "canvas_item_editor_plugin.h"
-#include "core_string_names.h"
-#include "os/input.h"
-#include "os/keyboard.h"
+#include "core/core_string_names.h"
+#include "core/os/input.h"
+#include "core/os/keyboard.h"
CurveEditor::CurveEditor() {
_selected_point = -1;
diff --git a/editor/plugins/editor_preview_plugins.cpp b/editor/plugins/editor_preview_plugins.cpp
index 9acbceec92..72a746e95b 100644
--- a/editor/plugins/editor_preview_plugins.cpp
+++ b/editor/plugins/editor_preview_plugins.cpp
@@ -30,12 +30,12 @@
#include "editor_preview_plugins.h"
+#include "core/io/file_access_memory.h"
+#include "core/io/resource_loader.h"
+#include "core/os/os.h"
#include "editor/editor_node.h"
#include "editor/editor_scale.h"
#include "editor/editor_settings.h"
-#include "io/file_access_memory.h"
-#include "io/resource_loader.h"
-#include "os/os.h"
#include "scene/resources/bit_mask.h"
#include "scene/resources/dynamic_font.h"
#include "scene/resources/material.h"
diff --git a/editor/plugins/item_list_editor_plugin.cpp b/editor/plugins/item_list_editor_plugin.cpp
index 1f0b4e9e97..7b5de9c009 100644
--- a/editor/plugins/item_list_editor_plugin.cpp
+++ b/editor/plugins/item_list_editor_plugin.cpp
@@ -30,7 +30,7 @@
#include "item_list_editor_plugin.h"
-#include "io/resource_loader.h"
+#include "core/io/resource_loader.h"
bool ItemListPlugin::_set(const StringName &p_name, const Variant &p_value) {
@@ -278,18 +278,20 @@ void ItemListEditor::_add_pressed() {
void ItemListEditor::_delete_pressed() {
- TreeItem *ti = tree->get_selected();
-
- if (!ti)
+ if (selected_idx == -1)
return;
- if (ti->get_parent() != tree->get_root())
+ String current_selected = (String)property_editor->get_selected_path();
+
+ if (current_selected == "")
return;
- int idx = ti->get_text(0).to_int();
+ // FIXME: Currently relying on selecting a *property* to derive what item to delete
+ // e.g. you select "1/enabled" to delete item 1.
+ // This should be fixed so that you can delete by selecting the item section header,
+ // or a delete button on that header.
- if (selected_idx == -1)
- return;
+ int idx = current_selected.get_slice("/", 0).to_int();
item_plugins[selected_idx]->erase(idx);
}
@@ -382,13 +384,9 @@ ItemListEditor::ItemListEditor() {
hbc->add_child(del_button);
del_button->connect("pressed", this, "_delete_button");
- property_editor = memnew(PropertyEditor);
- property_editor->hide_top_label();
- property_editor->set_subsection_selectable(true);
+ property_editor = memnew(EditorInspector);
vbc->add_child(property_editor);
property_editor->set_v_size_flags(SIZE_EXPAND_FILL);
-
- tree = property_editor->get_property_tree();
}
ItemListEditor::~ItemListEditor() {
diff --git a/editor/plugins/item_list_editor_plugin.h b/editor/plugins/item_list_editor_plugin.h
index d6a071b9b9..3dc3775f83 100644
--- a/editor/plugins/item_list_editor_plugin.h
+++ b/editor/plugins/item_list_editor_plugin.h
@@ -32,9 +32,9 @@
#define ITEM_LIST_EDITOR_PLUGIN_H
#include "canvas_item_editor_plugin.h"
+#include "editor/editor_inspector.h"
#include "editor/editor_node.h"
#include "editor/editor_plugin.h"
-
#include "scene/gui/menu_button.h"
#include "scene/gui/option_button.h"
#include "scene/gui/popup_menu.h"
@@ -210,7 +210,7 @@ class ItemListEditor : public HBoxContainer {
ToolButton *toolbar_button;
AcceptDialog *dialog;
- PropertyEditor *property_editor;
+ EditorInspector *property_editor;
Tree *tree;
Button *add_button;
Button *del_button;
diff --git a/editor/plugins/light_occluder_2d_editor_plugin.cpp b/editor/plugins/light_occluder_2d_editor_plugin.cpp
index 3351e5918f..4f8a307cc1 100644
--- a/editor/plugins/light_occluder_2d_editor_plugin.cpp
+++ b/editor/plugins/light_occluder_2d_editor_plugin.cpp
@@ -31,8 +31,8 @@
#include "light_occluder_2d_editor_plugin.h"
#include "canvas_item_editor_plugin.h"
+#include "core/os/file_access.h"
#include "editor/editor_settings.h"
-#include "os/file_access.h"
void LightOccluder2DEditor::_notification(int p_what) {
diff --git a/editor/plugins/particles_2d_editor_plugin.cpp b/editor/plugins/particles_2d_editor_plugin.cpp
index 3bde157edf..5dcbca2ed6 100644
--- a/editor/plugins/particles_2d_editor_plugin.cpp
+++ b/editor/plugins/particles_2d_editor_plugin.cpp
@@ -31,7 +31,7 @@
#include "particles_2d_editor_plugin.h"
#include "canvas_item_editor_plugin.h"
-#include "io/image_loader.h"
+#include "core/io/image_loader.h"
#include "scene/gui/separator.h"
#include "scene/resources/particles_material.h"
diff --git a/editor/plugins/particles_editor_plugin.cpp b/editor/plugins/particles_editor_plugin.cpp
index 9a1a60805f..6b41946918 100644
--- a/editor/plugins/particles_editor_plugin.cpp
+++ b/editor/plugins/particles_editor_plugin.cpp
@@ -30,8 +30,8 @@
#include "particles_editor_plugin.h"
+#include "core/io/resource_loader.h"
#include "editor/plugins/spatial_editor_plugin.h"
-#include "io/resource_loader.h"
#include "scene/3d/cpu_particles.h"
#include "scene/resources/particles_material.h"
diff --git a/editor/plugins/path_2d_editor_plugin.cpp b/editor/plugins/path_2d_editor_plugin.cpp
index 33e182faef..96c1ad2f2b 100644
--- a/editor/plugins/path_2d_editor_plugin.cpp
+++ b/editor/plugins/path_2d_editor_plugin.cpp
@@ -31,9 +31,9 @@
#include "path_2d_editor_plugin.h"
#include "canvas_item_editor_plugin.h"
+#include "core/os/file_access.h"
+#include "core/os/keyboard.h"
#include "editor/editor_settings.h"
-#include "os/file_access.h"
-#include "os/keyboard.h"
void Path2DEditor::_notification(int p_what) {
diff --git a/editor/plugins/polygon_2d_editor_plugin.cpp b/editor/plugins/polygon_2d_editor_plugin.cpp
index a437cd5362..e0c8cf41ff 100644
--- a/editor/plugins/polygon_2d_editor_plugin.cpp
+++ b/editor/plugins/polygon_2d_editor_plugin.cpp
@@ -31,10 +31,10 @@
#include "polygon_2d_editor_plugin.h"
#include "canvas_item_editor_plugin.h"
+#include "core/os/file_access.h"
+#include "core/os/input.h"
+#include "core/os/keyboard.h"
#include "editor/editor_settings.h"
-#include "os/file_access.h"
-#include "os/input.h"
-#include "os/keyboard.h"
#include "scene/2d/skeleton_2d.h"
Node2D *Polygon2DEditor::_get_node() const {
diff --git a/editor/plugins/resource_preloader_editor_plugin.cpp b/editor/plugins/resource_preloader_editor_plugin.cpp
index c6e8ec1a2b..da6aa48f9c 100644
--- a/editor/plugins/resource_preloader_editor_plugin.cpp
+++ b/editor/plugins/resource_preloader_editor_plugin.cpp
@@ -30,9 +30,9 @@
#include "resource_preloader_editor_plugin.h"
+#include "core/io/resource_loader.h"
+#include "core/project_settings.h"
#include "editor/editor_settings.h"
-#include "io/resource_loader.h"
-#include "project_settings.h"
void ResourcePreloaderEditor::_gui_input(Ref<InputEvent> p_event) {
}
diff --git a/editor/plugins/root_motion_editor_plugin.cpp b/editor/plugins/root_motion_editor_plugin.cpp
index aac58507f2..1961f3786c 100644
--- a/editor/plugins/root_motion_editor_plugin.cpp
+++ b/editor/plugins/root_motion_editor_plugin.cpp
@@ -126,7 +126,7 @@ void EditorPropertyRootMotion::_node_assign() {
node = base->get_node(accum);
}
if (!node)
- continue; //no node, cant edit
+ continue; //no node, can't edit
if (path.get_subname_count()) {
@@ -314,7 +314,7 @@ bool EditorInspectorRootMotionPlugin::parse_property(Object *p_object, Variant::
return true;
}
- return false; //can be overriden, although it will most likely be last anyway
+ return false; //can be overridden, although it will most likely be last anyway
}
void EditorInspectorRootMotionPlugin::parse_end() {
diff --git a/editor/plugins/script_editor_plugin.cpp b/editor/plugins/script_editor_plugin.cpp
index 70f1789a86..9dd6a8e0ed 100644
--- a/editor/plugins/script_editor_plugin.cpp
+++ b/editor/plugins/script_editor_plugin.cpp
@@ -59,25 +59,10 @@ void ScriptEditorBase::_bind_methods() {
ADD_SIGNAL(MethodInfo("search_in_files_requested", PropertyInfo(Variant::STRING, "text")));
}
-static bool _can_open_in_editor(Script *p_script) {
-
+static bool _is_built_in_script(Script *p_script) {
String path = p_script->get_path();
- if (path.find("::") != -1) {
- //refuse handling this if it can't be edited
-
- bool valid = false;
- for (int i = 0; i < EditorNode::get_singleton()->get_editor_data().get_edited_scene_count(); i++) {
- if (path.begins_with(EditorNode::get_singleton()->get_editor_data().get_scene_path(i))) {
- valid = true;
- break;
- }
- }
-
- return valid;
- }
-
- return true;
+ return path.find("::") != -1;
}
class EditorScriptCodeCompletionCache : public ScriptCodeCompletionCache {
@@ -504,6 +489,13 @@ void ScriptEditor::_open_recent_script(int p_idx) {
return;
}
// if it's a path then its most likely a deleted file not help
+ } else if (path.find("::") != -1) {
+ // built-in script
+ Ref<Script> script = ResourceLoader::load(path);
+ if (script.is_valid()) {
+ edit(script, true);
+ return;
+ }
} else if (!path.is_resource_file()) {
_help_class_open(path);
return;
@@ -939,7 +931,7 @@ void ScriptEditor::_menu_option(int p_option) {
switch (p_option) {
case FILE_NEW: {
- script_create_dialog->config("Node", ".gd");
+ script_create_dialog->config("Node", "new_script");
script_create_dialog->popup_centered(Size2(300, 300) * EDSCALE);
} break;
case FILE_NEW_TEXTFILE: {
@@ -1742,7 +1734,7 @@ void ScriptEditor::_update_script_names() {
} break;
case DISPLAY_DIR_AND_NAME: {
if (!path.get_base_dir().get_file().empty()) {
- sd.name = path.get_base_dir().get_file() + "/" + name;
+ sd.name = path.get_base_dir().get_file().plus_file(name);
} else {
sd.name = name;
}
@@ -1793,8 +1785,8 @@ void ScriptEditor::_update_script_names() {
new_cur_tab = i;
}
}
- tab_container->call_deferred("set_current_tab", new_prev_tab);
- tab_container->call_deferred("set_current_tab", new_cur_tab);
+ tab_container->set_current_tab(new_prev_tab);
+ tab_container->set_current_tab(new_cur_tab);
_sort_list_on_update = false;
}
@@ -2017,6 +2009,7 @@ bool ScriptEditor::edit(const RES &p_resource, int p_line, int p_col, bool p_gra
_go_to_tab(tab_container->get_tab_count() - 1);
}
+ _sort_list_on_update = true;
_update_script_names();
_save_layout();
se->connect("name_changed", this, "_update_script_names");
@@ -2106,8 +2099,6 @@ void ScriptEditor::_editor_play() {
debug_menu->get_popup()->set_item_disabled(debug_menu->get_popup()->get_item_index(DEBUG_STEP), true);
debug_menu->get_popup()->set_item_disabled(debug_menu->get_popup()->get_item_index(DEBUG_BREAK), false);
debug_menu->get_popup()->set_item_disabled(debug_menu->get_popup()->get_item_index(DEBUG_CONTINUE), true);
-
- //debugger_gui->start_listening(Globals::get_singleton()->get("debug/debug_port"));
}
void ScriptEditor::_editor_pause() {
@@ -2591,6 +2582,7 @@ void ScriptEditor::_help_class_open(const String &p_class) {
eh->go_to_class(p_class, 0);
eh->connect("go_to_help", this, "_help_class_goto");
_add_recent_script(p_class);
+ _sort_list_on_update = true;
_update_script_names();
_save_layout();
}
@@ -2620,6 +2612,7 @@ void ScriptEditor::_help_class_goto(const String &p_desc) {
eh->go_to_help(p_desc);
eh->connect("go_to_help", this, "_help_class_goto");
_add_recent_script(eh->get_class());
+ _sort_list_on_update = true;
_update_script_names();
_save_layout();
}
@@ -2728,7 +2721,7 @@ void ScriptEditor::set_scene_root_script(Ref<Script> p_script) {
if (bool(EditorSettings::get_singleton()->get("text_editor/external/use_external_editor")))
return;
- if (open_dominant && p_script.is_valid() && _can_open_in_editor(p_script.ptr())) {
+ if (open_dominant && p_script.is_valid()) {
edit(p_script);
}
}
@@ -3224,7 +3217,17 @@ ScriptEditor::~ScriptEditor() {
void ScriptEditorPlugin::edit(Object *p_object) {
if (Object::cast_to<Script>(p_object)) {
- script_editor->edit(Object::cast_to<Script>(p_object));
+
+ Script *p_script = Object::cast_to<Script>(p_object);
+ String scene_path = p_script->get_path().get_slice("::", 0);
+
+ if (_is_built_in_script(p_script) && !EditorNode::get_singleton()->is_scene_open(scene_path)) {
+ EditorNode::get_singleton()->load_scene(scene_path);
+
+ script_editor->call_deferred("edit", p_script);
+ } else {
+ script_editor->edit(p_script);
+ }
}
if (Object::cast_to<TextFile>(p_object)) {
@@ -3239,13 +3242,7 @@ bool ScriptEditorPlugin::handles(Object *p_object) const {
}
if (Object::cast_to<Script>(p_object)) {
-
- bool valid = _can_open_in_editor(Object::cast_to<Script>(p_object));
-
- if (!valid) { //user tried to open it by clicking
- EditorNode::get_singleton()->show_warning(TTR("Built-in scripts can only be edited when the scene they belong to is loaded"));
- }
- return valid;
+ return true;
}
return p_object->is_class("Script");
diff --git a/editor/plugins/script_editor_plugin.h b/editor/plugins/script_editor_plugin.h
index 737f17358b..120755b5af 100644
--- a/editor/plugins/script_editor_plugin.h
+++ b/editor/plugins/script_editor_plugin.h
@@ -31,6 +31,7 @@
#ifndef SCRIPT_EDITOR_PLUGIN_H
#define SCRIPT_EDITOR_PLUGIN_H
+#include "core/script_language.h"
#include "editor/code_editor.h"
#include "editor/editor_help.h"
#include "editor/editor_plugin.h"
@@ -44,7 +45,6 @@
#include "scene/gui/tree.h"
#include "scene/main/timer.h"
#include "scene/resources/text_file.h"
-#include "script_language.h"
class ScriptEditorQuickOpen : public ConfirmationDialog {
diff --git a/editor/plugins/script_text_editor.cpp b/editor/plugins/script_text_editor.cpp
index e0eb89d6b6..bdeeaa106d 100644
--- a/editor/plugins/script_text_editor.cpp
+++ b/editor/plugins/script_text_editor.cpp
@@ -30,10 +30,10 @@
#include "script_text_editor.h"
+#include "core/os/keyboard.h"
#include "editor/editor_node.h"
#include "editor/editor_settings.h"
#include "editor/script_editor_debugger.h"
-#include "os/keyboard.h"
Vector<String> ScriptTextEditor::get_functions() {
@@ -1256,7 +1256,7 @@ void ScriptTextEditor::_text_edit_gui_input(const Ref<InputEvent> &ev) {
int to_column = tx->get_selection_to_column();
if (row < from_line || row > to_line || (row == from_line && col < from_column) || (row == to_line && col > to_column)) {
- // Right click is outside the seleted text
+ // Right click is outside the selected text
tx->deselect();
}
}
@@ -1556,7 +1556,7 @@ void ScriptTextEditor::register_editor() {
#endif
ED_SHORTCUT("script_text_editor/trim_trailing_whitespace", TTR("Trim Trailing Whitespace"), KEY_MASK_CMD | KEY_MASK_ALT | KEY_T);
ED_SHORTCUT("script_text_editor/convert_indent_to_spaces", TTR("Convert Indent To Spaces"), KEY_MASK_CMD | KEY_MASK_SHIFT | KEY_Y);
- ED_SHORTCUT("script_text_editor/convert_indent_to_tabs", TTR("Convert Indent To Tabs"), KEY_MASK_CMD | KEY_MASK_SHIFT | KEY_X);
+ ED_SHORTCUT("script_text_editor/convert_indent_to_tabs", TTR("Convert Indent To Tabs"), KEY_MASK_CMD | KEY_MASK_SHIFT | KEY_I);
ED_SHORTCUT("script_text_editor/auto_indent", TTR("Auto Indent"), KEY_MASK_CMD | KEY_I);
#ifdef OSX_ENABLED
diff --git a/editor/plugins/shader_editor_plugin.cpp b/editor/plugins/shader_editor_plugin.cpp
index 5ee40dc90a..51e58b712e 100644
--- a/editor/plugins/shader_editor_plugin.cpp
+++ b/editor/plugins/shader_editor_plugin.cpp
@@ -480,7 +480,7 @@ void ShaderEditor::_text_edit_gui_input(const Ref<InputEvent> &ev) {
int to_column = tx->get_selection_to_column();
if (row < from_line || row > to_line || (row == from_line && col < from_column) || (row == to_line && col > to_column)) {
- // Right click is outside the seleted text
+ // Right click is outside the selected text
tx->deselect();
}
}
diff --git a/editor/plugins/sprite_frames_editor_plugin.cpp b/editor/plugins/sprite_frames_editor_plugin.cpp
index fcbbee2b9c..30246147c2 100644
--- a/editor/plugins/sprite_frames_editor_plugin.cpp
+++ b/editor/plugins/sprite_frames_editor_plugin.cpp
@@ -30,9 +30,9 @@
#include "sprite_frames_editor_plugin.h"
+#include "core/io/resource_loader.h"
+#include "core/project_settings.h"
#include "editor/editor_settings.h"
-#include "io/resource_loader.h"
-#include "project_settings.h"
#include "scene/3d/sprite_3d.h"
void SpriteFramesEditor::_gui_input(Ref<InputEvent> p_event) {
diff --git a/editor/plugins/text_editor.cpp b/editor/plugins/text_editor.cpp
index 16c25f3074..5d379fb8b3 100644
--- a/editor/plugins/text_editor.cpp
+++ b/editor/plugins/text_editor.cpp
@@ -475,7 +475,7 @@ void TextEditor::_text_edit_gui_input(const Ref<InputEvent> &ev) {
int to_column = tx->get_selection_to_column();
if (row < from_line || row > to_line || (row == from_line && col < from_column) || (row == to_line && col > to_column)) {
- // Right click is outside the seleted text
+ // Right click is outside the selected text
tx->deselect();
}
}
diff --git a/editor/plugins/texture_editor_plugin.cpp b/editor/plugins/texture_editor_plugin.cpp
index e891850870..140d37fdb5 100644
--- a/editor/plugins/texture_editor_plugin.cpp
+++ b/editor/plugins/texture_editor_plugin.cpp
@@ -30,9 +30,9 @@
#include "texture_editor_plugin.h"
+#include "core/io/resource_loader.h"
+#include "core/project_settings.h"
#include "editor/editor_settings.h"
-#include "io/resource_loader.h"
-#include "project_settings.h"
void TextureEditor::_gui_input(Ref<InputEvent> p_event) {
}
diff --git a/editor/plugins/texture_region_editor_plugin.cpp b/editor/plugins/texture_region_editor_plugin.cpp
index 4390b94ece..33e1f7c6a3 100644
--- a/editor/plugins/texture_region_editor_plugin.cpp
+++ b/editor/plugins/texture_region_editor_plugin.cpp
@@ -31,8 +31,8 @@
#include "texture_region_editor_plugin.h"
#include "core/core_string_names.h"
-#include "os/input.h"
-#include "os/keyboard.h"
+#include "core/os/input.h"
+#include "core/os/keyboard.h"
#include "scene/gui/check_box.h"
/**
diff --git a/editor/plugins/theme_editor_plugin.cpp b/editor/plugins/theme_editor_plugin.cpp
index 92b95963f9..acee1a6942 100644
--- a/editor/plugins/theme_editor_plugin.cpp
+++ b/editor/plugins/theme_editor_plugin.cpp
@@ -30,8 +30,8 @@
#include "theme_editor_plugin.h"
-#include "os/file_access.h"
-#include "version.h"
+#include "core/os/file_access.h"
+#include "core/version.h"
void ThemeEditor::edit(const Ref<Theme> &p_theme) {
diff --git a/editor/plugins/tile_map_editor_plugin.cpp b/editor/plugins/tile_map_editor_plugin.cpp
index 58c3fd015e..a0adbfccff 100644
--- a/editor/plugins/tile_map_editor_plugin.cpp
+++ b/editor/plugins/tile_map_editor_plugin.cpp
@@ -31,10 +31,10 @@
#include "tile_map_editor_plugin.h"
#include "canvas_item_editor_plugin.h"
+#include "core/os/input.h"
+#include "core/os/keyboard.h"
#include "editor/editor_scale.h"
#include "editor/editor_settings.h"
-#include "os/input.h"
-#include "os/keyboard.h"
#include "scene/gui/split_container.h"
void TileMapEditor::_notification(int p_what) {
diff --git a/editor/plugins/visual_shader_editor_plugin.cpp b/editor/plugins/visual_shader_editor_plugin.cpp
index ee31e1409c..0d683ea0a0 100644
--- a/editor/plugins/visual_shader_editor_plugin.cpp
+++ b/editor/plugins/visual_shader_editor_plugin.cpp
@@ -31,10 +31,10 @@
#include "visual_shader_editor_plugin.h"
#include "core/io/resource_loader.h"
+#include "core/os/input.h"
+#include "core/os/keyboard.h"
#include "core/project_settings.h"
#include "editor/editor_properties.h"
-#include "os/input.h"
-#include "os/keyboard.h"
#include "scene/animation/animation_player.h"
#include "scene/gui/menu_button.h"
#include "scene/gui/panel.h"
@@ -629,7 +629,7 @@ void VisualShaderEditor::_duplicate_nodes() {
int id = String(graph->get_child(i)->get_name()).to_int();
Ref<VisualShaderNode> node = visual_shader->get_node(type, id);
Ref<VisualShaderNodeOutput> output = node;
- if (output.is_valid()) //cant duplicate output
+ if (output.is_valid()) //can't duplicate output
continue;
if (node.is_valid()) {
nodes.push_back(id);
@@ -1158,7 +1158,7 @@ bool EditorInspectorShaderModePlugin::parse_property(Object *p_object, Variant::
return true;
}
- return false; //can be overriden, although it will most likely be last anyway
+ return false; //can be overridden, although it will most likely be last anyway
}
void EditorInspectorShaderModePlugin::parse_end() {
diff --git a/editor/progress_dialog.cpp b/editor/progress_dialog.cpp
index f735ef97db..29a780961e 100644
--- a/editor/progress_dialog.cpp
+++ b/editor/progress_dialog.cpp
@@ -30,10 +30,10 @@
#include "progress_dialog.h"
+#include "core/message_queue.h"
+#include "core/os/os.h"
#include "editor_scale.h"
#include "main/main.h"
-#include "message_queue.h"
-#include "os/os.h"
void BackgroundProgress::_add_task(const String &p_task, const String &p_label, int p_steps) {
diff --git a/editor/project_export.cpp b/editor/project_export.cpp
index df79317549..aba89a87ee 100644
--- a/editor/project_export.cpp
+++ b/editor/project_export.cpp
@@ -30,17 +30,17 @@
#include "project_export.h"
-#include "compressed_translation.h"
+#include "core/compressed_translation.h"
+#include "core/io/image_loader.h"
+#include "core/io/resource_loader.h"
+#include "core/io/resource_saver.h"
+#include "core/os/dir_access.h"
+#include "core/os/file_access.h"
+#include "core/os/os.h"
+#include "core/project_settings.h"
#include "editor_data.h"
#include "editor_node.h"
#include "editor_settings.h"
-#include "io/image_loader.h"
-#include "io/resource_loader.h"
-#include "io/resource_saver.h"
-#include "os/dir_access.h"
-#include "os/file_access.h"
-#include "os/os.h"
-#include "project_settings.h"
#include "scene/gui/box_container.h"
#include "scene/gui/margin_container.h"
#include "scene/gui/scroll_container.h"
diff --git a/editor/project_manager.cpp b/editor/project_manager.cpp
index 4d25a1da5c..f494c84efa 100644
--- a/editor/project_manager.cpp
+++ b/editor/project_manager.cpp
@@ -30,18 +30,21 @@
#include "project_manager.h"
+#include "core/io/config_file.h"
+#include "core/io/resource_saver.h"
+#include "core/io/stream_peer_ssl.h"
+#include "core/io/zip_io.h"
+#include "core/os/dir_access.h"
+#include "core/os/file_access.h"
+#include "core/os/keyboard.h"
+#include "core/os/os.h"
+#include "core/translation.h"
+#include "core/version.h"
+#include "core/version_hash.gen.h"
#include "editor_initialize_ssl.h"
#include "editor_scale.h"
#include "editor_settings.h"
#include "editor_themes.h"
-#include "io/config_file.h"
-#include "io/resource_saver.h"
-#include "io/stream_peer_ssl.h"
-#include "io/zip_io.h"
-#include "os/dir_access.h"
-#include "os/file_access.h"
-#include "os/keyboard.h"
-#include "os/os.h"
#include "scene/gui/center_container.h"
#include "scene/gui/line_edit.h"
#include "scene/gui/margin_container.h"
@@ -49,9 +52,6 @@
#include "scene/gui/separator.h"
#include "scene/gui/texture_rect.h"
#include "scene/gui/tool_button.h"
-#include "translation.h"
-#include "version.h"
-#include "version_hash.gen.h"
class ProjectDialog : public ConfirmationDialog {
diff --git a/editor/project_settings_editor.cpp b/editor/project_settings_editor.cpp
index a7c336eb16..1baf606e7b 100644
--- a/editor/project_settings_editor.cpp
+++ b/editor/project_settings_editor.cpp
@@ -1750,12 +1750,9 @@ ProjectSettingsEditor::ProjectSettingsEditor(EditorData *p_data) {
globals_editor = memnew(SectionedInspector);
props_base->add_child(globals_editor);
globals_editor->get_inspector()->set_undo_redo(EditorNode::get_singleton()->get_undo_redo());
- globals_editor->get_inspector()->set_property_selectable(true);
- //globals_editor->hide_top_label();
globals_editor->set_v_size_flags(Control::SIZE_EXPAND_FILL);
globals_editor->register_search_box(search_box);
globals_editor->get_inspector()->connect("property_selected", this, "_item_selected");
- //globals_editor->get_inspector()->connect("property_toggled", this, "_item_checked", varray(), CONNECT_DEFERRED);
globals_editor->get_inspector()->connect("property_edited", this, "_settings_prop_edited");
globals_editor->get_inspector()->connect("restart_requested", this, "_editor_restart_request");
diff --git a/editor/property_editor.cpp b/editor/property_editor.cpp
index d9812f7425..1c2eedfc9c 100644
--- a/editor/property_editor.cpp
+++ b/editor/property_editor.cpp
@@ -1910,6 +1910,7 @@ void CustomPropertyEditor::_bind_methods() {
ADD_SIGNAL(MethodInfo("variant_field_changed", PropertyInfo(Variant::STRING, "field")));
ADD_SIGNAL(MethodInfo("resource_edit_request"));
}
+
CustomPropertyEditor::CustomPropertyEditor() {
read_only = false;
@@ -2034,2691 +2035,8 @@ CustomPropertyEditor::CustomPropertyEditor() {
property_select = NULL;
}
-bool PropertyEditor::_might_be_in_instance() {
-
- if (!obj)
- return false;
-
- Node *node = Object::cast_to<Node>(obj);
-
- Node *edited_scene = EditorNode::get_singleton()->get_edited_scene();
-
- bool might_be = false;
-
- while (node) {
-
- if (node->get_scene_instance_state().is_valid()) {
- might_be = true;
- break;
- }
- if (node == edited_scene) {
- if (node->get_scene_inherited_state().is_valid()) {
- might_be = true;
- break;
- }
- might_be = false;
- break;
- }
- node = node->get_owner();
- }
-
- return might_be;
-}
-
-bool PropertyEditor::_get_instanced_node_original_property(const StringName &p_prop, Variant &value) {
-
- Node *node = Object::cast_to<Node>(obj);
-
- if (!node)
- return false;
-
- Node *orig = node;
-
- Node *edited_scene = EditorNode::get_singleton()->get_edited_scene();
-
- bool found = false;
-
- while (node) {
-
- Ref<SceneState> ss;
-
- if (node == edited_scene) {
- ss = node->get_scene_inherited_state();
-
- } else {
- ss = node->get_scene_instance_state();
- }
-
- if (ss.is_valid()) {
-
- NodePath np = node->get_path_to(orig);
- int node_idx = ss->find_node_by_path(np);
- if (node_idx >= 0) {
- bool lfound = false;
- Variant lvar;
- lvar = ss->get_property_value(node_idx, p_prop, lfound);
- if (lfound) {
-
- found = true;
- value = lvar;
- }
- }
- }
- if (node == edited_scene) {
- //just in case
- break;
- }
- node = node->get_owner();
- }
-
- return found;
-}
-
-bool PropertyEditor::_is_property_different(const Variant &p_current, const Variant &p_orig, int p_usage) {
-
- {
- Node *node = Object::cast_to<Node>(obj);
- if (!node)
- return false;
-
- Node *edited_scene = EditorNode::get_singleton()->get_edited_scene();
- bool found_state = false;
-
- while (node) {
-
- Ref<SceneState> ss;
-
- if (node == edited_scene) {
- ss = node->get_scene_inherited_state();
-
- } else {
- ss = node->get_scene_instance_state();
- }
-
- if (ss.is_valid()) {
- found_state = true;
- }
- if (node == edited_scene) {
- //just in case
- break;
- }
- node = node->get_owner();
- }
-
- if (!found_state)
- return false; //pointless to check if we are not comparing against anything.
- }
-
- if (p_orig.get_type() == Variant::NIL) {
-
- //special cases
- if (p_current.is_zero() && p_usage & PROPERTY_USAGE_STORE_IF_NONZERO)
- return false;
- if (p_current.is_one() && p_usage & PROPERTY_USAGE_STORE_IF_NONONE)
- return false;
- }
-
- if (p_current.get_type() == Variant::REAL && p_orig.get_type() == Variant::REAL) {
- float a = p_current;
- float b = p_orig;
-
- return Math::abs(a - b) > CMP_EPSILON; //this must be done because, as some scenes save as text, there might be a tiny difference in floats due to numerical error
- }
-
- return bool(Variant::evaluate(Variant::OP_NOT_EQUAL, p_current, p_orig));
-}
-
-bool PropertyEditor::_is_instanced_node_with_original_property_different(const String &p_name, TreeItem *item) {
- bool mbi = _might_be_in_instance();
- if (mbi) {
- Variant vorig;
- Dictionary d = item->get_metadata(0);
- int usage = d.has("usage") ? int(int(d["usage"]) & (PROPERTY_USAGE_STORE_IF_NONONE | PROPERTY_USAGE_STORE_IF_NONZERO)) : 0;
- if (_get_instanced_node_original_property(p_name, vorig) || usage) {
- Variant v = obj->get(p_name);
-
- if (_is_property_different(v, vorig, usage)) {
- return true;
- }
- }
- }
- return false;
-}
-
-TreeItem *PropertyEditor::find_item(TreeItem *p_item, const String &p_name) {
-
- if (!p_item)
- return NULL;
-
- String name = p_item->get_metadata(1);
-
- if (name == p_name) {
-
- return p_item;
- }
-
- TreeItem *c = p_item->get_children();
-
- while (c) {
-
- TreeItem *found = find_item(c, p_name);
- if (found)
- return found;
- c = c->get_next();
- }
-
- return NULL;
-}
-
-void PropertyEditor::_changed_callback(Object *p_changed, const char *p_prop) {
-
- _changed_callbacks(p_changed, p_prop);
-}
-
-void PropertyEditor::_changed_callbacks(Object *p_changed, const String &p_prop) {
-
- if (p_changed != obj)
- return;
-
- if (changing)
- return;
-
- if (p_prop == String())
- update_tree_pending = true;
- else {
-
- pending[p_prop] = p_prop;
- }
-}
-
-void PropertyEditor::update_property(const String &p_prop) {
-
- if (obj)
- _changed_callbacks(obj, p_prop);
-}
-
-void PropertyEditor::set_item_text(TreeItem *p_item, int p_type, const String &p_name, int p_hint, const String &p_hint_text) {
-
- switch (p_type) {
-
- case Variant::BOOL: {
-
- p_item->set_checked(1, obj->get(p_name));
- } break;
- case Variant::REAL:
- case Variant::INT: {
-
- if (p_hint == PROPERTY_HINT_LAYERS_2D_PHYSICS || p_hint == PROPERTY_HINT_LAYERS_2D_RENDER || p_hint == PROPERTY_HINT_LAYERS_3D_PHYSICS || p_hint == PROPERTY_HINT_LAYERS_3D_RENDER) {
- tree->update();
- break;
- }
-
- if (p_hint == PROPERTY_HINT_FLAGS) {
- Vector<String> values = p_hint_text.split(",");
- String flags;
- int val = obj->get(p_name);
- for (int i = 0; i < values.size(); i++) {
-
- String v = values[i];
- if (v == "")
- continue;
- if (!(val & (1 << i)))
- continue;
-
- if (flags != "")
- flags += ", ";
- flags += v;
- }
- p_item->set_text(1, flags);
- break;
- }
-
- if (p_hint == PROPERTY_HINT_EXP_EASING) {
-
- p_item->set_text(1, String::num(obj->get(p_name), 2));
- break;
- }
-
- if (p_type == Variant::REAL) {
- p_item->set_range(1, obj->get(p_name));
-
- } else {
- /* FIXME: Why are both statements equal? */
- p_item->set_range(1, obj->get(p_name));
- }
-
- p_item->set_editable(1, !read_only);
-
- } break;
- case Variant::STRING:
-
- if (p_hint == PROPERTY_HINT_TYPE_STRING) {
-
- p_item->set_text(1, obj->get(p_name));
- }
-
- if (p_hint == PROPERTY_HINT_METHOD_OF_VARIANT_TYPE ||
- p_hint == PROPERTY_HINT_METHOD_OF_BASE_TYPE ||
- p_hint == PROPERTY_HINT_METHOD_OF_INSTANCE ||
- p_hint == PROPERTY_HINT_METHOD_OF_SCRIPT ||
- p_hint == PROPERTY_HINT_PROPERTY_OF_VARIANT_TYPE ||
- p_hint == PROPERTY_HINT_PROPERTY_OF_BASE_TYPE ||
- p_hint == PROPERTY_HINT_PROPERTY_OF_INSTANCE ||
- p_hint == PROPERTY_HINT_PROPERTY_OF_SCRIPT) {
-
- p_item->set_text(1, obj->get(p_name));
- }
-
- if (p_hint == PROPERTY_HINT_ENUM) {
-
- Vector<String> strings = p_hint_text.split(",");
- String current = obj->get(p_name);
- int idx = 0;
- for (int x = 0; x < strings.size(); x++) {
- if (strings[x] == current) {
- idx = x;
- break;
- }
- }
- p_item->set_text(1, p_hint_text);
- p_item->set_range(1, idx);
- break;
- }
-
- case Variant::VECTOR3:
- case Variant::QUAT:
- case Variant::VECTOR2:
- case Variant::AABB:
- case Variant::RECT2:
- case Variant::TRANSFORM2D:
- case Variant::BASIS:
- case Variant::TRANSFORM: {
-
- p_item->set_text(1, obj->get(p_name));
-
- } break;
- case Variant::COLOR: {
-
- tree->update();
-
- } break;
- case Variant::NODE_PATH: {
-
- p_item->set_text(1, obj->get(p_name));
- } break;
- case Variant::OBJECT: {
-
- Ref<EncodedObjectAsID> encoded = obj->get(p_name); //for debugger and remote tools
-
- if (encoded.is_valid()) {
-
- p_item->set_text(1, "Object: " + itos(encoded->get_object_id()));
- p_item->set_icon(1, Ref<Texture>());
- p_item->set_custom_as_button(1, true);
-
- } else if (obj->get(p_name).get_type() == Variant::NIL || obj->get(p_name).operator RefPtr().is_null()) {
- p_item->set_text(1, "<null>");
- p_item->set_icon(1, Ref<Texture>());
- p_item->set_custom_as_button(1, false);
-
- Dictionary d = p_item->get_metadata(0);
- int hint = d.has("hint") ? d["hint"].operator int() : -1;
- String hint_text = d.has("hint_text") ? d["hint_text"] : "";
- if (hint == PROPERTY_HINT_RESOURCE_TYPE && hint_text == "Texture") {
- p_item->set_icon(1, NULL);
- }
-
- } else {
- p_item->set_custom_as_button(1, true);
- RES res = obj->get(p_name).operator RefPtr();
- if (res->is_class("Texture")) {
- int tw = EditorSettings::get_singleton()->get("docks/property_editor/texture_preview_width");
- Vector2 size(res->call("get_width"), res->call("get_height"));
- if (size.width < size.height) {
- tw = MAX((size.width / size.height) * tw, 1);
- }
- p_item->set_icon_max_width(1, tw);
- p_item->set_icon(1, res);
- p_item->set_text(1, "");
-
- } else if (res->get_name() != "") {
-
- p_item->set_text(1, res->get_name());
- } else if (res->get_path() != "" && !res->get_path().begins_with("local://")) {
- p_item->set_text(1, res->get_path().get_file());
- } else {
- p_item->set_text(1, "<" + res->get_class() + ">");
- };
-
- if (res.is_valid() && res->get_path().is_resource_file()) {
- p_item->set_tooltip(1, res->get_path());
- } else if (res.is_valid()) {
- p_item->set_tooltip(1, res->get_name() + " (" + res->get_class() + ")");
- }
-
- if (has_icon(res->get_class(), "EditorIcons")) {
-
- p_item->set_icon(0, get_icon(res->get_class(), "EditorIcons"));
- } else {
-
- Dictionary d = p_item->get_metadata(0);
- int hint = d.has("hint") ? d["hint"].operator int() : -1;
- String hint_text = d.has("hint_text") ? d["hint_text"] : "";
- if (hint == PROPERTY_HINT_RESOURCE_TYPE) {
-
- if (has_icon(hint_text, "EditorIcons")) {
-
- p_item->set_icon(0, get_icon(hint_text, "EditorIcons"));
-
- } else {
- p_item->set_icon(0, get_icon("Object", "EditorIcons"));
- }
- }
- }
-
- if (res->is_class("Script")) {
- p_item->set_text(1, res->get_path().get_file());
- } else if (!res->is_class("Texture")) {
- //texture already previews via itself
- EditorResourcePreview::get_singleton()->queue_edited_resource_preview(res, this, "_resource_preview_done", p_item->get_instance_id());
- }
- }
-
- } break;
- default: {};
- }
-}
-
-void PropertyEditor::_check_reload_status(const String &p_name, TreeItem *item) {
-
- bool has_reload = false;
- int found = -1;
- bool is_disabled = false;
-
- for (int i = 0; i < item->get_button_count(1); i++) {
-
- if (item->get_button_id(1, i) == 3) {
- found = i;
- is_disabled = item->is_button_disabled(1, i);
- break;
- }
- }
-
- if (_is_instanced_node_with_original_property_different(p_name, item)) {
- has_reload = true;
- }
-
- if (obj->call("property_can_revert", p_name).operator bool()) {
-
- has_reload = true;
- }
-
- if (!has_reload && !obj->get_script().is_null()) {
- Ref<Script> scr = obj->get_script();
- Variant orig_value;
- if (scr->get_property_default_value(p_name, orig_value)) {
- if (orig_value != obj->get(p_name)) {
- has_reload = true;
- }
- }
- }
-
- if (found != -1 && !has_reload) {
-
- if (!is_disabled) {
- item->erase_button(1, found);
- if (item->get_cell_mode(1) == TreeItem::CELL_MODE_RANGE && item->get_text(1) == String()) {
- item->add_button(1, get_icon("ReloadEmpty", "EditorIcons"), 3, true);
- }
- }
- } else if (found == -1 && has_reload) {
- item->add_button(1, get_icon("ReloadSmall", "EditorIcons"), 3);
- } else if (found != -1 && has_reload && is_disabled) {
- item->erase_button(1, found);
- item->add_button(1, get_icon("ReloadSmall", "EditorIcons"), 3);
- }
-}
-
-bool PropertyEditor::_is_drop_valid(const Dictionary &p_drag_data, const Dictionary &p_item_data) const {
-
- Dictionary d = p_item_data;
-
- if (d.has("type")) {
-
- int type = d["type"];
- if (type == Variant::OBJECT && d.has("hint") && d.has("hint_text") && int(d["hint"]) == PROPERTY_HINT_RESOURCE_TYPE) {
-
- String allowed_type = d["hint_text"];
-
- Dictionary drag_data = p_drag_data;
- if (drag_data.has("type") && String(drag_data["type"]) == "resource") {
- Ref<Resource> res = drag_data["resource"];
- for (int i = 0; i < allowed_type.get_slice_count(","); i++) {
- String at = allowed_type.get_slice(",", i).strip_edges();
- if (res.is_valid() && ClassDB::is_parent_class(res->get_class(), at)) {
- return true;
- }
- }
- }
-
- if (drag_data.has("type") && String(drag_data["type"]) == "files") {
-
- Vector<String> files = drag_data["files"];
-
- if (files.size() == 1) {
- String file = files[0];
- String ftype = EditorFileSystem::get_singleton()->get_file_type(file);
-
- if (ftype != "") {
-
- for (int i = 0; i < allowed_type.get_slice_count(","); i++) {
- String at = allowed_type.get_slice(",", i).strip_edges();
- if (ClassDB::is_parent_class(ftype, at)) {
- return true;
- }
- }
- }
- }
- }
- }
- }
-
- return false;
-}
-void PropertyEditor::_mark_drop_fields(TreeItem *p_at) {
-
- if (_is_drop_valid(get_viewport()->gui_get_drag_data(), p_at->get_metadata(0)))
- p_at->set_custom_bg_color(1, get_color("accent_color", "Editor"), true);
-
- if (p_at->get_children()) {
- _mark_drop_fields(p_at->get_children());
- }
-
- if (p_at->get_next()) {
- _mark_drop_fields(p_at->get_next());
- }
-}
-
-Variant PropertyEditor::get_drag_data_fw(const Point2 &p_point, Control *p_from) {
-
- TreeItem *item = tree->get_item_at_position(p_point);
- if (!item)
- return Variant();
-
- Dictionary d = item->get_metadata(0);
- if (!d.has("name"))
- return Variant();
-
- int col = tree->get_column_at_position(p_point);
- if (col == 0) {
-
- Dictionary dp;
- dp["type"] = "obj_property";
- dp["object"] = obj;
- dp["property"] = d["name"];
- dp["value"] = obj->get(d["name"]);
-
- Label *label = memnew(Label);
- label->set_text(d["name"]);
- set_drag_preview(label);
- return dp;
- }
-
- Variant val = obj->get(d["name"]);
-
- if (val.get_type() == Variant::OBJECT) {
- RES res = val;
- if (res.is_valid()) {
-
- custom_editor->hide_menu();
- return EditorNode::get_singleton()->drag_resource(res, p_from);
- }
- }
-
- return Variant();
-}
-
-bool PropertyEditor::can_drop_data_fw(const Point2 &p_point, const Variant &p_data, Control *p_from) const {
-
- TreeItem *item = tree->get_item_at_position(p_point);
- if (!item)
- return false;
-
- int col = tree->get_column_at_position(p_point);
- if (col != 1)
- return false;
-
- return _is_drop_valid(p_data, item->get_metadata(0));
-}
-void PropertyEditor::drop_data_fw(const Point2 &p_point, const Variant &p_data, Control *p_from) {
-
- TreeItem *item = tree->get_item_at_position(p_point);
- if (!item)
- return;
-
- int col = tree->get_column_at_position(p_point);
- if (col != 1)
- return;
-
- if (!_is_drop_valid(p_data, item->get_metadata(0)))
- return;
-
- Dictionary d = item->get_metadata(0);
-
- if (!d.has("name"))
- return;
-
- String name = d["name"];
-
- Dictionary drag_data = p_data;
- if (drag_data.has("type") && String(drag_data["type"]) == "resource") {
- Ref<Resource> res = drag_data["resource"];
- if (res.is_valid()) {
- _edit_set(name, res);
- return;
- }
- }
-
- if (drag_data.has("type") && String(drag_data["type"]) == "files") {
-
- Vector<String> files = drag_data["files"];
-
- if (files.size() == 1) {
- String file = files[0];
- RES res = ResourceLoader::load(file);
- if (res.is_valid()) {
- _edit_set(name, res);
- return;
- }
- }
- }
-}
-
-void PropertyEditor::_clear_drop_fields(TreeItem *p_at) {
-
- Dictionary d = p_at->get_metadata(0);
-
- if (d.has("type")) {
-
- int type = d["type"];
- if (type == Variant::OBJECT) {
- p_at->clear_custom_bg_color(1);
- }
- }
-
- if (p_at->get_children()) {
- _clear_drop_fields(p_at->get_children());
- }
-
- if (p_at->get_next()) {
- _clear_drop_fields(p_at->get_next());
- }
-}
-
-void PropertyEditor::_notification(int p_what) {
-
- if (p_what == NOTIFICATION_ENTER_TREE) {
-
- get_tree()->connect("node_removed", this, "_node_removed");
- }
- if (p_what == NOTIFICATION_EXIT_TREE) {
-
- get_tree()->disconnect("node_removed", this, "_node_removed");
- edit(NULL);
- }
-
- if (p_what == NOTIFICATION_DRAG_BEGIN) {
-
- if (is_visible_in_tree() && tree->get_root()) {
- _mark_drop_fields(tree->get_root());
- }
- }
-
- if (p_what == NOTIFICATION_DRAG_END) {
- if (is_visible_in_tree() && tree->get_root()) {
- _clear_drop_fields(tree->get_root());
- }
- }
-
- if (p_what == NOTIFICATION_PHYSICS_PROCESS) {
-
- if (refresh_countdown > 0) {
- refresh_countdown -= get_physics_process_delta_time();
- if (refresh_countdown <= 0) {
- TreeItem *root = tree->get_root();
- _refresh_item(root);
- }
- }
-
- changing = true;
-
- if (update_tree_pending) {
-
- update_tree();
- update_tree_pending = false;
-
- } else {
-
- const String *k = NULL;
- while ((k = pending.next(k))) {
-
- TreeItem *item = find_item(tree->get_root(), *k);
- if (!item)
- continue;
-
- _check_reload_status(*k, item);
-
- Dictionary d = item->get_metadata(0);
- set_item_text(item, d["type"], d["name"], d["hint"], d["hint_text"]);
- }
- }
-
- pending.clear();
-
- changing = false;
- }
-
- if (p_what == EditorSettings::NOTIFICATION_EDITOR_SETTINGS_CHANGED) {
- update_tree();
- }
-}
-
-TreeItem *PropertyEditor::get_parent_node(String p_path, HashMap<String, TreeItem *> &item_paths, TreeItem *root, TreeItem *category) {
-
- TreeItem *item = NULL;
-
- if (p_path == "") {
-
- item = category ? category : root;
- } else if (item_paths.has(p_path)) {
-
- item = item_paths.get(p_path);
- } else {
-
- TreeItem *parent = get_parent_node(p_path.left(p_path.find_last("/")), item_paths, root, NULL);
- item = tree->create_item(parent);
-
- String name = (p_path.find("/") != -1) ? p_path.right(p_path.find_last("/") + 1) : p_path;
- item->set_text(0, capitalize_paths ? name.capitalize() : name);
- item->set_tooltip(0, p_path);
- if (item->get_parent() != root) {
- item->set_icon(0, get_icon("Folder", "EditorIcons"));
- }
-
- item->set_editable(0, false);
- if (!subsection_selectable) {
- item->set_expand_right(0, true);
- }
- item->set_selectable(0, subsection_selectable);
- item->set_editable(1, false);
- item->set_selectable(1, subsection_selectable);
-
- if (use_folding) {
- if (!obj->editor_is_section_unfolded(p_path)) {
- updating_folding = true;
- item->set_collapsed(true);
- updating_folding = false;
- }
- item->set_metadata(0, p_path);
- foldable_property_cache.push_back(p_path);
- }
-
- if (item->get_parent() == root) {
-
- item->set_custom_bg_color(0, get_color("prop_subsection", "Editor"));
- item->set_custom_bg_color(1, get_color("prop_subsection", "Editor"));
- }
-
- item_paths[p_path] = item;
- }
-
- return item;
-}
-
-void PropertyEditor::_refresh_item(TreeItem *p_item) {
-
- if (!p_item)
- return;
-
- String name = p_item->get_metadata(1);
-
- if (name != String()) {
-
- _check_reload_status(name, p_item);
- Dictionary d = p_item->get_metadata(0);
- set_item_text(p_item, d["type"], d["name"], d["hint"], d["hint_text"]);
- }
-
- TreeItem *c = p_item->get_children();
-
- while (c) {
-
- _refresh_item(c);
-
- c = c->get_next();
- }
-}
-
-void PropertyEditor::refresh() {
-
- if (refresh_countdown > 0)
- return;
- refresh_countdown = EditorSettings::get_singleton()->get("docks/property_editor/auto_refresh_interval");
-}
-
-void PropertyEditor::update_tree() {
-
- tree->clear();
- foldable_property_cache.clear();
-
- if (!obj)
- return;
-
- HashMap<String, TreeItem *> item_path;
-
- TreeItem *root = tree->create_item(NULL);
- tree->set_hide_root(true);
-
- List<PropertyInfo> plist;
- obj->get_property_list(&plist, true);
-
- bool draw_red = false;
-
- {
- Node *nod = Object::cast_to<Node>(obj);
- Node *es = EditorNode::get_singleton()->get_edited_scene();
- if (nod && es != nod && nod->get_owner() != es) {
- draw_red = true;
- }
- }
-
- Color sscolor = get_color("prop_subsection", "Editor");
-
- TreeItem *current_category = NULL;
-
- String filter = search_box ? search_box->get_text() : "";
- String group;
- String group_base;
-
- for (List<PropertyInfo>::Element *I = plist.front(); I; I = I->next()) {
-
- PropertyInfo &p = I->get();
-
- //make sure the property can be edited
-
- if (p.usage & PROPERTY_USAGE_GROUP) {
-
- group = p.name;
- group_base = p.hint_string;
-
- continue;
-
- } else if (p.usage & PROPERTY_USAGE_CATEGORY) {
-
- group = "";
- group_base = "";
-
- if (!show_categories)
- continue;
-
- List<PropertyInfo>::Element *N = I->next();
- bool valid = true;
- //if no properties in category, skip
- while (N) {
- if (N->get().usage & PROPERTY_USAGE_EDITOR)
- break;
- if (N->get().usage & PROPERTY_USAGE_CATEGORY) {
- valid = false;
- break;
- }
- N = N->next();
- }
- if (!valid)
- continue; //empty, ignore
- TreeItem *sep = tree->create_item(root);
- current_category = sep;
- String type = p.name;
-
- if (has_icon(type, "EditorIcons"))
- sep->set_icon(0, get_icon(type, "EditorIcons"));
- else
- sep->set_icon(0, get_icon("Object", "EditorIcons"));
-
- sep->set_text(0, type);
- sep->set_expand_right(0, true);
- sep->set_selectable(0, false);
- sep->set_selectable(1, false);
- sep->set_custom_bg_color(0, get_color("prop_category", "Editor"));
- sep->set_custom_bg_color(1, get_color("prop_category", "Editor"));
- sep->set_text_align(0, TreeItem::ALIGN_CENTER);
- sep->set_disable_folding(true);
-
- if (use_doc_hints) {
- StringName type = p.name;
- if (!class_descr_cache.has(type)) {
-
- String descr;
- DocData *dd = EditorHelp::get_doc_data();
- Map<String, DocData::ClassDoc>::Element *E = dd->class_list.find(type);
- if (E) {
- descr = E->get().brief_description;
- }
- class_descr_cache[type] = descr.word_wrap(80);
- }
-
- sep->set_tooltip(0, TTR("Class:") + " " + p.name + (class_descr_cache[type] == "" ? "" : "\n\n" + class_descr_cache[type]));
- }
- continue;
-
- } else if (!(p.usage & PROPERTY_USAGE_EDITOR))
- continue;
-
- if (hide_script && p.name == "script")
- continue;
-
- String basename = p.name;
- if (group != "") {
- if (group_base != "") {
- if (basename.begins_with(group_base)) {
- basename = basename.replace_first(group_base, "");
- } else if (group_base.begins_with(basename)) {
- //keep it, this is used pretty often
- } else {
- group = ""; //no longer using group base, clear
- }
- }
- }
-
- if (group != "") {
- basename = group + "/" + basename;
- }
-
- String name = (basename.find("/") != -1) ? basename.right(basename.find_last("/") + 1) : basename;
-
- if (capitalize_paths) {
- int dot = name.find(".");
- if (dot != -1) {
- String ov = name.right(dot);
- name = name.substr(0, dot);
- name = name.camelcase_to_underscore().capitalize();
- name += ov;
-
- } else {
- name = name.camelcase_to_underscore().capitalize();
- }
- }
-
- String path = basename.left(basename.find_last("/"));
-
- if (use_filter && filter != "") {
-
- String cat = path;
-
- if (capitalize_paths)
- cat = cat.capitalize();
-
- if (!filter.is_subsequence_ofi(cat) && !filter.is_subsequence_ofi(name))
- continue;
- }
-
- TreeItem *parent = get_parent_node(path, item_path, root, current_category);
- int level = 0;
- if (parent != root) {
- level++;
- TreeItem *parent_lev = parent;
- while (parent_lev->get_parent() != root) {
- parent_lev = parent_lev->get_parent();
- level++;
- }
- }
- if (level > 4)
- level = 4;
-
- Color col = sscolor;
- col.a = (level / 4.0) * 0.7;
-
- TreeItem *item = tree->create_item(parent);
-
- if (level > 0) {
- item->set_custom_bg_color(0, col);
- }
- item->set_editable(0, false);
- item->set_selectable(0, property_selectable);
-
- if (p.usage & PROPERTY_USAGE_CHECKABLE) {
-
- item->set_cell_mode(0, TreeItem::CELL_MODE_CHECK);
- item->set_selectable(0, true);
- item->set_editable(0, true);
- item->set_checked(0, p.usage & PROPERTY_USAGE_CHECKED);
- }
-
- item->set_text(0, name);
- item->set_tooltip(0, p.name);
-
- if (name.find(".") != -1) {
- Color textcol = get_color("font_color", "Tree");
- textcol.a *= 0.5;
- //override :D
- item->set_custom_color(0, textcol);
- item->set_custom_color(1, textcol);
-
- Color iconcol(1, 1, 1, 0.6);
- item->set_icon_color(0, iconcol);
- item->set_icon_color(1, iconcol);
- }
-
- if (use_doc_hints) {
-
- StringName classname = obj->get_class_name();
- StringName propname = p.name;
- String descr;
- bool found = false;
-
- Map<StringName, Map<StringName, String> >::Element *E = descr_cache.find(classname);
- if (E) {
- Map<StringName, String>::Element *F = E->get().find(propname);
- if (F) {
- found = true;
- descr = F->get();
- }
- }
-
- if (!found) {
- DocData *dd = EditorHelp::get_doc_data();
- Map<String, DocData::ClassDoc>::Element *E = dd->class_list.find(classname);
- while (E && descr == String()) {
- for (int i = 0; i < E->get().properties.size(); i++) {
- if (E->get().properties[i].name == propname.operator String()) {
- descr = E->get().properties[i].description.strip_edges().word_wrap(80);
- break;
- }
- }
- if (!E->get().inherits.empty()) {
- E = dd->class_list.find(E->get().inherits);
- } else {
- break;
- }
- }
- descr_cache[classname][propname] = descr;
- }
-
- item->set_tooltip(0, TTR("Property:") + " " + p.name + (descr == "" ? "" : "\n\n" + descr));
- }
-
- Dictionary d;
- d["name"] = p.name;
- d["type"] = (int)p.type;
- d["hint"] = (int)p.hint;
- d["hint_text"] = p.hint_string;
- d["usage"] = (int)p.usage;
-
- item->set_metadata(0, d);
- item->set_metadata(1, p.name);
-
- if (draw_red)
- item->set_custom_color(0, get_color("error_color", "Editor"));
-
- if (p.name == selected_property) {
-
- item->select(1);
- }
-
- switch (p.type) {
-
- case Variant::BOOL: {
-
- item->set_cell_mode(1, TreeItem::CELL_MODE_CHECK);
- item->set_text(1, TTR("On"));
- item->set_tooltip(1, obj->get(p.name) ? "True" : "False");
- item->set_checked(1, obj->get(p.name));
- if (show_type_icons)
- item->set_icon(0, get_icon("bool", "EditorIcons"));
- item->set_editable(1, !read_only);
-
- } break;
- case Variant::REAL:
- case Variant::INT: {
-
- if (p.hint == PROPERTY_HINT_EXP_EASING) {
-
- item->set_cell_mode(1, TreeItem::CELL_MODE_CUSTOM);
- item->set_text(1, String::num(obj->get(p.name), 2));
- item->set_editable(1, !read_only);
- if (show_type_icons)
- item->set_icon(0, get_icon("Curve", "EditorIcons"));
-
- break;
- }
-
- if (p.hint == PROPERTY_HINT_LAYERS_2D_PHYSICS || p.hint == PROPERTY_HINT_LAYERS_2D_RENDER || p.hint == PROPERTY_HINT_LAYERS_3D_PHYSICS || p.hint == PROPERTY_HINT_LAYERS_3D_RENDER) {
-
- item->set_cell_mode(1, TreeItem::CELL_MODE_CUSTOM);
- item->set_editable(1, !read_only);
- item->set_custom_draw(1, this, "_draw_flags");
- break;
- }
-
- if (p.hint == PROPERTY_HINT_FLAGS) {
-
- item->set_cell_mode(1, TreeItem::CELL_MODE_CUSTOM);
- item->set_editable(1, !read_only);
-
- Vector<String> values = p.hint_string.split(",");
- String flags;
- int val = obj->get(p.name);
- for (int i = 0; i < values.size(); i++) {
-
- String v = values[i];
- if (v == "")
- continue;
- if (!(val & (1 << i)))
- continue;
-
- if (flags != "")
- flags += ", ";
- flags += v;
- }
- item->set_text(1, flags);
- break;
- }
-
- if (p.hint == PROPERTY_HINT_ENUM)
- item->set_cell_mode(1, TreeItem::CELL_MODE_RANGE);
- else
- item->set_cell_mode(1, TreeItem::CELL_MODE_RANGE_EXPRESSION);
-
- if (p.hint == PROPERTY_HINT_SPRITE_FRAME || p.hint == PROPERTY_HINT_RANGE || p.hint == PROPERTY_HINT_EXP_RANGE) {
-
- int c = p.hint_string.get_slice_count(",");
- float min = 0, max = 100, step = p.type == Variant::REAL ? .01 : 1;
- if (c >= 1) {
-
- min = p.hint_string.get_slice(",", 0).to_double();
- }
- if (c >= 2) {
-
- max = p.hint_string.get_slice(",", 1).to_double();
- }
-
- if (p.hint != PROPERTY_HINT_SPRITE_FRAME && c >= 3) {
-
- step = p.hint_string.get_slice(",", 2).to_double();
- }
-
- item->set_range_config(1, min, max, step, p.hint == PROPERTY_HINT_EXP_RANGE);
- } else if (p.hint == PROPERTY_HINT_ENUM) {
-
- item->set_text(1, p.hint_string);
- if (show_type_icons)
- item->set_icon(0, get_icon("Enum", "EditorIcons"));
- item->set_range(1, obj->get(p.name));
- item->set_editable(1, !read_only);
- break;
- } else if (p.hint == PROPERTY_HINT_OBJECT_ID) {
-
- item->set_cell_mode(1, TreeItem::CELL_MODE_CUSTOM);
-
- String type = p.hint_string;
- if (type == "")
- type = "Object";
-
- ObjectID id = obj->get(p.name);
- if (id != 0) {
- item->set_text(1, type + " ID: " + itos(id));
- item->add_button(1, get_icon("EditResource", "EditorIcons"));
- } else {
- item->set_text(1, TTR("[Empty]"));
- }
-
- if (has_icon(p.hint_string, "EditorIcons")) {
- type = p.hint_string;
- } else {
- type = "Object";
- }
-
- item->set_icon(0, get_icon(type, "EditorIcons"));
-
- break;
-
- } else {
- if (p.type == Variant::REAL) {
-
- item->set_range_config(1, -16777216, 16777216, 0.001);
- } else {
-
- item->set_range_config(1, -2147483647, 2147483647, 1);
- }
- };
-
- if (p.type == Variant::REAL) {
- if (show_type_icons)
- item->set_icon(0, get_icon("float", "EditorIcons"));
- item->set_range(1, obj->get(p.name));
-
- } else {
- if (show_type_icons)
- item->set_icon(0, get_icon("int", "EditorIcons"));
- item->set_range(1, obj->get(p.name));
- }
-
- item->set_editable(1, !read_only);
-
- } break;
- case Variant::STRING: {
-
- switch (p.hint) {
-
- case PROPERTY_HINT_DIR:
- case PROPERTY_HINT_FILE:
- case PROPERTY_HINT_GLOBAL_DIR:
- case PROPERTY_HINT_GLOBAL_FILE: {
-
- item->set_cell_mode(1, TreeItem::CELL_MODE_STRING);
- item->set_editable(1, !read_only);
- if (show_type_icons)
- item->set_icon(0, get_icon("File", "EditorIcons"));
- item->set_text(1, obj->get(p.name));
- item->add_button(1, get_icon("Folder", "EditorIcons"));
-
- } break;
- case PROPERTY_HINT_ENUM: {
-
- item->set_cell_mode(1, TreeItem::CELL_MODE_RANGE);
- Vector<String> strings = p.hint_string.split(",");
- String current = obj->get(p.name);
- int idx = 0;
- for (int x = 0; x < strings.size(); x++) {
- if (strings[x] == current) {
- idx = x;
- break;
- }
- }
- item->set_text(1, p.hint_string);
- item->set_range(1, idx);
- item->set_editable(1, !read_only);
- if (show_type_icons)
- item->set_icon(0, get_icon("Enum", "EditorIcons"));
-
- } break;
- case PROPERTY_HINT_METHOD_OF_VARIANT_TYPE: ///< a property of a type
- case PROPERTY_HINT_METHOD_OF_BASE_TYPE: ///< a method of a base type
- case PROPERTY_HINT_METHOD_OF_INSTANCE: ///< a method of an instance
- case PROPERTY_HINT_METHOD_OF_SCRIPT: ///< a method of a script & base
- case PROPERTY_HINT_PROPERTY_OF_VARIANT_TYPE: ///< a property of a type
- case PROPERTY_HINT_PROPERTY_OF_BASE_TYPE: ///< a property of a base type
- case PROPERTY_HINT_PROPERTY_OF_INSTANCE: ///< a property of an instance
- case PROPERTY_HINT_PROPERTY_OF_SCRIPT: ///< a property of a script & base
- case PROPERTY_HINT_TYPE_STRING: {
-
- item->set_cell_mode(1, TreeItem::CELL_MODE_CUSTOM);
- item->set_editable(1, !read_only);
- if (show_type_icons)
- item->set_icon(0, get_icon("String", "EditorIcons"));
- item->set_text(1, obj->get(p.name));
-
- } break;
-
- default: {
-
- item->set_cell_mode(1, TreeItem::CELL_MODE_STRING);
- item->set_editable(1, !read_only);
- if (show_type_icons)
- item->set_icon(0, get_icon("String", "EditorIcons"));
- item->set_text(1, obj->get(p.name));
- if (p.hint == PROPERTY_HINT_MULTILINE_TEXT)
- item->add_button(1, get_icon("MultiLine", "EditorIcons"));
-
- } break;
- }
-
- } break;
- case Variant::ARRAY: {
-
- item->set_cell_mode(1, TreeItem::CELL_MODE_CUSTOM);
- item->add_button(1, get_icon("EditResource", "EditorIcons"));
-
- Variant v = obj->get(p.name);
- String type_name = "Array";
- String type_name_suffix = "";
-
- String hint = p.hint_string;
- while (hint.begins_with(itos(Variant::ARRAY) + ":")) {
- type_name += "<Array";
- type_name_suffix += ">";
- hint = hint.right(2);
- }
- if (hint.find(":") >= 0) {
- int colon_pos = hint.find(":");
- String hint_string = hint.right(colon_pos + 1);
- hint = hint.left(colon_pos);
-
- PropertyHint property_hint = PROPERTY_HINT_NONE;
-
- if (hint.find("/") >= 0) {
- int slash_pos = hint.find("/");
- property_hint = PropertyHint(hint.right(slash_pos + 1).to_int());
- hint = hint.left(slash_pos);
- }
-
- if (property_hint == PROPERTY_HINT_RESOURCE_TYPE) {
- type_name += "<" + hint_string;
- } else {
- type_name += "<" + Variant::get_type_name(Variant::Type(hint.to_int()));
- }
- type_name_suffix += ">";
- }
- type_name += type_name_suffix;
-
- if (v.is_array())
- item->set_text(1, type_name + "(" + itos(v.call("size")) + ")");
- else
- item->set_text(1, type_name + "()");
-
- if (show_type_icons)
- item->set_icon(0, get_icon("PoolByteArray", "EditorIcons"));
-
- } break;
- case Variant::DICTIONARY: {
-
- Variant v = obj->get(p.name);
-
- item->set_cell_mode(1, TreeItem::CELL_MODE_STRING);
- item->set_text(1, String("Dictionary{") + itos(v.call("size")) + "}");
- item->add_button(1, get_icon("EditResource", "EditorIcons"));
-
- if (show_type_icons)
- item->set_icon(0, get_icon("Dictionary", "EditorIcons"));
-
- } break;
-
- case Variant::POOL_INT_ARRAY: {
-
- item->set_cell_mode(1, TreeItem::CELL_MODE_CUSTOM);
- item->add_button(1, get_icon("EditResource", "EditorIcons"));
-
- Variant v = obj->get(p.name);
- if (v.is_array())
- item->set_text(1, "IntArray[" + itos(v.call("size")) + "]");
- else
- item->set_text(1, "IntArray[]");
- if (show_type_icons)
- item->set_icon(0, get_icon("PoolIntArray", "EditorIcons"));
-
- } break;
- case Variant::POOL_REAL_ARRAY: {
-
- item->set_cell_mode(1, TreeItem::CELL_MODE_CUSTOM);
- item->add_button(1, get_icon("EditResource", "EditorIcons"));
-
- Variant v = obj->get(p.name);
- if (v.is_array())
- item->set_text(1, "FloatArray[" + itos(v.call("size")) + "]");
- else
- item->set_text(1, "FloatArray[]");
- if (show_type_icons)
- item->set_icon(0, get_icon("PoolRealArray", "EditorIcons"));
-
- } break;
- case Variant::POOL_STRING_ARRAY: {
-
- item->set_cell_mode(1, TreeItem::CELL_MODE_CUSTOM);
- item->add_button(1, get_icon("EditResource", "EditorIcons"));
-
- Variant v = obj->get(p.name);
- if (v.is_array())
- item->set_text(1, "String[" + itos(v.call("size")) + "]");
- else
- item->set_text(1, "String[]");
- if (show_type_icons)
- item->set_icon(0, get_icon("PoolStringArray", "EditorIcons"));
-
- } break;
- case Variant::POOL_BYTE_ARRAY: {
-
- item->set_cell_mode(1, TreeItem::CELL_MODE_CUSTOM);
- item->add_button(1, get_icon("EditResource", "EditorIcons"));
-
- Variant v = obj->get(p.name);
- if (v.is_array())
- item->set_text(1, "Byte[" + itos(v.call("size")) + "]");
- else
- item->set_text(1, "Byte[]");
- if (show_type_icons)
- item->set_icon(0, get_icon("PoolByteArray", "EditorIcons"));
-
- } break;
- case Variant::POOL_VECTOR2_ARRAY: {
-
- item->set_cell_mode(1, TreeItem::CELL_MODE_CUSTOM);
- item->add_button(1, get_icon("EditResource", "EditorIcons"));
-
- Variant v = obj->get(p.name);
- if (v.is_array())
- item->set_text(1, "Vector2[" + itos(v.call("size")) + "]");
- else
- item->set_text(1, "Vector2[]");
- if (show_type_icons)
- item->set_icon(0, get_icon("Vector2", "EditorIcons"));
-
- } break;
- case Variant::POOL_VECTOR3_ARRAY: {
-
- item->set_cell_mode(1, TreeItem::CELL_MODE_CUSTOM);
- item->add_button(1, get_icon("EditResource", "EditorIcons"));
-
- Variant v = obj->get(p.name);
- if (v.is_array())
- item->set_text(1, "Vector3[" + itos(v.call("size")) + "]");
- else
- item->set_text(1, "Vector3[]");
- if (show_type_icons)
- item->set_icon(0, get_icon("Vector3", "EditorIcons"));
-
- } break;
- case Variant::POOL_COLOR_ARRAY: {
-
- item->set_cell_mode(1, TreeItem::CELL_MODE_CUSTOM);
- item->add_button(1, get_icon("EditResource", "EditorIcons"));
-
- Variant v = obj->get(p.name);
- if (v.is_array())
- item->set_text(1, "Color[" + itos(v.call("size")) + "]");
- else
- item->set_text(1, "Color[]");
- if (show_type_icons)
- item->set_icon(0, get_icon("Color", "EditorIcons"));
-
- } break;
- case Variant::VECTOR2: {
-
- item->set_cell_mode(1, TreeItem::CELL_MODE_CUSTOM);
- item->set_editable(1, true);
- item->set_text(1, obj->get(p.name));
- if (show_type_icons)
- item->set_icon(0, get_icon("Vector2", "EditorIcons"));
-
- } break;
- case Variant::RECT2: {
-
- item->set_cell_mode(1, TreeItem::CELL_MODE_CUSTOM);
- item->set_editable(1, true);
- item->set_text(1, obj->get(p.name));
- if (show_type_icons)
- item->set_icon(0, get_icon("Rect2", "EditorIcons"));
-
- } break;
- case Variant::VECTOR3: {
-
- item->set_cell_mode(1, TreeItem::CELL_MODE_CUSTOM);
- item->set_editable(1, true);
- item->set_text(1, obj->get(p.name));
- if (show_type_icons)
- item->set_icon(0, get_icon("Vector3", "EditorIcons"));
-
- } break;
- case Variant::TRANSFORM2D:
- case Variant::BASIS: {
-
- item->set_cell_mode(1, TreeItem::CELL_MODE_CUSTOM);
- item->set_editable(1, true);
- item->set_text(1, obj->get(p.name));
-
- } break;
- case Variant::TRANSFORM: {
-
- item->set_cell_mode(1, TreeItem::CELL_MODE_CUSTOM);
- item->set_editable(1, true);
- item->set_text(1, obj->get(p.name));
- if (show_type_icons)
- item->set_icon(0, get_icon("Transform", "EditorIcons"));
-
- } break;
- case Variant::PLANE: {
-
- item->set_cell_mode(1, TreeItem::CELL_MODE_CUSTOM);
- item->set_editable(1, true);
- item->set_text(1, obj->get(p.name));
- if (show_type_icons)
- item->set_icon(0, get_icon("Plane", "EditorIcons"));
-
- } break;
- case Variant::AABB: {
-
- item->set_cell_mode(1, TreeItem::CELL_MODE_CUSTOM);
- item->set_editable(1, true);
- item->set_text(1, "AABB");
- if (show_type_icons)
- item->set_icon(0, get_icon("AABB", "EditorIcons"));
-
- } break;
-
- case Variant::QUAT: {
-
- item->set_cell_mode(1, TreeItem::CELL_MODE_CUSTOM);
- item->set_editable(1, true);
- item->set_text(1, obj->get(p.name));
- if (show_type_icons)
- item->set_icon(0, get_icon("Quat", "EditorIcons"));
-
- } break;
- case Variant::COLOR: {
-
- item->set_cell_mode(1, TreeItem::CELL_MODE_CUSTOM);
- item->set_editable(1, !read_only);
- item->set_custom_draw(1, this, "_draw_transparency");
- if (show_type_icons)
- item->set_icon(0, get_icon("Color", "EditorIcons"));
-
- } break;
-
- case Variant::NODE_PATH: {
-
- item->set_cell_mode(1, TreeItem::CELL_MODE_STRING);
- item->set_editable(1, !read_only);
- item->set_text(1, obj->get(p.name));
- item->add_button(1, get_icon("CopyNodePath", "EditorIcons"));
- if (show_type_icons)
- item->set_icon(0, get_icon("NodePath", "EditorIcons"));
-
- } break;
- case Variant::OBJECT: {
-
- item->set_cell_mode(1, TreeItem::CELL_MODE_CUSTOM);
- item->set_editable(1, !read_only);
- String type;
- if (p.hint == PROPERTY_HINT_RESOURCE_TYPE)
- type = p.hint_string;
-
- RES res = obj->get(p.name).operator RefPtr();
- if (type.begins_with("RES:") && type != "RES:") { // Remote resources
- res = ResourceLoader::load(type.substr(4, type.length()));
- }
- Ref<EncodedObjectAsID> encoded = obj->get(p.name); //for debugger and remote tools
-
- if (encoded.is_valid()) {
-
- item->set_text(1, "Object: " + itos(encoded->get_object_id()));
- item->set_icon(1, Ref<Texture>());
- item->set_custom_as_button(1, true);
- item->set_editable(1, true);
-
- } else if (obj->get(p.name).get_type() == Variant::NIL || res.is_null()) {
-
- item->set_text(1, "<null>");
- item->set_icon(1, Ref<Texture>());
- item->set_custom_as_button(1, false);
-
- } else if (res.is_valid()) {
-
- item->set_custom_as_button(1, true);
-
- if (res->is_class("Texture")) {
- int tw = EditorSettings::get_singleton()->get("docks/property_editor/texture_preview_width");
- Vector2 size(res->call("get_width"), res->call("get_height"));
- if (size.width < size.height) {
- tw = MAX((size.width / size.height) * tw, 1);
- }
- item->set_icon_max_width(1, tw);
- item->set_icon(1, res);
- item->set_text(1, "");
-
- } else if (res->get_name() != "") {
-
- item->set_text(1, res->get_name());
- } else if (res->get_path() != "" && !res->get_path().begins_with("local://")) {
- item->set_text(1, res->get_path().get_file());
-
- } else {
- item->set_text(1, "<" + res->get_class() + ">");
- }
-
- if (has_icon(res->get_class(), "EditorIcons")) {
- type = res->get_class();
- }
-
- if (res.is_valid() && res->get_path().is_resource_file()) {
- item->set_tooltip(1, res->get_path());
- } else if (res.is_valid()) {
- item->set_tooltip(1, res->get_name() + " (" + res->get_class() + ")");
- }
- if (res->is_class("Script")) {
- item->set_text(1, res->get_path().get_file());
- } else if (!res->is_class("Texture")) {
- //texture already previews via itself
- EditorResourcePreview::get_singleton()->queue_edited_resource_preview(res, this, "_resource_preview_done", item->get_instance_id());
- }
- }
-
- if (type != String()) {
- if (type.find(",") != -1)
- type = type.get_slice(",", 0);
- if (has_icon(type, "EditorIcons"))
- item->set_icon(0, get_icon(type, "EditorIcons"));
- else
- item->set_icon(0, get_icon("Object", "EditorIcons"));
- }
-
- } break;
- default: {};
- }
-
- if (keying) {
-
- if (p.hint == PROPERTY_HINT_SPRITE_FRAME) {
-
- item->add_button(1, get_icon("KeyNext", "EditorIcons"), 5);
- } else {
- item->add_button(1, get_icon("Key", "EditorIcons"), 2);
- }
- }
-
- bool has_reload = false;
-
- if (_is_instanced_node_with_original_property_different(p.name, item)) {
- item->add_button(1, get_icon("ReloadSmall", "EditorIcons"), 3);
- has_reload = true;
- }
-
- if (obj->call("property_can_revert", p.name).operator bool()) {
-
- item->add_button(1, get_icon("ReloadSmall", "EditorIcons"), 3);
- has_reload = true;
- }
-
- if (!has_reload && !obj->get_script().is_null()) {
- Ref<Script> scr = obj->get_script();
- Variant orig_value;
- if (scr->get_property_default_value(p.name, orig_value)) {
- if (orig_value != obj->get(p.name)) {
- item->add_button(1, get_icon("ReloadSmall", "EditorIcons"), 3);
- has_reload = true;
- }
- }
- }
-
- if (_might_be_in_instance() && !has_reload && item->get_cell_mode(1) == TreeItem::CELL_MODE_RANGE && item->get_text(1) == String()) {
- item->add_button(1, get_icon("ReloadEmpty", "EditorIcons"), 3, true);
- }
- }
-}
-
-void PropertyEditor::_draw_transparency(Object *t, const Rect2 &p_rect) {
-
- TreeItem *ti = Object::cast_to<TreeItem>(t);
- if (!ti)
- return;
-
- Color color = obj->get(ti->get_metadata(1));
- Ref<Texture> arrow = tree->get_icon("select_option");
-
- // make a little space between consecutive color fields
- Rect2 area = p_rect;
- area.position.y += 1;
- area.size.height -= 2;
- area.size.width -= arrow->get_size().width + 5;
- tree->draw_texture_rect(get_icon("GuiMiniCheckerboard", "EditorIcons"), area, true);
- tree->draw_rect(area, color);
-}
-
-void PropertyEditor::_item_folded(Object *item_obj) {
-
- if (updating_folding)
- return;
-
- TreeItem *item = Object::cast_to<TreeItem>(item_obj);
-
- obj->editor_set_section_unfold(item->get_metadata(0), !item->is_collapsed());
-}
-
-void PropertyEditor::_item_selected() {
-
- TreeItem *item = tree->get_selected();
- ERR_FAIL_COND(!item);
- selected_property = item->get_metadata(1);
-}
-
-void PropertyEditor::_item_rmb_edited() {
- _custom_editor_request(true);
-}
-
-void PropertyEditor::_edit_set(const String &p_name, const Variant &p_value, bool p_refresh_all, const String &p_changed_field) {
-
- if (autoclear) {
- TreeItem *item = tree->get_selected();
- if (item && item->get_cell_mode(0) == TreeItem::CELL_MODE_CHECK) {
-
- item->set_checked(0, true);
- }
- }
-
- if (!undo_redo || Object::cast_to<ArrayPropertyEdit>(obj) || Object::cast_to<DictionaryPropertyEdit>(obj)) { //kind of hacky
-
- obj->set(p_name, p_value);
- if (p_refresh_all)
- _changed_callbacks(obj, "");
- else
- _changed_callbacks(obj, p_name);
-
- emit_signal(_prop_edited, p_name);
-
- } else if (Object::cast_to<MultiNodeEdit>(obj)) {
-
- Object::cast_to<MultiNodeEdit>(obj)->set_property_field(p_name, p_value, p_changed_field);
- _changed_callbacks(obj, p_name);
- emit_signal(_prop_edited, p_name);
- } else {
-
- undo_redo->create_action(TTR("Set") + " " + p_name, UndoRedo::MERGE_ENDS);
- undo_redo->add_do_property(obj, p_name, p_value);
- undo_redo->add_undo_property(obj, p_name, obj->get(p_name));
-
- if (p_refresh_all) {
- undo_redo->add_do_method(this, "_changed_callback", obj, "");
- undo_redo->add_undo_method(this, "_changed_callback", obj, "");
- } else {
-
- undo_redo->add_do_method(this, "_changed_callback", obj, p_name);
- undo_redo->add_undo_method(this, "_changed_callback", obj, p_name);
- }
-
- Resource *r = Object::cast_to<Resource>(obj);
- if (r) {
- if (!r->is_edited() && String(p_name) != "resource/edited") {
- undo_redo->add_do_method(r, "set_edited", true);
- undo_redo->add_undo_method(r, "set_edited", false);
- }
-
- if (String(p_name) == "resource_local_to_scene") {
- bool prev = obj->get(p_name);
- bool next = p_value;
- if (next) {
- undo_redo->add_do_method(this, "setup_local_to_scene");
- }
- if (prev) {
- undo_redo->add_undo_method(this, "setup_local_to_scene");
- }
- }
- }
- undo_redo->add_do_method(this, "emit_signal", _prop_edited, p_name);
- undo_redo->add_undo_method(this, "emit_signal", _prop_edited, p_name);
- undo_redo->commit_action();
- }
-}
-
-void PropertyEditor::_item_edited() {
-
- TreeItem *item = tree->get_edited();
- if (!item)
- return; //it all happened too fast..
-
- Dictionary d = item->get_metadata(0);
-
- String name = d["name"];
-
- if (tree->get_edited_column() == 0) {
- //property checked
- if (autoclear) {
- if (!item->is_checked(0)) {
- obj->set(name, Variant());
- update_property(name);
- } else {
- Variant::CallError ce;
- obj->set(name, Variant::construct(Variant::Type(int(d["type"])), NULL, 0, ce));
- }
- } else {
- emit_signal("property_toggled", name, item->is_checked(0));
- }
- return;
- }
-
- if (autoclear && item->get_cell_mode(0) == TreeItem::CELL_MODE_CHECK && item->get_cell_mode(1) != TreeItem::CELL_MODE_CUSTOM) {
- item->set_checked(0, true);
- }
-
- int type = d["type"];
- int hint = d["hint"];
- int usage = d["usage"];
- bool refresh_all = usage & PROPERTY_USAGE_UPDATE_ALL_IF_MODIFIED;
-
- String hint_text = d["hint_text"];
- switch (type) {
-
- case Variant::NIL: {
-
- } break;
- case Variant::BOOL: {
-
- item->set_tooltip(1, item->is_checked(1) ? "True" : "False");
- _edit_set(name, item->is_checked(1), refresh_all);
- } break;
- case Variant::INT:
- case Variant::REAL: {
-
- if (hint == PROPERTY_HINT_LAYERS_2D_PHYSICS || hint == PROPERTY_HINT_LAYERS_2D_RENDER || hint == PROPERTY_HINT_LAYERS_3D_PHYSICS || hint == PROPERTY_HINT_LAYERS_3D_RENDER)
- break;
- if (hint == PROPERTY_HINT_EXP_EASING)
- break;
- if (hint == PROPERTY_HINT_FLAGS)
- break;
-
- if (type == Variant::INT)
- _edit_set(name, int64_t(round(item->get_range(1))), refresh_all);
- else
- _edit_set(name, item->get_range(1), refresh_all);
- } break;
- case Variant::STRING: {
-
- if (hint == PROPERTY_HINT_ENUM) {
-
- int idx = item->get_range(1);
-
- Vector<String> strings = hint_text.split(",");
- String txt;
- if (idx >= 0 && idx < strings.size()) {
-
- txt = strings[idx];
- }
-
- _edit_set(name, txt, refresh_all);
- } else {
- _edit_set(name, item->get_text(1), refresh_all);
- }
- } break;
-
- // math types
- case Variant::VECTOR3: {
-
- } break;
- case Variant::PLANE: {
-
- } break;
- case Variant::QUAT: {
-
- } break;
- case Variant::AABB: {
-
- } break;
- case Variant::BASIS: {
-
- } break;
- case Variant::TRANSFORM: {
-
- } break;
- case Variant::COLOR: {
-
- } break;
-
- case Variant::NODE_PATH: {
- _edit_set(name, NodePath(item->get_text(1)), refresh_all);
-
- } break;
- case Variant::OBJECT: {
- if (!item->is_custom_set_as_button(1))
- break;
-
- Ref<EncodedObjectAsID> encoded = obj->get(name); //for debugger and remote tools
-
- if (encoded.is_valid()) {
-
- emit_signal("object_id_selected", encoded->get_object_id());
- }
-
- RES res = obj->get(name);
- if (res.is_valid()) {
- emit_signal("resource_selected", res.get_ref_ptr(), name);
- }
-
- } break;
-
- case Variant::DICTIONARY: {
-
- } break;
-
- // arrays
- case Variant::POOL_BYTE_ARRAY: {
-
- } break;
- case Variant::POOL_INT_ARRAY: {
-
- } break;
- case Variant::POOL_REAL_ARRAY: {
-
- } break;
- case Variant::POOL_STRING_ARRAY: {
-
- } break;
- case Variant::POOL_VECTOR3_ARRAY: {
-
- } break;
- case Variant::POOL_COLOR_ARRAY: {
-
- } break;
- };
-}
-
-void PropertyEditor::_resource_edit_request() {
-
- RES res = custom_editor->get_variant();
- if (res.is_null())
- return;
-
- String name = custom_editor->get_name();
-
- emit_signal("resource_selected", res.get_ref_ptr(), name);
-}
-
-void PropertyEditor::_custom_editor_edited() {
-
- if (!obj)
- return;
-
- _edit_set(custom_editor->get_name(), custom_editor->get_variant());
-}
-
-void PropertyEditor::_custom_editor_edited_field(const String &p_field_name) {
-
- ERR_FAIL_COND(p_field_name == "");
-
- if (!obj)
- return;
-
- _edit_set(custom_editor->get_name(), custom_editor->get_variant(), false, p_field_name);
-}
-
-void PropertyEditor::_custom_editor_request(bool p_arrow) {
-
- TreeItem *item = tree->get_edited();
- ERR_FAIL_COND(!item);
- Dictionary d = item->get_metadata(0);
-
- String name = d["name"];
- Variant::Type type = Variant::NIL;
- if (d.has("type"))
- type = (Variant::Type)((int)(d["type"]));
-
- Variant v = obj->get(name);
- int hint = d.has("hint") ? d["hint"].operator int() : -1;
- String hint_text = d.has("hint_text") ? d["hint_text"] : "";
- Rect2 where = tree->get_custom_popup_rect();
- custom_editor->set_position(where.position);
-
- if (custom_editor->edit(obj, name, type, v, hint, hint_text)) {
- custom_editor->popup();
- }
-}
-
-void PropertyEditor::edit(Object *p_object) {
-
- if (obj == p_object)
- return;
- if (obj) {
-
- obj->remove_change_receptor(this);
- }
-
- obj = p_object;
-
- evaluator->edit(p_object);
-
- update_tree();
-
- if (obj) {
-
- obj->add_change_receptor(this);
- }
-}
-
-void PropertyEditor::_set_range_def(Object *p_item, String prop, float p_frame) {
-
- TreeItem *ti = Object::cast_to<TreeItem>(p_item);
- ERR_FAIL_COND(!ti);
-
- ti->call_deferred("set_range", 1, p_frame);
- obj->call_deferred("set", prop, p_frame);
-}
-
-void PropertyEditor::_edit_button(Object *p_item, int p_column, int p_button) {
-
- TreeItem *ti = Object::cast_to<TreeItem>(p_item);
- ERR_FAIL_COND(!ti);
-
- Dictionary d = ti->get_metadata(0);
-
- if (p_button == 2) {
-
- if (!d.has("name"))
- return;
- String prop = d["name"];
- emit_signal("property_keyed", prop, obj->get(prop), false);
- } else if (p_button == 5) {
- if (!d.has("name"))
- return;
- String prop = d["name"];
- emit_signal("property_keyed", prop, obj->get(prop), true);
- call_deferred("_set_range_def", ti, prop, ti->get_range(p_column) + 1.0);
- } else if (p_button == 3) {
-
- if (!d.has("name"))
- return;
-
- String prop = d["name"];
-
- Variant vorig;
-
- if (_might_be_in_instance() && _get_instanced_node_original_property(prop, vorig)) {
-
- _edit_set(prop, vorig.duplicate(true)); // Set, making sure to duplicate arrays properly
- return;
- }
-
- if (obj->call("property_can_revert", prop).operator bool()) {
- Variant rev = obj->call("property_get_revert", prop);
- _edit_set(prop, rev);
- }
-
- if (!obj->get_script().is_null()) {
- Ref<Script> scr = obj->get_script();
- Variant orig_value;
- if (scr->get_property_default_value(prop, orig_value)) {
- _edit_set(prop, orig_value);
- }
- }
-
- } else {
-
- Dictionary d = ti->get_metadata(0);
- if (!d.has("type"))
- return;
- if (!d.has("hint"))
- return;
- if (!d.has("name"))
- return;
- if (!d.has("hint_text"))
- return;
-
- int t = d["type"];
- int h = d["hint"];
- String n = d["name"];
- String ht = d["hint_text"];
-
- if (t == Variant::NODE_PATH) {
-
- Variant v = obj->get(n);
- Rect2 where = tree->get_item_rect(ti, 1);
- where.position -= tree->get_scroll();
- where.position += tree->get_global_position() + Point2(where.size.width, 0);
- for (int i = ti->get_button_count(p_column) - 1; i >= p_button; i--)
- where.position.x -= ti->get_button(p_column, i)->get_width();
- custom_editor->set_position(where.position);
- custom_editor->edit(obj, n, (Variant::Type)t, v, h, ht);
- custom_editor->popup();
-
- } else if (t == Variant::STRING) {
-
- Variant v = obj->get(n);
- custom_editor->edit(obj, n, (Variant::Type)t, v, h, ht);
- if (h == PROPERTY_HINT_FILE || h == PROPERTY_HINT_DIR || h == PROPERTY_HINT_GLOBAL_DIR || h == PROPERTY_HINT_GLOBAL_FILE) {
-
- Rect2 where = tree->get_item_rect(ti, 1);
- where.position -= tree->get_scroll();
- where.position += tree->get_global_position() + Point2(where.size.width, 0);
- for (int i = ti->get_button_count(p_column) - 1; i >= p_button; i--)
- where.position.x -= ti->get_button(p_column, i)->get_width();
- custom_editor->set_position(where.position);
- custom_editor->popup();
- } else {
- custom_editor->popup_centered_ratio();
- }
-
- } else if (t == Variant::OBJECT) {
-
- RES r = obj->get(n);
- if (r.is_valid()) {
-
- emit_signal("resource_selected", r, n);
- }
- } else if (t == Variant::INT && h == PROPERTY_HINT_OBJECT_ID) {
-
- emit_signal("object_id_selected", obj->get(n));
-
- } else if (t == Variant::ARRAY || t == Variant::POOL_INT_ARRAY || t == Variant::POOL_REAL_ARRAY || t == Variant::POOL_STRING_ARRAY || t == Variant::POOL_VECTOR2_ARRAY || t == Variant::POOL_VECTOR3_ARRAY || t == Variant::POOL_COLOR_ARRAY || t == Variant::POOL_BYTE_ARRAY) {
-
- Variant v = obj->get(n);
-
- if (v.get_type() != t) {
- Variant::CallError ce;
- v = Variant::construct(Variant::Type(t), NULL, 0, ce);
- }
-
- Ref<ArrayPropertyEdit> ape = memnew(ArrayPropertyEdit);
- ape->edit(obj, n, ht, Variant::Type(t));
- EditorNode::get_singleton()->push_item(ape.ptr());
-
- } else if (t == Variant::DICTIONARY) {
-
- Variant v = obj->get(n);
-
- if (v.get_type() != t) {
- Variant::CallError ce;
- v = Variant::construct(Variant::Type(t), NULL, 0, ce);
- }
-
- Ref<DictionaryPropertyEdit> dpe = memnew(DictionaryPropertyEdit);
- dpe->edit(obj, n);
- EditorNode::get_singleton()->push_item(dpe.ptr());
- }
- }
-}
-
-void PropertyEditor::_node_removed(Node *p_node) {
-
- if (p_node == obj) {
- edit(NULL);
- }
-}
-
-void PropertyEditor::set_keying(bool p_active) {
-
- if (keying == p_active)
- return;
-
- keying = p_active;
- update_tree();
-}
-
-void PropertyEditor::_draw_flags(Object *p_object, const Rect2 &p_rect) {
-
- TreeItem *ti = Object::cast_to<TreeItem>(p_object);
- if (!ti)
- return;
-
- Dictionary d = ti->get_metadata(0);
-
- if (!d.has("name"))
- return;
-
- uint32_t f = obj->get(d["name"]);
-
- int bsize = (p_rect.size.height * 80 / 100) / 2;
-
- int h = bsize * 2 + 1;
- int vofs = (p_rect.size.height - h) / 2;
-
- for (int i = 0; i < 2; i++) {
-
- Point2 ofs(4, vofs);
- if (i == 1)
- ofs.y += bsize + 1;
-
- ofs += p_rect.position;
- for (int j = 0; j < 10; j++) {
-
- Point2 o = ofs + Point2(j * (bsize + 1), 0);
- if (j >= 5)
- o.x += 1;
-
- uint32_t idx = i * 10 + j;
- bool on = f & (1 << idx);
- tree->draw_rect(Rect2(o, Size2(bsize, bsize)), Color(0, 0, 0, on ? 0.8 : 0.3));
- }
- }
-}
-
-void PropertyEditor::_filter_changed(const String &p_text) {
-
- update_tree();
-}
-
-void PropertyEditor::_resource_preview_done(const String &p_path, const Ref<Texture> &p_preview, Variant p_ud) {
-
- if (p_preview.is_null())
- return; //don't bother with empty preview
-
- ObjectID id = p_ud;
- Object *obj = ObjectDB::get_instance(id);
-
- if (!obj)
- return;
-
- TreeItem *ti = Object::cast_to<TreeItem>(obj);
-
- ERR_FAIL_COND(!ti);
-
- int tw = EditorSettings::get_singleton()->get("docks/property_editor/texture_preview_width");
-
- ti->set_icon(1, p_preview); //should be scaled I think?
- ti->set_icon_max_width(1, tw);
- ti->set_text(1, "");
-}
-void PropertyEditor::_bind_methods() {
-
- ClassDB::bind_method("_item_edited", &PropertyEditor::_item_edited);
- ClassDB::bind_method("_item_selected", &PropertyEditor::_item_selected);
- ClassDB::bind_method("_item_rmb_edited", &PropertyEditor::_item_rmb_edited);
- ClassDB::bind_method("_item_folded", &PropertyEditor::_item_folded);
- ClassDB::bind_method("_custom_editor_request", &PropertyEditor::_custom_editor_request);
- ClassDB::bind_method("_custom_editor_edited", &PropertyEditor::_custom_editor_edited);
- ClassDB::bind_method("_custom_editor_edited_field", &PropertyEditor::_custom_editor_edited_field, DEFVAL(""));
- ClassDB::bind_method("_resource_edit_request", &PropertyEditor::_resource_edit_request);
- ClassDB::bind_method("_node_removed", &PropertyEditor::_node_removed);
- ClassDB::bind_method("_edit_button", &PropertyEditor::_edit_button);
- ClassDB::bind_method("_changed_callback", &PropertyEditor::_changed_callbacks);
- ClassDB::bind_method("_draw_flags", &PropertyEditor::_draw_flags);
- ClassDB::bind_method("_set_range_def", &PropertyEditor::_set_range_def);
- ClassDB::bind_method("_filter_changed", &PropertyEditor::_filter_changed);
- ClassDB::bind_method("update_tree", &PropertyEditor::update_tree);
- ClassDB::bind_method("_resource_preview_done", &PropertyEditor::_resource_preview_done);
- ClassDB::bind_method("refresh", &PropertyEditor::refresh);
- ClassDB::bind_method("_draw_transparency", &PropertyEditor::_draw_transparency);
- ClassDB::bind_method("edit", &PropertyEditor::edit);
-
- ClassDB::bind_method(D_METHOD("get_drag_data_fw"), &PropertyEditor::get_drag_data_fw);
- ClassDB::bind_method(D_METHOD("can_drop_data_fw"), &PropertyEditor::can_drop_data_fw);
- ClassDB::bind_method(D_METHOD("drop_data_fw"), &PropertyEditor::drop_data_fw);
-
- ADD_SIGNAL(MethodInfo("property_toggled", PropertyInfo(Variant::STRING, "property"), PropertyInfo(Variant::BOOL, "value")));
- ADD_SIGNAL(MethodInfo("resource_selected", PropertyInfo(Variant::OBJECT, "res"), PropertyInfo(Variant::STRING, "prop")));
- ADD_SIGNAL(MethodInfo("object_id_selected", PropertyInfo(Variant::INT, "id")));
- ADD_SIGNAL(MethodInfo("property_keyed", PropertyInfo(Variant::STRING, "property")));
- ADD_SIGNAL(MethodInfo("property_edited", PropertyInfo(Variant::STRING, "property")));
-}
-
-Tree *PropertyEditor::get_property_tree() {
-
- return tree;
-}
-
-Label *PropertyEditor::get_top_label() {
-
- return top_label;
-}
-
-void PropertyEditor::hide_top_label() {
-
- top_label->hide();
- tree->set_begin(Point2(0, 0));
-}
-
-String PropertyEditor::get_selected_path() const {
-
- TreeItem *ti = tree->get_selected();
- if (!ti)
- return "";
-
- Dictionary d = ti->get_metadata(0);
-
- if (d.has("name"))
- return d["name"];
- else
- return "";
-}
-
-bool PropertyEditor::is_capitalize_paths_enabled() const {
-
- return capitalize_paths;
-}
-
-void PropertyEditor::set_enable_capitalize_paths(bool p_capitalize) {
-
- capitalize_paths = p_capitalize;
- update_tree_pending = true;
-}
-
-void PropertyEditor::set_autoclear(bool p_enable) {
-
- autoclear = p_enable;
-}
-
-void PropertyEditor::set_show_categories(bool p_show) {
-
- show_categories = p_show;
- update_tree();
-}
-
-void PropertyEditor::set_use_filter(bool p_use) {
-
- if (p_use == use_filter)
- return;
-
- use_filter = p_use;
- update_tree();
-}
-
-void PropertyEditor::register_text_enter(Node *p_line_edit) {
-
- ERR_FAIL_NULL(p_line_edit);
- search_box = Object::cast_to<LineEdit>(p_line_edit);
-
- if (search_box)
- search_box->connect("text_changed", this, "_filter_changed");
-}
-
-void PropertyEditor::set_property_selectable(bool p_selectable) {
- property_selectable = p_selectable;
- update_tree();
-}
-
-void PropertyEditor::set_subsection_selectable(bool p_selectable) {
-
- if (p_selectable == subsection_selectable)
- return;
-
- subsection_selectable = p_selectable;
- update_tree();
-}
-
-void PropertyEditor::set_use_folding(bool p_enable) {
-
- use_folding = p_enable;
- tree->set_hide_folding(false);
-}
-
-void PropertyEditor::collapse_all_folding() {
- if (!obj)
- return;
- for (List<String>::Element *E = foldable_property_cache.front(); E; E = E->next()) {
- obj->editor_set_section_unfold(E->get(), false);
- }
- update_tree();
-}
-
-void PropertyEditor::expand_all_folding() {
-
- if (!obj)
- return;
- for (List<String>::Element *E = foldable_property_cache.front(); E; E = E->next()) {
- obj->editor_set_section_unfold(E->get(), true);
- }
- update_tree();
-}
-
-PropertyEditor::PropertyEditor() {
-
- _prop_edited = "property_edited";
-
- hide_script = true;
- use_folding = false;
-
- undo_redo = NULL;
- obj = NULL;
- search_box = NULL;
- changing = false;
- update_tree_pending = false;
-
- top_label = memnew(Label);
- top_label->set_text(TTR("Properties:"));
- top_label->set_anchor(MARGIN_RIGHT, ANCHOR_END);
- top_label->set_begin(Point2(10, 0));
- top_label->set_end(Point2(0, 12));
-
- add_child(top_label);
-
- tree = memnew(Tree);
- tree->set_anchor(MARGIN_RIGHT, ANCHOR_END);
- tree->set_anchor(MARGIN_BOTTOM, ANCHOR_END);
- tree->set_begin(Point2(0, 19));
- tree->set_end(Point2(0, 0));
-
- tree->set_columns(2);
- tree->set_column_expand(0, true);
- tree->set_column_min_width(0, 30);
- tree->set_column_expand(1, true);
- tree->set_column_min_width(1, 18);
- add_child(tree);
-
- tree->connect("item_edited", this, "_item_edited", varray(), CONNECT_DEFERRED);
- tree->connect("item_rmb_edited", this, "_item_rmb_edited");
- tree->connect("cell_selected", this, "_item_selected");
- tree->connect("item_collapsed", this, "_item_folded");
-
- tree->set_drag_forwarding(this);
-
- set_physics_process(true);
-
- custom_editor = memnew(CustomPropertyEditor);
- custom_editor->set_pass_on_modal_close_click(false);
- add_child(custom_editor);
-
- tree->connect("custom_popup_edited", this, "_custom_editor_request");
- tree->connect("button_pressed", this, "_edit_button");
- custom_editor->connect("variant_changed", this, "_custom_editor_edited");
- custom_editor->connect("variant_field_changed", this, "_custom_editor_edited_field");
- custom_editor->connect("resource_edit_request", this, "_resource_edit_request", make_binds(), CONNECT_DEFERRED);
- tree->set_hide_folding(true);
-
- evaluator = memnew(PropertyValueEvaluator);
- tree->set_value_evaluator(evaluator);
- custom_editor->set_value_evaluator(evaluator);
-
- capitalize_paths = true;
- autoclear = false;
- tree->set_column_titles_visible(false);
- tree->add_constant_override("button_margin", 0);
-
- keying = false;
- read_only = false;
- show_categories = false;
- refresh_countdown = 0;
- use_doc_hints = false;
- updating_folding = true;
- use_filter = false;
- subsection_selectable = false;
- property_selectable = false;
- show_type_icons = false; // TODO: need to reimplement it to work with the new inspector
-}
-
-PropertyEditor::~PropertyEditor() {
- memdelete(evaluator);
-}
-
/////////////////////////////
-class SectionedPropertyEditorFilter : public Object {
-
- GDCLASS(SectionedPropertyEditorFilter, Object);
-
- Object *edited;
- String section;
- bool allow_sub;
-
- bool _set(const StringName &p_name, const Variant &p_value) {
-
- if (!edited)
- return false;
-
- String name = p_name;
- if (section != "") {
- name = section + "/" + name;
- }
-
- bool valid;
- edited->set(name, p_value, &valid);
- return valid;
- }
-
- bool _get(const StringName &p_name, Variant &r_ret) const {
-
- if (!edited)
- return false;
-
- String name = p_name;
- if (section != "") {
- name = section + "/" + name;
- }
-
- bool valid = false;
-
- r_ret = edited->get(name, &valid);
- return valid;
- }
- void _get_property_list(List<PropertyInfo> *p_list) const {
-
- if (!edited)
- return;
-
- List<PropertyInfo> pinfo;
- edited->get_property_list(&pinfo);
- for (List<PropertyInfo>::Element *E = pinfo.front(); E; E = E->next()) {
-
- PropertyInfo pi = E->get();
- int sp = pi.name.find("/");
-
- if (pi.name == "resource_path" || pi.name == "resource_name" || pi.name == "resource_local_to_scene" || pi.name.begins_with("script/")) //skip resource stuff
- continue;
-
- if (sp == -1) {
- pi.name = "global/" + pi.name;
- }
-
- if (pi.name.begins_with(section + "/")) {
- pi.name = pi.name.replace_first(section + "/", "");
- if (!allow_sub && pi.name.find("/") != -1)
- continue;
- p_list->push_back(pi);
- }
- }
- }
-
- bool property_can_revert(const String &p_name) {
-
- return edited->call("property_can_revert", section + "/" + p_name);
- }
-
- Variant property_get_revert(const String &p_name) {
-
- return edited->call("property_get_revert", section + "/" + p_name);
- }
-
-protected:
- static void _bind_methods() {
-
- ClassDB::bind_method("property_can_revert", &SectionedPropertyEditorFilter::property_can_revert);
- ClassDB::bind_method("property_get_revert", &SectionedPropertyEditorFilter::property_get_revert);
- }
-
-public:
- void set_section(const String &p_section, bool p_allow_sub) {
-
- section = p_section;
- allow_sub = p_allow_sub;
- _change_notify();
- }
-
- void set_edited(Object *p_edited) {
- edited = p_edited;
- _change_notify();
- }
-
- SectionedPropertyEditorFilter() {
- edited = NULL;
- }
-};
-
-void SectionedPropertyEditor::_bind_methods() {
-
- ClassDB::bind_method("_section_selected", &SectionedPropertyEditor::_section_selected);
- ClassDB::bind_method("_search_changed", &SectionedPropertyEditor::_search_changed);
-
- ClassDB::bind_method("update_category_list", &SectionedPropertyEditor::update_category_list);
-}
-
-void SectionedPropertyEditor::_section_selected() {
-
- if (!sections->get_selected())
- return;
-
- filter->set_section(sections->get_selected()->get_metadata(0), sections->get_selected()->get_children() == NULL);
-}
-
-void SectionedPropertyEditor::set_current_section(const String &p_section) {
-
- if (section_map.has(p_section)) {
- section_map[p_section]->select(0);
- }
-}
-
-String SectionedPropertyEditor::get_current_section() const {
-
- if (sections->get_selected())
- return sections->get_selected()->get_metadata(0);
- else
- return "";
-}
-
-String SectionedPropertyEditor::get_full_item_path(const String &p_item) {
-
- String base = get_current_section();
-
- if (base != "")
- return base + "/" + p_item;
- else
- return p_item;
-}
-
-void SectionedPropertyEditor::edit(Object *p_object) {
-
- if (!p_object) {
- obj = -1;
- sections->clear();
-
- filter->set_edited(NULL);
- editor->edit(NULL);
-
- return;
- }
-
- ObjectID id = p_object->get_instance_id();
-
- if (obj != id) {
-
- obj = id;
- update_category_list();
-
- filter->set_edited(p_object);
- editor->edit(filter);
-
- if (sections->get_root()->get_children()) {
- sections->get_root()->get_children()->select(0);
- }
- } else {
-
- update_category_list();
- }
-}
-
-void SectionedPropertyEditor::update_category_list() {
-
- String selected_category = get_current_section();
- sections->clear();
-
- Object *o = ObjectDB::get_instance(obj);
-
- if (!o)
- return;
-
- List<PropertyInfo> pinfo;
- o->get_property_list(&pinfo);
-
- section_map.clear();
-
- TreeItem *root = sections->create_item();
- section_map[""] = root;
-
- for (List<PropertyInfo>::Element *E = pinfo.front(); E; E = E->next()) {
-
- PropertyInfo pi = E->get();
-
- if (pi.usage & PROPERTY_USAGE_CATEGORY)
- continue;
- else if (!(pi.usage & PROPERTY_USAGE_EDITOR))
- continue;
-
- if (pi.name.find(":") != -1 || pi.name == "script" || pi.name == "resource_name" || pi.name == "resource_path" || pi.name == "resource_local_to_scene")
- continue;
-
- if (search_box && search_box->get_text() != String() && pi.name.findn(search_box->get_text()) == -1)
- continue;
-
- int sp = pi.name.find("/");
- if (sp == -1)
- pi.name = "Global/" + pi.name;
-
- Vector<String> sectionarr = pi.name.split("/");
- String metasection;
-
- int sc = MIN(2, sectionarr.size() - 1);
-
- for (int i = 0; i < sc; i++) {
-
- TreeItem *parent = section_map[metasection];
- parent->set_custom_bg_color(0, get_color("prop_subsection", "Editor"));
-
- if (i > 0) {
- metasection += "/" + sectionarr[i];
- } else {
- metasection = sectionarr[i];
- }
-
- if (!section_map.has(metasection)) {
- TreeItem *ms = sections->create_item(parent);
- section_map[metasection] = ms;
- ms->set_text(0, sectionarr[i].capitalize());
- ms->set_metadata(0, metasection);
- ms->set_selectable(0, false);
- }
-
- if (i == sc - 1) {
- //if it has children, make selectable
- section_map[metasection]->set_selectable(0, true);
- }
- }
- }
-
- if (section_map.has(selected_category)) {
- section_map[selected_category]->select(0);
- }
-
- editor->update_tree();
-}
-
-void SectionedPropertyEditor::register_search_box(LineEdit *p_box) {
-
- search_box = p_box;
- editor->register_text_enter(p_box);
- search_box->connect("text_changed", this, "_search_changed");
-}
-
-void SectionedPropertyEditor::_search_changed(const String &p_what) {
-
- update_category_list();
-}
-
-PropertyEditor *SectionedPropertyEditor::get_property_editor() {
-
- return editor;
-}
-
-SectionedPropertyEditor::SectionedPropertyEditor() {
-
- obj = -1;
-
- search_box = NULL;
-
- add_constant_override("autohide", 1); // Fixes the dragger always showing up
-
- VBoxContainer *left_vb = memnew(VBoxContainer);
- left_vb->set_custom_minimum_size(Size2(170, 0) * EDSCALE);
- add_child(left_vb);
-
- sections = memnew(Tree);
- sections->set_v_size_flags(SIZE_EXPAND_FILL);
- sections->set_hide_root(true);
-
- left_vb->add_child(sections, true);
-
- VBoxContainer *right_vb = memnew(VBoxContainer);
- right_vb->set_custom_minimum_size(Size2(300, 0) * EDSCALE);
- right_vb->set_h_size_flags(SIZE_EXPAND_FILL);
- add_child(right_vb);
-
- filter = memnew(SectionedPropertyEditorFilter);
- editor = memnew(PropertyEditor);
- editor->set_v_size_flags(SIZE_EXPAND_FILL);
- right_vb->add_child(editor, true);
-
- editor->get_property_tree()->set_column_titles_visible(false);
-
- editor->hide_top_label();
-
- sections->connect("cell_selected", this, "_section_selected");
-}
-
-SectionedPropertyEditor::~SectionedPropertyEditor() {
-
- memdelete(filter);
-}
-
double PropertyValueEvaluator::eval(const String &p_text) {
// If range value contains a comma replace it with dot (issue #6028)
diff --git a/editor/property_editor.h b/editor/property_editor.h
index 7d8fa22f3f..7d7ab912ea 100644
--- a/editor/property_editor.h
+++ b/editor/property_editor.h
@@ -175,180 +175,6 @@ public:
CustomPropertyEditor();
};
-class PropertyEditor : public Control {
-
- GDCLASS(PropertyEditor, Control);
-
- Tree *tree;
- Label *top_label;
- LineEdit *search_box;
-
- PropertyValueEvaluator *evaluator;
-
- Object *obj;
-
- StringName _prop_edited;
-
- bool capitalize_paths;
- bool changing;
- bool update_tree_pending;
- bool autoclear;
- bool keying;
- bool read_only;
- bool show_categories;
- bool show_type_icons;
- float refresh_countdown;
- bool use_doc_hints;
- bool use_filter;
- bool subsection_selectable;
- bool hide_script;
- bool use_folding;
- bool property_selectable;
- bool updating_folding;
-
- List<String> foldable_property_cache;
- HashMap<String, String> pending;
- String selected_property;
-
- Map<StringName, Map<StringName, String> > descr_cache;
- Map<StringName, String> class_descr_cache;
-
- CustomPropertyEditor *custom_editor;
-
- void _resource_edit_request();
- void _custom_editor_edited();
- void _custom_editor_edited_field(const String &p_field_name);
- void _custom_editor_request(bool p_arrow);
-
- void _item_selected();
- void _item_rmb_edited();
- void _item_edited();
- TreeItem *get_parent_node(String p_path, HashMap<String, TreeItem *> &item_paths, TreeItem *root, TreeItem *category);
-
- void set_item_text(TreeItem *p_item, int p_type, const String &p_name, int p_hint = PROPERTY_HINT_NONE, const String &p_hint_text = "");
-
- TreeItem *find_item(TreeItem *p_item, const String &p_name);
-
- virtual void _changed_callback(Object *p_changed, const char *p_prop);
- virtual void _changed_callbacks(Object *p_changed, const String &p_prop);
-
- void _check_reload_status(const String &p_name, TreeItem *item);
-
- void _edit_button(Object *p_item, int p_column, int p_button);
-
- void _node_removed(Node *p_node);
-
- friend class ProjectExportDialog;
- void _edit_set(const String &p_name, const Variant &p_value, bool p_refresh_all = false, const String &p_changed_field = "");
- void _draw_flags(Object *p_object, const Rect2 &p_rect);
-
- bool _might_be_in_instance();
- bool _get_instanced_node_original_property(const StringName &p_prop, Variant &value);
- bool _is_property_different(const Variant &p_current, const Variant &p_orig, int p_usage = 0);
- bool _is_instanced_node_with_original_property_different(const String &p_name, TreeItem *item);
-
- void _refresh_item(TreeItem *p_item);
- void _set_range_def(Object *p_item, String prop, float p_frame);
-
- void _filter_changed(const String &p_text);
-
- void _mark_drop_fields(TreeItem *p_at);
- void _clear_drop_fields(TreeItem *p_at);
-
- bool _is_drop_valid(const Dictionary &p_drag_data, const Dictionary &p_item_data) const;
- Variant get_drag_data_fw(const Point2 &p_point, Control *p_from);
- bool can_drop_data_fw(const Point2 &p_point, const Variant &p_data, Control *p_from) const;
- void drop_data_fw(const Point2 &p_point, const Variant &p_data, Control *p_from);
-
- void _resource_preview_done(const String &p_path, const Ref<Texture> &p_preview, Variant p_ud);
- void _draw_transparency(Object *t, const Rect2 &p_rect);
- void _item_folded(Object *item_obj);
-
- UndoRedo *undo_redo;
-
-protected:
- void _notification(int p_what);
- static void _bind_methods();
-
-public:
- void set_undo_redo(UndoRedo *p_undo_redo) { undo_redo = p_undo_redo; }
-
- String get_selected_path() const;
-
- Tree *get_property_tree();
- Label *get_top_label();
- void hide_top_label();
- void update_tree();
- void update_property(const String &p_prop);
-
- void refresh();
-
- void edit(Object *p_object);
-
- void set_keying(bool p_active);
- void set_read_only(bool p_read_only) {
- read_only = p_read_only;
- custom_editor->set_read_only(p_read_only);
- }
-
- bool is_capitalize_paths_enabled() const;
- void set_enable_capitalize_paths(bool p_capitalize);
- void set_autoclear(bool p_enable);
-
- void set_show_categories(bool p_show);
- void set_use_doc_hints(bool p_enable) { use_doc_hints = p_enable; }
- void set_hide_script(bool p_hide) { hide_script = p_hide; }
-
- void set_use_filter(bool p_use);
- void register_text_enter(Node *p_line_edit);
-
- void set_subsection_selectable(bool p_selectable);
- void set_property_selectable(bool p_selectable);
-
- void set_use_folding(bool p_enable);
-
- void collapse_all_folding();
- void expand_all_folding();
-
- PropertyEditor();
- ~PropertyEditor();
-};
-
-class SectionedPropertyEditorFilter;
-
-class SectionedPropertyEditor : public HSplitContainer {
-
- GDCLASS(SectionedPropertyEditor, HSplitContainer);
-
- ObjectID obj;
-
- Tree *sections;
- SectionedPropertyEditorFilter *filter;
-
- Map<String, TreeItem *> section_map;
- PropertyEditor *editor;
- LineEdit *search_box;
-
- static void _bind_methods();
- void _section_selected();
-
- void _search_changed(const String &p_what);
-
-public:
- void register_search_box(LineEdit *p_box);
- PropertyEditor *get_property_editor();
- void edit(Object *p_object);
- String get_full_item_path(const String &p_item);
-
- void set_current_section(const String &p_section);
- String get_current_section() const;
-
- void update_category_list();
-
- SectionedPropertyEditor();
- ~SectionedPropertyEditor();
-};
-
class PropertyValueEvaluator : public ValueEvaluator {
GDCLASS(PropertyValueEvaluator, ValueEvaluator);
diff --git a/editor/property_selector.cpp b/editor/property_selector.cpp
index dae1bdeeb0..c9eba33f35 100644
--- a/editor/property_selector.cpp
+++ b/editor/property_selector.cpp
@@ -30,8 +30,8 @@
#include "property_selector.h"
+#include "core/os/keyboard.h"
#include "editor_scale.h"
-#include "os/keyboard.h"
void PropertySelector::_text_changed(const String &p_newtext) {
diff --git a/editor/pvrtc_compress.cpp b/editor/pvrtc_compress.cpp
index 57a2b0d97f..b1c847570c 100644
--- a/editor/pvrtc_compress.cpp
+++ b/editor/pvrtc_compress.cpp
@@ -30,11 +30,11 @@
#include "pvrtc_compress.h"
+#include "core/io/resource_loader.h"
+#include "core/io/resource_saver.h"
+#include "core/os/file_access.h"
+#include "core/os/os.h"
#include "editor_settings.h"
-#include "io/resource_loader.h"
-#include "io/resource_saver.h"
-#include "os/file_access.h"
-#include "os/os.h"
#include "scene/resources/texture.h"
static void (*_base_image_compress_pvrtc2_func)(Image *) = NULL;
diff --git a/editor/pvrtc_compress.h b/editor/pvrtc_compress.h
index cdd2f0d242..0396837623 100644
--- a/editor/pvrtc_compress.h
+++ b/editor/pvrtc_compress.h
@@ -31,7 +31,7 @@
#ifndef PVRTC_COMPRESS_H
#define PVRTC_COMPRESS_H
-#include "image.h"
+#include "core/image.h"
void _pvrtc_register_compressors();
diff --git a/editor/quick_open.cpp b/editor/quick_open.cpp
index d2101f1e00..497596a508 100644
--- a/editor/quick_open.cpp
+++ b/editor/quick_open.cpp
@@ -30,7 +30,7 @@
#include "quick_open.h"
-#include "os/keyboard.h"
+#include "core/os/keyboard.h"
void EditorQuickOpen::popup(const StringName &p_base, bool p_enable_multi, bool p_add_dirs, bool p_dontclear) {
diff --git a/editor/quick_open.h b/editor/quick_open.h
index ecc6af0c53..ffea6b52bd 100644
--- a/editor/quick_open.h
+++ b/editor/quick_open.h
@@ -31,8 +31,8 @@
#ifndef EDITOR_QUICK_OPEN_H
#define EDITOR_QUICK_OPEN_H
+#include "core/pair.h"
#include "editor_file_system.h"
-#include "pair.h"
#include "scene/gui/dialogs.h"
#include "scene/gui/tree.h"
class EditorQuickOpen : public ConfirmationDialog {
diff --git a/editor/rename_dialog.cpp b/editor/rename_dialog.cpp
index bffd7bd155..47e1ae0dab 100644
--- a/editor/rename_dialog.cpp
+++ b/editor/rename_dialog.cpp
@@ -30,12 +30,12 @@
#include "rename_dialog.h"
+#include "core/print_string.h"
#include "editor_node.h"
#include "editor_settings.h"
#include "editor_themes.h"
#include "modules/regex/regex.h"
#include "plugins/script_editor_plugin.h"
-#include "print_string.h"
#include "scene/gui/control.h"
#include "scene/gui/label.h"
#include "scene/gui/tab_container.h"
diff --git a/editor/rename_dialog.h b/editor/rename_dialog.h
index c5ebc30c0c..fa558660a4 100644
--- a/editor/rename_dialog.h
+++ b/editor/rename_dialog.h
@@ -37,8 +37,8 @@
#include "scene/gui/option_button.h"
#include "scene/gui/spin_box.h"
+#include "core/undo_redo.h"
#include "editor/scene_tree_editor.h"
-#include "undo_redo.h"
/**
@author Blazej Floch
diff --git a/editor/reparent_dialog.cpp b/editor/reparent_dialog.cpp
index da8bfdbbd2..3a6864b052 100644
--- a/editor/reparent_dialog.cpp
+++ b/editor/reparent_dialog.cpp
@@ -30,7 +30,7 @@
#include "reparent_dialog.h"
-#include "print_string.h"
+#include "core/print_string.h"
#include "scene/gui/box_container.h"
#include "scene/gui/label.h"
diff --git a/editor/scene_tree_dock.cpp b/editor/scene_tree_dock.cpp
index 18de2a6221..9461f39aeb 100644
--- a/editor/scene_tree_dock.cpp
+++ b/editor/scene_tree_dock.cpp
@@ -224,7 +224,7 @@ void SceneTreeDock::_perform_instance_scenes(const Vector<String> &p_files, Node
String new_name = parent->validate_child_name(instanced_scene);
ScriptEditorDebugger *sed = ScriptEditor::get_singleton()->get_debugger();
editor_data->get_undo_redo().add_do_method(sed, "live_debug_instance_node", edited_scene->get_path_to(parent), p_files[i], new_name);
- editor_data->get_undo_redo().add_undo_method(sed, "live_debug_remove_node", NodePath(String(edited_scene->get_path_to(parent)) + "/" + new_name));
+ editor_data->get_undo_redo().add_undo_method(sed, "live_debug_remove_node", NodePath(String(edited_scene->get_path_to(parent)).plus_file(new_name)));
}
editor_data->get_undo_redo().commit_action();
@@ -354,9 +354,9 @@ void SceneTreeDock::_tool_selected(int p_tool, bool p_confirm_override) {
if (path == "") {
String root_path = editor_data->get_edited_scene_root()->get_filename();
if (root_path == "") {
- path = "res://" + selected->get_name();
+ path = String("res://").plus_file(selected->get_name());
} else {
- path = root_path.get_base_dir() + "/" + selected->get_name();
+ path = root_path.get_base_dir().plus_file(selected->get_name());
}
}
@@ -535,7 +535,7 @@ void SceneTreeDock::_tool_selected(int p_tool, bool p_confirm_override) {
ScriptEditorDebugger *sed = ScriptEditor::get_singleton()->get_debugger();
editor_data->get_undo_redo().add_do_method(sed, "live_debug_duplicate_node", edited_scene->get_path_to(node), dup->get_name());
- editor_data->get_undo_redo().add_undo_method(sed, "live_debug_remove_node", NodePath(String(edited_scene->get_path_to(parent)) + "/" + dup->get_name()));
+ editor_data->get_undo_redo().add_undo_method(sed, "live_debug_remove_node", NodePath(String(edited_scene->get_path_to(parent)).plus_file(dup->get_name())));
}
editor_data->get_undo_redo().commit_action();
@@ -1429,7 +1429,7 @@ void SceneTreeDock::_do_reparent(Node *p_new_parent, int p_position_in_parent, V
}
editor_data->get_undo_redo().add_do_method(sed, "live_debug_reparent_node", edited_scene->get_path_to(node), edited_scene->get_path_to(new_parent), new_name, p_position_in_parent + inc);
- editor_data->get_undo_redo().add_undo_method(sed, "live_debug_reparent_node", NodePath(String(edited_scene->get_path_to(new_parent)) + "/" + new_name), edited_scene->get_path_to(node->get_parent()), node->get_name(), node->get_index());
+ editor_data->get_undo_redo().add_undo_method(sed, "live_debug_reparent_node", NodePath(String(edited_scene->get_path_to(new_parent)).plus_file(new_name)), edited_scene->get_path_to(node->get_parent()), node->get_name(), node->get_index());
if (p_keep_global_xform) {
if (Object::cast_to<Node2D>(node))
@@ -1661,7 +1661,7 @@ void SceneTreeDock::_create() {
String new_name = parent->validate_child_name(child);
ScriptEditorDebugger *sed = ScriptEditor::get_singleton()->get_debugger();
editor_data->get_undo_redo().add_do_method(sed, "live_debug_create_node", edited_scene->get_path_to(parent), child->get_class(), new_name);
- editor_data->get_undo_redo().add_undo_method(sed, "live_debug_remove_node", NodePath(String(edited_scene->get_path_to(parent)) + "/" + new_name));
+ editor_data->get_undo_redo().add_undo_method(sed, "live_debug_remove_node", NodePath(String(edited_scene->get_path_to(parent)).plus_file(new_name)));
} else {
@@ -1816,6 +1816,13 @@ void SceneTreeDock::_new_scene_from(String p_file) {
return;
}
+ if (EditorNode::get_singleton()->is_scene_open(p_file)) {
+ accept->get_ok()->set_text(TTR("OK"));
+ accept->set_text(TTR("Can't overwrite scene that is still open!"));
+ accept->popup_centered_minsize();
+ return;
+ }
+
Node *base = selection.front()->get();
Map<Node *, Node *> reown;
diff --git a/editor/scene_tree_editor.cpp b/editor/scene_tree_editor.cpp
index a916ae23f6..a45773003a 100644
--- a/editor/scene_tree_editor.cpp
+++ b/editor/scene_tree_editor.cpp
@@ -30,11 +30,11 @@
#include "scene_tree_editor.h"
+#include "core/message_queue.h"
+#include "core/print_string.h"
#include "editor/plugins/animation_player_editor_plugin.h"
#include "editor/plugins/canvas_item_editor_plugin.h"
#include "editor_node.h"
-#include "message_queue.h"
-#include "print_string.h"
#include "scene/gui/label.h"
#include "scene/main/viewport.h"
#include "scene/resources/packed_scene.h"
diff --git a/editor/scene_tree_editor.h b/editor/scene_tree_editor.h
index c4f63f5736..e575fb986a 100644
--- a/editor/scene_tree_editor.h
+++ b/editor/scene_tree_editor.h
@@ -31,12 +31,12 @@
#ifndef SCENE_TREE_EDITOR_H
#define SCENE_TREE_EDITOR_H
+#include "core/undo_redo.h"
#include "editor_data.h"
#include "editor_settings.h"
#include "scene/gui/button.h"
#include "scene/gui/dialogs.h"
#include "scene/gui/tree.h"
-#include "undo_redo.h"
/**
@author Juan Linietsky <reduzio@gmail.com>
*/
diff --git a/editor/script_create_dialog.cpp b/editor/script_create_dialog.cpp
index 24c4ba4cb7..be255ba4aa 100644
--- a/editor/script_create_dialog.cpp
+++ b/editor/script_create_dialog.cpp
@@ -30,13 +30,13 @@
#include "script_create_dialog.h"
+#include "core/io/resource_saver.h"
+#include "core/os/file_access.h"
+#include "core/project_settings.h"
+#include "core/script_language.h"
#include "editor/editor_node.h"
#include "editor/editor_scale.h"
#include "editor_file_system.h"
-#include "io/resource_saver.h"
-#include "os/file_access.h"
-#include "project_settings.h"
-#include "script_language.h"
void ScriptCreateDialog::_notification(int p_what) {
@@ -56,6 +56,7 @@ void ScriptCreateDialog::config(const String &p_base_name, const String &p_base_
class_name->deselect();
parent_name->set_text(p_base_name);
parent_name->deselect();
+
if (p_base_path != "") {
initial_bp = p_base_path.get_basename();
file_path->set_text(initial_bp + "." + ScriptServer::get_language(language_menu->get_selected())->get_extension());
@@ -359,7 +360,7 @@ void ScriptCreateDialog::_path_changed(const String &p_path) {
is_path_valid = false;
is_new_script_created = true;
- String p = p_path;
+ String p = p_path.strip_edges();
if (p == "") {
_msg_path_valid(false, TTR("Path is empty"));
@@ -367,6 +368,12 @@ void ScriptCreateDialog::_path_changed(const String &p_path) {
return;
}
+ if (p.get_file().get_basename() == "") {
+ _msg_path_valid(false, TTR("Filename is empty"));
+ _update_dialog();
+ return;
+ }
+
p = ProjectSettings::get_singleton()->localize_path(p);
if (!p.begins_with("res://")) {
_msg_path_valid(false, TTR("Path is not local"));
diff --git a/editor/script_editor_debugger.cpp b/editor/script_editor_debugger.cpp
index 9db53fe5f5..b451092709 100644
--- a/editor/script_editor_debugger.cpp
+++ b/editor/script_editor_debugger.cpp
@@ -30,11 +30,12 @@
#include "script_editor_debugger.h"
+#include "core/project_settings.h"
+#include "core/ustring.h"
#include "editor_node.h"
#include "editor_profiler.h"
#include "editor_settings.h"
#include "main/performance.h"
-#include "project_settings.h"
#include "property_editor.h"
#include "scene/gui/dialogs.h"
#include "scene/gui/label.h"
@@ -47,7 +48,6 @@
#include "scene/gui/texture_button.h"
#include "scene/gui/tree.h"
#include "scene/resources/packed_scene.h"
-#include "ustring.h"
class ScriptEditorDebuggerVariables : public Object {
@@ -396,7 +396,6 @@ void ScriptEditorDebugger::_parse_message(const String &p_msg, const Array &p_da
dobreak->set_disabled(false);
docontinue->set_disabled(true);
emit_signal("breaked", false, false, Variant());
- //tabs->set_current_tab(0);
profiler->set_enabled(true);
profiler->disable_seeking();
inspector->edit(NULL);
@@ -712,27 +711,65 @@ void ScriptEditorDebugger::_parse_message(const String &p_msg, const Array &p_da
bool warning = err[9];
bool e;
String time = String("%d:%02d:%02d:%04d").sprintf(vals, &e);
- String txt = time + " - " + (err[8].is_zero() ? String(err[7]) : String(err[8]));
+ String txt = err[8].is_zero() ? String(err[7]) : String(err[8]);
- String tooltip = TTR("Type:") + String(warning ? TTR("Warning") : TTR("Error"));
- tooltip += "\n" + TTR("Description:") + " " + String(err[8]);
- tooltip += "\n" + TTR("Time:") + " " + time;
- tooltip += "\nC " + TTR("Error:") + " " + String(err[7]);
- tooltip += "\nC " + TTR("Source:") + " " + String(err[5]) + ":" + String(err[6]);
- tooltip += "\nC " + TTR("Function:") + " " + String(err[4]);
+ TreeItem *r = error_tree->get_root();
+ if (!r) {
+ r = error_tree->create_item();
+ }
- error_list->add_item(txt, EditorNode::get_singleton()->get_gui_base()->get_icon(warning ? "Warning" : "Error", "EditorIcons"));
- error_list->set_item_tooltip(error_list->get_item_count() - 1, tooltip);
+ TreeItem *error = error_tree->create_item(r);
+ error->set_collapsed(true);
- int scc = p_data[1];
+ error->set_icon(0, get_icon(warning ? "Warning" : "Error", "EditorIcons"));
+ error->set_text(0, time);
+ error->set_text_align(0, TreeItem::ALIGN_LEFT);
+
+ error->set_text(1, txt);
+
+ String source(err[5]);
+ bool source_is_project_file = source.begins_with("res://");
+ if (source_is_project_file)
+ source = source.get_file();
+
+ txt = source + ":" + String(err[6]);
+ String method = err[4];
+ if (method.length() > 0)
+ txt += " @ " + method + "()";
+
+ TreeItem *c_info = error_tree->create_item(error);
+ c_info->set_text(0, "<" + TTR(source_is_project_file ? "Source" : "C Source") + ">");
+ c_info->set_text(1, txt);
+ c_info->set_text_align(0, TreeItem::ALIGN_LEFT);
- Array stack;
- stack.resize(scc);
- for (int i = 0; i < scc; i++) {
- stack[i] = p_data[2 + i];
+ if (source_is_project_file) {
+ Array meta;
+ meta.push_back(source);
+ meta.push_back(err[6]);
+ error->set_metadata(0, meta);
+ c_info->set_metadata(0, meta);
}
- error_list->set_item_metadata(error_list->get_item_count() - 1, stack);
+ int scc = p_data[1];
+
+ for (int i = 0; i < scc; i += 3) {
+ String script = p_data[2 + i];
+ String method = p_data[3 + i];
+ int line = p_data[4 + i];
+ TreeItem *stack_trace = error_tree->create_item(error);
+
+ Array meta;
+ meta.push_back(script);
+ meta.push_back(line);
+ stack_trace->set_metadata(0, meta);
+
+ if (i == 0) {
+ stack_trace->set_text(0, "<" + TTR("Stack Trace") + ">");
+ stack_trace->set_text_align(0, TreeItem::ALIGN_LEFT);
+ error->set_metadata(0, meta);
+ }
+ stack_trace->set_text(1, script.get_file() + ":" + itos(line) + " @ " + method + "()");
+ }
if (warning)
warning_count++;
@@ -970,8 +1007,8 @@ void ScriptEditorDebugger::_notification(int p_what) {
//scene_tree_refresh->set_icon( get_icon("Reload","EditorIcons"));
le_set->connect("pressed", this, "_live_edit_set");
le_clear->connect("pressed", this, "_live_edit_clear");
- error_list->connect("item_selected", this, "_error_selected");
- error_stack->connect("item_selected", this, "_error_stack_selected");
+ error_tree->connect("item_selected", this, "_error_selected");
+ error_tree->connect("item_activated", this, "_error_activated");
vmem_refresh->set_icon(get_icon("Reload", "EditorIcons"));
reason->add_color_override("font_color", get_color("error_color", "Editor"));
@@ -1017,19 +1054,19 @@ void ScriptEditorDebugger::_notification(int p_what) {
if (error_count != last_error_count || warning_count != last_warning_count) {
if (error_count == 0 && warning_count == 0) {
- error_split->set_name(TTR("Errors"));
+ error_tree->set_name(TTR("Errors"));
debugger_button->set_text(TTR("Debugger"));
debugger_button->set_icon(Ref<Texture>());
- tabs->set_tab_icon(error_split->get_index(), Ref<Texture>());
+ tabs->set_tab_icon(error_tree->get_index(), Ref<Texture>());
} else {
- error_split->set_name(TTR("Errors") + " (" + itos(error_count + warning_count) + ")");
+ error_tree->set_name(TTR("Errors") + " (" + itos(error_count + warning_count) + ")");
debugger_button->set_text(TTR("Debugger") + " (" + itos(error_count + warning_count) + ")");
if (error_count == 0) {
debugger_button->set_icon(get_icon("Warning", "EditorIcons"));
- tabs->set_tab_icon(error_split->get_index(), get_icon("Warning", "EditorIcons"));
+ tabs->set_tab_icon(error_tree->get_index(), get_icon("Warning", "EditorIcons"));
} else {
debugger_button->set_icon(get_icon("Error", "EditorIcons"));
- tabs->set_tab_icon(error_split->get_index(), get_icon("Error", "EditorIcons"));
+ tabs->set_tab_icon(error_tree->get_index(), get_icon("Error", "EditorIcons"));
}
}
last_error_count = error_count;
@@ -1060,8 +1097,7 @@ void ScriptEditorDebugger::_notification(int p_what) {
inspect_scene_tree->clear();
le_set->set_disabled(true);
le_clear->set_disabled(false);
- error_list->clear();
- error_stack->clear();
+ error_tree->clear();
error_count = 0;
warning_count = 0;
profiler_signature.clear();
@@ -1659,45 +1695,52 @@ void ScriptEditorDebugger::reload_scripts() {
}
}
-void ScriptEditorDebugger::_error_selected(int p_idx) {
+void ScriptEditorDebugger::_error_activated() {
+ TreeItem *selected = error_tree->get_selected();
- error_stack->clear();
- Array st = error_list->get_item_metadata(p_idx);
- for (int i = 0; i < st.size(); i += 3) {
+ TreeItem *ci = selected->get_children();
+ if (ci) {
+ selected->set_collapsed(!selected->is_collapsed());
+ }
+}
- String script = st[i];
- String func = st[i + 1];
- int line = st[i + 2];
- Array md;
- md.push_back(st[i]);
- md.push_back(st[i + 1]);
- md.push_back(st[i + 2]);
+void ScriptEditorDebugger::_error_selected() {
+ TreeItem *selected = error_tree->get_selected();
- String str = func;
- String tooltip_str = TTR("Function:") + " " + func;
- if (script.length() > 0) {
- str += " in " + script.get_file();
- tooltip_str = TTR("File:") + " " + script + "\n" + tooltip_str;
- if (line > 0) {
- str += ":line " + itos(line);
- tooltip_str += "\n" + TTR("Line:") + " " + itos(line);
- }
- }
+ Array meta = selected->get_metadata(0);
+
+ if (meta.size() == 0) {
+ return;
+ }
+
+ Ref<Script> s = ResourceLoader::load(meta[0]);
+ emit_signal("goto_script_line", s, int(meta[1]) - 1);
+}
+
+void ScriptEditorDebugger::_expand_errors_list() {
+
+ TreeItem *root = error_tree->get_root();
+ if (!root)
+ return;
- error_stack->add_item(str);
- error_stack->set_item_metadata(error_stack->get_item_count() - 1, md);
- error_stack->set_item_tooltip(error_stack->get_item_count() - 1, tooltip_str);
+ TreeItem *item = root->get_children();
+ while (item) {
+ item->set_collapsed(false);
+ item = item->get_next();
}
}
-void ScriptEditorDebugger::_error_stack_selected(int p_idx) {
+void ScriptEditorDebugger::_collapse_errors_list() {
- Array arr = error_stack->get_item_metadata(p_idx);
- if (arr.size() != 3)
+ TreeItem *root = error_tree->get_root();
+ if (!root)
return;
- Ref<Script> s = ResourceLoader::load(arr[0]);
- emit_signal("goto_script_line", s, int(arr[2]) - 1);
+ TreeItem *item = root->get_children();
+ while (item) {
+ item->set_collapsed(true);
+ item = item->get_next();
+ }
}
void ScriptEditorDebugger::set_hide_on_stop(bool p_hide) {
@@ -1754,27 +1797,24 @@ void ScriptEditorDebugger::_clear_remote_objects() {
void ScriptEditorDebugger::_clear_errors_list() {
- error_list->clear();
+ error_tree->clear();
error_count = 0;
warning_count = 0;
_notification(NOTIFICATION_PROCESS);
}
// Right click on specific file(s) or folder(s).
-void ScriptEditorDebugger::_error_list_item_rmb_selected(int p_item, const Vector2 &p_pos) {
+void ScriptEditorDebugger::_error_tree_item_rmb_selected(const Vector2 &p_pos) {
item_menu->clear();
item_menu->set_size(Size2(1, 1));
- // Allow specific actions only on one item.
- bool single_item_selected = error_list->get_selected_items().size() == 1;
-
- if (single_item_selected) {
+ if (error_tree->is_anything_selected()) {
item_menu->add_icon_item(get_icon("ActionCopy", "EditorIcons"), TTR("Copy Error"), ITEM_MENU_COPY_ERROR);
}
if (item_menu->get_item_count() > 0) {
- item_menu->set_position(error_list->get_global_position() + p_pos);
+ item_menu->set_position(error_tree->get_global_position() + p_pos);
item_menu->popup();
}
}
@@ -1784,10 +1824,30 @@ void ScriptEditorDebugger::_item_menu_id_pressed(int p_option) {
switch (p_option) {
case ITEM_MENU_COPY_ERROR: {
- String title = error_list->get_item_text(error_list->get_current());
- String desc = error_list->get_item_tooltip(error_list->get_current());
+ TreeItem *ti = error_tree->get_selected();
+ while (ti->get_parent() != error_tree->get_root())
+ ti = ti->get_parent();
+
+ String type;
+
+ if (ti->get_icon(0) == get_icon("Warning", "EditorIcons")) {
+ type = "W ";
+ } else if (ti->get_icon(0) == get_icon("Error", "EditorIcons")) {
+ type = "E ";
+ }
+
+ String text = ti->get_text(0) + " ";
+ int rpad_len = text.length();
+
+ text = type + text + ti->get_text(1) + "\n";
+ TreeItem *ci = ti->get_children();
+ while (ci) {
+ text += " " + ci->get_text(0).rpad(rpad_len) + ci->get_text(1) + "\n";
+ ci = ci->get_next();
+ }
+
+ OS::get_singleton()->set_clipboard(text);
- OS::get_singleton()->set_clipboard(title + "\n----------\n" + desc);
} break;
case ITEM_MENU_SAVE_REMOTE_NODE: {
@@ -1826,12 +1886,14 @@ void ScriptEditorDebugger::_bind_methods() {
ClassDB::bind_method(D_METHOD("_live_edit_clear"), &ScriptEditorDebugger::_live_edit_clear);
ClassDB::bind_method(D_METHOD("_error_selected"), &ScriptEditorDebugger::_error_selected);
- ClassDB::bind_method(D_METHOD("_error_stack_selected"), &ScriptEditorDebugger::_error_stack_selected);
+ ClassDB::bind_method(D_METHOD("_error_activated"), &ScriptEditorDebugger::_error_activated);
+ ClassDB::bind_method(D_METHOD("_expand_errors_list"), &ScriptEditorDebugger::_expand_errors_list);
+ ClassDB::bind_method(D_METHOD("_collapse_errors_list"), &ScriptEditorDebugger::_collapse_errors_list);
ClassDB::bind_method(D_METHOD("_profiler_activate"), &ScriptEditorDebugger::_profiler_activate);
ClassDB::bind_method(D_METHOD("_profiler_seeked"), &ScriptEditorDebugger::_profiler_seeked);
ClassDB::bind_method(D_METHOD("_clear_errors_list"), &ScriptEditorDebugger::_clear_errors_list);
- ClassDB::bind_method(D_METHOD("_error_list_item_rmb_selected"), &ScriptEditorDebugger::_error_list_item_rmb_selected);
+ ClassDB::bind_method(D_METHOD("_error_tree_item_rmb_selected"), &ScriptEditorDebugger::_error_tree_item_rmb_selected);
ClassDB::bind_method(D_METHOD("_item_menu_id_pressed"), &ScriptEditorDebugger::_item_menu_id_pressed);
ClassDB::bind_method(D_METHOD("_paused"), &ScriptEditorDebugger::_paused);
@@ -1946,16 +2008,14 @@ ScriptEditorDebugger::ScriptEditorDebugger(EditorNode *p_editor) {
stack_dump->connect("cell_selected", this, "_stack_dump_frame_selected");
sc->add_child(stack_dump);
- inspector = memnew(PropertyEditor);
+ inspector = memnew(EditorInspector);
inspector->set_h_size_flags(SIZE_EXPAND_FILL);
- inspector->hide_top_label();
- inspector->get_property_tree()->set_column_title(0, TTR("Variable"));
inspector->set_enable_capitalize_paths(false);
inspector->set_read_only(true);
inspector->connect("object_id_selected", this, "_scene_tree_property_select_object");
sc->add_child(inspector);
- server = TCP_Server::create_ref();
+ server.instance();
pending_in_queue = 0;
@@ -1967,44 +2027,52 @@ ScriptEditorDebugger::ScriptEditorDebugger(EditorNode *p_editor) {
}
{ //errors
-
- error_split = memnew(HSplitContainer);
VBoxContainer *errvb = memnew(VBoxContainer);
+ errvb->set_name(TTR("Errors"));
+
HBoxContainer *errhb = memnew(HBoxContainer);
- errvb->set_h_size_flags(SIZE_EXPAND_FILL);
- Label *velb = memnew(Label(TTR("Errors:")));
- velb->set_h_size_flags(SIZE_EXPAND_FILL);
- errhb->add_child(velb);
+ errvb->add_child(errhb);
+
+ Button *expand_all = memnew(Button);
+ expand_all->set_text(TTR("Expand All"));
+ expand_all->connect("pressed", this, "_expand_errors_list");
+ errhb->add_child(expand_all);
+
+ Button *collapse_all = memnew(Button);
+ collapse_all->set_text(TTR("Collapse All"));
+ collapse_all->connect("pressed", this, "_collapse_errors_list");
+ errhb->add_child(collapse_all);
+
+ Control *space = memnew(Control);
+ space->set_h_size_flags(SIZE_EXPAND_FILL);
+ errhb->add_child(space);
clearbutton = memnew(Button);
clearbutton->set_text(TTR("Clear"));
+ clearbutton->set_h_size_flags(0);
clearbutton->connect("pressed", this, "_clear_errors_list");
errhb->add_child(clearbutton);
- errvb->add_child(errhb);
- error_list = memnew(ItemList);
- error_list->set_v_size_flags(SIZE_EXPAND_FILL);
- error_list->set_h_size_flags(SIZE_EXPAND_FILL);
- error_list->connect("item_rmb_selected", this, "_error_list_item_rmb_selected");
- error_list->set_allow_rmb_select(true);
- error_list->set_autoscroll_to_bottom(true);
+ error_tree = memnew(Tree);
+ error_tree->set_columns(2);
- item_menu = memnew(PopupMenu);
- item_menu->connect("id_pressed", this, "_item_menu_id_pressed");
- error_list->add_child(item_menu);
+ error_tree->set_column_expand(0, false);
+ error_tree->set_column_min_width(0, 140);
- errvb->add_child(error_list);
+ error_tree->set_column_expand(1, true);
- error_split->add_child(errvb);
+ error_tree->set_select_mode(Tree::SELECT_ROW);
+ error_tree->set_hide_root(true);
+ error_tree->set_v_size_flags(SIZE_EXPAND_FILL);
+ error_tree->set_allow_rmb_select(true);
+ error_tree->connect("item_rmb_selected", this, "_error_tree_item_rmb_selected");
+ errvb->add_child(error_tree);
- errvb = memnew(VBoxContainer);
- errvb->set_h_size_flags(SIZE_EXPAND_FILL);
- error_stack = memnew(ItemList);
- errvb->add_margin_child(TTR("Stack Trace (if applicable):"), error_stack, true);
- error_split->add_child(errvb);
+ item_menu = memnew(PopupMenu);
+ item_menu->connect("id_pressed", this, "_item_menu_id_pressed");
+ error_tree->add_child(item_menu);
- error_split->set_name(TTR("Errors"));
- tabs->add_child(error_split);
+ tabs->add_child(errvb);
}
{ // remote scene tree
@@ -2180,7 +2248,6 @@ ScriptEditorDebugger::ScriptEditorDebugger(EditorNode *p_editor) {
ScriptEditorDebugger::~ScriptEditorDebugger() {
- //inspector->edit(NULL);
memdelete(variables);
ppeer->set_stream_peer(Ref<StreamPeer>());
diff --git a/editor/script_editor_debugger.h b/editor/script_editor_debugger.h
index ce705aa35b..cebf6d785e 100644
--- a/editor/script_editor_debugger.h
+++ b/editor/script_editor_debugger.h
@@ -33,12 +33,12 @@
#include "core/io/packet_peer.h"
#include "core/io/tcp_server.h"
-#include "property_editor.h"
+#include "editor/editor_inspector.h"
+#include "editor/property_editor.h"
#include "scene/gui/box_container.h"
#include "scene/gui/button.h"
class Tree;
-class PropertyEditor;
class EditorNode;
class ScriptEditorDebuggerVariables;
class LineEdit;
@@ -88,8 +88,7 @@ class ScriptEditorDebugger : public Control {
Set<ObjectID> unfold_cache;
HSplitContainer *error_split;
- ItemList *error_list;
- ItemList *error_stack;
+ Tree *error_tree;
Tree *inspect_scene_tree;
Button *clearbutton;
PopupMenu *item_menu;
@@ -130,7 +129,7 @@ class ScriptEditorDebugger : public Control {
LineEdit *vmem_total;
Tree *stack_dump;
- PropertyEditor *inspector;
+ EditorInspector *inspector;
Ref<TCP_Server> server;
Ref<StreamPeerTCP> connection;
@@ -179,8 +178,11 @@ class ScriptEditorDebugger : public Control {
void _method_changed(Object *p_base, const StringName &p_name, VARIANT_ARG_DECLARE);
void _property_changed(Object *p_base, const StringName &p_property, const Variant &p_value);
- void _error_selected(int p_idx);
- void _error_stack_selected(int p_idx);
+ void _error_activated();
+ void _error_selected();
+
+ void _expand_errors_list();
+ void _collapse_errors_list();
void _profiler_activate(bool p_enable);
void _profiler_seeked();
@@ -191,7 +193,7 @@ class ScriptEditorDebugger : public Control {
void _clear_remote_objects();
void _clear_errors_list();
- void _error_list_item_rmb_selected(int p_item, const Vector2 &p_pos);
+ void _error_tree_item_rmb_selected(const Vector2 &p_pos);
void _item_menu_id_pressed(int p_option);
protected:
diff --git a/editor/settings_config_dialog.cpp b/editor/settings_config_dialog.cpp
index 4ebba73cb3..97cdd43fee 100644
--- a/editor/settings_config_dialog.cpp
+++ b/editor/settings_config_dialog.cpp
@@ -30,11 +30,11 @@
#include "settings_config_dialog.h"
+#include "core/os/keyboard.h"
+#include "core/project_settings.h"
#include "editor_file_system.h"
#include "editor_node.h"
#include "editor_settings.h"
-#include "os/keyboard.h"
-#include "project_settings.h"
#include "scene/gui/margin_container.h"
#include "script_editor_debugger.h"
diff --git a/editor/spatial_editor_gizmos.cpp b/editor/spatial_editor_gizmos.cpp
index 00067b84f7..3097f0d0b9 100644
--- a/editor/spatial_editor_gizmos.cpp
+++ b/editor/spatial_editor_gizmos.cpp
@@ -30,8 +30,8 @@
#include "spatial_editor_gizmos.h"
-#include "geometry.h"
-#include "quick_hull.h"
+#include "core/math/geometry.h"
+#include "core/math/quick_hull.h"
#include "scene/3d/audio_stream_player_3d.h"
#include "scene/3d/baked_lightmap.h"
#include "scene/3d/collision_polygon.h"
@@ -55,6 +55,7 @@
#include "scene/3d/visibility_notifier.h"
#include "scene/resources/box_shape.h"
#include "scene/resources/capsule_shape.h"
+#include "scene/resources/concave_polygon_shape.h"
#include "scene/resources/convex_polygon_shape.h"
#include "scene/resources/cylinder_shape.h"
#include "scene/resources/plane_shape.h"
@@ -908,7 +909,6 @@ void LightSpatialGizmoPlugin::redraw(EditorSpatialGizmo *p_gizmo) {
}
p_gizmo->add_lines(lines, material);
- p_gizmo->add_collision_segments(lines);
p_gizmo->add_unscaled_billboard(icon, 0.05);
}
@@ -939,8 +939,6 @@ void LightSpatialGizmoPlugin::redraw(EditorSpatialGizmo *p_gizmo) {
}
p_gizmo->add_lines(points, material, true);
- p_gizmo->add_collision_segments(points);
-
p_gizmo->add_unscaled_billboard(icon, 0.05);
Vector<Vector3> handles;
@@ -982,38 +980,14 @@ void LightSpatialGizmoPlugin::redraw(EditorSpatialGizmo *p_gizmo) {
p_gizmo->add_lines(points, material);
+ float ra = 16 * Math_PI * 2.0 / 64.0;
+ Point2 a = Vector2(Math::sin(ra), Math::cos(ra)) * w;
+
Vector<Vector3> handles;
handles.push_back(Vector3(0, 0, -r));
-
- Vector<Vector3> collision_segments;
-
- for (int i = 0; i < 64; i++) {
-
- float ra = i * Math_PI * 2.0 / 64.0;
- float rb = (i + 1) * Math_PI * 2.0 / 64.0;
- Point2 a = Vector2(Math::sin(ra), Math::cos(ra)) * w;
- Point2 b = Vector2(Math::sin(rb), Math::cos(rb)) * w;
-
- collision_segments.push_back(Vector3(a.x, a.y, -d));
- collision_segments.push_back(Vector3(b.x, b.y, -d));
-
- if (i % 16 == 0) {
-
- collision_segments.push_back(Vector3(a.x, a.y, -d));
- collision_segments.push_back(Vector3());
- }
-
- if (i == 16) {
-
- handles.push_back(Vector3(a.x, a.y, -d));
- }
- }
-
- collision_segments.push_back(Vector3(0, 0, -r));
- collision_segments.push_back(Vector3());
+ handles.push_back(Vector3(a.x, a.y, -d));
p_gizmo->add_handles(handles, get_material("handles"));
- p_gizmo->add_collision_segments(collision_segments);
p_gizmo->add_unscaled_billboard(icon, 0.05);
}
}
@@ -1149,7 +1123,6 @@ void AudioStreamPlayer3DSpatialGizmoPlugin::redraw(EditorSpatialGizmo *p_gizmo)
}
p_gizmo->add_lines(points, material);
- p_gizmo->add_collision_segments(points);
Vector<Vector3> handles;
float ha = Math::deg2rad(player->get_emission_angle());
@@ -1344,7 +1317,6 @@ void CameraSpatialGizmoPlugin::redraw(EditorSpatialGizmo *p_gizmo) {
}
p_gizmo->add_lines(lines, material);
- p_gizmo->add_collision_segments(lines);
p_gizmo->add_unscaled_billboard(icon, 0.05);
p_gizmo->add_handles(handles, get_material("handles"));
@@ -1387,7 +1359,6 @@ void CameraSpatialGizmoPlugin::redraw(EditorSpatialGizmo *p_gizmo) {
}
p_gizmo->add_lines(lines, material);
- p_gizmo->add_collision_segments(lines);
}
}
@@ -2123,12 +2094,10 @@ void SoftBodySpatialGizmoPlugin::redraw(EditorSpatialGizmo *p_gizmo) {
Vector<Vector3> points;
soft_body->get_mesh()->generate_debug_mesh_indices(points);
- soft_body->get_mesh()->clear_cache();
Ref<Material> material = get_material("shape_material", p_gizmo);
p_gizmo->add_lines(lines, material);
- p_gizmo->add_collision_segments(lines);
p_gizmo->add_handles(points, get_material("handles"));
p_gizmo->add_collision_triangles(tm);
}
@@ -2445,7 +2414,6 @@ void ParticlesGizmoPlugin::redraw(EditorSpatialGizmo *p_gizmo) {
Ref<Material> icon = get_material("particles_icon", p_gizmo);
p_gizmo->add_lines(lines, material);
- p_gizmo->add_collision_segments(lines);
if (p_gizmo->is_selected()) {
Ref<Material> solid_material = get_material("particles_solid_material", p_gizmo);
@@ -2630,7 +2598,6 @@ void ReflectionProbeGizmoPlugin::redraw(EditorSpatialGizmo *p_gizmo) {
}
p_gizmo->add_unscaled_billboard(icon, 0.05);
- p_gizmo->add_collision_segments(lines);
p_gizmo->add_handles(handles, get_material("handles"));
}
@@ -2745,7 +2712,6 @@ void GIProbeGizmoPlugin::redraw(EditorSpatialGizmo *p_gizmo) {
}
p_gizmo->add_lines(lines, material);
- p_gizmo->add_collision_segments(lines);
lines.clear();
@@ -2915,7 +2881,6 @@ void BakedIndirectLightGizmoPlugin::redraw(EditorSpatialGizmo *p_gizmo) {
}
p_gizmo->add_lines(lines, material);
- p_gizmo->add_collision_segments(lines);
Vector<Vector3> handles;
@@ -3506,6 +3471,14 @@ void CollisionShapeSpatialGizmoPlugin::redraw(EditorSpatialGizmo *p_gizmo) {
}
}
+ if (Object::cast_to<ConcavePolygonShape>(*s)) {
+
+ Ref<ConcavePolygonShape> cs = s;
+ Ref<ArrayMesh> mesh = cs->get_debug_mesh()->duplicate();
+ mesh->surface_set_material(0, material);
+ p_gizmo->add_mesh(mesh);
+ }
+
if (Object::cast_to<RayShape>(*s)) {
Ref<RayShape> rs = s;
diff --git a/editor/translations/extract.py b/editor/translations/extract.py
index 0dee1819dd..ebb032fd6f 100755
--- a/editor/translations/extract.py
+++ b/editor/translations/extract.py
@@ -88,7 +88,7 @@ def process_file(f, fname):
unique_str.append(msg)
unique_loc[msg] = [location]
elif (not location in unique_loc[msg]):
- # Add additional location to previous occurence too
+ # Add additional location to previous occurrence too
msg_pos = main_po.find('\nmsgid "' + msg + '"')
if (msg_pos == -1):
print("Someone apparently thought writing Python was as easy as GDScript. Ping Akien.")
diff --git a/main/input_default.cpp b/main/input_default.cpp
index d074e05f43..2efbb3f849 100644
--- a/main/input_default.cpp
+++ b/main/input_default.cpp
@@ -30,9 +30,9 @@
#include "input_default.h"
-#include "default_controller_mappings.h"
-#include "input_map.h"
-#include "os/os.h"
+#include "core/input_map.h"
+#include "core/os/os.h"
+#include "main/default_controller_mappings.h"
#include "scene/resources/texture.h"
#include "servers/visual_server.h"
diff --git a/main/input_default.h b/main/input_default.h
index 2e3cae8520..4441ade04e 100644
--- a/main/input_default.h
+++ b/main/input_default.h
@@ -31,7 +31,7 @@
#ifndef INPUT_DEFAULT_H
#define INPUT_DEFAULT_H
-#include "os/input.h"
+#include "core/os/input.h"
class InputDefault : public Input {
diff --git a/main/main.cpp b/main/main.cpp
index a336496d39..34aca032da 100644
--- a/main/main.cpp
+++ b/main/main.cpp
@@ -30,37 +30,44 @@
#include "main.h"
-#include "app_icon.gen.h"
+#include "core/input_map.h"
+#include "core/io/file_access_network.h"
+#include "core/io/file_access_pack.h"
+#include "core/io/file_access_zip.h"
+#include "core/io/ip.h"
+#include "core/io/resource_loader.h"
+#include "core/io/stream_peer_ssl.h"
+#include "core/io/stream_peer_tcp.h"
+#include "core/message_queue.h"
+#include "core/os/dir_access.h"
+#include "core/os/os.h"
+#include "core/project_settings.h"
#include "core/register_core_types.h"
+#include "core/script_debugger_local.h"
+#include "core/script_debugger_remote.h"
+#include "core/script_language.h"
+#include "core/translation.h"
+#include "core/version.h"
+#include "core/version_hash.gen.h"
#include "drivers/register_driver_types.h"
-#include "message_queue.h"
+#include "main/app_icon.gen.h"
+#include "main/input_default.h"
+#include "main/performance.h"
+#include "main/splash.gen.h"
+#include "main/splash_editor.gen.h"
+#include "main/tests/test_main.h"
+#include "main/timer_sync.h"
#include "modules/register_module_types.h"
-#include "os/os.h"
#include "platform/register_platform_apis.h"
-#include "project_settings.h"
-#include "scene/register_scene_types.h"
-#include "script_debugger_local.h"
-#include "script_debugger_remote.h"
-#include "servers/register_server_types.h"
-#include "splash.gen.h"
-#include "splash_editor.gen.h"
-
-#include "input_map.h"
-#include "io/resource_loader.h"
#include "scene/main/scene_tree.h"
+#include "scene/main/viewport.h"
+#include "scene/register_scene_types.h"
+#include "scene/resources/packed_scene.h"
#include "servers/arvr_server.h"
#include "servers/audio_server.h"
#include "servers/physics_2d_server.h"
#include "servers/physics_server.h"
-
-#include "io/resource_loader.h"
-#include "script_language.h"
-
-#include "core/io/ip.h"
-#include "main/tests/test_main.h"
-#include "os/dir_access.h"
-#include "scene/main/viewport.h"
-#include "scene/resources/packed_scene.h"
+#include "servers/register_server_types.h"
#ifdef TOOLS_ENABLED
#include "editor/doc/doc_data.h"
@@ -69,21 +76,6 @@
#include "editor/project_manager.h"
#endif
-#include "io/file_access_network.h"
-#include "servers/physics_2d_server.h"
-
-#include "core/io/file_access_pack.h"
-#include "core/io/file_access_zip.h"
-#include "core/io/stream_peer_ssl.h"
-#include "core/io/stream_peer_tcp.h"
-#include "main/input_default.h"
-#include "performance.h"
-#include "translation.h"
-#include "version.h"
-#include "version_hash.gen.h"
-
-#include "main/timer_sync.h"
-
static ProjectSettings *globals = NULL;
static Engine *engine = NULL;
static InputMap *input_map = NULL;
@@ -1693,6 +1685,7 @@ bool Main::start() {
#ifdef TOOLS_ENABLED
if (project_manager || (script == "" && test == "" && game_path == "" && !editor)) {
+ Engine::get_singleton()->set_editor_hint(true);
ProjectManager *pmanager = memnew(ProjectManager);
ProgressDialog *progress_dialog = memnew(ProgressDialog);
pmanager->add_child(progress_dialog);
diff --git a/main/main.h b/main/main.h
index c20592bf3b..bd56e21d94 100644
--- a/main/main.h
+++ b/main/main.h
@@ -35,9 +35,9 @@
@author Juan Linietsky <reduzio@gmail.com>
*/
+#include "core/error_list.h"
#include "core/os/thread.h"
-#include "error_list.h"
-#include "typedefs.h"
+#include "core/typedefs.h"
class Main {
diff --git a/main/main_builders.py b/main/main_builders.py
index 6d45768493..038a7d17f5 100644
--- a/main/main_builders.py
+++ b/main/main_builders.py
@@ -69,8 +69,8 @@ def make_default_controller_mappings(target, source, env):
g = open(dst, "w")
g.write("/* THIS FILE IS GENERATED DO NOT EDIT */\n")
- g.write("#include \"default_controller_mappings.h\"\n")
- g.write("#include \"typedefs.h\"\n")
+ g.write("#include \"core/typedefs.h\"\n")
+ g.write("#include \"main/default_controller_mappings.h\"\n")
# ensure mappings have a consistent order
platform_mappings = OrderedDict()
diff --git a/main/performance.cpp b/main/performance.cpp
index 70e0a5f7aa..aab3a8646f 100644
--- a/main/performance.cpp
+++ b/main/performance.cpp
@@ -29,13 +29,15 @@
/*************************************************************************/
#include "performance.h"
-#include "message_queue.h"
-#include "os/os.h"
+
+#include "core/message_queue.h"
+#include "core/os/os.h"
#include "scene/main/scene_tree.h"
#include "servers/audio_server.h"
#include "servers/physics_2d_server.h"
#include "servers/physics_server.h"
#include "servers/visual_server.h"
+
Performance *Performance::singleton = NULL;
void Performance::_bind_methods() {
diff --git a/main/performance.h b/main/performance.h
index de00df5ff9..41822562c5 100644
--- a/main/performance.h
+++ b/main/performance.h
@@ -31,7 +31,7 @@
#ifndef PERFORMANCE_H
#define PERFORMANCE_H
-#include "object.h"
+#include "core/object.h"
#define PERF_WARN_OFFLINE_FUNCTION
#define PERF_WARN_PROCESS_SYNC
diff --git a/main/tests/test_gdscript.cpp b/main/tests/test_gdscript.cpp
index 0a9d03c1b7..412e809732 100644
--- a/main/tests/test_gdscript.cpp
+++ b/main/tests/test_gdscript.cpp
@@ -30,9 +30,9 @@
#include "test_gdscript.h"
-#include "os/file_access.h"
-#include "os/main_loop.h"
-#include "os/os.h"
+#include "core/os/file_access.h"
+#include "core/os/main_loop.h"
+#include "core/os/os.h"
#ifdef GDSCRIPT_ENABLED
diff --git a/main/tests/test_gdscript.h b/main/tests/test_gdscript.h
index 91e0be1238..0a052c8db5 100644
--- a/main/tests/test_gdscript.h
+++ b/main/tests/test_gdscript.h
@@ -31,7 +31,7 @@
#ifndef TEST_GDSCRIPT_H
#define TEST_GDSCRIPT_H
-#include "os/main_loop.h"
+#include "core/os/main_loop.h"
namespace TestGDScript {
diff --git a/main/tests/test_gui.cpp b/main/tests/test_gui.cpp
index 305b749717..d25eedbf6f 100644
--- a/main/tests/test_gui.cpp
+++ b/main/tests/test_gui.cpp
@@ -32,9 +32,9 @@
#include "test_gui.h"
-#include "io/image_loader.h"
-#include "os/os.h"
-#include "print_string.h"
+#include "core/io/image_loader.h"
+#include "core/os/os.h"
+#include "core/print_string.h"
#include "scene/2d/sprite.h"
#include "scene/gui/button.h"
#include "scene/gui/control.h"
@@ -235,7 +235,7 @@ public:
richtext->push_meta("http://www.scrollingcapabilities.xz");
richtext->add_text("This allows to test for the scrolling capabilities ");
richtext->pop();
- richtext->add_text("of the rich text label for huge text (not like this text will really be huge but, you know).\nAs long as it is so long that it will work nicely for a test/demo, then it's welcomed in my book...\nChanging subject, the day is cloudy today and I'm wondering if I'll get che chance to travel somewhere nice. Sometimes, watching the clouds from satellite images may give a nice insight about how pressure zones in our planet work, althogh it also makes it pretty obvious to see why most weather forecasts get it wrong so often.\nClouds are so difficult to predict!\nBut it's pretty cool how our civilization has adapted to having water falling from the sky each time it rains...");
+ richtext->add_text("of the rich text label for huge text (not like this text will really be huge but, you know).\nAs long as it is so long that it will work nicely for a test/demo, then it's welcomed in my book...\nChanging subject, the day is cloudy today and I'm wondering if I'll get che chance to travel somewhere nice. Sometimes, watching the clouds from satellite images may give a nice insight about how pressure zones in our planet work, although it also makes it pretty obvious to see why most weather forecasts get it wrong so often.\nClouds are so difficult to predict!\nBut it's pretty cool how our civilization has adapted to having water falling from the sky each time it rains...");
TabContainer *tabc = memnew(TabContainer);
diff --git a/main/tests/test_gui.h b/main/tests/test_gui.h
index 3ed9dae522..25dfa3bc2b 100644
--- a/main/tests/test_gui.h
+++ b/main/tests/test_gui.h
@@ -31,7 +31,7 @@
#ifndef TEST_GUI_H
#define TEST_GUI_H
-#include "os/main_loop.h"
+#include "core/os/main_loop.h"
/**
@author Juan Linietsky <reduzio@gmail.com>
diff --git a/main/tests/test_image.cpp b/main/tests/test_image.cpp
index cb87458a93..979e590ab8 100644
--- a/main/tests/test_image.cpp
+++ b/main/tests/test_image.cpp
@@ -30,10 +30,10 @@
#include "test_image.h"
-#include "io/image_loader.h"
-#include "math_funcs.h"
-#include "os/main_loop.h"
-#include "print_string.h"
+#include "core/io/image_loader.h"
+#include "core/math/math_funcs.h"
+#include "core/os/main_loop.h"
+#include "core/print_string.h"
namespace TestImage {
diff --git a/main/tests/test_image.h b/main/tests/test_image.h
index d45b4e4e15..381edf7ef9 100644
--- a/main/tests/test_image.h
+++ b/main/tests/test_image.h
@@ -35,7 +35,7 @@
@author Juan Linietsky <reduzio@gmail.com>
*/
-#include "os/main_loop.h"
+#include "core/os/main_loop.h"
namespace TestImage {
diff --git a/main/tests/test_io.cpp b/main/tests/test_io.cpp
index 4f98955995..c1b4b8af9b 100644
--- a/main/tests/test_io.cpp
+++ b/main/tests/test_io.cpp
@@ -32,16 +32,16 @@
#ifdef MINIZIP_ENABLED
+#include "core/io/resource_loader.h"
+#include "core/io/resource_saver.h"
+#include "core/os/dir_access.h"
+#include "core/os/main_loop.h"
+#include "core/os/os.h"
+#include "core/print_string.h"
#include "core/project_settings.h"
-#include "io/resource_loader.h"
-#include "io/resource_saver.h"
-#include "os/dir_access.h"
-#include "os/main_loop.h"
-#include "os/os.h"
-#include "print_string.h"
#include "scene/resources/texture.h"
-#include "io/file_access_memory.h"
+#include "core/io/file_access_memory.h"
namespace TestIO {
diff --git a/main/tests/test_io.h b/main/tests/test_io.h
index 76567829e7..ffebd05160 100644
--- a/main/tests/test_io.h
+++ b/main/tests/test_io.h
@@ -35,7 +35,7 @@
@author Juan Linietsky <reduzio@gmail.com>
*/
-#include "os/main_loop.h"
+#include "core/os/main_loop.h"
namespace TestIO {
diff --git a/main/tests/test_main.cpp b/main/tests/test_main.cpp
index cbc1107acb..cd70b95a28 100644
--- a/main/tests/test_main.cpp
+++ b/main/tests/test_main.cpp
@@ -28,8 +28,8 @@
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
/*************************************************************************/
-#include "list.h"
-#include "os/main_loop.h"
+#include "core/list.h"
+#include "core/os/main_loop.h"
#ifdef DEBUG_ENABLED
diff --git a/main/tests/test_main.h b/main/tests/test_main.h
index d319391070..55ab4daeb8 100644
--- a/main/tests/test_main.h
+++ b/main/tests/test_main.h
@@ -31,8 +31,8 @@
#ifndef TEST_MAIN_H
#define TEST_MAIN_H
-#include "list.h"
-#include "ustring.h"
+#include "core/list.h"
+#include "core/ustring.h"
const char **tests_get_names();
MainLoop *test_main(String p_test, const List<String> &p_args);
diff --git a/main/tests/test_math.cpp b/main/tests/test_math.cpp
index 1a72416d6a..a48fdbe4e3 100644
--- a/main/tests/test_math.cpp
+++ b/main/tests/test_math.cpp
@@ -30,22 +30,22 @@
#include "test_math.h"
-#include "camera_matrix.h"
-#include "math_funcs.h"
-#include "matrix3.h"
-#include "os/file_access.h"
-#include "os/keyboard.h"
-#include "os/os.h"
-#include "print_string.h"
+#include "core/math/camera_matrix.h"
+#include "core/math/math_funcs.h"
+#include "core/math/matrix3.h"
+#include "core/math/transform.h"
+#include "core/os/file_access.h"
+#include "core/os/keyboard.h"
+#include "core/os/os.h"
+#include "core/print_string.h"
+#include "core/ustring.h"
+#include "core/variant.h"
+#include "core/vmap.h"
#include "scene/main/node.h"
#include "scene/resources/texture.h"
#include "servers/visual/shader_language.h"
-#include "transform.h"
-#include "ustring.h"
-#include "variant.h"
-#include "vmap.h"
-#include "method_ptrcall.h"
+#include "core/method_ptrcall.h"
namespace TestMath {
diff --git a/main/tests/test_math.h b/main/tests/test_math.h
index 26a33aa164..2d0c6c461f 100644
--- a/main/tests/test_math.h
+++ b/main/tests/test_math.h
@@ -31,7 +31,7 @@
#ifndef TEST_MATH_H
#define TEST_MATH_H
-#include "os/main_loop.h"
+#include "core/os/main_loop.h"
namespace TestMath {
diff --git a/main/tests/test_oa_hash_map.h b/main/tests/test_oa_hash_map.h
index a63da537d8..677021f933 100644
--- a/main/tests/test_oa_hash_map.h
+++ b/main/tests/test_oa_hash_map.h
@@ -31,7 +31,7 @@
#ifndef TEST_OA_HASH_MAP_H
#define TEST_OA_HASH_MAP_H
-#include "os/main_loop.h"
+#include "core/os/main_loop.h"
namespace TestOAHashMap {
diff --git a/main/tests/test_ordered_hash_map.cpp b/main/tests/test_ordered_hash_map.cpp
index 668a8788ff..cad52ceedf 100644
--- a/main/tests/test_ordered_hash_map.cpp
+++ b/main/tests/test_ordered_hash_map.cpp
@@ -28,10 +28,10 @@
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
/*************************************************************************/
-#include "ordered_hash_map.h"
-#include "os/os.h"
-#include "pair.h"
-#include "vector.h"
+#include "core/ordered_hash_map.h"
+#include "core/os/os.h"
+#include "core/pair.h"
+#include "core/vector.h"
namespace TestOrderedHashMap {
@@ -168,4 +168,4 @@ MainLoop *test() {
return NULL;
}
-} // namespace TestOrderedHashMap \ No newline at end of file
+} // namespace TestOrderedHashMap
diff --git a/main/tests/test_physics.cpp b/main/tests/test_physics.cpp
index 99c8fce70e..c869b268b0 100644
--- a/main/tests/test_physics.cpp
+++ b/main/tests/test_physics.cpp
@@ -30,12 +30,12 @@
#include "test_physics.h"
-#include "map.h"
-#include "math_funcs.h"
-#include "os/main_loop.h"
-#include "os/os.h"
-#include "print_string.h"
-#include "quick_hull.h"
+#include "core/map.h"
+#include "core/math/math_funcs.h"
+#include "core/math/quick_hull.h"
+#include "core/os/main_loop.h"
+#include "core/os/os.h"
+#include "core/print_string.h"
#include "servers/physics_server.h"
#include "servers/visual_server.h"
diff --git a/main/tests/test_physics.h b/main/tests/test_physics.h
index 4d62f3a0cf..c260bf9fcc 100644
--- a/main/tests/test_physics.h
+++ b/main/tests/test_physics.h
@@ -35,7 +35,7 @@
@author Juan Linietsky <reduzio@gmail.com>
*/
-#include "os/main_loop.h"
+#include "core/os/main_loop.h"
namespace TestPhysics {
diff --git a/main/tests/test_physics_2d.cpp b/main/tests/test_physics_2d.cpp
index 482a858650..8245ee276e 100644
--- a/main/tests/test_physics_2d.cpp
+++ b/main/tests/test_physics_2d.cpp
@@ -30,10 +30,10 @@
#include "test_physics_2d.h"
-#include "map.h"
-#include "os/main_loop.h"
-#include "os/os.h"
-#include "print_string.h"
+#include "core/map.h"
+#include "core/os/main_loop.h"
+#include "core/os/os.h"
+#include "core/print_string.h"
#include "scene/resources/texture.h"
#include "servers/physics_2d_server.h"
#include "servers/visual_server.h"
diff --git a/main/tests/test_physics_2d.h b/main/tests/test_physics_2d.h
index 1031aa7f71..52669777c0 100644
--- a/main/tests/test_physics_2d.h
+++ b/main/tests/test_physics_2d.h
@@ -31,7 +31,7 @@
#ifndef TEST_PHYSICS_2D_H
#define TEST_PHYSICS_2D_H
-#include "os/main_loop.h"
+#include "core/os/main_loop.h"
namespace TestPhysics2D {
diff --git a/main/tests/test_render.cpp b/main/tests/test_render.cpp
index 9340e69bc5..ebf6d363be 100644
--- a/main/tests/test_render.cpp
+++ b/main/tests/test_render.cpp
@@ -30,12 +30,12 @@
#include "test_render.h"
-#include "math_funcs.h"
-#include "os/keyboard.h"
-#include "os/main_loop.h"
-#include "os/os.h"
-#include "print_string.h"
-#include "quick_hull.h"
+#include "core/math/math_funcs.h"
+#include "core/math/quick_hull.h"
+#include "core/os/keyboard.h"
+#include "core/os/main_loop.h"
+#include "core/os/os.h"
+#include "core/print_string.h"
#include "servers/visual_server.h"
#define OBJECT_COUNT 50
diff --git a/main/tests/test_render.h b/main/tests/test_render.h
index 9084b57067..717074021c 100644
--- a/main/tests/test_render.h
+++ b/main/tests/test_render.h
@@ -35,7 +35,7 @@
@author Juan Linietsky <reduzio@gmail.com>
*/
-#include "os/main_loop.h"
+#include "core/os/main_loop.h"
namespace TestRender {
diff --git a/main/tests/test_shader_lang.cpp b/main/tests/test_shader_lang.cpp
index 7103b436e1..2cd39d0208 100644
--- a/main/tests/test_shader_lang.cpp
+++ b/main/tests/test_shader_lang.cpp
@@ -30,11 +30,11 @@
#include "test_shader_lang.h"
-#include "os/file_access.h"
-#include "os/main_loop.h"
-#include "os/os.h"
+#include "core/os/file_access.h"
+#include "core/os/main_loop.h"
+#include "core/os/os.h"
-#include "print_string.h"
+#include "core/print_string.h"
#include "scene/gui/control.h"
#include "scene/gui/text_edit.h"
#include "servers/visual/shader_language.h"
diff --git a/main/tests/test_shader_lang.h b/main/tests/test_shader_lang.h
index 235bf10463..e99858fdc6 100644
--- a/main/tests/test_shader_lang.h
+++ b/main/tests/test_shader_lang.h
@@ -31,7 +31,7 @@
#ifndef TEST_SHADER_LANG_H
#define TEST_SHADER_LANG_H
-#include "os/main_loop.h"
+#include "core/os/main_loop.h"
namespace TestShaderLang {
diff --git a/main/tests/test_string.cpp b/main/tests/test_string.cpp
index af948556c4..74157d63c9 100644
--- a/main/tests/test_string.cpp
+++ b/main/tests/test_string.cpp
@@ -28,11 +28,11 @@
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
/*************************************************************************/
-#include "ustring.h"
+#include "core/ustring.h"
#include <wchar.h>
-//#include "math_funcs.h"
+//#include "core/math/math_funcs.h"
#include "core/io/ip_address.h"
-#include "os/os.h"
+#include "core/os/os.h"
#include <stdio.h>
#include "test_string.h"
diff --git a/main/tests/test_string.h b/main/tests/test_string.h
index 110e115309..e293e96604 100644
--- a/main/tests/test_string.h
+++ b/main/tests/test_string.h
@@ -31,8 +31,8 @@
#ifndef TEST_STRING_H
#define TEST_STRING_H
-#include "os/main_loop.h"
-#include "ustring.h"
+#include "core/os/main_loop.h"
+#include "core/ustring.h"
namespace TestString {
diff --git a/main/timer_sync.cpp b/main/timer_sync.cpp
index 9f4f6ed271..275465914e 100644
--- a/main/timer_sync.cpp
+++ b/main/timer_sync.cpp
@@ -83,7 +83,7 @@ MainFrameTime MainTimerSync::advance_core(float p_frame_slice, int p_iterations_
int min_typical_steps = typical_physics_steps[0];
int max_typical_steps = min_typical_steps + 1;
- // given the past recorded steps and typcial steps to match, calculate bounds for this
+ // given the past recorded steps and typical steps to match, calculate bounds for this
// step to be typical
bool update_typical = false;
diff --git a/modules/bmp/image_loader_bmp.h b/modules/bmp/image_loader_bmp.h
index 3fa7481287..e0e50859fc 100644
--- a/modules/bmp/image_loader_bmp.h
+++ b/modules/bmp/image_loader_bmp.h
@@ -31,7 +31,7 @@
#ifndef IMAGE_LOADER_BMP_H
#define IMAGE_LOADER_BMP_H
-#include "io/image_loader.h"
+#include "core/io/image_loader.h"
class ImageLoaderBMP : public ImageFormatLoader {
protected:
diff --git a/modules/bullet/SCsub b/modules/bullet/SCsub
index b82eddde1c..2557e8cb1d 100644
--- a/modules/bullet/SCsub
+++ b/modules/bullet/SCsub
@@ -68,7 +68,7 @@ if env['builtin_bullet']:
, "BulletCollision/CollisionShapes/btEmptyShape.cpp"
, "BulletCollision/CollisionShapes/btHeightfieldTerrainShape.cpp"
, "BulletCollision/CollisionShapes/btMinkowskiSumShape.cpp"
- , "BulletCollision/CollisionShapes/btMiniSDF.cpp"
+ , "BulletCollision/CollisionShapes/btMiniSDF.cpp"
, "BulletCollision/CollisionShapes/btMultimaterialTriangleMeshShape.cpp"
, "BulletCollision/CollisionShapes/btMultiSphereShape.cpp"
, "BulletCollision/CollisionShapes/btOptimizedBvh.cpp"
diff --git a/modules/bullet/area_bullet.cpp b/modules/bullet/area_bullet.cpp
index f1da454e2e..3200b4a214 100644
--- a/modules/bullet/area_bullet.cpp
+++ b/modules/bullet/area_bullet.cpp
@@ -30,6 +30,7 @@
#include "area_bullet.h"
+#include "bullet_physics_server.h"
#include "bullet_types_converter.h"
#include "bullet_utilities.h"
#include "collision_object_bullet.h"
@@ -57,6 +58,7 @@ AreaBullet::AreaBullet() :
spOv_priority(0) {
btGhost = bulletnew(btGhostObject);
+ btGhost->setCollisionShape(BulletPhysicsServer::get_empty_shape());
setupBulletCollisionObject(btGhost);
/// Collision objects with a callback still have collision response with dynamic rigid bodies.
/// In order to use collision objects as trigger, you have to disable the collision response.
@@ -162,7 +164,10 @@ bool AreaBullet::is_monitoring() const {
}
void AreaBullet::main_shape_resetted() {
- btGhost->setCollisionShape(get_main_shape());
+ if (get_main_shape())
+ btGhost->setCollisionShape(get_main_shape());
+ else
+ btGhost->setCollisionShape(BulletPhysicsServer::get_empty_shape());
}
void AreaBullet::reload_body() {
diff --git a/modules/bullet/btRayShape.cpp b/modules/bullet/btRayShape.cpp
index 8707096038..6cc63d79ce 100644
--- a/modules/bullet/btRayShape.cpp
+++ b/modules/bullet/btRayShape.cpp
@@ -30,7 +30,7 @@
#include "btRayShape.h"
-#include "math/math_funcs.h"
+#include "core/math/math_funcs.h"
#include <LinearMath/btAabbUtil2.h>
diff --git a/modules/bullet/bullet_physics_server.cpp b/modules/bullet/bullet_physics_server.cpp
index dbd27a3564..53a38967c3 100644
--- a/modules/bullet/bullet_physics_server.cpp
+++ b/modules/bullet/bullet_physics_server.cpp
@@ -31,8 +31,8 @@
#include "bullet_physics_server.h"
#include "bullet_utilities.h"
-#include "class_db.h"
#include "cone_twist_joint_bullet.h"
+#include "core/class_db.h"
#include "core/error_macros.h"
#include "core/ustring.h"
#include "generic_6dof_joint_bullet.h"
diff --git a/modules/bullet/bullet_physics_server.h b/modules/bullet/bullet_physics_server.h
index e9c568d605..4c52cace67 100644
--- a/modules/bullet/bullet_physics_server.h
+++ b/modules/bullet/bullet_physics_server.h
@@ -32,8 +32,8 @@
#define BULLET_PHYSICS_SERVER_H
#include "area_bullet.h"
+#include "core/rid.h"
#include "joint_bullet.h"
-#include "rid.h"
#include "rigid_body_bullet.h"
#include "servers/physics_server.h"
#include "shape_bullet.h"
@@ -61,7 +61,7 @@ class BulletPhysicsServer : public PhysicsServer {
mutable RID_Owner<JointBullet> joint_owner;
private:
- /// This is used when a collision shape is not active, so the bullet compound shapes index are always sync with godot index
+ /// This is used as replacement of collision shape inside a compound or main shape
static btEmptyShape *emptyShape;
public:
diff --git a/modules/bullet/collision_object_bullet.h b/modules/bullet/collision_object_bullet.h
index d14fdd3301..ea06cecb17 100644
--- a/modules/bullet/collision_object_bullet.h
+++ b/modules/bullet/collision_object_bullet.h
@@ -31,11 +31,11 @@
#ifndef COLLISION_OBJECT_BULLET_H
#define COLLISION_OBJECT_BULLET_H
+#include "core/math/transform.h"
+#include "core/math/vector3.h"
+#include "core/object.h"
#include "core/vset.h"
-#include "object.h"
#include "shape_owner_bullet.h"
-#include "transform.h"
-#include "vector3.h"
#include <LinearMath/btTransform.h>
diff --git a/modules/bullet/godot_collision_dispatcher.h b/modules/bullet/godot_collision_dispatcher.h
index 2e5a6c2732..1faaa68626 100644
--- a/modules/bullet/godot_collision_dispatcher.h
+++ b/modules/bullet/godot_collision_dispatcher.h
@@ -31,7 +31,7 @@
#ifndef GODOT_COLLISION_DISPATCHER_H
#define GODOT_COLLISION_DISPATCHER_H
-#include "int_types.h"
+#include "core/int_types.h"
#include <btBulletDynamicsCommon.h>
diff --git a/modules/bullet/godot_result_callbacks.h b/modules/bullet/godot_result_callbacks.h
index 61247e2a7a..8e70b72841 100644
--- a/modules/bullet/godot_result_callbacks.h
+++ b/modules/bullet/godot_result_callbacks.h
@@ -74,7 +74,10 @@ public:
virtual bool needsCollision(btBroadphaseProxy *proxy0) const;
virtual btScalar addSingleResult(btCollisionWorld::LocalRayResult &rayResult, bool normalInWorldSpace) {
- m_shapeId = rayResult.m_localShapeInfo->m_triangleIndex; // "m_triangleIndex" Is a odd name but contains the compound shape ID
+ if (rayResult.m_localShapeInfo)
+ m_shapeId = rayResult.m_localShapeInfo->m_triangleIndex; // "m_triangleIndex" Is a odd name but contains the compound shape ID
+ else
+ m_shapeId = 0;
return btCollisionWorld::ClosestRayResultCallback::addSingleResult(rayResult, normalInWorldSpace);
}
};
diff --git a/modules/bullet/register_types.cpp b/modules/bullet/register_types.cpp
index a76b0438b4..31e5f6784e 100644
--- a/modules/bullet/register_types.cpp
+++ b/modules/bullet/register_types.cpp
@@ -31,8 +31,8 @@
#include "register_types.h"
#include "bullet_physics_server.h"
-#include "class_db.h"
-#include "project_settings.h"
+#include "core/class_db.h"
+#include "core/project_settings.h"
/**
@author AndreaCatania
diff --git a/modules/bullet/rigid_body_bullet.cpp b/modules/bullet/rigid_body_bullet.cpp
index 2974d6b3e4..f81cfe84fb 100644
--- a/modules/bullet/rigid_body_bullet.cpp
+++ b/modules/bullet/rigid_body_bullet.cpp
@@ -279,7 +279,7 @@ RigidBodyBullet::RigidBodyBullet() :
// Initial properties
const btVector3 localInertia(0, 0, 0);
- btRigidBody::btRigidBodyConstructionInfo cInfo(mass, godotMotionState, NULL, localInertia);
+ btRigidBody::btRigidBodyConstructionInfo cInfo(mass, godotMotionState, BulletPhysicsServer::get_empty_shape(), localInertia);
btBody = bulletnew(btRigidBody(cInfo));
setupBulletCollisionObject(btBody);
@@ -315,7 +315,11 @@ void RigidBodyBullet::destroy_kinematic_utilities() {
}
void RigidBodyBullet::main_shape_resetted() {
- btBody->setCollisionShape(get_main_shape());
+ if (get_main_shape())
+ btBody->setCollisionShape(get_main_shape());
+ else
+ btBody->setCollisionShape(BulletPhysicsServer::get_empty_shape());
+ set_continuous_collision_detection(is_continuous_collision_detection_enabled()); // Reset
}
void RigidBodyBullet::reload_body() {
@@ -716,15 +720,19 @@ void RigidBodyBullet::set_continuous_collision_detection(bool p_enable) {
if (p_enable) {
// This threshold enable CCD if the object moves more than
// 1 meter in one simulation frame
- btBody->setCcdMotionThreshold(1);
+ btBody->setCcdMotionThreshold(0.1);
/// Calculate using the rule writte below the CCD swept sphere radius
/// CCD works on an embedded sphere of radius, make sure this radius
/// is embedded inside the convex objects, preferably smaller:
/// for an object of dimensions 1 meter, try 0.2
- btVector3 center;
btScalar radius;
- btBody->getCollisionShape()->getBoundingSphere(center, radius);
+ if (btBody->getCollisionShape()) {
+ btVector3 center;
+ btBody->getCollisionShape()->getBoundingSphere(center, radius);
+ } else {
+ radius = 0;
+ }
btBody->setCcdSweptSphereRadius(radius * 0.2);
} else {
btBody->setCcdMotionThreshold(0.);
@@ -733,7 +741,7 @@ void RigidBodyBullet::set_continuous_collision_detection(bool p_enable) {
}
bool RigidBodyBullet::is_continuous_collision_detection_enabled() const {
- return 0. != btBody->getCcdMotionThreshold();
+ return 0. < btBody->getCcdMotionThreshold();
}
void RigidBodyBullet::set_linear_velocity(const Vector3 &p_velocity) {
@@ -841,7 +849,7 @@ void RigidBodyBullet::on_exit_area(AreaBullet *p_area) {
bool wasTheAreaFound = false;
for (int i = 0; i < areaWhereIamCount; ++i) {
if (p_area == areasWhereIam[i]) {
- // The area was fount, just shift down all elements
+ // The area was found, just shift down all elements
for (int j = i; j < areaWhereIamCount; ++j) {
areasWhereIam.write[j] = areasWhereIam[j + 1];
}
diff --git a/modules/bullet/shape_bullet.h b/modules/bullet/shape_bullet.h
index 638e044e6a..9a1c8f5bfa 100644
--- a/modules/bullet/shape_bullet.h
+++ b/modules/bullet/shape_bullet.h
@@ -31,8 +31,8 @@
#ifndef SHAPE_BULLET_H
#define SHAPE_BULLET_H
+#include "core/math/geometry.h"
#include "core/variant.h"
-#include "geometry.h"
#include "rid_bullet.h"
#include "servers/physics_server.h"
diff --git a/modules/bullet/space_bullet.cpp b/modules/bullet/space_bullet.cpp
index 6d00b3d1d8..5b220e1039 100644
--- a/modules/bullet/space_bullet.cpp
+++ b/modules/bullet/space_bullet.cpp
@@ -34,13 +34,13 @@
#include "bullet_types_converter.h"
#include "bullet_utilities.h"
#include "constraint_bullet.h"
+#include "core/project_settings.h"
+#include "core/ustring.h"
#include "godot_collision_configuration.h"
#include "godot_collision_dispatcher.h"
-#include "project_settings.h"
#include "rigid_body_bullet.h"
#include "servers/physics_server.h"
#include "soft_body_bullet.h"
-#include "ustring.h"
#include <BulletCollision/CollisionDispatch/btCollisionObject.h>
#include <BulletCollision/CollisionDispatch/btGhostObject.h>
diff --git a/modules/csg/csg.cpp b/modules/csg/csg.cpp
index 87c2caec0d..567485c2c7 100644
--- a/modules/csg/csg.cpp
+++ b/modules/csg/csg.cpp
@@ -29,10 +29,10 @@
/*************************************************************************/
#include "csg.h"
-#include "face3.h"
-#include "geometry.h"
-#include "os/os.h"
-#include "sort.h"
+#include "core/math/face3.h"
+#include "core/math/geometry.h"
+#include "core/os/os.h"
+#include "core/sort.h"
#include "thirdparty/misc/triangulator.h"
void CSGBrush::clear() {
@@ -292,12 +292,12 @@ void CSGBrushOperation::BuildPoly::_clip_segment(const CSGBrush *p_brush, int p_
for (int j = 0; j < 2; j++) {
if (edges[i].points[0] == segment_idx[0] || edges[i].points[1] == segment_idx[1] || edges[i].points[0] == segment_idx[1] || edges[i].points[1] == segment_idx[0]) {
- edge_valid = false; //segment has this point, cant check against this
+ edge_valid = false; //segment has this point, can't check against this
break;
}
}
- if (!edge_valid) //already hit a point in this edge, so dont test it
+ if (!edge_valid) //already hit a point in this edge, so don't test it
continue;
//see if either points are within the edge isntead of crossing it
@@ -573,7 +573,7 @@ void CSGBrushOperation::_collision_callback(const CSGBrush *A, int p_face_a, Map
}
}
- //if we are still here, it means they most likely intersect, so create BuildPolys if they dont existy
+ //if we are still here, it means they most likely intersect, so create BuildPolys if they don't exist
BuildPoly *poly_a = NULL;
@@ -896,7 +896,7 @@ void CSGBrushOperation::_merge_poly(MeshMerge &mesh, int p_face_idx, const Build
Vector2 to = p_poly.points[to_idx].point;
with_outline_vertex = l;
- //try agaisnt outline (other points) first
+ //try against outline (other points) first
valid = true;
@@ -915,7 +915,7 @@ void CSGBrushOperation::_merge_poly(MeshMerge &mesh, int p_face_idx, const Build
if (!valid)
continue;
- //try agaisnt all holes including self
+ //try against all holes including self
for (int m = 0; m < polys[i].holes.size(); m++) {
diff --git a/modules/csg/csg.h b/modules/csg/csg.h
index 2e07c23e28..5d6432eca8 100644
--- a/modules/csg/csg.h
+++ b/modules/csg/csg.h
@@ -31,15 +31,15 @@
#ifndef CSG_H
#define CSG_H
-#include "aabb.h"
-#include "dvector.h"
-#include "map.h"
-#include "oa_hash_map.h"
-#include "plane.h"
-#include "rect2.h"
+#include "core/dvector.h"
+#include "core/map.h"
+#include "core/math/aabb.h"
+#include "core/math/plane.h"
+#include "core/math/rect2.h"
+#include "core/math/transform.h"
+#include "core/math/vector3.h"
+#include "core/oa_hash_map.h"
#include "scene/resources/material.h"
-#include "transform.h"
-#include "vector3.h"
struct CSGBrush {
diff --git a/modules/cvtt/image_compress_cvtt.cpp b/modules/cvtt/image_compress_cvtt.cpp
index af92861352..17af6bff09 100644
--- a/modules/cvtt/image_compress_cvtt.cpp
+++ b/modules/cvtt/image_compress_cvtt.cpp
@@ -30,9 +30,9 @@
#include "image_compress_cvtt.h"
-#include "os/os.h"
-#include "os/thread.h"
-#include "print_string.h"
+#include "core/os/os.h"
+#include "core/os/thread.h"
+#include "core/print_string.h"
#include <ConvectionKernels.h>
diff --git a/modules/cvtt/image_compress_cvtt.h b/modules/cvtt/image_compress_cvtt.h
index 0e18b247e5..fe912ad3bb 100644
--- a/modules/cvtt/image_compress_cvtt.h
+++ b/modules/cvtt/image_compress_cvtt.h
@@ -31,7 +31,7 @@
#ifndef IMAGE_COMPRESS_CVTT_H
#define IMAGE_COMPRESS_CVTT_H
-#include "image.h"
+#include "core/image.h"
void image_compress_cvtt(Image *p_image, float p_lossy_quality, Image::CompressSource p_source);
void image_decompress_cvtt(Image *p_image);
diff --git a/modules/dds/texture_loader_dds.cpp b/modules/dds/texture_loader_dds.cpp
index 3cb24d0407..ff15aaa735 100644
--- a/modules/dds/texture_loader_dds.cpp
+++ b/modules/dds/texture_loader_dds.cpp
@@ -29,7 +29,7 @@
/*************************************************************************/
#include "texture_loader_dds.h"
-#include "os/file_access.h"
+#include "core/os/file_access.h"
enum {
DDS_MAGIC = 0x20534444,
diff --git a/modules/dds/texture_loader_dds.h b/modules/dds/texture_loader_dds.h
index 14d99ff506..4e2593c744 100644
--- a/modules/dds/texture_loader_dds.h
+++ b/modules/dds/texture_loader_dds.h
@@ -31,7 +31,7 @@
#ifndef TEXTURE_LOADER_DDS_H
#define TEXTURE_LOADER_DDS_H
-#include "io/resource_loader.h"
+#include "core/io/resource_loader.h"
#include "scene/resources/texture.h"
class ResourceFormatDDS : public ResourceFormatLoader {
diff --git a/modules/enet/doc_classes/NetworkedMultiplayerENet.xml b/modules/enet/doc_classes/NetworkedMultiplayerENet.xml
index fab4b05da9..76c551e8d7 100644
--- a/modules/enet/doc_classes/NetworkedMultiplayerENet.xml
+++ b/modules/enet/doc_classes/NetworkedMultiplayerENet.xml
@@ -36,7 +36,7 @@
<argument index="4" name="client_port" type="int" default="0">
</argument>
<description>
- Create client that connects to a server at [code]address[/code] using specified [code]port[/code]. The given address needs to be either a fully qualified domain nome (e.g. [code]www.example.com[/code]) or an IP address in IPv4 or IPv6 format (e.g. [code]192.168.1.1[/code]). The [code]port[/code] is the port the server is listening on. The [code]in_bandwidth[/code] and [code]out_bandwidth[/code] parameters can be used to limit the incoming and outgoing bandwidth to the given number of bytes per second. The default of 0 means unlimited bandwidth. Note that ENet will strategically drop packets on specific sides of a connection between peers to ensure the peer's bandwidth is not overwhelmed. The bandwidth parameters also determine the window size of a connection which limits the amount of reliable packets that may be in transit at any given time. Returns [code]OK[/code] if a client was created, [code]ERR_ALREADY_IN_USE[/code] if this NetworkedMultiplayerEnet instance already has an open connection (in which case you need to call [method close_connection] first) or [code]ERR_CANT_CREATE[/code] if the client could not be created. If [code]client_port[/code] is specified, the client will also listen to the given port, this is useful in some NAT traveral technique.
+ Create client that connects to a server at [code]address[/code] using specified [code]port[/code]. The given address needs to be either a fully qualified domain nome (e.g. [code]www.example.com[/code]) or an IP address in IPv4 or IPv6 format (e.g. [code]192.168.1.1[/code]). The [code]port[/code] is the port the server is listening on. The [code]in_bandwidth[/code] and [code]out_bandwidth[/code] parameters can be used to limit the incoming and outgoing bandwidth to the given number of bytes per second. The default of 0 means unlimited bandwidth. Note that ENet will strategically drop packets on specific sides of a connection between peers to ensure the peer's bandwidth is not overwhelmed. The bandwidth parameters also determine the window size of a connection which limits the amount of reliable packets that may be in transit at any given time. Returns [code]OK[/code] if a client was created, [code]ERR_ALREADY_IN_USE[/code] if this NetworkedMultiplayerEnet instance already has an open connection (in which case you need to call [method close_connection] first) or [code]ERR_CANT_CREATE[/code] if the client could not be created. If [code]client_port[/code] is specified, the client will also listen to the given port, this is useful in some NAT traversal technique.
</description>
</method>
<method name="create_server">
diff --git a/modules/enet/networked_multiplayer_enet.cpp b/modules/enet/networked_multiplayer_enet.cpp
index 25b7f2472d..0a1061f92e 100644
--- a/modules/enet/networked_multiplayer_enet.cpp
+++ b/modules/enet/networked_multiplayer_enet.cpp
@@ -29,9 +29,9 @@
/*************************************************************************/
#include "networked_multiplayer_enet.h"
-#include "io/ip.h"
-#include "io/marshalls.h"
-#include "os/os.h"
+#include "core/io/ip.h"
+#include "core/io/marshalls.h"
+#include "core/os/os.h"
void NetworkedMultiplayerENet::set_transfer_mode(TransferMode p_mode) {
@@ -100,8 +100,8 @@ Error NetworkedMultiplayerENet::create_server(int p_port, int p_max_clients, int
host = enet_host_create(&address /* the address to bind the server host to */,
p_max_clients /* allow up to 32 clients and/or outgoing connections */,
channel_count /* allow up to channel_count to be used */,
- p_in_bandwidth /* limit incoming bandwith if > 0 */,
- p_out_bandwidth /* limit outgoing bandwith if > 0 */);
+ p_in_bandwidth /* limit incoming bandwidth if > 0 */,
+ p_out_bandwidth /* limit outgoing bandwidth if > 0 */);
ERR_FAIL_COND_V(!host, ERR_CANT_CREATE);
@@ -144,14 +144,14 @@ Error NetworkedMultiplayerENet::create_client(const String &p_address, int p_por
host = enet_host_create(&c_client /* create a client host */,
1 /* only allow 1 outgoing connection */,
channel_count /* allow up to channel_count to be used */,
- p_in_bandwidth /* limit incoming bandwith if > 0 */,
- p_out_bandwidth /* limit outgoing bandwith if > 0 */);
+ p_in_bandwidth /* limit incoming bandwidth if > 0 */,
+ p_out_bandwidth /* limit outgoing bandwidth if > 0 */);
} else {
host = enet_host_create(NULL /* create a client host */,
1 /* only allow 1 outgoing connection */,
channel_count /* allow up to channel_count to be used */,
- p_in_bandwidth /* limit incoming bandwith if > 0 */,
- p_out_bandwidth /* limit outgoing bandwith if > 0 */);
+ p_in_bandwidth /* limit incoming bandwidth if > 0 */,
+ p_out_bandwidth /* limit outgoing bandwidth if > 0 */);
}
ERR_FAIL_COND_V(!host, ERR_CANT_CREATE);
diff --git a/modules/enet/networked_multiplayer_enet.h b/modules/enet/networked_multiplayer_enet.h
index 705807d429..a2b35f2395 100644
--- a/modules/enet/networked_multiplayer_enet.h
+++ b/modules/enet/networked_multiplayer_enet.h
@@ -31,8 +31,8 @@
#ifndef NETWORKED_MULTIPLAYER_ENET_H
#define NETWORKED_MULTIPLAYER_ENET_H
-#include "io/compression.h"
-#include "io/networked_multiplayer_peer.h"
+#include "core/io/compression.h"
+#include "core/io/networked_multiplayer_peer.h"
#include <enet/enet.h>
diff --git a/modules/enet/register_types.cpp b/modules/enet/register_types.cpp
index cabaeb692a..cde70e8d5c 100644
--- a/modules/enet/register_types.cpp
+++ b/modules/enet/register_types.cpp
@@ -29,7 +29,7 @@
/*************************************************************************/
#include "register_types.h"
-#include "error_macros.h"
+#include "core/error_macros.h"
#include "networked_multiplayer_enet.h"
static bool enet_ok = false;
diff --git a/modules/etc/image_etc.cpp b/modules/etc/image_etc.cpp
index f5c817c816..a534aec11b 100644
--- a/modules/etc/image_etc.cpp
+++ b/modules/etc/image_etc.cpp
@@ -31,10 +31,10 @@
#include "image_etc.h"
#include "Etc.h"
#include "EtcFilter.h"
-#include "image.h"
-#include "os/copymem.h"
-#include "os/os.h"
-#include "print_string.h"
+#include "core/image.h"
+#include "core/os/copymem.h"
+#include "core/os/os.h"
+#include "core/print_string.h"
static Image::Format _get_etc2_mode(Image::DetectChannels format) {
switch (format) {
diff --git a/modules/etc/texture_loader_pkm.cpp b/modules/etc/texture_loader_pkm.cpp
index ac89259c9b..3041dde876 100644
--- a/modules/etc/texture_loader_pkm.cpp
+++ b/modules/etc/texture_loader_pkm.cpp
@@ -30,7 +30,7 @@
#include "texture_loader_pkm.h"
-#include "os/file_access.h"
+#include "core/os/file_access.h"
#include <string.h>
struct ETC1Header {
diff --git a/modules/etc/texture_loader_pkm.h b/modules/etc/texture_loader_pkm.h
index 3c6d9180bd..b5a95767c7 100644
--- a/modules/etc/texture_loader_pkm.h
+++ b/modules/etc/texture_loader_pkm.h
@@ -31,7 +31,7 @@
#ifndef TEXTURE_LOADER_PKM_H
#define TEXTURE_LOADER_PKM_H
-#include "io/resource_loader.h"
+#include "core/io/resource_loader.h"
#include "scene/resources/texture.h"
class ResourceFormatPKM : public ResourceFormatLoader {
diff --git a/modules/freetype/SCsub b/modules/freetype/SCsub
index 301f218361..c86e78ccee 100644
--- a/modules/freetype/SCsub
+++ b/modules/freetype/SCsub
@@ -62,7 +62,7 @@ if env['builtin_freetype']:
env.Append(CCFLAGS=['/FI', '"modules/freetype/uwpdef.h"'])
elif env['platform'] == 'javascript':
# Forcibly undefine this macro so SIMD is not used in this file,
- # since currently unsuported in WASM
+ # since currently unsupported in WASM
sfnt = env.Object(sfnt, CPPFLAGS=['-U__OPTIMIZE__'])
thirdparty_sources += [sfnt]
diff --git a/modules/gdnative/gdnative.cpp b/modules/gdnative/gdnative.cpp
index 0acd6c27d8..ecde73ae1c 100644
--- a/modules/gdnative/gdnative.cpp
+++ b/modules/gdnative/gdnative.cpp
@@ -30,11 +30,11 @@
#include "gdnative.h"
-#include "global_constants.h"
-#include "io/file_access_encrypted.h"
-#include "os/file_access.h"
-#include "os/os.h"
-#include "project_settings.h"
+#include "core/global_constants.h"
+#include "core/io/file_access_encrypted.h"
+#include "core/os/file_access.h"
+#include "core/os/os.h"
+#include "core/project_settings.h"
#include "scene/main/scene_tree.h"
@@ -390,7 +390,7 @@ bool GDNative::terminate() {
if (library->should_load_once()) {
Vector<Ref<GDNative> > *gdnatives = &(*GDNativeLibrary::loaded_libraries)[library->get_current_library_path()];
if (gdnatives->size() > 1) {
- // there are other GDNative's still using this library, so we actually don't terminte
+ // there are other GDNative's still using this library, so we actually don't terminate
gdnatives->erase(Ref<GDNative>(this));
initialized = false;
return true;
diff --git a/modules/gdnative/gdnative.h b/modules/gdnative/gdnative.h
index 148f85723e..c5364a72ac 100644
--- a/modules/gdnative/gdnative.h
+++ b/modules/gdnative/gdnative.h
@@ -31,15 +31,15 @@
#ifndef GDNATIVE_H
#define GDNATIVE_H
-#include "io/resource_loader.h"
-#include "io/resource_saver.h"
-#include "os/thread_safe.h"
-#include "resource.h"
+#include "core/io/resource_loader.h"
+#include "core/io/resource_saver.h"
+#include "core/os/thread_safe.h"
+#include "core/resource.h"
#include "gdnative/gdnative.h"
#include "gdnative_api_struct.gen.h"
-#include "io/config_file.h"
+#include "core/io/config_file.h"
class GDNativeLibraryResourceLoader;
class GDNative;
diff --git a/modules/gdnative/gdnative/gdnative.cpp b/modules/gdnative/gdnative/gdnative.cpp
index 73fca655a8..8f10f116e6 100644
--- a/modules/gdnative/gdnative/gdnative.cpp
+++ b/modules/gdnative/gdnative/gdnative.cpp
@@ -30,12 +30,12 @@
#include "gdnative/gdnative.h"
-#include "class_db.h"
-#include "engine.h"
-#include "error_macros.h"
-#include "global_constants.h"
-#include "os/os.h"
-#include "variant.h"
+#include "core/class_db.h"
+#include "core/engine.h"
+#include "core/error_macros.h"
+#include "core/global_constants.h"
+#include "core/os/os.h"
+#include "core/variant.h"
#include "modules/gdnative/gdnative.h"
diff --git a/modules/gdnative/gdnative/pool_arrays.cpp b/modules/gdnative/gdnative/pool_arrays.cpp
index 2b6b7a823a..d55d81b5b6 100644
--- a/modules/gdnative/gdnative/pool_arrays.cpp
+++ b/modules/gdnative/gdnative/pool_arrays.cpp
@@ -30,9 +30,9 @@
#include "gdnative/pool_arrays.h"
-#include "array.h"
+#include "core/array.h"
+#include "core/dvector.h"
#include "core/variant.h"
-#include "dvector.h"
#include "core/color.h"
#include "core/math/vector2.h"
diff --git a/modules/gdnative/nativescript/api_generator.cpp b/modules/gdnative/nativescript/api_generator.cpp
index 70ca8d68b8..0983c12619 100644
--- a/modules/gdnative/nativescript/api_generator.cpp
+++ b/modules/gdnative/nativescript/api_generator.cpp
@@ -35,8 +35,8 @@
#include "core/class_db.h"
#include "core/engine.h"
#include "core/global_constants.h"
+#include "core/os/file_access.h"
#include "core/pair.h"
-#include "os/file_access.h"
// helper stuff
diff --git a/modules/gdnative/nativescript/godot_nativescript.cpp b/modules/gdnative/nativescript/godot_nativescript.cpp
index 72606c8340..c39efe126f 100644
--- a/modules/gdnative/nativescript/godot_nativescript.cpp
+++ b/modules/gdnative/nativescript/godot_nativescript.cpp
@@ -30,12 +30,12 @@
#include "nativescript/godot_nativescript.h"
-#include "class_db.h"
-#include "error_macros.h"
+#include "core/class_db.h"
+#include "core/error_macros.h"
+#include "core/global_constants.h"
+#include "core/project_settings.h"
+#include "core/variant.h"
#include "gdnative/gdnative.h"
-#include "global_constants.h"
-#include "project_settings.h"
-#include "variant.h"
#include "nativescript.h"
diff --git a/modules/gdnative/nativescript/nativescript.cpp b/modules/gdnative/nativescript/nativescript.cpp
index 3f88fabebd..ea968fb0b1 100644
--- a/modules/gdnative/nativescript/nativescript.cpp
+++ b/modules/gdnative/nativescript/nativescript.cpp
@@ -33,10 +33,10 @@
#include "gdnative/gdnative.h"
#include "core/global_constants.h"
+#include "core/io/file_access_encrypted.h"
+#include "core/os/file_access.h"
+#include "core/os/os.h"
#include "core/project_settings.h"
-#include "io/file_access_encrypted.h"
-#include "os/file_access.h"
-#include "os/os.h"
#include "scene/main/scene_tree.h"
#include "scene/resources/scene_format_text.h"
@@ -44,7 +44,7 @@
#include <stdlib.h>
#ifndef NO_THREADS
-#include "os/thread.h"
+#include "core/os/thread.h"
#endif
#if defined(TOOLS_ENABLED) && defined(DEBUG_METHODS_ENABLED)
diff --git a/modules/gdnative/nativescript/nativescript.h b/modules/gdnative/nativescript/nativescript.h
index ebfe36fd94..a96fe5c5e3 100644
--- a/modules/gdnative/nativescript/nativescript.h
+++ b/modules/gdnative/nativescript/nativescript.h
@@ -31,21 +31,21 @@
#ifndef NATIVE_SCRIPT_H
#define NATIVE_SCRIPT_H
+#include "core/io/resource_loader.h"
+#include "core/io/resource_saver.h"
+#include "core/oa_hash_map.h"
+#include "core/ordered_hash_map.h"
+#include "core/os/thread_safe.h"
#include "core/resource.h"
#include "core/script_language.h"
#include "core/self_list.h"
-#include "io/resource_loader.h"
-#include "io/resource_saver.h"
-#include "oa_hash_map.h"
-#include "ordered_hash_map.h"
-#include "os/thread_safe.h"
#include "scene/main/node.h"
#include "modules/gdnative/gdnative.h"
#include <nativescript/godot_nativescript.h>
#ifndef NO_THREADS
-#include "os/mutex.h"
+#include "core/os/mutex.h"
#endif
struct NativeScriptDesc {
diff --git a/modules/gdnative/nativescript/register_types.cpp b/modules/gdnative/nativescript/register_types.cpp
index 9a0e764391..4433c0a638 100644
--- a/modules/gdnative/nativescript/register_types.cpp
+++ b/modules/gdnative/nativescript/register_types.cpp
@@ -30,8 +30,8 @@
#include "register_types.h"
-#include "io/resource_loader.h"
-#include "io/resource_saver.h"
+#include "core/io/resource_loader.h"
+#include "core/io/resource_saver.h"
#include "nativescript.h"
diff --git a/modules/gdnative/pluginscript/pluginscript_loader.cpp b/modules/gdnative/pluginscript/pluginscript_loader.cpp
index acba297fa0..52d5b2b595 100644
--- a/modules/gdnative/pluginscript/pluginscript_loader.cpp
+++ b/modules/gdnative/pluginscript/pluginscript_loader.cpp
@@ -29,7 +29,7 @@
/*************************************************************************/
// Godot imports
-#include "os/file_access.h"
+#include "core/os/file_access.h"
// Pythonscript imports
#include "pluginscript_language.h"
#include "pluginscript_loader.h"
diff --git a/modules/gdnative/pluginscript/pluginscript_loader.h b/modules/gdnative/pluginscript/pluginscript_loader.h
index 9276ea3ef9..5c17bb932e 100644
--- a/modules/gdnative/pluginscript/pluginscript_loader.h
+++ b/modules/gdnative/pluginscript/pluginscript_loader.h
@@ -32,9 +32,9 @@
#define PYTHONSCRIPT_PY_LOADER_H
// Godot imports
+#include "core/io/resource_loader.h"
+#include "core/io/resource_saver.h"
#include "core/script_language.h"
-#include "io/resource_loader.h"
-#include "io/resource_saver.h"
class PluginScriptLanguage;
diff --git a/modules/gdnative/pluginscript/register_types.cpp b/modules/gdnative/pluginscript/register_types.cpp
index 924abf29df..e677bc9867 100644
--- a/modules/gdnative/pluginscript/register_types.cpp
+++ b/modules/gdnative/pluginscript/register_types.cpp
@@ -30,11 +30,11 @@
#include "register_types.h"
+#include "core/io/resource_loader.h"
+#include "core/io/resource_saver.h"
+#include "core/os/dir_access.h"
+#include "core/os/os.h"
#include "core/project_settings.h"
-#include "io/resource_loader.h"
-#include "io/resource_saver.h"
-#include "os/dir_access.h"
-#include "os/os.h"
#include "scene/main/scene_tree.h"
#include "pluginscript_language.h"
diff --git a/modules/gdnative/register_types.cpp b/modules/gdnative/register_types.cpp
index ae1a218392..48c0fc8aef 100644
--- a/modules/gdnative/register_types.cpp
+++ b/modules/gdnative/register_types.cpp
@@ -33,8 +33,8 @@
#include "gdnative.h"
-#include "io/resource_loader.h"
-#include "io/resource_saver.h"
+#include "core/io/resource_loader.h"
+#include "core/io/resource_saver.h"
#include "arvr/register_types.h"
#include "nativescript/register_types.h"
diff --git a/modules/gdscript/editor/gdscript_highlighter.cpp b/modules/gdscript/editor/gdscript_highlighter.cpp
index f2a1a5b50c..a1163b5d8d 100644
--- a/modules/gdscript/editor/gdscript_highlighter.cpp
+++ b/modules/gdscript/editor/gdscript_highlighter.cpp
@@ -121,8 +121,8 @@ Map<int, TextEdit::HighlighterInfo> GDScriptSyntaxHighlighter::_get_line_syntax_
is_hex_notation = false;
}
- // check for dot or underscore or 'x' for hex notation in floating point number
- if ((str[j] == '.' || str[j] == 'x' || str[j] == '_') && !in_word && prev_is_number && !is_number) {
+ // check for dot or underscore or 'x' for hex notation in floating point number or 'e' for scientific notation
+ if ((str[j] == '.' || str[j] == 'x' || str[j] == '_' || str[j] == 'e') && !in_word && prev_is_number && !is_number) {
is_number = true;
is_symbol = false;
is_char = false;
diff --git a/modules/gdscript/gdscript.cpp b/modules/gdscript/gdscript.cpp
index 33d9c011f2..4d5d8cedde 100644
--- a/modules/gdscript/gdscript.cpp
+++ b/modules/gdscript/gdscript.cpp
@@ -30,13 +30,13 @@
#include "gdscript.h"
-#include "engine.h"
+#include "core/engine.h"
+#include "core/global_constants.h"
+#include "core/io/file_access_encrypted.h"
+#include "core/os/file_access.h"
+#include "core/os/os.h"
+#include "core/project_settings.h"
#include "gdscript_compiler.h"
-#include "global_constants.h"
-#include "io/file_access_encrypted.h"
-#include "os/file_access.h"
-#include "os/os.h"
-#include "project_settings.h"
///////////////////////////
@@ -1973,14 +1973,14 @@ String GDScriptWarning::get_message() const {
} break;
case UNSAFE_CAST: {
CHECK_SYMBOLS(1);
- return "The value is cast to '" + symbols[0] + "' but has an unkown type.";
+ return "The value is cast to '" + symbols[0] + "' but has an unknown type.";
} break;
case UNSAFE_CALL_ARGUMENT: {
CHECK_SYMBOLS(4);
return "The argument '" + symbols[0] + "' of the function '" + symbols[1] + "' requires a the subtype '" + symbols[2] + "' but the supertype '" + symbols[3] + "' was provided";
} break;
}
- ERR_EXPLAIN("Invalid GDScript waring code: " + get_name_from_code(code));
+ ERR_EXPLAIN("Invalid GDScript warning code: " + get_name_from_code(code));
ERR_FAIL_V(String());
#undef CHECK_SYMBOLS
@@ -2031,7 +2031,7 @@ GDScriptWarning::Code GDScriptWarning::get_code_from_name(const String &p_name)
}
}
- ERR_EXPLAIN("Invalid GDScript waring name: " + p_name);
+ ERR_EXPLAIN("Invalid GDScript warning name: " + p_name);
ERR_FAIL_V(WARNING_MAX);
}
@@ -2112,23 +2112,14 @@ RES ResourceFormatLoaderGDScript::load(const String &p_path, const String &p_ori
script->set_script_path(p_original_path); // script needs this.
script->set_path(p_original_path);
Error err = script->load_byte_code(p_path);
-
- if (err != OK) {
- memdelete(script);
- ERR_FAIL_COND_V(err != OK, RES());
- }
+ ERR_FAIL_COND_V(err != OK, RES());
} else {
Error err = script->load_source_code(p_path);
-
- if (err != OK) {
- memdelete(script);
- ERR_FAIL_COND_V(err != OK, RES());
- }
+ ERR_FAIL_COND_V(err != OK, RES());
script->set_script_path(p_original_path); // script needs this.
script->set_path(p_original_path);
- //script->set_name(p_path.get_file());
script->reload();
}
diff --git a/modules/gdscript/gdscript.h b/modules/gdscript/gdscript.h
index d400230f43..739d18569f 100644
--- a/modules/gdscript/gdscript.h
+++ b/modules/gdscript/gdscript.h
@@ -31,10 +31,10 @@
#ifndef GDSCRIPT_H
#define GDSCRIPT_H
+#include "core/io/resource_loader.h"
+#include "core/io/resource_saver.h"
+#include "core/script_language.h"
#include "gdscript_function.h"
-#include "io/resource_loader.h"
-#include "io/resource_saver.h"
-#include "script_language.h"
class GDScriptNativeClass : public Reference {
@@ -286,7 +286,7 @@ struct GDScriptWarning {
FUNCTION_USED_AS_PROPERTY, // Property not found, but there's a function with the same name
INTEGER_DIVISION, // Integer divide by integer, decimal part is discarded
UNSAFE_PROPERTY_ACCESS, // Property not found in the detected type (but can be in subtypes)
- UNSAFE_METHOD_ACCESS, // Fucntion not found in the detected type (but can be in subtypes)
+ UNSAFE_METHOD_ACCESS, // Function not found in the detected type (but can be in subtypes)
UNSAFE_CAST, // Cast used in an unknown type
UNSAFE_CALL_ARGUMENT, // Function call argument is of a supertype of the require argument
WARNING_MAX,
diff --git a/modules/gdscript/gdscript_compiler.cpp b/modules/gdscript/gdscript_compiler.cpp
index 006fbece53..741b837b05 100644
--- a/modules/gdscript/gdscript_compiler.cpp
+++ b/modules/gdscript/gdscript_compiler.cpp
@@ -518,7 +518,7 @@ int GDScriptCompiler::_parse_expression(CodeGen &codegen, const GDScriptParser::
}
}
- codegen.opcodes.push_back(src_addr); // source adddress
+ codegen.opcodes.push_back(src_addr); // source address
int dst_addr = (p_stack_level) | (GDScriptFunction::ADDR_TYPE_STACK << GDScriptFunction::ADDR_BITS);
codegen.opcodes.push_back(dst_addr); // append the stack level as destination address of the opcode
codegen.alloc_stack(p_stack_level);
diff --git a/modules/gdscript/gdscript_editor.cpp b/modules/gdscript/gdscript_editor.cpp
index d3068fb6d0..affb73a048 100644
--- a/modules/gdscript/gdscript_editor.cpp
+++ b/modules/gdscript/gdscript_editor.cpp
@@ -31,16 +31,16 @@
#include "gdscript.h"
#include "core/engine.h"
+#include "core/global_constants.h"
+#include "core/os/file_access.h"
#include "editor/editor_settings.h"
#include "gdscript_compiler.h"
-#include "global_constants.h"
-#include "os/file_access.h"
#ifdef TOOLS_ENABLED
+#include "core/engine.h"
#include "core/reference.h"
#include "editor/editor_file_system.h"
#include "editor/editor_settings.h"
-#include "engine.h"
#endif
void GDScriptLanguage::get_comment_delimiters(List<String> *p_delimiters) const {
@@ -3304,7 +3304,7 @@ Error GDScriptLanguage::lookup_code(const String &p_code, const String &p_symbol
}
} else {
/*
- // Because get_integer_constant_enum and get_integer_constant dont work on @GlobalScope
+ // Because get_integer_constant_enum and get_integer_constant don't work on @GlobalScope
// We cannot determine the exact nature of the identifier here
// Otherwise these codes would work
StringName enumName = ClassDB::get_integer_constant_enum("@GlobalScope", p_symbol, true);
diff --git a/modules/gdscript/gdscript_function.cpp b/modules/gdscript/gdscript_function.cpp
index d615b58b24..abd08d13ff 100644
--- a/modules/gdscript/gdscript_function.cpp
+++ b/modules/gdscript/gdscript_function.cpp
@@ -30,9 +30,9 @@
#include "gdscript_function.h"
+#include "core/os/os.h"
#include "gdscript.h"
#include "gdscript_functions.h"
-#include "os/os.h"
Variant *GDScriptFunction::_get_variant(int p_address, GDScriptInstance *p_instance, GDScript *p_script, Variant &self, Variant *p_stack, String &r_error) const {
diff --git a/modules/gdscript/gdscript_function.h b/modules/gdscript/gdscript_function.h
index 633cca35d3..bfb6d673f1 100644
--- a/modules/gdscript/gdscript_function.h
+++ b/modules/gdscript/gdscript_function.h
@@ -31,13 +31,13 @@
#ifndef GDSCRIPT_FUNCTION_H
#define GDSCRIPT_FUNCTION_H
-#include "os/thread.h"
-#include "pair.h"
-#include "reference.h"
-#include "script_language.h"
-#include "self_list.h"
-#include "string_db.h"
-#include "variant.h"
+#include "core/os/thread.h"
+#include "core/pair.h"
+#include "core/reference.h"
+#include "core/script_language.h"
+#include "core/self_list.h"
+#include "core/string_db.h"
+#include "core/variant.h"
class GDScriptInstance;
class GDScript;
diff --git a/modules/gdscript/gdscript_functions.cpp b/modules/gdscript/gdscript_functions.cpp
index 03e7740887..c469defb01 100644
--- a/modules/gdscript/gdscript_functions.cpp
+++ b/modules/gdscript/gdscript_functions.cpp
@@ -30,15 +30,15 @@
#include "gdscript_functions.h"
-#include "class_db.h"
-#include "func_ref.h"
+#include "core/class_db.h"
+#include "core/func_ref.h"
+#include "core/io/json.h"
+#include "core/io/marshalls.h"
+#include "core/math/math_funcs.h"
+#include "core/os/os.h"
+#include "core/reference.h"
+#include "core/variant_parser.h"
#include "gdscript.h"
-#include "io/json.h"
-#include "io/marshalls.h"
-#include "math_funcs.h"
-#include "os/os.h"
-#include "reference.h"
-#include "variant_parser.h"
const char *GDScriptFunctions::get_func_name(Function p_func) {
diff --git a/modules/gdscript/gdscript_functions.h b/modules/gdscript/gdscript_functions.h
index a29f06e839..e920dd4ece 100644
--- a/modules/gdscript/gdscript_functions.h
+++ b/modules/gdscript/gdscript_functions.h
@@ -31,7 +31,7 @@
#ifndef GDSCRIPT_FUNCTIONS_H
#define GDSCRIPT_FUNCTIONS_H
-#include "variant.h"
+#include "core/variant.h"
class GDScriptFunctions {
public:
diff --git a/modules/gdscript/gdscript_parser.cpp b/modules/gdscript/gdscript_parser.cpp
index 7502f09d8a..7243690f94 100644
--- a/modules/gdscript/gdscript_parser.cpp
+++ b/modules/gdscript/gdscript_parser.cpp
@@ -32,14 +32,13 @@
#include "core/core_string_names.h"
#include "core/engine.h"
+#include "core/io/resource_loader.h"
+#include "core/os/file_access.h"
+#include "core/print_string.h"
#include "core/project_settings.h"
#include "core/reference.h"
+#include "core/script_language.h"
#include "gdscript.h"
-#include "io/resource_loader.h"
-#include "os/file_access.h"
-#include "print_string.h"
-#include "project_settings.h"
-#include "script_language.h"
template <class T>
T *GDScriptParser::alloc_node() {
@@ -2479,7 +2478,7 @@ void GDScriptParser::_generate_pattern(PatternNode *p_pattern, Node *p_node_to_m
Node *condition = NULL;
- // chech for has, then for pattern
+ // check for has, then for pattern
IdentifierNode *has = alloc_node<IdentifierNode>();
has->name = "has";
@@ -4536,14 +4535,14 @@ void GDScriptParser::_parse_class(ClassNode *p_class) {
member.rpc_mode = rpc_mode;
if (current_class->constant_expressions.has(member.identifier)) {
- _set_error("A constant named '" + String(member.identifier) + "' alread exists in this class (at line: " +
+ _set_error("A constant named '" + String(member.identifier) + "' already exists in this class (at line: " +
itos(current_class->constant_expressions[member.identifier].expression->line) + ").");
return;
}
for (int i = 0; i < current_class->variables.size(); i++) {
if (current_class->variables[i].identifier == member.identifier) {
- _set_error("Variable '" + String(member.identifier) + "' alread exists in this class (at line: " +
+ _set_error("Variable '" + String(member.identifier) + "' already exists in this class (at line: " +
itos(current_class->variables[i].line) + ").");
return;
}
@@ -4750,14 +4749,14 @@ void GDScriptParser::_parse_class(ClassNode *p_class) {
int line = tokenizer->get_token_line();
if (current_class->constant_expressions.has(const_id)) {
- _set_error("Constant '" + String(const_id) + "' alread exists in this class (at line: " +
+ _set_error("Constant '" + String(const_id) + "' already exists in this class (at line: " +
itos(current_class->constant_expressions[const_id].expression->line) + ").");
return;
}
for (int i = 0; i < current_class->variables.size(); i++) {
if (current_class->variables[i].identifier == const_id) {
- _set_error("A variable named '" + String(const_id) + "' alread exists in this class (at line: " +
+ _set_error("A variable named '" + String(const_id) + "' already exists in this class (at line: " +
itos(current_class->variables[i].line) + ").");
return;
}
@@ -4811,7 +4810,7 @@ void GDScriptParser::_parse_class(ClassNode *p_class) {
case GDScriptTokenizer::TK_PR_ENUM: {
//multiple constant declarations..
- int last_assign = -1; // Incremented by 1 right before the assingment.
+ int last_assign = -1; // Incremented by 1 right before the assignment.
String enum_name;
Dictionary enum_dict;
@@ -7243,7 +7242,7 @@ void GDScriptParser::_check_class_level_types(ClassNode *p_class) {
return;
}
- // Replace assigment with implict conversion
+ // Replace assignment with implict conversion
BuiltInFunctionNode *convert = alloc_node<BuiltInFunctionNode>();
convert->line = v.line;
convert->function = GDScriptFunctions::TYPE_CONVERT;
@@ -7621,7 +7620,7 @@ void GDScriptParser::_check_block_types(BlockNode *p_block) {
lv->line);
return;
}
- // Replace assigment with implict conversion
+ // Replace assignment with implict conversion
BuiltInFunctionNode *convert = alloc_node<BuiltInFunctionNode>();
convert->line = lv->line;
convert->function = GDScriptFunctions::TYPE_CONVERT;
@@ -7749,7 +7748,7 @@ void GDScriptParser::_check_block_types(BlockNode *p_block) {
op->line);
return;
}
- // Replace assigment with implict conversion
+ // Replace assignment with implict conversion
BuiltInFunctionNode *convert = alloc_node<BuiltInFunctionNode>();
convert->line = op->line;
convert->function = GDScriptFunctions::TYPE_CONVERT;
diff --git a/modules/gdscript/gdscript_parser.h b/modules/gdscript/gdscript_parser.h
index 3c51e3f372..cd68072499 100644
--- a/modules/gdscript/gdscript_parser.h
+++ b/modules/gdscript/gdscript_parser.h
@@ -31,11 +31,11 @@
#ifndef GDSCRIPT_PARSER_H
#define GDSCRIPT_PARSER_H
+#include "core/map.h"
+#include "core/object.h"
+#include "core/script_language.h"
#include "gdscript_functions.h"
#include "gdscript_tokenizer.h"
-#include "map.h"
-#include "object.h"
-#include "script_language.h"
struct GDScriptDataType;
struct GDScriptWarning;
diff --git a/modules/gdscript/gdscript_tokenizer.cpp b/modules/gdscript/gdscript_tokenizer.cpp
index 6e7842f190..941f5dbecc 100644
--- a/modules/gdscript/gdscript_tokenizer.cpp
+++ b/modules/gdscript/gdscript_tokenizer.cpp
@@ -30,10 +30,10 @@
#include "gdscript_tokenizer.h"
+#include "core/io/marshalls.h"
+#include "core/map.h"
+#include "core/print_string.h"
#include "gdscript_functions.h"
-#include "io/marshalls.h"
-#include "map.h"
-#include "print_string.h"
const char *GDScriptTokenizer::token_names[TK_MAX] = {
"Empty",
diff --git a/modules/gdscript/gdscript_tokenizer.h b/modules/gdscript/gdscript_tokenizer.h
index 11a291cb2e..01b1ac5bf2 100644
--- a/modules/gdscript/gdscript_tokenizer.h
+++ b/modules/gdscript/gdscript_tokenizer.h
@@ -32,11 +32,11 @@
#define GDSCRIPT_TOKENIZER_H
#include "core/pair.h"
+#include "core/string_db.h"
+#include "core/ustring.h"
+#include "core/variant.h"
+#include "core/vmap.h"
#include "gdscript_functions.h"
-#include "string_db.h"
-#include "ustring.h"
-#include "variant.h"
-#include "vmap.h"
class GDScriptTokenizer {
public:
diff --git a/modules/gdscript/register_types.cpp b/modules/gdscript/register_types.cpp
index 422223370b..26dcbdcf89 100644
--- a/modules/gdscript/register_types.cpp
+++ b/modules/gdscript/register_types.cpp
@@ -30,12 +30,12 @@
#include "register_types.h"
+#include "core/io/file_access_encrypted.h"
+#include "core/io/resource_loader.h"
+#include "core/os/file_access.h"
#include "editor/gdscript_highlighter.h"
#include "gdscript.h"
#include "gdscript_tokenizer.h"
-#include "io/file_access_encrypted.h"
-#include "io/resource_loader.h"
-#include "os/file_access.h"
GDScriptLanguage *script_language_gd = NULL;
ResourceFormatLoaderGDScript *resource_loader_gd = NULL;
diff --git a/modules/gridmap/doc_classes/GridMap.xml b/modules/gridmap/doc_classes/GridMap.xml
index 09e8e39796..f13479940d 100644
--- a/modules/gridmap/doc_classes/GridMap.xml
+++ b/modules/gridmap/doc_classes/GridMap.xml
@@ -65,7 +65,7 @@
<argument index="2" name="z" type="int">
</argument>
<description>
- The orientation of the cell at the grid-based X, Y and Z coordinates. -1 is retuned if the cell is empty.
+ The orientation of the cell at the grid-based X, Y and Z coordinates. -1 is returned if the cell is empty.
</description>
</method>
<method name="get_collision_layer_bit" qualifiers="const">
diff --git a/modules/gridmap/grid_map.cpp b/modules/gridmap/grid_map.cpp
index 919607c3f6..a480c4183e 100644
--- a/modules/gridmap/grid_map.cpp
+++ b/modules/gridmap/grid_map.cpp
@@ -29,13 +29,13 @@
/*************************************************************************/
#include "grid_map.h"
-#include "message_queue.h"
+#include "core/message_queue.h"
#include "scene/3d/light.h"
#include "scene/resources/surface_tool.h"
#include "servers/visual_server.h"
-#include "io/marshalls.h"
-#include "os/os.h"
+#include "core/io/marshalls.h"
+#include "core/os/os.h"
#include "scene/resources/mesh_library.h"
#include "scene/scene_string_names.h"
diff --git a/modules/gridmap/grid_map_editor_plugin.cpp b/modules/gridmap/grid_map_editor_plugin.cpp
index 90e28129cc..e6eaabd9ce 100644
--- a/modules/gridmap/grid_map_editor_plugin.cpp
+++ b/modules/gridmap/grid_map_editor_plugin.cpp
@@ -29,14 +29,14 @@
/*************************************************************************/
#include "grid_map_editor_plugin.h"
+#include "core/os/input.h"
#include "editor/editor_scale.h"
#include "editor/editor_settings.h"
#include "editor/plugins/spatial_editor_plugin.h"
-#include "os/input.h"
#include "scene/3d/camera.h"
-#include "geometry.h"
-#include "os/keyboard.h"
+#include "core/math/geometry.h"
+#include "core/os/keyboard.h"
void GridMapEditor::_node_removed(Node *p_node) {
diff --git a/modules/gridmap/register_types.cpp b/modules/gridmap/register_types.cpp
index a3ceea10af..030286d651 100644
--- a/modules/gridmap/register_types.cpp
+++ b/modules/gridmap/register_types.cpp
@@ -30,7 +30,7 @@
#include "register_types.h"
#ifndef _3D_DISABLED
-#include "class_db.h"
+#include "core/class_db.h"
#include "grid_map.h"
#include "grid_map_editor_plugin.h"
#endif
diff --git a/modules/hdr/image_loader_hdr.cpp b/modules/hdr/image_loader_hdr.cpp
index d592c19b97..fc6779ce86 100644
--- a/modules/hdr/image_loader_hdr.cpp
+++ b/modules/hdr/image_loader_hdr.cpp
@@ -30,8 +30,8 @@
#include "image_loader_hdr.h"
-#include "os/os.h"
-#include "print_string.h"
+#include "core/os/os.h"
+#include "core/print_string.h"
#include "thirdparty/tinyexr/tinyexr.h"
diff --git a/modules/hdr/image_loader_hdr.h b/modules/hdr/image_loader_hdr.h
index 3cce483745..7175b38cc8 100644
--- a/modules/hdr/image_loader_hdr.h
+++ b/modules/hdr/image_loader_hdr.h
@@ -31,7 +31,7 @@
#ifndef IMAGE_LOADER_HDR_H
#define IMAGE_LOADER_HDR_H
-#include "io/image_loader.h"
+#include "core/io/image_loader.h"
/**
@author Juan Linietsky <reduzio@gmail.com>
diff --git a/modules/jpg/image_loader_jpegd.cpp b/modules/jpg/image_loader_jpegd.cpp
index 437c0d57fa..a49137ae73 100644
--- a/modules/jpg/image_loader_jpegd.cpp
+++ b/modules/jpg/image_loader_jpegd.cpp
@@ -30,8 +30,8 @@
#include "image_loader_jpegd.h"
-#include "os/os.h"
-#include "print_string.h"
+#include "core/os/os.h"
+#include "core/print_string.h"
#include <jpgd.h>
#include <string.h>
diff --git a/modules/jpg/image_loader_jpegd.h b/modules/jpg/image_loader_jpegd.h
index 3e3ac5217f..b5f0637c9b 100644
--- a/modules/jpg/image_loader_jpegd.h
+++ b/modules/jpg/image_loader_jpegd.h
@@ -31,7 +31,7 @@
#ifndef IMAGE_LOADER_JPG_H
#define IMAGE_LOADER_JPG_H
-#include "io/image_loader.h"
+#include "core/io/image_loader.h"
/**
@author Juan Linietsky <reduzio@gmail.com>
diff --git a/modules/mbedtls/stream_peer_mbed_tls.cpp b/modules/mbedtls/stream_peer_mbed_tls.cpp
index 884c26ddfe..3398957775 100755
--- a/modules/mbedtls/stream_peer_mbed_tls.cpp
+++ b/modules/mbedtls/stream_peer_mbed_tls.cpp
@@ -29,8 +29,8 @@
/*************************************************************************/
#include "stream_peer_mbed_tls.h"
+#include "core/os/file_access.h"
#include "mbedtls/platform_util.h"
-#include "os/file_access.h"
static void my_debug(void *ctx, int level,
const char *file, int line,
diff --git a/modules/mbedtls/stream_peer_mbed_tls.h b/modules/mbedtls/stream_peer_mbed_tls.h
index 7f4e5a4513..0cf893eacf 100755
--- a/modules/mbedtls/stream_peer_mbed_tls.h
+++ b/modules/mbedtls/stream_peer_mbed_tls.h
@@ -31,7 +31,7 @@
#ifndef STREAM_PEER_OPEN_SSL_H
#define STREAM_PEER_OPEN_SSL_H
-#include "io/stream_peer_ssl.h"
+#include "core/io/stream_peer_ssl.h"
#include "mbedtls/config.h"
#include "mbedtls/ctr_drbg.h"
diff --git a/modules/mono/SCsub b/modules/mono/SCsub
index f3cf4c9c5d..b3a2d26e4a 100644
--- a/modules/mono/SCsub
+++ b/modules/mono/SCsub
@@ -7,21 +7,24 @@ env_mono = env_modules.Clone()
# TODO move functions to their own modules
-def make_cs_files_header(src, dst):
+def make_cs_files_header(src, dst, version_dst):
from compat import byte_to_str
with open(dst, 'w') as header:
- header.write('/* This is an automatically generated file; DO NOT EDIT! OK THX */\n')
- header.write('#ifndef _CS_FILES_DATA_H\n')
- header.write('#define _CS_FILES_DATA_H\n\n')
- header.write('#include "map.h"\n')
- header.write('#include "ustring.h"\n')
+ header.write('/* THIS FILE IS GENERATED DO NOT EDIT */\n')
+ header.write('#ifndef CS_COMPRESSED_H\n')
+ header.write('#define CS_COMPRESSED_H\n\n')
+ header.write('#ifdef TOOLS_ENABLED\n\n')
+ header.write('#include "core/map.h"\n')
+ header.write('#include "core/ustring.h"\n')
inserted_files = ''
import os
latest_mtime = 0
+ cs_file_count = 0
for root, _, files in os.walk(src):
files = [f for f in files if f.endswith('.cs')]
for file in files:
+ cs_file_count += 1
filepath = os.path.join(root, file)
filepath_src_rel = os.path.relpath(filepath, src)
mtime = os.path.getmtime(filepath)
@@ -31,8 +34,10 @@ def make_cs_files_header(src, dst):
decomp_size = len(buf)
import zlib
buf = zlib.compress(buf)
- name = os.path.splitext(os.path.normpath(filepath_src_rel))[0].strip(os.sep).replace(os.sep, '_').replace('.', '_dotto_')
- header.write('\nstatic const int _cs_' + name + '_compressed_size = ' + str(len(buf)) + ';\n')
+ name = str(cs_file_count)
+ header.write('\n')
+ header.write('// ' + filepath_src_rel + '\n')
+ header.write('static const int _cs_' + name + '_compressed_size = ' + str(len(buf)) + ';\n')
header.write('static const int _cs_' + name + '_uncompressed_size = ' + str(decomp_size) + ';\n')
header.write('static const unsigned char _cs_' + name + '_compressed[] = { ')
for i, buf_idx in enumerate(range(len(buf))):
@@ -44,8 +49,6 @@ def make_cs_files_header(src, dst):
'_cs_' + name + '_uncompressed_size, ' \
'_cs_' + name + '_compressed));\n'
header.write(' };\n')
- glue_version = int(latest_mtime) # The latest modified time will do for now
- header.write('\n#define CS_GLUE_VERSION UINT32_C(' + str(glue_version) + ')\n')
header.write('\nstruct CompressedFile\n' '{\n'
'\tint compressed_size;\n' '\tint uncompressed_size;\n' '\tconst unsigned char* data;\n'
'\n\tCompressedFile(int p_comp_size, int p_uncomp_size, const unsigned char* p_data)\n'
@@ -53,17 +56,28 @@ def make_cs_files_header(src, dst):
'\t\tdata = p_data;\n' '\t}\n' '\n\tCompressedFile() {}\n' '};\n'
'\nvoid get_compressed_files(Map<String, CompressedFile>& r_files)\n' '{\n' + inserted_files + '}\n'
)
- header.write('#endif // _CS_FILES_DATA_H')
+ header.write('\n#endif // TOOLS_ENABLED\n')
+ header.write('\n#endif // CS_COMPRESSED_H\n')
+
+ glue_version = int(latest_mtime) # The latest modified time will do for now
+
+ with open(version_dst, 'w') as version_header:
+ version_header.write('/* THIS FILE IS GENERATED DO NOT EDIT */\n')
+ version_header.write('#ifndef CS_GLUE_VERSION_H\n')
+ version_header.write('#define CS_GLUE_VERSION_H\n\n')
+ version_header.write('#define CS_GLUE_VERSION UINT32_C(' + str(glue_version) + ')\n')
+ version_header.write('\n#endif // CS_GLUE_VERSION_H\n')
env_mono.add_source_files(env.modules_sources, '*.cpp')
+env_mono.add_source_files(env.modules_sources, 'glue/*.cpp')
env_mono.add_source_files(env.modules_sources, 'mono_gd/*.cpp')
env_mono.add_source_files(env.modules_sources, 'utils/*.cpp')
if env['tools']:
env_mono.add_source_files(env.modules_sources, 'editor/*.cpp')
- # NOTE: It is safe to generate this file here, since this is still execute serially
- make_cs_files_header('glue/cs_files', 'glue/cs_compressed.gen.h')
+ # NOTE: It is safe to generate this file here, since this is still executed serially
+ make_cs_files_header('glue/Managed/Files', 'glue/cs_compressed.gen.h', 'glue/cs_glue_version.gen.h')
vars = Variables()
vars.Add(BoolVariable('mono_glue', 'Build with the mono glue sources', True))
@@ -72,9 +86,7 @@ vars.Update(env_mono)
# Glue sources
if env_mono['mono_glue']:
- env_mono.add_source_files(env.modules_sources, 'glue/*.cpp')
-else:
- env_mono.Append(CPPDEFINES=['MONO_GLUE_DISABLED'])
+ env_mono.Append(CPPDEFINES=['MONO_GLUE_ENABLED'])
if ARGUMENTS.get('yolo_copy', False):
env_mono.Append(CPPDEFINES=['YOLO_COPY'])
diff --git a/modules/mono/csharp_script.cpp b/modules/mono/csharp_script.cpp
index d2a861dbe8..b9209fce92 100644
--- a/modules/mono/csharp_script.cpp
+++ b/modules/mono/csharp_script.cpp
@@ -32,10 +32,10 @@
#include <mono/metadata/threads.h>
-#include "os/file_access.h"
-#include "os/os.h"
-#include "os/thread.h"
-#include "project_settings.h"
+#include "core/os/file_access.h"
+#include "core/os/os.h"
+#include "core/os/thread.h"
+#include "core/project_settings.h"
#ifdef TOOLS_ENABLED
#include "editor/bindings_generator.h"
@@ -107,7 +107,7 @@ void CSharpLanguage::init() {
gdmono = memnew(GDMono);
gdmono->initialize();
-#ifdef MONO_GLUE_DISABLED
+#ifndef MONO_GLUE_ENABLED
WARN_PRINT("This binary is built with `mono_glue=no` and cannot be used for scripting");
#endif
@@ -138,7 +138,7 @@ void CSharpLanguage::finish() {
#endif
// Release gchandle bindings before finalizing mono runtime
- gchandle_bindings.clear();
+ script_bindings.clear();
if (gdmono) {
memdelete(gdmono);
@@ -551,22 +551,22 @@ Vector<ScriptLanguage::StackInfo> CSharpLanguage::stack_trace_get_info(MonoObjec
void CSharpLanguage::frame() {
- const Ref<MonoGCHandle> &task_scheduler_handle = GDMonoUtils::mono_cache.task_scheduler_handle;
+ if (gdmono && gdmono->is_runtime_initialized() && gdmono->get_core_api_assembly() != NULL) {
+ const Ref<MonoGCHandle> &task_scheduler_handle = GDMonoUtils::mono_cache.task_scheduler_handle;
- if (task_scheduler_handle.is_valid()) {
- MonoObject *task_scheduler = task_scheduler_handle->get_target();
+ if (task_scheduler_handle.is_valid()) {
+ MonoObject *task_scheduler = task_scheduler_handle->get_target();
- if (task_scheduler) {
- GDMonoUtils::GodotTaskScheduler_Activate thunk = CACHED_METHOD_THUNK(GodotTaskScheduler, Activate);
+ if (task_scheduler) {
+ GDMonoUtils::GodotTaskScheduler_Activate thunk = CACHED_METHOD_THUNK(GodotTaskScheduler, Activate);
- ERR_FAIL_NULL(thunk);
+ MonoException *exc = NULL;
+ thunk(task_scheduler, (MonoObject **)&exc);
- MonoException *exc = NULL;
- thunk(task_scheduler, (MonoObject **)&exc);
-
- if (exc) {
- GDMonoUtils::debug_unhandled_exception(exc);
- _UNREACHABLE_();
+ if (exc) {
+ GDMonoUtils::debug_unhandled_exception(exc);
+ _UNREACHABLE_();
+ }
}
}
}
@@ -892,6 +892,48 @@ void CSharpLanguage::set_language_index(int p_idx) {
lang_idx = p_idx;
}
+void CSharpLanguage::release_script_gchandle(Ref<MonoGCHandle> &p_gchandle) {
+
+ if (!p_gchandle->is_released()) { // Do not locking unnecessarily
+#ifndef NO_THREADS
+ get_singleton()->script_gchandle_release_lock->lock();
+#endif
+
+ p_gchandle->release();
+
+#ifndef NO_THREADS
+ get_singleton()->script_gchandle_release_lock->unlock();
+#endif
+ }
+}
+
+void CSharpLanguage::release_script_gchandle(MonoObject *p_pinned_expected_obj, Ref<MonoGCHandle> &p_gchandle) {
+
+ uint32_t pinned_gchandle = MonoGCHandle::new_strong_handle_pinned(p_pinned_expected_obj); // we might lock after this, so pin it
+
+ if (!p_gchandle->is_released()) { // Do not locking unnecessarily
+#ifndef NO_THREADS
+ get_singleton()->script_gchandle_release_lock->lock();
+#endif
+
+ MonoObject *target = p_gchandle->get_target();
+
+ // We release the gchandle if it points to the MonoObject* we expect (otherwise it was
+ // already released and could have been replaced) or if we can't get its target MonoObject*
+ // (which doesn't necessarily mean it was released, and we want it released in order to
+ // avoid locking other threads unnecessarily).
+ if (target == p_pinned_expected_obj || target == NULL) {
+ p_gchandle->release();
+ }
+
+#ifndef NO_THREADS
+ get_singleton()->script_gchandle_release_lock->unlock();
+#endif
+ }
+
+ MonoGCHandle::free_handle(pinned_gchandle);
+}
+
CSharpLanguage::CSharpLanguage() {
ERR_FAIL_COND(singleton);
@@ -904,9 +946,11 @@ CSharpLanguage::CSharpLanguage() {
#ifdef NO_THREADS
lock = NULL;
gchandle_bind_lock = NULL;
+ script_gchandle_release_lock = NULL;
#else
lock = Mutex::create();
script_bind_lock = Mutex::create();
+ script_gchandle_release_lock = Mutex::create();
#endif
lang_idx = -1;
@@ -926,6 +970,11 @@ CSharpLanguage::~CSharpLanguage() {
script_bind_lock = NULL;
}
+ if (script_gchandle_release_lock) {
+ memdelete(script_gchandle_release_lock);
+ script_gchandle_release_lock = NULL;
+ }
+
singleton = NULL;
}
@@ -954,30 +1003,34 @@ void *CSharpLanguage::alloc_instance_binding_data(Object *p_object) {
ERR_FAIL_NULL_V(mono_object, NULL);
- // Tie managed to unmanaged
- Reference *ref = Object::cast_to<Reference>(p_object);
+ CSharpScriptBinding script_binding;
- if (ref) {
- // Unsafe refcount increment. The managed instance also counts as a reference.
- // This way if the unmanaged world has no references to our owner
- // but the managed instance is alive, the refcount will be 1 instead of 0.
- // See: _GodotSharp::_dispose_object(Object *p_object)
-
- ref->reference();
- }
-
- Ref<MonoGCHandle> gchandle = MonoGCHandle::create_strong(mono_object);
+ script_binding.type_name = type_name;
+ script_binding.wrapper_class = type_class; // cache
+ script_binding.gchandle = MonoGCHandle::create_strong(mono_object);
#ifndef NO_THREADS
script_bind_lock->lock();
#endif
- void *data = (void *)gchandle_bindings.insert(p_object, gchandle);
+ void *data = (void *)script_bindings.insert(p_object, script_binding);
#ifndef NO_THREADS
script_bind_lock->unlock();
#endif
+ // Tie managed to unmanaged
+ Reference *ref = Object::cast_to<Reference>(p_object);
+
+ if (ref) {
+ // Unsafe refcount increment. The managed instance also counts as a reference.
+ // This way if the unmanaged world has no references to our owner
+ // but the managed instance is alive, the refcount will be 1 instead of 0.
+ // See: godot_icall_Reference_Dtor(MonoObject *p_obj, Object *p_ptr)
+
+ ref->reference();
+ }
+
return data;
}
@@ -985,7 +1038,7 @@ void CSharpLanguage::free_instance_binding_data(void *p_data) {
if (GDMono::get_singleton() == NULL) {
#ifdef DEBUG_ENABLED
- CRASH_COND(!gchandle_bindings.empty());
+ CRASH_COND(!script_bindings.empty());
#endif
// Mono runtime finalized, all the gchandle bindings were already released
return;
@@ -998,15 +1051,15 @@ void CSharpLanguage::free_instance_binding_data(void *p_data) {
script_bind_lock->lock();
#endif
- Map<Object *, Ref<MonoGCHandle> >::Element *data = (Map<Object *, Ref<MonoGCHandle> >::Element *)p_data;
+ Map<Object *, CSharpScriptBinding>::Element *data = (Map<Object *, CSharpScriptBinding>::Element *)p_data;
// Set the native instance field to IntPtr.Zero, if not yet garbage collected
- MonoObject *mono_object = data->value()->get_target();
+ MonoObject *mono_object = data->value().gchandle->get_target();
if (mono_object) {
CACHED_FIELD(GodotObject, ptr)->set_value_raw(mono_object, NULL);
}
- gchandle_bindings.erase(data);
+ script_bindings.erase(data);
#ifndef NO_THREADS
script_bind_lock->unlock();
@@ -1024,7 +1077,7 @@ void CSharpLanguage::refcount_incremented_instance_binding(Object *p_object) {
void *data = p_object->get_script_instance_binding(get_language_index());
if (!data)
return;
- Ref<MonoGCHandle> &gchandle = ((Map<Object *, Ref<MonoGCHandle> >::Element *)data)->get();
+ Ref<MonoGCHandle> &gchandle = ((Map<Object *, CSharpScriptBinding>::Element *)data)->get().gchandle;
if (ref_owner->reference_get_count() > 1 && gchandle->is_weak()) { // The managed side also holds a reference, hence 1 instead of 0
// The reference count was increased after the managed side was the only one referencing our owner.
@@ -1036,7 +1089,7 @@ void CSharpLanguage::refcount_incremented_instance_binding(Object *p_object) {
return; // Called after the managed side was collected, so nothing to do here
// Release the current weak handle and replace it with a strong handle.
- uint32_t strong_gchandle = MonoGCHandle::make_strong_handle(target);
+ uint32_t strong_gchandle = MonoGCHandle::new_strong_handle(target);
gchandle->release();
gchandle->set_handle(strong_gchandle, MonoGCHandle::STRONG_HANDLE);
}
@@ -1055,7 +1108,7 @@ bool CSharpLanguage::refcount_decremented_instance_binding(Object *p_object) {
void *data = p_object->get_script_instance_binding(get_language_index());
if (!data)
return refcount == 0;
- Ref<MonoGCHandle> &gchandle = ((Map<Object *, Ref<MonoGCHandle> >::Element *)data)->get();
+ Ref<MonoGCHandle> &gchandle = ((Map<Object *, CSharpScriptBinding>::Element *)data)->get().gchandle;
if (refcount == 1 && !gchandle->is_weak()) { // The managed side also holds a reference, hence 1 instead of 0
// If owner owner is no longer referenced by the unmanaged side,
@@ -1066,7 +1119,7 @@ bool CSharpLanguage::refcount_decremented_instance_binding(Object *p_object) {
return refcount == 0; // Called after the managed side was collected, so nothing to do here
// Release the current strong handle and replace it with a weak handle.
- uint32_t weak_gchandle = MonoGCHandle::make_weak_handle(target);
+ uint32_t weak_gchandle = MonoGCHandle::new_weak_handle(target);
gchandle->release();
gchandle->set_handle(weak_gchandle, MonoGCHandle::WEAK_HANDLE);
@@ -1096,9 +1149,8 @@ CSharpInstance *CSharpInstance::create_for_managed_type(Object *p_owner, CSharpS
}
MonoObject *CSharpInstance::get_mono_object() const {
-#ifdef DEBUG_ENABLED
- CRASH_COND(gchandle.is_null());
-#endif
+
+ ERR_FAIL_COND_V(gchandle.is_null(), NULL);
return gchandle->get_target();
}
@@ -1326,10 +1378,12 @@ void CSharpInstance::call_multilevel_reversed(const StringName &p_method, const
call_multilevel(p_method, p_args, p_argcount);
}
-void CSharpInstance::_reference_owner_unsafe() {
+bool CSharpInstance::_reference_owner_unsafe() {
#ifdef DEBUG_ENABLED
CRASH_COND(!base_ref);
+ CRASH_COND(owner == NULL);
+ CRASH_COND(unsafe_referenced); // already referenced
#endif
// Unsafe refcount increment. The managed instance also counts as a reference.
@@ -1338,36 +1392,107 @@ void CSharpInstance::_reference_owner_unsafe() {
// See: _unreference_owner_unsafe()
// May not me referenced yet, so we must use init_ref() instead of reference()
- Object::cast_to<Reference>(owner)->init_ref();
+ bool success = Object::cast_to<Reference>(owner)->init_ref();
+ unsafe_referenced = success;
+ return success;
}
-void CSharpInstance::_unreference_owner_unsafe() {
+bool CSharpInstance::_unreference_owner_unsafe() {
#ifdef DEBUG_ENABLED
CRASH_COND(!base_ref);
+ CRASH_COND(owner == NULL);
#endif
+ if (!unsafe_referenced)
+ return false; // Already unreferenced
+
// Called from CSharpInstance::mono_object_disposed() or ~CSharpInstance()
// Unsafe refcount decrement. The managed instance also counts as a reference.
// See: _reference_owner_unsafe()
- if (Object::cast_to<Reference>(owner)->unreference()) {
+ bool die = static_cast<Reference *>(owner)->unreference();
+
+ if (die) {
memdelete(owner);
owner = NULL;
}
+
+ return die;
}
-void CSharpInstance::mono_object_disposed() {
+MonoObject *CSharpInstance::_internal_new_managed() {
+#ifdef DEBUG_ENABLED
+ CRASH_COND(!gchandle.is_valid());
+#endif
+
+ CSharpLanguage::get_singleton()->release_script_gchandle(gchandle);
+
+ ERR_FAIL_NULL_V(owner, NULL);
+ ERR_FAIL_COND_V(script.is_null(), NULL);
if (base_ref)
- _unreference_owner_unsafe();
+ _reference_owner_unsafe();
+
+ MonoObject *mono_object = mono_object_new(SCRIPTS_DOMAIN, script->script_class->get_mono_ptr());
+
+ if (!mono_object) {
+ script = Ref<CSharpScript>();
+ owner->set_script_instance(NULL);
+ ERR_EXPLAIN("Failed to allocate memory for the object");
+ ERR_FAIL_V(NULL);
+ }
+
+ CACHED_FIELD(GodotObject, ptr)->set_value_raw(mono_object, owner);
+
+ // Construct
+ GDMonoMethod *ctor = script->script_class->get_method(CACHED_STRING_NAME(dotctor), 0);
+ ctor->invoke_raw(mono_object, NULL);
+
+ // Tie managed to unmanaged
+ gchandle = MonoGCHandle::create_strong(mono_object);
+
+ return mono_object;
+}
+
+void CSharpInstance::mono_object_disposed(MonoObject *p_obj) {
+
+#ifdef DEBUG_ENABLED
+ CRASH_COND(base_ref == true);
+ CRASH_COND(gchandle.is_null());
+#endif
+ CSharpLanguage::get_singleton()->release_script_gchandle(p_obj, gchandle);
+}
+
+void CSharpInstance::mono_object_disposed_baseref(MonoObject *p_obj, bool p_is_finalizer, bool &r_owner_deleted) {
+
+#ifdef DEBUG_ENABLED
+ CRASH_COND(base_ref == false);
+ CRASH_COND(gchandle.is_null());
+#endif
+ if (_unreference_owner_unsafe()) {
+ r_owner_deleted = true;
+ } else {
+ r_owner_deleted = false;
+ CSharpLanguage::get_singleton()->release_script_gchandle(p_obj, gchandle);
+ if (p_is_finalizer) {
+ // If the native instance is still alive, then it was
+ // referenced from another thread before the finalizer could
+ // unreference it and delete it, so we want to keep it.
+ // GC.ReRegisterForFinalize(this) is not safe because the objects
+ // referenced by this could have already been collected.
+ // Instead we will create a new managed instance here.
+ _internal_new_managed();
+ }
+ }
}
void CSharpInstance::refcount_incremented() {
#ifdef DEBUG_ENABLED
CRASH_COND(!base_ref);
+ CRASH_COND(owner == NULL);
#endif
Reference *ref_owner = Object::cast_to<Reference>(owner);
@@ -1378,7 +1503,7 @@ void CSharpInstance::refcount_incremented() {
// so the owner must hold the managed side alive again to avoid it from being GCed.
// Release the current weak handle and replace it with a strong handle.
- uint32_t strong_gchandle = MonoGCHandle::make_strong_handle(gchandle->get_target());
+ uint32_t strong_gchandle = MonoGCHandle::new_strong_handle(gchandle->get_target());
gchandle->release();
gchandle->set_handle(strong_gchandle, MonoGCHandle::STRONG_HANDLE);
}
@@ -1388,6 +1513,7 @@ bool CSharpInstance::refcount_decremented() {
#ifdef DEBUG_ENABLED
CRASH_COND(!base_ref);
+ CRASH_COND(owner == NULL);
#endif
Reference *ref_owner = Object::cast_to<Reference>(owner);
@@ -1399,7 +1525,7 @@ bool CSharpInstance::refcount_decremented() {
// the managed instance takes responsibility of deleting the owner when GCed.
// Release the current strong handle and replace it with a weak handle.
- uint32_t weak_gchandle = MonoGCHandle::make_weak_handle(gchandle->get_target());
+ uint32_t weak_gchandle = MonoGCHandle::new_weak_handle(gchandle->get_target());
gchandle->release();
gchandle->set_handle(weak_gchandle, MonoGCHandle::WEAK_HANDLE);
@@ -1470,25 +1596,64 @@ MultiplayerAPI::RPCMode CSharpInstance::get_rset_mode(const StringName &p_variab
void CSharpInstance::notification(int p_notification) {
- MonoObject *mono_object = get_mono_object();
-
if (p_notification == Object::NOTIFICATION_PREDELETE) {
- if (mono_object != NULL) { // otherwise it was collected, and the finalizer already called NOTIFICATION_PREDELETE
- call_notification_no_check(mono_object, p_notification);
- // Set the native instance field to IntPtr.Zero
- CACHED_FIELD(GodotObject, ptr)->set_value_raw(mono_object, NULL);
+ // When NOTIFICATION_PREDELETE is sent, we also take the chance to call Dispose().
+ // It's safe to call Dispose() multiple times and NOTIFICATION_PREDELETE is guaranteed
+ // to be sent at least once, which happens right before the call to the destructor.
+
+ if (base_ref) {
+ // It's not safe to proceed if the owner derives Reference and the refcount reached 0.
+ // At this point, Dispose() was already called (manually or from the finalizer) so
+ // that's not a problem. The refcount wouldn't have reached 0 otherwise, since the
+ // managed side references it and Dispose() needs to be called to release it.
+ // However, this means C# Reference scripts can't receive NOTIFICATION_PREDELETE, but
+ // this is likely the case with GDScript as well: https://github.com/godotengine/godot/issues/6784
+ return;
+ }
+
+ _call_notification(p_notification);
+
+ MonoObject *mono_object = get_mono_object();
+ ERR_FAIL_NULL(mono_object);
+
+ GDMonoUtils::GodotObject_Dispose thunk = CACHED_METHOD_THUNK(GodotObject, Dispose);
+
+ MonoException *exc = NULL;
+ thunk(mono_object, (MonoObject **)&exc);
+
+ if (exc) {
+ GDMonoUtils::set_pending_exception(exc);
}
+
return;
}
- call_notification_no_check(mono_object, p_notification);
+ _call_notification(p_notification);
}
-void CSharpInstance::call_notification_no_check(MonoObject *p_mono_object, int p_notification) {
- Variant value = p_notification;
- const Variant *args[1] = { &value };
+void CSharpInstance::_call_notification(int p_notification) {
- _call_multilevel(p_mono_object, CACHED_STRING_NAME(_notification), args, 1);
+ MonoObject *mono_object = get_mono_object();
+ ERR_FAIL_NULL(mono_object);
+
+ // Custom version of _call_multilevel, optimized for _notification
+
+ uint32_t arg = p_notification;
+ void *args[1] = { &arg };
+ StringName method_name = CACHED_STRING_NAME(_notification);
+
+ GDMonoClass *top = script->script_class;
+
+ while (top && top != script->native) {
+ GDMonoMethod *method = top->get_method(method_name, 1);
+
+ if (method) {
+ method->invoke_raw(mono_object, args);
+ return;
+ }
+
+ top = top->get_parent_class();
+ }
}
Ref<Script> CSharpInstance::get_script() const {
@@ -1501,11 +1666,11 @@ ScriptLanguage *CSharpInstance::get_language() {
return CSharpLanguage::get_singleton();
}
-CSharpInstance::CSharpInstance() {
-
- owner = NULL;
- base_ref = false;
- ref_dying = false;
+CSharpInstance::CSharpInstance() :
+ owner(NULL),
+ base_ref(false),
+ ref_dying(false),
+ unsafe_referenced(false) {
}
CSharpInstance::~CSharpInstance() {
@@ -1514,10 +1679,7 @@ CSharpInstance::~CSharpInstance() {
gchandle->release(); // Make sure it's released
}
- if (base_ref && !ref_dying) { // it may be called from the owner's destructor
-#ifdef DEBUG_ENABLED
- CRASH_COND(!owner); // dunno, just in case
-#endif
+ if (base_ref && !ref_dying && owner) { // it may be called from the owner's destructor
_unreference_owner_unsafe();
}
@@ -1586,26 +1748,27 @@ bool CSharpScript::_update_exports() {
exported_members_cache.clear();
exported_members_defval_cache.clear();
- // We are creating a temporary new instance of the class here to get the default value
- // TODO Workaround. Should be replaced with IL opcodes analysis
+ // Here we create a temporary managed instance of the class to get the initial values
MonoObject *tmp_object = mono_object_new(SCRIPTS_DOMAIN, script_class->get_mono_ptr());
- if (tmp_object) {
- CACHED_FIELD(GodotObject, ptr)->set_value_raw(tmp_object, tmp_object); // FIXME WTF is this workaround
+ if (!tmp_object) {
+ ERR_PRINT("Failed to create temporary MonoObject");
+ return false;
+ }
- GDMonoMethod *ctor = script_class->get_method(CACHED_STRING_NAME(dotctor), 0);
- MonoException *exc = NULL;
- ctor->invoke(tmp_object, NULL, &exc);
+ uint32_t tmp_pinned_gchandle = MonoGCHandle::new_strong_handle_pinned(tmp_object); // pin it (not sure if needed)
- if (exc) {
- ERR_PRINT("Exception thrown from constructor of temporary MonoObject:");
- GDMonoUtils::debug_print_unhandled_exception(exc);
- tmp_object = NULL;
- ERR_FAIL_V(false);
- }
- } else {
- ERR_PRINT("Failed to create temporary MonoObject");
+ GDMonoMethod *ctor = script_class->get_method(CACHED_STRING_NAME(dotctor), 0);
+ MonoException *ctor_exc = NULL;
+ ctor->invoke(tmp_object, NULL, &ctor_exc);
+
+ if (ctor_exc) {
+ MonoGCHandle::free_handle(tmp_pinned_gchandle);
+ tmp_object = NULL;
+
+ ERR_PRINT("Exception thrown from constructor of temporary MonoObject:");
+ GDMonoUtils::debug_print_unhandled_exception(ctor_exc);
return false;
}
@@ -1666,6 +1829,21 @@ bool CSharpScript::_update_exports() {
top = top->get_parent_class();
}
+
+ // Dispose the temporary managed instance
+
+ GDMonoUtils::GodotObject_Dispose thunk = CACHED_METHOD_THUNK(GodotObject, Dispose);
+
+ MonoException *exc = NULL;
+ thunk(tmp_object, (MonoObject **)&exc);
+
+ if (exc) {
+ ERR_PRINT("Exception thrown from method Dispose() of temporary MonoObject:");
+ GDMonoUtils::debug_print_unhandled_exception(exc);
+ }
+
+ MonoGCHandle::free_handle(tmp_pinned_gchandle);
+ tmp_object = NULL;
}
if (placeholders.size()) {
@@ -1750,6 +1928,10 @@ bool CSharpScript::_get_signal(GDMonoClass *p_class, GDMonoClass *p_delegate, Ve
}
#ifdef TOOLS_ENABLED
+/**
+ * Returns false if there was an error, otherwise true.
+ * If there was an error, r_prop_info and r_exported are not assigned any value.
+ */
bool CSharpScript::_get_member_export(GDMonoClass *p_class, GDMonoClassMember *p_member, PropertyInfo &r_prop_info, bool &r_exported) {
StringName name = p_member->get_name();
@@ -1775,49 +1957,100 @@ bool CSharpScript::_get_member_export(GDMonoClass *p_class, GDMonoClassMember *p
Variant::Type variant_type = GDMonoMarshal::managed_to_variant_type(type);
- if (p_member->has_attribute(CACHED_CLASS(ExportAttribute))) {
- if (p_member->get_member_type() == GDMonoClassMember::MEMBER_TYPE_PROPERTY) {
- GDMonoProperty *property = static_cast<GDMonoProperty *>(p_member);
- if (!property->has_getter() || !property->has_setter()) {
- ERR_PRINTS("Cannot export property because it does not provide a getter or a setter: " + p_class->get_full_name() + "." + name.operator String());
- return false;
- }
+ if (!p_member->has_attribute(CACHED_CLASS(ExportAttribute))) {
+ r_prop_info = PropertyInfo(variant_type, name.operator String(), PROPERTY_HINT_NONE, "", PROPERTY_USAGE_SCRIPT_VARIABLE);
+ r_exported = false;
+ return true;
+ }
+
+ if (p_member->get_member_type() == GDMonoClassMember::MEMBER_TYPE_PROPERTY) {
+ GDMonoProperty *property = static_cast<GDMonoProperty *>(p_member);
+ if (!property->has_getter() || !property->has_setter()) {
+ ERR_PRINTS("Cannot export property because it does not provide a getter or a setter: " + p_class->get_full_name() + "." + name.operator String());
+ return false;
}
+ }
- MonoObject *attr = p_member->get_attribute(CACHED_CLASS(ExportAttribute));
+ MonoObject *attr = p_member->get_attribute(CACHED_CLASS(ExportAttribute));
- PropertyHint hint = PROPERTY_HINT_NONE;
- String hint_string;
+ PropertyHint hint = PROPERTY_HINT_NONE;
+ String hint_string;
- if (variant_type == Variant::NIL) {
- ERR_PRINTS("Unknown type of exported member: " + p_class->get_full_name() + "." + name.operator String());
- return false;
- } else if (variant_type == Variant::INT && type.type_encoding == MONO_TYPE_VALUETYPE && mono_class_is_enum(type.type_class->get_mono_ptr())) {
- variant_type = Variant::INT;
- hint = PROPERTY_HINT_ENUM;
+ if (variant_type == Variant::NIL) {
+ ERR_PRINTS("Unknown type of exported member: " + p_class->get_full_name() + "." + name.operator String());
+ return false;
+ } else if (variant_type == Variant::INT && type.type_encoding == MONO_TYPE_VALUETYPE && mono_class_is_enum(type.type_class->get_mono_ptr())) {
+ variant_type = Variant::INT;
+ hint = PROPERTY_HINT_ENUM;
+
+ Vector<MonoClassField *> fields = type.type_class->get_enum_fields();
+
+ MonoType *enum_basetype = mono_class_enum_basetype(type.type_class->get_mono_ptr());
- Vector<MonoClassField *> fields = type.type_class->get_enum_fields();
+ String name_only_hint_string;
- for (int i = 0; i < fields.size(); i++) {
- if (i > 0)
- hint_string += ",";
- hint_string += mono_field_get_name(fields[i]);
+ // True: enum Foo { Bar, Baz, Quux }
+ // True: enum Foo { Bar = 0, Baz = 1, Quux = 2 }
+ // False: enum Foo { Bar = 0, Baz = 7, Quux = 5 }
+ bool uses_default_values = true;
+
+ for (int i = 0; i < fields.size(); i++) {
+ MonoClassField *field = fields[i];
+
+ if (i > 0) {
+ hint_string += ",";
+ name_only_hint_string += ",";
}
- } else if (variant_type == Variant::OBJECT && CACHED_CLASS(GodotReference)->is_assignable_from(type.type_class)) {
- hint = PROPERTY_HINT_RESOURCE_TYPE;
- hint_string = NATIVE_GDMONOCLASS_NAME(type.type_class);
- } else {
- hint = PropertyHint(CACHED_FIELD(ExportAttribute, hint)->get_int_value(attr));
- hint_string = CACHED_FIELD(ExportAttribute, hintString)->get_string_value(attr);
+
+ String enum_field_name = mono_field_get_name(field);
+ hint_string += enum_field_name;
+ name_only_hint_string += enum_field_name;
+
+ // TODO:
+ // Instead of using mono_field_get_value_object, we can do this without boxing. Check the
+ // internal mono functions: ves_icall_System_Enum_GetEnumValuesAndNames and the get_enum_field.
+
+ MonoObject *val_obj = mono_field_get_value_object(mono_domain_get(), field, NULL);
+
+ if (val_obj == NULL) {
+ ERR_PRINTS("Failed to get '" + enum_field_name + "' constant enum value of exported member: " +
+ p_class->get_full_name() + "." + name.operator String());
+ return false;
+ }
+
+ bool r_error;
+ uint64_t val = GDMonoUtils::unbox_enum_value(val_obj, enum_basetype, r_error);
+ if (r_error) {
+ ERR_PRINTS("Failed to unbox '" + enum_field_name + "' constant enum value of exported member: " +
+ p_class->get_full_name() + "." + name.operator String());
+ return false;
+ }
+
+ if (val != i) {
+ uses_default_values = false;
+ }
+
+ hint_string += ":";
+ hint_string += String::num_uint64(val);
}
- r_prop_info = PropertyInfo(variant_type, name.operator String(), hint, hint_string, PROPERTY_USAGE_DEFAULT | PROPERTY_USAGE_SCRIPT_VARIABLE);
- r_exported = true;
+ if (uses_default_values) {
+ // If we use the format NAME:VAL, that's what the editor displays.
+ // That's annoying if the user is not using custom values for the enum constants.
+ // This may not be needed in the future if the editor is changed to not display values.
+ hint_string = name_only_hint_string;
+ }
+ } else if (variant_type == Variant::OBJECT && CACHED_CLASS(GodotReference)->is_assignable_from(type.type_class)) {
+ hint = PROPERTY_HINT_RESOURCE_TYPE;
+ hint_string = NATIVE_GDMONOCLASS_NAME(type.type_class);
} else {
- r_prop_info = PropertyInfo(variant_type, name.operator String(), PROPERTY_HINT_NONE, "", PROPERTY_USAGE_SCRIPT_VARIABLE);
- r_exported = false;
+ hint = PropertyHint(CACHED_FIELD(ExportAttribute, hint)->get_int_value(attr));
+ hint_string = CACHED_FIELD(ExportAttribute, hintString)->get_string_value(attr);
}
+ r_prop_info = PropertyInfo(variant_type, name.operator String(), hint, hint_string, PROPERTY_USAGE_DEFAULT | PROPERTY_USAGE_SCRIPT_VARIABLE);
+ r_exported = true;
+
return true;
}
#endif
@@ -2012,6 +2245,8 @@ CSharpInstance *CSharpScript::_create_instance(const Variant **p_args, int p_arg
ERR_FAIL_V(NULL);
}
+ uint32_t pinned_gchandle = MonoGCHandle::new_strong_handle_pinned(mono_object); // we might lock after this, so pin it
+
#ifndef NO_THREADS
CSharpLanguage::singleton->lock->lock();
#endif
@@ -2033,6 +2268,8 @@ CSharpInstance *CSharpScript::_create_instance(const Variant **p_args, int p_arg
/* STEP 3, PARTY */
+ MonoGCHandle::free_handle(pinned_gchandle);
+
//@TODO make thread safe
return instance;
}
diff --git a/modules/mono/csharp_script.h b/modules/mono/csharp_script.h
index 1a5d0c8a69..8b0a095890 100644
--- a/modules/mono/csharp_script.h
+++ b/modules/mono/csharp_script.h
@@ -31,10 +31,10 @@
#ifndef CSHARP_SCRIPT_H
#define CSHARP_SCRIPT_H
-#include "io/resource_loader.h"
-#include "io/resource_saver.h"
-#include "script_language.h"
-#include "self_list.h"
+#include "core/io/resource_loader.h"
+#include "core/io/resource_saver.h"
+#include "core/script_language.h"
+#include "core/self_list.h"
#include "mono_gc_handle.h"
#include "mono_gd/gd_mono.h"
@@ -48,6 +48,8 @@ class CSharpLanguage;
#ifdef NO_SAFE_CAST
template <typename TScriptInstance, typename TScriptLanguage>
TScriptInstance *cast_script_instance(ScriptInstance *p_inst) {
+ if (!p_inst)
+ return NULL;
return p_inst->get_language() == TScriptLanguage::get_singleton() ? static_cast<TScriptInstance *>(p_inst) : NULL;
}
#else
@@ -177,14 +179,19 @@ class CSharpInstance : public ScriptInstance {
friend class CSharpScript;
friend class CSharpLanguage;
+
Object *owner;
- Ref<CSharpScript> script;
- Ref<MonoGCHandle> gchandle;
bool base_ref;
bool ref_dying;
+ bool unsafe_referenced;
+
+ Ref<CSharpScript> script;
+ Ref<MonoGCHandle> gchandle;
- void _reference_owner_unsafe();
- void _unreference_owner_unsafe();
+ bool _reference_owner_unsafe();
+ bool _unreference_owner_unsafe();
+
+ MonoObject *_internal_new_managed();
// Do not use unless you know what you are doing
friend void GDMonoInternals::tie_managed_to_unmanaged(MonoObject *, Object *);
@@ -208,7 +215,8 @@ public:
virtual void call_multilevel(const StringName &p_method, const Variant **p_args, int p_argcount);
virtual void call_multilevel_reversed(const StringName &p_method, const Variant **p_args, int p_argcount);
- void mono_object_disposed();
+ void mono_object_disposed(MonoObject *p_obj);
+ void mono_object_disposed_baseref(MonoObject *p_obj, bool p_is_finalizer, bool &r_owner_deleted);
virtual void refcount_incremented();
virtual bool refcount_decremented();
@@ -217,7 +225,7 @@ public:
virtual MultiplayerAPI::RPCMode get_rset_mode(const StringName &p_variable) const;
virtual void notification(int p_notification);
- void call_notification_no_check(MonoObject *p_mono_object, int p_notification);
+ void _call_notification(int p_notification);
virtual Ref<Script> get_script() const;
@@ -227,6 +235,12 @@ public:
~CSharpInstance();
};
+struct CSharpScriptBinding {
+ StringName type_name;
+ GDMonoClass *wrapper_class;
+ Ref<MonoGCHandle> gchandle;
+};
+
class CSharpLanguage : public ScriptLanguage {
friend class CSharpScript;
@@ -241,10 +255,11 @@ class CSharpLanguage : public ScriptLanguage {
Mutex *lock;
Mutex *script_bind_lock;
+ Mutex *script_gchandle_release_lock;
Map<Ref<CSharpScript>, Map<ObjectID, List<Pair<StringName, Variant> > > > to_reload;
- Map<Object *, Ref<MonoGCHandle> > gchandle_bindings;
+ Map<Object *, CSharpScriptBinding> script_bindings;
struct StringNameCache {
@@ -270,6 +285,9 @@ public:
_FORCE_INLINE_ static CSharpLanguage *get_singleton() { return singleton; }
+ static void release_script_gchandle(Ref<MonoGCHandle> &p_gchandle);
+ static void release_script_gchandle(MonoObject *p_pinned_expected_obj, Ref<MonoGCHandle> &p_gchandle);
+
bool debug_break(const String &p_error, bool p_allow_continue = true);
bool debug_break_parse(const String &p_file, int p_line, const String &p_error);
diff --git a/modules/mono/editor/bindings_generator.cpp b/modules/mono/editor/bindings_generator.cpp
index cc954348f4..308c54ecb3 100644
--- a/modules/mono/editor/bindings_generator.cpp
+++ b/modules/mono/editor/bindings_generator.cpp
@@ -32,15 +32,16 @@
#ifdef DEBUG_METHODS_ENABLED
-#include "engine.h"
-#include "global_constants.h"
-#include "io/compression.h"
-#include "os/dir_access.h"
-#include "os/file_access.h"
-#include "os/os.h"
-#include "ucaps.h"
+#include "core/engine.h"
+#include "core/global_constants.h"
+#include "core/io/compression.h"
+#include "core/os/dir_access.h"
+#include "core/os/file_access.h"
+#include "core/os/os.h"
+#include "core/ucaps.h"
#include "../glue/cs_compressed.gen.h"
+#include "../glue/cs_glue_version.gen.h"
#include "../godotsharp_defs.h"
#include "../mono_gd/gd_mono_marshal.h"
#include "../utils/path_utils.h"
@@ -48,7 +49,7 @@
#include "csharp_project.h"
#include "net_solution.h"
-#define CS_INDENT " "
+#define CS_INDENT " " // 4 whitespaces
#define INDENT1 CS_INDENT
#define INDENT2 INDENT1 INDENT1
@@ -68,23 +69,18 @@
#define CLOSE_BLOCK_L3 INDENT3 CLOSE_BLOCK
#define CLOSE_BLOCK_L4 INDENT4 CLOSE_BLOCK
-#define LOCAL_RET "ret"
-
#define CS_FIELD_MEMORYOWN "memoryOwn"
#define CS_PARAM_METHODBIND "method"
#define CS_PARAM_INSTANCE "ptr"
#define CS_SMETHOD_GETINSTANCE "GetPtr"
-#define CS_FIELD_SINGLETON "instance"
-#define CS_PROP_SINGLETON "Instance"
-#define CS_CLASS_SIGNALAWAITER "SignalAwaiter"
#define CS_METHOD_CALL "Call"
#define GLUE_HEADER_FILE "glue_header.h"
#define ICALL_PREFIX "godot_icall_"
#define SINGLETON_ICALL_SUFFIX "_get_singleton"
-#define ICALL_GET_METHODBIND ICALL_PREFIX "ClassDB_get_method"
-#define ICALL_CONNECT_SIGNAL_AWAITER ICALL_PREFIX "Object_connect_signal_awaiter"
-#define ICALL_OBJECT_DTOR ICALL_PREFIX "Object_Dtor"
+#define ICALL_GET_METHODBIND ICALL_PREFIX "Object_ClassDB_get_method"
+
+#define C_LOCAL_RET "ret"
#define C_LOCAL_PTRCALL_ARGS "call_args"
#define C_MACRO_OBJECT_CONSTRUCT "GODOTSHARP_INSTANCE_OBJECT"
@@ -101,7 +97,7 @@
#define C_METHOD_MONOARRAY_TO(m_type) C_NS_MONOMARSHAL "::mono_array_to_" #m_type
#define C_METHOD_MONOARRAY_FROM(m_type) C_NS_MONOMARSHAL "::" #m_type "_to_mono_array"
-#define BINDINGS_GENERATOR_VERSION UINT32_C(2)
+#define BINDINGS_GENERATOR_VERSION UINT32_C(3)
const char *BindingsGenerator::TypeInterface::DEFAULT_VARARG_C_IN = "\t%0 %1_in = %1;\n";
@@ -196,48 +192,6 @@ String BindingsGenerator::_determine_enum_prefix(const EnumInterface &p_ienum) {
return front->get().name.substr(0, candidate_len);
}
-void BindingsGenerator::_generate_header_icalls() {
-
- core_custom_icalls.clear();
-
- core_custom_icalls.push_back(InternalCall(ICALL_GET_METHODBIND, "IntPtr", "string type, string method"));
- core_custom_icalls.push_back(InternalCall(ICALL_OBJECT_DTOR, "void", "object obj, IntPtr ptr"));
-
- core_custom_icalls.push_back(InternalCall(ICALL_CONNECT_SIGNAL_AWAITER, "Error",
- "IntPtr source, string signal, IntPtr target, " CS_CLASS_SIGNALAWAITER " awaiter"));
-
- core_custom_icalls.push_back(InternalCall(ICALL_PREFIX "NodePath_Ctor", "IntPtr", "string path"));
- core_custom_icalls.push_back(InternalCall(ICALL_PREFIX "NodePath_Dtor", "void", "IntPtr ptr"));
- core_custom_icalls.push_back(InternalCall(ICALL_PREFIX "NodePath_operator_String", "string", "IntPtr ptr"));
-
- core_custom_icalls.push_back(InternalCall(ICALL_PREFIX "RID_Ctor", "IntPtr", "IntPtr from"));
- core_custom_icalls.push_back(InternalCall(ICALL_PREFIX "RID_Dtor", "void", "IntPtr ptr"));
-
- core_custom_icalls.push_back(InternalCall(ICALL_PREFIX "String_md5_buffer", "byte[]", "string str"));
- core_custom_icalls.push_back(InternalCall(ICALL_PREFIX "String_md5_text", "string", "string str"));
- core_custom_icalls.push_back(InternalCall(ICALL_PREFIX "String_rfind", "int", "string str, string what, int from"));
- core_custom_icalls.push_back(InternalCall(ICALL_PREFIX "String_rfindn", "int", "string str, string what, int from"));
- core_custom_icalls.push_back(InternalCall(ICALL_PREFIX "String_sha256_buffer", "byte[]", "string str"));
- core_custom_icalls.push_back(InternalCall(ICALL_PREFIX "String_sha256_text", "string", "string str"));
-
- core_custom_icalls.push_back(InternalCall(ICALL_PREFIX "Godot_bytes2var", "object", "byte[] bytes"));
- core_custom_icalls.push_back(InternalCall(ICALL_PREFIX "Godot_convert", "object", "object what, int type"));
- core_custom_icalls.push_back(InternalCall(ICALL_PREFIX "Godot_hash", "int", "object var"));
- core_custom_icalls.push_back(InternalCall(ICALL_PREFIX "Godot_instance_from_id", "Object", "int instance_id"));
- core_custom_icalls.push_back(InternalCall(ICALL_PREFIX "Godot_print", "void", "object[] what"));
- core_custom_icalls.push_back(InternalCall(ICALL_PREFIX "Godot_printerr", "void", "object[] what"));
- core_custom_icalls.push_back(InternalCall(ICALL_PREFIX "Godot_printraw", "void", "object[] what"));
- core_custom_icalls.push_back(InternalCall(ICALL_PREFIX "Godot_prints", "void", "object[] what"));
- core_custom_icalls.push_back(InternalCall(ICALL_PREFIX "Godot_printt", "void", "object[] what"));
- core_custom_icalls.push_back(InternalCall(ICALL_PREFIX "Godot_seed", "void", "int seed"));
- core_custom_icalls.push_back(InternalCall(ICALL_PREFIX "Godot_str", "string", "object[] what"));
- core_custom_icalls.push_back(InternalCall(ICALL_PREFIX "Godot_str2var", "object", "string str"));
- core_custom_icalls.push_back(InternalCall(ICALL_PREFIX "Godot_type_exists", "bool", "string type"));
- core_custom_icalls.push_back(InternalCall(ICALL_PREFIX "Godot_var2bytes", "byte[]", "object what"));
- core_custom_icalls.push_back(InternalCall(ICALL_PREFIX "Godot_var2str", "string", "object var"));
- core_custom_icalls.push_back(InternalCall(ICALL_PREFIX "Godot_weakref", "WeakRef", "IntPtr obj"));
-}
-
void BindingsGenerator::_generate_method_icalls(const TypeInterface &p_itype) {
for (const List<MethodInterface>::Element *E = p_itype.methods.front(); E; E = E->next()) {
@@ -248,13 +202,8 @@ void BindingsGenerator::_generate_method_icalls(const TypeInterface &p_itype) {
const TypeInterface *return_type = _get_type_or_placeholder(imethod.return_type);
- String im_sig;
- String im_unique_sig;
-
- if (p_itype.is_object_type) {
- im_sig += "IntPtr " CS_PARAM_METHODBIND ", ";
- im_unique_sig += imethod.return_type.cname.operator String() + ",IntPtr,IntPtr";
- }
+ String im_sig = "IntPtr " CS_PARAM_METHODBIND ", ";
+ String im_unique_sig = imethod.return_type.cname.operator String() + ",IntPtr,IntPtr";
im_sig += "IntPtr " CS_PARAM_INSTANCE;
@@ -268,37 +217,28 @@ void BindingsGenerator::_generate_method_icalls(const TypeInterface &p_itype) {
im_sig += " arg";
im_sig += itos(i + 1);
- if (p_itype.is_object_type) {
- im_unique_sig += ",";
- im_unique_sig += get_unique_sig(*arg_type);
- }
+ im_unique_sig += ",";
+ im_unique_sig += get_unique_sig(*arg_type);
i++;
}
+ // godot_icall_{argc}_{icallcount}
String icall_method = ICALL_PREFIX;
-
- if (p_itype.is_object_type) {
- icall_method += itos(imethod.arguments.size()) + "_" + itos(method_icalls.size()); // godot_icall_{argc}_{icallcount}
- } else {
- icall_method += p_itype.name + "_" + imethod.name; // godot_icall_{Type}_{method}
- }
+ icall_method += itos(imethod.arguments.size());
+ icall_method += "_";
+ icall_method += itos(method_icalls.size());
InternalCall im_icall = InternalCall(p_itype.api_type, icall_method, return_type->im_type_out, im_sig, im_unique_sig);
- if (p_itype.is_object_type) {
- List<InternalCall>::Element *match = method_icalls.find(im_icall);
+ List<InternalCall>::Element *match = method_icalls.find(im_icall);
- if (match) {
- if (p_itype.api_type != ClassDB::API_EDITOR)
- match->get().editor_only = false;
- method_icalls_map.insert(&E->get(), &match->get());
- } else {
- List<InternalCall>::Element *added = method_icalls.push_back(im_icall);
- method_icalls_map.insert(&E->get(), &added->get());
- }
+ if (match) {
+ if (p_itype.api_type != ClassDB::API_EDITOR)
+ match->get().editor_only = false;
+ method_icalls_map.insert(&E->get(), &match->get());
} else {
- List<InternalCall>::Element *added = builtin_method_icalls.push_back(im_icall);
+ List<InternalCall>::Element *added = method_icalls.push_back(im_icall);
method_icalls_map.insert(&E->get(), &added->get());
}
}
@@ -483,20 +423,6 @@ Error BindingsGenerator::generate_cs_core_project(const String &p_output_dir, bo
compile_items.push_back(output_file);
}
-#define GENERATE_BUILTIN_TYPE(m_name) \
- { \
- String output_file = path_join(core_dir, #m_name ".cs"); \
- Error err = _generate_cs_type(builtin_types[#m_name], output_file); \
- if (err != OK) \
- return err; \
- compile_items.push_back(output_file); \
- }
-
- GENERATE_BUILTIN_TYPE(NodePath);
- GENERATE_BUILTIN_TYPE(RID);
-
-#undef GENERATE_BUILTIN_TYPE
-
// Generate sources from compressed files
Map<String, CompressedFile> compressed_files;
@@ -537,29 +463,26 @@ Error BindingsGenerator::generate_cs_core_project(const String &p_output_dir, bo
cs_icalls_content.push_back("namespace " BINDINGS_NAMESPACE "\n" OPEN_BLOCK);
cs_icalls_content.push_back(INDENT1 "internal static class " BINDINGS_CLASS_NATIVECALLS "\n" INDENT1 OPEN_BLOCK);
- cs_icalls_content.push_back(INDENT2 "internal static ulong godot_api_hash = ");
+ cs_icalls_content.push_back(MEMBER_BEGIN "internal static ulong godot_api_hash = ");
cs_icalls_content.push_back(String::num_uint64(GDMono::get_singleton()->get_api_core_hash()) + ";\n");
- cs_icalls_content.push_back(INDENT2 "internal static uint bindings_version = ");
+ cs_icalls_content.push_back(MEMBER_BEGIN "internal static uint bindings_version = ");
cs_icalls_content.push_back(String::num_uint64(BINDINGS_GENERATOR_VERSION) + ";\n");
- cs_icalls_content.push_back(INDENT2 "internal static uint cs_glue_version = ");
+ cs_icalls_content.push_back(MEMBER_BEGIN "internal static uint cs_glue_version = ");
cs_icalls_content.push_back(String::num_uint64(CS_GLUE_VERSION) + ";\n");
- cs_icalls_content.push_back("\n");
-#define ADD_INTERNAL_CALL(m_icall) \
- if (!m_icall.editor_only) { \
- cs_icalls_content.push_back(INDENT2 "[MethodImpl(MethodImplOptions.InternalCall)]\n"); \
- cs_icalls_content.push_back(INDENT2 "internal extern static "); \
- cs_icalls_content.push_back(m_icall.im_type_out + " "); \
- cs_icalls_content.push_back(m_icall.name + "("); \
- cs_icalls_content.push_back(m_icall.im_sig + ");\n"); \
+#define ADD_INTERNAL_CALL(m_icall) \
+ if (!m_icall.editor_only) { \
+ cs_icalls_content.push_back(MEMBER_BEGIN "[MethodImpl(MethodImplOptions.InternalCall)]\n"); \
+ cs_icalls_content.push_back(INDENT2 "internal extern static "); \
+ cs_icalls_content.push_back(m_icall.im_type_out + " "); \
+ cs_icalls_content.push_back(m_icall.name + "("); \
+ cs_icalls_content.push_back(m_icall.im_sig + ");\n"); \
}
for (const List<InternalCall>::Element *E = core_custom_icalls.front(); E; E = E->next())
ADD_INTERNAL_CALL(E->get());
for (const List<InternalCall>::Element *E = method_icalls.front(); E; E = E->next())
ADD_INTERNAL_CALL(E->get());
- for (const List<InternalCall>::Element *E = builtin_method_icalls.front(); E; E = E->next())
- ADD_INTERNAL_CALL(E->get());
#undef ADD_INTERNAL_CALL
@@ -658,8 +581,6 @@ Error BindingsGenerator::generate_cs_editor_project(const String &p_output_dir,
cs_icalls_content.push_back(m_icall.im_sig + ");\n"); \
}
- // No need to add builtin_method_icalls. Builtin types are core only
-
for (const List<InternalCall>::Element *E = editor_custom_icalls.front(); E; E = E->next())
ADD_INTERNAL_CALL(E->get());
for (const List<InternalCall>::Element *E = method_icalls.front(); E; E = E->next())
@@ -693,18 +614,34 @@ Error BindingsGenerator::generate_cs_editor_project(const String &p_output_dir,
return OK;
}
-// TODO: there are constants that hide inherited members. must explicitly use `new` to avoid warnings
-// e.g.: warning CS0108: 'SpriteBase3D.FLAG_MAX' hides inherited member 'GeometryInstance.FLAG_MAX'. Use the new keyword if hiding was intended.
+// FIXME: There are some members that hide other inherited members.
+// - In the case of both members being the same kind, the new one must be declared
+// explicitly as `new` to avoid the warning (and we must print a message about it).
+// - In the case of both members being of a different kind, then the new one must
+// be renamed to avoid the name collision (and we must print a warning about it).
+// - Csc warning e.g.:
+// ObjectType/LineEdit.cs(140,38): warning CS0108: 'LineEdit.FocusMode' hides inherited member 'Control.FocusMode'. Use the new keyword if hiding was intended.
Error BindingsGenerator::_generate_cs_type(const TypeInterface &itype, const String &p_output_file) {
+ CRASH_COND(!itype.is_object_type);
+
bool is_derived_type = itype.base_name != StringName();
+ if (!is_derived_type) {
+ // Some Godot.Object assertions
+ CRASH_COND(itype.cname != name_cache.type_Object);
+ CRASH_COND(!itype.is_instantiable);
+ CRASH_COND(itype.api_type != ClassDB::API_CORE);
+ CRASH_COND(itype.is_reference);
+ CRASH_COND(itype.is_singleton);
+ }
+
List<InternalCall> &custom_icalls = itype.api_type == ClassDB::API_EDITOR ? editor_custom_icalls : core_custom_icalls;
if (verbose_output)
OS::get_singleton()->print(String("Generating " + itype.proxy_name + ".cs...\n").utf8());
- String ctor_method(ICALL_PREFIX + itype.proxy_name + "_Ctor");
+ String ctor_method(ICALL_PREFIX + itype.proxy_name + "_Ctor"); // Used only for derived types
List<String> output;
@@ -733,28 +670,24 @@ Error BindingsGenerator::_generate_cs_type(const TypeInterface &itype, const Str
}
output.push_back(INDENT1 "public ");
- if (itype.is_object_type) {
- if (itype.is_singleton) {
- output.push_back("static partial class ");
- } else {
- output.push_back(itype.is_instantiable ? "partial class " : "abstract partial class ");
- }
+ if (itype.is_singleton) {
+ output.push_back("static partial class ");
} else {
- output.push_back("partial class ");
+ output.push_back(itype.is_instantiable ? "partial class " : "abstract partial class ");
}
output.push_back(itype.proxy_name);
if (itype.is_singleton) {
output.push_back("\n");
- } else if (!is_derived_type || !itype.is_object_type /* assuming only object types inherit */) {
- output.push_back(" : IDisposable\n");
- } else if (obj_types.has(itype.base_name)) {
- output.push_back(" : ");
- output.push_back(obj_types[itype.base_name].proxy_name);
- output.push_back("\n");
- } else {
- ERR_PRINTS("Base type '" + itype.base_name.operator String() + "' does not exist, for class " + itype.name);
- return ERR_INVALID_DATA;
+ } else if (is_derived_type) {
+ if (obj_types.has(itype.base_name)) {
+ output.push_back(" : ");
+ output.push_back(obj_types[itype.base_name].proxy_name);
+ output.push_back("\n");
+ } else {
+ ERR_PRINTS("Base type '" + itype.base_name.operator String() + "' does not exist, for class " + itype.name);
+ return ERR_INVALID_DATA;
+ }
}
output.push_back(INDENT1 "{");
@@ -851,9 +784,6 @@ Error BindingsGenerator::_generate_cs_type(const TypeInterface &itype, const Str
output.push_back(INDENT2 CLOSE_BLOCK);
}
- if (itype.enums.size())
- output.push_back("\n");
-
// Add properties
for (const List<PropertyInterface>::Element *E = itype.properties.front(); E; E = E->next()) {
@@ -865,43 +795,9 @@ Error BindingsGenerator::_generate_cs_type(const TypeInterface &itype, const Str
ERR_FAIL_V(prop_err);
}
}
-
- if (class_doc->properties.size())
- output.push_back("\n");
}
- if (!itype.is_object_type) {
- output.push_back(MEMBER_BEGIN "private const string " BINDINGS_NATIVE_NAME_FIELD " = \"" + itype.name + "\";\n");
- output.push_back(MEMBER_BEGIN "private bool disposed = false;\n");
- output.push_back(MEMBER_BEGIN "internal IntPtr " BINDINGS_PTR_FIELD ";\n");
-
- output.push_back(MEMBER_BEGIN "internal static IntPtr " CS_SMETHOD_GETINSTANCE "(");
- output.push_back(itype.proxy_name);
- output.push_back(" instance)\n" OPEN_BLOCK_L2 "return instance == null ? IntPtr.Zero : instance." BINDINGS_PTR_FIELD ";\n" CLOSE_BLOCK_L2);
-
- // Add Destructor
- output.push_back(MEMBER_BEGIN "~");
- output.push_back(itype.proxy_name);
- output.push_back("()\n" OPEN_BLOCK_L2 "Dispose(false);\n" CLOSE_BLOCK_L2);
-
- // Add the Dispose from IDisposable
- output.push_back(MEMBER_BEGIN "public void Dispose()\n" OPEN_BLOCK_L2 "Dispose(true);\n" INDENT3 "GC.SuppressFinalize(this);\n" CLOSE_BLOCK_L2);
-
- // Add the virtual Dispose
- output.push_back(MEMBER_BEGIN "protected virtual void Dispose(bool disposing)\n" OPEN_BLOCK_L2
- "if (disposed) return;\n" INDENT3
- "if (" BINDINGS_PTR_FIELD " != IntPtr.Zero)\n" OPEN_BLOCK_L3 "NativeCalls.godot_icall_");
- output.push_back(itype.proxy_name);
- output.push_back("_Dtor(" BINDINGS_PTR_FIELD ");\n" INDENT5 BINDINGS_PTR_FIELD " = IntPtr.Zero;\n" CLOSE_BLOCK_L3 INDENT3
- "GC.SuppressFinalize(this);\n" INDENT3 "disposed = true;\n" CLOSE_BLOCK_L2);
-
- output.push_back(MEMBER_BEGIN "internal ");
- output.push_back(itype.proxy_name);
- output.push_back("(IntPtr " BINDINGS_PTR_FIELD ")\n" OPEN_BLOCK_L2 "this." BINDINGS_PTR_FIELD " = " BINDINGS_PTR_FIELD ";\n" CLOSE_BLOCK_L2);
-
- output.push_back(MEMBER_BEGIN "public IntPtr NativeInstance\n" OPEN_BLOCK_L2
- "get { return " BINDINGS_PTR_FIELD "; }\n" CLOSE_BLOCK_L2);
- } else if (itype.is_singleton) {
+ if (itype.is_singleton) {
// Add the type name and the singleton pointer as static fields
output.push_back(MEMBER_BEGIN "private const string " BINDINGS_NATIVE_NAME_FIELD " = \"");
@@ -913,21 +809,13 @@ Error BindingsGenerator::_generate_cs_type(const TypeInterface &itype, const Str
output.push_back("." ICALL_PREFIX);
output.push_back(itype.name);
output.push_back(SINGLETON_ICALL_SUFFIX "();\n");
- } else {
+ } else if (is_derived_type) {
// Add member fields
output.push_back(MEMBER_BEGIN "private const string " BINDINGS_NATIVE_NAME_FIELD " = \"");
output.push_back(itype.name);
output.push_back("\";\n");
- // Only the base class stores the pointer to the native object
- // This pointer is expected to be and must be of type Object*
- if (!is_derived_type) {
- output.push_back(MEMBER_BEGIN "private bool disposed = false;\n");
- output.push_back(INDENT2 "internal IntPtr " BINDINGS_PTR_FIELD ";\n");
- output.push_back(INDENT2 "internal bool " CS_FIELD_MEMORYOWN ";\n");
- }
-
// Add default constructor
if (itype.is_instantiable) {
output.push_back(MEMBER_BEGIN "public ");
@@ -952,67 +840,9 @@ Error BindingsGenerator::_generate_cs_type(const TypeInterface &itype, const Str
// Add.. em.. trick constructor. Sort of.
output.push_back(MEMBER_BEGIN "internal ");
output.push_back(itype.proxy_name);
- if (is_derived_type) {
- output.push_back("(bool " CS_FIELD_MEMORYOWN ") : base(" CS_FIELD_MEMORYOWN ") {}\n");
- } else {
- output.push_back("(bool " CS_FIELD_MEMORYOWN ")\n" OPEN_BLOCK_L2
- "this." CS_FIELD_MEMORYOWN " = " CS_FIELD_MEMORYOWN ";\n" CLOSE_BLOCK_L2);
- }
-
- // Add methods
-
- if (!is_derived_type) {
- output.push_back(MEMBER_BEGIN "public IntPtr NativeInstance\n" OPEN_BLOCK_L2
- "get { return " BINDINGS_PTR_FIELD "; }\n" CLOSE_BLOCK_L2);
-
- output.push_back(MEMBER_BEGIN "internal static IntPtr " CS_SMETHOD_GETINSTANCE "(Object instance)\n" OPEN_BLOCK_L2
- "return instance == null ? IntPtr.Zero : instance." BINDINGS_PTR_FIELD ";\n" CLOSE_BLOCK_L2);
- }
-
- if (!is_derived_type) {
- // Add destructor
- output.push_back(MEMBER_BEGIN "~");
- output.push_back(itype.proxy_name);
- output.push_back("()\n" OPEN_BLOCK_L2 "Dispose(false);\n" CLOSE_BLOCK_L2);
-
- // Add the Dispose from IDisposable
- output.push_back(MEMBER_BEGIN "public void Dispose()\n" OPEN_BLOCK_L2 "Dispose(true);\n" INDENT3 "GC.SuppressFinalize(this);\n" CLOSE_BLOCK_L2);
-
- // Add the virtual Dispose
- output.push_back(MEMBER_BEGIN "protected virtual void Dispose(bool disposing)\n" OPEN_BLOCK_L2
- "if (disposed) return;\n" INDENT3
- "if (" BINDINGS_PTR_FIELD " != IntPtr.Zero)\n" OPEN_BLOCK_L3
- "if (" CS_FIELD_MEMORYOWN ")\n" OPEN_BLOCK_L4 CS_FIELD_MEMORYOWN
- " = false;\n" INDENT5 BINDINGS_CLASS_NATIVECALLS "." ICALL_OBJECT_DTOR
- "(this, " BINDINGS_PTR_FIELD ");\n" CLOSE_BLOCK_L4 CLOSE_BLOCK_L3 INDENT3
- "this." BINDINGS_PTR_FIELD " = IntPtr.Zero;\n" INDENT3
- "GC.SuppressFinalize(this);\n" INDENT3 "disposed = true;\n" CLOSE_BLOCK_L2);
-
- Map<StringName, TypeInterface>::Element *array_itype = builtin_types.find(name_cache.type_Array);
-
- if (!array_itype) {
- ERR_PRINT("BUG: Array type interface not found!");
- return ERR_BUG;
- }
-
- OrderedHashMap<StringName, TypeInterface>::Element object_itype = obj_types.find("Object");
-
- if (!object_itype) {
- ERR_PRINT("BUG: Object type interface not found!");
- return ERR_BUG;
- }
-
- output.push_back(MEMBER_BEGIN "public " CS_CLASS_SIGNALAWAITER " ToSignal(");
- output.push_back(object_itype.get().cs_type);
- output.push_back(" source, string signal)\n" OPEN_BLOCK_L2
- "return new " CS_CLASS_SIGNALAWAITER "(source, signal, this);\n" CLOSE_BLOCK_L2);
- }
+ output.push_back("(bool " CS_FIELD_MEMORYOWN ") : base(" CS_FIELD_MEMORYOWN ") {}\n");
}
- Map<StringName, String>::Element *extra_member = extra_members.find(itype.cname);
- if (extra_member)
- output.push_back(extra_member->get());
-
int method_bind_count = 0;
for (const List<MethodInterface>::Element *E = itype.methods.front(); E; E = E->next()) {
const MethodInterface &imethod = E->get();
@@ -1030,7 +860,7 @@ Error BindingsGenerator::_generate_cs_type(const TypeInterface &itype, const Str
custom_icalls.push_back(singleton_icall);
}
- if (itype.is_instantiable) {
+ if (is_derived_type && itype.is_instantiable) {
InternalCall ctor_icall = InternalCall(itype.api_type, ctor_method, "IntPtr", itype.proxy_name + " obj");
if (!find_icall_by_name(ctor_icall.name, custom_icalls))
@@ -1178,9 +1008,7 @@ Error BindingsGenerator::_generate_cs_method(const BindingsGenerator::TypeInterf
String arguments_sig;
String cs_in_statements;
- String icall_params;
- if (p_itype.is_object_type)
- icall_params += method_bind_field + ", ";
+ String icall_params = method_bind_field + ", ";
icall_params += sformat(p_itype.cs_in, "this");
List<String> default_args_doc;
@@ -1257,9 +1085,9 @@ Error BindingsGenerator::_generate_cs_method(const BindingsGenerator::TypeInterf
// Generate method
{
- if (p_itype.is_object_type && !p_imethod.is_virtual && !p_imethod.requires_object_call) {
+ if (!p_imethod.is_virtual && !p_imethod.requires_object_call) {
p_output.push_back(MEMBER_BEGIN "private static IntPtr ");
- p_output.push_back(method_bind_field + " = " BINDINGS_CLASS_NATIVECALLS "." ICALL_GET_METHODBIND "(" BINDINGS_NATIVE_NAME_FIELD ", \"");
+ p_output.push_back(method_bind_field + " = Object." ICALL_GET_METHODBIND "(" BINDINGS_NATIVE_NAME_FIELD ", \"");
p_output.push_back(p_imethod.name);
p_output.push_back("\");\n");
}
@@ -1372,19 +1200,31 @@ Error BindingsGenerator::generate_glue(const String &p_output_dir) {
List<String> output;
- output.push_back("#include \"" GLUE_HEADER_FILE "\"\n"
- "\n");
+ output.push_back("/* THIS FILE IS GENERATED DO NOT EDIT */\n");
+ output.push_back("#include \"" GLUE_HEADER_FILE "\"\n");
+ output.push_back("\n#ifdef MONO_GLUE_ENABLED\n");
generated_icall_funcs.clear();
for (OrderedHashMap<StringName, TypeInterface>::Element type_elem = obj_types.front(); type_elem; type_elem = type_elem.next()) {
const TypeInterface &itype = type_elem.get();
+ bool is_derived_type = itype.base_name != StringName();
+
+ if (!is_derived_type) {
+ // Some Object assertions
+ CRASH_COND(itype.cname != name_cache.type_Object);
+ CRASH_COND(!itype.is_instantiable);
+ CRASH_COND(itype.api_type != ClassDB::API_CORE);
+ CRASH_COND(itype.is_reference);
+ CRASH_COND(itype.is_singleton);
+ }
+
List<InternalCall> &custom_icalls = itype.api_type == ClassDB::API_EDITOR ? editor_custom_icalls : core_custom_icalls;
OS::get_singleton()->print(String("Generating " + itype.name + "...\n").utf8());
- String ctor_method(ICALL_PREFIX + itype.proxy_name + "_Ctor");
+ String ctor_method(ICALL_PREFIX + itype.proxy_name + "_Ctor"); // Used only for derived types
for (const List<MethodInterface>::Element *E = itype.methods.front(); E; E = E->next()) {
const MethodInterface &imethod = E->get();
@@ -1409,7 +1249,7 @@ Error BindingsGenerator::generate_glue(const String &p_output_dir) {
output.push_back("\");\n" CLOSE_BLOCK "\n");
}
- if (itype.is_instantiable) {
+ if (is_derived_type && itype.is_instantiable) {
InternalCall ctor_icall = InternalCall(itype.api_type, ctor_method, "IntPtr", itype.proxy_name + " obj");
if (!find_icall_by_name(ctor_icall.name, custom_icalls))
@@ -1426,7 +1266,7 @@ Error BindingsGenerator::generate_glue(const String &p_output_dir) {
}
}
- output.push_back("namespace GodotSharpBindings\n" OPEN_BLOCK);
+ output.push_back("namespace GodotSharpBindings\n" OPEN_BLOCK "\n");
output.push_back("uint64_t get_core_api_hash() { return ");
output.push_back(String::num_uint64(GDMono::get_singleton()->get_api_core_hash()) + "; }\n");
@@ -1438,11 +1278,9 @@ Error BindingsGenerator::generate_glue(const String &p_output_dir) {
output.push_back("uint32_t get_bindings_version() { return ");
output.push_back(String::num_uint64(BINDINGS_GENERATOR_VERSION) + "; }\n");
- output.push_back("uint32_t get_cs_glue_version() { return ");
- output.push_back(String::num_uint64(CS_GLUE_VERSION) + "; }\n");
- output.push_back("void register_generated_icalls() " OPEN_BLOCK);
- output.push_back("\tgodot_register_header_icalls();");
+ output.push_back("\nvoid register_generated_icalls() " OPEN_BLOCK);
+ output.push_back("\tgodot_register_glue_header_icalls();\n");
#define ADD_INTERNAL_CALL_REGISTRATION(m_icall) \
{ \
@@ -1505,12 +1343,11 @@ Error BindingsGenerator::generate_glue(const String &p_output_dir) {
output.push_back("#endif\n");
}
- for (const List<InternalCall>::Element *E = builtin_method_icalls.front(); E; E = E->next())
- ADD_INTERNAL_CALL_REGISTRATION(E->get());
-
#undef ADD_INTERNAL_CALL_REGISTRATION
- output.push_back(CLOSE_BLOCK "}\n");
+ output.push_back(CLOSE_BLOCK "\n} // namespace GodotSharpBindings\n");
+
+ output.push_back("\n#endif // MONO_GLUE_ENABLED\n");
Error save_err = _save_file(path_join(p_output_dir, "mono_glue.gen.cpp"), output);
if (save_err != OK)
@@ -1525,10 +1362,6 @@ uint32_t BindingsGenerator::get_version() {
return BINDINGS_GENERATOR_VERSION;
}
-uint32_t BindingsGenerator::get_cs_glue_version() {
- return CS_GLUE_VERSION;
-}
-
Error BindingsGenerator::_save_file(const String &p_path, const List<String> &p_content) {
FileAccessRef file = FileAccess::open(p_path, FileAccess::WRITE);
@@ -1591,9 +1424,6 @@ Error BindingsGenerator::_generate_glue_method(const BindingsGenerator::TypeInte
i++;
}
- if (!p_itype.is_object_type)
- return OK; // no auto-generated icall functions for builtin types
-
const Map<const MethodInterface *, const InternalCall *>::Element *match = method_icalls_map.find(&p_imethod);
ERR_FAIL_NULL_V(match, ERR_BUG);
@@ -1628,7 +1458,7 @@ Error BindingsGenerator::_generate_glue_method(const BindingsGenerator::TypeInte
}
p_output.push_back("\t" + ptrcall_return_type);
- p_output.push_back(" " LOCAL_RET);
+ p_output.push_back(" " C_LOCAL_RET);
p_output.push_back(initialization + ";\n");
p_output.push_back("\tERR_FAIL_NULL_V(" CS_PARAM_INSTANCE);
p_output.push_back(fail_ret);
@@ -1678,7 +1508,7 @@ Error BindingsGenerator::_generate_glue_method(const BindingsGenerator::TypeInte
p_output.push_back("\tVariant::CallError vcall_error;\n\t");
if (!ret_void)
- p_output.push_back(LOCAL_RET " = ");
+ p_output.push_back(C_LOCAL_RET " = ");
p_output.push_back(CS_PARAM_METHODBIND "->call(" CS_PARAM_INSTANCE ", ");
p_output.push_back(p_imethod.arguments.size() ? "(const Variant**)" C_LOCAL_PTRCALL_ARGS ".ptr()" : "NULL");
@@ -1686,14 +1516,14 @@ Error BindingsGenerator::_generate_glue_method(const BindingsGenerator::TypeInte
} else {
p_output.push_back("\t" CS_PARAM_METHODBIND "->ptrcall(" CS_PARAM_INSTANCE ", ");
p_output.push_back(p_imethod.arguments.size() ? C_LOCAL_PTRCALL_ARGS ", " : "NULL, ");
- p_output.push_back(!ret_void ? "&" LOCAL_RET ");\n" : "NULL);\n");
+ p_output.push_back(!ret_void ? "&" C_LOCAL_RET ");\n" : "NULL);\n");
}
if (!ret_void) {
if (return_type->c_out.empty())
- p_output.push_back("\treturn " LOCAL_RET ";\n");
+ p_output.push_back("\treturn " C_LOCAL_RET ";\n");
else
- p_output.push_back(sformat(return_type->c_out, return_type->c_type_out, LOCAL_RET, return_type->name));
+ p_output.push_back(sformat(return_type->c_out, return_type->c_type_out, C_LOCAL_RET, return_type->name));
}
p_output.push_back(CLOSE_BLOCK "\n");
@@ -1752,9 +1582,6 @@ const BindingsGenerator::TypeInterface *BindingsGenerator::_get_type_or_placehol
return &placeholder_types.insert(placeholder.cname, placeholder)->get();
}
-static void _create_constant_interface_from(const StringName &p_constant, const DocData::ClassDoc &p_classdoc) {
-}
-
void BindingsGenerator::_populate_object_type_interfaces() {
obj_types.clear();
@@ -1889,9 +1716,6 @@ void BindingsGenerator::_populate_object_type_interfaces() {
if (virtual_method_list.find(method_info)) {
// A virtual method without the virtual flag. This is a special case.
- // This type of method can only be found in Object derived types.
- ERR_FAIL_COND(!itype.is_object_type);
-
// There is no method bind, so let's fallback to Godot's object.Call(string, params)
imethod.requires_object_call = true;
@@ -2273,13 +2097,6 @@ void BindingsGenerator::_populate_builtin_type_interfaces() {
itype.cs_out = "return new %1(%0);";
itype.im_type_in = "IntPtr";
itype.im_type_out = "IntPtr";
- _populate_builtin_type(itype, Variant::NODE_PATH);
- extra_members.insert(itype.cname, MEMBER_BEGIN "public NodePath() : this(string.Empty) {}\n" MEMBER_BEGIN "public NodePath(string path)\n" OPEN_BLOCK_L2
- "this." BINDINGS_PTR_FIELD " = NativeCalls.godot_icall_NodePath_Ctor(path);\n" CLOSE_BLOCK_L2
- MEMBER_BEGIN "public static implicit operator NodePath(string from)\n" OPEN_BLOCK_L2 "return new NodePath(from);\n" CLOSE_BLOCK_L2
- MEMBER_BEGIN "public static implicit operator string(NodePath from)\n" OPEN_BLOCK_L2
- "return NativeCalls." ICALL_PREFIX "NodePath_operator_String(NodePath." CS_SMETHOD_GETINSTANCE "(from));\n" CLOSE_BLOCK_L2
- MEMBER_BEGIN "public override string ToString()\n" OPEN_BLOCK_L2 "return (string)this;\n" CLOSE_BLOCK_L2);
builtin_types.insert(itype.cname, itype);
// RID
@@ -2296,9 +2113,6 @@ void BindingsGenerator::_populate_builtin_type_interfaces() {
itype.cs_out = "return new %1(%0);";
itype.im_type_in = "IntPtr";
itype.im_type_out = "IntPtr";
- _populate_builtin_type(itype, Variant::_RID);
- extra_members.insert(itype.cname, MEMBER_BEGIN "internal RID()\n" OPEN_BLOCK_L2
- "this." BINDINGS_PTR_FIELD " = IntPtr.Zero;\n" CLOSE_BLOCK_L2);
builtin_types.insert(itype.cname, itype);
// Variant
@@ -2413,60 +2227,6 @@ void BindingsGenerator::_populate_builtin_type_interfaces() {
builtin_types.insert(itype.cname, itype);
}
-void BindingsGenerator::_populate_builtin_type(TypeInterface &r_itype, Variant::Type vtype) {
-
- Variant::CallError cerror;
- Variant v = Variant::construct(vtype, NULL, 0, cerror);
-
- List<MethodInfo> method_list;
- v.get_method_list(&method_list);
- method_list.sort();
-
- for (List<MethodInfo>::Element *E = method_list.front(); E; E = E->next()) {
- MethodInfo &mi = E->get();
- MethodInterface imethod;
-
- imethod.name = mi.name;
- imethod.cname = imethod.name;
- imethod.proxy_name = escape_csharp_keyword(snake_to_pascal_case(mi.name));
-
- for (int i = 0; i < mi.arguments.size(); i++) {
- ArgumentInterface iarg;
- PropertyInfo pi = mi.arguments[i];
-
- iarg.name = pi.name;
-
- if (pi.type == Variant::NIL)
- iarg.type.cname = name_cache.type_Variant;
- else
- iarg.type.cname = Variant::get_type_name(pi.type);
-
- if ((mi.default_arguments.size() - mi.arguments.size() + i) >= 0)
- _default_argument_from_variant(Variant::construct(pi.type, NULL, 0, cerror), iarg);
-
- imethod.add_argument(iarg);
- }
-
- if (mi.return_val.type == Variant::NIL) {
- if (mi.return_val.name != "")
- imethod.return_type.cname = name_cache.type_Variant;
- } else {
- imethod.return_type.cname = Variant::get_type_name(mi.return_val.type);
- }
-
- if (r_itype.class_doc) {
- for (int i = 0; i < r_itype.class_doc->methods.size(); i++) {
- if (r_itype.class_doc->methods[i].name == imethod.name) {
- imethod.method_doc = &r_itype.class_doc->methods[i];
- break;
- }
- }
- }
-
- r_itype.methods.push_back(imethod);
- }
-}
-
void BindingsGenerator::_populate_global_constants() {
int global_constants_count = GlobalConstants::get_global_constant_count();
@@ -2564,15 +2324,13 @@ void BindingsGenerator::initialize() {
_populate_global_constants();
- // Populate internal calls (after populating type interfaces and global constants)
+ // Generate internal calls (after populating type interfaces and global constants)
- _generate_header_icalls();
+ core_custom_icalls.clear();
+ editor_custom_icalls.clear();
for (OrderedHashMap<StringName, TypeInterface>::Element E = obj_types.front(); E; E = E.next())
_generate_method_icalls(E.get());
-
- _generate_method_icalls(builtin_types["NodePath"]);
- _generate_method_icalls(builtin_types["RID"]);
}
void BindingsGenerator::handle_cmdline_args(const List<String> &p_cmdline_args) {
diff --git a/modules/mono/editor/bindings_generator.h b/modules/mono/editor/bindings_generator.h
index 735e7ce7cc..ad89255ba5 100644
--- a/modules/mono/editor/bindings_generator.h
+++ b/modules/mono/editor/bindings_generator.h
@@ -31,13 +31,13 @@
#ifndef BINDINGS_GENERATOR_H
#define BINDINGS_GENERATOR_H
-#include "class_db.h"
+#include "core/class_db.h"
#include "editor/doc/doc_data.h"
#include "editor/editor_help.h"
#ifdef DEBUG_METHODS_ENABLED
-#include "ustring.h"
+#include "core/ustring.h"
class BindingsGenerator {
@@ -456,10 +456,7 @@ class BindingsGenerator {
List<EnumInterface> global_enums;
List<ConstantInterface> global_constants;
- Map<StringName, String> extra_members;
-
List<InternalCall> method_icalls;
- List<InternalCall> builtin_method_icalls;
Map<const MethodInterface *, const InternalCall *> method_icalls_map;
List<const InternalCall *> generated_icall_funcs;
@@ -518,14 +515,12 @@ class BindingsGenerator {
String _determine_enum_prefix(const EnumInterface &p_ienum);
- void _generate_header_icalls();
void _generate_method_icalls(const TypeInterface &p_itype);
const TypeInterface *_get_type_or_null(const TypeReference &p_typeref);
const TypeInterface *_get_type_or_placeholder(const TypeReference &p_typeref);
void _default_argument_from_variant(const Variant &p_val, ArgumentInterface &r_iarg);
- void _populate_builtin_type(TypeInterface &r_itype, Variant::Type vtype);
void _populate_object_type_interfaces();
void _populate_builtin_type_interfaces();
@@ -557,7 +552,6 @@ public:
Error generate_glue(const String &p_output_dir);
static uint32_t get_version();
- static uint32_t get_cs_glue_version();
void initialize();
diff --git a/modules/mono/editor/csharp_project.cpp b/modules/mono/editor/csharp_project.cpp
index bc95607743..4764cbe941 100644
--- a/modules/mono/editor/csharp_project.cpp
+++ b/modules/mono/editor/csharp_project.cpp
@@ -30,8 +30,8 @@
#include "csharp_project.h"
-#include "os/os.h"
-#include "project_settings.h"
+#include "core/os/os.h"
+#include "core/project_settings.h"
#include "../mono_gd/gd_mono_class.h"
#include "../mono_gd/gd_mono_marshal.h"
diff --git a/modules/mono/editor/csharp_project.h b/modules/mono/editor/csharp_project.h
index 381dd17e02..d852139de0 100644
--- a/modules/mono/editor/csharp_project.h
+++ b/modules/mono/editor/csharp_project.h
@@ -31,7 +31,7 @@
#ifndef CSHARP_PROJECT_H
#define CSHARP_PROJECT_H
-#include "ustring.h"
+#include "core/ustring.h"
namespace CSharpProject {
diff --git a/modules/mono/editor/godotsharp_builds.cpp b/modules/mono/editor/godotsharp_builds.cpp
index 2faab1718d..b01f8e66c3 100644
--- a/modules/mono/editor/godotsharp_builds.cpp
+++ b/modules/mono/editor/godotsharp_builds.cpp
@@ -30,8 +30,10 @@
#include "godotsharp_builds.h"
+#include "core/vector.h"
#include "main/main.h"
+#include "../glue/cs_glue_version.gen.h"
#include "../godotsharp_dirs.h"
#include "../mono_gd/gd_mono_class.h"
#include "../mono_gd/gd_mono_marshal.h"
@@ -50,6 +52,16 @@ void godot_icall_BuildInstance_ExitCallback(MonoString *p_solution, MonoString *
GodotSharpBuilds::get_singleton()->build_exit_callback(MonoBuildInfo(solution, config), p_exit_code);
}
+static Vector<const char *> _get_msbuild_hint_dirs() {
+ Vector<const char *> ret;
+#ifdef OSX_ENABLED
+ ret.push_back("/Library/Frameworks/Mono.framework/Versions/Current/bin/");
+ ret.push_back("/usr/local/var/homebrew/linked/mono/bin/");
+#endif
+ ret.push_back("/opt/novell/mono/bin/");
+ return ret;
+}
+
#ifdef UNIX_ENABLED
String _find_build_engine_on_unix(const String &p_name) {
String ret = path_which(p_name);
@@ -61,15 +73,9 @@ String _find_build_engine_on_unix(const String &p_name) {
if (ret_fallback.length())
return ret_fallback;
- const char *locations[] = {
-#ifdef OSX_ENABLED
- "/Library/Frameworks/Mono.framework/Versions/Current/bin/",
- "/usr/local/var/homebrew/linked/mono/bin/",
-#endif
- "/opt/novell/mono/bin/"
- };
+ static Vector<const char *> locations = _get_msbuild_hint_dirs();
- for (int i = 0; i < sizeof(locations) / sizeof(const char *); i++) {
+ for (int i = 0; i < locations.size(); i++) {
String hint_path = locations[i] + p_name;
if (FileAccess::exists(hint_path)) {
@@ -263,7 +269,7 @@ String GodotSharpBuilds::_api_folder_name(APIAssembly::Type p_api_type) {
GDMono::get_singleton()->get_api_editor_hash();
return String::num_uint64(api_hash) +
"_" + String::num_uint64(BindingsGenerator::get_version()) +
- "_" + String::num_uint64(BindingsGenerator::get_cs_glue_version());
+ "_" + String::num_uint64(CS_GLUE_VERSION);
}
bool GodotSharpBuilds::make_api_sln(APIAssembly::Type p_api_type) {
diff --git a/modules/mono/editor/mono_bottom_panel.cpp b/modules/mono/editor/mono_bottom_panel.cpp
index 9317550d28..ecc3e4c59e 100644
--- a/modules/mono/editor/mono_bottom_panel.cpp
+++ b/modules/mono/editor/mono_bottom_panel.cpp
@@ -53,9 +53,9 @@ void MonoBottomPanel::_update_build_tabs_list() {
build_tabs_list->add_item(item_name, tab->get_icon_texture());
- String item_tooltip = String("Solution: ") + tab->build_info.solution;
- item_tooltip += String("\nConfiguration: ") + tab->build_info.configuration;
- item_tooltip += String("\nStatus: ");
+ String item_tooltip = "Solution: " + tab->build_info.solution;
+ item_tooltip += "\nConfiguration: " + tab->build_info.configuration;
+ item_tooltip += "\nStatus: ";
if (tab->build_exited) {
item_tooltip += tab->build_result == MonoBuildTab::RESULT_SUCCESS ? "Succeeded" : "Errored";
diff --git a/modules/mono/editor/monodevelop_instance.h b/modules/mono/editor/monodevelop_instance.h
index 552c10a61d..73cf0f54cc 100644
--- a/modules/mono/editor/monodevelop_instance.h
+++ b/modules/mono/editor/monodevelop_instance.h
@@ -31,7 +31,7 @@
#ifndef MONODEVELOP_INSTANCE_H
#define MONODEVELOP_INSTANCE_H
-#include "reference.h"
+#include "core/reference.h"
#include "../mono_gc_handle.h"
#include "../mono_gd/gd_mono_method.h"
diff --git a/modules/mono/editor/net_solution.cpp b/modules/mono/editor/net_solution.cpp
index dab96e44e9..8bbd376c9a 100644
--- a/modules/mono/editor/net_solution.cpp
+++ b/modules/mono/editor/net_solution.cpp
@@ -30,8 +30,8 @@
#include "net_solution.h"
-#include "os/dir_access.h"
-#include "os/file_access.h"
+#include "core/os/dir_access.h"
+#include "core/os/file_access.h"
#include "../utils/path_utils.h"
#include "../utils/string_utils.h"
diff --git a/modules/mono/editor/net_solution.h b/modules/mono/editor/net_solution.h
index 293e86917a..bdff24af0b 100644
--- a/modules/mono/editor/net_solution.h
+++ b/modules/mono/editor/net_solution.h
@@ -31,8 +31,8 @@
#ifndef NET_SOLUTION_H
#define NET_SOLUTION_H
-#include "map.h"
-#include "ustring.h"
+#include "core/map.h"
+#include "core/ustring.h"
struct NETSolution {
String name;
diff --git a/modules/mono/glue/cs_files/AABB.cs b/modules/mono/glue/Managed/Files/AABB.cs
index 0df2e615f1..66490b5e25 100644
--- a/modules/mono/glue/cs_files/AABB.cs
+++ b/modules/mono/glue/Managed/Files/AABB.cs
@@ -51,24 +51,24 @@ namespace Godot
src_max.z > dst_max.z;
}
- public AABB Expand(Vector3 to_point)
+ public AABB Expand(Vector3 point)
{
Vector3 begin = _position;
Vector3 end = _position + _size;
- if (to_point.x < begin.x)
- begin.x = to_point.x;
- if (to_point.y < begin.y)
- begin.y = to_point.y;
- if (to_point.z < begin.z)
- begin.z = to_point.z;
+ if (point.x < begin.x)
+ begin.x = point.x;
+ if (point.y < begin.y)
+ begin.y = point.y;
+ if (point.z < begin.z)
+ begin.z = point.z;
- if (to_point.x > end.x)
- end.x = to_point.x;
- if (to_point.y > end.y)
- end.y = to_point.y;
- if (to_point.z > end.z)
- end.z = to_point.z;
+ if (point.x > end.x)
+ end.x = point.x;
+ if (point.y > end.y)
+ end.y = point.y;
+ if (point.z > end.z)
+ end.z = point.z;
return new AABB(begin, end - begin);
}
@@ -347,29 +347,29 @@ namespace Godot
for (int i = 0; i < 3; i++)
{
- real_t seg_from = from[i];
- real_t seg_to = to[i];
- real_t box_begin = _position[i];
- real_t box_end = box_begin + _size[i];
+ real_t segFrom = from[i];
+ real_t segTo = to[i];
+ real_t boxBegin = _position[i];
+ real_t boxEnd = boxBegin + _size[i];
real_t cmin, cmax;
- if (seg_from < seg_to)
+ if (segFrom < segTo)
{
- if (seg_from > box_end || seg_to < box_begin)
+ if (segFrom > boxEnd || segTo < boxBegin)
return false;
- real_t length = seg_to - seg_from;
- cmin = seg_from < box_begin ? (box_begin - seg_from) / length : 0f;
- cmax = seg_to > box_end ? (box_end - seg_from) / length : 1f;
+ real_t length = segTo - segFrom;
+ cmin = segFrom < boxBegin ? (boxBegin - segFrom) / length : 0f;
+ cmax = segTo > boxEnd ? (boxEnd - segFrom) / length : 1f;
}
else
{
- if (seg_to > box_end || seg_from < box_begin)
+ if (segTo > boxEnd || segFrom < boxBegin)
return false;
- real_t length = seg_to - seg_from;
- cmin = seg_from > box_end ? (box_end - seg_from) / length : 0f;
- cmax = seg_to < box_begin ? (box_begin - seg_from) / length : 1f;
+ real_t length = segTo - segFrom;
+ cmin = segFrom > boxEnd ? (boxEnd - segFrom) / length : 0f;
+ cmax = segTo < boxBegin ? (boxBegin - segFrom) / length : 1f;
}
if (cmin > min)
@@ -388,21 +388,21 @@ namespace Godot
public AABB Merge(AABB with)
{
- Vector3 beg_1 = _position;
- Vector3 beg_2 = with._position;
- var end_1 = new Vector3(_size.x, _size.y, _size.z) + beg_1;
- var end_2 = new Vector3(with._size.x, with._size.y, with._size.z) + beg_2;
+ Vector3 beg1 = _position;
+ Vector3 beg2 = with._position;
+ var end1 = new Vector3(_size.x, _size.y, _size.z) + beg1;
+ var end2 = new Vector3(with._size.x, with._size.y, with._size.z) + beg2;
var min = new Vector3(
- beg_1.x < beg_2.x ? beg_1.x : beg_2.x,
- beg_1.y < beg_2.y ? beg_1.y : beg_2.y,
- beg_1.z < beg_2.z ? beg_1.z : beg_2.z
+ beg1.x < beg2.x ? beg1.x : beg2.x,
+ beg1.y < beg2.y ? beg1.y : beg2.y,
+ beg1.z < beg2.z ? beg1.z : beg2.z
);
var max = new Vector3(
- end_1.x > end_2.x ? end_1.x : end_2.x,
- end_1.y > end_2.y ? end_1.y : end_2.y,
- end_1.z > end_2.z ? end_1.z : end_2.z
+ end1.x > end2.x ? end1.x : end2.x,
+ end1.y > end2.y ? end1.y : end2.y,
+ end1.z > end2.z ? end1.z : end2.z
);
return new AABB(min, max - min);
diff --git a/modules/mono/glue/cs_files/Array.cs b/modules/mono/glue/Managed/Files/Array.cs
index 2f0185b1e3..c80cb7cc83 100644
--- a/modules/mono/glue/cs_files/Array.cs
+++ b/modules/mono/glue/Managed/Files/Array.cs
@@ -30,45 +30,6 @@ namespace Godot.Collections
public class Array : IList<object>, ICollection<object>, IEnumerable<object>, IDisposable
{
- [MethodImpl(MethodImplOptions.InternalCall)]
- internal extern static IntPtr godot_icall_Array_Ctor();
-
- [MethodImpl(MethodImplOptions.InternalCall)]
- internal extern static void godot_icall_Array_Dtor(IntPtr ptr);
-
- [MethodImpl(MethodImplOptions.InternalCall)]
- internal extern static object godot_icall_Array_At(IntPtr ptr, int index);
-
- [MethodImpl(MethodImplOptions.InternalCall)]
- internal extern static void godot_icall_Array_SetAt(IntPtr ptr, int index, object value);
-
- [MethodImpl(MethodImplOptions.InternalCall)]
- internal extern static int godot_icall_Array_Count(IntPtr ptr);
-
- [MethodImpl(MethodImplOptions.InternalCall)]
- internal extern static void godot_icall_Array_Add(IntPtr ptr, object item);
-
- [MethodImpl(MethodImplOptions.InternalCall)]
- internal extern static void godot_icall_Array_Clear(IntPtr ptr);
-
- [MethodImpl(MethodImplOptions.InternalCall)]
- internal extern static bool godot_icall_Array_Contains(IntPtr ptr, object item);
-
- [MethodImpl(MethodImplOptions.InternalCall)]
- internal extern static void godot_icall_Array_CopyTo(IntPtr ptr, object[] array, int arrayIndex);
-
- [MethodImpl(MethodImplOptions.InternalCall)]
- internal extern static int godot_icall_Array_IndexOf(IntPtr ptr, object item);
-
- [MethodImpl(MethodImplOptions.InternalCall)]
- internal extern static void godot_icall_Array_Insert(IntPtr ptr, int index, object item);
-
- [MethodImpl(MethodImplOptions.InternalCall)]
- internal extern static bool godot_icall_Array_Remove(IntPtr ptr, object item);
-
- [MethodImpl(MethodImplOptions.InternalCall)]
- internal extern static void godot_icall_Array_RemoveAt(IntPtr ptr, int index);
-
ArraySafeHandle safeHandle;
bool disposed = false;
@@ -94,11 +55,6 @@ namespace Godot.Collections
public void Dispose()
{
- Dispose(true);
- }
-
- protected virtual void Dispose(bool disposing)
- {
if (disposed)
return;
@@ -200,6 +156,45 @@ namespace Godot.Collections
{
return GetEnumerator();
}
+
+ [MethodImpl(MethodImplOptions.InternalCall)]
+ internal extern static IntPtr godot_icall_Array_Ctor();
+
+ [MethodImpl(MethodImplOptions.InternalCall)]
+ internal extern static void godot_icall_Array_Dtor(IntPtr ptr);
+
+ [MethodImpl(MethodImplOptions.InternalCall)]
+ internal extern static object godot_icall_Array_At(IntPtr ptr, int index);
+
+ [MethodImpl(MethodImplOptions.InternalCall)]
+ internal extern static void godot_icall_Array_SetAt(IntPtr ptr, int index, object value);
+
+ [MethodImpl(MethodImplOptions.InternalCall)]
+ internal extern static int godot_icall_Array_Count(IntPtr ptr);
+
+ [MethodImpl(MethodImplOptions.InternalCall)]
+ internal extern static void godot_icall_Array_Add(IntPtr ptr, object item);
+
+ [MethodImpl(MethodImplOptions.InternalCall)]
+ internal extern static void godot_icall_Array_Clear(IntPtr ptr);
+
+ [MethodImpl(MethodImplOptions.InternalCall)]
+ internal extern static bool godot_icall_Array_Contains(IntPtr ptr, object item);
+
+ [MethodImpl(MethodImplOptions.InternalCall)]
+ internal extern static void godot_icall_Array_CopyTo(IntPtr ptr, object[] array, int arrayIndex);
+
+ [MethodImpl(MethodImplOptions.InternalCall)]
+ internal extern static int godot_icall_Array_IndexOf(IntPtr ptr, object item);
+
+ [MethodImpl(MethodImplOptions.InternalCall)]
+ internal extern static void godot_icall_Array_Insert(IntPtr ptr, int index, object item);
+
+ [MethodImpl(MethodImplOptions.InternalCall)]
+ internal extern static bool godot_icall_Array_Remove(IntPtr ptr, object item);
+
+ [MethodImpl(MethodImplOptions.InternalCall)]
+ internal extern static void godot_icall_Array_RemoveAt(IntPtr ptr, int index);
}
public class Array<T> : IList<T>, ICollection<T>, IEnumerable<T>
diff --git a/modules/mono/glue/cs_files/Attributes/ExportAttribute.cs b/modules/mono/glue/Managed/Files/Attributes/ExportAttribute.cs
index 6adf044886..6adf044886 100644
--- a/modules/mono/glue/cs_files/Attributes/ExportAttribute.cs
+++ b/modules/mono/glue/Managed/Files/Attributes/ExportAttribute.cs
diff --git a/modules/mono/glue/cs_files/Attributes/GodotMethodAttribute.cs b/modules/mono/glue/Managed/Files/Attributes/GodotMethodAttribute.cs
index 55848769d5..55848769d5 100644
--- a/modules/mono/glue/cs_files/Attributes/GodotMethodAttribute.cs
+++ b/modules/mono/glue/Managed/Files/Attributes/GodotMethodAttribute.cs
diff --git a/modules/mono/glue/cs_files/Attributes/RPCAttributes.cs b/modules/mono/glue/Managed/Files/Attributes/RPCAttributes.cs
index 6bf9560bfa..6bf9560bfa 100644
--- a/modules/mono/glue/cs_files/Attributes/RPCAttributes.cs
+++ b/modules/mono/glue/Managed/Files/Attributes/RPCAttributes.cs
diff --git a/modules/mono/glue/cs_files/Attributes/SignalAttribute.cs b/modules/mono/glue/Managed/Files/Attributes/SignalAttribute.cs
index 3957387be9..3957387be9 100644
--- a/modules/mono/glue/cs_files/Attributes/SignalAttribute.cs
+++ b/modules/mono/glue/Managed/Files/Attributes/SignalAttribute.cs
diff --git a/modules/mono/glue/cs_files/Attributes/ToolAttribute.cs b/modules/mono/glue/Managed/Files/Attributes/ToolAttribute.cs
index d0437409af..d0437409af 100644
--- a/modules/mono/glue/cs_files/Attributes/ToolAttribute.cs
+++ b/modules/mono/glue/Managed/Files/Attributes/ToolAttribute.cs
diff --git a/modules/mono/glue/cs_files/Basis.cs b/modules/mono/glue/Managed/Files/Basis.cs
index 10286f3832..ec96a9e2fa 100644
--- a/modules/mono/glue/cs_files/Basis.cs
+++ b/modules/mono/glue/Managed/Files/Basis.cs
@@ -378,51 +378,51 @@ namespace Godot
);
}
- public Quat Quat() {
- real_t trace = _x[0] + _y[1] + _z[2];
-
- if (trace > 0.0f) {
- real_t s = Mathf.Sqrt(trace + 1.0f) * 2f;
- real_t inv_s = 1f / s;
- return new Quat(
- (_z[1] - _y[2]) * inv_s,
- (_x[2] - _z[0]) * inv_s,
- (_y[0] - _x[1]) * inv_s,
- s * 0.25f
- );
- }
-
- if (_x[0] > _y[1] && _x[0] > _z[2]) {
- real_t s = Mathf.Sqrt(_x[0] - _y[1] - _z[2] + 1.0f) * 2f;
- real_t inv_s = 1f / s;
- return new Quat(
- s * 0.25f,
- (_x[1] + _y[0]) * inv_s,
- (_x[2] + _z[0]) * inv_s,
- (_z[1] - _y[2]) * inv_s
- );
- }
-
- if (_y[1] > _z[2]) {
- real_t s = Mathf.Sqrt(-_x[0] + _y[1] - _z[2] + 1.0f) * 2f;
- real_t inv_s = 1f / s;
- return new Quat(
- (_x[1] + _y[0]) * inv_s,
- s * 0.25f,
- (_y[2] + _z[1]) * inv_s,
- (_x[2] - _z[0]) * inv_s
- );
- } else {
- real_t s = Mathf.Sqrt(-_x[0] - _y[1] + _z[2] + 1.0f) * 2f;
- real_t inv_s = 1f / s;
- return new Quat(
- (_x[2] + _z[0]) * inv_s,
- (_y[2] + _z[1]) * inv_s,
- s * 0.25f,
- (_y[0] - _x[1]) * inv_s
- );
- }
- }
+ public Quat Quat() {
+ real_t trace = _x[0] + _y[1] + _z[2];
+
+ if (trace > 0.0f) {
+ real_t s = Mathf.Sqrt(trace + 1.0f) * 2f;
+ real_t inv_s = 1f / s;
+ return new Quat(
+ (_z[1] - _y[2]) * inv_s,
+ (_x[2] - _z[0]) * inv_s,
+ (_y[0] - _x[1]) * inv_s,
+ s * 0.25f
+ );
+ }
+
+ if (_x[0] > _y[1] && _x[0] > _z[2]) {
+ real_t s = Mathf.Sqrt(_x[0] - _y[1] - _z[2] + 1.0f) * 2f;
+ real_t inv_s = 1f / s;
+ return new Quat(
+ s * 0.25f,
+ (_x[1] + _y[0]) * inv_s,
+ (_x[2] + _z[0]) * inv_s,
+ (_z[1] - _y[2]) * inv_s
+ );
+ }
+
+ if (_y[1] > _z[2]) {
+ real_t s = Mathf.Sqrt(-_x[0] + _y[1] - _z[2] + 1.0f) * 2f;
+ real_t inv_s = 1f / s;
+ return new Quat(
+ (_x[1] + _y[0]) * inv_s,
+ s * 0.25f,
+ (_y[2] + _z[1]) * inv_s,
+ (_x[2] - _z[0]) * inv_s
+ );
+ } else {
+ real_t s = Mathf.Sqrt(-_x[0] - _y[1] + _z[2] + 1.0f) * 2f;
+ real_t inv_s = 1f / s;
+ return new Quat(
+ (_x[2] + _z[0]) * inv_s,
+ (_y[2] + _z[1]) * inv_s,
+ s * 0.25f,
+ (_y[0] - _x[1]) * inv_s
+ );
+ }
+ }
public Basis(Quat quat)
{
diff --git a/modules/mono/glue/cs_files/Color.cs b/modules/mono/glue/Managed/Files/Color.cs
index 49e04b333a..88cb8524b8 100644
--- a/modules/mono/glue/cs_files/Color.cs
+++ b/modules/mono/glue/Managed/Files/Color.cs
@@ -370,12 +370,12 @@ namespace Godot
{
var txt = string.Empty;
- txt += _to_hex(r);
- txt += _to_hex(g);
- txt += _to_hex(b);
+ txt += ToHex32(r);
+ txt += ToHex32(g);
+ txt += ToHex32(b);
if (include_alpha)
- txt = _to_hex(a) + txt;
+ txt = ToHex32(a) + txt;
return txt;
}
@@ -411,7 +411,7 @@ namespace Godot
r = (rgba & 0xFFFF) / 65535.0f;
}
- private static int _parse_col(string str, int ofs)
+ private static int ParseCol8(string str, int ofs)
{
int ig = 0;
@@ -448,7 +448,7 @@ namespace Godot
return ig;
}
- private String _to_hex(float val)
+ private String ToHex32(float val)
{
int v = Mathf.RoundToInt(Mathf.Clamp(val * 255, 0, 255));
@@ -490,17 +490,17 @@ namespace Godot
if (alpha)
{
- if (_parse_col(color, 0) < 0)
+ if (ParseCol8(color, 0) < 0)
return false;
}
int from = alpha ? 2 : 0;
- if (_parse_col(color, from + 0) < 0)
+ if (ParseCol8(color, from + 0) < 0)
return false;
- if (_parse_col(color, from + 2) < 0)
+ if (ParseCol8(color, from + 2) < 0)
return false;
- if (_parse_col(color, from + 4) < 0)
+ if (ParseCol8(color, from + 4) < 0)
return false;
return true;
@@ -542,7 +542,7 @@ namespace Godot
if (alpha)
{
- a = _parse_col(rgba, 0) / 255f;
+ a = ParseCol8(rgba, 0) / 255f;
if (a < 0)
throw new ArgumentOutOfRangeException("Invalid color code. Alpha part is not valid hexadecimal: " + rgba);
@@ -554,17 +554,17 @@ namespace Godot
int from = alpha ? 2 : 0;
- r = _parse_col(rgba, from + 0) / 255f;
+ r = ParseCol8(rgba, from + 0) / 255f;
if (r < 0)
throw new ArgumentOutOfRangeException("Invalid color code. Red part is not valid hexadecimal: " + rgba);
- g = _parse_col(rgba, from + 2) / 255f;
+ g = ParseCol8(rgba, from + 2) / 255f;
if (g < 0)
throw new ArgumentOutOfRangeException("Invalid color code. Green part is not valid hexadecimal: " + rgba);
- b = _parse_col(rgba, from + 4) / 255f;
+ b = ParseCol8(rgba, from + 4) / 255f;
if (b < 0)
throw new ArgumentOutOfRangeException("Invalid color code. Blue part is not valid hexadecimal: " + rgba);
diff --git a/modules/mono/glue/cs_files/DebuggingUtils.cs b/modules/mono/glue/Managed/Files/DebuggingUtils.cs
index b27816084e..b27816084e 100644
--- a/modules/mono/glue/cs_files/DebuggingUtils.cs
+++ b/modules/mono/glue/Managed/Files/DebuggingUtils.cs
diff --git a/modules/mono/glue/cs_files/Dictionary.cs b/modules/mono/glue/Managed/Files/Dictionary.cs
index 64cb9f935d..523e48c31a 100644
--- a/modules/mono/glue/cs_files/Dictionary.cs
+++ b/modules/mono/glue/Managed/Files/Dictionary.cs
@@ -34,48 +34,6 @@ namespace Godot.Collections
IEnumerable<KeyValuePair<object, object>>,
IDisposable
{
- [MethodImpl(MethodImplOptions.InternalCall)]
- internal extern static IntPtr godot_icall_Dictionary_Ctor();
-
- [MethodImpl(MethodImplOptions.InternalCall)]
- internal extern static void godot_icall_Dictionary_Dtor(IntPtr ptr);
-
- [MethodImpl(MethodImplOptions.InternalCall)]
- internal extern static object godot_icall_Dictionary_GetValue(IntPtr ptr, object key);
-
- [MethodImpl(MethodImplOptions.InternalCall)]
- internal extern static void godot_icall_Dictionary_SetValue(IntPtr ptr, object key, object value);
-
- [MethodImpl(MethodImplOptions.InternalCall)]
- internal extern static IntPtr godot_icall_Dictionary_Keys(IntPtr ptr);
-
- [MethodImpl(MethodImplOptions.InternalCall)]
- internal extern static IntPtr godot_icall_Dictionary_Values(IntPtr ptr);
-
- [MethodImpl(MethodImplOptions.InternalCall)]
- internal extern static int godot_icall_Dictionary_Count(IntPtr ptr);
-
- [MethodImpl(MethodImplOptions.InternalCall)]
- internal extern static void godot_icall_Dictionary_Add(IntPtr ptr, object key, object value);
-
- [MethodImpl(MethodImplOptions.InternalCall)]
- internal extern static void godot_icall_Dictionary_Clear(IntPtr ptr);
-
- [MethodImpl(MethodImplOptions.InternalCall)]
- internal extern static bool godot_icall_Dictionary_Contains(IntPtr ptr, object key, object value);
-
- [MethodImpl(MethodImplOptions.InternalCall)]
- internal extern static bool godot_icall_Dictionary_ContainsKey(IntPtr ptr, object key);
-
- [MethodImpl(MethodImplOptions.InternalCall)]
- internal extern static bool godot_icall_Dictionary_RemoveKey(IntPtr ptr, object key);
-
- [MethodImpl(MethodImplOptions.InternalCall)]
- internal extern static bool godot_icall_Dictionary_Remove(IntPtr ptr, object key, object value);
-
- [MethodImpl(MethodImplOptions.InternalCall)]
- internal extern static bool godot_icall_Dictionary_TryGetValue(IntPtr ptr, object key, out object value);
-
DictionarySafeHandle safeHandle;
bool disposed = false;
@@ -101,11 +59,6 @@ namespace Godot.Collections
public void Dispose()
{
- Dispose(true);
- }
-
- protected virtual void Dispose(bool disposing)
- {
if (disposed)
return;
@@ -240,8 +193,49 @@ namespace Godot.Collections
{
return GetEnumerator();
}
- }
+ [MethodImpl(MethodImplOptions.InternalCall)]
+ internal extern static IntPtr godot_icall_Dictionary_Ctor();
+
+ [MethodImpl(MethodImplOptions.InternalCall)]
+ internal extern static void godot_icall_Dictionary_Dtor(IntPtr ptr);
+
+ [MethodImpl(MethodImplOptions.InternalCall)]
+ internal extern static object godot_icall_Dictionary_GetValue(IntPtr ptr, object key);
+
+ [MethodImpl(MethodImplOptions.InternalCall)]
+ internal extern static void godot_icall_Dictionary_SetValue(IntPtr ptr, object key, object value);
+
+ [MethodImpl(MethodImplOptions.InternalCall)]
+ internal extern static IntPtr godot_icall_Dictionary_Keys(IntPtr ptr);
+
+ [MethodImpl(MethodImplOptions.InternalCall)]
+ internal extern static IntPtr godot_icall_Dictionary_Values(IntPtr ptr);
+
+ [MethodImpl(MethodImplOptions.InternalCall)]
+ internal extern static int godot_icall_Dictionary_Count(IntPtr ptr);
+
+ [MethodImpl(MethodImplOptions.InternalCall)]
+ internal extern static void godot_icall_Dictionary_Add(IntPtr ptr, object key, object value);
+
+ [MethodImpl(MethodImplOptions.InternalCall)]
+ internal extern static void godot_icall_Dictionary_Clear(IntPtr ptr);
+
+ [MethodImpl(MethodImplOptions.InternalCall)]
+ internal extern static bool godot_icall_Dictionary_Contains(IntPtr ptr, object key, object value);
+
+ [MethodImpl(MethodImplOptions.InternalCall)]
+ internal extern static bool godot_icall_Dictionary_ContainsKey(IntPtr ptr, object key);
+
+ [MethodImpl(MethodImplOptions.InternalCall)]
+ internal extern static bool godot_icall_Dictionary_RemoveKey(IntPtr ptr, object key);
+
+ [MethodImpl(MethodImplOptions.InternalCall)]
+ internal extern static bool godot_icall_Dictionary_Remove(IntPtr ptr, object key, object value);
+
+ [MethodImpl(MethodImplOptions.InternalCall)]
+ internal extern static bool godot_icall_Dictionary_TryGetValue(IntPtr ptr, object key, out object value);
+ }
public class Dictionary<TKey, TValue> :
IDictionary<TKey, TValue>,
diff --git a/modules/mono/glue/cs_files/Extensions/NodeExtensions.cs b/modules/mono/glue/Managed/Files/Extensions/NodeExtensions.cs
index 71534d7782..71534d7782 100644
--- a/modules/mono/glue/cs_files/Extensions/NodeExtensions.cs
+++ b/modules/mono/glue/Managed/Files/Extensions/NodeExtensions.cs
diff --git a/modules/mono/glue/cs_files/Extensions/ObjectExtensions.cs b/modules/mono/glue/Managed/Files/Extensions/ObjectExtensions.cs
index 5c9e6609f4..9ef0959750 100644
--- a/modules/mono/glue/cs_files/Extensions/ObjectExtensions.cs
+++ b/modules/mono/glue/Managed/Files/Extensions/ObjectExtensions.cs
@@ -1,4 +1,5 @@
using System;
+using System.Runtime.CompilerServices;
namespace Godot
{
@@ -11,7 +12,10 @@ namespace Godot
public static WeakRef WeakRef(Object obj)
{
- return NativeCalls.godot_icall_Godot_weakref(Object.GetPtr(obj));
+ return godot_icall_Object_weakref(Object.GetPtr(obj));
}
+
+ [MethodImpl(MethodImplOptions.InternalCall)]
+ internal extern static WeakRef godot_icall_Object_weakref(IntPtr obj);
}
}
diff --git a/modules/mono/glue/cs_files/Extensions/ResourceLoaderExtensions.cs b/modules/mono/glue/Managed/Files/Extensions/ResourceLoaderExtensions.cs
index ceecc589e6..ceecc589e6 100644
--- a/modules/mono/glue/cs_files/Extensions/ResourceLoaderExtensions.cs
+++ b/modules/mono/glue/Managed/Files/Extensions/ResourceLoaderExtensions.cs
diff --git a/modules/mono/glue/cs_files/GD.cs b/modules/mono/glue/Managed/Files/GD.cs
index 0a5d703f27..264be23588 100644
--- a/modules/mono/glue/cs_files/GD.cs
+++ b/modules/mono/glue/Managed/Files/GD.cs
@@ -1,11 +1,12 @@
using System;
+using System.Runtime.CompilerServices;
#if REAL_T_IS_DOUBLE
using real_t = System.Double;
#else
using real_t = System.Single;
#endif
-// TODO: Add comments describing what this class does. It is not obvious.
+// TODO: Add comments describing what this class does. It is not obvious.
namespace Godot
{
@@ -13,12 +14,12 @@ namespace Godot
{
public static object Bytes2Var(byte[] bytes)
{
- return NativeCalls.godot_icall_Godot_bytes2var(bytes);
+ return godot_icall_GD_bytes2var(bytes);
}
public static object Convert(object what, int type)
{
- return NativeCalls.godot_icall_Godot_convert(what, type);
+ return godot_icall_GD_convert(what, type);
}
public static real_t Db2Linear(real_t db)
@@ -46,12 +47,12 @@ namespace Godot
public static int Hash(object var)
{
- return NativeCalls.godot_icall_Godot_hash(var);
+ return godot_icall_GD_hash(var);
}
public static Object InstanceFromId(int instanceId)
{
- return NativeCalls.godot_icall_Godot_instance_from_id(instanceId);
+ return godot_icall_GD_instance_from_id(instanceId);
}
public static real_t Linear2Db(real_t linear)
@@ -71,7 +72,7 @@ namespace Godot
public static void Print(params object[] what)
{
- NativeCalls.godot_icall_Godot_print(what);
+ godot_icall_GD_print(what);
}
public static void PrintStack()
@@ -81,22 +82,22 @@ namespace Godot
public static void PrintErr(params object[] what)
{
- NativeCalls.godot_icall_Godot_printerr(what);
+ godot_icall_GD_printerr(what);
}
public static void PrintRaw(params object[] what)
{
- NativeCalls.godot_icall_Godot_printraw(what);
+ godot_icall_GD_printraw(what);
}
public static void PrintS(params object[] what)
{
- NativeCalls.godot_icall_Godot_prints(what);
+ godot_icall_GD_prints(what);
}
public static void PrintT(params object[] what)
{
- NativeCalls.godot_icall_Godot_printt(what);
+ godot_icall_GD_printt(what);
}
public static int[] Range(int length)
@@ -165,32 +166,77 @@ namespace Godot
public static void Seed(int seed)
{
- NativeCalls.godot_icall_Godot_seed(seed);
+ godot_icall_GD_seed(seed);
}
public static string Str(params object[] what)
{
- return NativeCalls.godot_icall_Godot_str(what);
+ return godot_icall_GD_str(what);
}
public static object Str2Var(string str)
{
- return NativeCalls.godot_icall_Godot_str2var(str);
+ return godot_icall_GD_str2var(str);
}
public static bool TypeExists(string type)
{
- return NativeCalls.godot_icall_Godot_type_exists(type);
+ return godot_icall_GD_type_exists(type);
}
public static byte[] Var2Bytes(object var)
{
- return NativeCalls.godot_icall_Godot_var2bytes(var);
+ return godot_icall_GD_var2bytes(var);
}
public static string Var2Str(object var)
{
- return NativeCalls.godot_icall_Godot_var2str(var);
+ return godot_icall_GD_var2str(var);
}
+
+ [MethodImpl(MethodImplOptions.InternalCall)]
+ internal extern static object godot_icall_GD_bytes2var(byte[] bytes);
+
+ [MethodImpl(MethodImplOptions.InternalCall)]
+ internal extern static object godot_icall_GD_convert(object what, int type);
+
+ [MethodImpl(MethodImplOptions.InternalCall)]
+ internal extern static int godot_icall_GD_hash(object var);
+
+ [MethodImpl(MethodImplOptions.InternalCall)]
+ internal extern static Object godot_icall_GD_instance_from_id(int instance_id);
+
+ [MethodImpl(MethodImplOptions.InternalCall)]
+ internal extern static void godot_icall_GD_print(object[] what);
+
+ [MethodImpl(MethodImplOptions.InternalCall)]
+ internal extern static void godot_icall_GD_printerr(object[] what);
+
+ [MethodImpl(MethodImplOptions.InternalCall)]
+ internal extern static void godot_icall_GD_printraw(object[] what);
+
+ [MethodImpl(MethodImplOptions.InternalCall)]
+ internal extern static void godot_icall_GD_prints(object[] what);
+
+ [MethodImpl(MethodImplOptions.InternalCall)]
+ internal extern static void godot_icall_GD_printt(object[] what);
+
+ [MethodImpl(MethodImplOptions.InternalCall)]
+ internal extern static void godot_icall_GD_seed(int seed);
+
+ [MethodImpl(MethodImplOptions.InternalCall)]
+ internal extern static string godot_icall_GD_str(object[] what);
+
+ [MethodImpl(MethodImplOptions.InternalCall)]
+ internal extern static object godot_icall_GD_str2var(string str);
+
+ [MethodImpl(MethodImplOptions.InternalCall)]
+ internal extern static bool godot_icall_GD_type_exists(string type);
+
+ [MethodImpl(MethodImplOptions.InternalCall)]
+ internal extern static byte[] godot_icall_GD_var2bytes(object what);
+
+ [MethodImpl(MethodImplOptions.InternalCall)]
+ internal extern static string godot_icall_GD_var2str(object var);
}
}
diff --git a/modules/mono/glue/Managed/Files/GodotSynchronizationContext.cs b/modules/mono/glue/Managed/Files/GodotSynchronizationContext.cs
new file mode 100644
index 0000000000..e727781d63
--- /dev/null
+++ b/modules/mono/glue/Managed/Files/GodotSynchronizationContext.cs
@@ -0,0 +1,25 @@
+using System.Collections.Concurrent;
+using System.Collections.Generic;
+using System.Threading;
+
+namespace Godot
+{
+ public class GodotSynchronizationContext : SynchronizationContext
+ {
+ private readonly BlockingCollection<KeyValuePair<SendOrPostCallback, object>> queue = new BlockingCollection<KeyValuePair<SendOrPostCallback, object>>();
+
+ public override void Post(SendOrPostCallback d, object state)
+ {
+ queue.Add(new KeyValuePair<SendOrPostCallback, object>(d, state));
+ }
+
+ public void ExecutePendingContinuations()
+ {
+ KeyValuePair<SendOrPostCallback, object> workItem;
+ while (queue.TryTake(out workItem))
+ {
+ workItem.Key(workItem.Value);
+ }
+ }
+ }
+}
diff --git a/modules/mono/glue/Managed/Files/GodotTaskScheduler.cs b/modules/mono/glue/Managed/Files/GodotTaskScheduler.cs
new file mode 100644
index 0000000000..9a40fef5a9
--- /dev/null
+++ b/modules/mono/glue/Managed/Files/GodotTaskScheduler.cs
@@ -0,0 +1,94 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Threading;
+using System.Threading.Tasks;
+
+namespace Godot
+{
+ public class GodotTaskScheduler : TaskScheduler
+ {
+ private GodotSynchronizationContext Context { get; set; }
+ private readonly LinkedList<Task> _tasks = new LinkedList<Task>();
+
+ public GodotTaskScheduler()
+ {
+ Context = new GodotSynchronizationContext();
+ SynchronizationContext.SetSynchronizationContext(Context);
+ }
+
+ protected sealed override void QueueTask(Task task)
+ {
+ lock (_tasks)
+ {
+ _tasks.AddLast(task);
+ }
+ }
+
+ protected sealed override bool TryExecuteTaskInline(Task task, bool taskWasPreviouslyQueued)
+ {
+ if (SynchronizationContext.Current != Context)
+ {
+ return false;
+ }
+
+ if (taskWasPreviouslyQueued)
+ {
+ TryDequeue(task);
+ }
+
+ return TryExecuteTask(task);
+ }
+
+ protected sealed override bool TryDequeue(Task task)
+ {
+ lock (_tasks)
+ {
+ return _tasks.Remove(task);
+ }
+ }
+
+ protected sealed override IEnumerable<Task> GetScheduledTasks()
+ {
+ lock (_tasks)
+ {
+ return _tasks.ToArray();
+ }
+ }
+
+ public void Activate()
+ {
+ ExecuteQueuedTasks();
+ Context.ExecutePendingContinuations();
+ }
+
+ private void ExecuteQueuedTasks()
+ {
+ while (true)
+ {
+ Task task;
+
+ lock (_tasks)
+ {
+ if (_tasks.Any())
+ {
+ task = _tasks.First.Value;
+ _tasks.RemoveFirst();
+ }
+ else
+ {
+ break;
+ }
+ }
+
+ if (task != null)
+ {
+ if (!TryExecuteTask(task))
+ {
+ throw new InvalidOperationException();
+ }
+ }
+ }
+ }
+ }
+}
diff --git a/modules/mono/glue/cs_files/Interfaces/IAwaitable.cs b/modules/mono/glue/Managed/Files/Interfaces/IAwaitable.cs
index 0397957d00..0397957d00 100644
--- a/modules/mono/glue/cs_files/Interfaces/IAwaitable.cs
+++ b/modules/mono/glue/Managed/Files/Interfaces/IAwaitable.cs
diff --git a/modules/mono/glue/cs_files/Interfaces/IAwaiter.cs b/modules/mono/glue/Managed/Files/Interfaces/IAwaiter.cs
index d3be9d781c..d3be9d781c 100644
--- a/modules/mono/glue/cs_files/Interfaces/IAwaiter.cs
+++ b/modules/mono/glue/Managed/Files/Interfaces/IAwaiter.cs
diff --git a/modules/mono/glue/cs_files/MarshalUtils.cs b/modules/mono/glue/Managed/Files/MarshalUtils.cs
index f7699a15bf..f7699a15bf 100644
--- a/modules/mono/glue/cs_files/MarshalUtils.cs
+++ b/modules/mono/glue/Managed/Files/MarshalUtils.cs
diff --git a/modules/mono/glue/cs_files/Mathf.cs b/modules/mono/glue/Managed/Files/Mathf.cs
index a89dfe5f27..a89dfe5f27 100644
--- a/modules/mono/glue/cs_files/Mathf.cs
+++ b/modules/mono/glue/Managed/Files/Mathf.cs
diff --git a/modules/mono/glue/cs_files/MathfEx.cs b/modules/mono/glue/Managed/Files/MathfEx.cs
index 739b7fb568..739b7fb568 100644
--- a/modules/mono/glue/cs_files/MathfEx.cs
+++ b/modules/mono/glue/Managed/Files/MathfEx.cs
diff --git a/modules/mono/glue/Managed/Files/NodePath.cs b/modules/mono/glue/Managed/Files/NodePath.cs
new file mode 100644
index 0000000000..2c89bec87f
--- /dev/null
+++ b/modules/mono/glue/Managed/Files/NodePath.cs
@@ -0,0 +1,147 @@
+using System;
+using System.Runtime.CompilerServices;
+
+namespace Godot
+{
+ public partial class NodePath : IDisposable
+ {
+ private bool disposed = false;
+
+ internal IntPtr ptr;
+
+ internal static IntPtr GetPtr(NodePath instance)
+ {
+ return instance == null ? IntPtr.Zero : instance.ptr;
+ }
+
+ ~NodePath()
+ {
+ Dispose(false);
+ }
+
+ public void Dispose()
+ {
+ Dispose(true);
+ GC.SuppressFinalize(this);
+ }
+
+ protected virtual void Dispose(bool disposing)
+ {
+ if (disposed)
+ return;
+
+ if (ptr != IntPtr.Zero)
+ {
+ godot_icall_NodePath_Dtor(ptr);
+ ptr = IntPtr.Zero;
+ }
+
+ disposed = true;
+ }
+
+ internal NodePath(IntPtr ptr)
+ {
+ this.ptr = ptr;
+ }
+
+ public IntPtr NativeInstance
+ {
+ get { return ptr; }
+ }
+
+ public NodePath() : this(string.Empty) {}
+
+ public NodePath(string path)
+ {
+ this.ptr = godot_icall_NodePath_Ctor(path);
+ }
+
+ public static implicit operator NodePath(string from)
+ {
+ return new NodePath(from);
+ }
+
+ public static implicit operator string(NodePath from)
+ {
+ return godot_icall_NodePath_operator_String(NodePath.GetPtr(from));
+ }
+
+ public override string ToString()
+ {
+ return (string)this;
+ }
+
+ public NodePath GetAsPropertyPath()
+ {
+ return new NodePath(godot_icall_NodePath_get_as_property_path(NodePath.GetPtr(this)));
+ }
+
+ public string GetConcatenatedSubnames()
+ {
+ return godot_icall_NodePath_get_concatenated_subnames(NodePath.GetPtr(this));
+ }
+
+ public string GetName(int idx)
+ {
+ return godot_icall_NodePath_get_name(NodePath.GetPtr(this), idx);
+ }
+
+ public int GetNameCount()
+ {
+ return godot_icall_NodePath_get_name_count(NodePath.GetPtr(this));
+ }
+
+ public string GetSubname(int idx)
+ {
+ return godot_icall_NodePath_get_subname(NodePath.GetPtr(this), idx);
+ }
+
+ public int GetSubnameCount()
+ {
+ return godot_icall_NodePath_get_subname_count(NodePath.GetPtr(this));
+ }
+
+ public bool IsAbsolute()
+ {
+ return godot_icall_NodePath_is_absolute(NodePath.GetPtr(this));
+ }
+
+ public bool IsEmpty()
+ {
+ return godot_icall_NodePath_is_empty(NodePath.GetPtr(this));
+ }
+
+ [MethodImpl(MethodImplOptions.InternalCall)]
+ internal extern static IntPtr godot_icall_NodePath_Ctor(string path);
+
+ [MethodImpl(MethodImplOptions.InternalCall)]
+ internal extern static void godot_icall_NodePath_Dtor(IntPtr ptr);
+
+ [MethodImpl(MethodImplOptions.InternalCall)]
+ internal extern static string godot_icall_NodePath_operator_String(IntPtr ptr);
+
+ [MethodImpl(MethodImplOptions.InternalCall)]
+ internal extern static IntPtr godot_icall_NodePath_get_as_property_path(IntPtr ptr);
+
+ [MethodImpl(MethodImplOptions.InternalCall)]
+ internal extern static string godot_icall_NodePath_get_concatenated_subnames(IntPtr ptr);
+
+ [MethodImpl(MethodImplOptions.InternalCall)]
+ internal extern static string godot_icall_NodePath_get_name(IntPtr ptr, int arg1);
+
+ [MethodImpl(MethodImplOptions.InternalCall)]
+ internal extern static int godot_icall_NodePath_get_name_count(IntPtr ptr);
+
+ [MethodImpl(MethodImplOptions.InternalCall)]
+ internal extern static string godot_icall_NodePath_get_subname(IntPtr ptr, int arg1);
+
+ [MethodImpl(MethodImplOptions.InternalCall)]
+ internal extern static int godot_icall_NodePath_get_subname_count(IntPtr ptr);
+
+ [MethodImpl(MethodImplOptions.InternalCall)]
+ internal extern static bool godot_icall_NodePath_is_absolute(IntPtr ptr);
+
+ [MethodImpl(MethodImplOptions.InternalCall)]
+ internal extern static bool godot_icall_NodePath_is_empty(IntPtr ptr);
+ }
+}
diff --git a/modules/mono/glue/Managed/Files/Object.base.cs b/modules/mono/glue/Managed/Files/Object.base.cs
new file mode 100644
index 0000000000..30490a715f
--- /dev/null
+++ b/modules/mono/glue/Managed/Files/Object.base.cs
@@ -0,0 +1,88 @@
+using System;
+using System.Runtime.CompilerServices;
+
+namespace Godot
+{
+ public partial class Object : IDisposable
+ {
+ private bool disposed = false;
+
+ private const string nativeName = "Object";
+
+ internal IntPtr ptr;
+ internal bool memoryOwn;
+
+ public Object() : this(false)
+ {
+ if (ptr == IntPtr.Zero)
+ ptr = godot_icall_Object_Ctor(this);
+ }
+
+ internal Object(bool memoryOwn)
+ {
+ this.memoryOwn = memoryOwn;
+ }
+
+ public IntPtr NativeInstance
+ {
+ get { return ptr; }
+ }
+
+ internal static IntPtr GetPtr(Object instance)
+ {
+ return instance == null ? IntPtr.Zero : instance.ptr;
+ }
+
+ ~Object()
+ {
+ Dispose(false);
+ }
+
+ public void Dispose()
+ {
+ Dispose(true);
+ GC.SuppressFinalize(this);
+ }
+
+ protected virtual void Dispose(bool disposing)
+ {
+ if (disposed)
+ return;
+
+ if (ptr != IntPtr.Zero)
+ {
+ if (memoryOwn)
+ {
+ memoryOwn = false;
+ godot_icall_Reference_Disposed(this, ptr, !disposing);
+ }
+ else
+ {
+ godot_icall_Object_Disposed(this, ptr);
+ }
+
+ this.ptr = IntPtr.Zero;
+ }
+
+ disposed = true;
+ }
+
+ public SignalAwaiter ToSignal(Object source, string signal)
+ {
+ return new SignalAwaiter(source, signal, this);
+ }
+
+ [MethodImpl(MethodImplOptions.InternalCall)]
+ internal extern static IntPtr godot_icall_Object_Ctor(Object obj);
+
+ [MethodImpl(MethodImplOptions.InternalCall)]
+ internal extern static void godot_icall_Object_Disposed(Object obj, IntPtr ptr);
+
+ [MethodImpl(MethodImplOptions.InternalCall)]
+ internal extern static void godot_icall_Reference_Disposed(Object obj, IntPtr ptr, bool isFinalizer);
+
+ // Used by the generated API
+ [MethodImpl(MethodImplOptions.InternalCall)]
+ internal extern static IntPtr godot_icall_Object_ClassDB_get_method(string type, string method);
+ }
+}
diff --git a/modules/mono/glue/cs_files/Plane.cs b/modules/mono/glue/Managed/Files/Plane.cs
index 9611dce11e..9611dce11e 100644
--- a/modules/mono/glue/cs_files/Plane.cs
+++ b/modules/mono/glue/Managed/Files/Plane.cs
diff --git a/modules/mono/glue/cs_files/Quat.cs b/modules/mono/glue/Managed/Files/Quat.cs
index eaa027eb69..eaa027eb69 100644
--- a/modules/mono/glue/cs_files/Quat.cs
+++ b/modules/mono/glue/Managed/Files/Quat.cs
diff --git a/modules/mono/glue/Managed/Files/RID.cs b/modules/mono/glue/Managed/Files/RID.cs
new file mode 100644
index 0000000000..b862b8cac0
--- /dev/null
+++ b/modules/mono/glue/Managed/Files/RID.cs
@@ -0,0 +1,76 @@
+using System;
+using System.Runtime.CompilerServices;
+
+namespace Godot
+{
+ public partial class RID : IDisposable
+ {
+ private bool disposed = false;
+
+ internal IntPtr ptr;
+
+ internal static IntPtr GetPtr(RID instance)
+ {
+ return instance == null ? IntPtr.Zero : instance.ptr;
+ }
+
+ ~RID()
+ {
+ Dispose(false);
+ }
+
+ public void Dispose()
+ {
+ Dispose(true);
+ GC.SuppressFinalize(this);
+ }
+
+ protected virtual void Dispose(bool disposing)
+ {
+ if (disposed)
+ return;
+
+ if (ptr != IntPtr.Zero)
+ {
+ godot_icall_RID_Dtor(ptr);
+ ptr = IntPtr.Zero;
+ }
+
+ disposed = true;
+ }
+
+ internal RID(IntPtr ptr)
+ {
+ this.ptr = ptr;
+ }
+
+ public IntPtr NativeInstance
+ {
+ get { return ptr; }
+ }
+
+ internal RID()
+ {
+ this.ptr = IntPtr.Zero;
+ }
+
+ public RID(Object from)
+ {
+ this.ptr = godot_icall_RID_Ctor(Object.GetPtr(from));
+ }
+
+ public int GetId()
+ {
+ return godot_icall_RID_get_id(RID.GetPtr(this));
+ }
+
+ [MethodImpl(MethodImplOptions.InternalCall)]
+ internal extern static IntPtr godot_icall_RID_Ctor(IntPtr from);
+
+ [MethodImpl(MethodImplOptions.InternalCall)]
+ internal extern static void godot_icall_RID_Dtor(IntPtr ptr);
+
+ [MethodImpl(MethodImplOptions.InternalCall)]
+ internal extern static int godot_icall_RID_get_id(IntPtr ptr);
+ }
+}
diff --git a/modules/mono/glue/cs_files/Rect2.cs b/modules/mono/glue/Managed/Files/Rect2.cs
index cb25c267bc..cb25c267bc 100644
--- a/modules/mono/glue/cs_files/Rect2.cs
+++ b/modules/mono/glue/Managed/Files/Rect2.cs
diff --git a/modules/mono/glue/cs_files/SignalAwaiter.cs b/modules/mono/glue/Managed/Files/SignalAwaiter.cs
index c06f6b05c9..9483b6ffb4 100644
--- a/modules/mono/glue/cs_files/SignalAwaiter.cs
+++ b/modules/mono/glue/Managed/Files/SignalAwaiter.cs
@@ -1,4 +1,5 @@
using System;
+using System.Runtime.CompilerServices;
namespace Godot
{
@@ -10,12 +11,12 @@ namespace Godot
public SignalAwaiter(Object source, string signal, Object target)
{
- NativeCalls.godot_icall_Object_connect_signal_awaiter(
- Object.GetPtr(source),
- signal, Object.GetPtr(target), this
- );
+ godot_icall_SignalAwaiter_connect(Object.GetPtr(source), signal, Object.GetPtr(target), this);
}
+ [MethodImpl(MethodImplOptions.InternalCall)]
+ internal extern static Error godot_icall_SignalAwaiter_connect(IntPtr source, string signal, IntPtr target, SignalAwaiter awaiter);
+
public bool IsCompleted
{
get
diff --git a/modules/mono/glue/cs_files/StringExtensions.cs b/modules/mono/glue/Managed/Files/StringExtensions.cs
index b58f8bc6a8..21c9be98c1 100644
--- a/modules/mono/glue/cs_files/StringExtensions.cs
+++ b/modules/mono/glue/Managed/Files/StringExtensions.cs
@@ -1,6 +1,7 @@
using System;
using System.Collections.Generic;
using System.Globalization;
+using System.Runtime.CompilerServices;
using System.Security;
using System.Text;
using System.Text.RegularExpressions;
@@ -26,7 +27,7 @@ namespace Godot
return slices;
}
- private static string GetSlicec(this string instance, char splitter, int slice)
+ private static string GetSliceCharacter(this string instance, char splitter, int slice)
{
if (!instance.Empty() && slice >= 0)
{
@@ -36,12 +37,18 @@ namespace Godot
while (true)
{
- if (instance[i] == 0 || instance[i] == splitter)
+ bool end = instance.Length <= i;
+
+ if (end || instance[i] == splitter)
{
if (slice == count)
{
return instance.Substring(prev, i - prev);
}
+ else if (end)
+ {
+ return string.Empty;
+ }
count++;
prev = i + 1;
@@ -57,7 +64,7 @@ namespace Godot
// <summary>
// If the string is a path to a file, return the path to the file without the extension.
// </summary>
- public static string Basename(this string instance)
+ public static string BaseName(this string instance)
{
int index = instance.LastIndexOf('.');
@@ -144,7 +151,7 @@ namespace Godot
for (int i = 0; i < aux.GetSliceCount(" "); i++)
{
- string slice = aux.GetSlicec(' ', i);
+ string slice = aux.GetSliceCharacter(' ', i);
if (slice.Length > 0)
{
slice = char.ToUpper(slice[0]) + slice.Substring(1);
@@ -162,30 +169,59 @@ namespace Godot
// </summary>
public static int CasecmpTo(this string instance, string to)
{
+ return instance.CompareTo(to, true);
+ }
+
+ // <summary>
+ // Perform a comparison to another string, return -1 if less, 0 if equal and +1 if greater.
+ // </summary>
+ public static int CompareTo(this string instance, string to, bool caseSensitive = true)
+ {
if (instance.Empty())
return to.Empty() ? 0 : -1;
if (to.Empty())
return 1;
- int instance_idx = 0;
- int to_idx = 0;
-
- while (true)
+ int instanceIndex = 0;
+ int toIndex = 0;
+
+ if (caseSensitive) // Outside while loop to avoid checking multiple times, despite some code duplication.
{
- if (to[to_idx] == 0 && instance[instance_idx] == 0)
- return 0; // We're equal
- if (instance[instance_idx] == 0)
- return -1; // If this is empty, and the other one is not, then we're less... I think?
- if (to[to_idx] == 0)
- return 1; // Otherwise the other one is smaller...
- if (instance[instance_idx] < to[to_idx]) // More than
- return -1;
- if (instance[instance_idx] > to[to_idx]) // Less than
- return 1;
-
- instance_idx++;
- to_idx++;
+ while (true)
+ {
+ if (to[toIndex] == 0 && instance[instanceIndex] == 0)
+ return 0; // We're equal
+ if (instance[instanceIndex] == 0)
+ return -1; // If this is empty, and the other one is not, then we're less... I think?
+ if (to[toIndex] == 0)
+ return 1; // Otherwise the other one is smaller...
+ if (instance[instanceIndex] < to[toIndex]) // More than
+ return -1;
+ if (instance[instanceIndex] > to[toIndex]) // Less than
+ return 1;
+
+ instanceIndex++;
+ toIndex++;
+ }
+ } else
+ {
+ while (true)
+ {
+ if (to[toIndex] == 0 && instance[instanceIndex] == 0)
+ return 0; // We're equal
+ if (instance[instanceIndex] == 0)
+ return -1; // If this is empty, and the other one is not, then we're less... I think?
+ if (to[toIndex] == 0)
+ return 1; // Otherwise the other one is smaller..
+ if (char.ToUpper(instance[instanceIndex]) < char.ToUpper(to[toIndex])) // More than
+ return -1;
+ if (char.ToUpper(instance[instanceIndex]) > char.ToUpper(to[toIndex])) // Less than
+ return 1;
+
+ instanceIndex++;
+ toIndex++;
+ }
}
}
@@ -361,7 +397,7 @@ namespace Godot
// <summary>
// Check whether this string is a subsequence of the given string.
// </summary>
- public static bool IsSubsequenceOf(this string instance, string text, bool case_insensitive)
+ public static bool IsSubsequenceOf(this string instance, string text, bool caseSensitive = true)
{
int len = instance.Length;
@@ -371,50 +407,42 @@ namespace Godot
if (len > text.Length)
return false;
- int src = 0;
- int tgt = 0;
+ int source = 0;
+ int target = 0;
- while (instance[src] != 0 && text[tgt] != 0)
+ while (instance[source] != 0 && text[target] != 0)
{
bool match;
- if (case_insensitive)
+ if (!caseSensitive)
{
- char srcc = char.ToLower(instance[src]);
- char tgtc = char.ToLower(text[tgt]);
- match = srcc == tgtc;
+ char sourcec = char.ToLower(instance[source]);
+ char targetc = char.ToLower(text[target]);
+ match = sourcec == targetc;
}
else
{
- match = instance[src] == text[tgt];
+ match = instance[source] == text[target];
}
if (match)
{
- src++;
- if (instance[src] == 0)
+ source++;
+ if (instance[source] == 0)
return true;
}
- tgt++;
+ target++;
}
return false;
}
// <summary>
- // Check whether this string is a subsequence of the given string, considering case.
- // </summary>
- public static bool IsSubsequenceOf(this string instance, string text)
- {
- return instance.IsSubsequenceOf(text, false);
- }
-
- // <summary>
- // Check whether this string is a subsequence of the given string, without considering case.
+ // Check whether this string is a subsequence of the given string, ignoring case differences.
// </summary>
public static bool IsSubsequenceOfI(this string instance, string text)
{
- return instance.IsSubsequenceOf(text, true);
+ return instance.IsSubsequenceOf(text, false);
}
// <summary>
@@ -452,12 +480,12 @@ namespace Godot
return false; // Don't start with number plz
}
- bool valid_char = instance[i] >= '0' &&
+ bool validChar = instance[i] >= '0' &&
instance[i] <= '9' || instance[i] >= 'a' &&
instance[i] <= 'z' || instance[i] >= 'A' &&
instance[i] <= 'Z' || instance[i] == '_';
- if (!valid_char)
+ if (!validChar)
return false;
}
@@ -476,8 +504,9 @@ namespace Godot
// <summary>
// Check whether the string contains a valid IP address.
// </summary>
- public static bool IsValidIpAddress(this string instance)
+ public static bool IsValidIPAddress(this string instance)
{
+ // TODO: Support IPv6 addresses
string[] ip = instance.Split(".");
if (ip.Length != 4)
@@ -500,7 +529,7 @@ namespace Godot
// <summary>
// Return a copy of the string with special characters escaped using the JSON standard.
// </summary>
- public static string JsonEscape(this string instance)
+ public static string JSONEscape(this string instance)
{
var sb = new StringBuilder(string.Copy(instance));
@@ -563,15 +592,15 @@ namespace Godot
// <summary>
// Do a simple case sensitive expression match, using ? and * wildcards (see [method expr_match]).
// </summary>
- public static bool Match(this string instance, string expr)
+ public static bool Match(this string instance, string expr, bool caseSensitive = true)
{
- return instance.ExprMatch(expr, true);
+ return instance.ExprMatch(expr, caseSensitive);
}
// <summary>
// Do a simple case insensitive expression match, using ? and * wildcards (see [method expr_match]).
// </summary>
- public static bool Matchn(this string instance, string expr)
+ public static bool MatchN(this string instance, string expr)
{
return instance.ExprMatch(expr, false);
}
@@ -579,49 +608,31 @@ namespace Godot
// <summary>
// Return the MD5 hash of the string as an array of bytes.
// </summary>
- public static byte[] Md5Buffer(this string instance)
+ public static byte[] MD5Buffer(this string instance)
{
- return NativeCalls.godot_icall_String_md5_buffer(instance);
+ return godot_icall_String_md5_buffer(instance);
}
+ [MethodImpl(MethodImplOptions.InternalCall)]
+ internal extern static byte[] godot_icall_String_md5_buffer(string str);
+
// <summary>
// Return the MD5 hash of the string as a string.
// </summary>
- public static string Md5Text(this string instance)
+ public static string MD5Text(this string instance)
{
- return NativeCalls.godot_icall_String_md5_text(instance);
+ return godot_icall_String_md5_text(instance);
}
+ [MethodImpl(MethodImplOptions.InternalCall)]
+ internal extern static string godot_icall_String_md5_text(string str);
+
// <summary>
// Perform a case-insensitive comparison to another string, return -1 if less, 0 if equal and +1 if greater.
// </summary>
public static int NocasecmpTo(this string instance, string to)
{
- if (instance.Empty())
- return to.Empty() ? 0 : -1;
-
- if (to.Empty())
- return 1;
-
- int instance_idx = 0;
- int to_idx = 0;
-
- while (true)
- {
- if (to[to_idx] == 0 && instance[instance_idx] == 0)
- return 0; // We're equal
- if (instance[instance_idx] == 0)
- return -1; // If this is empty, and the other one is not, then we're less... I think?
- if (to[to_idx] == 0)
- return 1; // Otherwise the other one is smaller..
- if (char.ToUpper(instance[instance_idx]) < char.ToUpper(to[to_idx])) // More than
- return -1;
- if (char.ToUpper(instance[instance_idx]) > char.ToUpper(to[to_idx])) // Less than
- return 1;
-
- instance_idx++;
- to_idx++;
- }
+ return instance.CompareTo(to, false);
}
// <summary>
@@ -738,7 +749,7 @@ namespace Godot
// <summary>
// Replace occurrences of a substring for different ones inside the string, but search case-insensitive.
// </summary>
- public static string Replacen(this string instance, string what, string forwhat)
+ public static string ReplaceN(this string instance, string what, string forwhat)
{
return Regex.Replace(instance, what, forwhat, RegexOptions.IgnoreCase);
}
@@ -746,19 +757,25 @@ namespace Godot
// <summary>
// Perform a search for a substring, but start from the end of the string instead of the beginning.
// </summary>
- public static int Rfind(this string instance, string what, int from = -1)
+ public static int RFind(this string instance, string what, int from = -1)
{
- return NativeCalls.godot_icall_String_rfind(instance, what, from);
+ return godot_icall_String_rfind(instance, what, from);
}
+ [MethodImpl(MethodImplOptions.InternalCall)]
+ internal extern static int godot_icall_String_rfind(string str, string what, int from);
+
// <summary>
// Perform a search for a substring, but start from the end of the string instead of the beginning. Also search case-insensitive.
// </summary>
- public static int Rfindn(this string instance, string what, int from = -1)
+ public static int RFindN(this string instance, string what, int from = -1)
{
- return NativeCalls.godot_icall_String_rfindn(instance, what, from);
+ return godot_icall_String_rfindn(instance, what, from);
}
+ [MethodImpl(MethodImplOptions.InternalCall)]
+ internal extern static int godot_icall_String_rfindn(string str, string what, int from);
+
// <summary>
// Return the right side of the string from a given position.
// </summary>
@@ -773,19 +790,25 @@ namespace Godot
return instance.Substring(pos, instance.Length - pos);
}
- public static byte[] Sha256Buffer(this string instance)
+ public static byte[] SHA256Buffer(this string instance)
{
- return NativeCalls.godot_icall_String_sha256_buffer(instance);
+ return godot_icall_String_sha256_buffer(instance);
}
+ [MethodImpl(MethodImplOptions.InternalCall)]
+ internal extern static byte[] godot_icall_String_sha256_buffer(string str);
+
// <summary>
// Return the SHA-256 hash of the string as a string.
// </summary>
- public static string Sha256Text(this string instance)
+ public static string SHA256Text(this string instance)
{
- return NativeCalls.godot_icall_String_sha256_text(instance);
+ return godot_icall_String_sha256_text(instance);
}
+ [MethodImpl(MethodImplOptions.InternalCall)]
+ internal extern static string godot_icall_String_sha256_text(string str);
+
// <summary>
// Return the similarity index of the text compared to this string. 1 means totally similar and 0 means totally dissimilar.
// </summary>
@@ -802,20 +825,20 @@ namespace Godot
return 0.0f;
}
- string[] srcBigrams = instance.Bigrams();
- string[] tgtBigrams = text.Bigrams();
+ string[] sourceBigrams = instance.Bigrams();
+ string[] targetBigrams = text.Bigrams();
- int src_size = srcBigrams.Length;
- int tgt_size = tgtBigrams.Length;
+ int sourceSize = sourceBigrams.Length;
+ int targetSize = targetBigrams.Length;
- float sum = src_size + tgt_size;
+ float sum = sourceSize + targetSize;
float inter = 0;
- for (int i = 0; i < src_size; i++)
+ for (int i = 0; i < sourceSize; i++)
{
- for (int j = 0; j < tgt_size; j++)
+ for (int j = 0; j < targetSize; j++)
{
- if (srcBigrams[i] == tgtBigrams[j])
+ if (sourceBigrams[i] == targetBigrams[j])
{
inter++;
break;
@@ -829,7 +852,7 @@ namespace Godot
// <summary>
// Split the string by a divisor string, return an array of the substrings. Example "One,Two,Three" will return ["One","Two","Three"] if split by ",".
// </summary>
- public static string[] Split(this string instance, string divisor, bool allow_empty = true)
+ public static string[] Split(this string instance, string divisor, bool allowEmpty = true)
{
return instance.Split(new[] { divisor }, StringSplitOptions.RemoveEmptyEntries);
}
@@ -837,7 +860,7 @@ namespace Godot
// <summary>
// Split the string in floats by using a divisor string, return an array of the substrings. Example "1,2.5,3" will return [1,2.5,3] if split by ",".
// </summary>
- public static float[] SplitFloats(this string instance, string divisor, bool allow_empty = true)
+ public static float[] SplitFloats(this string instance, string divisor, bool allowEmpty = true)
{
var ret = new List<float>();
int from = 0;
@@ -848,7 +871,7 @@ namespace Godot
int end = instance.Find(divisor, from);
if (end < 0)
end = len;
- if (allow_empty || end > from)
+ if (allowEmpty || end > from)
ret.Add(float.Parse(instance.Substring(from)));
if (end == len)
break;
@@ -859,7 +882,7 @@ namespace Godot
return ret.ToArray();
}
- private static readonly char[] non_printable = {
+ private static readonly char[] _nonPrintable = {
(char)00, (char)01, (char)02, (char)03, (char)04, (char)05,
(char)06, (char)07, (char)08, (char)09, (char)10, (char)11,
(char)12, (char)13, (char)14, (char)15, (char)16, (char)17,
@@ -876,11 +899,11 @@ namespace Godot
if (left)
{
if (right)
- return instance.Trim(non_printable);
- return instance.TrimStart(non_printable);
+ return instance.Trim(_nonPrintable);
+ return instance.TrimStart(_nonPrintable);
}
- return instance.TrimEnd(non_printable);
+ return instance.TrimEnd(_nonPrintable);
}
// <summary>
@@ -934,7 +957,7 @@ namespace Godot
// <summary>
// Convert the String (which is an array of characters) to PoolByteArray (which is an array of bytes). The conversion is a bit slower than to_ascii(), but supports all UTF-8 characters. Therefore, you should prefer this function over to_ascii().
// </summary>
- public static byte[] ToUtf8(this string instance)
+ public static byte[] ToUTF8(this string instance)
{
return Encoding.UTF8.GetBytes(instance);
}
@@ -942,7 +965,7 @@ namespace Godot
// <summary>
// Return a copy of the string with special characters escaped using the XML standard.
// </summary>
- public static string XmlEscape(this string instance)
+ public static string XMLEscape(this string instance)
{
return SecurityElement.Escape(instance);
}
@@ -950,7 +973,7 @@ namespace Godot
// <summary>
// Return a copy of the string with escaped characters replaced by their meanings according to the XML standard.
// </summary>
- public static string XmlUnescape(this string instance)
+ public static string XMLUnescape(this string instance)
{
return SecurityElement.FromString(instance).Text;
}
diff --git a/modules/mono/glue/cs_files/Transform.cs b/modules/mono/glue/Managed/Files/Transform.cs
index e432d5b52c..e432d5b52c 100644
--- a/modules/mono/glue/cs_files/Transform.cs
+++ b/modules/mono/glue/Managed/Files/Transform.cs
diff --git a/modules/mono/glue/cs_files/Transform2D.cs b/modules/mono/glue/Managed/Files/Transform2D.cs
index 8d30833066..8d30833066 100644
--- a/modules/mono/glue/cs_files/Transform2D.cs
+++ b/modules/mono/glue/Managed/Files/Transform2D.cs
diff --git a/modules/mono/glue/cs_files/Vector2.cs b/modules/mono/glue/Managed/Files/Vector2.cs
index 080b8802ba..080b8802ba 100644
--- a/modules/mono/glue/cs_files/Vector2.cs
+++ b/modules/mono/glue/Managed/Files/Vector2.cs
diff --git a/modules/mono/glue/cs_files/Vector3.cs b/modules/mono/glue/Managed/Files/Vector3.cs
index 6fffe5e4d6..6fffe5e4d6 100644
--- a/modules/mono/glue/cs_files/Vector3.cs
+++ b/modules/mono/glue/Managed/Files/Vector3.cs
diff --git a/modules/mono/glue/Managed/IgnoredFiles/Enums.cs b/modules/mono/glue/Managed/IgnoredFiles/Enums.cs
new file mode 100644
index 0000000000..05f1abcf93
--- /dev/null
+++ b/modules/mono/glue/Managed/IgnoredFiles/Enums.cs
@@ -0,0 +1,21 @@
+
+namespace Godot
+{
+ public enum Margin
+ {
+ Left = 0,
+ Top = 1,
+ Right = 2,
+ Bottom = 3
+ }
+
+ public enum Error
+ {
+ Ok = 0
+ }
+
+ public enum PropertyHint
+ {
+ None = 0
+ }
+}
diff --git a/modules/mono/glue/Managed/IgnoredFiles/FuncRef.cs b/modules/mono/glue/Managed/IgnoredFiles/FuncRef.cs
new file mode 100644
index 0000000000..83504fe49f
--- /dev/null
+++ b/modules/mono/glue/Managed/IgnoredFiles/FuncRef.cs
@@ -0,0 +1,17 @@
+using System;
+
+namespace Godot
+{
+ public partial class FuncRef
+ {
+ public void SetInstance(Object instance)
+ {
+ throw new NotImplementedException();
+ }
+
+ public void SetFunction(string name)
+ {
+ throw new NotImplementedException();
+ }
+ }
+}
diff --git a/modules/mono/glue/Managed/IgnoredFiles/Node.cs b/modules/mono/glue/Managed/IgnoredFiles/Node.cs
new file mode 100644
index 0000000000..99ba0f827a
--- /dev/null
+++ b/modules/mono/glue/Managed/IgnoredFiles/Node.cs
@@ -0,0 +1,28 @@
+
+using System;
+
+namespace Godot
+{
+ public partial class Node
+ {
+ public Node GetChild(int idx)
+ {
+ throw new NotImplementedException();
+ }
+
+ public Node GetNode(NodePath path)
+ {
+ throw new NotImplementedException();
+ }
+
+ public Node GetOwner()
+ {
+ throw new NotImplementedException();
+ }
+
+ public Node GetParent()
+ {
+ throw new NotImplementedException();
+ }
+ }
+}
diff --git a/modules/mono/glue/Managed/IgnoredFiles/Resource.cs b/modules/mono/glue/Managed/IgnoredFiles/Resource.cs
new file mode 100644
index 0000000000..cc0a5555b1
--- /dev/null
+++ b/modules/mono/glue/Managed/IgnoredFiles/Resource.cs
@@ -0,0 +1,7 @@
+namespace Godot
+{
+ public partial class Resource
+ {
+
+ }
+}
diff --git a/modules/mono/glue/Managed/IgnoredFiles/ResourceLoader.cs b/modules/mono/glue/Managed/IgnoredFiles/ResourceLoader.cs
new file mode 100644
index 0000000000..6461d35146
--- /dev/null
+++ b/modules/mono/glue/Managed/IgnoredFiles/ResourceLoader.cs
@@ -0,0 +1,12 @@
+using System;
+
+namespace Godot
+{
+ public partial class ResourceLoader
+ {
+ public static Resource Load(string path, string typeHint = "", bool pNoCache = false)
+ {
+ throw new NotImplementedException();
+ }
+ }
+}
diff --git a/modules/mono/glue/Managed/IgnoredFiles/WeakRef.cs b/modules/mono/glue/Managed/IgnoredFiles/WeakRef.cs
new file mode 100644
index 0000000000..1498b7836b
--- /dev/null
+++ b/modules/mono/glue/Managed/IgnoredFiles/WeakRef.cs
@@ -0,0 +1,7 @@
+namespace Godot
+{
+ public partial class WeakRef
+ {
+
+ }
+}
diff --git a/modules/mono/glue/Managed/Managed.csproj b/modules/mono/glue/Managed/Managed.csproj
new file mode 100644
index 0000000000..1f82dde5e7
--- /dev/null
+++ b/modules/mono/glue/Managed/Managed.csproj
@@ -0,0 +1,40 @@
+<?xml version="1.0" encoding="utf-8"?>
+<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+ <PropertyGroup>
+ <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
+ <Platform Condition=" '$(Platform)' == '' ">x86</Platform>
+ <ProjectGuid>{DAA3DEF8-5112-407C-A5E5-6C608CF5F955}</ProjectGuid>
+ <OutputType>Library</OutputType>
+ <RootNamespace>Managed</RootNamespace>
+ <AssemblyName>Managed</AssemblyName>
+ <TargetFrameworkVersion>v4.5</TargetFrameworkVersion>
+ </PropertyGroup>
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|x86' ">
+ <DebugSymbols>true</DebugSymbols>
+ <DebugType>full</DebugType>
+ <Optimize>false</Optimize>
+ <OutputPath>bin\Debug</OutputPath>
+ <DefineConstants>DEBUG;</DefineConstants>
+ <ErrorReport>prompt</ErrorReport>
+ <WarningLevel>4</WarningLevel>
+ <ExternalConsole>true</ExternalConsole>
+ <PlatformTarget>x86</PlatformTarget>
+ </PropertyGroup>
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|x86' ">
+ <Optimize>true</Optimize>
+ <OutputPath>bin\Release</OutputPath>
+ <ErrorReport>prompt</ErrorReport>
+ <WarningLevel>4</WarningLevel>
+ <ExternalConsole>true</ExternalConsole>
+ <PlatformTarget>x86</PlatformTarget>
+ </PropertyGroup>
+ <ItemGroup>
+ <Reference Include="System" />
+ </ItemGroup>
+ <ItemGroup>
+ <Compile Include="Files\**\*.cs" />
+ <Compile Include="IgnoredFiles\**\*.cs" />
+ <Compile Include="Properties\AssemblyInfo.cs" />
+ </ItemGroup>
+ <Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
+</Project>
diff --git a/modules/mono/glue/Managed/Managed.sln b/modules/mono/glue/Managed/Managed.sln
new file mode 100644
index 0000000000..61ddde0fb7
--- /dev/null
+++ b/modules/mono/glue/Managed/Managed.sln
@@ -0,0 +1,17 @@
+
+Microsoft Visual Studio Solution File, Format Version 12.00
+# Visual Studio 2012
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Managed", "Managed.csproj", "{DAA3DEF8-5112-407C-A5E5-6C608CF5F955}"
+EndProject
+Global
+ GlobalSection(SolutionConfigurationPlatforms) = preSolution
+ Debug|x86 = Debug|x86
+ Release|x86 = Release|x86
+ EndGlobalSection
+ GlobalSection(ProjectConfigurationPlatforms) = postSolution
+ {DAA3DEF8-5112-407C-A5E5-6C608CF5F955}.Debug|x86.ActiveCfg = Debug|x86
+ {DAA3DEF8-5112-407C-A5E5-6C608CF5F955}.Debug|x86.Build.0 = Debug|x86
+ {DAA3DEF8-5112-407C-A5E5-6C608CF5F955}.Release|x86.ActiveCfg = Release|x86
+ {DAA3DEF8-5112-407C-A5E5-6C608CF5F955}.Release|x86.Build.0 = Release|x86
+ EndGlobalSection
+EndGlobal
diff --git a/modules/mono/glue/Managed/Properties/AssemblyInfo.cs b/modules/mono/glue/Managed/Properties/AssemblyInfo.cs
new file mode 100644
index 0000000000..7ed68acad7
--- /dev/null
+++ b/modules/mono/glue/Managed/Properties/AssemblyInfo.cs
@@ -0,0 +1,26 @@
+using System.Reflection;
+using System.Runtime.CompilerServices;
+
+// Information about this assembly is defined by the following attributes.
+// Change them to the values specific to your project.
+
+[assembly: AssemblyTitle("Managed")]
+[assembly: AssemblyDescription("")]
+[assembly: AssemblyConfiguration("")]
+[assembly: AssemblyCompany("")]
+[assembly: AssemblyProduct("")]
+[assembly: AssemblyCopyright("")]
+[assembly: AssemblyTrademark("")]
+[assembly: AssemblyCulture("")]
+
+// The assembly version has the format "{Major}.{Minor}.{Build}.{Revision}".
+// The form "{Major}.{Minor}.*" will automatically update the build and revision,
+// and "{Major}.{Minor}.{Build}.*" will update just the revision.
+
+[assembly: AssemblyVersion("1.0.*")]
+
+// The following attributes are used to specify the signing key for the assembly,
+// if desired. See the Mono documentation for more information about signing.
+
+//[assembly: AssemblyDelaySign(false)]
+//[assembly: AssemblyKeyFile("")]
diff --git a/modules/mono/glue/Managed/README.md b/modules/mono/glue/Managed/README.md
new file mode 100644
index 0000000000..65e63cae37
--- /dev/null
+++ b/modules/mono/glue/Managed/README.md
@@ -0,0 +1,5 @@
+The directory `Files` contains C# files from the core assembly project that are not part of the generated API. Any file with the `.cs` extension in this directory will be added to the core assembly project.
+
+A dummy solution and project is provided to get tooling help while editing these files, like code completion and name refactoring.
+
+The directory `IgnoredFiles` contains C# files that are needed to build the dummy project but must not be added to the core assembly project. They contain placeholders for the declarations that are part of the generated API.
diff --git a/modules/mono/glue/base_object_glue.cpp b/modules/mono/glue/base_object_glue.cpp
new file mode 100644
index 0000000000..d718c3cc61
--- /dev/null
+++ b/modules/mono/glue/base_object_glue.cpp
@@ -0,0 +1,154 @@
+/*************************************************************************/
+/* base_object_glue.cpp */
+/*************************************************************************/
+/* This file is part of: */
+/* GODOT ENGINE */
+/* https://godotengine.org */
+/*************************************************************************/
+/* Copyright (c) 2007-2018 Juan Linietsky, Ariel Manzur. */
+/* Copyright (c) 2014-2018 Godot Engine contributors (cf. AUTHORS.md) */
+/* */
+/* Permission is hereby granted, free of charge, to any person obtaining */
+/* a copy of this software and associated documentation files (the */
+/* "Software"), to deal in the Software without restriction, including */
+/* without limitation the rights to use, copy, modify, merge, publish, */
+/* distribute, sublicense, and/or sell copies of the Software, and to */
+/* permit persons to whom the Software is furnished to do so, subject to */
+/* the following conditions: */
+/* */
+/* The above copyright notice and this permission notice shall be */
+/* included in all copies or substantial portions of the Software. */
+/* */
+/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */
+/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */
+/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.*/
+/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */
+/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */
+/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */
+/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
+/*************************************************************************/
+
+#include "base_object_glue.h"
+
+#ifdef MONO_GLUE_ENABLED
+
+#include "core/reference.h"
+#include "core/string_db.h"
+
+#include "../csharp_script.h"
+#include "../mono_gd/gd_mono_internals.h"
+#include "../mono_gd/gd_mono_utils.h"
+#include "../signal_awaiter_utils.h"
+
+Object *godot_icall_Object_Ctor(MonoObject *p_obj) {
+ Object *instance = memnew(Object);
+ GDMonoInternals::tie_managed_to_unmanaged(p_obj, instance);
+ return instance;
+}
+
+void godot_icall_Object_Disposed(MonoObject *p_obj, Object *p_ptr) {
+#ifdef DEBUG_ENABLED
+ CRASH_COND(p_ptr == NULL);
+#endif
+
+ if (p_ptr->get_script_instance()) {
+ CSharpInstance *cs_instance = CAST_CSHARP_INSTANCE(p_ptr->get_script_instance());
+ if (cs_instance) {
+ cs_instance->mono_object_disposed(p_obj);
+ p_ptr->set_script_instance(NULL);
+ return;
+ }
+ }
+
+ void *data = p_ptr->get_script_instance_binding(CSharpLanguage::get_singleton()->get_language_index());
+
+ if (data) {
+ Ref<MonoGCHandle> &gchandle = ((Map<Object *, CSharpScriptBinding>::Element *)data)->get().gchandle;
+ if (gchandle.is_valid()) {
+ CSharpLanguage::release_script_gchandle(p_obj, gchandle);
+ }
+ }
+}
+
+void godot_icall_Reference_Disposed(MonoObject *p_obj, Object *p_ptr, bool p_is_finalizer) {
+#ifdef DEBUG_ENABLED
+ CRASH_COND(p_ptr == NULL);
+ // This is only called with Reference derived classes
+ CRASH_COND(!Object::cast_to<Reference>(p_ptr));
+#endif
+
+ Reference *ref = static_cast<Reference *>(p_ptr);
+
+ if (ref->get_script_instance()) {
+ CSharpInstance *cs_instance = CAST_CSHARP_INSTANCE(ref->get_script_instance());
+ if (cs_instance) {
+ bool r_owner_deleted;
+ cs_instance->mono_object_disposed_baseref(p_obj, p_is_finalizer, r_owner_deleted);
+ if (!r_owner_deleted && !p_is_finalizer) {
+ // If the native instance is still alive and Dispose() was called
+ // (instead of the finalizer), then we remove the script instance.
+ ref->set_script_instance(NULL);
+ }
+ return;
+ }
+ }
+
+ // Unsafe refcount decrement. The managed instance also counts as a reference.
+ // See: CSharpLanguage::alloc_instance_binding_data(Object *p_object)
+ if (ref->unreference()) {
+ memdelete(ref);
+ } else {
+ void *data = ref->get_script_instance_binding(CSharpLanguage::get_singleton()->get_language_index());
+
+ if (data) {
+ Ref<MonoGCHandle> &gchandle = ((Map<Object *, CSharpScriptBinding>::Element *)data)->get().gchandle;
+ if (gchandle.is_valid()) {
+ CSharpLanguage::release_script_gchandle(p_obj, gchandle);
+ }
+ }
+ }
+}
+
+MethodBind *godot_icall_Object_ClassDB_get_method(MonoString *p_type, MonoString *p_method) {
+ StringName type(GDMonoMarshal::mono_string_to_godot(p_type));
+ StringName method(GDMonoMarshal::mono_string_to_godot(p_method));
+ return ClassDB::get_method(type, method);
+}
+
+MonoObject *godot_icall_Object_weakref(Object *p_obj) {
+ if (!p_obj)
+ return NULL;
+
+ Ref<WeakRef> wref;
+ Reference *ref = Object::cast_to<Reference>(p_obj);
+
+ if (ref) {
+ REF r = ref;
+ if (!r.is_valid())
+ return NULL;
+
+ wref.instance();
+ wref->set_ref(r);
+ } else {
+ wref.instance();
+ wref->set_obj(p_obj);
+ }
+
+ return GDMonoUtils::create_managed_for_godot_object(CACHED_CLASS(WeakRef), Reference::get_class_static(), Object::cast_to<Object>(wref.ptr()));
+}
+
+Error godot_icall_SignalAwaiter_connect(Object *p_source, MonoString *p_signal, Object *p_target, MonoObject *p_awaiter) {
+ String signal = GDMonoMarshal::mono_string_to_godot(p_signal);
+ return SignalAwaiterUtils::connect_signal_awaiter(p_source, signal, p_target, p_awaiter);
+}
+
+void godot_register_object_icalls() {
+ mono_add_internal_call("Godot.Object::godot_icall_Object_Ctor", (void *)godot_icall_Object_Ctor);
+ mono_add_internal_call("Godot.Object::godot_icall_Object_Disposed", (void *)godot_icall_Object_Disposed);
+ mono_add_internal_call("Godot.Object::godot_icall_Reference_Disposed", (void *)godot_icall_Reference_Disposed);
+ mono_add_internal_call("Godot.Object::godot_icall_Object_ClassDB_get_method", (void *)godot_icall_Object_ClassDB_get_method);
+ mono_add_internal_call("Godot.Object::godot_icall_Object_weakref", (void *)godot_icall_Object_weakref);
+ mono_add_internal_call("Godot.SignalAwaiter::godot_icall_SignalAwaiter_connect", (void *)godot_icall_SignalAwaiter_connect);
+}
+
+#endif // MONO_GLUE_ENABLED
diff --git a/modules/mono/glue/base_object_glue.h b/modules/mono/glue/base_object_glue.h
new file mode 100644
index 0000000000..2d4d66ebb8
--- /dev/null
+++ b/modules/mono/glue/base_object_glue.h
@@ -0,0 +1,59 @@
+/*************************************************************************/
+/* base_object_glue.h */
+/*************************************************************************/
+/* This file is part of: */
+/* GODOT ENGINE */
+/* https://godotengine.org */
+/*************************************************************************/
+/* Copyright (c) 2007-2018 Juan Linietsky, Ariel Manzur. */
+/* Copyright (c) 2014-2018 Godot Engine contributors (cf. AUTHORS.md) */
+/* */
+/* Permission is hereby granted, free of charge, to any person obtaining */
+/* a copy of this software and associated documentation files (the */
+/* "Software"), to deal in the Software without restriction, including */
+/* without limitation the rights to use, copy, modify, merge, publish, */
+/* distribute, sublicense, and/or sell copies of the Software, and to */
+/* permit persons to whom the Software is furnished to do so, subject to */
+/* the following conditions: */
+/* */
+/* The above copyright notice and this permission notice shall be */
+/* included in all copies or substantial portions of the Software. */
+/* */
+/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */
+/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */
+/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.*/
+/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */
+/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */
+/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */
+/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
+/*************************************************************************/
+
+#ifndef BASE_OBJECT_GLUE_H
+#define BASE_OBJECT_GLUE_H
+
+#ifdef MONO_GLUE_ENABLED
+
+#include "core/class_db.h"
+#include "core/object.h"
+
+#include "../mono_gd/gd_mono_marshal.h"
+
+Object *godot_icall_Object_Ctor(MonoObject *p_obj);
+
+void godot_icall_Object_Disposed(MonoObject *p_obj, Object *p_ptr);
+
+void godot_icall_Reference_Disposed(MonoObject *p_obj, Object *p_ptr, bool p_is_finalizer);
+
+MethodBind *godot_icall_Object_ClassDB_get_method(MonoString *p_type, MonoString *p_method);
+
+MonoObject *godot_icall_Object_weakref(Object *p_obj);
+
+Error godot_icall_SignalAwaiter_connect(Object *p_source, MonoString *p_signal, Object *p_target, MonoObject *p_awaiter);
+
+// Register internal calls
+
+void godot_register_object_icalls();
+
+#endif // MONO_GLUE_ENABLED
+
+#endif // BASE_OBJECT_GLUE_H
diff --git a/modules/mono/glue/collections_glue.cpp b/modules/mono/glue/collections_glue.cpp
index bb218b49b7..d9dba1c60d 100644
--- a/modules/mono/glue/collections_glue.cpp
+++ b/modules/mono/glue/collections_glue.cpp
@@ -30,9 +30,12 @@
#include "collections_glue.h"
+#ifdef MONO_GLUE_ENABLED
+
#include <mono/metadata/exception.h>
#include "../mono_gd/gd_mono_class.h"
+#include "../mono_gd/gd_mono_utils.h"
Array *godot_icall_Array_Ctor() {
return memnew(Array);
@@ -238,3 +241,5 @@ void godot_register_collections_icalls() {
mono_add_internal_call("Godot.Collections.Dictionary::godot_icall_Dictionary_Remove", (void *)godot_icall_Dictionary_Remove);
mono_add_internal_call("Godot.Collections.Dictionary::godot_icall_Dictionary_TryGetValue", (void *)godot_icall_Dictionary_TryGetValue);
}
+
+#endif // MONO_GLUE_ENABLED
diff --git a/modules/mono/glue/collections_glue.h b/modules/mono/glue/collections_glue.h
index eb5ecfb725..fa8e4c28aa 100644
--- a/modules/mono/glue/collections_glue.h
+++ b/modules/mono/glue/collections_glue.h
@@ -31,6 +31,8 @@
#ifndef COLLECTIONS_GLUE_H
#define COLLECTIONS_GLUE_H
+#ifdef MONO_GLUE_ENABLED
+
#include "core/array.h"
#include "../mono_gd/gd_mono_marshal.h"
@@ -97,4 +99,6 @@ bool godot_icall_Dictionary_TryGetValue(Dictionary *ptr, MonoObject *key, MonoOb
void godot_register_collections_icalls();
+#endif // MONO_GLUE_ENABLED
+
#endif // COLLECTIONS_GLUE_H
diff --git a/modules/mono/glue/cs_files/GodotSynchronizationContext.cs b/modules/mono/glue/cs_files/GodotSynchronizationContext.cs
deleted file mode 100644
index da3c7bac83..0000000000
--- a/modules/mono/glue/cs_files/GodotSynchronizationContext.cs
+++ /dev/null
@@ -1,25 +0,0 @@
-using System.Collections.Concurrent;
-using System.Collections.Generic;
-using System.Threading;
-
-namespace Godot
-{
- public class GodotSynchronizationContext : SynchronizationContext
- {
- private readonly BlockingCollection<KeyValuePair<SendOrPostCallback, object>> queue = new BlockingCollection<KeyValuePair<SendOrPostCallback, object>>();
-
- public override void Post(SendOrPostCallback d, object state)
- {
- queue.Add(new KeyValuePair<SendOrPostCallback, object>(d, state));
- }
-
- public void ExecutePendingContinuations()
- {
- KeyValuePair<SendOrPostCallback, object> workItem;
- while (queue.TryTake(out workItem))
- {
- workItem.Key(workItem.Value);
- }
- }
- }
-}
diff --git a/modules/mono/glue/cs_files/GodotTaskScheduler.cs b/modules/mono/glue/cs_files/GodotTaskScheduler.cs
deleted file mode 100644
index 3d23ec10f1..0000000000
--- a/modules/mono/glue/cs_files/GodotTaskScheduler.cs
+++ /dev/null
@@ -1,94 +0,0 @@
-using System;
-using System.Collections.Generic;
-using System.Linq;
-using System.Threading;
-using System.Threading.Tasks;
-
-namespace Godot
-{
- public class GodotTaskScheduler : TaskScheduler
- {
- private GodotSynchronizationContext Context { get; set; }
- private readonly LinkedList<Task> _tasks = new LinkedList<Task>();
-
- public GodotTaskScheduler()
- {
- Context = new GodotSynchronizationContext();
- SynchronizationContext.SetSynchronizationContext(Context);
- }
-
- protected sealed override void QueueTask(Task task)
- {
- lock (_tasks)
- {
- _tasks.AddLast(task);
- }
- }
-
- protected sealed override bool TryExecuteTaskInline(Task task, bool taskWasPreviouslyQueued)
- {
- if (SynchronizationContext.Current != Context)
- {
- return false;
- }
-
- if (taskWasPreviouslyQueued)
- {
- TryDequeue(task);
- }
-
- return TryExecuteTask(task);
- }
-
- protected sealed override bool TryDequeue(Task task)
- {
- lock (_tasks)
- {
- return _tasks.Remove(task);
- }
- }
-
- protected sealed override IEnumerable<Task> GetScheduledTasks()
- {
- lock (_tasks)
- {
- return _tasks.ToArray();
- }
- }
-
- public void Activate()
- {
- ExecuteQueuedTasks();
- Context.ExecutePendingContinuations();
- }
-
- private void ExecuteQueuedTasks()
- {
- while (true)
- {
- Task task;
-
- lock (_tasks)
- {
- if (_tasks.Any())
- {
- task = _tasks.First.Value;
- _tasks.RemoveFirst();
- }
- else
- {
- break;
- }
- }
-
- if (task != null)
- {
- if (!TryExecuteTask(task))
- {
- throw new InvalidOperationException();
- }
- }
- }
- }
- }
-}
diff --git a/modules/mono/glue/gd_glue.cpp b/modules/mono/glue/gd_glue.cpp
new file mode 100644
index 0000000000..051f42b966
--- /dev/null
+++ b/modules/mono/glue/gd_glue.cpp
@@ -0,0 +1,202 @@
+/*************************************************************************/
+/* gd_glue.cpp */
+/*************************************************************************/
+/* This file is part of: */
+/* GODOT ENGINE */
+/* https://godotengine.org */
+/*************************************************************************/
+/* Copyright (c) 2007-2018 Juan Linietsky, Ariel Manzur. */
+/* Copyright (c) 2014-2018 Godot Engine contributors (cf. AUTHORS.md) */
+/* */
+/* Permission is hereby granted, free of charge, to any person obtaining */
+/* a copy of this software and associated documentation files (the */
+/* "Software"), to deal in the Software without restriction, including */
+/* without limitation the rights to use, copy, modify, merge, publish, */
+/* distribute, sublicense, and/or sell copies of the Software, and to */
+/* permit persons to whom the Software is furnished to do so, subject to */
+/* the following conditions: */
+/* */
+/* The above copyright notice and this permission notice shall be */
+/* included in all copies or substantial portions of the Software. */
+/* */
+/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */
+/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */
+/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.*/
+/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */
+/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */
+/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */
+/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
+/*************************************************************************/
+
+#include "gd_glue.h"
+
+#ifdef MONO_GLUE_ENABLED
+
+#include "core/array.h"
+#include "core/io/marshalls.h"
+#include "core/os/os.h"
+#include "core/ustring.h"
+#include "core/variant.h"
+#include "core/variant_parser.h"
+
+#include "../mono_gd/gd_mono_utils.h"
+
+MonoObject *godot_icall_GD_bytes2var(MonoArray *p_bytes) {
+ Variant ret;
+ PoolByteArray varr = GDMonoMarshal::mono_array_to_PoolByteArray(p_bytes);
+ PoolByteArray::Read r = varr.read();
+ Error err = decode_variant(ret, r.ptr(), varr.size(), NULL);
+ if (err != OK) {
+ ret = RTR("Not enough bytes for decoding bytes, or invalid format.");
+ }
+ return GDMonoMarshal::variant_to_mono_object(ret);
+}
+
+MonoObject *godot_icall_GD_convert(MonoObject *p_what, int p_type) {
+ Variant what = GDMonoMarshal::mono_object_to_variant(p_what);
+ const Variant *args[1] = { &what };
+ Variant::CallError ce;
+ Variant ret = Variant::construct(Variant::Type(p_type), args, 1, ce);
+ ERR_FAIL_COND_V(ce.error != Variant::CallError::CALL_OK, NULL);
+ return GDMonoMarshal::variant_to_mono_object(ret);
+}
+
+int godot_icall_GD_hash(MonoObject *p_var) {
+ return GDMonoMarshal::mono_object_to_variant(p_var).hash();
+}
+
+MonoObject *godot_icall_GD_instance_from_id(int p_instance_id) {
+ return GDMonoUtils::unmanaged_get_managed(ObjectDB::get_instance(p_instance_id));
+}
+
+void godot_icall_GD_print(MonoArray *p_what) {
+ Array what = GDMonoMarshal::mono_array_to_Array(p_what);
+ String str;
+ for (int i = 0; i < what.size(); i++)
+ str += what[i].operator String();
+ print_line(str);
+}
+
+void godot_icall_GD_printerr(MonoArray *p_what) {
+ Array what = GDMonoMarshal::mono_array_to_Array(p_what);
+ String str;
+ for (int i = 0; i < what.size(); i++)
+ str += what[i].operator String();
+ OS::get_singleton()->printerr("%s\n", str.utf8().get_data());
+}
+
+void godot_icall_GD_printraw(MonoArray *p_what) {
+ Array what = GDMonoMarshal::mono_array_to_Array(p_what);
+ String str;
+ for (int i = 0; i < what.size(); i++)
+ str += what[i].operator String();
+ OS::get_singleton()->print("%s", str.utf8().get_data());
+}
+
+void godot_icall_GD_prints(MonoArray *p_what) {
+ Array what = GDMonoMarshal::mono_array_to_Array(p_what);
+ String str;
+ for (int i = 0; i < what.size(); i++) {
+ if (i)
+ str += " ";
+ str += what[i].operator String();
+ }
+ print_line(str);
+}
+
+void godot_icall_GD_printt(MonoArray *p_what) {
+ Array what = GDMonoMarshal::mono_array_to_Array(p_what);
+ String str;
+ for (int i = 0; i < what.size(); i++) {
+ if (i)
+ str += "\t";
+ str += what[i].operator String();
+ }
+ print_line(str);
+}
+
+void godot_icall_GD_seed(int p_seed) {
+ Math::seed(p_seed);
+}
+
+MonoString *godot_icall_GD_str(MonoArray *p_what) {
+ String str;
+ Array what = GDMonoMarshal::mono_array_to_Array(p_what);
+
+ for (int i = 0; i < what.size(); i++) {
+ String os = what[i].operator String();
+
+ if (i == 0)
+ str = os;
+ else
+ str += os;
+ }
+
+ return GDMonoMarshal::mono_string_from_godot(str);
+}
+
+MonoObject *godot_icall_GD_str2var(MonoString *p_str) {
+ Variant ret;
+
+ VariantParser::StreamString ss;
+ ss.s = GDMonoMarshal::mono_string_to_godot(p_str);
+
+ String errs;
+ int line;
+ Error err = VariantParser::parse(&ss, ret, errs, line);
+ if (err != OK) {
+ String err_str = "Parse error at line " + itos(line) + ": " + errs;
+ ERR_PRINTS(err_str);
+ ret = err_str;
+ }
+
+ return GDMonoMarshal::variant_to_mono_object(ret);
+}
+
+bool godot_icall_GD_type_exists(MonoString *p_type) {
+ return ClassDB::class_exists(GDMonoMarshal::mono_string_to_godot(p_type));
+}
+
+MonoArray *godot_icall_GD_var2bytes(MonoObject *p_var) {
+ Variant var = GDMonoMarshal::mono_object_to_variant(p_var);
+
+ PoolByteArray barr;
+ int len;
+ Error err = encode_variant(var, NULL, len);
+ ERR_EXPLAIN("Unexpected error encoding variable to bytes, likely unserializable type found (Object or RID).");
+ ERR_FAIL_COND_V(err != OK, NULL);
+
+ barr.resize(len);
+ {
+ PoolByteArray::Write w = barr.write();
+ encode_variant(var, w.ptr(), len);
+ }
+
+ return GDMonoMarshal::PoolByteArray_to_mono_array(barr);
+}
+
+MonoString *godot_icall_GD_var2str(MonoObject *p_var) {
+ String vars;
+ VariantWriter::write_to_string(GDMonoMarshal::mono_object_to_variant(p_var), vars);
+ return GDMonoMarshal::mono_string_from_godot(vars);
+}
+
+void godot_register_gd_icalls() {
+ mono_add_internal_call("Godot.GD::godot_icall_GD_bytes2var", (void *)godot_icall_GD_bytes2var);
+ mono_add_internal_call("Godot.GD::godot_icall_GD_convert", (void *)godot_icall_GD_convert);
+ mono_add_internal_call("Godot.GD::godot_icall_GD_hash", (void *)godot_icall_GD_hash);
+ mono_add_internal_call("Godot.GD::godot_icall_GD_instance_from_id", (void *)godot_icall_GD_instance_from_id);
+ mono_add_internal_call("Godot.GD::godot_icall_GD_print", (void *)godot_icall_GD_print);
+ mono_add_internal_call("Godot.GD::godot_icall_GD_printerr", (void *)godot_icall_GD_printerr);
+ mono_add_internal_call("Godot.GD::godot_icall_GD_printraw", (void *)godot_icall_GD_printraw);
+ mono_add_internal_call("Godot.GD::godot_icall_GD_prints", (void *)godot_icall_GD_prints);
+ mono_add_internal_call("Godot.GD::godot_icall_GD_printt", (void *)godot_icall_GD_printt);
+ mono_add_internal_call("Godot.GD::godot_icall_GD_seed", (void *)godot_icall_GD_seed);
+ mono_add_internal_call("Godot.GD::godot_icall_GD_str", (void *)godot_icall_GD_str);
+ mono_add_internal_call("Godot.GD::godot_icall_GD_str2var", (void *)godot_icall_GD_str2var);
+ mono_add_internal_call("Godot.GD::godot_icall_GD_type_exists", (void *)godot_icall_GD_type_exists);
+ mono_add_internal_call("Godot.GD::godot_icall_GD_var2bytes", (void *)godot_icall_GD_var2bytes);
+ mono_add_internal_call("Godot.GD::godot_icall_GD_var2str", (void *)godot_icall_GD_var2str);
+}
+
+#endif // MONO_GLUE_ENABLED
diff --git a/drivers/unix/packet_peer_udp_posix.h b/modules/mono/glue/gd_glue.h
index 7f72a9bfc9..6f846f221d 100644
--- a/drivers/unix/packet_peer_udp_posix.h
+++ b/modules/mono/glue/gd_glue.h
@@ -1,5 +1,5 @@
/*************************************************************************/
-/* packet_peer_udp_posix.h */
+/* gd_glue.h */
/*************************************************************************/
/* This file is part of: */
/* GODOT ENGINE */
@@ -28,61 +28,47 @@
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
/*************************************************************************/
-#ifndef PACKET_PEER_UDP_POSIX_H
-#define PACKET_PEER_UDP_POSIX_H
+#ifndef GD_GLUE_H
+#define GD_GLUE_H
-#ifdef UNIX_ENABLED
+#ifdef MONO_GLUE_ENABLED
-#include "io/packet_peer_udp.h"
-#include "ring_buffer.h"
+#include "../mono_gd/gd_mono_marshal.h"
-class PacketPeerUDPPosix : public PacketPeerUDP {
+MonoObject *godot_icall_GD_bytes2var(MonoArray *p_bytes);
- enum {
- PACKET_BUFFER_SIZE = 65536
- };
+MonoObject *godot_icall_GD_convert(MonoObject *p_what, int p_type);
- RingBuffer<uint8_t> rb;
- uint8_t recv_buffer[PACKET_BUFFER_SIZE];
- uint8_t packet_buffer[PACKET_BUFFER_SIZE];
- IP_Address packet_ip;
- int packet_port;
- int queue_count;
- int sockfd;
- bool sock_blocking;
- IP::Type sock_type;
+int godot_icall_GD_hash(MonoObject *p_var);
- IP_Address peer_addr;
- int peer_port;
+MonoObject *godot_icall_GD_instance_from_id(int p_instance_id);
- _FORCE_INLINE_ int _get_socket();
+void godot_icall_GD_print(MonoArray *p_what);
- static PacketPeerUDP *_create();
- void _set_sock_blocking(bool p_blocking);
- virtual Error _poll(bool p_block);
+void godot_icall_GD_printerr(MonoArray *p_what);
-public:
- virtual int get_available_packet_count() const;
- virtual Error get_packet(const uint8_t **r_buffer, int &r_buffer_size);
- virtual Error put_packet(const uint8_t *p_buffer, int p_buffer_size);
+void godot_icall_GD_printraw(MonoArray *p_what);
- virtual int get_max_packet_size() const;
+void godot_icall_GD_prints(MonoArray *p_what);
- virtual Error listen(int p_port, const IP_Address &p_bind_address = IP_Address("*"), int p_recv_buffer_size = 65536);
- virtual void close();
- virtual Error wait();
- virtual bool is_listening() const;
+void godot_icall_GD_printt(MonoArray *p_what);
- virtual IP_Address get_packet_address() const;
- virtual int get_packet_port() const;
+void godot_icall_GD_seed(int p_seed);
- virtual void set_dest_address(const IP_Address &p_address, int p_port);
+MonoString *godot_icall_GD_str(MonoArray *p_what);
- static void make_default();
+MonoObject *godot_icall_GD_str2var(MonoString *p_str);
- PacketPeerUDPPosix();
- ~PacketPeerUDPPosix();
-};
+bool godot_icall_GD_type_exists(MonoString *p_type);
-#endif // PACKET_PEER_UDP_POSIX_H
-#endif
+MonoArray *godot_icall_GD_var2bytes(MonoObject *p_var);
+
+MonoString *godot_icall_GD_var2str(MonoObject *p_var);
+
+// Register internal calls
+
+void godot_register_gd_icalls();
+
+#endif // MONO_GLUE_ENABLED
+
+#endif // GD_GLUE_H
diff --git a/modules/mono/glue/glue_header.h b/modules/mono/glue/glue_header.h
index 6a6f3062b4..69c5c6dcdb 100644
--- a/modules/mono/glue/glue_header.h
+++ b/modules/mono/glue/glue_header.h
@@ -28,27 +28,44 @@
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
/*************************************************************************/
-#include "builtin_types_glue.h"
+#ifdef MONO_GLUE_ENABLED
+
+#include "base_object_glue.h"
#include "collections_glue.h"
+#include "gd_glue.h"
+#include "nodepath_glue.h"
+#include "rid_glue.h"
+#include "string_glue.h"
+
+/**
+ * Registers internal calls that were not generated. This function is called
+ * from the generated GodotSharpBindings::register_generated_icalls() function.
+ */
+void godot_register_glue_header_icalls() {
+ godot_register_collections_icalls();
+ godot_register_gd_icalls();
+ godot_register_nodepath_icalls();
+ godot_register_object_icalls();
+ godot_register_rid_icalls();
+ godot_register_string_icalls();
+}
+
+// Used by the generated glue
+
+#include "core/array.h"
+#include "core/class_db.h"
+#include "core/dictionary.h"
+#include "core/engine.h"
+#include "core/method_bind.h"
+#include "core/node_path.h"
+#include "core/object.h"
+#include "core/reference.h"
+#include "core/typedefs.h"
+#include "core/ustring.h"
-#include "../csharp_script.h"
#include "../mono_gd/gd_mono_class.h"
#include "../mono_gd/gd_mono_internals.h"
-#include "../mono_gd/gd_mono_marshal.h"
-#include "../signal_awaiter_utils.h"
-
-#include "bind/core_bind.h"
-#include "class_db.h"
-#include "engine.h"
-#include "io/marshalls.h"
-#include "object.h"
-#include "os/os.h"
-#include "reference.h"
-#include "variant_parser.h"
-
-#ifdef TOOLS_ENABLED
-#include "editor/editor_node.h"
-#endif
+#include "../mono_gd/gd_mono_utils.h"
#define GODOTSHARP_INSTANCE_OBJECT(m_instance, m_type) \
static ClassDB::ClassInfo *ci = NULL; \
@@ -57,257 +74,4 @@
} \
Object *m_instance = ci->creation_func();
-void godot_icall_Object_Dtor(MonoObject *obj, Object *ptr) {
-#ifdef DEBUG_ENABLED
- CRASH_COND(ptr == NULL);
-#endif
- _GodotSharp::get_singleton()->queue_dispose(obj, ptr);
-}
-
-// -- ClassDB --
-
-MethodBind *godot_icall_ClassDB_get_method(MonoString *p_type, MonoString *p_method) {
- StringName type(GDMonoMarshal::mono_string_to_godot(p_type));
- StringName method(GDMonoMarshal::mono_string_to_godot(p_method));
- return ClassDB::get_method(type, method);
-}
-
-// -- SignalAwaiter --
-
-Error godot_icall_Object_connect_signal_awaiter(Object *p_source, MonoString *p_signal, Object *p_target, MonoObject *p_awaiter) {
- String signal = GDMonoMarshal::mono_string_to_godot(p_signal);
- return SignalAwaiterUtils::connect_signal_awaiter(p_source, signal, p_target, p_awaiter);
-}
-
-// -- NodePath --
-
-NodePath *godot_icall_NodePath_Ctor(MonoString *p_path) {
- return memnew(NodePath(GDMonoMarshal::mono_string_to_godot(p_path)));
-}
-
-void godot_icall_NodePath_Dtor(NodePath *p_ptr) {
- ERR_FAIL_NULL(p_ptr);
- _GodotSharp::get_singleton()->queue_dispose(p_ptr);
-}
-
-MonoString *godot_icall_NodePath_operator_String(NodePath *p_np) {
- return GDMonoMarshal::mono_string_from_godot(p_np->operator String());
-}
-
-// -- RID --
-
-RID *godot_icall_RID_Ctor(Object *p_from) {
- Resource *res_from = Object::cast_to<Resource>(p_from);
-
- if (res_from)
- return memnew(RID(res_from->get_rid()));
-
- return memnew(RID);
-}
-
-void godot_icall_RID_Dtor(RID *p_ptr) {
- ERR_FAIL_NULL(p_ptr);
- _GodotSharp::get_singleton()->queue_dispose(p_ptr);
-}
-
-// -- String --
-
-MonoArray *godot_icall_String_md5_buffer(MonoString *p_str) {
- Vector<uint8_t> ret = GDMonoMarshal::mono_string_to_godot(p_str).md5_buffer();
- // TODO Check possible Array/Vector<uint8_t> problem?
- return GDMonoMarshal::Array_to_mono_array(Variant(ret));
-}
-
-MonoString *godot_icall_String_md5_text(MonoString *p_str) {
- String ret = GDMonoMarshal::mono_string_to_godot(p_str).md5_text();
- return GDMonoMarshal::mono_string_from_godot(ret);
-}
-
-int godot_icall_String_rfind(MonoString *p_str, MonoString *p_what, int p_from) {
- String what = GDMonoMarshal::mono_string_to_godot(p_what);
- return GDMonoMarshal::mono_string_to_godot(p_str).rfind(what, p_from);
-}
-
-int godot_icall_String_rfindn(MonoString *p_str, MonoString *p_what, int p_from) {
- String what = GDMonoMarshal::mono_string_to_godot(p_what);
- return GDMonoMarshal::mono_string_to_godot(p_str).rfindn(what, p_from);
-}
-
-MonoArray *godot_icall_String_sha256_buffer(MonoString *p_str) {
- Vector<uint8_t> ret = GDMonoMarshal::mono_string_to_godot(p_str).sha256_buffer();
- return GDMonoMarshal::Array_to_mono_array(Variant(ret));
-}
-
-MonoString *godot_icall_String_sha256_text(MonoString *p_str) {
- String ret = GDMonoMarshal::mono_string_to_godot(p_str).sha256_text();
- return GDMonoMarshal::mono_string_from_godot(ret);
-}
-
-// -- Global Scope --
-
-MonoObject *godot_icall_Godot_bytes2var(MonoArray *p_bytes) {
- Variant ret;
- PoolByteArray varr = GDMonoMarshal::mono_array_to_PoolByteArray(p_bytes);
- PoolByteArray::Read r = varr.read();
- Error err = decode_variant(ret, r.ptr(), varr.size(), NULL);
- if (err != OK) {
- ret = RTR("Not enough bytes for decoding bytes, or invalid format.");
- }
- return GDMonoMarshal::variant_to_mono_object(ret);
-}
-
-MonoObject *godot_icall_Godot_convert(MonoObject *p_what, int p_type) {
- Variant what = GDMonoMarshal::mono_object_to_variant(p_what);
- const Variant *args[1] = { &what };
- Variant::CallError ce;
- Variant ret = Variant::construct(Variant::Type(p_type), args, 1, ce);
- ERR_FAIL_COND_V(ce.error != Variant::CallError::CALL_OK, NULL);
- return GDMonoMarshal::variant_to_mono_object(ret);
-}
-
-int godot_icall_Godot_hash(MonoObject *p_var) {
- return GDMonoMarshal::mono_object_to_variant(p_var).hash();
-}
-
-MonoObject *godot_icall_Godot_instance_from_id(int p_instance_id) {
- return GDMonoUtils::unmanaged_get_managed(ObjectDB::get_instance(p_instance_id));
-}
-
-void godot_icall_Godot_print(MonoArray *p_what) {
- Array what = GDMonoMarshal::mono_array_to_Array(p_what);
- String str;
- for (int i = 0; i < what.size(); i++)
- str += what[i].operator String();
- print_line(str);
-}
-
-void godot_icall_Godot_printerr(MonoArray *p_what) {
- Array what = GDMonoMarshal::mono_array_to_Array(p_what);
- String str;
- for (int i = 0; i < what.size(); i++)
- str += what[i].operator String();
- OS::get_singleton()->printerr("%s\n", str.utf8().get_data());
-}
-
-void godot_icall_Godot_printraw(MonoArray *p_what) {
- Array what = GDMonoMarshal::mono_array_to_Array(p_what);
- String str;
- for (int i = 0; i < what.size(); i++)
- str += what[i].operator String();
- OS::get_singleton()->print("%s", str.utf8().get_data());
-}
-
-void godot_icall_Godot_prints(MonoArray *p_what) {
- Array what = GDMonoMarshal::mono_array_to_Array(p_what);
- String str;
- for (int i = 0; i < what.size(); i++) {
- if (i)
- str += " ";
- str += what[i].operator String();
- }
- print_line(str);
-}
-
-void godot_icall_Godot_printt(MonoArray *p_what) {
- Array what = GDMonoMarshal::mono_array_to_Array(p_what);
- String str;
- for (int i = 0; i < what.size(); i++) {
- if (i)
- str += "\t";
- str += what[i].operator String();
- }
- print_line(str);
-}
-
-void godot_icall_Godot_seed(int p_seed) {
- Math::seed(p_seed);
-}
-
-MonoString *godot_icall_Godot_str(MonoArray *p_what) {
- String str;
- Array what = GDMonoMarshal::mono_array_to_Array(p_what);
-
- for (int i = 0; i < what.size(); i++) {
- String os = what[i].operator String();
-
- if (i == 0)
- str = os;
- else
- str += os;
- }
-
- return GDMonoMarshal::mono_string_from_godot(str);
-}
-
-MonoObject *godot_icall_Godot_str2var(MonoString *p_str) {
- Variant ret;
-
- VariantParser::StreamString ss;
- ss.s = GDMonoMarshal::mono_string_to_godot(p_str);
-
- String errs;
- int line;
- Error err = VariantParser::parse(&ss, ret, errs, line);
- if (err != OK) {
- String err_str = "Parse error at line " + itos(line) + ": " + errs;
- ERR_PRINTS(err_str);
- ret = err_str;
- }
-
- return GDMonoMarshal::variant_to_mono_object(ret);
-}
-
-bool godot_icall_Godot_type_exists(MonoString *p_type) {
- return ClassDB::class_exists(GDMonoMarshal::mono_string_to_godot(p_type));
-}
-
-MonoArray *godot_icall_Godot_var2bytes(MonoObject *p_var) {
- Variant var = GDMonoMarshal::mono_object_to_variant(p_var);
-
- PoolByteArray barr;
- int len;
- Error err = encode_variant(var, NULL, len);
- ERR_EXPLAIN("Unexpected error encoding variable to bytes, likely unserializable type found (Object or RID).");
- ERR_FAIL_COND_V(err != OK, NULL);
-
- barr.resize(len);
- {
- PoolByteArray::Write w = barr.write();
- encode_variant(var, w.ptr(), len);
- }
-
- return GDMonoMarshal::PoolByteArray_to_mono_array(barr);
-}
-
-MonoString *godot_icall_Godot_var2str(MonoObject *p_var) {
- String vars;
- VariantWriter::write_to_string(GDMonoMarshal::mono_object_to_variant(p_var), vars);
- return GDMonoMarshal::mono_string_from_godot(vars);
-}
-
-MonoObject *godot_icall_Godot_weakref(Object *p_obj) {
- if (!p_obj)
- return NULL;
-
- Ref<WeakRef> wref;
- Reference *ref = Object::cast_to<Reference>(p_obj);
-
- if (ref) {
- REF r = ref;
- if (!r.is_valid())
- return NULL;
-
- wref.instance();
- wref->set_ref(r);
- } else {
- wref.instance();
- wref->set_obj(p_obj);
- }
-
- return GDMonoUtils::create_managed_for_godot_object(CACHED_CLASS(WeakRef), Reference::get_class_static(), Object::cast_to<Object>(wref.ptr()));
-}
-
-void godot_register_header_icalls() {
- godot_register_builtin_type_icalls();
- godot_register_collections_icalls();
-}
+#endif // MONO_GLUE_ENABLED
diff --git a/modules/mono/glue/builtin_types_glue.h b/modules/mono/glue/nodepath_glue.cpp
index ef9f152682..4b7648a4f9 100644
--- a/modules/mono/glue/builtin_types_glue.h
+++ b/modules/mono/glue/nodepath_glue.cpp
@@ -1,5 +1,5 @@
/*************************************************************************/
-/* builtin_types_glue.h */
+/* nodepath_glue.cpp */
/*************************************************************************/
/* This file is part of: */
/* GODOT ENGINE */
@@ -28,15 +28,24 @@
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
/*************************************************************************/
-#ifndef BUILTIN_TYPES_GLUE_H
-#define BUILTIN_TYPES_GLUE_H
+#include "nodepath_glue.h"
-#include "core/node_path.h"
-#include "core/rid.h"
+#ifdef MONO_GLUE_ENABLED
-#include <mono/metadata/object.h>
+#include "core/ustring.h"
-#include "../mono_gd/gd_mono_marshal.h"
+NodePath *godot_icall_NodePath_Ctor(MonoString *p_path) {
+ return memnew(NodePath(GDMonoMarshal::mono_string_to_godot(p_path)));
+}
+
+void godot_icall_NodePath_Dtor(NodePath *p_ptr) {
+ ERR_FAIL_NULL(p_ptr);
+ _GodotSharp::get_singleton()->queue_dispose(p_ptr);
+}
+
+MonoString *godot_icall_NodePath_operator_String(NodePath *p_np) {
+ return GDMonoMarshal::mono_string_from_godot(p_np->operator String());
+}
MonoBoolean godot_icall_NodePath_is_absolute(NodePath *p_ptr) {
return (MonoBoolean)p_ptr->is_absolute();
@@ -70,20 +79,18 @@ MonoBoolean godot_icall_NodePath_is_empty(NodePath *p_ptr) {
return (MonoBoolean)p_ptr->is_empty();
}
-uint32_t godot_icall_RID_get_id(RID *p_ptr) {
- return p_ptr->get_id();
-}
-
-void godot_register_builtin_type_icalls() {
- mono_add_internal_call("Godot.NativeCalls::godot_icall_NodePath_get_as_property_path", (void *)godot_icall_NodePath_get_as_property_path);
- mono_add_internal_call("Godot.NativeCalls::godot_icall_NodePath_get_concatenated_subnames", (void *)godot_icall_NodePath_get_concatenated_subnames);
- mono_add_internal_call("Godot.NativeCalls::godot_icall_NodePath_get_name", (void *)godot_icall_NodePath_get_name);
- mono_add_internal_call("Godot.NativeCalls::godot_icall_NodePath_get_name_count", (void *)godot_icall_NodePath_get_name_count);
- mono_add_internal_call("Godot.NativeCalls::godot_icall_NodePath_get_subname", (void *)godot_icall_NodePath_get_subname);
- mono_add_internal_call("Godot.NativeCalls::godot_icall_NodePath_get_subname_count", (void *)godot_icall_NodePath_get_subname_count);
- mono_add_internal_call("Godot.NativeCalls::godot_icall_NodePath_is_absolute", (void *)godot_icall_NodePath_is_absolute);
- mono_add_internal_call("Godot.NativeCalls::godot_icall_NodePath_is_empty", (void *)godot_icall_NodePath_is_empty);
- mono_add_internal_call("Godot.NativeCalls::godot_icall_RID_get_id", (void *)godot_icall_RID_get_id);
+void godot_register_nodepath_icalls() {
+ mono_add_internal_call("Godot.NodePath::godot_icall_NodePath_Ctor", (void *)godot_icall_NodePath_Ctor);
+ mono_add_internal_call("Godot.NodePath::godot_icall_NodePath_Dtor", (void *)godot_icall_NodePath_Dtor);
+ mono_add_internal_call("Godot.NodePath::godot_icall_NodePath_operator_String", (void *)godot_icall_NodePath_operator_String);
+ mono_add_internal_call("Godot.NodePath::godot_icall_NodePath_get_as_property_path", (void *)godot_icall_NodePath_get_as_property_path);
+ mono_add_internal_call("Godot.NodePath::godot_icall_NodePath_get_concatenated_subnames", (void *)godot_icall_NodePath_get_concatenated_subnames);
+ mono_add_internal_call("Godot.NodePath::godot_icall_NodePath_get_name", (void *)godot_icall_NodePath_get_name);
+ mono_add_internal_call("Godot.NodePath::godot_icall_NodePath_get_name_count", (void *)godot_icall_NodePath_get_name_count);
+ mono_add_internal_call("Godot.NodePath::godot_icall_NodePath_get_subname", (void *)godot_icall_NodePath_get_subname);
+ mono_add_internal_call("Godot.NodePath::godot_icall_NodePath_get_subname_count", (void *)godot_icall_NodePath_get_subname_count);
+ mono_add_internal_call("Godot.NodePath::godot_icall_NodePath_is_absolute", (void *)godot_icall_NodePath_is_absolute);
+ mono_add_internal_call("Godot.NodePath::godot_icall_NodePath_is_empty", (void *)godot_icall_NodePath_is_empty);
}
-#endif // BUILTIN_TYPES_GLUE_H
+#endif // MONO_GLUE_ENABLED
diff --git a/drivers/windows/packet_peer_udp_winsock.h b/modules/mono/glue/nodepath_glue.h
index 8d575c2033..92579399a6 100644
--- a/drivers/windows/packet_peer_udp_winsock.h
+++ b/modules/mono/glue/nodepath_glue.h
@@ -1,5 +1,5 @@
/*************************************************************************/
-/* packet_peer_udp_winsock.h */
+/* nodepath_glue.h */
/*************************************************************************/
/* This file is part of: */
/* GODOT ENGINE */
@@ -28,62 +28,41 @@
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
/*************************************************************************/
-#ifdef WINDOWS_ENABLED
+#ifndef NODEPATH_GLUE_H
+#define NODEPATH_GLUE_H
-#ifndef PACKET_PEER_UDP_WINSOCK_H
-#define PACKET_PEER_UDP_WINSOCK_H
+#ifdef MONO_GLUE_ENABLED
-#include "io/packet_peer_udp.h"
-#include "ring_buffer.h"
+#include "core/node_path.h"
-class PacketPeerUDPWinsock : public PacketPeerUDP {
+#include "../mono_gd/gd_mono_marshal.h"
- enum {
- PACKET_BUFFER_SIZE = 65536
- };
+NodePath *godot_icall_NodePath_Ctor(MonoString *p_path);
- RingBuffer<uint8_t> rb;
- uint8_t recv_buffer[PACKET_BUFFER_SIZE];
- uint8_t packet_buffer[PACKET_BUFFER_SIZE];
- IP_Address packet_ip;
- int packet_port;
- int queue_count;
- int sockfd;
- bool sock_blocking;
- IP::Type sock_type;
+void godot_icall_NodePath_Dtor(NodePath *p_ptr);
- IP_Address peer_addr;
- int peer_port;
+MonoString *godot_icall_NodePath_operator_String(NodePath *p_np);
- _FORCE_INLINE_ int _get_socket();
+MonoBoolean godot_icall_NodePath_is_absolute(NodePath *p_ptr);
- static PacketPeerUDP *_create();
+uint32_t godot_icall_NodePath_get_name_count(NodePath *p_ptr);
- void _set_sock_blocking(bool p_blocking);
+MonoString *godot_icall_NodePath_get_name(NodePath *p_ptr, uint32_t p_idx);
- Error _poll(bool p_wait);
+uint32_t godot_icall_NodePath_get_subname_count(NodePath *p_ptr);
-public:
- virtual int get_available_packet_count() const;
- virtual Error get_packet(const uint8_t **r_buffer, int &r_buffer_size);
- virtual Error put_packet(const uint8_t *p_buffer, int p_buffer_size);
+MonoString *godot_icall_NodePath_get_subname(NodePath *p_ptr, uint32_t p_idx);
- virtual int get_max_packet_size() const;
+MonoString *godot_icall_NodePath_get_concatenated_subnames(NodePath *p_ptr);
- virtual Error listen(int p_port, const IP_Address &p_bind_address = IP_Address("*"), int p_recv_buffer_size = 65536);
- virtual void close();
- virtual Error wait();
- virtual bool is_listening() const;
+NodePath *godot_icall_NodePath_get_as_property_path(NodePath *p_ptr);
- virtual IP_Address get_packet_address() const;
- virtual int get_packet_port() const;
+MonoBoolean godot_icall_NodePath_is_empty(NodePath *p_ptr);
- virtual void set_dest_address(const IP_Address &p_address, int p_port);
+// Register internal calls
- static void make_default();
- PacketPeerUDPWinsock();
- ~PacketPeerUDPWinsock();
-};
-#endif // PACKET_PEER_UDP_WINSOCK_H
+void godot_register_nodepath_icalls();
-#endif
+#endif // MONO_GLUE_ENABLED
+
+#endif // NODEPATH_GLUE_H
diff --git a/modules/mono/glue/rid_glue.cpp b/modules/mono/glue/rid_glue.cpp
new file mode 100644
index 0000000000..5d66b8aa6f
--- /dev/null
+++ b/modules/mono/glue/rid_glue.cpp
@@ -0,0 +1,61 @@
+/*************************************************************************/
+/* rid_glue.cpp */
+/*************************************************************************/
+/* This file is part of: */
+/* GODOT ENGINE */
+/* https://godotengine.org */
+/*************************************************************************/
+/* Copyright (c) 2007-2018 Juan Linietsky, Ariel Manzur. */
+/* Copyright (c) 2014-2018 Godot Engine contributors (cf. AUTHORS.md) */
+/* */
+/* Permission is hereby granted, free of charge, to any person obtaining */
+/* a copy of this software and associated documentation files (the */
+/* "Software"), to deal in the Software without restriction, including */
+/* without limitation the rights to use, copy, modify, merge, publish, */
+/* distribute, sublicense, and/or sell copies of the Software, and to */
+/* permit persons to whom the Software is furnished to do so, subject to */
+/* the following conditions: */
+/* */
+/* The above copyright notice and this permission notice shall be */
+/* included in all copies or substantial portions of the Software. */
+/* */
+/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */
+/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */
+/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.*/
+/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */
+/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */
+/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */
+/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
+/*************************************************************************/
+
+#include "rid_glue.h"
+
+#ifdef MONO_GLUE_ENABLED
+
+#include "core/resource.h"
+
+RID *godot_icall_RID_Ctor(Object *p_from) {
+ Resource *res_from = Object::cast_to<Resource>(p_from);
+
+ if (res_from)
+ return memnew(RID(res_from->get_rid()));
+
+ return memnew(RID);
+}
+
+void godot_icall_RID_Dtor(RID *p_ptr) {
+ ERR_FAIL_NULL(p_ptr);
+ _GodotSharp::get_singleton()->queue_dispose(p_ptr);
+}
+
+uint32_t godot_icall_RID_get_id(RID *p_ptr) {
+ return p_ptr->get_id();
+}
+
+void godot_register_rid_icalls() {
+ mono_add_internal_call("Godot.RID::godot_icall_RID_Ctor", (void *)godot_icall_RID_Ctor);
+ mono_add_internal_call("Godot.RID::godot_icall_RID_Dtor", (void *)godot_icall_RID_Dtor);
+ mono_add_internal_call("Godot.RID::godot_icall_RID_get_id", (void *)godot_icall_RID_get_id);
+}
+
+#endif // MONO_GLUE_ENABLED
diff --git a/drivers/unix/tcp_server_posix.h b/modules/mono/glue/rid_glue.h
index c749314fb3..c725a9b5de 100644
--- a/drivers/unix/tcp_server_posix.h
+++ b/modules/mono/glue/rid_glue.h
@@ -1,5 +1,5 @@
/*************************************************************************/
-/* tcp_server_posix.h */
+/* rid_glue.h */
/*************************************************************************/
/* This file is part of: */
/* GODOT ENGINE */
@@ -28,31 +28,26 @@
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
/*************************************************************************/
-#ifndef TCP_SERVER_POSIX_H
-#define TCP_SERVER_POSIX_H
+#ifndef RID_GLUE_H
+#define RID_GLUE_H
-#ifdef UNIX_ENABLED
-#include "core/io/tcp_server.h"
+#ifdef MONO_GLUE_ENABLED
-class TCPServerPosix : public TCP_Server {
+#include "core/object.h"
+#include "core/rid.h"
- int listen_sockfd;
- IP::Type sock_type;
+#include "../mono_gd/gd_mono_marshal.h"
- static TCP_Server *_create();
+RID *godot_icall_RID_Ctor(Object *p_from);
-public:
- virtual Error listen(uint16_t p_port, const IP_Address &p_bind_address = IP_Address("*"));
- virtual bool is_connection_available() const;
- virtual Ref<StreamPeerTCP> take_connection();
+void godot_icall_RID_Dtor(RID *p_ptr);
- virtual void stop();
+uint32_t godot_icall_RID_get_id(RID *p_ptr);
- static void make_default();
+// Register internal calls
- TCPServerPosix();
- ~TCPServerPosix();
-};
+void godot_register_rid_icalls();
-#endif // TCP_SERVER_POSIX_H
-#endif
+#endif // MONO_GLUE_ENABLED
+
+#endif // RID_GLUE_H
diff --git a/modules/mono/glue/string_glue.cpp b/modules/mono/glue/string_glue.cpp
new file mode 100644
index 0000000000..e1a2f1affd
--- /dev/null
+++ b/modules/mono/glue/string_glue.cpp
@@ -0,0 +1,79 @@
+/*************************************************************************/
+/* string_glue.cpp */
+/*************************************************************************/
+/* This file is part of: */
+/* GODOT ENGINE */
+/* https://godotengine.org */
+/*************************************************************************/
+/* Copyright (c) 2007-2018 Juan Linietsky, Ariel Manzur. */
+/* Copyright (c) 2014-2018 Godot Engine contributors (cf. AUTHORS.md) */
+/* */
+/* Permission is hereby granted, free of charge, to any person obtaining */
+/* a copy of this software and associated documentation files (the */
+/* "Software"), to deal in the Software without restriction, including */
+/* without limitation the rights to use, copy, modify, merge, publish, */
+/* distribute, sublicense, and/or sell copies of the Software, and to */
+/* permit persons to whom the Software is furnished to do so, subject to */
+/* the following conditions: */
+/* */
+/* The above copyright notice and this permission notice shall be */
+/* included in all copies or substantial portions of the Software. */
+/* */
+/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */
+/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */
+/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.*/
+/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */
+/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */
+/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */
+/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
+/*************************************************************************/
+
+#include "string_glue.h"
+
+#ifdef MONO_GLUE_ENABLED
+
+#include "core/ustring.h"
+#include "core/variant.h"
+#include "core/vector.h"
+
+MonoArray *godot_icall_String_md5_buffer(MonoString *p_str) {
+ Vector<uint8_t> ret = GDMonoMarshal::mono_string_to_godot(p_str).md5_buffer();
+ // TODO Check possible Array/Vector<uint8_t> problem?
+ return GDMonoMarshal::Array_to_mono_array(Variant(ret));
+}
+
+MonoString *godot_icall_String_md5_text(MonoString *p_str) {
+ String ret = GDMonoMarshal::mono_string_to_godot(p_str).md5_text();
+ return GDMonoMarshal::mono_string_from_godot(ret);
+}
+
+int godot_icall_String_rfind(MonoString *p_str, MonoString *p_what, int p_from) {
+ String what = GDMonoMarshal::mono_string_to_godot(p_what);
+ return GDMonoMarshal::mono_string_to_godot(p_str).rfind(what, p_from);
+}
+
+int godot_icall_String_rfindn(MonoString *p_str, MonoString *p_what, int p_from) {
+ String what = GDMonoMarshal::mono_string_to_godot(p_what);
+ return GDMonoMarshal::mono_string_to_godot(p_str).rfindn(what, p_from);
+}
+
+MonoArray *godot_icall_String_sha256_buffer(MonoString *p_str) {
+ Vector<uint8_t> ret = GDMonoMarshal::mono_string_to_godot(p_str).sha256_buffer();
+ return GDMonoMarshal::Array_to_mono_array(Variant(ret));
+}
+
+MonoString *godot_icall_String_sha256_text(MonoString *p_str) {
+ String ret = GDMonoMarshal::mono_string_to_godot(p_str).sha256_text();
+ return GDMonoMarshal::mono_string_from_godot(ret);
+}
+
+void godot_register_string_icalls() {
+ mono_add_internal_call("Godot.String::godot_icall_String_md5_buffer", (void *)godot_icall_String_md5_buffer);
+ mono_add_internal_call("Godot.String::godot_icall_String_md5_text", (void *)godot_icall_String_md5_text);
+ mono_add_internal_call("Godot.String::godot_icall_String_rfind", (void *)godot_icall_String_rfind);
+ mono_add_internal_call("Godot.String::godot_icall_String_rfindn", (void *)godot_icall_String_rfindn);
+ mono_add_internal_call("Godot.String::godot_icall_String_sha256_buffer", (void *)godot_icall_String_sha256_buffer);
+ mono_add_internal_call("Godot.String::godot_icall_String_sha256_text", (void *)godot_icall_String_sha256_text);
+}
+
+#endif // MONO_GLUE_ENABLED
diff --git a/modules/mono/glue/string_glue.h b/modules/mono/glue/string_glue.h
new file mode 100644
index 0000000000..8b1553e28b
--- /dev/null
+++ b/modules/mono/glue/string_glue.h
@@ -0,0 +1,56 @@
+/*************************************************************************/
+/* string_glue.h */
+/*************************************************************************/
+/* This file is part of: */
+/* GODOT ENGINE */
+/* https://godotengine.org */
+/*************************************************************************/
+/* Copyright (c) 2007-2018 Juan Linietsky, Ariel Manzur. */
+/* Copyright (c) 2014-2018 Godot Engine contributors (cf. AUTHORS.md) */
+/* */
+/* Permission is hereby granted, free of charge, to any person obtaining */
+/* a copy of this software and associated documentation files (the */
+/* "Software"), to deal in the Software without restriction, including */
+/* without limitation the rights to use, copy, modify, merge, publish, */
+/* distribute, sublicense, and/or sell copies of the Software, and to */
+/* permit persons to whom the Software is furnished to do so, subject to */
+/* the following conditions: */
+/* */
+/* The above copyright notice and this permission notice shall be */
+/* included in all copies or substantial portions of the Software. */
+/* */
+/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */
+/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */
+/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.*/
+/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */
+/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */
+/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */
+/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
+/*************************************************************************/
+
+#ifndef STRING_GLUE_H
+#define STRING_GLUE_H
+
+#ifdef MONO_GLUE_ENABLED
+
+#include "../mono_gd/gd_mono_marshal.h"
+
+MonoArray *godot_icall_String_md5_buffer(MonoString *p_str);
+
+MonoString *godot_icall_String_md5_text(MonoString *p_str);
+
+int godot_icall_String_rfind(MonoString *p_str, MonoString *p_what, int p_from);
+
+int godot_icall_String_rfindn(MonoString *p_str, MonoString *p_what, int p_from);
+
+MonoArray *godot_icall_String_sha256_buffer(MonoString *p_str);
+
+MonoString *godot_icall_String_sha256_text(MonoString *p_str);
+
+// Register internal calls
+
+void godot_register_string_icalls();
+
+#endif // MONO_GLUE_ENABLED
+
+#endif // STRING_GLUE_H
diff --git a/modules/mono/godotsharp_dirs.cpp b/modules/mono/godotsharp_dirs.cpp
index 92c5cdc5c1..2570e68f13 100644
--- a/modules/mono/godotsharp_dirs.cpp
+++ b/modules/mono/godotsharp_dirs.cpp
@@ -30,13 +30,13 @@
#include "godotsharp_dirs.h"
-#include "os/os.h"
+#include "core/os/os.h"
#ifdef TOOLS_ENABLED
+#include "core/os/dir_access.h"
+#include "core/project_settings.h"
+#include "core/version.h"
#include "editor/editor_settings.h"
-#include "os/dir_access.h"
-#include "project_settings.h"
-#include "version.h"
#endif
namespace GodotSharpDirs {
diff --git a/modules/mono/godotsharp_dirs.h b/modules/mono/godotsharp_dirs.h
index e87b5a4150..3466cb271d 100644
--- a/modules/mono/godotsharp_dirs.h
+++ b/modules/mono/godotsharp_dirs.h
@@ -31,7 +31,7 @@
#ifndef GODOTSHARP_DIRS_H
#define GODOTSHARP_DIRS_H
-#include "ustring.h"
+#include "core/ustring.h"
namespace GodotSharpDirs {
diff --git a/modules/mono/mono_gc_handle.cpp b/modules/mono/mono_gc_handle.cpp
index 9f0e933a8c..f695bddfeb 100644
--- a/modules/mono/mono_gc_handle.cpp
+++ b/modules/mono/mono_gc_handle.cpp
@@ -32,24 +32,34 @@
#include "mono_gd/gd_mono.h"
-uint32_t MonoGCHandle::make_strong_handle(MonoObject *p_object) {
+uint32_t MonoGCHandle::new_strong_handle(MonoObject *p_object) {
return mono_gchandle_new(p_object, /* pinned: */ false);
}
-uint32_t MonoGCHandle::make_weak_handle(MonoObject *p_object) {
+uint32_t MonoGCHandle::new_strong_handle_pinned(MonoObject *p_object) {
+
+ return mono_gchandle_new(p_object, /* pinned: */ true);
+}
+
+uint32_t MonoGCHandle::new_weak_handle(MonoObject *p_object) {
return mono_gchandle_new_weakref(p_object, /* track_resurrection: */ false);
}
+void MonoGCHandle::free_handle(uint32_t p_gchandle) {
+
+ mono_gchandle_free(p_gchandle);
+}
+
Ref<MonoGCHandle> MonoGCHandle::create_strong(MonoObject *p_object) {
- return memnew(MonoGCHandle(make_strong_handle(p_object), STRONG_HANDLE));
+ return memnew(MonoGCHandle(new_strong_handle(p_object), STRONG_HANDLE));
}
Ref<MonoGCHandle> MonoGCHandle::create_weak(MonoObject *p_object) {
- return memnew(MonoGCHandle(make_weak_handle(p_object), WEAK_HANDLE));
+ return memnew(MonoGCHandle(new_weak_handle(p_object), WEAK_HANDLE));
}
void MonoGCHandle::release() {
@@ -59,7 +69,7 @@ void MonoGCHandle::release() {
#endif
if (!released && GDMono::get_singleton()->is_runtime_initialized()) {
- mono_gchandle_free(handle);
+ free_handle(handle);
released = true;
}
}
diff --git a/modules/mono/mono_gc_handle.h b/modules/mono/mono_gc_handle.h
index 7eeaba30e0..e5aa04e2b8 100644
--- a/modules/mono/mono_gc_handle.h
+++ b/modules/mono/mono_gc_handle.h
@@ -33,7 +33,7 @@
#include <mono/jit/jit.h>
-#include "reference.h"
+#include "core/reference.h"
class MonoGCHandle : public Reference {
@@ -49,12 +49,15 @@ public:
WEAK_HANDLE
};
- static uint32_t make_strong_handle(MonoObject *p_object);
- static uint32_t make_weak_handle(MonoObject *p_object);
+ static uint32_t new_strong_handle(MonoObject *p_object);
+ static uint32_t new_strong_handle_pinned(MonoObject *p_object);
+ static uint32_t new_weak_handle(MonoObject *p_object);
+ static void free_handle(uint32_t p_gchandle);
static Ref<MonoGCHandle> create_strong(MonoObject *p_object);
static Ref<MonoGCHandle> create_weak(MonoObject *p_object);
+ _FORCE_INLINE_ bool is_released() { return released; }
_FORCE_INLINE_ bool is_weak() { return weak; }
_FORCE_INLINE_ MonoObject *get_target() const { return released ? NULL : mono_gchandle_get_target(handle); }
diff --git a/modules/mono/mono_gd/gd_mono.cpp b/modules/mono/mono_gd/gd_mono.cpp
index fadac941e9..03418a02ea 100644
--- a/modules/mono/mono_gd/gd_mono.cpp
+++ b/modules/mono/mono_gd/gd_mono.cpp
@@ -35,13 +35,14 @@
#include <mono/metadata/mono-debug.h>
#include <mono/metadata/mono-gc.h>
-#include "os/dir_access.h"
-#include "os/file_access.h"
-#include "os/os.h"
-#include "os/thread.h"
-#include "project_settings.h"
+#include "core/os/dir_access.h"
+#include "core/os/file_access.h"
+#include "core/os/os.h"
+#include "core/os/thread.h"
+#include "core/project_settings.h"
#include "../csharp_script.h"
+#include "../glue/cs_glue_version.gen.h"
#include "../godotsharp_dirs.h"
#include "../utils/path_utils.h"
#include "gd_mono_class.h"
@@ -177,6 +178,30 @@ void GDMono::initialize() {
mono_set_dirs(assembly_dir.length() ? assembly_dir.get_data() : NULL,
config_dir.length() ? config_dir.get_data() : NULL);
+#elif OSX_ENABLED
+ mono_set_dirs(NULL, NULL);
+
+ {
+ const char *assembly_rootdir = mono_assembly_getrootdir();
+ const char *config_dir = mono_get_config_dir();
+
+ if (!assembly_rootdir || !config_dir || !DirAccess::exists(assembly_rootdir) || !DirAccess::exists(config_dir)) {
+ Vector<const char *> locations;
+ locations.push_back("/Library/Frameworks/Mono.framework/Versions/Current/");
+ locations.push_back("/usr/local/var/homebrew/linked/mono/");
+
+ for (int i = 0; i < locations.size(); i++) {
+ String hint_assembly_rootdir = path_join(locations[i], "lib");
+ String hint_mscorlib_path = path_join(hint_assembly_rootdir, "mono", "4.5", "mscorlib.dll");
+ String hint_config_dir = path_join(locations[i], "etc");
+
+ if (FileAccess::exists(hint_mscorlib_path) && DirAccess::exists(hint_config_dir)) {
+ mono_set_dirs(hint_assembly_rootdir.utf8().get_data(), hint_config_dir.utf8().get_data());
+ break;
+ }
+ }
+ }
+ }
#else
mono_set_dirs(NULL, NULL);
#endif
@@ -232,14 +257,14 @@ void GDMono::initialize() {
_register_internal_calls();
// The following assemblies are not required at initialization
-#ifndef MONO_GLUE_DISABLED
+#ifdef MONO_GLUE_ENABLED
if (_load_api_assemblies()) {
if (!core_api_assembly_out_of_sync && !editor_api_assembly_out_of_sync && GDMonoUtils::mono_cache.godot_api_cache_updated) {
// Everything is fine with the api assemblies, load the project assembly
_load_project_assembly();
} else {
#ifdef TOOLS_ENABLED
- // The assembly was successfuly loaded, but the full api could not be cached.
+ // The assembly was successfully loaded, but the full api could not be cached.
// This is most likely an outdated assembly loaded because of an invalid version in the metadata,
// so we invalidate the version in the metadata and unload the script domain.
@@ -275,7 +300,7 @@ void GDMono::initialize() {
print_verbose("Mono: INITIALIZED");
}
-#ifndef MONO_GLUE_DISABLED
+#ifdef MONO_GLUE_ENABLED
namespace GodotSharpBindings {
uint64_t get_core_api_hash();
@@ -283,14 +308,13 @@ uint64_t get_core_api_hash();
uint64_t get_editor_api_hash();
#endif // TOOLS_ENABLED
uint32_t get_bindings_version();
-uint32_t get_cs_glue_version();
void register_generated_icalls();
} // namespace GodotSharpBindings
#endif
void GDMono::_register_internal_calls() {
-#ifndef MONO_GLUE_DISABLED
+#ifdef MONO_GLUE_ENABLED
GodotSharpBindings::register_generated_icalls();
#endif
@@ -304,7 +328,7 @@ void GDMono::_initialize_and_check_api_hashes() {
api_core_hash = ClassDB::get_api_hash(ClassDB::API_CORE);
-#ifndef MONO_GLUE_DISABLED
+#ifdef MONO_GLUE_ENABLED
if (api_core_hash != GodotSharpBindings::get_core_api_hash()) {
ERR_PRINT("Mono: Core API hash mismatch!");
}
@@ -313,7 +337,7 @@ void GDMono::_initialize_and_check_api_hashes() {
#ifdef TOOLS_ENABLED
api_editor_hash = ClassDB::get_api_hash(ClassDB::API_EDITOR);
-#ifndef MONO_GLUE_DISABLED
+#ifdef MONO_GLUE_ENABLED
if (api_editor_hash != GodotSharpBindings::get_editor_api_hash()) {
ERR_PRINT("Mono: Editor API hash mismatch!");
}
@@ -431,11 +455,11 @@ bool GDMono::_load_core_api_assembly() {
bool success = load_assembly(API_ASSEMBLY_NAME, &core_api_assembly);
if (success) {
-#ifndef MONO_GLUE_DISABLED
+#ifdef MONO_GLUE_ENABLED
APIAssembly::Version api_assembly_ver = APIAssembly::Version::get_from_loaded_assembly(core_api_assembly, APIAssembly::API_CORE);
core_api_assembly_out_of_sync = GodotSharpBindings::get_core_api_hash() != api_assembly_ver.godot_api_hash ||
GodotSharpBindings::get_bindings_version() != api_assembly_ver.bindings_version ||
- GodotSharpBindings::get_cs_glue_version() != api_assembly_ver.cs_glue_version;
+ CS_GLUE_VERSION != api_assembly_ver.cs_glue_version;
#endif
GDMonoUtils::update_godot_api_cache();
}
@@ -457,11 +481,11 @@ bool GDMono::_load_editor_api_assembly() {
bool success = load_assembly(EDITOR_API_ASSEMBLY_NAME, &editor_api_assembly);
if (success) {
-#ifndef MONO_GLUE_DISABLED
+#ifdef MONO_GLUE_ENABLED
APIAssembly::Version api_assembly_ver = APIAssembly::Version::get_from_loaded_assembly(editor_api_assembly, APIAssembly::API_EDITOR);
editor_api_assembly_out_of_sync = GodotSharpBindings::get_editor_api_hash() != api_assembly_ver.godot_api_hash ||
GodotSharpBindings::get_bindings_version() != api_assembly_ver.bindings_version ||
- GodotSharpBindings::get_cs_glue_version() != api_assembly_ver.cs_glue_version;
+ CS_GLUE_VERSION != api_assembly_ver.cs_glue_version;
#endif
}
@@ -615,9 +639,7 @@ Error GDMono::_unload_scripts_domain() {
mono_gc_collect(mono_gc_max_generation());
- finalizing_scripts_domain = true;
mono_domain_finalize(scripts_domain, 2000);
- finalizing_scripts_domain = false;
mono_gc_collect(mono_gc_max_generation());
@@ -684,7 +706,7 @@ Error GDMono::reload_scripts_domain() {
return err;
}
-#ifndef MONO_GLUE_DISABLED
+#ifdef MONO_GLUE_ENABLED
if (!_load_api_assemblies()) {
return ERR_CANT_OPEN;
}
@@ -693,18 +715,20 @@ Error GDMono::reload_scripts_domain() {
// Everything is fine with the api assemblies, load the project assembly
_load_project_assembly();
} else {
- // The assembly was successfuly loaded, but the full api could not be cached.
+ // The assembly was successfully loaded, but the full api could not be cached.
// This is most likely an outdated assembly loaded because of an invalid version in the metadata,
// so we invalidate the version in the metadata and unload the script domain.
if (core_api_assembly_out_of_sync) {
+ ERR_PRINT("The loaded Core API assembly is out of sync");
metadata_set_api_assembly_invalidated(APIAssembly::API_CORE, true);
} else if (!GDMonoUtils::mono_cache.godot_api_cache_updated) {
- ERR_PRINT("Core API assembly is in sync, but the cache update failed");
+ ERR_PRINT("The loaded Core API assembly is in sync, but the cache update failed");
metadata_set_api_assembly_invalidated(APIAssembly::API_CORE, true);
}
if (editor_api_assembly_out_of_sync) {
+ ERR_PRINT("The loaded Editor API assembly is out of sync");
metadata_set_api_assembly_invalidated(APIAssembly::API_EDITOR, true);
}
@@ -813,7 +837,6 @@ GDMono::GDMono() {
gdmono_log = memnew(GDMonoLog);
runtime_initialized = false;
- finalizing_scripts_domain = false;
root_domain = NULL;
scripts_domain = NULL;
@@ -842,7 +865,7 @@ GDMono::GDMono() {
GDMono::~GDMono() {
- if (runtime_initialized) {
+ if (is_runtime_initialized()) {
if (scripts_domain) {
@@ -867,8 +890,9 @@ GDMono::~GDMono() {
print_verbose("Mono: Runtime cleanup...");
- runtime_initialized = false;
mono_jit_cleanup(root_domain);
+
+ runtime_initialized = false;
}
if (gdmono_log)
@@ -879,33 +903,12 @@ GDMono::~GDMono() {
_GodotSharp *_GodotSharp::singleton = NULL;
-void _GodotSharp::_dispose_object(Object *p_object) {
-
- if (p_object->get_script_instance()) {
- CSharpInstance *cs_instance = CAST_CSHARP_INSTANCE(p_object->get_script_instance());
- if (cs_instance) {
- cs_instance->mono_object_disposed();
- return;
- }
- }
-
- // Unsafe refcount decrement. The managed instance also counts as a reference.
- // See: CSharpLanguage::alloc_instance_binding_data(Object *p_object)
- if (Object::cast_to<Reference>(p_object)->unreference()) {
- memdelete(p_object);
- }
-}
-
void _GodotSharp::_dispose_callback() {
#ifndef NO_THREADS
queue_mutex->lock();
#endif
- for (List<Object *>::Element *E = obj_delete_queue.front(); E; E = E->next()) {
- _dispose_object(E->get());
- }
-
for (List<NodePath *>::Element *E = np_delete_queue.front(); E; E = E->next()) {
memdelete(E->get());
}
@@ -914,7 +917,6 @@ void _GodotSharp::_dispose_callback() {
memdelete(E->get());
}
- obj_delete_queue.clear();
np_delete_queue.clear();
rid_delete_queue.clear();
queue_empty = true;
@@ -934,52 +936,69 @@ void _GodotSharp::detach_thread() {
GDMonoUtils::detach_current_thread();
}
-bool _GodotSharp::is_finalizing_domain() {
+int32_t _GodotSharp::get_domain_id() {
- return GDMono::get_singleton()->is_finalizing_scripts_domain();
+ MonoDomain *domain = mono_domain_get();
+ CRASH_COND(!domain); // User must check if runtime is initialized before calling this method
+ return mono_domain_get_id(domain);
}
-bool _GodotSharp::is_domain_loaded() {
+int32_t _GodotSharp::get_scripts_domain_id() {
- return GDMono::get_singleton()->get_scripts_domain() != NULL;
+ MonoDomain *domain = SCRIPTS_DOMAIN;
+ CRASH_COND(!domain); // User must check if scripts domain is loaded before calling this method
+ return mono_domain_get_id(domain);
}
-#define ENQUEUE_FOR_DISPOSAL(m_queue, m_inst) \
- m_queue.push_back(m_inst); \
- if (queue_empty) { \
- queue_empty = false; \
- if (!is_finalizing_domain()) { /* call_deferred may not be safe here */ \
- call_deferred("_dispose_callback"); \
- } \
- }
+bool _GodotSharp::is_scripts_domain_loaded() {
-void _GodotSharp::queue_dispose(MonoObject *p_mono_object, Object *p_object) {
+ return GDMono::get_singleton()->is_runtime_initialized() && SCRIPTS_DOMAIN != NULL;
+}
- if (GDMonoUtils::is_main_thread() && !GDMono::get_singleton()->is_finalizing_scripts_domain()) {
- _dispose_object(p_object);
- } else {
-#ifndef NO_THREADS
- queue_mutex->lock();
-#endif
+bool _GodotSharp::_is_domain_finalizing_for_unload(int32_t p_domain_id) {
- // This is our last chance to invoke notification predelete (this is being called from the finalizer)
- // We must use the MonoObject* passed by the finalizer, because the weak GC handle target returns NULL at this point
- CSharpInstance *si = CAST_CSHARP_INSTANCE(p_object->get_script_instance());
- if (si) {
- si->call_notification_no_check(p_mono_object, Object::NOTIFICATION_PREDELETE);
- }
+ return is_domain_finalizing_for_unload(p_domain_id);
+}
- ENQUEUE_FOR_DISPOSAL(obj_delete_queue, p_object);
+bool _GodotSharp::is_domain_finalizing_for_unload() {
-#ifndef NO_THREADS
- queue_mutex->unlock();
-#endif
- }
+ return is_domain_finalizing_for_unload(mono_domain_get());
+}
+
+bool _GodotSharp::is_domain_finalizing_for_unload(int32_t p_domain_id) {
+
+ return is_domain_finalizing_for_unload(mono_domain_get_by_id(p_domain_id));
+}
+
+bool _GodotSharp::is_domain_finalizing_for_unload(MonoDomain *p_domain) {
+
+ if (!p_domain)
+ return true;
+ return mono_domain_is_unloading(p_domain);
+}
+
+bool _GodotSharp::is_runtime_shutting_down() {
+
+ return mono_runtime_is_shutting_down();
}
+bool _GodotSharp::is_runtime_initialized() {
+
+ return GDMono::get_singleton()->is_runtime_initialized();
+}
+
+#define ENQUEUE_FOR_DISPOSAL(m_queue, m_inst) \
+ m_queue.push_back(m_inst); \
+ if (queue_empty) { \
+ queue_empty = false; \
+ if (!is_domain_finalizing_for_unload(SCRIPTS_DOMAIN)) { /* call_deferred may not be safe here */ \
+ call_deferred("_dispose_callback"); \
+ } \
+ }
+
void _GodotSharp::queue_dispose(NodePath *p_node_path) {
- if (GDMonoUtils::is_main_thread() && !GDMono::get_singleton()->is_finalizing_scripts_domain()) {
+ if (GDMonoUtils::is_main_thread() && !is_domain_finalizing_for_unload(SCRIPTS_DOMAIN)) {
memdelete(p_node_path);
} else {
#ifndef NO_THREADS
@@ -996,7 +1015,7 @@ void _GodotSharp::queue_dispose(NodePath *p_node_path) {
void _GodotSharp::queue_dispose(RID *p_rid) {
- if (GDMonoUtils::is_main_thread() && !GDMono::get_singleton()->is_finalizing_scripts_domain()) {
+ if (GDMonoUtils::is_main_thread() && !is_domain_finalizing_for_unload(SCRIPTS_DOMAIN)) {
memdelete(p_rid);
} else {
#ifndef NO_THREADS
@@ -1016,8 +1035,13 @@ void _GodotSharp::_bind_methods() {
ClassDB::bind_method(D_METHOD("attach_thread"), &_GodotSharp::attach_thread);
ClassDB::bind_method(D_METHOD("detach_thread"), &_GodotSharp::detach_thread);
- ClassDB::bind_method(D_METHOD("is_finalizing_domain"), &_GodotSharp::is_finalizing_domain);
- ClassDB::bind_method(D_METHOD("is_domain_loaded"), &_GodotSharp::is_domain_loaded);
+ ClassDB::bind_method(D_METHOD("get_domain_id"), &_GodotSharp::get_domain_id);
+ ClassDB::bind_method(D_METHOD("get_scripts_domain_id"), &_GodotSharp::get_scripts_domain_id);
+ ClassDB::bind_method(D_METHOD("is_scripts_domain_loaded"), &_GodotSharp::is_scripts_domain_loaded);
+ ClassDB::bind_method(D_METHOD("is_domain_finalizing_for_unload", "domain_id"), &_GodotSharp::_is_domain_finalizing_for_unload);
+
+ ClassDB::bind_method(D_METHOD("is_runtime_shutting_down"), &_GodotSharp::is_runtime_shutting_down);
+ ClassDB::bind_method(D_METHOD("is_runtime_initialized"), &_GodotSharp::is_runtime_initialized);
ClassDB::bind_method(D_METHOD("_dispose_callback"), &_GodotSharp::_dispose_callback);
}
diff --git a/modules/mono/mono_gd/gd_mono.h b/modules/mono/mono_gd/gd_mono.h
index e0ec6ced5e..0c5503d28e 100644
--- a/modules/mono/mono_gd/gd_mono.h
+++ b/modules/mono/mono_gd/gd_mono.h
@@ -170,8 +170,7 @@ public:
void add_assembly(uint32_t p_domain_id, GDMonoAssembly *p_assembly);
GDMonoAssembly **get_loaded_assembly(const String &p_name);
- _FORCE_INLINE_ bool is_runtime_initialized() const { return runtime_initialized; }
- _FORCE_INLINE_ bool is_finalizing_scripts_domain() const { return finalizing_scripts_domain; }
+ _FORCE_INLINE_ bool is_runtime_initialized() const { return runtime_initialized && !mono_runtime_is_shutting_down() /* stays true after shutdown finished */; }
_FORCE_INLINE_ MonoDomain *get_scripts_domain() { return scripts_domain; }
#ifdef TOOLS_ENABLED
@@ -236,11 +235,10 @@ class _GodotSharp : public Object {
friend class GDMono;
- void _dispose_object(Object *p_object);
-
void _dispose_callback();
- List<Object *> obj_delete_queue;
+ bool _is_domain_finalizing_for_unload(int32_t p_domain_id);
+
List<NodePath *> np_delete_queue;
List<RID *> rid_delete_queue;
@@ -260,10 +258,18 @@ public:
void attach_thread();
void detach_thread();
- bool is_finalizing_domain();
- bool is_domain_loaded();
+ int32_t get_domain_id();
+ int32_t get_scripts_domain_id();
+
+ bool is_scripts_domain_loaded();
+
+ bool is_domain_finalizing_for_unload();
+ bool is_domain_finalizing_for_unload(int32_t p_domain_id);
+ bool is_domain_finalizing_for_unload(MonoDomain *p_domain);
+
+ bool is_runtime_shutting_down();
+ bool is_runtime_initialized();
- void queue_dispose(MonoObject *p_mono_object, Object *p_object);
void queue_dispose(NodePath *p_node_path);
void queue_dispose(RID *p_rid);
diff --git a/modules/mono/mono_gd/gd_mono_assembly.h b/modules/mono/mono_gd/gd_mono_assembly.h
index 2c6d367fc6..0ba11ac412 100644
--- a/modules/mono/mono_gd/gd_mono_assembly.h
+++ b/modules/mono/mono_gd/gd_mono_assembly.h
@@ -34,10 +34,10 @@
#include <mono/jit/jit.h>
#include <mono/metadata/assembly.h>
+#include "core/hash_map.h"
+#include "core/map.h"
+#include "core/ustring.h"
#include "gd_mono_utils.h"
-#include "hash_map.h"
-#include "map.h"
-#include "ustring.h"
class GDMonoAssembly {
diff --git a/modules/mono/mono_gd/gd_mono_class.h b/modules/mono/mono_gd/gd_mono_class.h
index f4e386549a..477305d503 100644
--- a/modules/mono/mono_gd/gd_mono_class.h
+++ b/modules/mono/mono_gd/gd_mono_class.h
@@ -33,8 +33,8 @@
#include <mono/metadata/debug-helpers.h>
-#include "map.h"
-#include "ustring.h"
+#include "core/map.h"
+#include "core/ustring.h"
#include "gd_mono_field.h"
#include "gd_mono_header.h"
diff --git a/modules/mono/mono_gd/gd_mono_header.h b/modules/mono/mono_gd/gd_mono_header.h
index 72a5439044..2fe05006f1 100644
--- a/modules/mono/mono_gd/gd_mono_header.h
+++ b/modules/mono/mono_gd/gd_mono_header.h
@@ -31,7 +31,7 @@
#ifndef GD_MONO_HEADER_H
#define GD_MONO_HEADER_H
-#include "int_types.h"
+#include "core/int_types.h"
class GDMonoAssembly;
class GDMonoClass;
diff --git a/modules/mono/mono_gd/gd_mono_log.cpp b/modules/mono/mono_gd/gd_mono_log.cpp
index 5224d309de..b7bb2cb2d6 100644
--- a/modules/mono/mono_gd/gd_mono_log.cpp
+++ b/modules/mono/mono_gd/gd_mono_log.cpp
@@ -33,8 +33,8 @@
#include <mono/utils/mono-logger.h>
#include <stdlib.h> // abort
-#include "os/dir_access.h"
-#include "os/os.h"
+#include "core/os/dir_access.h"
+#include "core/os/os.h"
#include "../godotsharp_dirs.h"
diff --git a/modules/mono/mono_gd/gd_mono_log.h b/modules/mono/mono_gd/gd_mono_log.h
index a7e374858c..3b4ff07b7b 100644
--- a/modules/mono/mono_gd/gd_mono_log.h
+++ b/modules/mono/mono_gd/gd_mono_log.h
@@ -31,7 +31,7 @@
#ifndef GD_MONO_LOG_H
#define GD_MONO_LOG_H
-#include "os/file_access.h"
+#include "core/os/file_access.h"
class GDMonoLog {
diff --git a/modules/mono/mono_gd/gd_mono_marshal.h b/modules/mono/mono_gd/gd_mono_marshal.h
index 464f584a0a..1ad0a4a6ea 100644
--- a/modules/mono/mono_gd/gd_mono_marshal.h
+++ b/modules/mono/mono_gd/gd_mono_marshal.h
@@ -31,9 +31,9 @@
#ifndef GDMONOMARSHAL_H
#define GDMONOMARSHAL_H
+#include "core/variant.h"
#include "gd_mono.h"
#include "gd_mono_utils.h"
-#include "variant.h"
namespace GDMonoMarshal {
diff --git a/modules/mono/mono_gd/gd_mono_utils.cpp b/modules/mono/mono_gd/gd_mono_utils.cpp
index c1f56bc3d2..8fbaca0992 100644
--- a/modules/mono/mono_gd/gd_mono_utils.cpp
+++ b/modules/mono/mono_gd/gd_mono_utils.cpp
@@ -32,10 +32,10 @@
#include <mono/metadata/exception.h>
-#include "os/dir_access.h"
-#include "os/os.h"
-#include "project_settings.h"
-#include "reference.h"
+#include "core/os/dir_access.h"
+#include "core/os/os.h"
+#include "core/project_settings.h"
+#include "core/reference.h"
#include "../csharp_script.h"
#include "../utils/macros.h"
@@ -138,6 +138,7 @@ void MonoCache::clear_members() {
field_Image_ptr = NULL;
field_RID_ptr = NULL;
+ methodthunk_GodotObject_Dispose = NULL;
methodthunk_Array_GetPtr = NULL;
methodthunk_Dictionary_GetPtr = NULL;
methodthunk_MarshalUtils_IsArrayGenericType = NULL;
@@ -235,6 +236,7 @@ void update_godot_api_cache() {
CACHE_FIELD_AND_CHECK(NodePath, ptr, CACHED_CLASS(NodePath)->get_field(BINDINGS_PTR_FIELD));
CACHE_FIELD_AND_CHECK(RID, ptr, CACHED_CLASS(RID)->get_field(BINDINGS_PTR_FIELD));
+ CACHE_METHOD_THUNK_AND_CHECK(GodotObject, Dispose, (GodotObject_Dispose)CACHED_CLASS(GodotObject)->get_method_thunk("Dispose", 0));
CACHE_METHOD_THUNK_AND_CHECK(Array, GetPtr, (Array_GetPtr)GODOT_API_NS_CLAS(BINDINGS_NAMESPACE_COLLECTIONS, Array)->get_method_thunk("GetPtr", 0));
CACHE_METHOD_THUNK_AND_CHECK(Dictionary, GetPtr, (Dictionary_GetPtr)GODOT_API_NS_CLAS(BINDINGS_NAMESPACE_COLLECTIONS, Dictionary)->get_method_thunk("GetPtr", 0));
CACHE_METHOD_THUNK_AND_CHECK(MarshalUtils, IsArrayGenericType, (IsArrayGenericType)GODOT_API_CLASS(MarshalUtils)->get_method_thunk("IsArrayGenericType", 1));
@@ -247,7 +249,7 @@ void update_godot_api_cache() {
CACHE_METHOD_THUNK_AND_CHECK(DebuggingUtils, GetStackFrameInfo, (DebugUtils_StackFrameInfo)GODOT_API_CLASS(DebuggingUtils)->get_method_thunk("GetStackFrameInfo", 4));
#endif
- // TODO Move to CSharpLanguage::init()
+ // TODO Move to CSharpLanguage::init() and do handle disposal
MonoObject *task_scheduler = mono_object_new(SCRIPTS_DOMAIN, GODOT_API_CLASS(GodotTaskScheduler)->get_mono_ptr());
GDMonoUtils::runtime_object_init(task_scheduler);
mono_cache.task_scheduler_handle = MonoGCHandle::create_strong(task_scheduler);
@@ -270,11 +272,48 @@ MonoObject *unmanaged_get_managed(Object *unmanaged) {
}
}
- // Only called if the owner does not have a CSharpInstance
+ // If the owner does not have a CSharpInstance...
+
void *data = unmanaged->get_script_instance_binding(CSharpLanguage::get_singleton()->get_language_index());
if (data) {
- return ((Map<Object *, Ref<MonoGCHandle> >::Element *)data)->value()->get_target();
+ CSharpScriptBinding &script_binding = ((Map<Object *, CSharpScriptBinding>::Element *)data)->value();
+
+ Ref<MonoGCHandle> &gchandle = script_binding.gchandle;
+ ERR_FAIL_COND_V(gchandle.is_null(), NULL);
+
+ MonoObject *target = gchandle->get_target();
+
+ if (target)
+ return target;
+
+ CSharpLanguage::get_singleton()->release_script_gchandle(gchandle);
+
+ // Create a new one
+
+#ifdef DEBUG_ENABLED
+ CRASH_COND(script_binding.type_name == StringName());
+ CRASH_COND(script_binding.wrapper_class == NULL);
+#endif
+
+ MonoObject *mono_object = GDMonoUtils::create_managed_for_godot_object(script_binding.wrapper_class, script_binding.type_name, unmanaged);
+ ERR_FAIL_NULL_V(mono_object, NULL);
+
+ gchandle->set_handle(MonoGCHandle::new_strong_handle(mono_object), MonoGCHandle::STRONG_HANDLE);
+
+ // Tie managed to unmanaged
+ Reference *ref = Object::cast_to<Reference>(unmanaged);
+
+ if (ref) {
+ // Unsafe refcount increment. The managed instance also counts as a reference.
+ // This way if the unmanaged world has no references to our owner
+ // but the managed instance is alive, the refcount will be 1 instead of 0.
+ // See: godot_icall_Reference_Dtor(MonoObject *p_obj, Object *p_ptr)
+
+ ref->reference();
+ }
+
+ return mono_object;
}
}
@@ -304,6 +343,7 @@ MonoThread *get_current_thread() {
void runtime_object_init(MonoObject *p_this_obj) {
GD_MONO_BEGIN_RUNTIME_INVOKE;
+ // FIXME: Do not use mono_runtime_object_init, it aborts if an exception is thrown
mono_runtime_object_init(p_this_obj);
GD_MONO_END_RUNTIME_INVOKE;
}
@@ -623,4 +663,33 @@ MonoObject *property_get_value(MonoProperty *p_prop, void *p_obj, void **p_param
return ret;
}
+uint64_t unbox_enum_value(MonoObject *p_boxed, MonoType *p_enum_basetype, bool &r_error) {
+ r_error = false;
+ switch (mono_type_get_type(p_enum_basetype)) {
+ case MONO_TYPE_BOOLEAN:
+ return (bool)GDMonoMarshal::unbox<MonoBoolean>(p_boxed) ? 1 : 0;
+ case MONO_TYPE_CHAR:
+ return GDMonoMarshal::unbox<uint16_t>(p_boxed);
+ case MONO_TYPE_U1:
+ return GDMonoMarshal::unbox<uint8_t>(p_boxed);
+ case MONO_TYPE_U2:
+ return GDMonoMarshal::unbox<uint16_t>(p_boxed);
+ case MONO_TYPE_U4:
+ return GDMonoMarshal::unbox<uint32_t>(p_boxed);
+ case MONO_TYPE_U8:
+ return GDMonoMarshal::unbox<uint64_t>(p_boxed);
+ case MONO_TYPE_I1:
+ return GDMonoMarshal::unbox<int8_t>(p_boxed);
+ case MONO_TYPE_I2:
+ return GDMonoMarshal::unbox<int16_t>(p_boxed);
+ case MONO_TYPE_I4:
+ return GDMonoMarshal::unbox<int32_t>(p_boxed);
+ case MONO_TYPE_I8:
+ return GDMonoMarshal::unbox<int64_t>(p_boxed);
+ default:
+ r_error = true;
+ return 0;
+ }
+}
+
} // namespace GDMonoUtils
diff --git a/modules/mono/mono_gd/gd_mono_utils.h b/modules/mono/mono_gd/gd_mono_utils.h
index bf8860c85a..96ff3e8116 100644
--- a/modules/mono/mono_gd/gd_mono_utils.h
+++ b/modules/mono/mono_gd/gd_mono_utils.h
@@ -38,8 +38,8 @@
#include "../utils/thread_local.h"
#include "gd_mono_header.h"
-#include "object.h"
-#include "reference.h"
+#include "core/object.h"
+#include "core/reference.h"
#define UNLIKELY_UNHANDLED_EXCEPTION(m_exc) \
if (unlikely(m_exc != NULL)) { \
@@ -49,6 +49,7 @@
namespace GDMonoUtils {
+typedef void (*GodotObject_Dispose)(MonoObject *, MonoObject **);
typedef Array *(*Array_GetPtr)(MonoObject *, MonoObject **);
typedef Dictionary *(*Dictionary_GetPtr)(MonoObject *, MonoObject **);
typedef MonoObject *(*SignalAwaiter_SignalCallback)(MonoObject *, MonoArray *, MonoObject **);
@@ -141,6 +142,7 @@ struct MonoCache {
GDMonoField *field_Image_ptr;
GDMonoField *field_RID_ptr;
+ GodotObject_Dispose methodthunk_GodotObject_Dispose;
Array_GetPtr methodthunk_Array_GetPtr;
Dictionary_GetPtr methodthunk_Dictionary_GetPtr;
IsArrayGenericType methodthunk_MarshalUtils_IsArrayGenericType;
@@ -238,6 +240,8 @@ MonoString *object_to_string(MonoObject *p_obj, MonoException **p_exc);
void property_set_value(MonoProperty *p_prop, void *p_obj, void **p_params, MonoException **p_exc);
MonoObject *property_get_value(MonoProperty *p_prop, void *p_obj, void **p_params, MonoException **p_exc);
+uint64_t unbox_enum_value(MonoObject *p_boxed, MonoType *p_enum_basetype, bool &r_error);
+
} // namespace GDMonoUtils
#define NATIVE_GDMONOCLASS_NAME(m_class) (GDMonoMarshal::mono_string_to_godot((MonoString *)m_class->get_field(BINDINGS_NATIVE_NAME_FIELD)->get_value(NULL)))
diff --git a/modules/mono/register_types.cpp b/modules/mono/register_types.cpp
index 4410996546..f6cb143e8e 100644
--- a/modules/mono/register_types.cpp
+++ b/modules/mono/register_types.cpp
@@ -30,7 +30,7 @@
#include "register_types.h"
-#include "engine.h"
+#include "core/engine.h"
#include "csharp_script.h"
diff --git a/modules/mono/signal_awaiter_utils.cpp b/modules/mono/signal_awaiter_utils.cpp
index add1e506ea..b4c78df538 100644
--- a/modules/mono/signal_awaiter_utils.cpp
+++ b/modules/mono/signal_awaiter_utils.cpp
@@ -119,7 +119,7 @@ void SignalAwaiterHandle::_bind_methods() {
}
SignalAwaiterHandle::SignalAwaiterHandle(MonoObject *p_managed) :
- MonoGCHandle(MonoGCHandle::make_strong_handle(p_managed), STRONG_HANDLE) {
+ MonoGCHandle(MonoGCHandle::new_strong_handle(p_managed), STRONG_HANDLE) {
#ifdef DEBUG_ENABLED
conn_target_id = 0;
diff --git a/modules/mono/signal_awaiter_utils.h b/modules/mono/signal_awaiter_utils.h
index 1920432709..4ec860537b 100644
--- a/modules/mono/signal_awaiter_utils.h
+++ b/modules/mono/signal_awaiter_utils.h
@@ -31,8 +31,8 @@
#ifndef SIGNAL_AWAITER_UTILS_H
#define SIGNAL_AWAITER_UTILS_H
+#include "core/reference.h"
#include "mono_gc_handle.h"
-#include "reference.h"
namespace SignalAwaiterUtils {
diff --git a/modules/mono/utils/mono_reg_utils.cpp b/modules/mono/utils/mono_reg_utils.cpp
index 7b23cd7579..8116df5f51 100644
--- a/modules/mono/utils/mono_reg_utils.cpp
+++ b/modules/mono/utils/mono_reg_utils.cpp
@@ -32,7 +32,7 @@
#ifdef WINDOWS_ENABLED
-#include "os/os.h"
+#include "core/os/os.h"
// Here, after os/os.h
#include <windows.h>
diff --git a/modules/mono/utils/mono_reg_utils.h b/modules/mono/utils/mono_reg_utils.h
index edf31f5a07..26f7e2d3c2 100644
--- a/modules/mono/utils/mono_reg_utils.h
+++ b/modules/mono/utils/mono_reg_utils.h
@@ -33,7 +33,7 @@
#ifdef WINDOWS_ENABLED
-#include "ustring.h"
+#include "core/ustring.h"
struct MonoRegInfo {
diff --git a/modules/mono/utils/path_utils.cpp b/modules/mono/utils/path_utils.cpp
index 4b77aeb54e..ea942a9a8e 100644
--- a/modules/mono/utils/path_utils.cpp
+++ b/modules/mono/utils/path_utils.cpp
@@ -30,10 +30,10 @@
#include "path_utils.h"
-#include "os/dir_access.h"
-#include "os/file_access.h"
-#include "os/os.h"
-#include "project_settings.h"
+#include "core/os/dir_access.h"
+#include "core/os/file_access.h"
+#include "core/os/os.h"
+#include "core/project_settings.h"
#ifdef WINDOWS_ENABLED
#define ENV_PATH_SEP ";"
diff --git a/modules/mono/utils/path_utils.h b/modules/mono/utils/path_utils.h
index 184cacfac7..3c7b36c0d4 100644
--- a/modules/mono/utils/path_utils.h
+++ b/modules/mono/utils/path_utils.h
@@ -31,7 +31,7 @@
#ifndef PATH_UTILS_H
#define PATH_UTILS_H
-#include "ustring.h"
+#include "core/ustring.h"
_FORCE_INLINE_ String path_join(const String &e1, const String &e2) {
return e1.plus_file(e2);
diff --git a/modules/mono/utils/string_utils.h b/modules/mono/utils/string_utils.h
index 5dddaee6e8..f2df2340ae 100644
--- a/modules/mono/utils/string_utils.h
+++ b/modules/mono/utils/string_utils.h
@@ -31,8 +31,8 @@
#ifndef STRING_FORMAT_H
#define STRING_FORMAT_H
-#include "ustring.h"
-#include "variant.h"
+#include "core/ustring.h"
+#include "core/variant.h"
String sformat(const String &p_text, const Variant &p1 = Variant(), const Variant &p2 = Variant(), const Variant &p3 = Variant(), const Variant &p4 = Variant(), const Variant &p5 = Variant());
diff --git a/modules/opus/audio_stream_opus.cpp b/modules/opus/audio_stream_opus.cpp
index 8323ff33ac..3920b3cd6e 100644
--- a/modules/opus/audio_stream_opus.cpp
+++ b/modules/opus/audio_stream_opus.cpp
@@ -142,7 +142,7 @@ Error AudioStreamPlaybackOpus::_load_stream() {
} break;
case OP_EBADLINK: // - Failed to find old data after seeking.
case OP_EBADTIMESTAMP: // - Timestamp failed the validity checks.
- case OP_EBADHEADER: { // - Invalid or mising Opus bitstream header.
+ case OP_EBADHEADER: { // - Invalid or missing Opus bitstream header.
memdelete(f);
f = NULL;
ERR_FAIL_V(ERR_FILE_CORRUPT);
@@ -208,7 +208,7 @@ Error AudioStreamPlaybackOpus::set_file(const String &p_file) {
} break;
case OP_EBADLINK: // - Failed to find old data after seeking.
case OP_EBADTIMESTAMP: // - Timestamp failed the validity checks.
- case OP_EBADHEADER: { // - Invalid or mising Opus bitstream header.
+ case OP_EBADHEADER: { // - Invalid or missing Opus bitstream header.
memdelete(f);
f = NULL;
ERR_FAIL_V(ERR_FILE_CORRUPT);
diff --git a/modules/opus/audio_stream_opus.h b/modules/opus/audio_stream_opus.h
index 3ffdaf2c18..c004adeb77 100644
--- a/modules/opus/audio_stream_opus.h
+++ b/modules/opus/audio_stream_opus.h
@@ -31,8 +31,8 @@
#ifndef AUDIO_STREAM_OPUS_H
#define AUDIO_STREAM_OPUS_H
-#include "io/resource_loader.h"
-#include "os/file_access.h"
+#include "core/io/resource_loader.h"
+#include "core/os/file_access.h"
#include "scene/resources/audio_stream.h"
#include <opus/opusfile.h>
diff --git a/modules/pvr/texture_loader_pvr.cpp b/modules/pvr/texture_loader_pvr.cpp
index 6ec44023c1..e6718eb4a2 100644
--- a/modules/pvr/texture_loader_pvr.cpp
+++ b/modules/pvr/texture_loader_pvr.cpp
@@ -31,7 +31,7 @@
#include "texture_loader_pvr.h"
#include "PvrTcEncoder.h"
#include "RgbaBitmap.h"
-#include "os/file_access.h"
+#include "core/os/file_access.h"
#include <string.h>
static void _pvrtc_decompress(Image *p_img);
diff --git a/modules/pvr/texture_loader_pvr.h b/modules/pvr/texture_loader_pvr.h
index 9369178336..c859a4cdda 100644
--- a/modules/pvr/texture_loader_pvr.h
+++ b/modules/pvr/texture_loader_pvr.h
@@ -31,7 +31,7 @@
#ifndef TEXTURE_LOADER_PVR_H
#define TEXTURE_LOADER_PVR_H
-#include "io/resource_loader.h"
+#include "core/io/resource_loader.h"
#include "scene/resources/texture.h"
class ResourceFormatPVR : public ResourceFormatLoader {
diff --git a/modules/recast/navigation_mesh_editor_plugin.cpp b/modules/recast/navigation_mesh_editor_plugin.cpp
index 8556b7aa0a..98351fbaee 100644
--- a/modules/recast/navigation_mesh_editor_plugin.cpp
+++ b/modules/recast/navigation_mesh_editor_plugin.cpp
@@ -30,8 +30,8 @@
#include "navigation_mesh_editor_plugin.h"
-#include "io/marshalls.h"
-#include "io/resource_saver.h"
+#include "core/io/marshalls.h"
+#include "core/io/resource_saver.h"
#include "scene/3d/mesh_instance.h"
#include "scene/gui/box_container.h"
diff --git a/modules/recast/navigation_mesh_generator.h b/modules/recast/navigation_mesh_generator.h
index 3588539ef1..2f2f57d721 100644
--- a/modules/recast/navigation_mesh_generator.h
+++ b/modules/recast/navigation_mesh_generator.h
@@ -31,9 +31,9 @@
#ifndef NAVIGATION_MESH_GENERATOR_H
#define NAVIGATION_MESH_GENERATOR_H
+#include "core/os/thread.h"
#include "editor/editor_node.h"
#include "editor/editor_settings.h"
-#include "os/thread.h"
#include "scene/3d/mesh_instance.h"
#include "scene/3d/navigation_mesh.h"
#include "scene/resources/shape.h"
diff --git a/modules/regex/register_types.cpp b/modules/regex/register_types.cpp
index 14eba69ee0..73e2c5022d 100644
--- a/modules/regex/register_types.cpp
+++ b/modules/regex/register_types.cpp
@@ -29,7 +29,7 @@
/*************************************************************************/
#include "register_types.h"
-#include "class_db.h"
+#include "core/class_db.h"
#include "regex.h"
void register_regex_types() {
diff --git a/modules/squish/image_compress_squish.cpp b/modules/squish/image_compress_squish.cpp
index bb8a4bdbea..26cb76011c 100644
--- a/modules/squish/image_compress_squish.cpp
+++ b/modules/squish/image_compress_squish.cpp
@@ -30,7 +30,7 @@
#include "image_compress_squish.h"
-#include "print_string.h"
+#include "core/print_string.h"
#include <squish.h>
diff --git a/modules/squish/image_compress_squish.h b/modules/squish/image_compress_squish.h
index 6da947beea..dfebdc955f 100644
--- a/modules/squish/image_compress_squish.h
+++ b/modules/squish/image_compress_squish.h
@@ -31,7 +31,7 @@
#ifndef IMAGE_COMPRESS_SQUISH_H
#define IMAGE_COMPRESS_SQUISH_H
-#include "image.h"
+#include "core/image.h"
void image_compress_squish(Image *p_image, float p_lossy_quality, Image::CompressSource p_source);
void image_decompress_squish(Image *p_image);
diff --git a/modules/stb_vorbis/audio_stream_ogg_vorbis.cpp b/modules/stb_vorbis/audio_stream_ogg_vorbis.cpp
index 0e533d3978..57b6b5343e 100644
--- a/modules/stb_vorbis/audio_stream_ogg_vorbis.cpp
+++ b/modules/stb_vorbis/audio_stream_ogg_vorbis.cpp
@@ -30,7 +30,7 @@
#include "audio_stream_ogg_vorbis.h"
-#include "os/file_access.h"
+#include "core/os/file_access.h"
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wmaybe-uninitialized"
diff --git a/modules/stb_vorbis/audio_stream_ogg_vorbis.h b/modules/stb_vorbis/audio_stream_ogg_vorbis.h
index d7bc7cc0d7..71a957a6af 100644
--- a/modules/stb_vorbis/audio_stream_ogg_vorbis.h
+++ b/modules/stb_vorbis/audio_stream_ogg_vorbis.h
@@ -31,7 +31,7 @@
#ifndef AUDIO_STREAM_STB_VORBIS_H
#define AUDIO_STREAM_STB_VORBIS_H
-#include "io/resource_loader.h"
+#include "core/io/resource_loader.h"
#include "servers/audio/audio_stream.h"
#define STB_VORBIS_HEADER_ONLY
diff --git a/modules/stb_vorbis/resource_importer_ogg_vorbis.cpp b/modules/stb_vorbis/resource_importer_ogg_vorbis.cpp
index c8acdb689a..74f2e68206 100644
--- a/modules/stb_vorbis/resource_importer_ogg_vorbis.cpp
+++ b/modules/stb_vorbis/resource_importer_ogg_vorbis.cpp
@@ -30,8 +30,8 @@
#include "resource_importer_ogg_vorbis.h"
-#include "io/resource_saver.h"
-#include "os/file_access.h"
+#include "core/io/resource_saver.h"
+#include "core/os/file_access.h"
#include "scene/resources/texture.h"
String ResourceImporterOGGVorbis::get_importer_name() const {
diff --git a/modules/stb_vorbis/resource_importer_ogg_vorbis.h b/modules/stb_vorbis/resource_importer_ogg_vorbis.h
index a1847545aa..82a03cd207 100644
--- a/modules/stb_vorbis/resource_importer_ogg_vorbis.h
+++ b/modules/stb_vorbis/resource_importer_ogg_vorbis.h
@@ -32,7 +32,7 @@
#define RESOURCEIMPORTEROGGVORBIS_H
#include "audio_stream_ogg_vorbis.h"
-#include "io/resource_import.h"
+#include "core/io/resource_import.h"
class ResourceImporterOGGVorbis : public ResourceImporter {
GDCLASS(ResourceImporterOGGVorbis, ResourceImporter)
diff --git a/modules/svg/image_loader_svg.cpp b/modules/svg/image_loader_svg.cpp
index 8ccd229f3d..ccb7d93885 100644
--- a/modules/svg/image_loader_svg.cpp
+++ b/modules/svg/image_loader_svg.cpp
@@ -30,10 +30,9 @@
#include "image_loader_svg.h"
-#include "os/os.h"
-#include "print_string.h"
-
-#include <ustring.h>
+#include "core/os/os.h"
+#include "core/print_string.h"
+#include "core/ustring.h"
void SVGRasterizer::rasterize(NSVGimage *p_image, float p_tx, float p_ty, float p_scale, unsigned char *p_dst, int p_w, int p_h, int p_stride) {
nsvgRasterize(rasterizer, p_image, p_tx, p_ty, p_scale, p_dst, p_w, p_h, p_stride);
diff --git a/modules/svg/image_loader_svg.h b/modules/svg/image_loader_svg.h
index 63854da2f6..ff361ad800 100644
--- a/modules/svg/image_loader_svg.h
+++ b/modules/svg/image_loader_svg.h
@@ -31,8 +31,8 @@
#ifndef IMAGE_LOADER_SVG_H
#define IMAGE_LOADER_SVG_H
-#include "io/image_loader.h"
-#include "ustring.h"
+#include "core/io/image_loader.h"
+#include "core/ustring.h"
#include <nanosvg.h>
#include <nanosvgrast.h>
diff --git a/modules/tga/image_loader_tga.cpp b/modules/tga/image_loader_tga.cpp
index d4fa88afa7..9bc24017fc 100644
--- a/modules/tga/image_loader_tga.cpp
+++ b/modules/tga/image_loader_tga.cpp
@@ -30,8 +30,8 @@
#include "image_loader_tga.h"
-#include "os/os.h"
-#include "print_string.h"
+#include "core/os/os.h"
+#include "core/print_string.h"
Error ImageLoaderTGA::decode_tga_rle(const uint8_t *p_compressed_buffer, size_t p_pixel_size, uint8_t *p_uncompressed_buffer, size_t p_output_size) {
Error error;
diff --git a/modules/tga/image_loader_tga.h b/modules/tga/image_loader_tga.h
index c4b10b7f49..0fe83a54a1 100644
--- a/modules/tga/image_loader_tga.h
+++ b/modules/tga/image_loader_tga.h
@@ -31,7 +31,7 @@
#ifndef IMAGE_LOADER_TGA_H
#define IMAGE_LOADER_TGA_H
-#include "io/image_loader.h"
+#include "core/io/image_loader.h"
/**
@author SaracenOne
diff --git a/modules/thekla_unwrap/register_types.cpp b/modules/thekla_unwrap/register_types.cpp
index c74cbd9d18..8e733d1ad2 100644
--- a/modules/thekla_unwrap/register_types.cpp
+++ b/modules/thekla_unwrap/register_types.cpp
@@ -29,7 +29,7 @@
/*************************************************************************/
#include "register_types.h"
-#include "error_macros.h"
+#include "core/error_macros.h"
#include "thirdparty/thekla_atlas/thekla/thekla_atlas.h"
#include <stdio.h>
diff --git a/modules/theora/video_stream_theora.cpp b/modules/theora/video_stream_theora.cpp
index 68087ac01f..44052d473f 100644
--- a/modules/theora/video_stream_theora.cpp
+++ b/modules/theora/video_stream_theora.cpp
@@ -30,8 +30,8 @@
#include "video_stream_theora.h"
-#include "os/os.h"
-#include "project_settings.h"
+#include "core/os/os.h"
+#include "core/project_settings.h"
#include "thirdparty/misc/yuv2rgb.h"
diff --git a/modules/theora/video_stream_theora.h b/modules/theora/video_stream_theora.h
index 1aba3f56da..4be723f85b 100644
--- a/modules/theora/video_stream_theora.h
+++ b/modules/theora/video_stream_theora.h
@@ -31,11 +31,11 @@
#ifndef VIDEO_STREAM_THEORA_H
#define VIDEO_STREAM_THEORA_H
-#include "io/resource_loader.h"
-#include "os/file_access.h"
-#include "os/semaphore.h"
-#include "os/thread.h"
-#include "ring_buffer.h"
+#include "core/io/resource_loader.h"
+#include "core/os/file_access.h"
+#include "core/os/semaphore.h"
+#include "core/os/thread.h"
+#include "core/ring_buffer.h"
#include "scene/resources/video_stream.h"
#include "servers/audio_server.h"
diff --git a/modules/tinyexr/image_loader_tinyexr.cpp b/modules/tinyexr/image_loader_tinyexr.cpp
index b19bcfefcb..63f0781028 100644
--- a/modules/tinyexr/image_loader_tinyexr.cpp
+++ b/modules/tinyexr/image_loader_tinyexr.cpp
@@ -30,8 +30,8 @@
#include "image_loader_tinyexr.h"
-#include "os/os.h"
-#include "print_string.h"
+#include "core/os/os.h"
+#include "core/print_string.h"
#include "thirdparty/tinyexr/tinyexr.h"
diff --git a/modules/tinyexr/image_loader_tinyexr.h b/modules/tinyexr/image_loader_tinyexr.h
index 6706e0972a..a6ef9000e5 100644
--- a/modules/tinyexr/image_loader_tinyexr.h
+++ b/modules/tinyexr/image_loader_tinyexr.h
@@ -31,7 +31,7 @@
#ifndef IMAGE_LOADER_TINYEXR_H
#define IMAGE_LOADER_TINYEXR_H
-#include "io/image_loader.h"
+#include "core/io/image_loader.h"
/**
@author Juan Linietsky <reduzio@gmail.com>
diff --git a/modules/upnp/doc_classes/UPNP.xml b/modules/upnp/doc_classes/UPNP.xml
index 30be9c836b..b98327c60d 100644
--- a/modules/upnp/doc_classes/UPNP.xml
+++ b/modules/upnp/doc_classes/UPNP.xml
@@ -69,7 +69,7 @@
</argument>
<description>
Discovers local [UPNPDevice]s. Clears the list of previously discovered devices.
- Filters for IGD (InternetGatewayDevice) type devices by default, as those manage port forwarding. [code]timeout[/code] is the time to wait for responses in miliseconds. [code]ttl[/code] is the time-to-live; only touch this if you know what you're doing.
+ Filters for IGD (InternetGatewayDevice) type devices by default, as those manage port forwarding. [code]timeout[/code] is the time to wait for responses in milliseconds. [code]ttl[/code] is the time-to-live; only touch this if you know what you're doing.
See [enum UPNPResult] for possible return values.
</description>
</method>
diff --git a/modules/upnp/register_types.cpp b/modules/upnp/register_types.cpp
index c79155c4d2..13088c94dd 100644
--- a/modules/upnp/register_types.cpp
+++ b/modules/upnp/register_types.cpp
@@ -29,7 +29,9 @@
/*************************************************************************/
#include "register_types.h"
-#include "error_macros.h"
+
+#include "core/error_macros.h"
+
#include "upnp.h"
#include "upnpdevice.h"
diff --git a/modules/upnp/upnp.cpp b/modules/upnp/upnp.cpp
index 32fdfe22f8..69e054f5c5 100644
--- a/modules/upnp/upnp.cpp
+++ b/modules/upnp/upnp.cpp
@@ -29,8 +29,10 @@
/*************************************************************************/
#include "upnp.h"
-#include "miniupnpc/miniwget.h"
-#include "upnpcommands.h"
+
+#include <miniupnpc/miniwget.h>
+#include <miniupnpc/upnpcommands.h>
+
#include <stdlib.h>
bool UPNP::is_common_device(const String &dev) const {
diff --git a/modules/upnp/upnp.h b/modules/upnp/upnp.h
index fb0c0f30a0..8f0a972c22 100644
--- a/modules/upnp/upnp.h
+++ b/modules/upnp/upnp.h
@@ -31,9 +31,11 @@
#ifndef GODOT_UPNP_H
#define GODOT_UPNP_H
-#include "miniupnpc/miniupnpc.h"
+#include "core/reference.h"
+
#include "upnpdevice.h"
-#include <reference.h>
+
+#include <miniupnpc/miniupnpc.h>
class UPNP : public Reference {
diff --git a/modules/upnp/upnpdevice.cpp b/modules/upnp/upnpdevice.cpp
index a5959cf649..8f935fbd82 100644
--- a/modules/upnp/upnpdevice.cpp
+++ b/modules/upnp/upnpdevice.cpp
@@ -29,8 +29,10 @@
/*************************************************************************/
#include "upnpdevice.h"
+
#include "upnp.h"
-#include "upnpcommands.h"
+
+#include <miniupnpc/upnpcommands.h>
String UPNPDevice::query_external_address() const {
ERR_FAIL_COND_V(!is_valid_gateway(), "");
diff --git a/modules/upnp/upnpdevice.h b/modules/upnp/upnpdevice.h
index 25c9fe1ba3..e4c5eb691d 100644
--- a/modules/upnp/upnpdevice.h
+++ b/modules/upnp/upnpdevice.h
@@ -31,7 +31,7 @@
#ifndef GODOT_UPNPDEVICE_H
#define GODOT_UPNPDEVICE_H
-#include <reference.h>
+#include "core/reference.h"
class UPNPDevice : public Reference {
diff --git a/modules/visual_script/register_types.cpp b/modules/visual_script/register_types.cpp
index 11401c0460..6e081817f1 100644
--- a/modules/visual_script/register_types.cpp
+++ b/modules/visual_script/register_types.cpp
@@ -31,7 +31,7 @@
#include "register_types.h"
#include "core/engine.h"
-#include "io/resource_loader.h"
+#include "core/io/resource_loader.h"
#include "visual_script.h"
#include "visual_script_builtin_funcs.h"
#include "visual_script_editor.h"
diff --git a/modules/visual_script/visual_script.cpp b/modules/visual_script/visual_script.cpp
index bbdec7195f..ff97c21fd9 100644
--- a/modules/visual_script/visual_script.cpp
+++ b/modules/visual_script/visual_script.cpp
@@ -30,8 +30,8 @@
#include "visual_script.h"
-#include "os/os.h"
-#include "project_settings.h"
+#include "core/os/os.h"
+#include "core/project_settings.h"
#include "scene/main/node.h"
#include "visual_script_nodes.h"
diff --git a/modules/visual_script/visual_script.h b/modules/visual_script/visual_script.h
index 13a8b909b0..ea99ce4970 100644
--- a/modules/visual_script/visual_script.h
+++ b/modules/visual_script/visual_script.h
@@ -31,8 +31,8 @@
#ifndef VISUAL_SCRIPT_H
#define VISUAL_SCRIPT_H
-#include "os/thread.h"
-#include "script_language.h"
+#include "core/os/thread.h"
+#include "core/script_language.h"
class VisualScriptInstance;
class VisualScriptNodeInstance;
diff --git a/modules/visual_script/visual_script_builtin_funcs.cpp b/modules/visual_script/visual_script_builtin_funcs.cpp
index 8e98b08b22..e7a4e0c31f 100644
--- a/modules/visual_script/visual_script_builtin_funcs.cpp
+++ b/modules/visual_script/visual_script_builtin_funcs.cpp
@@ -30,13 +30,13 @@
#include "visual_script_builtin_funcs.h"
-#include "class_db.h"
-#include "func_ref.h"
-#include "io/marshalls.h"
-#include "math_funcs.h"
-#include "os/os.h"
-#include "reference.h"
-#include "variant_parser.h"
+#include "core/class_db.h"
+#include "core/func_ref.h"
+#include "core/io/marshalls.h"
+#include "core/math/math_funcs.h"
+#include "core/os/os.h"
+#include "core/reference.h"
+#include "core/variant_parser.h"
const char *VisualScriptBuiltinFunc::func_name[VisualScriptBuiltinFunc::FUNC_MAX] = {
"sin",
diff --git a/modules/visual_script/visual_script_editor.cpp b/modules/visual_script/visual_script_editor.cpp
index 4471fbd0c4..1027c74f34 100644
--- a/modules/visual_script/visual_script_editor.cpp
+++ b/modules/visual_script/visual_script_editor.cpp
@@ -30,13 +30,13 @@
#include "visual_script_editor.h"
+#include "core/object.h"
+#include "core/os/input.h"
+#include "core/os/keyboard.h"
#include "core/script_language.h"
+#include "core/variant.h"
#include "editor/editor_node.h"
#include "editor/editor_resource_preview.h"
-#include "object.h"
-#include "os/input.h"
-#include "os/keyboard.h"
-#include "variant.h"
#include "visual_script_expression.h"
#include "visual_script_flow_control.h"
#include "visual_script_func_nodes.h"
@@ -321,7 +321,7 @@ protected:
p_list->push_back(PropertyInfo(Variant::INT, "type", PROPERTY_HINT_ENUM, argt));
p_list->push_back(PropertyInfo(script->get_variable_info(var).type, "value", script->get_variable_info(var).hint, script->get_variable_info(var).hint_string, PROPERTY_USAGE_DEFAULT));
// Update this when PropertyHint changes
- p_list->push_back(PropertyInfo(Variant::INT, "hint", PROPERTY_HINT_ENUM, "None,Range,ExpRange,Enum,ExpEasing,Length,SpriteFrame,KeyAccel,Flags,Layers2dRender,Layers2dPhysics,Layer3dRender,Layer3dPhysics,File,Dir,GlobalFile,GlobalDir,ResourceType,MultilineText,ColorNoAlpha,ImageCompressLossy,ImageCompressLossLess,ObjectId,String,NodePathToEditedNode,MethodOfVariantType,MethodOfBaseType,MethodOfInstance,MethodOfScript,PropertyOfVariantType,PropertyOfBaseType,PropertyOfInstance,PropertyOfScript,ObjectTooBig"));
+ p_list->push_back(PropertyInfo(Variant::INT, "hint", PROPERTY_HINT_ENUM, "None,Range,ExpRange,Enum,ExpEasing,Length,SpriteFrame,KeyAccel,Flags,Layers2dRender,Layers2dPhysics,Layer3dRender,Layer3dPhysics,File,Dir,GlobalFile,GlobalDir,ResourceType,MultilineText,PlaceholderText,ColorNoAlpha,ImageCompressLossy,ImageCompressLossLess,ObjectId,String,NodePathToEditedNode,MethodOfVariantType,MethodOfBaseType,MethodOfInstance,MethodOfScript,PropertyOfVariantType,PropertyOfBaseType,PropertyOfInstance,PropertyOfScript,ObjectTooBig,NodePathValidTypes"));
p_list->push_back(PropertyInfo(Variant::STRING, "hint_string"));
p_list->push_back(PropertyInfo(Variant::BOOL, "export"));
}
@@ -2343,7 +2343,7 @@ void VisualScriptEditor::_graph_connected(const String &p_from, int p_from_slot,
int from_port;
if (!_get_out_slot(from_node, p_from_slot, from_port, from_seq))
- return; //can't connect this, it' s invalid
+ return; //can't connect this, it's invalid
Ref<VisualScriptNode> to_node = script->get_node(edited_func, p_to.to_int());
ERR_FAIL_COND(!to_node.is_valid());
@@ -2352,7 +2352,7 @@ void VisualScriptEditor::_graph_connected(const String &p_from, int p_from_slot,
int to_port;
if (!_get_in_slot(to_node, p_to_slot, to_port, to_seq))
- return; //can't connect this, it' s invalid
+ return; //can't connect this, it's invalid
ERR_FAIL_COND(from_seq != to_seq);
@@ -2363,7 +2363,7 @@ void VisualScriptEditor::_graph_connected(const String &p_from, int p_from_slot,
undo_redo->add_undo_method(script.ptr(), "sequence_disconnect", edited_func, p_from.to_int(), from_port, p_to.to_int());
} else {
- // disconect current, and connect the new one
+ // disconnect current, and connect the new one
if (script->is_input_value_port_connected(edited_func, p_to.to_int(), to_port)) {
int conn_from;
int conn_port;
@@ -2396,7 +2396,7 @@ void VisualScriptEditor::_graph_disconnected(const String &p_from, int p_from_sl
int from_port;
if (!_get_out_slot(from_node, p_from_slot, from_port, from_seq))
- return; //can't connect this, it' s invalid
+ return; //can't connect this, it's invalid
Ref<VisualScriptNode> to_node = script->get_node(edited_func, p_to.to_int());
ERR_FAIL_COND(!to_node.is_valid());
@@ -2405,7 +2405,7 @@ void VisualScriptEditor::_graph_disconnected(const String &p_from, int p_from_sl
int to_port;
if (!_get_in_slot(to_node, p_to_slot, to_port, to_seq))
- return; //can't connect this, it' s invalid
+ return; //can't connect this, it's invalid
ERR_FAIL_COND(from_seq != to_seq);
@@ -3615,8 +3615,7 @@ VisualScriptEditor::VisualScriptEditor() {
edit_signal_dialog->set_title(TTR("Edit Signal Arguments:"));
signal_editor = memnew(VisualScriptEditorSignalEdit);
- edit_signal_edit = memnew(PropertyEditor);
- edit_signal_edit->hide_top_label();
+ edit_signal_edit = memnew(EditorInspector);
edit_signal_dialog->add_child(edit_signal_edit);
edit_signal_edit->edit(signal_editor);
@@ -3627,8 +3626,7 @@ VisualScriptEditor::VisualScriptEditor() {
edit_variable_dialog->set_title(TTR("Edit Variable:"));
variable_editor = memnew(VisualScriptEditorVariableEdit);
- edit_variable_edit = memnew(PropertyEditor);
- edit_variable_edit->hide_top_label();
+ edit_variable_edit = memnew(EditorInspector);
edit_variable_dialog->add_child(edit_variable_edit);
edit_variable_edit->edit(variable_editor);
diff --git a/modules/visual_script/visual_script_editor.h b/modules/visual_script/visual_script_editor.h
index 8bfd147519..b0bf971630 100644
--- a/modules/visual_script/visual_script_editor.h
+++ b/modules/visual_script/visual_script_editor.h
@@ -93,7 +93,7 @@ class VisualScriptEditor : public ScriptEditorBase {
VisualScriptEditorSignalEdit *signal_editor;
AcceptDialog *edit_signal_dialog;
- PropertyEditor *edit_signal_edit;
+ EditorInspector *edit_signal_edit;
VisualScriptPropertySelector *method_select;
VisualScriptPropertySelector *new_connect_node_select;
@@ -102,7 +102,7 @@ class VisualScriptEditor : public ScriptEditorBase {
VisualScriptEditorVariableEdit *variable_editor;
AcceptDialog *edit_variable_dialog;
- PropertyEditor *edit_variable_edit;
+ EditorInspector *edit_variable_edit;
CustomPropertyEditor *default_value_edit;
diff --git a/modules/visual_script/visual_script_flow_control.cpp b/modules/visual_script/visual_script_flow_control.cpp
index 7535f37ffc..c3ab949d24 100644
--- a/modules/visual_script/visual_script_flow_control.cpp
+++ b/modules/visual_script/visual_script_flow_control.cpp
@@ -30,9 +30,9 @@
#include "visual_script_flow_control.h"
-#include "io/resource_loader.h"
-#include "os/keyboard.h"
-#include "project_settings.h"
+#include "core/io/resource_loader.h"
+#include "core/os/keyboard.h"
+#include "core/project_settings.h"
//////////////////////////////////////////
////////////////RETURN////////////////////
diff --git a/modules/visual_script/visual_script_func_nodes.cpp b/modules/visual_script/visual_script_func_nodes.cpp
index f926d4e2eb..1913bfd8c7 100644
--- a/modules/visual_script/visual_script_func_nodes.cpp
+++ b/modules/visual_script/visual_script_func_nodes.cpp
@@ -30,9 +30,9 @@
#include "visual_script_func_nodes.h"
-#include "engine.h"
-#include "io/resource_loader.h"
-#include "os/os.h"
+#include "core/engine.h"
+#include "core/io/resource_loader.h"
+#include "core/os/os.h"
#include "scene/main/node.h"
#include "scene/main/scene_tree.h"
#include "visual_script_nodes.h"
diff --git a/modules/visual_script/visual_script_nodes.cpp b/modules/visual_script/visual_script_nodes.cpp
index d499512d93..99f242e974 100644
--- a/modules/visual_script/visual_script_nodes.cpp
+++ b/modules/visual_script/visual_script_nodes.cpp
@@ -30,11 +30,11 @@
#include "visual_script_nodes.h"
-#include "engine.h"
-#include "global_constants.h"
-#include "os/input.h"
-#include "os/os.h"
-#include "project_settings.h"
+#include "core/engine.h"
+#include "core/global_constants.h"
+#include "core/os/input.h"
+#include "core/os/os.h"
+#include "core/project_settings.h"
#include "scene/main/node.h"
#include "scene/main/scene_tree.h"
diff --git a/modules/visual_script/visual_script_property_selector.cpp b/modules/visual_script/visual_script_property_selector.cpp
index 8d465c8872..39997d14c4 100644
--- a/modules/visual_script/visual_script_property_selector.cpp
+++ b/modules/visual_script/visual_script_property_selector.cpp
@@ -30,13 +30,13 @@
#include "visual_script_property_selector.h"
+#include "core/os/keyboard.h"
#include "editor_scale.h"
#include "modules/visual_script/visual_script.h"
#include "modules/visual_script/visual_script_builtin_funcs.h"
#include "modules/visual_script/visual_script_flow_control.h"
#include "modules/visual_script/visual_script_func_nodes.h"
#include "modules/visual_script/visual_script_nodes.h"
-#include "os/keyboard.h"
#include "scene/main/node.h"
#include "scene/main/viewport.h"
diff --git a/modules/visual_script/visual_script_yield_nodes.cpp b/modules/visual_script/visual_script_yield_nodes.cpp
index a96e8408c0..a21fff67fe 100644
--- a/modules/visual_script/visual_script_yield_nodes.cpp
+++ b/modules/visual_script/visual_script_yield_nodes.cpp
@@ -30,7 +30,7 @@
#include "visual_script_yield_nodes.h"
-#include "os/os.h"
+#include "core/os/os.h"
#include "scene/main/node.h"
#include "scene/main/scene_tree.h"
#include "visual_script_nodes.h"
diff --git a/modules/vorbis/audio_stream_ogg_vorbis.h b/modules/vorbis/audio_stream_ogg_vorbis.h
index 01de8a3143..73c4b5f3f4 100644
--- a/modules/vorbis/audio_stream_ogg_vorbis.h
+++ b/modules/vorbis/audio_stream_ogg_vorbis.h
@@ -31,9 +31,9 @@
#ifndef AUDIO_STREAM_OGG_VORBIS_H
#define AUDIO_STREAM_OGG_VORBIS_H
-#include "io/resource_loader.h"
-#include "os/file_access.h"
-#include "os/thread_safe.h"
+#include "core/io/resource_loader.h"
+#include "core/os/file_access.h"
+#include "core/os/thread_safe.h"
#include "scene/resources/audio_stream.h"
#include <vorbis/vorbisfile.h>
diff --git a/modules/webm/video_stream_webm.cpp b/modules/webm/video_stream_webm.cpp
index 1bb9a43886..d9a6ece085 100644
--- a/modules/webm/video_stream_webm.cpp
+++ b/modules/webm/video_stream_webm.cpp
@@ -35,9 +35,9 @@
#include "mkvparser/mkvparser.h"
-#include "os/file_access.h"
-#include "os/os.h"
-#include "project_settings.h"
+#include "core/os/file_access.h"
+#include "core/os/os.h"
+#include "core/project_settings.h"
#include "thirdparty/misc/yuv2rgb.h"
diff --git a/modules/webm/video_stream_webm.h b/modules/webm/video_stream_webm.h
index dcf88092c5..3739a73114 100644
--- a/modules/webm/video_stream_webm.h
+++ b/modules/webm/video_stream_webm.h
@@ -31,7 +31,7 @@
#ifndef VIDEO_STREAM_WEBM_H
#define VIDEO_STREAM_WEBM_H
-#include "io/resource_loader.h"
+#include "core/io/resource_loader.h"
#include "scene/resources/video_stream.h"
class WebMFrame;
diff --git a/modules/webp/image_loader_webp.cpp b/modules/webp/image_loader_webp.cpp
index 42b2c77777..6734ae90d9 100644
--- a/modules/webp/image_loader_webp.cpp
+++ b/modules/webp/image_loader_webp.cpp
@@ -30,9 +30,9 @@
#include "image_loader_webp.h"
-#include "io/marshalls.h"
-#include "os/os.h"
-#include "print_string.h"
+#include "core/io/marshalls.h"
+#include "core/os/os.h"
+#include "core/print_string.h"
#include <stdlib.h>
#include <webp/decode.h>
diff --git a/modules/webp/image_loader_webp.h b/modules/webp/image_loader_webp.h
index f051fed4b8..256c787a16 100644
--- a/modules/webp/image_loader_webp.h
+++ b/modules/webp/image_loader_webp.h
@@ -31,7 +31,7 @@
#ifndef IMAGE_LOADER_WEBP_H
#define IMAGE_LOADER_WEBP_H
-#include "io/image_loader.h"
+#include "core/io/image_loader.h"
/**
@author Juan Linietsky <reduzio@gmail.com>
diff --git a/modules/websocket/doc_classes/WebSocketClient.xml b/modules/websocket/doc_classes/WebSocketClient.xml
index 2e11e1a44c..9241492623 100644
--- a/modules/websocket/doc_classes/WebSocketClient.xml
+++ b/modules/websocket/doc_classes/WebSocketClient.xml
@@ -25,7 +25,7 @@
</argument>
<description>
Connect to the given URL requesting one of the given [code]protocols[/code] as sub-protocol.
- If [code]true[/code] is passed as [code]gd_mp_api[/code], the client will behave like a network peer for the [MultiplayerAPI]. Note: connnections to non Godot servers will not work, and [signal data_received] will not be emitted when this option is true.
+ If [code]true[/code] is passed as [code]gd_mp_api[/code], the client will behave like a network peer for the [MultiplayerAPI]. Note: connections to non Godot servers will not work, and [signal data_received] will not be emitted when this option is true.
</description>
</method>
<method name="disconnect_from_host">
diff --git a/modules/websocket/register_types.cpp b/modules/websocket/register_types.cpp
index 721f3cc330..538cd40454 100644
--- a/modules/websocket/register_types.cpp
+++ b/modules/websocket/register_types.cpp
@@ -28,7 +28,7 @@
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
/*************************************************************************/
#include "register_types.h"
-#include "error_macros.h"
+#include "core/error_macros.h"
#ifdef JAVASCRIPT_ENABLED
#include "emscripten.h"
#include "emws_client.h"
diff --git a/platform/android/audio_driver_jandroid.cpp b/platform/android/audio_driver_jandroid.cpp
index 46bd691290..4fab40d534 100644
--- a/platform/android/audio_driver_jandroid.cpp
+++ b/platform/android/audio_driver_jandroid.cpp
@@ -30,8 +30,8 @@
#include "audio_driver_jandroid.h"
-#include "os/os.h"
-#include "project_settings.h"
+#include "core/os/os.h"
+#include "core/project_settings.h"
#include "thread_jandroid.h"
#ifndef ANDROID_NATIVE_ACTIVITY
diff --git a/platform/android/audio_driver_opensl.h b/platform/android/audio_driver_opensl.h
index 88cb122414..8e879b27c5 100644
--- a/platform/android/audio_driver_opensl.h
+++ b/platform/android/audio_driver_opensl.h
@@ -31,7 +31,7 @@
#ifndef AUDIO_DRIVER_OPENSL_H
#define AUDIO_DRIVER_OPENSL_H
-#include "os/mutex.h"
+#include "core/os/mutex.h"
#include "servers/audio_server.h"
#include <SLES/OpenSLES.h>
diff --git a/platform/android/dir_access_android.h b/platform/android/dir_access_android.h
index 085d7160cd..3ac0bd6332 100644
--- a/platform/android/dir_access_android.h
+++ b/platform/android/dir_access_android.h
@@ -33,7 +33,7 @@
#ifdef ANDROID_NATIVE_ACTIVITY
-#include "os/dir_access.h"
+#include "core/os/dir_access.h"
#include <android/asset_manager.h>
#include <android/log.h>
#include <android_native_app_glue.h>
diff --git a/platform/android/dir_access_jandroid.cpp b/platform/android/dir_access_jandroid.cpp
index ee5ae156b7..6a95277585 100644
--- a/platform/android/dir_access_jandroid.cpp
+++ b/platform/android/dir_access_jandroid.cpp
@@ -31,8 +31,8 @@
#ifndef ANDROID_NATIVE_ACTIVITY
#include "dir_access_jandroid.h"
+#include "core/print_string.h"
#include "file_access_jandroid.h"
-#include "print_string.h"
#include "thread_jandroid.h"
jobject DirAccessJAndroid::io = NULL;
diff --git a/platform/android/dir_access_jandroid.h b/platform/android/dir_access_jandroid.h
index 8dc52ab9c8..1653fb0aa5 100644
--- a/platform/android/dir_access_jandroid.h
+++ b/platform/android/dir_access_jandroid.h
@@ -33,8 +33,8 @@
#ifndef ANDROID_NATIVE_ACTIVITY
+#include "core/os/dir_access.h"
#include "java_glue.h"
-#include "os/dir_access.h"
#include <stdio.h>
class DirAccessJAndroid : public DirAccess {
diff --git a/platform/android/export/export.cpp b/platform/android/export/export.cpp
index 5c8d9e078f..fa9474bfe8 100644
--- a/platform/android/export/export.cpp
+++ b/platform/android/export/export.cpp
@@ -30,17 +30,17 @@
#include "export.h"
+#include "core/io/marshalls.h"
+#include "core/io/zip_io.h"
+#include "core/os/file_access.h"
+#include "core/os/os.h"
+#include "core/project_settings.h"
+#include "core/version.h"
#include "editor/editor_export.h"
#include "editor/editor_node.h"
#include "editor/editor_settings.h"
-#include "io/marshalls.h"
-#include "io/zip_io.h"
-#include "os/file_access.h"
-#include "os/os.h"
#include "platform/android/logo.gen.h"
#include "platform/android/run_icon.gen.h"
-#include "project_settings.h"
-#include "version.h"
#include <string.h>
@@ -1337,7 +1337,7 @@ public:
if (!FileAccess::exists(adb)) {
valid = false;
- err += "ADB executable not configured in editor settings.\n";
+ err += "ADB executable not configured in the Editor Settings.\n";
}
String js = EditorSettings::get_singleton()->get("export/android/jarsigner");
@@ -1345,7 +1345,7 @@ public:
if (!FileAccess::exists(js)) {
valid = false;
- err += "OpenJDK 6 jarsigner not configured in editor settings.\n";
+ err += "OpenJDK 8 jarsigner not configured in the Editor Settings.\n";
}
String dk = EditorSettings::get_singleton()->get("export/android/debug_keystore");
@@ -1353,7 +1353,7 @@ public:
if (!FileAccess::exists(dk)) {
valid = false;
- err += "Debug Keystore not configured in editor settings.\n";
+ err += "Debug keystore not configured in the Editor Settings.\n";
}
bool apk_expansion = p_preset->get("apk_expansion/enable");
@@ -1372,7 +1372,7 @@ public:
if (apk_expansion_pkey == "") {
valid = false;
- err += "Invalid public key for apk expansion.\n";
+ err += "Invalid public key for APK expansion.\n";
}
}
@@ -1680,7 +1680,7 @@ public:
String jarsigner = EditorSettings::get_singleton()->get("export/android/jarsigner");
if (!FileAccess::exists(jarsigner)) {
- EditorNode::add_io_error("'jarsigner' could not be found.\nPlease supply a path in the editor settings.\nResulting apk is unsigned.");
+ EditorNode::add_io_error("'jarsigner' could not be found.\nPlease supply a path in the Editor Settings.\nThe resulting APK is unsigned.");
return OK;
}
@@ -1692,14 +1692,14 @@ public:
password = EditorSettings::get_singleton()->get("export/android/debug_keystore_pass");
user = EditorSettings::get_singleton()->get("export/android/debug_keystore_user");
- ep.step("Signing Debug APK...", 103);
+ ep.step("Signing debug APK...", 103);
} else {
keystore = release_keystore;
password = release_password;
user = release_username;
- ep.step("Signing Release APK...", 103);
+ ep.step("Signing release APK...", 103);
}
if (!FileAccess::exists(keystore)) {
@@ -1742,7 +1742,7 @@ public:
OS::get_singleton()->execute(jarsigner, args, true, NULL, NULL, &retval);
if (retval) {
- EditorNode::add_io_error("'jarsigner' verification of APK failed. Make sure to use jarsigner from Java 6.");
+ EditorNode::add_io_error("'jarsigner' verification of APK failed. Make sure to use a jarsigner from OpenJDK 8.");
return ERR_CANT_CREATE;
}
}
diff --git a/platform/android/file_access_android.cpp b/platform/android/file_access_android.cpp
index c2eed50e4c..4c7436a5dc 100644
--- a/platform/android/file_access_android.cpp
+++ b/platform/android/file_access_android.cpp
@@ -29,7 +29,7 @@
/*************************************************************************/
#include "file_access_android.h"
-#include "print_string.h"
+#include "core/print_string.h"
AAssetManager *FileAccessAndroid::asset_manager = NULL;
diff --git a/platform/android/file_access_android.h b/platform/android/file_access_android.h
index 03f4c59521..1ee8697fa4 100644
--- a/platform/android/file_access_android.h
+++ b/platform/android/file_access_android.h
@@ -31,7 +31,7 @@
#ifndef FILE_ACCESS_ANDROID_H
#define FILE_ACCESS_ANDROID_H
-#include "os/file_access.h"
+#include "core/os/file_access.h"
#include <android/asset_manager.h>
#include <android/log.h>
#include <stdio.h>
diff --git a/platform/android/file_access_jandroid.cpp b/platform/android/file_access_jandroid.cpp
index 214e273d9b..573200bcf9 100644
--- a/platform/android/file_access_jandroid.cpp
+++ b/platform/android/file_access_jandroid.cpp
@@ -31,7 +31,7 @@
#ifndef ANDROID_NATIVE_ACTIVITY
#include "file_access_jandroid.h"
-#include "os/os.h"
+#include "core/os/os.h"
#include "thread_jandroid.h"
#include <unistd.h>
diff --git a/platform/android/file_access_jandroid.h b/platform/android/file_access_jandroid.h
index 72f81ee02e..39c201ba85 100644
--- a/platform/android/file_access_jandroid.h
+++ b/platform/android/file_access_jandroid.h
@@ -33,8 +33,8 @@
#ifndef ANDROID_NATIVE_ACTIVITY
+#include "core/os/file_access.h"
#include "java_glue.h"
-#include "os/file_access.h"
class FileAccessJAndroid : public FileAccess {
static jobject io;
diff --git a/platform/android/globals/global_defaults.cpp b/platform/android/globals/global_defaults.cpp
index a315f80452..efeb8598e5 100644
--- a/platform/android/globals/global_defaults.cpp
+++ b/platform/android/globals/global_defaults.cpp
@@ -29,7 +29,7 @@
/*************************************************************************/
#include "global_defaults.h"
-#include "project_settings.h"
+#include "core/project_settings.h"
void register_android_global_defaults() {
}
diff --git a/platform/android/godot_android.cpp b/platform/android/godot_android.cpp
index 061e05f5ee..54692dc831 100644
--- a/platform/android/godot_android.cpp
+++ b/platform/android/godot_android.cpp
@@ -30,11 +30,11 @@
#ifdef ANDROID_NATIVE_ACTIVITY
-#include "engine.h"
+#include "core/engine.h"
+#include "core/project_settings.h"
#include "file_access_android.h"
#include "main/main.h"
#include "os_android.h"
-#include "project_settings.h"
#include <EGL/egl.h>
#include <android/log.h>
diff --git a/platform/android/java/src/org/godotengine/godot/Godot.java b/platform/android/java/src/org/godotengine/godot/Godot.java
index ef798fc790..92c9be5d43 100644
--- a/platform/android/java/src/org/godotengine/godot/Godot.java
+++ b/platform/android/java/src/org/godotengine/godot/Godot.java
@@ -59,6 +59,9 @@ import android.content.pm.PackageManager.NameNotFoundException;
import android.net.Uri;
import android.media.MediaPlayer;
+import android.content.ClipboardManager;
+import android.content.ClipData;
+
import java.lang.reflect.Method;
import java.util.List;
import java.util.ArrayList;
@@ -103,6 +106,7 @@ public class Godot extends Activity implements SensorEventListener, IDownloaderC
private TextView mAverageSpeed;
private TextView mTimeRemaining;
private ProgressBar mPB;
+ private ClipboardManager mClipboard;
private View mDashboard;
private View mCellMessage;
@@ -441,6 +445,7 @@ public class Godot extends Activity implements SensorEventListener, IDownloaderC
Window window = getWindow();
//window.addFlags(WindowManager.LayoutParams.FLAG_TURN_SCREEN_ON | WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON);
window.addFlags(WindowManager.LayoutParams.FLAG_TURN_SCREEN_ON);
+ mClipboard = (ClipboardManager)getSystemService(Context.CLIPBOARD_SERVICE);
//check for apk expansion API
if (true) {
@@ -607,6 +612,24 @@ public class Godot extends Activity implements SensorEventListener, IDownloaderC
}
}
+ public String getClipboard() {
+
+ String copiedText = "";
+
+ if (mClipboard.getPrimaryClip() != null) {
+ ClipData.Item item = mClipboard.getPrimaryClip().getItemAt(0);
+ copiedText = item.getText().toString();
+ }
+
+ return copiedText;
+ }
+
+ public void setClipboard(String p_text) {
+
+ ClipData clip = ClipData.newPlainText("myLabel", p_text);
+ mClipboard.setPrimaryClip(clip);
+ }
+
@Override
protected void onResume() {
super.onResume();
diff --git a/platform/android/java_class_wrapper.h b/platform/android/java_class_wrapper.h
index 648c147ca8..ea3760452f 100644
--- a/platform/android/java_class_wrapper.h
+++ b/platform/android/java_class_wrapper.h
@@ -31,7 +31,7 @@
#ifndef JAVA_CLASS_WRAPPER_H
#define JAVA_CLASS_WRAPPER_H
-#include "reference.h"
+#include "core/reference.h"
#include <android/log.h>
#include <jni.h>
diff --git a/platform/android/java_glue.cpp b/platform/android/java_glue.cpp
index 8bb1c38345..6cf49758bc 100644
--- a/platform/android/java_glue.cpp
+++ b/platform/android/java_glue.cpp
@@ -33,16 +33,16 @@
#include "java_glue.h"
#include "android/asset_manager_jni.h"
#include "audio_driver_jandroid.h"
+#include "core/engine.h"
#include "core/os/keyboard.h"
+#include "core/project_settings.h"
#include "dir_access_jandroid.h"
-#include "engine.h"
#include "file_access_android.h"
#include "file_access_jandroid.h"
#include "java_class_wrapper.h"
#include "main/input_default.h"
#include "main/main.h"
#include "os_android.h"
-#include "project_settings.h"
#include "thread_jandroid.h"
#include <unistd.h>
@@ -607,6 +607,8 @@ static jobject _godot_instance;
static jmethodID _openURI = 0;
static jmethodID _getDataDir = 0;
static jmethodID _getLocale = 0;
+static jmethodID _getClipboard = 0;
+static jmethodID _setClipboard = 0;
static jmethodID _getModel = 0;
static jmethodID _getScreenDPI = 0;
static jmethodID _showKeyboard = 0;
@@ -646,6 +648,19 @@ static String _get_locale() {
return String(env->GetStringUTFChars(s, NULL));
}
+static String _get_clipboard() {
+ JNIEnv *env = ThreadAndroid::get_env();
+ jstring s = (jstring)env->CallObjectMethod(_godot_instance, _getClipboard);
+ return String(env->GetStringUTFChars(s, NULL));
+}
+
+static void _set_clipboard(const String &p_text) {
+
+ JNIEnv *env = ThreadAndroid::get_env();
+ jstring jStr = env->NewStringUTF(p_text.utf8().get_data());
+ env->CallVoidMethod(_godot_instance, _setClipboard, jStr);
+}
+
static String _get_model() {
JNIEnv *env = ThreadAndroid::get_env();
@@ -774,6 +789,8 @@ JNIEXPORT void JNICALL Java_org_godotengine_godot_GodotLib_initialize(JNIEnv *en
_setKeepScreenOn = env->GetMethodID(cls, "setKeepScreenOn", "(Z)V");
_alertDialog = env->GetMethodID(cls, "alert", "(Ljava/lang/String;Ljava/lang/String;)V");
_getGLESVersionCode = env->GetMethodID(cls, "getGLESVersionCode", "()I");
+ _getClipboard = env->GetMethodID(cls, "getClipboard", "()Ljava/lang/String;");
+ _setClipboard = env->GetMethodID(cls, "setClipboard", "(Ljava/lang/String;)V");
jclass clsio = env->FindClass("org/godotengine/godot/Godot");
if (cls) {
@@ -807,7 +824,7 @@ JNIEXPORT void JNICALL Java_org_godotengine_godot_GodotLib_initialize(JNIEnv *en
AudioDriverAndroid::setup(gob);
}
- os_android = new OS_Android(_gfx_init_func, env, _open_uri, _get_user_data_dir, _get_locale, _get_model, _get_screen_dpi, _show_vk, _hide_vk, _get_vk_height, _set_screen_orient, _get_unique_id, _get_system_dir, _get_gles_version_code, _play_video, _is_video_playing, _pause_video, _stop_video, _set_keep_screen_on, _alert, p_use_apk_expansion);
+ os_android = new OS_Android(_gfx_init_func, env, _open_uri, _get_user_data_dir, _get_locale, _get_model, _get_screen_dpi, _show_vk, _hide_vk, _get_vk_height, _set_screen_orient, _get_unique_id, _get_system_dir, _get_gles_version_code, _play_video, _is_video_playing, _pause_video, _stop_video, _set_keep_screen_on, _alert, _set_clipboard, _get_clipboard, p_use_apk_expansion);
os_android->set_need_reload_hooks(p_need_reload_hook);
char wd[500];
diff --git a/platform/android/os_android.cpp b/platform/android/os_android.cpp
index 74c40bde72..484ca4fff8 100644
--- a/platform/android/os_android.cpp
+++ b/platform/android/os_android.cpp
@@ -257,13 +257,10 @@ int OS_Android::get_mouse_button_state() const {
return 0;
}
+
void OS_Android::set_window_title(const String &p_title) {
}
-//interesting byt not yet
-//void set_clipboard(const String& p_text);
-//String get_clipboard() const;
-
void OS_Android::set_video_mode(const VideoMode &p_video_mode, int p_screen) {
}
@@ -599,6 +596,23 @@ String OS_Android::get_locale() const {
return OS_Unix::get_locale();
}
+void OS_Android::set_clipboard(const String &p_text) {
+
+ if (set_clipboard_func) {
+ set_clipboard_func(p_text);
+ } else {
+ OS_Unix::set_clipboard(p_text);
+ }
+}
+
+String OS_Android::get_clipboard() const {
+ if (get_clipboard_func) {
+ return get_clipboard_func();
+ }
+
+ return OS_Unix::get_clipboard();
+}
+
String OS_Android::get_model_name() const {
if (get_model_func)
@@ -732,7 +746,7 @@ bool OS_Android::_check_internal_feature_support(const String &p_feature) {
return false;
}
-OS_Android::OS_Android(GFXInitFunc p_gfx_init_func, void *p_gfx_init_ud, OpenURIFunc p_open_uri_func, GetUserDataDirFunc p_get_user_data_dir_func, GetLocaleFunc p_get_locale_func, GetModelFunc p_get_model_func, GetScreenDPIFunc p_get_screen_dpi_func, ShowVirtualKeyboardFunc p_show_vk, HideVirtualKeyboardFunc p_hide_vk, VirtualKeyboardHeightFunc p_vk_height_func, SetScreenOrientationFunc p_screen_orient, GetUniqueIDFunc p_get_unique_id, GetSystemDirFunc p_get_sdir_func, GetGLVersionCodeFunc p_get_gl_version_func, VideoPlayFunc p_video_play_func, VideoIsPlayingFunc p_video_is_playing_func, VideoPauseFunc p_video_pause_func, VideoStopFunc p_video_stop_func, SetKeepScreenOnFunc p_set_keep_screen_on_func, AlertFunc p_alert_func, bool p_use_apk_expansion) {
+OS_Android::OS_Android(GFXInitFunc p_gfx_init_func, void *p_gfx_init_ud, OpenURIFunc p_open_uri_func, GetUserDataDirFunc p_get_user_data_dir_func, GetLocaleFunc p_get_locale_func, GetModelFunc p_get_model_func, GetScreenDPIFunc p_get_screen_dpi_func, ShowVirtualKeyboardFunc p_show_vk, HideVirtualKeyboardFunc p_hide_vk, VirtualKeyboardHeightFunc p_vk_height_func, SetScreenOrientationFunc p_screen_orient, GetUniqueIDFunc p_get_unique_id, GetSystemDirFunc p_get_sdir_func, GetGLVersionCodeFunc p_get_gl_version_func, VideoPlayFunc p_video_play_func, VideoIsPlayingFunc p_video_is_playing_func, VideoPauseFunc p_video_pause_func, VideoStopFunc p_video_stop_func, SetKeepScreenOnFunc p_set_keep_screen_on_func, AlertFunc p_alert_func, SetClipboardFunc p_set_clipboard_func, GetClipboardFunc p_get_clipboard_func, bool p_use_apk_expansion) {
use_apk_expansion = p_use_apk_expansion;
default_videomode.width = 800;
@@ -765,6 +779,9 @@ OS_Android::OS_Android(GFXInitFunc p_gfx_init_func, void *p_gfx_init_ud, OpenURI
hide_virtual_keyboard_func = p_hide_vk;
get_virtual_keyboard_height_func = p_vk_height_func;
+ set_clipboard_func = p_set_clipboard_func;
+ get_clipboard_func = p_get_clipboard_func;
+
set_screen_orientation_func = p_screen_orient;
set_keep_screen_on_func = p_set_keep_screen_on_func;
alert_func = p_alert_func;
diff --git a/platform/android/os_android.h b/platform/android/os_android.h
index c4220906a3..9594c6fdf4 100644
--- a/platform/android/os_android.h
+++ b/platform/android/os_android.h
@@ -33,10 +33,10 @@
#include "audio_driver_jandroid.h"
#include "audio_driver_opensl.h"
+#include "core/os/input.h"
+#include "core/os/main_loop.h"
#include "drivers/unix/os_unix.h"
#include "main/input_default.h"
-#include "os/input.h"
-#include "os/main_loop.h"
//#include "power_android.h"
#include "servers/audio_server.h"
#include "servers/visual/rasterizer.h"
@@ -51,6 +51,8 @@ typedef void (*GFXInitFunc)(void *ud, bool gl2);
typedef int (*OpenURIFunc)(const String &);
typedef String (*GetUserDataDirFunc)();
typedef String (*GetLocaleFunc)();
+typedef void (*SetClipboardFunc)(const String &);
+typedef String (*GetClipboardFunc)();
typedef String (*GetModelFunc)();
typedef int (*GetScreenDPIFunc)();
typedef String (*GetUniqueIDFunc)();
@@ -119,6 +121,8 @@ private:
OpenURIFunc open_uri_func;
GetUserDataDirFunc get_user_data_dir_func;
GetLocaleFunc get_locale_func;
+ SetClipboardFunc set_clipboard_func;
+ GetClipboardFunc get_clipboard_func;
GetModelFunc get_model_func;
GetScreenDPIFunc get_screen_dpi_func;
ShowVirtualKeyboardFunc show_virtual_keyboard_func;
@@ -140,7 +144,7 @@ private:
int video_driver_index;
public:
- // functions used by main to initialize/deintialize the OS
+ // functions used by main to initialize/deinitialize the OS
virtual int get_video_driver_count() const;
virtual const char *get_video_driver_name(int p_driver) const;
@@ -172,9 +176,6 @@ public:
virtual int get_mouse_button_state() const;
virtual void set_window_title(const String &p_title);
- //virtual void set_clipboard(const String& p_text);
- //virtual String get_clipboard() const;
-
virtual void set_video_mode(const VideoMode &p_video_mode, int p_screen = 0);
virtual VideoMode get_video_mode(int p_screen = 0) const;
virtual void get_fullscreen_mode_list(List<VideoMode> *p_list, int p_screen = 0) const;
@@ -218,6 +219,8 @@ public:
virtual String get_user_data_dir() const;
virtual String get_resource_dir() const;
virtual String get_locale() const;
+ virtual void set_clipboard(const String &p_text);
+ virtual String get_clipboard() const;
virtual String get_model_name() const;
virtual int get_screen_dpi(int p_screen = 0) const;
@@ -244,7 +247,7 @@ public:
void joy_connection_changed(int p_device, bool p_connected, String p_name);
virtual bool _check_internal_feature_support(const String &p_feature);
- OS_Android(GFXInitFunc p_gfx_init_func, void *p_gfx_init_ud, OpenURIFunc p_open_uri_func, GetUserDataDirFunc p_get_user_data_dir_func, GetLocaleFunc p_get_locale_func, GetModelFunc p_get_model_func, GetScreenDPIFunc p_get_screen_dpi_func, ShowVirtualKeyboardFunc p_show_vk, HideVirtualKeyboardFunc p_hide_vk, VirtualKeyboardHeightFunc p_vk_height_func, SetScreenOrientationFunc p_screen_orient, GetUniqueIDFunc p_get_unique_id, GetSystemDirFunc p_get_sdir_func, GetGLVersionCodeFunc p_get_gl_version_func, VideoPlayFunc p_video_play_func, VideoIsPlayingFunc p_video_is_playing_func, VideoPauseFunc p_video_pause_func, VideoStopFunc p_video_stop_func, SetKeepScreenOnFunc p_set_keep_screen_on_func, AlertFunc p_alert_func, bool p_use_apk_expansion);
+ OS_Android(GFXInitFunc p_gfx_init_func, void *p_gfx_init_ud, OpenURIFunc p_open_uri_func, GetUserDataDirFunc p_get_user_data_dir_func, GetLocaleFunc p_get_locale_func, GetModelFunc p_get_model_func, GetScreenDPIFunc p_get_screen_dpi_func, ShowVirtualKeyboardFunc p_show_vk, HideVirtualKeyboardFunc p_hide_vk, VirtualKeyboardHeightFunc p_vk_height_func, SetScreenOrientationFunc p_screen_orient, GetUniqueIDFunc p_get_unique_id, GetSystemDirFunc p_get_sdir_func, GetGLVersionCodeFunc p_get_gl_version_func, VideoPlayFunc p_video_play_func, VideoIsPlayingFunc p_video_is_playing_func, VideoPauseFunc p_video_pause_func, VideoStopFunc p_video_stop_func, SetKeepScreenOnFunc p_set_keep_screen_on_func, AlertFunc p_alert_func, SetClipboardFunc p_set_clipboard, GetClipboardFunc p_get_clipboard, bool p_use_apk_expansion);
~OS_Android();
};
diff --git a/platform/android/power_android.h b/platform/android/power_android.h
index f0d1bee1e2..c39764222e 100644
--- a/platform/android/power_android.h
+++ b/platform/android/power_android.h
@@ -31,7 +31,7 @@
#ifndef PLATFORM_ANDROID_POWER_ANDROID_H_
#define PLATFORM_ANDROID_POWER_ANDROID_H_
-#include "os/os.h"
+#include "core/os/os.h"
#include <android/native_window_jni.h>
class power_android {
diff --git a/platform/android/thread_jandroid.cpp b/platform/android/thread_jandroid.cpp
index b13baf69c2..6795315e63 100644
--- a/platform/android/thread_jandroid.cpp
+++ b/platform/android/thread_jandroid.cpp
@@ -30,9 +30,9 @@
#include "thread_jandroid.h"
+#include "core/os/memory.h"
#include "core/safe_refcount.h"
-#include "os/memory.h"
-#include "script_language.h"
+#include "core/script_language.h"
static pthread_key_t _create_thread_id_key() {
pthread_key_t key;
diff --git a/platform/android/thread_jandroid.h b/platform/android/thread_jandroid.h
index 2bb64f3db2..a57bc47e6d 100644
--- a/platform/android/thread_jandroid.h
+++ b/platform/android/thread_jandroid.h
@@ -35,7 +35,7 @@
@author Juan Linietsky <reduzio@gmail.com>
*/
-#include "os/thread.h"
+#include "core/os/thread.h"
#include <jni.h>
#include <pthread.h>
#include <sys/types.h>
diff --git a/platform/haiku/audio_driver_media_kit.cpp b/platform/haiku/audio_driver_media_kit.cpp
index aeaf698015..7e68c01fad 100644
--- a/platform/haiku/audio_driver_media_kit.cpp
+++ b/platform/haiku/audio_driver_media_kit.cpp
@@ -32,7 +32,7 @@
#ifdef MEDIA_KIT_ENABLED
-#include "project_settings.h"
+#include "core/project_settings.h"
int32_t *AudioDriverMediaKit::samples_in = NULL;
diff --git a/platform/haiku/haiku_direct_window.cpp b/platform/haiku/haiku_direct_window.cpp
index 7eeb226167..150e90be65 100644
--- a/platform/haiku/haiku_direct_window.cpp
+++ b/platform/haiku/haiku_direct_window.cpp
@@ -30,10 +30,10 @@
#include <UnicodeChar.h>
+#include "core/os/keyboard.h"
#include "haiku_direct_window.h"
#include "key_mapping_haiku.h"
#include "main/main.h"
-#include "os/keyboard.h"
HaikuDirectWindow::HaikuDirectWindow(BRect p_frame) :
BDirectWindow(p_frame, "Godot", B_TITLED_WINDOW, B_QUIT_ON_WINDOW_CLOSE) {
diff --git a/platform/haiku/key_mapping_haiku.cpp b/platform/haiku/key_mapping_haiku.cpp
index 28a282e25c..ebe8117d5d 100644
--- a/platform/haiku/key_mapping_haiku.cpp
+++ b/platform/haiku/key_mapping_haiku.cpp
@@ -30,8 +30,8 @@
#include <InterfaceDefs.h>
+#include "core/os/keyboard.h"
#include "key_mapping_haiku.h"
-#include "os/keyboard.h"
struct _HaikuTranslatePair {
unsigned int keysym;
diff --git a/platform/iphone/export/export.cpp b/platform/iphone/export/export.cpp
index 008e213e5e..aae9d97a28 100644
--- a/platform/iphone/export/export.cpp
+++ b/platform/iphone/export/export.cpp
@@ -29,18 +29,18 @@
/*************************************************************************/
#include "export.h"
+#include "core/io/marshalls.h"
+#include "core/io/resource_saver.h"
+#include "core/io/zip_io.h"
+#include "core/os/file_access.h"
+#include "core/os/os.h"
+#include "core/project_settings.h"
+#include "core/version.h"
#include "editor/editor_export.h"
#include "editor/editor_node.h"
#include "editor/editor_settings.h"
-#include "io/marshalls.h"
-#include "io/resource_saver.h"
-#include "io/zip_io.h"
-#include "os/file_access.h"
-#include "os/os.h"
#include "platform/iphone/logo.gen.h"
-#include "project_settings.h"
#include "string.h"
-#include "version.h"
#include <sys/stat.h>
diff --git a/platform/iphone/globals/global_defaults.cpp b/platform/iphone/globals/global_defaults.cpp
index ccc90665c5..423f50995e 100644
--- a/platform/iphone/globals/global_defaults.cpp
+++ b/platform/iphone/globals/global_defaults.cpp
@@ -29,7 +29,7 @@
/*************************************************************************/
#include "global_defaults.h"
-#include "project_settings.h"
+#include "core/project_settings.h"
void register_iphone_global_defaults() {
}
diff --git a/platform/iphone/godot_iphone.cpp b/platform/iphone/godot_iphone.cpp
index dacbf42087..f9b9654a8c 100644
--- a/platform/iphone/godot_iphone.cpp
+++ b/platform/iphone/godot_iphone.cpp
@@ -28,9 +28,9 @@
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
/*************************************************************************/
+#include "core/ustring.h"
#include "main/main.h"
#include "os_iphone.h"
-#include "ustring.h"
#include <stdio.h>
#include <string.h>
diff --git a/platform/iphone/os_iphone.h b/platform/iphone/os_iphone.h
index db2912ad93..64a3c6355a 100644
--- a/platform/iphone/os_iphone.h
+++ b/platform/iphone/os_iphone.h
@@ -33,9 +33,9 @@
#ifndef OS_IPHONE_H
#define OS_IPHONE_H
+#include "core/os/input.h"
#include "drivers/coreaudio/audio_driver_coreaudio.h"
#include "drivers/unix/os_unix.h"
-#include "os/input.h"
#include "game_center.h"
#include "icloud.h"
diff --git a/platform/iphone/platform_refcount.h b/platform/iphone/platform_refcount.h
index 94e4e5fa3b..34338d92e7 100644
--- a/platform/iphone/platform_refcount.h
+++ b/platform/iphone/platform_refcount.h
@@ -28,7 +28,7 @@
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
/*************************************************************************/
-#include "safe_refcount.h"
+#include "core/safe_refcount.h"
#ifdef IPHONE_ENABLED
diff --git a/platform/iphone/sem_iphone.cpp b/platform/iphone/sem_iphone.cpp
index ec1337d63f..ebab9db8fa 100644
--- a/platform/iphone/sem_iphone.cpp
+++ b/platform/iphone/sem_iphone.cpp
@@ -70,7 +70,7 @@ void cgsem_destroy(cgsem_t *cgsem) {
close(cgsem->pipefd[0]);
}
-#include "os/memory.h"
+#include "core/os/memory.h"
#include <errno.h>
Error SemaphoreIphone::wait() {
diff --git a/platform/iphone/sem_iphone.h b/platform/iphone/sem_iphone.h
index ebd4e4ee43..3edc4492eb 100644
--- a/platform/iphone/sem_iphone.h
+++ b/platform/iphone/sem_iphone.h
@@ -37,7 +37,7 @@ struct cgsem {
typedef struct cgsem cgsem_t;
-#include "os/semaphore.h"
+#include "core/os/semaphore.h"
class SemaphoreIphone : public Semaphore {
diff --git a/platform/javascript/api/api.cpp b/platform/javascript/api/api.cpp
index b377ca4e52..c7a6d53561 100644
--- a/platform/javascript/api/api.cpp
+++ b/platform/javascript/api/api.cpp
@@ -29,7 +29,7 @@
/*************************************************************************/
#include "api.h"
-#include "engine.h"
+#include "core/engine.h"
#include "javascript_eval.h"
static JavaScript *javascript_eval;
diff --git a/platform/javascript/api/javascript_eval.h b/platform/javascript/api/javascript_eval.h
index 05f7c9f38a..49d5309737 100644
--- a/platform/javascript/api/javascript_eval.h
+++ b/platform/javascript/api/javascript_eval.h
@@ -31,7 +31,7 @@
#ifndef JAVASCRIPT_EVAL_H
#define JAVASCRIPT_EVAL_H
-#include "object.h"
+#include "core/object.h"
class JavaScript : public Object {
private:
diff --git a/platform/javascript/dom_keys.inc b/platform/javascript/dom_keys.inc
index dc8d67d52b..a30818decc 100644
--- a/platform/javascript/dom_keys.inc
+++ b/platform/javascript/dom_keys.inc
@@ -28,7 +28,7 @@
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
/*************************************************************************/
-#include "os/keyboard.h"
+#include "core/os/keyboard.h"
// https://developer.mozilla.org/en-US/docs/Web/API/KeyboardEvent/keyCode#Constants_for_keyCode_value
#define DOM_VK_CANCEL 0x03
diff --git a/platform/javascript/export/export.cpp b/platform/javascript/export/export.cpp
index a7f0084562..1e47d8db95 100644
--- a/platform/javascript/export/export.cpp
+++ b/platform/javascript/export/export.cpp
@@ -28,9 +28,9 @@
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
/*************************************************************************/
+#include "core/io/zip_io.h"
#include "editor/editor_node.h"
#include "editor_export.h"
-#include "io/zip_io.h"
#include "main/splash.gen.h"
#include "platform/javascript/logo.gen.h"
#include "platform/javascript/run_icon.gen.h"
diff --git a/platform/javascript/http_client_javascript.cpp b/platform/javascript/http_client_javascript.cpp
index 8d90e01ae1..4fb41d4dc9 100644
--- a/platform/javascript/http_client_javascript.cpp
+++ b/platform/javascript/http_client_javascript.cpp
@@ -28,8 +28,8 @@
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
/*************************************************************************/
+#include "core/io/http_client.h"
#include "http_request.h"
-#include "io/http_client.h"
Error HTTPClient::connect_to_host(const String &p_host, int p_port, bool p_ssl, bool p_verify_host) {
diff --git a/platform/javascript/javascript_main.cpp b/platform/javascript/javascript_main.cpp
index 3829e8d406..ec60571402 100644
--- a/platform/javascript/javascript_main.cpp
+++ b/platform/javascript/javascript_main.cpp
@@ -28,7 +28,7 @@
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
/*************************************************************************/
-#include "io/resource_loader.h"
+#include "core/io/resource_loader.h"
#include "main/main.h"
#include "os_javascript.h"
diff --git a/platform/javascript/os_javascript.cpp b/platform/javascript/os_javascript.cpp
index a7a26411b7..3515eeeb60 100644
--- a/platform/javascript/os_javascript.cpp
+++ b/platform/javascript/os_javascript.cpp
@@ -30,9 +30,9 @@
#include "os_javascript.h"
+#include "core/io/file_access_buffered_fa.h"
#include "gles2/rasterizer_gles2.h"
#include "gles3/rasterizer_gles3.h"
-#include "io/file_access_buffered_fa.h"
#include "main/main.h"
#include "servers/visual/visual_server_raster.h"
#include "unix/dir_access_unix.h"
@@ -708,7 +708,7 @@ Error OS_JavaScript::initialize(const VideoMode &p_desired, int p_video_driver,
video_driver_index = p_video_driver;
video_mode = p_desired;
- // Can't fulfil fullscreen request during start-up due to browser security.
+ // Can't fulfill fullscreen request during start-up due to browser security.
video_mode.fullscreen = false;
/* clang-format off */
if (EM_ASM_INT_V({ return Module.resizeCanvasOnStart })) {
diff --git a/platform/osx/crash_handler_osx.mm b/platform/osx/crash_handler_osx.mm
index 1664c5ce8e..9ad3437f0f 100644
--- a/platform/osx/crash_handler_osx.mm
+++ b/platform/osx/crash_handler_osx.mm
@@ -28,9 +28,9 @@
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
/*************************************************************************/
+#include "core/project_settings.h"
#include "main/main.h"
#include "os_osx.h"
-#include "project_settings.h"
#include <string.h>
#include <unistd.h>
diff --git a/platform/osx/dir_access_osx.h b/platform/osx/dir_access_osx.h
index e01ff2fe4d..a9d6d63a8e 100644
--- a/platform/osx/dir_access_osx.h
+++ b/platform/osx/dir_access_osx.h
@@ -38,8 +38,8 @@
#include <sys/types.h>
#include <unistd.h>
+#include "core/os/dir_access.h"
#include "drivers/unix/dir_access_unix.h"
-#include "os/dir_access.h"
/**
@author Juan Linietsky <reduzio@gmail.com>
diff --git a/platform/osx/export/export.cpp b/platform/osx/export/export.cpp
index 880705b507..b0232e2990 100644
--- a/platform/osx/export/export.cpp
+++ b/platform/osx/export/export.cpp
@@ -29,18 +29,18 @@
/*************************************************************************/
#include "export.h"
+#include "core/io/marshalls.h"
+#include "core/io/resource_saver.h"
+#include "core/io/zip_io.h"
+#include "core/os/file_access.h"
+#include "core/os/os.h"
+#include "core/project_settings.h"
+#include "core/version.h"
#include "editor/editor_export.h"
#include "editor/editor_node.h"
#include "editor/editor_settings.h"
-#include "io/marshalls.h"
-#include "io/resource_saver.h"
-#include "io/zip_io.h"
-#include "os/file_access.h"
-#include "os/os.h"
#include "platform/osx/logo.gen.h"
-#include "project_settings.h"
#include "string.h"
-#include "version.h"
#include <sys/stat.h>
class EditorExportPlatformOSX : public EditorExportPlatform {
diff --git a/platform/osx/os_osx.h b/platform/osx/os_osx.h
index 686e3f8c90..6fd52f09d1 100644
--- a/platform/osx/os_osx.h
+++ b/platform/osx/os_osx.h
@@ -31,13 +31,13 @@
#ifndef OS_OSX_H
#define OS_OSX_H
+#include "core/os/input.h"
#include "crash_handler_osx.h"
#include "drivers/coreaudio/audio_driver_coreaudio.h"
#include "drivers/coremidi/core_midi.h"
#include "drivers/unix/os_unix.h"
#include "joypad_osx.h"
#include "main/input_default.h"
-#include "os/input.h"
#include "power_osx.h"
#include "servers/audio_server.h"
#include "servers/visual/rasterizer.h"
diff --git a/platform/osx/os_osx.mm b/platform/osx/os_osx.mm
index 44b4223a65..c0de4e3f2a 100644
--- a/platform/osx/os_osx.mm
+++ b/platform/osx/os_osx.mm
@@ -30,15 +30,15 @@
#include "os_osx.h"
+#include "core/os/keyboard.h"
+#include "core/print_string.h"
+#include "core/version_generated.gen.h"
#include "dir_access_osx.h"
#include "drivers/gles2/rasterizer_gles2.h"
#include "drivers/gles3/rasterizer_gles3.h"
#include "main/main.h"
-#include "os/keyboard.h"
-#include "print_string.h"
#include "sem_osx.h"
#include "servers/visual/visual_server_raster.h"
-#include "version_generated.gen.h"
#include <mach-o/dyld.h>
diff --git a/platform/osx/power_osx.h b/platform/osx/power_osx.h
index 7123e34a03..9ad51e505b 100644
--- a/platform/osx/power_osx.h
+++ b/platform/osx/power_osx.h
@@ -31,9 +31,9 @@
#ifndef PLATFORM_OSX_POWER_OSX_H_
#define PLATFORM_OSX_POWER_OSX_H_
+#include "core/os/file_access.h"
+#include "core/os/os.h"
#include "dir_access_osx.h"
-#include "os/file_access.h"
-#include "os/os.h"
#include <CoreFoundation/CoreFoundation.h>
class power_osx {
diff --git a/platform/osx/sem_osx.cpp b/platform/osx/sem_osx.cpp
index 92f749322e..9b42abdb8d 100644
--- a/platform/osx/sem_osx.cpp
+++ b/platform/osx/sem_osx.cpp
@@ -65,7 +65,7 @@ void cgsem_destroy(cgsem_t *cgsem) {
close(cgsem->pipefd[0]);
}
-#include "os/memory.h"
+#include "core/os/memory.h"
#include <errno.h>
Error SemaphoreOSX::wait() {
diff --git a/platform/osx/sem_osx.h b/platform/osx/sem_osx.h
index ce31e966b7..0ab82873c6 100644
--- a/platform/osx/sem_osx.h
+++ b/platform/osx/sem_osx.h
@@ -37,7 +37,7 @@ struct cgsem {
typedef struct cgsem cgsem_t;
-#include "os/semaphore.h"
+#include "core/os/semaphore.h"
class SemaphoreOSX : public Semaphore {
diff --git a/platform/server/os_server.cpp b/platform/server/os_server.cpp
index 1c17780ad7..1069d6bbed 100644
--- a/platform/server/os_server.cpp
+++ b/platform/server/os_server.cpp
@@ -29,10 +29,10 @@
/*************************************************************************/
#include "os_server.h"
+#include "core/print_string.h"
#include "drivers/dummy/audio_driver_dummy.h"
#include "drivers/dummy/rasterizer_dummy.h"
#include "drivers/dummy/texture_loader_dummy.h"
-#include "print_string.h"
#include "servers/visual/visual_server_raster.h"
#include "main/main.h"
diff --git a/platform/uwp/export/export.cpp b/platform/uwp/export/export.cpp
index 1ad5293b44..6a7284f770 100644
--- a/platform/uwp/export/export.cpp
+++ b/platform/uwp/export/export.cpp
@@ -29,16 +29,16 @@
/*************************************************************************/
#include "export.h"
-#include "bind/core_bind.h"
+#include "core/bind/core_bind.h"
+#include "core/io/marshalls.h"
+#include "core/io/zip_io.h"
+#include "core/object.h"
+#include "core/os/file_access.h"
+#include "core/project_settings.h"
+#include "core/version.h"
#include "editor/editor_export.h"
#include "editor/editor_node.h"
-#include "io/marshalls.h"
-#include "io/zip_io.h"
-#include "object.h"
-#include "os/file_access.h"
#include "platform/uwp/logo.gen.h"
-#include "project_settings.h"
-#include "version.h"
#include "thirdparty/minizip/unzip.h"
#include "thirdparty/minizip/zip.h"
diff --git a/platform/uwp/gl_context_egl.h b/platform/uwp/gl_context_egl.h
index df0108c124..3e3c4a0f57 100644
--- a/platform/uwp/gl_context_egl.h
+++ b/platform/uwp/gl_context_egl.h
@@ -34,9 +34,9 @@
#include <wrl.h>
#include "EGL/egl.h"
+#include "core/error_list.h"
+#include "core/os/os.h"
#include "drivers/gl_context/context_gl.h"
-#include "error_list.h"
-#include "os/os.h"
using namespace Windows::UI::Core;
diff --git a/platform/uwp/os_uwp.cpp b/platform/uwp/os_uwp.cpp
index b2eb3450e2..5b5f30244e 100644
--- a/platform/uwp/os_uwp.cpp
+++ b/platform/uwp/os_uwp.cpp
@@ -28,23 +28,23 @@
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
/*************************************************************************/
+// Must include Winsock before windows.h (included by os_uwp.h)
+#include "drivers/unix/net_socket_posix.h"
+
#include "os_uwp.h"
+#include "core/io/marshalls.h"
+#include "core/project_settings.h"
#include "drivers/gles2/rasterizer_gles2.h"
#include "drivers/gles3/rasterizer_gles3.h"
#include "drivers/unix/ip_unix.h"
#include "drivers/windows/dir_access_windows.h"
#include "drivers/windows/file_access_windows.h"
#include "drivers/windows/mutex_windows.h"
-#include "drivers/windows/packet_peer_udp_winsock.h"
#include "drivers/windows/rw_lock_windows.h"
#include "drivers/windows/semaphore_windows.h"
-#include "drivers/windows/stream_peer_tcp_winsock.h"
-#include "drivers/windows/tcp_server_winsock.h"
-#include "io/marshalls.h"
#include "main/main.h"
#include "platform/windows/windows_terminal_logger.h"
-#include "project_settings.h"
#include "servers/audio_server.h"
#include "servers/visual/visual_server_raster.h"
#include "thread_uwp.h"
@@ -151,9 +151,7 @@ void OSUWP::initialize_core() {
DirAccess::make_default<DirAccessWindows>(DirAccess::ACCESS_USERDATA);
DirAccess::make_default<DirAccessWindows>(DirAccess::ACCESS_FILESYSTEM);
- TCPServerWinsock::make_default();
- StreamPeerTCPWinsock::make_default();
- PacketPeerUDPWinsock::make_default();
+ NetSocketPosix::make_default();
// We need to know how often the clock is updated
if (!QueryPerformanceFrequency((LARGE_INTEGER *)&ticks_per_second))
diff --git a/platform/uwp/os_uwp.h b/platform/uwp/os_uwp.h
index 89f71f0013..9641b9cde9 100644
--- a/platform/uwp/os_uwp.h
+++ b/platform/uwp/os_uwp.h
@@ -32,13 +32,13 @@
#define OSUWP_H
#include "core/math/transform_2d.h"
+#include "core/os/input.h"
+#include "core/os/os.h"
#include "core/ustring.h"
#include "drivers/xaudio2/audio_driver_xaudio2.h"
#include "gl_context_egl.h"
#include "joypad_uwp.h"
#include "main/input_default.h"
-#include "os/input.h"
-#include "os/os.h"
#include "power_uwp.h"
#include "servers/audio_server.h"
#include "servers/visual/rasterizer.h"
@@ -152,7 +152,7 @@ private:
Windows::Devices::Sensors::Magnetometer ^ magnetometer;
Windows::Devices::Sensors::Gyrometer ^ gyrometer;
- // functions used by main to initialize/deintialize the OS
+ // functions used by main to initialize/deinitialize the OS
protected:
virtual int get_video_driver_count() const;
virtual int get_current_video_driver() const;
diff --git a/platform/uwp/power_uwp.h b/platform/uwp/power_uwp.h
index 09572a15f4..da1cffe8f0 100644
--- a/platform/uwp/power_uwp.h
+++ b/platform/uwp/power_uwp.h
@@ -31,9 +31,9 @@
#ifndef PLATFORM_UWP_POWER_UWP_H_
#define PLATFORM_UWP_POWER_UWP_H_
-#include "os/dir_access.h"
-#include "os/file_access.h"
-#include "os/os.h"
+#include "core/os/dir_access.h"
+#include "core/os/file_access.h"
+#include "core/os/os.h"
class PowerUWP {
diff --git a/platform/uwp/thread_uwp.cpp b/platform/uwp/thread_uwp.cpp
index 25cd29190f..c755204ec4 100644
--- a/platform/uwp/thread_uwp.cpp
+++ b/platform/uwp/thread_uwp.cpp
@@ -30,7 +30,7 @@
#include "thread_uwp.h"
-#include "os/memory.h"
+#include "core/os/memory.h"
Thread *ThreadUWP::create_func_uwp(ThreadCreateCallback p_callback, void *p_user, const Settings &) {
diff --git a/platform/uwp/thread_uwp.h b/platform/uwp/thread_uwp.h
index 89081f3b2b..16e7efb60b 100644
--- a/platform/uwp/thread_uwp.h
+++ b/platform/uwp/thread_uwp.h
@@ -33,7 +33,7 @@
#ifdef UWP_ENABLED
-#include "os/thread.h"
+#include "core/os/thread.h"
#include <thread>
diff --git a/platform/windows/context_gl_win.h b/platform/windows/context_gl_win.h
index e7578a1aeb..af2f89568e 100644
--- a/platform/windows/context_gl_win.h
+++ b/platform/windows/context_gl_win.h
@@ -35,9 +35,9 @@
#ifndef CONTEXT_GL_WIN_H
#define CONTEXT_GL_WIN_H
+#include "core/error_list.h"
+#include "core/os/os.h"
#include "drivers/gl_context/context_gl.h"
-#include "error_list.h"
-#include "os/os.h"
#include <windows.h>
diff --git a/platform/windows/crash_handler_win.cpp b/platform/windows/crash_handler_win.cpp
index 76a227c608..2760e87b8b 100644
--- a/platform/windows/crash_handler_win.cpp
+++ b/platform/windows/crash_handler_win.cpp
@@ -28,9 +28,9 @@
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
/*************************************************************************/
+#include "core/project_settings.h"
#include "main/main.h"
#include "os_windows.h"
-#include "project_settings.h"
#ifdef CRASH_HANDLER_EXCEPTION
diff --git a/platform/windows/detect.py b/platform/windows/detect.py
index 150d418502..5d5af17086 100644
--- a/platform/windows/detect.py
+++ b/platform/windows/detect.py
@@ -208,8 +208,8 @@ def configure_msvc(env, manual_msvc_config):
'RTAUDIO_ENABLED', 'WASAPI_ENABLED',
'WINMIDI_ENABLED', 'TYPED_METHOD_BIND',
'WIN32', 'MSVC',
- {'WINVER' : '$target_win_version',
- '_WIN32_WINNT': '$target_win_version'}])
+ 'WINVER=$target_win_version',
+ '_WIN32_WINNT=$target_win_version'])
env.AppendUnique(CPPDEFINES=['NOMINMAX']) # disable bogus min/max WinDef.h macros
if env["bits"] == "64":
env.AppendUnique(CPPDEFINES=['_WIN64'])
diff --git a/platform/windows/export/export.cpp b/platform/windows/export/export.cpp
index 38fd6366c7..dcaae40b10 100644
--- a/platform/windows/export/export.cpp
+++ b/platform/windows/export/export.cpp
@@ -28,10 +28,10 @@
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
/*************************************************************************/
+#include "core/os/file_access.h"
+#include "core/os/os.h"
#include "editor/editor_export.h"
#include "editor/editor_settings.h"
-#include "os/file_access.h"
-#include "os/os.h"
#include "platform/windows/logo.gen.h"
class EditorExportPlatformWindows : public EditorExportPlatformPC {
diff --git a/platform/windows/key_mapping_win.cpp b/platform/windows/key_mapping_win.cpp
index 69dd385354..80580a63b3 100644
--- a/platform/windows/key_mapping_win.cpp
+++ b/platform/windows/key_mapping_win.cpp
@@ -212,7 +212,7 @@ static _WinTranslatePair _vk_to_keycode[] = {
{ KEY_SEMICOLON, VK_OEM_1 }, // (0xBA)
{ KEY_EQUAL, VK_OEM_PLUS }, // (0xBB) // Windows 2000/XP: For any country/region, the '+' key
- { KEY_COLON, VK_OEM_COMMA }, // (0xBC) // Windows 2000/XP: For any country/region, the ',' key
+ { KEY_COMMA, VK_OEM_COMMA }, // (0xBC) // Windows 2000/XP: For any country/region, the ',' key
{ KEY_MINUS, VK_OEM_MINUS }, // (0xBD) // Windows 2000/XP: For any country/region, the '-' key
{ KEY_PERIOD, VK_OEM_PERIOD }, // (0xBE) // Windows 2000/XP: For any country/region, the '.' key
{ KEY_SLASH, VK_OEM_2 }, // (0xBF) //Windows 2000/XP: For the US standard keyboard, the '/?' key
diff --git a/platform/windows/key_mapping_win.h b/platform/windows/key_mapping_win.h
index 8d6461f27d..340f916e1c 100644
--- a/platform/windows/key_mapping_win.h
+++ b/platform/windows/key_mapping_win.h
@@ -31,7 +31,7 @@
#ifndef KEY_MAPPING_WINDOWS_H
#define KEY_MAPPING_WINDOWS_H
-#include "os/keyboard.h"
+#include "core/os/keyboard.h"
#include <windows.h>
diff --git a/platform/windows/os_windows.cpp b/platform/windows/os_windows.cpp
index 88793386ab..6723210432 100644
--- a/platform/windows/os_windows.cpp
+++ b/platform/windows/os_windows.cpp
@@ -28,27 +28,27 @@
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
/*************************************************************************/
+// Must include Winsock before windows.h (included by os_windows.h)
+#include "drivers/unix/net_socket_posix.h"
+
#include "os_windows.h"
+#include "core/io/marshalls.h"
+#include "core/version_generated.gen.h"
#include "drivers/gles2/rasterizer_gles2.h"
#include "drivers/gles3/rasterizer_gles3.h"
#include "drivers/windows/dir_access_windows.h"
#include "drivers/windows/file_access_windows.h"
#include "drivers/windows/mutex_windows.h"
-#include "drivers/windows/packet_peer_udp_winsock.h"
#include "drivers/windows/rw_lock_windows.h"
#include "drivers/windows/semaphore_windows.h"
-#include "drivers/windows/stream_peer_tcp_winsock.h"
-#include "drivers/windows/tcp_server_winsock.h"
#include "drivers/windows/thread_windows.h"
-#include "io/marshalls.h"
#include "joypad.h"
#include "lang_table.h"
#include "main/main.h"
#include "servers/audio_server.h"
#include "servers/visual/visual_server_raster.h"
#include "servers/visual/visual_server_wrap_mt.h"
-#include "version_generated.gen.h"
#include "windows_terminal_logger.h"
#include <process.h>
@@ -219,9 +219,7 @@ void OS_Windows::initialize_core() {
DirAccess::make_default<DirAccessWindows>(DirAccess::ACCESS_USERDATA);
DirAccess::make_default<DirAccessWindows>(DirAccess::ACCESS_FILESYSTEM);
- TCPServerWinsock::make_default();
- StreamPeerTCPWinsock::make_default();
- PacketPeerUDPWinsock::make_default();
+ NetSocketPosix::make_default();
// We need to know how often the clock is updated
if (!QueryPerformanceFrequency((LARGE_INTEGER *)&ticks_per_second))
@@ -1514,9 +1512,6 @@ void OS_Windows::finalize_core() {
timeEndPeriod(1);
memdelete(process_map);
-
- TCPServerWinsock::cleanup();
- StreamPeerTCPWinsock::cleanup();
}
void OS_Windows::alert(const String &p_alert, const String &p_title) {
@@ -1711,6 +1706,15 @@ void OS_Windows::set_window_position(const Point2 &p_position) {
RECT r;
GetWindowRect(hWnd, &r);
MoveWindow(hWnd, p_position.x, p_position.y, r.right - r.left, r.bottom - r.top, TRUE);
+
+ // Don't let the mouse leave the window when moved
+ if (mouse_mode == MOUSE_MODE_CONFINED) {
+ RECT rect;
+ GetClientRect(hWnd, &rect);
+ ClientToScreen(hWnd, (POINT *)&rect.left);
+ ClientToScreen(hWnd, (POINT *)&rect.right);
+ ClipCursor(&rect);
+ }
}
Size2 OS_Windows::get_window_size() const {
diff --git a/platform/windows/os_windows.h b/platform/windows/os_windows.h
index c9fa46052a..01e1c51ca5 100644
--- a/platform/windows/os_windows.h
+++ b/platform/windows/os_windows.h
@@ -31,13 +31,13 @@
#ifndef OS_WINDOWS_H
#define OS_WINDOWS_H
#include "context_gl_win.h"
+#include "core/os/input.h"
+#include "core/os/os.h"
#include "core/project_settings.h"
#include "crash_handler_win.h"
#include "drivers/rtaudio/audio_driver_rtaudio.h"
#include "drivers/wasapi/audio_driver_wasapi.h"
#include "drivers/winmidi/win_midi.h"
-#include "os/input.h"
-#include "os/os.h"
#include "power_windows.h"
#include "servers/audio_server.h"
#include "servers/visual/rasterizer.h"
@@ -157,7 +157,7 @@ class OS_Windows : public OS {
void _update_window_style(bool repaint = true);
- // functions used by main to initialize/deintialize the OS
+ // functions used by main to initialize/deinitialize the OS
protected:
virtual int get_current_video_driver() const;
diff --git a/platform/windows/power_windows.h b/platform/windows/power_windows.h
index 1c1a8c0876..4984b473ca 100644
--- a/platform/windows/power_windows.h
+++ b/platform/windows/power_windows.h
@@ -31,9 +31,9 @@
#ifndef PLATFORM_WINDOWS_POWER_WINDOWS_H_
#define PLATFORM_WINDOWS_POWER_WINDOWS_H_
-#include "os/dir_access.h"
-#include "os/file_access.h"
-#include "os/os.h"
+#include "core/os/dir_access.h"
+#include "core/os/file_access.h"
+#include "core/os/os.h"
#include <windows.h>
diff --git a/platform/windows/windows_terminal_logger.h b/platform/windows/windows_terminal_logger.h
index 1ad2bcb0fd..1cd1941b8a 100644
--- a/platform/windows/windows_terminal_logger.h
+++ b/platform/windows/windows_terminal_logger.h
@@ -33,7 +33,7 @@
#ifdef WINDOWS_ENABLED
-#include "io/logger.h"
+#include "core/io/logger.h"
class WindowsTerminalLogger : public StdLogger {
public:
@@ -44,4 +44,4 @@ public:
#endif
-#endif \ No newline at end of file
+#endif
diff --git a/platform/x11/context_gl_x11.h b/platform/x11/context_gl_x11.h
index b8f3eb95d4..ab0379a2fe 100644
--- a/platform/x11/context_gl_x11.h
+++ b/platform/x11/context_gl_x11.h
@@ -38,8 +38,8 @@
#if defined(OPENGL_ENABLED)
+#include "core/os/os.h"
#include "drivers/gl_context/context_gl.h"
-#include "os/os.h"
#include <X11/Xlib.h>
#include <X11/extensions/Xrender.h>
diff --git a/platform/x11/crash_handler_x11.cpp b/platform/x11/crash_handler_x11.cpp
index 960105271b..ab9275e49f 100644
--- a/platform/x11/crash_handler_x11.cpp
+++ b/platform/x11/crash_handler_x11.cpp
@@ -33,9 +33,9 @@
#endif
#include "crash_handler_x11.h"
+#include "core/os/os.h"
+#include "core/project_settings.h"
#include "main/main.h"
-#include "os/os.h"
-#include "project_settings.h"
#ifdef CRASH_HANDLER_ENABLED
#include <cxxabi.h>
diff --git a/platform/x11/joypad_linux.h b/platform/x11/joypad_linux.h
index 1187acac23..34b240abf1 100644
--- a/platform/x11/joypad_linux.h
+++ b/platform/x11/joypad_linux.h
@@ -33,9 +33,9 @@
#define JOYPAD_LINUX_H
#ifdef JOYDEV_ENABLED
+#include "core/os/mutex.h"
+#include "core/os/thread.h"
#include "main/input_default.h"
-#include "os/mutex.h"
-#include "os/thread.h"
struct input_absinfo;
diff --git a/platform/x11/key_mapping_x11.h b/platform/x11/key_mapping_x11.h
index 62dfcf3a4d..6f05941c19 100644
--- a/platform/x11/key_mapping_x11.h
+++ b/platform/x11/key_mapping_x11.h
@@ -41,7 +41,7 @@
#define XK_XKB_KEYS
#include <X11/keysymdef.h>
-#include "os/keyboard.h"
+#include "core/os/keyboard.h"
class KeyMappingX11 {
KeyMappingX11(){};
diff --git a/platform/x11/os_x11.cpp b/platform/x11/os_x11.cpp
index a57a8c6bb9..b80a20ce40 100644
--- a/platform/x11/os_x11.cpp
+++ b/platform/x11/os_x11.cpp
@@ -29,12 +29,12 @@
/*************************************************************************/
#include "os_x11.h"
+#include "core/os/dir_access.h"
+#include "core/print_string.h"
#include "drivers/gles2/rasterizer_gles2.h"
#include "drivers/gles3/rasterizer_gles3.h"
#include "errno.h"
#include "key_mapping_x11.h"
-#include "os/dir_access.h"
-#include "print_string.h"
#include "servers/visual/visual_server_raster.h"
#include "servers/visual/visual_server_wrap_mt.h"
@@ -581,6 +581,8 @@ Error OS_X11::initialize(const VideoMode &p_desired, int p_video_driver, int p_a
}
}
+ update_real_mouse_position();
+
return OK;
}
@@ -742,12 +744,15 @@ void OS_X11::set_mouse_mode(MouseMode p_mode) {
ERR_PRINT("NO GRAB");
}
- center.x = current_videomode.width / 2;
- center.y = current_videomode.height / 2;
- XWarpPointer(x11_display, None, x11_window,
- 0, 0, 0, 0, (int)center.x, (int)center.y);
+ if (mouse_mode == MOUSE_MODE_CAPTURED) {
+ center.x = current_videomode.width / 2;
+ center.y = current_videomode.height / 2;
- input->set_mouse_position(center);
+ XWarpPointer(x11_display, None, x11_window,
+ 0, 0, 0, 0, (int)center.x, (int)center.y);
+
+ input->set_mouse_position(center);
+ }
} else {
do_mouse_warp = false;
}
@@ -1050,6 +1055,7 @@ Point2 OS_X11::get_window_position() const {
void OS_X11::set_window_position(const Point2 &p_position) {
XMoveWindow(x11_display, x11_window, p_position.x, p_position.y);
+ update_real_mouse_position();
}
Size2 OS_X11::get_window_size() const {
@@ -1079,6 +1085,16 @@ Size2 OS_X11::get_real_window_size() const {
}
void OS_X11::set_window_size(const Size2 p_size) {
+
+ if (current_videomode.width == p_size.width && current_videomode.height == p_size.height)
+ return;
+
+ XWindowAttributes xwa;
+ XSync(x11_display, False);
+ XGetWindowAttributes(x11_display, x11_window, &xwa);
+ int old_w = xwa.width;
+ int old_h = xwa.height;
+
// If window resizable is disabled we need to update the attributes first
if (is_window_resizable() == false) {
XSizeHints *xsh;
@@ -1098,6 +1114,16 @@ void OS_X11::set_window_size(const Size2 p_size) {
// Update our videomode width and height
current_videomode.width = p_size.x;
current_videomode.height = p_size.y;
+
+ for (int timeout = 0; timeout < 50; ++timeout) {
+ XSync(x11_display, False);
+ XGetWindowAttributes(x11_display, x11_window, &xwa);
+
+ if (old_w != xwa.width || old_h != xwa.height)
+ break;
+
+ usleep(10000);
+ }
}
void OS_X11::set_window_fullscreen(bool p_enabled) {
@@ -2044,6 +2070,10 @@ void OS_X11::process_xevents() {
Point2i rel = pos - last_mouse_pos;
+ if (mouse_mode == MOUSE_MODE_CAPTURED) {
+ pos = Point2i(current_videomode.width / 2, current_videomode.height / 2);
+ }
+
Ref<InputEventMouseMotion> mm;
mm.instance();
@@ -2972,6 +3002,25 @@ OS::LatinKeyboardVariant OS_X11::get_latin_keyboard_variant() const {
return LATIN_KEYBOARD_QWERTY;
}
+void OS_X11::update_real_mouse_position() {
+ Window root_return, child_return;
+ int root_x, root_y, win_x, win_y;
+ unsigned int mask_return;
+
+ Bool xquerypointer_result = XQueryPointer(x11_display, x11_window, &root_return, &child_return, &root_x, &root_y,
+ &win_x, &win_y, &mask_return);
+
+ if (xquerypointer_result) {
+ if (win_x > 0 && win_y > 0 && win_x <= current_videomode.width && win_y <= current_videomode.height) {
+
+ last_mouse_pos.x = win_x;
+ last_mouse_pos.y = win_y;
+ last_mouse_pos_valid = true;
+ input->set_mouse_position(last_mouse_pos);
+ }
+ }
+}
+
OS_X11::OS_X11() {
#ifdef PULSEAUDIO_ENABLED
diff --git a/platform/x11/os_x11.h b/platform/x11/os_x11.h
index 44455a2d8d..47ff257455 100644
--- a/platform/x11/os_x11.h
+++ b/platform/x11/os_x11.h
@@ -32,9 +32,9 @@
#define OS_X11_H
#include "context_gl_x11.h"
+#include "core/os/input.h"
#include "crash_handler_x11.h"
#include "drivers/unix/os_unix.h"
-#include "os/input.h"
#include "servers/visual_server.h"
//#include "servers/visual/visual_server_wrap_mt.h"
#include "drivers/alsa/audio_driver_alsa.h"
@@ -313,6 +313,7 @@ public:
virtual LatinKeyboardVariant get_latin_keyboard_variant() const;
+ void update_real_mouse_position();
OS_X11();
};
diff --git a/platform/x11/power_x11.h b/platform/x11/power_x11.h
index 4077887998..d0805b6f8a 100644
--- a/platform/x11/power_x11.h
+++ b/platform/x11/power_x11.h
@@ -31,9 +31,9 @@
#ifndef X11_POWER_H_
#define X11_POWER_H_
-#include "os/dir_access.h"
-#include "os/file_access.h"
-#include "os/os.h"
+#include "core/os/dir_access.h"
+#include "core/os/file_access.h"
+#include "core/os/os.h"
class PowerX11 {
diff --git a/scene/2d/animated_sprite.cpp b/scene/2d/animated_sprite.cpp
index 85e7f8df92..a33fc844a5 100644
--- a/scene/2d/animated_sprite.cpp
+++ b/scene/2d/animated_sprite.cpp
@@ -29,7 +29,7 @@
/*************************************************************************/
#include "animated_sprite.h"
-#include "os/os.h"
+#include "core/os/os.h"
#include "scene/scene_string_names.h"
#define NORMAL_SUFFIX "_normal"
diff --git a/scene/2d/area_2d.h b/scene/2d/area_2d.h
index 0fda9b867d..cd60b6c1e1 100644
--- a/scene/2d/area_2d.h
+++ b/scene/2d/area_2d.h
@@ -31,8 +31,8 @@
#ifndef AREA_2D_H
#define AREA_2D_H
+#include "core/vset.h"
#include "scene/2d/collision_object_2d.h"
-#include "vset.h"
class Area2D : public CollisionObject2D {
diff --git a/scene/2d/audio_stream_player_2d.cpp b/scene/2d/audio_stream_player_2d.cpp
index 559e041dbf..a1ae05d971 100644
--- a/scene/2d/audio_stream_player_2d.cpp
+++ b/scene/2d/audio_stream_player_2d.cpp
@@ -30,7 +30,7 @@
#include "audio_stream_player_2d.h"
-#include "engine.h"
+#include "core/engine.h"
#include "scene/2d/area_2d.h"
#include "scene/main/viewport.h"
diff --git a/scene/2d/canvas_item.cpp b/scene/2d/canvas_item.cpp
index 3914c75ca8..fab0b7d433 100644
--- a/scene/2d/canvas_item.cpp
+++ b/scene/2d/canvas_item.cpp
@@ -29,9 +29,9 @@
/*************************************************************************/
#include "canvas_item.h"
+#include "core/message_queue.h"
#include "core/method_bind_ext.gen.inc"
-#include "message_queue.h"
-#include "os/input.h"
+#include "core/os/input.h"
#include "scene/main/canvas_layer.h"
#include "scene/main/viewport.h"
#include "scene/resources/font.h"
diff --git a/scene/2d/canvas_item.h b/scene/2d/canvas_item.h
index 6dc2e2e39d..36a0e4039a 100644
--- a/scene/2d/canvas_item.h
+++ b/scene/2d/canvas_item.h
@@ -348,7 +348,7 @@ public:
void force_update_transform();
- // Used by control nodes to retreive the parent's anchorable area
+ // Used by control nodes to retrieve the parent's anchorable area
virtual Rect2 get_anchorable_rect() const { return Rect2(0, 0, 0, 0); };
int get_canvas_layer() const;
diff --git a/scene/2d/collision_polygon_2d.cpp b/scene/2d/collision_polygon_2d.cpp
index 9f19f56e75..508ceeaaf9 100644
--- a/scene/2d/collision_polygon_2d.cpp
+++ b/scene/2d/collision_polygon_2d.cpp
@@ -31,7 +31,7 @@
#include "collision_polygon_2d.h"
#include "collision_object_2d.h"
-#include "engine.h"
+#include "core/engine.h"
#include "scene/resources/concave_polygon_shape_2d.h"
#include "scene/resources/convex_polygon_shape_2d.h"
diff --git a/scene/2d/collision_shape_2d.cpp b/scene/2d/collision_shape_2d.cpp
index ff5f7062c4..cb9c8ecf95 100644
--- a/scene/2d/collision_shape_2d.cpp
+++ b/scene/2d/collision_shape_2d.cpp
@@ -31,7 +31,7 @@
#include "collision_shape_2d.h"
#include "collision_object_2d.h"
-#include "engine.h"
+#include "core/engine.h"
#include "scene/resources/capsule_shape_2d.h"
#include "scene/resources/circle_shape_2d.h"
#include "scene/resources/concave_polygon_shape_2d.h"
diff --git a/scene/2d/cpu_particles_2d.h b/scene/2d/cpu_particles_2d.h
index dbe9f59748..4f51eb1062 100644
--- a/scene/2d/cpu_particles_2d.h
+++ b/scene/2d/cpu_particles_2d.h
@@ -31,7 +31,7 @@
#ifndef CPU_PARTICLES_2D_H
#define CPU_PARTICLES_2D_H
-#include "rid.h"
+#include "core/rid.h"
#include "scene/2d/node_2d.h"
#include "scene/resources/texture.h"
diff --git a/scene/2d/joints_2d.cpp b/scene/2d/joints_2d.cpp
index 7d5360c0e4..b9a48e1fdc 100644
--- a/scene/2d/joints_2d.cpp
+++ b/scene/2d/joints_2d.cpp
@@ -30,7 +30,7 @@
#include "joints_2d.h"
-#include "engine.h"
+#include "core/engine.h"
#include "physics_body_2d.h"
#include "servers/physics_2d_server.h"
diff --git a/scene/2d/light_2d.cpp b/scene/2d/light_2d.cpp
index 4d24daa5a7..e6a5a0b651 100644
--- a/scene/2d/light_2d.cpp
+++ b/scene/2d/light_2d.cpp
@@ -30,7 +30,7 @@
#include "light_2d.h"
-#include "engine.h"
+#include "core/engine.h"
#include "servers/visual_server.h"
Dictionary Light2D::_edit_get_state() const {
diff --git a/scene/2d/light_occluder_2d.cpp b/scene/2d/light_occluder_2d.cpp
index c9e5d0f1bc..ab15b49985 100644
--- a/scene/2d/light_occluder_2d.cpp
+++ b/scene/2d/light_occluder_2d.cpp
@@ -30,7 +30,7 @@
#include "light_occluder_2d.h"
-#include "engine.h"
+#include "core/engine.h"
void OccluderPolygon2D::set_polygon(const PoolVector<Vector2> &p_polygon) {
diff --git a/scene/2d/line_2d.cpp b/scene/2d/line_2d.cpp
index ad9775c0b7..e164f0ca75 100644
--- a/scene/2d/line_2d.cpp
+++ b/scene/2d/line_2d.cpp
@@ -31,7 +31,7 @@
#include "line_2d.h"
#include "line_builder.h"
-#include "core_string_names.h"
+#include "core/core_string_names.h"
// Needed so we can bind functions
VARIANT_ENUM_CAST(Line2D::LineJointMode)
diff --git a/scene/2d/line_builder.h b/scene/2d/line_builder.h
index edfdf97c47..f9d26f12af 100644
--- a/scene/2d/line_builder.h
+++ b/scene/2d/line_builder.h
@@ -31,10 +31,10 @@
#ifndef LINE_BUILDER_H
#define LINE_BUILDER_H
-#include "color.h"
+#include "core/color.h"
+#include "core/math/vector2.h"
#include "line_2d.h"
#include "scene/resources/color_ramp.h"
-#include "vector2.h"
class LineBuilder {
public:
diff --git a/scene/2d/navigation_polygon.cpp b/scene/2d/navigation_polygon.cpp
index 84b12b0bfe..b36924e521 100644
--- a/scene/2d/navigation_polygon.cpp
+++ b/scene/2d/navigation_polygon.cpp
@@ -30,8 +30,8 @@
#include "navigation_polygon.h"
-#include "core_string_names.h"
-#include "engine.h"
+#include "core/core_string_names.h"
+#include "core/engine.h"
#include "navigation2d.h"
#include "thirdparty/misc/triangulator.h"
diff --git a/scene/2d/node_2d.cpp b/scene/2d/node_2d.cpp
index 7de72dc41d..29065a89b3 100644
--- a/scene/2d/node_2d.cpp
+++ b/scene/2d/node_2d.cpp
@@ -30,7 +30,7 @@
#include "node_2d.h"
-#include "message_queue.h"
+#include "core/message_queue.h"
#include "scene/gui/control.h"
#include "scene/main/viewport.h"
#include "servers/visual_server.h"
diff --git a/scene/2d/parallax_layer.cpp b/scene/2d/parallax_layer.cpp
index 2ac6c76032..06de723f27 100644
--- a/scene/2d/parallax_layer.cpp
+++ b/scene/2d/parallax_layer.cpp
@@ -30,7 +30,7 @@
#include "parallax_layer.h"
-#include "engine.h"
+#include "core/engine.h"
#include "parallax_background.h"
void ParallaxLayer::set_motion_scale(const Size2 &p_scale) {
diff --git a/scene/2d/particles_2d.h b/scene/2d/particles_2d.h
index 816149ba79..af673841b1 100644
--- a/scene/2d/particles_2d.h
+++ b/scene/2d/particles_2d.h
@@ -31,7 +31,7 @@
#ifndef PARTICLES_2D_H
#define PARTICLES_2D_H
-#include "rid.h"
+#include "core/rid.h"
#include "scene/2d/node_2d.h"
#include "scene/resources/texture.h"
diff --git a/scene/2d/path_2d.cpp b/scene/2d/path_2d.cpp
index 658b998d17..cdb208e6cd 100644
--- a/scene/2d/path_2d.cpp
+++ b/scene/2d/path_2d.cpp
@@ -30,7 +30,7 @@
#include "path_2d.h"
-#include "engine.h"
+#include "core/engine.h"
#include "scene/scene_string_names.h"
#ifdef TOOLS_ENABLED
diff --git a/scene/2d/physics_body_2d.cpp b/scene/2d/physics_body_2d.cpp
index dc93414669..d0bebd3354 100644
--- a/scene/2d/physics_body_2d.cpp
+++ b/scene/2d/physics_body_2d.cpp
@@ -31,9 +31,9 @@
#include "physics_body_2d.h"
#include "core/core_string_names.h"
+#include "core/engine.h"
+#include "core/math/math_funcs.h"
#include "core/method_bind_ext.gen.inc"
-#include "engine.h"
-#include "math_funcs.h"
#include "scene/scene_string_names.h"
void PhysicsBody2D::_notification(int p_what) {
diff --git a/scene/2d/physics_body_2d.h b/scene/2d/physics_body_2d.h
index 852963a721..29befb0375 100644
--- a/scene/2d/physics_body_2d.h
+++ b/scene/2d/physics_body_2d.h
@@ -31,10 +31,10 @@
#ifndef PHYSICS_BODY_2D_H
#define PHYSICS_BODY_2D_H
+#include "core/vset.h"
#include "scene/2d/collision_object_2d.h"
#include "scene/resources/physics_material.h"
#include "servers/physics_2d_server.h"
-#include "vset.h"
class KinematicCollision2D;
diff --git a/scene/2d/position_2d.cpp b/scene/2d/position_2d.cpp
index 64d23719e7..543314eefa 100644
--- a/scene/2d/position_2d.cpp
+++ b/scene/2d/position_2d.cpp
@@ -30,7 +30,7 @@
#include "position_2d.h"
-#include "engine.h"
+#include "core/engine.h"
#include "scene/resources/texture.h"
void Position2D::_draw_cross() {
diff --git a/scene/2d/ray_cast_2d.cpp b/scene/2d/ray_cast_2d.cpp
index d9b3cb07fc..f7c18a17df 100644
--- a/scene/2d/ray_cast_2d.cpp
+++ b/scene/2d/ray_cast_2d.cpp
@@ -31,7 +31,7 @@
#include "ray_cast_2d.h"
#include "collision_object_2d.h"
-#include "engine.h"
+#include "core/engine.h"
#include "physics_body_2d.h"
#include "servers/physics_2d_server.h"
diff --git a/scene/2d/screen_button.cpp b/scene/2d/screen_button.cpp
index 45f63fd5bf..44a41328e8 100644
--- a/scene/2d/screen_button.cpp
+++ b/scene/2d/screen_button.cpp
@@ -29,9 +29,9 @@
/*************************************************************************/
#include "screen_button.h"
-#include "input_map.h"
-#include "os/input.h"
-#include "os/os.h"
+#include "core/input_map.h"
+#include "core/os/input.h"
+#include "core/os/os.h"
void TouchScreenButton::set_texture(const Ref<Texture> &p_texture) {
diff --git a/scene/2d/sprite.cpp b/scene/2d/sprite.cpp
index bb5990fa79..04e199a21b 100644
--- a/scene/2d/sprite.cpp
+++ b/scene/2d/sprite.cpp
@@ -30,7 +30,7 @@
#include "sprite.h"
#include "core/core_string_names.h"
-#include "os/os.h"
+#include "core/os/os.h"
#include "scene/main/viewport.h"
#include "scene/scene_string_names.h"
diff --git a/scene/2d/tile_map.cpp b/scene/2d/tile_map.cpp
index 8a2fdbacfa..71bd51507e 100644
--- a/scene/2d/tile_map.cpp
+++ b/scene/2d/tile_map.cpp
@@ -30,9 +30,9 @@
#include "tile_map.h"
-#include "io/marshalls.h"
-#include "method_bind_ext.gen.inc"
-#include "os/os.h"
+#include "core/io/marshalls.h"
+#include "core/method_bind_ext.gen.inc"
+#include "core/os/os.h"
#include "servers/physics_2d_server.h"
int TileMap::_get_quadrant_size() const {
diff --git a/scene/2d/tile_map.h b/scene/2d/tile_map.h
index 55db33837f..499c79b180 100644
--- a/scene/2d/tile_map.h
+++ b/scene/2d/tile_map.h
@@ -31,11 +31,11 @@
#ifndef TILE_MAP_H
#define TILE_MAP_H
+#include "core/self_list.h"
+#include "core/vset.h"
#include "scene/2d/navigation2d.h"
#include "scene/2d/node_2d.h"
#include "scene/resources/tile_set.h"
-#include "self_list.h"
-#include "vset.h"
class TileMap : public Node2D {
diff --git a/scene/2d/visibility_notifier_2d.cpp b/scene/2d/visibility_notifier_2d.cpp
index ddca97e60a..7d7c47619a 100644
--- a/scene/2d/visibility_notifier_2d.cpp
+++ b/scene/2d/visibility_notifier_2d.cpp
@@ -30,7 +30,7 @@
#include "visibility_notifier_2d.h"
-#include "engine.h"
+#include "core/engine.h"
#include "particles_2d.h"
#include "scene/2d/animated_sprite.h"
#include "scene/2d/physics_body_2d.h"
diff --git a/scene/3d/area.h b/scene/3d/area.h
index e49b7e493b..e1ff1079e3 100644
--- a/scene/3d/area.h
+++ b/scene/3d/area.h
@@ -31,8 +31,8 @@
#ifndef AREA_H
#define AREA_H
+#include "core/vset.h"
#include "scene/3d/collision_object.h"
-#include "vset.h"
class Area : public CollisionObject {
diff --git a/scene/3d/audio_stream_player_3d.cpp b/scene/3d/audio_stream_player_3d.cpp
index 8504a18f54..386f2a4348 100644
--- a/scene/3d/audio_stream_player_3d.cpp
+++ b/scene/3d/audio_stream_player_3d.cpp
@@ -29,7 +29,7 @@
/*************************************************************************/
#include "audio_stream_player_3d.h"
-#include "engine.h"
+#include "core/engine.h"
#include "scene/3d/area.h"
#include "scene/3d/camera.h"
#include "scene/main/viewport.h"
diff --git a/scene/3d/baked_lightmap.cpp b/scene/3d/baked_lightmap.cpp
index 2cb59c871c..c58e318651 100644
--- a/scene/3d/baked_lightmap.cpp
+++ b/scene/3d/baked_lightmap.cpp
@@ -29,9 +29,9 @@
/*************************************************************************/
#include "baked_lightmap.h"
-#include "io/resource_saver.h"
-#include "os/dir_access.h"
-#include "os/os.h"
+#include "core/io/resource_saver.h"
+#include "core/os/dir_access.h"
+#include "core/os/os.h"
#include "voxel_light_baker.h"
void BakedLightmapData::set_bounds(const AABB &p_bounds) {
diff --git a/scene/3d/camera.cpp b/scene/3d/camera.cpp
index 6ecf219c2b..8ef64e2e80 100644
--- a/scene/3d/camera.cpp
+++ b/scene/3d/camera.cpp
@@ -30,9 +30,9 @@
#include "camera.h"
-#include "camera_matrix.h"
#include "collision_object.h"
-#include "engine.h"
+#include "core/engine.h"
+#include "core/math/camera_matrix.h"
#include "scene/resources/material.h"
#include "scene/resources/surface_tool.h"
void Camera::_update_audio_listener_state() {
diff --git a/scene/3d/collision_shape.cpp b/scene/3d/collision_shape.cpp
index 943f4158f7..4fd68fb47d 100644
--- a/scene/3d/collision_shape.cpp
+++ b/scene/3d/collision_shape.cpp
@@ -38,9 +38,9 @@
#include "scene/resources/sphere_shape.h"
#include "servers/visual_server.h"
//TODO: Implement CylinderShape and HeightMapShape?
+#include "core/math/quick_hull.h"
#include "mesh_instance.h"
#include "physics_body.h"
-#include "quick_hull.h"
void CollisionShape::make_convex_from_brothers() {
diff --git a/scene/3d/cpu_particles.h b/scene/3d/cpu_particles.h
index 47d0ef3f5e..4e29d8d4ce 100644
--- a/scene/3d/cpu_particles.h
+++ b/scene/3d/cpu_particles.h
@@ -31,7 +31,7 @@
#ifndef CPU_PARTICLES_H
#define CPU_PARTICLES_H
-#include "rid.h"
+#include "core/rid.h"
#include "scene/3d/visual_instance.h"
/**
diff --git a/scene/3d/interpolated_camera.cpp b/scene/3d/interpolated_camera.cpp
index ffa283f634..93832f8e00 100644
--- a/scene/3d/interpolated_camera.cpp
+++ b/scene/3d/interpolated_camera.cpp
@@ -30,7 +30,7 @@
#include "interpolated_camera.h"
-#include "engine.h"
+#include "core/engine.h"
void InterpolatedCamera::_notification(int p_what) {
diff --git a/scene/3d/light.cpp b/scene/3d/light.cpp
index e2784c0252..d674958d33 100644
--- a/scene/3d/light.cpp
+++ b/scene/3d/light.cpp
@@ -30,8 +30,8 @@
#include "light.h"
-#include "engine.h"
-#include "project_settings.h"
+#include "core/engine.h"
+#include "core/project_settings.h"
#include "scene/resources/surface_tool.h"
bool Light::_can_gizmo_scale() const {
@@ -319,7 +319,7 @@ Light::Light(VisualServer::LightType p_type) {
Light::Light() {
type = VisualServer::LIGHT_DIRECTIONAL;
- ERR_PRINT("Light shouldn't be instanced dircetly, use the subtypes.");
+ ERR_PRINT("Light should not be instanced directly; use the DirectionalLight, OmniLight or SpotLight subtypes instead.");
}
Light::~Light() {
diff --git a/scene/3d/mesh_instance.cpp b/scene/3d/mesh_instance.cpp
index e277cae5b7..4cbf6f2de3 100644
--- a/scene/3d/mesh_instance.cpp
+++ b/scene/3d/mesh_instance.cpp
@@ -31,7 +31,7 @@
#include "mesh_instance.h"
#include "collision_shape.h"
-#include "core_string_names.h"
+#include "core/core_string_names.h"
#include "physics_body.h"
#include "scene/resources/material.h"
#include "scene/scene_string_names.h"
diff --git a/scene/3d/particles.h b/scene/3d/particles.h
index 742246f78c..72241c5c89 100644
--- a/scene/3d/particles.h
+++ b/scene/3d/particles.h
@@ -31,7 +31,7 @@
#ifndef PARTICLES_H
#define PARTICLES_H
-#include "rid.h"
+#include "core/rid.h"
#include "scene/3d/visual_instance.h"
#include "scene/resources/material.h"
diff --git a/scene/3d/path.cpp b/scene/3d/path.cpp
index 9acaa15641..e37efa0e8a 100644
--- a/scene/3d/path.cpp
+++ b/scene/3d/path.cpp
@@ -30,7 +30,7 @@
#include "path.h"
-#include "engine.h"
+#include "core/engine.h"
#include "scene/scene_string_names.h"
void Path::_notification(int p_what) {
diff --git a/scene/3d/physics_body.cpp b/scene/3d/physics_body.cpp
index f7af6a57dd..d7bd89625f 100644
--- a/scene/3d/physics_body.cpp
+++ b/scene/3d/physics_body.cpp
@@ -31,8 +31,8 @@
#include "physics_body.h"
#include "core/core_string_names.h"
-#include "engine.h"
-#include "method_bind_ext.gen.inc"
+#include "core/engine.h"
+#include "core/method_bind_ext.gen.inc"
#include "scene/scene_string_names.h"
#ifdef TOOLS_ENABLED
diff --git a/scene/3d/physics_body.h b/scene/3d/physics_body.h
index c4db41f577..ca48b51ffb 100644
--- a/scene/3d/physics_body.h
+++ b/scene/3d/physics_body.h
@@ -31,11 +31,11 @@
#ifndef PHYSICS_BODY__H
#define PHYSICS_BODY__H
+#include "core/vset.h"
#include "scene/3d/collision_object.h"
#include "scene/resources/physics_material.h"
#include "servers/physics_server.h"
#include "skeleton.h"
-#include "vset.h"
class PhysicsBody : public CollisionObject {
diff --git a/scene/3d/portal.cpp b/scene/3d/portal.cpp
index d16d9ed7c5..137338d79e 100644
--- a/scene/3d/portal.cpp
+++ b/scene/3d/portal.cpp
@@ -29,7 +29,7 @@
/*************************************************************************/
#include "portal.h"
-#include "project_settings.h"
+#include "core/project_settings.h"
#include "scene/resources/surface_tool.h"
#include "servers/visual_server.h"
diff --git a/scene/3d/proximity_group.cpp b/scene/3d/proximity_group.cpp
index 101d9ed70c..f56f728d99 100644
--- a/scene/3d/proximity_group.cpp
+++ b/scene/3d/proximity_group.cpp
@@ -30,7 +30,7 @@
#include "proximity_group.h"
-#include "math_funcs.h"
+#include "core/math/math_funcs.h"
void ProximityGroup::clear_groups() {
diff --git a/scene/3d/ray_cast.cpp b/scene/3d/ray_cast.cpp
index b846a5b6c0..17f069bbc8 100644
--- a/scene/3d/ray_cast.cpp
+++ b/scene/3d/ray_cast.cpp
@@ -31,7 +31,7 @@
#include "ray_cast.h"
#include "collision_object.h"
-#include "engine.h"
+#include "core/engine.h"
#include "mesh_instance.h"
#include "servers/physics_server.h"
diff --git a/scene/3d/room_instance.cpp b/scene/3d/room_instance.cpp
index 0d83a9942e..3914d7190e 100644
--- a/scene/3d/room_instance.cpp
+++ b/scene/3d/room_instance.cpp
@@ -34,8 +34,8 @@
// FIXME: Will be removed, kept as reference for new implementation
#if 0
-#include "geometry.h"
-#include "project_settings.h"
+#include "core/math/geometry.h"
+#include "core/project_settings.h"
#include "scene/resources/surface_tool.h"
void Room::_notification(int p_what) {
diff --git a/scene/3d/skeleton.cpp b/scene/3d/skeleton.cpp
index c796e47f25..db82ef2a5c 100644
--- a/scene/3d/skeleton.cpp
+++ b/scene/3d/skeleton.cpp
@@ -30,7 +30,7 @@
#include "skeleton.h"
-#include "message_queue.h"
+#include "core/message_queue.h"
#include "core/project_settings.h"
#include "scene/3d/physics_body.h"
diff --git a/scene/3d/skeleton.h b/scene/3d/skeleton.h
index e044e08437..07abdc1fe7 100644
--- a/scene/3d/skeleton.h
+++ b/scene/3d/skeleton.h
@@ -31,7 +31,7 @@
#ifndef SKELETON_H
#define SKELETON_H
-#include "rid.h"
+#include "core/rid.h"
#include "scene/3d/spatial.h"
/**
diff --git a/scene/3d/soft_body.cpp b/scene/3d/soft_body.cpp
index 58ddb52760..4ebc941ebc 100644
--- a/scene/3d/soft_body.cpp
+++ b/scene/3d/soft_body.cpp
@@ -29,7 +29,7 @@
/*************************************************************************/
#include "soft_body.h"
-#include "os/os.h"
+#include "core/os/os.h"
#include "scene/3d/collision_object.h"
#include "scene/3d/skeleton.h"
#include "servers/physics_server.h"
diff --git a/scene/3d/spatial.cpp b/scene/3d/spatial.cpp
index d6141c12a8..fcc908cdc6 100644
--- a/scene/3d/spatial.cpp
+++ b/scene/3d/spatial.cpp
@@ -30,8 +30,8 @@
#include "spatial.h"
-#include "engine.h"
-#include "message_queue.h"
+#include "core/engine.h"
+#include "core/message_queue.h"
#include "scene/main/viewport.h"
#include "scene/scene_string_names.h"
diff --git a/scene/3d/spatial_velocity_tracker.cpp b/scene/3d/spatial_velocity_tracker.cpp
index d96b003a81..3850a0c7e6 100644
--- a/scene/3d/spatial_velocity_tracker.cpp
+++ b/scene/3d/spatial_velocity_tracker.cpp
@@ -29,7 +29,7 @@
/*************************************************************************/
#include "spatial_velocity_tracker.h"
-#include "engine.h"
+#include "core/engine.h"
void SpatialVelocityTracker::set_track_physics_step(bool p_track_physics_step) {
diff --git a/scene/3d/spring_arm.cpp b/scene/3d/spring_arm.cpp
index 492c6b806e..818e7f9217 100644
--- a/scene/3d/spring_arm.cpp
+++ b/scene/3d/spring_arm.cpp
@@ -29,7 +29,7 @@
/*************************************************************************/
#include "spring_arm.h"
-#include "engine.h"
+#include "core/engine.h"
#include "scene/3d/collision_object.h"
#include "scene/resources/sphere_shape.h"
#include "servers/physics_server.h"
diff --git a/scene/3d/sprite_3d.cpp b/scene/3d/sprite_3d.cpp
index 036a748c83..36c0dfc18a 100644
--- a/scene/3d/sprite_3d.cpp
+++ b/scene/3d/sprite_3d.cpp
@@ -29,7 +29,7 @@
/*************************************************************************/
#include "sprite_3d.h"
-#include "core_string_names.h"
+#include "core/core_string_names.h"
#include "scene/scene_string_names.h"
Color SpriteBase3D::_get_color_accum() {
diff --git a/scene/3d/vehicle_body.cpp b/scene/3d/vehicle_body.cpp
index f9d096633c..56a86b6a17 100644
--- a/scene/3d/vehicle_body.cpp
+++ b/scene/3d/vehicle_body.cpp
@@ -562,7 +562,7 @@ void VehicleBody::_resolve_single_bilateral(PhysicsDirectBodyState *s, const Vec
b2invmass);
// FIXME: rel_vel assignment here is overwritten by the following assignment.
- // What seemes to be intended in the next next assignment is: rel_vel = normal.dot(rel_vel);
+ // What seems to be intended in the next next assignment is: rel_vel = normal.dot(rel_vel);
// Investigate why.
real_t rel_vel = jac.getRelativeVelocity(
s->get_linear_velocity(),
diff --git a/scene/3d/visibility_notifier.cpp b/scene/3d/visibility_notifier.cpp
index 9d6e4941f3..c69387d082 100644
--- a/scene/3d/visibility_notifier.cpp
+++ b/scene/3d/visibility_notifier.cpp
@@ -30,7 +30,7 @@
#include "visibility_notifier.h"
-#include "engine.h"
+#include "core/engine.h"
#include "scene/3d/camera.h"
#include "scene/3d/physics_body.h"
#include "scene/animation/animation_player.h"
diff --git a/scene/3d/visual_instance.h b/scene/3d/visual_instance.h
index 9249bc04ce..784f2a358a 100644
--- a/scene/3d/visual_instance.h
+++ b/scene/3d/visual_instance.h
@@ -31,8 +31,8 @@
#ifndef VISUAL_INSTANCE_H
#define VISUAL_INSTANCE_H
-#include "face3.h"
-#include "rid.h"
+#include "core/math/face3.h"
+#include "core/rid.h"
#include "scene/3d/spatial.h"
#include "scene/resources/material.h"
/**
diff --git a/scene/3d/voxel_light_baker.cpp b/scene/3d/voxel_light_baker.cpp
index e846e1763d..651a057392 100644
--- a/scene/3d/voxel_light_baker.cpp
+++ b/scene/3d/voxel_light_baker.cpp
@@ -29,8 +29,8 @@
/*************************************************************************/
#include "voxel_light_baker.h"
-#include "os/os.h"
-#include "os/threaded_array_processor.h"
+#include "core/os/os.h"
+#include "core/os/threaded_array_processor.h"
#include <stdlib.h>
diff --git a/scene/animation/animation_blend_space_2d.cpp b/scene/animation/animation_blend_space_2d.cpp
index f3a76b950e..f5f899a6cd 100644
--- a/scene/animation/animation_blend_space_2d.cpp
+++ b/scene/animation/animation_blend_space_2d.cpp
@@ -29,7 +29,7 @@
/*************************************************************************/
#include "animation_blend_space_2d.h"
-#include "math/delaunay.h"
+#include "core/math/delaunay.h"
void AnimationNodeBlendSpace2D::get_parameter_list(List<PropertyInfo> *r_list) const {
r_list->push_back(PropertyInfo(Variant::VECTOR2, blend_position));
diff --git a/scene/animation/animation_node_state_machine.cpp b/scene/animation/animation_node_state_machine.cpp
index 837723450c..5923ad7657 100644
--- a/scene/animation/animation_node_state_machine.cpp
+++ b/scene/animation/animation_node_state_machine.cpp
@@ -320,7 +320,7 @@ float AnimationNodeStateMachinePlayback::process(AnimationNodeStateMachine *sm,
}
if (!_travel(sm, start_request)) {
- //cant travel, then teleport
+ //can't travel, then teleport
path.clear();
current = start_request;
}
diff --git a/scene/animation/animation_player.cpp b/scene/animation/animation_player.cpp
index d8db1973d2..7d91703cf8 100644
--- a/scene/animation/animation_player.cpp
+++ b/scene/animation/animation_player.cpp
@@ -30,8 +30,8 @@
#include "animation_player.h"
-#include "engine.h"
-#include "message_queue.h"
+#include "core/engine.h"
+#include "core/message_queue.h"
#include "scene/scene_string_names.h"
#include "servers/audio/audio_stream.h"
#ifdef TOOLS_ENABLED
@@ -263,43 +263,36 @@ void AnimationPlayer::_ensure_node_caches(AnimationData *p_anim) {
key.id = id;
key.bone_idx = bone_idx;
- if (node_cache_map.has(key)) {
-
- p_anim->node_cache.write[i] = &node_cache_map[key];
- } else {
-
+ if (!node_cache_map.has(key))
node_cache_map[key] = TrackNodeCache();
- p_anim->node_cache.write[i] = &node_cache_map[key];
- p_anim->node_cache[i]->path = a->track_get_path(i);
- p_anim->node_cache[i]->node = child;
- p_anim->node_cache[i]->resource = resource;
- p_anim->node_cache[i]->node_2d = Object::cast_to<Node2D>(child);
- if (a->track_get_type(i) == Animation::TYPE_TRANSFORM) {
- // special cases and caches for transform tracks
-
- // cache spatial
- p_anim->node_cache[i]->spatial = Object::cast_to<Spatial>(child);
- // cache skeleton
- p_anim->node_cache[i]->skeleton = Object::cast_to<Skeleton>(child);
- if (p_anim->node_cache[i]->skeleton) {
-
- if (a->track_get_path(i).get_subname_count() == 1) {
- StringName bone_name = a->track_get_path(i).get_subname(0);
-
- p_anim->node_cache[i]->bone_idx = p_anim->node_cache[i]->skeleton->find_bone(bone_name);
- if (p_anim->node_cache[i]->bone_idx < 0) {
- // broken track (nonexistent bone)
- p_anim->node_cache[i]->skeleton = NULL;
- p_anim->node_cache[i]->spatial = NULL;
- printf("bone is %ls\n", String(bone_name).c_str());
- ERR_CONTINUE(p_anim->node_cache[i]->bone_idx < 0);
- } else {
- }
- } else {
- // no property, just use spatialnode
+ p_anim->node_cache.write[i] = &node_cache_map[key];
+ p_anim->node_cache[i]->path = a->track_get_path(i);
+ p_anim->node_cache[i]->node = child;
+ p_anim->node_cache[i]->resource = resource;
+ p_anim->node_cache[i]->node_2d = Object::cast_to<Node2D>(child);
+ if (a->track_get_type(i) == Animation::TYPE_TRANSFORM) {
+ // special cases and caches for transform tracks
+
+ // cache spatial
+ p_anim->node_cache[i]->spatial = Object::cast_to<Spatial>(child);
+ // cache skeleton
+ p_anim->node_cache[i]->skeleton = Object::cast_to<Skeleton>(child);
+ if (p_anim->node_cache[i]->skeleton) {
+ if (a->track_get_path(i).get_subname_count() == 1) {
+ StringName bone_name = a->track_get_path(i).get_subname(0);
+
+ p_anim->node_cache[i]->bone_idx = p_anim->node_cache[i]->skeleton->find_bone(bone_name);
+ if (p_anim->node_cache[i]->bone_idx < 0) {
+ // broken track (nonexistent bone)
p_anim->node_cache[i]->skeleton = NULL;
+ p_anim->node_cache[i]->spatial = NULL;
+ printf("bone is %ls\n", String(bone_name).c_str());
+ ERR_CONTINUE(p_anim->node_cache[i]->bone_idx < 0);
}
+ } else {
+ // no property, just use spatialnode
+ p_anim->node_cache[i]->skeleton = NULL;
}
}
}
@@ -426,7 +419,7 @@ void AnimationPlayer::_animation_process_animation(AnimationData *p_anim, float
if (first_key_time == 0.0) {
//ignore, use for transition
if (key_count == 1)
- continue; //with one key we cant do anything
+ continue; //with one key we can't do anything
transition = a->track_get_key_transition(i, 0);
first_key_time = a->track_get_key_time(i, 1);
first_key = 1;
diff --git a/scene/animation/animation_tree.cpp b/scene/animation/animation_tree.cpp
index 9b06d538e9..eb00f91bb3 100644
--- a/scene/animation/animation_tree.cpp
+++ b/scene/animation/animation_tree.cpp
@@ -29,9 +29,10 @@
/*************************************************************************/
#include "animation_tree.h"
+
#include "animation_blend_tree.h"
+#include "core/engine.h"
#include "core/method_bind_ext.gen.inc"
-#include "engine.h"
#include "scene/scene_string_names.h"
#include "servers/audio/audio_stream.h"
@@ -191,7 +192,7 @@ float AnimationNode::_blend_node(const StringName &p_subpath, const Vector<Strin
case FILTER_IGNORE:
break; //will not happen anyway
case FILTER_PASS: {
- //values filtered pass, the rest dont
+ //values filtered pass, the rest don't
for (int i = 0; i < blend_count; i++) {
if (blendw[i] == 0) //not filtered, does not pass
continue;
@@ -205,7 +206,7 @@ float AnimationNode::_blend_node(const StringName &p_subpath, const Vector<Strin
} break;
case FILTER_STOP: {
- //values filtered dont pass, the rest are blended
+ //values filtered don't pass, the rest are blended
for (int i = 0; i < blend_count; i++) {
if (blendw[i] > 0) //filtered, does not pass
@@ -291,7 +292,7 @@ String AnimationNode::get_caption() const {
}
void AnimationNode::add_input(const String &p_name) {
- //root nodes cant add inputs
+ //root nodes can't add inputs
ERR_FAIL_COND(Object::cast_to<AnimationRootNode>(this) != NULL)
Input input;
ERR_FAIL_COND(p_name.find(".") != -1 || p_name.find("/") != -1);
@@ -1226,7 +1227,7 @@ void AnimationTree::_process_graph(float p_delta) {
t->object->set_indexed(t->subpath, t->value);
} break;
- default: {} //the rest dont matter
+ default: {} //the rest don't matter
}
}
}
diff --git a/scene/animation/root_motion_view.cpp b/scene/animation/root_motion_view.cpp
index 098bd05e9a..01a10dbc2b 100644
--- a/scene/animation/root_motion_view.cpp
+++ b/scene/animation/root_motion_view.cpp
@@ -112,7 +112,7 @@ void RootMotionView::_notification(int p_what) {
first = false;
- transform.orthonormalize(); //dont want scale, too imprecise
+ transform.orthonormalize(); //don't want scale, too imprecise
transform.affine_invert();
accumulated = transform * accumulated;
diff --git a/scene/animation/tween.cpp b/scene/animation/tween.cpp
index 58be636e44..82e2bb93e2 100644
--- a/scene/animation/tween.cpp
+++ b/scene/animation/tween.cpp
@@ -29,7 +29,8 @@
/*************************************************************************/
#include "tween.h"
-#include "method_bind_ext.gen.inc"
+
+#include "core/method_bind_ext.gen.inc"
void Tween::_add_pending_command(StringName p_key, const Variant &p_arg1, const Variant &p_arg2, const Variant &p_arg3, const Variant &p_arg4, const Variant &p_arg5, const Variant &p_arg6, const Variant &p_arg7, const Variant &p_arg8, const Variant &p_arg9, const Variant &p_arg10) {
@@ -673,6 +674,10 @@ float Tween::get_speed_scale() const {
}
bool Tween::start() {
+ if (pending_update != 0) {
+ call_deferred("start");
+ return true;
+ }
set_active(true);
return true;
diff --git a/scene/animation/tween_interpolaters.cpp b/scene/animation/tween_interpolaters.cpp
index 11f2b0c17f..52aa7403c0 100644
--- a/scene/animation/tween_interpolaters.cpp
+++ b/scene/animation/tween_interpolaters.cpp
@@ -28,6 +28,12 @@
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
/*************************************************************************/
+/**
+ * Adapted from Penner Easing equations' C++ port.
+ * Source: https://github.com/jesusgollonet/ofpennereasing
+ * License: BSD-3-clause
+ */
+
#include "tween.h"
const real_t pi = 3.1415926535898;
diff --git a/scene/audio/audio_player.cpp b/scene/audio/audio_player.cpp
index 7a9f2bd8d0..64af7efb16 100644
--- a/scene/audio/audio_player.cpp
+++ b/scene/audio/audio_player.cpp
@@ -30,7 +30,7 @@
#include "audio_player.h"
-#include "engine.h"
+#include "core/engine.h"
void AudioStreamPlayer::_mix_internal(bool p_fadeout) {
diff --git a/scene/gui/base_button.cpp b/scene/gui/base_button.cpp
index d17ae1d84c..59590ea67b 100644
--- a/scene/gui/base_button.cpp
+++ b/scene/gui/base_button.cpp
@@ -30,7 +30,7 @@
#include "base_button.h"
-#include "os/keyboard.h"
+#include "core/os/keyboard.h"
#include "scene/main/viewport.h"
#include "scene/scene_string_names.h"
diff --git a/scene/gui/button.cpp b/scene/gui/button.cpp
index a34f2f1ad5..dd6d66ac62 100644
--- a/scene/gui/button.cpp
+++ b/scene/gui/button.cpp
@@ -29,8 +29,8 @@
/*************************************************************************/
#include "button.h"
+#include "core/translation.h"
#include "servers/visual_server.h"
-#include "translation.h"
Size2 Button::get_minimum_size() const {
diff --git a/scene/gui/check_button.cpp b/scene/gui/check_button.cpp
index f9ed0ecdbb..fa9538da28 100644
--- a/scene/gui/check_button.cpp
+++ b/scene/gui/check_button.cpp
@@ -30,7 +30,7 @@
#include "check_button.h"
-#include "print_string.h"
+#include "core/print_string.h"
#include "servers/visual_server.h"
Size2 CheckButton::get_icon_size() const {
diff --git a/scene/gui/color_picker.cpp b/scene/gui/color_picker.cpp
index 8e232c6f46..537a16fbc3 100644
--- a/scene/gui/color_picker.cpp
+++ b/scene/gui/color_picker.cpp
@@ -30,9 +30,9 @@
#include "color_picker.h"
-#include "os/input.h"
-#include "os/keyboard.h"
-#include "os/os.h"
+#include "core/os/input.h"
+#include "core/os/keyboard.h"
+#include "core/os/os.h"
#include "scene/gui/separator.h"
#include "scene/main/viewport.h"
diff --git a/scene/gui/container.cpp b/scene/gui/container.cpp
index 7df03bf7c6..d606629041 100644
--- a/scene/gui/container.cpp
+++ b/scene/gui/container.cpp
@@ -29,7 +29,7 @@
/*************************************************************************/
#include "container.h"
-#include "message_queue.h"
+#include "core/message_queue.h"
#include "scene/scene_string_names.h"
void Container::_child_minsize_changed() {
diff --git a/scene/gui/control.cpp b/scene/gui/control.cpp
index dc042b88d2..12349e0983 100644
--- a/scene/gui/control.cpp
+++ b/scene/gui/control.cpp
@@ -29,15 +29,15 @@
/*************************************************************************/
#include "control.h"
-#include "project_settings.h"
+#include "core/project_settings.h"
#include "scene/main/canvas_layer.h"
#include "scene/main/viewport.h"
#include "servers/visual_server.h"
-#include "message_queue.h"
-#include "os/keyboard.h"
-#include "os/os.h"
-#include "print_string.h"
+#include "core/message_queue.h"
+#include "core/os/keyboard.h"
+#include "core/os/os.h"
+#include "core/print_string.h"
#include "scene/gui/label.h"
#include "scene/gui/panel.h"
#include "scene/scene_string_names.h"
@@ -2877,7 +2877,7 @@ void Control::_bind_methods() {
ADD_GROUP("Mouse", "mouse_");
ADD_PROPERTY(PropertyInfo(Variant::INT, "mouse_filter", PROPERTY_HINT_ENUM, "Stop,Pass,Ignore"), "set_mouse_filter", "get_mouse_filter");
- ADD_PROPERTY(PropertyInfo(Variant::INT, "mouse_default_cursor_shape", PROPERTY_HINT_ENUM, "Arrow,Ibeam,Pointing hand,Cross,Wait,Busy,Drag,Can drop,Forbidden,Vertical resize,Horizontal resize,Secondary diagonal resize,Main diagonal resize,Move,Vertial split,Horizontal split,Help"), "set_default_cursor_shape", "get_default_cursor_shape");
+ ADD_PROPERTY(PropertyInfo(Variant::INT, "mouse_default_cursor_shape", PROPERTY_HINT_ENUM, "Arrow,Ibeam,Pointing hand,Cross,Wait,Busy,Drag,Can drop,Forbidden,Vertical resize,Horizontal resize,Secondary diagonal resize,Main diagonal resize,Move,Vertical split,Horizontal split,Help"), "set_default_cursor_shape", "get_default_cursor_shape");
ADD_GROUP("Size Flags", "size_flags_");
ADD_PROPERTY(PropertyInfo(Variant::INT, "size_flags_horizontal", PROPERTY_HINT_FLAGS, "Fill,Expand,Shrink Center,Shrink End"), "set_h_size_flags", "get_h_size_flags");
diff --git a/scene/gui/control.h b/scene/gui/control.h
index c6bd2f097d..eb39d9ca0f 100644
--- a/scene/gui/control.h
+++ b/scene/gui/control.h
@@ -31,13 +31,13 @@
#ifndef CONTROL_H
#define CONTROL_H
-#include "rid.h"
+#include "core/math/transform_2d.h"
+#include "core/rid.h"
#include "scene/2d/canvas_item.h"
#include "scene/gui/shortcut.h"
#include "scene/main/node.h"
#include "scene/main/timer.h"
#include "scene/resources/theme.h"
-#include "transform_2d.h"
/**
@author Juan Linietsky <reduzio@gmail.com>
*/
@@ -76,7 +76,7 @@ public:
SIZE_EXPAND = 2,
SIZE_EXPAND_FILL = SIZE_EXPAND | SIZE_FILL,
SIZE_SHRINK_CENTER = 4, //ignored by expand or fill
- SIZE_SHRINK_END = 8, //ignored by expand or fil
+ SIZE_SHRINK_END = 8, //ignored by expand or fill
};
diff --git a/scene/gui/dialogs.cpp b/scene/gui/dialogs.cpp
index d9737fa21a..e3a21eb10d 100644
--- a/scene/gui/dialogs.cpp
+++ b/scene/gui/dialogs.cpp
@@ -29,9 +29,9 @@
/*************************************************************************/
#include "dialogs.h"
+#include "core/print_string.h"
+#include "core/translation.h"
#include "line_edit.h"
-#include "print_string.h"
-#include "translation.h"
#ifdef TOOLS_ENABLED
#include "editor/editor_node.h"
diff --git a/scene/gui/file_dialog.cpp b/scene/gui/file_dialog.cpp
index 9bddaa7d29..5f162a3652 100644
--- a/scene/gui/file_dialog.cpp
+++ b/scene/gui/file_dialog.cpp
@@ -29,8 +29,8 @@
/*************************************************************************/
#include "file_dialog.h"
-#include "os/keyboard.h"
-#include "print_string.h"
+#include "core/os/keyboard.h"
+#include "core/print_string.h"
#include "scene/gui/label.h"
FileDialog::GetIconFunc FileDialog::get_icon_func = NULL;
diff --git a/scene/gui/file_dialog.h b/scene/gui/file_dialog.h
index 3227f1c3a8..8bd15080d3 100644
--- a/scene/gui/file_dialog.h
+++ b/scene/gui/file_dialog.h
@@ -32,7 +32,7 @@
#define FILE_DIALOG_H
#include "box_container.h"
-#include "os/dir_access.h"
+#include "core/os/dir_access.h"
#include "scene/gui/dialogs.h"
#include "scene/gui/line_edit.h"
#include "scene/gui/option_button.h"
diff --git a/scene/gui/gradient_edit.cpp b/scene/gui/gradient_edit.cpp
index dc013f00a5..19ffe681ef 100644
--- a/scene/gui/gradient_edit.cpp
+++ b/scene/gui/gradient_edit.cpp
@@ -29,8 +29,8 @@
/*************************************************************************/
#include "gradient_edit.h"
+#include "core/os/keyboard.h"
#include "editor/editor_scale.h"
-#include "os/keyboard.h"
#define SPACING (3 * EDSCALE)
diff --git a/scene/gui/graph_edit.cpp b/scene/gui/graph_edit.cpp
index 8797ab6fd3..0ffaac20f6 100644
--- a/scene/gui/graph_edit.cpp
+++ b/scene/gui/graph_edit.cpp
@@ -30,8 +30,8 @@
#include "graph_edit.h"
-#include "os/input.h"
-#include "os/keyboard.h"
+#include "core/os/input.h"
+#include "core/os/keyboard.h"
#include "scene/gui/box_container.h"
#define ZOOM_SCALE 1.2
@@ -1304,7 +1304,7 @@ GraphEdit::GraphEdit() {
add_child(connections_layer);
connections_layer->connect("draw", this, "_connections_layer_draw");
connections_layer->set_name("CLAYER");
- connections_layer->set_disable_visibility_clip(true); // so it can draw freely and be offseted
+ connections_layer->set_disable_visibility_clip(true); // so it can draw freely and be offset
connections_layer->set_mouse_filter(MOUSE_FILTER_IGNORE);
h_scroll = memnew(HScrollBar);
diff --git a/scene/gui/graph_node.cpp b/scene/gui/graph_node.cpp
index 24857d49fa..b189afd30b 100644
--- a/scene/gui/graph_node.cpp
+++ b/scene/gui/graph_node.cpp
@@ -29,7 +29,8 @@
/*************************************************************************/
#include "graph_node.h"
-#include "method_bind_ext.gen.inc"
+
+#include "core/method_bind_ext.gen.inc"
bool GraphNode::_set(const StringName &p_name, const Variant &p_value) {
diff --git a/scene/gui/item_list.cpp b/scene/gui/item_list.cpp
index 9f5c12e87f..0d5fbee9ee 100644
--- a/scene/gui/item_list.cpp
+++ b/scene/gui/item_list.cpp
@@ -29,8 +29,8 @@
/*************************************************************************/
#include "item_list.h"
-#include "os/os.h"
-#include "project_settings.h"
+#include "core/os/os.h"
+#include "core/project_settings.h"
void ItemList::add_item(const String &p_item, const Ref<Texture> &p_texture, bool p_selectable) {
diff --git a/scene/gui/label.cpp b/scene/gui/label.cpp
index 0b36e1663c..ce8de38b74 100644
--- a/scene/gui/label.cpp
+++ b/scene/gui/label.cpp
@@ -29,9 +29,9 @@
/*************************************************************************/
#include "label.h"
-#include "print_string.h"
-#include "project_settings.h"
-#include "translation.h"
+#include "core/print_string.h"
+#include "core/project_settings.h"
+#include "core/translation.h"
void Label::set_autowrap(bool p_autowrap) {
diff --git a/scene/gui/line_edit.cpp b/scene/gui/line_edit.cpp
index 1f3d5e6e13..9c43d5b308 100644
--- a/scene/gui/line_edit.cpp
+++ b/scene/gui/line_edit.cpp
@@ -29,12 +29,12 @@
/*************************************************************************/
#include "line_edit.h"
+#include "core/message_queue.h"
+#include "core/os/keyboard.h"
+#include "core/os/os.h"
+#include "core/print_string.h"
+#include "core/translation.h"
#include "label.h"
-#include "message_queue.h"
-#include "os/keyboard.h"
-#include "os/os.h"
-#include "print_string.h"
-#include "translation.h"
#ifdef TOOLS_ENABLED
#include "editor/editor_scale.h"
diff --git a/scene/gui/menu_button.cpp b/scene/gui/menu_button.cpp
index 87cf4dc334..95ec618c3b 100644
--- a/scene/gui/menu_button.cpp
+++ b/scene/gui/menu_button.cpp
@@ -29,7 +29,7 @@
/*************************************************************************/
#include "menu_button.h"
-#include "os/keyboard.h"
+#include "core/os/keyboard.h"
#include "scene/main/viewport.h"
void MenuButton::_unhandled_key_input(Ref<InputEvent> p_event) {
diff --git a/scene/gui/option_button.cpp b/scene/gui/option_button.cpp
index 2901176a69..6b847c6483 100644
--- a/scene/gui/option_button.cpp
+++ b/scene/gui/option_button.cpp
@@ -29,7 +29,7 @@
/*************************************************************************/
#include "option_button.h"
-#include "print_string.h"
+#include "core/print_string.h"
Size2 OptionButton::get_minimum_size() const {
diff --git a/scene/gui/panel.cpp b/scene/gui/panel.cpp
index 4375e03a50..d3b7b72ee1 100644
--- a/scene/gui/panel.cpp
+++ b/scene/gui/panel.cpp
@@ -29,7 +29,7 @@
/*************************************************************************/
#include "panel.h"
-#include "print_string.h"
+#include "core/print_string.h"
void Panel::_notification(int p_what) {
diff --git a/scene/gui/popup.cpp b/scene/gui/popup.cpp
index 2add67ace1..bfbe62e1c7 100644
--- a/scene/gui/popup.cpp
+++ b/scene/gui/popup.cpp
@@ -30,8 +30,8 @@
#include "popup.h"
-#include "engine.h"
-#include "os/keyboard.h"
+#include "core/engine.h"
+#include "core/os/keyboard.h"
void Popup::_gui_input(Ref<InputEvent> p_event) {
}
diff --git a/scene/gui/popup_menu.cpp b/scene/gui/popup_menu.cpp
index 436dda41a4..3239641c2f 100644
--- a/scene/gui/popup_menu.cpp
+++ b/scene/gui/popup_menu.cpp
@@ -29,10 +29,10 @@
/*************************************************************************/
#include "popup_menu.h"
-#include "os/input.h"
-#include "os/keyboard.h"
-#include "print_string.h"
-#include "translation.h"
+#include "core/os/input.h"
+#include "core/os/keyboard.h"
+#include "core/print_string.h"
+#include "core/translation.h"
String PopupMenu::_get_accel_text(int p_item) const {
diff --git a/scene/gui/reference_rect.cpp b/scene/gui/reference_rect.cpp
index 74e68598f4..e96e5afb2a 100644
--- a/scene/gui/reference_rect.cpp
+++ b/scene/gui/reference_rect.cpp
@@ -30,7 +30,7 @@
#include "reference_rect.h"
-#include "engine.h"
+#include "core/engine.h"
void ReferenceRect::_notification(int p_what) {
diff --git a/scene/gui/rich_text_label.cpp b/scene/gui/rich_text_label.cpp
index a5f9bea1b1..1e281471a6 100644
--- a/scene/gui/rich_text_label.cpp
+++ b/scene/gui/rich_text_label.cpp
@@ -29,8 +29,8 @@
/*************************************************************************/
#include "rich_text_label.h"
-#include "os/keyboard.h"
-#include "os/os.h"
+#include "core/os/keyboard.h"
+#include "core/os/os.h"
#include "scene/scene_string_names.h"
#ifdef TOOLS_ENABLED
@@ -1423,18 +1423,28 @@ bool RichTextLabel::remove_line(const int p_line) {
if (p_line >= current_frame->lines.size() || p_line < 0)
return false;
- int lines = p_line * 2;
+ int i = 0;
+ while (i < current->subitems.size() && current->subitems[i]->line < p_line) {
+ i++;
+ }
- if (current->subitems[lines]->type != ITEM_NEWLINE)
- _remove_item(current->subitems[lines], current->subitems[lines]->line, lines);
+ bool was_newline = false;
+ while (i < current->subitems.size()) {
+ was_newline = current->subitems[i]->type == ITEM_NEWLINE;
+ _remove_item(current->subitems[i], current->subitems[i]->line, p_line);
+ if (was_newline)
+ break;
+ }
- _remove_item(current->subitems[lines], current->subitems[lines]->line, lines);
+ if (!was_newline) {
+ current_frame->lines.remove(p_line);
+ }
- if (p_line == 0) {
+ if (p_line == 0 && current->subitems.size() > 0)
main->lines.write[0].from = main;
- }
main->first_invalid_line = 0;
+
return true;
}
diff --git a/scene/gui/scroll_bar.cpp b/scene/gui/scroll_bar.cpp
index e5bd1c453d..df27fb0e6b 100644
--- a/scene/gui/scroll_bar.cpp
+++ b/scene/gui/scroll_bar.cpp
@@ -30,9 +30,9 @@
#include "scroll_bar.h"
-#include "os/keyboard.h"
-#include "os/os.h"
-#include "print_string.h"
+#include "core/os/keyboard.h"
+#include "core/os/os.h"
+#include "core/print_string.h"
bool ScrollBar::focus_by_default = false;
diff --git a/scene/gui/scroll_container.cpp b/scene/gui/scroll_container.cpp
index 495d618930..e3fb602065 100644
--- a/scene/gui/scroll_container.cpp
+++ b/scene/gui/scroll_container.cpp
@@ -29,7 +29,7 @@
/*************************************************************************/
#include "scroll_container.h"
-#include "os/os.h"
+#include "core/os/os.h"
bool ScrollContainer::clips_input() const {
return true;
diff --git a/scene/gui/shortcut.cpp b/scene/gui/shortcut.cpp
index 36490cf254..6fcf96f611 100644
--- a/scene/gui/shortcut.cpp
+++ b/scene/gui/shortcut.cpp
@@ -30,7 +30,7 @@
#include "shortcut.h"
-#include "os/keyboard.h"
+#include "core/os/keyboard.h"
void ShortCut::set_shortcut(const Ref<InputEvent> &p_shortcut) {
diff --git a/scene/gui/shortcut.h b/scene/gui/shortcut.h
index f9240642bf..7613a24e43 100644
--- a/scene/gui/shortcut.h
+++ b/scene/gui/shortcut.h
@@ -31,8 +31,8 @@
#ifndef SHORTCUT_H
#define SHORTCUT_H
-#include "os/input_event.h"
-#include "resource.h"
+#include "core/os/input_event.h"
+#include "core/resource.h"
class ShortCut : public Resource {
diff --git a/scene/gui/slider.cpp b/scene/gui/slider.cpp
index b820e2eafd..147c0518ec 100644
--- a/scene/gui/slider.cpp
+++ b/scene/gui/slider.cpp
@@ -29,7 +29,7 @@
/*************************************************************************/
#include "slider.h"
-#include "os/keyboard.h"
+#include "core/os/keyboard.h"
Size2 Slider::get_minimum_size() const {
diff --git a/scene/gui/spin_box.cpp b/scene/gui/spin_box.cpp
index 145981d498..2221923093 100644
--- a/scene/gui/spin_box.cpp
+++ b/scene/gui/spin_box.cpp
@@ -29,7 +29,7 @@
/*************************************************************************/
#include "spin_box.h"
-#include "os/input.h"
+#include "core/os/input.h"
Size2 SpinBox::get_minimum_size() const {
diff --git a/scene/gui/tab_container.cpp b/scene/gui/tab_container.cpp
index c30fa96327..4c354768fe 100644
--- a/scene/gui/tab_container.cpp
+++ b/scene/gui/tab_container.cpp
@@ -30,7 +30,7 @@
#include "tab_container.h"
-#include "message_queue.h"
+#include "core/message_queue.h"
#include "scene/gui/box_container.h"
#include "scene/gui/label.h"
#include "scene/gui/texture_rect.h"
diff --git a/scene/gui/tabs.cpp b/scene/gui/tabs.cpp
index 2075f7ce70..c56b7d0f26 100644
--- a/scene/gui/tabs.cpp
+++ b/scene/gui/tabs.cpp
@@ -30,7 +30,7 @@
#include "tabs.h"
-#include "message_queue.h"
+#include "core/message_queue.h"
#include "scene/gui/box_container.h"
#include "scene/gui/label.h"
#include "scene/gui/texture_rect.h"
diff --git a/scene/gui/text_edit.cpp b/scene/gui/text_edit.cpp
index ec98b01ced..a9566d9387 100644
--- a/scene/gui/text_edit.cpp
+++ b/scene/gui/text_edit.cpp
@@ -30,11 +30,11 @@
#include "text_edit.h"
-#include "message_queue.h"
-#include "os/input.h"
-#include "os/keyboard.h"
-#include "os/os.h"
-#include "project_settings.h"
+#include "core/message_queue.h"
+#include "core/os/input.h"
+#include "core/os/keyboard.h"
+#include "core/os/os.h"
+#include "core/project_settings.h"
#include "scene/main/viewport.h"
#ifdef TOOLS_ENABLED
@@ -556,7 +556,6 @@ void TextEdit::_notification(int p_what) {
} break;
case NOTIFICATION_RESIZED: {
- cache.size = get_size();
_update_scrollbars();
update_wrap_at();
} break;
@@ -593,6 +592,7 @@ void TextEdit::_notification(int p_what) {
}
} break;
case NOTIFICATION_DRAW: {
+ Size2 size = get_size();
if ((!has_focus() && !menu->has_focus()) || !window_has_focus) {
draw_caret = false;
}
@@ -634,17 +634,17 @@ void TextEdit::_notification(int p_what) {
RID ci = get_canvas_item();
VisualServer::get_singleton()->canvas_item_set_clip(get_canvas_item(), true);
int xmargin_beg = cache.style_normal->get_margin(MARGIN_LEFT) + cache.line_number_w + cache.breakpoint_gutter_width + cache.fold_gutter_width;
- int xmargin_end = cache.size.width - cache.style_normal->get_margin(MARGIN_RIGHT);
+ int xmargin_end = size.width - cache.style_normal->get_margin(MARGIN_RIGHT);
//let's do it easy for now:
- cache.style_normal->draw(ci, Rect2(Point2(), cache.size));
+ cache.style_normal->draw(ci, Rect2(Point2(), size));
float readonly_alpha = 1.0; // used to set the input text color when in read-only mode
if (readonly) {
- cache.style_readonly->draw(ci, Rect2(Point2(), cache.size));
+ cache.style_readonly->draw(ci, Rect2(Point2(), size));
readonly_alpha = .5;
draw_caret = false;
}
if (has_focus())
- cache.style_focus->draw(ci, Rect2(Point2(), cache.size));
+ cache.style_focus->draw(ci, Rect2(Point2(), size));
int ascent = cache.font->get_ascent();
@@ -1261,7 +1261,7 @@ void TextEdit::_notification(int p_what) {
if (line_length_guideline) {
int x = xmargin_beg + cache.font->get_char_size('0').width * line_length_guideline_col - cursor.x_ofs;
if (x > xmargin_beg && x < xmargin_end) {
- VisualServer::get_singleton()->canvas_item_add_line(ci, Point2(x, 0), Point2(x, cache.size.height), cache.line_length_guideline_color);
+ VisualServer::get_singleton()->canvas_item_add_line(ci, Point2(x, 0), Point2(x, size.height), cache.line_length_guideline_color);
}
}
@@ -1942,7 +1942,7 @@ void TextEdit::_gui_input(const Ref<InputEvent> &p_gui_input) {
int to_column = get_selection_to_column();
if (row < from_line || row > to_line || (row == from_line && col < from_column) || (row == to_line && col > to_column)) {
- // Right click is outside the seleted text
+ // Right click is outside the selected text
deselect();
}
}
@@ -3119,16 +3119,14 @@ void TextEdit::_gui_input(const Ref<InputEvent> &p_gui_input) {
if (selection.active) {
int ini = selection.from_line;
int end = selection.to_line;
+
for (int i = ini; i <= end; i++) {
- if (get_line(i).begins_with("#"))
- _remove_text(i, 0, i, 1);
+ _uncomment_line(i);
}
} else {
- if (get_line(cursor.line).begins_with("#")) {
- _remove_text(cursor.line, 0, cursor.line, 1);
- if (cursor.column >= get_line(cursor.line).length()) {
- cursor.column = MAX(0, get_line(cursor.line).length() - 1);
- }
+ _uncomment_line(cursor.line);
+ if (cursor.column >= get_line(cursor.line).length()) {
+ cursor.column = MAX(0, get_line(cursor.line).length() - 1);
}
}
update();
@@ -3208,6 +3206,24 @@ void TextEdit::_gui_input(const Ref<InputEvent> &p_gui_input) {
}
}
+void TextEdit::_uncomment_line(int p_line) {
+ String line_text = get_line(p_line);
+ for (int i = 0; i < line_text.length(); i++) {
+ if (line_text[i] == '#') {
+ _remove_text(p_line, i, p_line, i + 1);
+ if (p_line == selection.to_line && selection.to_column > line_text.length() - 1) {
+ selection.to_column -= 1;
+ if (selection.to_column >= selection.from_column) {
+ selection.active = false;
+ }
+ }
+ return;
+ } else if (line_text[i] != '\t' && line_text[i] != ' ') {
+ return;
+ }
+ }
+}
+
void TextEdit::_scroll_up(real_t p_delta) {
if (scrolling && smooth_scroll_enabled && SGN(target_v_scroll - v_scroll->get_value()) != SGN(-p_delta))
@@ -3609,7 +3625,7 @@ Size2 TextEdit::get_minimum_size() const {
int TextEdit::get_visible_rows() const {
- int total = cache.size.height;
+ int total = get_size().height;
total -= cache.style_normal->get_minimum_size().height;
if (h_scroll->is_visible_in_tree())
total -= h_scroll->get_size().height;
@@ -3636,7 +3652,7 @@ int TextEdit::get_total_visible_rows() const {
void TextEdit::update_wrap_at() {
- wrap_at = cache.size.width - cache.style_normal->get_minimum_size().width - cache.line_number_w - cache.breakpoint_gutter_width - cache.fold_gutter_width - wrap_right_offset;
+ wrap_at = get_size().width - cache.style_normal->get_minimum_size().width - cache.line_number_w - cache.breakpoint_gutter_width - cache.fold_gutter_width - wrap_right_offset;
update_cursor_wrap_offset();
text.clear_wrap_cache();
@@ -3670,7 +3686,7 @@ void TextEdit::adjust_viewport_to_cursor() {
set_line_as_last_visible(cur_line, cur_wrap);
}
- int visible_width = cache.size.width - cache.style_normal->get_minimum_size().width - cache.line_number_w - cache.breakpoint_gutter_width - cache.fold_gutter_width;
+ int visible_width = get_size().width - cache.style_normal->get_minimum_size().width - cache.line_number_w - cache.breakpoint_gutter_width - cache.fold_gutter_width;
if (v_scroll->is_visible_in_tree())
visible_width -= v_scroll->get_combined_minimum_size().width;
visible_width -= 20; // give it a little more space
@@ -3701,7 +3717,7 @@ void TextEdit::center_viewport_to_cursor() {
unfold_line(cursor.line);
set_line_as_center_visible(cursor.line, get_cursor_wrap_index());
- int visible_width = cache.size.width - cache.style_normal->get_minimum_size().width - cache.line_number_w - cache.breakpoint_gutter_width - cache.fold_gutter_width;
+ int visible_width = get_size().width - cache.style_normal->get_minimum_size().width - cache.line_number_w - cache.breakpoint_gutter_width - cache.fold_gutter_width;
if (v_scroll->is_visible_in_tree())
visible_width -= v_scroll->get_combined_minimum_size().width;
visible_width -= 20; // give it a little more space
@@ -4158,7 +4174,7 @@ Control::CursorShape TextEdit::get_cursor_shape(const Point2 &p_pos) const {
}
}
- return CURSOR_IBEAM;
+ return get_default_cursor_shape();
}
void TextEdit::set_text(String p_text) {
@@ -4822,28 +4838,27 @@ bool TextEdit::search(const String &p_key, uint32_t p_search_flags, int p_from_l
pos = -1;
- int pos_from = 0;
+ int pos_from = (p_search_flags & SEARCH_BACKWARDS) ? text_line.length() : 0;
int last_pos = -1;
while (true) {
- while ((last_pos = (p_search_flags & SEARCH_MATCH_CASE) ? text_line.find(p_key, pos_from) : text_line.findn(p_key, pos_from)) != -1) {
-
- if (p_search_flags & SEARCH_BACKWARDS) {
-
- if (last_pos > from_column)
+ if (p_search_flags & SEARCH_BACKWARDS) {
+ while ((last_pos = (p_search_flags & SEARCH_MATCH_CASE) ? text_line.rfind(p_key, pos_from) : text_line.rfindn(p_key, pos_from)) != -1) {
+ if (last_pos <= from_column) {
+ pos = last_pos;
break;
- pos = last_pos;
-
- } else {
-
+ }
+ pos_from = last_pos - p_key.length();
+ }
+ } else {
+ while ((last_pos = (p_search_flags & SEARCH_MATCH_CASE) ? text_line.find(p_key, pos_from) : text_line.findn(p_key, pos_from)) != -1) {
if (last_pos >= from_column) {
pos = last_pos;
break;
}
+ pos_from = last_pos + p_key.length();
}
-
- pos_from = last_pos + p_key.length();
}
bool is_match = true;
@@ -4856,11 +4871,15 @@ bool TextEdit::search(const String &p_key, uint32_t p_search_flags, int p_from_l
is_match = false;
}
+ if (pos_from == -1) {
+ pos = -1;
+ }
+
if (is_match || last_pos == -1 || pos == -1) {
break;
}
- pos_from = pos + 1;
+ pos_from = (p_search_flags & SEARCH_BACKWARDS) ? pos - 1 : pos + 1;
pos = -1;
}
@@ -5543,7 +5562,7 @@ int TextEdit::get_last_visible_line_wrap_index() const {
double TextEdit::get_visible_rows_offset() const {
- double total = cache.size.height;
+ double total = get_size().height;
total -= cache.style_normal->get_minimum_size().height;
if (h_scroll->is_visible_in_tree())
total -= h_scroll->get_size().height;
@@ -5910,6 +5929,9 @@ void TextEdit::set_line(int line, String new_text) {
if (cursor.line == line) {
cursor.column = MIN(cursor.column, new_text.length());
}
+ if (is_selection_active() && line == selection.to_line && selection.to_column > text[line].length()) {
+ selection.to_column = text[line].length();
+ }
}
void TextEdit::insert_at(const String &p_text, int at) {
@@ -6227,7 +6249,6 @@ TextEdit::TextEdit() {
set_focus_mode(FOCUS_ALL);
syntax_highlighter = NULL;
_update_caches();
- cache.size = Size2(1, 1);
cache.row_height = 1;
cache.line_spacing = 1;
cache.line_number_w = 1;
@@ -6235,6 +6256,7 @@ TextEdit::TextEdit() {
breakpoint_gutter_width = 0;
cache.fold_gutter_width = 0;
fold_gutter_width = 0;
+ set_default_cursor_shape(CURSOR_IBEAM);
indent_size = 4;
text.set_indent_size(indent_size);
@@ -6400,8 +6422,8 @@ Map<int, TextEdit::HighlighterInfo> TextEdit::_get_line_syntax_highlighting(int
is_hex_notation = false;
}
- // check for dot or underscore or 'x' for hex notation in floating point number
- if ((str[j] == '.' || str[j] == 'x' || str[j] == '_' || str[j] == 'f') && !in_word && prev_is_number && !is_number) {
+ // check for dot or underscore or 'x' for hex notation in floating point number or 'e' for scientific notation
+ if ((str[j] == '.' || str[j] == 'x' || str[j] == '_' || str[j] == 'f' || str[j] == 'e') && !in_word && prev_is_number && !is_number) {
is_number = true;
is_symbol = false;
is_char = false;
diff --git a/scene/gui/text_edit.h b/scene/gui/text_edit.h
index 19b5d574c6..f0c18ad047 100644
--- a/scene/gui/text_edit.h
+++ b/scene/gui/text_edit.h
@@ -193,7 +193,6 @@ private:
int line_number_w;
int breakpoint_gutter_width;
int fold_gutter_width;
- Size2 size;
} cache;
Map<int, int> color_region_cache;
@@ -373,6 +372,7 @@ private:
void _update_selection_mode_word();
void _update_selection_mode_line();
+ void _uncomment_line(int p_line);
void _scroll_up(real_t p_delta);
void _scroll_down(real_t p_delta);
diff --git a/scene/gui/texture_progress.cpp b/scene/gui/texture_progress.cpp
index ff90576c1b..8188d1dcf8 100644
--- a/scene/gui/texture_progress.cpp
+++ b/scene/gui/texture_progress.cpp
@@ -30,7 +30,7 @@
#include "texture_progress.h"
-#include "engine.h"
+#include "core/engine.h"
void TextureProgress::set_under_texture(const Ref<Texture> &p_texture) {
@@ -466,9 +466,9 @@ void TextureProgress::_bind_methods() {
ADD_PROPERTY(PropertyInfo(Variant::OBJECT, "texture_progress", PROPERTY_HINT_RESOURCE_TYPE, "Texture"), "set_progress_texture", "get_progress_texture");
ADD_PROPERTYNZ(PropertyInfo(Variant::INT, "fill_mode", PROPERTY_HINT_ENUM, "Left to Right,Right to Left,Top to Bottom,Bottom to Top,Clockwise,Counter Clockwise,Bilinear (Left and Right),Bilinear (Top and Bottom), Clockwise and Counter Clockwise"), "set_fill_mode", "get_fill_mode");
ADD_GROUP("Tint", "tint_");
- ADD_PROPERTY(PropertyInfo(Variant::COLOR, "tint_under", PROPERTY_HINT_COLOR_NO_ALPHA), "set_tint_under", "get_tint_under");
- ADD_PROPERTY(PropertyInfo(Variant::COLOR, "tint_over", PROPERTY_HINT_COLOR_NO_ALPHA), "set_tint_over", "get_tint_over");
- ADD_PROPERTY(PropertyInfo(Variant::COLOR, "tint_progress", PROPERTY_HINT_COLOR_NO_ALPHA), "set_tint_progress", "get_tint_progress");
+ ADD_PROPERTY(PropertyInfo(Variant::COLOR, "tint_under"), "set_tint_under", "get_tint_under");
+ ADD_PROPERTY(PropertyInfo(Variant::COLOR, "tint_over"), "set_tint_over", "get_tint_over");
+ ADD_PROPERTY(PropertyInfo(Variant::COLOR, "tint_progress"), "set_tint_progress", "get_tint_progress");
ADD_GROUP("Radial Fill", "radial_");
ADD_PROPERTYNZ(PropertyInfo(Variant::REAL, "radial_initial_angle", PROPERTY_HINT_RANGE, "0.0,360.0,0.1,slider"), "set_radial_initial_angle", "get_radial_initial_angle");
ADD_PROPERTYNZ(PropertyInfo(Variant::REAL, "radial_fill_degrees", PROPERTY_HINT_RANGE, "0.0,360.0,0.1,slider"), "set_fill_degrees", "get_fill_degrees");
diff --git a/scene/gui/tree.cpp b/scene/gui/tree.cpp
index eaf7ad7670..365a6a5cae 100644
--- a/scene/gui/tree.cpp
+++ b/scene/gui/tree.cpp
@@ -31,12 +31,12 @@
#include "tree.h"
#include <limits.h>
-#include "math_funcs.h"
-#include "os/input.h"
-#include "os/keyboard.h"
-#include "os/os.h"
-#include "print_string.h"
-#include "project_settings.h"
+#include "core/math/math_funcs.h"
+#include "core/os/input.h"
+#include "core/os/keyboard.h"
+#include "core/os/os.h"
+#include "core/print_string.h"
+#include "core/project_settings.h"
#include "scene/main/viewport.h"
#ifdef TOOLS_ENABLED
@@ -1721,7 +1721,7 @@ int Tree::propagate_mouse_event(const Point2i &p_pos, int x_ofs, int y_ofs, bool
if (p_button == BUTTON_LEFT || (p_button == BUTTON_RIGHT && allow_rmb_select)) {
/* process selection */
- if (p_doubleclick && (!c.editable || c.mode == TreeItem::CELL_MODE_CUSTOM || c.mode == TreeItem::CELL_MODE_ICON /*|| c.mode==TreeItem::CELL_MODE_CHECK*/)) { //it' s confusing for check
+ if (p_doubleclick && (!c.editable || c.mode == TreeItem::CELL_MODE_CUSTOM || c.mode == TreeItem::CELL_MODE_ICON /*|| c.mode==TreeItem::CELL_MODE_CHECK*/)) { //it's confusing for check
emit_signal("item_activated");
incr_search.clear();
diff --git a/scene/gui/tree.h b/scene/gui/tree.h
index 5af66c5faa..205cdbfb7e 100644
--- a/scene/gui/tree.h
+++ b/scene/gui/tree.h
@@ -516,7 +516,7 @@ protected:
static void _bind_methods();
//bind helpers
- Object *_create_item(Object *p_parent, int p_idx = -1) {
+ TreeItem *_create_item(Object *p_parent, int p_idx = -1) {
return create_item(Object::cast_to<TreeItem>(p_parent), p_idx);
}
diff --git a/scene/gui/video_player.cpp b/scene/gui/video_player.cpp
index 88e1847533..17ab234551 100644
--- a/scene/gui/video_player.cpp
+++ b/scene/gui/video_player.cpp
@@ -31,7 +31,7 @@
#include "video_player.h"
#include "scene/scene_string_names.h"
-#include "os/os.h"
+#include "core/os/os.h"
#include "servers/audio_server.h"
int VideoPlayer::sp_get_channel_count() const {
diff --git a/scene/main/http_request.cpp b/scene/main/http_request.cpp
index 4750e05633..a9b7fba9c7 100644
--- a/scene/main/http_request.cpp
+++ b/scene/main/http_request.cpp
@@ -330,15 +330,13 @@ bool HTTPRequest::_update_connection() {
return true;
}
- if (client->is_response_chunked()) {
- body_len = -1; // No body len because chunked, change your webserver configuration if you want body len
- } else {
- body_len = client->get_response_body_length();
+ // No body len (-1) if chunked or no content-length header was provided.
+ // Change your webserver configuration if you want body len.
+ body_len = client->get_response_body_length();
- if (body_size_limit >= 0 && body_len > body_size_limit) {
- call_deferred("_request_done", RESULT_BODY_SIZE_LIMIT_EXCEEDED, response_code, response_headers, PoolByteArray());
- return true;
- }
+ if (body_size_limit >= 0 && body_len > body_size_limit) {
+ call_deferred("_request_done", RESULT_BODY_SIZE_LIMIT_EXCEEDED, response_code, response_headers, PoolByteArray());
+ return true;
}
if (download_to_file != String()) {
@@ -378,6 +376,9 @@ bool HTTPRequest::_update_connection() {
call_deferred("_request_done", RESULT_SUCCESS, response_code, response_headers, body);
return true;
}
+ } else if (client->get_status() == HTTPClient::STATUS_DISCONNECTED) {
+ // We read till EOF, with no errors. Request is done.
+ call_deferred("_request_done", RESULT_SUCCESS, response_code, response_headers, body);
}
return false;
diff --git a/scene/main/http_request.h b/scene/main/http_request.h
index eb5d020bc5..de09d2afda 100644
--- a/scene/main/http_request.h
+++ b/scene/main/http_request.h
@@ -31,10 +31,10 @@
#ifndef HTTPREQUEST_H
#define HTTPREQUEST_H
-#include "io/http_client.h"
+#include "core/io/http_client.h"
+#include "core/os/file_access.h"
+#include "core/os/thread.h"
#include "node.h"
-#include "os/file_access.h"
-#include "os/thread.h"
class HTTPRequest : public Node {
diff --git a/scene/main/instance_placeholder.cpp b/scene/main/instance_placeholder.cpp
index 1443d5efbf..0ee5648de2 100644
--- a/scene/main/instance_placeholder.cpp
+++ b/scene/main/instance_placeholder.cpp
@@ -30,7 +30,7 @@
#include "instance_placeholder.h"
-#include "io/resource_loader.h"
+#include "core/io/resource_loader.h"
#include "scene/resources/packed_scene.h"
bool InstancePlaceholder::_set(const StringName &p_name, const Variant &p_value) {
diff --git a/scene/main/node.cpp b/scene/main/node.cpp
index 3d1614199a..d4456738ae 100644
--- a/scene/main/node.cpp
+++ b/scene/main/node.cpp
@@ -31,10 +31,10 @@
#include "node.h"
#include "core/core_string_names.h"
+#include "core/io/resource_loader.h"
+#include "core/message_queue.h"
+#include "core/print_string.h"
#include "instance_placeholder.h"
-#include "io/resource_loader.h"
-#include "message_queue.h"
-#include "print_string.h"
#include "scene/resources/packed_scene.h"
#include "scene/scene_string_names.h"
#include "viewport.h"
diff --git a/scene/main/node.h b/scene/main/node.h
index fb84981feb..8d6c558e93 100644
--- a/scene/main/node.h
+++ b/scene/main/node.h
@@ -31,13 +31,13 @@
#ifndef NODE_H
#define NODE_H
-#include "class_db.h"
-#include "map.h"
-#include "node_path.h"
-#include "object.h"
-#include "project_settings.h"
+#include "core/class_db.h"
+#include "core/map.h"
+#include "core/node_path.h"
+#include "core/object.h"
+#include "core/project_settings.h"
+#include "core/script_language.h"
#include "scene/main/scene_tree.h"
-#include "script_language.h"
class Viewport;
class SceneState;
diff --git a/scene/main/scene_tree.cpp b/scene/main/scene_tree.cpp
index 0b763d2433..16be6dad7d 100644
--- a/scene/main/scene_tree.cpp
+++ b/scene/main/scene_tree.cpp
@@ -30,16 +30,16 @@
#include "scene_tree.h"
+#include "core/io/marshalls.h"
+#include "core/io/resource_loader.h"
+#include "core/message_queue.h"
+#include "core/os/keyboard.h"
+#include "core/os/os.h"
+#include "core/print_string.h"
+#include "core/project_settings.h"
#include "editor/editor_node.h"
-#include "io/marshalls.h"
-#include "io/resource_loader.h"
#include "main/input_default.h"
-#include "message_queue.h"
#include "node.h"
-#include "os/keyboard.h"
-#include "os/os.h"
-#include "print_string.h"
-#include "project_settings.h"
#include "scene/resources/dynamic_font.h"
#include "scene/resources/material.h"
#include "scene/resources/mesh.h"
diff --git a/scene/main/scene_tree.h b/scene/main/scene_tree.h
index 11201097d4..d59cbe05fb 100644
--- a/scene/main/scene_tree.h
+++ b/scene/main/scene_tree.h
@@ -31,13 +31,13 @@
#ifndef SCENE_MAIN_LOOP_H
#define SCENE_MAIN_LOOP_H
-#include "io/multiplayer_api.h"
-#include "os/main_loop.h"
-#include "os/thread_safe.h"
+#include "core/io/multiplayer_api.h"
+#include "core/os/main_loop.h"
+#include "core/os/thread_safe.h"
+#include "core/self_list.h"
#include "scene/resources/mesh.h"
#include "scene/resources/world.h"
#include "scene/resources/world_2d.h"
-#include "self_list.h"
/**
@author Juan Linietsky <reduzio@gmail.com>
diff --git a/scene/main/timer.cpp b/scene/main/timer.cpp
index c285694dfa..227840531e 100755
--- a/scene/main/timer.cpp
+++ b/scene/main/timer.cpp
@@ -30,7 +30,7 @@
#include "timer.h"
-#include "engine.h"
+#include "core/engine.h"
void Timer::_notification(int p_what) {
diff --git a/scene/main/viewport.cpp b/scene/main/viewport.cpp
index d1b3eb9d9a..dfd9dfa52e 100644
--- a/scene/main/viewport.cpp
+++ b/scene/main/viewport.cpp
@@ -30,9 +30,9 @@
#include "viewport.h"
-#include "os/input.h"
-#include "os/os.h"
-#include "project_settings.h"
+#include "core/os/input.h"
+#include "core/os/os.h"
+#include "core/project_settings.h"
#include "scene/2d/collision_object_2d.h"
#include "scene/3d/camera.h"
#include "scene/3d/collision_object.h"
diff --git a/scene/main/viewport.h b/scene/main/viewport.h
index 450f235b79..c1a4c0e3eb 100644
--- a/scene/main/viewport.h
+++ b/scene/main/viewport.h
@@ -31,11 +31,11 @@
#ifndef VIEWPORT_H
#define VIEWPORT_H
+#include "core/math/transform_2d.h"
#include "scene/main/node.h"
#include "scene/resources/texture.h"
#include "scene/resources/world_2d.h"
#include "servers/visual_server.h"
-#include "transform_2d.h"
/**
@author Juan Linietsky <reduzio@gmail.com>
*/
diff --git a/scene/resources/animation.cpp b/scene/resources/animation.cpp
index 58e6db3f5e..80ad2ad739 100644
--- a/scene/resources/animation.cpp
+++ b/scene/resources/animation.cpp
@@ -30,7 +30,7 @@
#include "animation.h"
-#include "geometry.h"
+#include "core/math/geometry.h"
#define ANIM_MIN_LENGTH 0.001
@@ -1442,7 +1442,7 @@ void Animation::track_set_key_transition(int p_track, int p_key_idx, float p_tra
case TYPE_BEZIER:
case TYPE_AUDIO:
case TYPE_ANIMATION: {
- // they dont use transition
+ // they don't use transition
} break;
}
}
diff --git a/scene/resources/animation.h b/scene/resources/animation.h
index a41e6ea5d7..6eec2c8bc7 100644
--- a/scene/resources/animation.h
+++ b/scene/resources/animation.h
@@ -31,7 +31,7 @@
#ifndef ANIMATION_H
#define ANIMATION_H
-#include "resource.h"
+#include "core/resource.h"
/**
@author Juan Linietsky <reduzio@gmail.com>
*/
diff --git a/scene/resources/audio_stream_sample.cpp b/scene/resources/audio_stream_sample.cpp
index e6a4b01deb..57d0deeb78 100644
--- a/scene/resources/audio_stream_sample.cpp
+++ b/scene/resources/audio_stream_sample.cpp
@@ -29,8 +29,8 @@
/*************************************************************************/
#include "audio_stream_sample.h"
-#include "io/marshalls.h"
-#include "os/file_access.h"
+#include "core/io/marshalls.h"
+#include "core/os/file_access.h"
void AudioStreamPlaybackSample::start(float p_from_pos) {
diff --git a/scene/resources/bit_mask.cpp b/scene/resources/bit_mask.cpp
index 5694099754..d670161afd 100644
--- a/scene/resources/bit_mask.cpp
+++ b/scene/resources/bit_mask.cpp
@@ -30,7 +30,7 @@
#include "bit_mask.h"
-#include "io/image_loader.h"
+#include "core/io/image_loader.h"
void BitMap::create(const Size2 &p_size) {
diff --git a/scene/resources/bit_mask.h b/scene/resources/bit_mask.h
index 40f0bfb04a..04191a7774 100644
--- a/scene/resources/bit_mask.h
+++ b/scene/resources/bit_mask.h
@@ -31,9 +31,9 @@
#ifndef BIT_MASK_H
#define BIT_MASK_H
-#include "image.h"
-#include "io/resource_loader.h"
-#include "resource.h"
+#include "core/image.h"
+#include "core/io/resource_loader.h"
+#include "core/resource.h"
class BitMap : public Resource {
diff --git a/scene/resources/bounds.h b/scene/resources/bounds.h
index dfe2fe40c6..c86e15ae40 100644
--- a/scene/resources/bounds.h
+++ b/scene/resources/bounds.h
@@ -31,8 +31,8 @@
#ifndef BOUNDS_H
#define BOUNDS_H
-#include "bsp_tree.h"
-#include "resource.h"
+#include "core/math/bsp_tree.h"
+#include "core/resource.h"
class Bounds : public Resource {
diff --git a/scene/resources/canvas.h b/scene/resources/canvas.h
index dfdea82ca5..cd37ea3583 100644
--- a/scene/resources/canvas.h
+++ b/scene/resources/canvas.h
@@ -31,7 +31,7 @@
#ifndef CANVAS_H
#define CANVAS_H
-#include "resource.h"
+#include "core/resource.h"
class Canvas : public Resource {
diff --git a/scene/resources/color_ramp.cpp b/scene/resources/color_ramp.cpp
index 4a43303d84..d5e8c17cbc 100644
--- a/scene/resources/color_ramp.cpp
+++ b/scene/resources/color_ramp.cpp
@@ -29,7 +29,7 @@
/*************************************************************************/
#include "color_ramp.h"
-#include "core_string_names.h"
+#include "core/core_string_names.h"
//setter and getter names for property serialization
#define COLOR_RAMP_GET_OFFSETS "get_offsets"
diff --git a/scene/resources/color_ramp.h b/scene/resources/color_ramp.h
index 070ad7f0d3..88fa4beb7f 100644
--- a/scene/resources/color_ramp.h
+++ b/scene/resources/color_ramp.h
@@ -31,7 +31,7 @@
#ifndef SCENE_RESOURCES_COLOR_RAMP_H_
#define SCENE_RESOURCES_COLOR_RAMP_H_
-#include "resource.h"
+#include "core/resource.h"
class Gradient : public Resource {
GDCLASS(Gradient, Resource);
diff --git a/scene/resources/convex_polygon_shape.cpp b/scene/resources/convex_polygon_shape.cpp
index fa9369d3bc..9d47bca5ed 100644
--- a/scene/resources/convex_polygon_shape.cpp
+++ b/scene/resources/convex_polygon_shape.cpp
@@ -29,7 +29,7 @@
/*************************************************************************/
#include "convex_polygon_shape.h"
-#include "quick_hull.h"
+#include "core/math/quick_hull.h"
#include "servers/physics_server.h"
Vector<Vector3> ConvexPolygonShape::_gen_debug_mesh_lines() {
diff --git a/scene/resources/convex_polygon_shape_2d.cpp b/scene/resources/convex_polygon_shape_2d.cpp
index d061c4ea1e..f325af7ea4 100644
--- a/scene/resources/convex_polygon_shape_2d.cpp
+++ b/scene/resources/convex_polygon_shape_2d.cpp
@@ -30,7 +30,7 @@
#include "convex_polygon_shape_2d.h"
-#include "geometry.h"
+#include "core/math/geometry.h"
#include "servers/physics_2d_server.h"
#include "servers/visual_server.h"
diff --git a/scene/resources/curve.cpp b/scene/resources/curve.cpp
index d8989bf062..9188d890f7 100644
--- a/scene/resources/curve.cpp
+++ b/scene/resources/curve.cpp
@@ -30,7 +30,7 @@
#include "curve.h"
-#include "core_string_names.h"
+#include "core/core_string_names.h"
template <class T>
static _FORCE_INLINE_ T _bezier_interp(real_t t, T start, T control_1, T control_2, T end) {
@@ -491,6 +491,7 @@ void Curve::ensure_default_setup(float p_min, float p_max) {
void Curve::_bind_methods() {
+ ClassDB::bind_method(D_METHOD("get_point_count"), &Curve::get_point_count);
ClassDB::bind_method(D_METHOD("add_point", "position", "left_tangent", "right_tangent", "left_mode", "right_mode"), &Curve::add_point, DEFVAL(0), DEFVAL(0), DEFVAL(TANGENT_FREE), DEFVAL(TANGENT_FREE));
ClassDB::bind_method(D_METHOD("remove_point", "index"), &Curve::remove_point);
ClassDB::bind_method(D_METHOD("clear_points"), &Curve::clear_points);
diff --git a/scene/resources/curve.h b/scene/resources/curve.h
index 058c4f1bc2..234e3a6779 100644
--- a/scene/resources/curve.h
+++ b/scene/resources/curve.h
@@ -31,7 +31,7 @@
#ifndef CURVE_H
#define CURVE_H
-#include "resource.h"
+#include "core/resource.h"
// y(x) curve
class Curve : public Resource {
diff --git a/scene/resources/default_theme/default_theme.cpp b/scene/resources/default_theme/default_theme.cpp
index 0eee2ae393..20fa1d6e2b 100644
--- a/scene/resources/default_theme/default_theme.cpp
+++ b/scene/resources/default_theme/default_theme.cpp
@@ -32,7 +32,7 @@
#include "scene/resources/theme.h"
-#include "os/os.h"
+#include "core/os/os.h"
#include "theme_data.h"
#include "font_hidpi.inc"
diff --git a/scene/resources/dynamic_font.cpp b/scene/resources/dynamic_font.cpp
index 4df849df6a..0785d3bfc6 100644
--- a/scene/resources/dynamic_font.cpp
+++ b/scene/resources/dynamic_font.cpp
@@ -30,8 +30,8 @@
#ifdef FREETYPE_ENABLED
#include "dynamic_font.h"
-#include "os/file_access.h"
-#include "os/os.h"
+#include "core/os/file_access.h"
+#include "core/os/os.h"
#include FT_STROKER_H
diff --git a/scene/resources/dynamic_font.h b/scene/resources/dynamic_font.h
index f460bca2d4..afda48a566 100644
--- a/scene/resources/dynamic_font.h
+++ b/scene/resources/dynamic_font.h
@@ -32,10 +32,10 @@
#define DYNAMIC_FONT_H
#ifdef FREETYPE_ENABLED
-#include "io/resource_loader.h"
-#include "os/mutex.h"
-#include "os/thread_safe.h"
-#include "pair.h"
+#include "core/io/resource_loader.h"
+#include "core/os/mutex.h"
+#include "core/os/thread_safe.h"
+#include "core/pair.h"
#include "scene/resources/font.h"
#include <ft2build.h>
diff --git a/scene/resources/dynamic_font_stb.cpp b/scene/resources/dynamic_font_stb.cpp
index be394e19c4..8cb2cc4983 100644
--- a/scene/resources/dynamic_font_stb.cpp
+++ b/scene/resources/dynamic_font_stb.cpp
@@ -33,7 +33,7 @@
#ifndef FREETYPE_ENABLED
#define STB_TRUETYPE_IMPLEMENTATION
-#include "os/file_access.h"
+#include "core/os/file_access.h"
void DynamicFontData::lock() {
diff --git a/scene/resources/dynamic_font_stb.h b/scene/resources/dynamic_font_stb.h
index feae29c0c2..e1ef72ea4f 100644
--- a/scene/resources/dynamic_font_stb.h
+++ b/scene/resources/dynamic_font_stb.h
@@ -33,8 +33,8 @@
#ifndef FREETYPE_ENABLED
+#include "core/io/resource_loader.h"
#include "font.h"
-#include "io/resource_loader.h"
#include "thirdparty/misc/stb_truetype.h"
diff --git a/scene/resources/environment.cpp b/scene/resources/environment.cpp
index d3da842b79..f4d5b8376b 100644
--- a/scene/resources/environment.cpp
+++ b/scene/resources/environment.cpp
@@ -29,7 +29,7 @@
/*************************************************************************/
#include "environment.h"
-#include "project_settings.h"
+#include "core/project_settings.h"
#include "servers/visual_server.h"
#include "texture.h"
diff --git a/scene/resources/environment.h b/scene/resources/environment.h
index 7d66c7e60b..aab37719e0 100644
--- a/scene/resources/environment.h
+++ b/scene/resources/environment.h
@@ -31,7 +31,7 @@
#ifndef ENVIRONMENT_H
#define ENVIRONMENT_H
-#include "resource.h"
+#include "core/resource.h"
#include "scene/resources/sky_box.h"
#include "scene/resources/texture.h"
#include "servers/visual_server.h"
diff --git a/scene/resources/font.cpp b/scene/resources/font.cpp
index 3dfde01320..50bf8f38f7 100644
--- a/scene/resources/font.cpp
+++ b/scene/resources/font.cpp
@@ -31,8 +31,8 @@
#include "font.h"
#include "core/io/resource_loader.h"
+#include "core/method_bind_ext.gen.inc"
#include "core/os/file_access.h"
-#include "method_bind_ext.gen.inc"
void Font::draw_halign(RID p_canvas_item, const Point2 &p_pos, HAlign p_align, float p_width, const String &p_text, const Color &p_modulate, const Color &p_outline_modulate) const {
float length = get_string_size(p_text).width;
diff --git a/scene/resources/font.h b/scene/resources/font.h
index 4e295b6035..39e66a822d 100644
--- a/scene/resources/font.h
+++ b/scene/resources/font.h
@@ -31,8 +31,8 @@
#ifndef FONT_H
#define FONT_H
-#include "map.h"
-#include "resource.h"
+#include "core/map.h"
+#include "core/resource.h"
#include "scene/resources/texture.h"
/**
@author Juan Linietsky <reduzio@gmail.com>
diff --git a/scene/resources/material.h b/scene/resources/material.h
index f43d240a53..078649e7b0 100644
--- a/scene/resources/material.h
+++ b/scene/resources/material.h
@@ -31,10 +31,10 @@
#ifndef MATERIAL_H
#define MATERIAL_H
-#include "resource.h"
+#include "core/resource.h"
+#include "core/self_list.h"
#include "scene/resources/shader.h"
#include "scene/resources/texture.h"
-#include "self_list.h"
#include "servers/visual/shader_language.h"
#include "servers/visual_server.h"
/**
diff --git a/scene/resources/mesh.cpp b/scene/resources/mesh.cpp
index e6ef956dc5..6426689397 100644
--- a/scene/resources/mesh.cpp
+++ b/scene/resources/mesh.cpp
@@ -30,18 +30,13 @@
#include "mesh.h"
-#include "pair.h"
+#include "core/pair.h"
#include "scene/resources/concave_polygon_shape.h"
#include "scene/resources/convex_polygon_shape.h"
#include "surface_tool.h"
#include <stdlib.h>
-void Mesh::_clear_triangle_mesh() const {
-
- triangle_mesh.unref();
-}
-
Ref<TriangleMesh> Mesh::generate_triangle_mesh() const {
if (triangle_mesh.is_valid())
@@ -111,6 +106,11 @@ Ref<TriangleMesh> Mesh::generate_triangle_mesh() const {
void Mesh::generate_debug_mesh_lines(Vector<Vector3> &r_lines) {
+ if (debug_lines.size() > 0) {
+ r_lines = debug_lines;
+ return;
+ }
+
Ref<TriangleMesh> tm = generate_triangle_mesh();
if (tm.is_null())
return;
@@ -120,23 +120,25 @@ void Mesh::generate_debug_mesh_lines(Vector<Vector3> &r_lines) {
const int triangles_num = tm->get_triangles().size();
PoolVector<Vector3> vertices = tm->get_vertices();
- r_lines.resize(tm->get_triangles().size() * 6); // 3 lines x 2 points each line
+ debug_lines.resize(tm->get_triangles().size() * 6); // 3 lines x 2 points each line
PoolVector<int>::Read ind_r = triangle_indices.read();
PoolVector<Vector3>::Read ver_r = vertices.read();
for (int j = 0, x = 0, i = 0; i < triangles_num; j += 6, x += 3, ++i) {
// Triangle line 1
- r_lines.write[j + 0] = ver_r[ind_r[x + 0]];
- r_lines.write[j + 1] = ver_r[ind_r[x + 1]];
+ debug_lines.write[j + 0] = ver_r[ind_r[x + 0]];
+ debug_lines.write[j + 1] = ver_r[ind_r[x + 1]];
// Triangle line 2
- r_lines.write[j + 2] = ver_r[ind_r[x + 1]];
- r_lines.write[j + 3] = ver_r[ind_r[x + 2]];
+ debug_lines.write[j + 2] = ver_r[ind_r[x + 1]];
+ debug_lines.write[j + 3] = ver_r[ind_r[x + 2]];
// Triangle line 3
- r_lines.write[j + 4] = ver_r[ind_r[x + 2]];
- r_lines.write[j + 5] = ver_r[ind_r[x + 0]];
+ debug_lines.write[j + 4] = ver_r[ind_r[x + 2]];
+ debug_lines.write[j + 5] = ver_r[ind_r[x + 0]];
}
+
+ r_lines = debug_lines;
}
void Mesh::generate_debug_mesh_indices(Vector<Vector3> &r_points) {
Ref<TriangleMesh> tm = generate_triangle_mesh();
@@ -536,8 +538,9 @@ void Mesh::_bind_methods() {
BIND_ENUM_CONSTANT(ARRAY_MAX);
}
-void Mesh::clear_cache() {
- _clear_triangle_mesh();
+void Mesh::clear_cache() const {
+ triangle_mesh.unref();
+ debug_lines.clear();
}
Mesh::Mesh() {
@@ -850,7 +853,7 @@ void ArrayMesh::add_surface_from_arrays(PrimitiveType p_primitive, const Array &
_recompute_aabb();
}
- _clear_triangle_mesh();
+ clear_cache();
_change_notify();
emit_changed();
}
@@ -929,7 +932,7 @@ void ArrayMesh::surface_remove(int p_idx) {
VisualServer::get_singleton()->mesh_remove_surface(mesh, p_idx);
surfaces.remove(p_idx);
- _clear_triangle_mesh();
+ clear_cache();
_recompute_aabb();
_change_notify();
emit_changed();
@@ -1035,7 +1038,7 @@ void ArrayMesh::add_surface_from_mesh_data(const Geometry::MeshData &p_mesh_data
else
aabb.merge_with(s.aabb);
- _clear_triangle_mesh();
+ clear_cache();
surfaces.push_back(s);
_change_notify();
@@ -1375,6 +1378,7 @@ void ArrayMesh::reload_from_file() {
VisualServer::get_singleton()->mesh_clear(mesh);
surfaces.clear();
clear_blend_shapes();
+ clear_cache();
Resource::reload_from_file();
diff --git a/scene/resources/mesh.h b/scene/resources/mesh.h
index 36bfca49f8..aebba09ef8 100644
--- a/scene/resources/mesh.h
+++ b/scene/resources/mesh.h
@@ -31,11 +31,11 @@
#ifndef MESH_H
#define MESH_H
-#include "resource.h"
+#include "core/math/triangle_mesh.h"
+#include "core/resource.h"
#include "scene/resources/material.h"
#include "scene/resources/shape.h"
#include "servers/visual_server.h"
-#include "triangle_mesh.h"
/**
@author Juan Linietsky <reduzio@gmail.com>
*/
@@ -44,11 +44,10 @@ class Mesh : public Resource {
GDCLASS(Mesh, Resource);
mutable Ref<TriangleMesh> triangle_mesh; //cached
+ mutable Vector<Vector3> debug_lines;
Size2 lightmap_size_hint;
protected:
- void _clear_triangle_mesh() const;
-
static void _bind_methods();
public:
@@ -146,7 +145,7 @@ public:
void set_lightmap_size_hint(const Vector2 &p_size);
Size2 get_lightmap_size_hint() const;
- void clear_cache();
+ void clear_cache() const;
Mesh();
};
diff --git a/scene/resources/mesh_library.h b/scene/resources/mesh_library.h
index 69719960e2..3ce0cf9b66 100644
--- a/scene/resources/mesh_library.h
+++ b/scene/resources/mesh_library.h
@@ -31,9 +31,9 @@
#ifndef GRID_THEME_H
#define GRID_THEME_H
-#include "map.h"
+#include "core/map.h"
+#include "core/resource.h"
#include "mesh.h"
-#include "resource.h"
#include "scene/3d/navigation_mesh.h"
#include "shape.h"
diff --git a/scene/resources/packed_scene.cpp b/scene/resources/packed_scene.cpp
index f034e07ff9..086fb83af9 100644
--- a/scene/resources/packed_scene.cpp
+++ b/scene/resources/packed_scene.cpp
@@ -31,9 +31,9 @@
#include "packed_scene.h"
#include "core/core_string_names.h"
-#include "engine.h"
-#include "io/resource_loader.h"
-#include "project_settings.h"
+#include "core/engine.h"
+#include "core/io/resource_loader.h"
+#include "core/project_settings.h"
#include "scene/2d/node_2d.h"
#include "scene/3d/spatial.h"
#include "scene/gui/control.h"
diff --git a/scene/resources/packed_scene.h b/scene/resources/packed_scene.h
index 278986eb62..e5f22f5e3b 100644
--- a/scene/resources/packed_scene.h
+++ b/scene/resources/packed_scene.h
@@ -31,7 +31,7 @@
#ifndef PACKED_SCENE_H
#define PACKED_SCENE_H
-#include "resource.h"
+#include "core/resource.h"
#include "scene/main/node.h"
class SceneState : public Reference {
diff --git a/scene/resources/particles_material.cpp b/scene/resources/particles_material.cpp
index 218a4cefe7..364ec9bb19 100644
--- a/scene/resources/particles_material.cpp
+++ b/scene/resources/particles_material.cpp
@@ -1123,7 +1123,7 @@ void ParticlesMaterial::_bind_methods() {
ADD_GROUP("Gravity", "");
ADD_PROPERTY(PropertyInfo(Variant::VECTOR3, "gravity"), "set_gravity", "get_gravity");
ADD_GROUP("Initial Velocity", "initial_");
- ADD_PROPERTYI(PropertyInfo(Variant::REAL, "initial_velocity", PROPERTY_HINT_RANGE, "0,1000,0.01,or_greater"), "set_param", "get_param", PARAM_INITIAL_LINEAR_VELOCITY);
+ ADD_PROPERTYI(PropertyInfo(Variant::REAL, "initial_velocity", PROPERTY_HINT_RANGE, "0,1000,0.01,or_lesser,or_greater"), "set_param", "get_param", PARAM_INITIAL_LINEAR_VELOCITY);
ADD_PROPERTYI(PropertyInfo(Variant::REAL, "initial_velocity_random", PROPERTY_HINT_RANGE, "0,1,0.01"), "set_param_randomness", "get_param_randomness", PARAM_INITIAL_LINEAR_VELOCITY);
ADD_GROUP("Angular Velocity", "angular_");
ADD_PROPERTYI(PropertyInfo(Variant::REAL, "angular_velocity", PROPERTY_HINT_RANGE, "-360,360,0.01"), "set_param", "get_param", PARAM_ANGULAR_VELOCITY);
@@ -1204,7 +1204,7 @@ ParticlesMaterial::ParticlesMaterial() :
set_spread(45);
set_flatness(0);
- set_param(PARAM_INITIAL_LINEAR_VELOCITY, 1);
+ set_param(PARAM_INITIAL_LINEAR_VELOCITY, 0);
set_param(PARAM_ORBIT_VELOCITY, 0);
set_param(PARAM_LINEAR_ACCEL, 0);
set_param(PARAM_RADIAL_ACCEL, 0);
diff --git a/scene/resources/particles_material.h b/scene/resources/particles_material.h
index 8090926fa3..91fdcc0346 100644
--- a/scene/resources/particles_material.h
+++ b/scene/resources/particles_material.h
@@ -28,7 +28,7 @@
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
/*************************************************************************/
-#include "rid.h"
+#include "core/rid.h"
#include "scene/resources/material.h"
#ifndef PARTICLES_MATERIAL_H
diff --git a/scene/resources/physics_material.h b/scene/resources/physics_material.h
index c882e2081a..bf11bf0ac1 100644
--- a/scene/resources/physics_material.h
+++ b/scene/resources/physics_material.h
@@ -31,7 +31,7 @@
#ifndef physics_material_override_H
#define physics_material_override_H
-#include "resource.h"
+#include "core/resource.h"
#include "servers/physics_server.h"
class PhysicsMaterial : public Resource {
diff --git a/scene/resources/polygon_path_finder.cpp b/scene/resources/polygon_path_finder.cpp
index 44f9ebaf33..bd03930c9e 100644
--- a/scene/resources/polygon_path_finder.cpp
+++ b/scene/resources/polygon_path_finder.cpp
@@ -29,7 +29,7 @@
/*************************************************************************/
#include "polygon_path_finder.h"
-#include "geometry.h"
+#include "core/math/geometry.h"
bool PolygonPathFinder::_is_point_inside(const Vector2 &p_point) const {
diff --git a/scene/resources/polygon_path_finder.h b/scene/resources/polygon_path_finder.h
index 19761c274c..66282458af 100644
--- a/scene/resources/polygon_path_finder.h
+++ b/scene/resources/polygon_path_finder.h
@@ -31,7 +31,7 @@
#ifndef POLYGON_PATH_FINDER_H
#define POLYGON_PATH_FINDER_H
-#include "resource.h"
+#include "core/resource.h"
class PolygonPathFinder : public Resource {
diff --git a/scene/resources/primitive_meshes.cpp b/scene/resources/primitive_meshes.cpp
index 28aa6f1aa7..63aa44e1d8 100644
--- a/scene/resources/primitive_meshes.cpp
+++ b/scene/resources/primitive_meshes.cpp
@@ -89,7 +89,7 @@ void PrimitiveMesh::_update() const {
pending_request = false;
- _clear_triangle_mesh();
+ clear_cache();
const_cast<PrimitiveMesh *>(this)->emit_changed();
}
diff --git a/scene/resources/room.h b/scene/resources/room.h
index 359d918665..d5ad847516 100644
--- a/scene/resources/room.h
+++ b/scene/resources/room.h
@@ -31,8 +31,8 @@
#ifndef ROOM_BOUNDS_H
#define ROOM_BOUNDS_H
-#include "bsp_tree.h"
-#include "resource.h"
+#include "core/math/bsp_tree.h"
+#include "core/resource.h"
/**
@author Juan Linietsky <reduzio@gmail.com>
*/
diff --git a/scene/resources/scene_format_text.cpp b/scene/resources/scene_format_text.cpp
index fd9989fe72..597ffe49ae 100644
--- a/scene/resources/scene_format_text.cpp
+++ b/scene/resources/scene_format_text.cpp
@@ -30,15 +30,15 @@
#include "scene_format_text.h"
#include "core/io/resource_format_binary.h"
-#include "os/dir_access.h"
-#include "project_settings.h"
-#include "version.h"
+#include "core/os/dir_access.h"
+#include "core/project_settings.h"
+#include "core/version.h"
//version 2: changed names for basis, aabb, poolvectors, etc.
#define FORMAT_VERSION 2
-#include "os/dir_access.h"
-#include "version.h"
+#include "core/os/dir_access.h"
+#include "core/version.h"
#define _printerr() ERR_PRINT(String(res_path + ":" + itos(lines) + " - Parse Error: " + error_text).utf8().get_data());
@@ -294,25 +294,25 @@ Ref<PackedScene> ResourceInteractiveLoaderText::_parse_node_tag(VariantParser::R
if (!next_tag.fields.has("from")) {
error = ERR_FILE_CORRUPT;
- error_text = "missing 'from' field fron connection tag";
+ error_text = "missing 'from' field from connection tag";
return Ref<PackedScene>();
}
if (!next_tag.fields.has("to")) {
error = ERR_FILE_CORRUPT;
- error_text = "missing 'to' field fron connection tag";
+ error_text = "missing 'to' field from connection tag";
return Ref<PackedScene>();
}
if (!next_tag.fields.has("signal")) {
error = ERR_FILE_CORRUPT;
- error_text = "missing 'signal' field fron connection tag";
+ error_text = "missing 'signal' field from connection tag";
return Ref<PackedScene>();
}
if (!next_tag.fields.has("method")) {
error = ERR_FILE_CORRUPT;
- error_text = "missing 'method' field fron connection tag";
+ error_text = "missing 'method' field from connection tag";
return Ref<PackedScene>();
}
@@ -358,7 +358,7 @@ Ref<PackedScene> ResourceInteractiveLoaderText::_parse_node_tag(VariantParser::R
if (!next_tag.fields.has("path")) {
error = ERR_FILE_CORRUPT;
- error_text = "missing 'path' field fron connection tag";
+ error_text = "missing 'path' field from connection tag";
_printerr();
return Ref<PackedScene>();
}
diff --git a/scene/resources/scene_format_text.h b/scene/resources/scene_format_text.h
index c28ded3d77..8d1af2bbb2 100644
--- a/scene/resources/scene_format_text.h
+++ b/scene/resources/scene_format_text.h
@@ -31,11 +31,11 @@
#ifndef SCENE_FORMAT_TEXT_H
#define SCENE_FORMAT_TEXT_H
-#include "io/resource_loader.h"
-#include "io/resource_saver.h"
-#include "os/file_access.h"
+#include "core/io/resource_loader.h"
+#include "core/io/resource_saver.h"
+#include "core/os/file_access.h"
+#include "core/variant_parser.h"
#include "scene/resources/packed_scene.h"
-#include "variant_parser.h"
class ResourceInteractiveLoaderText : public ResourceInteractiveLoader {
diff --git a/scene/resources/shader.cpp b/scene/resources/shader.cpp
index f53f03c1c8..1bfc41bd92 100644
--- a/scene/resources/shader.cpp
+++ b/scene/resources/shader.cpp
@@ -29,7 +29,7 @@
/*************************************************************************/
#include "shader.h"
-#include "os/file_access.h"
+#include "core/os/file_access.h"
#include "scene/scene_string_names.h"
#include "servers/visual/shader_language.h"
#include "servers/visual_server.h"
diff --git a/scene/resources/shader.h b/scene/resources/shader.h
index efc5da7753..6c91205c0c 100644
--- a/scene/resources/shader.h
+++ b/scene/resources/shader.h
@@ -31,9 +31,9 @@
#ifndef SHADER_H
#define SHADER_H
-#include "io/resource_loader.h"
-#include "io/resource_saver.h"
-#include "resource.h"
+#include "core/io/resource_loader.h"
+#include "core/io/resource_saver.h"
+#include "core/resource.h"
#include "scene/resources/texture.h"
class Shader : public Resource {
diff --git a/scene/resources/shape.cpp b/scene/resources/shape.cpp
index a48ce0564b..8ccca81acd 100644
--- a/scene/resources/shape.cpp
+++ b/scene/resources/shape.cpp
@@ -30,7 +30,7 @@
#include "shape.h"
-#include "os/os.h"
+#include "core/os/os.h"
#include "scene/main/scene_tree.h"
#include "scene/resources/mesh.h"
#include "servers/physics_server.h"
diff --git a/scene/resources/shape.h b/scene/resources/shape.h
index 0c44b86e92..6643f4ee44 100644
--- a/scene/resources/shape.h
+++ b/scene/resources/shape.h
@@ -31,7 +31,7 @@
#ifndef SHAPE_H
#define SHAPE_H
-#include "resource.h"
+#include "core/resource.h"
class ArrayMesh;
class Shape : public Resource {
diff --git a/scene/resources/shape_2d.h b/scene/resources/shape_2d.h
index 7eb0406bd8..fa39daa565 100644
--- a/scene/resources/shape_2d.h
+++ b/scene/resources/shape_2d.h
@@ -31,7 +31,7 @@
#ifndef SHAPE_2D_H
#define SHAPE_2D_H
-#include "resource.h"
+#include "core/resource.h"
class Shape2D : public Resource {
GDCLASS(Shape2D, Resource);
diff --git a/scene/resources/sky_box.cpp b/scene/resources/sky_box.cpp
index 4176aed4d8..a6a52c7bba 100644
--- a/scene/resources/sky_box.cpp
+++ b/scene/resources/sky_box.cpp
@@ -29,7 +29,7 @@
/*************************************************************************/
#include "sky_box.h"
-#include "io/image_loader.h"
+#include "core/io/image_loader.h"
void Sky::set_radiance_size(RadianceSize p_size) {
ERR_FAIL_INDEX(p_size, RADIANCE_SIZE_MAX);
diff --git a/scene/resources/sky_box.h b/scene/resources/sky_box.h
index e561653a9e..bbb852822d 100644
--- a/scene/resources/sky_box.h
+++ b/scene/resources/sky_box.h
@@ -31,7 +31,7 @@
#ifndef SKY_BOX_H
#define SKY_BOX_H
-#include "os/thread.h"
+#include "core/os/thread.h"
#include "scene/resources/texture.h"
class Sky : public Resource {
GDCLASS(Sky, Resource);
diff --git a/scene/resources/space_2d.h b/scene/resources/space_2d.h
index 148285ac6d..1143ad2bd5 100644
--- a/scene/resources/space_2d.h
+++ b/scene/resources/space_2d.h
@@ -31,7 +31,7 @@
#ifndef SPACE_2D_H
#define SPACE_2D_H
-#include "resource.h"
+#include "core/resource.h"
#include "servers/physics_2d_server.h"
class Space2D : public Resource {
diff --git a/scene/resources/style_box.h b/scene/resources/style_box.h
index ed193a1ab4..df3ebe1c36 100644
--- a/scene/resources/style_box.h
+++ b/scene/resources/style_box.h
@@ -31,7 +31,7 @@
#ifndef STYLE_BOX_H
#define STYLE_BOX_H
-#include "resource.h"
+#include "core/resource.h"
#include "scene/resources/texture.h"
#include "servers/visual_server.h"
/**
diff --git a/scene/resources/surface_tool.cpp b/scene/resources/surface_tool.cpp
index 81fabf40fe..5d4c7861e3 100644
--- a/scene/resources/surface_tool.cpp
+++ b/scene/resources/surface_tool.cpp
@@ -29,7 +29,8 @@
/*************************************************************************/
#include "surface_tool.h"
-#include "method_bind_ext.gen.inc"
+
+#include "core/method_bind_ext.gen.inc"
#define _VERTEX_SNAP 0.0001
#define EQ_VERTEX_DIST 0.00001
diff --git a/scene/resources/text_file.cpp b/scene/resources/text_file.cpp
index e2fe0adfc5..2af24ad2d5 100644
--- a/scene/resources/text_file.cpp
+++ b/scene/resources/text_file.cpp
@@ -30,7 +30,7 @@
#include "text_file.h"
-#include "os/file_access.h"
+#include "core/os/file_access.h"
bool TextFile::has_text() const {
return text != "";
diff --git a/scene/resources/text_file.h b/scene/resources/text_file.h
index 40b648eebb..3abc769dc6 100644
--- a/scene/resources/text_file.h
+++ b/scene/resources/text_file.h
@@ -31,8 +31,8 @@
#ifndef TEXTFILE_H
#define TEXTFILE_H
-#include "io/resource_loader.h"
-#include "io/resource_saver.h"
+#include "core/io/resource_loader.h"
+#include "core/io/resource_saver.h"
class TextFile : public Resource {
diff --git a/scene/resources/texture.cpp b/scene/resources/texture.cpp
index 811e5c3d2c..9875c7b130 100644
--- a/scene/resources/texture.cpp
+++ b/scene/resources/texture.cpp
@@ -29,11 +29,12 @@
/*************************************************************************/
#include "texture.h"
+
#include "bit_mask.h"
+#include "core/core_string_names.h"
+#include "core/io/image_loader.h"
#include "core/method_bind_ext.gen.inc"
#include "core/os/os.h"
-#include "core_string_names.h"
-#include "io/image_loader.h"
Size2 Texture::get_size() const {
@@ -1606,7 +1607,7 @@ void GradientTexture::_bind_methods() {
ClassDB::bind_method(D_METHOD("_update"), &GradientTexture::_update);
ADD_PROPERTY(PropertyInfo(Variant::OBJECT, "gradient", PROPERTY_HINT_RESOURCE_TYPE, "Gradient"), "set_gradient", "get_gradient");
- ADD_PROPERTY(PropertyInfo(Variant::INT, "width"), "set_width", "get_width");
+ ADD_PROPERTY(PropertyInfo(Variant::INT, "width", PROPERTY_HINT_RANGE, "1,2048,1,or_greater"), "set_width", "get_width");
}
void GradientTexture::set_gradient(Ref<Gradient> p_gradient) {
diff --git a/scene/resources/texture.h b/scene/resources/texture.h
index 79e6d2cdf9..4865f7b507 100644
--- a/scene/resources/texture.h
+++ b/scene/resources/texture.h
@@ -31,13 +31,13 @@
#ifndef TEXTURE_H
#define TEXTURE_H
+#include "core/io/resource_loader.h"
+#include "core/math/rect2.h"
+#include "core/os/mutex.h"
+#include "core/os/rw_lock.h"
+#include "core/os/thread_safe.h"
+#include "core/resource.h"
#include "curve.h"
-#include "io/resource_loader.h"
-#include "os/mutex.h"
-#include "os/rw_lock.h"
-#include "os/thread_safe.h"
-#include "rect2.h"
-#include "resource.h"
#include "scene/resources/color_ramp.h"
#include "servers/visual_server.h"
/**
diff --git a/scene/resources/theme.cpp b/scene/resources/theme.cpp
index f903669fc7..b102d477f2 100644
--- a/scene/resources/theme.cpp
+++ b/scene/resources/theme.cpp
@@ -29,8 +29,8 @@
/*************************************************************************/
#include "theme.h"
-#include "os/file_access.h"
-#include "print_string.h"
+#include "core/os/file_access.h"
+#include "core/print_string.h"
Ref<Theme> Theme::default_theme;
diff --git a/scene/resources/theme.h b/scene/resources/theme.h
index e0d4038e7e..0b76e95f18 100644
--- a/scene/resources/theme.h
+++ b/scene/resources/theme.h
@@ -31,8 +31,8 @@
#ifndef THEME_H
#define THEME_H
-#include "io/resource_loader.h"
-#include "resource.h"
+#include "core/io/resource_loader.h"
+#include "core/resource.h"
#include "scene/resources/font.h"
#include "scene/resources/shader.h"
#include "scene/resources/style_box.h"
diff --git a/scene/resources/tile_set.cpp b/scene/resources/tile_set.cpp
index 23074b4bae..f852ecd7eb 100644
--- a/scene/resources/tile_set.cpp
+++ b/scene/resources/tile_set.cpp
@@ -29,7 +29,7 @@
/*************************************************************************/
#include "tile_set.h"
-#include "array.h"
+#include "core/array.h"
bool TileSet::_set(const StringName &p_name, const Variant &p_value) {
diff --git a/scene/resources/tile_set.h b/scene/resources/tile_set.h
index 40eee2700d..74dcd47c48 100644
--- a/scene/resources/tile_set.h
+++ b/scene/resources/tile_set.h
@@ -32,7 +32,7 @@
#define TILE_SET_H
#include "core/array.h"
-#include "resource.h"
+#include "core/resource.h"
#include "scene/2d/light_occluder_2d.h"
#include "scene/2d/navigation_polygon.h"
#include "scene/resources/shape_2d.h"
diff --git a/scene/resources/visual_shader.cpp b/scene/resources/visual_shader.cpp
index 46b936b731..6bfb6ec5bf 100644
--- a/scene/resources/visual_shader.cpp
+++ b/scene/resources/visual_shader.cpp
@@ -29,8 +29,8 @@
/*************************************************************************/
#include "visual_shader.h"
+#include "core/vmap.h"
#include "servers/visual/shader_types.h"
-#include "vmap.h"
void VisualShaderNode::set_output_port_for_preview(int p_index) {
diff --git a/scene/resources/visual_shader.h b/scene/resources/visual_shader.h
index 81dd37de3c..70d2425304 100644
--- a/scene/resources/visual_shader.h
+++ b/scene/resources/visual_shader.h
@@ -31,8 +31,8 @@
#ifndef VISUAL_SHADER_H
#define VISUAL_SHADER_H
+#include "core/string_builder.h"
#include "scene/resources/shader.h"
-#include "string_builder.h"
class VisualShaderNodeUniform;
class VisualShaderNode;
diff --git a/scene/resources/world.cpp b/scene/resources/world.cpp
index 82183d24e7..b4588cd87c 100644
--- a/scene/resources/world.cpp
+++ b/scene/resources/world.cpp
@@ -30,8 +30,8 @@
#include "world.h"
-#include "camera_matrix.h"
-#include "octree.h"
+#include "core/math/camera_matrix.h"
+#include "core/math/octree.h"
#include "scene/3d/camera.h"
#include "scene/3d/visibility_notifier.h"
#include "scene/scene_string_names.h"
diff --git a/scene/resources/world.h b/scene/resources/world.h
index 54bdf25784..4c517323f3 100644
--- a/scene/resources/world.h
+++ b/scene/resources/world.h
@@ -31,7 +31,7 @@
#ifndef WORLD_H
#define WORLD_H
-#include "resource.h"
+#include "core/resource.h"
#include "scene/resources/environment.h"
#include "servers/physics_server.h"
#include "servers/visual_server.h"
diff --git a/scene/resources/world_2d.cpp b/scene/resources/world_2d.cpp
index bed6ffd1bd..b390e74073 100644
--- a/scene/resources/world_2d.cpp
+++ b/scene/resources/world_2d.cpp
@@ -32,7 +32,7 @@
#include "servers/physics_2d_server.h"
#include "servers/visual_server.h"
//#include "servers/spatial_sound_2d_server.h"
-#include "project_settings.h"
+#include "core/project_settings.h"
#include "scene/2d/camera_2d.h"
#include "scene/2d/visibility_notifier_2d.h"
#include "scene/main/viewport.h"
diff --git a/scene/resources/world_2d.h b/scene/resources/world_2d.h
index 59f34e32f2..856e9dbf01 100644
--- a/scene/resources/world_2d.h
+++ b/scene/resources/world_2d.h
@@ -31,8 +31,8 @@
#ifndef WORLD_2D_H
#define WORLD_2D_H
-#include "project_settings.h"
-#include "resource.h"
+#include "core/project_settings.h"
+#include "core/resource.h"
#include "servers/physics_2d_server.h"
class SpatialIndexer2D;
diff --git a/scene/scene_string_names.h b/scene/scene_string_names.h
index dbbcf79b9f..25e2c5d4a6 100644
--- a/scene/scene_string_names.h
+++ b/scene/scene_string_names.h
@@ -31,8 +31,8 @@
#ifndef SCENE_STRING_NAMES_H
#define SCENE_STRING_NAMES_H
-#include "node_path.h"
-#include "string_db.h"
+#include "core/node_path.h"
+#include "core/string_db.h"
class SceneStringNames {
friend void register_scene_types();
diff --git a/servers/arvr/arvr_interface.h b/servers/arvr/arvr_interface.h
index 910b401db9..b26ee6cb1b 100644
--- a/servers/arvr/arvr_interface.h
+++ b/servers/arvr/arvr_interface.h
@@ -32,7 +32,7 @@
#define ARVR_INTERFACE_H
#include "core/math/camera_matrix.h"
-#include "os/thread_safe.h"
+#include "core/os/thread_safe.h"
#include "scene/main/viewport.h"
#include "servers/arvr_server.h"
diff --git a/servers/arvr/arvr_positional_tracker.h b/servers/arvr/arvr_positional_tracker.h
index 525e47a681..69b89f11d3 100644
--- a/servers/arvr/arvr_positional_tracker.h
+++ b/servers/arvr/arvr_positional_tracker.h
@@ -31,7 +31,7 @@
#ifndef ARVR_POSITIONAL_TRACKER_H
#define ARVR_POSITIONAL_TRACKER_H
-#include "os/thread_safe.h"
+#include "core/os/thread_safe.h"
#include "servers/arvr_server.h"
/**
diff --git a/servers/arvr_server.cpp b/servers/arvr_server.cpp
index 2040377dd4..55f8ea8f5b 100644
--- a/servers/arvr_server.cpp
+++ b/servers/arvr_server.cpp
@@ -31,7 +31,7 @@
#include "arvr_server.h"
#include "arvr/arvr_interface.h"
#include "arvr/arvr_positional_tracker.h"
-#include "project_settings.h"
+#include "core/project_settings.h"
ARVRServer *ARVRServer::singleton = NULL;
diff --git a/servers/arvr_server.h b/servers/arvr_server.h
index 1f4d84fe19..a28b91c225 100644
--- a/servers/arvr_server.h
+++ b/servers/arvr_server.h
@@ -31,11 +31,11 @@
#ifndef ARVR_SERVER_H
#define ARVR_SERVER_H
-#include "os/os.h"
-#include "os/thread_safe.h"
-#include "reference.h"
-#include "rid.h"
-#include "variant.h"
+#include "core/os/os.h"
+#include "core/os/thread_safe.h"
+#include "core/reference.h"
+#include "core/rid.h"
+#include "core/variant.h"
class ARVRInterface;
class ARVRPositionalTracker;
@@ -87,7 +87,7 @@ private:
uint64_t last_process_usec; /* for frame timing, usec when we did our processing */
uint64_t last_commit_usec; /* for frame timing, usec when we finished committing both eyes */
- uint64_t last_frame_usec; /* time it took between process and commiting, we should probably average this over the last x frames */
+ uint64_t last_frame_usec; /* time it took between process and committing, we should probably average this over the last x frames */
protected:
static ARVRServer *singleton;
diff --git a/servers/audio/audio_driver_dummy.cpp b/servers/audio/audio_driver_dummy.cpp
index be36c3b748..512ff5da7b 100644
--- a/servers/audio/audio_driver_dummy.cpp
+++ b/servers/audio/audio_driver_dummy.cpp
@@ -30,8 +30,8 @@
#include "audio_driver_dummy.h"
-#include "os/os.h"
-#include "project_settings.h"
+#include "core/os/os.h"
+#include "core/project_settings.h"
Error AudioDriverDummy::init() {
diff --git a/servers/audio/audio_effect.h b/servers/audio/audio_effect.h
index b950e824c0..bbabedbc30 100644
--- a/servers/audio/audio_effect.h
+++ b/servers/audio/audio_effect.h
@@ -31,8 +31,8 @@
#ifndef AUDIOEFFECT_H
#define AUDIOEFFECT_H
-#include "audio_frame.h"
-#include "resource.h"
+#include "core/math/audio_frame.h"
+#include "core/resource.h"
class AudioEffectInstance : public Reference {
GDCLASS(AudioEffectInstance, Reference)
diff --git a/servers/audio/audio_filter_sw.h b/servers/audio/audio_filter_sw.h
index 4174f9bd51..d137ed8ff9 100644
--- a/servers/audio/audio_filter_sw.h
+++ b/servers/audio/audio_filter_sw.h
@@ -31,7 +31,7 @@
#ifndef AUDIO_FILTER_SW_H
#define AUDIO_FILTER_SW_H
-#include "math_funcs.h"
+#include "core/math/math_funcs.h"
class AudioFilterSW {
public:
diff --git a/servers/audio/audio_rb_resampler.cpp b/servers/audio/audio_rb_resampler.cpp
index 3414351681..3ae897c299 100644
--- a/servers/audio/audio_rb_resampler.cpp
+++ b/servers/audio/audio_rb_resampler.cpp
@@ -30,7 +30,7 @@
#include "audio_rb_resampler.h"
#include "core/math/math_funcs.h"
-#include "os/os.h"
+#include "core/os/os.h"
#include "servers/audio_server.h"
int AudioRBResampler::get_channel_count() const {
diff --git a/servers/audio/audio_rb_resampler.h b/servers/audio/audio_rb_resampler.h
index 6ef79c93fa..b21c480fc4 100644
--- a/servers/audio/audio_rb_resampler.h
+++ b/servers/audio/audio_rb_resampler.h
@@ -31,9 +31,9 @@
#ifndef AUDIO_RB_RESAMPLER_H
#define AUDIO_RB_RESAMPLER_H
-#include "os/memory.h"
+#include "core/os/memory.h"
+#include "core/typedefs.h"
#include "servers/audio_server.h"
-#include "typedefs.h"
struct AudioRBResampler {
diff --git a/servers/audio/audio_stream.cpp b/servers/audio/audio_stream.cpp
index eef8aba0c4..7de0695e8c 100644
--- a/servers/audio/audio_stream.cpp
+++ b/servers/audio/audio_stream.cpp
@@ -29,7 +29,7 @@
/*************************************************************************/
#include "audio_stream.h"
-#include "os/os.h"
+#include "core/os/os.h"
//////////////////////////////
@@ -137,7 +137,7 @@ void AudioStreamPlaybackMicrophone::_mix_internal(AudioFrame *p_buffer, int p_fr
Vector<int32_t> buf = AudioDriver::get_singleton()->get_input_buffer();
unsigned int input_size = AudioDriver::get_singleton()->get_input_size();
- // p_frames is multipled by two since an AudioFrame is stereo
+ // p_frames is multiplied by two since an AudioFrame is stereo
if ((p_frames + MICROPHONE_PLAYBACK_DELAY * 2) > input_size) {
for (int i = 0; i < p_frames; i++) {
p_buffer[i] = AudioFrame(0.0f, 0.0f);
diff --git a/servers/audio/audio_stream.h b/servers/audio/audio_stream.h
index 66e1b6ee2f..c7763890fc 100644
--- a/servers/audio/audio_stream.h
+++ b/servers/audio/audio_stream.h
@@ -31,8 +31,8 @@
#ifndef AUDIO_STREAM_H
#define AUDIO_STREAM_H
-#include "image.h"
-#include "resource.h"
+#include "core/image.h"
+#include "core/resource.h"
#include "servers/audio/audio_filter_sw.h"
#include "servers/audio_server.h"
diff --git a/servers/audio/effects/audio_effect_chorus.cpp b/servers/audio/effects/audio_effect_chorus.cpp
index fd9e3311e7..3c88d050f6 100644
--- a/servers/audio/effects/audio_effect_chorus.cpp
+++ b/servers/audio/effects/audio_effect_chorus.cpp
@@ -29,7 +29,7 @@
/*************************************************************************/
#include "audio_effect_chorus.h"
-#include "math_funcs.h"
+#include "core/math/math_funcs.h"
#include "servers/audio_server.h"
void AudioEffectChorusInstance::process(const AudioFrame *p_src_frames, AudioFrame *p_dst_frames, int p_frame_count) {
diff --git a/servers/audio/effects/audio_effect_delay.cpp b/servers/audio/effects/audio_effect_delay.cpp
index e3af898afa..abc10ee096 100644
--- a/servers/audio/effects/audio_effect_delay.cpp
+++ b/servers/audio/effects/audio_effect_delay.cpp
@@ -29,7 +29,7 @@
/*************************************************************************/
#include "audio_effect_delay.h"
-#include "math_funcs.h"
+#include "core/math/math_funcs.h"
#include "servers/audio_server.h"
void AudioEffectDelayInstance::process(const AudioFrame *p_src_frames, AudioFrame *p_dst_frames, int p_frame_count) {
diff --git a/servers/audio/effects/audio_effect_distortion.cpp b/servers/audio/effects/audio_effect_distortion.cpp
index c9ac0db644..0422083363 100644
--- a/servers/audio/effects/audio_effect_distortion.cpp
+++ b/servers/audio/effects/audio_effect_distortion.cpp
@@ -29,7 +29,7 @@
/*************************************************************************/
#include "audio_effect_distortion.h"
-#include "math_funcs.h"
+#include "core/math/math_funcs.h"
#include "servers/audio_server.h"
void AudioEffectDistortionInstance::process(const AudioFrame *p_src_frames, AudioFrame *p_dst_frames, int p_frame_count) {
diff --git a/servers/audio/effects/audio_effect_phaser.cpp b/servers/audio/effects/audio_effect_phaser.cpp
index c0a9bd773d..3151111ec8 100644
--- a/servers/audio/effects/audio_effect_phaser.cpp
+++ b/servers/audio/effects/audio_effect_phaser.cpp
@@ -29,7 +29,7 @@
/*************************************************************************/
#include "audio_effect_phaser.h"
-#include "math_funcs.h"
+#include "core/math/math_funcs.h"
#include "servers/audio_server.h"
void AudioEffectPhaserInstance::process(const AudioFrame *p_src_frames, AudioFrame *p_dst_frames, int p_frame_count) {
diff --git a/servers/audio/effects/audio_effect_pitch_shift.cpp b/servers/audio/effects/audio_effect_pitch_shift.cpp
index c6d1217308..f5ca8f2da4 100644
--- a/servers/audio/effects/audio_effect_pitch_shift.cpp
+++ b/servers/audio/effects/audio_effect_pitch_shift.cpp
@@ -30,7 +30,7 @@
#include "audio_effect_pitch_shift.h"
-#include "math_funcs.h"
+#include "core/math/math_funcs.h"
#include "servers/audio_server.h"
/* Thirdparty code, so disable clang-format with Godot style */
diff --git a/servers/audio/effects/audio_effect_record.h b/servers/audio/effects/audio_effect_record.h
index e4f5ba8a23..5f5c7802b4 100644
--- a/servers/audio/effects/audio_effect_record.h
+++ b/servers/audio/effects/audio_effect_record.h
@@ -31,11 +31,11 @@
#ifndef AUDIOEFFECTRECORD_H
#define AUDIOEFFECTRECORD_H
+#include "core/io/marshalls.h"
+#include "core/os/file_access.h"
+#include "core/os/os.h"
#include "core/os/thread.h"
#include "editor/import/resource_importer_wav.h"
-#include "io/marshalls.h"
-#include "os/file_access.h"
-#include "os/os.h"
#include "scene/resources/audio_stream_sample.h"
#include "servers/audio/audio_effect.h"
#include "servers/audio_server.h"
diff --git a/servers/audio/effects/eq.cpp b/servers/audio/effects/eq.cpp
index b15fc7ecf4..70ac70a5a8 100644
--- a/servers/audio/effects/eq.cpp
+++ b/servers/audio/effects/eq.cpp
@@ -31,8 +31,8 @@
// Author: reduzio@gmail.com (C) 2006
#include "eq.h"
-#include "error_macros.h"
-#include "math_funcs.h"
+#include "core/error_macros.h"
+#include "core/math/math_funcs.h"
#include <math.h>
#define POW2(v) ((v) * (v))
diff --git a/servers/audio/effects/eq.h b/servers/audio/effects/eq.h
index 5c654529c3..c06f1f8bf8 100644
--- a/servers/audio/effects/eq.h
+++ b/servers/audio/effects/eq.h
@@ -33,8 +33,8 @@
#ifndef EQ_FILTER_H
#define EQ_FILTER_H
-#include "typedefs.h"
-#include "vector.h"
+#include "core/typedefs.h"
+#include "core/vector.h"
/**
@author Juan Linietsky
diff --git a/servers/audio/effects/reverb.cpp b/servers/audio/effects/reverb.cpp
index 5e31202e58..ef23e4aaf3 100644
--- a/servers/audio/effects/reverb.cpp
+++ b/servers/audio/effects/reverb.cpp
@@ -31,7 +31,7 @@
// Author: Juan Linietsky <reduzio@gmail.com>, (C) 2006
#include "reverb.h"
-#include "math_funcs.h"
+#include "core/math/math_funcs.h"
#include <math.h>
const float Reverb::comb_tunings[MAX_COMBS] = {
diff --git a/servers/audio/effects/reverb.h b/servers/audio/effects/reverb.h
index c3d3873dcd..03cf197456 100644
--- a/servers/audio/effects/reverb.h
+++ b/servers/audio/effects/reverb.h
@@ -33,9 +33,9 @@
#ifndef REVERB_H
#define REVERB_H
-#include "audio_frame.h"
-#include "os/memory.h"
-#include "typedefs.h"
+#include "core/math/audio_frame.h"
+#include "core/os/memory.h"
+#include "core/typedefs.h"
class Reverb {
public:
diff --git a/servers/audio/reverb_sw.cpp b/servers/audio/reverb_sw.cpp
index 52e7699deb..13742d5db5 100644
--- a/servers/audio/reverb_sw.cpp
+++ b/servers/audio/reverb_sw.cpp
@@ -29,7 +29,7 @@
/*************************************************************************/
#include "reverb_sw.h"
-#include "print_string.h"
+#include "core/print_string.h"
#include "stdlib.h"
#define SETMIN(x, y) (x) = MIN((x), (y))
#define rangeloop(c, min, max) \
diff --git a/servers/audio/reverb_sw.h b/servers/audio/reverb_sw.h
index 15f9a43183..26b3fa5166 100644
--- a/servers/audio/reverb_sw.h
+++ b/servers/audio/reverb_sw.h
@@ -31,8 +31,8 @@
#ifndef REVERB_SW_H
#define REVERB_SW_H
-#include "os/memory.h"
-#include "typedefs.h"
+#include "core/os/memory.h"
+#include "core/typedefs.h"
class ReverbParamsSW;
diff --git a/servers/audio/voice_rb_sw.h b/servers/audio/voice_rb_sw.h
index 42045428a8..fc02cc1827 100644
--- a/servers/audio/voice_rb_sw.h
+++ b/servers/audio/voice_rb_sw.h
@@ -31,7 +31,7 @@
#ifndef VOICE_RB_SW_H
#define VOICE_RB_SW_H
-#include "os/os.h"
+#include "core/os/os.h"
#include "servers/audio_server.h"
class VoiceRBSW {
public:
diff --git a/servers/audio_server.cpp b/servers/audio_server.cpp
index db178e0df8..070099a3d8 100644
--- a/servers/audio_server.cpp
+++ b/servers/audio_server.cpp
@@ -29,10 +29,10 @@
/*************************************************************************/
#include "audio_server.h"
-#include "io/resource_loader.h"
-#include "os/file_access.h"
-#include "os/os.h"
-#include "project_settings.h"
+#include "core/io/resource_loader.h"
+#include "core/os/file_access.h"
+#include "core/os/os.h"
+#include "core/project_settings.h"
#include "scene/resources/audio_stream_sample.h"
#include "servers/audio/audio_driver_dummy.h"
#include "servers/audio/effects/audio_effect_compressor.h"
diff --git a/servers/audio_server.h b/servers/audio_server.h
index 2663a0f968..ba6569eb38 100644
--- a/servers/audio_server.h
+++ b/servers/audio_server.h
@@ -31,11 +31,11 @@
#ifndef AUDIO_SERVER_H
#define AUDIO_SERVER_H
-#include "audio_frame.h"
-#include "object.h"
-#include "os/os.h"
+#include "core/math/audio_frame.h"
+#include "core/object.h"
+#include "core/os/os.h"
+#include "core/variant.h"
#include "servers/audio/audio_effect.h"
-#include "variant.h"
class AudioDriverDummy;
class AudioStream;
diff --git a/servers/physics/area_sw.h b/servers/physics/area_sw.h
index ae19b0e04e..63a4db5d02 100644
--- a/servers/physics/area_sw.h
+++ b/servers/physics/area_sw.h
@@ -32,7 +32,7 @@
#define AREA_SW_H
#include "collision_object_sw.h"
-#include "self_list.h"
+#include "core/self_list.h"
#include "servers/physics_server.h"
//#include "servers/physics/query_sw.h"
diff --git a/servers/physics/body_pair_sw.cpp b/servers/physics/body_pair_sw.cpp
index 0ce38e4486..357fc05355 100644
--- a/servers/physics/body_pair_sw.cpp
+++ b/servers/physics/body_pair_sw.cpp
@@ -31,7 +31,7 @@
#include "body_pair_sw.h"
#include "collision_solver_sw.h"
-#include "os/os.h"
+#include "core/os/os.h"
#include "space_sw.h"
/*
diff --git a/servers/physics/body_sw.h b/servers/physics/body_sw.h
index 9d7b147fd6..0f7797254e 100644
--- a/servers/physics/body_sw.h
+++ b/servers/physics/body_sw.h
@@ -33,7 +33,7 @@
#include "area_sw.h"
#include "collision_object_sw.h"
-#include "vset.h"
+#include "core/vset.h"
class ConstraintSW;
diff --git a/servers/physics/broad_phase_basic.cpp b/servers/physics/broad_phase_basic.cpp
index 52483a8b14..d55951b39a 100644
--- a/servers/physics/broad_phase_basic.cpp
+++ b/servers/physics/broad_phase_basic.cpp
@@ -29,8 +29,8 @@
/*************************************************************************/
#include "broad_phase_basic.h"
-#include "list.h"
-#include "print_string.h"
+#include "core/list.h"
+#include "core/print_string.h"
BroadPhaseSW::ID BroadPhaseBasic::create(CollisionObjectSW *p_object, int p_subindex) {
diff --git a/servers/physics/broad_phase_basic.h b/servers/physics/broad_phase_basic.h
index 47fcdb3060..500b8544a1 100644
--- a/servers/physics/broad_phase_basic.h
+++ b/servers/physics/broad_phase_basic.h
@@ -32,7 +32,7 @@
#define BROAD_PHASE_BASIC_H
#include "broad_phase_sw.h"
-#include "map.h"
+#include "core/map.h"
class BroadPhaseBasic : public BroadPhaseSW {
diff --git a/servers/physics/broad_phase_octree.h b/servers/physics/broad_phase_octree.h
index e7028eba98..c4b8ecb299 100644
--- a/servers/physics/broad_phase_octree.h
+++ b/servers/physics/broad_phase_octree.h
@@ -32,7 +32,7 @@
#define BROAD_PHASE_OCTREE_H
#include "broad_phase_sw.h"
-#include "octree.h"
+#include "core/math/octree.h"
class BroadPhaseOctree : public BroadPhaseSW {
diff --git a/servers/physics/broad_phase_sw.h b/servers/physics/broad_phase_sw.h
index 7559942cd4..2db1c1dd06 100644
--- a/servers/physics/broad_phase_sw.h
+++ b/servers/physics/broad_phase_sw.h
@@ -31,8 +31,8 @@
#ifndef BROAD_PHASE_SW_H
#define BROAD_PHASE_SW_H
-#include "aabb.h"
-#include "math_funcs.h"
+#include "core/math/aabb.h"
+#include "core/math/math_funcs.h"
class CollisionObjectSW;
diff --git a/servers/physics/collision_object_sw.h b/servers/physics/collision_object_sw.h
index b6430b38dc..993799ee10 100644
--- a/servers/physics/collision_object_sw.h
+++ b/servers/physics/collision_object_sw.h
@@ -32,7 +32,7 @@
#define COLLISION_OBJECT_SW_H
#include "broad_phase_sw.h"
-#include "self_list.h"
+#include "core/self_list.h"
#include "servers/physics_server.h"
#include "shape_sw.h"
diff --git a/servers/physics/collision_solver_sat.cpp b/servers/physics/collision_solver_sat.cpp
index 294b1df241..087ae570fb 100644
--- a/servers/physics/collision_solver_sat.cpp
+++ b/servers/physics/collision_solver_sat.cpp
@@ -29,7 +29,7 @@
/*************************************************************************/
#include "collision_solver_sat.h"
-#include "geometry.h"
+#include "core/math/geometry.h"
#define _EDGE_IS_VALID_SUPPORT_THRESHOLD 0.02
diff --git a/servers/physics/joints/jacobian_entry_sw.h b/servers/physics/joints/jacobian_entry_sw.h
index 42c90c9ae9..4bc1255a9a 100644
--- a/servers/physics/joints/jacobian_entry_sw.h
+++ b/servers/physics/joints/jacobian_entry_sw.h
@@ -50,7 +50,7 @@ subject to the following restrictions:
3. This notice may not be removed or altered from any source distribution.
*/
-#include "transform.h"
+#include "core/math/transform.h"
class JacobianEntrySW {
public:
diff --git a/servers/physics/physics_server_sw.cpp b/servers/physics/physics_server_sw.cpp
index 472283833e..76a6138817 100644
--- a/servers/physics/physics_server_sw.cpp
+++ b/servers/physics/physics_server_sw.cpp
@@ -32,13 +32,13 @@
#include "broad_phase_basic.h"
#include "broad_phase_octree.h"
+#include "core/os/os.h"
+#include "core/script_language.h"
#include "joints/cone_twist_joint_sw.h"
#include "joints/generic_6dof_joint_sw.h"
#include "joints/hinge_joint_sw.h"
#include "joints/pin_joint_sw.h"
#include "joints/slider_joint_sw.h"
-#include "os/os.h"
-#include "script_language.h"
RID PhysicsServerSW::shape_create(ShapeType p_shape) {
diff --git a/servers/physics/shape_sw.cpp b/servers/physics/shape_sw.cpp
index 9d2e5e846d..e1c985f44f 100644
--- a/servers/physics/shape_sw.cpp
+++ b/servers/physics/shape_sw.cpp
@@ -30,9 +30,9 @@
#include "shape_sw.h"
-#include "geometry.h"
-#include "quick_hull.h"
-#include "sort.h"
+#include "core/math/geometry.h"
+#include "core/math/quick_hull.h"
+#include "core/sort.h"
#define _POINT_SNAP 0.001953125
#define _EDGE_IS_VALID_SUPPORT_THRESHOLD 0.0002
diff --git a/servers/physics/shape_sw.h b/servers/physics/shape_sw.h
index 7be818b23c..073d19e317 100644
--- a/servers/physics/shape_sw.h
+++ b/servers/physics/shape_sw.h
@@ -31,8 +31,8 @@
#ifndef SHAPE_SW_H
#define SHAPE_SW_H
-#include "bsp_tree.h"
-#include "geometry.h"
+#include "core/math/bsp_tree.h"
+#include "core/math/geometry.h"
#include "servers/physics_server.h"
/*
diff --git a/servers/physics/space_sw.cpp b/servers/physics/space_sw.cpp
index b2ab7bec16..731749b8ce 100644
--- a/servers/physics/space_sw.cpp
+++ b/servers/physics/space_sw.cpp
@@ -31,8 +31,8 @@
#include "space_sw.h"
#include "collision_solver_sw.h"
+#include "core/project_settings.h"
#include "physics_server_sw.h"
-#include "project_settings.h"
_FORCE_INLINE_ static bool _can_collide_with(CollisionObjectSW *p_object, uint32_t p_collision_mask, bool p_collide_with_bodies, bool p_collide_with_areas) {
@@ -105,7 +105,7 @@ bool PhysicsDirectSpaceStateSW::intersect_ray(const Vector3 &p_from, const Vecto
int amount = space->broadphase->cull_segment(begin, end, space->intersection_query_results, SpaceSW::INTERSECTION_QUERY_MAX, space->intersection_query_subindex_results);
- //todo, create another array tha references results, compute AABBs and check closest point to ray origin, sort, and stop evaluating results when beyond first collision
+ //todo, create another array that references results, compute AABBs and check closest point to ray origin, sort, and stop evaluating results when beyond first collision
bool collided = false;
Vector3 res_point, res_normal;
diff --git a/servers/physics/space_sw.h b/servers/physics/space_sw.h
index e7231df532..d550b374e3 100644
--- a/servers/physics/space_sw.h
+++ b/servers/physics/space_sw.h
@@ -37,9 +37,9 @@
#include "body_sw.h"
#include "broad_phase_sw.h"
#include "collision_object_sw.h"
-#include "hash_map.h"
-#include "project_settings.h"
-#include "typedefs.h"
+#include "core/hash_map.h"
+#include "core/project_settings.h"
+#include "core/typedefs.h"
class PhysicsDirectSpaceStateSW : public PhysicsDirectSpaceState {
diff --git a/servers/physics/step_sw.cpp b/servers/physics/step_sw.cpp
index 4128e1ec1a..5238f24b20 100644
--- a/servers/physics/step_sw.cpp
+++ b/servers/physics/step_sw.cpp
@@ -31,7 +31,7 @@
#include "step_sw.h"
#include "joints_sw.h"
-#include "os/os.h"
+#include "core/os/os.h"
void StepSW::_populate_island(BodySW *p_body, BodySW **p_island, ConstraintSW **p_constraint_island) {
diff --git a/servers/physics_2d/area_2d_sw.h b/servers/physics_2d/area_2d_sw.h
index d2058ad5af..90e30f68bc 100644
--- a/servers/physics_2d/area_2d_sw.h
+++ b/servers/physics_2d/area_2d_sw.h
@@ -32,7 +32,7 @@
#define AREA_2D_SW_H
#include "collision_object_2d_sw.h"
-#include "self_list.h"
+#include "core/self_list.h"
#include "servers/physics_2d_server.h"
//#include "servers/physics/query_sw.h"
diff --git a/servers/physics_2d/body_2d_sw.h b/servers/physics_2d/body_2d_sw.h
index 69184ad484..97dff69a20 100644
--- a/servers/physics_2d/body_2d_sw.h
+++ b/servers/physics_2d/body_2d_sw.h
@@ -33,7 +33,7 @@
#include "area_2d_sw.h"
#include "collision_object_2d_sw.h"
-#include "vset.h"
+#include "core/vset.h"
class Constraint2DSW;
diff --git a/servers/physics_2d/broad_phase_2d_basic.h b/servers/physics_2d/broad_phase_2d_basic.h
index f0f0b3df88..da5dc38b8e 100644
--- a/servers/physics_2d/broad_phase_2d_basic.h
+++ b/servers/physics_2d/broad_phase_2d_basic.h
@@ -31,7 +31,7 @@
#ifndef BROAD_PHASE_2D_BASIC_H
#define BROAD_PHASE_2D_BASIC_H
-#include "map.h"
+#include "core/map.h"
#include "space_2d_sw.h"
class BroadPhase2DBasic : public BroadPhase2DSW {
diff --git a/servers/physics_2d/broad_phase_2d_hash_grid.cpp b/servers/physics_2d/broad_phase_2d_hash_grid.cpp
index 1a5b2d5e3a..950f0f9d24 100644
--- a/servers/physics_2d/broad_phase_2d_hash_grid.cpp
+++ b/servers/physics_2d/broad_phase_2d_hash_grid.cpp
@@ -29,7 +29,7 @@
/*************************************************************************/
#include "broad_phase_2d_hash_grid.h"
-#include "project_settings.h"
+#include "core/project_settings.h"
#define LARGE_ELEMENT_FI 1.01239812
diff --git a/servers/physics_2d/broad_phase_2d_hash_grid.h b/servers/physics_2d/broad_phase_2d_hash_grid.h
index 5188abc837..0ecb915a7b 100644
--- a/servers/physics_2d/broad_phase_2d_hash_grid.h
+++ b/servers/physics_2d/broad_phase_2d_hash_grid.h
@@ -32,7 +32,7 @@
#define BROAD_PHASE_2D_HASH_GRID_H
#include "broad_phase_2d_sw.h"
-#include "map.h"
+#include "core/map.h"
class BroadPhase2DHashGrid : public BroadPhase2DSW {
diff --git a/servers/physics_2d/broad_phase_2d_sw.h b/servers/physics_2d/broad_phase_2d_sw.h
index d7d236c4c6..5b512dac76 100644
--- a/servers/physics_2d/broad_phase_2d_sw.h
+++ b/servers/physics_2d/broad_phase_2d_sw.h
@@ -31,8 +31,8 @@
#ifndef BROAD_PHASE_2D_SW_H
#define BROAD_PHASE_2D_SW_H
-#include "math_funcs.h"
-#include "rect2.h"
+#include "core/math/math_funcs.h"
+#include "core/math/rect2.h"
class CollisionObject2DSW;
diff --git a/servers/physics_2d/collision_object_2d_sw.h b/servers/physics_2d/collision_object_2d_sw.h
index 393c4a6ed7..c3b9e4b713 100644
--- a/servers/physics_2d/collision_object_2d_sw.h
+++ b/servers/physics_2d/collision_object_2d_sw.h
@@ -32,7 +32,7 @@
#define COLLISION_OBJECT_2D_SW_H
#include "broad_phase_2d_sw.h"
-#include "self_list.h"
+#include "core/self_list.h"
#include "servers/physics_2d_server.h"
#include "shape_2d_sw.h"
diff --git a/servers/physics_2d/collision_solver_2d_sat.cpp b/servers/physics_2d/collision_solver_2d_sat.cpp
index 98fe4adb80..0f32f2ec85 100644
--- a/servers/physics_2d/collision_solver_2d_sat.cpp
+++ b/servers/physics_2d/collision_solver_2d_sat.cpp
@@ -30,7 +30,7 @@
#include "collision_solver_2d_sat.h"
-#include "geometry.h"
+#include "core/math/geometry.h"
struct _CollectorCallback2D {
diff --git a/servers/physics_2d/physics_2d_server_sw.cpp b/servers/physics_2d/physics_2d_server_sw.cpp
index 721f21fc40..000e38c4a2 100644
--- a/servers/physics_2d/physics_2d_server_sw.cpp
+++ b/servers/physics_2d/physics_2d_server_sw.cpp
@@ -32,9 +32,9 @@
#include "broad_phase_2d_basic.h"
#include "broad_phase_2d_hash_grid.h"
#include "collision_solver_2d_sw.h"
-#include "os/os.h"
-#include "project_settings.h"
-#include "script_language.h"
+#include "core/os/os.h"
+#include "core/project_settings.h"
+#include "core/script_language.h"
RID Physics2DServerSW::_shape_create(ShapeType p_shape) {
diff --git a/servers/physics_2d/physics_2d_server_wrap_mt.cpp b/servers/physics_2d/physics_2d_server_wrap_mt.cpp
index 804b93ecd8..3ded4b717a 100644
--- a/servers/physics_2d/physics_2d_server_wrap_mt.cpp
+++ b/servers/physics_2d/physics_2d_server_wrap_mt.cpp
@@ -30,7 +30,7 @@
#include "physics_2d_server_wrap_mt.h"
-#include "os/os.h"
+#include "core/os/os.h"
void Physics2DServerWrapMT::thread_exit() {
diff --git a/servers/physics_2d/physics_2d_server_wrap_mt.h b/servers/physics_2d/physics_2d_server_wrap_mt.h
index 6b34fb9739..5f5fd3866f 100644
--- a/servers/physics_2d/physics_2d_server_wrap_mt.h
+++ b/servers/physics_2d/physics_2d_server_wrap_mt.h
@@ -31,9 +31,9 @@
#ifndef PHYSICS2DSERVERWRAPMT_H
#define PHYSICS2DSERVERWRAPMT_H
-#include "command_queue_mt.h"
-#include "os/thread.h"
-#include "project_settings.h"
+#include "core/command_queue_mt.h"
+#include "core/os/thread.h"
+#include "core/project_settings.h"
#include "servers/physics_2d_server.h"
#ifdef DEBUG_SYNC
diff --git a/servers/physics_2d/shape_2d_sw.cpp b/servers/physics_2d/shape_2d_sw.cpp
index dc8ec23e69..94b0a0a0c7 100644
--- a/servers/physics_2d/shape_2d_sw.cpp
+++ b/servers/physics_2d/shape_2d_sw.cpp
@@ -30,8 +30,8 @@
#include "shape_2d_sw.h"
-#include "geometry.h"
-#include "sort.h"
+#include "core/math/geometry.h"
+#include "core/sort.h"
void Shape2DSW::configure(const Rect2 &p_aabb) {
aabb = p_aabb;
diff --git a/servers/physics_2d/space_2d_sw.cpp b/servers/physics_2d/space_2d_sw.cpp
index 746aa2d49b..f36328c985 100644
--- a/servers/physics_2d/space_2d_sw.cpp
+++ b/servers/physics_2d/space_2d_sw.cpp
@@ -31,7 +31,7 @@
#include "space_2d_sw.h"
#include "collision_solver_2d_sw.h"
-#include "pair.h"
+#include "core/pair.h"
#include "physics_2d_server_sw.h"
_FORCE_INLINE_ static bool _can_collide_with(CollisionObject2DSW *p_object, uint32_t p_collision_mask, bool p_collide_with_bodies, bool p_collide_with_areas) {
@@ -112,7 +112,7 @@ bool Physics2DDirectSpaceStateSW::intersect_ray(const Vector2 &p_from, const Vec
int amount = space->broadphase->cull_segment(begin, end, space->intersection_query_results, Space2DSW::INTERSECTION_QUERY_MAX, space->intersection_query_subindex_results);
- //todo, create another array tha references results, compute AABBs and check closest point to ray origin, sort, and stop evaluating results when beyond first collision
+ //todo, create another array that references results, compute AABBs and check closest point to ray origin, sort, and stop evaluating results when beyond first collision
bool collided = false;
Vector2 res_point, res_normal;
diff --git a/servers/physics_2d/space_2d_sw.h b/servers/physics_2d/space_2d_sw.h
index 6e2e025185..c894eb9c40 100644
--- a/servers/physics_2d/space_2d_sw.h
+++ b/servers/physics_2d/space_2d_sw.h
@@ -37,9 +37,9 @@
#include "body_pair_2d_sw.h"
#include "broad_phase_2d_sw.h"
#include "collision_object_2d_sw.h"
-#include "hash_map.h"
-#include "project_settings.h"
-#include "typedefs.h"
+#include "core/hash_map.h"
+#include "core/project_settings.h"
+#include "core/typedefs.h"
class Physics2DDirectSpaceStateSW : public Physics2DDirectSpaceState {
diff --git a/servers/physics_2d/step_2d_sw.cpp b/servers/physics_2d/step_2d_sw.cpp
index d1078f1506..0fb7af0c94 100644
--- a/servers/physics_2d/step_2d_sw.cpp
+++ b/servers/physics_2d/step_2d_sw.cpp
@@ -29,7 +29,7 @@
/*************************************************************************/
#include "step_2d_sw.h"
-#include "os/os.h"
+#include "core/os/os.h"
void Step2DSW::_populate_island(Body2DSW *p_body, Body2DSW **p_island, Constraint2DSW **p_constraint_island) {
diff --git a/servers/physics_2d_server.cpp b/servers/physics_2d_server.cpp
index a51b938541..3ca6e29f0b 100644
--- a/servers/physics_2d_server.cpp
+++ b/servers/physics_2d_server.cpp
@@ -29,9 +29,10 @@
/*************************************************************************/
#include "physics_2d_server.h"
+
#include "core/method_bind_ext.gen.inc"
+#include "core/print_string.h"
#include "core/project_settings.h"
-#include "print_string.h"
Physics2DServer *Physics2DServer::singleton = NULL;
@@ -291,6 +292,8 @@ Dictionary Physics2DDirectSpaceState::_intersect_ray(const Vector2 &p_from, cons
Array Physics2DDirectSpaceState::_intersect_shape(const Ref<Physics2DShapeQueryParameters> &p_shape_query, int p_max_results) {
+ ERR_FAIL_COND_V(!p_shape_query.is_valid(), Array());
+
Vector<ShapeResult> sr;
sr.resize(p_max_results);
int rc = intersect_shape(p_shape_query->shape, p_shape_query->transform, p_shape_query->motion, p_shape_query->margin, sr.ptrw(), sr.size(), p_shape_query->exclude, p_shape_query->collision_mask, p_shape_query->collide_with_bodies, p_shape_query->collide_with_areas);
@@ -312,6 +315,8 @@ Array Physics2DDirectSpaceState::_intersect_shape(const Ref<Physics2DShapeQueryP
Array Physics2DDirectSpaceState::_cast_motion(const Ref<Physics2DShapeQueryParameters> &p_shape_query) {
+ ERR_FAIL_COND_V(!p_shape_query.is_valid(), Array());
+
float closest_safe, closest_unsafe;
bool res = cast_motion(p_shape_query->shape, p_shape_query->transform, p_shape_query->motion, p_shape_query->margin, closest_safe, closest_unsafe, p_shape_query->exclude, p_shape_query->collision_mask, p_shape_query->collide_with_bodies, p_shape_query->collide_with_areas);
if (!res)
@@ -353,6 +358,8 @@ Array Physics2DDirectSpaceState::_intersect_point(const Vector2 &p_point, int p_
Array Physics2DDirectSpaceState::_collide_shape(const Ref<Physics2DShapeQueryParameters> &p_shape_query, int p_max_results) {
+ ERR_FAIL_COND_V(!p_shape_query.is_valid(), Array());
+
Vector<Vector2> ret;
ret.resize(p_max_results * 2);
int rc = 0;
@@ -367,6 +374,8 @@ Array Physics2DDirectSpaceState::_collide_shape(const Ref<Physics2DShapeQueryPar
}
Dictionary Physics2DDirectSpaceState::_get_rest_info(const Ref<Physics2DShapeQueryParameters> &p_shape_query) {
+ ERR_FAIL_COND_V(!p_shape_query.is_valid(), Dictionary());
+
ShapeRestInfo sri;
bool res = rest_info(p_shape_query->shape, p_shape_query->transform, p_shape_query->motion, p_shape_query->margin, &sri, p_shape_query->exclude, p_shape_query->collision_mask, p_shape_query->collide_with_bodies, p_shape_query->collide_with_areas);
@@ -396,7 +405,6 @@ void Physics2DDirectSpaceState::_bind_methods() {
ClassDB::bind_method(D_METHOD("cast_motion", "shape"), &Physics2DDirectSpaceState::_cast_motion);
ClassDB::bind_method(D_METHOD("collide_shape", "shape", "max_results"), &Physics2DDirectSpaceState::_collide_shape, DEFVAL(32));
ClassDB::bind_method(D_METHOD("get_rest_info", "shape"), &Physics2DDirectSpaceState::_get_rest_info);
- //ClassDB::bind_method(D_METHOD("cast_motion","shape","xform","motion","exclude","umask"),&Physics2DDirectSpaceState::_intersect_shape,DEFVAL(Array()),DEFVAL(0));
}
int Physics2DShapeQueryResult::get_result_count() const {
@@ -434,10 +442,6 @@ void Physics2DShapeQueryResult::_bind_methods() {
///////////////////////////////
-/*bool Physics2DTestMotionResult::is_colliding() const {
-
- return colliding;
-}*/
Vector2 Physics2DTestMotionResult::get_motion() const {
return result.motion;
@@ -479,7 +483,6 @@ int Physics2DTestMotionResult::get_collider_shape() const {
void Physics2DTestMotionResult::_bind_methods() {
- //ClassDB::bind_method(D_METHOD("is_colliding"),&Physics2DTestMotionResult::is_colliding);
ClassDB::bind_method(D_METHOD("get_motion"), &Physics2DTestMotionResult::get_motion);
ClassDB::bind_method(D_METHOD("get_motion_remainder"), &Physics2DTestMotionResult::get_motion_remainder);
ClassDB::bind_method(D_METHOD("get_collision_point"), &Physics2DTestMotionResult::get_collision_point);
@@ -628,7 +631,6 @@ void Physics2DServer::_bind_methods() {
ClassDB::bind_method(D_METHOD("body_add_collision_exception", "body", "excepted_body"), &Physics2DServer::body_add_collision_exception);
ClassDB::bind_method(D_METHOD("body_remove_collision_exception", "body", "excepted_body"), &Physics2DServer::body_remove_collision_exception);
- //virtual void body_get_collision_exceptions(RID p_body, List<RID> *p_exceptions)=0;
ClassDB::bind_method(D_METHOD("body_set_max_contacts_reported", "body", "amount"), &Physics2DServer::body_set_max_contacts_reported);
ClassDB::bind_method(D_METHOD("body_get_max_contacts_reported", "body"), &Physics2DServer::body_get_max_contacts_reported);
@@ -662,11 +664,6 @@ void Physics2DServer::_bind_methods() {
ClassDB::bind_method(D_METHOD("get_process_info", "process_info"), &Physics2DServer::get_process_info);
- //ClassDB::bind_method(D_METHOD("init"),&Physics2DServer::init);
- //ClassDB::bind_method(D_METHOD("step"),&Physics2DServer::step);
- //ClassDB::bind_method(D_METHOD("sync"),&Physics2DServer::sync);
- //ClassDB::bind_method(D_METHOD("flush_queries"),&Physics2DServer::flush_queries);
-
BIND_ENUM_CONSTANT(SPACE_PARAM_CONTACT_RECYCLE_RADIUS);
BIND_ENUM_CONSTANT(SPACE_PARAM_CONTACT_MAX_SEPARATION);
BIND_ENUM_CONSTANT(SPACE_PARAM_BODY_MAX_ALLOWED_PENETRATION);
@@ -736,9 +733,6 @@ void Physics2DServer::_bind_methods() {
BIND_ENUM_CONSTANT(CCD_MODE_CAST_RAY);
BIND_ENUM_CONSTANT(CCD_MODE_CAST_SHAPE);
- //BIND_ENUM_CONSTANT( TYPE_BODY );
- //BIND_ENUM_CONSTANT( TYPE_AREA );
-
BIND_ENUM_CONSTANT(AREA_BODY_ADDED);
BIND_ENUM_CONSTANT(AREA_BODY_REMOVED);
@@ -749,7 +743,6 @@ void Physics2DServer::_bind_methods() {
Physics2DServer::Physics2DServer() {
- //ERR_FAIL_COND( singleton!=NULL );
singleton = this;
}
diff --git a/servers/physics_2d_server.h b/servers/physics_2d_server.h
index 82b4eb75d8..fc2a228723 100644
--- a/servers/physics_2d_server.h
+++ b/servers/physics_2d_server.h
@@ -31,9 +31,9 @@
#ifndef PHYSICS_2D_SERVER_H
#define PHYSICS_2D_SERVER_H
-#include "object.h"
-#include "reference.h"
-#include "resource.h"
+#include "core/object.h"
+#include "core/reference.h"
+#include "core/resource.h"
class Physics2DDirectSpaceState;
diff --git a/servers/physics_server.cpp b/servers/physics_server.cpp
index deb3cd9bbe..0660c84d09 100644
--- a/servers/physics_server.cpp
+++ b/servers/physics_server.cpp
@@ -30,9 +30,9 @@
#include "physics_server.h"
+#include "core/method_bind_ext.gen.inc"
+#include "core/print_string.h"
#include "core/project_settings.h"
-#include "method_bind_ext.gen.inc"
-#include "print_string.h"
PhysicsServer *PhysicsServer::singleton = NULL;
@@ -260,36 +260,6 @@ PhysicsShapeQueryParameters::PhysicsShapeQueryParameters() {
/////////////////////////////////////
-/*
-Variant PhysicsDirectSpaceState::_intersect_shape(const RID& p_shape, const Transform& p_xform,int p_result_max,const Vector<RID>& p_exclude,uint32_t p_collision_mask) {
-
-
-
- ERR_FAIL_INDEX_V(p_result_max,4096,Variant());
- if (p_result_max<=0)
- return Variant();
-
- Set<RID> exclude;
- for(int i=0;i<p_exclude.size();i++)
- exclude.insert(p_exclude[i]);
-
- ShapeResult *res=(ShapeResult*)alloca(p_result_max*sizeof(ShapeResult));
-
- int rc = intersect_shape(p_shape,p_xform,0,res,p_result_max,exclude);
-
- if (rc==0)
- return Variant();
-
- Ref<PhysicsShapeQueryResult> result = memnew( PhysicsShapeQueryResult );
- result->result.resize(rc);
- for(int i=0;i<rc;i++)
- result->result[i]=res[i];
-
- return result;
-
-}
-*/
-
Dictionary PhysicsDirectSpaceState::_intersect_ray(const Vector3 &p_from, const Vector3 &p_to, const Vector<RID> &p_exclude, uint32_t p_collision_mask, bool p_collide_with_bodies, bool p_collide_with_areas) {
RayResult inters;
@@ -315,6 +285,8 @@ Dictionary PhysicsDirectSpaceState::_intersect_ray(const Vector3 &p_from, const
Array PhysicsDirectSpaceState::_intersect_shape(const Ref<PhysicsShapeQueryParameters> &p_shape_query, int p_max_results) {
+ ERR_FAIL_COND_V(!p_shape_query.is_valid(), Array());
+
Vector<ShapeResult> sr;
sr.resize(p_max_results);
int rc = intersect_shape(p_shape_query->shape, p_shape_query->transform, p_shape_query->margin, sr.ptrw(), sr.size(), p_shape_query->exclude, p_shape_query->collision_mask, p_shape_query->collide_with_bodies, p_shape_query->collide_with_areas);
@@ -335,6 +307,8 @@ Array PhysicsDirectSpaceState::_intersect_shape(const Ref<PhysicsShapeQueryParam
Array PhysicsDirectSpaceState::_cast_motion(const Ref<PhysicsShapeQueryParameters> &p_shape_query, const Vector3 &p_motion) {
+ ERR_FAIL_COND_V(!p_shape_query.is_valid(), Array());
+
float closest_safe, closest_unsafe;
bool res = cast_motion(p_shape_query->shape, p_shape_query->transform, p_motion, p_shape_query->margin, closest_safe, closest_unsafe, p_shape_query->exclude, p_shape_query->collision_mask, p_shape_query->collide_with_bodies, p_shape_query->collide_with_areas);
if (!res)
@@ -347,6 +321,8 @@ Array PhysicsDirectSpaceState::_cast_motion(const Ref<PhysicsShapeQueryParameter
}
Array PhysicsDirectSpaceState::_collide_shape(const Ref<PhysicsShapeQueryParameters> &p_shape_query, int p_max_results) {
+ ERR_FAIL_COND_V(!p_shape_query.is_valid(), Array());
+
Vector<Vector3> ret;
ret.resize(p_max_results * 2);
int rc = 0;
@@ -361,6 +337,8 @@ Array PhysicsDirectSpaceState::_collide_shape(const Ref<PhysicsShapeQueryParamet
}
Dictionary PhysicsDirectSpaceState::_get_rest_info(const Ref<PhysicsShapeQueryParameters> &p_shape_query) {
+ ERR_FAIL_COND_V(!p_shape_query.is_valid(), Dictionary());
+
ShapeRestInfo sri;
bool res = rest_info(p_shape_query->shape, p_shape_query->transform, p_shape_query->margin, &sri, p_shape_query->exclude, p_shape_query->collision_mask, p_shape_query->collide_with_bodies, p_shape_query->collide_with_areas);
@@ -383,9 +361,6 @@ PhysicsDirectSpaceState::PhysicsDirectSpaceState() {
void PhysicsDirectSpaceState::_bind_methods() {
- //ClassDB::bind_method(D_METHOD("intersect_ray","from","to","exclude","umask"),&PhysicsDirectSpaceState::_intersect_ray,DEFVAL(Array()),DEFVAL(0));
- //ClassDB::bind_method(D_METHOD("intersect_shape","shape","xform","result_max","exclude","umask"),&PhysicsDirectSpaceState::_intersect_shape,DEFVAL(Array()),DEFVAL(0));
-
ClassDB::bind_method(D_METHOD("intersect_ray", "from", "to", "exclude", "collision_mask", "collide_with_bodies", "collide_with_areas"), &PhysicsDirectSpaceState::_intersect_ray, DEFVAL(Array()), DEFVAL(0x7FFFFFFF), DEFVAL(true), DEFVAL(false));
ClassDB::bind_method(D_METHOD("intersect_shape", "shape", "max_results"), &PhysicsDirectSpaceState::_intersect_shape, DEFVAL(32));
ClassDB::bind_method(D_METHOD("cast_motion", "shape", "motion"), &PhysicsDirectSpaceState::_cast_motion);
@@ -513,9 +488,6 @@ void PhysicsServer::_bind_methods() {
ClassDB::bind_method(D_METHOD("body_set_enable_continuous_collision_detection", "body", "enable"), &PhysicsServer::body_set_enable_continuous_collision_detection);
ClassDB::bind_method(D_METHOD("body_is_continuous_collision_detection_enabled", "body"), &PhysicsServer::body_is_continuous_collision_detection_enabled);
- //ClassDB::bind_method(D_METHOD("body_set_user_flags","flags""),&PhysicsServer::body_set_shape,DEFVAL(Transform));
- //ClassDB::bind_method(D_METHOD("body_get_user_flags","body","shape_idx","shape"),&PhysicsServer::body_get_shape);
-
ClassDB::bind_method(D_METHOD("body_set_param", "body", "param", "value"), &PhysicsServer::body_set_param);
ClassDB::bind_method(D_METHOD("body_get_param", "body", "param"), &PhysicsServer::body_get_param);
@@ -539,7 +511,6 @@ void PhysicsServer::_bind_methods() {
ClassDB::bind_method(D_METHOD("body_add_collision_exception", "body", "excepted_body"), &PhysicsServer::body_add_collision_exception);
ClassDB::bind_method(D_METHOD("body_remove_collision_exception", "body", "excepted_body"), &PhysicsServer::body_remove_collision_exception);
- //virtual void body_get_collision_exceptions(RID p_body, List<RID> *p_exceptions)=0;
ClassDB::bind_method(D_METHOD("body_set_max_contacts_reported", "body", "amount"), &PhysicsServer::body_set_max_contacts_reported);
ClassDB::bind_method(D_METHOD("body_get_max_contacts_reported", "body"), &PhysicsServer::body_get_max_contacts_reported);
@@ -672,28 +643,10 @@ void PhysicsServer::_bind_methods() {
ClassDB::bind_method(D_METHOD("generic_6dof_joint_set_flag", "joint", "axis", "flag", "enable"), &PhysicsServer::generic_6dof_joint_set_flag);
ClassDB::bind_method(D_METHOD("generic_6dof_joint_get_flag", "joint", "axis", "flag"), &PhysicsServer::generic_6dof_joint_get_flag);
- /*
- ClassDB::bind_method(D_METHOD("joint_set_param","joint","param","value"),&PhysicsServer::joint_set_param);
- ClassDB::bind_method(D_METHOD("joint_get_param","joint","param"),&PhysicsServer::joint_get_param);
-
- ClassDB::bind_method(D_METHOD("pin_joint_create","anchor","body_a","body_b"),&PhysicsServer::pin_joint_create,DEFVAL(RID()));
- ClassDB::bind_method(D_METHOD("groove_joint_create","groove1_a","groove2_a","anchor_b","body_a","body_b"),&PhysicsServer::groove_joint_create,DEFVAL(RID()),DEFVAL(RID()));
- ClassDB::bind_method(D_METHOD("damped_spring_joint_create","anchor_a","anchor_b","body_a","body_b"),&PhysicsServer::damped_spring_joint_create,DEFVAL(RID()));
-
- ClassDB::bind_method(D_METHOD("damped_string_joint_set_param","joint","param","value"),&PhysicsServer::damped_string_joint_set_param,DEFVAL(RID()));
- ClassDB::bind_method(D_METHOD("damped_string_joint_get_param","joint","param"),&PhysicsServer::damped_string_joint_get_param);
-
- ClassDB::bind_method(D_METHOD("joint_get_type","joint"),&PhysicsServer::joint_get_type);
-*/
ClassDB::bind_method(D_METHOD("free_rid", "rid"), &PhysicsServer::free);
ClassDB::bind_method(D_METHOD("set_active", "active"), &PhysicsServer::set_active);
- //ClassDB::bind_method(D_METHOD("init"),&PhysicsServer::init);
- //ClassDB::bind_method(D_METHOD("step"),&PhysicsServer::step);
- //ClassDB::bind_method(D_METHOD("sync"),&PhysicsServer::sync);
- //ClassDB::bind_method(D_METHOD("flush_queries"),&PhysicsServer::flush_queries);
-
ClassDB::bind_method(D_METHOD("get_process_info", "process_info"), &PhysicsServer::get_process_info);
BIND_ENUM_CONSTANT(SHAPE_PLANE);
@@ -741,17 +694,6 @@ void PhysicsServer::_bind_methods() {
BIND_ENUM_CONSTANT(BODY_STATE_ANGULAR_VELOCITY);
BIND_ENUM_CONSTANT(BODY_STATE_SLEEPING);
BIND_ENUM_CONSTANT(BODY_STATE_CAN_SLEEP);
- /*
- BIND_ENUM_CONSTANT( JOINT_PIN );
- BIND_ENUM_CONSTANT( JOINT_GROOVE );
- BIND_ENUM_CONSTANT( JOINT_DAMPED_SPRING );
-
- BIND_ENUM_CONSTANT( DAMPED_STRING_REST_LENGTH );
- BIND_ENUM_CONSTANT( DAMPED_STRING_STIFFNESS );
- BIND_ENUM_CONSTANT( DAMPED_STRING_DAMPING );
-*/
- //BIND_ENUM_CONSTANT( TYPE_BODY );
- //BIND_ENUM_CONSTANT( TYPE_AREA );
BIND_ENUM_CONSTANT(AREA_BODY_ADDED);
BIND_ENUM_CONSTANT(AREA_BODY_REMOVED);
diff --git a/servers/physics_server.h b/servers/physics_server.h
index f2aa33a6cc..d0d2ec16f0 100644
--- a/servers/physics_server.h
+++ b/servers/physics_server.h
@@ -31,8 +31,8 @@
#ifndef PHYSICS_SERVER_H
#define PHYSICS_SERVER_H
-#include "object.h"
-#include "resource.h"
+#include "core/object.h"
+#include "core/resource.h"
class PhysicsDirectSpaceState;
diff --git a/servers/register_server_types.cpp b/servers/register_server_types.cpp
index 4c764641e3..7deeec676b 100644
--- a/servers/register_server_types.cpp
+++ b/servers/register_server_types.cpp
@@ -29,8 +29,8 @@
/*************************************************************************/
#include "register_server_types.h"
-#include "engine.h"
-#include "project_settings.h"
+#include "core/engine.h"
+#include "core/project_settings.h"
#include "arvr/arvr_interface.h"
#include "arvr/arvr_positional_tracker.h"
@@ -52,12 +52,12 @@
#include "audio/effects/audio_effect_reverb.h"
#include "audio/effects/audio_effect_stereo_enhance.h"
#include "audio_server.h"
+#include "core/script_debugger_remote.h"
#include "physics/physics_server_sw.h"
#include "physics_2d/physics_2d_server_sw.h"
#include "physics_2d/physics_2d_server_wrap_mt.h"
#include "physics_2d_server.h"
#include "physics_server.h"
-#include "script_debugger_remote.h"
#include "visual/shader_types.h"
#include "visual_server.h"
diff --git a/servers/visual/rasterizer.cpp b/servers/visual/rasterizer.cpp
index be46690e55..6c04d1de63 100644
--- a/servers/visual/rasterizer.cpp
+++ b/servers/visual/rasterizer.cpp
@@ -30,8 +30,8 @@
#include "rasterizer.h"
-#include "os/os.h"
-#include "print_string.h"
+#include "core/os/os.h"
+#include "core/print_string.h"
Rasterizer *(*Rasterizer::_create_func)() = NULL;
diff --git a/servers/visual/rasterizer.h b/servers/visual/rasterizer.h
index 90f2972ddf..c26f02f087 100644
--- a/servers/visual/rasterizer.h
+++ b/servers/visual/rasterizer.h
@@ -31,10 +31,10 @@
#ifndef RASTERIZER_H
#define RASTERIZER_H
-#include "camera_matrix.h"
+#include "core/math/camera_matrix.h"
#include "servers/visual_server.h"
-#include "self_list.h"
+#include "core/self_list.h"
class RasterizerScene {
public:
diff --git a/servers/visual/shader_language.cpp b/servers/visual/shader_language.cpp
index 9500f35732..8a8b8af267 100644
--- a/servers/visual/shader_language.cpp
+++ b/servers/visual/shader_language.cpp
@@ -29,8 +29,8 @@
/*************************************************************************/
#include "shader_language.h"
-#include "os/os.h"
-#include "print_string.h"
+#include "core/os/os.h"
+#include "core/print_string.h"
static bool _is_text_char(CharType c) {
return (c >= 'a' && c <= 'z') || (c >= 'A' && c <= 'Z') || (c >= '0' && c <= '9') || c == '_';
diff --git a/servers/visual/shader_language.h b/servers/visual/shader_language.h
index d68f233b2f..e8ae099302 100644
--- a/servers/visual/shader_language.h
+++ b/servers/visual/shader_language.h
@@ -31,12 +31,12 @@
#ifndef SHADER_LANGUAGE_H
#define SHADER_LANGUAGE_H
-#include "list.h"
-#include "map.h"
-#include "string_db.h"
-#include "typedefs.h"
-#include "ustring.h"
-#include "variant.h"
+#include "core/list.h"
+#include "core/map.h"
+#include "core/string_db.h"
+#include "core/typedefs.h"
+#include "core/ustring.h"
+#include "core/variant.h"
class ShaderLanguage {
diff --git a/servers/visual/shader_types.h b/servers/visual/shader_types.h
index 0680ec8242..e195b6ea20 100644
--- a/servers/visual/shader_types.h
+++ b/servers/visual/shader_types.h
@@ -31,7 +31,7 @@
#ifndef SHADERTYPES_H
#define SHADERTYPES_H
-#include "ordered_hash_map.h"
+#include "core/ordered_hash_map.h"
#include "servers/visual_server.h"
#include "shader_language.h"
diff --git a/servers/visual/visual_server_raster.cpp b/servers/visual/visual_server_raster.cpp
index c7d33ec43c..ea63ae5013 100644
--- a/servers/visual/visual_server_raster.cpp
+++ b/servers/visual/visual_server_raster.cpp
@@ -30,11 +30,11 @@
#include "visual_server_raster.h"
+#include "core/io/marshalls.h"
+#include "core/os/os.h"
+#include "core/project_settings.h"
+#include "core/sort.h"
#include "default_mouse_cursor.xpm"
-#include "io/marshalls.h"
-#include "os/os.h"
-#include "project_settings.h"
-#include "sort.h"
#include "visual_server_canvas.h"
#include "visual_server_global.h"
#include "visual_server_scene.h"
diff --git a/servers/visual/visual_server_raster.h b/servers/visual/visual_server_raster.h
index 7960c5468b..f25973c4e2 100644
--- a/servers/visual/visual_server_raster.h
+++ b/servers/visual/visual_server_raster.h
@@ -31,8 +31,8 @@
#ifndef VISUAL_SERVER_RASTER_H
#define VISUAL_SERVER_RASTER_H
-#include "allocators.h"
-#include "octree.h"
+#include "core/allocators.h"
+#include "core/math/octree.h"
#include "servers/visual/rasterizer.h"
#include "servers/visual_server.h"
#include "visual_server_canvas.h"
diff --git a/servers/visual/visual_server_scene.cpp b/servers/visual/visual_server_scene.cpp
index 1e255591f0..eacb5f671c 100644
--- a/servers/visual/visual_server_scene.cpp
+++ b/servers/visual/visual_server_scene.cpp
@@ -29,7 +29,7 @@
/*************************************************************************/
#include "visual_server_scene.h"
-#include "os/os.h"
+#include "core/os/os.h"
#include "visual_server_global.h"
#include "visual_server_raster.h"
/* CAMERA API */
diff --git a/servers/visual/visual_server_scene.h b/servers/visual/visual_server_scene.h
index 12d732724a..87e19bc6b0 100644
--- a/servers/visual/visual_server_scene.h
+++ b/servers/visual/visual_server_scene.h
@@ -33,12 +33,12 @@
#include "servers/visual/rasterizer.h"
-#include "allocators.h"
-#include "geometry.h"
-#include "octree.h"
-#include "os/semaphore.h"
-#include "os/thread.h"
-#include "self_list.h"
+#include "core/allocators.h"
+#include "core/math/geometry.h"
+#include "core/math/octree.h"
+#include "core/os/semaphore.h"
+#include "core/os/thread.h"
+#include "core/self_list.h"
#include "servers/arvr/arvr_interface.h"
class VisualServerScene {
diff --git a/servers/visual/visual_server_viewport.cpp b/servers/visual/visual_server_viewport.cpp
index 90acba306a..b286533590 100644
--- a/servers/visual/visual_server_viewport.cpp
+++ b/servers/visual/visual_server_viewport.cpp
@@ -30,7 +30,7 @@
#include "visual_server_viewport.h"
-#include "project_settings.h"
+#include "core/project_settings.h"
#include "visual_server_canvas.h"
#include "visual_server_global.h"
#include "visual_server_scene.h"
@@ -294,7 +294,7 @@ void VisualServerViewport::draw_viewports() {
arvr_interface->commit_for_eye(ARVRInterface::EYE_RIGHT, vp->render_target, vp->viewport_to_screen_rect);
}
- // and for our frame timing, mark when we've finished commiting our eyes
+ // and for our frame timing, mark when we've finished committing our eyes
ARVRServer::get_singleton()->_mark_commit();
} else {
VSG::rasterizer->set_current_render_target(vp->render_target);
diff --git a/servers/visual/visual_server_viewport.h b/servers/visual/visual_server_viewport.h
index f915e26b81..978d6ae4ae 100644
--- a/servers/visual/visual_server_viewport.h
+++ b/servers/visual/visual_server_viewport.h
@@ -31,8 +31,8 @@
#ifndef VISUALSERVERVIEWPORT_H
#define VISUALSERVERVIEWPORT_H
+#include "core/self_list.h"
#include "rasterizer.h"
-#include "self_list.h"
#include "servers/arvr/arvr_interface.h"
#include "servers/visual_server.h"
diff --git a/servers/visual/visual_server_wrap_mt.cpp b/servers/visual/visual_server_wrap_mt.cpp
index 1cafc47685..f59d8af9cb 100644
--- a/servers/visual/visual_server_wrap_mt.cpp
+++ b/servers/visual/visual_server_wrap_mt.cpp
@@ -29,8 +29,8 @@
/*************************************************************************/
#include "visual_server_wrap_mt.h"
-#include "os/os.h"
-#include "project_settings.h"
+#include "core/os/os.h"
+#include "core/project_settings.h"
void VisualServerWrapMT::thread_exit() {
diff --git a/servers/visual/visual_server_wrap_mt.h b/servers/visual/visual_server_wrap_mt.h
index fcf9b08968..85205e5132 100644
--- a/servers/visual/visual_server_wrap_mt.h
+++ b/servers/visual/visual_server_wrap_mt.h
@@ -31,8 +31,8 @@
#ifndef VISUAL_SERVER_WRAP_MT_H
#define VISUAL_SERVER_WRAP_MT_H
-#include "command_queue_mt.h"
-#include "os/thread.h"
+#include "core/command_queue_mt.h"
+#include "core/os/thread.h"
#include "servers/visual_server.h"
/**
diff --git a/servers/visual_server.cpp b/servers/visual_server.cpp
index 18a04e9a4b..d4e96bb173 100644
--- a/servers/visual_server.cpp
+++ b/servers/visual_server.cpp
@@ -30,8 +30,8 @@
#include "visual_server.h"
-#include "method_bind_ext.gen.inc"
-#include "project_settings.h"
+#include "core/method_bind_ext.gen.inc"
+#include "core/project_settings.h"
VisualServer *VisualServer::singleton = NULL;
VisualServer *(*VisualServer::create_func)() = NULL;
diff --git a/servers/visual_server.h b/servers/visual_server.h
index e74df1269a..7c21d138e0 100644
--- a/servers/visual_server.h
+++ b/servers/visual_server.h
@@ -31,13 +31,13 @@
#ifndef VISUAL_SERVER_H
#define VISUAL_SERVER_H
-#include "bsp_tree.h"
-#include "geometry.h"
-#include "image.h"
-#include "object.h"
-#include "rid.h"
-#include "transform_2d.h"
-#include "variant.h"
+#include "core/image.h"
+#include "core/math/bsp_tree.h"
+#include "core/math/geometry.h"
+#include "core/math/transform_2d.h"
+#include "core/object.h"
+#include "core/rid.h"
+#include "core/variant.h"
/**
@author Juan Linietsky <reduzio@gmail.com>
diff --git a/thirdparty/README.md b/thirdparty/README.md
index 82b7748194..55f6a71179 100644
--- a/thirdparty/README.md
+++ b/thirdparty/README.md
@@ -266,6 +266,8 @@ File extracted from upstream source:
- Also copy `win32helpers/` from `win32port/` inside `thirdparty/libwebsockets`
- A small fix has been added in `libwebsockets/libwebsockets.h` to `#include <sys/socket.h>` for the BSD family.
This change has been PRed upstream, and should be merged before the next update. Remember to check and remove this line.
+- Another fix has been added to allow building for 32-bits UWP, replacing `GetFileSize[Ex]` and `CreateFileW` with supported functions.
+ There is a diff for this change in `thirdparty/libwebsockets/uwp_fixes.diff`
Important: `lws_config.h` and `lws_config_private.h` contains custom
Godot build configurations, check them out when updating.
@@ -523,3 +525,5 @@ Files extracted from upstream source:
- lib/{common/,compress/,decompress/,zstd.h}
- LICENSE
+
+- Applied the patch in `thirdparty/zstd/1314.diff` (PR 1314 upstream, already merged). Needed to build on UWP ARM. Can be removed when a new version is released with the patch.
diff --git a/thirdparty/b2d_convexdecomp/b2Glue.h b/thirdparty/b2d_convexdecomp/b2Glue.h
index 10c2f62361..175f75be75 100644
--- a/thirdparty/b2d_convexdecomp/b2Glue.h
+++ b/thirdparty/b2d_convexdecomp/b2Glue.h
@@ -19,7 +19,8 @@
#ifndef B2GLUE_H
#define B2GLUE_H
-#include "vector2.h"
+#include "core/math/vector2.h"
+
#include <limits.h>
namespace b2ConvexDecomp {
diff --git a/thirdparty/enet/godot.cpp b/thirdparty/enet/godot.cpp
index 7813b70286..6ba7cf0000 100644
--- a/thirdparty/enet/godot.cpp
+++ b/thirdparty/enet/godot.cpp
@@ -108,7 +108,7 @@ int enet_socket_bind(ENetSocket socket, const ENetAddress *address) {
ENetSocket enet_socket_create(ENetSocketType type) {
- PacketPeerUDP *socket = PacketPeerUDP::create();
+ PacketPeerUDP *socket = memnew(PacketPeerUDP);
socket->set_blocking_mode(false);
return socket;
@@ -151,7 +151,7 @@ int enet_socket_send(ENetSocket socket, const ENetAddress *address, const ENetBu
err = sock->put_packet((const uint8_t *)&w[0], size);
if (err != OK) {
- if (err == ERR_UNAVAILABLE) { // blocking call
+ if (err == ERR_BUSY) { // Blocking call
return 0;
}
@@ -168,8 +168,9 @@ int enet_socket_receive(ENetSocket socket, ENetAddress *address, ENetBuffer *buf
PacketPeerUDP *sock = (PacketPeerUDP *)socket;
- if (sock->get_available_packet_count() == 0) {
- return 0;
+ int pc = sock->get_available_packet_count();
+ if (pc < 1) {
+ return pc;
}
const uint8_t *buffer;
diff --git a/thirdparty/libogg/ogg/config_types.h b/thirdparty/libogg/ogg/config_types.h
index 5ea49b8abd..e630657547 100644
--- a/thirdparty/libogg/ogg/config_types.h
+++ b/thirdparty/libogg/ogg/config_types.h
@@ -1,7 +1,7 @@
#ifndef __CONFIG_TYPES_H__
#define __CONFIG_TYPES_H__
-#include "int_types.h"
+#include "core/int_types.h"
typedef int16_t ogg_int16_t;
typedef uint16_t ogg_uint16_t;
diff --git a/thirdparty/libwebsockets/plat/lws-plat-win.c b/thirdparty/libwebsockets/plat/lws-plat-win.c
index 948db62896..8a43081ef1 100644
--- a/thirdparty/libwebsockets/plat/lws-plat-win.c
+++ b/thirdparty/libwebsockets/plat/lws-plat-win.c
@@ -635,9 +635,20 @@ _lws_plat_file_open(const struct lws_plat_file_ops *fops, const char *filename,
HANDLE ret;
WCHAR buf[MAX_PATH];
lws_fop_fd_t fop_fd;
- LARGE_INTEGER llFileSize = {0};
+ FILE_STANDARD_INFO fInfo = {0};
MultiByteToWideChar(CP_UTF8, 0, filename, -1, buf, ARRAY_SIZE(buf));
+
+#if defined(_WIN32_WINNT) && _WIN32_WINNT >= 0x0602 // Windows 8 (minimum when UWP_ENABLED, but can be used in Windows builds)
+ CREATEFILE2_EXTENDED_PARAMETERS extParams = {0};
+ extParams.dwFileAttributes = FILE_ATTRIBUTE_NORMAL;
+
+ if (((*flags) & 7) == _O_RDONLY) {
+ ret = CreateFile2(buf, GENERIC_READ, FILE_SHARE_READ, OPEN_EXISTING, &extParams);
+ } else {
+ ret = CreateFile2(buf, GENERIC_WRITE, 0, CREATE_ALWAYS, &extParams);
+ }
+#else
if (((*flags) & 7) == _O_RDONLY) {
ret = CreateFileW(buf, GENERIC_READ, FILE_SHARE_READ,
NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL);
@@ -645,6 +656,7 @@ _lws_plat_file_open(const struct lws_plat_file_ops *fops, const char *filename,
ret = CreateFileW(buf, GENERIC_WRITE, 0, NULL,
CREATE_ALWAYS, FILE_ATTRIBUTE_NORMAL, NULL);
}
+#endif
if (ret == LWS_INVALID_FILE)
goto bail;
@@ -657,9 +669,9 @@ _lws_plat_file_open(const struct lws_plat_file_ops *fops, const char *filename,
fop_fd->fd = ret;
fop_fd->filesystem_priv = NULL; /* we don't use it */
fop_fd->flags = *flags;
- fop_fd->len = GetFileSize(ret, NULL);
- if(GetFileSizeEx(ret, &llFileSize))
- fop_fd->len = llFileSize.QuadPart;
+ fop_fd->len = 0;
+ if(GetFileInformationByHandleEx(ret, FileStandardInfo, &fInfo, sizeof(fInfo)))
+ fop_fd->len = fInfo.EndOfFile.QuadPart;
fop_fd->pos = 0;
diff --git a/thirdparty/libwebsockets/uwp_fixes.diff b/thirdparty/libwebsockets/uwp_fixes.diff
new file mode 100644
index 0000000000..5b9d8724ed
--- /dev/null
+++ b/thirdparty/libwebsockets/uwp_fixes.diff
@@ -0,0 +1,47 @@
+diff --git a/thirdparty/libwebsockets/plat/lws-plat-win.c b/thirdparty/libwebsockets/plat/lws-plat-win.c
+index 948db6289..511e29739 100644
+--- a/thirdparty/libwebsockets/plat/lws-plat-win.c
++++ b/thirdparty/libwebsockets/plat/lws-plat-win.c
+@@ -635,9 +635,20 @@ _lws_plat_file_open(const struct lws_plat_file_ops *fops, const char *filename,
+ HANDLE ret;
+ WCHAR buf[MAX_PATH];
+ lws_fop_fd_t fop_fd;
+- LARGE_INTEGER llFileSize = {0};
++ FILE_STANDARD_INFO fInfo = {0};
+
+ MultiByteToWideChar(CP_UTF8, 0, filename, -1, buf, ARRAY_SIZE(buf));
++
++#if defined(_WIN32_WINNT) && _WIN32_WINNT >= 0x0602 // Windows 8 (minimum when UWP_ENABLED, but can be used in Windows builds)
++ CREATEFILE2_EXTENDED_PARAMETERS extParams = {0};
++ extParams.dwFileAttributes = FILE_ATTRIBUTE_NORMAL;
++
++ if (((*flags) & 7) == _O_RDONLY) {
++ ret = CreateFile2(buf, GENERIC_READ, FILE_SHARE_READ, OPEN_EXISTING, &extParams);
++ } else {
++ ret = CreateFile2(buf, GENERIC_WRITE, 0, CREATE_ALWAYS, &extParams);
++ }
++#else
+ if (((*flags) & 7) == _O_RDONLY) {
+ ret = CreateFileW(buf, GENERIC_READ, FILE_SHARE_READ,
+ NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL);
+@@ -645,6 +656,7 @@ _lws_plat_file_open(const struct lws_plat_file_ops *fops, const char *filename,
+ ret = CreateFileW(buf, GENERIC_WRITE, 0, NULL,
+ CREATE_ALWAYS, FILE_ATTRIBUTE_NORMAL, NULL);
+ }
++#endif
+
+ if (ret == LWS_INVALID_FILE)
+ goto bail;
+@@ -657,9 +669,9 @@ _lws_plat_file_open(const struct lws_plat_file_ops *fops, const char *filename,
+ fop_fd->fd = ret;
+ fop_fd->filesystem_priv = NULL; /* we don't use it */
+ fop_fd->flags = *flags;
+- fop_fd->len = GetFileSize(ret, NULL);
+- if(GetFileSizeEx(ret, &llFileSize))
+- fop_fd->len = llFileSize.QuadPart;
++ fop_fd->len = 0;
++ if(GetFileInformationByHandleEx(ret, FileStandardInfo, &fInfo, sizeof(fInfo)))
++ fop_fd->len = fInfo.EndOfFile.QuadPart;
+
+ fop_fd->pos = 0;
+
diff --git a/thirdparty/miniupnpc/miniupnpcstrings.h b/thirdparty/miniupnpc/miniupnpcstrings.h
index 1d5c5882fd..a718cc7bbf 100644
--- a/thirdparty/miniupnpc/miniupnpcstrings.h
+++ b/thirdparty/miniupnpc/miniupnpcstrings.h
@@ -1,7 +1,7 @@
#ifndef MINIUPNPCSTRINGS_H_INCLUDED
#define MINIUPNPCSTRINGS_H_INCLUDED
-#include <version.h>
+#include "core/version.h"
#define OS_STRING VERSION_NAME "/1.0"
#define MINIUPNPC_VERSION_STRING "2.1"
diff --git a/thirdparty/misc/aes256.h b/thirdparty/misc/aes256.h
index 8fcc25a4de..150a0670f5 100644
--- a/thirdparty/misc/aes256.h
+++ b/thirdparty/misc/aes256.h
@@ -21,7 +21,7 @@
#ifndef AES_256_H
#define AES_256_H
-#include "typedefs.h"
+#include "core/typedefs.h"
#ifdef __cplusplus
extern "C" {
diff --git a/thirdparty/misc/hq2x.cpp b/thirdparty/misc/hq2x.cpp
index 7ebb505d64..9c089ba85c 100644
--- a/thirdparty/misc/hq2x.cpp
+++ b/thirdparty/misc/hq2x.cpp
@@ -16,8 +16,8 @@
#include "hq2x.h"
-#include "math_funcs.h"
+#include "core/math/math_funcs.h"
static const uint32_t AMASK = 0xFF000000;
static const uint32_t YMASK = 0x00FF0000;
diff --git a/thirdparty/misc/hq2x.h b/thirdparty/misc/hq2x.h
index 8f119d2a01..bebd917950 100644
--- a/thirdparty/misc/hq2x.h
+++ b/thirdparty/misc/hq2x.h
@@ -1,7 +1,7 @@
#ifndef HQ2X_H
#define HQ2X_H
-#include "typedefs.h"
+#include "core/typedefs.h"
uint32_t *hq2x_resize(
diff --git a/thirdparty/misc/md5.h b/thirdparty/misc/md5.h
index e99d58b443..14b3cd3ddf 100644
--- a/thirdparty/misc/md5.h
+++ b/thirdparty/misc/md5.h
@@ -42,7 +42,7 @@
/* NOT typedef a 32 bit type */
-#include "typedefs.h"
+#include "core/typedefs.h"
/* Data structure for MD5 (Message Digest) computation */
typedef struct {
diff --git a/thirdparty/misc/pcg.h b/thirdparty/misc/pcg.h
index 81f4c9770e..e2d66d51d5 100644
--- a/thirdparty/misc/pcg.h
+++ b/thirdparty/misc/pcg.h
@@ -4,7 +4,7 @@
#ifndef RANDOM_H
#define RANDOM_H
-#include "typedefs.h"
+#include "core/typedefs.h"
#define PCG_DEFAULT_INC_64 1442695040888963407ULL
diff --git a/thirdparty/misc/triangulator.h b/thirdparty/misc/triangulator.h
index d1538cfae5..c85792fd50 100644
--- a/thirdparty/misc/triangulator.h
+++ b/thirdparty/misc/triangulator.h
@@ -21,11 +21,11 @@
#ifndef TRIANGULATOR_H
#define TRIANGULATOR_H
-#include "list.h"
-#include "set.h"
-#include "vector2.h"
-//2D point structure
+#include "core/list.h"
+#include "core/math/vector2.h"
+#include "core/set.h"
+//2D point structure
#define TRIANGULATOR_CCW 1
#define TRIANGULATOR_CW -1
diff --git a/thirdparty/misc/yuv2rgb.h b/thirdparty/misc/yuv2rgb.h
index d0c2813a75..3ec8388246 100644
--- a/thirdparty/misc/yuv2rgb.h
+++ b/thirdparty/misc/yuv2rgb.h
@@ -27,7 +27,7 @@ ship it.
#ifndef YUV2RGB_H
#define YUV2RGB_H
-#include "typedefs.h"
+#include "core/typedefs.h"
static const uint32_t tables[256*3] = {
/* y_table */
diff --git a/thirdparty/pvrtccompressor/BitScale.h b/thirdparty/pvrtccompressor/BitScale.h
index 36613aeeee..3ea7962f55 100644
--- a/thirdparty/pvrtccompressor/BitScale.h
+++ b/thirdparty/pvrtccompressor/BitScale.h
@@ -2,7 +2,7 @@
#pragma once
-#include "typedefs.h"
+#include "core/typedefs.h"
//============================================================================
diff --git a/thirdparty/zstd/1314.diff b/thirdparty/zstd/1314.diff
new file mode 100644
index 0000000000..c9f4efadbf
--- /dev/null
+++ b/thirdparty/zstd/1314.diff
@@ -0,0 +1,13 @@
+diff --git a/common/cpu.h b/common/cpu.h
+index 88e0ebf44..eeb428ad5 100644
+--- a/common/cpu.h
++++ b/common/cpu.h
+@@ -36,7 +36,7 @@ MEM_STATIC ZSTD_cpuid_t ZSTD_cpuid(void) {
+ U32 f1d = 0;
+ U32 f7b = 0;
+ U32 f7c = 0;
+-#ifdef _MSC_VER
++#if defined(_MSC_VER) && (defined(_M_X64) || defined(_M_IX86))
+ int reg[4];
+ __cpuid((int*)reg, 0);
+ {
diff --git a/thirdparty/zstd/common/cpu.h b/thirdparty/zstd/common/cpu.h
index 4eb48e39e1..a109520a33 100644
--- a/thirdparty/zstd/common/cpu.h
+++ b/thirdparty/zstd/common/cpu.h
@@ -36,7 +36,7 @@ MEM_STATIC ZSTD_cpuid_t ZSTD_cpuid(void) {
U32 f1d = 0;
U32 f7b = 0;
U32 f7c = 0;
-#ifdef _MSC_VER
+#if defined(_MSC_VER) && (defined(_M_X64) || defined(_M_IX86))
int reg[4];
__cpuid((int*)reg, 0);
{