summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--.github/workflows/android_builds.yml2
-rw-r--r--.github/workflows/ios_builds.yml2
-rw-r--r--.github/workflows/javascript_builds.disabled2
-rw-r--r--.github/workflows/linux_builds.yml2
-rw-r--r--.github/workflows/macos_builds.yml2
-rw-r--r--core/SCsub9
-rw-r--r--core/bind/SCsub5
-rw-r--r--core/color_names.inc155
-rw-r--r--core/config/SCsub7
-rw-r--r--core/config/engine.cpp (renamed from core/engine.cpp)0
-rw-r--r--core/config/engine.h (renamed from core/engine.h)6
-rw-r--r--core/config/project_settings.cpp (renamed from core/project_settings.cpp)4
-rw-r--r--core/config/project_settings.h (renamed from core/project_settings.h)4
-rw-r--r--core/core_bind.cpp (renamed from core/bind/core_bind.cpp)2
-rw-r--r--core/core_bind.h (renamed from core/bind/core_bind.h)2
-rw-r--r--core/core_constants.cpp690
-rw-r--r--core/core_constants.h (renamed from core/global_constants.h)10
-rw-r--r--core/core_string_names.h2
-rw-r--r--core/crypto/aes_context.h2
-rw-r--r--core/crypto/crypto.cpp2
-rw-r--r--core/crypto/crypto.h4
-rw-r--r--core/crypto/crypto_core.h2
-rw-r--r--core/crypto/hashing_context.h2
-rw-r--r--core/debugger/debugger_marshalls.h2
-rw-r--r--core/debugger/engine_debugger.h12
-rw-r--r--core/debugger/local_debugger.h4
-rw-r--r--core/debugger/remote_debugger.cpp4
-rw-r--r--core/debugger/remote_debugger.h8
-rw-r--r--core/debugger/remote_debugger_peer.cpp2
-rw-r--r--core/debugger/remote_debugger_peer.h4
-rw-r--r--core/debugger/script_debugger.h10
-rw-r--r--core/error/SCsub7
-rw-r--r--core/error/error_list.h (renamed from core/error_list.h)0
-rw-r--r--core/error/error_macros.cpp (renamed from core/error_macros.cpp)4
-rw-r--r--core/error/error_macros.h (renamed from core/error_macros.h)0
-rw-r--r--core/func_ref.cpp101
-rw-r--r--core/func_ref.h55
-rw-r--r--core/global_constants.cpp691
-rw-r--r--core/input/input.cpp2
-rw-r--r--core/input/input.h2
-rw-r--r--core/input/input_event.h4
-rw-r--r--core/input/input_map.cpp2
-rw-r--r--core/input/input_map.h2
-rw-r--r--core/int_types.h62
-rw-r--r--core/io/compression.cpp2
-rw-r--r--core/io/compression.h2
-rw-r--r--core/io/config_file.cpp2
-rw-r--r--core/io/config_file.h6
-rw-r--r--core/io/dtls_server.cpp2
-rw-r--r--core/io/file_access_buffered.cpp2
-rw-r--r--core/io/file_access_buffered.h2
-rw-r--r--core/io/file_access_compressed.cpp2
-rw-r--r--core/io/file_access_encrypted.cpp4
-rw-r--r--core/io/file_access_memory.cpp4
-rw-r--r--core/io/file_access_network.cpp2
-rw-r--r--core/io/file_access_pack.cpp2
-rw-r--r--core/io/file_access_pack.h6
-rw-r--r--core/io/file_access_zip.h2
-rw-r--r--core/io/http_client.h5
-rw-r--r--core/io/image.cpp (renamed from core/image.cpp)21
-rw-r--r--core/io/image.h (renamed from core/image.h)6
-rw-r--r--core/io/image_loader.cpp2
-rw-r--r--core/io/image_loader.h6
-rw-r--r--core/io/ip.cpp2
-rw-r--r--core/io/ip_address.h2
-rw-r--r--core/io/json.cpp2
-rw-r--r--core/io/json.h2
-rw-r--r--core/io/logger.cpp2
-rw-r--r--core/io/logger.h4
-rw-r--r--core/io/marshalls.cpp8
-rw-r--r--core/io/marshalls.h4
-rw-r--r--core/io/multiplayer_api.h2
-rw-r--r--core/io/net_socket.h2
-rw-r--r--core/io/packed_data_container.cpp (renamed from core/packed_data_container.cpp)5
-rw-r--r--core/io/packed_data_container.h (renamed from core/packed_data_container.h)2
-rw-r--r--core/io/packet_peer.cpp2
-rw-r--r--core/io/packet_peer.h4
-rw-r--r--core/io/packet_peer_dtls.cpp2
-rw-r--r--core/io/pck_packer.h2
-rw-r--r--core/io/resource.cpp (renamed from core/resource.cpp)2
-rw-r--r--core/io/resource.h (renamed from core/resource.h)8
-rw-r--r--core/io/resource_format_binary.cpp6
-rw-r--r--core/io/resource_importer.cpp4
-rw-r--r--core/io/resource_loader.cpp8
-rw-r--r--core/io/resource_loader.h2
-rw-r--r--core/io/resource_saver.cpp4
-rw-r--r--core/io/resource_saver.h2
-rw-r--r--core/io/stream_peer.h2
-rw-r--r--core/io/stream_peer_ssl.cpp2
-rw-r--r--core/io/stream_peer_tcp.cpp2
-rw-r--r--core/io/translation_loader_po.cpp4
-rw-r--r--core/io/translation_loader_po.h2
-rw-r--r--core/io/xml_parser.cpp2
-rw-r--r--core/io/xml_parser.h6
-rw-r--r--core/math/a_star.cpp2
-rw-r--r--core/math/a_star.h4
-rw-r--r--core/math/aabb.cpp4
-rw-r--r--core/math/aabb.h8
-rw-r--r--core/math/basis.cpp2
-rw-r--r--core/math/camera_matrix.cpp2
-rw-r--r--core/math/color.cpp (renamed from core/color.cpp)100
-rw-r--r--core/math/color.h (renamed from core/color.h)76
-rw-r--r--core/math/color_names.inc160
-rw-r--r--core/math/delaunay_3d.h10
-rw-r--r--core/math/disjoint_set.h4
-rw-r--r--core/math/expression.cpp56
-rw-r--r--core/math/expression.h8
-rw-r--r--core/math/geometry_2d.h4
-rw-r--r--core/math/geometry_3d.cpp2
-rw-r--r--core/math/geometry_3d.h4
-rw-r--r--core/math/math_fieldwise.h2
-rw-r--r--core/math/math_funcs.cpp8
-rw-r--r--core/math/math_funcs.h2
-rw-r--r--core/math/octree.h8
-rw-r--r--core/math/plane.cpp2
-rw-r--r--core/math/quat.cpp2
-rw-r--r--core/math/quat.h24
-rw-r--r--core/math/quick_hull.cpp2
-rw-r--r--core/math/quick_hull.h4
-rw-r--r--core/math/random_number_generator.h23
-rw-r--r--core/math/random_pcg.cpp15
-rw-r--r--core/math/random_pcg.h2
-rw-r--r--core/math/rect2.h17
-rw-r--r--core/math/transform.cpp9
-rw-r--r--core/math/transform.h5
-rw-r--r--core/math/transform_2d.h6
-rw-r--r--core/math/triangle_mesh.cpp2
-rw-r--r--core/math/triangle_mesh.h2
-rw-r--r--core/math/vector2.cpp13
-rw-r--r--core/math/vector2.h8
-rw-r--r--core/math/vector3.h2
-rw-r--r--core/math/vector3i.h28
-rw-r--r--core/object/SCsub7
-rw-r--r--core/object/callable_method_pointer.cpp (renamed from core/callable_method_pointer.cpp)0
-rw-r--r--core/object/callable_method_pointer.h (renamed from core/callable_method_pointer.h)10
-rw-r--r--core/object/class_db.cpp (renamed from core/class_db.cpp)2
-rw-r--r--core/object/class_db.h (renamed from core/class_db.h)8
-rw-r--r--core/object/message_queue.cpp (renamed from core/message_queue.cpp)4
-rw-r--r--core/object/message_queue.h (renamed from core/message_queue.h)2
-rw-r--r--core/object/method_bind.cpp (renamed from core/method_bind.cpp)2
-rw-r--r--core/object/method_bind.h (renamed from core/method_bind.h)2
-rw-r--r--core/object/object.cpp (renamed from core/object.cpp)63
-rw-r--r--core/object/object.h (renamed from core/object.h)18
-rw-r--r--core/object/object_id.h (renamed from core/object_id.h)0
-rw-r--r--core/object/reference.cpp (renamed from core/reference.cpp)2
-rw-r--r--core/object/reference.h (renamed from core/reference.h)4
-rw-r--r--core/object/script_language.cpp (renamed from core/script_language.cpp)2
-rw-r--r--core/object/script_language.h (renamed from core/script_language.h)6
-rw-r--r--core/object/undo_redo.cpp (renamed from core/undo_redo.cpp)0
-rw-r--r--core/object/undo_redo.h (renamed from core/undo_redo.h)4
-rw-r--r--core/os/dir_access.cpp2
-rw-r--r--core/os/dir_access.h2
-rw-r--r--core/os/file_access.cpp2
-rw-r--r--core/os/file_access.h2
-rw-r--r--core/os/keyboard.h2
-rw-r--r--core/os/main_loop.cpp2
-rw-r--r--core/os/main_loop.h4
-rw-r--r--core/os/memory.cpp4
-rw-r--r--core/os/memory.h4
-rw-r--r--core/os/midi_driver.h2
-rw-r--r--core/os/mutex.h2
-rw-r--r--core/os/os.cpp2
-rw-r--r--core/os/os.h10
-rw-r--r--core/os/pool_allocator.cpp (renamed from core/pool_allocator.cpp)4
-rw-r--r--core/os/pool_allocator.h (renamed from core/pool_allocator.h)0
-rw-r--r--core/os/rw_lock.cpp2
-rw-r--r--core/os/rw_lock.h2
-rw-r--r--core/os/semaphore.h2
-rw-r--r--core/os/spin_lock.h (renamed from core/spin_lock.h)0
-rw-r--r--core/os/thread.h2
-rw-r--r--core/os/threaded_array_processor.h2
-rw-r--r--core/register_core_types.cpp26
-rw-r--r--core/string/SCsub7
-rw-r--r--core/string/compressed_translation.cpp (renamed from core/compressed_translation.cpp)2
-rw-r--r--core/string/compressed_translation.h (renamed from core/compressed_translation.h)2
-rw-r--r--core/string/node_path.cpp (renamed from core/node_path.cpp)2
-rw-r--r--core/string/node_path.h (renamed from core/node_path.h)4
-rw-r--r--core/string/print_string.cpp (renamed from core/print_string.cpp)0
-rw-r--r--core/string/print_string.h (renamed from core/print_string.h)2
-rw-r--r--core/string/string_buffer.h (renamed from core/string_buffer.h)2
-rw-r--r--core/string/string_builder.cpp (renamed from core/string_builder.cpp)0
-rw-r--r--core/string/string_builder.h (renamed from core/string_builder.h)4
-rw-r--r--core/string/string_name.cpp (renamed from core/string_name.cpp)16
-rw-r--r--core/string/string_name.h (renamed from core/string_name.h)9
-rw-r--r--core/string/translation.cpp (renamed from core/translation.cpp)2
-rw-r--r--core/string/translation.h (renamed from core/translation.h)2
-rw-r--r--core/string/translation_po.cpp (renamed from core/translation_po.cpp)0
-rw-r--r--core/string/translation_po.h (renamed from core/translation_po.h)2
-rw-r--r--core/string/ucaps.h (renamed from core/ucaps.h)0
-rw-r--r--core/string/ustring.cpp (renamed from core/ustring.cpp)41
-rw-r--r--core/string/ustring.h (renamed from core/ustring.h)12
-rw-r--r--core/templates/SCsub7
-rw-r--r--core/templates/command_queue_mt.cpp (renamed from core/command_queue_mt.cpp)2
-rw-r--r--core/templates/command_queue_mt.h (renamed from core/command_queue_mt.h)2
-rw-r--r--core/templates/cowdata.h (renamed from core/cowdata.h)4
-rw-r--r--core/templates/hash_map.h (renamed from core/hash_map.h)8
-rw-r--r--core/templates/hashfuncs.h (renamed from core/hashfuncs.h)10
-rw-r--r--core/templates/list.h (renamed from core/list.h)4
-rw-r--r--core/templates/local_vector.h (renamed from core/local_vector.h)6
-rw-r--r--core/templates/map.h (renamed from core/map.h)4
-rw-r--r--core/templates/oa_hash_map.h (renamed from core/oa_hash_map.h)2
-rw-r--r--core/templates/ordered_hash_map.h (renamed from core/ordered_hash_map.h)6
-rw-r--r--core/templates/pair.h (renamed from core/pair.h)0
-rw-r--r--core/templates/rid.h (renamed from core/rid.h)3
-rw-r--r--core/templates/rid_owner.cpp (renamed from core/rid_owner.cpp)0
-rw-r--r--core/templates/rid_owner.h (renamed from core/rid_owner.h)14
-rw-r--r--core/templates/ring_buffer.h (renamed from core/ring_buffer.h)2
-rw-r--r--core/templates/safe_refcount.cpp (renamed from core/safe_refcount.cpp)0
-rw-r--r--core/templates/safe_refcount.h (renamed from core/safe_refcount.h)0
-rw-r--r--core/templates/self_list.h (renamed from core/self_list.h)2
-rw-r--r--core/templates/set.h (renamed from core/set.h)0
-rw-r--r--core/templates/simple_type.h (renamed from core/simple_type.h)0
-rw-r--r--core/templates/sort_array.h (renamed from core/sort_array.h)2
-rw-r--r--core/templates/thread_work_pool.cpp (renamed from core/thread_work_pool.cpp)0
-rw-r--r--core/templates/thread_work_pool.h (renamed from core/thread_work_pool.h)0
-rw-r--r--core/templates/vector.h (renamed from core/vector.h)32
-rw-r--r--core/templates/vmap.h (renamed from core/vmap.h)2
-rw-r--r--core/templates/vset.h (renamed from core/vset.h)2
-rw-r--r--core/typedefs.h4
-rw-r--r--core/variant/SCsub7
-rw-r--r--core/variant/array.cpp (renamed from core/array.cpp)43
-rw-r--r--core/variant/array.h (renamed from core/array.h)6
-rw-r--r--core/variant/binder_common.h (renamed from core/binder_common.h)14
-rw-r--r--core/variant/callable.cpp (renamed from core/callable.cpp)8
-rw-r--r--core/variant/callable.h (renamed from core/callable.h)6
-rw-r--r--core/variant/callable_bind.cpp (renamed from core/callable_bind.cpp)0
-rw-r--r--core/variant/callable_bind.h (renamed from core/callable_bind.h)4
-rw-r--r--core/variant/container_type_validate.h (renamed from core/container_type_validate.h)4
-rw-r--r--core/variant/dictionary.cpp (renamed from core/dictionary.cpp)6
-rw-r--r--core/variant/dictionary.h (renamed from core/dictionary.h)6
-rw-r--r--core/variant/method_ptrcall.h (renamed from core/method_ptrcall.h)4
-rw-r--r--core/variant/type_info.h (renamed from core/type_info.h)2
-rw-r--r--core/variant/typed_array.h (renamed from core/typed_array.h)10
-rw-r--r--core/variant/variant.cpp (renamed from core/variant.cpp)83
-rw-r--r--core/variant/variant.h (renamed from core/variant.h)180
-rw-r--r--core/variant/variant_call.cpp (renamed from core/variant_call.cpp)514
-rw-r--r--core/variant/variant_construct.cpp832
-rw-r--r--core/variant/variant_internal.h (renamed from core/variant_internal.h)495
-rw-r--r--core/variant/variant_op.cpp2190
-rw-r--r--core/variant/variant_parser.cpp (renamed from core/variant_parser.cpp)2
-rw-r--r--core/variant/variant_parser.h (renamed from core/variant_parser.h)4
-rw-r--r--core/variant/variant_setget.cpp2587
-rw-r--r--core/variant_op.cpp4608
-rw-r--r--doc/classes/@GlobalScope.xml27
-rw-r--r--doc/classes/AABB.xml16
-rw-r--r--doc/classes/Array.xml44
-rw-r--r--doc/classes/Basis.xml28
-rw-r--r--doc/classes/Callable.xml20
-rw-r--r--doc/classes/Color.xml88
-rw-r--r--doc/classes/DTLSServer.xml97
-rw-r--r--doc/classes/Decal.xml24
-rw-r--r--doc/classes/Dictionary.xml179
-rw-r--r--doc/classes/Directory.xml33
-rw-r--r--doc/classes/DisplayServer.xml18
-rw-r--r--doc/classes/DynamicFont.xml12
-rw-r--r--doc/classes/EditorImportPlugin.xml93
-rw-r--r--doc/classes/EditorPlugin.xml89
-rw-r--r--doc/classes/EditorScenePostImport.xml42
-rw-r--r--doc/classes/EditorScript.xml19
-rw-r--r--doc/classes/EditorSettings.xml48
-rw-r--r--doc/classes/EditorTranslationParserPlugin.xml72
-rw-r--r--doc/classes/Engine.xml16
-rw-r--r--doc/classes/Expression.xml35
-rw-r--r--doc/classes/FuncRef.xml53
-rw-r--r--doc/classes/HTTPClient.xml3
-rw-r--r--doc/classes/HTTPRequest.xml10
-rw-r--r--doc/classes/Image.xml10
-rw-r--r--doc/classes/NodePath.xml16
-rw-r--r--doc/classes/PackedByteArray.xml16
-rw-r--r--doc/classes/PackedColorArray.xml16
-rw-r--r--doc/classes/PackedFloat32Array.xml16
-rw-r--r--doc/classes/PackedFloat64Array.xml16
-rw-r--r--doc/classes/PackedInt32Array.xml16
-rw-r--r--doc/classes/PackedInt64Array.xml16
-rw-r--r--doc/classes/PackedStringArray.xml16
-rw-r--r--doc/classes/PackedVector2Array.xml16
-rw-r--r--doc/classes/PackedVector3Array.xml16
-rw-r--r--doc/classes/Plane.xml41
-rw-r--r--doc/classes/ProjectSettings.xml11
-rw-r--r--doc/classes/Quat.xml38
-rw-r--r--doc/classes/RID.xml11
-rw-r--r--doc/classes/Rect2.xml34
-rw-r--r--doc/classes/Rect2i.xml34
-rw-r--r--doc/classes/Signal.xml20
-rw-r--r--doc/classes/String.xml264
-rw-r--r--doc/classes/StringName.xml16
-rw-r--r--doc/classes/Transform.xml39
-rw-r--r--doc/classes/Transform2D.xml25
-rw-r--r--doc/classes/Vector2.xml16
-rw-r--r--doc/classes/Vector2i.xml24
-rw-r--r--doc/classes/Vector3.xml16
-rw-r--r--doc/classes/Vector3i.xml28
-rw-r--r--doc/classes/Window.xml2
-rw-r--r--doc/classes/bool.xml16
-rw-r--r--doc/classes/float.xml19
-rw-r--r--doc/classes/int.xml19
-rw-r--r--drivers/alsa/audio_driver_alsa.cpp2
-rw-r--r--drivers/alsamidi/midi_driver_alsamidi.cpp2
-rw-r--r--drivers/alsamidi/midi_driver_alsamidi.h2
-rw-r--r--drivers/coreaudio/audio_driver_coreaudio.cpp2
-rw-r--r--drivers/coremidi/midi_driver_coremidi.cpp2
-rw-r--r--drivers/coremidi/midi_driver_coremidi.h2
-rw-r--r--drivers/dummy/rasterizer_dummy.h4
-rw-r--r--drivers/dummy/texture_loader_dummy.cpp2
-rw-r--r--drivers/png/image_loader_png.cpp2
-rw-r--r--drivers/png/png_driver_common.h2
-rw-r--r--drivers/png/resource_saver_png.cpp2
-rw-r--r--drivers/png/resource_saver_png.h2
-rw-r--r--drivers/pulseaudio/audio_driver_pulseaudio.cpp2
-rw-r--r--drivers/unix/dir_access_unix.cpp4
-rw-r--r--drivers/unix/file_access_unix.cpp2
-rw-r--r--drivers/unix/os_unix.cpp2
-rw-r--r--drivers/unix/rw_lock_posix.cpp2
-rw-r--r--drivers/unix/syslog_logger.cpp2
-rw-r--r--drivers/unix/thread_posix.cpp4
-rw-r--r--drivers/vulkan/rendering_device_vulkan.cpp4
-rw-r--r--drivers/vulkan/rendering_device_vulkan.h4
-rw-r--r--drivers/vulkan/vulkan_context.cpp6
-rw-r--r--drivers/vulkan/vulkan_context.h8
-rw-r--r--drivers/wasapi/audio_driver_wasapi.cpp2
-rw-r--r--drivers/windows/dir_access_windows.cpp2
-rw-r--r--drivers/windows/file_access_windows.cpp2
-rw-r--r--drivers/windows/rw_lock_windows.cpp2
-rw-r--r--drivers/windows/thread_windows.h2
-rw-r--r--drivers/winmidi/midi_driver_winmidi.cpp2
-rw-r--r--drivers/winmidi/midi_driver_winmidi.h2
-rw-r--r--drivers/xaudio2/audio_driver_xaudio2.cpp2
-rw-r--r--editor/animation_track_editor.cpp14
-rw-r--r--editor/array_property_edit.cpp7
-rw-r--r--editor/code_editor.cpp2
-rw-r--r--editor/connections_dialog.cpp2
-rw-r--r--editor/connections_dialog.h2
-rw-r--r--editor/create_dialog.cpp2
-rw-r--r--editor/debugger/editor_debugger_server.h2
-rw-r--r--editor/debugger/editor_performance_profiler.h4
-rw-r--r--editor/debugger/script_editor_debugger.cpp6
-rw-r--r--editor/dependency_editor.cpp16
-rw-r--r--editor/doc_data.cpp71
-rw-r--r--editor/doc_data.h21
-rw-r--r--editor/editor_atlas_packer.h2
-rw-r--r--editor/editor_autoload_settings.cpp8
-rw-r--r--editor/editor_data.cpp2
-rw-r--r--editor/editor_data.h6
-rw-r--r--editor/editor_export.cpp4
-rw-r--r--editor/editor_export.h2
-rw-r--r--editor/editor_feature_profile.h2
-rw-r--r--editor/editor_file_dialog.cpp2
-rw-r--r--editor/editor_file_system.cpp4
-rw-r--r--editor/editor_file_system.h2
-rw-r--r--editor/editor_help_search.h2
-rw-r--r--editor/editor_inspector.cpp2
-rw-r--r--editor/editor_layouts_dialog.cpp2
-rw-r--r--editor/editor_node.cpp12
-rw-r--r--editor/editor_plugin.h2
-rw-r--r--editor/editor_plugin_settings.cpp2
-rw-r--r--editor/editor_plugin_settings.h2
-rw-r--r--editor/editor_properties.cpp2
-rw-r--r--editor/editor_properties_array_dict.cpp22
-rw-r--r--editor/editor_resource_preview.cpp4
-rw-r--r--editor/editor_run.cpp2
-rw-r--r--editor/editor_run_script.h2
-rw-r--r--editor/editor_settings.cpp2
-rw-r--r--editor/editor_settings.h6
-rw-r--r--editor/editor_translation_parser.cpp6
-rw-r--r--editor/editor_translation_parser.h4
-rw-r--r--editor/editor_vcs_interface.h4
-rw-r--r--editor/fileserver/editor_file_server.h2
-rw-r--r--editor/filesystem_dock.cpp4
-rw-r--r--editor/find_in_files.h2
-rw-r--r--editor/groups_editor.h2
-rw-r--r--editor/icons/DirectionalLight2D.svg1
-rw-r--r--editor/icons/PointLight2D.svg (renamed from editor/icons/Light2D.svg)0
-rw-r--r--editor/import/collada.h4
-rw-r--r--editor/import/editor_import_plugin.cpp2
-rw-r--r--editor/import/resource_importer_bitmask.cpp2
-rw-r--r--editor/import/resource_importer_bitmask.h2
-rw-r--r--editor/import/resource_importer_csv_translation.cpp4
-rw-r--r--editor/import/resource_importer_image.h2
-rw-r--r--editor/import/resource_importer_layered_texture.h2
-rw-r--r--editor/import/resource_importer_texture.h2
-rw-r--r--editor/import/resource_importer_texture_atlas.h2
-rw-r--r--editor/input_map_editor.h2
-rw-r--r--editor/localization_editor.cpp2
-rw-r--r--editor/localization_editor.h2
-rw-r--r--editor/plugins/animation_blend_space_2d_editor.cpp2
-rw-r--r--editor/plugins/animation_blend_tree_editor_plugin.cpp2
-rw-r--r--editor/plugins/animation_player_editor_plugin.cpp2
-rw-r--r--editor/plugins/animation_state_machine_editor.cpp2
-rw-r--r--editor/plugins/animation_tree_editor_plugin.cpp2
-rw-r--r--editor/plugins/audio_stream_editor_plugin.cpp2
-rw-r--r--editor/plugins/canvas_item_editor_plugin.cpp4
-rw-r--r--editor/plugins/node_3d_editor_plugin.cpp73
-rw-r--r--editor/plugins/node_3d_editor_plugin.h4
-rw-r--r--editor/plugins/resource_preloader_editor_plugin.cpp2
-rw-r--r--editor/plugins/script_editor_plugin.cpp4
-rw-r--r--editor/plugins/script_editor_plugin.h2
-rw-r--r--editor/plugins/sprite_frames_editor_plugin.cpp2
-rw-r--r--editor/plugins/texture_3d_editor_plugin.cpp2
-rw-r--r--editor/plugins/texture_editor_plugin.cpp2
-rw-r--r--editor/plugins/texture_layered_editor_plugin.cpp2
-rw-r--r--editor/plugins/texture_region_editor_plugin.cpp3
-rw-r--r--editor/plugins/version_control_editor_plugin.cpp2
-rw-r--r--editor/plugins/visual_shader_editor_plugin.cpp2
-rw-r--r--editor/pot_generator.cpp4
-rw-r--r--editor/pot_generator.h4
-rw-r--r--editor/progress_dialog.cpp2
-rw-r--r--editor/project_export.cpp4
-rw-r--r--editor/project_manager.cpp2
-rw-r--r--editor/project_settings_editor.cpp5
-rw-r--r--editor/project_settings_editor.h2
-rw-r--r--editor/property_editor.cpp10
-rw-r--r--editor/property_selector.cpp4
-rw-r--r--editor/pvrtc_compress.h2
-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.cpp2
-rw-r--r--editor/scene_tree_editor.cpp4
-rw-r--r--editor/scene_tree_editor.h2
-rw-r--r--editor/script_create_dialog.cpp6
-rw-r--r--editor/settings_config_dialog.cpp2
-rw-r--r--editor/shader_globals_editor.h2
-rw-r--r--main/main.cpp8
-rw-r--r--main/main.h2
-rw-r--r--main/main_timer_sync.h2
-rw-r--r--main/performance.cpp2
-rw-r--r--main/performance.h4
-rw-r--r--modules/assimp/editor_scene_importer_assimp.h4
-rw-r--r--modules/assimp/import_state.h4
-rw-r--r--modules/bmp/image_loader_bmp.cpp20
-rw-r--r--modules/bullet/area_bullet.h2
-rw-r--r--modules/bullet/bullet_physics_server.cpp6
-rw-r--r--modules/bullet/bullet_physics_server.h4
-rw-r--r--modules/bullet/collision_object_bullet.h4
-rw-r--r--modules/bullet/godot_collision_dispatcher.h2
-rw-r--r--modules/bullet/register_types.cpp4
-rw-r--r--modules/bullet/rid_bullet.h2
-rw-r--r--modules/bullet/shape_bullet.cpp2
-rw-r--r--modules/bullet/shape_bullet.h2
-rw-r--r--modules/bullet/space_bullet.cpp4
-rw-r--r--modules/bullet/space_bullet.h4
-rw-r--r--modules/csg/csg.cpp2
-rw-r--r--modules/csg/csg.h10
-rw-r--r--modules/cvtt/image_compress_cvtt.cpp2
-rw-r--r--modules/cvtt/image_compress_cvtt.h2
-rw-r--r--modules/denoise/lightmap_denoiser.h2
-rw-r--r--modules/denoise/register_types.cpp2
-rw-r--r--modules/enet/register_types.cpp2
-rw-r--r--modules/etc/image_etc.cpp4
-rw-r--r--modules/gdnative/gdnative.cpp4
-rw-r--r--modules/gdnative/gdnative.h2
-rw-r--r--modules/gdnative/gdnative/aabb.cpp2
-rw-r--r--modules/gdnative/gdnative/array.cpp6
-rw-r--r--modules/gdnative/gdnative/basis.cpp2
-rw-r--r--modules/gdnative/gdnative/callable.cpp6
-rw-r--r--modules/gdnative/gdnative/color.cpp11
-rw-r--r--modules/gdnative/gdnative/dictionary.cpp6
-rw-r--r--modules/gdnative/gdnative/gdnative.cpp16
-rw-r--r--modules/gdnative/gdnative/node_path.cpp4
-rw-r--r--modules/gdnative/gdnative/packed_arrays.cpp6
-rw-r--r--modules/gdnative/gdnative/plane.cpp2
-rw-r--r--modules/gdnative/gdnative/quat.cpp2
-rw-r--r--modules/gdnative/gdnative/rect2.cpp2
-rw-r--r--modules/gdnative/gdnative/rid.cpp6
-rw-r--r--modules/gdnative/gdnative/string.cpp6
-rw-r--r--modules/gdnative/gdnative/string_name.cpp4
-rw-r--r--modules/gdnative/gdnative/transform.cpp2
-rw-r--r--modules/gdnative/gdnative/transform2d.cpp2
-rw-r--r--modules/gdnative/gdnative/variant.cpp4
-rw-r--r--modules/gdnative/gdnative/vector2.cpp2
-rw-r--r--modules/gdnative/gdnative/vector3.cpp4
-rw-r--r--modules/gdnative/gdnative_api.json7
-rw-r--r--modules/gdnative/include/gdnative/color.h2
-rw-r--r--modules/gdnative/nativescript/api_generator.cpp20
-rw-r--r--modules/gdnative/nativescript/api_generator.h2
-rw-r--r--modules/gdnative/nativescript/godot_nativescript.cpp10
-rw-r--r--modules/gdnative/nativescript/nativescript.cpp4
-rw-r--r--modules/gdnative/nativescript/nativescript.h10
-rw-r--r--modules/gdnative/pluginscript/pluginscript_instance.cpp2
-rw-r--r--modules/gdnative/pluginscript/pluginscript_instance.h2
-rw-r--r--modules/gdnative/pluginscript/pluginscript_language.cpp2
-rw-r--r--modules/gdnative/pluginscript/pluginscript_language.h6
-rw-r--r--modules/gdnative/pluginscript/pluginscript_loader.h2
-rw-r--r--modules/gdnative/pluginscript/pluginscript_script.h2
-rw-r--r--modules/gdnative/pluginscript/register_types.cpp2
-rw-r--r--modules/gdnative/register_types.cpp4
-rw-r--r--modules/gdnative/videodecoder/register_types.cpp2
-rw-r--r--modules/gdnative/videodecoder/video_stream_gdnative.cpp2
-rw-r--r--modules/gdnavigation/gd_navigation_server.h4
-rw-r--r--modules/gdnavigation/nav_rid.h2
-rw-r--r--modules/gdnavigation/register_types.cpp2
-rw-r--r--modules/gdnavigation/rvo_agent.h2
-rw-r--r--modules/gdscript/doc_classes/@GDScript.xml61
-rw-r--r--modules/gdscript/editor/gdscript_translation_parser_plugin.h2
-rw-r--r--modules/gdscript/gdscript.cpp13
-rw-r--r--modules/gdscript/gdscript.h2
-rw-r--r--modules/gdscript/gdscript_analyzer.cpp27
-rw-r--r--modules/gdscript/gdscript_analyzer.h6
-rw-r--r--modules/gdscript/gdscript_cache.cpp2
-rw-r--r--modules/gdscript/gdscript_cache.h6
-rw-r--r--modules/gdscript/gdscript_codegen.h4
-rw-r--r--modules/gdscript/gdscript_compiler.h2
-rw-r--r--modules/gdscript/gdscript_editor.cpp41
-rw-r--r--modules/gdscript/gdscript_function.cpp17
-rw-r--r--modules/gdscript/gdscript_function.h12
-rw-r--r--modules/gdscript/gdscript_functions.cpp66
-rw-r--r--modules/gdscript/gdscript_functions.h8
-rw-r--r--modules/gdscript/gdscript_parser.cpp14
-rw-r--r--modules/gdscript/gdscript_parser.h22
-rw-r--r--modules/gdscript/gdscript_tokenizer.cpp2
-rw-r--r--modules/gdscript/gdscript_tokenizer.h8
-rw-r--r--modules/gdscript/gdscript_warning.cpp2
-rw-r--r--modules/gdscript/gdscript_warning.h4
-rw-r--r--modules/gdscript/language_server/gdscript_extend_parser.h2
-rw-r--r--modules/gdscript/language_server/gdscript_language_protocol.cpp2
-rw-r--r--modules/gdscript/language_server/gdscript_text_document.h2
-rw-r--r--modules/gdscript/language_server/gdscript_workspace.cpp4
-rw-r--r--modules/gdscript/language_server/gdscript_workspace.h2
-rw-r--r--modules/gdscript/language_server/lsp.hpp4
-rw-r--r--modules/gdscript/register_types.cpp2
-rw-r--r--modules/gdscript/tests/test_gdscript.cpp4
-rw-r--r--modules/gridmap/grid_map.cpp2
-rw-r--r--modules/gridmap/register_types.cpp2
-rw-r--r--modules/hdr/image_loader_hdr.cpp2
-rw-r--r--modules/jpg/image_loader_jpegd.cpp2
-rw-r--r--modules/jsonrpc/jsonrpc.h4
-rw-r--r--modules/jsonrpc/register_types.cpp2
-rw-r--r--modules/lightmapper_rd/lightmapper_rd.cpp2
-rw-r--r--modules/lightmapper_rd/lightmapper_rd.h2
-rw-r--r--modules/lightmapper_rd/register_types.cpp2
-rw-r--r--modules/mbedtls/crypto_mbedtls.cpp4
-rw-r--r--modules/mbedtls/crypto_mbedtls.h2
-rw-r--r--modules/mbedtls/ssl_context_mbedtls.h2
-rw-r--r--modules/mono/class_db_api_json.cpp2
-rw-r--r--modules/mono/class_db_api_json.h8
-rw-r--r--modules/mono/csharp_script.cpp4
-rw-r--r--modules/mono/csharp_script.h4
-rw-r--r--modules/mono/editor/bindings_generator.cpp18
-rw-r--r--modules/mono/editor/bindings_generator.h6
-rw-r--r--modules/mono/editor/code_completion.cpp2
-rw-r--r--modules/mono/editor/code_completion.h4
-rw-r--r--modules/mono/editor/godotsharp_export.cpp2
-rw-r--r--modules/mono/editor/godotsharp_export.h6
-rw-r--r--modules/mono/editor/script_class_parser.cpp2
-rw-r--r--modules/mono/editor/script_class_parser.h6
-rw-r--r--modules/mono/glue/GodotSharp/GodotSharp/Core/Array.cs13
-rw-r--r--modules/mono/glue/GodotSharp/GodotSharp/Core/Color.cs14
-rw-r--r--modules/mono/glue/GodotSharp/GodotSharp/Core/GD.cs11
-rw-r--r--modules/mono/glue/base_object_glue.cpp6
-rw-r--r--modules/mono/glue/collections_glue.cpp7
-rw-r--r--modules/mono/glue/gd_glue.cpp17
-rw-r--r--modules/mono/glue/glue_header.h16
-rw-r--r--modules/mono/glue/nodepath_glue.cpp4
-rw-r--r--modules/mono/glue/rid_glue.cpp6
-rw-r--r--modules/mono/glue/scene_tree_glue.cpp6
-rw-r--r--modules/mono/glue/string_glue.cpp6
-rw-r--r--modules/mono/glue/string_name_glue.cpp4
-rw-r--r--modules/mono/godotsharp_dirs.cpp2
-rw-r--r--modules/mono/godotsharp_dirs.h2
-rw-r--r--modules/mono/managed_callable.h4
-rw-r--r--modules/mono/mono_gc_handle.h2
-rw-r--r--modules/mono/mono_gd/android_mono_config.h2
-rw-r--r--modules/mono/mono_gd/gd_mono.cpp2
-rw-r--r--modules/mono/mono_gd/gd_mono_assembly.cpp4
-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_field.cpp6
-rw-r--r--modules/mono/mono_gd/gd_mono_header.h2
-rw-r--r--modules/mono/mono_gd/gd_mono_internals.h2
-rw-r--r--modules/mono/mono_gd/gd_mono_marshal.cpp8
-rw-r--r--modules/mono/mono_gd/gd_mono_marshal.h2
-rw-r--r--modules/mono/mono_gd/gd_mono_utils.cpp2
-rw-r--r--modules/mono/mono_gd/gd_mono_utils.h4
-rw-r--r--modules/mono/mono_gd/support/android_support.cpp2
-rwxr-xr-xmodules/mono/mono_gd/support/android_support.h2
-rwxr-xr-xmodules/mono/mono_gd/support/ios_support.h2
-rw-r--r--modules/mono/register_types.cpp2
-rw-r--r--modules/mono/signal_awaiter_utils.h2
-rw-r--r--modules/mono/utils/mono_reg_utils.h2
-rw-r--r--modules/mono/utils/osx_utils.cpp2
-rw-r--r--modules/mono/utils/osx_utils.h2
-rw-r--r--modules/mono/utils/path_utils.cpp2
-rw-r--r--modules/mono/utils/path_utils.h4
-rw-r--r--modules/mono/utils/string_utils.h4
-rw-r--r--modules/opensimplex/noise_texture.h4
-rw-r--r--modules/opensimplex/open_simplex_noise.h4
-rw-r--r--modules/regex/regex.h12
-rw-r--r--modules/regex/register_types.cpp2
-rw-r--r--modules/squish/image_compress_squish.h2
-rw-r--r--modules/stb_vorbis/register_types.cpp2
-rw-r--r--modules/svg/image_loader_svg.h2
-rw-r--r--modules/tga/image_loader_tga.cpp8
-rw-r--r--modules/theora/video_stream_theora.cpp2
-rw-r--r--modules/theora/video_stream_theora.h2
-rw-r--r--modules/tinyexr/image_loader_tinyexr.cpp2
-rw-r--r--modules/upnp/register_types.cpp2
-rw-r--r--modules/upnp/upnp.h2
-rw-r--r--modules/upnp/upnp_device.h2
-rw-r--r--modules/visual_script/doc_classes/VisualScriptBuiltinFunc.xml40
-rw-r--r--modules/visual_script/register_types.cpp2
-rw-r--r--modules/visual_script/visual_script.cpp6
-rw-r--r--modules/visual_script/visual_script.h2
-rw-r--r--modules/visual_script/visual_script_builtin_funcs.cpp93
-rw-r--r--modules/visual_script/visual_script_builtin_funcs.h6
-rw-r--r--modules/visual_script/visual_script_editor.cpp21
-rw-r--r--modules/visual_script/visual_script_expression.cpp4
-rw-r--r--modules/visual_script/visual_script_flow_control.cpp2
-rw-r--r--modules/visual_script/visual_script_func_nodes.cpp35
-rw-r--r--modules/visual_script/visual_script_nodes.cpp23
-rw-r--r--modules/visual_script/visual_script_property_selector.cpp2
-rw-r--r--modules/webm/video_stream_webm.cpp2
-rw-r--r--modules/webp/image_loader_webp.cpp2
-rw-r--r--modules/webrtc/register_types.cpp2
-rw-r--r--modules/webrtc/webrtc_data_channel.cpp2
-rw-r--r--modules/websocket/editor_debugger_server_websocket.cpp2
-rw-r--r--modules/websocket/emws_client.cpp2
-rw-r--r--modules/websocket/emws_client.h2
-rw-r--r--modules/websocket/emws_peer.h4
-rw-r--r--modules/websocket/emws_server.h2
-rw-r--r--modules/websocket/packet_buffer.h2
-rw-r--r--modules/websocket/register_types.cpp4
-rw-r--r--modules/websocket/remote_debugger_peer_websocket.cpp2
-rw-r--r--modules/websocket/websocket_client.h2
-rw-r--r--modules/websocket/websocket_multiplayer_peer.h4
-rw-r--r--modules/websocket/websocket_peer.h2
-rw-r--r--modules/websocket/websocket_server.h2
-rw-r--r--modules/websocket/wsl_client.cpp2
-rw-r--r--modules/websocket/wsl_client.h2
-rw-r--r--modules/websocket/wsl_peer.h4
-rw-r--r--modules/websocket/wsl_server.cpp2
-rw-r--r--modules/xatlas_unwrap/register_types.cpp2
-rw-r--r--platform/android/api/api.cpp2
-rw-r--r--platform/android/api/java_class_wrapper.h2
-rw-r--r--platform/android/api/jni_singleton.h4
-rw-r--r--platform/android/audio_driver_jandroid.cpp2
-rw-r--r--platform/android/dir_access_jandroid.cpp2
-rw-r--r--platform/android/display_server_android.cpp2
-rw-r--r--platform/android/export/export.cpp2
-rw-r--r--platform/android/file_access_android.cpp2
-rw-r--r--platform/android/java_godot_io_wrapper.cpp2
-rw-r--r--platform/android/java_godot_lib_jni.cpp4
-rw-r--r--platform/android/jni_utils.h4
-rw-r--r--platform/android/os_android.cpp2
-rw-r--r--platform/android/plugin/godot_plugin_config.h4
-rw-r--r--platform/android/plugin/godot_plugin_jni.cpp6
-rw-r--r--platform/android/string_android.h2
-rw-r--r--platform/android/thread_jandroid.cpp4
-rw-r--r--platform/iphone/app_delegate.mm2
-rw-r--r--platform/iphone/detect.py2
-rw-r--r--platform/iphone/display_layer.mm2
-rw-r--r--platform/iphone/display_server_iphone.mm2
-rw-r--r--platform/iphone/export/export.cpp2
-rw-r--r--platform/iphone/game_center.h2
-rw-r--r--platform/iphone/godot_iphone.mm2
-rw-r--r--platform/iphone/godot_view.mm2
-rw-r--r--platform/iphone/godot_view_gesture_recognizer.mm2
-rw-r--r--platform/iphone/godot_view_renderer.mm2
-rw-r--r--platform/iphone/icloud.h2
-rw-r--r--platform/iphone/in_app_store.h2
-rw-r--r--platform/iphone/ios.h2
-rw-r--r--platform/iphone/joypad_iphone.mm2
-rw-r--r--platform/iphone/os_iphone.mm2
-rw-r--r--platform/iphone/view_controller.mm2
-rw-r--r--platform/javascript/api/api.cpp2
-rw-r--r--platform/javascript/api/javascript_eval.h2
-rw-r--r--platform/javascript/api/javascript_tools_editor_plugin.cpp4
-rw-r--r--platform/javascript/audio_driver_javascript.cpp4
-rw-r--r--platform/javascript/native/library_godot_audio.js2
-rw-r--r--platform/linuxbsd/SCsub2
-rw-r--r--platform/linuxbsd/crash_handler_linuxbsd.cpp2
-rw-r--r--platform/linuxbsd/detect.py6
-rw-r--r--platform/linuxbsd/detect_prime_x11.cpp4
-rw-r--r--platform/linuxbsd/display_server_x11.cpp4
-rw-r--r--platform/linuxbsd/display_server_x11.h2
-rw-r--r--platform/osx/SCsub2
-rw-r--r--platform/osx/context_gl_osx.h2
-rw-r--r--platform/osx/crash_handler_osx.mm2
-rw-r--r--platform/osx/detect.py6
-rw-r--r--platform/osx/export/export.cpp2
-rw-r--r--platform/server/detect.py6
-rw-r--r--platform/server/os_server.cpp2
-rw-r--r--platform/uwp/context_egl_uwp.h2
-rw-r--r--platform/uwp/export/export.cpp6
-rw-r--r--platform/uwp/os_uwp.cpp2
-rw-r--r--platform/uwp/os_uwp.h2
-rw-r--r--platform/windows/SCsub2
-rw-r--r--platform/windows/context_gl_windows.h2
-rw-r--r--platform/windows/crash_handler_windows.cpp2
-rw-r--r--platform/windows/detect.py8
-rw-r--r--platform/windows/display_server_windows.h2
-rw-r--r--platform/windows/godot.natvis4
-rw-r--r--platform/windows/joypad_windows.cpp4
-rw-r--r--platform/windows/joypad_windows.h2
-rw-r--r--platform/windows/os_windows.cpp10
-rw-r--r--platform/windows/os_windows.h2
-rw-r--r--scene/2d/area_2d.h2
-rw-r--r--scene/2d/audio_stream_player_2d.cpp2
-rw-r--r--scene/2d/camera_2d.cpp2
-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/gpu_particles_2d.cpp2
-rw-r--r--scene/2d/gpu_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_builder.h2
-rw-r--r--scene/2d/navigation_agent_2d.cpp2
-rw-r--r--scene/2d/navigation_agent_2d.h2
-rw-r--r--scene/2d/navigation_region_2d.cpp2
-rw-r--r--scene/2d/node_2d.cpp2
-rw-r--r--scene/2d/parallax_layer.cpp2
-rw-r--r--scene/2d/path_2d.cpp2
-rw-r--r--scene/2d/physics_body_2d.cpp8
-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/tile_map.h4
-rw-r--r--scene/2d/visibility_notifier_2d.cpp2
-rw-r--r--scene/3d/area_3d.h2
-rw-r--r--scene/3d/audio_stream_player_3d.cpp2
-rw-r--r--scene/3d/baked_lightmap.cpp2
-rw-r--r--scene/3d/baked_lightmap.h2
-rw-r--r--scene/3d/camera_3d.cpp2
-rw-r--r--scene/3d/cpu_particles_3d.h2
-rw-r--r--scene/3d/gpu_particles_3d.h2
-rw-r--r--scene/3d/gpu_particles_collision_3d.cpp2
-rw-r--r--scene/3d/gpu_particles_collision_3d.h4
-rw-r--r--scene/3d/light_3d.cpp4
-rw-r--r--scene/3d/navigation_agent_3d.cpp2
-rw-r--r--scene/3d/navigation_agent_3d.h2
-rw-r--r--scene/3d/node_3d.cpp4
-rw-r--r--scene/3d/path_3d.cpp2
-rw-r--r--scene/3d/physics_body_3d.cpp8
-rw-r--r--scene/3d/physics_body_3d.h2
-rw-r--r--scene/3d/ray_cast_3d.cpp2
-rw-r--r--scene/3d/skeleton_3d.cpp8
-rw-r--r--scene/3d/skeleton_3d.h2
-rw-r--r--scene/3d/soft_body_3d.cpp6
-rw-r--r--scene/3d/spring_arm_3d.cpp2
-rw-r--r--scene/3d/velocity_tracker_3d.cpp2
-rw-r--r--scene/3d/visibility_notifier_3d.cpp2
-rw-r--r--scene/3d/visual_instance_3d.h2
-rw-r--r--scene/animation/animation_player.cpp4
-rw-r--r--scene/animation/animation_tree.cpp2
-rw-r--r--scene/audio/audio_stream_player.cpp2
-rw-r--r--scene/debugger/scene_debugger.cpp2
-rw-r--r--scene/debugger/scene_debugger.h8
-rw-r--r--scene/gui/button.cpp2
-rw-r--r--scene/gui/check_button.cpp2
-rw-r--r--scene/gui/container.cpp2
-rw-r--r--scene/gui/control.cpp6
-rw-r--r--scene/gui/control.h2
-rw-r--r--scene/gui/dialogs.cpp4
-rw-r--r--scene/gui/file_dialog.cpp2
-rw-r--r--scene/gui/gradient_edit.cpp2
-rw-r--r--scene/gui/item_list.cpp2
-rw-r--r--scene/gui/label.cpp6
-rw-r--r--scene/gui/line_edit.cpp6
-rw-r--r--scene/gui/option_button.cpp2
-rw-r--r--scene/gui/panel.cpp2
-rw-r--r--scene/gui/popup.cpp2
-rw-r--r--scene/gui/popup.h2
-rw-r--r--scene/gui/popup_menu.cpp4
-rw-r--r--scene/gui/reference_rect.cpp2
-rw-r--r--scene/gui/rich_text_effect.cpp2
-rw-r--r--scene/gui/rich_text_effect.h2
-rw-r--r--scene/gui/scroll_bar.cpp2
-rw-r--r--scene/gui/shortcut.h2
-rw-r--r--scene/gui/subviewport_container.cpp2
-rw-r--r--scene/gui/tab_container.cpp2
-rw-r--r--scene/gui/tabs.cpp2
-rw-r--r--scene/gui/text_edit.cpp6
-rw-r--r--scene/gui/texture_progress.cpp2
-rw-r--r--scene/gui/tree.cpp4
-rw-r--r--scene/main/canvas_item.cpp2
-rw-r--r--scene/main/http_request.cpp2
-rw-r--r--scene/main/node.cpp4
-rw-r--r--scene/main/node.h12
-rw-r--r--scene/main/scene_tree.cpp6
-rw-r--r--scene/main/scene_tree.h2
-rw-r--r--scene/main/shader_globals_override.cpp2
-rw-r--r--scene/main/timer.cpp2
-rw-r--r--scene/main/viewport.cpp2
-rw-r--r--scene/register_scene_types.cpp4
-rw-r--r--scene/resources/animation.h2
-rw-r--r--scene/resources/bit_map.h4
-rw-r--r--scene/resources/camera_effects.h4
-rw-r--r--scene/resources/curve.h2
-rw-r--r--scene/resources/dynamic_font.h2
-rw-r--r--scene/resources/environment.cpp2
-rw-r--r--scene/resources/environment.h2
-rw-r--r--scene/resources/font.h4
-rw-r--r--scene/resources/gradient.h2
-rw-r--r--scene/resources/material.cpp4
-rw-r--r--scene/resources/material.h4
-rw-r--r--scene/resources/mesh.cpp2
-rw-r--r--scene/resources/mesh.h2
-rw-r--r--scene/resources/mesh_library.h4
-rw-r--r--scene/resources/packed_scene.cpp4
-rw-r--r--scene/resources/packed_scene.h2
-rw-r--r--scene/resources/particles_material.h2
-rw-r--r--scene/resources/physics_material.h2
-rw-r--r--scene/resources/polygon_path_finder.h2
-rw-r--r--scene/resources/resource_format_text.cpp2
-rw-r--r--scene/resources/resource_format_text.h2
-rw-r--r--scene/resources/shader.cpp3
-rw-r--r--scene/resources/shader.h2
-rw-r--r--scene/resources/shape_2d.h2
-rw-r--r--scene/resources/shape_3d.h2
-rw-r--r--scene/resources/skin.h2
-rw-r--r--scene/resources/sky_material.h2
-rw-r--r--scene/resources/style_box.h2
-rw-r--r--scene/resources/syntax_highlighter.cpp2
-rw-r--r--scene/resources/syntax_highlighter.h2
-rw-r--r--scene/resources/texture.h2
-rw-r--r--scene/resources/theme.cpp2
-rw-r--r--scene/resources/theme.h2
-rw-r--r--scene/resources/tile_set.cpp4
-rw-r--r--scene/resources/tile_set.h4
-rw-r--r--scene/resources/visual_shader.cpp2
-rw-r--r--scene/resources/visual_shader.h2
-rw-r--r--scene/resources/world_2d.cpp6
-rw-r--r--scene/resources/world_2d.h4
-rw-r--r--scene/resources/world_3d.cpp4
-rw-r--r--scene/resources/world_3d.h2
-rw-r--r--scene/scene_string_names.h4
-rw-r--r--servers/audio/audio_driver_dummy.cpp2
-rw-r--r--servers/audio/audio_effect.h2
-rw-r--r--servers/audio/audio_stream.cpp2
-rw-r--r--servers/audio/audio_stream.h4
-rw-r--r--servers/audio/effects/audio_stream_generator.h2
-rw-r--r--servers/audio/effects/eq.cpp2
-rw-r--r--servers/audio/effects/eq.h2
-rw-r--r--servers/audio_server.cpp2
-rw-r--r--servers/audio_server.h4
-rw-r--r--servers/camera/camera_feed.h2
-rw-r--r--servers/camera_server.h8
-rw-r--r--servers/display_server.h4
-rw-r--r--servers/navigation_server_2d.h4
-rw-r--r--servers/navigation_server_3d.h4
-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/collision_object_2d_sw.h2
-rw-r--r--servers/physics_2d/physics_server_2d_sw.cpp2
-rw-r--r--servers/physics_2d/physics_server_2d_sw.h2
-rw-r--r--servers/physics_2d/physics_server_2d_wrap_mt.h4
-rw-r--r--servers/physics_2d/shape_2d_sw.cpp2
-rw-r--r--servers/physics_2d/space_2d_sw.cpp2
-rw-r--r--servers/physics_2d/space_2d_sw.h4
-rw-r--r--servers/physics_3d/area_3d_sw.h2
-rw-r--r--servers/physics_3d/body_3d_sw.h2
-rw-r--r--servers/physics_3d/broad_phase_3d_basic.cpp4
-rw-r--r--servers/physics_3d/broad_phase_3d_basic.h2
-rw-r--r--servers/physics_3d/collision_object_3d_sw.h2
-rw-r--r--servers/physics_3d/physics_server_3d_sw.h2
-rw-r--r--servers/physics_3d/shape_3d_sw.cpp2
-rw-r--r--servers/physics_3d/space_3d_sw.cpp2
-rw-r--r--servers/physics_3d/space_3d_sw.h4
-rw-r--r--servers/physics_server_2d.cpp10
-rw-r--r--servers/physics_server_2d.h6
-rw-r--r--servers/physics_server_3d.cpp8
-rw-r--r--servers/physics_server_3d.h4
-rw-r--r--servers/register_server_types.cpp4
-rw-r--r--servers/rendering/rasterizer.cpp2
-rw-r--r--servers/rendering/rasterizer.h4
-rw-r--r--servers/rendering/rasterizer_rd/rasterizer_canvas_rd.cpp4
-rw-r--r--servers/rendering/rasterizer_rd/rasterizer_effects_rd.cpp2
-rw-r--r--servers/rendering/rasterizer_rd/rasterizer_rd.cpp2
-rw-r--r--servers/rendering/rasterizer_rd/rasterizer_rd.h2
-rw-r--r--servers/rendering/rasterizer_rd/rasterizer_scene_high_end_rd.cpp2
-rw-r--r--servers/rendering/rasterizer_rd/rasterizer_scene_rd.cpp2
-rw-r--r--servers/rendering/rasterizer_rd/rasterizer_scene_rd.h4
-rw-r--r--servers/rendering/rasterizer_rd/rasterizer_storage_rd.cpp6
-rw-r--r--servers/rendering/rasterizer_rd/rasterizer_storage_rd.h4
-rw-r--r--servers/rendering/rasterizer_rd/render_pipeline_vertex_format_cache_rd.h2
-rw-r--r--servers/rendering/rasterizer_rd/shader_compiler_rd.cpp2
-rw-r--r--servers/rendering/rasterizer_rd/shader_compiler_rd.h2
-rw-r--r--servers/rendering/rasterizer_rd/shader_rd.cpp2
-rw-r--r--servers/rendering/rasterizer_rd/shader_rd.h8
-rw-r--r--servers/rendering/rendering_device.h4
-rw-r--r--servers/rendering/rendering_server_raster.cpp4
-rw-r--r--servers/rendering/rendering_server_scene.h6
-rw-r--r--servers/rendering/rendering_server_viewport.cpp2
-rw-r--r--servers/rendering/rendering_server_viewport.h4
-rw-r--r--servers/rendering/rendering_server_wrap_mt.cpp2
-rw-r--r--servers/rendering/rendering_server_wrap_mt.h2
-rw-r--r--servers/rendering/shader_language.cpp2
-rw-r--r--servers/rendering/shader_language.h12
-rw-r--r--servers/rendering/shader_types.h2
-rw-r--r--servers/rendering_server.cpp2
-rw-r--r--servers/rendering_server.h10
-rw-r--r--servers/xr_server.cpp2
-rw-r--r--servers/xr_server.h6
-rw-r--r--tests/test_basis.h2
-rw-r--r--tests/test_class_db.h20
-rw-r--r--tests/test_color.h5
-rw-r--r--tests/test_command_queue.h4
-rw-r--r--tests/test_expression.h6
-rw-r--r--tests/test_gradient.h4
-rw-r--r--tests/test_gui.cpp2
-rw-r--r--tests/test_list.h2
-rw-r--r--tests/test_macros.h4
-rw-r--r--tests/test_main.cpp2
-rw-r--r--tests/test_math.cpp10
-rw-r--r--tests/test_method_bind.h2
-rw-r--r--tests/test_oa_hash_map.cpp2
-rw-r--r--tests/test_ordered_hash_map.h6
-rw-r--r--tests/test_physics_2d.cpp4
-rw-r--r--tests/test_physics_3d.cpp4
-rw-r--r--tests/test_render.cpp2
-rw-r--r--tests/test_shader_lang.cpp2
-rw-r--r--tests/test_string.h2
-rw-r--r--tests/test_variant.h4
-rw-r--r--thirdparty/README.md2
-rw-r--r--thirdparty/libogg/ogg/config_types.h2
-rw-r--r--thirdparty/misc/open-simplex-noise.c11
-rw-r--r--thirdparty/misc/pcg.cpp23
-rw-r--r--thirdparty/misc/triangulator.h4
923 files changed, 10703 insertions, 8719 deletions
diff --git a/.github/workflows/android_builds.yml b/.github/workflows/android_builds.yml
index 3ce3765efc..f4b571fc08 100644
--- a/.github/workflows/android_builds.yml
+++ b/.github/workflows/android_builds.yml
@@ -4,7 +4,7 @@ on: [push, pull_request]
# Global Settings
env:
GODOT_BASE_BRANCH: master
- SCONSFLAGS: platform=android verbose=yes warnings=all werror=yes --jobs=2
+ SCONSFLAGS: platform=android verbose=yes warnings=extra werror=yes --jobs=2
SCONS_CACHE_LIMIT: 4096
jobs:
diff --git a/.github/workflows/ios_builds.yml b/.github/workflows/ios_builds.yml
index 80db5d68ce..fa965a45f1 100644
--- a/.github/workflows/ios_builds.yml
+++ b/.github/workflows/ios_builds.yml
@@ -4,7 +4,7 @@ on: [push, pull_request]
# Global Settings
env:
GODOT_BASE_BRANCH: master
- SCONSFLAGS: platform=iphone verbose=yes warnings=all werror=yes --jobs=2
+ SCONSFLAGS: platform=iphone verbose=yes warnings=extra werror=yes --jobs=2
SCONS_CACHE_LIMIT: 4096
jobs:
diff --git a/.github/workflows/javascript_builds.disabled b/.github/workflows/javascript_builds.disabled
index 8ed77726cc..015a1f314c 100644
--- a/.github/workflows/javascript_builds.disabled
+++ b/.github/workflows/javascript_builds.disabled
@@ -4,7 +4,7 @@ on: [push, pull_request]
# Global Settings
env:
GODOT_BASE_BRANCH: master
- SCONSFLAGS: platform=javascript verbose=yes warnings=all werror=yes --jobs=2
+ SCONSFLAGS: platform=javascript verbose=yes warnings=extra werror=yes --jobs=2
SCONS_CACHE_LIMIT: 4096
EM_VERSION: 1.39.20
EM_CACHE_FOLDER: 'emsdk-cache'
diff --git a/.github/workflows/linux_builds.yml b/.github/workflows/linux_builds.yml
index b81c06e54d..b7b40eccbd 100644
--- a/.github/workflows/linux_builds.yml
+++ b/.github/workflows/linux_builds.yml
@@ -4,7 +4,7 @@ on: [push, pull_request]
# Global Settings
env:
GODOT_BASE_BRANCH: master
- SCONSFLAGS: platform=linuxbsd verbose=yes warnings=all werror=yes --jobs=2
+ SCONSFLAGS: platform=linuxbsd verbose=yes warnings=extra werror=yes --jobs=2
SCONS_CACHE_LIMIT: 4096
jobs:
diff --git a/.github/workflows/macos_builds.yml b/.github/workflows/macos_builds.yml
index 5f9ad24ac7..401cfadc30 100644
--- a/.github/workflows/macos_builds.yml
+++ b/.github/workflows/macos_builds.yml
@@ -4,7 +4,7 @@ on: [push, pull_request]
# Global Settings
env:
GODOT_BASE_BRANCH: master
- SCONSFLAGS: platform=osx verbose=yes warnings=all werror=yes --jobs=2
+ SCONSFLAGS: platform=osx verbose=yes warnings=extra werror=yes --jobs=2
SCONS_CACHE_LIMIT: 4096
jobs:
diff --git a/core/SCsub b/core/SCsub
index b9f06d12ae..78a4395619 100644
--- a/core/SCsub
+++ b/core/SCsub
@@ -34,7 +34,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 "core/project_settings.h"\nuint8_t script_encryption_key[32]={' + txt + "};\n")
+ f.write('#include "core/config/project_settings.h"\nuint8_t script_encryption_key[32]={' + txt + "};\n")
# Add required thirdparty code.
@@ -174,7 +174,12 @@ SConscript("crypto/SCsub")
SConscript("io/SCsub")
SConscript("debugger/SCsub")
SConscript("input/SCsub")
-SConscript("bind/SCsub")
+SConscript("variant/SCsub")
+SConscript("object/SCsub")
+SConscript("templates/SCsub")
+SConscript("string/SCsub")
+SConscript("config/SCsub")
+SConscript("error/SCsub")
# Build it all as a library
diff --git a/core/bind/SCsub b/core/bind/SCsub
deleted file mode 100644
index 19a6549225..0000000000
--- a/core/bind/SCsub
+++ /dev/null
@@ -1,5 +0,0 @@
-#!/usr/bin/env python
-
-Import("env")
-
-env.add_source_files(env.core_sources, "*.cpp")
diff --git a/core/color_names.inc b/core/color_names.inc
deleted file mode 100644
index 2b50d88b02..0000000000
--- a/core/color_names.inc
+++ /dev/null
@@ -1,155 +0,0 @@
-// Names from https://en.wikipedia.org/wiki/X11_color_names
-#include "core/map.h"
-
-static Map<String, Color> _named_colors;
-static void _populate_named_colors() {
- if (!_named_colors.empty()) {
- return;
- }
- _named_colors.insert("aliceblue", Color(0.94, 0.97, 1.00));
- _named_colors.insert("antiquewhite", Color(0.98, 0.92, 0.84));
- _named_colors.insert("aqua", Color(0.00, 1.00, 1.00));
- _named_colors.insert("aquamarine", Color(0.50, 1.00, 0.83));
- _named_colors.insert("azure", Color(0.94, 1.00, 1.00));
- _named_colors.insert("beige", Color(0.96, 0.96, 0.86));
- _named_colors.insert("bisque", Color(1.00, 0.89, 0.77));
- _named_colors.insert("black", Color(0.00, 0.00, 0.00));
- _named_colors.insert("blanchedalmond", Color(1.00, 0.92, 0.80));
- _named_colors.insert("blue", Color(0.00, 0.00, 1.00));
- _named_colors.insert("blueviolet", Color(0.54, 0.17, 0.89));
- _named_colors.insert("brown", Color(0.65, 0.16, 0.16));
- _named_colors.insert("burlywood", Color(0.87, 0.72, 0.53));
- _named_colors.insert("cadetblue", Color(0.37, 0.62, 0.63));
- _named_colors.insert("chartreuse", Color(0.50, 1.00, 0.00));
- _named_colors.insert("chocolate", Color(0.82, 0.41, 0.12));
- _named_colors.insert("coral", Color(1.00, 0.50, 0.31));
- _named_colors.insert("cornflower", Color(0.39, 0.58, 0.93));
- _named_colors.insert("cornsilk", Color(1.00, 0.97, 0.86));
- _named_colors.insert("crimson", Color(0.86, 0.08, 0.24));
- _named_colors.insert("cyan", Color(0.00, 1.00, 1.00));
- _named_colors.insert("darkblue", Color(0.00, 0.00, 0.55));
- _named_colors.insert("darkcyan", Color(0.00, 0.55, 0.55));
- _named_colors.insert("darkgoldenrod", Color(0.72, 0.53, 0.04));
- _named_colors.insert("darkgray", Color(0.66, 0.66, 0.66));
- _named_colors.insert("darkgreen", Color(0.00, 0.39, 0.00));
- _named_colors.insert("darkkhaki", Color(0.74, 0.72, 0.42));
- _named_colors.insert("darkmagenta", Color(0.55, 0.00, 0.55));
- _named_colors.insert("darkolivegreen", Color(0.33, 0.42, 0.18));
- _named_colors.insert("darkorange", Color(1.00, 0.55, 0.00));
- _named_colors.insert("darkorchid", Color(0.60, 0.20, 0.80));
- _named_colors.insert("darkred", Color(0.55, 0.00, 0.00));
- _named_colors.insert("darksalmon", Color(0.91, 0.59, 0.48));
- _named_colors.insert("darkseagreen", Color(0.56, 0.74, 0.56));
- _named_colors.insert("darkslateblue", Color(0.28, 0.24, 0.55));
- _named_colors.insert("darkslategray", Color(0.18, 0.31, 0.31));
- _named_colors.insert("darkturquoise", Color(0.00, 0.81, 0.82));
- _named_colors.insert("darkviolet", Color(0.58, 0.00, 0.83));
- _named_colors.insert("deeppink", Color(1.00, 0.08, 0.58));
- _named_colors.insert("deepskyblue", Color(0.00, 0.75, 1.00));
- _named_colors.insert("dimgray", Color(0.41, 0.41, 0.41));
- _named_colors.insert("dodgerblue", Color(0.12, 0.56, 1.00));
- _named_colors.insert("firebrick", Color(0.70, 0.13, 0.13));
- _named_colors.insert("floralwhite", Color(1.00, 0.98, 0.94));
- _named_colors.insert("forestgreen", Color(0.13, 0.55, 0.13));
- _named_colors.insert("fuchsia", Color(1.00, 0.00, 1.00));
- _named_colors.insert("gainsboro", Color(0.86, 0.86, 0.86));
- _named_colors.insert("ghostwhite", Color(0.97, 0.97, 1.00));
- _named_colors.insert("gold", Color(1.00, 0.84, 0.00));
- _named_colors.insert("goldenrod", Color(0.85, 0.65, 0.13));
- _named_colors.insert("gray", Color(0.75, 0.75, 0.75));
- _named_colors.insert("webgray", Color(0.50, 0.50, 0.50));
- _named_colors.insert("green", Color(0.00, 1.00, 0.00));
- _named_colors.insert("webgreen", Color(0.00, 0.50, 0.00));
- _named_colors.insert("greenyellow", Color(0.68, 1.00, 0.18));
- _named_colors.insert("honeydew", Color(0.94, 1.00, 0.94));
- _named_colors.insert("hotpink", Color(1.00, 0.41, 0.71));
- _named_colors.insert("indianred", Color(0.80, 0.36, 0.36));
- _named_colors.insert("indigo", Color(0.29, 0.00, 0.51));
- _named_colors.insert("ivory", Color(1.00, 1.00, 0.94));
- _named_colors.insert("khaki", Color(0.94, 0.90, 0.55));
- _named_colors.insert("lavender", Color(0.90, 0.90, 0.98));
- _named_colors.insert("lavenderblush", Color(1.00, 0.94, 0.96));
- _named_colors.insert("lawngreen", Color(0.49, 0.99, 0.00));
- _named_colors.insert("lemonchiffon", Color(1.00, 0.98, 0.80));
- _named_colors.insert("lightblue", Color(0.68, 0.85, 0.90));
- _named_colors.insert("lightcoral", Color(0.94, 0.50, 0.50));
- _named_colors.insert("lightcyan", Color(0.88, 1.00, 1.00));
- _named_colors.insert("lightgoldenrod", Color(0.98, 0.98, 0.82));
- _named_colors.insert("lightgray", Color(0.83, 0.83, 0.83));
- _named_colors.insert("lightgreen", Color(0.56, 0.93, 0.56));
- _named_colors.insert("lightpink", Color(1.00, 0.71, 0.76));
- _named_colors.insert("lightsalmon", Color(1.00, 0.63, 0.48));
- _named_colors.insert("lightseagreen", Color(0.13, 0.70, 0.67));
- _named_colors.insert("lightskyblue", Color(0.53, 0.81, 0.98));
- _named_colors.insert("lightslategray", Color(0.47, 0.53, 0.60));
- _named_colors.insert("lightsteelblue", Color(0.69, 0.77, 0.87));
- _named_colors.insert("lightyellow", Color(1.00, 1.00, 0.88));
- _named_colors.insert("lime", Color(0.00, 1.00, 0.00));
- _named_colors.insert("limegreen", Color(0.20, 0.80, 0.20));
- _named_colors.insert("linen", Color(0.98, 0.94, 0.90));
- _named_colors.insert("magenta", Color(1.00, 0.00, 1.00));
- _named_colors.insert("maroon", Color(0.69, 0.19, 0.38));
- _named_colors.insert("webmaroon", Color(0.50, 0.00, 0.00));
- _named_colors.insert("mediumaquamarine", Color(0.40, 0.80, 0.67));
- _named_colors.insert("mediumblue", Color(0.00, 0.00, 0.80));
- _named_colors.insert("mediumorchid", Color(0.73, 0.33, 0.83));
- _named_colors.insert("mediumpurple", Color(0.58, 0.44, 0.86));
- _named_colors.insert("mediumseagreen", Color(0.24, 0.70, 0.44));
- _named_colors.insert("mediumslateblue", Color(0.48, 0.41, 0.93));
- _named_colors.insert("mediumspringgreen", Color(0.00, 0.98, 0.60));
- _named_colors.insert("mediumturquoise", Color(0.28, 0.82, 0.80));
- _named_colors.insert("mediumvioletred", Color(0.78, 0.08, 0.52));
- _named_colors.insert("midnightblue", Color(0.10, 0.10, 0.44));
- _named_colors.insert("mintcream", Color(0.96, 1.00, 0.98));
- _named_colors.insert("mistyrose", Color(1.00, 0.89, 0.88));
- _named_colors.insert("moccasin", Color(1.00, 0.89, 0.71));
- _named_colors.insert("navajowhite", Color(1.00, 0.87, 0.68));
- _named_colors.insert("navyblue", Color(0.00, 0.00, 0.50));
- _named_colors.insert("oldlace", Color(0.99, 0.96, 0.90));
- _named_colors.insert("olive", Color(0.50, 0.50, 0.00));
- _named_colors.insert("olivedrab", Color(0.42, 0.56, 0.14));
- _named_colors.insert("orange", Color(1.00, 0.65, 0.00));
- _named_colors.insert("orangered", Color(1.00, 0.27, 0.00));
- _named_colors.insert("orchid", Color(0.85, 0.44, 0.84));
- _named_colors.insert("palegoldenrod", Color(0.93, 0.91, 0.67));
- _named_colors.insert("palegreen", Color(0.60, 0.98, 0.60));
- _named_colors.insert("paleturquoise", Color(0.69, 0.93, 0.93));
- _named_colors.insert("palevioletred", Color(0.86, 0.44, 0.58));
- _named_colors.insert("papayawhip", Color(1.00, 0.94, 0.84));
- _named_colors.insert("peachpuff", Color(1.00, 0.85, 0.73));
- _named_colors.insert("peru", Color(0.80, 0.52, 0.25));
- _named_colors.insert("pink", Color(1.00, 0.75, 0.80));
- _named_colors.insert("plum", Color(0.87, 0.63, 0.87));
- _named_colors.insert("powderblue", Color(0.69, 0.88, 0.90));
- _named_colors.insert("purple", Color(0.63, 0.13, 0.94));
- _named_colors.insert("webpurple", Color(0.50, 0.00, 0.50));
- _named_colors.insert("rebeccapurple", Color(0.40, 0.20, 0.60));
- _named_colors.insert("red", Color(1.00, 0.00, 0.00));
- _named_colors.insert("rosybrown", Color(0.74, 0.56, 0.56));
- _named_colors.insert("royalblue", Color(0.25, 0.41, 0.88));
- _named_colors.insert("saddlebrown", Color(0.55, 0.27, 0.07));
- _named_colors.insert("salmon", Color(0.98, 0.50, 0.45));
- _named_colors.insert("sandybrown", Color(0.96, 0.64, 0.38));
- _named_colors.insert("seagreen", Color(0.18, 0.55, 0.34));
- _named_colors.insert("seashell", Color(1.00, 0.96, 0.93));
- _named_colors.insert("sienna", Color(0.63, 0.32, 0.18));
- _named_colors.insert("silver", Color(0.75, 0.75, 0.75));
- _named_colors.insert("skyblue", Color(0.53, 0.81, 0.92));
- _named_colors.insert("slateblue", Color(0.42, 0.35, 0.80));
- _named_colors.insert("slategray", Color(0.44, 0.50, 0.56));
- _named_colors.insert("snow", Color(1.00, 0.98, 0.98));
- _named_colors.insert("springgreen", Color(0.00, 1.00, 0.50));
- _named_colors.insert("steelblue", Color(0.27, 0.51, 0.71));
- _named_colors.insert("tan", Color(0.82, 0.71, 0.55));
- _named_colors.insert("teal", Color(0.00, 0.50, 0.50));
- _named_colors.insert("thistle", Color(0.85, 0.75, 0.85));
- _named_colors.insert("tomato", Color(1.00, 0.39, 0.28));
- _named_colors.insert("turquoise", Color(0.25, 0.88, 0.82));
- _named_colors.insert("transparent", Color(1.00, 1.00, 1.00, 0.00));
- _named_colors.insert("violet", Color(0.93, 0.51, 0.93));
- _named_colors.insert("wheat", Color(0.96, 0.87, 0.70));
- _named_colors.insert("white", Color(1.00, 1.00, 1.00));
- _named_colors.insert("whitesmoke", Color(0.96, 0.96, 0.96));
- _named_colors.insert("yellow", Color(1.00, 1.00, 0.00));
- _named_colors.insert("yellowgreen", Color(0.60, 0.80, 0.20));
-}
diff --git a/core/config/SCsub b/core/config/SCsub
new file mode 100644
index 0000000000..bf70285490
--- /dev/null
+++ b/core/config/SCsub
@@ -0,0 +1,7 @@
+#!/usr/bin/env python
+
+Import("env")
+
+env_config = env.Clone()
+
+env_config.add_source_files(env.core_sources, "*.cpp")
diff --git a/core/engine.cpp b/core/config/engine.cpp
index b0037ffb37..b0037ffb37 100644
--- a/core/engine.cpp
+++ b/core/config/engine.cpp
diff --git a/core/engine.h b/core/config/engine.h
index b581c58ec5..1d3d963b39 100644
--- a/core/engine.h
+++ b/core/config/engine.h
@@ -31,10 +31,10 @@
#ifndef ENGINE_H
#define ENGINE_H
-#include "core/list.h"
#include "core/os/main_loop.h"
-#include "core/ustring.h"
-#include "core/vector.h"
+#include "core/string/ustring.h"
+#include "core/templates/list.h"
+#include "core/templates/vector.h"
class Engine {
public:
diff --git a/core/project_settings.cpp b/core/config/project_settings.cpp
index 3829474626..aa954ed300 100644
--- a/core/project_settings.cpp
+++ b/core/config/project_settings.cpp
@@ -30,7 +30,7 @@
#include "project_settings.h"
-#include "core/bind/core_bind.h"
+#include "core/core_bind.h"
#include "core/core_string_names.h"
#include "core/io/file_access_network.h"
#include "core/io/file_access_pack.h"
@@ -39,7 +39,7 @@
#include "core/os/file_access.h"
#include "core/os/keyboard.h"
#include "core/os/os.h"
-#include "core/variant_parser.h"
+#include "core/variant/variant_parser.h"
#include <zlib.h>
diff --git a/core/project_settings.h b/core/config/project_settings.h
index 9a1d9cee97..a8c9adc587 100644
--- a/core/project_settings.h
+++ b/core/config/project_settings.h
@@ -31,9 +31,9 @@
#ifndef PROJECT_SETTINGS_H
#define PROJECT_SETTINGS_H
-#include "core/class_db.h"
+#include "core/object/class_db.h"
#include "core/os/thread_safe.h"
-#include "core/set.h"
+#include "core/templates/set.h"
class ProjectSettings : public Object {
GDCLASS(ProjectSettings, Object);
diff --git a/core/bind/core_bind.cpp b/core/core_bind.cpp
index baf5d4b928..f3bdea1eec 100644
--- a/core/bind/core_bind.cpp
+++ b/core/core_bind.cpp
@@ -30,6 +30,7 @@
#include "core_bind.h"
+#include "core/config/project_settings.h"
#include "core/crypto/crypto_core.h"
#include "core/debugger/engine_debugger.h"
#include "core/io/file_access_compressed.h"
@@ -40,7 +41,6 @@
#include "core/math/geometry_3d.h"
#include "core/os/keyboard.h"
#include "core/os/os.h"
-#include "core/project_settings.h"
/**
* Time constants borrowed from loc_time.h
diff --git a/core/bind/core_bind.h b/core/core_bind.h
index e75e740cd5..7794750387 100644
--- a/core/bind/core_bind.h
+++ b/core/core_bind.h
@@ -31,8 +31,8 @@
#ifndef CORE_BIND_H
#define CORE_BIND_H
-#include "core/image.h"
#include "core/io/compression.h"
+#include "core/io/image.h"
#include "core/io/resource_loader.h"
#include "core/io/resource_saver.h"
#include "core/os/dir_access.h"
diff --git a/core/core_constants.cpp b/core/core_constants.cpp
new file mode 100644
index 0000000000..4229436e84
--- /dev/null
+++ b/core/core_constants.cpp
@@ -0,0 +1,690 @@
+/*************************************************************************/
+/* core_constants.cpp */
+/*************************************************************************/
+/* This file is part of: */
+/* GODOT ENGINE */
+/* https://godotengine.org */
+/*************************************************************************/
+/* Copyright (c) 2007-2020 Juan Linietsky, Ariel Manzur. */
+/* Copyright (c) 2014-2020 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 "core_constants.h"
+
+#include "core/input/input_event.h"
+#include "core/object/class_db.h"
+#include "core/os/keyboard.h"
+#include "core/variant/variant.h"
+
+struct _CoreConstant {
+#ifdef DEBUG_METHODS_ENABLED
+ StringName enum_name;
+ bool ignore_value_in_docs;
+#endif
+ const char *name;
+ int value;
+
+ _CoreConstant() {}
+
+#ifdef DEBUG_METHODS_ENABLED
+ _CoreConstant(const StringName &p_enum_name, const char *p_name, int p_value, bool p_ignore_value_in_docs = false) :
+ enum_name(p_enum_name),
+ ignore_value_in_docs(p_ignore_value_in_docs),
+ name(p_name),
+ value(p_value) {
+ }
+#else
+ _CoreConstant(const char *p_name, int p_value) :
+ name(p_name),
+ value(p_value) {
+ }
+#endif
+};
+
+static Vector<_CoreConstant> _global_constants;
+
+#ifdef DEBUG_METHODS_ENABLED
+
+#define BIND_CORE_CONSTANT(m_constant) \
+ _global_constants.push_back(_CoreConstant(StringName(), #m_constant, m_constant));
+
+#define BIND_CORE_ENUM_CONSTANT(m_constant) \
+ _global_constants.push_back(_CoreConstant(__constant_get_enum_name(m_constant, #m_constant), #m_constant, m_constant));
+
+#define BIND_CORE_ENUM_CONSTANT_CUSTOM(m_custom_name, m_constant) \
+ _global_constants.push_back(_CoreConstant(__constant_get_enum_name(m_constant, #m_constant), m_custom_name, m_constant));
+
+#define BIND_CORE_CONSTANT_NO_VAL(m_constant) \
+ _global_constants.push_back(_CoreConstant(StringName(), #m_constant, m_constant, true));
+
+#define BIND_CORE_ENUM_CONSTANT_NO_VAL(m_constant) \
+ _global_constants.push_back(_CoreConstant(__constant_get_enum_name(m_constant, #m_constant), #m_constant, m_constant, true));
+
+#define BIND_CORE_ENUM_CONSTANT_CUSTOM_NO_VAL(m_custom_name, m_constant) \
+ _global_constants.push_back(_CoreConstant(__constant_get_enum_name(m_constant, #m_constant), m_custom_name, m_constant, true));
+
+#else
+
+#define BIND_CORE_CONSTANT(m_constant) \
+ _global_constants.push_back(_CoreConstant(#m_constant, m_constant));
+
+#define BIND_CORE_ENUM_CONSTANT(m_constant) \
+ _global_constants.push_back(_CoreConstant(#m_constant, m_constant));
+
+#define BIND_CORE_ENUM_CONSTANT_CUSTOM(m_custom_name, m_constant) \
+ _global_constants.push_back(_CoreConstant(m_custom_name, m_constant));
+
+#define BIND_CORE_CONSTANT_NO_VAL(m_constant) \
+ _global_constants.push_back(_CoreConstant(#m_constant, m_constant));
+
+#define BIND_CORE_ENUM_CONSTANT_NO_VAL(m_constant) \
+ _global_constants.push_back(_CoreConstant(#m_constant, m_constant));
+
+#define BIND_CORE_ENUM_CONSTANT_CUSTOM_NO_VAL(m_custom_name, m_constant) \
+ _global_constants.push_back(_CoreConstant(m_custom_name, m_constant));
+
+#endif
+
+VARIANT_ENUM_CAST(KeyList);
+VARIANT_ENUM_CAST(KeyModifierMask);
+VARIANT_ENUM_CAST(ButtonList);
+VARIANT_ENUM_CAST(JoyButtonList);
+VARIANT_ENUM_CAST(JoyAxisList);
+VARIANT_ENUM_CAST(MidiMessageList);
+
+void register_global_constants() {
+ BIND_CORE_ENUM_CONSTANT(MARGIN_LEFT);
+ BIND_CORE_ENUM_CONSTANT(MARGIN_TOP);
+ BIND_CORE_ENUM_CONSTANT(MARGIN_RIGHT);
+ BIND_CORE_ENUM_CONSTANT(MARGIN_BOTTOM);
+
+ BIND_CORE_ENUM_CONSTANT(CORNER_TOP_LEFT);
+ BIND_CORE_ENUM_CONSTANT(CORNER_TOP_RIGHT);
+ BIND_CORE_ENUM_CONSTANT(CORNER_BOTTOM_RIGHT);
+ BIND_CORE_ENUM_CONSTANT(CORNER_BOTTOM_LEFT);
+
+ BIND_CORE_ENUM_CONSTANT(VERTICAL);
+ BIND_CORE_ENUM_CONSTANT(HORIZONTAL);
+
+ BIND_CORE_ENUM_CONSTANT(HALIGN_LEFT);
+ BIND_CORE_ENUM_CONSTANT(HALIGN_CENTER);
+ BIND_CORE_ENUM_CONSTANT(HALIGN_RIGHT);
+
+ BIND_CORE_ENUM_CONSTANT(VALIGN_TOP);
+ BIND_CORE_ENUM_CONSTANT(VALIGN_CENTER);
+ BIND_CORE_ENUM_CONSTANT(VALIGN_BOTTOM);
+
+ // huge list of keys
+ BIND_CORE_CONSTANT(SPKEY);
+
+ BIND_CORE_ENUM_CONSTANT(KEY_ESCAPE);
+ BIND_CORE_ENUM_CONSTANT(KEY_TAB);
+ BIND_CORE_ENUM_CONSTANT(KEY_BACKTAB);
+ BIND_CORE_ENUM_CONSTANT(KEY_BACKSPACE);
+ BIND_CORE_ENUM_CONSTANT(KEY_ENTER);
+ BIND_CORE_ENUM_CONSTANT(KEY_KP_ENTER);
+ BIND_CORE_ENUM_CONSTANT(KEY_INSERT);
+ BIND_CORE_ENUM_CONSTANT(KEY_DELETE);
+ BIND_CORE_ENUM_CONSTANT(KEY_PAUSE);
+ BIND_CORE_ENUM_CONSTANT(KEY_PRINT);
+ BIND_CORE_ENUM_CONSTANT(KEY_SYSREQ);
+ BIND_CORE_ENUM_CONSTANT(KEY_CLEAR);
+ BIND_CORE_ENUM_CONSTANT(KEY_HOME);
+ BIND_CORE_ENUM_CONSTANT(KEY_END);
+ BIND_CORE_ENUM_CONSTANT(KEY_LEFT);
+ BIND_CORE_ENUM_CONSTANT(KEY_UP);
+ BIND_CORE_ENUM_CONSTANT(KEY_RIGHT);
+ BIND_CORE_ENUM_CONSTANT(KEY_DOWN);
+ BIND_CORE_ENUM_CONSTANT(KEY_PAGEUP);
+ BIND_CORE_ENUM_CONSTANT(KEY_PAGEDOWN);
+ BIND_CORE_ENUM_CONSTANT(KEY_SHIFT);
+ BIND_CORE_ENUM_CONSTANT(KEY_CONTROL);
+ BIND_CORE_ENUM_CONSTANT(KEY_META);
+ BIND_CORE_ENUM_CONSTANT(KEY_ALT);
+ BIND_CORE_ENUM_CONSTANT(KEY_CAPSLOCK);
+ BIND_CORE_ENUM_CONSTANT(KEY_NUMLOCK);
+ BIND_CORE_ENUM_CONSTANT(KEY_SCROLLLOCK);
+ BIND_CORE_ENUM_CONSTANT(KEY_F1);
+ BIND_CORE_ENUM_CONSTANT(KEY_F2);
+ BIND_CORE_ENUM_CONSTANT(KEY_F3);
+ BIND_CORE_ENUM_CONSTANT(KEY_F4);
+ BIND_CORE_ENUM_CONSTANT(KEY_F5);
+ BIND_CORE_ENUM_CONSTANT(KEY_F6);
+ BIND_CORE_ENUM_CONSTANT(KEY_F7);
+ BIND_CORE_ENUM_CONSTANT(KEY_F8);
+ BIND_CORE_ENUM_CONSTANT(KEY_F9);
+ BIND_CORE_ENUM_CONSTANT(KEY_F10);
+ BIND_CORE_ENUM_CONSTANT(KEY_F11);
+ BIND_CORE_ENUM_CONSTANT(KEY_F12);
+ BIND_CORE_ENUM_CONSTANT(KEY_F13);
+ BIND_CORE_ENUM_CONSTANT(KEY_F14);
+ BIND_CORE_ENUM_CONSTANT(KEY_F15);
+ BIND_CORE_ENUM_CONSTANT(KEY_F16);
+ BIND_CORE_ENUM_CONSTANT(KEY_KP_MULTIPLY);
+ BIND_CORE_ENUM_CONSTANT(KEY_KP_DIVIDE);
+ BIND_CORE_ENUM_CONSTANT(KEY_KP_SUBTRACT);
+ BIND_CORE_ENUM_CONSTANT(KEY_KP_PERIOD);
+ BIND_CORE_ENUM_CONSTANT(KEY_KP_ADD);
+ BIND_CORE_ENUM_CONSTANT(KEY_KP_0);
+ BIND_CORE_ENUM_CONSTANT(KEY_KP_1);
+ BIND_CORE_ENUM_CONSTANT(KEY_KP_2);
+ BIND_CORE_ENUM_CONSTANT(KEY_KP_3);
+ BIND_CORE_ENUM_CONSTANT(KEY_KP_4);
+ BIND_CORE_ENUM_CONSTANT(KEY_KP_5);
+ BIND_CORE_ENUM_CONSTANT(KEY_KP_6);
+ BIND_CORE_ENUM_CONSTANT(KEY_KP_7);
+ BIND_CORE_ENUM_CONSTANT(KEY_KP_8);
+ BIND_CORE_ENUM_CONSTANT(KEY_KP_9);
+ BIND_CORE_ENUM_CONSTANT(KEY_SUPER_L);
+ BIND_CORE_ENUM_CONSTANT(KEY_SUPER_R);
+ BIND_CORE_ENUM_CONSTANT(KEY_MENU);
+ BIND_CORE_ENUM_CONSTANT(KEY_HYPER_L);
+ BIND_CORE_ENUM_CONSTANT(KEY_HYPER_R);
+ BIND_CORE_ENUM_CONSTANT(KEY_HELP);
+ BIND_CORE_ENUM_CONSTANT(KEY_DIRECTION_L);
+ BIND_CORE_ENUM_CONSTANT(KEY_DIRECTION_R);
+ BIND_CORE_ENUM_CONSTANT(KEY_BACK);
+ BIND_CORE_ENUM_CONSTANT(KEY_FORWARD);
+ BIND_CORE_ENUM_CONSTANT(KEY_STOP);
+ BIND_CORE_ENUM_CONSTANT(KEY_REFRESH);
+ BIND_CORE_ENUM_CONSTANT(KEY_VOLUMEDOWN);
+ BIND_CORE_ENUM_CONSTANT(KEY_VOLUMEMUTE);
+ BIND_CORE_ENUM_CONSTANT(KEY_VOLUMEUP);
+ BIND_CORE_ENUM_CONSTANT(KEY_BASSBOOST);
+ BIND_CORE_ENUM_CONSTANT(KEY_BASSUP);
+ BIND_CORE_ENUM_CONSTANT(KEY_BASSDOWN);
+ BIND_CORE_ENUM_CONSTANT(KEY_TREBLEUP);
+ BIND_CORE_ENUM_CONSTANT(KEY_TREBLEDOWN);
+ BIND_CORE_ENUM_CONSTANT(KEY_MEDIAPLAY);
+ BIND_CORE_ENUM_CONSTANT(KEY_MEDIASTOP);
+ BIND_CORE_ENUM_CONSTANT(KEY_MEDIAPREVIOUS);
+ BIND_CORE_ENUM_CONSTANT(KEY_MEDIANEXT);
+ BIND_CORE_ENUM_CONSTANT(KEY_MEDIARECORD);
+ BIND_CORE_ENUM_CONSTANT(KEY_HOMEPAGE);
+ BIND_CORE_ENUM_CONSTANT(KEY_FAVORITES);
+ BIND_CORE_ENUM_CONSTANT(KEY_SEARCH);
+ BIND_CORE_ENUM_CONSTANT(KEY_STANDBY);
+ BIND_CORE_ENUM_CONSTANT(KEY_OPENURL);
+ BIND_CORE_ENUM_CONSTANT(KEY_LAUNCHMAIL);
+ BIND_CORE_ENUM_CONSTANT(KEY_LAUNCHMEDIA);
+ BIND_CORE_ENUM_CONSTANT(KEY_LAUNCH0);
+ BIND_CORE_ENUM_CONSTANT(KEY_LAUNCH1);
+ BIND_CORE_ENUM_CONSTANT(KEY_LAUNCH2);
+ BIND_CORE_ENUM_CONSTANT(KEY_LAUNCH3);
+ BIND_CORE_ENUM_CONSTANT(KEY_LAUNCH4);
+ BIND_CORE_ENUM_CONSTANT(KEY_LAUNCH5);
+ BIND_CORE_ENUM_CONSTANT(KEY_LAUNCH6);
+ BIND_CORE_ENUM_CONSTANT(KEY_LAUNCH7);
+ BIND_CORE_ENUM_CONSTANT(KEY_LAUNCH8);
+ BIND_CORE_ENUM_CONSTANT(KEY_LAUNCH9);
+ BIND_CORE_ENUM_CONSTANT(KEY_LAUNCHA);
+ BIND_CORE_ENUM_CONSTANT(KEY_LAUNCHB);
+ BIND_CORE_ENUM_CONSTANT(KEY_LAUNCHC);
+ BIND_CORE_ENUM_CONSTANT(KEY_LAUNCHD);
+ BIND_CORE_ENUM_CONSTANT(KEY_LAUNCHE);
+ BIND_CORE_ENUM_CONSTANT(KEY_LAUNCHF);
+
+ BIND_CORE_ENUM_CONSTANT(KEY_UNKNOWN);
+ BIND_CORE_ENUM_CONSTANT(KEY_SPACE);
+ BIND_CORE_ENUM_CONSTANT(KEY_EXCLAM);
+ BIND_CORE_ENUM_CONSTANT(KEY_QUOTEDBL);
+ BIND_CORE_ENUM_CONSTANT(KEY_NUMBERSIGN);
+ BIND_CORE_ENUM_CONSTANT(KEY_DOLLAR);
+ BIND_CORE_ENUM_CONSTANT(KEY_PERCENT);
+ BIND_CORE_ENUM_CONSTANT(KEY_AMPERSAND);
+ BIND_CORE_ENUM_CONSTANT(KEY_APOSTROPHE);
+ BIND_CORE_ENUM_CONSTANT(KEY_PARENLEFT);
+ BIND_CORE_ENUM_CONSTANT(KEY_PARENRIGHT);
+ BIND_CORE_ENUM_CONSTANT(KEY_ASTERISK);
+ BIND_CORE_ENUM_CONSTANT(KEY_PLUS);
+ BIND_CORE_ENUM_CONSTANT(KEY_COMMA);
+ BIND_CORE_ENUM_CONSTANT(KEY_MINUS);
+ BIND_CORE_ENUM_CONSTANT(KEY_PERIOD);
+ BIND_CORE_ENUM_CONSTANT(KEY_SLASH);
+ BIND_CORE_ENUM_CONSTANT(KEY_0);
+ BIND_CORE_ENUM_CONSTANT(KEY_1);
+ BIND_CORE_ENUM_CONSTANT(KEY_2);
+ BIND_CORE_ENUM_CONSTANT(KEY_3);
+ BIND_CORE_ENUM_CONSTANT(KEY_4);
+ BIND_CORE_ENUM_CONSTANT(KEY_5);
+ BIND_CORE_ENUM_CONSTANT(KEY_6);
+ BIND_CORE_ENUM_CONSTANT(KEY_7);
+ BIND_CORE_ENUM_CONSTANT(KEY_8);
+ BIND_CORE_ENUM_CONSTANT(KEY_9);
+ BIND_CORE_ENUM_CONSTANT(KEY_COLON);
+ BIND_CORE_ENUM_CONSTANT(KEY_SEMICOLON);
+ BIND_CORE_ENUM_CONSTANT(KEY_LESS);
+ BIND_CORE_ENUM_CONSTANT(KEY_EQUAL);
+ BIND_CORE_ENUM_CONSTANT(KEY_GREATER);
+ BIND_CORE_ENUM_CONSTANT(KEY_QUESTION);
+ BIND_CORE_ENUM_CONSTANT(KEY_AT);
+ BIND_CORE_ENUM_CONSTANT(KEY_A);
+ BIND_CORE_ENUM_CONSTANT(KEY_B);
+ BIND_CORE_ENUM_CONSTANT(KEY_C);
+ BIND_CORE_ENUM_CONSTANT(KEY_D);
+ BIND_CORE_ENUM_CONSTANT(KEY_E);
+ BIND_CORE_ENUM_CONSTANT(KEY_F);
+ BIND_CORE_ENUM_CONSTANT(KEY_G);
+ BIND_CORE_ENUM_CONSTANT(KEY_H);
+ BIND_CORE_ENUM_CONSTANT(KEY_I);
+ BIND_CORE_ENUM_CONSTANT(KEY_J);
+ BIND_CORE_ENUM_CONSTANT(KEY_K);
+ BIND_CORE_ENUM_CONSTANT(KEY_L);
+ BIND_CORE_ENUM_CONSTANT(KEY_M);
+ BIND_CORE_ENUM_CONSTANT(KEY_N);
+ BIND_CORE_ENUM_CONSTANT(KEY_O);
+ BIND_CORE_ENUM_CONSTANT(KEY_P);
+ BIND_CORE_ENUM_CONSTANT(KEY_Q);
+ BIND_CORE_ENUM_CONSTANT(KEY_R);
+ BIND_CORE_ENUM_CONSTANT(KEY_S);
+ BIND_CORE_ENUM_CONSTANT(KEY_T);
+ BIND_CORE_ENUM_CONSTANT(KEY_U);
+ BIND_CORE_ENUM_CONSTANT(KEY_V);
+ BIND_CORE_ENUM_CONSTANT(KEY_W);
+ BIND_CORE_ENUM_CONSTANT(KEY_X);
+ BIND_CORE_ENUM_CONSTANT(KEY_Y);
+ BIND_CORE_ENUM_CONSTANT(KEY_Z);
+ BIND_CORE_ENUM_CONSTANT(KEY_BRACKETLEFT);
+ BIND_CORE_ENUM_CONSTANT(KEY_BACKSLASH);
+ BIND_CORE_ENUM_CONSTANT(KEY_BRACKETRIGHT);
+ BIND_CORE_ENUM_CONSTANT(KEY_ASCIICIRCUM);
+ BIND_CORE_ENUM_CONSTANT(KEY_UNDERSCORE);
+ BIND_CORE_ENUM_CONSTANT(KEY_QUOTELEFT);
+ BIND_CORE_ENUM_CONSTANT(KEY_BRACELEFT);
+ BIND_CORE_ENUM_CONSTANT(KEY_BAR);
+ BIND_CORE_ENUM_CONSTANT(KEY_BRACERIGHT);
+ BIND_CORE_ENUM_CONSTANT(KEY_ASCIITILDE);
+ BIND_CORE_ENUM_CONSTANT(KEY_NOBREAKSPACE);
+ BIND_CORE_ENUM_CONSTANT(KEY_EXCLAMDOWN);
+ BIND_CORE_ENUM_CONSTANT(KEY_CENT);
+ BIND_CORE_ENUM_CONSTANT(KEY_STERLING);
+ BIND_CORE_ENUM_CONSTANT(KEY_CURRENCY);
+ BIND_CORE_ENUM_CONSTANT(KEY_YEN);
+ BIND_CORE_ENUM_CONSTANT(KEY_BROKENBAR);
+ BIND_CORE_ENUM_CONSTANT(KEY_SECTION);
+ BIND_CORE_ENUM_CONSTANT(KEY_DIAERESIS);
+ BIND_CORE_ENUM_CONSTANT(KEY_COPYRIGHT);
+ BIND_CORE_ENUM_CONSTANT(KEY_ORDFEMININE);
+ BIND_CORE_ENUM_CONSTANT(KEY_GUILLEMOTLEFT);
+ BIND_CORE_ENUM_CONSTANT(KEY_NOTSIGN);
+ BIND_CORE_ENUM_CONSTANT(KEY_HYPHEN);
+ BIND_CORE_ENUM_CONSTANT(KEY_REGISTERED);
+ BIND_CORE_ENUM_CONSTANT(KEY_MACRON);
+ BIND_CORE_ENUM_CONSTANT(KEY_DEGREE);
+ BIND_CORE_ENUM_CONSTANT(KEY_PLUSMINUS);
+ BIND_CORE_ENUM_CONSTANT(KEY_TWOSUPERIOR);
+ BIND_CORE_ENUM_CONSTANT(KEY_THREESUPERIOR);
+ BIND_CORE_ENUM_CONSTANT(KEY_ACUTE);
+ BIND_CORE_ENUM_CONSTANT(KEY_MU);
+ BIND_CORE_ENUM_CONSTANT(KEY_PARAGRAPH);
+ BIND_CORE_ENUM_CONSTANT(KEY_PERIODCENTERED);
+ BIND_CORE_ENUM_CONSTANT(KEY_CEDILLA);
+ BIND_CORE_ENUM_CONSTANT(KEY_ONESUPERIOR);
+ BIND_CORE_ENUM_CONSTANT(KEY_MASCULINE);
+ BIND_CORE_ENUM_CONSTANT(KEY_GUILLEMOTRIGHT);
+ BIND_CORE_ENUM_CONSTANT(KEY_ONEQUARTER);
+ BIND_CORE_ENUM_CONSTANT(KEY_ONEHALF);
+ BIND_CORE_ENUM_CONSTANT(KEY_THREEQUARTERS);
+ BIND_CORE_ENUM_CONSTANT(KEY_QUESTIONDOWN);
+ BIND_CORE_ENUM_CONSTANT(KEY_AGRAVE);
+ BIND_CORE_ENUM_CONSTANT(KEY_AACUTE);
+ BIND_CORE_ENUM_CONSTANT(KEY_ACIRCUMFLEX);
+ BIND_CORE_ENUM_CONSTANT(KEY_ATILDE);
+ BIND_CORE_ENUM_CONSTANT(KEY_ADIAERESIS);
+ BIND_CORE_ENUM_CONSTANT(KEY_ARING);
+ BIND_CORE_ENUM_CONSTANT(KEY_AE);
+ BIND_CORE_ENUM_CONSTANT(KEY_CCEDILLA);
+ BIND_CORE_ENUM_CONSTANT(KEY_EGRAVE);
+ BIND_CORE_ENUM_CONSTANT(KEY_EACUTE);
+ BIND_CORE_ENUM_CONSTANT(KEY_ECIRCUMFLEX);
+ BIND_CORE_ENUM_CONSTANT(KEY_EDIAERESIS);
+ BIND_CORE_ENUM_CONSTANT(KEY_IGRAVE);
+ BIND_CORE_ENUM_CONSTANT(KEY_IACUTE);
+ BIND_CORE_ENUM_CONSTANT(KEY_ICIRCUMFLEX);
+ BIND_CORE_ENUM_CONSTANT(KEY_IDIAERESIS);
+ BIND_CORE_ENUM_CONSTANT(KEY_ETH);
+ BIND_CORE_ENUM_CONSTANT(KEY_NTILDE);
+ BIND_CORE_ENUM_CONSTANT(KEY_OGRAVE);
+ BIND_CORE_ENUM_CONSTANT(KEY_OACUTE);
+ BIND_CORE_ENUM_CONSTANT(KEY_OCIRCUMFLEX);
+ BIND_CORE_ENUM_CONSTANT(KEY_OTILDE);
+ BIND_CORE_ENUM_CONSTANT(KEY_ODIAERESIS);
+ BIND_CORE_ENUM_CONSTANT(KEY_MULTIPLY);
+ BIND_CORE_ENUM_CONSTANT(KEY_OOBLIQUE);
+ BIND_CORE_ENUM_CONSTANT(KEY_UGRAVE);
+ BIND_CORE_ENUM_CONSTANT(KEY_UACUTE);
+ BIND_CORE_ENUM_CONSTANT(KEY_UCIRCUMFLEX);
+ BIND_CORE_ENUM_CONSTANT(KEY_UDIAERESIS);
+ BIND_CORE_ENUM_CONSTANT(KEY_YACUTE);
+ BIND_CORE_ENUM_CONSTANT(KEY_THORN);
+ BIND_CORE_ENUM_CONSTANT(KEY_SSHARP);
+
+ BIND_CORE_ENUM_CONSTANT(KEY_DIVISION);
+ BIND_CORE_ENUM_CONSTANT(KEY_YDIAERESIS);
+
+ BIND_CORE_ENUM_CONSTANT(KEY_CODE_MASK);
+ BIND_CORE_ENUM_CONSTANT(KEY_MODIFIER_MASK);
+
+ BIND_CORE_ENUM_CONSTANT(KEY_MASK_SHIFT);
+ BIND_CORE_ENUM_CONSTANT(KEY_MASK_ALT);
+ BIND_CORE_ENUM_CONSTANT(KEY_MASK_META);
+ BIND_CORE_ENUM_CONSTANT(KEY_MASK_CTRL);
+ BIND_CORE_ENUM_CONSTANT_NO_VAL(KEY_MASK_CMD);
+ BIND_CORE_ENUM_CONSTANT(KEY_MASK_KPAD);
+ BIND_CORE_ENUM_CONSTANT(KEY_MASK_GROUP_SWITCH);
+
+ // mouse
+ BIND_CORE_ENUM_CONSTANT(BUTTON_LEFT);
+ BIND_CORE_ENUM_CONSTANT(BUTTON_RIGHT);
+ BIND_CORE_ENUM_CONSTANT(BUTTON_MIDDLE);
+ BIND_CORE_ENUM_CONSTANT(BUTTON_XBUTTON1);
+ BIND_CORE_ENUM_CONSTANT(BUTTON_XBUTTON2);
+ BIND_CORE_ENUM_CONSTANT(BUTTON_WHEEL_UP);
+ BIND_CORE_ENUM_CONSTANT(BUTTON_WHEEL_DOWN);
+ BIND_CORE_ENUM_CONSTANT(BUTTON_WHEEL_LEFT);
+ BIND_CORE_ENUM_CONSTANT(BUTTON_WHEEL_RIGHT);
+ BIND_CORE_ENUM_CONSTANT(BUTTON_MASK_LEFT);
+ BIND_CORE_ENUM_CONSTANT(BUTTON_MASK_RIGHT);
+ BIND_CORE_ENUM_CONSTANT(BUTTON_MASK_MIDDLE);
+ BIND_CORE_ENUM_CONSTANT(BUTTON_MASK_XBUTTON1);
+ BIND_CORE_ENUM_CONSTANT(BUTTON_MASK_XBUTTON2);
+
+ // Joypad buttons
+ BIND_CORE_ENUM_CONSTANT(JOY_INVALID_BUTTON);
+ BIND_CORE_ENUM_CONSTANT(JOY_BUTTON_A);
+ BIND_CORE_ENUM_CONSTANT(JOY_BUTTON_B);
+ BIND_CORE_ENUM_CONSTANT(JOY_BUTTON_X);
+ BIND_CORE_ENUM_CONSTANT(JOY_BUTTON_Y);
+ BIND_CORE_ENUM_CONSTANT(JOY_BUTTON_BACK);
+ BIND_CORE_ENUM_CONSTANT(JOY_BUTTON_GUIDE);
+ BIND_CORE_ENUM_CONSTANT(JOY_BUTTON_START);
+ BIND_CORE_ENUM_CONSTANT(JOY_BUTTON_LEFT_STICK);
+ BIND_CORE_ENUM_CONSTANT(JOY_BUTTON_RIGHT_STICK);
+ BIND_CORE_ENUM_CONSTANT(JOY_BUTTON_LEFT_SHOULDER);
+ BIND_CORE_ENUM_CONSTANT(JOY_BUTTON_RIGHT_SHOULDER);
+ BIND_CORE_ENUM_CONSTANT(JOY_BUTTON_DPAD_UP);
+ BIND_CORE_ENUM_CONSTANT(JOY_BUTTON_DPAD_DOWN);
+ BIND_CORE_ENUM_CONSTANT(JOY_BUTTON_DPAD_LEFT);
+ BIND_CORE_ENUM_CONSTANT(JOY_BUTTON_DPAD_RIGHT);
+ BIND_CORE_ENUM_CONSTANT(JOY_SDL_BUTTONS);
+ BIND_CORE_ENUM_CONSTANT(JOY_SONY_X);
+ BIND_CORE_ENUM_CONSTANT(JOY_SONY_CROSS);
+ BIND_CORE_ENUM_CONSTANT(JOY_SONY_CIRCLE);
+ BIND_CORE_ENUM_CONSTANT(JOY_SONY_SQUARE);
+ BIND_CORE_ENUM_CONSTANT(JOY_SONY_TRIANGLE);
+ BIND_CORE_ENUM_CONSTANT(JOY_SONY_SELECT);
+ BIND_CORE_ENUM_CONSTANT(JOY_SONY_START);
+ BIND_CORE_ENUM_CONSTANT(JOY_SONY_PS);
+ BIND_CORE_ENUM_CONSTANT(JOY_SONY_L1);
+ BIND_CORE_ENUM_CONSTANT(JOY_SONY_R1);
+ BIND_CORE_ENUM_CONSTANT(JOY_SONY_L3);
+ BIND_CORE_ENUM_CONSTANT(JOY_SONY_R3);
+ BIND_CORE_ENUM_CONSTANT(JOY_XBOX_A);
+ BIND_CORE_ENUM_CONSTANT(JOY_XBOX_B);
+ BIND_CORE_ENUM_CONSTANT(JOY_XBOX_X);
+ BIND_CORE_ENUM_CONSTANT(JOY_XBOX_Y);
+ BIND_CORE_ENUM_CONSTANT(JOY_XBOX_BACK);
+ BIND_CORE_ENUM_CONSTANT(JOY_XBOX_START);
+ BIND_CORE_ENUM_CONSTANT(JOY_XBOX_HOME);
+ BIND_CORE_ENUM_CONSTANT(JOY_XBOX_LS);
+ BIND_CORE_ENUM_CONSTANT(JOY_XBOX_RS);
+ BIND_CORE_ENUM_CONSTANT(JOY_XBOX_LB);
+ BIND_CORE_ENUM_CONSTANT(JOY_XBOX_RB);
+ BIND_CORE_ENUM_CONSTANT(JOY_BUTTON_MAX);
+
+ // Joypad axes
+ BIND_CORE_ENUM_CONSTANT(JOY_INVALID_AXIS);
+ BIND_CORE_ENUM_CONSTANT(JOY_AXIS_LEFT_X);
+ BIND_CORE_ENUM_CONSTANT(JOY_AXIS_LEFT_Y);
+ BIND_CORE_ENUM_CONSTANT(JOY_AXIS_RIGHT_X);
+ BIND_CORE_ENUM_CONSTANT(JOY_AXIS_RIGHT_Y);
+ BIND_CORE_ENUM_CONSTANT(JOY_AXIS_TRIGGER_LEFT);
+ BIND_CORE_ENUM_CONSTANT(JOY_AXIS_TRIGGER_RIGHT);
+ BIND_CORE_ENUM_CONSTANT(JOY_SDL_AXES);
+ BIND_CORE_ENUM_CONSTANT(JOY_AXIS_0_X);
+ BIND_CORE_ENUM_CONSTANT(JOY_AXIS_0_Y);
+ BIND_CORE_ENUM_CONSTANT(JOY_AXIS_1_X);
+ BIND_CORE_ENUM_CONSTANT(JOY_AXIS_1_Y);
+ BIND_CORE_ENUM_CONSTANT(JOY_AXIS_2_X);
+ BIND_CORE_ENUM_CONSTANT(JOY_AXIS_2_Y);
+ BIND_CORE_ENUM_CONSTANT(JOY_AXIS_3_X);
+ BIND_CORE_ENUM_CONSTANT(JOY_AXIS_3_Y);
+ BIND_CORE_ENUM_CONSTANT(JOY_AXIS_4_X);
+ BIND_CORE_ENUM_CONSTANT(JOY_AXIS_4_Y);
+ BIND_CORE_ENUM_CONSTANT(JOY_AXIS_MAX);
+
+ // midi
+ BIND_CORE_ENUM_CONSTANT(MIDI_MESSAGE_NOTE_OFF);
+ BIND_CORE_ENUM_CONSTANT(MIDI_MESSAGE_NOTE_ON);
+ BIND_CORE_ENUM_CONSTANT(MIDI_MESSAGE_AFTERTOUCH);
+ BIND_CORE_ENUM_CONSTANT(MIDI_MESSAGE_CONTROL_CHANGE);
+ BIND_CORE_ENUM_CONSTANT(MIDI_MESSAGE_PROGRAM_CHANGE);
+ BIND_CORE_ENUM_CONSTANT(MIDI_MESSAGE_CHANNEL_PRESSURE);
+ BIND_CORE_ENUM_CONSTANT(MIDI_MESSAGE_PITCH_BEND);
+
+ // error list
+
+ BIND_CORE_ENUM_CONSTANT(OK); // (0)
+ BIND_CORE_ENUM_CONSTANT(FAILED);
+ BIND_CORE_ENUM_CONSTANT(ERR_UNAVAILABLE);
+ BIND_CORE_ENUM_CONSTANT(ERR_UNCONFIGURED);
+ BIND_CORE_ENUM_CONSTANT(ERR_UNAUTHORIZED);
+ BIND_CORE_ENUM_CONSTANT(ERR_PARAMETER_RANGE_ERROR); // (5)
+ BIND_CORE_ENUM_CONSTANT(ERR_OUT_OF_MEMORY);
+ BIND_CORE_ENUM_CONSTANT(ERR_FILE_NOT_FOUND);
+ BIND_CORE_ENUM_CONSTANT(ERR_FILE_BAD_DRIVE);
+ BIND_CORE_ENUM_CONSTANT(ERR_FILE_BAD_PATH);
+ BIND_CORE_ENUM_CONSTANT(ERR_FILE_NO_PERMISSION); // (10)
+ BIND_CORE_ENUM_CONSTANT(ERR_FILE_ALREADY_IN_USE);
+ BIND_CORE_ENUM_CONSTANT(ERR_FILE_CANT_OPEN);
+ BIND_CORE_ENUM_CONSTANT(ERR_FILE_CANT_WRITE);
+ BIND_CORE_ENUM_CONSTANT(ERR_FILE_CANT_READ);
+ BIND_CORE_ENUM_CONSTANT(ERR_FILE_UNRECOGNIZED); // (15)
+ BIND_CORE_ENUM_CONSTANT(ERR_FILE_CORRUPT);
+ BIND_CORE_ENUM_CONSTANT(ERR_FILE_MISSING_DEPENDENCIES);
+ BIND_CORE_ENUM_CONSTANT(ERR_FILE_EOF);
+ BIND_CORE_ENUM_CONSTANT(ERR_CANT_OPEN);
+ BIND_CORE_ENUM_CONSTANT(ERR_CANT_CREATE); // (20)
+ BIND_CORE_ENUM_CONSTANT(ERR_QUERY_FAILED);
+ BIND_CORE_ENUM_CONSTANT(ERR_ALREADY_IN_USE);
+ BIND_CORE_ENUM_CONSTANT(ERR_LOCKED);
+ BIND_CORE_ENUM_CONSTANT(ERR_TIMEOUT);
+ BIND_CORE_ENUM_CONSTANT(ERR_CANT_CONNECT); // (25)
+ BIND_CORE_ENUM_CONSTANT(ERR_CANT_RESOLVE);
+ BIND_CORE_ENUM_CONSTANT(ERR_CONNECTION_ERROR);
+ BIND_CORE_ENUM_CONSTANT(ERR_CANT_ACQUIRE_RESOURCE);
+ BIND_CORE_ENUM_CONSTANT(ERR_CANT_FORK);
+ BIND_CORE_ENUM_CONSTANT(ERR_INVALID_DATA); // (30)
+ BIND_CORE_ENUM_CONSTANT(ERR_INVALID_PARAMETER);
+ BIND_CORE_ENUM_CONSTANT(ERR_ALREADY_EXISTS);
+ BIND_CORE_ENUM_CONSTANT(ERR_DOES_NOT_EXIST);
+ BIND_CORE_ENUM_CONSTANT(ERR_DATABASE_CANT_READ);
+ BIND_CORE_ENUM_CONSTANT(ERR_DATABASE_CANT_WRITE); // (35)
+ BIND_CORE_ENUM_CONSTANT(ERR_COMPILATION_FAILED);
+ BIND_CORE_ENUM_CONSTANT(ERR_METHOD_NOT_FOUND);
+ BIND_CORE_ENUM_CONSTANT(ERR_LINK_FAILED);
+ BIND_CORE_ENUM_CONSTANT(ERR_SCRIPT_FAILED);
+ BIND_CORE_ENUM_CONSTANT(ERR_CYCLIC_LINK); // (40)
+ BIND_CORE_ENUM_CONSTANT(ERR_INVALID_DECLARATION);
+ BIND_CORE_ENUM_CONSTANT(ERR_DUPLICATE_SYMBOL);
+ BIND_CORE_ENUM_CONSTANT(ERR_PARSE_ERROR);
+ BIND_CORE_ENUM_CONSTANT(ERR_BUSY);
+ BIND_CORE_ENUM_CONSTANT(ERR_SKIP); // (45)
+ BIND_CORE_ENUM_CONSTANT(ERR_HELP);
+ BIND_CORE_ENUM_CONSTANT(ERR_BUG);
+ BIND_CORE_ENUM_CONSTANT(ERR_PRINTER_ON_FIRE);
+
+ BIND_CORE_ENUM_CONSTANT(PROPERTY_HINT_NONE);
+ BIND_CORE_ENUM_CONSTANT(PROPERTY_HINT_RANGE);
+ BIND_CORE_ENUM_CONSTANT(PROPERTY_HINT_EXP_RANGE);
+ BIND_CORE_ENUM_CONSTANT(PROPERTY_HINT_ENUM);
+ BIND_CORE_ENUM_CONSTANT(PROPERTY_HINT_EXP_EASING);
+ BIND_CORE_ENUM_CONSTANT(PROPERTY_HINT_LENGTH);
+ BIND_CORE_ENUM_CONSTANT(PROPERTY_HINT_KEY_ACCEL);
+ BIND_CORE_ENUM_CONSTANT(PROPERTY_HINT_FLAGS);
+
+ BIND_CORE_ENUM_CONSTANT(PROPERTY_HINT_LAYERS_2D_RENDER);
+ BIND_CORE_ENUM_CONSTANT(PROPERTY_HINT_LAYERS_2D_PHYSICS);
+ BIND_CORE_ENUM_CONSTANT(PROPERTY_HINT_LAYERS_3D_RENDER);
+ BIND_CORE_ENUM_CONSTANT(PROPERTY_HINT_LAYERS_3D_PHYSICS);
+
+ BIND_CORE_ENUM_CONSTANT(PROPERTY_HINT_FILE);
+ BIND_CORE_ENUM_CONSTANT(PROPERTY_HINT_DIR);
+ BIND_CORE_ENUM_CONSTANT(PROPERTY_HINT_GLOBAL_FILE);
+ BIND_CORE_ENUM_CONSTANT(PROPERTY_HINT_GLOBAL_DIR);
+ BIND_CORE_ENUM_CONSTANT(PROPERTY_HINT_RESOURCE_TYPE);
+ BIND_CORE_ENUM_CONSTANT(PROPERTY_HINT_MULTILINE_TEXT);
+ BIND_CORE_ENUM_CONSTANT(PROPERTY_HINT_PLACEHOLDER_TEXT);
+ BIND_CORE_ENUM_CONSTANT(PROPERTY_HINT_COLOR_NO_ALPHA);
+ BIND_CORE_ENUM_CONSTANT(PROPERTY_HINT_IMAGE_COMPRESS_LOSSY);
+ BIND_CORE_ENUM_CONSTANT(PROPERTY_HINT_IMAGE_COMPRESS_LOSSLESS);
+
+ BIND_CORE_ENUM_CONSTANT(PROPERTY_USAGE_STORAGE);
+ BIND_CORE_ENUM_CONSTANT(PROPERTY_USAGE_EDITOR);
+ BIND_CORE_ENUM_CONSTANT(PROPERTY_USAGE_NETWORK);
+
+ BIND_CORE_ENUM_CONSTANT(PROPERTY_USAGE_EDITOR_HELPER);
+ BIND_CORE_ENUM_CONSTANT(PROPERTY_USAGE_CHECKABLE);
+ BIND_CORE_ENUM_CONSTANT(PROPERTY_USAGE_CHECKED);
+ BIND_CORE_ENUM_CONSTANT(PROPERTY_USAGE_INTERNATIONALIZED);
+ BIND_CORE_ENUM_CONSTANT(PROPERTY_USAGE_GROUP);
+ BIND_CORE_ENUM_CONSTANT(PROPERTY_USAGE_CATEGORY);
+ BIND_CORE_ENUM_CONSTANT(PROPERTY_USAGE_SUBGROUP);
+ BIND_CORE_ENUM_CONSTANT(PROPERTY_USAGE_NO_INSTANCE_STATE);
+ BIND_CORE_ENUM_CONSTANT(PROPERTY_USAGE_RESTART_IF_CHANGED);
+ BIND_CORE_ENUM_CONSTANT(PROPERTY_USAGE_SCRIPT_VARIABLE);
+
+ BIND_CORE_ENUM_CONSTANT(PROPERTY_USAGE_DEFAULT);
+ BIND_CORE_ENUM_CONSTANT(PROPERTY_USAGE_DEFAULT_INTL);
+ BIND_CORE_ENUM_CONSTANT(PROPERTY_USAGE_NOEDITOR);
+
+ BIND_CORE_ENUM_CONSTANT(METHOD_FLAG_NORMAL);
+ BIND_CORE_ENUM_CONSTANT(METHOD_FLAG_EDITOR);
+ BIND_CORE_ENUM_CONSTANT(METHOD_FLAG_NOSCRIPT);
+ BIND_CORE_ENUM_CONSTANT(METHOD_FLAG_CONST);
+ BIND_CORE_ENUM_CONSTANT(METHOD_FLAG_REVERSE);
+ BIND_CORE_ENUM_CONSTANT(METHOD_FLAG_VIRTUAL);
+ BIND_CORE_ENUM_CONSTANT(METHOD_FLAG_FROM_SCRIPT);
+ BIND_CORE_ENUM_CONSTANT(METHOD_FLAGS_DEFAULT);
+
+ BIND_CORE_ENUM_CONSTANT_CUSTOM("TYPE_NIL", Variant::NIL);
+ BIND_CORE_ENUM_CONSTANT_CUSTOM("TYPE_BOOL", Variant::BOOL);
+ BIND_CORE_ENUM_CONSTANT_CUSTOM("TYPE_INT", Variant::INT);
+ BIND_CORE_ENUM_CONSTANT_CUSTOM("TYPE_REAL", Variant::FLOAT);
+ BIND_CORE_ENUM_CONSTANT_CUSTOM("TYPE_STRING", Variant::STRING);
+ BIND_CORE_ENUM_CONSTANT_CUSTOM("TYPE_VECTOR2", Variant::VECTOR2);
+ BIND_CORE_ENUM_CONSTANT_CUSTOM("TYPE_VECTOR2I", Variant::VECTOR2I);
+ BIND_CORE_ENUM_CONSTANT_CUSTOM("TYPE_RECT2", Variant::RECT2);
+ BIND_CORE_ENUM_CONSTANT_CUSTOM("TYPE_RECT2I", Variant::RECT2I);
+ BIND_CORE_ENUM_CONSTANT_CUSTOM("TYPE_VECTOR3", Variant::VECTOR3);
+ BIND_CORE_ENUM_CONSTANT_CUSTOM("TYPE_VECTOR3I", Variant::VECTOR3I);
+ BIND_CORE_ENUM_CONSTANT_CUSTOM("TYPE_TRANSFORM2D", Variant::TRANSFORM2D);
+ BIND_CORE_ENUM_CONSTANT_CUSTOM("TYPE_PLANE", Variant::PLANE);
+ BIND_CORE_ENUM_CONSTANT_CUSTOM("TYPE_QUAT", Variant::QUAT);
+ BIND_CORE_ENUM_CONSTANT_CUSTOM("TYPE_AABB", Variant::AABB);
+ BIND_CORE_ENUM_CONSTANT_CUSTOM("TYPE_BASIS", Variant::BASIS);
+ BIND_CORE_ENUM_CONSTANT_CUSTOM("TYPE_TRANSFORM", Variant::TRANSFORM);
+ BIND_CORE_ENUM_CONSTANT_CUSTOM("TYPE_COLOR", Variant::COLOR);
+ BIND_CORE_ENUM_CONSTANT_CUSTOM("TYPE_STRING_NAME", Variant::STRING_NAME);
+ BIND_CORE_ENUM_CONSTANT_CUSTOM("TYPE_NODE_PATH", Variant::NODE_PATH);
+ BIND_CORE_ENUM_CONSTANT_CUSTOM("TYPE_RID", Variant::RID);
+ BIND_CORE_ENUM_CONSTANT_CUSTOM("TYPE_OBJECT", Variant::OBJECT);
+ BIND_CORE_ENUM_CONSTANT_CUSTOM("TYPE_CALLABLE", Variant::CALLABLE);
+ BIND_CORE_ENUM_CONSTANT_CUSTOM("TYPE_SIGNAL", Variant::SIGNAL);
+ BIND_CORE_ENUM_CONSTANT_CUSTOM("TYPE_DICTIONARY", Variant::DICTIONARY);
+ BIND_CORE_ENUM_CONSTANT_CUSTOM("TYPE_ARRAY", Variant::ARRAY);
+ BIND_CORE_ENUM_CONSTANT_CUSTOM("TYPE_RAW_ARRAY", Variant::PACKED_BYTE_ARRAY);
+ BIND_CORE_ENUM_CONSTANT_CUSTOM("TYPE_INT32_ARRAY", Variant::PACKED_INT32_ARRAY);
+ BIND_CORE_ENUM_CONSTANT_CUSTOM("TYPE_INT64_ARRAY", Variant::PACKED_INT64_ARRAY);
+ BIND_CORE_ENUM_CONSTANT_CUSTOM("TYPE_FLOAT32_ARRAY", Variant::PACKED_FLOAT32_ARRAY);
+ BIND_CORE_ENUM_CONSTANT_CUSTOM("TYPE_FLOAT64_ARRAY", Variant::PACKED_FLOAT64_ARRAY);
+ BIND_CORE_ENUM_CONSTANT_CUSTOM("TYPE_STRING_ARRAY", Variant::PACKED_STRING_ARRAY);
+ BIND_CORE_ENUM_CONSTANT_CUSTOM("TYPE_VECTOR2_ARRAY", Variant::PACKED_VECTOR2_ARRAY);
+ BIND_CORE_ENUM_CONSTANT_CUSTOM("TYPE_VECTOR3_ARRAY", Variant::PACKED_VECTOR3_ARRAY);
+ BIND_CORE_ENUM_CONSTANT_CUSTOM("TYPE_COLOR_ARRAY", Variant::PACKED_COLOR_ARRAY);
+ BIND_CORE_ENUM_CONSTANT_CUSTOM("TYPE_MAX", Variant::VARIANT_MAX);
+
+ //comparison
+ BIND_CORE_ENUM_CONSTANT_CUSTOM("OP_EQUAL", Variant::OP_EQUAL);
+ BIND_CORE_ENUM_CONSTANT_CUSTOM("OP_NOT_EQUAL", Variant::OP_NOT_EQUAL);
+ BIND_CORE_ENUM_CONSTANT_CUSTOM("OP_LESS", Variant::OP_LESS);
+ BIND_CORE_ENUM_CONSTANT_CUSTOM("OP_LESS_EQUAL", Variant::OP_LESS_EQUAL);
+ BIND_CORE_ENUM_CONSTANT_CUSTOM("OP_GREATER", Variant::OP_GREATER);
+ BIND_CORE_ENUM_CONSTANT_CUSTOM("OP_GREATER_EQUAL", Variant::OP_GREATER_EQUAL);
+ //mathematic
+ BIND_CORE_ENUM_CONSTANT_CUSTOM("OP_ADD", Variant::OP_ADD);
+ BIND_CORE_ENUM_CONSTANT_CUSTOM("OP_SUBTRACT", Variant::OP_SUBTRACT);
+ BIND_CORE_ENUM_CONSTANT_CUSTOM("OP_MULTIPLY", Variant::OP_MULTIPLY);
+ BIND_CORE_ENUM_CONSTANT_CUSTOM("OP_DIVIDE", Variant::OP_DIVIDE);
+ BIND_CORE_ENUM_CONSTANT_CUSTOM("OP_NEGATE", Variant::OP_NEGATE);
+ BIND_CORE_ENUM_CONSTANT_CUSTOM("OP_POSITIVE", Variant::OP_POSITIVE);
+ BIND_CORE_ENUM_CONSTANT_CUSTOM("OP_MODULE", Variant::OP_MODULE);
+ //bitwise
+ BIND_CORE_ENUM_CONSTANT_CUSTOM("OP_SHIFT_LEFT", Variant::OP_SHIFT_LEFT);
+ BIND_CORE_ENUM_CONSTANT_CUSTOM("OP_SHIFT_RIGHT", Variant::OP_SHIFT_RIGHT);
+ BIND_CORE_ENUM_CONSTANT_CUSTOM("OP_BIT_AND", Variant::OP_BIT_AND);
+ BIND_CORE_ENUM_CONSTANT_CUSTOM("OP_BIT_OR", Variant::OP_BIT_OR);
+ BIND_CORE_ENUM_CONSTANT_CUSTOM("OP_BIT_XOR", Variant::OP_BIT_XOR);
+ BIND_CORE_ENUM_CONSTANT_CUSTOM("OP_BIT_NEGATE", Variant::OP_BIT_NEGATE);
+ //logic
+ BIND_CORE_ENUM_CONSTANT_CUSTOM("OP_AND", Variant::OP_AND);
+ BIND_CORE_ENUM_CONSTANT_CUSTOM("OP_OR", Variant::OP_OR);
+ BIND_CORE_ENUM_CONSTANT_CUSTOM("OP_XOR", Variant::OP_XOR);
+ BIND_CORE_ENUM_CONSTANT_CUSTOM("OP_NOT", Variant::OP_NOT);
+ //containment
+ BIND_CORE_ENUM_CONSTANT_CUSTOM("OP_IN", Variant::OP_IN);
+ BIND_CORE_ENUM_CONSTANT_CUSTOM("OP_MAX", Variant::OP_MAX);
+}
+
+void unregister_global_constants() {
+ _global_constants.clear();
+}
+
+int CoreConstants::get_global_constant_count() {
+ return _global_constants.size();
+}
+
+#ifdef DEBUG_METHODS_ENABLED
+StringName CoreConstants::get_global_constant_enum(int p_idx) {
+ return _global_constants[p_idx].enum_name;
+}
+
+bool CoreConstants::get_ignore_value_in_docs(int p_idx) {
+ return _global_constants[p_idx].ignore_value_in_docs;
+}
+#else
+StringName CoreConstants::get_global_constant_enum(int p_idx) {
+ return StringName();
+}
+
+bool CoreConstants::get_ignore_value_in_docs(int p_idx) {
+ return false;
+}
+#endif
+
+const char *CoreConstants::get_global_constant_name(int p_idx) {
+ return _global_constants[p_idx].name;
+}
+
+int CoreConstants::get_global_constant_value(int p_idx) {
+ return _global_constants[p_idx].value;
+}
diff --git a/core/global_constants.h b/core/core_constants.h
index 989633a6fa..6cddd9daec 100644
--- a/core/global_constants.h
+++ b/core/core_constants.h
@@ -1,5 +1,5 @@
/*************************************************************************/
-/* global_constants.h */
+/* core_constants.h */
/*************************************************************************/
/* This file is part of: */
/* GODOT ENGINE */
@@ -28,12 +28,12 @@
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
/*************************************************************************/
-#ifndef GLOBAL_CONSTANTS_H
-#define GLOBAL_CONSTANTS_H
+#ifndef CORE_CONSTANTS_H
+#define CORE_CONSTANTS_H
-#include "core/string_name.h"
+#include "core/string/string_name.h"
-class GlobalConstants {
+class CoreConstants {
public:
static int get_global_constant_count();
static StringName get_global_constant_enum(int p_idx);
diff --git a/core/core_string_names.h b/core/core_string_names.h
index 43597ef301..c0bdc33d28 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 "core/string_name.h"
+#include "core/string/string_name.h"
class CoreStringNames {
friend void register_core_types();
diff --git a/core/crypto/aes_context.h b/core/crypto/aes_context.h
index 006ecee2ad..c23c504a72 100644
--- a/core/crypto/aes_context.h
+++ b/core/crypto/aes_context.h
@@ -32,7 +32,7 @@
#define AES_CONTEXT_H
#include "core/crypto/crypto_core.h"
-#include "core/reference.h"
+#include "core/object/reference.h"
class AESContext : public Reference {
GDCLASS(AESContext, Reference);
diff --git a/core/crypto/crypto.cpp b/core/crypto/crypto.cpp
index 29d02e11df..d12108bca0 100644
--- a/core/crypto/crypto.cpp
+++ b/core/crypto/crypto.cpp
@@ -30,7 +30,7 @@
#include "crypto.h"
-#include "core/engine.h"
+#include "core/config/engine.h"
#include "core/io/certs_compressed.gen.h"
#include "core/io/compression.h"
diff --git a/core/crypto/crypto.h b/core/crypto/crypto.h
index 916f7798eb..8325f043bf 100644
--- a/core/crypto/crypto.h
+++ b/core/crypto/crypto.h
@@ -32,10 +32,10 @@
#define CRYPTO_H
#include "core/crypto/hashing_context.h"
+#include "core/io/resource.h"
#include "core/io/resource_loader.h"
#include "core/io/resource_saver.h"
-#include "core/reference.h"
-#include "core/resource.h"
+#include "core/object/reference.h"
class CryptoKey : public Resource {
GDCLASS(CryptoKey, Resource);
diff --git a/core/crypto/crypto_core.h b/core/crypto/crypto_core.h
index 9ab2871caa..57ba469f8d 100644
--- a/core/crypto/crypto_core.h
+++ b/core/crypto/crypto_core.h
@@ -31,7 +31,7 @@
#ifndef CRYPTO_CORE_H
#define CRYPTO_CORE_H
-#include "core/reference.h"
+#include "core/object/reference.h"
class CryptoCore {
public:
diff --git a/core/crypto/hashing_context.h b/core/crypto/hashing_context.h
index f9454fa891..40d075afa9 100644
--- a/core/crypto/hashing_context.h
+++ b/core/crypto/hashing_context.h
@@ -31,7 +31,7 @@
#ifndef HASHING_CONTEXT_H
#define HASHING_CONTEXT_H
-#include "core/reference.h"
+#include "core/object/reference.h"
class HashingContext : public Reference {
GDCLASS(HashingContext, Reference);
diff --git a/core/debugger/debugger_marshalls.h b/core/debugger/debugger_marshalls.h
index 7b7f4ac4b5..f5a1a891bf 100644
--- a/core/debugger/debugger_marshalls.h
+++ b/core/debugger/debugger_marshalls.h
@@ -31,7 +31,7 @@
#ifndef DEBUGGER_MARSHARLLS_H
#define DEBUGGER_MARSHARLLS_H
-#include "core/script_language.h"
+#include "core/object/script_language.h"
#include "servers/rendering_server.h"
struct DebuggerMarshalls {
diff --git a/core/debugger/engine_debugger.h b/core/debugger/engine_debugger.h
index 8d5ebb2394..10f04bf97a 100644
--- a/core/debugger/engine_debugger.h
+++ b/core/debugger/engine_debugger.h
@@ -31,12 +31,12 @@
#ifndef ENGINE_DEBUGGER_H
#define ENGINE_DEBUGGER_H
-#include "core/array.h"
-#include "core/map.h"
-#include "core/string_name.h"
-#include "core/ustring.h"
-#include "core/variant.h"
-#include "core/vector.h"
+#include "core/string/string_name.h"
+#include "core/string/ustring.h"
+#include "core/templates/map.h"
+#include "core/templates/vector.h"
+#include "core/variant/array.h"
+#include "core/variant/variant.h"
class RemoteDebuggerPeer;
class ScriptDebugger;
diff --git a/core/debugger/local_debugger.h b/core/debugger/local_debugger.h
index d342da6d44..dbdeec173b 100644
--- a/core/debugger/local_debugger.h
+++ b/core/debugger/local_debugger.h
@@ -32,8 +32,8 @@
#define LOCAL_DEBUGGER_H
#include "core/debugger/engine_debugger.h"
-#include "core/list.h"
-#include "core/script_language.h"
+#include "core/object/script_language.h"
+#include "core/templates/list.h"
class LocalDebugger : public EngineDebugger {
private:
diff --git a/core/debugger/remote_debugger.cpp b/core/debugger/remote_debugger.cpp
index 9d55e1312e..ff89517497 100644
--- a/core/debugger/remote_debugger.cpp
+++ b/core/debugger/remote_debugger.cpp
@@ -30,13 +30,13 @@
#include "remote_debugger.h"
+#include "core/config/project_settings.h"
#include "core/debugger/debugger_marshalls.h"
#include "core/debugger/engine_debugger.h"
#include "core/debugger/script_debugger.h"
#include "core/input/input.h"
+#include "core/object/script_language.h"
#include "core/os/os.h"
-#include "core/project_settings.h"
-#include "core/script_language.h"
#include "scene/main/node.h"
#include "servers/display_server.h"
diff --git a/core/debugger/remote_debugger.h b/core/debugger/remote_debugger.h
index 320ee15996..37cc8af2a5 100644
--- a/core/debugger/remote_debugger.h
+++ b/core/debugger/remote_debugger.h
@@ -31,13 +31,13 @@
#ifndef REMOTE_DEBUGGER_H
#define REMOTE_DEBUGGER_H
-#include "core/array.h"
-#include "core/class_db.h"
#include "core/debugger/debugger_marshalls.h"
#include "core/debugger/engine_debugger.h"
#include "core/debugger/remote_debugger_peer.h"
-#include "core/string_name.h"
-#include "core/ustring.h"
+#include "core/object/class_db.h"
+#include "core/string/string_name.h"
+#include "core/string/ustring.h"
+#include "core/variant/array.h"
class RemoteDebugger : public EngineDebugger {
public:
diff --git a/core/debugger/remote_debugger_peer.cpp b/core/debugger/remote_debugger_peer.cpp
index 0ce0042f50..338c637014 100644
--- a/core/debugger/remote_debugger_peer.cpp
+++ b/core/debugger/remote_debugger_peer.cpp
@@ -30,9 +30,9 @@
#include "remote_debugger_peer.h"
+#include "core/config/project_settings.h"
#include "core/io/marshalls.h"
#include "core/os/os.h"
-#include "core/project_settings.h"
bool RemoteDebuggerPeerTCP::is_peer_connected() {
return connected;
diff --git a/core/debugger/remote_debugger_peer.h b/core/debugger/remote_debugger_peer.h
index 3a75a2a02b..79b88f5549 100644
--- a/core/debugger/remote_debugger_peer.h
+++ b/core/debugger/remote_debugger_peer.h
@@ -32,10 +32,10 @@
#define REMOTE_DEBUGGER_PEER_H
#include "core/io/stream_peer_tcp.h"
+#include "core/object/reference.h"
#include "core/os/mutex.h"
#include "core/os/thread.h"
-#include "core/reference.h"
-#include "core/ustring.h"
+#include "core/string/ustring.h"
class RemoteDebuggerPeer : public Reference {
protected:
diff --git a/core/debugger/script_debugger.h b/core/debugger/script_debugger.h
index 0068691825..7f2f2becc2 100644
--- a/core/debugger/script_debugger.h
+++ b/core/debugger/script_debugger.h
@@ -31,11 +31,11 @@
#ifndef SCRIPT_DEBUGGER_H
#define SCRIPT_DEBUGGER_H
-#include "core/map.h"
-#include "core/script_language.h"
-#include "core/set.h"
-#include "core/string_name.h"
-#include "core/vector.h"
+#include "core/object/script_language.h"
+#include "core/string/string_name.h"
+#include "core/templates/map.h"
+#include "core/templates/set.h"
+#include "core/templates/vector.h"
class ScriptDebugger {
typedef ScriptLanguage::StackInfo StackInfo;
diff --git a/core/error/SCsub b/core/error/SCsub
new file mode 100644
index 0000000000..dfd6248a94
--- /dev/null
+++ b/core/error/SCsub
@@ -0,0 +1,7 @@
+#!/usr/bin/env python
+
+Import("env")
+
+env_error = env.Clone()
+
+env_error.add_source_files(env.core_sources, "*.cpp")
diff --git a/core/error_list.h b/core/error/error_list.h
index a0218cf045..a0218cf045 100644
--- a/core/error_list.h
+++ b/core/error/error_list.h
diff --git a/core/error_macros.cpp b/core/error/error_macros.cpp
index 2fae939965..80879dd25d 100644
--- a/core/error_macros.cpp
+++ b/core/error/error_macros.cpp
@@ -31,8 +31,8 @@
#include "error_macros.h"
#include "core/io/logger.h"
-#include "core/ustring.h"
-#include "os/os.h"
+#include "core/os/os.h"
+#include "core/string/ustring.h"
static ErrorHandlerList *error_handler_list = nullptr;
diff --git a/core/error_macros.h b/core/error/error_macros.h
index 6353961b04..6353961b04 100644
--- a/core/error_macros.h
+++ b/core/error/error_macros.h
diff --git a/core/func_ref.cpp b/core/func_ref.cpp
deleted file mode 100644
index 7e062f16d0..0000000000
--- a/core/func_ref.cpp
+++ /dev/null
@@ -1,101 +0,0 @@
-/*************************************************************************/
-/* func_ref.cpp */
-/*************************************************************************/
-/* This file is part of: */
-/* GODOT ENGINE */
-/* https://godotengine.org */
-/*************************************************************************/
-/* Copyright (c) 2007-2020 Juan Linietsky, Ariel Manzur. */
-/* Copyright (c) 2014-2020 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 "func_ref.h"
-
-Variant FuncRef::call_func(const Variant **p_args, int p_argcount, Callable::CallError &r_error) {
- if (id.is_null()) {
- r_error.error = Callable::CallError::CALL_ERROR_INSTANCE_IS_NULL;
- return Variant();
- }
- Object *obj = ObjectDB::get_instance(id);
-
- if (!obj) {
- r_error.error = Callable::CallError::CALL_ERROR_INSTANCE_IS_NULL;
- return Variant();
- }
-
- return obj->call(function, p_args, p_argcount, r_error);
-}
-
-Variant FuncRef::call_funcv(const Array &p_args) {
- ERR_FAIL_COND_V(id.is_null(), Variant());
-
- Object *obj = ObjectDB::get_instance(id);
-
- ERR_FAIL_COND_V(!obj, Variant());
-
- return obj->callv(function, p_args);
-}
-
-void FuncRef::set_instance(Object *p_obj) {
- ERR_FAIL_NULL(p_obj);
- id = p_obj->get_instance_id();
-}
-
-void FuncRef::set_function(const StringName &p_func) {
- function = p_func;
-}
-
-StringName FuncRef::get_function() {
- return function;
-}
-
-bool FuncRef::is_valid() const {
- if (id.is_null()) {
- return false;
- }
-
- Object *obj = ObjectDB::get_instance(id);
- if (!obj) {
- return false;
- }
-
- return obj->has_method(function);
-}
-
-void FuncRef::_bind_methods() {
- {
- MethodInfo mi;
- mi.name = "call_func";
- Vector<Variant> defargs;
- ClassDB::bind_vararg_method(METHOD_FLAGS_DEFAULT, "call_func", &FuncRef::call_func, mi, defargs);
- }
-
- ClassDB::bind_method(D_METHOD("call_funcv", "arg_array"), &FuncRef::call_funcv);
-
- ClassDB::bind_method(D_METHOD("set_instance", "instance"), &FuncRef::set_instance);
- ClassDB::bind_method(D_METHOD("is_valid"), &FuncRef::is_valid);
-
- ClassDB::bind_method(D_METHOD("set_function", "name"), &FuncRef::set_function);
- ClassDB::bind_method(D_METHOD("get_function"), &FuncRef::get_function);
-
- ADD_PROPERTY(PropertyInfo(Variant::STRING_NAME, "function"), "set_function", "get_function");
-}
diff --git a/core/func_ref.h b/core/func_ref.h
deleted file mode 100644
index 75b84e705e..0000000000
--- a/core/func_ref.h
+++ /dev/null
@@ -1,55 +0,0 @@
-/*************************************************************************/
-/* func_ref.h */
-/*************************************************************************/
-/* This file is part of: */
-/* GODOT ENGINE */
-/* https://godotengine.org */
-/*************************************************************************/
-/* Copyright (c) 2007-2020 Juan Linietsky, Ariel Manzur. */
-/* Copyright (c) 2014-2020 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 FUNC_REF_H
-#define FUNC_REF_H
-
-#include "core/reference.h"
-
-class FuncRef : public Reference {
- GDCLASS(FuncRef, Reference);
- ObjectID id;
- StringName function;
-
-protected:
- static void _bind_methods();
-
-public:
- Variant call_func(const Variant **p_args, int p_argcount, Callable::CallError &r_error);
- Variant call_funcv(const Array &p_args);
- void set_instance(Object *p_obj);
- void set_function(const StringName &p_func);
- StringName get_function();
- bool is_valid() const;
-
- FuncRef() {}
-};
-
-#endif // FUNC_REF_H
diff --git a/core/global_constants.cpp b/core/global_constants.cpp
deleted file mode 100644
index 064c302341..0000000000
--- a/core/global_constants.cpp
+++ /dev/null
@@ -1,691 +0,0 @@
-/*************************************************************************/
-/* global_constants.cpp */
-/*************************************************************************/
-/* This file is part of: */
-/* GODOT ENGINE */
-/* https://godotengine.org */
-/*************************************************************************/
-/* Copyright (c) 2007-2020 Juan Linietsky, Ariel Manzur. */
-/* Copyright (c) 2014-2020 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 "global_constants.h"
-
-#include "core/class_db.h"
-#include "core/input/input_event.h"
-#include "core/os/keyboard.h"
-#include "core/variant.h"
-
-struct _GlobalConstant {
-#ifdef DEBUG_METHODS_ENABLED
- StringName enum_name;
- bool ignore_value_in_docs;
-#endif
- const char *name;
- int value;
-
- _GlobalConstant() {}
-
-#ifdef DEBUG_METHODS_ENABLED
- _GlobalConstant(const StringName &p_enum_name, const char *p_name, int p_value, bool p_ignore_value_in_docs = false) :
- enum_name(p_enum_name),
- ignore_value_in_docs(p_ignore_value_in_docs),
- name(p_name),
- value(p_value) {
- }
-#else
- _GlobalConstant(const char *p_name, int p_value) :
- name(p_name),
- value(p_value) {
- }
-#endif
-};
-
-static Vector<_GlobalConstant> _global_constants;
-
-#ifdef DEBUG_METHODS_ENABLED
-
-#define BIND_GLOBAL_CONSTANT(m_constant) \
- _global_constants.push_back(_GlobalConstant(StringName(), #m_constant, m_constant));
-
-#define BIND_GLOBAL_ENUM_CONSTANT(m_constant) \
- _global_constants.push_back(_GlobalConstant(__constant_get_enum_name(m_constant, #m_constant), #m_constant, m_constant));
-
-#define BIND_GLOBAL_ENUM_CONSTANT_CUSTOM(m_custom_name, m_constant) \
- _global_constants.push_back(_GlobalConstant(__constant_get_enum_name(m_constant, #m_constant), m_custom_name, m_constant));
-
-#define BIND_GLOBAL_CONSTANT_NO_VAL(m_constant) \
- _global_constants.push_back(_GlobalConstant(StringName(), #m_constant, m_constant, true));
-
-#define BIND_GLOBAL_ENUM_CONSTANT_NO_VAL(m_constant) \
- _global_constants.push_back(_GlobalConstant(__constant_get_enum_name(m_constant, #m_constant), #m_constant, m_constant, true));
-
-#define BIND_GLOBAL_ENUM_CONSTANT_CUSTOM_NO_VAL(m_custom_name, m_constant) \
- _global_constants.push_back(_GlobalConstant(__constant_get_enum_name(m_constant, #m_constant), m_custom_name, m_constant, true));
-
-#else
-
-#define BIND_GLOBAL_CONSTANT(m_constant) \
- _global_constants.push_back(_GlobalConstant(#m_constant, m_constant));
-
-#define BIND_GLOBAL_ENUM_CONSTANT(m_constant) \
- _global_constants.push_back(_GlobalConstant(#m_constant, m_constant));
-
-#define BIND_GLOBAL_ENUM_CONSTANT_CUSTOM(m_custom_name, m_constant) \
- _global_constants.push_back(_GlobalConstant(m_custom_name, m_constant));
-
-#define BIND_GLOBAL_CONSTANT_NO_VAL(m_constant) \
- _global_constants.push_back(_GlobalConstant(#m_constant, m_constant));
-
-#define BIND_GLOBAL_ENUM_CONSTANT_NO_VAL(m_constant) \
- _global_constants.push_back(_GlobalConstant(#m_constant, m_constant));
-
-#define BIND_GLOBAL_ENUM_CONSTANT_CUSTOM_NO_VAL(m_custom_name, m_constant) \
- _global_constants.push_back(_GlobalConstant(m_custom_name, m_constant));
-
-#endif
-
-VARIANT_ENUM_CAST(KeyList);
-VARIANT_ENUM_CAST(KeyModifierMask);
-VARIANT_ENUM_CAST(ButtonList);
-VARIANT_ENUM_CAST(JoyButtonList);
-VARIANT_ENUM_CAST(JoyAxisList);
-VARIANT_ENUM_CAST(MidiMessageList);
-
-void register_global_constants() {
- BIND_GLOBAL_ENUM_CONSTANT(MARGIN_LEFT);
- BIND_GLOBAL_ENUM_CONSTANT(MARGIN_TOP);
- BIND_GLOBAL_ENUM_CONSTANT(MARGIN_RIGHT);
- BIND_GLOBAL_ENUM_CONSTANT(MARGIN_BOTTOM);
-
- BIND_GLOBAL_ENUM_CONSTANT(CORNER_TOP_LEFT);
- BIND_GLOBAL_ENUM_CONSTANT(CORNER_TOP_RIGHT);
- BIND_GLOBAL_ENUM_CONSTANT(CORNER_BOTTOM_RIGHT);
- BIND_GLOBAL_ENUM_CONSTANT(CORNER_BOTTOM_LEFT);
-
- BIND_GLOBAL_ENUM_CONSTANT(VERTICAL);
- BIND_GLOBAL_ENUM_CONSTANT(HORIZONTAL);
-
- BIND_GLOBAL_ENUM_CONSTANT(HALIGN_LEFT);
- BIND_GLOBAL_ENUM_CONSTANT(HALIGN_CENTER);
- BIND_GLOBAL_ENUM_CONSTANT(HALIGN_RIGHT);
-
- BIND_GLOBAL_ENUM_CONSTANT(VALIGN_TOP);
- BIND_GLOBAL_ENUM_CONSTANT(VALIGN_CENTER);
- BIND_GLOBAL_ENUM_CONSTANT(VALIGN_BOTTOM);
-
- // huge list of keys
- BIND_GLOBAL_CONSTANT(SPKEY);
-
- BIND_GLOBAL_ENUM_CONSTANT(KEY_ESCAPE);
- BIND_GLOBAL_ENUM_CONSTANT(KEY_TAB);
- BIND_GLOBAL_ENUM_CONSTANT(KEY_BACKTAB);
- BIND_GLOBAL_ENUM_CONSTANT(KEY_BACKSPACE);
- BIND_GLOBAL_ENUM_CONSTANT(KEY_ENTER);
- BIND_GLOBAL_ENUM_CONSTANT(KEY_KP_ENTER);
- BIND_GLOBAL_ENUM_CONSTANT(KEY_INSERT);
- BIND_GLOBAL_ENUM_CONSTANT(KEY_DELETE);
- BIND_GLOBAL_ENUM_CONSTANT(KEY_PAUSE);
- BIND_GLOBAL_ENUM_CONSTANT(KEY_PRINT);
- BIND_GLOBAL_ENUM_CONSTANT(KEY_SYSREQ);
- BIND_GLOBAL_ENUM_CONSTANT(KEY_CLEAR);
- BIND_GLOBAL_ENUM_CONSTANT(KEY_HOME);
- BIND_GLOBAL_ENUM_CONSTANT(KEY_END);
- BIND_GLOBAL_ENUM_CONSTANT(KEY_LEFT);
- BIND_GLOBAL_ENUM_CONSTANT(KEY_UP);
- BIND_GLOBAL_ENUM_CONSTANT(KEY_RIGHT);
- BIND_GLOBAL_ENUM_CONSTANT(KEY_DOWN);
- BIND_GLOBAL_ENUM_CONSTANT(KEY_PAGEUP);
- BIND_GLOBAL_ENUM_CONSTANT(KEY_PAGEDOWN);
- BIND_GLOBAL_ENUM_CONSTANT(KEY_SHIFT);
- BIND_GLOBAL_ENUM_CONSTANT(KEY_CONTROL);
- BIND_GLOBAL_ENUM_CONSTANT(KEY_META);
- BIND_GLOBAL_ENUM_CONSTANT(KEY_ALT);
- BIND_GLOBAL_ENUM_CONSTANT(KEY_CAPSLOCK);
- BIND_GLOBAL_ENUM_CONSTANT(KEY_NUMLOCK);
- BIND_GLOBAL_ENUM_CONSTANT(KEY_SCROLLLOCK);
- BIND_GLOBAL_ENUM_CONSTANT(KEY_F1);
- BIND_GLOBAL_ENUM_CONSTANT(KEY_F2);
- BIND_GLOBAL_ENUM_CONSTANT(KEY_F3);
- BIND_GLOBAL_ENUM_CONSTANT(KEY_F4);
- BIND_GLOBAL_ENUM_CONSTANT(KEY_F5);
- BIND_GLOBAL_ENUM_CONSTANT(KEY_F6);
- BIND_GLOBAL_ENUM_CONSTANT(KEY_F7);
- BIND_GLOBAL_ENUM_CONSTANT(KEY_F8);
- BIND_GLOBAL_ENUM_CONSTANT(KEY_F9);
- BIND_GLOBAL_ENUM_CONSTANT(KEY_F10);
- BIND_GLOBAL_ENUM_CONSTANT(KEY_F11);
- BIND_GLOBAL_ENUM_CONSTANT(KEY_F12);
- BIND_GLOBAL_ENUM_CONSTANT(KEY_F13);
- BIND_GLOBAL_ENUM_CONSTANT(KEY_F14);
- BIND_GLOBAL_ENUM_CONSTANT(KEY_F15);
- BIND_GLOBAL_ENUM_CONSTANT(KEY_F16);
- BIND_GLOBAL_ENUM_CONSTANT(KEY_KP_MULTIPLY);
- BIND_GLOBAL_ENUM_CONSTANT(KEY_KP_DIVIDE);
- BIND_GLOBAL_ENUM_CONSTANT(KEY_KP_SUBTRACT);
- BIND_GLOBAL_ENUM_CONSTANT(KEY_KP_PERIOD);
- BIND_GLOBAL_ENUM_CONSTANT(KEY_KP_ADD);
- BIND_GLOBAL_ENUM_CONSTANT(KEY_KP_0);
- BIND_GLOBAL_ENUM_CONSTANT(KEY_KP_1);
- BIND_GLOBAL_ENUM_CONSTANT(KEY_KP_2);
- BIND_GLOBAL_ENUM_CONSTANT(KEY_KP_3);
- BIND_GLOBAL_ENUM_CONSTANT(KEY_KP_4);
- BIND_GLOBAL_ENUM_CONSTANT(KEY_KP_5);
- BIND_GLOBAL_ENUM_CONSTANT(KEY_KP_6);
- BIND_GLOBAL_ENUM_CONSTANT(KEY_KP_7);
- BIND_GLOBAL_ENUM_CONSTANT(KEY_KP_8);
- BIND_GLOBAL_ENUM_CONSTANT(KEY_KP_9);
- BIND_GLOBAL_ENUM_CONSTANT(KEY_SUPER_L);
- BIND_GLOBAL_ENUM_CONSTANT(KEY_SUPER_R);
- BIND_GLOBAL_ENUM_CONSTANT(KEY_MENU);
- BIND_GLOBAL_ENUM_CONSTANT(KEY_HYPER_L);
- BIND_GLOBAL_ENUM_CONSTANT(KEY_HYPER_R);
- BIND_GLOBAL_ENUM_CONSTANT(KEY_HELP);
- BIND_GLOBAL_ENUM_CONSTANT(KEY_DIRECTION_L);
- BIND_GLOBAL_ENUM_CONSTANT(KEY_DIRECTION_R);
- BIND_GLOBAL_ENUM_CONSTANT(KEY_BACK);
- BIND_GLOBAL_ENUM_CONSTANT(KEY_FORWARD);
- BIND_GLOBAL_ENUM_CONSTANT(KEY_STOP);
- BIND_GLOBAL_ENUM_CONSTANT(KEY_REFRESH);
- BIND_GLOBAL_ENUM_CONSTANT(KEY_VOLUMEDOWN);
- BIND_GLOBAL_ENUM_CONSTANT(KEY_VOLUMEMUTE);
- BIND_GLOBAL_ENUM_CONSTANT(KEY_VOLUMEUP);
- BIND_GLOBAL_ENUM_CONSTANT(KEY_BASSBOOST);
- BIND_GLOBAL_ENUM_CONSTANT(KEY_BASSUP);
- BIND_GLOBAL_ENUM_CONSTANT(KEY_BASSDOWN);
- BIND_GLOBAL_ENUM_CONSTANT(KEY_TREBLEUP);
- BIND_GLOBAL_ENUM_CONSTANT(KEY_TREBLEDOWN);
- BIND_GLOBAL_ENUM_CONSTANT(KEY_MEDIAPLAY);
- BIND_GLOBAL_ENUM_CONSTANT(KEY_MEDIASTOP);
- BIND_GLOBAL_ENUM_CONSTANT(KEY_MEDIAPREVIOUS);
- BIND_GLOBAL_ENUM_CONSTANT(KEY_MEDIANEXT);
- BIND_GLOBAL_ENUM_CONSTANT(KEY_MEDIARECORD);
- BIND_GLOBAL_ENUM_CONSTANT(KEY_HOMEPAGE);
- BIND_GLOBAL_ENUM_CONSTANT(KEY_FAVORITES);
- BIND_GLOBAL_ENUM_CONSTANT(KEY_SEARCH);
- BIND_GLOBAL_ENUM_CONSTANT(KEY_STANDBY);
- BIND_GLOBAL_ENUM_CONSTANT(KEY_OPENURL);
- BIND_GLOBAL_ENUM_CONSTANT(KEY_LAUNCHMAIL);
- BIND_GLOBAL_ENUM_CONSTANT(KEY_LAUNCHMEDIA);
- BIND_GLOBAL_ENUM_CONSTANT(KEY_LAUNCH0);
- BIND_GLOBAL_ENUM_CONSTANT(KEY_LAUNCH1);
- BIND_GLOBAL_ENUM_CONSTANT(KEY_LAUNCH2);
- BIND_GLOBAL_ENUM_CONSTANT(KEY_LAUNCH3);
- BIND_GLOBAL_ENUM_CONSTANT(KEY_LAUNCH4);
- BIND_GLOBAL_ENUM_CONSTANT(KEY_LAUNCH5);
- BIND_GLOBAL_ENUM_CONSTANT(KEY_LAUNCH6);
- BIND_GLOBAL_ENUM_CONSTANT(KEY_LAUNCH7);
- BIND_GLOBAL_ENUM_CONSTANT(KEY_LAUNCH8);
- BIND_GLOBAL_ENUM_CONSTANT(KEY_LAUNCH9);
- BIND_GLOBAL_ENUM_CONSTANT(KEY_LAUNCHA);
- BIND_GLOBAL_ENUM_CONSTANT(KEY_LAUNCHB);
- BIND_GLOBAL_ENUM_CONSTANT(KEY_LAUNCHC);
- BIND_GLOBAL_ENUM_CONSTANT(KEY_LAUNCHD);
- BIND_GLOBAL_ENUM_CONSTANT(KEY_LAUNCHE);
- BIND_GLOBAL_ENUM_CONSTANT(KEY_LAUNCHF);
-
- BIND_GLOBAL_ENUM_CONSTANT(KEY_UNKNOWN);
- BIND_GLOBAL_ENUM_CONSTANT(KEY_SPACE);
- BIND_GLOBAL_ENUM_CONSTANT(KEY_EXCLAM);
- BIND_GLOBAL_ENUM_CONSTANT(KEY_QUOTEDBL);
- BIND_GLOBAL_ENUM_CONSTANT(KEY_NUMBERSIGN);
- BIND_GLOBAL_ENUM_CONSTANT(KEY_DOLLAR);
- BIND_GLOBAL_ENUM_CONSTANT(KEY_PERCENT);
- BIND_GLOBAL_ENUM_CONSTANT(KEY_AMPERSAND);
- BIND_GLOBAL_ENUM_CONSTANT(KEY_APOSTROPHE);
- BIND_GLOBAL_ENUM_CONSTANT(KEY_PARENLEFT);
- BIND_GLOBAL_ENUM_CONSTANT(KEY_PARENRIGHT);
- BIND_GLOBAL_ENUM_CONSTANT(KEY_ASTERISK);
- BIND_GLOBAL_ENUM_CONSTANT(KEY_PLUS);
- BIND_GLOBAL_ENUM_CONSTANT(KEY_COMMA);
- BIND_GLOBAL_ENUM_CONSTANT(KEY_MINUS);
- BIND_GLOBAL_ENUM_CONSTANT(KEY_PERIOD);
- BIND_GLOBAL_ENUM_CONSTANT(KEY_SLASH);
- BIND_GLOBAL_ENUM_CONSTANT(KEY_0);
- BIND_GLOBAL_ENUM_CONSTANT(KEY_1);
- BIND_GLOBAL_ENUM_CONSTANT(KEY_2);
- BIND_GLOBAL_ENUM_CONSTANT(KEY_3);
- BIND_GLOBAL_ENUM_CONSTANT(KEY_4);
- BIND_GLOBAL_ENUM_CONSTANT(KEY_5);
- BIND_GLOBAL_ENUM_CONSTANT(KEY_6);
- BIND_GLOBAL_ENUM_CONSTANT(KEY_7);
- BIND_GLOBAL_ENUM_CONSTANT(KEY_8);
- BIND_GLOBAL_ENUM_CONSTANT(KEY_9);
- BIND_GLOBAL_ENUM_CONSTANT(KEY_COLON);
- BIND_GLOBAL_ENUM_CONSTANT(KEY_SEMICOLON);
- BIND_GLOBAL_ENUM_CONSTANT(KEY_LESS);
- BIND_GLOBAL_ENUM_CONSTANT(KEY_EQUAL);
- BIND_GLOBAL_ENUM_CONSTANT(KEY_GREATER);
- BIND_GLOBAL_ENUM_CONSTANT(KEY_QUESTION);
- BIND_GLOBAL_ENUM_CONSTANT(KEY_AT);
- BIND_GLOBAL_ENUM_CONSTANT(KEY_A);
- BIND_GLOBAL_ENUM_CONSTANT(KEY_B);
- BIND_GLOBAL_ENUM_CONSTANT(KEY_C);
- BIND_GLOBAL_ENUM_CONSTANT(KEY_D);
- BIND_GLOBAL_ENUM_CONSTANT(KEY_E);
- BIND_GLOBAL_ENUM_CONSTANT(KEY_F);
- BIND_GLOBAL_ENUM_CONSTANT(KEY_G);
- BIND_GLOBAL_ENUM_CONSTANT(KEY_H);
- BIND_GLOBAL_ENUM_CONSTANT(KEY_I);
- BIND_GLOBAL_ENUM_CONSTANT(KEY_J);
- BIND_GLOBAL_ENUM_CONSTANT(KEY_K);
- BIND_GLOBAL_ENUM_CONSTANT(KEY_L);
- BIND_GLOBAL_ENUM_CONSTANT(KEY_M);
- BIND_GLOBAL_ENUM_CONSTANT(KEY_N);
- BIND_GLOBAL_ENUM_CONSTANT(KEY_O);
- BIND_GLOBAL_ENUM_CONSTANT(KEY_P);
- BIND_GLOBAL_ENUM_CONSTANT(KEY_Q);
- BIND_GLOBAL_ENUM_CONSTANT(KEY_R);
- BIND_GLOBAL_ENUM_CONSTANT(KEY_S);
- BIND_GLOBAL_ENUM_CONSTANT(KEY_T);
- BIND_GLOBAL_ENUM_CONSTANT(KEY_U);
- BIND_GLOBAL_ENUM_CONSTANT(KEY_V);
- BIND_GLOBAL_ENUM_CONSTANT(KEY_W);
- BIND_GLOBAL_ENUM_CONSTANT(KEY_X);
- BIND_GLOBAL_ENUM_CONSTANT(KEY_Y);
- BIND_GLOBAL_ENUM_CONSTANT(KEY_Z);
- BIND_GLOBAL_ENUM_CONSTANT(KEY_BRACKETLEFT);
- BIND_GLOBAL_ENUM_CONSTANT(KEY_BACKSLASH);
- BIND_GLOBAL_ENUM_CONSTANT(KEY_BRACKETRIGHT);
- BIND_GLOBAL_ENUM_CONSTANT(KEY_ASCIICIRCUM);
- BIND_GLOBAL_ENUM_CONSTANT(KEY_UNDERSCORE);
- BIND_GLOBAL_ENUM_CONSTANT(KEY_QUOTELEFT);
- BIND_GLOBAL_ENUM_CONSTANT(KEY_BRACELEFT);
- BIND_GLOBAL_ENUM_CONSTANT(KEY_BAR);
- BIND_GLOBAL_ENUM_CONSTANT(KEY_BRACERIGHT);
- BIND_GLOBAL_ENUM_CONSTANT(KEY_ASCIITILDE);
- BIND_GLOBAL_ENUM_CONSTANT(KEY_NOBREAKSPACE);
- BIND_GLOBAL_ENUM_CONSTANT(KEY_EXCLAMDOWN);
- BIND_GLOBAL_ENUM_CONSTANT(KEY_CENT);
- BIND_GLOBAL_ENUM_CONSTANT(KEY_STERLING);
- BIND_GLOBAL_ENUM_CONSTANT(KEY_CURRENCY);
- BIND_GLOBAL_ENUM_CONSTANT(KEY_YEN);
- BIND_GLOBAL_ENUM_CONSTANT(KEY_BROKENBAR);
- BIND_GLOBAL_ENUM_CONSTANT(KEY_SECTION);
- BIND_GLOBAL_ENUM_CONSTANT(KEY_DIAERESIS);
- BIND_GLOBAL_ENUM_CONSTANT(KEY_COPYRIGHT);
- BIND_GLOBAL_ENUM_CONSTANT(KEY_ORDFEMININE);
- BIND_GLOBAL_ENUM_CONSTANT(KEY_GUILLEMOTLEFT);
- BIND_GLOBAL_ENUM_CONSTANT(KEY_NOTSIGN);
- BIND_GLOBAL_ENUM_CONSTANT(KEY_HYPHEN);
- BIND_GLOBAL_ENUM_CONSTANT(KEY_REGISTERED);
- BIND_GLOBAL_ENUM_CONSTANT(KEY_MACRON);
- BIND_GLOBAL_ENUM_CONSTANT(KEY_DEGREE);
- BIND_GLOBAL_ENUM_CONSTANT(KEY_PLUSMINUS);
- BIND_GLOBAL_ENUM_CONSTANT(KEY_TWOSUPERIOR);
- BIND_GLOBAL_ENUM_CONSTANT(KEY_THREESUPERIOR);
- BIND_GLOBAL_ENUM_CONSTANT(KEY_ACUTE);
- BIND_GLOBAL_ENUM_CONSTANT(KEY_MU);
- BIND_GLOBAL_ENUM_CONSTANT(KEY_PARAGRAPH);
- BIND_GLOBAL_ENUM_CONSTANT(KEY_PERIODCENTERED);
- BIND_GLOBAL_ENUM_CONSTANT(KEY_CEDILLA);
- BIND_GLOBAL_ENUM_CONSTANT(KEY_ONESUPERIOR);
- BIND_GLOBAL_ENUM_CONSTANT(KEY_MASCULINE);
- BIND_GLOBAL_ENUM_CONSTANT(KEY_GUILLEMOTRIGHT);
- BIND_GLOBAL_ENUM_CONSTANT(KEY_ONEQUARTER);
- BIND_GLOBAL_ENUM_CONSTANT(KEY_ONEHALF);
- BIND_GLOBAL_ENUM_CONSTANT(KEY_THREEQUARTERS);
- BIND_GLOBAL_ENUM_CONSTANT(KEY_QUESTIONDOWN);
- BIND_GLOBAL_ENUM_CONSTANT(KEY_AGRAVE);
- BIND_GLOBAL_ENUM_CONSTANT(KEY_AACUTE);
- BIND_GLOBAL_ENUM_CONSTANT(KEY_ACIRCUMFLEX);
- BIND_GLOBAL_ENUM_CONSTANT(KEY_ATILDE);
- BIND_GLOBAL_ENUM_CONSTANT(KEY_ADIAERESIS);
- BIND_GLOBAL_ENUM_CONSTANT(KEY_ARING);
- BIND_GLOBAL_ENUM_CONSTANT(KEY_AE);
- BIND_GLOBAL_ENUM_CONSTANT(KEY_CCEDILLA);
- BIND_GLOBAL_ENUM_CONSTANT(KEY_EGRAVE);
- BIND_GLOBAL_ENUM_CONSTANT(KEY_EACUTE);
- BIND_GLOBAL_ENUM_CONSTANT(KEY_ECIRCUMFLEX);
- BIND_GLOBAL_ENUM_CONSTANT(KEY_EDIAERESIS);
- BIND_GLOBAL_ENUM_CONSTANT(KEY_IGRAVE);
- BIND_GLOBAL_ENUM_CONSTANT(KEY_IACUTE);
- BIND_GLOBAL_ENUM_CONSTANT(KEY_ICIRCUMFLEX);
- BIND_GLOBAL_ENUM_CONSTANT(KEY_IDIAERESIS);
- BIND_GLOBAL_ENUM_CONSTANT(KEY_ETH);
- BIND_GLOBAL_ENUM_CONSTANT(KEY_NTILDE);
- BIND_GLOBAL_ENUM_CONSTANT(KEY_OGRAVE);
- BIND_GLOBAL_ENUM_CONSTANT(KEY_OACUTE);
- BIND_GLOBAL_ENUM_CONSTANT(KEY_OCIRCUMFLEX);
- BIND_GLOBAL_ENUM_CONSTANT(KEY_OTILDE);
- BIND_GLOBAL_ENUM_CONSTANT(KEY_ODIAERESIS);
- BIND_GLOBAL_ENUM_CONSTANT(KEY_MULTIPLY);
- BIND_GLOBAL_ENUM_CONSTANT(KEY_OOBLIQUE);
- BIND_GLOBAL_ENUM_CONSTANT(KEY_UGRAVE);
- BIND_GLOBAL_ENUM_CONSTANT(KEY_UACUTE);
- BIND_GLOBAL_ENUM_CONSTANT(KEY_UCIRCUMFLEX);
- BIND_GLOBAL_ENUM_CONSTANT(KEY_UDIAERESIS);
- BIND_GLOBAL_ENUM_CONSTANT(KEY_YACUTE);
- BIND_GLOBAL_ENUM_CONSTANT(KEY_THORN);
- BIND_GLOBAL_ENUM_CONSTANT(KEY_SSHARP);
-
- BIND_GLOBAL_ENUM_CONSTANT(KEY_DIVISION);
- BIND_GLOBAL_ENUM_CONSTANT(KEY_YDIAERESIS);
-
- BIND_GLOBAL_ENUM_CONSTANT(KEY_CODE_MASK);
- BIND_GLOBAL_ENUM_CONSTANT(KEY_MODIFIER_MASK);
-
- BIND_GLOBAL_ENUM_CONSTANT(KEY_MASK_SHIFT);
- BIND_GLOBAL_ENUM_CONSTANT(KEY_MASK_ALT);
- BIND_GLOBAL_ENUM_CONSTANT(KEY_MASK_META);
- BIND_GLOBAL_ENUM_CONSTANT(KEY_MASK_CTRL);
- BIND_GLOBAL_ENUM_CONSTANT_NO_VAL(KEY_MASK_CMD);
- BIND_GLOBAL_ENUM_CONSTANT(KEY_MASK_KPAD);
- BIND_GLOBAL_ENUM_CONSTANT(KEY_MASK_GROUP_SWITCH);
-
- // mouse
- BIND_GLOBAL_ENUM_CONSTANT(BUTTON_LEFT);
- BIND_GLOBAL_ENUM_CONSTANT(BUTTON_RIGHT);
- BIND_GLOBAL_ENUM_CONSTANT(BUTTON_MIDDLE);
- BIND_GLOBAL_ENUM_CONSTANT(BUTTON_XBUTTON1);
- BIND_GLOBAL_ENUM_CONSTANT(BUTTON_XBUTTON2);
- BIND_GLOBAL_ENUM_CONSTANT(BUTTON_WHEEL_UP);
- BIND_GLOBAL_ENUM_CONSTANT(BUTTON_WHEEL_DOWN);
- BIND_GLOBAL_ENUM_CONSTANT(BUTTON_WHEEL_LEFT);
- BIND_GLOBAL_ENUM_CONSTANT(BUTTON_WHEEL_RIGHT);
- BIND_GLOBAL_ENUM_CONSTANT(BUTTON_MASK_LEFT);
- BIND_GLOBAL_ENUM_CONSTANT(BUTTON_MASK_RIGHT);
- BIND_GLOBAL_ENUM_CONSTANT(BUTTON_MASK_MIDDLE);
- BIND_GLOBAL_ENUM_CONSTANT(BUTTON_MASK_XBUTTON1);
- BIND_GLOBAL_ENUM_CONSTANT(BUTTON_MASK_XBUTTON2);
-
- // Joypad buttons
- BIND_GLOBAL_ENUM_CONSTANT(JOY_INVALID_BUTTON);
- BIND_GLOBAL_ENUM_CONSTANT(JOY_BUTTON_A);
- BIND_GLOBAL_ENUM_CONSTANT(JOY_BUTTON_B);
- BIND_GLOBAL_ENUM_CONSTANT(JOY_BUTTON_X);
- BIND_GLOBAL_ENUM_CONSTANT(JOY_BUTTON_Y);
- BIND_GLOBAL_ENUM_CONSTANT(JOY_BUTTON_BACK);
- BIND_GLOBAL_ENUM_CONSTANT(JOY_BUTTON_GUIDE);
- BIND_GLOBAL_ENUM_CONSTANT(JOY_BUTTON_START);
- BIND_GLOBAL_ENUM_CONSTANT(JOY_BUTTON_LEFT_STICK);
- BIND_GLOBAL_ENUM_CONSTANT(JOY_BUTTON_RIGHT_STICK);
- BIND_GLOBAL_ENUM_CONSTANT(JOY_BUTTON_LEFT_SHOULDER);
- BIND_GLOBAL_ENUM_CONSTANT(JOY_BUTTON_RIGHT_SHOULDER);
- BIND_GLOBAL_ENUM_CONSTANT(JOY_BUTTON_DPAD_UP);
- BIND_GLOBAL_ENUM_CONSTANT(JOY_BUTTON_DPAD_DOWN);
- BIND_GLOBAL_ENUM_CONSTANT(JOY_BUTTON_DPAD_LEFT);
- BIND_GLOBAL_ENUM_CONSTANT(JOY_BUTTON_DPAD_RIGHT);
- BIND_GLOBAL_ENUM_CONSTANT(JOY_SDL_BUTTONS);
- BIND_GLOBAL_ENUM_CONSTANT(JOY_SONY_X);
- BIND_GLOBAL_ENUM_CONSTANT(JOY_SONY_CROSS);
- BIND_GLOBAL_ENUM_CONSTANT(JOY_SONY_CIRCLE);
- BIND_GLOBAL_ENUM_CONSTANT(JOY_SONY_SQUARE);
- BIND_GLOBAL_ENUM_CONSTANT(JOY_SONY_TRIANGLE);
- BIND_GLOBAL_ENUM_CONSTANT(JOY_SONY_SELECT);
- BIND_GLOBAL_ENUM_CONSTANT(JOY_SONY_START);
- BIND_GLOBAL_ENUM_CONSTANT(JOY_SONY_PS);
- BIND_GLOBAL_ENUM_CONSTANT(JOY_SONY_L1);
- BIND_GLOBAL_ENUM_CONSTANT(JOY_SONY_R1);
- BIND_GLOBAL_ENUM_CONSTANT(JOY_SONY_L3);
- BIND_GLOBAL_ENUM_CONSTANT(JOY_SONY_R3);
- BIND_GLOBAL_ENUM_CONSTANT(JOY_XBOX_A);
- BIND_GLOBAL_ENUM_CONSTANT(JOY_XBOX_B);
- BIND_GLOBAL_ENUM_CONSTANT(JOY_XBOX_X);
- BIND_GLOBAL_ENUM_CONSTANT(JOY_XBOX_Y);
- BIND_GLOBAL_ENUM_CONSTANT(JOY_XBOX_BACK);
- BIND_GLOBAL_ENUM_CONSTANT(JOY_XBOX_START);
- BIND_GLOBAL_ENUM_CONSTANT(JOY_XBOX_HOME);
- BIND_GLOBAL_ENUM_CONSTANT(JOY_XBOX_LS);
- BIND_GLOBAL_ENUM_CONSTANT(JOY_XBOX_RS);
- BIND_GLOBAL_ENUM_CONSTANT(JOY_XBOX_LB);
- BIND_GLOBAL_ENUM_CONSTANT(JOY_XBOX_RB);
- BIND_GLOBAL_ENUM_CONSTANT(JOY_BUTTON_MAX);
-
- // Joypad axes
- BIND_GLOBAL_ENUM_CONSTANT(JOY_INVALID_AXIS);
- BIND_GLOBAL_ENUM_CONSTANT(JOY_AXIS_LEFT_X);
- BIND_GLOBAL_ENUM_CONSTANT(JOY_AXIS_LEFT_Y);
- BIND_GLOBAL_ENUM_CONSTANT(JOY_AXIS_RIGHT_X);
- BIND_GLOBAL_ENUM_CONSTANT(JOY_AXIS_RIGHT_Y);
- BIND_GLOBAL_ENUM_CONSTANT(JOY_AXIS_TRIGGER_LEFT);
- BIND_GLOBAL_ENUM_CONSTANT(JOY_AXIS_TRIGGER_RIGHT);
- BIND_GLOBAL_ENUM_CONSTANT(JOY_SDL_AXES);
- BIND_GLOBAL_ENUM_CONSTANT(JOY_AXIS_0_X);
- BIND_GLOBAL_ENUM_CONSTANT(JOY_AXIS_0_Y);
- BIND_GLOBAL_ENUM_CONSTANT(JOY_AXIS_1_X);
- BIND_GLOBAL_ENUM_CONSTANT(JOY_AXIS_1_Y);
- BIND_GLOBAL_ENUM_CONSTANT(JOY_AXIS_2_X);
- BIND_GLOBAL_ENUM_CONSTANT(JOY_AXIS_2_Y);
- BIND_GLOBAL_ENUM_CONSTANT(JOY_AXIS_3_X);
- BIND_GLOBAL_ENUM_CONSTANT(JOY_AXIS_3_Y);
- BIND_GLOBAL_ENUM_CONSTANT(JOY_AXIS_4_X);
- BIND_GLOBAL_ENUM_CONSTANT(JOY_AXIS_4_Y);
- BIND_GLOBAL_ENUM_CONSTANT(JOY_AXIS_MAX);
-
- // midi
- BIND_GLOBAL_ENUM_CONSTANT(MIDI_MESSAGE_NOTE_OFF);
- BIND_GLOBAL_ENUM_CONSTANT(MIDI_MESSAGE_NOTE_ON);
- BIND_GLOBAL_ENUM_CONSTANT(MIDI_MESSAGE_AFTERTOUCH);
- BIND_GLOBAL_ENUM_CONSTANT(MIDI_MESSAGE_CONTROL_CHANGE);
- BIND_GLOBAL_ENUM_CONSTANT(MIDI_MESSAGE_PROGRAM_CHANGE);
- BIND_GLOBAL_ENUM_CONSTANT(MIDI_MESSAGE_CHANNEL_PRESSURE);
- BIND_GLOBAL_ENUM_CONSTANT(MIDI_MESSAGE_PITCH_BEND);
-
- // error list
-
- BIND_GLOBAL_ENUM_CONSTANT(OK); // (0)
- BIND_GLOBAL_ENUM_CONSTANT(FAILED);
- BIND_GLOBAL_ENUM_CONSTANT(ERR_UNAVAILABLE);
- BIND_GLOBAL_ENUM_CONSTANT(ERR_UNCONFIGURED);
- BIND_GLOBAL_ENUM_CONSTANT(ERR_UNAUTHORIZED);
- BIND_GLOBAL_ENUM_CONSTANT(ERR_PARAMETER_RANGE_ERROR); // (5)
- BIND_GLOBAL_ENUM_CONSTANT(ERR_OUT_OF_MEMORY);
- BIND_GLOBAL_ENUM_CONSTANT(ERR_FILE_NOT_FOUND);
- BIND_GLOBAL_ENUM_CONSTANT(ERR_FILE_BAD_DRIVE);
- BIND_GLOBAL_ENUM_CONSTANT(ERR_FILE_BAD_PATH);
- BIND_GLOBAL_ENUM_CONSTANT(ERR_FILE_NO_PERMISSION); // (10)
- BIND_GLOBAL_ENUM_CONSTANT(ERR_FILE_ALREADY_IN_USE);
- BIND_GLOBAL_ENUM_CONSTANT(ERR_FILE_CANT_OPEN);
- BIND_GLOBAL_ENUM_CONSTANT(ERR_FILE_CANT_WRITE);
- BIND_GLOBAL_ENUM_CONSTANT(ERR_FILE_CANT_READ);
- BIND_GLOBAL_ENUM_CONSTANT(ERR_FILE_UNRECOGNIZED); // (15)
- BIND_GLOBAL_ENUM_CONSTANT(ERR_FILE_CORRUPT);
- BIND_GLOBAL_ENUM_CONSTANT(ERR_FILE_MISSING_DEPENDENCIES);
- BIND_GLOBAL_ENUM_CONSTANT(ERR_FILE_EOF);
- BIND_GLOBAL_ENUM_CONSTANT(ERR_CANT_OPEN);
- BIND_GLOBAL_ENUM_CONSTANT(ERR_CANT_CREATE); // (20)
- BIND_GLOBAL_ENUM_CONSTANT(ERR_QUERY_FAILED);
- BIND_GLOBAL_ENUM_CONSTANT(ERR_ALREADY_IN_USE);
- BIND_GLOBAL_ENUM_CONSTANT(ERR_LOCKED);
- BIND_GLOBAL_ENUM_CONSTANT(ERR_TIMEOUT);
- BIND_GLOBAL_ENUM_CONSTANT(ERR_CANT_CONNECT); // (25)
- BIND_GLOBAL_ENUM_CONSTANT(ERR_CANT_RESOLVE);
- BIND_GLOBAL_ENUM_CONSTANT(ERR_CONNECTION_ERROR);
- BIND_GLOBAL_ENUM_CONSTANT(ERR_CANT_ACQUIRE_RESOURCE);
- BIND_GLOBAL_ENUM_CONSTANT(ERR_CANT_FORK);
- BIND_GLOBAL_ENUM_CONSTANT(ERR_INVALID_DATA); // (30)
- BIND_GLOBAL_ENUM_CONSTANT(ERR_INVALID_PARAMETER);
- BIND_GLOBAL_ENUM_CONSTANT(ERR_ALREADY_EXISTS);
- BIND_GLOBAL_ENUM_CONSTANT(ERR_DOES_NOT_EXIST);
- BIND_GLOBAL_ENUM_CONSTANT(ERR_DATABASE_CANT_READ);
- BIND_GLOBAL_ENUM_CONSTANT(ERR_DATABASE_CANT_WRITE); // (35)
- BIND_GLOBAL_ENUM_CONSTANT(ERR_COMPILATION_FAILED);
- BIND_GLOBAL_ENUM_CONSTANT(ERR_METHOD_NOT_FOUND);
- BIND_GLOBAL_ENUM_CONSTANT(ERR_LINK_FAILED);
- BIND_GLOBAL_ENUM_CONSTANT(ERR_SCRIPT_FAILED);
- BIND_GLOBAL_ENUM_CONSTANT(ERR_CYCLIC_LINK); // (40)
- BIND_GLOBAL_ENUM_CONSTANT(ERR_INVALID_DECLARATION);
- BIND_GLOBAL_ENUM_CONSTANT(ERR_DUPLICATE_SYMBOL);
- BIND_GLOBAL_ENUM_CONSTANT(ERR_PARSE_ERROR);
- BIND_GLOBAL_ENUM_CONSTANT(ERR_BUSY);
- BIND_GLOBAL_ENUM_CONSTANT(ERR_SKIP); // (45)
- BIND_GLOBAL_ENUM_CONSTANT(ERR_HELP);
- BIND_GLOBAL_ENUM_CONSTANT(ERR_BUG);
- BIND_GLOBAL_ENUM_CONSTANT(ERR_PRINTER_ON_FIRE);
-
- BIND_GLOBAL_ENUM_CONSTANT(PROPERTY_HINT_NONE);
- BIND_GLOBAL_ENUM_CONSTANT(PROPERTY_HINT_RANGE);
- BIND_GLOBAL_ENUM_CONSTANT(PROPERTY_HINT_EXP_RANGE);
- BIND_GLOBAL_ENUM_CONSTANT(PROPERTY_HINT_ENUM);
- BIND_GLOBAL_ENUM_CONSTANT(PROPERTY_HINT_EXP_EASING);
- BIND_GLOBAL_ENUM_CONSTANT(PROPERTY_HINT_LENGTH);
- BIND_GLOBAL_ENUM_CONSTANT(PROPERTY_HINT_KEY_ACCEL);
- BIND_GLOBAL_ENUM_CONSTANT(PROPERTY_HINT_FLAGS);
-
- BIND_GLOBAL_ENUM_CONSTANT(PROPERTY_HINT_LAYERS_2D_RENDER);
- BIND_GLOBAL_ENUM_CONSTANT(PROPERTY_HINT_LAYERS_2D_PHYSICS);
- BIND_GLOBAL_ENUM_CONSTANT(PROPERTY_HINT_LAYERS_3D_RENDER);
- BIND_GLOBAL_ENUM_CONSTANT(PROPERTY_HINT_LAYERS_3D_PHYSICS);
-
- BIND_GLOBAL_ENUM_CONSTANT(PROPERTY_HINT_FILE);
- BIND_GLOBAL_ENUM_CONSTANT(PROPERTY_HINT_DIR);
- BIND_GLOBAL_ENUM_CONSTANT(PROPERTY_HINT_GLOBAL_FILE);
- BIND_GLOBAL_ENUM_CONSTANT(PROPERTY_HINT_GLOBAL_DIR);
- BIND_GLOBAL_ENUM_CONSTANT(PROPERTY_HINT_RESOURCE_TYPE);
- BIND_GLOBAL_ENUM_CONSTANT(PROPERTY_HINT_MULTILINE_TEXT);
- BIND_GLOBAL_ENUM_CONSTANT(PROPERTY_HINT_PLACEHOLDER_TEXT);
- BIND_GLOBAL_ENUM_CONSTANT(PROPERTY_HINT_COLOR_NO_ALPHA);
- BIND_GLOBAL_ENUM_CONSTANT(PROPERTY_HINT_IMAGE_COMPRESS_LOSSY);
- BIND_GLOBAL_ENUM_CONSTANT(PROPERTY_HINT_IMAGE_COMPRESS_LOSSLESS);
-
- BIND_GLOBAL_ENUM_CONSTANT(PROPERTY_USAGE_STORAGE);
- BIND_GLOBAL_ENUM_CONSTANT(PROPERTY_USAGE_EDITOR);
- BIND_GLOBAL_ENUM_CONSTANT(PROPERTY_USAGE_NETWORK);
-
- BIND_GLOBAL_ENUM_CONSTANT(PROPERTY_USAGE_EDITOR_HELPER);
- BIND_GLOBAL_ENUM_CONSTANT(PROPERTY_USAGE_CHECKABLE);
- BIND_GLOBAL_ENUM_CONSTANT(PROPERTY_USAGE_CHECKED);
- BIND_GLOBAL_ENUM_CONSTANT(PROPERTY_USAGE_INTERNATIONALIZED);
- BIND_GLOBAL_ENUM_CONSTANT(PROPERTY_USAGE_GROUP);
- BIND_GLOBAL_ENUM_CONSTANT(PROPERTY_USAGE_CATEGORY);
- BIND_GLOBAL_ENUM_CONSTANT(PROPERTY_USAGE_SUBGROUP);
- BIND_GLOBAL_ENUM_CONSTANT(PROPERTY_USAGE_NO_INSTANCE_STATE);
- BIND_GLOBAL_ENUM_CONSTANT(PROPERTY_USAGE_RESTART_IF_CHANGED);
- BIND_GLOBAL_ENUM_CONSTANT(PROPERTY_USAGE_SCRIPT_VARIABLE);
-
- BIND_GLOBAL_ENUM_CONSTANT(PROPERTY_USAGE_DEFAULT);
- BIND_GLOBAL_ENUM_CONSTANT(PROPERTY_USAGE_DEFAULT_INTL);
- BIND_GLOBAL_ENUM_CONSTANT(PROPERTY_USAGE_NOEDITOR);
-
- BIND_GLOBAL_ENUM_CONSTANT(METHOD_FLAG_NORMAL);
- BIND_GLOBAL_ENUM_CONSTANT(METHOD_FLAG_EDITOR);
- BIND_GLOBAL_ENUM_CONSTANT(METHOD_FLAG_NOSCRIPT);
- BIND_GLOBAL_ENUM_CONSTANT(METHOD_FLAG_CONST);
- BIND_GLOBAL_ENUM_CONSTANT(METHOD_FLAG_REVERSE);
- BIND_GLOBAL_ENUM_CONSTANT(METHOD_FLAG_VIRTUAL);
- BIND_GLOBAL_ENUM_CONSTANT(METHOD_FLAG_FROM_SCRIPT);
- BIND_GLOBAL_ENUM_CONSTANT(METHOD_FLAGS_DEFAULT);
-
- BIND_GLOBAL_ENUM_CONSTANT_CUSTOM("TYPE_NIL", Variant::NIL);
- BIND_GLOBAL_ENUM_CONSTANT_CUSTOM("TYPE_BOOL", Variant::BOOL);
- BIND_GLOBAL_ENUM_CONSTANT_CUSTOM("TYPE_INT", Variant::INT);
- BIND_GLOBAL_ENUM_CONSTANT_CUSTOM("TYPE_REAL", Variant::FLOAT);
- BIND_GLOBAL_ENUM_CONSTANT_CUSTOM("TYPE_STRING", Variant::STRING);
- BIND_GLOBAL_ENUM_CONSTANT_CUSTOM("TYPE_VECTOR2", Variant::VECTOR2);
- BIND_GLOBAL_ENUM_CONSTANT_CUSTOM("TYPE_VECTOR2I", Variant::VECTOR2I);
- BIND_GLOBAL_ENUM_CONSTANT_CUSTOM("TYPE_RECT2", Variant::RECT2);
- BIND_GLOBAL_ENUM_CONSTANT_CUSTOM("TYPE_RECT2I", Variant::RECT2I);
- BIND_GLOBAL_ENUM_CONSTANT_CUSTOM("TYPE_VECTOR3", Variant::VECTOR3);
- BIND_GLOBAL_ENUM_CONSTANT_CUSTOM("TYPE_VECTOR3I", Variant::VECTOR3I);
- BIND_GLOBAL_ENUM_CONSTANT_CUSTOM("TYPE_TRANSFORM2D", Variant::TRANSFORM2D);
- BIND_GLOBAL_ENUM_CONSTANT_CUSTOM("TYPE_PLANE", Variant::PLANE);
- BIND_GLOBAL_ENUM_CONSTANT_CUSTOM("TYPE_QUAT", Variant::QUAT);
- BIND_GLOBAL_ENUM_CONSTANT_CUSTOM("TYPE_AABB", Variant::AABB);
- BIND_GLOBAL_ENUM_CONSTANT_CUSTOM("TYPE_BASIS", Variant::BASIS);
- BIND_GLOBAL_ENUM_CONSTANT_CUSTOM("TYPE_TRANSFORM", Variant::TRANSFORM);
- BIND_GLOBAL_ENUM_CONSTANT_CUSTOM("TYPE_COLOR", Variant::COLOR);
- BIND_GLOBAL_ENUM_CONSTANT_CUSTOM("TYPE_STRING_NAME", Variant::STRING_NAME);
- BIND_GLOBAL_ENUM_CONSTANT_CUSTOM("TYPE_NODE_PATH", Variant::NODE_PATH);
- BIND_GLOBAL_ENUM_CONSTANT_CUSTOM("TYPE_RID", Variant::_RID);
- BIND_GLOBAL_ENUM_CONSTANT_CUSTOM("TYPE_OBJECT", Variant::OBJECT);
- BIND_GLOBAL_ENUM_CONSTANT_CUSTOM("TYPE_CALLABLE", Variant::CALLABLE);
- BIND_GLOBAL_ENUM_CONSTANT_CUSTOM("TYPE_SIGNAL", Variant::SIGNAL);
- BIND_GLOBAL_ENUM_CONSTANT_CUSTOM("TYPE_DICTIONARY", Variant::DICTIONARY);
- BIND_GLOBAL_ENUM_CONSTANT_CUSTOM("TYPE_ARRAY", Variant::ARRAY);
- BIND_GLOBAL_ENUM_CONSTANT_CUSTOM("TYPE_RAW_ARRAY", Variant::PACKED_BYTE_ARRAY);
- BIND_GLOBAL_ENUM_CONSTANT_CUSTOM("TYPE_INT32_ARRAY", Variant::PACKED_INT32_ARRAY);
- BIND_GLOBAL_ENUM_CONSTANT_CUSTOM("TYPE_INT64_ARRAY", Variant::PACKED_INT64_ARRAY);
- BIND_GLOBAL_ENUM_CONSTANT_CUSTOM("TYPE_FLOAT32_ARRAY", Variant::PACKED_FLOAT32_ARRAY);
- BIND_GLOBAL_ENUM_CONSTANT_CUSTOM("TYPE_FLOAT64_ARRAY", Variant::PACKED_FLOAT64_ARRAY);
- BIND_GLOBAL_ENUM_CONSTANT_CUSTOM("TYPE_STRING_ARRAY", Variant::PACKED_STRING_ARRAY);
- BIND_GLOBAL_ENUM_CONSTANT_CUSTOM("TYPE_VECTOR2_ARRAY", Variant::PACKED_VECTOR2_ARRAY);
- BIND_GLOBAL_ENUM_CONSTANT_CUSTOM("TYPE_VECTOR3_ARRAY", Variant::PACKED_VECTOR3_ARRAY);
- BIND_GLOBAL_ENUM_CONSTANT_CUSTOM("TYPE_COLOR_ARRAY", Variant::PACKED_COLOR_ARRAY);
- BIND_GLOBAL_ENUM_CONSTANT_CUSTOM("TYPE_MAX", Variant::VARIANT_MAX);
-
- //comparison
- BIND_GLOBAL_ENUM_CONSTANT_CUSTOM("OP_EQUAL", Variant::OP_EQUAL);
- BIND_GLOBAL_ENUM_CONSTANT_CUSTOM("OP_NOT_EQUAL", Variant::OP_NOT_EQUAL);
- BIND_GLOBAL_ENUM_CONSTANT_CUSTOM("OP_LESS", Variant::OP_LESS);
- BIND_GLOBAL_ENUM_CONSTANT_CUSTOM("OP_LESS_EQUAL", Variant::OP_LESS_EQUAL);
- BIND_GLOBAL_ENUM_CONSTANT_CUSTOM("OP_GREATER", Variant::OP_GREATER);
- BIND_GLOBAL_ENUM_CONSTANT_CUSTOM("OP_GREATER_EQUAL", Variant::OP_GREATER_EQUAL);
- //mathematic
- BIND_GLOBAL_ENUM_CONSTANT_CUSTOM("OP_ADD", Variant::OP_ADD);
- BIND_GLOBAL_ENUM_CONSTANT_CUSTOM("OP_SUBTRACT", Variant::OP_SUBTRACT);
- BIND_GLOBAL_ENUM_CONSTANT_CUSTOM("OP_MULTIPLY", Variant::OP_MULTIPLY);
- BIND_GLOBAL_ENUM_CONSTANT_CUSTOM("OP_DIVIDE", Variant::OP_DIVIDE);
- BIND_GLOBAL_ENUM_CONSTANT_CUSTOM("OP_NEGATE", Variant::OP_NEGATE);
- BIND_GLOBAL_ENUM_CONSTANT_CUSTOM("OP_POSITIVE", Variant::OP_POSITIVE);
- BIND_GLOBAL_ENUM_CONSTANT_CUSTOM("OP_MODULE", Variant::OP_MODULE);
- BIND_GLOBAL_ENUM_CONSTANT_CUSTOM("OP_STRING_CONCAT", Variant::OP_STRING_CONCAT);
- //bitwise
- BIND_GLOBAL_ENUM_CONSTANT_CUSTOM("OP_SHIFT_LEFT", Variant::OP_SHIFT_LEFT);
- BIND_GLOBAL_ENUM_CONSTANT_CUSTOM("OP_SHIFT_RIGHT", Variant::OP_SHIFT_RIGHT);
- BIND_GLOBAL_ENUM_CONSTANT_CUSTOM("OP_BIT_AND", Variant::OP_BIT_AND);
- BIND_GLOBAL_ENUM_CONSTANT_CUSTOM("OP_BIT_OR", Variant::OP_BIT_OR);
- BIND_GLOBAL_ENUM_CONSTANT_CUSTOM("OP_BIT_XOR", Variant::OP_BIT_XOR);
- BIND_GLOBAL_ENUM_CONSTANT_CUSTOM("OP_BIT_NEGATE", Variant::OP_BIT_NEGATE);
- //logic
- BIND_GLOBAL_ENUM_CONSTANT_CUSTOM("OP_AND", Variant::OP_AND);
- BIND_GLOBAL_ENUM_CONSTANT_CUSTOM("OP_OR", Variant::OP_OR);
- BIND_GLOBAL_ENUM_CONSTANT_CUSTOM("OP_XOR", Variant::OP_XOR);
- BIND_GLOBAL_ENUM_CONSTANT_CUSTOM("OP_NOT", Variant::OP_NOT);
- //containment
- BIND_GLOBAL_ENUM_CONSTANT_CUSTOM("OP_IN", Variant::OP_IN);
- BIND_GLOBAL_ENUM_CONSTANT_CUSTOM("OP_MAX", Variant::OP_MAX);
-}
-
-void unregister_global_constants() {
- _global_constants.clear();
-}
-
-int GlobalConstants::get_global_constant_count() {
- return _global_constants.size();
-}
-
-#ifdef DEBUG_METHODS_ENABLED
-StringName GlobalConstants::get_global_constant_enum(int p_idx) {
- return _global_constants[p_idx].enum_name;
-}
-
-bool GlobalConstants::get_ignore_value_in_docs(int p_idx) {
- return _global_constants[p_idx].ignore_value_in_docs;
-}
-#else
-StringName GlobalConstants::get_global_constant_enum(int p_idx) {
- return StringName();
-}
-
-bool GlobalConstants::get_ignore_value_in_docs(int p_idx) {
- return false;
-}
-#endif
-
-const char *GlobalConstants::get_global_constant_name(int p_idx) {
- return _global_constants[p_idx].name;
-}
-
-int GlobalConstants::get_global_constant_value(int p_idx) {
- return _global_constants[p_idx].value;
-}
diff --git a/core/input/input.cpp b/core/input/input.cpp
index b0b1d20222..ee66bf94cb 100644
--- a/core/input/input.cpp
+++ b/core/input/input.cpp
@@ -30,10 +30,10 @@
#include "input.h"
+#include "core/config/project_settings.h"
#include "core/input/default_controller_mappings.h"
#include "core/input/input_map.h"
#include "core/os/os.h"
-#include "core/project_settings.h"
#ifdef TOOLS_ENABLED
#include "editor/editor_settings.h"
diff --git a/core/input/input.h b/core/input/input.h
index 60e378d72c..98bbff6441 100644
--- a/core/input/input.h
+++ b/core/input/input.h
@@ -32,7 +32,7 @@
#define INPUT_H
#include "core/input/input_event.h"
-#include "core/object.h"
+#include "core/object/object.h"
#include "core/os/thread_safe.h"
class Input : public Object {
diff --git a/core/input/input_event.h b/core/input/input_event.h
index 815ba5ae80..8b58cf08c2 100644
--- a/core/input/input_event.h
+++ b/core/input/input_event.h
@@ -31,11 +31,11 @@
#ifndef INPUT_EVENT_H
#define INPUT_EVENT_H
+#include "core/io/resource.h"
#include "core/math/transform_2d.h"
#include "core/os/copymem.h"
-#include "core/resource.h"
+#include "core/string/ustring.h"
#include "core/typedefs.h"
-#include "core/ustring.h"
/**
* Input Event classes. These are used in the main loop.
diff --git a/core/input/input_map.cpp b/core/input/input_map.cpp
index 6319ffc8f1..ba1de3c58d 100644
--- a/core/input/input_map.cpp
+++ b/core/input/input_map.cpp
@@ -30,8 +30,8 @@
#include "input_map.h"
+#include "core/config/project_settings.h"
#include "core/os/keyboard.h"
-#include "core/project_settings.h"
InputMap *InputMap::singleton = nullptr;
diff --git a/core/input/input_map.h b/core/input/input_map.h
index 755df26984..35c65d0881 100644
--- a/core/input/input_map.h
+++ b/core/input/input_map.h
@@ -31,8 +31,8 @@
#ifndef INPUT_MAP_H
#define INPUT_MAP_H
-#include "core/class_db.h"
#include "core/input/input_event.h"
+#include "core/object/class_db.h"
class InputMap : public Object {
GDCLASS(InputMap, Object);
diff --git a/core/int_types.h b/core/int_types.h
deleted file mode 100644
index 71caa2202d..0000000000
--- a/core/int_types.h
+++ /dev/null
@@ -1,62 +0,0 @@
-/*************************************************************************/
-/* int_types.h */
-/*************************************************************************/
-/* This file is part of: */
-/* GODOT ENGINE */
-/* https://godotengine.org */
-/*************************************************************************/
-/* Copyright (c) 2007-2020 Juan Linietsky, Ariel Manzur. */
-/* Copyright (c) 2014-2020 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 INT_TYPES_H
-#define INT_TYPES_H
-
-#ifdef _MSC_VER
-
-typedef signed __int8 int8_t;
-typedef unsigned __int8 uint8_t;
-typedef signed __int16 int16_t;
-typedef unsigned __int16 uint16_t;
-typedef signed __int32 int32_t;
-typedef unsigned __int32 uint32_t;
-typedef signed __int64 int64_t;
-typedef unsigned __int64 uint64_t;
-
-#else
-
-#ifdef NO_STDINT_H
-typedef unsigned char uint8_t;
-typedef signed char int8_t;
-typedef unsigned short uint16_t;
-typedef signed short int16_t;
-typedef unsigned int uint32_t;
-typedef signed int int32_t;
-typedef long long int64_t;
-typedef unsigned long long uint64_t;
-#else
-#include <stdint.h>
-#endif
-
-#endif // _MSC_VER
-
-#endif // INT_TYPES_H
diff --git a/core/io/compression.cpp b/core/io/compression.cpp
index 7480262835..cd8793bb0a 100644
--- a/core/io/compression.cpp
+++ b/core/io/compression.cpp
@@ -30,9 +30,9 @@
#include "compression.h"
+#include "core/config/project_settings.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 c103fa8eae..864869788a 100644
--- a/core/io/compression.h
+++ b/core/io/compression.h
@@ -31,8 +31,8 @@
#ifndef COMPRESSION_H
#define COMPRESSION_H
+#include "core/templates/vector.h"
#include "core/typedefs.h"
-#include "core/vector.h"
class Compression {
public:
diff --git a/core/io/config_file.cpp b/core/io/config_file.cpp
index 1af9142317..8be39178db 100644
--- a/core/io/config_file.cpp
+++ b/core/io/config_file.cpp
@@ -32,7 +32,7 @@
#include "core/io/file_access_encrypted.h"
#include "core/os/keyboard.h"
-#include "core/variant_parser.h"
+#include "core/variant/variant_parser.h"
PackedStringArray ConfigFile::_get_sections() const {
List<String> s;
diff --git a/core/io/config_file.h b/core/io/config_file.h
index ae06960f02..1dc4492ca8 100644
--- a/core/io/config_file.h
+++ b/core/io/config_file.h
@@ -31,10 +31,10 @@
#ifndef CONFIG_FILE_H
#define CONFIG_FILE_H
-#include "core/ordered_hash_map.h"
+#include "core/object/reference.h"
#include "core/os/file_access.h"
-#include "core/reference.h"
-#include "core/variant_parser.h"
+#include "core/templates/ordered_hash_map.h"
+#include "core/variant/variant_parser.h"
class ConfigFile : public Reference {
GDCLASS(ConfigFile, Reference);
diff --git a/core/io/dtls_server.cpp b/core/io/dtls_server.cpp
index e43b1f5385..1930f40c47 100644
--- a/core/io/dtls_server.cpp
+++ b/core/io/dtls_server.cpp
@@ -30,8 +30,8 @@
#include "dtls_server.h"
+#include "core/config/project_settings.h"
#include "core/os/file_access.h"
-#include "core/project_settings.h"
DTLSServer *(*DTLSServer::_create)() = nullptr;
bool DTLSServer::available = false;
diff --git a/core/io/file_access_buffered.cpp b/core/io/file_access_buffered.cpp
index 6208f3a4d1..714f3b6099 100644
--- a/core/io/file_access_buffered.cpp
+++ b/core/io/file_access_buffered.cpp
@@ -30,7 +30,7 @@
#include "file_access_buffered.h"
-#include "core/error_macros.h"
+#include "core/error/error_macros.h"
Error FileAccessBuffered::set_error(Error p_error) const {
return (last_error = p_error);
diff --git a/core/io/file_access_buffered.h b/core/io/file_access_buffered.h
index 99d5ce903d..7fd99b6373 100644
--- a/core/io/file_access_buffered.h
+++ b/core/io/file_access_buffered.h
@@ -33,7 +33,7 @@
#include "core/os/file_access.h"
-#include "core/ustring.h"
+#include "core/string/ustring.h"
class FileAccessBuffered : public FileAccess {
public:
diff --git a/core/io/file_access_compressed.cpp b/core/io/file_access_compressed.cpp
index 7817ccb773..4424192af2 100644
--- a/core/io/file_access_compressed.cpp
+++ b/core/io/file_access_compressed.cpp
@@ -30,7 +30,7 @@
#include "file_access_compressed.h"
-#include "core/print_string.h"
+#include "core/string/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_encrypted.cpp b/core/io/file_access_encrypted.cpp
index eb684f457e..2ac24d5169 100644
--- a/core/io/file_access_encrypted.cpp
+++ b/core/io/file_access_encrypted.cpp
@@ -32,8 +32,8 @@
#include "core/crypto/crypto_core.h"
#include "core/os/copymem.h"
-#include "core/print_string.h"
-#include "core/variant.h"
+#include "core/string/print_string.h"
+#include "core/variant/variant.h"
#include <stdio.h>
diff --git a/core/io/file_access_memory.cpp b/core/io/file_access_memory.cpp
index a65ff92a89..79cba63765 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 "core/map.h"
+#include "core/config/project_settings.h"
#include "core/os/copymem.h"
#include "core/os/dir_access.h"
-#include "core/project_settings.h"
+#include "core/templates/map.h"
static Map<String, Vector<uint8_t>> *files = nullptr;
diff --git a/core/io/file_access_network.cpp b/core/io/file_access_network.cpp
index 6890740d90..1e9266f118 100644
--- a/core/io/file_access_network.cpp
+++ b/core/io/file_access_network.cpp
@@ -30,10 +30,10 @@
#include "file_access_network.h"
+#include "core/config/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());
diff --git a/core/io/file_access_pack.cpp b/core/io/file_access_pack.cpp
index 8fdbb650d4..b63e0adc45 100644
--- a/core/io/file_access_pack.cpp
+++ b/core/io/file_access_pack.cpp
@@ -31,7 +31,7 @@
#include "file_access_pack.h"
#include "core/io/file_access_encrypted.h"
-#include "core/script_language.h"
+#include "core/object/script_language.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 d934b0deb5..5c58dc01b4 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 "core/list.h"
-#include "core/map.h"
#include "core/os/dir_access.h"
#include "core/os/file_access.h"
-#include "core/print_string.h"
+#include "core/string/print_string.h"
+#include "core/templates/list.h"
+#include "core/templates/map.h"
// Godot's packed file magic header ("GDPC" in ASCII).
#define PACK_HEADER_MAGIC 0x43504447
diff --git a/core/io/file_access_zip.h b/core/io/file_access_zip.h
index c251b3c424..eff07c60e2 100644
--- a/core/io/file_access_zip.h
+++ b/core/io/file_access_zip.h
@@ -34,7 +34,7 @@
#ifdef MINIZIP_ENABLED
#include "core/io/file_access_pack.h"
-#include "core/map.h"
+#include "core/templates/map.h"
#include "thirdparty/minizip/unzip.h"
diff --git a/core/io/http_client.h b/core/io/http_client.h
index 1dc1f3d76a..ece7e1924b 100644
--- a/core/io/http_client.h
+++ b/core/io/http_client.h
@@ -34,7 +34,7 @@
#include "core/io/ip.h"
#include "core/io/stream_peer.h"
#include "core/io/stream_peer_tcp.h"
-#include "core/reference.h"
+#include "core/object/reference.h"
class HTTPClient : public Reference {
GDCLASS(HTTPClient, Reference);
@@ -182,7 +182,8 @@ private:
int response_num = 0;
Vector<String> response_headers;
- int read_chunk_size = 4096;
+ // 64 KiB by default (favors fast download speeds at the cost of memory usage).
+ int read_chunk_size = 65536;
Error _get_http_data(uint8_t *p_buffer, int p_bytes, int &r_received);
diff --git a/core/image.cpp b/core/io/image.cpp
index b8a443eed2..005fd481e8 100644
--- a/core/image.cpp
+++ b/core/io/image.cpp
@@ -30,13 +30,13 @@
#include "image.h"
-#include "core/error_macros.h"
-#include "core/hash_map.h"
+#include "core/error/error_macros.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 "core/print_string.h"
+#include "core/string/print_string.h"
+#include "core/templates/hash_map.h"
#include <stdio.h>
@@ -2711,6 +2711,7 @@ ImageMemLoadFunc Image::_png_mem_loader_func = nullptr;
ImageMemLoadFunc Image::_jpg_mem_loader_func = nullptr;
ImageMemLoadFunc Image::_webp_mem_loader_func = nullptr;
ImageMemLoadFunc Image::_tga_mem_loader_func = nullptr;
+ImageMemLoadFunc Image::_bmp_mem_loader_func = nullptr;
void (*Image::_image_compress_bc_func)(Image *, float, Image::UsedChannels) = nullptr;
void (*Image::_image_compress_bptc_func)(Image *, float, Image::UsedChannels) = nullptr;
@@ -3141,6 +3142,7 @@ void Image::_bind_methods() {
ClassDB::bind_method(D_METHOD("load_jpg_from_buffer", "buffer"), &Image::load_jpg_from_buffer);
ClassDB::bind_method(D_METHOD("load_webp_from_buffer", "buffer"), &Image::load_webp_from_buffer);
ClassDB::bind_method(D_METHOD("load_tga_from_buffer", "buffer"), &Image::load_tga_from_buffer);
+ ClassDB::bind_method(D_METHOD("load_bmp_from_buffer", "buffer"), &Image::load_bmp_from_buffer);
ADD_PROPERTY(PropertyInfo(Variant::DICTIONARY, "data", PROPERTY_HINT_NONE, "", PROPERTY_USAGE_STORAGE), "_set_data", "_get_data");
@@ -3473,10 +3475,21 @@ Error Image::load_webp_from_buffer(const Vector<uint8_t> &p_array) {
}
Error Image::load_tga_from_buffer(const Vector<uint8_t> &p_array) {
- ERR_FAIL_NULL_V_MSG(_tga_mem_loader_func, ERR_UNAVAILABLE, "TGA module was not installed.");
+ ERR_FAIL_NULL_V_MSG(
+ _tga_mem_loader_func,
+ ERR_UNAVAILABLE,
+ "The TGA module isn't enabled. Recompile the Godot editor or export template binary with the `module_tga_enabled=yes` SCons option.");
return _load_from_buffer(p_array, _tga_mem_loader_func);
}
+Error Image::load_bmp_from_buffer(const Vector<uint8_t> &p_array) {
+ ERR_FAIL_NULL_V_MSG(
+ _bmp_mem_loader_func,
+ ERR_UNAVAILABLE,
+ "The BMP module isn't enabled. Recompile the Godot editor or export template binary with the `module_bmp_enabled=yes` SCons option.");
+ return _load_from_buffer(p_array, _bmp_mem_loader_func);
+}
+
void Image::convert_rg_to_ra_rgba8() {
ERR_FAIL_COND(format != FORMAT_RGBA8);
ERR_FAIL_COND(!data.size());
diff --git a/core/image.h b/core/io/image.h
index 06794c7fed..fecb90cab0 100644
--- a/core/image.h
+++ b/core/io/image.h
@@ -31,9 +31,9 @@
#ifndef IMAGE_H
#define IMAGE_H
-#include "core/color.h"
+#include "core/io/resource.h"
+#include "core/math/color.h"
#include "core/math/rect2.h"
-#include "core/resource.h"
/**
* @author Juan Linietsky <reduzio@gmail.com>
@@ -136,6 +136,7 @@ public:
static ImageMemLoadFunc _jpg_mem_loader_func;
static ImageMemLoadFunc _webp_mem_loader_func;
static ImageMemLoadFunc _tga_mem_loader_func;
+ static ImageMemLoadFunc _bmp_mem_loader_func;
static void (*_image_compress_bc_func)(Image *, float, UsedChannels p_channels);
static void (*_image_compress_bptc_func)(Image *, float p_lossy_quality, UsedChannels p_channels);
@@ -375,6 +376,7 @@ public:
Error load_jpg_from_buffer(const Vector<uint8_t> &p_array);
Error load_webp_from_buffer(const Vector<uint8_t> &p_array);
Error load_tga_from_buffer(const Vector<uint8_t> &p_array);
+ Error load_bmp_from_buffer(const Vector<uint8_t> &p_array);
void convert_rg_to_ra_rgba8();
void convert_ra_rgba8_to_rg();
diff --git a/core/io/image_loader.cpp b/core/io/image_loader.cpp
index b1e92eb87f..f6d8668349 100644
--- a/core/io/image_loader.cpp
+++ b/core/io/image_loader.cpp
@@ -30,7 +30,7 @@
#include "image_loader.h"
-#include "core/print_string.h"
+#include "core/string/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 9682f144c7..d5fb4678eb 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 "core/image.h"
+#include "core/io/image.h"
#include "core/io/resource_loader.h"
-#include "core/list.h"
#include "core/os/file_access.h"
-#include "core/ustring.h"
+#include "core/string/ustring.h"
+#include "core/templates/list.h"
class ImageLoader;
diff --git a/core/io/ip.cpp b/core/io/ip.cpp
index 24b8ec7cc1..9f3540efad 100644
--- a/core/io/ip.cpp
+++ b/core/io/ip.cpp
@@ -30,9 +30,9 @@
#include "ip.h"
-#include "core/hash_map.h"
#include "core/os/semaphore.h"
#include "core/os/thread.h"
+#include "core/templates/hash_map.h"
VARIANT_ENUM_CAST(IP::ResolverStatus);
diff --git a/core/io/ip_address.h b/core/io/ip_address.h
index 2f8f83503e..7a813230f5 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 "core/ustring.h"
+#include "core/string/ustring.h"
struct IP_Address {
private:
diff --git a/core/io/json.cpp b/core/io/json.cpp
index 1b89d966fd..58bce1cf63 100644
--- a/core/io/json.cpp
+++ b/core/io/json.cpp
@@ -30,7 +30,7 @@
#include "json.h"
-#include "core/print_string.h"
+#include "core/string/print_string.h"
const char *JSON::tk_name[TK_MAX] = {
"'{'",
diff --git a/core/io/json.h b/core/io/json.h
index 9122228163..9fc6655fb4 100644
--- a/core/io/json.h
+++ b/core/io/json.h
@@ -31,7 +31,7 @@
#ifndef JSON_H
#define JSON_H
-#include "core/variant.h"
+#include "core/variant/variant.h"
class JSON {
enum TokenType {
diff --git a/core/io/logger.cpp b/core/io/logger.cpp
index 886e5695b1..0e6a2e2c9f 100644
--- a/core/io/logger.cpp
+++ b/core/io/logger.cpp
@@ -32,7 +32,7 @@
#include "core/os/dir_access.h"
#include "core/os/os.h"
-#include "core/print_string.h"
+#include "core/string/print_string.h"
#if defined(MINGW_ENABLED) || defined(_MSC_VER)
#define sprintf sprintf_s
diff --git a/core/io/logger.h b/core/io/logger.h
index 277be9ed35..9eaf506c51 100644
--- a/core/io/logger.h
+++ b/core/io/logger.h
@@ -32,8 +32,8 @@
#define LOGGER_H
#include "core/os/file_access.h"
-#include "core/ustring.h"
-#include "core/vector.h"
+#include "core/string/ustring.h"
+#include "core/templates/vector.h"
#include <stdarg.h>
diff --git a/core/io/marshalls.cpp b/core/io/marshalls.cpp
index eb39b1433f..3cf4acaf39 100644
--- a/core/io/marshalls.cpp
+++ b/core/io/marshalls.cpp
@@ -30,9 +30,9 @@
#include "marshalls.h"
+#include "core/object/reference.h"
#include "core/os/keyboard.h"
-#include "core/print_string.h"
-#include "core/reference.h"
+#include "core/string/print_string.h"
#include <limits.h>
#include <stdio.h>
@@ -420,7 +420,7 @@ Error decode_variant(Variant &r_variant, const uint8_t *p_buffer, int p_len, int
}
} break;
- case Variant::_RID: {
+ case Variant::RID: {
r_variant = RID();
} break;
case Variant::OBJECT: {
@@ -1172,7 +1172,7 @@ Error encode_variant(const Variant &p_variant, uint8_t *r_buffer, int &r_len, bo
r_len += 4 * 4;
} break;
- case Variant::_RID: {
+ case Variant::RID: {
} break;
case Variant::CALLABLE: {
} break;
diff --git a/core/io/marshalls.h b/core/io/marshalls.h
index c8ed497528..6969a9b500 100644
--- a/core/io/marshalls.h
+++ b/core/io/marshalls.h
@@ -31,9 +31,9 @@
#ifndef MARSHALLS_H
#define MARSHALLS_H
-#include "core/reference.h"
+#include "core/object/reference.h"
#include "core/typedefs.h"
-#include "core/variant.h"
+#include "core/variant/variant.h"
/**
* Miscellaneous helpers for marshalling data types, and encoding
diff --git a/core/io/multiplayer_api.h b/core/io/multiplayer_api.h
index 06eab7796c..e0ce1c8ca4 100644
--- a/core/io/multiplayer_api.h
+++ b/core/io/multiplayer_api.h
@@ -32,7 +32,7 @@
#define MULTIPLAYER_API_H
#include "core/io/networked_multiplayer_peer.h"
-#include "core/reference.h"
+#include "core/object/reference.h"
class MultiplayerAPI : public Reference {
GDCLASS(MultiplayerAPI, Reference);
diff --git a/core/io/net_socket.h b/core/io/net_socket.h
index 746945eced..67d0253985 100644
--- a/core/io/net_socket.h
+++ b/core/io/net_socket.h
@@ -32,7 +32,7 @@
#define NET_SOCKET_H
#include "core/io/ip.h"
-#include "core/reference.h"
+#include "core/object/reference.h"
class NetSocket : public Reference {
protected:
diff --git a/core/packed_data_container.cpp b/core/io/packed_data_container.cpp
index e335ec0daa..fbe8fa8a28 100644
--- a/core/packed_data_container.cpp
+++ b/core/io/packed_data_container.cpp
@@ -39,6 +39,9 @@ Variant PackedDataContainer::getvar(const Variant &p_key, bool *r_valid) const {
if (r_valid) {
*r_valid = !err;
}
+ if (err) {
+ return Object::getvar(p_key, r_valid);
+ }
return ret;
}
@@ -243,7 +246,7 @@ uint32_t PackedDataContainer::_pack(const Variant &p_data, Vector<uint8_t> &tmpd
} break;
// misc types
- case Variant::_RID:
+ case Variant::RID:
case Variant::OBJECT: {
return _pack(Variant(), tmpdata, string_cache);
} break;
diff --git a/core/packed_data_container.h b/core/io/packed_data_container.h
index 28ec9cc87c..b784abcd16 100644
--- a/core/packed_data_container.h
+++ b/core/io/packed_data_container.h
@@ -31,7 +31,7 @@
#ifndef PACKED_DATA_CONTAINER_H
#define PACKED_DATA_CONTAINER_H
-#include "core/resource.h"
+#include "core/io/resource.h"
class PackedDataContainer : public Resource {
GDCLASS(PackedDataContainer, Resource);
diff --git a/core/io/packet_peer.cpp b/core/io/packet_peer.cpp
index dacd548a3e..b6cc5bf42a 100644
--- a/core/io/packet_peer.cpp
+++ b/core/io/packet_peer.cpp
@@ -30,8 +30,8 @@
#include "packet_peer.h"
+#include "core/config/project_settings.h"
#include "core/io/marshalls.h"
-#include "core/project_settings.h"
/* helpers / binders */
diff --git a/core/io/packet_peer.h b/core/io/packet_peer.h
index fb4dc181db..f7f080aa43 100644
--- a/core/io/packet_peer.h
+++ b/core/io/packet_peer.h
@@ -31,9 +31,9 @@
#ifndef PACKET_PEER_H
#define PACKET_PEER_H
-#include "core/class_db.h"
#include "core/io/stream_peer.h"
-#include "core/ring_buffer.h"
+#include "core/object/class_db.h"
+#include "core/templates/ring_buffer.h"
class PacketPeer : public Reference {
GDCLASS(PacketPeer, Reference);
diff --git a/core/io/packet_peer_dtls.cpp b/core/io/packet_peer_dtls.cpp
index 632f86a9f6..9f6fccc993 100644
--- a/core/io/packet_peer_dtls.cpp
+++ b/core/io/packet_peer_dtls.cpp
@@ -29,8 +29,8 @@
/*************************************************************************/
#include "packet_peer_dtls.h"
+#include "core/config/project_settings.h"
#include "core/os/file_access.h"
-#include "core/project_settings.h"
PacketPeerDTLS *(*PacketPeerDTLS::_create)() = nullptr;
bool PacketPeerDTLS::available = false;
diff --git a/core/io/pck_packer.h b/core/io/pck_packer.h
index a6054dff2c..c1026c2499 100644
--- a/core/io/pck_packer.h
+++ b/core/io/pck_packer.h
@@ -31,7 +31,7 @@
#ifndef PCK_PACKER_H
#define PCK_PACKER_H
-#include "core/reference.h"
+#include "core/object/reference.h"
class FileAccess;
diff --git a/core/resource.cpp b/core/io/resource.cpp
index 3b589793ef..5b249f7af3 100644
--- a/core/resource.cpp
+++ b/core/io/resource.cpp
@@ -32,9 +32,9 @@
#include "core/core_string_names.h"
#include "core/io/resource_loader.h"
+#include "core/object/script_language.h"
#include "core/os/file_access.h"
#include "core/os/os.h"
-#include "core/script_language.h"
#include "scene/main/node.h" //only so casting works
#include <stdio.h>
diff --git a/core/resource.h b/core/io/resource.h
index 41707f216d..6e0bd7d7f4 100644
--- a/core/resource.h
+++ b/core/io/resource.h
@@ -31,10 +31,10 @@
#ifndef RESOURCE_H
#define RESOURCE_H
-#include "core/class_db.h"
-#include "core/reference.h"
-#include "core/safe_refcount.h"
-#include "core/self_list.h"
+#include "core/object/class_db.h"
+#include "core/object/reference.h"
+#include "core/templates/safe_refcount.h"
+#include "core/templates/self_list.h"
#define RES_BASE_EXTENSION(m_ext) \
public: \
diff --git a/core/io/resource_format_binary.cpp b/core/io/resource_format_binary.cpp
index 21de7835ce..c67e68e4fc 100644
--- a/core/io/resource_format_binary.cpp
+++ b/core/io/resource_format_binary.cpp
@@ -30,11 +30,11 @@
#include "resource_format_binary.h"
-#include "core/image.h"
+#include "core/config/project_settings.h"
#include "core/io/file_access_compressed.h"
+#include "core/io/image.h"
#include "core/io/marshalls.h"
#include "core/os/dir_access.h"
-#include "core/project_settings.h"
#include "core/version.h"
//#define print_bl(m_what) print_line(m_what)
@@ -1467,7 +1467,7 @@ void ResourceFormatSaverBinaryInstance::write_variant(FileAccess *f, const Varia
}
} break;
- case Variant::_RID: {
+ case Variant::RID: {
f->store_32(VARIANT_RID);
WARN_PRINT("Can't save RIDs.");
RID val = p_property;
diff --git a/core/io/resource_importer.cpp b/core/io/resource_importer.cpp
index 4d980bcf1a..c88331cf9e 100644
--- a/core/io/resource_importer.cpp
+++ b/core/io/resource_importer.cpp
@@ -30,9 +30,9 @@
#include "resource_importer.h"
+#include "core/config/project_settings.h"
#include "core/os/os.h"
-#include "core/project_settings.h"
-#include "core/variant_parser.h"
+#include "core/variant/variant_parser.h"
bool ResourceFormatImporter::SortImporterByName::operator()(const Ref<ResourceImporter> &p_a, const Ref<ResourceImporter> &p_b) const {
return p_a->get_importer_name() < p_b->get_importer_name();
diff --git a/core/io/resource_loader.cpp b/core/io/resource_loader.cpp
index b5c598e860..9991ee405e 100644
--- a/core/io/resource_loader.cpp
+++ b/core/io/resource_loader.cpp
@@ -30,13 +30,13 @@
#include "resource_loader.h"
+#include "core/config/project_settings.h"
#include "core/io/resource_importer.h"
#include "core/os/file_access.h"
#include "core/os/os.h"
-#include "core/print_string.h"
-#include "core/project_settings.h"
-#include "core/translation.h"
-#include "core/variant_parser.h"
+#include "core/string/print_string.h"
+#include "core/string/translation.h"
+#include "core/variant/variant_parser.h"
#ifdef DEBUG_LOAD_THREADED
#define print_lt(m_text) print_line(m_text)
diff --git a/core/io/resource_loader.h b/core/io/resource_loader.h
index 9322b5273a..02c668f214 100644
--- a/core/io/resource_loader.h
+++ b/core/io/resource_loader.h
@@ -31,9 +31,9 @@
#ifndef RESOURCE_LOADER_H
#define RESOURCE_LOADER_H
+#include "core/io/resource.h"
#include "core/os/semaphore.h"
#include "core/os/thread.h"
-#include "core/resource.h"
class ResourceFormatLoader : public Reference {
GDCLASS(ResourceFormatLoader, Reference);
diff --git a/core/io/resource_saver.cpp b/core/io/resource_saver.cpp
index a8da215b61..2eac2a6b4d 100644
--- a/core/io/resource_saver.cpp
+++ b/core/io/resource_saver.cpp
@@ -29,10 +29,10 @@
/*************************************************************************/
#include "resource_saver.h"
+#include "core/config/project_settings.h"
#include "core/io/resource_loader.h"
+#include "core/object/script_language.h"
#include "core/os/file_access.h"
-#include "core/project_settings.h"
-#include "core/script_language.h"
Ref<ResourceFormatSaver> ResourceSaver::saver[MAX_SAVERS];
diff --git a/core/io/resource_saver.h b/core/io/resource_saver.h
index 8b4cdd86f8..2e2950af53 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 "core/resource.h"
+#include "core/io/resource.h"
class ResourceFormatSaver : public Reference {
GDCLASS(ResourceFormatSaver, Reference);
diff --git a/core/io/stream_peer.h b/core/io/stream_peer.h
index 39097a57f2..8c1e918dd8 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 "core/reference.h"
+#include "core/object/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 3dc31c6769..daf36a5350 100644
--- a/core/io/stream_peer_ssl.cpp
+++ b/core/io/stream_peer_ssl.cpp
@@ -30,7 +30,7 @@
#include "stream_peer_ssl.h"
-#include "core/engine.h"
+#include "core/config/engine.h"
StreamPeerSSL *(*StreamPeerSSL::_create)() = nullptr;
diff --git a/core/io/stream_peer_tcp.cpp b/core/io/stream_peer_tcp.cpp
index cce728c30a..aa9c409528 100644
--- a/core/io/stream_peer_tcp.cpp
+++ b/core/io/stream_peer_tcp.cpp
@@ -30,7 +30,7 @@
#include "stream_peer_tcp.h"
-#include "core/project_settings.h"
+#include "core/config/project_settings.h"
Error StreamPeerTCP::_poll_connection() {
ERR_FAIL_COND_V(status != STATUS_CONNECTING || !_sock.is_valid() || !_sock->is_open(), FAILED);
diff --git a/core/io/translation_loader_po.cpp b/core/io/translation_loader_po.cpp
index d8ddb213c3..34cccca540 100644
--- a/core/io/translation_loader_po.cpp
+++ b/core/io/translation_loader_po.cpp
@@ -31,8 +31,8 @@
#include "translation_loader_po.h"
#include "core/os/file_access.h"
-#include "core/translation.h"
-#include "core/translation_po.h"
+#include "core/string/translation.h"
+#include "core/string/translation_po.h"
RES TranslationLoaderPO::load_translation(FileAccess *f, Error *r_error) {
enum Status {
diff --git a/core/io/translation_loader_po.h b/core/io/translation_loader_po.h
index a196a37dc0..16c9f1e680 100644
--- a/core/io/translation_loader_po.h
+++ b/core/io/translation_loader_po.h
@@ -33,7 +33,7 @@
#include "core/io/resource_loader.h"
#include "core/os/file_access.h"
-#include "core/translation.h"
+#include "core/string/translation.h"
class TranslationLoaderPO : public ResourceFormatLoader {
public:
diff --git a/core/io/xml_parser.cpp b/core/io/xml_parser.cpp
index fc75ac7d1e..85143c0f04 100644
--- a/core/io/xml_parser.cpp
+++ b/core/io/xml_parser.cpp
@@ -30,7 +30,7 @@
#include "xml_parser.h"
-#include "core/print_string.h"
+#include "core/string/print_string.h"
//#define DEBUG_XML
diff --git a/core/io/xml_parser.h b/core/io/xml_parser.h
index ee2174d52c..d8cc26b4c1 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 "core/object/reference.h"
#include "core/os/file_access.h"
-#include "core/reference.h"
-#include "core/ustring.h"
-#include "core/vector.h"
+#include "core/string/ustring.h"
+#include "core/templates/vector.h"
/*
Based on irrXML (see their zlib license). Added mainly for compatibility with their Collada loader.
diff --git a/core/math/a_star.cpp b/core/math/a_star.cpp
index 30f712b2c3..b4410acf7d 100644
--- a/core/math/a_star.cpp
+++ b/core/math/a_star.cpp
@@ -31,7 +31,7 @@
#include "a_star.h"
#include "core/math/geometry_3d.h"
-#include "core/script_language.h"
+#include "core/object/script_language.h"
#include "scene/scene_string_names.h"
int AStar::get_available_point_id() const {
diff --git a/core/math/a_star.h b/core/math/a_star.h
index ba1c3033b8..a6fa771b30 100644
--- a/core/math/a_star.h
+++ b/core/math/a_star.h
@@ -31,8 +31,8 @@
#ifndef A_STAR_H
#define A_STAR_H
-#include "core/oa_hash_map.h"
-#include "core/reference.h"
+#include "core/object/reference.h"
+#include "core/templates/oa_hash_map.h"
/**
A* pathfinding algorithm
diff --git a/core/math/aabb.cpp b/core/math/aabb.cpp
index e868ebc7c8..08673d0dd1 100644
--- a/core/math/aabb.cpp
+++ b/core/math/aabb.cpp
@@ -30,8 +30,8 @@
#include "aabb.h"
-#include "core/print_string.h"
-#include "core/variant.h"
+#include "core/string/print_string.h"
+#include "core/variant/variant.h"
real_t AABB::get_area() const {
return size.x * size.y * size.z;
diff --git a/core/math/aabb.h b/core/math/aabb.h
index 8c08754e1c..45dcbc7f7f 100644
--- a/core/math/aabb.h
+++ b/core/math/aabb.h
@@ -107,6 +107,14 @@ public:
Variant intersects_segment_bind(const Vector3 &p_from, const Vector3 &p_to) const;
Variant intersects_ray_bind(const Vector3 &p_from, const Vector3 &p_dir) const;
+ _FORCE_INLINE_ void set_end(const Vector3 &p_end) {
+ size = p_end - position;
+ }
+
+ _FORCE_INLINE_ Vector3 get_end() const {
+ return position + size;
+ }
+
operator String() const;
_FORCE_INLINE_ AABB() {}
diff --git a/core/math/basis.cpp b/core/math/basis.cpp
index a712ae7e3e..c6030d9757 100644
--- a/core/math/basis.cpp
+++ b/core/math/basis.cpp
@@ -32,7 +32,7 @@
#include "core/math/math_funcs.h"
#include "core/os/copymem.h"
-#include "core/print_string.h"
+#include "core/string/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/camera_matrix.cpp b/core/math/camera_matrix.cpp
index c154d57a13..5e5efb6356 100644
--- a/core/math/camera_matrix.cpp
+++ b/core/math/camera_matrix.cpp
@@ -31,7 +31,7 @@
#include "camera_matrix.h"
#include "core/math/math_funcs.h"
-#include "core/print_string.h"
+#include "core/string/print_string.h"
float CameraMatrix::determinant() const {
return matrix[0][3] * matrix[1][2] * matrix[2][1] * matrix[3][0] - matrix[0][2] * matrix[1][3] * matrix[2][1] * matrix[3][0] -
diff --git a/core/color.cpp b/core/math/color.cpp
index c61ee0e64a..2afe14bd63 100644
--- a/core/color.cpp
+++ b/core/math/color.cpp
@@ -30,10 +30,10 @@
#include "color.h"
-#include "core/color_names.inc"
-#include "core/map.h"
+#include "color_names.inc"
#include "core/math/math_funcs.h"
-#include "core/print_string.h"
+#include "core/string/print_string.h"
+#include "core/templates/map.h"
uint32_t Color::to_argb32() const {
uint32_t c = (uint8_t)Math::round(a * 255);
@@ -159,7 +159,7 @@ void Color::set_hsv(float p_h, float p_s, float p_v, float p_alpha) {
a = p_alpha;
if (p_s == 0) {
- // acp_hromatic (grey)
+ // Achromatic (grey)
r = g = b = p_v;
return;
}
@@ -217,12 +217,6 @@ void Color::invert() {
b = 1.0 - b;
}
-void Color::contrast() {
- r = Math::fmod(r + 0.5, 1.0);
- g = Math::fmod(g + 0.5, 1.0);
- b = Math::fmod(b + 0.5, 1.0);
-}
-
Color Color::hex(uint32_t p_hex) {
float a = (p_hex & 0xFF) / 255.0;
p_hex >>= 8;
@@ -284,12 +278,6 @@ Color Color::inverted() const {
return c;
}
-Color Color::contrasted() const {
- Color c = *this;
- c.contrast();
- return c;
-}
-
Color Color::html(const String &p_rgba) {
String color = p_rgba;
if (color.length() == 0) {
@@ -367,9 +355,6 @@ bool Color::html_is_valid(const String &p_color) {
}
Color Color::named(const String &p_name) {
- if (_named_colors.empty()) {
- _populate_named_colors(); // from color_names.inc
- }
String name = p_name;
// Normalize name
name = name.replace(" ", "");
@@ -379,9 +364,31 @@ Color Color::named(const String &p_name) {
name = name.replace(".", "");
name = name.to_lower();
- const Map<String, Color>::Element *color = _named_colors.find(name);
- ERR_FAIL_NULL_V_MSG(color, Color(), "Invalid color name: " + p_name + ".");
- return color->value();
+ int idx = 0;
+ while (named_colors[idx].name != nullptr) {
+ if (name == named_colors[idx].name) {
+ return named_colors[idx].color;
+ }
+ idx++;
+ }
+
+ ERR_FAIL_V_MSG(Color(), "Invalid color name: " + p_name + ".");
+
+ return Color();
+}
+
+int Color::get_named_color_count() {
+ int idx = 0;
+ while (named_colors[idx].name != nullptr) {
+ idx++;
+ }
+ return idx;
+}
+String Color::get_named_color_name(int p_idx) {
+ return named_colors[p_idx].name;
+}
+Color Color::get_named_color(int p_idx) {
+ return named_colors[p_idx].color;
}
String _to_hex(float p_val) {
@@ -482,6 +489,13 @@ Color Color::operator+(const Color &p_color) const {
a + p_color.a);
}
+void Color::operator+=(const Color &p_color) {
+ r = r + p_color.r;
+ g = g + p_color.g;
+ b = b + p_color.b;
+ a = a + p_color.a;
+}
+
Color Color::operator-(const Color &p_color) const {
return Color(
r - p_color.r,
@@ -505,12 +519,12 @@ Color Color::operator*(const Color &p_color) const {
a * p_color.a);
}
-Color Color::operator*(const real_t &rvalue) const {
+Color Color::operator*(real_t p_rvalue) const {
return Color(
- r * rvalue,
- g * rvalue,
- b * rvalue,
- a * rvalue);
+ r * p_rvalue,
+ g * p_rvalue,
+ b * p_rvalue,
+ a * p_rvalue);
}
void Color::operator*=(const Color &p_color) {
@@ -520,11 +534,11 @@ void Color::operator*=(const Color &p_color) {
a = a * p_color.a;
}
-void Color::operator*=(const real_t &rvalue) {
- r = r * rvalue;
- g = g * rvalue;
- b = b * rvalue;
- a = a * rvalue;
+void Color::operator*=(real_t p_rvalue) {
+ r = r * p_rvalue;
+ g = g * p_rvalue;
+ b = b * p_rvalue;
+ a = a * p_rvalue;
}
Color Color::operator/(const Color &p_color) const {
@@ -535,12 +549,12 @@ Color Color::operator/(const Color &p_color) const {
a / p_color.a);
}
-Color Color::operator/(const real_t &rvalue) const {
+Color Color::operator/(real_t p_rvalue) const {
return Color(
- r / rvalue,
- g / rvalue,
- b / rvalue,
- a / rvalue);
+ r / p_rvalue,
+ g / p_rvalue,
+ b / p_rvalue,
+ a / p_rvalue);
}
void Color::operator/=(const Color &p_color) {
@@ -550,17 +564,17 @@ void Color::operator/=(const Color &p_color) {
a = a / p_color.a;
}
-void Color::operator/=(const real_t &rvalue) {
- if (rvalue == 0) {
+void Color::operator/=(real_t p_rvalue) {
+ if (p_rvalue == 0) {
r = 1.0;
g = 1.0;
b = 1.0;
a = 1.0;
} else {
- r = r / rvalue;
- g = g / rvalue;
- b = b / rvalue;
- a = a / rvalue;
+ r = r / p_rvalue;
+ g = g / p_rvalue;
+ b = b / p_rvalue;
+ a = a / p_rvalue;
}
}
diff --git a/core/color.h b/core/math/color.h
index 2dbbc52905..a9be9e9035 100644
--- a/core/color.h
+++ b/core/math/color.h
@@ -32,7 +32,7 @@
#define COLOR_H
#include "core/math/math_funcs.h"
-#include "core/ustring.h"
+#include "core/string/ustring.h"
struct Color {
union {
@@ -45,9 +45,6 @@ struct Color {
float components[4] = { 0, 0, 0, 1.0 };
};
- bool operator==(const Color &p_color) const { return (r == p_color.r && g == p_color.g && b == p_color.b && a == p_color.a); }
- bool operator!=(const Color &p_color) const { return (r != p_color.r || g != p_color.g || b != p_color.b || a != p_color.a); }
-
uint32_t to_rgba32() const;
uint32_t to_argb32() const;
uint32_t to_abgr32() const;
@@ -59,41 +56,41 @@ struct Color {
float get_v() const;
void set_hsv(float p_h, float p_s, float p_v, float p_alpha = 1.0);
- _FORCE_INLINE_ float &operator[](int idx) {
- return components[idx];
+ _FORCE_INLINE_ float &operator[](int p_idx) {
+ return components[p_idx];
}
- _FORCE_INLINE_ const float &operator[](int idx) const {
- return components[idx];
+ _FORCE_INLINE_ const float &operator[](int p_idx) const {
+ return components[p_idx];
}
- Color operator+(const Color &p_color) const;
- _FORCE_INLINE_ void operator+=(const Color &p_color) {
- r = r + p_color.r;
- g = g + p_color.g;
- b = b + p_color.b;
- a = a + p_color.a;
+ bool operator==(const Color &p_color) const {
+ return (r == p_color.r && g == p_color.g && b == p_color.b && a == p_color.a);
}
+ bool operator!=(const Color &p_color) const {
+ return (r != p_color.r || g != p_color.g || b != p_color.b || a != p_color.a);
+ }
+
+ Color operator+(const Color &p_color) const;
+ void operator+=(const Color &p_color);
Color operator-() const;
Color operator-(const Color &p_color) const;
void operator-=(const Color &p_color);
Color operator*(const Color &p_color) const;
- Color operator*(const real_t &rvalue) const;
+ Color operator*(real_t p_rvalue) const;
void operator*=(const Color &p_color);
- void operator*=(const real_t &rvalue);
+ void operator*=(real_t p_rvalue);
Color operator/(const Color &p_color) const;
- Color operator/(const real_t &rvalue) const;
+ Color operator/(real_t p_rvalue) const;
void operator/=(const Color &p_color);
- void operator/=(const real_t &rvalue);
+ void operator/=(real_t p_rvalue);
bool is_equal_approx(const Color &p_color) const;
void invert();
- void contrast();
Color inverted() const;
- Color contrasted() const;
_FORCE_INLINE_ Color lerp(const Color &p_b, float p_t) const {
Color res = *this;
@@ -125,10 +122,9 @@ struct Color {
_FORCE_INLINE_ uint32_t to_rgbe9995() const {
const float pow2to9 = 512.0f;
const float B = 15.0f;
- //const float Emax = 31.0f;
const float N = 9.0f;
- float sharedexp = 65408.000f; //(( pow2to9 - 1.0f)/ pow2to9)*powf( 2.0f, 31.0f - 15.0f);
+ float sharedexp = 65408.000f; // Result of: ((pow2to9 - 1.0f) / pow2to9) * powf(2.0f, 31.0f - 15.0f)
float cRed = MAX(0.0f, MIN(sharedexp, r));
float cGreen = MAX(0.0f, MIN(sharedexp, g));
@@ -136,8 +132,6 @@ struct Color {
float cMax = MAX(cRed, MAX(cGreen, cBlue));
- // expp = MAX(-B - 1, log2(maxc)) + 1 + B
-
float expp = MAX(-B - 1.0f, floor(Math::log(cMax) / Math_LN2)) + 1.0f + B;
float sMax = (float)floor((cMax / Math::pow(2.0f, expp - B - N)) + 0.5f);
@@ -188,6 +182,9 @@ struct Color {
static Color html(const String &p_rgba);
static bool html_is_valid(const String &p_color);
static Color named(const String &p_name);
+ static int get_named_color_count();
+ static String get_named_color_name(int p_idx);
+ static Color get_named_color(int p_idx);
String to_html(bool p_alpha = true) const;
Color from_hsv(float p_h, float p_s, float p_v, float p_a) const;
static Color from_rgbe9995(uint32_t p_rgbe);
@@ -195,12 +192,27 @@ struct Color {
_FORCE_INLINE_ bool operator<(const Color &p_color) const; //used in set keys
operator String() const;
+ // For the binder.
+ _FORCE_INLINE_ void set_r8(int32_t r8) { r = (CLAMP(r8, 0, 255) / 255.0); }
+ _FORCE_INLINE_ int32_t get_r8() const { return int32_t(CLAMP(r * 255.0, 0.0, 255.0)); }
+ _FORCE_INLINE_ void set_g8(int32_t g8) { g = (CLAMP(g8, 0, 255) / 255.0); }
+ _FORCE_INLINE_ int32_t get_g8() const { return int32_t(CLAMP(g * 255.0, 0.0, 255.0)); }
+ _FORCE_INLINE_ void set_b8(int32_t b8) { b = (CLAMP(b8, 0, 255) / 255.0); }
+ _FORCE_INLINE_ int32_t get_b8() const { return int32_t(CLAMP(b * 255.0, 0.0, 255.0)); }
+ _FORCE_INLINE_ void set_a8(int32_t a8) { a = (CLAMP(a8, 0, 255) / 255.0); }
+ _FORCE_INLINE_ int32_t get_a8() const { return int32_t(CLAMP(a * 255.0, 0.0, 255.0)); }
+
+ _FORCE_INLINE_ void set_h(float p_h) { set_hsv(p_h, get_s(), get_v()); }
+ _FORCE_INLINE_ void set_s(float p_s) { set_hsv(get_h(), p_s, get_v()); }
+ _FORCE_INLINE_ void set_v(float p_v) { set_hsv(get_h(), get_s(), p_v); }
+
_FORCE_INLINE_ Color() {}
/**
- * RGB / RGBA construct parameters. Alpha is optional, but defaults to 1.0
+ * RGBA construct parameters.
+ * Alpha is not optional as otherwise we can't bind the RGB version for scripting.
*/
- _FORCE_INLINE_ Color(float p_r, float p_g, float p_b, float p_a = 1.0) {
+ _FORCE_INLINE_ Color(float p_r, float p_g, float p_b, float p_a) {
r = p_r;
g = p_g;
b = p_b;
@@ -208,6 +220,16 @@ struct Color {
}
/**
+ * RGB construct parameters.
+ */
+ _FORCE_INLINE_ Color(float p_r, float p_g, float p_b) {
+ r = p_r;
+ g = p_g;
+ b = p_b;
+ a = 1.0;
+ }
+
+ /**
* Construct a Color from another Color, but with the specified alpha value.
*/
_FORCE_INLINE_ Color(const Color &p_c, float p_a) {
@@ -234,7 +256,7 @@ bool Color::operator<(const Color &p_color) const {
}
}
-_FORCE_INLINE_ Color operator*(const real_t &p_real, const Color &p_color) {
+_FORCE_INLINE_ Color operator*(real_t p_real, const Color &p_color) {
return p_color * p_real;
}
diff --git a/core/math/color_names.inc b/core/math/color_names.inc
new file mode 100644
index 0000000000..523c7e3c59
--- /dev/null
+++ b/core/math/color_names.inc
@@ -0,0 +1,160 @@
+// Names from https://en.wikipedia.org/wiki/X11_color_names
+
+// So this in a way that does not require memory allocation
+// the old way leaked memory
+// this is not used as often as for more performance to make sense
+
+struct NamedColor {
+ const char *name;
+ Color color;
+};
+
+static NamedColor named_colors[] = {
+ { "aliceblue", Color(0.94, 0.97, 1.00) },
+ { "antiquewhite", Color(0.98, 0.92, 0.84) },
+ { "aqua", Color(0.00, 1.00, 1.00) },
+ { "aquamarine", Color(0.50, 1.00, 0.83) },
+ { "azure", Color(0.94, 1.00, 1.00) },
+ { "beige", Color(0.96, 0.96, 0.86) },
+ { "bisque", Color(1.00, 0.89, 0.77) },
+ { "black", Color(0.00, 0.00, 0.00) },
+ { "blanchedalmond", Color(1.00, 0.92, 0.80) },
+ { "blue", Color(0.00, 0.00, 1.00) },
+ { "blueviolet", Color(0.54, 0.17, 0.89) },
+ { "brown", Color(0.65, 0.16, 0.16) },
+ { "burlywood", Color(0.87, 0.72, 0.53) },
+ { "cadetblue", Color(0.37, 0.62, 0.63) },
+ { "chartreuse", Color(0.50, 1.00, 0.00) },
+ { "chocolate", Color(0.82, 0.41, 0.12) },
+ { "coral", Color(1.00, 0.50, 0.31) },
+ { "cornflower", Color(0.39, 0.58, 0.93) },
+ { "cornsilk", Color(1.00, 0.97, 0.86) },
+ { "crimson", Color(0.86, 0.08, 0.24) },
+ { "cyan", Color(0.00, 1.00, 1.00) },
+ { "darkblue", Color(0.00, 0.00, 0.55) },
+ { "darkcyan", Color(0.00, 0.55, 0.55) },
+ { "darkgoldenrod", Color(0.72, 0.53, 0.04) },
+ { "darkgray", Color(0.66, 0.66, 0.66) },
+ { "darkgreen", Color(0.00, 0.39, 0.00) },
+ { "darkkhaki", Color(0.74, 0.72, 0.42) },
+ { "darkmagenta", Color(0.55, 0.00, 0.55) },
+ { "darkolivegreen", Color(0.33, 0.42, 0.18) },
+ { "darkorange", Color(1.00, 0.55, 0.00) },
+ { "darkorchid", Color(0.60, 0.20, 0.80) },
+ { "darkred", Color(0.55, 0.00, 0.00) },
+ { "darksalmon", Color(0.91, 0.59, 0.48) },
+ { "darkseagreen", Color(0.56, 0.74, 0.56) },
+ { "darkslateblue", Color(0.28, 0.24, 0.55) },
+ { "darkslategray", Color(0.18, 0.31, 0.31) },
+ { "darkturquoise", Color(0.00, 0.81, 0.82) },
+ { "darkviolet", Color(0.58, 0.00, 0.83) },
+ { "deeppink", Color(1.00, 0.08, 0.58) },
+ { "deepskyblue", Color(0.00, 0.75, 1.00) },
+ { "dimgray", Color(0.41, 0.41, 0.41) },
+ { "dodgerblue", Color(0.12, 0.56, 1.00) },
+ { "firebrick", Color(0.70, 0.13, 0.13) },
+ { "floralwhite", Color(1.00, 0.98, 0.94) },
+ { "forestgreen", Color(0.13, 0.55, 0.13) },
+ { "fuchsia", Color(1.00, 0.00, 1.00) },
+ { "gainsboro", Color(0.86, 0.86, 0.86) },
+ { "ghostwhite", Color(0.97, 0.97, 1.00) },
+ { "gold", Color(1.00, 0.84, 0.00) },
+ { "goldenrod", Color(0.85, 0.65, 0.13) },
+ { "gray", Color(0.75, 0.75, 0.75) },
+ { "green", Color(0.00, 1.00, 0.00) },
+ { "greenyellow", Color(0.68, 1.00, 0.18) },
+ { "honeydew", Color(0.94, 1.00, 0.94) },
+ { "hotpink", Color(1.00, 0.41, 0.71) },
+ { "indianred", Color(0.80, 0.36, 0.36) },
+ { "indigo", Color(0.29, 0.00, 0.51) },
+ { "ivory", Color(1.00, 1.00, 0.94) },
+ { "khaki", Color(0.94, 0.90, 0.55) },
+ { "lavender", Color(0.90, 0.90, 0.98) },
+ { "lavenderblush", Color(1.00, 0.94, 0.96) },
+ { "lawngreen", Color(0.49, 0.99, 0.00) },
+ { "lemonchiffon", Color(1.00, 0.98, 0.80) },
+ { "lightblue", Color(0.68, 0.85, 0.90) },
+ { "lightcoral", Color(0.94, 0.50, 0.50) },
+ { "lightcyan", Color(0.88, 1.00, 1.00) },
+ { "lightgoldenrod", Color(0.98, 0.98, 0.82) },
+ { "lightgray", Color(0.83, 0.83, 0.83) },
+ { "lightgreen", Color(0.56, 0.93, 0.56) },
+ { "lightpink", Color(1.00, 0.71, 0.76) },
+ { "lightsalmon", Color(1.00, 0.63, 0.48) },
+ { "lightseagreen", Color(0.13, 0.70, 0.67) },
+ { "lightskyblue", Color(0.53, 0.81, 0.98) },
+ { "lightslategray", Color(0.47, 0.53, 0.60) },
+ { "lightsteelblue", Color(0.69, 0.77, 0.87) },
+ { "lightyellow", Color(1.00, 1.00, 0.88) },
+ { "lime", Color(0.00, 1.00, 0.00) },
+ { "limegreen", Color(0.20, 0.80, 0.20) },
+ { "linen", Color(0.98, 0.94, 0.90) },
+ { "magenta", Color(1.00, 0.00, 1.00) },
+ { "maroon", Color(0.69, 0.19, 0.38) },
+ { "mediumaquamarine", Color(0.40, 0.80, 0.67) },
+ { "mediumblue", Color(0.00, 0.00, 0.80) },
+ { "mediumorchid", Color(0.73, 0.33, 0.83) },
+ { "mediumpurple", Color(0.58, 0.44, 0.86) },
+ { "mediumseagreen", Color(0.24, 0.70, 0.44) },
+ { "mediumslateblue", Color(0.48, 0.41, 0.93) },
+ { "mediumspringgreen", Color(0.00, 0.98, 0.60) },
+ { "mediumturquoise", Color(0.28, 0.82, 0.80) },
+ { "mediumvioletred", Color(0.78, 0.08, 0.52) },
+ { "midnightblue", Color(0.10, 0.10, 0.44) },
+ { "mintcream", Color(0.96, 1.00, 0.98) },
+ { "mistyrose", Color(1.00, 0.89, 0.88) },
+ { "moccasin", Color(1.00, 0.89, 0.71) },
+ { "navajowhite", Color(1.00, 0.87, 0.68) },
+ { "navyblue", Color(0.00, 0.00, 0.50) },
+ { "oldlace", Color(0.99, 0.96, 0.90) },
+ { "olive", Color(0.50, 0.50, 0.00) },
+ { "olivedrab", Color(0.42, 0.56, 0.14) },
+ { "orange", Color(1.00, 0.65, 0.00) },
+ { "orangered", Color(1.00, 0.27, 0.00) },
+ { "orchid", Color(0.85, 0.44, 0.84) },
+ { "palegoldenrod", Color(0.93, 0.91, 0.67) },
+ { "palegreen", Color(0.60, 0.98, 0.60) },
+ { "paleturquoise", Color(0.69, 0.93, 0.93) },
+ { "palevioletred", Color(0.86, 0.44, 0.58) },
+ { "papayawhip", Color(1.00, 0.94, 0.84) },
+ { "peachpuff", Color(1.00, 0.85, 0.73) },
+ { "peru", Color(0.80, 0.52, 0.25) },
+ { "pink", Color(1.00, 0.75, 0.80) },
+ { "plum", Color(0.87, 0.63, 0.87) },
+ { "powderblue", Color(0.69, 0.88, 0.90) },
+ { "purple", Color(0.63, 0.13, 0.94) },
+ { "rebeccapurple", Color(0.40, 0.20, 0.60) },
+ { "red", Color(1.00, 0.00, 0.00) },
+ { "rosybrown", Color(0.74, 0.56, 0.56) },
+ { "royalblue", Color(0.25, 0.41, 0.88) },
+ { "saddlebrown", Color(0.55, 0.27, 0.07) },
+ { "salmon", Color(0.98, 0.50, 0.45) },
+ { "sandybrown", Color(0.96, 0.64, 0.38) },
+ { "seagreen", Color(0.18, 0.55, 0.34) },
+ { "seashell", Color(1.00, 0.96, 0.93) },
+ { "sienna", Color(0.63, 0.32, 0.18) },
+ { "silver", Color(0.75, 0.75, 0.75) },
+ { "skyblue", Color(0.53, 0.81, 0.92) },
+ { "slateblue", Color(0.42, 0.35, 0.80) },
+ { "slategray", Color(0.44, 0.50, 0.56) },
+ { "snow", Color(1.00, 0.98, 0.98) },
+ { "springgreen", Color(0.00, 1.00, 0.50) },
+ { "steelblue", Color(0.27, 0.51, 0.71) },
+ { "tan", Color(0.82, 0.71, 0.55) },
+ { "teal", Color(0.00, 0.50, 0.50) },
+ { "thistle", Color(0.85, 0.75, 0.85) },
+ { "tomato", Color(1.00, 0.39, 0.28) },
+ { "transparent", Color(1.00, 1.00, 1.00, 0.00) },
+ { "turquoise", Color(0.25, 0.88, 0.82) },
+ { "violet", Color(0.93, 0.51, 0.93) },
+ { "webgray", Color(0.50, 0.50, 0.50) },
+ { "webgreen", Color(0.00, 0.50, 0.00) },
+ { "webmaroon", Color(0.50, 0.00, 0.00) },
+ { "webpurple", Color(0.50, 0.00, 0.50) },
+ { "wheat", Color(0.96, 0.87, 0.70) },
+ { "white", Color(1.00, 1.00, 1.00) },
+ { "whitesmoke", Color(0.96, 0.96, 0.96) },
+ { "yellow", Color(1.00, 1.00, 0.00) },
+ { "yellowgreen", Color(0.60, 0.80, 0.20) },
+ { nullptr, Color(0.60, 0.80, 0.20) },
+};
diff --git a/core/math/delaunay_3d.h b/core/math/delaunay_3d.h
index 014b4c4621..ea8655cfff 100644
--- a/core/math/delaunay_3d.h
+++ b/core/math/delaunay_3d.h
@@ -31,15 +31,15 @@
#ifndef DELAUNAY_3D_H
#define DELAUNAY_3D_H
-#include "core/local_vector.h"
#include "core/math/aabb.h"
#include "core/math/camera_matrix.h"
#include "core/math/vector3.h"
-#include "core/oa_hash_map.h"
#include "core/os/file_access.h"
-#include "core/print_string.h"
-#include "core/variant.h"
-#include "core/vector.h"
+#include "core/string/print_string.h"
+#include "core/templates/local_vector.h"
+#include "core/templates/oa_hash_map.h"
+#include "core/templates/vector.h"
+#include "core/variant/variant.h"
#include "thirdparty/misc/r128.h"
diff --git a/core/math/disjoint_set.h b/core/math/disjoint_set.h
index 198f46e111..51b9ce81af 100644
--- a/core/math/disjoint_set.h
+++ b/core/math/disjoint_set.h
@@ -31,8 +31,8 @@
#ifndef DISJOINT_SET_H
#define DISJOINT_SET_H
-#include "core/map.h"
-#include "core/vector.h"
+#include "core/templates/map.h"
+#include "core/templates/vector.h"
/**
@author Marios Staikopoulos <marios@staik.net>
diff --git a/core/math/expression.cpp b/core/math/expression.cpp
index 1040f9e0e4..48ad73bd32 100644
--- a/core/math/expression.cpp
+++ b/core/math/expression.cpp
@@ -30,13 +30,12 @@
#include "expression.h"
-#include "core/class_db.h"
-#include "core/func_ref.h"
#include "core/io/marshalls.h"
#include "core/math/math_funcs.h"
+#include "core/object/class_db.h"
+#include "core/object/reference.h"
#include "core/os/os.h"
-#include "core/reference.h"
-#include "core/variant_parser.h"
+#include "core/variant/variant_parser.h"
const char *Expression::func_name[Expression::FUNC_MAX] = {
"sin",
@@ -76,7 +75,8 @@ const char *Expression::func_name[Expression::FUNC_MAX] = {
"randomize",
"randi",
"randf",
- "rand_range",
+ "randf_range",
+ "randi_range",
"seed",
"rand_seed",
"deg2rad",
@@ -92,7 +92,6 @@ const char *Expression::func_name[Expression::FUNC_MAX] = {
"clamp",
"nearest_po2",
"weakref",
- "funcref",
"convert",
"typeof",
"type_exists",
@@ -127,7 +126,7 @@ String Expression::get_func_name(BuiltinFunc p_func) {
int Expression::get_func_argument_count(BuiltinFunc p_func) {
switch (p_func) {
case MATH_RANDOMIZE:
- case MATH_RAND:
+ case MATH_RANDI:
case MATH_RANDF:
return 0;
case MATH_SIN:
@@ -178,12 +177,12 @@ int Expression::get_func_argument_count(BuiltinFunc p_func) {
case MATH_POW:
case MATH_EASE:
case MATH_STEPIFY:
- case MATH_RANDOM:
+ case MATH_RANDF_RANGE:
+ case MATH_RANDI_RANGE:
case MATH_POLAR2CARTESIAN:
case MATH_CARTESIAN2POLAR:
case LOGIC_MAX:
case LOGIC_MIN:
- case FUNC_FUNCREF:
case TYPE_CONVERT:
case COLORN:
return 2;
@@ -397,17 +396,22 @@ void Expression::exec_func(BuiltinFunc p_func, const Variant **p_inputs, Variant
Math::randomize();
} break;
- case MATH_RAND: {
+ case MATH_RANDI: {
*r_return = Math::rand();
} break;
case MATH_RANDF: {
*r_return = Math::randf();
} break;
- case MATH_RANDOM: {
+ case MATH_RANDF_RANGE: {
VALIDATE_ARG_NUM(0);
VALIDATE_ARG_NUM(1);
*r_return = Math::random((double)*p_inputs[0], (double)*p_inputs[1]);
} break;
+ case MATH_RANDI_RANGE: {
+ VALIDATE_ARG_NUM(0);
+ VALIDATE_ARG_NUM(1);
+ *r_return = Math::random((int)*p_inputs[0], (int)*p_inputs[1]);
+ } break;
case MATH_SEED: {
VALIDATE_ARG_NUM(0);
uint64_t seed = *p_inputs[0];
@@ -549,30 +553,6 @@ void Expression::exec_func(BuiltinFunc p_func, const Variant **p_inputs, Variant
}
} break;
- case FUNC_FUNCREF: {
- if (p_inputs[0]->get_type() != Variant::OBJECT) {
- r_error.error = Callable::CallError::CALL_ERROR_INVALID_ARGUMENT;
- r_error.argument = 0;
- r_error.expected = Variant::OBJECT;
-
- return;
- }
- if (p_inputs[1]->get_type() != Variant::STRING && p_inputs[1]->get_type() != Variant::NODE_PATH) {
- r_error.error = Callable::CallError::CALL_ERROR_INVALID_ARGUMENT;
- r_error.argument = 1;
- r_error.expected = Variant::STRING;
-
- return;
- }
-
- Ref<FuncRef> fr = memnew(FuncRef);
-
- fr->set_instance(*p_inputs[0]);
- fr->set_function(*p_inputs[1]);
-
- *r_return = fr;
-
- } break;
case TYPE_CONVERT: {
VALIDATE_ARG_NUM(1);
int type = *p_inputs[1];
@@ -584,7 +564,7 @@ void Expression::exec_func(BuiltinFunc p_func, const Variant **p_inputs, Variant
return;
} else {
- *r_return = Variant::construct(Variant::Type(type), p_inputs, 1, r_error);
+ Variant::construct(Variant::Type(type), *r_return, p_inputs, 1, r_error);
}
} break;
case TYPE_OF: {
@@ -1973,7 +1953,7 @@ bool Expression::_execute(const Array &p_inputs, Object *p_instance, Expression:
}
bool valid;
- r_ret = base.get_named(index->name, &valid);
+ r_ret = base.get_named(index->name, valid);
if (!valid) {
r_error_str = vformat(RTR("Invalid named index '%s' for base type %s"), String(index->name), Variant::get_type_name(base.get_type()));
return true;
@@ -2041,7 +2021,7 @@ bool Expression::_execute(const Array &p_inputs, Object *p_instance, Expression:
}
Callable::CallError ce;
- r_ret = Variant::construct(constructor->data_type, (const Variant **)argp.ptr(), argp.size(), ce);
+ Variant::construct(constructor->data_type, r_ret, (const Variant **)argp.ptr(), argp.size(), ce);
if (ce.error != Callable::CallError::CALL_OK) {
r_error_str = vformat(RTR("Invalid arguments to construct '%s'"), Variant::get_type_name(constructor->data_type));
diff --git a/core/math/expression.h b/core/math/expression.h
index f2cfe6b1a6..991554f4fd 100644
--- a/core/math/expression.h
+++ b/core/math/expression.h
@@ -31,7 +31,7 @@
#ifndef EXPRESSION_H
#define EXPRESSION_H
-#include "core/reference.h"
+#include "core/object/reference.h"
class Expression : public Reference {
GDCLASS(Expression, Reference);
@@ -73,9 +73,10 @@ public:
MATH_MOVE_TOWARD,
MATH_DECTIME,
MATH_RANDOMIZE,
- MATH_RAND,
+ MATH_RANDI,
MATH_RANDF,
- MATH_RANDOM,
+ MATH_RANDF_RANGE,
+ MATH_RANDI_RANGE,
MATH_SEED,
MATH_RANDSEED,
MATH_DEG2RAD,
@@ -91,7 +92,6 @@ public:
LOGIC_CLAMP,
LOGIC_NEAREST_PO2,
OBJ_WEAKREF,
- FUNC_FUNCREF,
TYPE_CONVERT,
TYPE_OF,
TYPE_EXISTS,
diff --git a/core/math/geometry_2d.h b/core/math/geometry_2d.h
index cfd7abfacb..12bad5768e 100644
--- a/core/math/geometry_2d.h
+++ b/core/math/geometry_2d.h
@@ -34,8 +34,8 @@
#include "core/math/delaunay_2d.h"
#include "core/math/rect2.h"
#include "core/math/triangulate.h"
-#include "core/object.h"
-#include "core/vector.h"
+#include "core/object/object.h"
+#include "core/templates/vector.h"
class Geometry2D {
Geometry2D();
diff --git a/core/math/geometry_3d.cpp b/core/math/geometry_3d.cpp
index 2c19fe2085..56353de783 100644
--- a/core/math/geometry_3d.cpp
+++ b/core/math/geometry_3d.cpp
@@ -30,7 +30,7 @@
#include "geometry_3d.h"
-#include "core/print_string.h"
+#include "core/string/print_string.h"
#include "thirdparty/misc/clipper.hpp"
#include "thirdparty/misc/triangulator.h"
diff --git a/core/math/geometry_3d.h b/core/math/geometry_3d.h
index 11cac8f108..f10fbeaaaf 100644
--- a/core/math/geometry_3d.h
+++ b/core/math/geometry_3d.h
@@ -32,8 +32,8 @@
#define GEOMETRY_3D_H
#include "core/math/face3.h"
-#include "core/object.h"
-#include "core/vector.h"
+#include "core/object/object.h"
+#include "core/templates/vector.h"
class Geometry3D {
Geometry3D();
diff --git a/core/math/math_fieldwise.h b/core/math/math_fieldwise.h
index c1ee9ec8f0..e8aac0dced 100644
--- a/core/math/math_fieldwise.h
+++ b/core/math/math_fieldwise.h
@@ -33,7 +33,7 @@
#ifdef TOOLS_ENABLED
-#include "core/variant.h"
+#include "core/variant/variant.h"
Variant fieldwise_assign(const Variant &p_target, const Variant &p_source, const String &p_field);
diff --git a/core/math/math_funcs.cpp b/core/math/math_funcs.cpp
index 1585c96b38..e57257b442 100644
--- a/core/math/math_funcs.cpp
+++ b/core/math/math_funcs.cpp
@@ -30,12 +30,10 @@
#include "math_funcs.h"
-#include "core/error_macros.h"
+#include "core/error/error_macros.h"
RandomPCG Math::default_rand(RandomPCG::DEFAULT_SEED, RandomPCG::DEFAULT_INC);
-#define PHI 0x9e3779b9
-
uint32_t Math::rand_from_seed(uint64_t *seed) {
RandomPCG rng = RandomPCG(*seed, RandomPCG::DEFAULT_INC);
uint32_t r = rng.rand();
@@ -183,3 +181,7 @@ double Math::random(double from, double to) {
float Math::random(float from, float to) {
return default_rand.random(from, to);
}
+
+int Math::random(int from, int to) {
+ return default_rand.random(from, to);
+}
diff --git a/core/math/math_funcs.h b/core/math/math_funcs.h
index f83ee44f4a..827637bf2b 100644
--- a/core/math/math_funcs.h
+++ b/core/math/math_funcs.h
@@ -289,7 +289,7 @@ public:
static double random(double from, double to);
static float random(float from, float to);
- static real_t random(int from, int to) { return (real_t)random((real_t)from, (real_t)to); }
+ static int random(int from, int to);
static _ALWAYS_INLINE_ bool is_equal_approx(real_t a, real_t b) {
// Check for exact equality first, required to handle "infinity" values.
diff --git a/core/math/octree.h b/core/math/octree.h
index 5d9688d442..40201f99b1 100644
--- a/core/math/octree.h
+++ b/core/math/octree.h
@@ -31,13 +31,13 @@
#ifndef OCTREE_H
#define OCTREE_H
-#include "core/list.h"
-#include "core/map.h"
#include "core/math/aabb.h"
#include "core/math/geometry_3d.h"
#include "core/math/vector3.h"
-#include "core/print_string.h"
-#include "core/variant.h"
+#include "core/string/print_string.h"
+#include "core/templates/list.h"
+#include "core/templates/map.h"
+#include "core/variant/variant.h"
typedef uint32_t OctreeElementID;
diff --git a/core/math/plane.cpp b/core/math/plane.cpp
index ae2021d2f6..e1ae3288ed 100644
--- a/core/math/plane.cpp
+++ b/core/math/plane.cpp
@@ -31,7 +31,7 @@
#include "plane.h"
#include "core/math/math_funcs.h"
-#include "core/variant.h"
+#include "core/variant/variant.h"
void Plane::set_normal(const Vector3 &p_normal) {
normal = p_normal;
diff --git a/core/math/quat.cpp b/core/math/quat.cpp
index c10f5da494..b6a017dd41 100644
--- a/core/math/quat.cpp
+++ b/core/math/quat.cpp
@@ -31,7 +31,7 @@
#include "quat.h"
#include "core/math/basis.h"
-#include "core/print_string.h"
+#include "core/string/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 3152b7d233..f8ab537d7b 100644
--- a/core/math/quat.h
+++ b/core/math/quat.h
@@ -36,12 +36,26 @@
#include "core/math/math_defs.h"
#include "core/math/math_funcs.h"
-#include "core/ustring.h"
+#include "core/string/ustring.h"
class Quat {
public:
- real_t x = 0, y = 0, z = 0, w = 1;
-
+ union {
+ struct {
+ real_t x;
+ real_t y;
+ real_t z;
+ real_t w;
+ };
+ real_t components[4] = { 0, 0, 0, 1.0 };
+ };
+
+ _FORCE_INLINE_ real_t &operator[](int idx) {
+ return components[idx];
+ }
+ _FORCE_INLINE_ const real_t &operator[](int idx) const {
+ return components[idx];
+ }
_FORCE_INLINE_ real_t length_squared() const;
bool is_equal_approx(const Quat &p_quat) const;
real_t length() const;
@@ -91,6 +105,10 @@ public:
return v + ((uv * w) + u.cross(uv)) * ((real_t)2);
}
+ _FORCE_INLINE_ Vector3 xform_inv(const Vector3 &v) const {
+ return inverse().xform(v);
+ }
+
_FORCE_INLINE_ void operator+=(const Quat &q);
_FORCE_INLINE_ void operator-=(const Quat &q);
_FORCE_INLINE_ void operator*=(const real_t &s);
diff --git a/core/math/quick_hull.cpp b/core/math/quick_hull.cpp
index 8ba1ba9286..8dff13c050 100644
--- a/core/math/quick_hull.cpp
+++ b/core/math/quick_hull.cpp
@@ -30,7 +30,7 @@
#include "quick_hull.h"
-#include "core/map.h"
+#include "core/templates/map.h"
uint32_t QuickHull::debug_stop_after = 0xFFFFFFFF;
diff --git a/core/math/quick_hull.h b/core/math/quick_hull.h
index cac8e58d23..80f32e191b 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 "core/list.h"
#include "core/math/aabb.h"
#include "core/math/geometry_3d.h"
-#include "core/set.h"
+#include "core/templates/list.h"
+#include "core/templates/set.h"
class QuickHull {
public:
diff --git a/core/math/random_number_generator.h b/core/math/random_number_generator.h
index 2e7941b345..0d0ea17205 100644
--- a/core/math/random_number_generator.h
+++ b/core/math/random_number_generator.h
@@ -32,7 +32,7 @@
#define RANDOM_NUMBER_GENERATOR_H
#include "core/math/random_pcg.h"
-#include "core/reference.h"
+#include "core/object/reference.h"
class RandomNumberGenerator : public Reference {
GDCLASS(RandomNumberGenerator, Reference);
@@ -43,7 +43,7 @@ protected:
static void _bind_methods();
public:
- _FORCE_INLINE_ void set_seed(uint64_t seed) { randbase.seed(seed); }
+ _FORCE_INLINE_ void set_seed(uint64_t p_seed) { randbase.seed(p_seed); }
_FORCE_INLINE_ uint64_t get_seed() { return randbase.get_seed(); }
@@ -53,24 +53,11 @@ public:
_FORCE_INLINE_ real_t randf() { return randbase.randf(); }
- _FORCE_INLINE_ real_t randf_range(real_t from, real_t to) { return randbase.random(from, to); }
+ _FORCE_INLINE_ real_t randf_range(real_t p_from, real_t p_to) { return randbase.random(p_from, p_to); }
- _FORCE_INLINE_ real_t randfn(real_t mean = 0.0, real_t deviation = 1.0) { return randbase.randfn(mean, deviation); }
+ _FORCE_INLINE_ real_t randfn(real_t p_mean = 0.0, real_t p_deviation = 1.0) { return randbase.randfn(p_mean, p_deviation); }
- _FORCE_INLINE_ int randi_range(int from, int to) {
- int range;
- int min;
- if (to > from) {
- range = to - from + 1;
- min = from;
- } else if (to < from) {
- range = from - to + 1;
- min = to;
- } else { // from == to
- return from;
- }
- return randbase.rand(range) + min;
- }
+ _FORCE_INLINE_ int randi_range(int p_from, int p_to) { return randbase.random(p_from, p_to); }
RandomNumberGenerator() {}
};
diff --git a/core/math/random_pcg.cpp b/core/math/random_pcg.cpp
index 02257c38d9..e0768b9403 100644
--- a/core/math/random_pcg.cpp
+++ b/core/math/random_pcg.cpp
@@ -49,3 +49,18 @@ double RandomPCG::random(double p_from, double p_to) {
float RandomPCG::random(float p_from, float p_to) {
return randf() * (p_to - p_from) + p_from;
}
+
+int RandomPCG::random(int p_from, int p_to) {
+ int range;
+ int min;
+ if (p_to > p_from) {
+ range = p_to - p_from + 1;
+ min = p_from;
+ } else if (p_to < p_from) {
+ range = p_from - p_to + 1;
+ min = p_to;
+ } else { // from == to
+ return p_from;
+ }
+ return rand(range) + min;
+}
diff --git a/core/math/random_pcg.h b/core/math/random_pcg.h
index dfdae53eed..fe6b1b5639 100644
--- a/core/math/random_pcg.h
+++ b/core/math/random_pcg.h
@@ -133,7 +133,7 @@ public:
double random(double p_from, double p_to);
float random(float p_from, float p_to);
- real_t random(int p_from, int p_to) { return (real_t)random((real_t)p_from, (real_t)p_to); }
+ int random(int p_from, int p_to);
};
#endif // RANDOM_PCG_H
diff --git a/core/math/rect2.h b/core/math/rect2.h
index 5a746aa732..b1fe865ba5 100644
--- a/core/math/rect2.h
+++ b/core/math/rect2.h
@@ -306,6 +306,15 @@ struct Rect2 {
return false;
}
}
+
+ _FORCE_INLINE_ void set_end(const Vector2 &p_end) {
+ size = p_end - position;
+ }
+
+ _FORCE_INLINE_ Vector2 get_end() const {
+ return position + size;
+ }
+
operator String() const { return String(position) + ", " + String(size); }
Rect2() {}
@@ -475,6 +484,14 @@ struct Rect2i {
return Rect2i(Point2i(position.x + MIN(size.x, 0), position.y + MIN(size.y, 0)), size.abs());
}
+ _FORCE_INLINE_ void set_end(const Vector2i &p_end) {
+ size = p_end - position;
+ }
+
+ _FORCE_INLINE_ Vector2i get_end() const {
+ return position + size;
+ }
+
operator String() const { return String(position) + ", " + String(size); }
operator Rect2() const { return Rect2(position, size); }
diff --git a/core/math/transform.cpp b/core/math/transform.cpp
index 0274dd18af..733bb4d55e 100644
--- a/core/math/transform.cpp
+++ b/core/math/transform.cpp
@@ -32,7 +32,7 @@
#include "core/math/math_funcs.h"
#include "core/os/copymem.h"
-#include "core/print_string.h"
+#include "core/string/print_string.h"
void Transform::affine_invert() {
basis.invert();
@@ -200,6 +200,13 @@ Transform::Transform(const Basis &p_basis, const Vector3 &p_origin) :
origin(p_origin) {
}
+Transform::Transform(const Vector3 &p_x, const Vector3 &p_y, const Vector3 &p_z, const Vector3 &p_origin) :
+ origin(p_origin) {
+ basis.set_axis(0, p_x);
+ basis.set_axis(1, p_y);
+ basis.set_axis(2, p_z);
+}
+
Transform::Transform(real_t xx, real_t xy, real_t xz, real_t yx, real_t yy, real_t yz, real_t zx, real_t zy, real_t zz, real_t ox, real_t oy, real_t oz) {
basis = Basis(xx, xy, xz, yx, yy, yz, zx, zy, zz);
origin = Vector3(ox, oy, oz);
diff --git a/core/math/transform.h b/core/math/transform.h
index 71847d36ac..c63dbcb989 100644
--- a/core/math/transform.h
+++ b/core/math/transform.h
@@ -106,9 +106,10 @@ public:
operator String() const;
- Transform(real_t xx, real_t xy, real_t xz, real_t yx, real_t yy, real_t yz, real_t zx, real_t zy, real_t zz, real_t ox, real_t oy, real_t oz);
- Transform(const Basis &p_basis, const Vector3 &p_origin = Vector3());
Transform() {}
+ Transform(const Basis &p_basis, const Vector3 &p_origin = Vector3());
+ Transform(const Vector3 &p_x, const Vector3 &p_y, const Vector3 &p_z, const Vector3 &p_origin);
+ Transform(real_t xx, real_t xy, real_t xz, real_t yx, real_t yy, real_t yz, real_t zx, real_t zy, real_t zz, real_t ox, real_t oy, real_t oz);
};
_FORCE_INLINE_ Vector3 Transform::xform(const Vector3 &p_vector) const {
diff --git a/core/math/transform_2d.h b/core/math/transform_2d.h
index 46e97abaa7..342623939e 100644
--- a/core/math/transform_2d.h
+++ b/core/math/transform_2d.h
@@ -128,6 +128,12 @@ struct Transform2D {
elements[2][1] = oy;
}
+ Transform2D(const Vector2 &p_x, const Vector2 &p_y, const Vector2 &p_origin) {
+ elements[0] = p_x;
+ elements[1] = p_y;
+ elements[2] = p_origin;
+ }
+
Transform2D(real_t p_rot, const Vector2 &p_pos);
Transform2D() {
elements[0][0] = 1.0;
diff --git a/core/math/triangle_mesh.cpp b/core/math/triangle_mesh.cpp
index c9a546e385..cfe8422d80 100644
--- a/core/math/triangle_mesh.cpp
+++ b/core/math/triangle_mesh.cpp
@@ -30,7 +30,7 @@
#include "triangle_mesh.h"
-#include "core/sort_array.h"
+#include "core/templates/sort_array.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) {
if (p_depth > max_depth) {
diff --git a/core/math/triangle_mesh.h b/core/math/triangle_mesh.h
index 86412cf725..d719822ec3 100644
--- a/core/math/triangle_mesh.h
+++ b/core/math/triangle_mesh.h
@@ -32,7 +32,7 @@
#define TRIANGLE_MESH_H
#include "core/math/face3.h"
-#include "core/reference.h"
+#include "core/object/reference.h"
class TriangleMesh : public Reference {
GDCLASS(TriangleMesh, Reference);
diff --git a/core/math/vector2.cpp b/core/math/vector2.cpp
index 233421e070..75e742a5f1 100644
--- a/core/math/vector2.cpp
+++ b/core/math/vector2.cpp
@@ -233,6 +233,19 @@ void Vector2i::operator/=(const int &rvalue) {
y /= rvalue;
}
+Vector2i Vector2i::operator%(const Vector2i &p_v1) const {
+ return Vector2i(x % p_v1.x, y % p_v1.y);
+}
+
+Vector2i Vector2i::operator%(const int &rvalue) const {
+ return Vector2i(x % rvalue, y % rvalue);
+}
+
+void Vector2i::operator%=(const int &rvalue) {
+ x %= rvalue;
+ y %= rvalue;
+}
+
Vector2i Vector2i::operator-() const {
return Vector2i(-x, -y);
}
diff --git a/core/math/vector2.h b/core/math/vector2.h
index c2a2656e72..8cb63b2fb5 100644
--- a/core/math/vector2.h
+++ b/core/math/vector2.h
@@ -32,7 +32,7 @@
#define VECTOR2_H
#include "core/math/math_funcs.h"
-#include "core/ustring.h"
+#include "core/string/ustring.h"
struct Vector2i;
@@ -290,11 +290,13 @@ struct Vector2i {
void operator*=(const int &rvalue);
Vector2i operator/(const Vector2i &p_v1) const;
-
Vector2i operator/(const int &rvalue) const;
-
void operator/=(const int &rvalue);
+ Vector2i operator%(const Vector2i &p_v1) const;
+ Vector2i operator%(const int &rvalue) const;
+ void operator%=(const int &rvalue);
+
Vector2i operator-() const;
bool operator<(const Vector2i &p_vec2) const { return (x == p_vec2.x) ? (y < p_vec2.y) : (x < p_vec2.x); }
bool operator>(const Vector2i &p_vec2) const { return (x == p_vec2.x) ? (y > p_vec2.y) : (x > p_vec2.x); }
diff --git a/core/math/vector3.h b/core/math/vector3.h
index 5370b297f1..ae8b9376cf 100644
--- a/core/math/vector3.h
+++ b/core/math/vector3.h
@@ -33,7 +33,7 @@
#include "core/math/math_funcs.h"
#include "core/math/vector3i.h"
-#include "core/ustring.h"
+#include "core/string/ustring.h"
class Basis;
diff --git a/core/math/vector3i.h b/core/math/vector3i.h
index 08729ad056..1bfd6d5ab2 100644
--- a/core/math/vector3i.h
+++ b/core/math/vector3i.h
@@ -31,8 +31,8 @@
#ifndef VECTOR3I_H
#define VECTOR3I_H
+#include "core/string/ustring.h"
#include "core/typedefs.h"
-#include "core/ustring.h"
struct Vector3i {
enum Axis {
@@ -80,11 +80,15 @@ struct Vector3i {
_FORCE_INLINE_ Vector3i operator*(const Vector3i &p_v) const;
_FORCE_INLINE_ Vector3i &operator/=(const Vector3i &p_v);
_FORCE_INLINE_ Vector3i operator/(const Vector3i &p_v) const;
+ _FORCE_INLINE_ Vector3i &operator%=(const Vector3i &p_v);
+ _FORCE_INLINE_ Vector3i operator%(const Vector3i &p_v) const;
_FORCE_INLINE_ Vector3i &operator*=(int32_t p_scalar);
_FORCE_INLINE_ Vector3i operator*(int32_t p_scalar) const;
_FORCE_INLINE_ Vector3i &operator/=(int32_t p_scalar);
_FORCE_INLINE_ Vector3i operator/(int32_t p_scalar) const;
+ _FORCE_INLINE_ Vector3i &operator%=(int32_t p_scalar);
+ _FORCE_INLINE_ Vector3i operator%(int32_t p_scalar) const;
_FORCE_INLINE_ Vector3i operator-() const;
@@ -159,6 +163,17 @@ Vector3i Vector3i::operator/(const Vector3i &p_v) const {
return Vector3i(x / p_v.x, y / p_v.y, z / p_v.z);
}
+Vector3i &Vector3i::operator%=(const Vector3i &p_v) {
+ x %= p_v.x;
+ y %= p_v.y;
+ z %= p_v.z;
+ return *this;
+}
+
+Vector3i Vector3i::operator%(const Vector3i &p_v) const {
+ return Vector3i(x % p_v.x, y % p_v.y, z % p_v.z);
+}
+
Vector3i &Vector3i::operator*=(int32_t p_scalar) {
x *= p_scalar;
y *= p_scalar;
@@ -185,6 +200,17 @@ Vector3i Vector3i::operator/(int32_t p_scalar) const {
return Vector3i(x / p_scalar, y / p_scalar, z / p_scalar);
}
+Vector3i &Vector3i::operator%=(int32_t p_scalar) {
+ x %= p_scalar;
+ y %= p_scalar;
+ z %= p_scalar;
+ return *this;
+}
+
+Vector3i Vector3i::operator%(int32_t p_scalar) const {
+ return Vector3i(x % p_scalar, y % p_scalar, z % p_scalar);
+}
+
Vector3i Vector3i::operator-() const {
return Vector3i(-x, -y, -z);
}
diff --git a/core/object/SCsub b/core/object/SCsub
new file mode 100644
index 0000000000..5d429960e5
--- /dev/null
+++ b/core/object/SCsub
@@ -0,0 +1,7 @@
+#!/usr/bin/env python
+
+Import("env")
+
+env_object = env.Clone()
+
+env_object.add_source_files(env.core_sources, "*.cpp")
diff --git a/core/callable_method_pointer.cpp b/core/object/callable_method_pointer.cpp
index 21a917cbd7..21a917cbd7 100644
--- a/core/callable_method_pointer.cpp
+++ b/core/object/callable_method_pointer.cpp
diff --git a/core/callable_method_pointer.h b/core/object/callable_method_pointer.h
index 2007b9f338..ee6da6a8db 100644
--- a/core/callable_method_pointer.h
+++ b/core/object/callable_method_pointer.h
@@ -31,12 +31,12 @@
#ifndef CALLABLE_METHOD_POINTER_H
#define CALLABLE_METHOD_POINTER_H
-#include "core/binder_common.h"
-#include "core/callable.h"
-#include "core/hashfuncs.h"
-#include "core/object.h"
+#include "core/object/object.h"
#include "core/os/copymem.h"
-#include "core/simple_type.h"
+#include "core/templates/hashfuncs.h"
+#include "core/templates/simple_type.h"
+#include "core/variant/binder_common.h"
+#include "core/variant/callable.h"
class CallableCustomMethodPointerBase : public CallableCustom {
uint32_t *comp_ptr;
diff --git a/core/class_db.cpp b/core/object/class_db.cpp
index 81bc901561..64ebeb427e 100644
--- a/core/class_db.cpp
+++ b/core/object/class_db.cpp
@@ -30,7 +30,7 @@
#include "class_db.h"
-#include "core/engine.h"
+#include "core/config/engine.h"
#include "core/os/mutex.h"
#include "core/version.h"
diff --git a/core/class_db.h b/core/object/class_db.h
index 22072066d9..94f26da60d 100644
--- a/core/class_db.h
+++ b/core/object/class_db.h
@@ -31,9 +31,9 @@
#ifndef CLASS_DB_H
#define CLASS_DB_H
-#include "core/method_bind.h"
-#include "core/object.h"
-#include "core/print_string.h"
+#include "core/object/method_bind.h"
+#include "core/object/object.h"
+#include "core/string/print_string.h"
/** To bind more then 6 parameters include this:
*
@@ -41,7 +41,7 @@
// Makes callable_mp readily available in all classes connecting signals.
// Needs to come after method_bind and object have been included.
-#include "core/callable_method_pointer.h"
+#include "core/object/callable_method_pointer.h"
#define DEFVAL(m_defval) (m_defval)
diff --git a/core/message_queue.cpp b/core/object/message_queue.cpp
index 6dcf24e7ed..f0d6786853 100644
--- a/core/message_queue.cpp
+++ b/core/object/message_queue.cpp
@@ -30,9 +30,9 @@
#include "message_queue.h"
+#include "core/config/project_settings.h"
#include "core/core_string_names.h"
-#include "core/project_settings.h"
-#include "core/script_language.h"
+#include "core/object/script_language.h"
MessageQueue *MessageQueue::singleton = nullptr;
diff --git a/core/message_queue.h b/core/object/message_queue.h
index 5d39ceee03..2901ab196a 100644
--- a/core/message_queue.h
+++ b/core/object/message_queue.h
@@ -31,7 +31,7 @@
#ifndef MESSAGE_QUEUE_H
#define MESSAGE_QUEUE_H
-#include "core/class_db.h"
+#include "core/object/class_db.h"
#include "core/os/thread_safe.h"
class MessageQueue {
diff --git a/core/method_bind.cpp b/core/object/method_bind.cpp
index 3244c63292..e6652ac09f 100644
--- a/core/method_bind.cpp
+++ b/core/object/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 "core/object.h"
+#include "core/object/object.h"
#include "method_bind.h"
diff --git a/core/method_bind.h b/core/object/method_bind.h
index d43186257b..ab4ba90b94 100644
--- a/core/method_bind.h
+++ b/core/object/method_bind.h
@@ -31,7 +31,7 @@
#ifndef METHOD_BIND_H
#define METHOD_BIND_H
-#include "core/binder_common.h"
+#include "core/variant/binder_common.h"
enum MethodFlags {
diff --git a/core/object.cpp b/core/object/object.cpp
index 0d9e5c5116..c3f49856ca 100644
--- a/core/object.cpp
+++ b/core/object/object.cpp
@@ -30,14 +30,14 @@
#include "object.h"
-#include "core/class_db.h"
#include "core/core_string_names.h"
-#include "core/message_queue.h"
+#include "core/io/resource.h"
+#include "core/object/class_db.h"
+#include "core/object/message_queue.h"
+#include "core/object/script_language.h"
#include "core/os/os.h"
-#include "core/print_string.h"
-#include "core/resource.h"
-#include "core/script_language.h"
-#include "core/translation.h"
+#include "core/string/print_string.h"
+#include "core/string/translation.h"
#ifdef DEBUG_ENABLED
@@ -421,17 +421,6 @@ void Object::set(const StringName &p_name, const Variant &p_value, bool *r_valid
return;
}
- {
- bool valid;
- setvar(p_name, p_value, &valid);
- if (valid) {
- if (r_valid) {
- *r_valid = true;
- }
- return;
- }
- }
-
#ifdef TOOLS_ENABLED
if (script_instance) {
bool valid;
@@ -496,18 +485,6 @@ Variant Object::get(const StringName &p_name, bool *r_valid) const {
return ret;
}
- //if nothing else, use getvar
- {
- bool valid;
- ret = getvar(p_name, &valid);
- if (valid) {
- if (r_valid) {
- *r_valid = true;
- }
- return ret;
- }
- }
-
#ifdef TOOLS_ENABLED
if (script_instance) {
bool valid;
@@ -555,9 +532,12 @@ void Object::set_indexed(const Vector<StringName> &p_names, const Variant &p_val
}
for (int i = 1; i < p_names.size() - 1; i++) {
- value_stack.push_back(value_stack.back()->get().get_named(p_names[i], r_valid));
+ value_stack.push_back(value_stack.back()->get().get_named(p_names[i], valid));
+ if (r_valid) {
+ *r_valid = valid;
+ }
- if (!*r_valid) {
+ if (!valid) {
value_stack.clear();
return;
}
@@ -566,10 +546,13 @@ void Object::set_indexed(const Vector<StringName> &p_names, const Variant &p_val
value_stack.push_back(p_value); // p_names[p_names.size() - 1]
for (int i = p_names.size() - 1; i > 0; i--) {
- value_stack.back()->prev()->get().set_named(p_names[i], value_stack.back()->get(), r_valid);
+ value_stack.back()->prev()->get().set_named(p_names[i], value_stack.back()->get(), valid);
value_stack.pop_back();
- if (!*r_valid) {
+ if (r_valid) {
+ *r_valid = valid;
+ }
+ if (!valid) {
value_stack.clear();
return;
}
@@ -592,7 +575,7 @@ Variant Object::get_indexed(const Vector<StringName> &p_names, bool *r_valid) co
Variant current_value = get(p_names[0], &valid);
for (int i = 1; i < p_names.size(); i++) {
- current_value = current_value.get_named(p_names[i], &valid);
+ current_value = current_value.get_named(p_names[i], valid);
if (!valid) {
break;
@@ -698,6 +681,10 @@ Variant Object::getvar(const Variant &p_key, bool *r_valid) const {
if (r_valid) {
*r_valid = false;
}
+
+ if (p_key.get_type() == Variant::STRING_NAME || p_key.get_type() == Variant::STRING) {
+ return get(p_key, r_valid);
+ }
return Variant();
}
@@ -705,6 +692,9 @@ void Object::setvar(const Variant &p_key, const Variant &p_value, bool *r_valid)
if (r_valid) {
*r_valid = false;
}
+ if (p_key.get_type() == Variant::STRING_NAME || p_key.get_type() == Variant::STRING) {
+ return set(p_key, p_value, r_valid);
+ }
}
Variant Object::callv(const StringName &p_method, const Array &p_args) {
@@ -1700,7 +1690,8 @@ Variant::Type Object::get_static_property_type_indexed(const Vector<StringName>
}
Callable::CallError ce;
- Variant check = Variant::construct(t, nullptr, 0, ce);
+ Variant check;
+ Variant::construct(t, check, nullptr, 0, ce);
for (int i = 1; i < p_path.size(); i++) {
if (check.get_type() == Variant::OBJECT || check.get_type() == Variant::DICTIONARY || check.get_type() == Variant::ARRAY) {
@@ -1711,7 +1702,7 @@ Variant::Type Object::get_static_property_type_indexed(const Vector<StringName>
return Variant::NIL;
}
- check = check.get_named(p_path[i], &valid);
+ check = check.get_named(p_path[i], valid);
if (!valid) {
if (r_valid) {
diff --git a/core/object.h b/core/object/object.h
index 765fb63c6e..c79745cf74 100644
--- a/core/object.h
+++ b/core/object/object.h
@@ -31,16 +31,16 @@
#ifndef OBJECT_H
#define OBJECT_H
-#include "core/callable_bind.h"
-#include "core/hash_map.h"
-#include "core/list.h"
-#include "core/map.h"
-#include "core/object_id.h"
+#include "core/object/object_id.h"
#include "core/os/rw_lock.h"
-#include "core/set.h"
-#include "core/spin_lock.h"
-#include "core/variant.h"
-#include "core/vmap.h"
+#include "core/os/spin_lock.h"
+#include "core/templates/hash_map.h"
+#include "core/templates/list.h"
+#include "core/templates/map.h"
+#include "core/templates/set.h"
+#include "core/templates/vmap.h"
+#include "core/variant/callable_bind.h"
+#include "core/variant/variant.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
diff --git a/core/object_id.h b/core/object/object_id.h
index 63b0c27af8..63b0c27af8 100644
--- a/core/object_id.h
+++ b/core/object/object_id.h
diff --git a/core/reference.cpp b/core/object/reference.cpp
index d1dba0d9bf..ce95d83dfc 100644
--- a/core/reference.cpp
+++ b/core/object/reference.cpp
@@ -30,7 +30,7 @@
#include "reference.h"
-#include "core/script_language.h"
+#include "core/object/script_language.h"
bool Reference::init_ref() {
if (reference()) {
diff --git a/core/reference.h b/core/object/reference.h
index 868894aad4..575f1cd914 100644
--- a/core/reference.h
+++ b/core/object/reference.h
@@ -31,8 +31,8 @@
#ifndef REFERENCE_H
#define REFERENCE_H
-#include "core/class_db.h"
-#include "core/safe_refcount.h"
+#include "core/object/class_db.h"
+#include "core/templates/safe_refcount.h"
class Reference : public Object {
GDCLASS(Reference, Object);
diff --git a/core/script_language.cpp b/core/object/script_language.cpp
index d535c54dea..17ac75e19f 100644
--- a/core/script_language.cpp
+++ b/core/object/script_language.cpp
@@ -30,10 +30,10 @@
#include "script_language.h"
+#include "core/config/project_settings.h"
#include "core/core_string_names.h"
#include "core/debugger/engine_debugger.h"
#include "core/debugger/script_debugger.h"
-#include "core/project_settings.h"
#include <stdint.h>
diff --git a/core/script_language.h b/core/object/script_language.h
index a94c128932..447216f14f 100644
--- a/core/script_language.h
+++ b/core/object/script_language.h
@@ -32,9 +32,9 @@
#define SCRIPT_LANGUAGE_H
#include "core/io/multiplayer_api.h"
-#include "core/map.h"
-#include "core/pair.h"
-#include "core/resource.h"
+#include "core/io/resource.h"
+#include "core/templates/map.h"
+#include "core/templates/pair.h"
class ScriptLanguage;
diff --git a/core/undo_redo.cpp b/core/object/undo_redo.cpp
index 1dcbb0cd6b..1dcbb0cd6b 100644
--- a/core/undo_redo.cpp
+++ b/core/object/undo_redo.cpp
diff --git a/core/undo_redo.h b/core/object/undo_redo.h
index 68a553efd4..68d78e0d7d 100644
--- a/core/undo_redo.h
+++ b/core/object/undo_redo.h
@@ -31,8 +31,8 @@
#ifndef UNDO_REDO_H
#define UNDO_REDO_H
-#include "core/class_db.h"
-#include "core/resource.h"
+#include "core/io/resource.h"
+#include "core/object/class_db.h"
class UndoRedo : public Object {
GDCLASS(UndoRedo, Object);
diff --git a/core/os/dir_access.cpp b/core/os/dir_access.cpp
index 5e1cb8ea29..30b1b51b53 100644
--- a/core/os/dir_access.cpp
+++ b/core/os/dir_access.cpp
@@ -30,10 +30,10 @@
#include "dir_access.h"
+#include "core/config/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 {
switch (_access_type) {
diff --git a/core/os/dir_access.h b/core/os/dir_access.h
index 6bce9a4c12..0f4fa9b250 100644
--- a/core/os/dir_access.h
+++ b/core/os/dir_access.h
@@ -31,8 +31,8 @@
#ifndef DIR_ACCESS_H
#define DIR_ACCESS_H
+#include "core/string/ustring.h"
#include "core/typedefs.h"
-#include "core/ustring.h"
//@ TODO, excellent candidate for THREAD_SAFE MACRO, should go through all these and add THREAD_SAFE where it applies
class DirAccess {
diff --git a/core/os/file_access.cpp b/core/os/file_access.cpp
index 9dbb2952f7..ef3eb6800a 100644
--- a/core/os/file_access.cpp
+++ b/core/os/file_access.cpp
@@ -30,11 +30,11 @@
#include "file_access.h"
+#include "core/config/project_settings.h"
#include "core/crypto/crypto_core.h"
#include "core/io/file_access_pack.h"
#include "core/io/marshalls.h"
#include "core/os/os.h"
-#include "core/project_settings.h"
FileAccess::CreateFunc FileAccess::create_func[ACCESS_MAX] = { nullptr, nullptr };
diff --git a/core/os/file_access.h b/core/os/file_access.h
index 48b9ee4269..39b977a4d9 100644
--- a/core/os/file_access.h
+++ b/core/os/file_access.h
@@ -33,8 +33,8 @@
#include "core/math/math_defs.h"
#include "core/os/memory.h"
+#include "core/string/ustring.h"
#include "core/typedefs.h"
-#include "core/ustring.h"
/**
* Multi-Platform abstraction for accessing to files.
diff --git a/core/os/keyboard.h b/core/os/keyboard.h
index 5d11e6a378..92664aff8f 100644
--- a/core/os/keyboard.h
+++ b/core/os/keyboard.h
@@ -31,7 +31,7 @@
#ifndef KEYBOARD_H
#define KEYBOARD_H
-#include "core/ustring.h"
+#include "core/string/ustring.h"
/*
Special Key:
diff --git a/core/os/main_loop.cpp b/core/os/main_loop.cpp
index 6651fb80d7..d29bcd011f 100644
--- a/core/os/main_loop.cpp
+++ b/core/os/main_loop.cpp
@@ -30,7 +30,7 @@
#include "main_loop.h"
-#include "core/script_language.h"
+#include "core/object/script_language.h"
void MainLoop::_bind_methods() {
BIND_VMETHOD(MethodInfo("_initialize"));
diff --git a/core/os/main_loop.h b/core/os/main_loop.h
index 2c34cf193c..8c46ad9b6a 100644
--- a/core/os/main_loop.h
+++ b/core/os/main_loop.h
@@ -32,8 +32,8 @@
#define MAIN_LOOP_H
#include "core/input/input_event.h"
-#include "core/reference.h"
-#include "core/script_language.h"
+#include "core/object/reference.h"
+#include "core/object/script_language.h"
class MainLoop : public Object {
GDCLASS(MainLoop, Object);
diff --git a/core/os/memory.cpp b/core/os/memory.cpp
index 8457c52092..f2723d13f6 100644
--- a/core/os/memory.cpp
+++ b/core/os/memory.cpp
@@ -30,9 +30,9 @@
#include "memory.h"
-#include "core/error_macros.h"
+#include "core/error/error_macros.h"
#include "core/os/copymem.h"
-#include "core/safe_refcount.h"
+#include "core/templates/safe_refcount.h"
#include <stdio.h>
#include <stdlib.h>
diff --git a/core/os/memory.h b/core/os/memory.h
index 46ffb4124b..dee08d4de4 100644
--- a/core/os/memory.h
+++ b/core/os/memory.h
@@ -31,8 +31,8 @@
#ifndef MEMORY_H
#define MEMORY_H
-#include "core/error_macros.h"
-#include "core/safe_refcount.h"
+#include "core/error/error_macros.h"
+#include "core/templates/safe_refcount.h"
#include <stddef.h>
diff --git a/core/os/midi_driver.h b/core/os/midi_driver.h
index bc922e1fcf..f487b31d4c 100644
--- a/core/os/midi_driver.h
+++ b/core/os/midi_driver.h
@@ -32,7 +32,7 @@
#define MIDI_DRIVER_H
#include "core/typedefs.h"
-#include "core/variant.h"
+#include "core/variant/variant.h"
/**
* Multi-Platform abstraction for accessing to MIDI.
diff --git a/core/os/mutex.h b/core/os/mutex.h
index d42cbed821..778bdaba09 100644
--- a/core/os/mutex.h
+++ b/core/os/mutex.h
@@ -31,7 +31,7 @@
#ifndef MUTEX_H
#define MUTEX_H
-#include "core/error_list.h"
+#include "core/error/error_list.h"
#include "core/typedefs.h"
#if !defined(NO_THREADS)
diff --git a/core/os/os.cpp b/core/os/os.cpp
index 3a398316bd..552bf043bf 100644
--- a/core/os/os.cpp
+++ b/core/os/os.cpp
@@ -30,11 +30,11 @@
#include "os.h"
+#include "core/config/project_settings.h"
#include "core/input/input.h"
#include "core/os/dir_access.h"
#include "core/os/file_access.h"
#include "core/os/midi_driver.h"
-#include "core/project_settings.h"
#include "core/version_generated.gen.h"
#include "servers/audio_server.h"
diff --git a/core/os/os.h b/core/os/os.h
index 4c1d930107..a1e75b5ee9 100644
--- a/core/os/os.h
+++ b/core/os/os.h
@@ -31,13 +31,13 @@
#ifndef OS_H
#define OS_H
-#include "core/engine.h"
-#include "core/image.h"
+#include "core/config/engine.h"
+#include "core/io/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 "core/string/ustring.h"
+#include "core/templates/list.h"
+#include "core/templates/vector.h"
#include <stdarg.h>
diff --git a/core/pool_allocator.cpp b/core/os/pool_allocator.cpp
index b222c20a00..52536ff45d 100644
--- a/core/pool_allocator.cpp
+++ b/core/os/pool_allocator.cpp
@@ -30,11 +30,11 @@
#include "pool_allocator.h"
-#include "core/error_macros.h"
+#include "core/error/error_macros.h"
#include "core/os/copymem.h"
#include "core/os/memory.h"
#include "core/os/os.h"
-#include "core/print_string.h"
+#include "core/string/print_string.h"
#include <assert.h>
diff --git a/core/pool_allocator.h b/core/os/pool_allocator.h
index 7d77af6266..7d77af6266 100644
--- a/core/pool_allocator.h
+++ b/core/os/pool_allocator.h
diff --git a/core/os/rw_lock.cpp b/core/os/rw_lock.cpp
index a668fe2b4c..669f05c6b0 100644
--- a/core/os/rw_lock.cpp
+++ b/core/os/rw_lock.cpp
@@ -30,7 +30,7 @@
#include "rw_lock.h"
-#include "core/error_macros.h"
+#include "core/error/error_macros.h"
#include <stddef.h>
diff --git a/core/os/rw_lock.h b/core/os/rw_lock.h
index 1035072cce..1190102a83 100644
--- a/core/os/rw_lock.h
+++ b/core/os/rw_lock.h
@@ -31,7 +31,7 @@
#ifndef RW_LOCK_H
#define RW_LOCK_H
-#include "core/error_list.h"
+#include "core/error/error_list.h"
class RWLock {
protected:
diff --git a/core/os/semaphore.h b/core/os/semaphore.h
index 077e04704b..b170cada3a 100644
--- a/core/os/semaphore.h
+++ b/core/os/semaphore.h
@@ -31,7 +31,7 @@
#ifndef SEMAPHORE_H
#define SEMAPHORE_H
-#include "core/error_list.h"
+#include "core/error/error_list.h"
#include "core/typedefs.h"
#if !defined(NO_THREADS)
diff --git a/core/spin_lock.h b/core/os/spin_lock.h
index 1bb810bb29..1bb810bb29 100644
--- a/core/spin_lock.h
+++ b/core/os/spin_lock.h
diff --git a/core/os/thread.h b/core/os/thread.h
index f761d4ca43..d68476e683 100644
--- a/core/os/thread.h
+++ b/core/os/thread.h
@@ -31,8 +31,8 @@
#ifndef THREAD_H
#define THREAD_H
+#include "core/string/ustring.h"
#include "core/typedefs.h"
-#include "core/ustring.h"
typedef void (*ThreadCreateCallback)(void *p_userdata);
diff --git a/core/os/threaded_array_processor.h b/core/os/threaded_array_processor.h
index d27399e4cc..ed141a5339 100644
--- a/core/os/threaded_array_processor.h
+++ b/core/os/threaded_array_processor.h
@@ -35,7 +35,7 @@
#include "core/os/os.h"
#include "core/os/thread.h"
#include "core/os/thread_safe.h"
-#include "core/safe_refcount.h"
+#include "core/templates/safe_refcount.h"
template <class C, class U>
struct ThreadArrayProcessData {
diff --git a/core/register_core_types.cpp b/core/register_core_types.cpp
index a2b3f75bea..6bbdad11f8 100644
--- a/core/register_core_types.cpp
+++ b/core/register_core_types.cpp
@@ -30,15 +30,13 @@
#include "register_core_types.h"
-#include "core/bind/core_bind.h"
-#include "core/class_db.h"
-#include "core/compressed_translation.h"
+#include "core/config/engine.h"
+#include "core/config/project_settings.h"
+#include "core/core_bind.h"
#include "core/core_string_names.h"
#include "core/crypto/aes_context.h"
#include "core/crypto/crypto.h"
#include "core/crypto/hashing_context.h"
-#include "core/engine.h"
-#include "core/func_ref.h"
#include "core/input/input.h"
#include "core/input/input_map.h"
#include "core/io/config_file.h"
@@ -48,6 +46,7 @@
#include "core/io/marshalls.h"
#include "core/io/multiplayer_api.h"
#include "core/io/networked_multiplayer_peer.h"
+#include "core/io/packed_data_container.h"
#include "core/io/packet_peer.h"
#include "core/io/packet_peer_dtls.h"
#include "core/io/packet_peer_udp.h"
@@ -65,11 +64,11 @@
#include "core/math/geometry_3d.h"
#include "core/math/random_number_generator.h"
#include "core/math/triangle_mesh.h"
+#include "core/object/class_db.h"
+#include "core/object/undo_redo.h"
#include "core/os/main_loop.h"
-#include "core/packed_data_container.h"
-#include "core/project_settings.h"
-#include "core/translation.h"
-#include "core/undo_redo.h"
+#include "core/string/compressed_translation.h"
+#include "core/string/translation.h"
static Ref<ResourceFormatSaverBinary> resource_saver_binary;
static Ref<ResourceFormatLoaderBinary> resource_loader_binary;
@@ -97,8 +96,6 @@ extern Mutex _global_mutex;
extern void register_global_constants();
extern void unregister_global_constants();
-extern void register_variant_methods();
-extern void unregister_variant_methods();
void register_core_types() {
//consistency check
@@ -111,7 +108,8 @@ void register_core_types() {
ResourceLoader::initialize();
register_global_constants();
- register_variant_methods();
+
+ Variant::register_types();
CoreStringNames::create();
@@ -155,7 +153,6 @@ void register_core_types() {
ClassDB::register_class<InputEventPanGesture>();
ClassDB::register_class<InputEventMIDI>();
- ClassDB::register_class<FuncRef>();
ClassDB::register_virtual_class<StreamPeer>();
ClassDB::register_class<StreamPeerBuffer>();
ClassDB::register_class<StreamPeerTCP>();
@@ -319,7 +316,8 @@ void unregister_core_types() {
ClassDB::cleanup_defaults();
ObjectDB::cleanup();
- unregister_variant_methods();
+ Variant::unregister_types();
+
unregister_global_constants();
ClassDB::cleanup();
diff --git a/core/string/SCsub b/core/string/SCsub
new file mode 100644
index 0000000000..3217166f18
--- /dev/null
+++ b/core/string/SCsub
@@ -0,0 +1,7 @@
+#!/usr/bin/env python
+
+Import("env")
+
+env_string = env.Clone()
+
+env_string.add_source_files(env.core_sources, "*.cpp")
diff --git a/core/compressed_translation.cpp b/core/string/compressed_translation.cpp
index a92275565d..bdb296a79b 100644
--- a/core/compressed_translation.cpp
+++ b/core/string/compressed_translation.cpp
@@ -30,7 +30,7 @@
#include "compressed_translation.h"
-#include "core/pair.h"
+#include "core/templates/pair.h"
extern "C" {
#include "thirdparty/misc/smaz.h"
diff --git a/core/compressed_translation.h b/core/string/compressed_translation.h
index c8b3cd2330..efb3535362 100644
--- a/core/compressed_translation.h
+++ b/core/string/compressed_translation.h
@@ -31,7 +31,7 @@
#ifndef COMPRESSED_TRANSLATION_H
#define COMPRESSED_TRANSLATION_H
-#include "core/translation.h"
+#include "core/string/translation.h"
class PHashTranslation : public Translation {
GDCLASS(PHashTranslation, Translation);
diff --git a/core/node_path.cpp b/core/string/node_path.cpp
index 2a51dca74a..4d152d9258 100644
--- a/core/node_path.cpp
+++ b/core/string/node_path.cpp
@@ -30,7 +30,7 @@
#include "node_path.h"
-#include "core/print_string.h"
+#include "core/string/print_string.h"
void NodePath::_update_hash_cache() const {
uint32_t h = data->absolute ? 1 : 0;
diff --git a/core/node_path.h b/core/string/node_path.h
index 7c06bf01ce..b4513ddb3c 100644
--- a/core/node_path.h
+++ b/core/string/node_path.h
@@ -31,8 +31,8 @@
#ifndef NODE_PATH_H
#define NODE_PATH_H
-#include "core/string_name.h"
-#include "core/ustring.h"
+#include "core/string/string_name.h"
+#include "core/string/ustring.h"
class NodePath {
struct Data {
diff --git a/core/print_string.cpp b/core/string/print_string.cpp
index 54de229471..54de229471 100644
--- a/core/print_string.cpp
+++ b/core/string/print_string.cpp
diff --git a/core/print_string.h b/core/string/print_string.h
index 4d03f4a6de..3e8f244cc5 100644
--- a/core/print_string.h
+++ b/core/string/print_string.h
@@ -31,7 +31,7 @@
#ifndef PRINT_STRING_H
#define PRINT_STRING_H
-#include "core/ustring.h"
+#include "core/string/ustring.h"
extern void (*_print_func)(String);
diff --git a/core/string_buffer.h b/core/string/string_buffer.h
index a685720851..1317b538d4 100644
--- a/core/string_buffer.h
+++ b/core/string/string_buffer.h
@@ -31,7 +31,7 @@
#ifndef STRING_BUFFER_H
#define STRING_BUFFER_H
-#include "core/ustring.h"
+#include "core/string/ustring.h"
template <int SHORT_BUFFER_SIZE = 64>
class StringBuffer {
diff --git a/core/string_builder.cpp b/core/string/string_builder.cpp
index dec299ffa3..dec299ffa3 100644
--- a/core/string_builder.cpp
+++ b/core/string/string_builder.cpp
diff --git a/core/string_builder.h b/core/string/string_builder.h
index 2a37d14218..c732f1b9ea 100644
--- a/core/string_builder.h
+++ b/core/string/string_builder.h
@@ -31,8 +31,8 @@
#ifndef STRING_BUILDER_H
#define STRING_BUILDER_H
-#include "core/ustring.h"
-#include "core/vector.h"
+#include "core/string/ustring.h"
+#include "core/templates/vector.h"
class StringBuilder {
uint32_t string_length = 0;
diff --git a/core/string_name.cpp b/core/string/string_name.cpp
index 6260e3ce8c..34afdaee38 100644
--- a/core/string_name.cpp
+++ b/core/string/string_name.cpp
@@ -31,7 +31,7 @@
#include "string_name.h"
#include "core/os/os.h"
-#include "core/print_string.h"
+#include "core/string/print_string.h"
StaticCString StaticCString::create(const char *p_ptr) {
StaticCString scs;
@@ -377,3 +377,17 @@ StringName StringName::search(const String &p_name) {
StringName::~StringName() {
unref();
}
+
+bool operator==(const String &p_name, const StringName &p_string_name) {
+ return p_name == p_string_name.operator String();
+}
+bool operator!=(const String &p_name, const StringName &p_string_name) {
+ return p_name != p_string_name.operator String();
+}
+
+bool operator==(const char *p_name, const StringName &p_string_name) {
+ return p_name == p_string_name.operator String();
+}
+bool operator!=(const char *p_name, const StringName &p_string_name) {
+ return p_name != p_string_name.operator String();
+}
diff --git a/core/string_name.h b/core/string/string_name.h
index 4f90479bda..e6b46506c3 100644
--- a/core/string_name.h
+++ b/core/string/string_name.h
@@ -32,8 +32,8 @@
#define STRING_NAME_H
#include "core/os/mutex.h"
-#include "core/safe_refcount.h"
-#include "core/ustring.h"
+#include "core/string/ustring.h"
+#include "core/templates/safe_refcount.h"
class Main;
@@ -155,6 +155,11 @@ public:
~StringName();
};
+bool operator==(const String &p_name, const StringName &p_string_name);
+bool operator!=(const String &p_name, const StringName &p_string_name);
+bool operator==(const char *p_name, const StringName &p_string_name);
+bool operator!=(const char *p_name, const StringName &p_string_name);
+
StringName _scs_create(const char *p_chr);
#endif // STRING_NAME_H
diff --git a/core/translation.cpp b/core/string/translation.cpp
index 8c8ca06740..df8a26e5ce 100644
--- a/core/translation.cpp
+++ b/core/string/translation.cpp
@@ -30,9 +30,9 @@
#include "translation.h"
+#include "core/config/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/string/translation.h
index cba25a434f..8d34f7997e 100644
--- a/core/translation.h
+++ b/core/string/translation.h
@@ -31,7 +31,7 @@
#ifndef TRANSLATION_H
#define TRANSLATION_H
-#include "core/resource.h"
+#include "core/io/resource.h"
class Translation : public Resource {
GDCLASS(Translation, Resource);
diff --git a/core/translation_po.cpp b/core/string/translation_po.cpp
index 203f29026b..203f29026b 100644
--- a/core/translation_po.cpp
+++ b/core/string/translation_po.cpp
diff --git a/core/translation_po.h b/core/string/translation_po.h
index 88830210ef..c8a47bec5a 100644
--- a/core/translation_po.h
+++ b/core/string/translation_po.h
@@ -34,7 +34,7 @@
//#define DEBUG_TRANSLATION_PO
#include "core/math/expression.h"
-#include "core/translation.h"
+#include "core/string/translation.h"
class TranslationPO : public Translation {
GDCLASS(TranslationPO, Translation);
diff --git a/core/ucaps.h b/core/string/ucaps.h
index 79b346acba..79b346acba 100644
--- a/core/ucaps.h
+++ b/core/string/ucaps.h
diff --git a/core/ustring.cpp b/core/string/ustring.cpp
index 27dab8db6e..b5758bddf3 100644
--- a/core/ustring.cpp
+++ b/core/string/ustring.cpp
@@ -30,14 +30,14 @@
#include "ustring.h"
-#include "core/color.h"
#include "core/crypto/crypto_core.h"
+#include "core/math/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 "core/string/print_string.h"
+#include "core/string/translation.h"
+#include "core/string/ucaps.h"
+#include "core/variant/variant.h"
#include <cstdint>
@@ -637,6 +637,20 @@ bool operator==(const wchar_t *p_chr, const String &p_str) {
#endif
}
+bool operator!=(const char *p_chr, const String &p_str) {
+ return !(p_str == p_chr);
+}
+
+bool operator!=(const wchar_t *p_chr, const String &p_str) {
+#ifdef WINDOWS_ENABLED
+ // wchar_t is 16-bit
+ return !(p_str == String::utf16((const char16_t *)p_chr));
+#else
+ // wchar_t is 32-bi
+ return !(p_str == String((const char32_t *)p_chr));
+#endif
+}
+
bool String::operator!=(const char *p_str) const {
return (!(*this == p_str));
}
@@ -654,7 +668,14 @@ bool String::operator!=(const String &p_str) const {
}
bool String::operator<=(const String &p_str) const {
- return (*this < p_str) || (*this == p_str);
+ return !(p_str < *this);
+}
+
+bool String::operator>(const String &p_str) const {
+ return p_str < *this;
+}
+bool String::operator>=(const String &p_str) const {
+ return !(*this < p_str);
}
bool String::operator<(const char *p_str) const {
@@ -4455,7 +4476,9 @@ String String::sprintf(const Array &values, bool *error) const {
bool left_justified = false;
bool show_sign = false;
- *error = true;
+ if (error) {
+ *error = true;
+ }
for (; *self; self++) {
const char32_t c = *self;
@@ -4716,7 +4739,9 @@ String String::sprintf(const Array &values, bool *error) const {
return "not all arguments converted during string formatting";
}
- *error = false;
+ if (error) {
+ *error = false;
+ }
return formatted;
}
diff --git a/core/ustring.h b/core/string/ustring.h
index bf9c06b9ca..201b439b12 100644
--- a/core/ustring.h
+++ b/core/string/ustring.h
@@ -31,10 +31,10 @@
#ifndef USTRING_H
#define USTRING_H
-#include "core/array.h"
-#include "core/cowdata.h"
+#include "core/templates/cowdata.h"
+#include "core/templates/vector.h"
#include "core/typedefs.h"
-#include "core/vector.h"
+#include "core/variant/array.h"
/*************************************************************************/
/* CharProxy */
@@ -254,6 +254,8 @@ public:
bool operator<(const String &p_str) const;
bool operator<=(const String &p_str) const;
+ bool operator>(const String &p_str) const;
+ bool operator>=(const String &p_str) const;
signed char casecmp_to(const String &p_str) const;
signed char nocasecmp_to(const String &p_str) const;
@@ -431,10 +433,10 @@ public:
/**
* The constructors must not depend on other overloads
*/
- /* String(char32_t p_char);*/
_FORCE_INLINE_ String() {}
_FORCE_INLINE_ String(const String &p_str) { _cowdata._ref(p_str._cowdata); }
+
String &operator=(const String &p_str) {
_cowdata._ref(p_str._cowdata);
return *this;
@@ -456,6 +458,8 @@ public:
bool operator==(const char *p_chr, const String &p_str);
bool operator==(const wchar_t *p_chr, const String &p_str);
+bool operator!=(const char *p_chr, const String &p_str);
+bool operator!=(const wchar_t *p_chr, const String &p_str);
String operator+(const char *p_chr, const String &p_str);
String operator+(const wchar_t *p_chr, const String &p_str);
diff --git a/core/templates/SCsub b/core/templates/SCsub
new file mode 100644
index 0000000000..8c4c843a33
--- /dev/null
+++ b/core/templates/SCsub
@@ -0,0 +1,7 @@
+#!/usr/bin/env python
+
+Import("env")
+
+env_templates = env.Clone()
+
+env_templates.add_source_files(env.core_sources, "*.cpp")
diff --git a/core/command_queue_mt.cpp b/core/templates/command_queue_mt.cpp
index a55eed5d3c..a94853a21c 100644
--- a/core/command_queue_mt.cpp
+++ b/core/templates/command_queue_mt.cpp
@@ -30,8 +30,8 @@
#include "command_queue_mt.h"
+#include "core/config/project_settings.h"
#include "core/os/os.h"
-#include "core/project_settings.h"
void CommandQueueMT::lock() {
mutex.lock();
diff --git a/core/command_queue_mt.h b/core/templates/command_queue_mt.h
index 0e5bc7f369..ac38d330de 100644
--- a/core/command_queue_mt.h
+++ b/core/templates/command_queue_mt.h
@@ -34,7 +34,7 @@
#include "core/os/memory.h"
#include "core/os/mutex.h"
#include "core/os/semaphore.h"
-#include "core/simple_type.h"
+#include "core/templates/simple_type.h"
#include "core/typedefs.h"
#define COMMA(N) _COMMA_##N
diff --git a/core/cowdata.h b/core/templates/cowdata.h
index 79676e6d80..d5eb08286d 100644
--- a/core/cowdata.h
+++ b/core/templates/cowdata.h
@@ -31,9 +31,9 @@
#ifndef COWDATA_H
#define COWDATA_H
-#include "core/error_macros.h"
+#include "core/error/error_macros.h"
#include "core/os/memory.h"
-#include "core/safe_refcount.h"
+#include "core/templates/safe_refcount.h"
#include <string.h>
diff --git a/core/hash_map.h b/core/templates/hash_map.h
index 10fc931e7a..f6b889015a 100644
--- a/core/hash_map.h
+++ b/core/templates/hash_map.h
@@ -31,12 +31,12 @@
#ifndef HASH_MAP_H
#define HASH_MAP_H
-#include "core/error_macros.h"
-#include "core/hashfuncs.h"
-#include "core/list.h"
+#include "core/error/error_macros.h"
#include "core/math/math_funcs.h"
#include "core/os/memory.h"
-#include "core/ustring.h"
+#include "core/string/ustring.h"
+#include "core/templates/hashfuncs.h"
+#include "core/templates/list.h"
/**
* @class HashMap
diff --git a/core/hashfuncs.h b/core/templates/hashfuncs.h
index f4048843fc..86bb1b5228 100644
--- a/core/hashfuncs.h
+++ b/core/templates/hashfuncs.h
@@ -33,12 +33,12 @@
#include "core/math/math_defs.h"
#include "core/math/math_funcs.h"
-#include "core/node_path.h"
-#include "core/object_id.h"
-#include "core/rid.h"
-#include "core/string_name.h"
+#include "core/object/object_id.h"
+#include "core/string/node_path.h"
+#include "core/string/string_name.h"
+#include "core/string/ustring.h"
+#include "core/templates/rid.h"
#include "core/typedefs.h"
-#include "core/ustring.h"
/**
* Hashing functions
*/
diff --git a/core/list.h b/core/templates/list.h
index 1cef3c484d..d745066e4c 100644
--- a/core/list.h
+++ b/core/templates/list.h
@@ -31,9 +31,9 @@
#ifndef LIST_H
#define LIST_H
-#include "core/error_macros.h"
+#include "core/error/error_macros.h"
#include "core/os/memory.h"
-#include "core/sort_array.h"
+#include "core/templates/sort_array.h"
/**
* Generic Templatized Linked List Implementation.
diff --git a/core/local_vector.h b/core/templates/local_vector.h
index b0dbd22b29..4ef040dc77 100644
--- a/core/local_vector.h
+++ b/core/templates/local_vector.h
@@ -31,11 +31,11 @@
#ifndef LOCAL_VECTOR_H
#define LOCAL_VECTOR_H
-#include "core/error_macros.h"
+#include "core/error/error_macros.h"
#include "core/os/copymem.h"
#include "core/os/memory.h"
-#include "core/sort_array.h"
-#include "core/vector.h"
+#include "core/templates/sort_array.h"
+#include "core/templates/vector.h"
template <class T, class U = uint32_t, bool force_trivial = false>
class LocalVector {
diff --git a/core/map.h b/core/templates/map.h
index fd4f500556..c454d69256 100644
--- a/core/map.h
+++ b/core/templates/map.h
@@ -31,8 +31,8 @@
#ifndef MAP_H
#define MAP_H
-#include "core/error_macros.h"
-#include "core/set.h"
+#include "core/error/error_macros.h"
+#include "core/templates/set.h"
// based on the very nice implementation of rb-trees by:
// https://web.archive.org/web/20120507164830/http://web.mit.edu/~emin/www/source_code/red_black_tree/index.html
diff --git a/core/oa_hash_map.h b/core/templates/oa_hash_map.h
index 6061366ab3..d9d632b4ce 100644
--- a/core/oa_hash_map.h
+++ b/core/templates/oa_hash_map.h
@@ -31,10 +31,10 @@
#ifndef OA_HASH_MAP_H
#define OA_HASH_MAP_H
-#include "core/hashfuncs.h"
#include "core/math/math_funcs.h"
#include "core/os/copymem.h"
#include "core/os/memory.h"
+#include "core/templates/hashfuncs.h"
/**
* A HashMap implementation that uses open addressing with Robin Hood hashing.
diff --git a/core/ordered_hash_map.h b/core/templates/ordered_hash_map.h
index e6a6340a2f..9398868b01 100644
--- a/core/ordered_hash_map.h
+++ b/core/templates/ordered_hash_map.h
@@ -31,9 +31,9 @@
#ifndef ORDERED_HASH_MAP_H
#define ORDERED_HASH_MAP_H
-#include "core/hash_map.h"
-#include "core/list.h"
-#include "core/pair.h"
+#include "core/templates/hash_map.h"
+#include "core/templates/list.h"
+#include "core/templates/pair.h"
/**
* A hash map which allows to iterate elements in insertion order.
diff --git a/core/pair.h b/core/templates/pair.h
index 89ea2b9fd9..89ea2b9fd9 100644
--- a/core/pair.h
+++ b/core/templates/pair.h
diff --git a/core/rid.h b/core/templates/rid.h
index 4b65f3fb6a..a475d166d5 100644
--- a/core/rid.h
+++ b/core/templates/rid.h
@@ -52,6 +52,9 @@ public:
_FORCE_INLINE_ bool operator>(const RID &p_rid) const {
return _id > p_rid._id;
}
+ _FORCE_INLINE_ bool operator>=(const RID &p_rid) const {
+ return _id >= p_rid._id;
+ }
_FORCE_INLINE_ bool operator!=(const RID &p_rid) const {
return _id != p_rid._id;
}
diff --git a/core/rid_owner.cpp b/core/templates/rid_owner.cpp
index a5065f29f8..a5065f29f8 100644
--- a/core/rid_owner.cpp
+++ b/core/templates/rid_owner.cpp
diff --git a/core/rid_owner.h b/core/templates/rid_owner.h
index 30f1e41733..d1bcb92010 100644
--- a/core/rid_owner.h
+++ b/core/templates/rid_owner.h
@@ -31,14 +31,14 @@
#ifndef RID_OWNER_H
#define RID_OWNER_H
-#include "core/list.h"
-#include "core/oa_hash_map.h"
#include "core/os/memory.h"
-#include "core/print_string.h"
-#include "core/rid.h"
-#include "core/safe_refcount.h"
-#include "core/set.h"
-#include "core/spin_lock.h"
+#include "core/os/spin_lock.h"
+#include "core/string/print_string.h"
+#include "core/templates/list.h"
+#include "core/templates/oa_hash_map.h"
+#include "core/templates/rid.h"
+#include "core/templates/safe_refcount.h"
+#include "core/templates/set.h"
#include <stdio.h>
#include <typeinfo>
diff --git a/core/ring_buffer.h b/core/templates/ring_buffer.h
index 6b71d12cf3..12ec047fb6 100644
--- a/core/ring_buffer.h
+++ b/core/templates/ring_buffer.h
@@ -31,7 +31,7 @@
#ifndef RING_BUFFER_H
#define RING_BUFFER_H
-#include "core/vector.h"
+#include "core/templates/vector.h"
template <typename T>
class RingBuffer {
diff --git a/core/safe_refcount.cpp b/core/templates/safe_refcount.cpp
index d5ee778ef7..d5ee778ef7 100644
--- a/core/safe_refcount.cpp
+++ b/core/templates/safe_refcount.cpp
diff --git a/core/safe_refcount.h b/core/templates/safe_refcount.h
index dc4e62354a..dc4e62354a 100644
--- a/core/safe_refcount.h
+++ b/core/templates/safe_refcount.h
diff --git a/core/self_list.h b/core/templates/self_list.h
index 3104bcb714..2a037d109c 100644
--- a/core/self_list.h
+++ b/core/templates/self_list.h
@@ -31,7 +31,7 @@
#ifndef SELF_LIST_H
#define SELF_LIST_H
-#include "core/error_macros.h"
+#include "core/error/error_macros.h"
#include "core/typedefs.h"
template <class T>
diff --git a/core/set.h b/core/templates/set.h
index 1bc0a3f41e..1bc0a3f41e 100644
--- a/core/set.h
+++ b/core/templates/set.h
diff --git a/core/simple_type.h b/core/templates/simple_type.h
index 841ab9f384..841ab9f384 100644
--- a/core/simple_type.h
+++ b/core/templates/simple_type.h
diff --git a/core/sort_array.h b/core/templates/sort_array.h
index 93cc6f727d..a4326ac565 100644
--- a/core/sort_array.h
+++ b/core/templates/sort_array.h
@@ -31,7 +31,7 @@
#ifndef SORT_ARRAY_H
#define SORT_ARRAY_H
-#include "core/error_macros.h"
+#include "core/error/error_macros.h"
#include "core/typedefs.h"
#define ERR_BAD_COMPARE(cond) \
diff --git a/core/thread_work_pool.cpp b/core/templates/thread_work_pool.cpp
index 3a95e83ffc..3a95e83ffc 100644
--- a/core/thread_work_pool.cpp
+++ b/core/templates/thread_work_pool.cpp
diff --git a/core/thread_work_pool.h b/core/templates/thread_work_pool.h
index 661060aa3f..661060aa3f 100644
--- a/core/thread_work_pool.h
+++ b/core/templates/thread_work_pool.h
diff --git a/core/vector.h b/core/templates/vector.h
index 5a61f0eae3..9d45f7c30a 100644
--- a/core/vector.h
+++ b/core/templates/vector.h
@@ -37,11 +37,11 @@
* Vector container. Regular Vector Container. Use with care and for smaller arrays when possible. Use Vector for large arrays.
*/
-#include "core/cowdata.h"
-#include "core/error_macros.h"
+#include "core/error/error_macros.h"
#include "core/os/copymem.h"
#include "core/os/memory.h"
-#include "core/sort_array.h"
+#include "core/templates/cowdata.h"
+#include "core/templates/sort_array.h"
template <class T>
class VectorWriteProxy {
@@ -157,6 +157,32 @@ public:
return slice;
}
+ bool operator==(const Vector<T> &p_arr) const {
+ int s = size();
+ if (s != p_arr.size()) {
+ return false;
+ }
+ for (int i = 0; i < s; i++) {
+ if (operator[](i) != p_arr[i]) {
+ return false;
+ }
+ }
+ return true;
+ }
+
+ bool operator!=(const Vector<T> &p_arr) const {
+ int s = size();
+ if (s != p_arr.size()) {
+ return true;
+ }
+ for (int i = 0; i < s; i++) {
+ if (operator[](i) != p_arr[i]) {
+ return true;
+ }
+ }
+ return false;
+ }
+
_FORCE_INLINE_ Vector() {}
_FORCE_INLINE_ Vector(const Vector &p_from) { _cowdata._ref(p_from._cowdata); }
diff --git a/core/vmap.h b/core/templates/vmap.h
index c91ea9b3c9..8d2a3d2a9c 100644
--- a/core/vmap.h
+++ b/core/templates/vmap.h
@@ -31,7 +31,7 @@
#ifndef VMAP_H
#define VMAP_H
-#include "core/cowdata.h"
+#include "core/templates/cowdata.h"
#include "core/typedefs.h"
template <class T, class V>
diff --git a/core/vset.h b/core/templates/vset.h
index 034b8fe851..4c0b8717b6 100644
--- a/core/vset.h
+++ b/core/templates/vset.h
@@ -31,8 +31,8 @@
#ifndef VSET_H
#define VSET_H
+#include "core/templates/vector.h"
#include "core/typedefs.h"
-#include "core/vector.h"
template <class T>
class VSet {
diff --git a/core/typedefs.h b/core/typedefs.h
index f0c32f2c95..d7ee5ee40e 100644
--- a/core/typedefs.h
+++ b/core/typedefs.h
@@ -41,8 +41,8 @@
#include "platform_config.h"
// Should be available everywhere.
-#include "core/error_list.h"
-#include "core/int_types.h"
+#include "core/error/error_list.h"
+#include <cstdint>
// Turn argument to string constant:
// https://gcc.gnu.org/onlinedocs/cpp/Stringizing.html#Stringizing
diff --git a/core/variant/SCsub b/core/variant/SCsub
new file mode 100644
index 0000000000..7f4c8b7788
--- /dev/null
+++ b/core/variant/SCsub
@@ -0,0 +1,7 @@
+#!/usr/bin/env python
+
+Import("env")
+
+env_variant = env.Clone()
+
+env_variant.add_source_files(env.core_sources, "*.cpp")
diff --git a/core/array.cpp b/core/variant/array.cpp
index c6e90d71ec..04ee47efff 100644
--- a/core/array.cpp
+++ b/core/variant/array.cpp
@@ -31,11 +31,11 @@
#include "array.h"
#include "container_type_validate.h"
-#include "core/class_db.h"
-#include "core/hashfuncs.h"
-#include "core/script_language.h"
-#include "core/variant.h"
-#include "core/vector.h"
+#include "core/object/class_db.h"
+#include "core/object/script_language.h"
+#include "core/templates/hashfuncs.h"
+#include "core/templates/vector.h"
+#include "core/variant/variant.h"
class ArrayPrivate {
public:
@@ -98,6 +98,37 @@ bool Array::operator==(const Array &p_array) const {
return _p == p_array._p;
}
+bool Array::operator!=(const Array &p_array) const {
+ return !operator==(p_array);
+}
+
+bool Array::operator<(const Array &p_array) const {
+ int a_len = size();
+ int b_len = p_array.size();
+
+ int min_cmp = MIN(a_len, b_len);
+
+ for (int i = 0; i < min_cmp; i++) {
+ if (operator[](i) < p_array[i]) {
+ return true;
+ } else if (p_array[i] < operator[](i)) {
+ return false;
+ }
+ }
+
+ return a_len < b_len;
+}
+
+bool Array::operator<=(const Array &p_array) const {
+ return !operator>(p_array);
+}
+bool Array::operator>(const Array &p_array) const {
+ return p_array < *this;
+}
+bool Array::operator>=(const Array &p_array) const {
+ return !operator<(p_array);
+}
+
uint32_t Array::hash() const {
uint32_t h = hash_djb2_one_32(0);
@@ -134,7 +165,7 @@ void Array::_assign(const Array &p_array) {
} else if (Variant::can_convert_strict(src_val.get_type(), _p->typed.type)) {
Variant *ptr = &src_val;
Callable::CallError ce;
- new_array.write[i] = Variant::construct(_p->typed.type, (const Variant **)&ptr, 1, ce, true);
+ Variant::construct(_p->typed.type, new_array.write[i], (const Variant **)&ptr, 1, ce);
if (ce.error != Callable::CallError::CALL_OK) {
ERR_FAIL_MSG("Unable to convert array index " + itos(i) + " from '" + Variant::get_type_name(src_val.get_type()) + "' to '" + Variant::get_type_name(_p->typed.type) + "'.");
}
diff --git a/core/array.h b/core/variant/array.h
index 34367088e4..b37d600abd 100644
--- a/core/array.h
+++ b/core/variant/array.h
@@ -61,6 +61,7 @@ public:
void clear();
bool operator==(const Array &p_array) const;
+ bool operator!=(const Array &p_array) const;
uint32_t hash() const;
void operator=(const Array &p_array);
@@ -98,6 +99,11 @@ public:
Array slice(int p_begin, int p_end, int p_step = 1, bool p_deep = false) const;
+ bool operator<(const Array &p_array) const;
+ bool operator<=(const Array &p_array) const;
+ bool operator>(const Array &p_array) const;
+ bool operator>=(const Array &p_array) const;
+
Variant min() const;
Variant max() const;
diff --git a/core/binder_common.h b/core/variant/binder_common.h
index 0fbfa56230..e72f76c5e1 100644
--- a/core/binder_common.h
+++ b/core/variant/binder_common.h
@@ -31,14 +31,14 @@
#ifndef BINDER_COMMON_H
#define BINDER_COMMON_H
-#include "core/list.h"
-#include "core/method_ptrcall.h"
-#include "core/object.h"
-#include "core/simple_type.h"
-#include "core/type_info.h"
+#include "core/object/object.h"
+#include "core/templates/list.h"
+#include "core/templates/simple_type.h"
#include "core/typedefs.h"
-#include "core/variant.h"
-#include "core/variant_internal.h"
+#include "core/variant/method_ptrcall.h"
+#include "core/variant/type_info.h"
+#include "core/variant/variant.h"
+#include "core/variant/variant_internal.h"
#include <stdio.h>
diff --git a/core/callable.cpp b/core/variant/callable.cpp
index c368565687..e504fd05e3 100644
--- a/core/callable.cpp
+++ b/core/variant/callable.cpp
@@ -31,10 +31,10 @@
#include "callable.h"
#include "callable_bind.h"
-#include "core/script_language.h"
-#include "message_queue.h"
-#include "object.h"
-#include "reference.h"
+#include "core/object/message_queue.h"
+#include "core/object/object.h"
+#include "core/object/reference.h"
+#include "core/object/script_language.h"
void Callable::call_deferred(const Variant **p_arguments, int p_argcount) const {
MessageQueue::get_singleton()->push_callable(*this, p_arguments, p_argcount);
diff --git a/core/callable.h b/core/variant/callable.h
index 936272a681..40621fbde3 100644
--- a/core/callable.h
+++ b/core/variant/callable.h
@@ -31,9 +31,9 @@
#ifndef CALLABLE_H
#define CALLABLE_H
-#include "core/list.h"
-#include "core/object_id.h"
-#include "core/string_name.h"
+#include "core/object/object_id.h"
+#include "core/string/string_name.h"
+#include "core/templates/list.h"
class Object;
class Variant;
diff --git a/core/callable_bind.cpp b/core/variant/callable_bind.cpp
index da08d3ccbd..da08d3ccbd 100644
--- a/core/callable_bind.cpp
+++ b/core/variant/callable_bind.cpp
diff --git a/core/callable_bind.h b/core/variant/callable_bind.h
index 21b9228be3..fc5659e412 100644
--- a/core/callable_bind.h
+++ b/core/variant/callable_bind.h
@@ -31,8 +31,8 @@
#ifndef CALLABLE_BIND_H
#define CALLABLE_BIND_H
-#include "core/callable.h"
-#include "core/variant.h"
+#include "core/variant/callable.h"
+#include "core/variant/variant.h"
class CallableCustomBind : public CallableCustom {
Callable callable;
diff --git a/core/container_type_validate.h b/core/variant/container_type_validate.h
index 8a361aa0ef..4d3a5f683b 100644
--- a/core/container_type_validate.h
+++ b/core/variant/container_type_validate.h
@@ -31,8 +31,8 @@
#ifndef CONTAINER_TYPE_VALIDATE_H
#define CONTAINER_TYPE_VALIDATE_H
-#include "core/script_language.h"
-#include "core/variant.h"
+#include "core/object/script_language.h"
+#include "core/variant/variant.h"
struct ContainerTypeValidate {
Variant::Type type = Variant::NIL;
diff --git a/core/dictionary.cpp b/core/variant/dictionary.cpp
index 052e1bdae1..2bc1f7a86d 100644
--- a/core/dictionary.cpp
+++ b/core/variant/dictionary.cpp
@@ -30,9 +30,9 @@
#include "dictionary.h"
-#include "core/ordered_hash_map.h"
-#include "core/safe_refcount.h"
-#include "core/variant.h"
+#include "core/templates/ordered_hash_map.h"
+#include "core/templates/safe_refcount.h"
+#include "core/variant/variant.h"
struct DictionaryPrivate {
SafeRefCount refcount;
diff --git a/core/dictionary.h b/core/variant/dictionary.h
index a01d96ba01..bbe94122ad 100644
--- a/core/dictionary.h
+++ b/core/variant/dictionary.h
@@ -31,9 +31,9 @@
#ifndef DICTIONARY_H
#define DICTIONARY_H
-#include "core/array.h"
-#include "core/list.h"
-#include "core/ustring.h"
+#include "core/string/ustring.h"
+#include "core/templates/list.h"
+#include "core/variant/array.h"
class Variant;
diff --git a/core/method_ptrcall.h b/core/variant/method_ptrcall.h
index 022ed2a5d6..936de145f8 100644
--- a/core/method_ptrcall.h
+++ b/core/variant/method_ptrcall.h
@@ -32,9 +32,9 @@
#define METHOD_PTRCALL_H
#include "core/math/transform_2d.h"
-#include "core/object_id.h"
+#include "core/object/object_id.h"
#include "core/typedefs.h"
-#include "core/variant.h"
+#include "core/variant/variant.h"
#ifdef PTRCALL_ENABLED
diff --git a/core/type_info.h b/core/variant/type_info.h
index b9ae88d97c..ce7c2bfe14 100644
--- a/core/type_info.h
+++ b/core/variant/type_info.h
@@ -153,7 +153,7 @@ MAKE_TYPE_INFO(Transform, Variant::TRANSFORM)
MAKE_TYPE_INFO(Color, Variant::COLOR)
MAKE_TYPE_INFO(StringName, Variant::STRING_NAME)
MAKE_TYPE_INFO(NodePath, Variant::NODE_PATH)
-MAKE_TYPE_INFO(RID, Variant::_RID)
+MAKE_TYPE_INFO(RID, Variant::RID)
MAKE_TYPE_INFO(Callable, Variant::CALLABLE)
MAKE_TYPE_INFO(Signal, Variant::SIGNAL)
MAKE_TYPE_INFO(Dictionary, Variant::DICTIONARY)
diff --git a/core/typed_array.h b/core/variant/typed_array.h
index 86f26d7550..ff42cb687e 100644
--- a/core/typed_array.h
+++ b/core/variant/typed_array.h
@@ -31,9 +31,9 @@
#ifndef TYPED_ARRAY_H
#define TYPED_ARRAY_H
-#include "core/array.h"
-#include "core/method_ptrcall.h"
-#include "core/variant.h"
+#include "core/variant/array.h"
+#include "core/variant/method_ptrcall.h"
+#include "core/variant/variant.h"
template <class T>
class TypedArray : public Array {
@@ -105,7 +105,7 @@ MAKE_TYPED_ARRAY(Transform, Variant::TRANSFORM)
MAKE_TYPED_ARRAY(Color, Variant::COLOR)
MAKE_TYPED_ARRAY(StringName, Variant::STRING_NAME)
MAKE_TYPED_ARRAY(NodePath, Variant::NODE_PATH)
-MAKE_TYPED_ARRAY(RID, Variant::_RID)
+MAKE_TYPED_ARRAY(RID, Variant::RID)
MAKE_TYPED_ARRAY(Callable, Variant::CALLABLE)
MAKE_TYPED_ARRAY(Signal, Variant::SIGNAL)
MAKE_TYPED_ARRAY(Dictionary, Variant::DICTIONARY)
@@ -207,7 +207,7 @@ MAKE_TYPED_ARRAY_INFO(Transform, Variant::TRANSFORM)
MAKE_TYPED_ARRAY_INFO(Color, Variant::COLOR)
MAKE_TYPED_ARRAY_INFO(StringName, Variant::STRING_NAME)
MAKE_TYPED_ARRAY_INFO(NodePath, Variant::NODE_PATH)
-MAKE_TYPED_ARRAY_INFO(RID, Variant::_RID)
+MAKE_TYPED_ARRAY_INFO(RID, Variant::RID)
MAKE_TYPED_ARRAY_INFO(Callable, Variant::CALLABLE)
MAKE_TYPED_ARRAY_INFO(Signal, Variant::SIGNAL)
MAKE_TYPED_ARRAY_INFO(Dictionary, Variant::DICTIONARY)
diff --git a/core/variant.cpp b/core/variant/variant.cpp
index 181ced0f32..3114a358f7 100644
--- a/core/variant.cpp
+++ b/core/variant/variant.cpp
@@ -33,10 +33,10 @@
#include "core/core_string_names.h"
#include "core/debugger/engine_debugger.h"
#include "core/io/marshalls.h"
+#include "core/io/resource.h"
#include "core/math/math_funcs.h"
-#include "core/print_string.h"
-#include "core/resource.h"
-#include "core/variant_parser.h"
+#include "core/string/print_string.h"
+#include "core/variant/variant_parser.h"
#include "scene/gui/control.h"
#include "scene/main/node.h"
@@ -109,7 +109,7 @@ String Variant::get_type_name(Variant::Type p_type) {
return "Color";
} break;
- case _RID: {
+ case RID: {
return "RID";
} break;
case OBJECT: {
@@ -342,7 +342,7 @@ bool Variant::can_convert(Variant::Type p_type_from, Variant::Type p_type_to) {
} break;
- case _RID: {
+ case RID: {
static const Type valid[] = {
OBJECT,
NIL
@@ -649,7 +649,7 @@ bool Variant::can_convert_strict(Variant::Type p_type_from, Variant::Type p_type
} break;
- case _RID: {
+ case RID: {
static const Type valid[] = {
OBJECT,
NIL
@@ -891,8 +891,8 @@ bool Variant::is_zero() const {
return *reinterpret_cast<const Color *>(_data._mem) == Color();
} break;
- case _RID: {
- return *reinterpret_cast<const RID *>(_data._mem) == RID();
+ case RID: {
+ return *reinterpret_cast<const ::RID *>(_data._mem) == ::RID();
} break;
case OBJECT: {
return _get_obj().obj == nullptr;
@@ -1109,8 +1109,8 @@ void Variant::reference(const Variant &p_variant) {
memnew_placement(_data._mem, Color(*reinterpret_cast<const Color *>(p_variant._data._mem)));
} break;
- case _RID: {
- memnew_placement(_data._mem, RID(*reinterpret_cast<const RID *>(p_variant._data._mem)));
+ case RID: {
+ memnew_placement(_data._mem, ::RID(*reinterpret_cast<const ::RID *>(p_variant._data._mem)));
} break;
case OBJECT: {
memnew_placement(_data._mem, ObjData);
@@ -1266,7 +1266,7 @@ void Variant::zero() {
}
}
-void Variant::clear() {
+void Variant::_clear_internal() {
switch (type) {
case STRING: {
reinterpret_cast<String *>(_data._mem)->~String();
@@ -1311,9 +1311,11 @@ void Variant::clear() {
_get_obj().obj = nullptr;
_get_obj().id = ObjectID();
} break;
- case _RID: {
+ case RID: {
// not much need probably
- reinterpret_cast<RID *>(_data._mem)->~RID();
+ // Can't seem to use destructor + scoping operator, so hack.
+ typedef ::RID RID_Class;
+ reinterpret_cast<RID_Class *>(_data._mem)->~RID_Class();
} break;
case CALLABLE: {
reinterpret_cast<Callable *>(_data._mem)->~Callable();
@@ -1358,8 +1360,6 @@ void Variant::clear() {
default: {
} /* not needed */
}
-
- type = NIL;
}
Variant::operator signed int() const {
@@ -1849,8 +1849,8 @@ String Variant::stringify(List<const void *> &stack) const {
const Signal &s = *reinterpret_cast<const Signal *>(_data._mem);
return s;
} break;
- case _RID: {
- const RID &s = *reinterpret_cast<const RID *>(_data._mem);
+ case RID: {
+ const ::RID &s = *reinterpret_cast<const ::RID *>(_data._mem);
return "RID(" + itos(s.get_id()) + ")";
} break;
default: {
@@ -2041,25 +2041,25 @@ Variant::operator NodePath() const {
}
}
-Variant::operator RID() const {
- if (type == _RID) {
- return *reinterpret_cast<const RID *>(_data._mem);
+Variant::operator ::RID() const {
+ if (type == RID) {
+ return *reinterpret_cast<const ::RID *>(_data._mem);
} else if (type == OBJECT && _get_obj().obj == nullptr) {
- return RID();
+ return ::RID();
} else if (type == OBJECT && _get_obj().obj) {
#ifdef DEBUG_ENABLED
if (EngineDebugger::is_active()) {
- ERR_FAIL_COND_V_MSG(ObjectDB::get_instance(_get_obj().id) == nullptr, RID(), "Invalid pointer (object was freed).");
+ ERR_FAIL_COND_V_MSG(ObjectDB::get_instance(_get_obj().id) == nullptr, ::RID(), "Invalid pointer (object was freed).");
}
#endif
Callable::CallError ce;
Variant ret = _get_obj().obj->call(CoreStringNames::get_singleton()->get_rid, nullptr, 0, ce);
- if (ce.error == Callable::CallError::CALL_OK && ret.get_type() == Variant::_RID) {
+ if (ce.error == Callable::CallError::CALL_OK && ret.get_type() == Variant::RID) {
return ret;
}
- return RID();
+ return ::RID();
} else {
- return RID();
+ return ::RID();
}
}
@@ -2263,9 +2263,9 @@ Variant::operator Vector<Color>() const {
/* helpers */
-Variant::operator Vector<RID>() const {
+Variant::operator Vector<::RID>() const {
Array va = operator Array();
- Vector<RID> rids;
+ Vector<::RID> rids;
rids.resize(va.size());
for (int i = 0; i < rids.size(); i++) {
rids.write[i] = va[i];
@@ -2520,9 +2520,9 @@ Variant::Variant(const NodePath &p_node_path) {
memnew_placement(_data._mem, NodePath(p_node_path));
}
-Variant::Variant(const RID &p_rid) {
- type = _RID;
- memnew_placement(_data._mem, RID(p_rid));
+Variant::Variant(const ::RID &p_rid) {
+ type = RID;
+ memnew_placement(_data._mem, ::RID(p_rid));
}
Variant::Variant(const Object *p_object) {
@@ -2580,7 +2580,7 @@ Variant::Variant(const Vector<Plane> &p_array) {
}
}
-Variant::Variant(const Vector<RID> &p_array) {
+Variant::Variant(const Vector<::RID> &p_array) {
type = ARRAY;
Array *rid_array = memnew_placement(_data._mem, Array);
@@ -2753,8 +2753,8 @@ void Variant::operator=(const Variant &p_variant) {
case COLOR: {
*reinterpret_cast<Color *>(_data._mem) = *reinterpret_cast<const Color *>(p_variant._data._mem);
} break;
- case _RID: {
- *reinterpret_cast<RID *>(_data._mem) = *reinterpret_cast<const RID *>(p_variant._data._mem);
+ case RID: {
+ *reinterpret_cast<::RID *>(_data._mem) = *reinterpret_cast<const ::RID *>(p_variant._data._mem);
} break;
case OBJECT: {
if (_get_obj().id.is_reference()) {
@@ -2955,8 +2955,8 @@ uint32_t Variant::hash() const {
return hash_djb2_one_float(reinterpret_cast<const Color *>(_data._mem)->a, hash);
} break;
- case _RID: {
- return hash_djb2_one_64(reinterpret_cast<const RID *>(_data._mem)->get_id());
+ case RID: {
+ return hash_djb2_one_64(reinterpret_cast<const ::RID *>(_data._mem)->get_id());
} break;
case OBJECT: {
return hash_djb2_one_64(make_uint64_t(_get_obj().obj));
@@ -3519,3 +3519,16 @@ String vformat(const String &p_text, const Variant &p1, const Variant &p2, const
return fmt;
}
+
+void Variant::register_types() {
+ _register_variant_operators();
+ _register_variant_methods();
+ _register_variant_setters_getters();
+ _register_variant_constructors();
+}
+void Variant::unregister_types() {
+ _unregister_variant_operators();
+ _unregister_variant_methods();
+ _unregister_variant_setters_getters();
+ _unregister_variant_constructors();
+}
diff --git a/core/variant.h b/core/variant/variant.h
index 84e5427b21..ee08373b27 100644
--- a/core/variant.h
+++ b/core/variant/variant.h
@@ -31,13 +31,10 @@
#ifndef VARIANT_H
#define VARIANT_H
-#include "core/array.h"
-#include "core/callable.h"
-#include "core/color.h"
-#include "core/dictionary.h"
#include "core/io/ip_address.h"
#include "core/math/aabb.h"
#include "core/math/basis.h"
+#include "core/math/color.h"
#include "core/math/face3.h"
#include "core/math/plane.h"
#include "core/math/quat.h"
@@ -45,10 +42,13 @@
#include "core/math/transform_2d.h"
#include "core/math/vector3.h"
#include "core/math/vector3i.h"
-#include "core/node_path.h"
-#include "core/object_id.h"
-#include "core/rid.h"
-#include "core/ustring.h"
+#include "core/object/object_id.h"
+#include "core/string/node_path.h"
+#include "core/string/ustring.h"
+#include "core/templates/rid.h"
+#include "core/variant/array.h"
+#include "core/variant/callable.h"
+#include "core/variant/dictionary.h"
class Object;
class Node; // helper
@@ -97,7 +97,7 @@ public:
COLOR,
STRING_NAME,
NODE_PATH,
- _RID,
+ RID,
OBJECT,
CALLABLE,
SIGNAL,
@@ -207,7 +207,66 @@ private:
} _data alignas(8);
void reference(const Variant &p_variant);
- void clear();
+
+ void _clear_internal();
+
+ _FORCE_INLINE_ void clear() {
+ static const bool needs_deinit[Variant::VARIANT_MAX] = {
+ false, //NIL,
+ false, //BOOL,
+ false, //INT,
+ false, //FLOAT,
+ true, //STRING,
+ false, //VECTOR2,
+ false, //VECTOR2I,
+ false, //RECT2,
+ false, //RECT2I,
+ false, //VECTOR3,
+ false, //VECTOR3I,
+ true, //TRANSFORM2D,
+ false, //PLANE,
+ false, //QUAT,
+ true, //AABB,
+ true, //BASIS,
+ true, //TRANSFORM,
+
+ // misc types
+ false, //COLOR,
+ true, //STRING_NAME,
+ true, //NODE_PATH,
+ false, //RID,
+ true, //OBJECT,
+ true, //CALLABLE,
+ true, //SIGNAL,
+ true, //DICTIONARY,
+ true, //ARRAY,
+
+ // typed arrays
+ true, //PACKED_BYTE_ARRAY,
+ true, //PACKED_INT32_ARRAY,
+ true, //PACKED_INT64_ARRAY,
+ true, //PACKED_FLOAT32_ARRAY,
+ true, //PACKED_FLOAT64_ARRAY,
+ true, //PACKED_STRING_ARRAY,
+ true, //PACKED_VECTOR2_ARRAY,
+ true, //PACKED_VECTOR3_ARRAY,
+ true, //PACKED_COLOR_ARRAY,
+ };
+
+ if (unlikely(needs_deinit[type])) { //make it fast for types that dont need deinit
+ _clear_internal();
+ }
+ type = NIL;
+ }
+
+ static void _register_variant_operators();
+ static void _unregister_variant_operators();
+ static void _register_variant_methods();
+ static void _unregister_variant_methods();
+ static void _register_variant_setters_getters();
+ static void _unregister_variant_setters_getters();
+ static void _register_variant_constructors();
+ static void _unregister_variant_constructors();
public:
_FORCE_INLINE_ Type get_type() const {
@@ -266,7 +325,7 @@ public:
operator Color() const;
operator NodePath() const;
- operator RID() const;
+ operator ::RID() const;
operator Object *() const;
operator Node *() const;
@@ -291,7 +350,7 @@ public:
operator Vector<Variant>() const;
operator Vector<StringName>() const;
- operator Vector<RID>() const;
+ operator Vector<::RID>() const;
operator Vector<Vector2>() const;
// some core type enums to convert to
@@ -338,7 +397,7 @@ public:
Variant(const Transform &p_transform);
Variant(const Color &p_color);
Variant(const NodePath &p_node_path);
- Variant(const RID &p_rid);
+ Variant(const ::RID &p_rid);
Variant(const Object *p_object);
Variant(const Callable &p_callable);
Variant(const Signal &p_signal);
@@ -358,7 +417,7 @@ public:
Variant(const Vector<Variant> &p_array);
Variant(const Vector<StringName> &p_array);
- Variant(const Vector<RID> &p_array); // helper
+ Variant(const Vector<::RID> &p_array); // helper
Variant(const Vector<Vector2> &p_array); // helper
Variant(const IP_Address &p_address);
@@ -381,7 +440,6 @@ public:
OP_NEGATE,
OP_POSITIVE,
OP_MODULE,
- OP_STRING_CONCAT,
//bitwise
OP_SHIFT_LEFT,
OP_SHIFT_RIGHT,
@@ -409,6 +467,14 @@ public:
return res;
}
+ static Variant::Type get_operator_return_type(Operator p_operator, Type p_type_a, Type p_type_b);
+ typedef void (*ValidatedOperatorEvaluator)(const Variant *left, const Variant *right, Variant *r_ret);
+ static ValidatedOperatorEvaluator get_validated_operator_evaluator(Operator p_operator, Type p_type_a, Type p_type_b);
+#ifdef PTRCALL_ENABLED
+ typedef void (*PTROperatorEvaluator)(const void *left, const void *right, void *r_ret);
+ static PTROperatorEvaluator get_ptr_operator_evaluator(Operator p_operator, Type p_type_a, Type p_type_b);
+#endif
+
void zero();
Variant duplicate(bool deep = false) const;
static void blend(const Variant &a, const Variant &b, float c, Variant &r_dst);
@@ -460,7 +526,19 @@ public:
static String get_call_error_text(Object *p_base, const StringName &p_method, const Variant **p_argptrs, int p_argcount, const Callable::CallError &ce);
static String get_callable_error_text(const Callable &p_callable, const Variant **p_argptrs, int p_argcount, const Callable::CallError &ce);
- static Variant construct(const Variant::Type, const Variant **p_args, int p_argcount, Callable::CallError &r_error, bool p_strict = true);
+ // constructor
+ typedef void (*ValidatedConstructor)(Variant &r_base, const Variant **p_args);
+ typedef void (*PTRConstructor)(void *base, const void **p_args);
+
+ static int get_constructor_count(Variant::Type p_type);
+ static ValidatedConstructor get_validated_constructor(Variant::Type p_type, int p_constructor);
+ static PTRConstructor get_ptr_constructor(Variant::Type p_type, int p_constructor);
+ static int get_constructor_argument_count(Variant::Type p_type, int p_constructor);
+ static Variant::Type get_constructor_argument_type(Variant::Type p_type, int p_constructor, int p_argument);
+ static String get_constructor_argument_name(Variant::Type p_type, int p_constructor, int p_argument);
+ static void construct(Variant::Type, Variant &base, const Variant **p_args, int p_argcount, Callable::CallError &r_error);
+
+ static void get_constructor_list(Type p_type, List<MethodInfo> *r_list); //convenience
void get_method_list(List<MethodInfo> *p_list) const;
bool has_method(const StringName &p_method) const;
@@ -470,8 +548,66 @@ public:
static Vector<StringName> get_method_argument_names(Variant::Type p_type, const StringName &p_method);
static bool is_method_const(Variant::Type p_type, const StringName &p_method);
- void set_named(const StringName &p_index, const Variant &p_value, bool *r_valid = nullptr);
- Variant get_named(const StringName &p_index, bool *r_valid = nullptr) const;
+ void set_named(const StringName &p_member, const Variant &p_value, bool &r_valid);
+ Variant get_named(const StringName &p_member, bool &r_valid) const;
+
+ typedef void (*ValidatedSetter)(Variant *base, const Variant *value);
+ typedef void (*ValidatedGetter)(const Variant *base, Variant *value);
+
+ static bool has_member(Variant::Type p_type, const StringName &p_member);
+ static Variant::Type get_member_type(Variant::Type p_type, const StringName &p_member);
+ static void get_member_list(Type p_type, List<StringName> *r_members);
+
+ static ValidatedSetter get_member_validated_setter(Variant::Type p_type, const StringName &p_member);
+ static ValidatedGetter get_member_validated_getter(Variant::Type p_type, const StringName &p_member);
+
+ typedef void (*PTRSetter)(void *base, const void *value);
+ typedef void (*PTRGetter)(const void *base, void *value);
+
+ static PTRSetter get_member_ptr_setter(Variant::Type p_type, const StringName &p_member);
+ static PTRGetter get_member_ptr_getter(Variant::Type p_type, const StringName &p_member);
+
+ static bool has_indexing(Variant::Type p_type);
+ static Variant::Type get_indexed_element_type(Variant::Type p_type);
+
+ typedef void (*ValidatedIndexedSetter)(Variant *base, int64_t index, const Variant *value, bool &oob);
+ typedef void (*ValidatedIndexedGetter)(const Variant *base, int64_t index, Variant *value, bool &oob);
+
+ static ValidatedIndexedSetter get_member_validated_indexed_setter(Variant::Type p_type);
+ static ValidatedIndexedGetter get_member_validated_indexed_getter(Variant::Type p_type);
+
+ typedef void (*PTRIndexedSetter)(void *base, int64_t index, const void *value);
+ typedef void (*PTRIndexedGetter)(const void *base, int64_t index, void *value);
+
+ static PTRIndexedSetter get_member_ptr_indexed_setter(Variant::Type p_type);
+ static PTRIndexedGetter get_member_ptr_indexed_getter(Variant::Type p_type);
+
+ void set_indexed(int64_t p_index, const Variant &p_value, bool &r_valid, bool &r_oob);
+ Variant get_indexed(int64_t p_index, bool &r_valid, bool &r_oob) const;
+
+ uint64_t get_indexed_size() const;
+
+ static bool is_keyed(Variant::Type p_type);
+
+ typedef void (*ValidatedKeyedSetter)(Variant *base, const Variant *key, const Variant *value, bool &valid);
+ typedef void (*ValidatedKeyedGetter)(const Variant *base, const Variant *key, Variant *value, bool &valid);
+ typedef bool (*ValidatedKeyedChecker)(const Variant *base, const Variant *key, bool &valid);
+
+ static ValidatedKeyedSetter get_member_validated_keyed_setter(Variant::Type p_type);
+ static ValidatedKeyedGetter get_member_validated_keyed_getter(Variant::Type p_type);
+ static ValidatedKeyedChecker get_member_validated_keyed_checker(Variant::Type p_type);
+
+ typedef void (*PTRKeyedSetter)(void *base, const void *key, const void *value);
+ typedef void (*PTRKeyedGetter)(const void *base, const void *key, void *value);
+ typedef bool (*PTRKeyedChecker)(const void *base, const void *key);
+
+ static PTRKeyedSetter get_member_ptr_keyed_setter(Variant::Type p_type);
+ static PTRKeyedGetter get_member_ptr_keyed_getter(Variant::Type p_type);
+ static PTRKeyedChecker get_member_ptr_keyed_checker(Variant::Type p_type);
+
+ void set_keyed(const Variant &p_key, const Variant &p_value, bool &r_valid);
+ Variant get_keyed(const Variant &p_key, bool &r_valid) const;
+ bool has_key(const Variant &p_key, bool &r_valid) const;
void set(const Variant &p_index, const Variant &p_value, bool *r_valid = nullptr);
Variant get(const Variant &p_index, bool *r_valid = nullptr) const;
@@ -495,7 +631,6 @@ public:
String stringify(List<const void *> &stack) const;
void static_assign(const Variant &p_variant);
- static void get_constructor_list(Variant::Type p_type, List<MethodInfo> *p_list);
static void get_constants_for_type(Variant::Type p_type, List<StringName> *p_constants);
static bool has_constant(Variant::Type p_type, const StringName &p_value);
static Variant get_constant_value(Variant::Type p_type, const StringName &p_value, bool *r_valid = nullptr);
@@ -508,12 +643,13 @@ public:
void operator=(const Variant &p_variant); // only this is enough for all the other types
+ static void register_types();
+ static void unregister_types();
+
Variant(const Variant &p_variant);
_FORCE_INLINE_ Variant() {}
_FORCE_INLINE_ ~Variant() {
- if (type != Variant::NIL) {
- clear();
- }
+ clear();
}
};
diff --git a/core/variant_call.cpp b/core/variant/variant_call.cpp
index b1a046a72c..929a8e2cc8 100644
--- a/core/variant_call.cpp
+++ b/core/variant/variant_call.cpp
@@ -30,14 +30,13 @@
#include "variant.h"
-#include "core/class_db.h"
-#include "core/color_names.inc"
#include "core/core_string_names.h"
#include "core/crypto/crypto_core.h"
#include "core/debugger/engine_debugger.h"
#include "core/io/compression.h"
-#include "core/oa_hash_map.h"
+#include "core/object/class_db.h"
#include "core/os/os.h"
+#include "core/templates/oa_hash_map.h"
_FORCE_INLINE_ void sarray_add_str(Vector<String> &arr) {
}
@@ -62,6 +61,27 @@ _FORCE_INLINE_ Vector<String> sarray(P... p_args) {
typedef void (*VariantFunc)(Variant &r_ret, Variant &p_self, const Variant **p_args);
typedef void (*VariantConstructFunc)(Variant &r_ret, const Variant **p_args);
+template <class T>
+struct TypeAdjust {
+ _FORCE_INLINE_ static void adjust(Variant *r_ret) {
+ VariantTypeChanger<typename GetSimpleTypeT<T>::type_t>::change(r_ret);
+ }
+};
+
+template <> //do nothing for variant
+struct TypeAdjust<Variant> {
+ _FORCE_INLINE_ static void adjust(Variant *r_ret) {
+ }
+};
+
+template <> //do nothing for variant
+struct TypeAdjust<Object *> {
+ _FORCE_INLINE_ static void adjust(Variant *r_ret) {
+ VariantInternal::clear(r_ret);
+ *r_ret = (Object *)nullptr;
+ }
+};
+
struct _VariantCall {
template <class T, class... P>
class InternalMethod : public Variant::InternalMethod {
@@ -167,6 +187,7 @@ struct _VariantCall {
}
virtual void validated_call(Variant *base, const Variant **p_args, Variant *r_ret) {
+ TypeAdjust<R>::adjust(r_ret);
call_with_validated_variant_args_ret(base, method, p_args, r_ret);
}
#ifdef PTRCALL_ENABLED
@@ -232,6 +253,7 @@ struct _VariantCall {
}
virtual void validated_call(Variant *base, const Variant **p_args, Variant *r_ret) {
+ TypeAdjust<R>::adjust(r_ret);
call_with_validated_variant_args_retc(base, method, p_args, r_ret);
}
#ifdef PTRCALL_ENABLED
@@ -334,6 +356,7 @@ struct _VariantCall {
}
virtual void validated_call(Variant *base, const Variant **p_args, Variant *r_ret) {
+ TypeAdjust<R>::adjust(r_ret);
call_with_validated_variant_args_static_retc(base, method, p_args, r_ret);
}
#ifdef PTRCALL_ENABLED
@@ -671,190 +694,6 @@ struct _VariantCall {
signal->emit(p_args, p_argcount);
}
- struct ConstructData {
- int arg_count;
- Vector<Variant::Type> arg_types;
- Vector<String> arg_names;
- VariantConstructFunc func;
- };
-
- struct ConstructFunc {
- List<ConstructData> constructors;
- };
-
- static ConstructFunc *construct_funcs;
-
- static void Vector2_init1(Variant &r_ret, const Variant **p_args) {
- r_ret = Vector2(*p_args[0], *p_args[1]);
- }
-
- static void Vector2i_init1(Variant &r_ret, const Variant **p_args) {
- r_ret = Vector2i(*p_args[0], *p_args[1]);
- }
-
- static void Rect2_init1(Variant &r_ret, const Variant **p_args) {
- r_ret = Rect2(*p_args[0], *p_args[1]);
- }
-
- static void Rect2_init2(Variant &r_ret, const Variant **p_args) {
- r_ret = Rect2(*p_args[0], *p_args[1], *p_args[2], *p_args[3]);
- }
-
- static void Rect2i_init1(Variant &r_ret, const Variant **p_args) {
- r_ret = Rect2i(*p_args[0], *p_args[1]);
- }
-
- static void Rect2i_init2(Variant &r_ret, const Variant **p_args) {
- r_ret = Rect2i(*p_args[0], *p_args[1], *p_args[2], *p_args[3]);
- }
-
- static void Transform2D_init2(Variant &r_ret, const Variant **p_args) {
- Transform2D m(*p_args[0], *p_args[1]);
- r_ret = m;
- }
-
- static void Transform2D_init3(Variant &r_ret, const Variant **p_args) {
- Transform2D m;
- m[0] = *p_args[0];
- m[1] = *p_args[1];
- m[2] = *p_args[2];
- r_ret = m;
- }
-
- static void Vector3_init1(Variant &r_ret, const Variant **p_args) {
- r_ret = Vector3(*p_args[0], *p_args[1], *p_args[2]);
- }
-
- static void Vector3i_init1(Variant &r_ret, const Variant **p_args) {
- r_ret = Vector3i(*p_args[0], *p_args[1], *p_args[2]);
- }
-
- static void Plane_init1(Variant &r_ret, const Variant **p_args) {
- r_ret = Plane(*p_args[0], *p_args[1], *p_args[2], *p_args[3]);
- }
-
- static void Plane_init2(Variant &r_ret, const Variant **p_args) {
- r_ret = Plane(*p_args[0], *p_args[1], *p_args[2]);
- }
-
- static void Plane_init3(Variant &r_ret, const Variant **p_args) {
- r_ret = Plane(p_args[0]->operator Vector3(), p_args[1]->operator real_t());
- }
- static void Plane_init4(Variant &r_ret, const Variant **p_args) {
- r_ret = Plane(p_args[0]->operator Vector3(), p_args[1]->operator Vector3());
- }
-
- static void Quat_init1(Variant &r_ret, const Variant **p_args) {
- r_ret = Quat(*p_args[0], *p_args[1], *p_args[2], *p_args[3]);
- }
-
- static void Quat_init2(Variant &r_ret, const Variant **p_args) {
- r_ret = Quat(((Vector3)(*p_args[0])), ((real_t)(*p_args[1])));
- }
-
- static void Quat_init3(Variant &r_ret, const Variant **p_args) {
- r_ret = Quat(((Vector3)(*p_args[0])));
- }
-
- static void Color_init1(Variant &r_ret, const Variant **p_args) {
- r_ret = Color(*p_args[0], *p_args[1], *p_args[2], *p_args[3]);
- }
-
- static void Color_init2(Variant &r_ret, const Variant **p_args) {
- r_ret = Color(*p_args[0], *p_args[1], *p_args[2]);
- }
-
- static void Color_init3(Variant &r_ret, const Variant **p_args) {
- r_ret = Color::html(*p_args[0]);
- }
-
- static void Color_init4(Variant &r_ret, const Variant **p_args) {
- r_ret = Color::hex(*p_args[0]);
- }
-
- static void Color_init5(Variant &r_ret, const Variant **p_args) {
- r_ret = Color(((Color)(*p_args[0])), *p_args[1]);
- }
-
- static void AABB_init1(Variant &r_ret, const Variant **p_args) {
- r_ret = ::AABB(*p_args[0], *p_args[1]);
- }
-
- static void Basis_init1(Variant &r_ret, const Variant **p_args) {
- Basis m;
- m.set_axis(0, *p_args[0]);
- m.set_axis(1, *p_args[1]);
- m.set_axis(2, *p_args[2]);
- r_ret = m;
- }
-
- static void Basis_init2(Variant &r_ret, const Variant **p_args) {
- r_ret = Basis(p_args[0]->operator Vector3(), p_args[1]->operator real_t());
- }
-
- static void Transform_init1(Variant &r_ret, const Variant **p_args) {
- Transform t;
- t.basis.set_axis(0, *p_args[0]);
- t.basis.set_axis(1, *p_args[1]);
- t.basis.set_axis(2, *p_args[2]);
- t.origin = *p_args[3];
- r_ret = t;
- }
-
- static void Transform_init2(Variant &r_ret, const Variant **p_args) {
- r_ret = Transform(p_args[0]->operator Basis(), p_args[1]->operator Vector3());
- }
-
- static void Callable_init2(Variant &r_ret, const Variant **p_args) {
- r_ret = Callable(p_args[0]->operator ObjectID(), p_args[1]->operator String());
- }
-
- static void Signal_init2(Variant &r_ret, const Variant **p_args) {
- r_ret = Signal(p_args[0]->operator ObjectID(), p_args[1]->operator String());
- }
-
- static void add_constructor(VariantConstructFunc p_func, const Variant::Type p_type,
- const String &p_name1 = "", const Variant::Type p_type1 = Variant::NIL,
- const String &p_name2 = "", const Variant::Type p_type2 = Variant::NIL,
- const String &p_name3 = "", const Variant::Type p_type3 = Variant::NIL,
- const String &p_name4 = "", const Variant::Type p_type4 = Variant::NIL) {
- ConstructData cd;
- cd.func = p_func;
- cd.arg_count = 0;
-
- if (p_name1 == "") {
- goto end;
- }
- cd.arg_count++;
- cd.arg_names.push_back(p_name1);
- cd.arg_types.push_back(p_type1);
-
- if (p_name2 == "") {
- goto end;
- }
- cd.arg_count++;
- cd.arg_names.push_back(p_name2);
- cd.arg_types.push_back(p_type2);
-
- if (p_name3 == "") {
- goto end;
- }
- cd.arg_count++;
- cd.arg_names.push_back(p_name3);
- cd.arg_types.push_back(p_type3);
-
- if (p_name4 == "") {
- goto end;
- }
- cd.arg_count++;
- cd.arg_names.push_back(p_name4);
- cd.arg_types.push_back(p_type4);
-
- end:
-
- construct_funcs[p_type].constructors.push_back(cd);
- }
-
struct ConstantData {
Map<StringName, int> value;
#ifdef DEBUG_ENABLED
@@ -883,7 +722,6 @@ struct _VariantCall {
}
};
-_VariantCall::ConstructFunc *_VariantCall::construct_funcs = nullptr;
_VariantCall::ConstantData *_VariantCall::constant_data = nullptr;
_VariantCall::MethodMap *_VariantCall::type_internal_methods = nullptr;
List<StringName> *_VariantCall::type_internal_method_names = nullptr;
@@ -936,213 +774,6 @@ void Variant::call_ptr(const StringName &p_method, const Variant **p_args, int p
#define VCALL(m_type, m_method) _VariantCall::_call_##m_type##_##m_method
-Variant Variant::construct(const Variant::Type p_type, const Variant **p_args, int p_argcount, Callable::CallError &r_error, bool p_strict) {
- r_error.error = Callable::CallError::CALL_ERROR_INVALID_METHOD;
- ERR_FAIL_INDEX_V(p_type, VARIANT_MAX, Variant());
-
- r_error.error = Callable::CallError::CALL_OK;
- if (p_argcount == 0) { //generic construct
-
- switch (p_type) {
- case NIL:
- return Variant();
-
- // atomic types
- case BOOL:
- return Variant(false);
- case INT:
- return 0;
- case FLOAT:
- return 0.0f;
- case STRING:
- return String();
-
- // math types
- case VECTOR2:
- return Vector2();
- case VECTOR2I:
- return Vector2i();
- case RECT2:
- return Rect2();
- case RECT2I:
- return Rect2i();
- case VECTOR3:
- return Vector3();
- case VECTOR3I:
- return Vector3i();
- case TRANSFORM2D:
- return Transform2D();
- case PLANE:
- return Plane();
- case QUAT:
- return Quat();
- case AABB:
- return ::AABB();
- case BASIS:
- return Basis();
- case TRANSFORM:
- return Transform();
-
- // misc types
- case COLOR:
- return Color();
- case STRING_NAME:
- return StringName();
- case NODE_PATH:
- return NodePath();
- case _RID:
- return RID();
- case OBJECT:
- return (Object *)nullptr;
- case CALLABLE:
- return Callable();
- case SIGNAL:
- return Signal();
- case DICTIONARY:
- return Dictionary();
- case ARRAY:
- return Array();
- case PACKED_BYTE_ARRAY:
- return PackedByteArray();
- case PACKED_INT32_ARRAY:
- return PackedInt32Array();
- case PACKED_INT64_ARRAY:
- return PackedInt64Array();
- case PACKED_FLOAT32_ARRAY:
- return PackedFloat32Array();
- case PACKED_FLOAT64_ARRAY:
- return PackedFloat64Array();
- case PACKED_STRING_ARRAY:
- return PackedStringArray();
- case PACKED_VECTOR2_ARRAY:
- return PackedVector2Array();
- case PACKED_VECTOR3_ARRAY:
- return PackedVector3Array();
- case PACKED_COLOR_ARRAY:
- return PackedColorArray();
- default:
- return Variant();
- }
-
- } else if (p_argcount == 1 && p_args[0]->type == p_type) {
- return *p_args[0]; //copy construct
- } else if (p_argcount == 1 && (!p_strict || Variant::can_convert(p_args[0]->type, p_type))) {
- //near match construct
-
- switch (p_type) {
- case NIL: {
- return Variant();
- } break;
- case BOOL: {
- return Variant(bool(*p_args[0]));
- }
- case INT: {
- return (int64_t(*p_args[0]));
- }
- case FLOAT: {
- return double(*p_args[0]);
- }
- case STRING: {
- return String(*p_args[0]);
- }
- case VECTOR2: {
- return Vector2(*p_args[0]);
- }
- case VECTOR2I: {
- return Vector2i(*p_args[0]);
- }
- case RECT2:
- return (Rect2(*p_args[0]));
- case RECT2I:
- return (Rect2i(*p_args[0]));
- case VECTOR3:
- return (Vector3(*p_args[0]));
- case VECTOR3I:
- return (Vector3i(*p_args[0]));
- case TRANSFORM2D:
- return (Transform2D(p_args[0]->operator Transform2D()));
- case PLANE:
- return (Plane(*p_args[0]));
- case QUAT:
- return (p_args[0]->operator Quat());
- case AABB:
- return (::AABB(*p_args[0]));
- case BASIS:
- return (Basis(p_args[0]->operator Basis()));
- case TRANSFORM:
- return (Transform(p_args[0]->operator Transform()));
-
- // misc types
- case COLOR:
- return p_args[0]->type == Variant::STRING ? Color::html(*p_args[0]) : Color::hex(*p_args[0]);
- case STRING_NAME:
- return (StringName(p_args[0]->operator StringName()));
- case NODE_PATH:
- return (NodePath(p_args[0]->operator NodePath()));
- case _RID:
- return (RID(*p_args[0]));
- case OBJECT:
- return ((Object *)(p_args[0]->operator Object *()));
- case CALLABLE:
- return ((Callable)(p_args[0]->operator Callable()));
- case SIGNAL:
- return ((Signal)(p_args[0]->operator Signal()));
- case DICTIONARY:
- return p_args[0]->operator Dictionary();
- case ARRAY:
- return p_args[0]->operator Array();
-
- // arrays
- case PACKED_BYTE_ARRAY:
- return (PackedByteArray(*p_args[0]));
- case PACKED_INT32_ARRAY:
- return (PackedInt32Array(*p_args[0]));
- case PACKED_INT64_ARRAY:
- return (PackedInt64Array(*p_args[0]));
- case PACKED_FLOAT32_ARRAY:
- return (PackedFloat32Array(*p_args[0]));
- case PACKED_FLOAT64_ARRAY:
- return (PackedFloat64Array(*p_args[0]));
- case PACKED_STRING_ARRAY:
- return (PackedStringArray(*p_args[0]));
- case PACKED_VECTOR2_ARRAY:
- return (PackedVector2Array(*p_args[0]));
- case PACKED_VECTOR3_ARRAY:
- return (PackedVector3Array(*p_args[0]));
- case PACKED_COLOR_ARRAY:
- return (PackedColorArray(*p_args[0]));
- default:
- return Variant();
- }
- } else if (p_argcount >= 1) {
- _VariantCall::ConstructFunc &c = _VariantCall::construct_funcs[p_type];
-
- for (List<_VariantCall::ConstructData>::Element *E = c.constructors.front(); E; E = E->next()) {
- const _VariantCall::ConstructData &cd = E->get();
-
- if (cd.arg_count != p_argcount) {
- continue;
- }
-
- //validate parameters
- for (int i = 0; i < cd.arg_count; i++) {
- if (!Variant::can_convert(p_args[i]->type, cd.arg_types[i])) {
- r_error.error = Callable::CallError::CALL_ERROR_INVALID_ARGUMENT; //no such constructor
- r_error.argument = i;
- r_error.expected = cd.arg_types[i];
- return Variant();
- }
- }
-
- Variant v;
- cd.func(v, p_args);
- return v;
- }
- }
- r_error.error = Callable::CallError::CALL_ERROR_INVALID_METHOD; //no such constructor
- return Variant();
-}
-
bool Variant::has_method(const StringName &p_method) const {
if (type == OBJECT) {
Object *obj = get_validated_object();
@@ -1247,43 +878,6 @@ void Variant::get_method_list(List<MethodInfo> *p_list) const {
}
}
-void Variant::get_constructor_list(Variant::Type p_type, List<MethodInfo> *p_list) {
- ERR_FAIL_INDEX(p_type, VARIANT_MAX);
-
- //custom constructors
- for (const List<_VariantCall::ConstructData>::Element *E = _VariantCall::construct_funcs[p_type].constructors.front(); E; E = E->next()) {
- const _VariantCall::ConstructData &cd = E->get();
- MethodInfo mi;
- mi.name = Variant::get_type_name(p_type);
- mi.return_val.type = p_type;
- for (int i = 0; i < cd.arg_count; i++) {
- PropertyInfo pi;
- pi.name = cd.arg_names[i];
- pi.type = cd.arg_types[i];
- mi.arguments.push_back(pi);
- }
- p_list->push_back(mi);
- }
- //default constructors
- for (int i = 0; i < VARIANT_MAX; i++) {
- if (i == p_type) {
- continue;
- }
- if (!Variant::can_convert(Variant::Type(i), p_type)) {
- continue;
- }
-
- MethodInfo mi;
- mi.name = Variant::get_type_name(p_type);
- PropertyInfo pi;
- pi.name = "from";
- pi.type = Variant::Type(i);
- mi.arguments.push_back(pi);
- mi.return_val.type = p_type;
- p_list->push_back(mi);
- }
-}
-
void Variant::get_constants_for_type(Variant::Type p_type, List<StringName> *p_constants) {
ERR_FAIL_INDEX(p_type, Variant::VARIANT_MAX);
@@ -1351,10 +945,9 @@ Variant::InternalMethod *Variant::get_internal_method(Type p_type, const StringN
return nullptr;
}
-void register_variant_methods() {
+void Variant::_register_variant_methods() {
_VariantCall::type_internal_methods = memnew_arr(_VariantCall::MethodMap, Variant::VARIANT_MAX);
_VariantCall::type_internal_method_names = memnew_arr(List<StringName>, Variant::VARIANT_MAX);
- _VariantCall::construct_funcs = memnew_arr(_VariantCall::ConstructFunc, Variant::VARIANT_MAX);
_VariantCall::constant_data = memnew_arr(_VariantCall::ConstantData, Variant::VARIANT_MAX);
/* String */
@@ -1614,7 +1207,6 @@ void register_variant_methods() {
bind_method(Color, to_rgba64, sarray(), varray());
bind_method(Color, inverted, sarray(), varray());
- bind_method(Color, contrasted, sarray(), varray());
bind_method(Color, lerp, sarray("b", "t"), varray());
bind_method(Color, lightened, sarray("amount"), varray());
bind_method(Color, darkened, sarray("amount"), varray());
@@ -1627,7 +1219,7 @@ void register_variant_methods() {
/* RID */
- bind_method(RID, get_id, sarray(), varray());
+ bind_method(::RID, get_id, sarray(), varray());
/* NodePath */
@@ -1948,52 +1540,11 @@ void register_variant_methods() {
bind_method(PackedColorArray, to_byte_array, sarray(), varray());
bind_method(PackedColorArray, sort, sarray(), varray());
- /* Register constructors */
-
- _VariantCall::add_constructor(_VariantCall::Vector2_init1, Variant::VECTOR2, "x", Variant::FLOAT, "y", Variant::FLOAT);
- _VariantCall::add_constructor(_VariantCall::Vector2i_init1, Variant::VECTOR2I, "x", Variant::INT, "y", Variant::INT);
-
- _VariantCall::add_constructor(_VariantCall::Rect2_init1, Variant::RECT2, "position", Variant::VECTOR2, "size", Variant::VECTOR2);
- _VariantCall::add_constructor(_VariantCall::Rect2_init2, Variant::RECT2, "x", Variant::FLOAT, "y", Variant::FLOAT, "width", Variant::FLOAT, "height", Variant::FLOAT);
-
- _VariantCall::add_constructor(_VariantCall::Rect2i_init1, Variant::RECT2I, "position", Variant::VECTOR2I, "size", Variant::VECTOR2I);
- _VariantCall::add_constructor(_VariantCall::Rect2i_init2, Variant::RECT2I, "x", Variant::INT, "y", Variant::INT, "width", Variant::INT, "height", Variant::INT);
-
- _VariantCall::add_constructor(_VariantCall::Transform2D_init2, Variant::TRANSFORM2D, "rotation", Variant::FLOAT, "position", Variant::VECTOR2);
- _VariantCall::add_constructor(_VariantCall::Transform2D_init3, Variant::TRANSFORM2D, "x_axis", Variant::VECTOR2, "y_axis", Variant::VECTOR2, "origin", Variant::VECTOR2);
-
- _VariantCall::add_constructor(_VariantCall::Vector3_init1, Variant::VECTOR3, "x", Variant::FLOAT, "y", Variant::FLOAT, "z", Variant::FLOAT);
- _VariantCall::add_constructor(_VariantCall::Vector3i_init1, Variant::VECTOR3I, "x", Variant::INT, "y", Variant::INT, "z", Variant::INT);
-
- _VariantCall::add_constructor(_VariantCall::Plane_init1, Variant::PLANE, "a", Variant::FLOAT, "b", Variant::FLOAT, "c", Variant::FLOAT, "d", Variant::FLOAT);
- _VariantCall::add_constructor(_VariantCall::Plane_init2, Variant::PLANE, "v1", Variant::VECTOR3, "v2", Variant::VECTOR3, "v3", Variant::VECTOR3);
- _VariantCall::add_constructor(_VariantCall::Plane_init3, Variant::PLANE, "normal", Variant::VECTOR3, "d", Variant::FLOAT);
-
- _VariantCall::add_constructor(_VariantCall::Quat_init1, Variant::QUAT, "x", Variant::FLOAT, "y", Variant::FLOAT, "z", Variant::FLOAT, "w", Variant::FLOAT);
- _VariantCall::add_constructor(_VariantCall::Quat_init2, Variant::QUAT, "axis", Variant::VECTOR3, "angle", Variant::FLOAT);
- _VariantCall::add_constructor(_VariantCall::Quat_init3, Variant::QUAT, "euler", Variant::VECTOR3);
-
- _VariantCall::add_constructor(_VariantCall::Color_init1, Variant::COLOR, "r", Variant::FLOAT, "g", Variant::FLOAT, "b", Variant::FLOAT, "a", Variant::FLOAT);
- _VariantCall::add_constructor(_VariantCall::Color_init2, Variant::COLOR, "r", Variant::FLOAT, "g", Variant::FLOAT, "b", Variant::FLOAT);
- // init3 and init4 are the constructors for HTML hex strings and integers respectively which don't need binding here, so we skip to init5.
- _VariantCall::add_constructor(_VariantCall::Color_init5, Variant::COLOR, "c", Variant::COLOR, "a", Variant::FLOAT);
-
- _VariantCall::add_constructor(_VariantCall::AABB_init1, Variant::AABB, "position", Variant::VECTOR3, "size", Variant::VECTOR3);
-
- _VariantCall::add_constructor(_VariantCall::Basis_init1, Variant::BASIS, "x_axis", Variant::VECTOR3, "y_axis", Variant::VECTOR3, "z_axis", Variant::VECTOR3);
- _VariantCall::add_constructor(_VariantCall::Basis_init2, Variant::BASIS, "axis", Variant::VECTOR3, "phi", Variant::FLOAT);
-
- _VariantCall::add_constructor(_VariantCall::Transform_init1, Variant::TRANSFORM, "x_axis", Variant::VECTOR3, "y_axis", Variant::VECTOR3, "z_axis", Variant::VECTOR3, "origin", Variant::VECTOR3);
- _VariantCall::add_constructor(_VariantCall::Transform_init2, Variant::TRANSFORM, "basis", Variant::BASIS, "origin", Variant::VECTOR3);
-
- _VariantCall::add_constructor(_VariantCall::Callable_init2, Variant::CALLABLE, "object", Variant::OBJECT, "method_name", Variant::STRING_NAME);
- _VariantCall::add_constructor(_VariantCall::Signal_init2, Variant::SIGNAL, "object", Variant::OBJECT, "signal_name", Variant::STRING_NAME);
-
/* Register constants */
- _populate_named_colors();
- for (Map<String, Color>::Element *color = _named_colors.front(); color; color = color->next()) {
- _VariantCall::add_variant_constant(Variant::COLOR, color->key(), color->value());
+ int ncc = Color::get_named_color_count();
+ for (int i = 0; i < ncc; i++) {
+ _VariantCall::add_variant_constant(Variant::COLOR, Color::get_named_color_name(i), Color::get_named_color(i));
}
_VariantCall::add_constant(Variant::VECTOR3, "AXIS_X", Vector3::AXIS_X);
@@ -2073,7 +1624,7 @@ void register_variant_methods() {
_VariantCall::add_variant_constant(Variant::QUAT, "IDENTITY", Quat(0, 0, 0, 1));
}
-void unregister_variant_methods() {
+void Variant::_unregister_variant_methods() {
//clear methods
for (int i = 0; i < Variant::VARIANT_MAX; i++) {
for (List<StringName>::Element *E = _VariantCall::type_internal_method_names[i].front(); E; E = E->next()) {
@@ -2086,6 +1637,5 @@ void unregister_variant_methods() {
memdelete_arr(_VariantCall::type_internal_methods);
memdelete_arr(_VariantCall::type_internal_method_names);
- memdelete_arr(_VariantCall::construct_funcs);
memdelete_arr(_VariantCall::constant_data);
}
diff --git a/core/variant/variant_construct.cpp b/core/variant/variant_construct.cpp
new file mode 100644
index 0000000000..b777323e82
--- /dev/null
+++ b/core/variant/variant_construct.cpp
@@ -0,0 +1,832 @@
+/*************************************************************************/
+/* variant_construct.cpp */
+/*************************************************************************/
+/* This file is part of: */
+/* GODOT ENGINE */
+/* https://godotengine.org */
+/*************************************************************************/
+/* Copyright (c) 2007-2020 Juan Linietsky, Ariel Manzur. */
+/* Copyright (c) 2014-2020 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 "variant.h"
+
+#include "core/core_string_names.h"
+#include "core/crypto/crypto_core.h"
+#include "core/debugger/engine_debugger.h"
+#include "core/io/compression.h"
+#include "core/object/class_db.h"
+#include "core/os/os.h"
+#include "core/templates/local_vector.h"
+#include "core/templates/oa_hash_map.h"
+
+_FORCE_INLINE_ void sarray_add_str(Vector<String> &arr) {
+}
+
+_FORCE_INLINE_ void sarray_add_str(Vector<String> &arr, const String &p_str) {
+ arr.push_back(p_str);
+}
+
+template <class... P>
+_FORCE_INLINE_ void sarray_add_str(Vector<String> &arr, const String &p_str, P... p_args) {
+ arr.push_back(p_str);
+ sarray_add_str(arr, p_args...);
+}
+
+template <class... P>
+_FORCE_INLINE_ Vector<String> sarray(P... p_args) {
+ Vector<String> arr;
+ sarray_add_str(arr, p_args...);
+ return arr;
+}
+
+template <class T, class... P>
+class VariantConstructor {
+ template <size_t... Is>
+ static _FORCE_INLINE_ void construct_helper(T &base, const Variant **p_args, Callable::CallError &r_error, IndexSequence<Is...>) {
+ r_error.error = Callable::CallError::CALL_OK;
+
+#ifdef DEBUG_METHODS_ENABLED
+ base = T(VariantCasterAndValidate<P>::cast(p_args, Is, r_error)...);
+#else
+ base = T(VariantCaster<P>::cast(*p_args[Is])...);
+#endif
+ }
+
+ template <size_t... Is>
+ static _FORCE_INLINE_ void validated_construct_helper(T &base, const Variant **p_args, IndexSequence<Is...>) {
+ base = T((*VariantGetInternalPtr<P>::get_ptr(p_args[Is]))...);
+ }
+
+ template <size_t... Is>
+ static _FORCE_INLINE_ void ptr_construct_helper(void *base, const void **p_args, IndexSequence<Is...>) {
+ PtrToArg<T>::encode(T(PtrToArg<P>::convert(p_args[Is])...), base);
+ }
+
+public:
+ static void construct(Variant &r_ret, const Variant **p_args, Callable::CallError &r_error) {
+ r_error.error = Callable::CallError::CALL_OK;
+ VariantTypeChanger<T>::change(&r_ret);
+ construct_helper(*VariantGetInternalPtr<T>::get_ptr(&r_ret), p_args, r_error, BuildIndexSequence<sizeof...(P)>{});
+ }
+
+ static void validated_construct(Variant &r_ret, const Variant **p_args) {
+ VariantTypeChanger<T>::change(&r_ret);
+ validated_construct_helper(*VariantGetInternalPtr<T>::get_ptr(&r_ret), p_args, BuildIndexSequence<sizeof...(P)>{});
+ }
+ static void ptr_construct(void *base, const void **p_args) {
+ ptr_construct_helper(base, p_args, BuildIndexSequence<sizeof...(P)>{});
+ }
+
+ static int get_argument_count() {
+ return sizeof...(P);
+ }
+
+ static Variant::Type get_argument_type(int p_arg) {
+ return call_get_argument_type<P...>(p_arg);
+ }
+
+ static Variant::Type get_base_type() {
+ return GetTypeInfo<T>::VARIANT_TYPE;
+ }
+};
+
+class VariantConstructorObject {
+public:
+ static void construct(Variant &r_ret, const Variant **p_args, Callable::CallError &r_error) {
+ VariantInternal::clear(&r_ret);
+ if (p_args[0]->get_type() == Variant::NIL) {
+ VariantInternal::object_assign_null(&r_ret);
+ r_error.error = Callable::CallError::CALL_OK;
+ } else if (p_args[0]->get_type() == Variant::OBJECT) {
+ VariantInternal::object_assign(&r_ret, p_args[0]);
+ r_error.error = Callable::CallError::CALL_OK;
+ } else {
+ r_error.error = Callable::CallError::CALL_ERROR_INVALID_ARGUMENT;
+ r_error.argument = 0;
+ r_error.expected = Variant::OBJECT;
+ }
+ }
+
+ static void validated_construct(Variant &r_ret, const Variant **p_args) {
+ VariantInternal::clear(&r_ret);
+ VariantInternal::object_assign(&r_ret, p_args[0]);
+ }
+ static void ptr_construct(void *base, const void **p_args) {
+ PtrToArg<Object *>::encode(PtrToArg<Object *>::convert(p_args[0]), base);
+ }
+
+ static int get_argument_count() {
+ return 1;
+ }
+
+ static Variant::Type get_argument_type(int p_arg) {
+ return Variant::OBJECT;
+ }
+
+ static Variant::Type get_base_type() {
+ return Variant::OBJECT;
+ }
+};
+
+class VariantConstructorNilObject {
+public:
+ static void construct(Variant &r_ret, const Variant **p_args, Callable::CallError &r_error) {
+ if (p_args[0]->get_type() != Variant::NIL) {
+ r_error.error = Callable::CallError::CALL_ERROR_INVALID_ARGUMENT;
+ r_error.argument = 0;
+ r_error.expected = Variant::NIL;
+ }
+
+ VariantInternal::clear(&r_ret);
+ VariantInternal::object_assign_null(&r_ret);
+ }
+
+ static void validated_construct(Variant &r_ret, const Variant **p_args) {
+ VariantInternal::clear(&r_ret);
+ VariantInternal::object_assign_null(&r_ret);
+ }
+ static void ptr_construct(void *base, const void **p_args) {
+ PtrToArg<Object *>::encode(nullptr, base);
+ }
+
+ static int get_argument_count() {
+ return 1;
+ }
+
+ static Variant::Type get_argument_type(int p_arg) {
+ return Variant::NIL;
+ }
+
+ static Variant::Type get_base_type() {
+ return Variant::OBJECT;
+ }
+};
+
+class VariantConstructorCallableArgs {
+public:
+ static void construct(Variant &r_ret, const Variant **p_args, Callable::CallError &r_error) {
+ ObjectID object_id;
+ StringName method;
+
+ if (p_args[0]->get_type() == Variant::NIL) {
+ // leave as is
+ } else if (p_args[0]->get_type() == Variant::OBJECT) {
+ object_id = VariantInternal::get_object_id(p_args[0]);
+ } else {
+ r_error.error = Callable::CallError::CALL_ERROR_INVALID_ARGUMENT;
+ r_error.argument = 0;
+ r_error.expected = Variant::OBJECT;
+ return;
+ }
+
+ if (p_args[1]->get_type() == Variant::STRING_NAME) {
+ method = *VariantGetInternalPtr<StringName>::get_ptr(p_args[1]);
+ } else if (p_args[1]->get_type() == Variant::STRING) {
+ method = *VariantGetInternalPtr<String>::get_ptr(p_args[1]);
+ } else {
+ r_error.error = Callable::CallError::CALL_ERROR_INVALID_ARGUMENT;
+ r_error.argument = 1;
+ r_error.expected = Variant::STRING_NAME;
+ return;
+ }
+
+ VariantTypeChanger<Callable>::change(&r_ret);
+ *VariantGetInternalPtr<Callable>::get_ptr(&r_ret) = Callable(object_id, method);
+ }
+
+ static void validated_construct(Variant &r_ret, const Variant **p_args) {
+ VariantTypeChanger<Callable>::change(&r_ret);
+ *VariantGetInternalPtr<Callable>::get_ptr(&r_ret) = Callable(VariantInternal::get_object_id(p_args[0]), *VariantGetInternalPtr<StringName>::get_ptr(p_args[1]));
+ }
+ static void ptr_construct(void *base, const void **p_args) {
+ PtrToArg<Callable>::encode(Callable(PtrToArg<Object *>::convert(p_args[0]), PtrToArg<StringName>::convert(p_args[1])), base);
+ }
+
+ static int get_argument_count() {
+ return 2;
+ }
+
+ static Variant::Type get_argument_type(int p_arg) {
+ if (p_arg == 0) {
+ return Variant::OBJECT;
+ } else {
+ return Variant::STRING_NAME;
+ }
+ }
+
+ static Variant::Type get_base_type() {
+ return Variant::CALLABLE;
+ }
+};
+
+class VariantConstructorSignalArgs {
+public:
+ static void construct(Variant &r_ret, const Variant **p_args, Callable::CallError &r_error) {
+ ObjectID object_id;
+ StringName method;
+
+ if (p_args[0]->get_type() == Variant::NIL) {
+ // leave as is
+ } else if (p_args[0]->get_type() == Variant::OBJECT) {
+ object_id = VariantInternal::get_object_id(p_args[0]);
+ } else {
+ r_error.error = Callable::CallError::CALL_ERROR_INVALID_ARGUMENT;
+ r_error.argument = 0;
+ r_error.expected = Variant::OBJECT;
+ return;
+ }
+
+ if (p_args[1]->get_type() == Variant::STRING_NAME) {
+ method = *VariantGetInternalPtr<StringName>::get_ptr(p_args[1]);
+ } else if (p_args[1]->get_type() == Variant::STRING) {
+ method = *VariantGetInternalPtr<String>::get_ptr(p_args[1]);
+ } else {
+ r_error.error = Callable::CallError::CALL_ERROR_INVALID_ARGUMENT;
+ r_error.argument = 1;
+ r_error.expected = Variant::STRING_NAME;
+ return;
+ }
+
+ VariantTypeChanger<Signal>::change(&r_ret);
+ *VariantGetInternalPtr<Signal>::get_ptr(&r_ret) = Signal(object_id, method);
+ }
+
+ static void validated_construct(Variant &r_ret, const Variant **p_args) {
+ VariantTypeChanger<Signal>::change(&r_ret);
+ *VariantGetInternalPtr<Signal>::get_ptr(&r_ret) = Signal(VariantInternal::get_object_id(p_args[0]), *VariantGetInternalPtr<StringName>::get_ptr(p_args[1]));
+ }
+ static void ptr_construct(void *base, const void **p_args) {
+ PtrToArg<Signal>::encode(Signal(PtrToArg<Object *>::convert(p_args[0]), PtrToArg<StringName>::convert(p_args[1])), base);
+ }
+
+ static int get_argument_count() {
+ return 2;
+ }
+
+ static Variant::Type get_argument_type(int p_arg) {
+ if (p_arg == 0) {
+ return Variant::OBJECT;
+ } else {
+ return Variant::STRING_NAME;
+ }
+ }
+
+ static Variant::Type get_base_type() {
+ return Variant::SIGNAL;
+ }
+};
+
+template <class T>
+class VariantConstructorToArray {
+public:
+ static void construct(Variant &r_ret, const Variant **p_args, Callable::CallError &r_error) {
+ if (p_args[0]->get_type() != GetTypeInfo<T>::VARIANT_TYPE) {
+ r_error.error = Callable::CallError::CALL_ERROR_INVALID_ARGUMENT;
+ r_error.argument = 0;
+ r_error.expected = GetTypeInfo<T>::VARIANT_TYPE;
+ return;
+ }
+
+ VariantTypeChanger<Array>::change(&r_ret);
+ Array &dst_arr = *VariantGetInternalPtr<Array>::get_ptr(&r_ret);
+ const T &src_arr = *VariantGetInternalPtr<T>::get_ptr(p_args[0]);
+
+ int size = src_arr.size();
+ dst_arr.resize(size);
+ for (int i = 0; i < size; i++) {
+ dst_arr[i] = src_arr[i];
+ }
+ }
+
+ static void validated_construct(Variant &r_ret, const Variant **p_args) {
+ VariantTypeChanger<Array>::change(&r_ret);
+ Array &dst_arr = *VariantGetInternalPtr<Array>::get_ptr(&r_ret);
+ const T &src_arr = *VariantGetInternalPtr<T>::get_ptr(p_args[0]);
+
+ int size = src_arr.size();
+ dst_arr.resize(size);
+ for (int i = 0; i < size; i++) {
+ dst_arr[i] = src_arr[i];
+ }
+ }
+ static void ptr_construct(void *base, const void **p_args) {
+ Array dst_arr;
+ T src_arr = PtrToArg<T>::convert(p_args[0]);
+
+ int size = src_arr.size();
+ dst_arr.resize(size);
+ for (int i = 0; i < size; i++) {
+ dst_arr[i] = src_arr[i];
+ }
+
+ PtrToArg<Array>::encode(dst_arr, base);
+ }
+
+ static int get_argument_count() {
+ return 1;
+ }
+
+ static Variant::Type get_argument_type(int p_arg) {
+ return GetTypeInfo<T>::VARIANT_TYPE;
+ }
+
+ static Variant::Type get_base_type() {
+ return Variant::ARRAY;
+ }
+};
+
+template <class T>
+class VariantConstructorFromArray {
+public:
+ static void construct(Variant &r_ret, const Variant **p_args, Callable::CallError &r_error) {
+ if (p_args[0]->get_type() != Variant::ARRAY) {
+ r_error.error = Callable::CallError::CALL_ERROR_INVALID_ARGUMENT;
+ r_error.argument = 0;
+ r_error.expected = Variant::ARRAY;
+ return;
+ }
+
+ VariantTypeChanger<T>::change(&r_ret);
+ const Array &src_arr = *VariantGetInternalPtr<Array>::get_ptr(p_args[0]);
+ T &dst_arr = *VariantGetInternalPtr<T>::get_ptr(&r_ret);
+
+ int size = src_arr.size();
+ dst_arr.resize(size);
+ for (int i = 0; i < size; i++) {
+ dst_arr.write[i] = src_arr[i];
+ }
+ }
+
+ static void validated_construct(Variant &r_ret, const Variant **p_args) {
+ VariantTypeChanger<T>::change(&r_ret);
+ const Array &src_arr = *VariantGetInternalPtr<Array>::get_ptr(p_args[0]);
+ T &dst_arr = *VariantGetInternalPtr<T>::get_ptr(&r_ret);
+
+ int size = src_arr.size();
+ dst_arr.resize(size);
+ for (int i = 0; i < size; i++) {
+ dst_arr.write[i] = src_arr[i];
+ }
+ }
+ static void ptr_construct(void *base, const void **p_args) {
+ Array src_arr = PtrToArg<Array>::convert(p_args[0]);
+ T dst_arr;
+
+ int size = src_arr.size();
+ dst_arr.resize(size);
+ for (int i = 0; i < size; i++) {
+ dst_arr.write[i] = src_arr[i];
+ }
+
+ PtrToArg<T>::encode(dst_arr, base);
+ }
+
+ static int get_argument_count() {
+ return 1;
+ }
+
+ static Variant::Type get_argument_type(int p_arg) {
+ return Variant::ARRAY;
+ }
+
+ static Variant::Type get_base_type() {
+ return GetTypeInfo<T>::VARIANT_TYPE;
+ }
+};
+
+class VariantConstructorNil {
+public:
+ static void construct(Variant &r_ret, const Variant **p_args, Callable::CallError &r_error) {
+ if (p_args[0]->get_type() != Variant::NIL) {
+ r_error.error = Callable::CallError::CALL_ERROR_INVALID_ARGUMENT;
+ r_error.argument = 0;
+ r_error.expected = Variant::NIL;
+ return;
+ }
+
+ r_error.error = Callable::CallError::CALL_OK;
+ VariantInternal::clear(&r_ret);
+ }
+
+ static void validated_construct(Variant &r_ret, const Variant **p_args) {
+ VariantInternal::clear(&r_ret);
+ }
+ static void ptr_construct(void *base, const void **p_args) {
+ PtrToArg<Variant>::encode(Variant(), base);
+ }
+
+ static int get_argument_count() {
+ return 1;
+ }
+
+ static Variant::Type get_argument_type(int p_arg) {
+ return Variant::NIL;
+ }
+
+ static Variant::Type get_base_type() {
+ return Variant::NIL;
+ }
+};
+
+template <class T>
+class VariantConstructNoArgs {
+public:
+ static void construct(Variant &r_ret, const Variant **p_args, Callable::CallError &r_error) {
+ VariantTypeChanger<T>::change_and_reset(&r_ret);
+ r_error.error = Callable::CallError::CALL_OK;
+ }
+
+ static void validated_construct(Variant &r_ret, const Variant **p_args) {
+ VariantTypeChanger<T>::change_and_reset(&r_ret);
+ }
+ static void ptr_construct(void *base, const void **p_args) {
+ PtrToArg<T>::encode(T(), base);
+ }
+
+ static int get_argument_count() {
+ return 0;
+ }
+
+ static Variant::Type get_argument_type(int p_arg) {
+ return Variant::NIL;
+ }
+
+ static Variant::Type get_base_type() {
+ return GetTypeInfo<T>::VARIANT_TYPE;
+ }
+};
+
+class VariantConstructNoArgsNil {
+public:
+ static void construct(Variant &r_ret, const Variant **p_args, Callable::CallError &r_error) {
+ VariantInternal::clear(&r_ret);
+ r_error.error = Callable::CallError::CALL_OK;
+ }
+
+ static void validated_construct(Variant &r_ret, const Variant **p_args) {
+ VariantInternal::clear(&r_ret);
+ }
+ static void ptr_construct(void *base, const void **p_args) {
+ ERR_FAIL_MSG("can't ptrcall nil constructor");
+ }
+
+ static int get_argument_count() {
+ return 0;
+ }
+
+ static Variant::Type get_argument_type(int p_arg) {
+ return Variant::NIL;
+ }
+
+ static Variant::Type get_base_type() {
+ return Variant::NIL;
+ }
+};
+
+class VariantConstructNoArgsObject {
+public:
+ static void construct(Variant &r_ret, const Variant **p_args, Callable::CallError &r_error) {
+ VariantInternal::clear(&r_ret);
+ VariantInternal::object_assign_null(&r_ret);
+ r_error.error = Callable::CallError::CALL_OK;
+ }
+
+ static void validated_construct(Variant &r_ret, const Variant **p_args) {
+ VariantInternal::clear(&r_ret);
+ VariantInternal::object_assign_null(&r_ret);
+ }
+ static void ptr_construct(void *base, const void **p_args) {
+ PtrToArg<Object *>::encode(nullptr, base);
+ }
+
+ static int get_argument_count() {
+ return 0;
+ }
+
+ static Variant::Type get_argument_type(int p_arg) {
+ return Variant::NIL;
+ }
+
+ static Variant::Type get_base_type() {
+ return Variant::OBJECT;
+ }
+};
+
+struct VariantConstructData {
+ void (*construct)(Variant &r_base, const Variant **p_args, Callable::CallError &r_error);
+ Variant::ValidatedConstructor validated_construct;
+ Variant::PTRConstructor ptr_construct;
+ Variant::Type (*get_argument_type)(int);
+ int argument_count;
+ Vector<String> arg_names;
+};
+
+static LocalVector<VariantConstructData> construct_data[Variant::VARIANT_MAX];
+
+template <class T>
+static void add_constructor(const Vector<String> &arg_names) {
+ ERR_FAIL_COND_MSG(arg_names.size() != T::get_argument_count(), "Argument names size mismatch for " + Variant::get_type_name(T::get_base_type()) + ".");
+
+ VariantConstructData cd;
+ cd.construct = T::construct;
+ cd.validated_construct = T::validated_construct;
+ cd.ptr_construct = T::ptr_construct;
+ cd.get_argument_type = T::get_argument_type;
+ cd.argument_count = T::get_argument_count();
+ cd.arg_names = arg_names;
+ construct_data[T::get_base_type()].push_back(cd);
+}
+
+void Variant::_register_variant_constructors() {
+ add_constructor<VariantConstructNoArgsNil>(sarray());
+ add_constructor<VariantConstructorNil>(sarray("from"));
+
+ add_constructor<VariantConstructNoArgs<bool>>(sarray());
+ add_constructor<VariantConstructor<bool, bool>>(sarray("from"));
+ add_constructor<VariantConstructor<bool, int64_t>>(sarray("from"));
+ add_constructor<VariantConstructor<bool, double>>(sarray("from"));
+
+ add_constructor<VariantConstructNoArgs<int64_t>>(sarray());
+ add_constructor<VariantConstructor<int64_t, int64_t>>(sarray("from"));
+ add_constructor<VariantConstructor<int64_t, double>>(sarray("from"));
+ add_constructor<VariantConstructor<int64_t, bool>>(sarray("from"));
+
+ add_constructor<VariantConstructNoArgs<double>>(sarray());
+ add_constructor<VariantConstructor<double, double>>(sarray("from"));
+ add_constructor<VariantConstructor<double, int64_t>>(sarray("from"));
+ add_constructor<VariantConstructor<double, bool>>(sarray("from"));
+
+ add_constructor<VariantConstructNoArgs<String>>(sarray());
+ add_constructor<VariantConstructor<String, String>>(sarray("from"));
+ add_constructor<VariantConstructor<String, StringName>>(sarray("from"));
+ add_constructor<VariantConstructor<String, NodePath>>(sarray("from"));
+
+ add_constructor<VariantConstructNoArgs<Vector2>>(sarray());
+ add_constructor<VariantConstructor<Vector2, Vector2>>(sarray("from"));
+ add_constructor<VariantConstructor<Vector2, Vector2i>>(sarray("from"));
+ add_constructor<VariantConstructor<Vector2, double, double>>(sarray("x", "y"));
+
+ add_constructor<VariantConstructNoArgs<Vector2i>>(sarray());
+ add_constructor<VariantConstructor<Vector2i, Vector2i>>(sarray("from"));
+ add_constructor<VariantConstructor<Vector2i, Vector2>>(sarray("from"));
+ add_constructor<VariantConstructor<Vector2i, int64_t, int64_t>>(sarray("x", "y"));
+
+ add_constructor<VariantConstructNoArgs<Rect2>>(sarray());
+ add_constructor<VariantConstructor<Rect2, Rect2>>(sarray("from"));
+ add_constructor<VariantConstructor<Rect2, Rect2i>>(sarray("from"));
+ add_constructor<VariantConstructor<Rect2, Vector2, Vector2>>(sarray("position", "size"));
+ add_constructor<VariantConstructor<Rect2, double, double, double, double>>(sarray("x", "y", "width", "height"));
+
+ add_constructor<VariantConstructNoArgs<Rect2i>>(sarray());
+ add_constructor<VariantConstructor<Rect2i, Rect2i>>(sarray("from"));
+ add_constructor<VariantConstructor<Rect2i, Rect2>>(sarray("from"));
+ add_constructor<VariantConstructor<Rect2i, Vector2i, Vector2i>>(sarray("position", "size"));
+ add_constructor<VariantConstructor<Rect2i, int64_t, int64_t, int64_t, int64_t>>(sarray("x", "y", "width", "height"));
+
+ add_constructor<VariantConstructNoArgs<Vector3>>(sarray());
+ add_constructor<VariantConstructor<Vector3, Vector3>>(sarray("from"));
+ add_constructor<VariantConstructor<Vector3, Vector3i>>(sarray("from"));
+ add_constructor<VariantConstructor<Vector3, double, double, double>>(sarray("x", "y", "z"));
+
+ add_constructor<VariantConstructNoArgs<Vector3i>>(sarray());
+ add_constructor<VariantConstructor<Vector3i, Vector3i>>(sarray("from"));
+ add_constructor<VariantConstructor<Vector3i, Vector3>>(sarray("from"));
+ add_constructor<VariantConstructor<Vector3i, int64_t, int64_t, int64_t>>(sarray("x", "y", "z"));
+
+ add_constructor<VariantConstructNoArgs<Transform2D>>(sarray());
+ add_constructor<VariantConstructor<Transform2D, Transform2D>>(sarray("from"));
+ add_constructor<VariantConstructor<Transform2D, float, Vector2>>(sarray("rotation", "position"));
+ add_constructor<VariantConstructor<Transform2D, Vector2, Vector2, Vector2>>(sarray("x_axis", "y_axis", "origin"));
+
+ add_constructor<VariantConstructNoArgs<Plane>>(sarray());
+ add_constructor<VariantConstructor<Plane, Plane>>(sarray("from"));
+ add_constructor<VariantConstructor<Plane, Vector3, double>>(sarray("normal", "d"));
+ add_constructor<VariantConstructor<Plane, Vector3, Vector3>>(sarray("point", "normal"));
+ add_constructor<VariantConstructor<Plane, Vector3, Vector3, Vector3>>(sarray("point1", "point2", "point3"));
+ add_constructor<VariantConstructor<Plane, double, double, double, double>>(sarray("a", "b", "c", "d"));
+
+ add_constructor<VariantConstructNoArgs<Quat>>(sarray());
+ add_constructor<VariantConstructor<Quat, Quat>>(sarray("from"));
+ add_constructor<VariantConstructor<Quat, Basis>>(sarray("from"));
+ add_constructor<VariantConstructor<Quat, Vector3>>(sarray("euler"));
+ add_constructor<VariantConstructor<Quat, Vector3, double>>(sarray("axis", "angle"));
+ add_constructor<VariantConstructor<Quat, Vector3, Vector3>>(sarray("arc_from", "arc_to"));
+ add_constructor<VariantConstructor<Quat, double, double, double, double>>(sarray("x", "y", "z", "w"));
+
+ add_constructor<VariantConstructNoArgs<::AABB>>(sarray());
+ add_constructor<VariantConstructor<::AABB, ::AABB>>(sarray("from"));
+ add_constructor<VariantConstructor<::AABB, Vector3, Vector3>>(sarray("position", "size"));
+
+ add_constructor<VariantConstructNoArgs<Basis>>(sarray());
+ add_constructor<VariantConstructor<Basis, Basis>>(sarray("from"));
+ add_constructor<VariantConstructor<Basis, Quat>>(sarray("from"));
+ add_constructor<VariantConstructor<Basis, Vector3>>(sarray("euler"));
+ add_constructor<VariantConstructor<Basis, Vector3, double>>(sarray("axis", "phi"));
+ add_constructor<VariantConstructor<Basis, Vector3, Vector3, Vector3>>(sarray("x_axis", "y_axis", "z_axis"));
+
+ add_constructor<VariantConstructNoArgs<Transform>>(sarray());
+ add_constructor<VariantConstructor<Transform, Transform>>(sarray("from"));
+ add_constructor<VariantConstructor<Transform, Basis, Vector3>>(sarray("basis", "origin"));
+ add_constructor<VariantConstructor<Transform, Vector3, Vector3, Vector3, Vector3>>(sarray("x_axis", "y_axis", "z_axis", "origin"));
+
+ add_constructor<VariantConstructNoArgs<Color>>(sarray());
+ add_constructor<VariantConstructor<Color, Color>>(sarray("from"));
+ add_constructor<VariantConstructor<Color, Color, double>>(sarray("from", "alpha"));
+ add_constructor<VariantConstructor<Color, double, double, double>>(sarray("r", "g", "b"));
+ add_constructor<VariantConstructor<Color, double, double, double, double>>(sarray("r", "g", "b", "a"));
+
+ add_constructor<VariantConstructNoArgs<StringName>>(sarray());
+ add_constructor<VariantConstructor<StringName, StringName>>(sarray("from"));
+ add_constructor<VariantConstructor<StringName, String>>(sarray("from"));
+
+ add_constructor<VariantConstructNoArgs<NodePath>>(sarray());
+ add_constructor<VariantConstructor<NodePath, NodePath>>(sarray("from"));
+ add_constructor<VariantConstructor<NodePath, String>>(sarray("from"));
+
+ add_constructor<VariantConstructNoArgs<::RID>>(sarray());
+ add_constructor<VariantConstructor<::RID, ::RID>>(sarray("from"));
+
+ add_constructor<VariantConstructNoArgsObject>(sarray());
+ add_constructor<VariantConstructorObject>(sarray("from"));
+ add_constructor<VariantConstructorNilObject>(sarray("from"));
+
+ add_constructor<VariantConstructNoArgs<Callable>>(sarray());
+ add_constructor<VariantConstructor<Callable, Callable>>(sarray("from"));
+ add_constructor<VariantConstructorCallableArgs>(sarray("object", "method"));
+
+ add_constructor<VariantConstructNoArgs<Signal>>(sarray());
+ add_constructor<VariantConstructor<Signal, Signal>>(sarray("from"));
+ add_constructor<VariantConstructorSignalArgs>(sarray("object", "signal"));
+
+ add_constructor<VariantConstructNoArgs<Dictionary>>(sarray());
+ add_constructor<VariantConstructor<Dictionary, Dictionary>>(sarray("from"));
+
+ add_constructor<VariantConstructNoArgs<Array>>(sarray());
+ add_constructor<VariantConstructor<Array, Array>>(sarray("from"));
+ add_constructor<VariantConstructorToArray<PackedByteArray>>(sarray("from"));
+ add_constructor<VariantConstructorToArray<PackedInt32Array>>(sarray("from"));
+ add_constructor<VariantConstructorToArray<PackedInt64Array>>(sarray("from"));
+ add_constructor<VariantConstructorToArray<PackedFloat32Array>>(sarray("from"));
+ add_constructor<VariantConstructorToArray<PackedFloat64Array>>(sarray("from"));
+ add_constructor<VariantConstructorToArray<PackedStringArray>>(sarray("from"));
+ add_constructor<VariantConstructorToArray<PackedVector2Array>>(sarray("from"));
+ add_constructor<VariantConstructorToArray<PackedVector3Array>>(sarray("from"));
+ add_constructor<VariantConstructorToArray<PackedColorArray>>(sarray("from"));
+
+ add_constructor<VariantConstructNoArgs<PackedByteArray>>(sarray());
+ add_constructor<VariantConstructor<PackedByteArray, PackedByteArray>>(sarray("from"));
+ add_constructor<VariantConstructorFromArray<PackedByteArray>>(sarray("from"));
+
+ add_constructor<VariantConstructNoArgs<PackedInt32Array>>(sarray());
+ add_constructor<VariantConstructor<PackedInt32Array, PackedInt32Array>>(sarray("from"));
+ add_constructor<VariantConstructorFromArray<PackedInt32Array>>(sarray("from"));
+
+ add_constructor<VariantConstructNoArgs<PackedInt64Array>>(sarray());
+ add_constructor<VariantConstructor<PackedInt64Array, PackedInt64Array>>(sarray("from"));
+ add_constructor<VariantConstructorFromArray<PackedInt64Array>>(sarray("from"));
+
+ add_constructor<VariantConstructNoArgs<PackedFloat32Array>>(sarray());
+ add_constructor<VariantConstructor<PackedFloat32Array, PackedFloat32Array>>(sarray("from"));
+ add_constructor<VariantConstructorFromArray<PackedFloat32Array>>(sarray("from"));
+
+ add_constructor<VariantConstructNoArgs<PackedFloat64Array>>(sarray());
+ add_constructor<VariantConstructor<PackedFloat64Array, PackedFloat64Array>>(sarray("from"));
+ add_constructor<VariantConstructorFromArray<PackedFloat64Array>>(sarray("from"));
+
+ add_constructor<VariantConstructNoArgs<PackedStringArray>>(sarray());
+ add_constructor<VariantConstructor<PackedStringArray, PackedStringArray>>(sarray("from"));
+ add_constructor<VariantConstructorFromArray<PackedStringArray>>(sarray("from"));
+
+ add_constructor<VariantConstructNoArgs<PackedVector2Array>>(sarray());
+ add_constructor<VariantConstructor<PackedVector2Array, PackedVector2Array>>(sarray("from"));
+ add_constructor<VariantConstructorFromArray<PackedVector2Array>>(sarray("from"));
+
+ add_constructor<VariantConstructNoArgs<PackedVector3Array>>(sarray());
+ add_constructor<VariantConstructor<PackedVector3Array, PackedVector3Array>>(sarray("from"));
+ add_constructor<VariantConstructorFromArray<PackedVector3Array>>(sarray("from"));
+
+ add_constructor<VariantConstructNoArgs<PackedColorArray>>(sarray());
+ add_constructor<VariantConstructor<PackedColorArray, PackedColorArray>>(sarray("from"));
+ add_constructor<VariantConstructorFromArray<PackedColorArray>>(sarray("from"));
+}
+
+void Variant::_unregister_variant_constructors() {
+ for (int i = 0; i < Variant::VARIANT_MAX; i++) {
+ construct_data[i].clear();
+ }
+}
+
+void Variant::construct(Variant::Type p_type, Variant &base, const Variant **p_args, int p_argcount, Callable::CallError &r_error) {
+ uint32_t s = construct_data[p_type].size();
+ for (uint32_t i = 0; i < s; i++) {
+ int argc = construct_data[p_type][i].argument_count;
+ if (argc != p_argcount) {
+ continue;
+ }
+ bool args_match = true;
+ for (int j = 0; j < argc; j++) {
+ if (!Variant::can_convert_strict(p_args[j]->get_type(), construct_data[p_type][i].get_argument_type(j))) {
+ args_match = false;
+ break;
+ }
+ }
+
+ if (!args_match) {
+ continue;
+ }
+
+ construct_data[p_type][i].construct(base, p_args, r_error);
+ return;
+ }
+
+ r_error.error = Callable::CallError::CALL_ERROR_INVALID_METHOD;
+}
+
+int Variant::get_constructor_count(Variant::Type p_type) {
+ ERR_FAIL_INDEX_V(p_type, Variant::VARIANT_MAX, -1);
+ return construct_data[p_type].size();
+}
+
+Variant::ValidatedConstructor Variant::get_validated_constructor(Variant::Type p_type, int p_constructor) {
+ ERR_FAIL_INDEX_V(p_type, Variant::VARIANT_MAX, nullptr);
+ ERR_FAIL_INDEX_V(p_constructor, (int)construct_data[p_type].size(), nullptr);
+ return construct_data[p_type][p_constructor].validated_construct;
+}
+
+Variant::PTRConstructor Variant::get_ptr_constructor(Variant::Type p_type, int p_constructor) {
+ ERR_FAIL_INDEX_V(p_type, Variant::VARIANT_MAX, nullptr);
+ ERR_FAIL_INDEX_V(p_constructor, (int)construct_data[p_type].size(), nullptr);
+ return construct_data[p_type][p_constructor].ptr_construct;
+}
+
+int Variant::get_constructor_argument_count(Variant::Type p_type, int p_constructor) {
+ ERR_FAIL_INDEX_V(p_type, Variant::VARIANT_MAX, -1);
+ ERR_FAIL_INDEX_V(p_constructor, (int)construct_data[p_type].size(), -1);
+ return construct_data[p_type][p_constructor].argument_count;
+}
+
+Variant::Type Variant::get_constructor_argument_type(Variant::Type p_type, int p_constructor, int p_argument) {
+ ERR_FAIL_INDEX_V(p_type, Variant::VARIANT_MAX, Variant::VARIANT_MAX);
+ ERR_FAIL_INDEX_V(p_constructor, (int)construct_data[p_type].size(), Variant::VARIANT_MAX);
+ return construct_data[p_type][p_constructor].get_argument_type(p_argument);
+}
+
+String Variant::get_constructor_argument_name(Variant::Type p_type, int p_constructor, int p_argument) {
+ ERR_FAIL_INDEX_V(p_type, Variant::VARIANT_MAX, String());
+ ERR_FAIL_INDEX_V(p_constructor, (int)construct_data[p_type].size(), String());
+ return construct_data[p_type][p_constructor].arg_names[p_argument];
+}
+
+void VariantInternal::object_assign(Variant *v, const Variant *o) {
+ if (o->_get_obj().obj && o->_get_obj().id.is_reference()) {
+ Reference *reference = static_cast<Reference *>(o->_get_obj().obj);
+ if (!reference->reference()) {
+ v->_get_obj().obj = nullptr;
+ v->_get_obj().id = ObjectID();
+ return;
+ }
+ }
+
+ v->_get_obj().obj = const_cast<Object *>(o->_get_obj().obj);
+ v->_get_obj().id = o->_get_obj().id;
+}
+
+void Variant::get_constructor_list(Type p_type, List<MethodInfo> *r_list) {
+ ERR_FAIL_INDEX(p_type, Variant::VARIANT_MAX);
+
+ MethodInfo mi;
+ mi.return_val.type = p_type;
+ mi.name = get_type_name(p_type);
+
+ for (int i = 0; i < get_constructor_count(p_type); i++) {
+ int ac = get_constructor_argument_count(p_type, i);
+ mi.arguments.clear();
+ for (int j = 0; j < ac; j++) {
+ PropertyInfo arg;
+ arg.name = get_constructor_argument_name(p_type, i, j);
+ arg.type = get_constructor_argument_type(p_type, i, j);
+ mi.arguments.push_back(arg);
+ }
+ r_list->push_back(mi);
+ }
+}
diff --git a/core/variant_internal.h b/core/variant/variant_internal.h
index 7893c6d382..3ac7f32dec 100644
--- a/core/variant_internal.h
+++ b/core/variant/variant_internal.h
@@ -83,8 +83,8 @@ public:
_FORCE_INLINE_ static const StringName *get_string_name(const Variant *v) { return reinterpret_cast<const StringName *>(v->_data._mem); }
_FORCE_INLINE_ static NodePath *get_node_path(Variant *v) { return reinterpret_cast<NodePath *>(v->_data._mem); }
_FORCE_INLINE_ static const NodePath *get_node_path(const Variant *v) { return reinterpret_cast<const NodePath *>(v->_data._mem); }
- _FORCE_INLINE_ static RID *get_rid(Variant *v) { return reinterpret_cast<RID *>(v->_data._mem); }
- _FORCE_INLINE_ static const RID *get_rid(const Variant *v) { return reinterpret_cast<const RID *>(v->_data._mem); }
+ _FORCE_INLINE_ static ::RID *get_rid(Variant *v) { return reinterpret_cast<::RID *>(v->_data._mem); }
+ _FORCE_INLINE_ static const ::RID *get_rid(const Variant *v) { return reinterpret_cast<const ::RID *>(v->_data._mem); }
_FORCE_INLINE_ static Callable *get_callable(Variant *v) { return reinterpret_cast<Callable *>(v->_data._mem); }
_FORCE_INLINE_ static const Callable *get_callable(const Variant *v) { return reinterpret_cast<const Callable *>(v->_data._mem); }
_FORCE_INLINE_ static Signal *get_signal(Variant *v) { return reinterpret_cast<Signal *>(v->_data._mem); }
@@ -116,6 +116,106 @@ public:
_FORCE_INLINE_ static Object **get_object(Variant *v) { return (Object **)&v->_get_obj().obj; }
_FORCE_INLINE_ static const Object **get_object(const Variant *v) { return (const Object **)&v->_get_obj().obj; }
+
+ _FORCE_INLINE_ static const ObjectID get_object_id(const Variant *v) { return v->_get_obj().id; }
+
+ template <class T>
+ _FORCE_INLINE_ static void init_generic(Variant *v) {
+ v->type = GetTypeInfo<T>::VARIANT_TYPE;
+ }
+
+ _FORCE_INLINE_ static void init_string(Variant *v) {
+ memnew_placement(v->_data._mem, String);
+ v->type = Variant::STRING;
+ }
+
+ _FORCE_INLINE_ static void init_transform2d(Variant *v) {
+ v->_data._transform2d = memnew(Transform2D);
+ v->type = Variant::TRANSFORM2D;
+ }
+ _FORCE_INLINE_ static void init_aabb(Variant *v) {
+ v->_data._aabb = memnew(AABB);
+ v->type = Variant::AABB;
+ }
+ _FORCE_INLINE_ static void init_basis(Variant *v) {
+ v->_data._basis = memnew(Basis);
+ v->type = Variant::BASIS;
+ }
+ _FORCE_INLINE_ static void init_transform(Variant *v) {
+ v->_data._transform = memnew(Transform);
+ v->type = Variant::TRANSFORM;
+ }
+ _FORCE_INLINE_ static void init_string_name(Variant *v) {
+ memnew_placement(v->_data._mem, StringName);
+ v->type = Variant::STRING_NAME;
+ }
+ _FORCE_INLINE_ static void init_node_path(Variant *v) {
+ memnew_placement(v->_data._mem, NodePath);
+ v->type = Variant::NODE_PATH;
+ }
+ _FORCE_INLINE_ static void init_callable(Variant *v) {
+ memnew_placement(v->_data._mem, Callable);
+ v->type = Variant::CALLABLE;
+ }
+ _FORCE_INLINE_ static void init_signal(Variant *v) {
+ memnew_placement(v->_data._mem, Signal);
+ v->type = Variant::SIGNAL;
+ }
+ _FORCE_INLINE_ static void init_dictionary(Variant *v) {
+ memnew_placement(v->_data._mem, Dictionary);
+ v->type = Variant::DICTIONARY;
+ }
+ _FORCE_INLINE_ static void init_array(Variant *v) {
+ memnew_placement(v->_data._mem, Array);
+ v->type = Variant::ARRAY;
+ }
+ _FORCE_INLINE_ static void init_byte_array(Variant *v) {
+ v->_data.packed_array = Variant::PackedArrayRef<uint8_t>::create(Vector<uint8_t>());
+ v->type = Variant::PACKED_BYTE_ARRAY;
+ }
+ _FORCE_INLINE_ static void init_int32_array(Variant *v) {
+ v->_data.packed_array = Variant::PackedArrayRef<int32_t>::create(Vector<int32_t>());
+ v->type = Variant::PACKED_INT32_ARRAY;
+ }
+ _FORCE_INLINE_ static void init_int64_array(Variant *v) {
+ v->_data.packed_array = Variant::PackedArrayRef<int64_t>::create(Vector<int64_t>());
+ v->type = Variant::PACKED_INT64_ARRAY;
+ }
+ _FORCE_INLINE_ static void init_float32_array(Variant *v) {
+ v->_data.packed_array = Variant::PackedArrayRef<float>::create(Vector<float>());
+ v->type = Variant::PACKED_FLOAT32_ARRAY;
+ }
+ _FORCE_INLINE_ static void init_float64_array(Variant *v) {
+ v->_data.packed_array = Variant::PackedArrayRef<double>::create(Vector<double>());
+ v->type = Variant::PACKED_FLOAT64_ARRAY;
+ }
+ _FORCE_INLINE_ static void init_string_array(Variant *v) {
+ v->_data.packed_array = Variant::PackedArrayRef<String>::create(Vector<String>());
+ v->type = Variant::PACKED_STRING_ARRAY;
+ }
+ _FORCE_INLINE_ static void init_vector2_array(Variant *v) {
+ v->_data.packed_array = Variant::PackedArrayRef<Vector2>::create(Vector<Vector2>());
+ v->type = Variant::PACKED_VECTOR2_ARRAY;
+ }
+ _FORCE_INLINE_ static void init_vector3_array(Variant *v) {
+ v->_data.packed_array = Variant::PackedArrayRef<Vector3>::create(Vector<Vector3>());
+ v->type = Variant::PACKED_VECTOR3_ARRAY;
+ }
+ _FORCE_INLINE_ static void init_color_array(Variant *v) {
+ v->_data.packed_array = Variant::PackedArrayRef<Color>::create(Vector<Color>());
+ v->type = Variant::PACKED_COLOR_ARRAY;
+ }
+
+ _FORCE_INLINE_ static void clear(Variant *v) {
+ v->clear();
+ }
+
+ static void object_assign(Variant *v, const Variant *o); //needs to use reference, do away
+
+ _FORCE_INLINE_ static void object_assign_null(Variant *v) {
+ v->_get_obj().obj = nullptr;
+ v->_get_obj().id = ObjectID();
+ }
};
template <class T>
@@ -305,9 +405,9 @@ struct VariantGetInternalPtr<NodePath> {
};
template <>
-struct VariantGetInternalPtr<RID> {
- static RID *get_ptr(Variant *v) { return VariantInternal::get_rid(v); }
- static const RID *get_ptr(const Variant *v) { return VariantInternal::get_rid(v); }
+struct VariantGetInternalPtr<::RID> {
+ static ::RID *get_ptr(Variant *v) { return VariantInternal::get_rid(v); }
+ static const ::RID *get_ptr(const Variant *v) { return VariantInternal::get_rid(v); }
};
template <>
@@ -532,9 +632,9 @@ struct VariantInternalAccessor<NodePath> {
};
template <>
-struct VariantInternalAccessor<RID> {
- static _FORCE_INLINE_ const RID &get(const Variant *v) { return *VariantInternal::get_rid(v); }
- static _FORCE_INLINE_ void set(Variant *v, const RID &p_value) { *VariantInternal::get_rid(v) = p_value; }
+struct VariantInternalAccessor<::RID> {
+ static _FORCE_INLINE_ const ::RID &get(const Variant *v) { return *VariantInternal::get_rid(v); }
+ static _FORCE_INLINE_ void set(Variant *v, const ::RID &p_value) { *VariantInternal::get_rid(v) = p_value; }
};
template <>
@@ -649,4 +749,383 @@ struct VariantInternalAccessor<Vector<Variant>> {
}
};
+template <class T>
+struct VariantInitializer {
+};
+
+template <>
+struct VariantInitializer<bool> {
+ static _FORCE_INLINE_ void init(Variant *v) { VariantInternal::init_generic<bool>(v); }
+};
+
+#define INITIALIZER_INT(m_type) \
+ template <> \
+ struct VariantInitializer<m_type> { \
+ static _FORCE_INLINE_ void init(Variant *v) { VariantInternal::init_generic<int64_t>(v); } \
+ };
+
+INITIALIZER_INT(uint8_t)
+INITIALIZER_INT(int8_t)
+INITIALIZER_INT(uint16_t)
+INITIALIZER_INT(int16_t)
+INITIALIZER_INT(uint32_t)
+INITIALIZER_INT(int32_t)
+INITIALIZER_INT(uint64_t)
+INITIALIZER_INT(int64_t)
+INITIALIZER_INT(char32_t)
+INITIALIZER_INT(Error)
+INITIALIZER_INT(ObjectID)
+
+template <>
+struct VariantInitializer<double> {
+ static _FORCE_INLINE_ void init(Variant *v) { VariantInternal::init_generic<double>(v); }
+};
+
+template <>
+struct VariantInitializer<float> {
+ static _FORCE_INLINE_ void init(Variant *v) { VariantInternal::init_generic<double>(v); }
+};
+
+template <>
+struct VariantInitializer<String> {
+ static _FORCE_INLINE_ void init(Variant *v) { VariantInternal::init_string(v); }
+};
+
+template <>
+struct VariantInitializer<Vector2> {
+ static _FORCE_INLINE_ void init(Variant *v) { VariantInternal::init_generic<Vector2>(v); }
+};
+
+template <>
+struct VariantInitializer<Vector2i> {
+ static _FORCE_INLINE_ void init(Variant *v) { VariantInternal::init_generic<Vector2i>(v); }
+};
+
+template <>
+struct VariantInitializer<Rect2> {
+ static _FORCE_INLINE_ void init(Variant *v) { VariantInternal::init_generic<Rect2>(v); }
+};
+
+template <>
+struct VariantInitializer<Rect2i> {
+ static _FORCE_INLINE_ void init(Variant *v) { VariantInternal::init_generic<Rect2i>(v); }
+};
+
+template <>
+struct VariantInitializer<Vector3> {
+ static _FORCE_INLINE_ void init(Variant *v) { VariantInternal::init_generic<Vector3>(v); }
+};
+
+template <>
+struct VariantInitializer<Vector3i> {
+ static _FORCE_INLINE_ void init(Variant *v) { VariantInternal::init_generic<Vector3i>(v); }
+};
+
+template <>
+struct VariantInitializer<Transform2D> {
+ static _FORCE_INLINE_ void init(Variant *v) { VariantInternal::init_transform2d(v); }
+};
+
+template <>
+struct VariantInitializer<Plane> {
+ static _FORCE_INLINE_ void init(Variant *v) { VariantInternal::init_generic<Plane>(v); }
+};
+
+template <>
+struct VariantInitializer<Quat> {
+ static _FORCE_INLINE_ void init(Variant *v) { VariantInternal::init_generic<Quat>(v); }
+};
+
+template <>
+struct VariantInitializer<AABB> {
+ static _FORCE_INLINE_ void init(Variant *v) { VariantInternal::init_aabb(v); }
+};
+
+template <>
+struct VariantInitializer<Basis> {
+ static _FORCE_INLINE_ void init(Variant *v) { VariantInternal::init_basis(v); }
+};
+
+template <>
+struct VariantInitializer<Transform> {
+ static _FORCE_INLINE_ void init(Variant *v) { VariantInternal::init_transform(v); }
+};
+
+template <>
+struct VariantInitializer<Color> {
+ static _FORCE_INLINE_ void init(Variant *v) { VariantInternal::init_generic<Color>(v); }
+};
+
+template <>
+struct VariantInitializer<StringName> {
+ static _FORCE_INLINE_ void init(Variant *v) { VariantInternal::init_string_name(v); }
+};
+
+template <>
+struct VariantInitializer<NodePath> {
+ static _FORCE_INLINE_ void init(Variant *v) { VariantInternal::init_node_path(v); }
+};
+
+template <>
+struct VariantInitializer<::RID> {
+ static _FORCE_INLINE_ void init(Variant *v) { VariantInternal::init_generic<::RID>(v); }
+};
+
+template <>
+struct VariantInitializer<Callable> {
+ static _FORCE_INLINE_ void init(Variant *v) { VariantInternal::init_callable(v); }
+};
+
+template <>
+struct VariantInitializer<Signal> {
+ static _FORCE_INLINE_ void init(Variant *v) { VariantInternal::init_signal(v); }
+};
+
+template <>
+struct VariantInitializer<Dictionary> {
+ static _FORCE_INLINE_ void init(Variant *v) { VariantInternal::init_dictionary(v); }
+};
+
+template <>
+struct VariantInitializer<Array> {
+ static _FORCE_INLINE_ void init(Variant *v) { VariantInternal::init_array(v); }
+};
+
+template <>
+struct VariantInitializer<PackedByteArray> {
+ static _FORCE_INLINE_ void init(Variant *v) { VariantInternal::init_byte_array(v); }
+};
+
+template <>
+struct VariantInitializer<PackedInt32Array> {
+ static _FORCE_INLINE_ void init(Variant *v) { VariantInternal::init_int32_array(v); }
+};
+
+template <>
+struct VariantInitializer<PackedInt64Array> {
+ static _FORCE_INLINE_ void init(Variant *v) { VariantInternal::init_int64_array(v); }
+};
+
+template <>
+struct VariantInitializer<PackedFloat32Array> {
+ static _FORCE_INLINE_ void init(Variant *v) { VariantInternal::init_float32_array(v); }
+};
+
+template <>
+struct VariantInitializer<PackedFloat64Array> {
+ static _FORCE_INLINE_ void init(Variant *v) { VariantInternal::init_float64_array(v); }
+};
+
+template <>
+struct VariantInitializer<PackedStringArray> {
+ static _FORCE_INLINE_ void init(Variant *v) { VariantInternal::init_string_array(v); }
+};
+
+template <>
+struct VariantInitializer<PackedVector2Array> {
+ static _FORCE_INLINE_ void init(Variant *v) { VariantInternal::init_vector2_array(v); }
+};
+
+template <>
+struct VariantInitializer<PackedVector3Array> {
+ static _FORCE_INLINE_ void init(Variant *v) { VariantInternal::init_vector3_array(v); }
+};
+
+template <>
+struct VariantInitializer<PackedColorArray> {
+ static _FORCE_INLINE_ void init(Variant *v) { VariantInternal::init_color_array(v); }
+};
+
+template <class T>
+struct VariantZeroAssigner {
+};
+
+template <>
+struct VariantZeroAssigner<bool> {
+ static _FORCE_INLINE_ void zero(Variant *v) { *VariantInternal::get_bool(v) = false; }
+};
+
+template <>
+struct VariantZeroAssigner<int64_t> {
+ static _FORCE_INLINE_ void zero(Variant *v) { *VariantInternal::get_int(v) = 0; }
+};
+
+template <>
+struct VariantZeroAssigner<double> {
+ static _FORCE_INLINE_ void zero(Variant *v) { *VariantInternal::get_float(v) = 0.0; }
+};
+
+template <>
+struct VariantZeroAssigner<float> {
+ static _FORCE_INLINE_ void zero(Variant *v) { *VariantInternal::get_float(v) = 0.0; }
+};
+
+template <>
+struct VariantZeroAssigner<String> {
+ static _FORCE_INLINE_ void zero(Variant *v) {}
+};
+
+template <>
+struct VariantZeroAssigner<Vector2> {
+ static _FORCE_INLINE_ void zero(Variant *v) { *VariantInternal::get_vector2(v) = Vector2(); }
+};
+
+template <>
+struct VariantZeroAssigner<Vector2i> {
+ static _FORCE_INLINE_ void zero(Variant *v) { *VariantInternal::get_vector2i(v) = Vector2i(); }
+};
+
+template <>
+struct VariantZeroAssigner<Rect2> {
+ static _FORCE_INLINE_ void zero(Variant *v) { *VariantInternal::get_rect2(v) = Rect2(); }
+};
+
+template <>
+struct VariantZeroAssigner<Rect2i> {
+ static _FORCE_INLINE_ void zero(Variant *v) { *VariantInternal::get_rect2i(v) = Rect2i(); }
+};
+
+template <>
+struct VariantZeroAssigner<Vector3> {
+ static _FORCE_INLINE_ void zero(Variant *v) { *VariantInternal::get_vector3(v) = Vector3(); }
+};
+
+template <>
+struct VariantZeroAssigner<Vector3i> {
+ static _FORCE_INLINE_ void zero(Variant *v) { *VariantInternal::get_vector3i(v) = Vector3i(); }
+};
+
+template <>
+struct VariantZeroAssigner<Transform2D> {
+ static _FORCE_INLINE_ void zero(Variant *v) { *VariantInternal::get_transform2d(v) = Transform2D(); }
+};
+
+template <>
+struct VariantZeroAssigner<Plane> {
+ static _FORCE_INLINE_ void zero(Variant *v) { *VariantInternal::get_plane(v) = Plane(); }
+};
+
+template <>
+struct VariantZeroAssigner<Quat> {
+ static _FORCE_INLINE_ void zero(Variant *v) { *VariantInternal::get_quat(v) = Quat(); }
+};
+
+template <>
+struct VariantZeroAssigner<AABB> {
+ static _FORCE_INLINE_ void zero(Variant *v) { *VariantInternal::get_aabb(v) = AABB(); }
+};
+
+template <>
+struct VariantZeroAssigner<Basis> {
+ static _FORCE_INLINE_ void zero(Variant *v) { *VariantInternal::get_basis(v) = Basis(); }
+};
+
+template <>
+struct VariantZeroAssigner<Transform> {
+ static _FORCE_INLINE_ void zero(Variant *v) { *VariantInternal::get_transform(v) = Transform(); }
+};
+
+template <>
+struct VariantZeroAssigner<Color> {
+ static _FORCE_INLINE_ void zero(Variant *v) { *VariantInternal::get_color(v) = Color(); }
+};
+
+template <>
+struct VariantZeroAssigner<StringName> {
+ static _FORCE_INLINE_ void zero(Variant *v) {}
+};
+
+template <>
+struct VariantZeroAssigner<NodePath> {
+ static _FORCE_INLINE_ void zero(Variant *v) {}
+};
+
+template <>
+struct VariantZeroAssigner<::RID> {
+ static _FORCE_INLINE_ void zero(Variant *v) { *VariantInternal::get_rid(v) = RID(); }
+};
+
+template <>
+struct VariantZeroAssigner<Callable> {
+ static _FORCE_INLINE_ void zero(Variant *v) {}
+};
+
+template <>
+struct VariantZeroAssigner<Signal> {
+ static _FORCE_INLINE_ void zero(Variant *v) {}
+};
+
+template <>
+struct VariantZeroAssigner<Dictionary> {
+ static _FORCE_INLINE_ void zero(Variant *v) {}
+};
+
+template <>
+struct VariantZeroAssigner<Array> {
+ static _FORCE_INLINE_ void zero(Variant *v) {}
+};
+
+template <>
+struct VariantZeroAssigner<PackedByteArray> {
+ static _FORCE_INLINE_ void zero(Variant *v) {}
+};
+
+template <>
+struct VariantZeroAssigner<PackedInt32Array> {
+ static _FORCE_INLINE_ void zero(Variant *v) {}
+};
+
+template <>
+struct VariantZeroAssigner<PackedInt64Array> {
+ static _FORCE_INLINE_ void zero(Variant *v) {}
+};
+
+template <>
+struct VariantZeroAssigner<PackedFloat32Array> {
+ static _FORCE_INLINE_ void zero(Variant *v) {}
+};
+
+template <>
+struct VariantZeroAssigner<PackedFloat64Array> {
+ static _FORCE_INLINE_ void zero(Variant *v) {}
+};
+
+template <>
+struct VariantZeroAssigner<PackedStringArray> {
+ static _FORCE_INLINE_ void zero(Variant *v) {}
+};
+
+template <>
+struct VariantZeroAssigner<PackedVector2Array> {
+ static _FORCE_INLINE_ void zero(Variant *v) {}
+};
+
+template <>
+struct VariantZeroAssigner<PackedVector3Array> {
+ static _FORCE_INLINE_ void zero(Variant *v) {}
+};
+
+template <>
+struct VariantZeroAssigner<PackedColorArray> {
+ static _FORCE_INLINE_ void zero(Variant *v) {}
+};
+
+template <class T>
+struct VariantTypeChanger {
+ static _FORCE_INLINE_ void change(Variant *v) {
+ if (v->get_type() != GetTypeInfo<T>::VARIANT_TYPE || GetTypeInfo<T>::VARIANT_TYPE >= Variant::PACKED_BYTE_ARRAY) { //second condition removed by optimizer
+ VariantInternal::clear(v);
+ VariantInitializer<T>::init(v);
+ }
+ }
+ static _FORCE_INLINE_ void change_and_reset(Variant *v) {
+ if (v->get_type() != GetTypeInfo<T>::VARIANT_TYPE || GetTypeInfo<T>::VARIANT_TYPE >= Variant::PACKED_BYTE_ARRAY) { //second condition removed by optimizer
+ VariantInternal::clear(v);
+ VariantInitializer<T>::init(v);
+ }
+
+ VariantZeroAssigner<T>::zero(v);
+ }
+};
+
#endif // VARIANT_INTERNAL_H
diff --git a/core/variant/variant_op.cpp b/core/variant/variant_op.cpp
new file mode 100644
index 0000000000..8e55c1d6cd
--- /dev/null
+++ b/core/variant/variant_op.cpp
@@ -0,0 +1,2190 @@
+/*************************************************************************/
+/* variant_op.cpp */
+/*************************************************************************/
+/* This file is part of: */
+/* GODOT ENGINE */
+/* https://godotengine.org */
+/*************************************************************************/
+/* Copyright (c) 2007-2020 Juan Linietsky, Ariel Manzur. */
+/* Copyright (c) 2014-2020 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 "variant.h"
+
+#include "core/core_string_names.h"
+#include "core/debugger/engine_debugger.h"
+#include "core/object/class_db.h"
+
+template <class R, class A, class B>
+class OperatorEvaluatorAdd {
+public:
+ static void evaluate(const Variant &p_left, const Variant &p_right, Variant *r_ret, bool &r_valid) {
+ const A &a = *VariantGetInternalPtr<A>::get_ptr(&p_left);
+ const B &b = *VariantGetInternalPtr<B>::get_ptr(&p_right);
+ *r_ret = a + b;
+ r_valid = true;
+ }
+ static void validated_evaluate(const Variant *left, const Variant *right, Variant *r_ret) {
+ VariantTypeChanger<R>::change(r_ret);
+ *VariantGetInternalPtr<R>::get_ptr(r_ret) = *VariantGetInternalPtr<A>::get_ptr(left) + *VariantGetInternalPtr<B>::get_ptr(right);
+ }
+#ifdef PTRCALL_ENABLED
+ static void ptr_evaluate(const void *left, const void *right, void *r_ret) {
+ PtrToArg<R>::encode(PtrToArg<A>::convert(left) + PtrToArg<B>::convert(right), r_ret);
+ }
+#endif
+ static Variant::Type get_return_type() { return GetTypeInfo<R>::VARIANT_TYPE; }
+};
+
+template <class R, class A, class B>
+class OperatorEvaluatorSub {
+public:
+ static void evaluate(const Variant &p_left, const Variant &p_right, Variant *r_ret, bool &r_valid) {
+ const A &a = *VariantGetInternalPtr<A>::get_ptr(&p_left);
+ const B &b = *VariantGetInternalPtr<B>::get_ptr(&p_right);
+ *r_ret = a - b;
+ r_valid = true;
+ }
+ static void validated_evaluate(const Variant *left, const Variant *right, Variant *r_ret) {
+ VariantTypeChanger<R>::change(r_ret);
+ *VariantGetInternalPtr<R>::get_ptr(r_ret) = *VariantGetInternalPtr<A>::get_ptr(left) - *VariantGetInternalPtr<B>::get_ptr(right);
+ }
+#ifdef PTRCALL_ENABLED
+ static void ptr_evaluate(const void *left, const void *right, void *r_ret) {
+ PtrToArg<R>::encode(PtrToArg<A>::convert(left) - PtrToArg<B>::convert(right), r_ret);
+ }
+#endif
+ static Variant::Type get_return_type() { return GetTypeInfo<R>::VARIANT_TYPE; }
+};
+
+template <class R, class A, class B>
+class OperatorEvaluatorMul {
+public:
+ static void evaluate(const Variant &p_left, const Variant &p_right, Variant *r_ret, bool &r_valid) {
+ const A &a = *VariantGetInternalPtr<A>::get_ptr(&p_left);
+ const B &b = *VariantGetInternalPtr<B>::get_ptr(&p_right);
+ *r_ret = a * b;
+ r_valid = true;
+ }
+ static void validated_evaluate(const Variant *left, const Variant *right, Variant *r_ret) {
+ VariantTypeChanger<R>::change(r_ret);
+ *VariantGetInternalPtr<R>::get_ptr(r_ret) = *VariantGetInternalPtr<A>::get_ptr(left) * *VariantGetInternalPtr<B>::get_ptr(right);
+ }
+#ifdef PTRCALL_ENABLED
+ static void ptr_evaluate(const void *left, const void *right, void *r_ret) {
+ PtrToArg<R>::encode(PtrToArg<A>::convert(left) * PtrToArg<B>::convert(right), r_ret);
+ }
+#endif
+ static Variant::Type get_return_type() { return GetTypeInfo<R>::VARIANT_TYPE; }
+};
+
+template <class R, class A, class B>
+class OperatorEvaluatorXForm {
+public:
+ static void evaluate(const Variant &p_left, const Variant &p_right, Variant *r_ret, bool &r_valid) {
+ const A &a = *VariantGetInternalPtr<A>::get_ptr(&p_left);
+ const B &b = *VariantGetInternalPtr<B>::get_ptr(&p_right);
+ *r_ret = a.xform(b);
+ r_valid = true;
+ }
+ static void validated_evaluate(const Variant *left, const Variant *right, Variant *r_ret) {
+ VariantTypeChanger<R>::change(r_ret);
+ *VariantGetInternalPtr<R>::get_ptr(r_ret) = VariantGetInternalPtr<A>::get_ptr(left)->xform(*VariantGetInternalPtr<B>::get_ptr(right));
+ }
+#ifdef PTRCALL_ENABLED
+ static void ptr_evaluate(const void *left, const void *right, void *r_ret) {
+ PtrToArg<R>::encode(PtrToArg<A>::convert(left).xform(PtrToArg<B>::convert(right)), r_ret);
+ }
+#endif
+ static Variant::Type get_return_type() { return GetTypeInfo<R>::VARIANT_TYPE; }
+};
+
+template <class R, class A, class B>
+class OperatorEvaluatorXFormInv {
+public:
+ static void evaluate(const Variant &p_left, const Variant &p_right, Variant *r_ret, bool &r_valid) {
+ const A &a = *VariantGetInternalPtr<A>::get_ptr(&p_left);
+ const B &b = *VariantGetInternalPtr<B>::get_ptr(&p_right);
+ *r_ret = b.xform_inv(a);
+ r_valid = true;
+ }
+ static void validated_evaluate(const Variant *left, const Variant *right, Variant *r_ret) {
+ VariantTypeChanger<R>::change(r_ret);
+ *VariantGetInternalPtr<R>::get_ptr(r_ret) = VariantGetInternalPtr<B>::get_ptr(right)->xform_inv(*VariantGetInternalPtr<A>::get_ptr(left));
+ }
+#ifdef PTRCALL_ENABLED
+ static void ptr_evaluate(const void *left, const void *right, void *r_ret) {
+ PtrToArg<R>::encode(PtrToArg<B>::convert(right).xform_inv(PtrToArg<A>::convert(left)), r_ret);
+ }
+#endif
+ static Variant::Type get_return_type() { return GetTypeInfo<R>::VARIANT_TYPE; }
+};
+
+template <class R, class A, class B>
+class OperatorEvaluatorDiv {
+public:
+ static void evaluate(const Variant &p_left, const Variant &p_right, Variant *r_ret, bool &r_valid) {
+ const A &a = *VariantGetInternalPtr<A>::get_ptr(&p_left);
+ const B &b = *VariantGetInternalPtr<B>::get_ptr(&p_right);
+ *r_ret = a / b;
+ r_valid = true;
+ }
+ static void validated_evaluate(const Variant *left, const Variant *right, Variant *r_ret) {
+ VariantTypeChanger<R>::change(r_ret);
+ *VariantGetInternalPtr<R>::get_ptr(r_ret) = *VariantGetInternalPtr<A>::get_ptr(left) / *VariantGetInternalPtr<B>::get_ptr(right);
+ }
+#ifdef PTRCALL_ENABLED
+ static void ptr_evaluate(const void *left, const void *right, void *r_ret) {
+ PtrToArg<R>::encode(PtrToArg<A>::convert(left) / PtrToArg<B>::convert(right), r_ret);
+ }
+#endif
+ static Variant::Type get_return_type() { return GetTypeInfo<R>::VARIANT_TYPE; }
+};
+
+template <class R, class A, class B>
+class OperatorEvaluatorDivNZ {
+public:
+ static void evaluate(const Variant &p_left, const Variant &p_right, Variant *r_ret, bool &r_valid) {
+ const A &a = *VariantGetInternalPtr<A>::get_ptr(&p_left);
+ const B &b = *VariantGetInternalPtr<B>::get_ptr(&p_right);
+ if (b == 0) {
+ r_valid = false;
+ *r_ret = "Division by zero error";
+ return;
+ }
+ *r_ret = a / b;
+ r_valid = true;
+ }
+ static void validated_evaluate(const Variant *left, const Variant *right, Variant *r_ret) {
+ VariantTypeChanger<R>::change(r_ret);
+ *VariantGetInternalPtr<R>::get_ptr(r_ret) = *VariantGetInternalPtr<A>::get_ptr(left) / *VariantGetInternalPtr<B>::get_ptr(right);
+ }
+#ifdef PTRCALL_ENABLED
+ static void ptr_evaluate(const void *left, const void *right, void *r_ret) {
+ PtrToArg<R>::encode(PtrToArg<A>::convert(left) / PtrToArg<B>::convert(right), r_ret);
+ }
+#endif
+ static Variant::Type get_return_type() { return GetTypeInfo<R>::VARIANT_TYPE; }
+};
+
+template <class R, class A, class B>
+class OperatorEvaluatorMod {
+public:
+ static void evaluate(const Variant &p_left, const Variant &p_right, Variant *r_ret, bool &r_valid) {
+ const A &a = *VariantGetInternalPtr<A>::get_ptr(&p_left);
+ const B &b = *VariantGetInternalPtr<B>::get_ptr(&p_right);
+ *r_ret = a % b;
+ r_valid = true;
+ }
+ static void validated_evaluate(const Variant *left, const Variant *right, Variant *r_ret) {
+ VariantTypeChanger<R>::change(r_ret);
+ *VariantGetInternalPtr<R>::get_ptr(r_ret) = *VariantGetInternalPtr<A>::get_ptr(left) % *VariantGetInternalPtr<B>::get_ptr(right);
+ }
+#ifdef PTRCALL_ENABLED
+ static void ptr_evaluate(const void *left, const void *right, void *r_ret) {
+ PtrToArg<R>::encode(PtrToArg<A>::convert(left) % PtrToArg<B>::convert(right), r_ret);
+ }
+#endif
+ static Variant::Type get_return_type() { return GetTypeInfo<R>::VARIANT_TYPE; }
+};
+
+template <class R, class A, class B>
+class OperatorEvaluatorModNZ {
+public:
+ static void evaluate(const Variant &p_left, const Variant &p_right, Variant *r_ret, bool &r_valid) {
+ const A &a = *VariantGetInternalPtr<A>::get_ptr(&p_left);
+ const B &b = *VariantGetInternalPtr<B>::get_ptr(&p_right);
+ if (b == 0) {
+ r_valid = false;
+ *r_ret = "Module by zero error";
+ return;
+ }
+ *r_ret = a % b;
+ r_valid = true;
+ }
+ static void validated_evaluate(const Variant *left, const Variant *right, Variant *r_ret) {
+ VariantTypeChanger<R>::change(r_ret);
+ *VariantGetInternalPtr<R>::get_ptr(r_ret) = *VariantGetInternalPtr<A>::get_ptr(left) % *VariantGetInternalPtr<B>::get_ptr(right);
+ }
+#ifdef PTRCALL_ENABLED
+ static void ptr_evaluate(const void *left, const void *right, void *r_ret) {
+ PtrToArg<R>::encode(PtrToArg<A>::convert(left) % PtrToArg<B>::convert(right), r_ret);
+ }
+#endif
+ static Variant::Type get_return_type() { return GetTypeInfo<R>::VARIANT_TYPE; }
+};
+
+template <class R, class A>
+class OperatorEvaluatorNeg {
+public:
+ static void evaluate(const Variant &p_left, const Variant &p_right, Variant *r_ret, bool &r_valid) {
+ const A &a = *VariantGetInternalPtr<A>::get_ptr(&p_left);
+ *r_ret = -a;
+ r_valid = true;
+ }
+ static void validated_evaluate(const Variant *left, const Variant *right, Variant *r_ret) {
+ VariantTypeChanger<R>::change(r_ret);
+ *VariantGetInternalPtr<R>::get_ptr(r_ret) = -*VariantGetInternalPtr<A>::get_ptr(left);
+ }
+#ifdef PTRCALL_ENABLED
+ static void ptr_evaluate(const void *left, const void *right, void *r_ret) {
+ PtrToArg<R>::encode(-PtrToArg<A>::convert(left), r_ret);
+ }
+#endif
+ static Variant::Type get_return_type() { return GetTypeInfo<R>::VARIANT_TYPE; }
+};
+
+template <class R, class A>
+class OperatorEvaluatorPos {
+public:
+ static void evaluate(const Variant &p_left, const Variant &p_right, Variant *r_ret, bool &r_valid) {
+ const A &a = *VariantGetInternalPtr<A>::get_ptr(&p_left);
+ *r_ret = a;
+ r_valid = true;
+ }
+ static void validated_evaluate(const Variant *left, const Variant *right, Variant *r_ret) {
+ VariantTypeChanger<R>::change(r_ret);
+ *VariantGetInternalPtr<R>::get_ptr(r_ret) = *VariantGetInternalPtr<A>::get_ptr(left);
+ }
+#ifdef PTRCALL_ENABLED
+ static void ptr_evaluate(const void *left, const void *right, void *r_ret) {
+ PtrToArg<R>::encode(PtrToArg<A>::convert(left), r_ret);
+ }
+#endif
+ static Variant::Type get_return_type() { return GetTypeInfo<R>::VARIANT_TYPE; }
+};
+
+template <class R, class A, class B>
+class OperatorEvaluatorShiftLeft {
+public:
+ static void evaluate(const Variant &p_left, const Variant &p_right, Variant *r_ret, bool &r_valid) {
+ const A &a = *VariantGetInternalPtr<A>::get_ptr(&p_left);
+ const B &b = *VariantGetInternalPtr<B>::get_ptr(&p_right);
+ *r_ret = a << b;
+ r_valid = true;
+ }
+ static void validated_evaluate(const Variant *left, const Variant *right, Variant *r_ret) {
+ VariantTypeChanger<R>::change(r_ret);
+ *VariantGetInternalPtr<R>::get_ptr(r_ret) = *VariantGetInternalPtr<A>::get_ptr(left) << *VariantGetInternalPtr<B>::get_ptr(right);
+ }
+#ifdef PTRCALL_ENABLED
+ static void ptr_evaluate(const void *left, const void *right, void *r_ret) {
+ PtrToArg<R>::encode(PtrToArg<A>::convert(left) << PtrToArg<B>::convert(right), r_ret);
+ }
+#endif
+ static Variant::Type get_return_type() { return GetTypeInfo<R>::VARIANT_TYPE; }
+};
+
+template <class R, class A, class B>
+class OperatorEvaluatorShiftRight {
+public:
+ static void evaluate(const Variant &p_left, const Variant &p_right, Variant *r_ret, bool &r_valid) {
+ const A &a = *VariantGetInternalPtr<A>::get_ptr(&p_left);
+ const B &b = *VariantGetInternalPtr<B>::get_ptr(&p_right);
+ *r_ret = a >> b;
+ r_valid = true;
+ }
+ static void validated_evaluate(const Variant *left, const Variant *right, Variant *r_ret) {
+ VariantTypeChanger<R>::change(r_ret);
+ *VariantGetInternalPtr<R>::get_ptr(r_ret) = *VariantGetInternalPtr<A>::get_ptr(left) >> *VariantGetInternalPtr<B>::get_ptr(right);
+ }
+#ifdef PTRCALL_ENABLED
+ static void ptr_evaluate(const void *left, const void *right, void *r_ret) {
+ PtrToArg<R>::encode(PtrToArg<A>::convert(left) >> PtrToArg<B>::convert(right), r_ret);
+ }
+#endif
+ static Variant::Type get_return_type() { return GetTypeInfo<R>::VARIANT_TYPE; }
+};
+
+template <class R, class A, class B>
+class OperatorEvaluatorBitOr {
+public:
+ static void evaluate(const Variant &p_left, const Variant &p_right, Variant *r_ret, bool &r_valid) {
+ const A &a = *VariantGetInternalPtr<A>::get_ptr(&p_left);
+ const B &b = *VariantGetInternalPtr<B>::get_ptr(&p_right);
+ *r_ret = a | b;
+ r_valid = true;
+ }
+ static void validated_evaluate(const Variant *left, const Variant *right, Variant *r_ret) {
+ VariantTypeChanger<R>::change(r_ret);
+ *VariantGetInternalPtr<R>::get_ptr(r_ret) = *VariantGetInternalPtr<A>::get_ptr(left) | *VariantGetInternalPtr<B>::get_ptr(right);
+ }
+#ifdef PTRCALL_ENABLED
+ static void ptr_evaluate(const void *left, const void *right, void *r_ret) {
+ PtrToArg<R>::encode(PtrToArg<A>::convert(left) | PtrToArg<B>::convert(right), r_ret);
+ }
+#endif
+ static Variant::Type get_return_type() { return GetTypeInfo<R>::VARIANT_TYPE; }
+};
+
+template <class R, class A, class B>
+class OperatorEvaluatorBitAnd {
+public:
+ static void evaluate(const Variant &p_left, const Variant &p_right, Variant *r_ret, bool &r_valid) {
+ const A &a = *VariantGetInternalPtr<A>::get_ptr(&p_left);
+ const B &b = *VariantGetInternalPtr<B>::get_ptr(&p_right);
+ *r_ret = a & b;
+ r_valid = true;
+ }
+ static void validated_evaluate(const Variant *left, const Variant *right, Variant *r_ret) {
+ *VariantGetInternalPtr<R>::get_ptr(r_ret) = *VariantGetInternalPtr<A>::get_ptr(left) & *VariantGetInternalPtr<B>::get_ptr(right);
+ }
+#ifdef PTRCALL_ENABLED
+ static void ptr_evaluate(const void *left, const void *right, void *r_ret) {
+ PtrToArg<R>::encode(PtrToArg<A>::convert(left) & PtrToArg<B>::convert(right), r_ret);
+ }
+#endif
+ static Variant::Type get_return_type() { return GetTypeInfo<R>::VARIANT_TYPE; }
+};
+
+template <class R, class A, class B>
+class OperatorEvaluatorBitXor {
+public:
+ static void evaluate(const Variant &p_left, const Variant &p_right, Variant *r_ret, bool &r_valid) {
+ const A &a = *VariantGetInternalPtr<A>::get_ptr(&p_left);
+ const B &b = *VariantGetInternalPtr<B>::get_ptr(&p_right);
+ *r_ret = a ^ b;
+ r_valid = true;
+ }
+ static void validated_evaluate(const Variant *left, const Variant *right, Variant *r_ret) {
+ VariantTypeChanger<R>::change(r_ret);
+ *VariantGetInternalPtr<R>::get_ptr(r_ret) = *VariantGetInternalPtr<A>::get_ptr(left) ^ *VariantGetInternalPtr<B>::get_ptr(right);
+ }
+#ifdef PTRCALL_ENABLED
+ static void ptr_evaluate(const void *left, const void *right, void *r_ret) {
+ PtrToArg<R>::encode(PtrToArg<A>::convert(left) ^ PtrToArg<B>::convert(right), r_ret);
+ }
+#endif
+ static Variant::Type get_return_type() { return GetTypeInfo<R>::VARIANT_TYPE; }
+};
+
+template <class R, class A>
+class OperatorEvaluatorBitNeg {
+public:
+ static void evaluate(const Variant &p_left, const Variant &p_right, Variant *r_ret, bool &r_valid) {
+ const A &a = *VariantGetInternalPtr<A>::get_ptr(&p_left);
+ *r_ret = ~a;
+ r_valid = true;
+ }
+ static void validated_evaluate(const Variant *left, const Variant *right, Variant *r_ret) {
+ VariantTypeChanger<R>::change(r_ret);
+ *VariantGetInternalPtr<R>::get_ptr(r_ret) = ~*VariantGetInternalPtr<A>::get_ptr(left);
+ }
+#ifdef PTRCALL_ENABLED
+ static void ptr_evaluate(const void *left, const void *right, void *r_ret) {
+ PtrToArg<R>::encode(~PtrToArg<A>::convert(left), r_ret);
+ }
+#endif
+ static Variant::Type get_return_type() { return GetTypeInfo<R>::VARIANT_TYPE; }
+};
+
+template <class A, class B>
+class OperatorEvaluatorEqual {
+public:
+ static void evaluate(const Variant &p_left, const Variant &p_right, Variant *r_ret, bool &r_valid) {
+ const A &a = *VariantGetInternalPtr<A>::get_ptr(&p_left);
+ const B &b = *VariantGetInternalPtr<B>::get_ptr(&p_right);
+ *r_ret = a == b;
+ r_valid = true;
+ }
+ static void validated_evaluate(const Variant *left, const Variant *right, Variant *r_ret) {
+ VariantTypeChanger<bool>::change(r_ret);
+ *VariantGetInternalPtr<bool>::get_ptr(r_ret) = *VariantGetInternalPtr<A>::get_ptr(left) == *VariantGetInternalPtr<B>::get_ptr(right);
+ }
+#ifdef PTRCALL_ENABLED
+ static void ptr_evaluate(const void *left, const void *right, void *r_ret) {
+ PtrToArg<bool>::encode(PtrToArg<A>::convert(left) == PtrToArg<B>::convert(right), r_ret);
+ }
+#endif
+ static Variant::Type get_return_type() { return Variant::BOOL; }
+};
+//equalobject
+class OperatorEvaluatorEqualObject {
+public:
+ static void evaluate(const Variant &p_left, const Variant &p_right, Variant *r_ret, bool &r_valid) {
+ const Object *a = p_left.get_validated_object();
+ const Object *b = p_right.get_validated_object();
+ *r_ret = a == b;
+ r_valid = true;
+ }
+ static void validated_evaluate(const Variant *left, const Variant *right, Variant *r_ret) {
+ const Object *a = left->get_validated_object();
+ const Object *b = right->get_validated_object();
+ VariantTypeChanger<bool>::change(r_ret);
+ *VariantGetInternalPtr<bool>::get_ptr(r_ret) = a == b;
+ }
+#ifdef PTRCALL_ENABLED
+ static void ptr_evaluate(const void *left, const void *right, void *r_ret) {
+ PtrToArg<bool>::encode(PtrToArg<Object *>::convert(left) == PtrToArg<Object *>::convert(right), r_ret);
+ }
+#endif
+ static Variant::Type get_return_type() { return Variant::BOOL; }
+};
+
+class OperatorEvaluatorEqualObjectNil {
+public:
+ static void evaluate(const Variant &p_left, const Variant &p_right, Variant *r_ret, bool &r_valid) {
+ const Object *a = p_left.get_validated_object();
+ *r_ret = a == nullptr;
+ r_valid = true;
+ }
+ static void validated_evaluate(const Variant *left, const Variant *right, Variant *r_ret) {
+ const Object *a = left->get_validated_object();
+ VariantTypeChanger<bool>::change(r_ret);
+ *VariantGetInternalPtr<bool>::get_ptr(r_ret) = a == nullptr;
+ }
+#ifdef PTRCALL_ENABLED
+ static void ptr_evaluate(const void *left, const void *right, void *r_ret) {
+ PtrToArg<bool>::encode(PtrToArg<Object *>::convert(left) == nullptr, r_ret);
+ }
+#endif
+ static Variant::Type get_return_type() { return Variant::BOOL; }
+};
+
+class OperatorEvaluatorEqualNilObject {
+public:
+ static void evaluate(const Variant &p_left, const Variant &p_right, Variant *r_ret, bool &r_valid) {
+ const Object *b = p_right.get_validated_object();
+ *r_ret = nullptr == b;
+ r_valid = true;
+ }
+ static void validated_evaluate(const Variant *left, const Variant *right, Variant *r_ret) {
+ const Object *b = right->get_validated_object();
+ VariantTypeChanger<bool>::change(r_ret);
+ *VariantGetInternalPtr<bool>::get_ptr(r_ret) = nullptr == b;
+ }
+#ifdef PTRCALL_ENABLED
+ static void ptr_evaluate(const void *left, const void *right, void *r_ret) {
+ PtrToArg<bool>::encode(nullptr == PtrToArg<Object *>::convert(right), r_ret);
+ }
+#endif
+ static Variant::Type get_return_type() { return Variant::BOOL; }
+};
+
+template <class A, class B>
+class OperatorEvaluatorNotEqual {
+public:
+ static void evaluate(const Variant &p_left, const Variant &p_right, Variant *r_ret, bool &r_valid) {
+ const A &a = *VariantGetInternalPtr<A>::get_ptr(&p_left);
+ const B &b = *VariantGetInternalPtr<B>::get_ptr(&p_right);
+ *r_ret = a != b;
+ r_valid = true;
+ }
+ static void validated_evaluate(const Variant *left, const Variant *right, Variant *r_ret) {
+ VariantTypeChanger<bool>::change(r_ret);
+ *VariantGetInternalPtr<bool>::get_ptr(r_ret) = *VariantGetInternalPtr<A>::get_ptr(left) != *VariantGetInternalPtr<B>::get_ptr(right);
+ }
+#ifdef PTRCALL_ENABLED
+ static void ptr_evaluate(const void *left, const void *right, void *r_ret) {
+ PtrToArg<bool>::encode(PtrToArg<A>::convert(left) != PtrToArg<B>::convert(right), r_ret);
+ }
+#endif
+ static Variant::Type get_return_type() { return Variant::BOOL; }
+};
+
+class OperatorEvaluatorNotEqualObject {
+public:
+ static void evaluate(const Variant &p_left, const Variant &p_right, Variant *r_ret, bool &r_valid) {
+ Object *a = p_left.get_validated_object();
+ Object *b = p_right.get_validated_object();
+ *r_ret = a != b;
+ r_valid = true;
+ }
+ static void validated_evaluate(const Variant *left, const Variant *right, Variant *r_ret) {
+ Object *a = left->get_validated_object();
+ Object *b = right->get_validated_object();
+ VariantTypeChanger<bool>::change(r_ret);
+ *VariantGetInternalPtr<bool>::get_ptr(r_ret) = a != b;
+ }
+#ifdef PTRCALL_ENABLED
+ static void ptr_evaluate(const void *left, const void *right, void *r_ret) {
+ PtrToArg<bool>::encode(PtrToArg<Object *>::convert(left) != PtrToArg<Object *>::convert(right), r_ret);
+ }
+#endif
+ static Variant::Type get_return_type() { return Variant::BOOL; }
+};
+
+class OperatorEvaluatorNotEqualObjectNil {
+public:
+ static void evaluate(const Variant &p_left, const Variant &p_right, Variant *r_ret, bool &r_valid) {
+ Object *a = p_left.get_validated_object();
+ *r_ret = a != nullptr;
+ r_valid = true;
+ }
+ static void validated_evaluate(const Variant *left, const Variant *right, Variant *r_ret) {
+ Object *a = left->get_validated_object();
+ VariantTypeChanger<bool>::change(r_ret);
+ *VariantGetInternalPtr<bool>::get_ptr(r_ret) = a != nullptr;
+ }
+#ifdef PTRCALL_ENABLED
+ static void ptr_evaluate(const void *left, const void *right, void *r_ret) {
+ PtrToArg<bool>::encode(PtrToArg<Object *>::convert(left) != nullptr, r_ret);
+ }
+#endif
+ static Variant::Type get_return_type() { return Variant::BOOL; }
+};
+
+class OperatorEvaluatorNotEqualNilObject {
+public:
+ static void evaluate(const Variant &p_left, const Variant &p_right, Variant *r_ret, bool &r_valid) {
+ Object *b = p_right.get_validated_object();
+ *r_ret = nullptr != b;
+ r_valid = true;
+ }
+ static void validated_evaluate(const Variant *left, const Variant *right, Variant *r_ret) {
+ Object *b = right->get_validated_object();
+ VariantTypeChanger<bool>::change(r_ret);
+ *VariantGetInternalPtr<bool>::get_ptr(r_ret) = nullptr != b;
+ }
+#ifdef PTRCALL_ENABLED
+ static void ptr_evaluate(const void *left, const void *right, void *r_ret) {
+ PtrToArg<bool>::encode(nullptr != PtrToArg<Object *>::convert(right), r_ret);
+ }
+#endif
+ static Variant::Type get_return_type() { return Variant::BOOL; }
+};
+
+template <class A, class B>
+class OperatorEvaluatorLess {
+public:
+ static void evaluate(const Variant &p_left, const Variant &p_right, Variant *r_ret, bool &r_valid) {
+ const A &a = *VariantGetInternalPtr<A>::get_ptr(&p_left);
+ const B &b = *VariantGetInternalPtr<B>::get_ptr(&p_right);
+ *r_ret = a < b;
+ r_valid = true;
+ }
+ static void validated_evaluate(const Variant *left, const Variant *right, Variant *r_ret) {
+ VariantTypeChanger<bool>::change(r_ret);
+ *VariantGetInternalPtr<bool>::get_ptr(r_ret) = *VariantGetInternalPtr<A>::get_ptr(left) < *VariantGetInternalPtr<B>::get_ptr(right);
+ }
+#ifdef PTRCALL_ENABLED
+ static void ptr_evaluate(const void *left, const void *right, void *r_ret) {
+ PtrToArg<bool>::encode(PtrToArg<A>::convert(left) < PtrToArg<B>::convert(right), r_ret);
+ }
+#endif
+ static Variant::Type get_return_type() { return Variant::BOOL; }
+};
+
+template <class A, class B>
+class OperatorEvaluatorLessEqual {
+public:
+ static void evaluate(const Variant &p_left, const Variant &p_right, Variant *r_ret, bool &r_valid) {
+ const A &a = *VariantGetInternalPtr<A>::get_ptr(&p_left);
+ const B &b = *VariantGetInternalPtr<B>::get_ptr(&p_right);
+ *r_ret = a <= b;
+ r_valid = true;
+ }
+ static void validated_evaluate(const Variant *left, const Variant *right, Variant *r_ret) {
+ VariantTypeChanger<bool>::change(r_ret);
+ *VariantGetInternalPtr<bool>::get_ptr(r_ret) = *VariantGetInternalPtr<A>::get_ptr(left) <= *VariantGetInternalPtr<B>::get_ptr(right);
+ }
+#ifdef PTRCALL_ENABLED
+ static void ptr_evaluate(const void *left, const void *right, void *r_ret) {
+ PtrToArg<bool>::encode(PtrToArg<A>::convert(left) <= PtrToArg<B>::convert(right), r_ret);
+ }
+#endif
+ static Variant::Type get_return_type() { return Variant::BOOL; }
+};
+
+template <class A, class B>
+class OperatorEvaluatorGreater {
+public:
+ static void evaluate(const Variant &p_left, const Variant &p_right, Variant *r_ret, bool &r_valid) {
+ const A &a = *VariantGetInternalPtr<A>::get_ptr(&p_left);
+ const B &b = *VariantGetInternalPtr<B>::get_ptr(&p_right);
+ *r_ret = a > b;
+ r_valid = true;
+ }
+ static void validated_evaluate(const Variant *left, const Variant *right, Variant *r_ret) {
+ VariantTypeChanger<bool>::change(r_ret);
+ *VariantGetInternalPtr<bool>::get_ptr(r_ret) = *VariantGetInternalPtr<A>::get_ptr(left) > *VariantGetInternalPtr<B>::get_ptr(right);
+ }
+#ifdef PTRCALL_ENABLED
+ static void ptr_evaluate(const void *left, const void *right, void *r_ret) {
+ PtrToArg<bool>::encode(PtrToArg<A>::convert(left) > PtrToArg<B>::convert(right), r_ret);
+ }
+#endif
+ static Variant::Type get_return_type() { return Variant::BOOL; }
+};
+
+template <class A, class B>
+class OperatorEvaluatorGreaterEqual {
+public:
+ static void evaluate(const Variant &p_left, const Variant &p_right, Variant *r_ret, bool &r_valid) {
+ const A &a = *VariantGetInternalPtr<A>::get_ptr(&p_left);
+ const B &b = *VariantGetInternalPtr<B>::get_ptr(&p_right);
+ *r_ret = a >= b;
+ r_valid = true;
+ }
+ static void validated_evaluate(const Variant *left, const Variant *right, Variant *r_ret) {
+ VariantTypeChanger<bool>::change(r_ret);
+ *VariantGetInternalPtr<bool>::get_ptr(r_ret) = *VariantGetInternalPtr<A>::get_ptr(left) >= *VariantGetInternalPtr<B>::get_ptr(right);
+ }
+#ifdef PTRCALL_ENABLED
+ static void ptr_evaluate(const void *left, const void *right, void *r_ret) {
+ PtrToArg<bool>::encode(PtrToArg<A>::convert(left) >= PtrToArg<B>::convert(right), r_ret);
+ }
+#endif
+ static Variant::Type get_return_type() { return Variant::BOOL; }
+};
+
+template <class A, class B>
+class OperatorEvaluatorAnd {
+public:
+ static void evaluate(const Variant &p_left, const Variant &p_right, Variant *r_ret, bool &r_valid) {
+ const A &a = *VariantGetInternalPtr<A>::get_ptr(&p_left);
+ const B &b = *VariantGetInternalPtr<B>::get_ptr(&p_right);
+ *r_ret = a && b;
+ r_valid = true;
+ }
+ static void validated_evaluate(const Variant *left, const Variant *right, Variant *r_ret) {
+ VariantTypeChanger<bool>::change(r_ret);
+ *VariantGetInternalPtr<bool>::get_ptr(r_ret) = *VariantGetInternalPtr<A>::get_ptr(left) && *VariantGetInternalPtr<B>::get_ptr(right);
+ }
+#ifdef PTRCALL_ENABLED
+ static void ptr_evaluate(const void *left, const void *right, void *r_ret) {
+ PtrToArg<bool>::encode(PtrToArg<A>::convert(left) && PtrToArg<B>::convert(right), r_ret);
+ }
+#endif
+
+ static Variant::Type get_return_type() { return Variant::BOOL; }
+};
+
+template <class A, class B>
+class OperatorEvaluatorOr {
+public:
+ static void evaluate(const Variant &p_left, const Variant &p_right, Variant *r_ret, bool &r_valid) {
+ const A &a = *VariantGetInternalPtr<A>::get_ptr(&p_left);
+ const B &b = *VariantGetInternalPtr<B>::get_ptr(&p_right);
+ *r_ret = a || b;
+ r_valid = true;
+ }
+ static void validated_evaluate(const Variant *left, const Variant *right, Variant *r_ret) {
+ VariantTypeChanger<bool>::change(r_ret);
+ *VariantGetInternalPtr<bool>::get_ptr(r_ret) = *VariantGetInternalPtr<A>::get_ptr(left) || *VariantGetInternalPtr<B>::get_ptr(right);
+ }
+#ifdef PTRCALL_ENABLED
+ static void ptr_evaluate(const void *left, const void *right, void *r_ret) {
+ PtrToArg<bool>::encode(PtrToArg<A>::convert(left) || PtrToArg<B>::convert(right), r_ret);
+ }
+#endif
+ static Variant::Type get_return_type() { return Variant::BOOL; }
+};
+
+#define XOR_OP(m_a, m_b) (((m_a) || (m_b)) && !((m_a) && (m_b)))
+template <class A, class B>
+class OperatorEvaluatorXor {
+public:
+ _FORCE_INLINE_ static bool xor_op(const A &a, const B &b) {
+ return ((a) || (b)) && !((a) && (b));
+ }
+
+ static void evaluate(const Variant &p_left, const Variant &p_right, Variant *r_ret, bool &r_valid) {
+ const A &a = *VariantGetInternalPtr<A>::get_ptr(&p_left);
+ const B &b = *VariantGetInternalPtr<B>::get_ptr(&p_right);
+ *r_ret = xor_op(a, b);
+ r_valid = true;
+ }
+ static void validated_evaluate(const Variant *left, const Variant *right, Variant *r_ret) {
+ VariantTypeChanger<bool>::change(r_ret);
+ *VariantGetInternalPtr<bool>::get_ptr(r_ret) = xor_op(*VariantGetInternalPtr<A>::get_ptr(left), *VariantGetInternalPtr<B>::get_ptr(right));
+ }
+#ifdef PTRCALL_ENABLED
+ static void ptr_evaluate(const void *left, const void *right, void *r_ret) {
+ PtrToArg<bool>::encode(xor_op(PtrToArg<A>::convert(left), PtrToArg<B>::convert(right)), r_ret);
+ }
+#endif
+
+ static Variant::Type get_return_type() { return Variant::BOOL; }
+};
+
+template <class A>
+class OperatorEvaluatorNot {
+public:
+ static void evaluate(const Variant &p_left, const Variant &p_right, Variant *r_ret, bool &r_valid) {
+ const A &a = *VariantGetInternalPtr<A>::get_ptr(&p_left);
+ *r_ret = !a;
+ r_valid = true;
+ }
+ static void validated_evaluate(const Variant *left, const Variant *right, Variant *r_ret) {
+ VariantTypeChanger<bool>::change(r_ret);
+ *VariantGetInternalPtr<bool>::get_ptr(r_ret) = !*VariantGetInternalPtr<A>::get_ptr(left);
+ }
+#ifdef PTRCALL_ENABLED
+ static void ptr_evaluate(const void *left, const void *right, void *r_ret) {
+ PtrToArg<bool>::encode(!PtrToArg<A>::convert(left));
+ }
+#endif
+ static Variant::Type get_return_type() { return Variant::BOOL; }
+};
+
+//// CUSTOM ////
+
+class OperatorEvaluatorAddArray {
+public:
+ _FORCE_INLINE_ static void _add_arrays(Array &sum, const Array &array_a, const Array &array_b) {
+ int asize = array_a.size();
+ int bsize = array_b.size();
+ sum.resize(asize + bsize);
+ for (int i = 0; i < asize; i++) {
+ sum[i] = array_a[i];
+ }
+ for (int i = 0; i < bsize; i++) {
+ sum[i + asize] = array_b[i];
+ }
+ }
+ static void evaluate(const Variant &p_left, const Variant &p_right, Variant *r_ret, bool &r_valid) {
+ const Array &array_a = *VariantGetInternalPtr<Array>::get_ptr(&p_left);
+ const Array &array_b = *VariantGetInternalPtr<Array>::get_ptr(&p_right);
+ Array sum;
+ _add_arrays(sum, array_a, array_b);
+ *r_ret = sum;
+ r_valid = true;
+ }
+ static void validated_evaluate(const Variant *left, const Variant *right, Variant *r_ret) {
+ VariantTypeChanger<Array>::change(r_ret);
+ _add_arrays(*VariantGetInternalPtr<Array>::get_ptr(r_ret), *VariantGetInternalPtr<Array>::get_ptr(left), *VariantGetInternalPtr<Array>::get_ptr(right));
+ }
+#ifdef PTRCALL_ENABLED
+ static void ptr_evaluate(const void *left, const void *right, void *r_ret) {
+ Array ret;
+ _add_arrays(ret, PtrToArg<Array>::convert(left), PtrToArg<Array>::convert(right));
+ PtrToArg<Array>::encode(ret, r_ret);
+ }
+#endif
+
+ static Variant::Type get_return_type() { return Variant::ARRAY; }
+};
+
+template <class T>
+class OperatorEvaluatorAppendArray {
+public:
+ static void evaluate(const Variant &p_left, const Variant &p_right, Variant *r_ret, bool &r_valid) {
+ const Vector<T> &array_a = *VariantGetInternalPtr<Vector<T>>::get_ptr(&p_left);
+ const Vector<T> &array_b = *VariantGetInternalPtr<Vector<T>>::get_ptr(&p_right);
+ Vector<T> sum = array_a;
+ sum.append_array(array_b);
+ *r_ret = sum;
+ r_valid = true;
+ }
+ static void validated_evaluate(const Variant *left, const Variant *right, Variant *r_ret) {
+ VariantTypeChanger<Vector<T>>::change(r_ret);
+ *VariantGetInternalPtr<Vector<T>>::get_ptr(r_ret) = *VariantGetInternalPtr<Vector<T>>::get_ptr(left);
+ VariantGetInternalPtr<Vector<T>>::get_ptr(r_ret)->append_array(*VariantGetInternalPtr<Vector<T>>::get_ptr(right));
+ }
+#ifdef PTRCALL_ENABLED
+ static void ptr_evaluate(const void *left, const void *right, void *r_ret) {
+ Vector<T> sum = PtrToArg<Vector<T>>::convert(left);
+ sum.append_array(PtrToArg<Vector<T>>::convert(right));
+ PtrToArg<Vector<T>>::encode(sum, r_ret);
+ }
+#endif
+
+ static Variant::Type get_return_type() { return GetTypeInfo<Vector<T>>::VARIANT_TYPE; }
+};
+
+class OperatorEvaluatorStringModNil {
+public:
+ _FORCE_INLINE_ static String do_mod(const String &s, bool *r_valid) {
+ Array values;
+ values.push_back(Variant());
+
+ String a = s.sprintf(values, r_valid);
+ if (r_valid) {
+ *r_valid = !*r_valid;
+ }
+ return a;
+ }
+ static void evaluate(const Variant &p_left, const Variant &p_right, Variant *r_ret, bool &r_valid) {
+ const String &a = *VariantGetInternalPtr<String>::get_ptr(&p_left);
+ *r_ret = do_mod(a, &r_valid);
+ r_valid = true;
+ }
+
+ static void validated_evaluate(const Variant *left, const Variant *right, Variant *r_ret) {
+ VariantTypeChanger<String>::change(r_ret);
+ *VariantGetInternalPtr<String>::get_ptr(r_ret) = do_mod(*VariantGetInternalPtr<String>::get_ptr(left), nullptr);
+ }
+#ifdef PTRCALL_ENABLED
+ static void ptr_evaluate(const void *left, const void *right, void *r_ret) {
+ PtrToArg<String>::encode(do_mod(PtrToArg<String>::convert(left), nullptr), r_ret);
+ }
+#endif
+ static Variant::Type get_return_type() { return Variant::STRING; }
+};
+
+class OperatorEvaluatorStringModArray {
+public:
+ _FORCE_INLINE_ static String do_mod(const String &s, const Array &p_values, bool *r_valid) {
+ String a = s.sprintf(p_values, r_valid);
+ if (r_valid) {
+ *r_valid = !*r_valid;
+ }
+ return a;
+ }
+ static void evaluate(const Variant &p_left, const Variant &p_right, Variant *r_ret, bool &r_valid) {
+ const String &a = *VariantGetInternalPtr<String>::get_ptr(&p_left);
+ *r_ret = do_mod(a, *VariantGetInternalPtr<Array>::get_ptr(&p_right), &r_valid);
+ r_valid = true;
+ }
+
+ static void validated_evaluate(const Variant *left, const Variant *right, Variant *r_ret) {
+ VariantTypeChanger<String>::change(r_ret);
+ *VariantGetInternalPtr<String>::get_ptr(r_ret) = do_mod(*VariantGetInternalPtr<String>::get_ptr(left), *VariantGetInternalPtr<Array>::get_ptr(right), nullptr);
+ }
+#ifdef PTRCALL_ENABLED
+ static void ptr_evaluate(const void *left, const void *right, void *r_ret) {
+ PtrToArg<String>::encode(do_mod(PtrToArg<String>::convert(left), PtrToArg<Array>::convert(right), nullptr), r_ret);
+ }
+#endif
+ static Variant::Type get_return_type() { return Variant::STRING; }
+};
+
+class OperatorEvaluatorStringModObject {
+public:
+ _FORCE_INLINE_ static String do_mod(const String &s, const Object *p_object, bool *r_valid) {
+ Array values;
+ values.push_back(p_object);
+ String a = s.sprintf(values, r_valid);
+ if (r_valid) {
+ *r_valid = !*r_valid;
+ }
+
+ return a;
+ }
+ static void evaluate(const Variant &p_left, const Variant &p_right, Variant *r_ret, bool &r_valid) {
+ const String &a = *VariantGetInternalPtr<String>::get_ptr(&p_left);
+ *r_ret = do_mod(a, p_right.get_validated_object(), &r_valid);
+ r_valid = true;
+ }
+
+ static void validated_evaluate(const Variant *left, const Variant *right, Variant *r_ret) {
+ VariantTypeChanger<String>::change(r_ret);
+ *VariantGetInternalPtr<String>::get_ptr(r_ret) = do_mod(*VariantGetInternalPtr<String>::get_ptr(left), right->get_validated_object(), nullptr);
+ }
+#ifdef PTRCALL_ENABLED
+ static void ptr_evaluate(const void *left, const void *right, void *r_ret) {
+ PtrToArg<String>::encode(do_mod(PtrToArg<String>::convert(left), PtrToArg<Object *>::convert(right), nullptr), r_ret);
+ }
+#endif
+ static Variant::Type get_return_type() { return Variant::STRING; }
+};
+
+template <class T>
+class OperatorEvaluatorStringModT {
+public:
+ _FORCE_INLINE_ static String do_mod(const String &s, const T &p_value, bool *r_valid) {
+ Array values;
+ values.push_back(p_value);
+ String a = s.sprintf(values, r_valid);
+ if (r_valid) {
+ *r_valid = !*r_valid;
+ }
+ return a;
+ }
+ static void evaluate(const Variant &p_left, const Variant &p_right, Variant *r_ret, bool &r_valid) {
+ const String &a = *VariantGetInternalPtr<String>::get_ptr(&p_left);
+ *r_ret = do_mod(a, *VariantGetInternalPtr<T>::get_ptr(&p_right), &r_valid);
+ r_valid = true;
+ }
+
+ static void validated_evaluate(const Variant *left, const Variant *right, Variant *r_ret) {
+ VariantTypeChanger<String>::change(r_ret);
+ *VariantGetInternalPtr<String>::get_ptr(r_ret) = do_mod(*VariantGetInternalPtr<String>::get_ptr(left), *VariantGetInternalPtr<T>::get_ptr(right), nullptr);
+ }
+#ifdef PTRCALL_ENABLED
+ static void ptr_evaluate(const void *left, const void *right, void *r_ret) {
+ PtrToArg<String>::encode(do_mod(PtrToArg<String>::convert(left), PtrToArg<T>::convert(right), nullptr), r_ret);
+ }
+#endif
+ static Variant::Type get_return_type() { return Variant::STRING; }
+};
+
+template <Variant::Operator op, Variant::Type type_left, Variant::Type type_right>
+class OperatorEvaluatorAlwaysTrue {
+public:
+ static void evaluate(const Variant &p_left, const Variant &p_right, Variant *r_ret, bool &r_valid) {
+ *r_ret = true;
+ r_valid = true;
+ }
+
+ static void validated_evaluate(const Variant *left, const Variant *right, Variant *r_ret) {
+ VariantTypeChanger<bool>::change(r_ret);
+ *VariantGetInternalPtr<bool>::get_ptr(r_ret) = true;
+ }
+#ifdef PTRCALL_ENABLED
+ static void ptr_evaluate(const void *left, const void *right, void *r_ret) {
+ PtrToArg<bool>::encode(true, r_ret);
+ }
+#endif
+ static Variant::Type get_return_type() { return Variant::BOOL; }
+};
+
+template <Variant::Operator op, Variant::Type type_left, Variant::Type type_right>
+class OperatorEvaluatorAlwaysFalse {
+public:
+ static void evaluate(const Variant &p_left, const Variant &p_right, Variant *r_ret, bool &r_valid) {
+ *r_ret = false;
+ r_valid = true;
+ }
+
+ static void validated_evaluate(const Variant *left, const Variant *right, Variant *r_ret) {
+ VariantTypeChanger<bool>::change(r_ret);
+ *VariantGetInternalPtr<bool>::get_ptr(r_ret) = false;
+ }
+#ifdef PTRCALL_ENABLED
+ static void ptr_evaluate(const void *left, const void *right, void *r_ret) {
+ PtrToArg<bool>::encode(false, r_ret);
+ }
+#endif
+ static Variant::Type get_return_type() { return Variant::BOOL; }
+};
+
+///// OR ///////
+
+_FORCE_INLINE_ static bool _operate_or(bool p_left, bool p_right) {
+ return p_left || p_right;
+}
+_FORCE_INLINE_ static bool _operate_and(bool p_left, bool p_right) {
+ return p_left && p_right;
+}
+_FORCE_INLINE_ static bool _operate_xor(bool p_left, bool p_right) {
+ return (p_left || p_right) && !(p_left && p_right);
+}
+
+_FORCE_INLINE_ static bool _operate_get_nil(const Variant *p_ptr) {
+ return p_ptr->get_validated_object() != nullptr;
+}
+
+_FORCE_INLINE_ static bool _operate_get_bool(const Variant *p_ptr) {
+ return *VariantGetInternalPtr<bool>::get_ptr(p_ptr);
+}
+
+_FORCE_INLINE_ static bool _operate_get_int(const Variant *p_ptr) {
+ return *VariantGetInternalPtr<int64_t>::get_ptr(p_ptr) != 0;
+}
+
+_FORCE_INLINE_ static bool _operate_get_float(const Variant *p_ptr) {
+ return *VariantGetInternalPtr<double>::get_ptr(p_ptr) != 0.0;
+}
+
+_FORCE_INLINE_ static bool _operate_get_object(const Variant *p_ptr) {
+ return p_ptr->get_validated_object() != nullptr;
+}
+
+#ifndef PTRCALL_ENABLED
+
+#define OP_EVALUATOR(m_class_name, m_left, m_right, m_op) \
+ class m_class_name { \
+ public: \
+ static void evaluate(const Variant &p_left, const Variant &p_right, Variant *r_ret, bool &r_valid) { \
+ *r_ret = m_op(_operate_get_##m_left(&p_left), _operate_get_##m_right(&p_right)); \
+ r_valid = true; \
+ } \
+ \
+ static void validated_evaluate(const Variant *left, const Variant *right, Variant *r_ret) { \
+ VariantTypeChanger<bool>::change(r_ret); \
+ *VariantGetInternalPtr<bool>::get_ptr(r_ret) = m_op(_operate_get_##m_left(left), _operate_get_##m_right(right)); \
+ } \
+ \
+ static Variant::Type \
+ get_return_type() { \
+ return Variant::BOOL; \
+ } \
+ };
+
+#else
+
+_FORCE_INLINE_ static bool _operate_get_ptr_nil(const void *p_ptr) {
+ return false;
+}
+
+_FORCE_INLINE_ static bool _operate_get_ptr_bool(const void *p_ptr) {
+ return PtrToArg<bool>::convert(p_ptr);
+}
+
+_FORCE_INLINE_ static bool _operate_get_ptr_int(const void *p_ptr) {
+ return PtrToArg<int64_t>::convert(p_ptr) != 0;
+}
+
+_FORCE_INLINE_ static bool _operate_get_ptr_float(const void *p_ptr) {
+ return PtrToArg<double>::convert(p_ptr) != 0.0;
+}
+
+_FORCE_INLINE_ static bool _operate_get_ptr_object(const void *p_ptr) {
+ return PtrToArg<Object *>::convert(p_ptr) != nullptr;
+}
+
+#define OP_EVALUATOR(m_class_name, m_left, m_right, m_op) \
+ class m_class_name { \
+ public: \
+ static void evaluate(const Variant &p_left, const Variant &p_right, Variant *r_ret, bool &r_valid) { \
+ *r_ret = m_op(_operate_get_##m_left(&p_left), _operate_get_##m_right(&p_right)); \
+ r_valid = true; \
+ } \
+ \
+ static void validated_evaluate(const Variant *left, const Variant *right, Variant *r_ret) { \
+ VariantTypeChanger<bool>::change(r_ret); \
+ *VariantGetInternalPtr<bool>::get_ptr(r_ret) = m_op(_operate_get_##m_left(left), _operate_get_##m_right(right)); \
+ } \
+ \
+ static void ptr_evaluate(const void *left, const void *right, void *r_ret) { \
+ PtrToArg<bool>::encode(m_op(_operate_get_ptr_##m_left(left), _operate_get_ptr_##m_right(right)), r_ret); \
+ } \
+ \
+ static Variant::Type get_return_type() { \
+ return Variant::BOOL; \
+ } \
+ };
+
+#endif
+
+// OR
+
+//nil
+OP_EVALUATOR(OperatorEvaluatorNilXBoolOr, nil, bool, _operate_or)
+OP_EVALUATOR(OperatorEvaluatorBoolXNilOr, bool, nil, _operate_or)
+
+OP_EVALUATOR(OperatorEvaluatorNilXIntOr, nil, int, _operate_or)
+OP_EVALUATOR(OperatorEvaluatorIntXNilOr, int, nil, _operate_or)
+
+OP_EVALUATOR(OperatorEvaluatorNilXFloatOr, nil, float, _operate_or)
+OP_EVALUATOR(OperatorEvaluatorFloatXNilOr, float, nil, _operate_or)
+
+OP_EVALUATOR(OperatorEvaluatorObjectXNilOr, object, nil, _operate_or)
+OP_EVALUATOR(OperatorEvaluatorNilXObjectOr, nil, object, _operate_or)
+
+//bool
+OP_EVALUATOR(OperatorEvaluatorBoolXBoolOr, bool, bool, _operate_or)
+
+OP_EVALUATOR(OperatorEvaluatorBoolXIntOr, bool, int, _operate_or)
+OP_EVALUATOR(OperatorEvaluatorIntXBoolOr, int, bool, _operate_or)
+
+OP_EVALUATOR(OperatorEvaluatorBoolXFloatOr, bool, float, _operate_or)
+OP_EVALUATOR(OperatorEvaluatorFloatXBoolOr, float, bool, _operate_or)
+
+OP_EVALUATOR(OperatorEvaluatorBoolXObjectOr, bool, object, _operate_or)
+OP_EVALUATOR(OperatorEvaluatorObjectXBoolOr, object, bool, _operate_or)
+
+//int
+
+OP_EVALUATOR(OperatorEvaluatorIntXIntOr, int, int, _operate_or)
+
+OP_EVALUATOR(OperatorEvaluatorIntXFloatOr, int, float, _operate_or)
+OP_EVALUATOR(OperatorEvaluatorFloatXIntOr, float, int, _operate_or)
+
+OP_EVALUATOR(OperatorEvaluatorIntXObjectOr, int, object, _operate_or)
+OP_EVALUATOR(OperatorEvaluatorObjectXIntOr, object, int, _operate_or)
+
+//float
+
+OP_EVALUATOR(OperatorEvaluatorFloatXFloatOr, float, float, _operate_or)
+
+OP_EVALUATOR(OperatorEvaluatorFloatXObjectOr, float, object, _operate_or)
+OP_EVALUATOR(OperatorEvaluatorObjectXFloatOr, object, float, _operate_or)
+
+//object
+
+OP_EVALUATOR(OperatorEvaluatorObjectXObjectOr, object, object, _operate_or)
+
+// AND
+
+//nil
+OP_EVALUATOR(OperatorEvaluatorNilXBoolAnd, nil, bool, _operate_and)
+OP_EVALUATOR(OperatorEvaluatorBoolXNilAnd, bool, nil, _operate_and)
+
+OP_EVALUATOR(OperatorEvaluatorNilXIntAnd, nil, int, _operate_and)
+OP_EVALUATOR(OperatorEvaluatorIntXNilAnd, int, nil, _operate_and)
+
+OP_EVALUATOR(OperatorEvaluatorNilXFloatAnd, nil, float, _operate_and)
+OP_EVALUATOR(OperatorEvaluatorFloatXNilAnd, float, nil, _operate_and)
+
+OP_EVALUATOR(OperatorEvaluatorObjectXNilAnd, object, nil, _operate_and)
+OP_EVALUATOR(OperatorEvaluatorNilXObjectAnd, nil, object, _operate_and)
+
+//bool
+OP_EVALUATOR(OperatorEvaluatorBoolXBoolAnd, bool, bool, _operate_and)
+
+OP_EVALUATOR(OperatorEvaluatorBoolXIntAnd, bool, int, _operate_and)
+OP_EVALUATOR(OperatorEvaluatorIntXBoolAnd, int, bool, _operate_and)
+
+OP_EVALUATOR(OperatorEvaluatorBoolXFloatAnd, bool, float, _operate_and)
+OP_EVALUATOR(OperatorEvaluatorFloatXBoolAnd, float, bool, _operate_and)
+
+OP_EVALUATOR(OperatorEvaluatorBoolXObjectAnd, bool, object, _operate_and)
+OP_EVALUATOR(OperatorEvaluatorObjectXBoolAnd, object, bool, _operate_and)
+
+//int
+
+OP_EVALUATOR(OperatorEvaluatorIntXIntAnd, int, int, _operate_and)
+
+OP_EVALUATOR(OperatorEvaluatorIntXFloatAnd, int, float, _operate_and)
+OP_EVALUATOR(OperatorEvaluatorFloatXIntAnd, float, int, _operate_and)
+
+OP_EVALUATOR(OperatorEvaluatorIntXObjectAnd, int, object, _operate_and)
+OP_EVALUATOR(OperatorEvaluatorObjectXIntAnd, object, int, _operate_and)
+
+//float
+
+OP_EVALUATOR(OperatorEvaluatorFloatXFloatAnd, float, float, _operate_and)
+
+OP_EVALUATOR(OperatorEvaluatorFloatXObjectAnd, float, object, _operate_and)
+OP_EVALUATOR(OperatorEvaluatorObjectXFloatAnd, object, float, _operate_and)
+
+//object
+
+OP_EVALUATOR(OperatorEvaluatorObjectXObjectAnd, object, object, _operate_and)
+
+// XOR
+
+//nil
+OP_EVALUATOR(OperatorEvaluatorNilXBoolXor, nil, bool, _operate_xor)
+OP_EVALUATOR(OperatorEvaluatorBoolXNilXor, bool, nil, _operate_xor)
+
+OP_EVALUATOR(OperatorEvaluatorNilXIntXor, nil, int, _operate_xor)
+OP_EVALUATOR(OperatorEvaluatorIntXNilXor, int, nil, _operate_xor)
+
+OP_EVALUATOR(OperatorEvaluatorNilXFloatXor, nil, float, _operate_xor)
+OP_EVALUATOR(OperatorEvaluatorFloatXNilXor, float, nil, _operate_xor)
+
+OP_EVALUATOR(OperatorEvaluatorObjectXNilXor, object, nil, _operate_xor)
+OP_EVALUATOR(OperatorEvaluatorNilXObjectXor, nil, object, _operate_xor)
+
+//bool
+OP_EVALUATOR(OperatorEvaluatorBoolXBoolXor, bool, bool, _operate_xor)
+
+OP_EVALUATOR(OperatorEvaluatorBoolXIntXor, bool, int, _operate_xor)
+OP_EVALUATOR(OperatorEvaluatorIntXBoolXor, int, bool, _operate_xor)
+
+OP_EVALUATOR(OperatorEvaluatorBoolXFloatXor, bool, float, _operate_xor)
+OP_EVALUATOR(OperatorEvaluatorFloatXBoolXor, float, bool, _operate_xor)
+
+OP_EVALUATOR(OperatorEvaluatorBoolXObjectXor, bool, object, _operate_xor)
+OP_EVALUATOR(OperatorEvaluatorObjectXBoolXor, object, bool, _operate_xor)
+
+//int
+
+OP_EVALUATOR(OperatorEvaluatorIntXIntXor, int, int, _operate_xor)
+
+OP_EVALUATOR(OperatorEvaluatorIntXFloatXor, int, float, _operate_xor)
+OP_EVALUATOR(OperatorEvaluatorFloatXIntXor, float, int, _operate_xor)
+
+OP_EVALUATOR(OperatorEvaluatorIntXObjectXor, int, object, _operate_xor)
+OP_EVALUATOR(OperatorEvaluatorObjectXIntXor, object, int, _operate_xor)
+
+//float
+
+OP_EVALUATOR(OperatorEvaluatorFloatXFloatXor, float, float, _operate_xor)
+
+OP_EVALUATOR(OperatorEvaluatorFloatXObjectXor, float, object, _operate_xor)
+OP_EVALUATOR(OperatorEvaluatorObjectXFloatXor, object, float, _operate_xor)
+
+//object
+
+OP_EVALUATOR(OperatorEvaluatorObjectXObjectXor, object, object, _operate_xor)
+
+class OperatorEvaluatorNotBool {
+public:
+ static void evaluate(const Variant &p_left, const Variant &p_right, Variant *r_ret, bool &r_valid) {
+ *r_ret = !*VariantGetInternalPtr<bool>::get_ptr(&p_left);
+ r_valid = true;
+ }
+
+ static void validated_evaluate(const Variant *left, const Variant *right, Variant *r_ret) {
+ VariantTypeChanger<bool>::change(r_ret);
+ *VariantGetInternalPtr<bool>::get_ptr(r_ret) = !*VariantGetInternalPtr<bool>::get_ptr(left);
+ }
+#ifdef PTRCALL_ENABLED
+ static void ptr_evaluate(const void *left, const void *right, void *r_ret) {
+ PtrToArg<bool>::encode(!PtrToArg<bool>::convert(left), r_ret);
+ }
+#endif
+
+ static Variant::Type get_return_type() { return Variant::BOOL; }
+};
+
+class OperatorEvaluatorNotInt {
+public:
+ static void evaluate(const Variant &p_left, const Variant &p_right, Variant *r_ret, bool &r_valid) {
+ *r_ret = !*VariantGetInternalPtr<int64_t>::get_ptr(&p_left);
+ r_valid = true;
+ }
+
+ static void validated_evaluate(const Variant *left, const Variant *right, Variant *r_ret) {
+ VariantTypeChanger<bool>::change(r_ret);
+ *VariantGetInternalPtr<bool>::get_ptr(r_ret) = !*VariantGetInternalPtr<int64_t>::get_ptr(left);
+ }
+#ifdef PTRCALL_ENABLED
+ static void ptr_evaluate(const void *left, const void *right, void *r_ret) {
+ PtrToArg<bool>::encode(!PtrToArg<int64_t>::convert(left), r_ret);
+ }
+#endif
+
+ static Variant::Type get_return_type() { return Variant::BOOL; }
+};
+
+class OperatorEvaluatorNotFloat {
+public:
+ static void evaluate(const Variant &p_left, const Variant &p_right, Variant *r_ret, bool &r_valid) {
+ *r_ret = !*VariantGetInternalPtr<double>::get_ptr(&p_left);
+ r_valid = true;
+ }
+
+ static void validated_evaluate(const Variant *left, const Variant *right, Variant *r_ret) {
+ VariantTypeChanger<bool>::change(r_ret);
+ *VariantGetInternalPtr<bool>::get_ptr(r_ret) = !*VariantGetInternalPtr<double>::get_ptr(left);
+ }
+#ifdef PTRCALL_ENABLED
+ static void ptr_evaluate(const void *left, const void *right, void *r_ret) {
+ PtrToArg<bool>::encode(!PtrToArg<double>::convert(left), r_ret);
+ }
+#endif
+
+ static Variant::Type get_return_type() { return Variant::BOOL; }
+};
+
+class OperatorEvaluatorNotObject {
+public:
+ static void evaluate(const Variant &p_left, const Variant &p_right, Variant *r_ret, bool &r_valid) {
+ *r_ret = p_left.get_validated_object() == nullptr;
+ r_valid = true;
+ }
+
+ static void validated_evaluate(const Variant *left, const Variant *right, Variant *r_ret) {
+ VariantTypeChanger<bool>::change(r_ret);
+ *VariantGetInternalPtr<bool>::get_ptr(r_ret) = left->get_validated_object() == nullptr;
+ }
+#ifdef PTRCALL_ENABLED
+ static void ptr_evaluate(const void *left, const void *right, void *r_ret) {
+ PtrToArg<bool>::encode(PtrToArg<Object *>::convert(left) == nullptr, r_ret);
+ }
+#endif
+
+ static Variant::Type get_return_type() { return Variant::BOOL; }
+};
+
+////
+
+class OperatorEvaluatorInStringFind {
+public:
+ static void evaluate(const Variant &p_left, const Variant &p_right, Variant *r_ret, bool &r_valid) {
+ const String &str_a = *VariantGetInternalPtr<String>::get_ptr(&p_left);
+ const String &str_b = *VariantGetInternalPtr<String>::get_ptr(&p_right);
+
+ *r_ret = str_b.find(str_a) != -1;
+ r_valid = true;
+ }
+
+ static void validated_evaluate(const Variant *left, const Variant *right, Variant *r_ret) {
+ const String &str_a = *VariantGetInternalPtr<String>::get_ptr(left);
+ const String &str_b = *VariantGetInternalPtr<String>::get_ptr(right);
+ VariantTypeChanger<bool>::change(r_ret);
+ *VariantGetInternalPtr<bool>::get_ptr(r_ret) = str_b.find(str_a) != -1;
+ }
+#ifdef PTRCALL_ENABLED
+ static void ptr_evaluate(const void *left, const void *right, void *r_ret) {
+ PtrToArg<bool>::encode(PtrToArg<String>::convert(right).find(PtrToArg<String>::convert(left)) != -1, r_ret);
+ }
+#endif
+ static Variant::Type get_return_type() { return Variant::BOOL; }
+};
+
+template <class A, class B>
+class OperatorEvaluatorInArrayFind {
+public:
+ static void evaluate(const Variant &p_left, const Variant &p_right, Variant *r_ret, bool &r_valid) {
+ const A &a = *VariantGetInternalPtr<A>::get_ptr(&p_left);
+ const B &b = *VariantGetInternalPtr<B>::get_ptr(&p_right);
+
+ *r_ret = b.find(a) != -1;
+ r_valid = true;
+ }
+
+ static void validated_evaluate(const Variant *left, const Variant *right, Variant *r_ret) {
+ const A &a = *VariantGetInternalPtr<A>::get_ptr(left);
+ const B &b = *VariantGetInternalPtr<B>::get_ptr(right);
+ VariantTypeChanger<bool>::change(r_ret);
+ *VariantGetInternalPtr<bool>::get_ptr(r_ret) = b.find(a) != -1;
+ }
+#ifdef PTRCALL_ENABLED
+ static void ptr_evaluate(const void *left, const void *right, void *r_ret) {
+ PtrToArg<bool>::encode(PtrToArg<B>::convert(right).find(PtrToArg<A>::convert(left)) != -1, r_ret);
+ }
+#endif
+ static Variant::Type get_return_type() { return Variant::BOOL; }
+};
+
+class OperatorEvaluatorInArrayFindNil {
+public:
+ static void evaluate(const Variant &p_left, const Variant &p_right, Variant *r_ret, bool &r_valid) {
+ const Array &b = *VariantGetInternalPtr<Array>::get_ptr(&p_right);
+ *r_ret = b.find(Variant()) != -1;
+ r_valid = true;
+ }
+
+ static void validated_evaluate(const Variant *left, const Variant *right, Variant *r_ret) {
+ const Array &b = *VariantGetInternalPtr<Array>::get_ptr(right);
+ VariantTypeChanger<bool>::change(r_ret);
+ *VariantGetInternalPtr<bool>::get_ptr(r_ret) = b.find(Variant()) != -1;
+ }
+#ifdef PTRCALL_ENABLED
+ static void ptr_evaluate(const void *left, const void *right, void *r_ret) {
+ PtrToArg<bool>::encode(PtrToArg<Array>::convert(right).find(Variant()) != -1, r_ret);
+ }
+#endif
+ static Variant::Type get_return_type() { return Variant::BOOL; }
+};
+
+class OperatorEvaluatorInArrayFindObject {
+public:
+ static void evaluate(const Variant &p_left, const Variant &p_right, Variant *r_ret, bool &r_valid) {
+ const Array &b = *VariantGetInternalPtr<Array>::get_ptr(&p_right);
+ *r_ret = b.find(p_left) != -1;
+ r_valid = true;
+ }
+
+ static void validated_evaluate(const Variant *left, const Variant *right, Variant *r_ret) {
+ const Array &b = *VariantGetInternalPtr<Array>::get_ptr(right);
+ VariantTypeChanger<bool>::change(r_ret);
+ *VariantGetInternalPtr<bool>::get_ptr(r_ret) = b.find(*left) != -1;
+ }
+#ifdef PTRCALL_ENABLED
+ static void ptr_evaluate(const void *left, const void *right, void *r_ret) {
+ PtrToArg<bool>::encode(PtrToArg<Array>::convert(right).find(PtrToArg<Object *>::convert(left)) != -1, r_ret);
+ }
+#endif
+ static Variant::Type get_return_type() { return Variant::BOOL; }
+};
+
+template <class A>
+class OperatorEvaluatorInDictionaryHas {
+public:
+ static void evaluate(const Variant &p_left, const Variant &p_right, Variant *r_ret, bool &r_valid) {
+ const Dictionary &b = *VariantGetInternalPtr<Dictionary>::get_ptr(&p_right);
+ const A &a = *VariantGetInternalPtr<A>::get_ptr(&p_left);
+
+ *r_ret = b.has(a);
+ r_valid = true;
+ }
+
+ static void validated_evaluate(const Variant *left, const Variant *right, Variant *r_ret) {
+ const Dictionary &b = *VariantGetInternalPtr<Dictionary>::get_ptr(right);
+ const A &a = *VariantGetInternalPtr<A>::get_ptr(left);
+ VariantTypeChanger<bool>::change(r_ret);
+ *VariantGetInternalPtr<bool>::get_ptr(r_ret) = b.has(a);
+ }
+#ifdef PTRCALL_ENABLED
+ static void ptr_evaluate(const void *left, const void *right, void *r_ret) {
+ PtrToArg<bool>::encode(PtrToArg<Dictionary>::convert(right).has(PtrToArg<A>::convert(left)), r_ret);
+ }
+#endif
+ static Variant::Type get_return_type() { return Variant::BOOL; }
+};
+
+class OperatorEvaluatorInDictionaryHasNil {
+public:
+ static void evaluate(const Variant &p_left, const Variant &p_right, Variant *r_ret, bool &r_valid) {
+ const Dictionary &b = *VariantGetInternalPtr<Dictionary>::get_ptr(&p_right);
+
+ *r_ret = b.has(Variant());
+ r_valid = true;
+ }
+
+ static void validated_evaluate(const Variant *left, const Variant *right, Variant *r_ret) {
+ const Dictionary &b = *VariantGetInternalPtr<Dictionary>::get_ptr(right);
+ VariantTypeChanger<bool>::change(r_ret);
+ *VariantGetInternalPtr<bool>::get_ptr(r_ret) = b.has(Variant());
+ }
+#ifdef PTRCALL_ENABLED
+ static void ptr_evaluate(const void *left, const void *right, void *r_ret) {
+ PtrToArg<bool>::encode(PtrToArg<Dictionary>::convert(right).has(Variant()), r_ret);
+ }
+#endif
+ static Variant::Type get_return_type() { return Variant::BOOL; }
+};
+
+class OperatorEvaluatorInDictionaryHasObject {
+public:
+ static void evaluate(const Variant &p_left, const Variant &p_right, Variant *r_ret, bool &r_valid) {
+ const Dictionary &b = *VariantGetInternalPtr<Dictionary>::get_ptr(&p_right);
+
+ *r_ret = b.has(p_left);
+ r_valid = true;
+ }
+
+ static void validated_evaluate(const Variant *left, const Variant *right, Variant *r_ret) {
+ const Dictionary &b = *VariantGetInternalPtr<Dictionary>::get_ptr(right);
+ VariantTypeChanger<bool>::change(r_ret);
+ *VariantGetInternalPtr<bool>::get_ptr(r_ret) = b.has(*left);
+ }
+#ifdef PTRCALL_ENABLED
+ static void ptr_evaluate(const void *left, const void *right, void *r_ret) {
+ PtrToArg<bool>::encode(PtrToArg<Dictionary>::convert(right).has(PtrToArg<Object *>::convert(left)), r_ret);
+ }
+#endif
+ static Variant::Type get_return_type() { return Variant::BOOL; }
+};
+
+class OperatorEvaluatorObjectHasPropertyString {
+public:
+ static void evaluate(const Variant &p_left, const Variant &p_right, Variant *r_ret, bool &r_valid) {
+ Object *b = p_right.get_validated_object();
+ if (!b) {
+ *r_ret = "Invalid base object for 'in'";
+ r_valid = false;
+ return;
+ }
+
+ const String &a = *VariantGetInternalPtr<String>::get_ptr(&p_left);
+
+ b->get(a, &r_valid);
+ *r_ret = r_valid;
+ }
+
+ static void validated_evaluate(const Variant *left, const Variant *right, Variant *r_ret) {
+ Object *l = right->get_validated_object();
+ ERR_FAIL_COND(l == nullptr);
+ const String &a = *VariantGetInternalPtr<String>::get_ptr(left);
+
+ bool valid;
+ l->get(a, &valid);
+ VariantTypeChanger<bool>::change(r_ret);
+ *VariantGetInternalPtr<bool>::get_ptr(r_ret) = valid;
+ }
+#ifdef PTRCALL_ENABLED
+ static void ptr_evaluate(const void *left, const void *right, void *r_ret) {
+ bool valid;
+ PtrToArg<Object *>::convert(right)->get(PtrToArg<String>::convert(left), &valid);
+ PtrToArg<bool>::encode(valid, r_ret);
+ }
+#endif
+ static Variant::Type get_return_type() { return Variant::BOOL; }
+};
+
+class OperatorEvaluatorObjectHasPropertyStringName {
+public:
+ static void evaluate(const Variant &p_left, const Variant &p_right, Variant *r_ret, bool &r_valid) {
+ Object *b = p_right.get_validated_object();
+ if (!b) {
+ *r_ret = "Invalid base object for 'in'";
+ r_valid = false;
+ return;
+ }
+
+ const StringName &a = *VariantGetInternalPtr<StringName>::get_ptr(&p_left);
+
+ b->get(a, &r_valid);
+ *r_ret = r_valid;
+ }
+
+ static void validated_evaluate(const Variant *left, const Variant *right, Variant *r_ret) {
+ Object *l = right->get_validated_object();
+ ERR_FAIL_COND(l == nullptr);
+ const StringName &a = *VariantGetInternalPtr<StringName>::get_ptr(left);
+
+ bool valid;
+ l->get(a, &valid);
+ VariantTypeChanger<bool>::change(r_ret);
+ *VariantGetInternalPtr<bool>::get_ptr(r_ret) = valid;
+ }
+#ifdef PTRCALL_ENABLED
+ static void ptr_evaluate(const void *left, const void *right, void *r_ret) {
+ bool valid;
+ PtrToArg<Object *>::convert(right)->get(PtrToArg<StringName>::convert(left), &valid);
+ PtrToArg<bool>::encode(valid, r_ret);
+ }
+#endif
+ static Variant::Type get_return_type() { return Variant::BOOL; }
+};
+
+typedef void (*VariantEvaluatorFunction)(const Variant &p_left, const Variant &p_right, Variant *r_ret, bool &r_valid);
+
+static Variant::Type operator_return_type_table[Variant::OP_MAX][Variant::VARIANT_MAX][Variant::VARIANT_MAX];
+static VariantEvaluatorFunction operator_evaluator_table[Variant::OP_MAX][Variant::VARIANT_MAX][Variant::VARIANT_MAX];
+static Variant::ValidatedOperatorEvaluator validated_operator_evaluator_table[Variant::OP_MAX][Variant::VARIANT_MAX][Variant::VARIANT_MAX];
+#ifdef PTRCALL_ENABLED
+static Variant::PTROperatorEvaluator ptr_operator_evaluator_table[Variant::OP_MAX][Variant::VARIANT_MAX][Variant::VARIANT_MAX];
+#endif
+
+template <class T>
+void register_op(Variant::Operator p_op, Variant::Type p_type_a, Variant::Type p_type_b) {
+ operator_return_type_table[p_op][p_type_a][p_type_b] = T::get_return_type();
+ operator_evaluator_table[p_op][p_type_a][p_type_b] = T::evaluate;
+ validated_operator_evaluator_table[p_op][p_type_a][p_type_b] = T::validated_evaluate;
+#ifdef PTRCALL_ENABLED
+ ptr_operator_evaluator_table[p_op][p_type_a][p_type_b] = T::ptr_evaluate;
+#endif
+}
+
+void Variant::_register_variant_operators() {
+ zeromem(operator_return_type_table, sizeof(operator_return_type_table));
+ zeromem(operator_evaluator_table, sizeof(operator_evaluator_table));
+ zeromem(validated_operator_evaluator_table, sizeof(validated_operator_evaluator_table));
+#ifdef PTRCALL_ENABLED
+ zeromem(ptr_operator_evaluator_table, sizeof(ptr_operator_evaluator_table));
+#endif
+
+ register_op<OperatorEvaluatorAdd<int64_t, int64_t, int64_t>>(Variant::OP_ADD, Variant::INT, Variant::INT);
+ register_op<OperatorEvaluatorAdd<double, int64_t, double>>(Variant::OP_ADD, Variant::INT, Variant::FLOAT);
+ register_op<OperatorEvaluatorAdd<double, double, int64_t>>(Variant::OP_ADD, Variant::FLOAT, Variant::INT);
+ register_op<OperatorEvaluatorAdd<double, double, double>>(Variant::OP_ADD, Variant::FLOAT, Variant::FLOAT);
+ register_op<OperatorEvaluatorAdd<String, String, String>>(Variant::OP_ADD, Variant::STRING, Variant::STRING);
+ register_op<OperatorEvaluatorAdd<Vector2, Vector2, Vector2>>(Variant::OP_ADD, Variant::VECTOR2, Variant::VECTOR2);
+ register_op<OperatorEvaluatorAdd<Vector2i, Vector2i, Vector2i>>(Variant::OP_ADD, Variant::VECTOR2I, Variant::VECTOR2I);
+ register_op<OperatorEvaluatorAdd<Vector3, Vector3, Vector3>>(Variant::OP_ADD, Variant::VECTOR3, Variant::VECTOR3);
+ register_op<OperatorEvaluatorAdd<Vector3i, Vector3i, Vector3i>>(Variant::OP_ADD, Variant::VECTOR3I, Variant::VECTOR3I);
+ register_op<OperatorEvaluatorAdd<Quat, Quat, Quat>>(Variant::OP_ADD, Variant::QUAT, Variant::QUAT);
+ register_op<OperatorEvaluatorAdd<Color, Color, Color>>(Variant::OP_ADD, Variant::COLOR, Variant::COLOR);
+ register_op<OperatorEvaluatorAddArray>(Variant::OP_ADD, Variant::ARRAY, Variant::ARRAY);
+ register_op<OperatorEvaluatorAppendArray<uint8_t>>(Variant::OP_ADD, Variant::PACKED_BYTE_ARRAY, Variant::PACKED_BYTE_ARRAY);
+ register_op<OperatorEvaluatorAppendArray<int32_t>>(Variant::OP_ADD, Variant::PACKED_INT32_ARRAY, Variant::PACKED_INT32_ARRAY);
+ register_op<OperatorEvaluatorAppendArray<int64_t>>(Variant::OP_ADD, Variant::PACKED_INT64_ARRAY, Variant::PACKED_INT64_ARRAY);
+ register_op<OperatorEvaluatorAppendArray<float>>(Variant::OP_ADD, Variant::PACKED_FLOAT32_ARRAY, Variant::PACKED_FLOAT32_ARRAY);
+ register_op<OperatorEvaluatorAppendArray<double>>(Variant::OP_ADD, Variant::PACKED_FLOAT64_ARRAY, Variant::PACKED_FLOAT64_ARRAY);
+ register_op<OperatorEvaluatorAppendArray<String>>(Variant::OP_ADD, Variant::PACKED_STRING_ARRAY, Variant::PACKED_STRING_ARRAY);
+ register_op<OperatorEvaluatorAppendArray<Vector2>>(Variant::OP_ADD, Variant::PACKED_VECTOR2_ARRAY, Variant::PACKED_VECTOR2_ARRAY);
+ register_op<OperatorEvaluatorAppendArray<Vector3>>(Variant::OP_ADD, Variant::PACKED_VECTOR3_ARRAY, Variant::PACKED_VECTOR3_ARRAY);
+ register_op<OperatorEvaluatorAppendArray<Color>>(Variant::OP_ADD, Variant::PACKED_COLOR_ARRAY, Variant::PACKED_COLOR_ARRAY);
+
+ register_op<OperatorEvaluatorSub<int64_t, int64_t, int64_t>>(Variant::OP_SUBTRACT, Variant::INT, Variant::INT);
+ register_op<OperatorEvaluatorSub<double, int64_t, double>>(Variant::OP_SUBTRACT, Variant::INT, Variant::FLOAT);
+ register_op<OperatorEvaluatorSub<double, double, int64_t>>(Variant::OP_SUBTRACT, Variant::FLOAT, Variant::INT);
+ register_op<OperatorEvaluatorSub<double, double, double>>(Variant::OP_SUBTRACT, Variant::FLOAT, Variant::FLOAT);
+ register_op<OperatorEvaluatorSub<Vector2, Vector2, Vector2>>(Variant::OP_SUBTRACT, Variant::VECTOR2, Variant::VECTOR2);
+ register_op<OperatorEvaluatorSub<Vector2i, Vector2i, Vector2i>>(Variant::OP_SUBTRACT, Variant::VECTOR2I, Variant::VECTOR2I);
+ register_op<OperatorEvaluatorSub<Vector3, Vector3, Vector3>>(Variant::OP_SUBTRACT, Variant::VECTOR3, Variant::VECTOR3);
+ register_op<OperatorEvaluatorSub<Vector3i, Vector3i, Vector3i>>(Variant::OP_SUBTRACT, Variant::VECTOR3I, Variant::VECTOR3I);
+
+ register_op<OperatorEvaluatorMul<int64_t, int64_t, int64_t>>(Variant::OP_MULTIPLY, Variant::INT, Variant::INT);
+ register_op<OperatorEvaluatorMul<double, int64_t, double>>(Variant::OP_MULTIPLY, Variant::INT, Variant::FLOAT);
+ register_op<OperatorEvaluatorMul<Vector2, int64_t, Vector2>>(Variant::OP_MULTIPLY, Variant::INT, Variant::VECTOR2);
+ register_op<OperatorEvaluatorMul<Vector2i, int64_t, Vector2i>>(Variant::OP_MULTIPLY, Variant::INT, Variant::VECTOR2I);
+ register_op<OperatorEvaluatorMul<Vector3, int64_t, Vector3>>(Variant::OP_MULTIPLY, Variant::INT, Variant::VECTOR3);
+ register_op<OperatorEvaluatorMul<Vector3i, int64_t, Vector3i>>(Variant::OP_MULTIPLY, Variant::INT, Variant::VECTOR3I);
+
+ register_op<OperatorEvaluatorMul<double, double, double>>(Variant::OP_MULTIPLY, Variant::FLOAT, Variant::FLOAT);
+ register_op<OperatorEvaluatorMul<double, double, int64_t>>(Variant::OP_MULTIPLY, Variant::FLOAT, Variant::INT);
+ register_op<OperatorEvaluatorMul<Vector2, double, Vector2>>(Variant::OP_MULTIPLY, Variant::FLOAT, Variant::VECTOR2);
+ register_op<OperatorEvaluatorMul<Vector2i, double, Vector2i>>(Variant::OP_MULTIPLY, Variant::FLOAT, Variant::VECTOR2I);
+ register_op<OperatorEvaluatorMul<Vector3, double, Vector3>>(Variant::OP_MULTIPLY, Variant::FLOAT, Variant::VECTOR3);
+ register_op<OperatorEvaluatorMul<Vector3i, double, Vector3i>>(Variant::OP_MULTIPLY, Variant::FLOAT, Variant::VECTOR3I);
+
+ register_op<OperatorEvaluatorMul<Vector2, Vector2, Vector2>>(Variant::OP_MULTIPLY, Variant::VECTOR2, Variant::VECTOR2);
+ register_op<OperatorEvaluatorMul<Vector2, Vector2, int64_t>>(Variant::OP_MULTIPLY, Variant::VECTOR2, Variant::INT);
+ register_op<OperatorEvaluatorMul<Vector2, Vector2, double>>(Variant::OP_MULTIPLY, Variant::VECTOR2, Variant::FLOAT);
+
+ register_op<OperatorEvaluatorMul<Vector2i, Vector2i, Vector2i>>(Variant::OP_MULTIPLY, Variant::VECTOR2I, Variant::VECTOR2I);
+ register_op<OperatorEvaluatorMul<Vector2i, Vector2i, int64_t>>(Variant::OP_MULTIPLY, Variant::VECTOR2I, Variant::INT);
+ register_op<OperatorEvaluatorMul<Vector2i, Vector2i, double>>(Variant::OP_MULTIPLY, Variant::VECTOR2I, Variant::FLOAT);
+
+ register_op<OperatorEvaluatorMul<Vector3, Vector3, Vector3>>(Variant::OP_MULTIPLY, Variant::VECTOR3, Variant::VECTOR3);
+ register_op<OperatorEvaluatorMul<Vector3, Vector3, int64_t>>(Variant::OP_MULTIPLY, Variant::VECTOR3, Variant::INT);
+ register_op<OperatorEvaluatorMul<Vector3, Vector3, double>>(Variant::OP_MULTIPLY, Variant::VECTOR3, Variant::FLOAT);
+
+ register_op<OperatorEvaluatorMul<Vector3i, Vector3i, Vector3i>>(Variant::OP_MULTIPLY, Variant::VECTOR3I, Variant::VECTOR3I);
+ register_op<OperatorEvaluatorMul<Vector3i, Vector3i, int64_t>>(Variant::OP_MULTIPLY, Variant::VECTOR3I, Variant::INT);
+ register_op<OperatorEvaluatorMul<Vector3i, Vector3i, double>>(Variant::OP_MULTIPLY, Variant::VECTOR3I, Variant::FLOAT);
+
+ register_op<OperatorEvaluatorMul<Quat, Quat, Quat>>(Variant::OP_MULTIPLY, Variant::QUAT, Variant::QUAT);
+ register_op<OperatorEvaluatorMul<Quat, Quat, int64_t>>(Variant::OP_MULTIPLY, Variant::QUAT, Variant::INT);
+ register_op<OperatorEvaluatorMul<Quat, Quat, double>>(Variant::OP_MULTIPLY, Variant::QUAT, Variant::FLOAT);
+
+ register_op<OperatorEvaluatorMul<Color, Color, Color>>(Variant::OP_MULTIPLY, Variant::COLOR, Variant::COLOR);
+ register_op<OperatorEvaluatorMul<Color, Color, int64_t>>(Variant::OP_MULTIPLY, Variant::COLOR, Variant::INT);
+ register_op<OperatorEvaluatorMul<Color, Color, double>>(Variant::OP_MULTIPLY, Variant::COLOR, Variant::FLOAT);
+
+ register_op<OperatorEvaluatorMul<Transform2D, Transform2D, Transform2D>>(Variant::OP_MULTIPLY, Variant::TRANSFORM2D, Variant::TRANSFORM2D);
+ register_op<OperatorEvaluatorXForm<Vector2, Transform2D, Vector2>>(Variant::OP_MULTIPLY, Variant::TRANSFORM2D, Variant::VECTOR2);
+ register_op<OperatorEvaluatorXFormInv<Vector2, Vector2, Transform2D>>(Variant::OP_MULTIPLY, Variant::VECTOR2, Variant::TRANSFORM2D);
+ register_op<OperatorEvaluatorXForm<Rect2, Transform2D, Rect2>>(Variant::OP_MULTIPLY, Variant::TRANSFORM2D, Variant::RECT2);
+ register_op<OperatorEvaluatorXFormInv<Rect2, Rect2, Transform2D>>(Variant::OP_MULTIPLY, Variant::RECT2, Variant::TRANSFORM2D);
+ register_op<OperatorEvaluatorXForm<Vector<Vector2>, Transform2D, Vector<Vector2>>>(Variant::OP_MULTIPLY, Variant::TRANSFORM2D, Variant::PACKED_VECTOR2_ARRAY);
+ register_op<OperatorEvaluatorXFormInv<Vector<Vector2>, Vector<Vector2>, Transform2D>>(Variant::OP_MULTIPLY, Variant::PACKED_VECTOR2_ARRAY, Variant::TRANSFORM2D);
+
+ register_op<OperatorEvaluatorMul<Transform, Transform, Transform>>(Variant::OP_MULTIPLY, Variant::TRANSFORM, Variant::TRANSFORM);
+ register_op<OperatorEvaluatorXForm<Vector3, Transform, Vector3>>(Variant::OP_MULTIPLY, Variant::TRANSFORM, Variant::VECTOR3);
+ register_op<OperatorEvaluatorXFormInv<Vector3, Vector3, Transform>>(Variant::OP_MULTIPLY, Variant::VECTOR3, Variant::TRANSFORM);
+ register_op<OperatorEvaluatorXForm<::AABB, Transform, ::AABB>>(Variant::OP_MULTIPLY, Variant::TRANSFORM, Variant::AABB);
+ register_op<OperatorEvaluatorXFormInv<::AABB, ::AABB, Transform>>(Variant::OP_MULTIPLY, Variant::AABB, Variant::TRANSFORM);
+ register_op<OperatorEvaluatorXForm<Vector<Vector3>, Transform, Vector<Vector3>>>(Variant::OP_MULTIPLY, Variant::TRANSFORM, Variant::PACKED_VECTOR3_ARRAY);
+ register_op<OperatorEvaluatorXFormInv<Vector<Vector3>, Vector<Vector3>, Transform>>(Variant::OP_MULTIPLY, Variant::PACKED_VECTOR3_ARRAY, Variant::TRANSFORM);
+
+ register_op<OperatorEvaluatorMul<Basis, Basis, Basis>>(Variant::OP_MULTIPLY, Variant::BASIS, Variant::BASIS);
+ register_op<OperatorEvaluatorXForm<Vector3, Basis, Vector3>>(Variant::OP_MULTIPLY, Variant::BASIS, Variant::VECTOR3);
+ register_op<OperatorEvaluatorXFormInv<Vector3, Vector3, Basis>>(Variant::OP_MULTIPLY, Variant::VECTOR3, Variant::BASIS);
+
+ register_op<OperatorEvaluatorMul<Quat, Quat, Quat>>(Variant::OP_MULTIPLY, Variant::QUAT, Variant::QUAT);
+ register_op<OperatorEvaluatorMul<Quat, Quat, int64_t>>(Variant::OP_MULTIPLY, Variant::QUAT, Variant::INT);
+ register_op<OperatorEvaluatorMul<Quat, int64_t, Quat>>(Variant::OP_MULTIPLY, Variant::INT, Variant::QUAT);
+ register_op<OperatorEvaluatorMul<Quat, Quat, double>>(Variant::OP_MULTIPLY, Variant::QUAT, Variant::FLOAT);
+ register_op<OperatorEvaluatorMul<Quat, double, Quat>>(Variant::OP_MULTIPLY, Variant::FLOAT, Variant::QUAT);
+ register_op<OperatorEvaluatorXForm<Vector3, Quat, Vector3>>(Variant::OP_MULTIPLY, Variant::QUAT, Variant::VECTOR3);
+ register_op<OperatorEvaluatorXFormInv<Vector3, Vector3, Quat>>(Variant::OP_MULTIPLY, Variant::VECTOR3, Variant::QUAT);
+
+ register_op<OperatorEvaluatorMul<Color, Color, Color>>(Variant::OP_MULTIPLY, Variant::COLOR, Variant::COLOR);
+ register_op<OperatorEvaluatorMul<Color, Color, int64_t>>(Variant::OP_MULTIPLY, Variant::COLOR, Variant::INT);
+ register_op<OperatorEvaluatorMul<Color, int64_t, Color>>(Variant::OP_MULTIPLY, Variant::INT, Variant::COLOR);
+ register_op<OperatorEvaluatorMul<Color, Color, double>>(Variant::OP_MULTIPLY, Variant::COLOR, Variant::FLOAT);
+ register_op<OperatorEvaluatorMul<Color, double, Color>>(Variant::OP_MULTIPLY, Variant::FLOAT, Variant::COLOR);
+
+ register_op<OperatorEvaluatorDivNZ<int64_t, int64_t, int64_t>>(Variant::OP_DIVIDE, Variant::INT, Variant::INT);
+ register_op<OperatorEvaluatorDiv<double, double, int64_t>>(Variant::OP_DIVIDE, Variant::FLOAT, Variant::INT);
+ register_op<OperatorEvaluatorDiv<double, int64_t, double>>(Variant::OP_DIVIDE, Variant::INT, Variant::FLOAT);
+ register_op<OperatorEvaluatorDiv<double, double, double>>(Variant::OP_DIVIDE, Variant::FLOAT, Variant::FLOAT);
+
+ register_op<OperatorEvaluatorDiv<Vector2, Vector2, Vector2>>(Variant::OP_DIVIDE, Variant::VECTOR2, Variant::VECTOR2);
+ register_op<OperatorEvaluatorDiv<Vector2, Vector2, double>>(Variant::OP_DIVIDE, Variant::VECTOR2, Variant::FLOAT);
+ register_op<OperatorEvaluatorDiv<Vector2, Vector2, int64_t>>(Variant::OP_DIVIDE, Variant::VECTOR2, Variant::INT);
+
+ register_op<OperatorEvaluatorDiv<Vector2i, Vector2i, Vector2i>>(Variant::OP_DIVIDE, Variant::VECTOR2I, Variant::VECTOR2I);
+ register_op<OperatorEvaluatorDivNZ<Vector2i, Vector2i, double>>(Variant::OP_DIVIDE, Variant::VECTOR2I, Variant::FLOAT);
+ register_op<OperatorEvaluatorDivNZ<Vector2i, Vector2i, int64_t>>(Variant::OP_DIVIDE, Variant::VECTOR2I, Variant::INT);
+
+ register_op<OperatorEvaluatorDiv<Vector2, Vector2, Vector2>>(Variant::OP_DIVIDE, Variant::VECTOR2, Variant::VECTOR2);
+ register_op<OperatorEvaluatorDiv<Vector2, Vector2, double>>(Variant::OP_DIVIDE, Variant::VECTOR2, Variant::FLOAT);
+ register_op<OperatorEvaluatorDiv<Vector2, Vector2, int64_t>>(Variant::OP_DIVIDE, Variant::VECTOR2, Variant::INT);
+
+ register_op<OperatorEvaluatorDiv<Vector3, Vector3, Vector3>>(Variant::OP_DIVIDE, Variant::VECTOR3, Variant::VECTOR3);
+ register_op<OperatorEvaluatorDiv<Vector3, Vector3, double>>(Variant::OP_DIVIDE, Variant::VECTOR3, Variant::FLOAT);
+ register_op<OperatorEvaluatorDiv<Vector3, Vector3, int64_t>>(Variant::OP_DIVIDE, Variant::VECTOR3, Variant::INT);
+
+ register_op<OperatorEvaluatorDiv<Vector3i, Vector3i, Vector3i>>(Variant::OP_DIVIDE, Variant::VECTOR3I, Variant::VECTOR3I);
+ register_op<OperatorEvaluatorDivNZ<Vector3i, Vector3i, double>>(Variant::OP_DIVIDE, Variant::VECTOR3I, Variant::FLOAT);
+ register_op<OperatorEvaluatorDivNZ<Vector3i, Vector3i, int64_t>>(Variant::OP_DIVIDE, Variant::VECTOR3I, Variant::INT);
+
+ register_op<OperatorEvaluatorDiv<Quat, Quat, double>>(Variant::OP_DIVIDE, Variant::QUAT, Variant::FLOAT);
+ register_op<OperatorEvaluatorDiv<Quat, Quat, int64_t>>(Variant::OP_DIVIDE, Variant::QUAT, Variant::INT);
+
+ register_op<OperatorEvaluatorDiv<Color, Color, Color>>(Variant::OP_DIVIDE, Variant::COLOR, Variant::COLOR);
+ register_op<OperatorEvaluatorDiv<Color, Color, double>>(Variant::OP_DIVIDE, Variant::COLOR, Variant::FLOAT);
+ register_op<OperatorEvaluatorDiv<Color, Color, int64_t>>(Variant::OP_DIVIDE, Variant::COLOR, Variant::INT);
+
+ register_op<OperatorEvaluatorModNZ<int64_t, int64_t, int64_t>>(Variant::OP_MODULE, Variant::INT, Variant::INT);
+ register_op<OperatorEvaluatorMod<Vector2i, Vector2i, Vector2i>>(Variant::OP_MODULE, Variant::VECTOR2I, Variant::VECTOR2I);
+ register_op<OperatorEvaluatorModNZ<Vector2i, Vector2i, int64_t>>(Variant::OP_MODULE, Variant::VECTOR2I, Variant::INT);
+
+ register_op<OperatorEvaluatorMod<Vector3i, Vector3i, Vector3i>>(Variant::OP_MODULE, Variant::VECTOR3I, Variant::VECTOR3I);
+ register_op<OperatorEvaluatorModNZ<Vector3i, Vector3i, int64_t>>(Variant::OP_MODULE, Variant::VECTOR3I, Variant::INT);
+
+ register_op<OperatorEvaluatorStringModNil>(Variant::OP_MODULE, Variant::STRING, Variant::NIL);
+
+ register_op<OperatorEvaluatorStringModT<bool>>(Variant::OP_MODULE, Variant::STRING, Variant::BOOL);
+ register_op<OperatorEvaluatorStringModT<int64_t>>(Variant::OP_MODULE, Variant::STRING, Variant::INT);
+ register_op<OperatorEvaluatorStringModT<double>>(Variant::OP_MODULE, Variant::STRING, Variant::FLOAT);
+ register_op<OperatorEvaluatorStringModT<String>>(Variant::OP_MODULE, Variant::STRING, Variant::STRING);
+ register_op<OperatorEvaluatorStringModT<Vector2>>(Variant::OP_MODULE, Variant::STRING, Variant::VECTOR2);
+ register_op<OperatorEvaluatorStringModT<Vector2i>>(Variant::OP_MODULE, Variant::STRING, Variant::VECTOR2I);
+ register_op<OperatorEvaluatorStringModT<Rect2>>(Variant::OP_MODULE, Variant::STRING, Variant::RECT2);
+ register_op<OperatorEvaluatorStringModT<Rect2i>>(Variant::OP_MODULE, Variant::STRING, Variant::RECT2I);
+ register_op<OperatorEvaluatorStringModT<Vector3>>(Variant::OP_MODULE, Variant::STRING, Variant::VECTOR3);
+ register_op<OperatorEvaluatorStringModT<Vector3i>>(Variant::OP_MODULE, Variant::STRING, Variant::VECTOR3I);
+ register_op<OperatorEvaluatorStringModT<Transform2D>>(Variant::OP_MODULE, Variant::STRING, Variant::TRANSFORM2D);
+ register_op<OperatorEvaluatorStringModT<Plane>>(Variant::OP_MODULE, Variant::STRING, Variant::PLANE);
+ register_op<OperatorEvaluatorStringModT<Quat>>(Variant::OP_MODULE, Variant::STRING, Variant::QUAT);
+ register_op<OperatorEvaluatorStringModT<::AABB>>(Variant::OP_MODULE, Variant::STRING, Variant::AABB);
+ register_op<OperatorEvaluatorStringModT<Basis>>(Variant::OP_MODULE, Variant::STRING, Variant::BASIS);
+ register_op<OperatorEvaluatorStringModT<Transform>>(Variant::OP_MODULE, Variant::STRING, Variant::TRANSFORM);
+
+ register_op<OperatorEvaluatorStringModT<Color>>(Variant::OP_MODULE, Variant::STRING, Variant::COLOR);
+ register_op<OperatorEvaluatorStringModT<StringName>>(Variant::OP_MODULE, Variant::STRING, Variant::STRING_NAME);
+ register_op<OperatorEvaluatorStringModT<NodePath>>(Variant::OP_MODULE, Variant::STRING, Variant::NODE_PATH);
+ register_op<OperatorEvaluatorStringModObject>(Variant::OP_MODULE, Variant::STRING, Variant::OBJECT);
+ register_op<OperatorEvaluatorStringModT<Callable>>(Variant::OP_MODULE, Variant::STRING, Variant::CALLABLE);
+ register_op<OperatorEvaluatorStringModT<Signal>>(Variant::OP_MODULE, Variant::STRING, Variant::SIGNAL);
+ register_op<OperatorEvaluatorStringModT<Dictionary>>(Variant::OP_MODULE, Variant::STRING, Variant::DICTIONARY);
+ register_op<OperatorEvaluatorStringModArray>(Variant::OP_MODULE, Variant::STRING, Variant::ARRAY);
+
+ register_op<OperatorEvaluatorStringModT<PackedByteArray>>(Variant::OP_MODULE, Variant::STRING, Variant::PACKED_BYTE_ARRAY);
+ register_op<OperatorEvaluatorStringModT<PackedInt32Array>>(Variant::OP_MODULE, Variant::STRING, Variant::PACKED_INT32_ARRAY);
+ register_op<OperatorEvaluatorStringModT<PackedInt64Array>>(Variant::OP_MODULE, Variant::STRING, Variant::PACKED_INT64_ARRAY);
+ register_op<OperatorEvaluatorStringModT<PackedFloat32Array>>(Variant::OP_MODULE, Variant::STRING, Variant::PACKED_FLOAT32_ARRAY);
+ register_op<OperatorEvaluatorStringModT<PackedFloat64Array>>(Variant::OP_MODULE, Variant::STRING, Variant::PACKED_FLOAT64_ARRAY);
+ register_op<OperatorEvaluatorStringModT<PackedStringArray>>(Variant::OP_MODULE, Variant::STRING, Variant::PACKED_STRING_ARRAY);
+ register_op<OperatorEvaluatorStringModT<PackedVector2Array>>(Variant::OP_MODULE, Variant::STRING, Variant::PACKED_VECTOR2_ARRAY);
+ register_op<OperatorEvaluatorStringModT<PackedVector3Array>>(Variant::OP_MODULE, Variant::STRING, Variant::PACKED_VECTOR3_ARRAY);
+ register_op<OperatorEvaluatorStringModT<PackedColorArray>>(Variant::OP_MODULE, Variant::STRING, Variant::PACKED_COLOR_ARRAY);
+
+ register_op<OperatorEvaluatorNeg<int64_t, int64_t>>(Variant::OP_NEGATE, Variant::INT, Variant::NIL);
+ register_op<OperatorEvaluatorNeg<double, double>>(Variant::OP_NEGATE, Variant::FLOAT, Variant::NIL);
+ register_op<OperatorEvaluatorNeg<Vector2, Vector2>>(Variant::OP_NEGATE, Variant::VECTOR2, Variant::NIL);
+ register_op<OperatorEvaluatorNeg<Vector2i, Vector2i>>(Variant::OP_NEGATE, Variant::VECTOR2I, Variant::NIL);
+ register_op<OperatorEvaluatorNeg<Vector3, Vector3>>(Variant::OP_NEGATE, Variant::VECTOR3, Variant::NIL);
+ register_op<OperatorEvaluatorNeg<Vector3i, Vector3i>>(Variant::OP_NEGATE, Variant::VECTOR3I, Variant::NIL);
+ register_op<OperatorEvaluatorNeg<Quat, Quat>>(Variant::OP_NEGATE, Variant::QUAT, Variant::NIL);
+ register_op<OperatorEvaluatorNeg<Plane, Plane>>(Variant::OP_NEGATE, Variant::PLANE, Variant::NIL);
+ register_op<OperatorEvaluatorNeg<Color, Color>>(Variant::OP_NEGATE, Variant::COLOR, Variant::NIL);
+
+ register_op<OperatorEvaluatorPos<int64_t, int64_t>>(Variant::OP_POSITIVE, Variant::INT, Variant::NIL);
+ register_op<OperatorEvaluatorPos<double, double>>(Variant::OP_POSITIVE, Variant::FLOAT, Variant::NIL);
+ register_op<OperatorEvaluatorPos<Vector2, Vector2>>(Variant::OP_POSITIVE, Variant::VECTOR2, Variant::NIL);
+ register_op<OperatorEvaluatorPos<Vector2i, Vector2i>>(Variant::OP_POSITIVE, Variant::VECTOR2I, Variant::NIL);
+ register_op<OperatorEvaluatorPos<Vector3, Vector3>>(Variant::OP_POSITIVE, Variant::VECTOR3, Variant::NIL);
+ register_op<OperatorEvaluatorPos<Vector3i, Vector3i>>(Variant::OP_POSITIVE, Variant::VECTOR3I, Variant::NIL);
+ register_op<OperatorEvaluatorPos<Quat, Quat>>(Variant::OP_POSITIVE, Variant::QUAT, Variant::NIL);
+ register_op<OperatorEvaluatorPos<Plane, Plane>>(Variant::OP_POSITIVE, Variant::PLANE, Variant::NIL);
+ register_op<OperatorEvaluatorPos<Color, Color>>(Variant::OP_POSITIVE, Variant::COLOR, Variant::NIL);
+
+ register_op<OperatorEvaluatorShiftLeft<int64_t, int64_t, int64_t>>(Variant::OP_SHIFT_LEFT, Variant::INT, Variant::INT);
+ register_op<OperatorEvaluatorShiftRight<int64_t, int64_t, int64_t>>(Variant::OP_SHIFT_RIGHT, Variant::INT, Variant::INT);
+ register_op<OperatorEvaluatorBitOr<int64_t, int64_t, int64_t>>(Variant::OP_BIT_OR, Variant::INT, Variant::INT);
+ register_op<OperatorEvaluatorBitAnd<int64_t, int64_t, int64_t>>(Variant::OP_BIT_AND, Variant::INT, Variant::INT);
+ register_op<OperatorEvaluatorBitXor<int64_t, int64_t, int64_t>>(Variant::OP_BIT_XOR, Variant::INT, Variant::INT);
+ register_op<OperatorEvaluatorBitNeg<int64_t, int64_t>>(Variant::OP_BIT_NEGATE, Variant::INT, Variant::NIL);
+
+ register_op<OperatorEvaluatorBitNeg<int64_t, int64_t>>(Variant::OP_BIT_NEGATE, Variant::INT, Variant::NIL);
+
+ register_op<OperatorEvaluatorAlwaysTrue<Variant::OP_EQUAL, Variant::NIL, Variant::NIL>>(Variant::OP_EQUAL, Variant::NIL, Variant::NIL);
+ register_op<OperatorEvaluatorEqual<bool, bool>>(Variant::OP_EQUAL, Variant::BOOL, Variant::BOOL);
+ register_op<OperatorEvaluatorEqual<int64_t, int64_t>>(Variant::OP_EQUAL, Variant::INT, Variant::INT);
+ register_op<OperatorEvaluatorEqual<int64_t, double>>(Variant::OP_EQUAL, Variant::INT, Variant::FLOAT);
+ register_op<OperatorEvaluatorEqual<double, int64_t>>(Variant::OP_EQUAL, Variant::FLOAT, Variant::INT);
+ register_op<OperatorEvaluatorEqual<double, double>>(Variant::OP_EQUAL, Variant::FLOAT, Variant::FLOAT);
+ register_op<OperatorEvaluatorEqual<String, String>>(Variant::OP_EQUAL, Variant::STRING, Variant::STRING);
+ register_op<OperatorEvaluatorEqual<Vector2, Vector2>>(Variant::OP_EQUAL, Variant::VECTOR2, Variant::VECTOR2);
+ register_op<OperatorEvaluatorEqual<Vector2i, Vector2i>>(Variant::OP_EQUAL, Variant::VECTOR2I, Variant::VECTOR2I);
+ register_op<OperatorEvaluatorEqual<Rect2, Rect2>>(Variant::OP_EQUAL, Variant::RECT2, Variant::RECT2);
+ register_op<OperatorEvaluatorEqual<Rect2i, Rect2i>>(Variant::OP_EQUAL, Variant::RECT2I, Variant::RECT2I);
+ register_op<OperatorEvaluatorEqual<Vector3, Vector3>>(Variant::OP_EQUAL, Variant::VECTOR3, Variant::VECTOR3);
+ register_op<OperatorEvaluatorEqual<Vector3i, Vector3i>>(Variant::OP_EQUAL, Variant::VECTOR3I, Variant::VECTOR3I);
+ register_op<OperatorEvaluatorEqual<Transform2D, Transform2D>>(Variant::OP_EQUAL, Variant::TRANSFORM2D, Variant::TRANSFORM2D);
+ register_op<OperatorEvaluatorEqual<Plane, Plane>>(Variant::OP_EQUAL, Variant::PLANE, Variant::PLANE);
+ register_op<OperatorEvaluatorEqual<Quat, Quat>>(Variant::OP_EQUAL, Variant::QUAT, Variant::QUAT);
+ register_op<OperatorEvaluatorEqual<::AABB, ::AABB>>(Variant::OP_EQUAL, Variant::AABB, Variant::AABB);
+ register_op<OperatorEvaluatorEqual<Basis, Basis>>(Variant::OP_EQUAL, Variant::BASIS, Variant::BASIS);
+ register_op<OperatorEvaluatorEqual<Transform, Transform>>(Variant::OP_EQUAL, Variant::TRANSFORM, Variant::TRANSFORM);
+ register_op<OperatorEvaluatorEqual<Color, Color>>(Variant::OP_EQUAL, Variant::COLOR, Variant::COLOR);
+
+ register_op<OperatorEvaluatorEqual<StringName, String>>(Variant::OP_EQUAL, Variant::STRING_NAME, Variant::STRING);
+ register_op<OperatorEvaluatorEqual<String, StringName>>(Variant::OP_EQUAL, Variant::STRING, Variant::STRING_NAME);
+ register_op<OperatorEvaluatorEqual<StringName, StringName>>(Variant::OP_EQUAL, Variant::STRING_NAME, Variant::STRING_NAME);
+
+ register_op<OperatorEvaluatorEqual<NodePath, NodePath>>(Variant::OP_EQUAL, Variant::NODE_PATH, Variant::NODE_PATH);
+ register_op<OperatorEvaluatorEqual<::RID, ::RID>>(Variant::OP_EQUAL, Variant::RID, Variant::RID);
+
+ register_op<OperatorEvaluatorEqualObject>(Variant::OP_EQUAL, Variant::OBJECT, Variant::OBJECT);
+ register_op<OperatorEvaluatorEqualObjectNil>(Variant::OP_EQUAL, Variant::OBJECT, Variant::NIL);
+ register_op<OperatorEvaluatorEqualNilObject>(Variant::OP_EQUAL, Variant::NIL, Variant::OBJECT);
+
+ register_op<OperatorEvaluatorEqual<Callable, Callable>>(Variant::OP_EQUAL, Variant::CALLABLE, Variant::CALLABLE);
+ register_op<OperatorEvaluatorEqual<Signal, Signal>>(Variant::OP_EQUAL, Variant::SIGNAL, Variant::SIGNAL);
+ register_op<OperatorEvaluatorEqual<Dictionary, Dictionary>>(Variant::OP_EQUAL, Variant::DICTIONARY, Variant::DICTIONARY);
+ register_op<OperatorEvaluatorEqual<Array, Array>>(Variant::OP_EQUAL, Variant::ARRAY, Variant::ARRAY);
+ register_op<OperatorEvaluatorEqual<PackedByteArray, PackedByteArray>>(Variant::OP_EQUAL, Variant::PACKED_BYTE_ARRAY, Variant::PACKED_BYTE_ARRAY);
+ register_op<OperatorEvaluatorEqual<PackedInt32Array, PackedInt32Array>>(Variant::OP_EQUAL, Variant::PACKED_INT32_ARRAY, Variant::PACKED_INT32_ARRAY);
+ register_op<OperatorEvaluatorEqual<PackedInt64Array, PackedInt64Array>>(Variant::OP_EQUAL, Variant::PACKED_INT64_ARRAY, Variant::PACKED_INT64_ARRAY);
+ register_op<OperatorEvaluatorEqual<PackedFloat32Array, PackedFloat32Array>>(Variant::OP_EQUAL, Variant::PACKED_FLOAT32_ARRAY, Variant::PACKED_FLOAT32_ARRAY);
+ register_op<OperatorEvaluatorEqual<PackedFloat64Array, PackedFloat64Array>>(Variant::OP_EQUAL, Variant::PACKED_FLOAT64_ARRAY, Variant::PACKED_FLOAT64_ARRAY);
+ register_op<OperatorEvaluatorEqual<PackedStringArray, PackedStringArray>>(Variant::OP_EQUAL, Variant::PACKED_STRING_ARRAY, Variant::PACKED_STRING_ARRAY);
+ register_op<OperatorEvaluatorEqual<PackedVector2Array, PackedVector2Array>>(Variant::OP_EQUAL, Variant::PACKED_VECTOR2_ARRAY, Variant::PACKED_VECTOR2_ARRAY);
+ register_op<OperatorEvaluatorEqual<PackedVector3Array, PackedVector3Array>>(Variant::OP_EQUAL, Variant::PACKED_VECTOR3_ARRAY, Variant::PACKED_VECTOR3_ARRAY);
+ register_op<OperatorEvaluatorEqual<PackedColorArray, PackedColorArray>>(Variant::OP_EQUAL, Variant::PACKED_COLOR_ARRAY, Variant::PACKED_COLOR_ARRAY);
+
+ register_op<OperatorEvaluatorAlwaysFalse<Variant::OP_NOT_EQUAL, Variant::NIL, Variant::NIL>>(Variant::OP_NOT_EQUAL, Variant::NIL, Variant::NIL);
+ register_op<OperatorEvaluatorNotEqual<bool, bool>>(Variant::OP_NOT_EQUAL, Variant::BOOL, Variant::BOOL);
+ register_op<OperatorEvaluatorNotEqual<int64_t, int64_t>>(Variant::OP_NOT_EQUAL, Variant::INT, Variant::INT);
+ register_op<OperatorEvaluatorNotEqual<int64_t, double>>(Variant::OP_NOT_EQUAL, Variant::INT, Variant::FLOAT);
+ register_op<OperatorEvaluatorNotEqual<double, int64_t>>(Variant::OP_NOT_EQUAL, Variant::FLOAT, Variant::INT);
+ register_op<OperatorEvaluatorNotEqual<double, double>>(Variant::OP_NOT_EQUAL, Variant::FLOAT, Variant::FLOAT);
+ register_op<OperatorEvaluatorNotEqual<String, String>>(Variant::OP_NOT_EQUAL, Variant::STRING, Variant::STRING);
+ register_op<OperatorEvaluatorNotEqual<Vector2, Vector2>>(Variant::OP_NOT_EQUAL, Variant::VECTOR2, Variant::VECTOR2);
+ register_op<OperatorEvaluatorNotEqual<Vector2i, Vector2i>>(Variant::OP_NOT_EQUAL, Variant::VECTOR2I, Variant::VECTOR2I);
+ register_op<OperatorEvaluatorNotEqual<Rect2, Rect2>>(Variant::OP_NOT_EQUAL, Variant::RECT2, Variant::RECT2);
+ register_op<OperatorEvaluatorNotEqual<Rect2i, Rect2i>>(Variant::OP_NOT_EQUAL, Variant::RECT2I, Variant::RECT2I);
+ register_op<OperatorEvaluatorNotEqual<Vector3, Vector3>>(Variant::OP_NOT_EQUAL, Variant::VECTOR3, Variant::VECTOR3);
+ register_op<OperatorEvaluatorNotEqual<Vector3i, Vector3i>>(Variant::OP_NOT_EQUAL, Variant::VECTOR3I, Variant::VECTOR3I);
+ register_op<OperatorEvaluatorNotEqual<Transform2D, Transform2D>>(Variant::OP_NOT_EQUAL, Variant::TRANSFORM2D, Variant::TRANSFORM2D);
+ register_op<OperatorEvaluatorNotEqual<Plane, Plane>>(Variant::OP_NOT_EQUAL, Variant::PLANE, Variant::PLANE);
+ register_op<OperatorEvaluatorNotEqual<Quat, Quat>>(Variant::OP_NOT_EQUAL, Variant::QUAT, Variant::QUAT);
+ register_op<OperatorEvaluatorNotEqual<::AABB, ::AABB>>(Variant::OP_NOT_EQUAL, Variant::AABB, Variant::AABB);
+ register_op<OperatorEvaluatorNotEqual<Basis, Basis>>(Variant::OP_NOT_EQUAL, Variant::BASIS, Variant::BASIS);
+ register_op<OperatorEvaluatorNotEqual<Transform, Transform>>(Variant::OP_NOT_EQUAL, Variant::TRANSFORM, Variant::TRANSFORM);
+ register_op<OperatorEvaluatorNotEqual<Color, Color>>(Variant::OP_NOT_EQUAL, Variant::COLOR, Variant::COLOR);
+
+ register_op<OperatorEvaluatorNotEqual<StringName, String>>(Variant::OP_NOT_EQUAL, Variant::STRING_NAME, Variant::STRING);
+ register_op<OperatorEvaluatorNotEqual<String, StringName>>(Variant::OP_NOT_EQUAL, Variant::STRING, Variant::STRING_NAME);
+ register_op<OperatorEvaluatorNotEqual<StringName, StringName>>(Variant::OP_NOT_EQUAL, Variant::STRING_NAME, Variant::STRING_NAME);
+
+ register_op<OperatorEvaluatorNotEqual<NodePath, NodePath>>(Variant::OP_NOT_EQUAL, Variant::NODE_PATH, Variant::NODE_PATH);
+ register_op<OperatorEvaluatorNotEqual<::RID, ::RID>>(Variant::OP_NOT_EQUAL, Variant::RID, Variant::RID);
+
+ register_op<OperatorEvaluatorNotEqualObject>(Variant::OP_NOT_EQUAL, Variant::OBJECT, Variant::OBJECT);
+ register_op<OperatorEvaluatorNotEqualObjectNil>(Variant::OP_NOT_EQUAL, Variant::OBJECT, Variant::NIL);
+ register_op<OperatorEvaluatorNotEqualNilObject>(Variant::OP_NOT_EQUAL, Variant::NIL, Variant::OBJECT);
+
+ register_op<OperatorEvaluatorNotEqual<Callable, Callable>>(Variant::OP_NOT_EQUAL, Variant::CALLABLE, Variant::CALLABLE);
+ register_op<OperatorEvaluatorNotEqual<Signal, Signal>>(Variant::OP_NOT_EQUAL, Variant::SIGNAL, Variant::SIGNAL);
+ register_op<OperatorEvaluatorNotEqual<Dictionary, Dictionary>>(Variant::OP_NOT_EQUAL, Variant::DICTIONARY, Variant::DICTIONARY);
+ register_op<OperatorEvaluatorNotEqual<Array, Array>>(Variant::OP_NOT_EQUAL, Variant::ARRAY, Variant::ARRAY);
+ register_op<OperatorEvaluatorNotEqual<PackedByteArray, PackedByteArray>>(Variant::OP_NOT_EQUAL, Variant::PACKED_BYTE_ARRAY, Variant::PACKED_BYTE_ARRAY);
+ register_op<OperatorEvaluatorNotEqual<PackedInt32Array, PackedInt32Array>>(Variant::OP_NOT_EQUAL, Variant::PACKED_INT32_ARRAY, Variant::PACKED_INT32_ARRAY);
+ register_op<OperatorEvaluatorNotEqual<PackedInt64Array, PackedInt64Array>>(Variant::OP_NOT_EQUAL, Variant::PACKED_INT64_ARRAY, Variant::PACKED_INT64_ARRAY);
+ register_op<OperatorEvaluatorNotEqual<PackedFloat32Array, PackedFloat32Array>>(Variant::OP_NOT_EQUAL, Variant::PACKED_FLOAT32_ARRAY, Variant::PACKED_FLOAT32_ARRAY);
+ register_op<OperatorEvaluatorNotEqual<PackedFloat64Array, PackedFloat64Array>>(Variant::OP_NOT_EQUAL, Variant::PACKED_FLOAT64_ARRAY, Variant::PACKED_FLOAT64_ARRAY);
+ register_op<OperatorEvaluatorNotEqual<PackedStringArray, PackedStringArray>>(Variant::OP_NOT_EQUAL, Variant::PACKED_STRING_ARRAY, Variant::PACKED_STRING_ARRAY);
+ register_op<OperatorEvaluatorNotEqual<PackedVector2Array, PackedVector2Array>>(Variant::OP_NOT_EQUAL, Variant::PACKED_VECTOR2_ARRAY, Variant::PACKED_VECTOR2_ARRAY);
+ register_op<OperatorEvaluatorNotEqual<PackedVector3Array, PackedVector3Array>>(Variant::OP_NOT_EQUAL, Variant::PACKED_VECTOR3_ARRAY, Variant::PACKED_VECTOR3_ARRAY);
+ register_op<OperatorEvaluatorNotEqual<PackedColorArray, PackedColorArray>>(Variant::OP_NOT_EQUAL, Variant::PACKED_COLOR_ARRAY, Variant::PACKED_COLOR_ARRAY);
+
+ register_op<OperatorEvaluatorLess<bool, bool>>(Variant::OP_LESS, Variant::BOOL, Variant::BOOL);
+ register_op<OperatorEvaluatorLess<int64_t, int64_t>>(Variant::OP_LESS, Variant::INT, Variant::INT);
+ register_op<OperatorEvaluatorLess<int64_t, double>>(Variant::OP_LESS, Variant::INT, Variant::FLOAT);
+ register_op<OperatorEvaluatorLess<double, int64_t>>(Variant::OP_LESS, Variant::FLOAT, Variant::INT);
+ register_op<OperatorEvaluatorLess<double, double>>(Variant::OP_LESS, Variant::FLOAT, Variant::FLOAT);
+ register_op<OperatorEvaluatorLess<String, String>>(Variant::OP_LESS, Variant::STRING, Variant::STRING);
+ register_op<OperatorEvaluatorLess<Vector2, Vector2>>(Variant::OP_LESS, Variant::VECTOR2, Variant::VECTOR2);
+ register_op<OperatorEvaluatorLess<Vector2i, Vector2i>>(Variant::OP_LESS, Variant::VECTOR2I, Variant::VECTOR2I);
+ register_op<OperatorEvaluatorLess<Vector3, Vector3>>(Variant::OP_LESS, Variant::VECTOR3, Variant::VECTOR3);
+ register_op<OperatorEvaluatorLess<Vector3i, Vector3i>>(Variant::OP_LESS, Variant::VECTOR3I, Variant::VECTOR3I);
+ register_op<OperatorEvaluatorLess<::RID, ::RID>>(Variant::OP_LESS, Variant::RID, Variant::RID);
+ register_op<OperatorEvaluatorLess<Array, Array>>(Variant::OP_LESS, Variant::ARRAY, Variant::ARRAY);
+
+ register_op<OperatorEvaluatorLessEqual<int64_t, int64_t>>(Variant::OP_LESS_EQUAL, Variant::INT, Variant::INT);
+ register_op<OperatorEvaluatorLessEqual<int64_t, double>>(Variant::OP_LESS_EQUAL, Variant::INT, Variant::FLOAT);
+ register_op<OperatorEvaluatorLessEqual<double, int64_t>>(Variant::OP_LESS_EQUAL, Variant::FLOAT, Variant::INT);
+ register_op<OperatorEvaluatorLessEqual<double, double>>(Variant::OP_LESS_EQUAL, Variant::FLOAT, Variant::FLOAT);
+ register_op<OperatorEvaluatorLessEqual<String, String>>(Variant::OP_LESS_EQUAL, Variant::STRING, Variant::STRING);
+ register_op<OperatorEvaluatorLessEqual<Vector2, Vector2>>(Variant::OP_LESS_EQUAL, Variant::VECTOR2, Variant::VECTOR2);
+ register_op<OperatorEvaluatorLessEqual<Vector2i, Vector2i>>(Variant::OP_LESS_EQUAL, Variant::VECTOR2I, Variant::VECTOR2I);
+ register_op<OperatorEvaluatorLessEqual<Vector3, Vector3>>(Variant::OP_LESS_EQUAL, Variant::VECTOR3, Variant::VECTOR3);
+ register_op<OperatorEvaluatorLessEqual<Vector3i, Vector3i>>(Variant::OP_LESS_EQUAL, Variant::VECTOR3I, Variant::VECTOR3I);
+ register_op<OperatorEvaluatorLessEqual<::RID, ::RID>>(Variant::OP_LESS_EQUAL, Variant::RID, Variant::RID);
+ register_op<OperatorEvaluatorLessEqual<Array, Array>>(Variant::OP_LESS_EQUAL, Variant::ARRAY, Variant::ARRAY);
+
+ register_op<OperatorEvaluatorGreater<bool, bool>>(Variant::OP_GREATER, Variant::BOOL, Variant::BOOL);
+ register_op<OperatorEvaluatorGreater<int64_t, int64_t>>(Variant::OP_GREATER, Variant::INT, Variant::INT);
+ register_op<OperatorEvaluatorGreater<int64_t, double>>(Variant::OP_GREATER, Variant::INT, Variant::FLOAT);
+ register_op<OperatorEvaluatorGreater<double, int64_t>>(Variant::OP_GREATER, Variant::FLOAT, Variant::INT);
+ register_op<OperatorEvaluatorGreater<double, double>>(Variant::OP_GREATER, Variant::FLOAT, Variant::FLOAT);
+ register_op<OperatorEvaluatorGreater<String, String>>(Variant::OP_GREATER, Variant::STRING, Variant::STRING);
+ register_op<OperatorEvaluatorGreater<Vector2, Vector2>>(Variant::OP_GREATER, Variant::VECTOR2, Variant::VECTOR2);
+ register_op<OperatorEvaluatorGreater<Vector2i, Vector2i>>(Variant::OP_GREATER, Variant::VECTOR2I, Variant::VECTOR2I);
+ register_op<OperatorEvaluatorGreater<Vector3, Vector3>>(Variant::OP_GREATER, Variant::VECTOR3, Variant::VECTOR3);
+ register_op<OperatorEvaluatorGreater<Vector3i, Vector3i>>(Variant::OP_GREATER, Variant::VECTOR3I, Variant::VECTOR3I);
+ register_op<OperatorEvaluatorGreater<::RID, ::RID>>(Variant::OP_GREATER, Variant::RID, Variant::RID);
+ register_op<OperatorEvaluatorGreater<Array, Array>>(Variant::OP_GREATER, Variant::ARRAY, Variant::ARRAY);
+
+ register_op<OperatorEvaluatorGreaterEqual<int64_t, int64_t>>(Variant::OP_GREATER_EQUAL, Variant::INT, Variant::INT);
+ register_op<OperatorEvaluatorGreaterEqual<int64_t, double>>(Variant::OP_GREATER_EQUAL, Variant::INT, Variant::FLOAT);
+ register_op<OperatorEvaluatorGreaterEqual<double, int64_t>>(Variant::OP_GREATER_EQUAL, Variant::FLOAT, Variant::INT);
+ register_op<OperatorEvaluatorGreaterEqual<double, double>>(Variant::OP_GREATER_EQUAL, Variant::FLOAT, Variant::FLOAT);
+ register_op<OperatorEvaluatorGreaterEqual<String, String>>(Variant::OP_GREATER_EQUAL, Variant::STRING, Variant::STRING);
+ register_op<OperatorEvaluatorGreaterEqual<Vector2, Vector2>>(Variant::OP_GREATER_EQUAL, Variant::VECTOR2, Variant::VECTOR2);
+ register_op<OperatorEvaluatorGreaterEqual<Vector2i, Vector2i>>(Variant::OP_GREATER_EQUAL, Variant::VECTOR2I, Variant::VECTOR2I);
+ register_op<OperatorEvaluatorGreaterEqual<Vector3, Vector3>>(Variant::OP_GREATER_EQUAL, Variant::VECTOR3, Variant::VECTOR3);
+ register_op<OperatorEvaluatorGreaterEqual<Vector3i, Vector3i>>(Variant::OP_GREATER_EQUAL, Variant::VECTOR3I, Variant::VECTOR3I);
+ register_op<OperatorEvaluatorGreaterEqual<::RID, ::RID>>(Variant::OP_GREATER_EQUAL, Variant::RID, Variant::RID);
+ register_op<OperatorEvaluatorGreaterEqual<Array, Array>>(Variant::OP_GREATER_EQUAL, Variant::ARRAY, Variant::ARRAY);
+
+ register_op<OperatorEvaluatorAlwaysFalse<Variant::OP_OR, Variant::NIL, Variant::NIL>>(Variant::OP_OR, Variant::NIL, Variant::NIL);
+
+ //OR
+ register_op<OperatorEvaluatorNilXBoolOr>(Variant::OP_OR, Variant::NIL, Variant::BOOL);
+ register_op<OperatorEvaluatorBoolXNilOr>(Variant::OP_OR, Variant::BOOL, Variant::NIL);
+ register_op<OperatorEvaluatorNilXIntOr>(Variant::OP_OR, Variant::NIL, Variant::INT);
+ register_op<OperatorEvaluatorIntXNilOr>(Variant::OP_OR, Variant::INT, Variant::NIL);
+ register_op<OperatorEvaluatorNilXFloatOr>(Variant::OP_OR, Variant::NIL, Variant::FLOAT);
+ register_op<OperatorEvaluatorFloatXNilOr>(Variant::OP_OR, Variant::FLOAT, Variant::NIL);
+ register_op<OperatorEvaluatorNilXObjectOr>(Variant::OP_OR, Variant::NIL, Variant::OBJECT);
+ register_op<OperatorEvaluatorObjectXNilOr>(Variant::OP_OR, Variant::OBJECT, Variant::NIL);
+
+ register_op<OperatorEvaluatorBoolXBoolOr>(Variant::OP_OR, Variant::BOOL, Variant::BOOL);
+ register_op<OperatorEvaluatorBoolXIntOr>(Variant::OP_OR, Variant::BOOL, Variant::INT);
+ register_op<OperatorEvaluatorIntXBoolOr>(Variant::OP_OR, Variant::INT, Variant::BOOL);
+ register_op<OperatorEvaluatorBoolXFloatOr>(Variant::OP_OR, Variant::BOOL, Variant::FLOAT);
+ register_op<OperatorEvaluatorFloatXBoolOr>(Variant::OP_OR, Variant::FLOAT, Variant::BOOL);
+ register_op<OperatorEvaluatorBoolXObjectOr>(Variant::OP_OR, Variant::BOOL, Variant::OBJECT);
+ register_op<OperatorEvaluatorObjectXBoolOr>(Variant::OP_OR, Variant::OBJECT, Variant::BOOL);
+
+ register_op<OperatorEvaluatorIntXIntOr>(Variant::OP_OR, Variant::INT, Variant::INT);
+ register_op<OperatorEvaluatorIntXFloatOr>(Variant::OP_OR, Variant::INT, Variant::FLOAT);
+ register_op<OperatorEvaluatorFloatXIntOr>(Variant::OP_OR, Variant::FLOAT, Variant::INT);
+ register_op<OperatorEvaluatorIntXObjectOr>(Variant::OP_OR, Variant::INT, Variant::OBJECT);
+ register_op<OperatorEvaluatorObjectXIntOr>(Variant::OP_OR, Variant::OBJECT, Variant::INT);
+
+ register_op<OperatorEvaluatorFloatXFloatOr>(Variant::OP_OR, Variant::FLOAT, Variant::FLOAT);
+ register_op<OperatorEvaluatorFloatXObjectOr>(Variant::OP_OR, Variant::FLOAT, Variant::OBJECT);
+ register_op<OperatorEvaluatorObjectXFloatOr>(Variant::OP_OR, Variant::OBJECT, Variant::FLOAT);
+ register_op<OperatorEvaluatorObjectXObjectOr>(Variant::OP_OR, Variant::OBJECT, Variant::OBJECT);
+ //AND
+ register_op<OperatorEvaluatorNilXBoolAnd>(Variant::OP_AND, Variant::NIL, Variant::BOOL);
+ register_op<OperatorEvaluatorBoolXNilAnd>(Variant::OP_AND, Variant::BOOL, Variant::NIL);
+ register_op<OperatorEvaluatorNilXIntAnd>(Variant::OP_AND, Variant::NIL, Variant::INT);
+ register_op<OperatorEvaluatorIntXNilAnd>(Variant::OP_AND, Variant::INT, Variant::NIL);
+ register_op<OperatorEvaluatorNilXFloatAnd>(Variant::OP_AND, Variant::NIL, Variant::FLOAT);
+ register_op<OperatorEvaluatorFloatXNilAnd>(Variant::OP_AND, Variant::FLOAT, Variant::NIL);
+ register_op<OperatorEvaluatorNilXObjectAnd>(Variant::OP_AND, Variant::NIL, Variant::OBJECT);
+ register_op<OperatorEvaluatorObjectXNilAnd>(Variant::OP_AND, Variant::OBJECT, Variant::NIL);
+
+ register_op<OperatorEvaluatorBoolXBoolAnd>(Variant::OP_AND, Variant::BOOL, Variant::BOOL);
+ register_op<OperatorEvaluatorBoolXIntAnd>(Variant::OP_AND, Variant::BOOL, Variant::INT);
+ register_op<OperatorEvaluatorIntXBoolAnd>(Variant::OP_AND, Variant::INT, Variant::BOOL);
+ register_op<OperatorEvaluatorBoolXFloatAnd>(Variant::OP_AND, Variant::BOOL, Variant::FLOAT);
+ register_op<OperatorEvaluatorFloatXBoolAnd>(Variant::OP_AND, Variant::FLOAT, Variant::BOOL);
+ register_op<OperatorEvaluatorBoolXObjectAnd>(Variant::OP_AND, Variant::BOOL, Variant::OBJECT);
+ register_op<OperatorEvaluatorObjectXBoolAnd>(Variant::OP_AND, Variant::OBJECT, Variant::BOOL);
+
+ register_op<OperatorEvaluatorIntXIntAnd>(Variant::OP_AND, Variant::INT, Variant::INT);
+ register_op<OperatorEvaluatorIntXFloatAnd>(Variant::OP_AND, Variant::INT, Variant::FLOAT);
+ register_op<OperatorEvaluatorFloatXIntAnd>(Variant::OP_AND, Variant::FLOAT, Variant::INT);
+ register_op<OperatorEvaluatorIntXObjectAnd>(Variant::OP_AND, Variant::INT, Variant::OBJECT);
+ register_op<OperatorEvaluatorObjectXIntAnd>(Variant::OP_AND, Variant::OBJECT, Variant::INT);
+
+ register_op<OperatorEvaluatorFloatXFloatAnd>(Variant::OP_AND, Variant::FLOAT, Variant::FLOAT);
+ register_op<OperatorEvaluatorFloatXObjectAnd>(Variant::OP_AND, Variant::FLOAT, Variant::OBJECT);
+ register_op<OperatorEvaluatorObjectXFloatAnd>(Variant::OP_AND, Variant::OBJECT, Variant::FLOAT);
+ register_op<OperatorEvaluatorObjectXObjectAnd>(Variant::OP_AND, Variant::OBJECT, Variant::OBJECT);
+ //XOR
+ register_op<OperatorEvaluatorNilXBoolXor>(Variant::OP_XOR, Variant::NIL, Variant::BOOL);
+ register_op<OperatorEvaluatorBoolXNilXor>(Variant::OP_XOR, Variant::BOOL, Variant::NIL);
+ register_op<OperatorEvaluatorNilXIntXor>(Variant::OP_XOR, Variant::NIL, Variant::INT);
+ register_op<OperatorEvaluatorIntXNilXor>(Variant::OP_XOR, Variant::INT, Variant::NIL);
+ register_op<OperatorEvaluatorNilXFloatXor>(Variant::OP_XOR, Variant::NIL, Variant::FLOAT);
+ register_op<OperatorEvaluatorFloatXNilXor>(Variant::OP_XOR, Variant::FLOAT, Variant::NIL);
+ register_op<OperatorEvaluatorNilXObjectXor>(Variant::OP_XOR, Variant::NIL, Variant::OBJECT);
+ register_op<OperatorEvaluatorObjectXNilXor>(Variant::OP_XOR, Variant::OBJECT, Variant::NIL);
+
+ register_op<OperatorEvaluatorBoolXBoolXor>(Variant::OP_XOR, Variant::BOOL, Variant::BOOL);
+ register_op<OperatorEvaluatorBoolXIntXor>(Variant::OP_XOR, Variant::BOOL, Variant::INT);
+ register_op<OperatorEvaluatorIntXBoolXor>(Variant::OP_XOR, Variant::INT, Variant::BOOL);
+ register_op<OperatorEvaluatorBoolXFloatXor>(Variant::OP_XOR, Variant::BOOL, Variant::FLOAT);
+ register_op<OperatorEvaluatorFloatXBoolXor>(Variant::OP_XOR, Variant::FLOAT, Variant::BOOL);
+ register_op<OperatorEvaluatorBoolXObjectXor>(Variant::OP_XOR, Variant::BOOL, Variant::OBJECT);
+ register_op<OperatorEvaluatorObjectXBoolXor>(Variant::OP_XOR, Variant::OBJECT, Variant::BOOL);
+
+ register_op<OperatorEvaluatorIntXIntXor>(Variant::OP_XOR, Variant::INT, Variant::INT);
+ register_op<OperatorEvaluatorIntXFloatXor>(Variant::OP_XOR, Variant::INT, Variant::FLOAT);
+ register_op<OperatorEvaluatorFloatXIntXor>(Variant::OP_XOR, Variant::FLOAT, Variant::INT);
+ register_op<OperatorEvaluatorIntXObjectXor>(Variant::OP_XOR, Variant::INT, Variant::OBJECT);
+ register_op<OperatorEvaluatorObjectXIntXor>(Variant::OP_XOR, Variant::OBJECT, Variant::INT);
+
+ register_op<OperatorEvaluatorFloatXFloatXor>(Variant::OP_XOR, Variant::FLOAT, Variant::FLOAT);
+ register_op<OperatorEvaluatorFloatXObjectXor>(Variant::OP_XOR, Variant::FLOAT, Variant::OBJECT);
+ register_op<OperatorEvaluatorObjectXFloatXor>(Variant::OP_XOR, Variant::OBJECT, Variant::FLOAT);
+ register_op<OperatorEvaluatorObjectXObjectXor>(Variant::OP_XOR, Variant::OBJECT, Variant::OBJECT);
+
+ register_op<OperatorEvaluatorAlwaysTrue<Variant::OP_NOT, Variant::NIL, Variant::NIL>>(Variant::OP_NOT, Variant::NIL, Variant::NIL);
+ register_op<OperatorEvaluatorNotBool>(Variant::OP_NOT, Variant::BOOL, Variant::NIL);
+ register_op<OperatorEvaluatorNotInt>(Variant::OP_NOT, Variant::INT, Variant::NIL);
+ register_op<OperatorEvaluatorNotFloat>(Variant::OP_NOT, Variant::FLOAT, Variant::NIL);
+ register_op<OperatorEvaluatorNotObject>(Variant::OP_NOT, Variant::OBJECT, Variant::NIL);
+
+ register_op<OperatorEvaluatorInStringFind>(Variant::OP_IN, Variant::STRING, Variant::STRING);
+
+ register_op<OperatorEvaluatorInDictionaryHasNil>(Variant::OP_IN, Variant::NIL, Variant::DICTIONARY);
+ register_op<OperatorEvaluatorInDictionaryHas<bool>>(Variant::OP_IN, Variant::BOOL, Variant::DICTIONARY);
+ register_op<OperatorEvaluatorInDictionaryHas<int64_t>>(Variant::OP_IN, Variant::INT, Variant::DICTIONARY);
+ register_op<OperatorEvaluatorInDictionaryHas<double>>(Variant::OP_IN, Variant::FLOAT, Variant::DICTIONARY);
+ register_op<OperatorEvaluatorInDictionaryHas<String>>(Variant::OP_IN, Variant::STRING, Variant::DICTIONARY);
+ register_op<OperatorEvaluatorInDictionaryHas<Vector2>>(Variant::OP_IN, Variant::VECTOR2, Variant::DICTIONARY);
+ register_op<OperatorEvaluatorInDictionaryHas<Vector2i>>(Variant::OP_IN, Variant::VECTOR2I, Variant::DICTIONARY);
+ register_op<OperatorEvaluatorInDictionaryHas<Rect2>>(Variant::OP_IN, Variant::RECT2, Variant::DICTIONARY);
+ register_op<OperatorEvaluatorInDictionaryHas<Rect2i>>(Variant::OP_IN, Variant::RECT2I, Variant::DICTIONARY);
+ register_op<OperatorEvaluatorInDictionaryHas<Vector3>>(Variant::OP_IN, Variant::VECTOR3, Variant::DICTIONARY);
+ register_op<OperatorEvaluatorInDictionaryHas<Vector3i>>(Variant::OP_IN, Variant::VECTOR3I, Variant::DICTIONARY);
+ register_op<OperatorEvaluatorInDictionaryHas<Transform2D>>(Variant::OP_IN, Variant::TRANSFORM2D, Variant::DICTIONARY);
+ register_op<OperatorEvaluatorInDictionaryHas<Plane>>(Variant::OP_IN, Variant::PLANE, Variant::DICTIONARY);
+ register_op<OperatorEvaluatorInDictionaryHas<Quat>>(Variant::OP_IN, Variant::QUAT, Variant::DICTIONARY);
+ register_op<OperatorEvaluatorInDictionaryHas<::AABB>>(Variant::OP_IN, Variant::AABB, Variant::DICTIONARY);
+ register_op<OperatorEvaluatorInDictionaryHas<Basis>>(Variant::OP_IN, Variant::BASIS, Variant::DICTIONARY);
+ register_op<OperatorEvaluatorInDictionaryHas<Transform>>(Variant::OP_IN, Variant::TRANSFORM, Variant::DICTIONARY);
+
+ register_op<OperatorEvaluatorInDictionaryHas<Color>>(Variant::OP_IN, Variant::COLOR, Variant::DICTIONARY);
+ register_op<OperatorEvaluatorInDictionaryHas<StringName>>(Variant::OP_IN, Variant::STRING_NAME, Variant::DICTIONARY);
+ register_op<OperatorEvaluatorInDictionaryHas<NodePath>>(Variant::OP_IN, Variant::NODE_PATH, Variant::DICTIONARY);
+ register_op<OperatorEvaluatorInDictionaryHasObject>(Variant::OP_IN, Variant::OBJECT, Variant::DICTIONARY);
+ register_op<OperatorEvaluatorInDictionaryHas<Callable>>(Variant::OP_IN, Variant::CALLABLE, Variant::DICTIONARY);
+ register_op<OperatorEvaluatorInDictionaryHas<Signal>>(Variant::OP_IN, Variant::SIGNAL, Variant::DICTIONARY);
+ register_op<OperatorEvaluatorInDictionaryHas<Dictionary>>(Variant::OP_IN, Variant::DICTIONARY, Variant::DICTIONARY);
+ register_op<OperatorEvaluatorInDictionaryHas<Array>>(Variant::OP_IN, Variant::ARRAY, Variant::DICTIONARY);
+
+ register_op<OperatorEvaluatorInDictionaryHas<PackedByteArray>>(Variant::OP_IN, Variant::PACKED_BYTE_ARRAY, Variant::DICTIONARY);
+ register_op<OperatorEvaluatorInDictionaryHas<PackedInt32Array>>(Variant::OP_IN, Variant::PACKED_INT32_ARRAY, Variant::DICTIONARY);
+ register_op<OperatorEvaluatorInDictionaryHas<PackedInt64Array>>(Variant::OP_IN, Variant::PACKED_INT64_ARRAY, Variant::DICTIONARY);
+ register_op<OperatorEvaluatorInDictionaryHas<PackedFloat32Array>>(Variant::OP_IN, Variant::PACKED_FLOAT32_ARRAY, Variant::DICTIONARY);
+ register_op<OperatorEvaluatorInDictionaryHas<PackedFloat64Array>>(Variant::OP_IN, Variant::PACKED_FLOAT64_ARRAY, Variant::DICTIONARY);
+ register_op<OperatorEvaluatorInDictionaryHas<PackedStringArray>>(Variant::OP_IN, Variant::PACKED_STRING_ARRAY, Variant::DICTIONARY);
+ register_op<OperatorEvaluatorInDictionaryHas<PackedVector2Array>>(Variant::OP_IN, Variant::PACKED_VECTOR2_ARRAY, Variant::DICTIONARY);
+ register_op<OperatorEvaluatorInDictionaryHas<PackedVector3Array>>(Variant::OP_IN, Variant::PACKED_VECTOR3_ARRAY, Variant::DICTIONARY);
+ register_op<OperatorEvaluatorInDictionaryHas<PackedColorArray>>(Variant::OP_IN, Variant::PACKED_COLOR_ARRAY, Variant::DICTIONARY);
+
+ register_op<OperatorEvaluatorInArrayFindNil>(Variant::OP_IN, Variant::NIL, Variant::ARRAY);
+ register_op<OperatorEvaluatorInArrayFind<bool, Array>>(Variant::OP_IN, Variant::BOOL, Variant::ARRAY);
+ register_op<OperatorEvaluatorInArrayFind<int64_t, Array>>(Variant::OP_IN, Variant::INT, Variant::ARRAY);
+ register_op<OperatorEvaluatorInArrayFind<double, Array>>(Variant::OP_IN, Variant::FLOAT, Variant::ARRAY);
+ register_op<OperatorEvaluatorInArrayFind<String, Array>>(Variant::OP_IN, Variant::STRING, Variant::ARRAY);
+ register_op<OperatorEvaluatorInArrayFind<Vector2, Array>>(Variant::OP_IN, Variant::VECTOR2, Variant::ARRAY);
+ register_op<OperatorEvaluatorInArrayFind<Vector2i, Array>>(Variant::OP_IN, Variant::VECTOR2I, Variant::ARRAY);
+ register_op<OperatorEvaluatorInArrayFind<Rect2, Array>>(Variant::OP_IN, Variant::RECT2, Variant::ARRAY);
+ register_op<OperatorEvaluatorInArrayFind<Rect2i, Array>>(Variant::OP_IN, Variant::RECT2I, Variant::ARRAY);
+ register_op<OperatorEvaluatorInArrayFind<Vector3, Array>>(Variant::OP_IN, Variant::VECTOR3, Variant::ARRAY);
+ register_op<OperatorEvaluatorInArrayFind<Vector3i, Array>>(Variant::OP_IN, Variant::VECTOR3I, Variant::ARRAY);
+ register_op<OperatorEvaluatorInArrayFind<Transform2D, Array>>(Variant::OP_IN, Variant::TRANSFORM2D, Variant::ARRAY);
+ register_op<OperatorEvaluatorInArrayFind<Plane, Array>>(Variant::OP_IN, Variant::PLANE, Variant::ARRAY);
+ register_op<OperatorEvaluatorInArrayFind<Quat, Array>>(Variant::OP_IN, Variant::QUAT, Variant::ARRAY);
+ register_op<OperatorEvaluatorInArrayFind<::AABB, Array>>(Variant::OP_IN, Variant::AABB, Variant::ARRAY);
+ register_op<OperatorEvaluatorInArrayFind<Basis, Array>>(Variant::OP_IN, Variant::BASIS, Variant::ARRAY);
+ register_op<OperatorEvaluatorInArrayFind<Transform, Array>>(Variant::OP_IN, Variant::TRANSFORM, Variant::ARRAY);
+
+ register_op<OperatorEvaluatorInArrayFind<Color, Array>>(Variant::OP_IN, Variant::COLOR, Variant::ARRAY);
+ register_op<OperatorEvaluatorInArrayFind<StringName, Array>>(Variant::OP_IN, Variant::STRING_NAME, Variant::ARRAY);
+ register_op<OperatorEvaluatorInArrayFind<NodePath, Array>>(Variant::OP_IN, Variant::NODE_PATH, Variant::ARRAY);
+ register_op<OperatorEvaluatorInArrayFindObject>(Variant::OP_IN, Variant::OBJECT, Variant::ARRAY);
+ register_op<OperatorEvaluatorInArrayFind<Callable, Array>>(Variant::OP_IN, Variant::CALLABLE, Variant::ARRAY);
+ register_op<OperatorEvaluatorInArrayFind<Signal, Array>>(Variant::OP_IN, Variant::SIGNAL, Variant::ARRAY);
+ register_op<OperatorEvaluatorInArrayFind<Dictionary, Array>>(Variant::OP_IN, Variant::DICTIONARY, Variant::ARRAY);
+ register_op<OperatorEvaluatorInArrayFind<Array, Array>>(Variant::OP_IN, Variant::ARRAY, Variant::ARRAY);
+
+ register_op<OperatorEvaluatorInArrayFind<PackedByteArray, Array>>(Variant::OP_IN, Variant::PACKED_BYTE_ARRAY, Variant::ARRAY);
+ register_op<OperatorEvaluatorInArrayFind<PackedInt32Array, Array>>(Variant::OP_IN, Variant::PACKED_INT32_ARRAY, Variant::ARRAY);
+ register_op<OperatorEvaluatorInArrayFind<PackedInt64Array, Array>>(Variant::OP_IN, Variant::PACKED_INT64_ARRAY, Variant::ARRAY);
+ register_op<OperatorEvaluatorInArrayFind<PackedFloat32Array, Array>>(Variant::OP_IN, Variant::PACKED_FLOAT32_ARRAY, Variant::ARRAY);
+ register_op<OperatorEvaluatorInArrayFind<PackedFloat64Array, Array>>(Variant::OP_IN, Variant::PACKED_FLOAT64_ARRAY, Variant::ARRAY);
+ register_op<OperatorEvaluatorInArrayFind<PackedStringArray, Array>>(Variant::OP_IN, Variant::PACKED_STRING_ARRAY, Variant::ARRAY);
+ register_op<OperatorEvaluatorInArrayFind<PackedVector2Array, Array>>(Variant::OP_IN, Variant::PACKED_VECTOR2_ARRAY, Variant::ARRAY);
+ register_op<OperatorEvaluatorInArrayFind<PackedVector3Array, Array>>(Variant::OP_IN, Variant::PACKED_VECTOR3_ARRAY, Variant::ARRAY);
+ register_op<OperatorEvaluatorInArrayFind<PackedColorArray, Array>>(Variant::OP_IN, Variant::PACKED_COLOR_ARRAY, Variant::ARRAY);
+
+ register_op<OperatorEvaluatorInArrayFind<int, PackedByteArray>>(Variant::OP_IN, Variant::INT, Variant::PACKED_BYTE_ARRAY);
+ register_op<OperatorEvaluatorInArrayFind<float, PackedByteArray>>(Variant::OP_IN, Variant::FLOAT, Variant::PACKED_BYTE_ARRAY);
+
+ register_op<OperatorEvaluatorInArrayFind<int, PackedInt32Array>>(Variant::OP_IN, Variant::INT, Variant::PACKED_INT32_ARRAY);
+ register_op<OperatorEvaluatorInArrayFind<float, PackedInt32Array>>(Variant::OP_IN, Variant::FLOAT, Variant::PACKED_INT32_ARRAY);
+
+ register_op<OperatorEvaluatorInArrayFind<int, PackedInt64Array>>(Variant::OP_IN, Variant::INT, Variant::PACKED_INT64_ARRAY);
+ register_op<OperatorEvaluatorInArrayFind<float, PackedInt64Array>>(Variant::OP_IN, Variant::FLOAT, Variant::PACKED_INT64_ARRAY);
+
+ register_op<OperatorEvaluatorInArrayFind<int, PackedFloat32Array>>(Variant::OP_IN, Variant::INT, Variant::PACKED_FLOAT32_ARRAY);
+ register_op<OperatorEvaluatorInArrayFind<float, PackedFloat32Array>>(Variant::OP_IN, Variant::FLOAT, Variant::PACKED_FLOAT32_ARRAY);
+
+ register_op<OperatorEvaluatorInArrayFind<int, PackedFloat64Array>>(Variant::OP_IN, Variant::INT, Variant::PACKED_FLOAT64_ARRAY);
+ register_op<OperatorEvaluatorInArrayFind<float, PackedFloat64Array>>(Variant::OP_IN, Variant::FLOAT, Variant::PACKED_FLOAT64_ARRAY);
+
+ register_op<OperatorEvaluatorInArrayFind<String, PackedStringArray>>(Variant::OP_IN, Variant::STRING, Variant::PACKED_STRING_ARRAY);
+
+ register_op<OperatorEvaluatorInArrayFind<Vector2, PackedVector2Array>>(Variant::OP_IN, Variant::VECTOR2, Variant::PACKED_VECTOR2_ARRAY);
+ register_op<OperatorEvaluatorInArrayFind<Vector3, PackedVector3Array>>(Variant::OP_IN, Variant::VECTOR3, Variant::PACKED_VECTOR3_ARRAY);
+
+ register_op<OperatorEvaluatorInArrayFind<Color, PackedColorArray>>(Variant::OP_IN, Variant::COLOR, Variant::PACKED_COLOR_ARRAY);
+
+ register_op<OperatorEvaluatorObjectHasPropertyString>(Variant::OP_IN, Variant::STRING, Variant::OBJECT);
+ register_op<OperatorEvaluatorObjectHasPropertyStringName>(Variant::OP_IN, Variant::STRING_NAME, Variant::OBJECT);
+}
+
+void Variant::_unregister_variant_operators() {
+}
+
+void Variant::evaluate(const Operator &p_op, const Variant &p_a,
+ const Variant &p_b, Variant &r_ret, bool &r_valid) {
+ ERR_FAIL_INDEX(p_op, Variant::OP_MAX);
+ Variant::Type type_a = p_a.get_type();
+ Variant::Type type_b = p_b.get_type();
+ ERR_FAIL_INDEX(type_a, Variant::VARIANT_MAX);
+ ERR_FAIL_INDEX(type_b, Variant::VARIANT_MAX);
+
+ VariantEvaluatorFunction ev = operator_evaluator_table[p_op][type_a][type_b];
+ if (unlikely(!ev)) {
+ r_valid = false;
+ r_ret = Variant();
+ return;
+ }
+
+ ev(p_a, p_b, &r_ret, r_valid);
+}
+
+Variant::Type Variant::get_operator_return_type(Operator p_operator, Type p_type_a, Type p_type_b) {
+ ERR_FAIL_INDEX_V(p_operator, Variant::OP_MAX, Variant::NIL);
+ ERR_FAIL_INDEX_V(p_type_a, Variant::VARIANT_MAX, Variant::NIL);
+ ERR_FAIL_INDEX_V(p_type_b, Variant::VARIANT_MAX, Variant::NIL);
+
+ return operator_return_type_table[p_operator][p_type_a][p_type_b];
+}
+
+Variant::ValidatedOperatorEvaluator Variant::get_validated_operator_evaluator(Operator p_operator, Type p_type_a, Type p_type_b) {
+ ERR_FAIL_INDEX_V(p_operator, Variant::OP_MAX, nullptr);
+ ERR_FAIL_INDEX_V(p_type_a, Variant::VARIANT_MAX, nullptr);
+ ERR_FAIL_INDEX_V(p_type_b, Variant::VARIANT_MAX, nullptr);
+ return validated_operator_evaluator_table[p_operator][p_type_a][p_type_b];
+}
+#ifdef PTRCALL_ENABLED
+Variant::PTROperatorEvaluator Variant::get_ptr_operator_evaluator(Operator p_operator, Type p_type_a, Type p_type_b) {
+ ERR_FAIL_INDEX_V(p_operator, Variant::OP_MAX, nullptr);
+ ERR_FAIL_INDEX_V(p_type_a, Variant::VARIANT_MAX, nullptr);
+ ERR_FAIL_INDEX_V(p_type_b, Variant::VARIANT_MAX, nullptr);
+ return ptr_operator_evaluator_table[p_operator][p_type_a][p_type_b];
+}
+
+#endif
+
+static const char *_op_names[Variant::OP_MAX] = {
+ "==",
+ "!=",
+ "<",
+ "<=",
+ ">",
+ ">=",
+ "+",
+ "-",
+ "*",
+ "/",
+ "-",
+ "+",
+ "%",
+ "<<",
+ ">>",
+ "&",
+ "|",
+ "^",
+ "~",
+ "and",
+ "or",
+ "xor",
+ "not",
+ "in"
+
+};
+
+String Variant::get_operator_name(Operator p_op) {
+ ERR_FAIL_INDEX_V(p_op, OP_MAX, "");
+ return _op_names[p_op];
+}
+
+Variant::operator bool() const {
+ return booleanize();
+}
+
+// We consider all uninitialized or empty types to be false based on the type's
+// zeroiness.
+bool Variant::booleanize() const {
+ return !is_zero();
+}
+
+bool Variant::in(const Variant &p_index, bool *r_valid) const {
+ bool valid;
+ Variant ret;
+ evaluate(OP_IN, p_index, *this, ret, valid);
+ if (r_valid) {
+ *r_valid = valid;
+ return false;
+ }
+ ERR_FAIL_COND_V(ret.type != BOOL, false);
+ return *VariantGetInternalPtr<bool>::get_ptr(&ret);
+}
diff --git a/core/variant_parser.cpp b/core/variant/variant_parser.cpp
index 04cd4c1b9b..5a0bbf041b 100644
--- a/core/variant_parser.cpp
+++ b/core/variant/variant_parser.cpp
@@ -33,7 +33,7 @@
#include "core/input/input_event.h"
#include "core/io/resource_loader.h"
#include "core/os/keyboard.h"
-#include "core/string_buffer.h"
+#include "core/string/string_buffer.h"
char32_t VariantParser::StreamFile::get_char() {
return f->get_8();
diff --git a/core/variant_parser.h b/core/variant/variant_parser.h
index 12329e2db6..59d18a8b9f 100644
--- a/core/variant_parser.h
+++ b/core/variant/variant_parser.h
@@ -31,9 +31,9 @@
#ifndef VARIANT_PARSER_H
#define VARIANT_PARSER_H
+#include "core/io/resource.h"
#include "core/os/file_access.h"
-#include "core/resource.h"
-#include "core/variant.h"
+#include "core/variant/variant.h"
class VariantParser {
public:
diff --git a/core/variant/variant_setget.cpp b/core/variant/variant_setget.cpp
new file mode 100644
index 0000000000..05fe2b80d9
--- /dev/null
+++ b/core/variant/variant_setget.cpp
@@ -0,0 +1,2587 @@
+/*************************************************************************/
+/* variant_setget.cpp */
+/*************************************************************************/
+/* This file is part of: */
+/* GODOT ENGINE */
+/* https://godotengine.org */
+/*************************************************************************/
+/* Copyright (c) 2007-2020 Juan Linietsky, Ariel Manzur. */
+/* Copyright (c) 2014-2020 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 "variant.h"
+
+#include "core/core_string_names.h"
+#include "core/debugger/engine_debugger.h"
+#include "core/object/class_db.h"
+#include "core/templates/local_vector.h"
+#include "core/variant/variant_internal.h"
+
+/**** NAMED SETTERS AND GETTERS ****/
+
+#define SETGET_STRUCT(m_base_type, m_member_type, m_member) \
+ struct VariantSetGet_##m_base_type##_##m_member { \
+ static void get(const Variant *base, Variant *member) { \
+ *member = VariantGetInternalPtr<m_base_type>::get_ptr(base)->m_member; \
+ } \
+ static void validated_get(const Variant *base, Variant *member) { \
+ *VariantGetInternalPtr<m_member_type>::get_ptr(member) = VariantGetInternalPtr<m_base_type>::get_ptr(base)->m_member; \
+ } \
+ static void ptr_get(const void *base, void *member) { \
+ PtrToArg<m_member_type>::encode(PtrToArg<m_base_type>::convert(base).m_member, member); \
+ } \
+ static void set(Variant *base, const Variant *value, bool &valid) { \
+ if (value->get_type() == GetTypeInfo<m_member_type>::VARIANT_TYPE) { \
+ VariantGetInternalPtr<m_base_type>::get_ptr(base)->m_member = *VariantGetInternalPtr<m_member_type>::get_ptr(value); \
+ valid = true; \
+ } else { \
+ valid = false; \
+ } \
+ } \
+ static void validated_set(Variant *base, const Variant *value) { \
+ VariantGetInternalPtr<m_base_type>::get_ptr(base)->m_member = *VariantGetInternalPtr<m_member_type>::get_ptr(value); \
+ } \
+ static void ptr_set(void *base, const void *member) { \
+ m_base_type b = PtrToArg<m_base_type>::convert(base); \
+ b.m_member = PtrToArg<m_member_type>::convert(member); \
+ PtrToArg<m_base_type>::encode(b, base); \
+ } \
+ static Variant::Type get_type() { return GetTypeInfo<m_member_type>::VARIANT_TYPE; } \
+ };
+
+#define SETGET_NUMBER_STRUCT(m_base_type, m_member_type, m_member) \
+ struct VariantSetGet_##m_base_type##_##m_member { \
+ static void get(const Variant *base, Variant *member) { \
+ *member = VariantGetInternalPtr<m_base_type>::get_ptr(base)->m_member; \
+ } \
+ static void validated_get(const Variant *base, Variant *member) { \
+ *VariantGetInternalPtr<m_member_type>::get_ptr(member) = VariantGetInternalPtr<m_base_type>::get_ptr(base)->m_member; \
+ } \
+ static void ptr_get(const void *base, void *member) { \
+ PtrToArg<m_member_type>::encode(PtrToArg<m_base_type>::convert(base).m_member, member); \
+ } \
+ static void set(Variant *base, const Variant *value, bool &valid) { \
+ if (value->get_type() == Variant::FLOAT) { \
+ VariantGetInternalPtr<m_base_type>::get_ptr(base)->m_member = *VariantGetInternalPtr<double>::get_ptr(value); \
+ valid = true; \
+ } else if (value->get_type() == Variant::INT) { \
+ VariantGetInternalPtr<m_base_type>::get_ptr(base)->m_member = *VariantGetInternalPtr<int64_t>::get_ptr(value); \
+ valid = true; \
+ } else { \
+ valid = false; \
+ } \
+ } \
+ static void validated_set(Variant *base, const Variant *value) { \
+ VariantGetInternalPtr<m_base_type>::get_ptr(base)->m_member = *VariantGetInternalPtr<m_member_type>::get_ptr(value); \
+ } \
+ static void ptr_set(void *base, const void *member) { \
+ m_base_type b = PtrToArg<m_base_type>::convert(base); \
+ b.m_member = PtrToArg<m_member_type>::convert(member); \
+ PtrToArg<m_base_type>::encode(b, base); \
+ } \
+ static Variant::Type get_type() { return GetTypeInfo<m_member_type>::VARIANT_TYPE; } \
+ };
+
+#define SETGET_STRUCT_CUSTOM(m_base_type, m_member_type, m_member, m_custom) \
+ struct VariantSetGet_##m_base_type##_##m_member { \
+ static void get(const Variant *base, Variant *member) { \
+ *member = VariantGetInternalPtr<m_base_type>::get_ptr(base)->m_custom; \
+ } \
+ static void validated_get(const Variant *base, Variant *member) { \
+ *VariantGetInternalPtr<m_member_type>::get_ptr(member) = VariantGetInternalPtr<m_base_type>::get_ptr(base)->m_custom; \
+ } \
+ static void ptr_get(const void *base, void *member) { \
+ PtrToArg<m_member_type>::encode(PtrToArg<m_base_type>::convert(base).m_custom, member); \
+ } \
+ static void set(Variant *base, const Variant *value, bool &valid) { \
+ if (value->get_type() == GetTypeInfo<m_member_type>::VARIANT_TYPE) { \
+ VariantGetInternalPtr<m_base_type>::get_ptr(base)->m_custom = *VariantGetInternalPtr<m_member_type>::get_ptr(value); \
+ valid = true; \
+ } else { \
+ valid = false; \
+ } \
+ } \
+ static void validated_set(Variant *base, const Variant *value) { \
+ VariantGetInternalPtr<m_base_type>::get_ptr(base)->m_custom = *VariantGetInternalPtr<m_member_type>::get_ptr(value); \
+ } \
+ static void ptr_set(void *base, const void *member) { \
+ m_base_type b = PtrToArg<m_base_type>::convert(base); \
+ b.m_custom = PtrToArg<m_member_type>::convert(member); \
+ PtrToArg<m_base_type>::encode(b, base); \
+ } \
+ static Variant::Type get_type() { return GetTypeInfo<m_member_type>::VARIANT_TYPE; } \
+ };
+
+#define SETGET_NUMBER_STRUCT_CUSTOM(m_base_type, m_member_type, m_member, m_custom) \
+ struct VariantSetGet_##m_base_type##_##m_member { \
+ static void get(const Variant *base, Variant *member) { \
+ *member = VariantGetInternalPtr<m_base_type>::get_ptr(base)->m_custom; \
+ } \
+ static void validated_get(const Variant *base, Variant *member) { \
+ *VariantGetInternalPtr<m_member_type>::get_ptr(member) = VariantGetInternalPtr<m_base_type>::get_ptr(base)->m_custom; \
+ } \
+ static void ptr_get(const void *base, void *member) { \
+ PtrToArg<m_member_type>::encode(PtrToArg<m_base_type>::convert(base).m_custom, member); \
+ } \
+ static void set(Variant *base, const Variant *value, bool &valid) { \
+ if (value->get_type() == Variant::FLOAT) { \
+ VariantGetInternalPtr<m_base_type>::get_ptr(base)->m_custom = *VariantGetInternalPtr<double>::get_ptr(value); \
+ valid = true; \
+ } else if (value->get_type() == Variant::INT) { \
+ VariantGetInternalPtr<m_base_type>::get_ptr(base)->m_custom = *VariantGetInternalPtr<int64_t>::get_ptr(value); \
+ valid = true; \
+ } else { \
+ valid = false; \
+ } \
+ } \
+ static void validated_set(Variant *base, const Variant *value) { \
+ VariantGetInternalPtr<m_base_type>::get_ptr(base)->m_custom = *VariantGetInternalPtr<m_member_type>::get_ptr(value); \
+ } \
+ static void ptr_set(void *base, const void *member) { \
+ m_base_type b = PtrToArg<m_base_type>::convert(base); \
+ b.m_custom = PtrToArg<m_member_type>::convert(member); \
+ PtrToArg<m_base_type>::encode(b, base); \
+ } \
+ static Variant::Type get_type() { return GetTypeInfo<m_member_type>::VARIANT_TYPE; } \
+ };
+
+#define SETGET_STRUCT_FUNC(m_base_type, m_member_type, m_member, m_setter, m_getter) \
+ struct VariantSetGet_##m_base_type##_##m_member { \
+ static void get(const Variant *base, Variant *member) { \
+ *member = VariantGetInternalPtr<m_base_type>::get_ptr(base)->m_getter(); \
+ } \
+ static void validated_get(const Variant *base, Variant *member) { \
+ *VariantGetInternalPtr<m_member_type>::get_ptr(member) = VariantGetInternalPtr<m_base_type>::get_ptr(base)->m_getter(); \
+ } \
+ static void ptr_get(const void *base, void *member) { \
+ PtrToArg<m_member_type>::encode(PtrToArg<m_base_type>::convert(base).m_getter(), member); \
+ } \
+ static void set(Variant *base, const Variant *value, bool &valid) { \
+ if (value->get_type() == GetTypeInfo<m_member_type>::VARIANT_TYPE) { \
+ VariantGetInternalPtr<m_base_type>::get_ptr(base)->m_setter(*VariantGetInternalPtr<m_member_type>::get_ptr(value)); \
+ valid = true; \
+ } else { \
+ valid = false; \
+ } \
+ } \
+ static void validated_set(Variant *base, const Variant *value) { \
+ VariantGetInternalPtr<m_base_type>::get_ptr(base)->m_setter(*VariantGetInternalPtr<m_member_type>::get_ptr(value)); \
+ } \
+ static void ptr_set(void *base, const void *member) { \
+ m_base_type b = PtrToArg<m_base_type>::convert(base); \
+ b.m_setter(PtrToArg<m_member_type>::convert(member)); \
+ PtrToArg<m_base_type>::encode(b, base); \
+ } \
+ static Variant::Type get_type() { return GetTypeInfo<m_member_type>::VARIANT_TYPE; } \
+ };
+
+#define SETGET_NUMBER_STRUCT_FUNC(m_base_type, m_member_type, m_member, m_setter, m_getter) \
+ struct VariantSetGet_##m_base_type##_##m_member { \
+ static void get(const Variant *base, Variant *member) { \
+ *member = VariantGetInternalPtr<m_base_type>::get_ptr(base)->m_getter(); \
+ } \
+ static void validated_get(const Variant *base, Variant *member) { \
+ *VariantGetInternalPtr<m_member_type>::get_ptr(member) = VariantGetInternalPtr<m_base_type>::get_ptr(base)->m_getter(); \
+ } \
+ static void ptr_get(const void *base, void *member) { \
+ PtrToArg<m_member_type>::encode(PtrToArg<m_base_type>::convert(base).m_getter(), member); \
+ } \
+ static void set(Variant *base, const Variant *value, bool &valid) { \
+ if (value->get_type() == Variant::FLOAT) { \
+ VariantGetInternalPtr<m_base_type>::get_ptr(base)->m_setter(*VariantGetInternalPtr<double>::get_ptr(value)); \
+ valid = true; \
+ } else if (value->get_type() == Variant::INT) { \
+ VariantGetInternalPtr<m_base_type>::get_ptr(base)->m_setter(*VariantGetInternalPtr<int64_t>::get_ptr(value)); \
+ valid = true; \
+ } else { \
+ valid = false; \
+ } \
+ } \
+ static void validated_set(Variant *base, const Variant *value) { \
+ VariantGetInternalPtr<m_base_type>::get_ptr(base)->m_setter(*VariantGetInternalPtr<m_member_type>::get_ptr(value)); \
+ } \
+ static void ptr_set(void *base, const void *member) { \
+ m_base_type b = PtrToArg<m_base_type>::convert(base); \
+ b.m_setter(PtrToArg<m_member_type>::convert(member)); \
+ PtrToArg<m_base_type>::encode(b, base); \
+ } \
+ static Variant::Type get_type() { return GetTypeInfo<m_member_type>::VARIANT_TYPE; } \
+ };
+
+#define SETGET_STRUCT_FUNC_INDEX(m_base_type, m_member_type, m_member, m_setter, m_getter, m_index) \
+ struct VariantSetGet_##m_base_type##_##m_member { \
+ static void get(const Variant *base, Variant *member) { \
+ *member = VariantGetInternalPtr<m_base_type>::get_ptr(base)->m_getter(m_index); \
+ } \
+ static void validated_get(const Variant *base, Variant *member) { \
+ *VariantGetInternalPtr<m_member_type>::get_ptr(member) = VariantGetInternalPtr<m_base_type>::get_ptr(base)->m_getter(m_index); \
+ } \
+ static void ptr_get(const void *base, void *member) { \
+ PtrToArg<m_member_type>::encode(PtrToArg<m_base_type>::convert(base).m_getter(m_index), member); \
+ } \
+ static void set(Variant *base, const Variant *value, bool &valid) { \
+ if (value->get_type() == GetTypeInfo<m_member_type>::VARIANT_TYPE) { \
+ VariantGetInternalPtr<m_base_type>::get_ptr(base)->m_setter(m_index, *VariantGetInternalPtr<m_member_type>::get_ptr(value)); \
+ valid = true; \
+ } else { \
+ valid = false; \
+ } \
+ } \
+ static void validated_set(Variant *base, const Variant *value) { \
+ VariantGetInternalPtr<m_base_type>::get_ptr(base)->m_setter(m_index, *VariantGetInternalPtr<m_member_type>::get_ptr(value)); \
+ } \
+ static void ptr_set(void *base, const void *member) { \
+ m_base_type b = PtrToArg<m_base_type>::convert(base); \
+ b.m_setter(m_index, PtrToArg<m_member_type>::convert(member)); \
+ PtrToArg<m_base_type>::encode(b, base); \
+ } \
+ static Variant::Type get_type() { return GetTypeInfo<m_member_type>::VARIANT_TYPE; } \
+ };
+
+SETGET_NUMBER_STRUCT(Vector2, double, x)
+SETGET_NUMBER_STRUCT(Vector2, double, y)
+
+SETGET_NUMBER_STRUCT(Vector2i, int64_t, x)
+SETGET_NUMBER_STRUCT(Vector2i, int64_t, y)
+
+SETGET_NUMBER_STRUCT(Vector3, double, x)
+SETGET_NUMBER_STRUCT(Vector3, double, y)
+SETGET_NUMBER_STRUCT(Vector3, double, z)
+
+SETGET_NUMBER_STRUCT(Vector3i, int64_t, x)
+SETGET_NUMBER_STRUCT(Vector3i, int64_t, y)
+SETGET_NUMBER_STRUCT(Vector3i, int64_t, z)
+
+SETGET_STRUCT(Rect2, Vector2, position)
+SETGET_STRUCT(Rect2, Vector2, size)
+SETGET_STRUCT_FUNC(Rect2, Vector2, end, set_end, get_end)
+
+SETGET_STRUCT(Rect2i, Vector2i, position)
+SETGET_STRUCT(Rect2i, Vector2i, size)
+SETGET_STRUCT_FUNC(Rect2i, Vector2i, end, set_end, get_end)
+
+SETGET_STRUCT(AABB, Vector3, position)
+SETGET_STRUCT(AABB, Vector3, size)
+SETGET_STRUCT_FUNC(AABB, Vector3, end, set_end, get_end)
+
+SETGET_STRUCT_CUSTOM(Transform2D, Vector2, x, elements[0])
+SETGET_STRUCT_CUSTOM(Transform2D, Vector2, y, elements[1])
+SETGET_STRUCT_CUSTOM(Transform2D, Vector2, origin, elements[2])
+
+SETGET_NUMBER_STRUCT_CUSTOM(Plane, double, x, normal.x)
+SETGET_NUMBER_STRUCT_CUSTOM(Plane, double, y, normal.y)
+SETGET_NUMBER_STRUCT_CUSTOM(Plane, double, z, normal.z)
+SETGET_STRUCT(Plane, Vector3, normal)
+SETGET_NUMBER_STRUCT(Plane, double, d)
+
+SETGET_NUMBER_STRUCT(Quat, double, x)
+SETGET_NUMBER_STRUCT(Quat, double, y)
+SETGET_NUMBER_STRUCT(Quat, double, z)
+SETGET_NUMBER_STRUCT(Quat, double, w)
+
+SETGET_STRUCT_FUNC_INDEX(Basis, Vector3, x, set_axis, get_axis, 0)
+SETGET_STRUCT_FUNC_INDEX(Basis, Vector3, y, set_axis, get_axis, 1)
+SETGET_STRUCT_FUNC_INDEX(Basis, Vector3, z, set_axis, get_axis, 2)
+
+SETGET_STRUCT(Transform, Basis, basis)
+SETGET_STRUCT(Transform, Vector3, origin)
+
+SETGET_NUMBER_STRUCT(Color, double, r)
+SETGET_NUMBER_STRUCT(Color, double, g)
+SETGET_NUMBER_STRUCT(Color, double, b)
+SETGET_NUMBER_STRUCT(Color, double, a)
+
+SETGET_NUMBER_STRUCT_FUNC(Color, int64_t, r8, set_r8, get_r8)
+SETGET_NUMBER_STRUCT_FUNC(Color, int64_t, g8, set_g8, get_g8)
+SETGET_NUMBER_STRUCT_FUNC(Color, int64_t, b8, set_b8, get_b8)
+SETGET_NUMBER_STRUCT_FUNC(Color, int64_t, a8, set_a8, get_a8)
+
+SETGET_NUMBER_STRUCT_FUNC(Color, double, h, set_h, get_h)
+SETGET_NUMBER_STRUCT_FUNC(Color, double, s, set_s, get_s)
+SETGET_NUMBER_STRUCT_FUNC(Color, double, v, set_v, get_v)
+
+struct VariantSetterGetterInfo {
+ void (*setter)(Variant *base, const Variant *value, bool &valid);
+ void (*getter)(const Variant *base, Variant *value);
+ Variant::ValidatedSetter validated_setter;
+ Variant::ValidatedGetter validated_getter;
+ Variant::PTRSetter ptr_setter;
+ Variant::PTRGetter ptr_getter;
+ Variant::Type member_type;
+};
+
+static LocalVector<VariantSetterGetterInfo> variant_setters_getters[Variant::VARIANT_MAX];
+static LocalVector<StringName> variant_setters_getters_names[Variant::VARIANT_MAX]; //one next to another to make it cache friendly
+
+template <class T>
+static void register_member(Variant::Type p_type, const StringName &p_member) {
+ VariantSetterGetterInfo sgi;
+ sgi.setter = T::set;
+ sgi.validated_setter = T::validated_set;
+ sgi.ptr_setter = T::ptr_set;
+
+ sgi.getter = T::get;
+ sgi.validated_getter = T::validated_get;
+ sgi.ptr_getter = T::ptr_get;
+
+ sgi.member_type = T::get_type();
+
+ variant_setters_getters[p_type].push_back(sgi);
+ variant_setters_getters_names[p_type].push_back(p_member);
+}
+
+void register_named_setters_getters() {
+#define REGISTER_MEMBER(m_base_type, m_member) register_member<VariantSetGet_##m_base_type##_##m_member>(GetTypeInfo<m_base_type>::VARIANT_TYPE, #m_member)
+
+ REGISTER_MEMBER(Vector2, x);
+ REGISTER_MEMBER(Vector2, y);
+
+ REGISTER_MEMBER(Vector2i, x);
+ REGISTER_MEMBER(Vector2i, y);
+
+ REGISTER_MEMBER(Vector3, x);
+ REGISTER_MEMBER(Vector3, y);
+ REGISTER_MEMBER(Vector3, z);
+
+ REGISTER_MEMBER(Vector3i, x);
+ REGISTER_MEMBER(Vector3i, y);
+ REGISTER_MEMBER(Vector3i, z);
+
+ REGISTER_MEMBER(Rect2, position);
+ REGISTER_MEMBER(Rect2, size);
+ REGISTER_MEMBER(Rect2, end);
+
+ REGISTER_MEMBER(Rect2i, position);
+ REGISTER_MEMBER(Rect2i, size);
+ REGISTER_MEMBER(Rect2i, end);
+
+ REGISTER_MEMBER(AABB, position);
+ REGISTER_MEMBER(AABB, size);
+ REGISTER_MEMBER(AABB, end);
+
+ REGISTER_MEMBER(Transform2D, x);
+ REGISTER_MEMBER(Transform2D, y);
+ REGISTER_MEMBER(Transform2D, origin);
+
+ REGISTER_MEMBER(Plane, x);
+ REGISTER_MEMBER(Plane, y);
+ REGISTER_MEMBER(Plane, z);
+ REGISTER_MEMBER(Plane, d);
+ REGISTER_MEMBER(Plane, normal);
+
+ REGISTER_MEMBER(Quat, x);
+ REGISTER_MEMBER(Quat, y);
+ REGISTER_MEMBER(Quat, z);
+ REGISTER_MEMBER(Quat, w);
+
+ REGISTER_MEMBER(Basis, x);
+ REGISTER_MEMBER(Basis, y);
+ REGISTER_MEMBER(Basis, z);
+
+ REGISTER_MEMBER(Transform, basis);
+ REGISTER_MEMBER(Transform, origin);
+
+ REGISTER_MEMBER(Color, r);
+ REGISTER_MEMBER(Color, g);
+ REGISTER_MEMBER(Color, b);
+ REGISTER_MEMBER(Color, a);
+
+ REGISTER_MEMBER(Color, r8);
+ REGISTER_MEMBER(Color, g8);
+ REGISTER_MEMBER(Color, b8);
+ REGISTER_MEMBER(Color, a8);
+
+ REGISTER_MEMBER(Color, h);
+ REGISTER_MEMBER(Color, s);
+ REGISTER_MEMBER(Color, v);
+}
+
+void unregister_named_setters_getters() {
+ for (int i = 0; i < Variant::VARIANT_MAX; i++) {
+ variant_setters_getters[i].clear();
+ variant_setters_getters_names[i].clear();
+ }
+}
+
+bool Variant::has_member(Variant::Type p_type, const StringName &p_member) {
+ ERR_FAIL_INDEX_V(p_type, Variant::VARIANT_MAX, false);
+
+ for (uint32_t i = 0; i < variant_setters_getters_names[p_type].size(); i++) {
+ if (variant_setters_getters_names[p_type][i] == p_member) {
+ return true;
+ }
+ }
+ return false;
+}
+
+Variant::Type Variant::get_member_type(Variant::Type p_type, const StringName &p_member) {
+ ERR_FAIL_INDEX_V(p_type, Variant::VARIANT_MAX, Variant::VARIANT_MAX);
+
+ for (uint32_t i = 0; i < variant_setters_getters_names[p_type].size(); i++) {
+ if (variant_setters_getters_names[p_type][i] == p_member) {
+ return variant_setters_getters[p_type][i].member_type;
+ }
+ }
+
+ return Variant::NIL;
+}
+
+void Variant::get_member_list(Variant::Type p_type, List<StringName> *r_members) {
+ for (uint32_t i = 0; i < variant_setters_getters_names[p_type].size(); i++) {
+ r_members->push_back(variant_setters_getters_names[p_type][i]);
+ }
+}
+
+Variant::ValidatedSetter Variant::get_member_validated_setter(Variant::Type p_type, const StringName &p_member) {
+ ERR_FAIL_INDEX_V(p_type, Variant::VARIANT_MAX, nullptr);
+
+ for (uint32_t i = 0; i < variant_setters_getters_names[p_type].size(); i++) {
+ if (variant_setters_getters_names[p_type][i] == p_member) {
+ return variant_setters_getters[p_type][i].validated_setter;
+ }
+ }
+
+ return nullptr;
+}
+Variant::ValidatedGetter Variant::get_member_validated_getter(Variant::Type p_type, const StringName &p_member) {
+ ERR_FAIL_INDEX_V(p_type, Variant::VARIANT_MAX, nullptr);
+
+ for (uint32_t i = 0; i < variant_setters_getters_names[p_type].size(); i++) {
+ if (variant_setters_getters_names[p_type][i] == p_member) {
+ return variant_setters_getters[p_type][i].validated_getter;
+ }
+ }
+
+ return nullptr;
+}
+
+Variant::PTRSetter Variant::get_member_ptr_setter(Variant::Type p_type, const StringName &p_member) {
+ ERR_FAIL_INDEX_V(p_type, Variant::VARIANT_MAX, nullptr);
+
+ for (uint32_t i = 0; i < variant_setters_getters_names[p_type].size(); i++) {
+ if (variant_setters_getters_names[p_type][i] == p_member) {
+ return variant_setters_getters[p_type][i].ptr_setter;
+ }
+ }
+
+ return nullptr;
+}
+
+Variant::PTRGetter Variant::get_member_ptr_getter(Variant::Type p_type, const StringName &p_member) {
+ ERR_FAIL_INDEX_V(p_type, Variant::VARIANT_MAX, nullptr);
+
+ for (uint32_t i = 0; i < variant_setters_getters_names[p_type].size(); i++) {
+ if (variant_setters_getters_names[p_type][i] == p_member) {
+ return variant_setters_getters[p_type][i].ptr_getter;
+ }
+ }
+
+ return nullptr;
+}
+
+void Variant::set_named(const StringName &p_member, const Variant &p_value, bool &r_valid) {
+ uint32_t s = variant_setters_getters[type].size();
+ if (s) {
+ for (uint32_t i = 0; i < s; i++) {
+ if (variant_setters_getters_names[type][i] == p_member) {
+ variant_setters_getters[type][i].setter(this, &p_value, r_valid);
+ return;
+ }
+ }
+ r_valid = false;
+
+ } else if (type == Variant::OBJECT) {
+ Object *obj = get_validated_object();
+ if (!obj) {
+ r_valid = false;
+ } else {
+ obj->set(p_member, p_value, &r_valid);
+ return;
+ }
+ } else if (type == Variant::DICTIONARY) {
+ Variant *v = VariantGetInternalPtr<Dictionary>::get_ptr(this)->getptr(p_member);
+ if (v) {
+ *v = p_value;
+ r_valid = true;
+ } else {
+ r_valid = false;
+ }
+
+ } else {
+ r_valid = false;
+ }
+}
+
+Variant Variant::get_named(const StringName &p_member, bool &r_valid) const {
+ Variant ret;
+ uint32_t s = variant_setters_getters[type].size();
+ if (s) {
+ for (uint32_t i = 0; i < s; i++) {
+ if (variant_setters_getters_names[type][i] == p_member) {
+ variant_setters_getters[type][i].getter(this, &ret);
+ r_valid = true;
+ return ret;
+ }
+ }
+
+ r_valid = false;
+
+ } else if (type == Variant::OBJECT) {
+ Object *obj = get_validated_object();
+ if (!obj) {
+ r_valid = false;
+ return "Instance base is null.";
+ } else {
+ return obj->get(p_member, &r_valid);
+ }
+ } else if (type == Variant::DICTIONARY) {
+ const Variant *v = VariantGetInternalPtr<Dictionary>::get_ptr(this)->getptr(p_member);
+ if (v) {
+ r_valid = true;
+
+ return *v;
+ } else {
+ r_valid = false;
+ }
+
+ } else {
+ r_valid = false;
+ }
+
+ return ret;
+}
+
+/**** INDEXED SETTERS AND GETTERS ****/
+
+#ifdef DEBUG_ENABLED
+
+#define OOB_TEST(m_idx, m_v) \
+ ERR_FAIL_INDEX(m_idx, m_v)
+
+#else
+
+#define OOB_TEST(m_idx, m_v)
+
+#endif
+
+#ifdef DEBUG_ENABLED
+
+#define NULL_TEST(m_key) \
+ ERR_FAIL_COND(!m_key)
+
+#else
+
+#define NULL_TEST(m_key)
+
+#endif
+
+#define INDEXED_SETGET_STRUCT_TYPED(m_base_type, m_elem_type) \
+ struct VariantIndexedSetGet_##m_base_type { \
+ static void get(const Variant *base, int64_t index, Variant *value, bool &oob) { \
+ int64_t size = VariantGetInternalPtr<m_base_type>::get_ptr(base)->size(); \
+ if (index < 0) { \
+ index += size; \
+ } \
+ if (index < 0 || index >= size) { \
+ oob = true; \
+ return; \
+ } \
+ *value = (*VariantGetInternalPtr<m_base_type>::get_ptr(base))[index]; \
+ oob = false; \
+ } \
+ static void validated_get(const Variant *base, int64_t index, Variant *value, bool &oob) { \
+ int64_t size = VariantGetInternalPtr<m_base_type>::get_ptr(base)->size(); \
+ if (index < 0) { \
+ index += size; \
+ } \
+ if (index < 0 || index >= size) { \
+ oob = true; \
+ return; \
+ } \
+ *VariantGetInternalPtr<m_elem_type>::get_ptr(value) = (*VariantGetInternalPtr<m_base_type>::get_ptr(base))[index]; \
+ oob = false; \
+ } \
+ static void ptr_get(const void *base, int64_t index, void *member) { \
+ /* avoid ptrconvert for performance*/ \
+ const m_base_type &v = *reinterpret_cast<const m_base_type *>(base); \
+ if (index < 0) \
+ index += v.size(); \
+ OOB_TEST(index, v.size()); \
+ PtrToArg<m_elem_type>::encode(v[index], member); \
+ } \
+ static void set(Variant *base, int64_t index, const Variant *value, bool &valid, bool &oob) { \
+ if (value->get_type() != GetTypeInfo<m_elem_type>::VARIANT_TYPE) { \
+ oob = false; \
+ valid = false; \
+ return; \
+ } \
+ int64_t size = VariantGetInternalPtr<m_base_type>::get_ptr(base)->size(); \
+ if (index < 0) { \
+ index += size; \
+ } \
+ if (index < 0 || index >= size) { \
+ oob = true; \
+ valid = false; \
+ return; \
+ } \
+ (*VariantGetInternalPtr<m_base_type>::get_ptr(base)).write[index] = *VariantGetInternalPtr<m_elem_type>::get_ptr(value); \
+ oob = false; \
+ valid = true; \
+ } \
+ static void validated_set(Variant *base, int64_t index, const Variant *value, bool &oob) { \
+ int64_t size = VariantGetInternalPtr<m_base_type>::get_ptr(base)->size(); \
+ if (index < 0) { \
+ index += size; \
+ } \
+ if (index < 0 || index >= size) { \
+ oob = true; \
+ return; \
+ } \
+ (*VariantGetInternalPtr<m_base_type>::get_ptr(base)).write[index] = *VariantGetInternalPtr<m_elem_type>::get_ptr(value); \
+ oob = false; \
+ } \
+ static void ptr_set(void *base, int64_t index, const void *member) { \
+ /* avoid ptrconvert for performance*/ \
+ m_base_type &v = *reinterpret_cast<m_base_type *>(base); \
+ if (index < 0) \
+ index += v.size(); \
+ OOB_TEST(index, v.size()); \
+ v.write[index] = PtrToArg<m_elem_type>::convert(member); \
+ } \
+ static Variant::Type get_index_type() { return GetTypeInfo<m_elem_type>::VARIANT_TYPE; } \
+ static uint64_t get_indexed_size(const Variant *base) { return VariantGetInternalPtr<m_base_type>::get_ptr(base)->size(); } \
+ };
+
+#define INDEXED_SETGET_STRUCT_TYPED_NUMERIC(m_base_type, m_elem_type, m_assign_type) \
+ struct VariantIndexedSetGet_##m_base_type { \
+ static void get(const Variant *base, int64_t index, Variant *value, bool &oob) { \
+ int64_t size = VariantGetInternalPtr<m_base_type>::get_ptr(base)->size(); \
+ if (index < 0) { \
+ index += size; \
+ } \
+ if (index < 0 || index >= size) { \
+ oob = true; \
+ return; \
+ } \
+ *value = (*VariantGetInternalPtr<m_base_type>::get_ptr(base))[index]; \
+ oob = false; \
+ } \
+ static void validated_get(const Variant *base, int64_t index, Variant *value, bool &oob) { \
+ int64_t size = VariantGetInternalPtr<m_base_type>::get_ptr(base)->size(); \
+ if (index < 0) { \
+ index += size; \
+ } \
+ if (index < 0 || index >= size) { \
+ oob = true; \
+ return; \
+ } \
+ *VariantGetInternalPtr<m_elem_type>::get_ptr(value) = (*VariantGetInternalPtr<m_base_type>::get_ptr(base))[index]; \
+ oob = false; \
+ } \
+ static void ptr_get(const void *base, int64_t index, void *member) { \
+ /* avoid ptrconvert for performance*/ \
+ const m_base_type &v = *reinterpret_cast<const m_base_type *>(base); \
+ if (index < 0) \
+ index += v.size(); \
+ OOB_TEST(index, v.size()); \
+ PtrToArg<m_elem_type>::encode(v[index], member); \
+ } \
+ static void set(Variant *base, int64_t index, const Variant *value, bool &valid, bool &oob) { \
+ int64_t size = VariantGetInternalPtr<m_base_type>::get_ptr(base)->size(); \
+ if (index < 0) { \
+ index += size; \
+ } \
+ if (index < 0 || index >= size) { \
+ oob = true; \
+ valid = false; \
+ return; \
+ } \
+ m_assign_type num; \
+ if (value->get_type() == Variant::INT) { \
+ num = (m_assign_type)*VariantGetInternalPtr<int64_t>::get_ptr(value); \
+ } else if (value->get_type() == Variant::FLOAT) { \
+ num = (m_assign_type)*VariantGetInternalPtr<double>::get_ptr(value); \
+ } else { \
+ oob = false; \
+ valid = false; \
+ return; \
+ } \
+ (*VariantGetInternalPtr<m_base_type>::get_ptr(base)).write[index] = num; \
+ oob = false; \
+ valid = true; \
+ } \
+ static void validated_set(Variant *base, int64_t index, const Variant *value, bool &oob) { \
+ int64_t size = VariantGetInternalPtr<m_base_type>::get_ptr(base)->size(); \
+ if (index < 0) { \
+ index += size; \
+ } \
+ if (index < 0 || index >= size) { \
+ oob = true; \
+ return; \
+ } \
+ (*VariantGetInternalPtr<m_base_type>::get_ptr(base)).write[index] = *VariantGetInternalPtr<m_elem_type>::get_ptr(value); \
+ oob = false; \
+ } \
+ static void ptr_set(void *base, int64_t index, const void *member) { \
+ /* avoid ptrconvert for performance*/ \
+ m_base_type &v = *reinterpret_cast<m_base_type *>(base); \
+ if (index < 0) \
+ index += v.size(); \
+ OOB_TEST(index, v.size()); \
+ v.write[index] = PtrToArg<m_elem_type>::convert(member); \
+ } \
+ static Variant::Type get_index_type() { return GetTypeInfo<m_elem_type>::VARIANT_TYPE; } \
+ static uint64_t get_indexed_size(const Variant *base) { return VariantGetInternalPtr<m_base_type>::get_ptr(base)->size(); } \
+ };
+
+#define INDEXED_SETGET_STRUCT_BULTIN_NUMERIC(m_base_type, m_elem_type, m_assign_type, m_max) \
+ struct VariantIndexedSetGet_##m_base_type { \
+ static void get(const Variant *base, int64_t index, Variant *value, bool &oob) { \
+ if (index < 0 || index >= m_max) { \
+ oob = true; \
+ return; \
+ } \
+ *value = (*VariantGetInternalPtr<m_base_type>::get_ptr(base))[index]; \
+ oob = false; \
+ } \
+ static void validated_get(const Variant *base, int64_t index, Variant *value, bool &oob) { \
+ if (index < 0 || index >= m_max) { \
+ oob = true; \
+ return; \
+ } \
+ *VariantGetInternalPtr<m_elem_type>::get_ptr(value) = (*VariantGetInternalPtr<m_base_type>::get_ptr(base))[index]; \
+ oob = false; \
+ } \
+ static void ptr_get(const void *base, int64_t index, void *member) { \
+ /* avoid ptrconvert for performance*/ \
+ const m_base_type &v = *reinterpret_cast<const m_base_type *>(base); \
+ OOB_TEST(index, m_max); \
+ PtrToArg<m_elem_type>::encode(v[index], member); \
+ } \
+ static void set(Variant *base, int64_t index, const Variant *value, bool &valid, bool &oob) { \
+ if (index < 0 || index >= m_max) { \
+ oob = true; \
+ valid = false; \
+ return; \
+ } \
+ m_assign_type num; \
+ if (value->get_type() == Variant::INT) { \
+ num = (m_assign_type)*VariantGetInternalPtr<int64_t>::get_ptr(value); \
+ } else if (value->get_type() == Variant::FLOAT) { \
+ num = (m_assign_type)*VariantGetInternalPtr<double>::get_ptr(value); \
+ } else { \
+ oob = false; \
+ valid = false; \
+ return; \
+ } \
+ (*VariantGetInternalPtr<m_base_type>::get_ptr(base))[index] = num; \
+ oob = false; \
+ valid = true; \
+ } \
+ static void validated_set(Variant *base, int64_t index, const Variant *value, bool &oob) { \
+ if (index < 0 || index >= m_max) { \
+ oob = true; \
+ return; \
+ } \
+ (*VariantGetInternalPtr<m_base_type>::get_ptr(base))[index] = *VariantGetInternalPtr<m_elem_type>::get_ptr(value); \
+ oob = false; \
+ } \
+ static void ptr_set(void *base, int64_t index, const void *member) { \
+ /* avoid ptrconvert for performance*/ \
+ m_base_type &v = *reinterpret_cast<m_base_type *>(base); \
+ OOB_TEST(index, m_max); \
+ v[index] = PtrToArg<m_elem_type>::convert(member); \
+ } \
+ static Variant::Type get_index_type() { return GetTypeInfo<m_elem_type>::VARIANT_TYPE; } \
+ static uint64_t get_indexed_size(const Variant *base) { return m_max; } \
+ };
+
+#define INDEXED_SETGET_STRUCT_BULTIN_ACCESSOR(m_base_type, m_elem_type, m_accessor, m_max) \
+ struct VariantIndexedSetGet_##m_base_type { \
+ static void get(const Variant *base, int64_t index, Variant *value, bool &oob) { \
+ if (index < 0 || index >= m_max) { \
+ oob = true; \
+ return; \
+ } \
+ *value = (*VariantGetInternalPtr<m_base_type>::get_ptr(base))m_accessor[index]; \
+ oob = false; \
+ } \
+ static void validated_get(const Variant *base, int64_t index, Variant *value, bool &oob) { \
+ if (index < 0 || index >= m_max) { \
+ oob = true; \
+ return; \
+ } \
+ *VariantGetInternalPtr<m_elem_type>::get_ptr(value) = (*VariantGetInternalPtr<m_base_type>::get_ptr(base))m_accessor[index]; \
+ oob = false; \
+ } \
+ static void ptr_get(const void *base, int64_t index, void *member) { \
+ /* avoid ptrconvert for performance*/ \
+ const m_base_type &v = *reinterpret_cast<const m_base_type *>(base); \
+ OOB_TEST(index, m_max); \
+ PtrToArg<m_elem_type>::encode(v m_accessor[index], member); \
+ } \
+ static void set(Variant *base, int64_t index, const Variant *value, bool &valid, bool &oob) { \
+ if (value->get_type() != GetTypeInfo<m_elem_type>::VARIANT_TYPE) { \
+ oob = false; \
+ valid = false; \
+ } \
+ if (index < 0 || index >= m_max) { \
+ oob = true; \
+ valid = false; \
+ return; \
+ } \
+ (*VariantGetInternalPtr<m_base_type>::get_ptr(base)) m_accessor[index] = *VariantGetInternalPtr<m_elem_type>::get_ptr(value); \
+ oob = false; \
+ valid = true; \
+ } \
+ static void validated_set(Variant *base, int64_t index, const Variant *value, bool &oob) { \
+ if (index < 0 || index >= m_max) { \
+ oob = true; \
+ return; \
+ } \
+ (*VariantGetInternalPtr<m_base_type>::get_ptr(base)) m_accessor[index] = *VariantGetInternalPtr<m_elem_type>::get_ptr(value); \
+ oob = false; \
+ } \
+ static void ptr_set(void *base, int64_t index, const void *member) { \
+ /* avoid ptrconvert for performance*/ \
+ m_base_type &v = *reinterpret_cast<m_base_type *>(base); \
+ OOB_TEST(index, m_max); \
+ v m_accessor[index] = PtrToArg<m_elem_type>::convert(member); \
+ } \
+ static Variant::Type get_index_type() { return GetTypeInfo<m_elem_type>::VARIANT_TYPE; } \
+ static uint64_t get_indexed_size(const Variant *base) { return m_max; } \
+ };
+
+#define INDEXED_SETGET_STRUCT_BULTIN_FUNC(m_base_type, m_elem_type, m_set, m_get, m_max) \
+ struct VariantIndexedSetGet_##m_base_type { \
+ static void get(const Variant *base, int64_t index, Variant *value, bool &oob) { \
+ if (index < 0 || index >= m_max) { \
+ oob = true; \
+ return; \
+ } \
+ *value = VariantGetInternalPtr<m_base_type>::get_ptr(base)->m_get(index); \
+ oob = false; \
+ } \
+ static void validated_get(const Variant *base, int64_t index, Variant *value, bool &oob) { \
+ if (index < 0 || index >= m_max) { \
+ oob = true; \
+ return; \
+ } \
+ *VariantGetInternalPtr<m_elem_type>::get_ptr(value) = VariantGetInternalPtr<m_base_type>::get_ptr(base)->m_get(index); \
+ oob = false; \
+ } \
+ static void ptr_get(const void *base, int64_t index, void *member) { \
+ /* avoid ptrconvert for performance*/ \
+ const m_base_type &v = *reinterpret_cast<const m_base_type *>(base); \
+ OOB_TEST(index, m_max); \
+ PtrToArg<m_elem_type>::encode(v.m_get(index), member); \
+ } \
+ static void set(Variant *base, int64_t index, const Variant *value, bool &valid, bool &oob) { \
+ if (value->get_type() != GetTypeInfo<m_elem_type>::VARIANT_TYPE) { \
+ oob = false; \
+ valid = false; \
+ } \
+ if (index < 0 || index >= m_max) { \
+ oob = true; \
+ valid = false; \
+ return; \
+ } \
+ VariantGetInternalPtr<m_base_type>::get_ptr(base)->m_set(index, *VariantGetInternalPtr<m_elem_type>::get_ptr(value)); \
+ oob = false; \
+ valid = true; \
+ } \
+ static void validated_set(Variant *base, int64_t index, const Variant *value, bool &oob) { \
+ if (index < 0 || index >= m_max) { \
+ oob = true; \
+ return; \
+ } \
+ VariantGetInternalPtr<m_base_type>::get_ptr(base)->m_set(index, *VariantGetInternalPtr<m_elem_type>::get_ptr(value)); \
+ oob = false; \
+ } \
+ static void ptr_set(void *base, int64_t index, const void *member) { \
+ /* avoid ptrconvert for performance*/ \
+ m_base_type &v = *reinterpret_cast<m_base_type *>(base); \
+ OOB_TEST(index, m_max); \
+ v.m_set(index, PtrToArg<m_elem_type>::convert(member)); \
+ } \
+ static Variant::Type get_index_type() { return GetTypeInfo<m_elem_type>::VARIANT_TYPE; } \
+ static uint64_t get_indexed_size(const Variant *base) { return m_max; } \
+ };
+
+#define INDEXED_SETGET_STRUCT_VARIANT(m_base_type) \
+ struct VariantIndexedSetGet_##m_base_type { \
+ static void get(const Variant *base, int64_t index, Variant *value, bool &oob) { \
+ int64_t size = VariantGetInternalPtr<m_base_type>::get_ptr(base)->size(); \
+ if (index < 0) { \
+ index += size; \
+ } \
+ if (index < 0 || index >= size) { \
+ oob = true; \
+ return; \
+ } \
+ *value = (*VariantGetInternalPtr<m_base_type>::get_ptr(base))[index]; \
+ oob = false; \
+ } \
+ static void validated_get(const Variant *base, int64_t index, Variant *value, bool &oob) { \
+ int64_t size = VariantGetInternalPtr<m_base_type>::get_ptr(base)->size(); \
+ if (index < 0) { \
+ index += size; \
+ } \
+ if (index < 0 || index >= size) { \
+ oob = true; \
+ return; \
+ } \
+ *value = (*VariantGetInternalPtr<m_base_type>::get_ptr(base))[index]; \
+ oob = false; \
+ } \
+ static void ptr_get(const void *base, int64_t index, void *member) { \
+ /* avoid ptrconvert for performance*/ \
+ const m_base_type &v = *reinterpret_cast<const m_base_type *>(base); \
+ if (index < 0) \
+ index += v.size(); \
+ OOB_TEST(index, v.size()); \
+ PtrToArg<Variant>::encode(v[index], member); \
+ } \
+ static void set(Variant *base, int64_t index, const Variant *value, bool &valid, bool &oob) { \
+ int64_t size = VariantGetInternalPtr<m_base_type>::get_ptr(base)->size(); \
+ if (index < 0) { \
+ index += size; \
+ } \
+ if (index < 0 || index >= size) { \
+ oob = true; \
+ valid = false; \
+ return; \
+ } \
+ (*VariantGetInternalPtr<m_base_type>::get_ptr(base))[index] = *value; \
+ oob = false; \
+ valid = true; \
+ } \
+ static void validated_set(Variant *base, int64_t index, const Variant *value, bool &oob) { \
+ int64_t size = VariantGetInternalPtr<m_base_type>::get_ptr(base)->size(); \
+ if (index < 0) { \
+ index += size; \
+ } \
+ if (index < 0 || index >= size) { \
+ oob = true; \
+ return; \
+ } \
+ (*VariantGetInternalPtr<m_base_type>::get_ptr(base))[index] = *value; \
+ oob = false; \
+ } \
+ static void ptr_set(void *base, int64_t index, const void *member) { \
+ /* avoid ptrconvert for performance*/ \
+ m_base_type &v = *reinterpret_cast<m_base_type *>(base); \
+ if (index < 0) \
+ index += v.size(); \
+ OOB_TEST(index, v.size()); \
+ v[index] = PtrToArg<Variant>::convert(member); \
+ } \
+ static Variant::Type get_index_type() { return Variant::NIL; } \
+ static uint64_t get_indexed_size(const Variant *base) { return 0; } \
+ };
+
+#define INDEXED_SETGET_STRUCT_DICT(m_base_type) \
+ struct VariantIndexedSetGet_##m_base_type { \
+ static void get(const Variant *base, int64_t index, Variant *value, bool &oob) { \
+ const Variant *ptr = VariantGetInternalPtr<m_base_type>::get_ptr(base)->getptr(index); \
+ if (!ptr) { \
+ oob = true; \
+ return; \
+ } \
+ *value = *ptr; \
+ oob = false; \
+ } \
+ static void validated_get(const Variant *base, int64_t index, Variant *value, bool &oob) { \
+ const Variant *ptr = VariantGetInternalPtr<m_base_type>::get_ptr(base)->getptr(index); \
+ if (!ptr) { \
+ oob = true; \
+ return; \
+ } \
+ *value = *ptr; \
+ oob = false; \
+ } \
+ static void ptr_get(const void *base, int64_t index, void *member) { \
+ /* avoid ptrconvert for performance*/ \
+ const m_base_type &v = *reinterpret_cast<const m_base_type *>(base); \
+ const Variant *ptr = v.getptr(index); \
+ NULL_TEST(ptr); \
+ PtrToArg<Variant>::encode(*ptr, member); \
+ } \
+ static void set(Variant *base, int64_t index, const Variant *value, bool &valid, bool &oob) { \
+ (*VariantGetInternalPtr<m_base_type>::get_ptr(base))[index] = *value; \
+ oob = false; \
+ valid = true; \
+ } \
+ static void validated_set(Variant *base, int64_t index, const Variant *value, bool &oob) { \
+ (*VariantGetInternalPtr<m_base_type>::get_ptr(base))[index] = *value; \
+ oob = false; \
+ } \
+ static void ptr_set(void *base, int64_t index, const void *member) { \
+ m_base_type &v = *reinterpret_cast<m_base_type *>(base); \
+ v[index] = PtrToArg<Variant>::convert(member); \
+ } \
+ static Variant::Type get_index_type() { return Variant::NIL; } \
+ static uint64_t get_indexed_size(const Variant *base) { return VariantGetInternalPtr<m_base_type>::get_ptr(base)->size(); } \
+ };
+
+INDEXED_SETGET_STRUCT_BULTIN_NUMERIC(Vector2, double, real_t, 2)
+INDEXED_SETGET_STRUCT_BULTIN_NUMERIC(Vector2i, int64_t, int32_t, 2)
+INDEXED_SETGET_STRUCT_BULTIN_NUMERIC(Vector3, double, real_t, 3)
+INDEXED_SETGET_STRUCT_BULTIN_NUMERIC(Vector3i, int64_t, int32_t, 3)
+INDEXED_SETGET_STRUCT_BULTIN_NUMERIC(Quat, double, real_t, 4)
+INDEXED_SETGET_STRUCT_BULTIN_NUMERIC(Color, double, float, 4)
+
+INDEXED_SETGET_STRUCT_BULTIN_ACCESSOR(Transform2D, Vector2, .elements, 3)
+INDEXED_SETGET_STRUCT_BULTIN_FUNC(Basis, Vector3, set_axis, get_axis, 3)
+
+INDEXED_SETGET_STRUCT_TYPED_NUMERIC(PackedByteArray, int64_t, uint8_t)
+INDEXED_SETGET_STRUCT_TYPED_NUMERIC(PackedInt32Array, int64_t, int32_t)
+INDEXED_SETGET_STRUCT_TYPED_NUMERIC(PackedInt64Array, int64_t, int64_t)
+INDEXED_SETGET_STRUCT_TYPED_NUMERIC(PackedFloat32Array, double, float)
+INDEXED_SETGET_STRUCT_TYPED_NUMERIC(PackedFloat64Array, double, double)
+INDEXED_SETGET_STRUCT_TYPED(PackedVector2Array, Vector2)
+INDEXED_SETGET_STRUCT_TYPED(PackedVector3Array, Vector3)
+INDEXED_SETGET_STRUCT_TYPED(PackedStringArray, String)
+INDEXED_SETGET_STRUCT_TYPED(PackedColorArray, Color)
+
+INDEXED_SETGET_STRUCT_VARIANT(Array)
+INDEXED_SETGET_STRUCT_DICT(Dictionary)
+
+struct VariantIndexedSetterGetterInfo {
+ void (*setter)(Variant *base, int64_t index, const Variant *value, bool &valid, bool &oob);
+ void (*getter)(const Variant *base, int64_t index, Variant *value, bool &oob);
+
+ Variant::ValidatedIndexedSetter validated_setter;
+ Variant::ValidatedIndexedGetter validated_getter;
+
+ Variant::PTRIndexedSetter ptr_setter;
+ Variant::PTRIndexedGetter ptr_getter;
+
+ uint64_t (*get_indexed_size)(const Variant *base);
+
+ Variant::Type index_type;
+
+ bool valid = false;
+};
+
+static VariantIndexedSetterGetterInfo variant_indexed_setters_getters[Variant::VARIANT_MAX];
+
+template <class T>
+static void register_indexed_member(Variant::Type p_type) {
+ VariantIndexedSetterGetterInfo &sgi = variant_indexed_setters_getters[p_type];
+
+ sgi.setter = T::set;
+ sgi.validated_setter = T::validated_set;
+ sgi.ptr_setter = T::ptr_set;
+
+ sgi.getter = T::get;
+ sgi.validated_getter = T::validated_get;
+ sgi.ptr_getter = T::ptr_get;
+
+ sgi.index_type = T::get_index_type();
+ sgi.get_indexed_size = T::get_indexed_size;
+
+ sgi.valid = true;
+}
+
+void register_indexed_setters_getters() {
+#define REGISTER_INDEXED_MEMBER(m_base_type) register_indexed_member<VariantIndexedSetGet_##m_base_type>(GetTypeInfo<m_base_type>::VARIANT_TYPE)
+
+ REGISTER_INDEXED_MEMBER(Vector2);
+ REGISTER_INDEXED_MEMBER(Vector2i);
+ REGISTER_INDEXED_MEMBER(Vector3);
+ REGISTER_INDEXED_MEMBER(Vector3i);
+ REGISTER_INDEXED_MEMBER(Quat);
+ REGISTER_INDEXED_MEMBER(Color);
+ REGISTER_INDEXED_MEMBER(Transform2D);
+ REGISTER_INDEXED_MEMBER(Basis);
+
+ REGISTER_INDEXED_MEMBER(PackedByteArray);
+ REGISTER_INDEXED_MEMBER(PackedInt32Array);
+ REGISTER_INDEXED_MEMBER(PackedInt64Array);
+ REGISTER_INDEXED_MEMBER(PackedFloat64Array);
+ REGISTER_INDEXED_MEMBER(PackedVector2Array);
+ REGISTER_INDEXED_MEMBER(PackedVector3Array);
+ REGISTER_INDEXED_MEMBER(PackedStringArray);
+ REGISTER_INDEXED_MEMBER(PackedColorArray);
+
+ REGISTER_INDEXED_MEMBER(Array);
+ REGISTER_INDEXED_MEMBER(Dictionary);
+}
+
+static void unregister_indexed_setters_getters() {
+}
+
+bool Variant::has_indexing(Variant::Type p_type) {
+ ERR_FAIL_INDEX_V(p_type, Variant::VARIANT_MAX, false);
+ return variant_indexed_setters_getters[p_type].valid;
+}
+
+Variant::Type Variant::get_indexed_element_type(Variant::Type p_type) {
+ ERR_FAIL_INDEX_V(p_type, Variant::VARIANT_MAX, Variant::VARIANT_MAX);
+ return variant_indexed_setters_getters[p_type].index_type;
+}
+
+Variant::ValidatedIndexedSetter Variant::get_member_validated_indexed_setter(Variant::Type p_type) {
+ ERR_FAIL_INDEX_V(p_type, Variant::VARIANT_MAX, nullptr);
+ return variant_indexed_setters_getters[p_type].validated_setter;
+}
+Variant::ValidatedIndexedGetter Variant::get_member_validated_indexed_getter(Variant::Type p_type) {
+ ERR_FAIL_INDEX_V(p_type, Variant::VARIANT_MAX, nullptr);
+ return variant_indexed_setters_getters[p_type].validated_getter;
+}
+
+Variant::PTRIndexedSetter Variant::get_member_ptr_indexed_setter(Variant::Type p_type) {
+ ERR_FAIL_INDEX_V(p_type, Variant::VARIANT_MAX, nullptr);
+ return variant_indexed_setters_getters[p_type].ptr_setter;
+}
+Variant::PTRIndexedGetter Variant::get_member_ptr_indexed_getter(Variant::Type p_type) {
+ ERR_FAIL_INDEX_V(p_type, Variant::VARIANT_MAX, nullptr);
+ return variant_indexed_setters_getters[p_type].ptr_getter;
+}
+
+void Variant::set_indexed(int64_t p_index, const Variant &p_value, bool &r_valid, bool &r_oob) {
+ if (likely(variant_indexed_setters_getters[type].valid)) {
+ variant_indexed_setters_getters[type].setter(this, p_index, &p_value, r_valid, r_oob);
+ } else {
+ r_valid = false;
+ r_oob = false;
+ }
+}
+Variant Variant::get_indexed(int64_t p_index, bool &r_valid, bool &r_oob) const {
+ if (likely(variant_indexed_setters_getters[type].valid)) {
+ Variant ret;
+ variant_indexed_setters_getters[type].getter(this, p_index, &ret, r_oob);
+ r_valid = !r_oob;
+ return ret;
+ } else {
+ r_valid = false;
+ r_oob = false;
+ return Variant();
+ }
+}
+
+uint64_t Variant::get_indexed_size() const {
+ if (likely(variant_indexed_setters_getters[type].valid && variant_indexed_setters_getters[type].get_indexed_size)) {
+ return variant_indexed_setters_getters[type].get_indexed_size(this);
+ } else {
+ return 0;
+ }
+}
+
+struct VariantKeyedSetGetDictionary {
+ static void get(const Variant *base, const Variant *key, Variant *value, bool &r_valid) {
+ const Variant *ptr = VariantGetInternalPtr<Dictionary>::get_ptr(base)->getptr(*key);
+ if (!ptr) {
+ r_valid = false;
+ return;
+ }
+ *value = *ptr;
+ r_valid = true;
+ }
+ static void ptr_get(const void *base, const void *key, void *value) {
+ /* avoid ptrconvert for performance*/
+ const Dictionary &v = *reinterpret_cast<const Dictionary *>(base);
+ const Variant *ptr = v.getptr(PtrToArg<Variant>::convert(key));
+ NULL_TEST(ptr);
+ PtrToArg<Variant>::encode(*ptr, value);
+ }
+ static void set(Variant *base, const Variant *key, const Variant *value, bool &r_valid) {
+ (*VariantGetInternalPtr<Dictionary>::get_ptr(base))[*key] = *value;
+ r_valid = true;
+ }
+ static void ptr_set(void *base, const void *key, const void *value) {
+ Dictionary &v = *reinterpret_cast<Dictionary *>(base);
+ v[PtrToArg<Variant>::convert(key)] = PtrToArg<Variant>::convert(value);
+ }
+
+ static bool has(const Variant *base, const Variant *key, bool &r_valid) {
+ r_valid = true;
+ return VariantGetInternalPtr<Dictionary>::get_ptr(base)->has(*key);
+ }
+ static bool ptr_has(const void *base, const void *key) {
+ /* avoid ptrconvert for performance*/
+ const Dictionary &v = *reinterpret_cast<const Dictionary *>(base);
+ return v.has(PtrToArg<Variant>::convert(key));
+ }
+};
+
+struct VariantKeyedSetGetObject {
+ static void get(const Variant *base, const Variant *key, Variant *value, bool &r_valid) {
+ Object *obj = base->get_validated_object();
+
+ if (!obj) {
+ r_valid = false;
+ *value = Variant();
+ return;
+ }
+ *value = obj->getvar(*key, &r_valid);
+ }
+ static void ptr_get(const void *base, const void *key, void *value) {
+ const Object *obj = PtrToArg<Object *>::convert(base);
+ NULL_TEST(obj);
+ Variant v = obj->getvar(PtrToArg<Variant>::convert(key));
+ PtrToArg<Variant>::encode(v, value);
+ }
+ static void set(Variant *base, const Variant *key, const Variant *value, bool &r_valid) {
+ Object *obj = base->get_validated_object();
+
+ if (!obj) {
+ r_valid = false;
+ return;
+ }
+ obj->setvar(*key, *value, &r_valid);
+ }
+ static void ptr_set(void *base, const void *key, const void *value) {
+ Object *obj = PtrToArg<Object *>::convert(base);
+ NULL_TEST(obj);
+ obj->setvar(PtrToArg<Variant>::convert(key), PtrToArg<Variant>::convert(value));
+ }
+
+ static bool has(const Variant *base, const Variant *key, bool &r_valid) {
+ Object *obj = base->get_validated_object();
+ if (obj != nullptr) {
+ r_valid = false;
+ return false;
+ }
+ r_valid = true;
+ bool exists;
+ obj->getvar(*key, &exists);
+ return exists;
+ }
+ static bool ptr_has(const void *base, const void *key) {
+ const Object *obj = PtrToArg<Object *>::convert(base);
+ ERR_FAIL_COND_V(!obj, false);
+ bool valid;
+ obj->getvar(PtrToArg<Variant>::convert(key), &valid);
+ return valid;
+ }
+};
+
+/*typedef void (*ValidatedKeyedSetter)(Variant *base, const Variant *key, const Variant *value);
+typedef void (*ValidatedKeyedGetter)(const Variant *base, const Variant *key, Variant *value, bool &valid);
+typedef bool (*ValidatedKeyedChecker)(const Variant *base, const Variant *key);
+
+typedef void (*PTRKeyedSetter)(void *base, const void *key, const void *value);
+typedef void (*PTRKeyedGetter)(const void *base, const void *key, void *value);
+typedef bool (*PTRKeyedChecker)(const void *base, const void *key);*/
+
+struct VariantKeyedSetterGetterInfo {
+ Variant::ValidatedKeyedSetter validated_setter;
+ Variant::ValidatedKeyedGetter validated_getter;
+ Variant::ValidatedKeyedChecker validated_checker;
+
+ Variant::PTRKeyedSetter ptr_setter;
+ Variant::PTRKeyedGetter ptr_getter;
+ Variant::PTRKeyedChecker ptr_checker;
+
+ bool valid = false;
+};
+
+static VariantKeyedSetterGetterInfo variant_keyed_setters_getters[Variant::VARIANT_MAX];
+
+template <class T>
+static void register_keyed_member(Variant::Type p_type) {
+ VariantKeyedSetterGetterInfo &sgi = variant_keyed_setters_getters[p_type];
+
+ sgi.validated_setter = T::set;
+ sgi.ptr_setter = T::ptr_set;
+
+ sgi.validated_getter = T::get;
+ sgi.ptr_getter = T::ptr_get;
+
+ sgi.validated_checker = T::has;
+ sgi.ptr_checker = T::ptr_has;
+
+ sgi.valid = true;
+}
+
+static void register_keyed_setters_getters() {
+ register_keyed_member<VariantKeyedSetGetDictionary>(Variant::DICTIONARY);
+ register_keyed_member<VariantKeyedSetGetObject>(Variant::OBJECT);
+}
+bool Variant::is_keyed(Variant::Type p_type) {
+ ERR_FAIL_INDEX_V(p_type, VARIANT_MAX, false);
+ return variant_keyed_setters_getters[p_type].valid;
+}
+
+Variant::ValidatedKeyedSetter Variant::get_member_validated_keyed_setter(Variant::Type p_type) {
+ ERR_FAIL_INDEX_V(p_type, VARIANT_MAX, nullptr);
+ return variant_keyed_setters_getters[p_type].validated_setter;
+}
+Variant::ValidatedKeyedGetter Variant::get_member_validated_keyed_getter(Variant::Type p_type) {
+ ERR_FAIL_INDEX_V(p_type, VARIANT_MAX, nullptr);
+ return variant_keyed_setters_getters[p_type].validated_getter;
+}
+Variant::ValidatedKeyedChecker Variant::get_member_validated_keyed_checker(Variant::Type p_type) {
+ ERR_FAIL_INDEX_V(p_type, VARIANT_MAX, nullptr);
+ return variant_keyed_setters_getters[p_type].validated_checker;
+}
+
+Variant::PTRKeyedSetter Variant::get_member_ptr_keyed_setter(Variant::Type p_type) {
+ ERR_FAIL_INDEX_V(p_type, VARIANT_MAX, nullptr);
+ return variant_keyed_setters_getters[p_type].ptr_setter;
+}
+Variant::PTRKeyedGetter Variant::get_member_ptr_keyed_getter(Variant::Type p_type) {
+ ERR_FAIL_INDEX_V(p_type, VARIANT_MAX, nullptr);
+ return variant_keyed_setters_getters[p_type].ptr_getter;
+}
+Variant::PTRKeyedChecker Variant::get_member_ptr_keyed_checker(Variant::Type p_type) {
+ ERR_FAIL_INDEX_V(p_type, VARIANT_MAX, nullptr);
+ return variant_keyed_setters_getters[p_type].ptr_checker;
+}
+
+void Variant::set_keyed(const Variant &p_key, const Variant &p_value, bool &r_valid) {
+ if (likely(variant_keyed_setters_getters[type].valid)) {
+ variant_keyed_setters_getters[type].validated_setter(this, &p_key, &p_value, r_valid);
+ } else {
+ r_valid = false;
+ }
+}
+Variant Variant::get_keyed(const Variant &p_key, bool &r_valid) const {
+ if (likely(variant_keyed_setters_getters[type].valid)) {
+ Variant ret;
+ variant_keyed_setters_getters[type].validated_getter(this, &p_key, &ret, r_valid);
+ return ret;
+ } else {
+ r_valid = false;
+ return Variant();
+ }
+}
+bool Variant::has_key(const Variant &p_key, bool &r_valid) const {
+ if (likely(variant_keyed_setters_getters[type].valid)) {
+ return variant_keyed_setters_getters[type].validated_checker(this, &p_key, r_valid);
+ } else {
+ r_valid = false;
+ return false;
+ }
+}
+
+void Variant::set(const Variant &p_index, const Variant &p_value, bool *r_valid) {
+ if (type == DICTIONARY || type == OBJECT) {
+ bool valid;
+ set_keyed(p_index, p_value, valid);
+ if (r_valid) {
+ *r_valid = valid;
+ }
+ } else {
+ bool valid = false;
+ if (p_index.get_type() == STRING_NAME) {
+ set_named(*VariantGetInternalPtr<StringName>::get_ptr(&p_index), p_value, valid);
+ } else if (p_index.get_type() == INT) {
+ bool obb;
+ set_indexed(*VariantGetInternalPtr<int64_t>::get_ptr(&p_index), p_value, valid, obb);
+ if (obb) {
+ valid = false;
+ }
+ } else if (p_index.get_type() == STRING) { // less efficient version of named
+ set_named(*VariantGetInternalPtr<String>::get_ptr(&p_index), p_value, valid);
+ } else if (p_index.get_type() == FLOAT) { // less efficient version of indexed
+ bool obb;
+ set_indexed(*VariantGetInternalPtr<double>::get_ptr(&p_index), p_value, valid, obb);
+ if (obb) {
+ valid = false;
+ }
+ }
+ if (r_valid) {
+ *r_valid = valid;
+ }
+ }
+}
+
+Variant Variant::get(const Variant &p_index, bool *r_valid) const {
+ Variant ret;
+ if (type == DICTIONARY || type == OBJECT) {
+ bool valid;
+ ret = get_keyed(p_index, valid);
+ if (r_valid) {
+ *r_valid = valid;
+ }
+ } else {
+ bool valid = false;
+ if (p_index.get_type() == STRING_NAME) {
+ ret = get_named(*VariantGetInternalPtr<StringName>::get_ptr(&p_index), valid);
+ } else if (p_index.get_type() == INT) {
+ bool obb;
+ ret = get_indexed(*VariantGetInternalPtr<int64_t>::get_ptr(&p_index), valid, obb);
+ if (obb) {
+ valid = false;
+ }
+ } else if (p_index.get_type() == STRING) { // less efficient version of named
+ ret = get_named(*VariantGetInternalPtr<String>::get_ptr(&p_index), valid);
+ } else if (p_index.get_type() == FLOAT) { // less efficient version of indexed
+ bool obb;
+ ret = get_indexed(*VariantGetInternalPtr<double>::get_ptr(&p_index), valid, obb);
+ if (obb) {
+ valid = false;
+ }
+ }
+ if (r_valid) {
+ *r_valid = valid;
+ }
+ }
+
+ return ret;
+}
+
+void Variant::get_property_list(List<PropertyInfo> *p_list) const {
+ if (type == DICTIONARY) {
+ const Dictionary *dic = reinterpret_cast<const Dictionary *>(_data._mem);
+ List<Variant> keys;
+ dic->get_key_list(&keys);
+ for (List<Variant>::Element *E = keys.front(); E; E = E->next()) {
+ if (E->get().get_type() == Variant::STRING) {
+ p_list->push_back(PropertyInfo(Variant::STRING, E->get()));
+ }
+ }
+ } else if (type == OBJECT) {
+ Object *obj = get_validated_object();
+ ERR_FAIL_COND(!obj);
+ obj->get_property_list(p_list);
+
+ } else {
+ List<StringName> members;
+ get_member_list(type, &members);
+ for (List<StringName>::Element *E = members.front(); E; E = E->next()) {
+ PropertyInfo pi;
+ pi.name = E->get();
+ pi.type = get_member_type(type, E->get());
+ p_list->push_back(pi);
+ }
+ }
+}
+
+bool Variant::iter_init(Variant &r_iter, bool &valid) const {
+ valid = true;
+ switch (type) {
+ case INT: {
+ r_iter = 0;
+ return _data._int > 0;
+ } break;
+ case FLOAT: {
+ r_iter = 0;
+ return _data._float > 0.0;
+ } break;
+ case VECTOR2: {
+ double from = reinterpret_cast<const Vector2 *>(_data._mem)->x;
+ double to = reinterpret_cast<const Vector2 *>(_data._mem)->y;
+
+ r_iter = from;
+
+ return from < to;
+ } break;
+ case VECTOR2I: {
+ int64_t from = reinterpret_cast<const Vector2i *>(_data._mem)->x;
+ int64_t to = reinterpret_cast<const Vector2i *>(_data._mem)->y;
+
+ r_iter = from;
+
+ return from < to;
+ } break;
+ case VECTOR3: {
+ double from = reinterpret_cast<const Vector3 *>(_data._mem)->x;
+ double to = reinterpret_cast<const Vector3 *>(_data._mem)->y;
+ double step = reinterpret_cast<const Vector3 *>(_data._mem)->z;
+
+ r_iter = from;
+
+ if (from == to) {
+ return false;
+ } else if (from < to) {
+ return step > 0;
+ }
+ return step < 0;
+ } break;
+ case VECTOR3I: {
+ int64_t from = reinterpret_cast<const Vector3i *>(_data._mem)->x;
+ int64_t to = reinterpret_cast<const Vector3i *>(_data._mem)->y;
+ int64_t step = reinterpret_cast<const Vector3i *>(_data._mem)->z;
+
+ r_iter = from;
+
+ if (from == to) {
+ return false;
+ } else if (from < to) {
+ return step > 0;
+ }
+ return step < 0;
+ } break;
+ case OBJECT: {
+ if (!_get_obj().obj) {
+ valid = false;
+ return false;
+ }
+
+#ifdef DEBUG_ENABLED
+
+ if (EngineDebugger::is_active() && !_get_obj().id.is_reference() && ObjectDB::get_instance(_get_obj().id) == nullptr) {
+ valid = false;
+ return false;
+ }
+
+#endif
+ Callable::CallError ce;
+ ce.error = Callable::CallError::CALL_OK;
+ Array ref;
+ ref.push_back(r_iter);
+ Variant vref = ref;
+ const Variant *refp[] = { &vref };
+ Variant ret = _get_obj().obj->call(CoreStringNames::get_singleton()->_iter_init, refp, 1, ce);
+
+ if (ref.size() != 1 || ce.error != Callable::CallError::CALL_OK) {
+ valid = false;
+ return false;
+ }
+
+ r_iter = ref[0];
+ return ret;
+ } break;
+
+ case STRING: {
+ const String *str = reinterpret_cast<const String *>(_data._mem);
+ if (str->empty()) {
+ return false;
+ }
+ r_iter = 0;
+ return true;
+ } break;
+ case DICTIONARY: {
+ const Dictionary *dic = reinterpret_cast<const Dictionary *>(_data._mem);
+ if (dic->empty()) {
+ return false;
+ }
+
+ const Variant *next = dic->next(nullptr);
+ r_iter = *next;
+ return true;
+
+ } break;
+ case ARRAY: {
+ const Array *arr = reinterpret_cast<const Array *>(_data._mem);
+ if (arr->empty()) {
+ return false;
+ }
+ r_iter = 0;
+ return true;
+ } break;
+ case PACKED_BYTE_ARRAY: {
+ const Vector<uint8_t> *arr = &PackedArrayRef<uint8_t>::get_array(_data.packed_array);
+ if (arr->size() == 0) {
+ return false;
+ }
+ r_iter = 0;
+ return true;
+
+ } break;
+ case PACKED_INT32_ARRAY: {
+ const Vector<int32_t> *arr = &PackedArrayRef<int32_t>::get_array(_data.packed_array);
+ if (arr->size() == 0) {
+ return false;
+ }
+ r_iter = 0;
+ return true;
+
+ } break;
+ case PACKED_INT64_ARRAY: {
+ const Vector<int64_t> *arr = &PackedArrayRef<int64_t>::get_array(_data.packed_array);
+ if (arr->size() == 0) {
+ return false;
+ }
+ r_iter = 0;
+ return true;
+
+ } break;
+ case PACKED_FLOAT32_ARRAY: {
+ const Vector<float> *arr = &PackedArrayRef<float>::get_array(_data.packed_array);
+ if (arr->size() == 0) {
+ return false;
+ }
+ r_iter = 0;
+ return true;
+
+ } break;
+ case PACKED_FLOAT64_ARRAY: {
+ const Vector<double> *arr = &PackedArrayRef<double>::get_array(_data.packed_array);
+ if (arr->size() == 0) {
+ return false;
+ }
+ r_iter = 0;
+ return true;
+
+ } break;
+ case PACKED_STRING_ARRAY: {
+ const Vector<String> *arr = &PackedArrayRef<String>::get_array(_data.packed_array);
+ if (arr->size() == 0) {
+ return false;
+ }
+ r_iter = 0;
+ return true;
+ } break;
+ case PACKED_VECTOR2_ARRAY: {
+ const Vector<Vector2> *arr = &PackedArrayRef<Vector2>::get_array(_data.packed_array);
+ if (arr->size() == 0) {
+ return false;
+ }
+ r_iter = 0;
+ return true;
+ } break;
+ case PACKED_VECTOR3_ARRAY: {
+ const Vector<Vector3> *arr = &PackedArrayRef<Vector3>::get_array(_data.packed_array);
+ if (arr->size() == 0) {
+ return false;
+ }
+ r_iter = 0;
+ return true;
+ } break;
+ case PACKED_COLOR_ARRAY: {
+ const Vector<Color> *arr = &PackedArrayRef<Color>::get_array(_data.packed_array);
+ if (arr->size() == 0) {
+ return false;
+ }
+ r_iter = 0;
+ return true;
+
+ } break;
+ default: {
+ }
+ }
+
+ valid = false;
+ return false;
+}
+
+bool Variant::iter_next(Variant &r_iter, bool &valid) const {
+ valid = true;
+ switch (type) {
+ case INT: {
+ int64_t idx = r_iter;
+ idx++;
+ if (idx >= _data._int) {
+ return false;
+ }
+ r_iter = idx;
+ return true;
+ } break;
+ case FLOAT: {
+ int64_t idx = r_iter;
+ idx++;
+ if (idx >= _data._float) {
+ return false;
+ }
+ r_iter = idx;
+ return true;
+ } break;
+ case VECTOR2: {
+ double to = reinterpret_cast<const Vector2 *>(_data._mem)->y;
+
+ double idx = r_iter;
+ idx++;
+
+ if (idx >= to) {
+ return false;
+ }
+
+ r_iter = idx;
+ return true;
+ } break;
+ case VECTOR2I: {
+ int64_t to = reinterpret_cast<const Vector2i *>(_data._mem)->y;
+
+ int64_t idx = r_iter;
+ idx++;
+
+ if (idx >= to) {
+ return false;
+ }
+
+ r_iter = idx;
+ return true;
+ } break;
+ case VECTOR3: {
+ double to = reinterpret_cast<const Vector3 *>(_data._mem)->y;
+ double step = reinterpret_cast<const Vector3 *>(_data._mem)->z;
+
+ double idx = r_iter;
+ idx += step;
+
+ if (step < 0 && idx <= to) {
+ return false;
+ }
+
+ if (step > 0 && idx >= to) {
+ return false;
+ }
+
+ r_iter = idx;
+ return true;
+ } break;
+ case VECTOR3I: {
+ int64_t to = reinterpret_cast<const Vector3i *>(_data._mem)->y;
+ int64_t step = reinterpret_cast<const Vector3i *>(_data._mem)->z;
+
+ int64_t idx = r_iter;
+ idx += step;
+
+ if (step < 0 && idx <= to) {
+ return false;
+ }
+
+ if (step > 0 && idx >= to) {
+ return false;
+ }
+
+ r_iter = idx;
+ return true;
+ } break;
+ case OBJECT: {
+ if (!_get_obj().obj) {
+ valid = false;
+ return false;
+ }
+
+#ifdef DEBUG_ENABLED
+
+ if (EngineDebugger::is_active() && !_get_obj().id.is_reference() && ObjectDB::get_instance(_get_obj().id) == nullptr) {
+ valid = false;
+ return false;
+ }
+
+#endif
+ Callable::CallError ce;
+ ce.error = Callable::CallError::CALL_OK;
+ Array ref;
+ ref.push_back(r_iter);
+ Variant vref = ref;
+ const Variant *refp[] = { &vref };
+ Variant ret = _get_obj().obj->call(CoreStringNames::get_singleton()->_iter_next, refp, 1, ce);
+
+ if (ref.size() != 1 || ce.error != Callable::CallError::CALL_OK) {
+ valid = false;
+ return false;
+ }
+
+ r_iter = ref[0];
+
+ return ret;
+ } break;
+
+ case STRING: {
+ const String *str = reinterpret_cast<const String *>(_data._mem);
+ int idx = r_iter;
+ idx++;
+ if (idx >= str->length()) {
+ return false;
+ }
+ r_iter = idx;
+ return true;
+ } break;
+ case DICTIONARY: {
+ const Dictionary *dic = reinterpret_cast<const Dictionary *>(_data._mem);
+ const Variant *next = dic->next(&r_iter);
+ if (!next) {
+ return false;
+ }
+
+ r_iter = *next;
+ return true;
+
+ } break;
+ case ARRAY: {
+ const Array *arr = reinterpret_cast<const Array *>(_data._mem);
+ int idx = r_iter;
+ idx++;
+ if (idx >= arr->size()) {
+ return false;
+ }
+ r_iter = idx;
+ return true;
+ } break;
+ case PACKED_BYTE_ARRAY: {
+ const Vector<uint8_t> *arr = &PackedArrayRef<uint8_t>::get_array(_data.packed_array);
+ int idx = r_iter;
+ idx++;
+ if (idx >= arr->size()) {
+ return false;
+ }
+ r_iter = idx;
+ return true;
+
+ } break;
+ case PACKED_INT32_ARRAY: {
+ const Vector<int32_t> *arr = &PackedArrayRef<int32_t>::get_array(_data.packed_array);
+ int32_t idx = r_iter;
+ idx++;
+ if (idx >= arr->size()) {
+ return false;
+ }
+ r_iter = idx;
+ return true;
+
+ } break;
+ case PACKED_INT64_ARRAY: {
+ const Vector<int64_t> *arr = &PackedArrayRef<int64_t>::get_array(_data.packed_array);
+ int64_t idx = r_iter;
+ idx++;
+ if (idx >= arr->size()) {
+ return false;
+ }
+ r_iter = idx;
+ return true;
+
+ } break;
+ case PACKED_FLOAT32_ARRAY: {
+ const Vector<float> *arr = &PackedArrayRef<float>::get_array(_data.packed_array);
+ int idx = r_iter;
+ idx++;
+ if (idx >= arr->size()) {
+ return false;
+ }
+ r_iter = idx;
+ return true;
+
+ } break;
+ case PACKED_FLOAT64_ARRAY: {
+ const Vector<double> *arr = &PackedArrayRef<double>::get_array(_data.packed_array);
+ int idx = r_iter;
+ idx++;
+ if (idx >= arr->size()) {
+ return false;
+ }
+ r_iter = idx;
+ return true;
+
+ } break;
+ case PACKED_STRING_ARRAY: {
+ const Vector<String> *arr = &PackedArrayRef<String>::get_array(_data.packed_array);
+ int idx = r_iter;
+ idx++;
+ if (idx >= arr->size()) {
+ return false;
+ }
+ r_iter = idx;
+ return true;
+ } break;
+ case PACKED_VECTOR2_ARRAY: {
+ const Vector<Vector2> *arr = &PackedArrayRef<Vector2>::get_array(_data.packed_array);
+ int idx = r_iter;
+ idx++;
+ if (idx >= arr->size()) {
+ return false;
+ }
+ r_iter = idx;
+ return true;
+ } break;
+ case PACKED_VECTOR3_ARRAY: {
+ const Vector<Vector3> *arr = &PackedArrayRef<Vector3>::get_array(_data.packed_array);
+ int idx = r_iter;
+ idx++;
+ if (idx >= arr->size()) {
+ return false;
+ }
+ r_iter = idx;
+ return true;
+ } break;
+ case PACKED_COLOR_ARRAY: {
+ const Vector<Color> *arr = &PackedArrayRef<Color>::get_array(_data.packed_array);
+ int idx = r_iter;
+ idx++;
+ if (idx >= arr->size()) {
+ return false;
+ }
+ r_iter = idx;
+ return true;
+ } break;
+ default: {
+ }
+ }
+
+ valid = false;
+ return false;
+}
+
+Variant Variant::iter_get(const Variant &r_iter, bool &r_valid) const {
+ r_valid = true;
+ switch (type) {
+ case INT: {
+ return r_iter;
+ } break;
+ case FLOAT: {
+ return r_iter;
+ } break;
+ case VECTOR2: {
+ return r_iter;
+ } break;
+ case VECTOR2I: {
+ return r_iter;
+ } break;
+ case VECTOR3: {
+ return r_iter;
+ } break;
+ case VECTOR3I: {
+ return r_iter;
+ } break;
+ case OBJECT: {
+ if (!_get_obj().obj) {
+ r_valid = false;
+ return Variant();
+ }
+#ifdef DEBUG_ENABLED
+ if (EngineDebugger::is_active() && !_get_obj().id.is_reference() && ObjectDB::get_instance(_get_obj().id) == nullptr) {
+ r_valid = false;
+ return Variant();
+ }
+
+#endif
+ Callable::CallError ce;
+ ce.error = Callable::CallError::CALL_OK;
+ const Variant *refp[] = { &r_iter };
+ Variant ret = _get_obj().obj->call(CoreStringNames::get_singleton()->_iter_get, refp, 1, ce);
+
+ if (ce.error != Callable::CallError::CALL_OK) {
+ r_valid = false;
+ return Variant();
+ }
+
+ //r_iter=ref[0];
+
+ return ret;
+ } break;
+
+ case STRING: {
+ const String *str = reinterpret_cast<const String *>(_data._mem);
+ return str->substr(r_iter, 1);
+ } break;
+ case DICTIONARY: {
+ return r_iter; //iterator is the same as the key
+
+ } break;
+ case ARRAY: {
+ const Array *arr = reinterpret_cast<const Array *>(_data._mem);
+ int idx = r_iter;
+#ifdef DEBUG_ENABLED
+ if (idx < 0 || idx >= arr->size()) {
+ r_valid = false;
+ return Variant();
+ }
+#endif
+ return arr->get(idx);
+ } break;
+ case PACKED_BYTE_ARRAY: {
+ const Vector<uint8_t> *arr = &PackedArrayRef<uint8_t>::get_array(_data.packed_array);
+ int idx = r_iter;
+#ifdef DEBUG_ENABLED
+ if (idx < 0 || idx >= arr->size()) {
+ r_valid = false;
+ return Variant();
+ }
+#endif
+ return arr->get(idx);
+ } break;
+ case PACKED_INT32_ARRAY: {
+ const Vector<int32_t> *arr = &PackedArrayRef<int32_t>::get_array(_data.packed_array);
+ int32_t idx = r_iter;
+#ifdef DEBUG_ENABLED
+ if (idx < 0 || idx >= arr->size()) {
+ r_valid = false;
+ return Variant();
+ }
+#endif
+ return arr->get(idx);
+ } break;
+ case PACKED_INT64_ARRAY: {
+ const Vector<int64_t> *arr = &PackedArrayRef<int64_t>::get_array(_data.packed_array);
+ int64_t idx = r_iter;
+#ifdef DEBUG_ENABLED
+ if (idx < 0 || idx >= arr->size()) {
+ r_valid = false;
+ return Variant();
+ }
+#endif
+ return arr->get(idx);
+ } break;
+ case PACKED_FLOAT32_ARRAY: {
+ const Vector<float> *arr = &PackedArrayRef<float>::get_array(_data.packed_array);
+ int idx = r_iter;
+#ifdef DEBUG_ENABLED
+ if (idx < 0 || idx >= arr->size()) {
+ r_valid = false;
+ return Variant();
+ }
+#endif
+ return arr->get(idx);
+ } break;
+ case PACKED_FLOAT64_ARRAY: {
+ const Vector<double> *arr = &PackedArrayRef<double>::get_array(_data.packed_array);
+ int idx = r_iter;
+#ifdef DEBUG_ENABLED
+ if (idx < 0 || idx >= arr->size()) {
+ r_valid = false;
+ return Variant();
+ }
+#endif
+ return arr->get(idx);
+ } break;
+ case PACKED_STRING_ARRAY: {
+ const Vector<String> *arr = &PackedArrayRef<String>::get_array(_data.packed_array);
+ int idx = r_iter;
+#ifdef DEBUG_ENABLED
+ if (idx < 0 || idx >= arr->size()) {
+ r_valid = false;
+ return Variant();
+ }
+#endif
+ return arr->get(idx);
+ } break;
+ case PACKED_VECTOR2_ARRAY: {
+ const Vector<Vector2> *arr = &PackedArrayRef<Vector2>::get_array(_data.packed_array);
+ int idx = r_iter;
+#ifdef DEBUG_ENABLED
+ if (idx < 0 || idx >= arr->size()) {
+ r_valid = false;
+ return Variant();
+ }
+#endif
+ return arr->get(idx);
+ } break;
+ case PACKED_VECTOR3_ARRAY: {
+ const Vector<Vector3> *arr = &PackedArrayRef<Vector3>::get_array(_data.packed_array);
+ int idx = r_iter;
+#ifdef DEBUG_ENABLED
+ if (idx < 0 || idx >= arr->size()) {
+ r_valid = false;
+ return Variant();
+ }
+#endif
+ return arr->get(idx);
+ } break;
+ case PACKED_COLOR_ARRAY: {
+ const Vector<Color> *arr = &PackedArrayRef<Color>::get_array(_data.packed_array);
+ int idx = r_iter;
+#ifdef DEBUG_ENABLED
+ if (idx < 0 || idx >= arr->size()) {
+ r_valid = false;
+ return Variant();
+ }
+#endif
+ return arr->get(idx);
+ } break;
+ default: {
+ }
+ }
+
+ r_valid = false;
+ return Variant();
+}
+
+Variant Variant::duplicate(bool deep) const {
+ switch (type) {
+ case OBJECT: {
+ /* breaks stuff :(
+ if (deep && !_get_obj().ref.is_null()) {
+ Ref<Resource> resource = _get_obj().ref;
+ if (resource.is_valid()) {
+ return resource->duplicate(true);
+ }
+ }
+ */
+ return *this;
+ } break;
+ case DICTIONARY:
+ return operator Dictionary().duplicate(deep);
+ case ARRAY:
+ return operator Array().duplicate(deep);
+ default:
+ return *this;
+ }
+}
+
+void Variant::blend(const Variant &a, const Variant &b, float c, Variant &r_dst) {
+ if (a.type != b.type) {
+ if (a.is_num() && b.is_num()) {
+ real_t va = a;
+ real_t vb = b;
+ r_dst = va + vb * c;
+ } else {
+ r_dst = a;
+ }
+ return;
+ }
+
+ switch (a.type) {
+ case NIL: {
+ r_dst = Variant();
+ }
+ return;
+ case INT: {
+ int64_t va = a._data._int;
+ int64_t vb = b._data._int;
+ r_dst = int(va + vb * c + 0.5);
+ }
+ return;
+ case FLOAT: {
+ double ra = a._data._float;
+ double rb = b._data._float;
+ r_dst = ra + rb * c;
+ }
+ return;
+ case VECTOR2: {
+ r_dst = *reinterpret_cast<const Vector2 *>(a._data._mem) + *reinterpret_cast<const Vector2 *>(b._data._mem) * c;
+ }
+ return;
+ case VECTOR2I: {
+ int32_t vax = reinterpret_cast<const Vector2i *>(a._data._mem)->x;
+ int32_t vbx = reinterpret_cast<const Vector2i *>(b._data._mem)->x;
+ int32_t vay = reinterpret_cast<const Vector2i *>(a._data._mem)->y;
+ int32_t vby = reinterpret_cast<const Vector2i *>(b._data._mem)->y;
+ r_dst = Vector2i(int32_t(vax + vbx * c + 0.5), int32_t(vay + vby * c + 0.5));
+ }
+ return;
+ case RECT2: {
+ const Rect2 *ra = reinterpret_cast<const Rect2 *>(a._data._mem);
+ const Rect2 *rb = reinterpret_cast<const Rect2 *>(b._data._mem);
+ r_dst = Rect2(ra->position + rb->position * c, ra->size + rb->size * c);
+ }
+ return;
+ case RECT2I: {
+ const Rect2i *ra = reinterpret_cast<const Rect2i *>(a._data._mem);
+ const Rect2i *rb = reinterpret_cast<const Rect2i *>(b._data._mem);
+
+ int32_t vax = ra->position.x;
+ int32_t vay = ra->position.y;
+ int32_t vbx = ra->size.x;
+ int32_t vby = ra->size.y;
+ int32_t vcx = rb->position.x;
+ int32_t vcy = rb->position.y;
+ int32_t vdx = rb->size.x;
+ int32_t vdy = rb->size.y;
+
+ r_dst = Rect2i(int32_t(vax + vbx * c + 0.5), int32_t(vay + vby * c + 0.5), int32_t(vcx + vdx * c + 0.5), int32_t(vcy + vdy * c + 0.5));
+ }
+ return;
+ case VECTOR3: {
+ r_dst = *reinterpret_cast<const Vector3 *>(a._data._mem) + *reinterpret_cast<const Vector3 *>(b._data._mem) * c;
+ }
+ return;
+ case VECTOR3I: {
+ int32_t vax = reinterpret_cast<const Vector3i *>(a._data._mem)->x;
+ int32_t vbx = reinterpret_cast<const Vector3i *>(b._data._mem)->x;
+ int32_t vay = reinterpret_cast<const Vector3i *>(a._data._mem)->y;
+ int32_t vby = reinterpret_cast<const Vector3i *>(b._data._mem)->y;
+ int32_t vaz = reinterpret_cast<const Vector3i *>(a._data._mem)->z;
+ int32_t vbz = reinterpret_cast<const Vector3i *>(b._data._mem)->z;
+ r_dst = Vector3i(int32_t(vax + vbx * c + 0.5), int32_t(vay + vby * c + 0.5), int32_t(vaz + vbz * c + 0.5));
+ }
+ return;
+ case AABB: {
+ const ::AABB *ra = reinterpret_cast<const ::AABB *>(a._data._mem);
+ const ::AABB *rb = reinterpret_cast<const ::AABB *>(b._data._mem);
+ r_dst = ::AABB(ra->position + rb->position * c, ra->size + rb->size * c);
+ }
+ return;
+ case QUAT: {
+ Quat empty_rot;
+ const Quat *qa = reinterpret_cast<const Quat *>(a._data._mem);
+ const Quat *qb = reinterpret_cast<const Quat *>(b._data._mem);
+ r_dst = *qa * empty_rot.slerp(*qb, c);
+ }
+ return;
+ case COLOR: {
+ const Color *ca = reinterpret_cast<const Color *>(a._data._mem);
+ const Color *cb = reinterpret_cast<const Color *>(b._data._mem);
+ float new_r = ca->r + cb->r * c;
+ float new_g = ca->g + cb->g * c;
+ float new_b = ca->b + cb->b * c;
+ float new_a = ca->a + cb->a * c;
+ new_r = new_r > 1.0 ? 1.0 : new_r;
+ new_g = new_g > 1.0 ? 1.0 : new_g;
+ new_b = new_b > 1.0 ? 1.0 : new_b;
+ new_a = new_a > 1.0 ? 1.0 : new_a;
+ r_dst = Color(new_r, new_g, new_b, new_a);
+ }
+ return;
+ default: {
+ r_dst = c < 0.5 ? a : b;
+ }
+ return;
+ }
+}
+
+void Variant::interpolate(const Variant &a, const Variant &b, float c, Variant &r_dst) {
+ if (a.type != b.type) {
+ if (a.is_num() && b.is_num()) {
+ //not as efficient but..
+ real_t va = a;
+ real_t vb = b;
+ r_dst = va + (vb - va) * c;
+
+ } else {
+ r_dst = a;
+ }
+ return;
+ }
+
+ switch (a.type) {
+ case NIL: {
+ r_dst = Variant();
+ }
+ return;
+ case BOOL: {
+ r_dst = a;
+ }
+ return;
+ case INT: {
+ int64_t va = a._data._int;
+ int64_t vb = b._data._int;
+ r_dst = int(va + (vb - va) * c);
+ }
+ return;
+ case FLOAT: {
+ real_t va = a._data._float;
+ real_t vb = b._data._float;
+ r_dst = va + (vb - va) * c;
+ }
+ return;
+ case STRING: {
+ //this is pretty funny and bizarre, but artists like to use it for typewritter effects
+ String sa = *reinterpret_cast<const String *>(a._data._mem);
+ String sb = *reinterpret_cast<const String *>(b._data._mem);
+ String dst;
+ int sa_len = sa.length();
+ int sb_len = sb.length();
+ int csize = sa_len + (sb_len - sa_len) * c;
+ if (csize == 0) {
+ r_dst = "";
+ return;
+ }
+ dst.resize(csize + 1);
+ dst[csize] = 0;
+ int split = csize / 2;
+
+ for (int i = 0; i < csize; i++) {
+ char32_t chr = ' ';
+
+ if (i < split) {
+ if (i < sa.length()) {
+ chr = sa[i];
+ } else if (i < sb.length()) {
+ chr = sb[i];
+ }
+
+ } else {
+ if (i < sb.length()) {
+ chr = sb[i];
+ } else if (i < sa.length()) {
+ chr = sa[i];
+ }
+ }
+
+ dst[i] = chr;
+ }
+
+ r_dst = dst;
+ }
+ return;
+ case VECTOR2: {
+ r_dst = reinterpret_cast<const Vector2 *>(a._data._mem)->lerp(*reinterpret_cast<const Vector2 *>(b._data._mem), c);
+ }
+ return;
+ case VECTOR2I: {
+ int32_t vax = reinterpret_cast<const Vector2i *>(a._data._mem)->x;
+ int32_t vbx = reinterpret_cast<const Vector2i *>(b._data._mem)->x;
+ int32_t vay = reinterpret_cast<const Vector2i *>(a._data._mem)->y;
+ int32_t vby = reinterpret_cast<const Vector2i *>(b._data._mem)->y;
+ r_dst = Vector2i(int32_t(vax + vbx * c + 0.5), int32_t(vay + vby * c + 0.5));
+ }
+ return;
+
+ case RECT2: {
+ r_dst = Rect2(reinterpret_cast<const Rect2 *>(a._data._mem)->position.lerp(reinterpret_cast<const Rect2 *>(b._data._mem)->position, c), reinterpret_cast<const Rect2 *>(a._data._mem)->size.lerp(reinterpret_cast<const Rect2 *>(b._data._mem)->size, c));
+ }
+ return;
+ case RECT2I: {
+ const Rect2i *ra = reinterpret_cast<const Rect2i *>(a._data._mem);
+ const Rect2i *rb = reinterpret_cast<const Rect2i *>(b._data._mem);
+
+ int32_t vax = ra->position.x;
+ int32_t vay = ra->position.y;
+ int32_t vbx = ra->size.x;
+ int32_t vby = ra->size.y;
+ int32_t vcx = rb->position.x;
+ int32_t vcy = rb->position.y;
+ int32_t vdx = rb->size.x;
+ int32_t vdy = rb->size.y;
+
+ r_dst = Rect2i(int32_t(vax + vbx * c + 0.5), int32_t(vay + vby * c + 0.5), int32_t(vcx + vdx * c + 0.5), int32_t(vcy + vdy * c + 0.5));
+ }
+ return;
+
+ case VECTOR3: {
+ r_dst = reinterpret_cast<const Vector3 *>(a._data._mem)->lerp(*reinterpret_cast<const Vector3 *>(b._data._mem), c);
+ }
+ return;
+ case VECTOR3I: {
+ int32_t vax = reinterpret_cast<const Vector3i *>(a._data._mem)->x;
+ int32_t vbx = reinterpret_cast<const Vector3i *>(b._data._mem)->x;
+ int32_t vay = reinterpret_cast<const Vector3i *>(a._data._mem)->y;
+ int32_t vby = reinterpret_cast<const Vector3i *>(b._data._mem)->y;
+ int32_t vaz = reinterpret_cast<const Vector3i *>(a._data._mem)->z;
+ int32_t vbz = reinterpret_cast<const Vector3i *>(b._data._mem)->z;
+ r_dst = Vector3i(int32_t(vax + vbx * c + 0.5), int32_t(vay + vby * c + 0.5), int32_t(vaz + vbz * c + 0.5));
+ }
+ return;
+
+ case TRANSFORM2D: {
+ r_dst = a._data._transform2d->interpolate_with(*b._data._transform2d, c);
+ }
+ return;
+ case PLANE: {
+ r_dst = a;
+ }
+ return;
+ case QUAT: {
+ r_dst = reinterpret_cast<const Quat *>(a._data._mem)->slerp(*reinterpret_cast<const Quat *>(b._data._mem), c);
+ }
+ return;
+ case AABB: {
+ r_dst = ::AABB(a._data._aabb->position.lerp(b._data._aabb->position, c), a._data._aabb->size.lerp(b._data._aabb->size, c));
+ }
+ return;
+ case BASIS: {
+ r_dst = Transform(*a._data._basis).interpolate_with(Transform(*b._data._basis), c).basis;
+ }
+ return;
+ case TRANSFORM: {
+ r_dst = a._data._transform->interpolate_with(*b._data._transform, c);
+ }
+ return;
+ case COLOR: {
+ r_dst = reinterpret_cast<const Color *>(a._data._mem)->lerp(*reinterpret_cast<const Color *>(b._data._mem), c);
+ }
+ return;
+ case STRING_NAME: {
+ r_dst = a;
+ }
+ return;
+ case NODE_PATH: {
+ r_dst = a;
+ }
+ return;
+ case RID: {
+ r_dst = a;
+ }
+ return;
+ case OBJECT: {
+ r_dst = a;
+ }
+ return;
+ case DICTIONARY: {
+ }
+ return;
+ case ARRAY: {
+ r_dst = a;
+ }
+ return;
+ case PACKED_BYTE_ARRAY: {
+ r_dst = a;
+ }
+ return;
+ case PACKED_INT32_ARRAY: {
+ const Vector<int32_t> *arr_a = &PackedArrayRef<int32_t>::get_array(a._data.packed_array);
+ const Vector<int32_t> *arr_b = &PackedArrayRef<int32_t>::get_array(b._data.packed_array);
+ int32_t sz = arr_a->size();
+ if (sz == 0 || arr_b->size() != sz) {
+ r_dst = a;
+ } else {
+ Vector<int32_t> v;
+ v.resize(sz);
+ {
+ int32_t *vw = v.ptrw();
+ const int32_t *ar = arr_a->ptr();
+ const int32_t *br = arr_b->ptr();
+
+ Variant va;
+ for (int32_t i = 0; i < sz; i++) {
+ Variant::interpolate(ar[i], br[i], c, va);
+ vw[i] = va;
+ }
+ }
+ r_dst = v;
+ }
+ }
+ return;
+ case PACKED_INT64_ARRAY: {
+ const Vector<int64_t> *arr_a = &PackedArrayRef<int64_t>::get_array(a._data.packed_array);
+ const Vector<int64_t> *arr_b = &PackedArrayRef<int64_t>::get_array(b._data.packed_array);
+ int64_t sz = arr_a->size();
+ if (sz == 0 || arr_b->size() != sz) {
+ r_dst = a;
+ } else {
+ Vector<int64_t> v;
+ v.resize(sz);
+ {
+ int64_t *vw = v.ptrw();
+ const int64_t *ar = arr_a->ptr();
+ const int64_t *br = arr_b->ptr();
+
+ Variant va;
+ for (int64_t i = 0; i < sz; i++) {
+ Variant::interpolate(ar[i], br[i], c, va);
+ vw[i] = va;
+ }
+ }
+ r_dst = v;
+ }
+ }
+ return;
+ case PACKED_FLOAT32_ARRAY: {
+ const Vector<float> *arr_a = &PackedArrayRef<float>::get_array(a._data.packed_array);
+ const Vector<float> *arr_b = &PackedArrayRef<float>::get_array(b._data.packed_array);
+ int sz = arr_a->size();
+ if (sz == 0 || arr_b->size() != sz) {
+ r_dst = a;
+ } else {
+ Vector<float> v;
+ v.resize(sz);
+ {
+ float *vw = v.ptrw();
+ const float *ar = arr_a->ptr();
+ const float *br = arr_b->ptr();
+
+ Variant va;
+ for (int i = 0; i < sz; i++) {
+ Variant::interpolate(ar[i], br[i], c, va);
+ vw[i] = va;
+ }
+ }
+ r_dst = v;
+ }
+ }
+ return;
+ case PACKED_FLOAT64_ARRAY: {
+ const Vector<double> *arr_a = &PackedArrayRef<double>::get_array(a._data.packed_array);
+ const Vector<double> *arr_b = &PackedArrayRef<double>::get_array(b._data.packed_array);
+ int sz = arr_a->size();
+ if (sz == 0 || arr_b->size() != sz) {
+ r_dst = a;
+ } else {
+ Vector<double> v;
+ v.resize(sz);
+ {
+ double *vw = v.ptrw();
+ const double *ar = arr_a->ptr();
+ const double *br = arr_b->ptr();
+
+ Variant va;
+ for (int i = 0; i < sz; i++) {
+ Variant::interpolate(ar[i], br[i], c, va);
+ vw[i] = va;
+ }
+ }
+ r_dst = v;
+ }
+ }
+ return;
+ case PACKED_STRING_ARRAY: {
+ r_dst = a;
+ }
+ return;
+ case PACKED_VECTOR2_ARRAY: {
+ const Vector<Vector2> *arr_a = &PackedArrayRef<Vector2>::get_array(a._data.packed_array);
+ const Vector<Vector2> *arr_b = &PackedArrayRef<Vector2>::get_array(b._data.packed_array);
+ int sz = arr_a->size();
+ if (sz == 0 || arr_b->size() != sz) {
+ r_dst = a;
+ } else {
+ Vector<Vector2> v;
+ v.resize(sz);
+ {
+ Vector2 *vw = v.ptrw();
+ const Vector2 *ar = arr_a->ptr();
+ const Vector2 *br = arr_b->ptr();
+
+ for (int i = 0; i < sz; i++) {
+ vw[i] = ar[i].lerp(br[i], c);
+ }
+ }
+ r_dst = v;
+ }
+ }
+ return;
+ case PACKED_VECTOR3_ARRAY: {
+ const Vector<Vector3> *arr_a = &PackedArrayRef<Vector3>::get_array(a._data.packed_array);
+ const Vector<Vector3> *arr_b = &PackedArrayRef<Vector3>::get_array(b._data.packed_array);
+ int sz = arr_a->size();
+ if (sz == 0 || arr_b->size() != sz) {
+ r_dst = a;
+ } else {
+ Vector<Vector3> v;
+ v.resize(sz);
+ {
+ Vector3 *vw = v.ptrw();
+ const Vector3 *ar = arr_a->ptr();
+ const Vector3 *br = arr_b->ptr();
+
+ for (int i = 0; i < sz; i++) {
+ vw[i] = ar[i].lerp(br[i], c);
+ }
+ }
+ r_dst = v;
+ }
+ }
+ return;
+ case PACKED_COLOR_ARRAY: {
+ const Vector<Color> *arr_a = &PackedArrayRef<Color>::get_array(a._data.packed_array);
+ const Vector<Color> *arr_b = &PackedArrayRef<Color>::get_array(b._data.packed_array);
+ int sz = arr_a->size();
+ if (sz == 0 || arr_b->size() != sz) {
+ r_dst = a;
+ } else {
+ Vector<Color> v;
+ v.resize(sz);
+ {
+ Color *vw = v.ptrw();
+ const Color *ar = arr_a->ptr();
+ const Color *br = arr_b->ptr();
+
+ for (int i = 0; i < sz; i++) {
+ vw[i] = ar[i].lerp(br[i], c);
+ }
+ }
+ r_dst = v;
+ }
+ }
+ return;
+ default: {
+ r_dst = a;
+ }
+ }
+}
+
+void Variant::_register_variant_setters_getters() {
+ register_named_setters_getters();
+ register_indexed_setters_getters();
+ register_keyed_setters_getters();
+}
+void Variant::_unregister_variant_setters_getters() {
+ unregister_named_setters_getters();
+ unregister_indexed_setters_getters();
+}
diff --git a/core/variant_op.cpp b/core/variant_op.cpp
deleted file mode 100644
index 47539df856..0000000000
--- a/core/variant_op.cpp
+++ /dev/null
@@ -1,4608 +0,0 @@
-/*************************************************************************/
-/* variant_op.cpp */
-/*************************************************************************/
-/* This file is part of: */
-/* GODOT ENGINE */
-/* https://godotengine.org */
-/*************************************************************************/
-/* Copyright (c) 2007-2020 Juan Linietsky, Ariel Manzur. */
-/* Copyright (c) 2014-2020 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 "variant.h"
-
-#include "core/class_db.h"
-#include "core/core_string_names.h"
-#include "core/debugger/engine_debugger.h"
-
-#define CASE_TYPE_ALL(PREFIX, OP) \
- CASE_TYPE(PREFIX, OP, INT) \
- CASE_TYPE_ALL_BUT_INT(PREFIX, OP)
-
-#define CASE_TYPE_ALL_BUT_INT(PREFIX, OP) \
- CASE_TYPE(PREFIX, OP, NIL) \
- CASE_TYPE(PREFIX, OP, BOOL) \
- CASE_TYPE(PREFIX, OP, FLOAT) \
- CASE_TYPE(PREFIX, OP, STRING) \
- CASE_TYPE(PREFIX, OP, VECTOR2) \
- CASE_TYPE(PREFIX, OP, VECTOR2I) \
- CASE_TYPE(PREFIX, OP, RECT2) \
- CASE_TYPE(PREFIX, OP, RECT2I) \
- CASE_TYPE(PREFIX, OP, VECTOR3) \
- CASE_TYPE(PREFIX, OP, VECTOR3I) \
- CASE_TYPE(PREFIX, OP, TRANSFORM2D) \
- CASE_TYPE(PREFIX, OP, PLANE) \
- CASE_TYPE(PREFIX, OP, QUAT) \
- CASE_TYPE(PREFIX, OP, AABB) \
- CASE_TYPE(PREFIX, OP, BASIS) \
- CASE_TYPE(PREFIX, OP, TRANSFORM) \
- CASE_TYPE(PREFIX, OP, COLOR) \
- CASE_TYPE(PREFIX, OP, STRING_NAME) \
- CASE_TYPE(PREFIX, OP, NODE_PATH) \
- CASE_TYPE(PREFIX, OP, _RID) \
- CASE_TYPE(PREFIX, OP, OBJECT) \
- CASE_TYPE(PREFIX, OP, CALLABLE) \
- CASE_TYPE(PREFIX, OP, SIGNAL) \
- CASE_TYPE(PREFIX, OP, DICTIONARY) \
- CASE_TYPE(PREFIX, OP, ARRAY) \
- CASE_TYPE(PREFIX, OP, PACKED_BYTE_ARRAY) \
- CASE_TYPE(PREFIX, OP, PACKED_INT32_ARRAY) \
- CASE_TYPE(PREFIX, OP, PACKED_INT64_ARRAY) \
- CASE_TYPE(PREFIX, OP, PACKED_FLOAT32_ARRAY) \
- CASE_TYPE(PREFIX, OP, PACKED_FLOAT64_ARRAY) \
- CASE_TYPE(PREFIX, OP, PACKED_STRING_ARRAY) \
- CASE_TYPE(PREFIX, OP, PACKED_VECTOR2_ARRAY) \
- CASE_TYPE(PREFIX, OP, PACKED_VECTOR3_ARRAY) \
- CASE_TYPE(PREFIX, OP, PACKED_COLOR_ARRAY)
-
-#ifdef __GNUC__
-#define TYPE(PREFIX, OP, TYPE) &&PREFIX##_##OP##_##TYPE
-
-/* clang-format off */
-#define TYPES(PREFIX, OP) { \
- TYPE(PREFIX, OP, NIL), \
- TYPE(PREFIX, OP, BOOL), \
- TYPE(PREFIX, OP, INT), \
- TYPE(PREFIX, OP, FLOAT), \
- TYPE(PREFIX, OP, STRING), \
- TYPE(PREFIX, OP, VECTOR2), \
- TYPE(PREFIX, OP, VECTOR2I), \
- TYPE(PREFIX, OP, RECT2), \
- TYPE(PREFIX, OP, RECT2I), \
- TYPE(PREFIX, OP, VECTOR3), \
- TYPE(PREFIX, OP, VECTOR3I), \
- TYPE(PREFIX, OP, TRANSFORM2D), \
- TYPE(PREFIX, OP, PLANE), \
- TYPE(PREFIX, OP, QUAT), \
- TYPE(PREFIX, OP, AABB), \
- TYPE(PREFIX, OP, BASIS), \
- TYPE(PREFIX, OP, TRANSFORM), \
- TYPE(PREFIX, OP, COLOR), \
- TYPE(PREFIX, OP, STRING_NAME), \
- TYPE(PREFIX, OP, NODE_PATH), \
- TYPE(PREFIX, OP, _RID), \
- TYPE(PREFIX, OP, OBJECT), \
- TYPE(PREFIX, OP, CALLABLE), \
- TYPE(PREFIX, OP, SIGNAL), \
- TYPE(PREFIX, OP, DICTIONARY), \
- TYPE(PREFIX, OP, ARRAY), \
- TYPE(PREFIX, OP, PACKED_BYTE_ARRAY), \
- TYPE(PREFIX, OP, PACKED_INT32_ARRAY), \
- TYPE(PREFIX, OP, PACKED_INT64_ARRAY), \
- TYPE(PREFIX, OP, PACKED_FLOAT32_ARRAY), \
- TYPE(PREFIX, OP, PACKED_FLOAT64_ARRAY), \
- TYPE(PREFIX, OP, PACKED_STRING_ARRAY), \
- TYPE(PREFIX, OP, PACKED_VECTOR2_ARRAY), \
- TYPE(PREFIX, OP, PACKED_VECTOR3_ARRAY), \
- TYPE(PREFIX, OP, PACKED_COLOR_ARRAY), \
-}
-
-/* clang-format on */
-
-#define CASES(PREFIX) static const void *switch_table_##PREFIX[Variant::OP_MAX][Variant::VARIANT_MAX] = { \
- TYPES(PREFIX, OP_EQUAL), \
- TYPES(PREFIX, OP_NOT_EQUAL), \
- TYPES(PREFIX, OP_LESS), \
- TYPES(PREFIX, OP_LESS_EQUAL), \
- TYPES(PREFIX, OP_GREATER), \
- TYPES(PREFIX, OP_GREATER_EQUAL), \
- TYPES(PREFIX, OP_ADD), \
- TYPES(PREFIX, OP_SUBTRACT), \
- TYPES(PREFIX, OP_MULTIPLY), \
- TYPES(PREFIX, OP_DIVIDE), \
- TYPES(PREFIX, OP_NEGATE), \
- TYPES(PREFIX, OP_POSITIVE), \
- TYPES(PREFIX, OP_MODULE), \
- TYPES(PREFIX, OP_STRING_CONCAT), \
- TYPES(PREFIX, OP_SHIFT_LEFT), \
- TYPES(PREFIX, OP_SHIFT_RIGHT), \
- TYPES(PREFIX, OP_BIT_AND), \
- TYPES(PREFIX, OP_BIT_OR), \
- TYPES(PREFIX, OP_BIT_XOR), \
- TYPES(PREFIX, OP_BIT_NEGATE), \
- TYPES(PREFIX, OP_AND), \
- TYPES(PREFIX, OP_OR), \
- TYPES(PREFIX, OP_XOR), \
- TYPES(PREFIX, OP_NOT), \
- TYPES(PREFIX, OP_IN), \
-}
-
-#define SWITCH(PREFIX, op, val) goto *switch_table_##PREFIX[op][val];
-#define SWITCH_OP(PREFIX, OP, val)
-#define CASE_TYPE(PREFIX, OP, TYPE) PREFIX##_##OP##_##TYPE:
-
-#else
-#define CASES(PREFIX)
-#define SWITCH(PREFIX, op, val) switch (op)
-#define SWITCH_OP(PREFIX, OP, val) \
- case OP: \
- switch (val)
-#define CASE_TYPE(PREFIX, OP, TYPE) case TYPE:
-#endif
-
-Variant::operator bool() const {
- return booleanize();
-}
-
-// We consider all uninitialized or empty types to be false based on the type's
-// zeroiness.
-bool Variant::booleanize() const {
- return !is_zero();
-}
-
-#define _RETURN(m_what) \
- { \
- r_ret = m_what; \
- return; \
- }
-
-#define _RETURN_FAIL \
- { \
- r_valid = false; \
- return; \
- }
-
-#define DEFAULT_OP_NUM(m_prefix, m_op_name, m_name, m_op, m_type) \
- CASE_TYPE(m_prefix, m_op_name, m_name) { \
- if (p_b.type == INT) \
- _RETURN(p_a._data.m_type m_op p_b._data._int); \
- if (p_b.type == FLOAT) \
- _RETURN(p_a._data.m_type m_op p_b._data._float); \
- \
- _RETURN_FAIL \
- }
-
-#define DEFAULT_OP_NUM_NULL(m_prefix, m_op_name, m_name, m_op, m_type) \
- CASE_TYPE(m_prefix, m_op_name, m_name) { \
- if (p_b.type == INT) \
- _RETURN(p_a._data.m_type m_op p_b._data._int); \
- if (p_b.type == FLOAT) \
- _RETURN(p_a._data.m_type m_op p_b._data._float); \
- if (p_b.type == NIL) \
- _RETURN(!(p_b.type m_op NIL)); \
- \
- _RETURN_FAIL \
- }
-
-#ifdef DEBUG_ENABLED
-#define DEFAULT_OP_NUM_DIV(m_prefix, m_op_name, m_name, m_type) \
- CASE_TYPE(m_prefix, m_op_name, m_name) { \
- if (p_b.type == INT) { \
- if (p_b._data._int == 0) { \
- r_valid = false; \
- _RETURN("Division By Zero"); \
- } \
- _RETURN(p_a._data.m_type / p_b._data._int); \
- } \
- if (p_b.type == FLOAT) { \
- if (p_b._data._float == 0) { \
- r_valid = false; \
- _RETURN("Division By Zero"); \
- } \
- _RETURN(p_a._data.m_type / p_b._data._float); \
- } \
- \
- _RETURN_FAIL \
- }
-#else
-#define DEFAULT_OP_NUM_DIV(m_prefix, m_op_name, m_name, m_type) \
- CASE_TYPE(m_prefix, m_op_name, m_name) { \
- if (p_b.type == INT) \
- _RETURN(p_a._data.m_type / p_b._data._int); \
- if (p_b.type == FLOAT) \
- _RETURN(p_a._data.m_type / p_b._data._float); \
- \
- _RETURN_FAIL \
- }
-#endif
-
-#define DEFAULT_OP_NUM_NEG(m_prefix, m_op_name, m_name, m_type) \
- CASE_TYPE(m_prefix, m_op_name, m_name) { \
- _RETURN(-p_a._data.m_type); \
- }
-
-#define DEFAULT_OP_NUM_POS(m_prefix, m_op_name, m_name, m_type) \
- CASE_TYPE(m_prefix, m_op_name, m_name) { \
- _RETURN(p_a._data.m_type); \
- }
-
-#define DEFAULT_OP_NUM_VEC(m_prefix, m_op_name, m_name, m_op, m_type) \
- CASE_TYPE(m_prefix, m_op_name, m_name) { \
- if (p_b.type == INT) \
- _RETURN(p_a._data.m_type m_op p_b._data._int); \
- if (p_b.type == FLOAT) \
- _RETURN(p_a._data.m_type m_op p_b._data._float); \
- if (p_b.type == VECTOR2) \
- _RETURN(p_a._data.m_type m_op *reinterpret_cast<const Vector2 *>(p_b._data._mem)); \
- if (p_b.type == VECTOR3) \
- _RETURN(p_a._data.m_type m_op *reinterpret_cast<const Vector3 *>(p_b._data._mem)); \
- if (p_b.type == VECTOR2I) \
- _RETURN(p_a._data.m_type m_op *reinterpret_cast<const Vector2i *>(p_b._data._mem)); \
- if (p_b.type == VECTOR3I) \
- _RETURN(p_a._data.m_type m_op *reinterpret_cast<const Vector3i *>(p_b._data._mem)); \
- \
- _RETURN_FAIL \
- }
-
-#define DEFAULT_OP_STR_REV(m_prefix, m_op_name, m_name, m_op, m_type) \
- CASE_TYPE(m_prefix, m_op_name, m_name) { \
- if (p_b.type == STRING) \
- _RETURN(*reinterpret_cast<const m_type *>(p_b._data._mem) m_op *reinterpret_cast<const String *>(p_a._data._mem)); \
- if (p_b.type == STRING_NAME) \
- _RETURN(*reinterpret_cast<const m_type *>(p_b._data._mem) m_op *reinterpret_cast<const StringName *>(p_a._data._mem)); \
- if (p_b.type == NODE_PATH) \
- _RETURN(*reinterpret_cast<const m_type *>(p_b._data._mem) m_op *reinterpret_cast<const NodePath *>(p_a._data._mem)); \
- \
- _RETURN_FAIL \
- }
-
-#define DEFAULT_OP_STR(m_prefix, m_op_name, m_name, m_op, m_type) \
- CASE_TYPE(m_prefix, m_op_name, m_name) { \
- if (p_b.type == STRING) \
- _RETURN(*reinterpret_cast<const m_type *>(p_a._data._mem) m_op *reinterpret_cast<const String *>(p_b._data._mem)); \
- if (p_b.type == STRING_NAME) \
- _RETURN(*reinterpret_cast<const m_type *>(p_a._data._mem) m_op *reinterpret_cast<const StringName *>(p_b._data._mem)); \
- if (p_b.type == NODE_PATH) \
- _RETURN(*reinterpret_cast<const m_type *>(p_a._data._mem) m_op *reinterpret_cast<const NodePath *>(p_b._data._mem)); \
- \
- _RETURN_FAIL \
- }
-
-#define DEFAULT_OP_STR_NULL(m_prefix, m_op_name, m_name, m_op, m_type) \
- CASE_TYPE(m_prefix, m_op_name, m_name) { \
- if (p_b.type == STRING) \
- _RETURN(*reinterpret_cast<const m_type *>(p_a._data._mem) m_op *reinterpret_cast<const String *>(p_b._data._mem)); \
- if (p_b.type == STRING_NAME) \
- _RETURN(*reinterpret_cast<const m_type *>(p_a._data._mem) m_op *reinterpret_cast<const StringName *>(p_b._data._mem)); \
- if (p_b.type == NODE_PATH) \
- _RETURN(*reinterpret_cast<const m_type *>(p_a._data._mem) m_op *reinterpret_cast<const NodePath *>(p_b._data._mem)); \
- if (p_b.type == NIL) \
- _RETURN(!(p_b.type m_op NIL)); \
- \
- _RETURN_FAIL \
- }
-
-#define DEFAULT_OP_STR_NULL_NP(m_prefix, m_op_name, m_name, m_op, m_type) \
- CASE_TYPE(m_prefix, m_op_name, m_name) { \
- if (p_b.type == STRING) \
- _RETURN(*reinterpret_cast<const m_type *>(p_a._data._mem) m_op *reinterpret_cast<const String *>(p_b._data._mem)); \
- if (p_b.type == NODE_PATH) \
- _RETURN(*reinterpret_cast<const m_type *>(p_a._data._mem) m_op *reinterpret_cast<const NodePath *>(p_b._data._mem)); \
- if (p_b.type == NIL) \
- _RETURN(!(p_b.type m_op NIL)); \
- \
- _RETURN_FAIL \
- }
-
-#define DEFAULT_OP_STR_NULL_SN(m_prefix, m_op_name, m_name, m_op, m_type) \
- CASE_TYPE(m_prefix, m_op_name, m_name) { \
- if (p_b.type == STRING) \
- _RETURN(*reinterpret_cast<const m_type *>(p_a._data._mem) m_op *reinterpret_cast<const String *>(p_b._data._mem)); \
- if (p_b.type == STRING_NAME) \
- _RETURN(*reinterpret_cast<const m_type *>(p_a._data._mem) m_op *reinterpret_cast<const StringName *>(p_b._data._mem)); \
- if (p_b.type == NIL) \
- _RETURN(!(p_b.type m_op NIL)); \
- \
- _RETURN_FAIL \
- }
-
-#define DEFAULT_OP_LOCALMEM_REV(m_prefix, m_op_name, m_name, m_op, m_type) \
- CASE_TYPE(m_prefix, m_op_name, m_name) { \
- if (p_b.type == m_name) \
- _RETURN(*reinterpret_cast<const m_type *>(p_b._data._mem) m_op *reinterpret_cast<const m_type *>(p_a._data._mem)); \
- \
- _RETURN_FAIL \
- }
-
-#define DEFAULT_OP_LOCALMEM(m_prefix, m_op_name, m_name, m_op, m_type) \
- CASE_TYPE(m_prefix, m_op_name, m_name) { \
- if (p_b.type == m_name) \
- _RETURN(*reinterpret_cast<const m_type *>(p_a._data._mem) m_op *reinterpret_cast<const m_type *>(p_b._data._mem)); \
- \
- _RETURN_FAIL \
- }
-
-#define DEFAULT_OP_LOCALMEM_NULL(m_prefix, m_op_name, m_name, m_op, m_type) \
- CASE_TYPE(m_prefix, m_op_name, m_name) { \
- if (p_b.type == m_name) \
- _RETURN(*reinterpret_cast<const m_type *>(p_a._data._mem) m_op *reinterpret_cast<const m_type *>(p_b._data._mem)); \
- if (p_b.type == NIL) \
- _RETURN(!(p_b.type m_op NIL)); \
- \
- _RETURN_FAIL \
- }
-
-#define DEFAULT_OP_LOCALMEM_NEG(m_prefix, m_op_name, m_name, m_type) \
- CASE_TYPE(m_prefix, m_op_name, m_name) { \
- _RETURN(-*reinterpret_cast<const m_type *>(p_a._data._mem)); \
- }
-
-#define DEFAULT_OP_LOCALMEM_POS(m_prefix, m_op_name, m_name, m_type) \
- CASE_TYPE(m_prefix, m_op_name, m_name) { \
- _RETURN(*reinterpret_cast<const m_type *>(p_a._data._mem)); \
- }
-
-#define DEFAULT_OP_LOCALMEM_NUM(m_prefix, m_op_name, m_name, m_op, m_type) \
- CASE_TYPE(m_prefix, m_op_name, m_name) { \
- if (p_b.type == m_name) \
- _RETURN(*reinterpret_cast<const m_type *>(p_a._data._mem) m_op *reinterpret_cast<const m_type *>(p_b._data._mem)); \
- if (p_b.type == INT) \
- _RETURN(*reinterpret_cast<const m_type *>(p_a._data._mem) m_op p_b._data._int); \
- if (p_b.type == FLOAT) \
- _RETURN(*reinterpret_cast<const m_type *>(p_a._data._mem) m_op p_b._data._float); \
- \
- _RETURN_FAIL \
- }
-
-#define DEFAULT_OP_PTR(m_op, m_name, m_sub) \
- CASE_TYPE(m_prefix, m_op_name, m_name) { \
- if (p_b.type == m_name) \
- _RETURN(p_a._data.m_sub m_op p_b._data.m_sub); \
- \
- _RETURN_FAIL \
- }
-
-#define DEFAULT_OP_PTRREF(m_prefix, m_op_name, m_name, m_op, m_sub) \
- CASE_TYPE(m_prefix, m_op_name, m_name) { \
- if (p_b.type == m_name) \
- _RETURN(*p_a._data.m_sub m_op *p_b._data.m_sub); \
- \
- _RETURN_FAIL \
- }
-
-#define DEFAULT_OP_PTRREF_NULL(m_prefix, m_op_name, m_name, m_op, m_sub) \
- CASE_TYPE(m_prefix, m_op_name, m_name) { \
- if (p_b.type == m_name) \
- _RETURN(*p_a._data.m_sub m_op *p_b._data.m_sub); \
- if (p_b.type == NIL) \
- _RETURN(!(p_b.type m_op NIL)); \
- \
- _RETURN_FAIL \
- }
-
-#define DEFAULT_OP_ARRAY_EQ(m_prefix, m_op_name, m_name, m_type) \
- CASE_TYPE(m_prefix, m_op_name, m_name) { \
- if (p_b.type == NIL) \
- _RETURN(false) \
- DEFAULT_OP_ARRAY_OP_BODY(m_prefix, m_op_name, m_name, m_type, !=, !=, true, false, false) \
- }
-
-#define DEFAULT_OP_ARRAY_NEQ(m_prefix, m_op_name, m_name, m_type) \
- CASE_TYPE(m_prefix, m_op_name, m_name) { \
- if (p_b.type == NIL) \
- _RETURN(true) \
- DEFAULT_OP_ARRAY_OP_BODY(m_prefix, m_op_name, m_name, m_type, !=, !=, false, true, true) \
- }
-
-#define DEFAULT_OP_ARRAY_LT(m_prefix, m_op_name, m_name, m_type) \
- DEFAULT_OP_ARRAY_OP(m_prefix, m_op_name, m_name, m_type, <, !=, false, a_len < array_b.size(), true)
-
-#define DEFAULT_OP_ARRAY_GT(m_prefix, m_op_name, m_name, m_type) \
- DEFAULT_OP_ARRAY_OP(m_prefix, m_op_name, m_name, m_type, >, !=, false, a_len < array_b.size(), true)
-
-#define DEFAULT_OP_ARRAY_OP(m_prefix, m_op_name, m_name, m_type, m_opa, m_opb, m_ret_def, m_ret_s, m_ret_f) \
- CASE_TYPE(m_prefix, m_op_name, m_name) { \
- DEFAULT_OP_ARRAY_OP_BODY(m_prefix, m_op_name, m_name, m_type, m_opa, m_opb, m_ret_def, m_ret_s, m_ret_f) \
- }
-
-#define DEFAULT_OP_ARRAY_OP_BODY(m_prefix, m_op_name, m_name, m_type, m_opa, m_opb, m_ret_def, m_ret_s, m_ret_f) \
- if (p_a.type != p_b.type) \
- _RETURN_FAIL \
- \
- const Vector<m_type> &array_a = PackedArrayRef<m_type>::get_array(p_a._data.packed_array); \
- const Vector<m_type> &array_b = PackedArrayRef<m_type>::get_array(p_b._data.packed_array); \
- \
- int a_len = array_a.size(); \
- if (a_len m_opa array_b.size()) { \
- _RETURN(m_ret_s); \
- } else { \
- const m_type *ra = array_a.ptr(); \
- const m_type *rb = array_b.ptr(); \
- \
- for (int i = 0; i < a_len; i++) { \
- if (ra[i] m_opb rb[i]) \
- _RETURN(m_ret_f); \
- } \
- \
- _RETURN(m_ret_def); \
- }
-
-#define DEFAULT_OP_ARRAY_ADD(m_prefix, m_op_name, m_name, m_type) \
- CASE_TYPE(m_prefix, m_op_name, m_name) { \
- if (p_a.type != p_b.type) \
- _RETURN_FAIL; \
- \
- const Vector<m_type> &array_a = PackedArrayRef<m_type>::get_array(p_a._data.packed_array); \
- const Vector<m_type> &array_b = PackedArrayRef<m_type>::get_array(p_b._data.packed_array); \
- Vector<m_type> sum = array_a; \
- sum.append_array(array_b); \
- _RETURN(sum); \
- }
-
-void Variant::evaluate(const Operator &p_op, const Variant &p_a,
- const Variant &p_b, Variant &r_ret, bool &r_valid) {
- CASES(math);
- r_valid = true;
-
- SWITCH(math, p_op, p_a.type) {
- SWITCH_OP(math, OP_EQUAL, p_a.type) {
- CASE_TYPE(math, OP_EQUAL, NIL) {
- if (p_b.type == NIL)
- _RETURN(true);
- if (p_b.type == OBJECT)
- _RETURN(p_b._get_obj().obj == nullptr);
-
- _RETURN(false);
- }
-
- CASE_TYPE(math, OP_EQUAL, BOOL) {
- if (p_b.type != BOOL) {
- if (p_b.type == NIL)
- _RETURN(false);
- _RETURN_FAIL;
- }
-
- _RETURN(p_a._data._bool == p_b._data._bool);
- }
-
- CASE_TYPE(math, OP_EQUAL, OBJECT) {
- if (p_b.type == OBJECT)
- _RETURN((p_a._get_obj().obj == p_b._get_obj().obj));
- if (p_b.type == NIL)
- _RETURN(p_a._get_obj().obj == nullptr);
-
- _RETURN_FAIL;
- }
-
- DEFAULT_OP_LOCALMEM_NULL(math, OP_EQUAL, CALLABLE, ==, Callable);
- DEFAULT_OP_LOCALMEM_NULL(math, OP_EQUAL, SIGNAL, ==, Signal);
-
- CASE_TYPE(math, OP_EQUAL, DICTIONARY) {
- if (p_b.type != DICTIONARY) {
- if (p_b.type == NIL)
- _RETURN(false);
- _RETURN_FAIL;
- }
-
- const Dictionary *arr_a = reinterpret_cast<const Dictionary *>(p_a._data._mem);
- const Dictionary *arr_b = reinterpret_cast<const Dictionary *>(p_b._data._mem);
-
- _RETURN(*arr_a == *arr_b);
- }
-
- CASE_TYPE(math, OP_EQUAL, ARRAY) {
- if (p_b.type != ARRAY) {
- if (p_b.type == NIL)
- _RETURN(false);
- _RETURN_FAIL;
- }
- const Array *arr_a = reinterpret_cast<const Array *>(p_a._data._mem);
- const Array *arr_b = reinterpret_cast<const Array *>(p_b._data._mem);
-
- int l = arr_a->size();
- if (arr_b->size() != l)
- _RETURN(false);
- for (int i = 0; i < l; i++) {
- if (!((*arr_a)[i] == (*arr_b)[i])) {
- _RETURN(false);
- }
- }
-
- _RETURN(true);
- }
-
- DEFAULT_OP_NUM_NULL(math, OP_EQUAL, INT, ==, _int);
- DEFAULT_OP_NUM_NULL(math, OP_EQUAL, FLOAT, ==, _float);
- DEFAULT_OP_STR_NULL(math, OP_EQUAL, STRING, ==, String);
- DEFAULT_OP_LOCALMEM_NULL(math, OP_EQUAL, VECTOR2, ==, Vector2);
- DEFAULT_OP_LOCALMEM_NULL(math, OP_EQUAL, VECTOR2I, ==, Vector2i);
- DEFAULT_OP_LOCALMEM_NULL(math, OP_EQUAL, RECT2, ==, Rect2);
- DEFAULT_OP_LOCALMEM_NULL(math, OP_EQUAL, RECT2I, ==, Rect2i);
- DEFAULT_OP_PTRREF_NULL(math, OP_EQUAL, TRANSFORM2D, ==, _transform2d);
- DEFAULT_OP_LOCALMEM_NULL(math, OP_EQUAL, VECTOR3, ==, Vector3);
- DEFAULT_OP_LOCALMEM_NULL(math, OP_EQUAL, VECTOR3I, ==, Vector3i);
- DEFAULT_OP_LOCALMEM_NULL(math, OP_EQUAL, PLANE, ==, Plane);
- DEFAULT_OP_LOCALMEM_NULL(math, OP_EQUAL, QUAT, ==, Quat);
- DEFAULT_OP_PTRREF_NULL(math, OP_EQUAL, AABB, ==, _aabb);
- DEFAULT_OP_PTRREF_NULL(math, OP_EQUAL, BASIS, ==, _basis);
- DEFAULT_OP_PTRREF_NULL(math, OP_EQUAL, TRANSFORM, ==, _transform);
- DEFAULT_OP_LOCALMEM_NULL(math, OP_EQUAL, COLOR, ==, Color);
- DEFAULT_OP_STR_NULL_SN(math, OP_EQUAL, STRING_NAME, ==, StringName);
- DEFAULT_OP_STR_NULL_NP(math, OP_EQUAL, NODE_PATH, ==, NodePath);
- DEFAULT_OP_LOCALMEM_NULL(math, OP_EQUAL, _RID, ==, RID);
-
- DEFAULT_OP_ARRAY_EQ(math, OP_EQUAL, PACKED_BYTE_ARRAY, uint8_t);
- DEFAULT_OP_ARRAY_EQ(math, OP_EQUAL, PACKED_INT32_ARRAY, int32_t);
- DEFAULT_OP_ARRAY_EQ(math, OP_EQUAL, PACKED_INT64_ARRAY, int64_t);
- DEFAULT_OP_ARRAY_EQ(math, OP_EQUAL, PACKED_FLOAT32_ARRAY, float);
- DEFAULT_OP_ARRAY_EQ(math, OP_EQUAL, PACKED_FLOAT64_ARRAY, double);
- DEFAULT_OP_ARRAY_EQ(math, OP_EQUAL, PACKED_STRING_ARRAY, String);
- DEFAULT_OP_ARRAY_EQ(math, OP_EQUAL, PACKED_VECTOR2_ARRAY, Vector2);
- DEFAULT_OP_ARRAY_EQ(math, OP_EQUAL, PACKED_VECTOR3_ARRAY, Vector3);
- DEFAULT_OP_ARRAY_EQ(math, OP_EQUAL, PACKED_COLOR_ARRAY, Color);
- }
-
- SWITCH_OP(math, OP_NOT_EQUAL, p_a.type) {
- CASE_TYPE(math, OP_NOT_EQUAL, NIL) {
- if (p_b.type == NIL)
- _RETURN(false);
- if (p_b.type == OBJECT)
- _RETURN(p_b._get_obj().obj != nullptr);
-
- _RETURN(true);
- }
-
- CASE_TYPE(math, OP_NOT_EQUAL, BOOL) {
- if (p_b.type != BOOL) {
- if (p_b.type == NIL)
- _RETURN(true);
-
- _RETURN_FAIL;
- }
-
- _RETURN(p_a._data._bool != p_b._data._bool);
- }
-
- CASE_TYPE(math, OP_NOT_EQUAL, OBJECT) {
- if (p_b.type == OBJECT)
- _RETURN((p_a._get_obj().obj != p_b._get_obj().obj));
- if (p_b.type == NIL)
- _RETURN(p_a._get_obj().obj != nullptr);
-
- _RETURN_FAIL;
- }
-
- DEFAULT_OP_LOCALMEM_NULL(math, OP_NOT_EQUAL, CALLABLE, !=, Callable);
- DEFAULT_OP_LOCALMEM_NULL(math, OP_NOT_EQUAL, SIGNAL, !=, Signal);
-
- CASE_TYPE(math, OP_NOT_EQUAL, DICTIONARY) {
- if (p_b.type != DICTIONARY) {
- if (p_b.type == NIL)
- _RETURN(true);
- _RETURN_FAIL;
- }
-
- const Dictionary *arr_a = reinterpret_cast<const Dictionary *>(p_a._data._mem);
- const Dictionary *arr_b = reinterpret_cast<const Dictionary *>(p_b._data._mem);
-
- _RETURN(*arr_a != *arr_b);
- }
-
- CASE_TYPE(math, OP_NOT_EQUAL, ARRAY) {
- if (p_b.type != ARRAY) {
- if (p_b.type == NIL)
- _RETURN(true);
-
- _RETURN_FAIL;
- }
-
- const Array *arr_a = reinterpret_cast<const Array *>(p_a._data._mem);
- const Array *arr_b = reinterpret_cast<const Array *>(p_b._data._mem);
-
- int l = arr_a->size();
- if (arr_b->size() != l)
- _RETURN(true);
- for (int i = 0; i < l; i++) {
- if (((*arr_a)[i] != (*arr_b)[i])) {
- _RETURN(true);
- }
- }
-
- _RETURN(false);
- }
-
- DEFAULT_OP_NUM_NULL(math, OP_NOT_EQUAL, INT, !=, _int);
- DEFAULT_OP_NUM_NULL(math, OP_NOT_EQUAL, FLOAT, !=, _float);
- DEFAULT_OP_STR_NULL(math, OP_NOT_EQUAL, STRING, !=, String);
- DEFAULT_OP_LOCALMEM_NULL(math, OP_NOT_EQUAL, VECTOR2, !=, Vector2);
- DEFAULT_OP_LOCALMEM_NULL(math, OP_NOT_EQUAL, VECTOR2I, !=, Vector2i);
- DEFAULT_OP_LOCALMEM_NULL(math, OP_NOT_EQUAL, RECT2, !=, Rect2);
- DEFAULT_OP_LOCALMEM_NULL(math, OP_NOT_EQUAL, RECT2I, !=, Rect2i);
- DEFAULT_OP_PTRREF_NULL(math, OP_NOT_EQUAL, TRANSFORM2D, !=, _transform2d);
- DEFAULT_OP_LOCALMEM_NULL(math, OP_NOT_EQUAL, VECTOR3, !=, Vector3);
- DEFAULT_OP_LOCALMEM_NULL(math, OP_NOT_EQUAL, VECTOR3I, !=, Vector3i);
- DEFAULT_OP_LOCALMEM_NULL(math, OP_NOT_EQUAL, PLANE, !=, Plane);
- DEFAULT_OP_LOCALMEM_NULL(math, OP_NOT_EQUAL, QUAT, !=, Quat);
- DEFAULT_OP_PTRREF_NULL(math, OP_NOT_EQUAL, AABB, !=, _aabb);
- DEFAULT_OP_PTRREF_NULL(math, OP_NOT_EQUAL, BASIS, !=, _basis);
- DEFAULT_OP_PTRREF_NULL(math, OP_NOT_EQUAL, TRANSFORM, !=, _transform);
- DEFAULT_OP_LOCALMEM_NULL(math, OP_NOT_EQUAL, COLOR, !=, Color);
- DEFAULT_OP_STR_NULL_SN(math, OP_NOT_EQUAL, STRING_NAME, !=, StringName);
- DEFAULT_OP_STR_NULL_NP(math, OP_NOT_EQUAL, NODE_PATH, !=, NodePath);
- DEFAULT_OP_LOCALMEM_NULL(math, OP_NOT_EQUAL, _RID, !=, RID);
-
- DEFAULT_OP_ARRAY_NEQ(math, OP_NOT_EQUAL, PACKED_BYTE_ARRAY, uint8_t);
- DEFAULT_OP_ARRAY_NEQ(math, OP_NOT_EQUAL, PACKED_INT32_ARRAY, int32_t);
- DEFAULT_OP_ARRAY_NEQ(math, OP_NOT_EQUAL, PACKED_INT64_ARRAY, int64_t);
- DEFAULT_OP_ARRAY_NEQ(math, OP_NOT_EQUAL, PACKED_FLOAT32_ARRAY, float);
- DEFAULT_OP_ARRAY_NEQ(math, OP_NOT_EQUAL, PACKED_FLOAT64_ARRAY, double);
- DEFAULT_OP_ARRAY_NEQ(math, OP_NOT_EQUAL, PACKED_STRING_ARRAY, String);
- DEFAULT_OP_ARRAY_NEQ(math, OP_NOT_EQUAL, PACKED_VECTOR2_ARRAY, Vector2);
- DEFAULT_OP_ARRAY_NEQ(math, OP_NOT_EQUAL, PACKED_VECTOR3_ARRAY, Vector3);
- DEFAULT_OP_ARRAY_NEQ(math, OP_NOT_EQUAL, PACKED_COLOR_ARRAY, Color);
- }
-
- SWITCH_OP(math, OP_LESS, p_a.type) {
- CASE_TYPE(math, OP_LESS, BOOL) {
- if (p_b.type != BOOL)
- _RETURN_FAIL;
-
- if (p_a._data._bool == p_b._data._bool)
- _RETURN(false);
-
- if (p_a._data._bool && !p_b._data._bool)
- _RETURN(false);
-
- _RETURN(true);
- }
-
- CASE_TYPE(math, OP_LESS, OBJECT) {
- if (p_b.type != OBJECT)
- _RETURN_FAIL;
- _RETURN((p_a._get_obj().obj < p_b._get_obj().obj));
- }
-
- DEFAULT_OP_LOCALMEM_NULL(math, OP_LESS, CALLABLE, <, Callable);
- DEFAULT_OP_LOCALMEM_NULL(math, OP_LESS, SIGNAL, <, Signal);
-
- CASE_TYPE(math, OP_LESS, ARRAY) {
- if (p_b.type != ARRAY)
- _RETURN_FAIL;
-
- const Array *arr_a = reinterpret_cast<const Array *>(p_a._data._mem);
- const Array *arr_b = reinterpret_cast<const Array *>(p_b._data._mem);
-
- int l = arr_a->size();
- if (arr_b->size() < l)
- _RETURN(false);
- for (int i = 0; i < l; i++) {
- if (!((*arr_a)[i] < (*arr_b)[i])) {
- _RETURN(true);
- }
- }
-
- _RETURN(false);
- }
-
- DEFAULT_OP_NUM(math, OP_LESS, INT, <, _int);
- DEFAULT_OP_NUM(math, OP_LESS, FLOAT, <, _float);
- DEFAULT_OP_STR(math, OP_LESS, STRING, <, String);
- DEFAULT_OP_LOCALMEM(math, OP_LESS, VECTOR2, <, Vector2);
- DEFAULT_OP_LOCALMEM(math, OP_LESS, VECTOR2I, <, Vector2i);
- DEFAULT_OP_LOCALMEM(math, OP_LESS, VECTOR3, <, Vector3);
- DEFAULT_OP_LOCALMEM(math, OP_LESS, VECTOR3I, <, Vector3i);
- DEFAULT_OP_LOCALMEM(math, OP_LESS, _RID, <, RID);
- DEFAULT_OP_ARRAY_LT(math, OP_LESS, PACKED_BYTE_ARRAY, uint8_t);
- DEFAULT_OP_ARRAY_LT(math, OP_LESS, PACKED_INT32_ARRAY, int32_t);
- DEFAULT_OP_ARRAY_LT(math, OP_LESS, PACKED_INT64_ARRAY, int64_t);
- DEFAULT_OP_ARRAY_LT(math, OP_LESS, PACKED_FLOAT32_ARRAY, float);
- DEFAULT_OP_ARRAY_LT(math, OP_LESS, PACKED_FLOAT64_ARRAY, double);
- DEFAULT_OP_ARRAY_LT(math, OP_LESS, PACKED_STRING_ARRAY, String);
- DEFAULT_OP_ARRAY_LT(math, OP_LESS, PACKED_VECTOR2_ARRAY, Vector3);
- DEFAULT_OP_ARRAY_LT(math, OP_LESS, PACKED_VECTOR3_ARRAY, Vector3);
- DEFAULT_OP_ARRAY_LT(math, OP_LESS, PACKED_COLOR_ARRAY, Color);
-
- CASE_TYPE(math, OP_LESS, NIL)
- CASE_TYPE(math, OP_LESS, RECT2)
- CASE_TYPE(math, OP_LESS, RECT2I)
- CASE_TYPE(math, OP_LESS, TRANSFORM2D)
- CASE_TYPE(math, OP_LESS, PLANE)
- CASE_TYPE(math, OP_LESS, QUAT)
- CASE_TYPE(math, OP_LESS, AABB)
- CASE_TYPE(math, OP_LESS, BASIS)
- CASE_TYPE(math, OP_LESS, TRANSFORM)
- CASE_TYPE(math, OP_LESS, COLOR)
- CASE_TYPE(math, OP_LESS, STRING_NAME)
- CASE_TYPE(math, OP_LESS, NODE_PATH)
- CASE_TYPE(math, OP_LESS, DICTIONARY)
- _RETURN_FAIL;
- }
-
- SWITCH_OP(math, OP_LESS_EQUAL, p_a.type) {
- CASE_TYPE(math, OP_LESS_EQUAL, OBJECT) {
- if (p_b.type != OBJECT)
- _RETURN_FAIL;
- _RETURN((p_a._get_obj().obj <= p_b._get_obj().obj));
- }
-
- DEFAULT_OP_NUM(math, OP_LESS_EQUAL, INT, <=, _int);
- DEFAULT_OP_NUM(math, OP_LESS_EQUAL, FLOAT, <=, _float);
- DEFAULT_OP_STR(math, OP_LESS_EQUAL, STRING, <=, String);
- DEFAULT_OP_LOCALMEM(math, OP_LESS_EQUAL, VECTOR2, <=, Vector2);
- DEFAULT_OP_LOCALMEM(math, OP_LESS_EQUAL, VECTOR2I, <=, Vector2i);
- DEFAULT_OP_LOCALMEM(math, OP_LESS_EQUAL, VECTOR3, <=, Vector3);
- DEFAULT_OP_LOCALMEM(math, OP_LESS_EQUAL, VECTOR3I, <=, Vector3i);
- DEFAULT_OP_LOCALMEM(math, OP_LESS_EQUAL, _RID, <=, RID);
-
- CASE_TYPE(math, OP_LESS_EQUAL, NIL)
- CASE_TYPE(math, OP_LESS_EQUAL, BOOL)
- CASE_TYPE(math, OP_LESS_EQUAL, RECT2)
- CASE_TYPE(math, OP_LESS_EQUAL, RECT2I)
- CASE_TYPE(math, OP_LESS_EQUAL, TRANSFORM2D)
- CASE_TYPE(math, OP_LESS_EQUAL, PLANE)
- CASE_TYPE(math, OP_LESS_EQUAL, QUAT)
- CASE_TYPE(math, OP_LESS_EQUAL, AABB)
- CASE_TYPE(math, OP_LESS_EQUAL, BASIS)
- CASE_TYPE(math, OP_LESS_EQUAL, TRANSFORM)
- CASE_TYPE(math, OP_LESS_EQUAL, COLOR)
- CASE_TYPE(math, OP_LESS_EQUAL, STRING_NAME)
- CASE_TYPE(math, OP_LESS_EQUAL, NODE_PATH)
- CASE_TYPE(math, OP_LESS_EQUAL, CALLABLE)
- CASE_TYPE(math, OP_LESS_EQUAL, SIGNAL)
-
- CASE_TYPE(math, OP_LESS_EQUAL, DICTIONARY)
- CASE_TYPE(math, OP_LESS_EQUAL, ARRAY)
- CASE_TYPE(math, OP_LESS_EQUAL, PACKED_BYTE_ARRAY);
- CASE_TYPE(math, OP_LESS_EQUAL, PACKED_INT32_ARRAY);
- CASE_TYPE(math, OP_LESS_EQUAL, PACKED_INT64_ARRAY);
- CASE_TYPE(math, OP_LESS_EQUAL, PACKED_FLOAT32_ARRAY);
- CASE_TYPE(math, OP_LESS_EQUAL, PACKED_FLOAT64_ARRAY);
- CASE_TYPE(math, OP_LESS_EQUAL, PACKED_STRING_ARRAY);
- CASE_TYPE(math, OP_LESS_EQUAL, PACKED_VECTOR2_ARRAY);
- CASE_TYPE(math, OP_LESS_EQUAL, PACKED_VECTOR3_ARRAY);
- CASE_TYPE(math, OP_LESS_EQUAL, PACKED_COLOR_ARRAY);
- _RETURN_FAIL;
- }
-
- SWITCH_OP(math, OP_GREATER, p_a.type) {
- CASE_TYPE(math, OP_GREATER, BOOL) {
- if (p_b.type != BOOL)
- _RETURN_FAIL;
-
- if (p_a._data._bool == p_b._data._bool)
- _RETURN(false);
-
- if (!p_a._data._bool && p_b._data._bool)
- _RETURN(false);
-
- _RETURN(true);
- }
-
- CASE_TYPE(math, OP_GREATER, OBJECT) {
- if (p_b.type != OBJECT)
- _RETURN_FAIL;
- _RETURN((p_a._get_obj().obj > p_b._get_obj().obj));
- }
-
- CASE_TYPE(math, OP_GREATER, ARRAY) {
- if (p_b.type != ARRAY)
- _RETURN_FAIL;
-
- const Array *arr_a = reinterpret_cast<const Array *>(p_a._data._mem);
- const Array *arr_b = reinterpret_cast<const Array *>(p_b._data._mem);
-
- int l = arr_a->size();
- if (arr_b->size() > l)
- _RETURN(false);
- for (int i = 0; i < l; i++) {
- if (((*arr_a)[i] < (*arr_b)[i])) {
- _RETURN(false);
- }
- }
-
- _RETURN(true);
- }
-
- DEFAULT_OP_NUM(math, OP_GREATER, INT, >, _int);
- DEFAULT_OP_NUM(math, OP_GREATER, FLOAT, >, _float);
- DEFAULT_OP_STR_REV(math, OP_GREATER, STRING, <, String);
- DEFAULT_OP_LOCALMEM_REV(math, OP_GREATER, VECTOR2, <, Vector2);
- DEFAULT_OP_LOCALMEM_REV(math, OP_GREATER, VECTOR2I, <, Vector2i);
- DEFAULT_OP_LOCALMEM_REV(math, OP_GREATER, VECTOR3, <, Vector3);
- DEFAULT_OP_LOCALMEM_REV(math, OP_GREATER, VECTOR3I, <, Vector3i);
- DEFAULT_OP_LOCALMEM_REV(math, OP_GREATER, _RID, <, RID);
- DEFAULT_OP_ARRAY_GT(math, OP_GREATER, PACKED_BYTE_ARRAY, uint8_t);
- DEFAULT_OP_ARRAY_GT(math, OP_GREATER, PACKED_INT32_ARRAY, int32_t);
- DEFAULT_OP_ARRAY_GT(math, OP_GREATER, PACKED_INT64_ARRAY, int64_t);
- DEFAULT_OP_ARRAY_GT(math, OP_GREATER, PACKED_FLOAT32_ARRAY, float);
- DEFAULT_OP_ARRAY_GT(math, OP_GREATER, PACKED_FLOAT64_ARRAY, double);
- DEFAULT_OP_ARRAY_GT(math, OP_GREATER, PACKED_STRING_ARRAY, String);
- DEFAULT_OP_ARRAY_GT(math, OP_GREATER, PACKED_VECTOR2_ARRAY, Vector3);
- DEFAULT_OP_ARRAY_GT(math, OP_GREATER, PACKED_VECTOR3_ARRAY, Vector3);
- DEFAULT_OP_ARRAY_GT(math, OP_GREATER, PACKED_COLOR_ARRAY, Color);
-
- CASE_TYPE(math, OP_GREATER, NIL)
- CASE_TYPE(math, OP_GREATER, RECT2)
- CASE_TYPE(math, OP_GREATER, RECT2I)
- CASE_TYPE(math, OP_GREATER, TRANSFORM2D)
- CASE_TYPE(math, OP_GREATER, PLANE)
- CASE_TYPE(math, OP_GREATER, QUAT)
- CASE_TYPE(math, OP_GREATER, AABB)
- CASE_TYPE(math, OP_GREATER, BASIS)
- CASE_TYPE(math, OP_GREATER, TRANSFORM)
- CASE_TYPE(math, OP_GREATER, COLOR)
- CASE_TYPE(math, OP_GREATER, STRING_NAME)
- CASE_TYPE(math, OP_GREATER, NODE_PATH)
- CASE_TYPE(math, OP_GREATER, DICTIONARY)
- CASE_TYPE(math, OP_GREATER, CALLABLE)
- CASE_TYPE(math, OP_GREATER, SIGNAL)
-
- _RETURN_FAIL;
- }
-
- SWITCH_OP(math, OP_GREATER_EQUAL, p_a.type) {
- CASE_TYPE(math, OP_GREATER_EQUAL, OBJECT) {
- if (p_b.type != OBJECT)
- _RETURN_FAIL;
- _RETURN((p_a._get_obj().obj >= p_b._get_obj().obj));
- }
-
- DEFAULT_OP_NUM(math, OP_GREATER_EQUAL, INT, >=, _int);
- DEFAULT_OP_NUM(math, OP_GREATER_EQUAL, FLOAT, >=, _float);
- DEFAULT_OP_STR_REV(math, OP_GREATER_EQUAL, STRING, <=, String);
- DEFAULT_OP_LOCALMEM_REV(math, OP_GREATER_EQUAL, VECTOR2, <=, Vector2);
- DEFAULT_OP_LOCALMEM_REV(math, OP_GREATER_EQUAL, VECTOR2I, <=, Vector2i);
- DEFAULT_OP_LOCALMEM_REV(math, OP_GREATER_EQUAL, VECTOR3, <=, Vector3);
- DEFAULT_OP_LOCALMEM_REV(math, OP_GREATER_EQUAL, VECTOR3I, <=, Vector3i);
- DEFAULT_OP_LOCALMEM_REV(math, OP_GREATER_EQUAL, _RID, <=, RID);
-
- CASE_TYPE(math, OP_GREATER_EQUAL, NIL)
- CASE_TYPE(math, OP_GREATER_EQUAL, BOOL)
- CASE_TYPE(math, OP_GREATER_EQUAL, RECT2)
- CASE_TYPE(math, OP_GREATER_EQUAL, RECT2I)
- CASE_TYPE(math, OP_GREATER_EQUAL, TRANSFORM2D)
- CASE_TYPE(math, OP_GREATER_EQUAL, PLANE)
- CASE_TYPE(math, OP_GREATER_EQUAL, QUAT)
- CASE_TYPE(math, OP_GREATER_EQUAL, AABB)
- CASE_TYPE(math, OP_GREATER_EQUAL, BASIS)
- CASE_TYPE(math, OP_GREATER_EQUAL, TRANSFORM)
- CASE_TYPE(math, OP_GREATER_EQUAL, COLOR)
- CASE_TYPE(math, OP_GREATER_EQUAL, STRING_NAME)
- CASE_TYPE(math, OP_GREATER_EQUAL, NODE_PATH)
- CASE_TYPE(math, OP_GREATER_EQUAL, CALLABLE)
- CASE_TYPE(math, OP_GREATER_EQUAL, SIGNAL)
-
- CASE_TYPE(math, OP_GREATER_EQUAL, DICTIONARY)
- CASE_TYPE(math, OP_GREATER_EQUAL, ARRAY)
- CASE_TYPE(math, OP_GREATER_EQUAL, PACKED_BYTE_ARRAY);
- CASE_TYPE(math, OP_GREATER_EQUAL, PACKED_INT32_ARRAY);
- CASE_TYPE(math, OP_GREATER_EQUAL, PACKED_INT64_ARRAY);
- CASE_TYPE(math, OP_GREATER_EQUAL, PACKED_FLOAT32_ARRAY);
- CASE_TYPE(math, OP_GREATER_EQUAL, PACKED_FLOAT64_ARRAY);
- CASE_TYPE(math, OP_GREATER_EQUAL, PACKED_STRING_ARRAY);
- CASE_TYPE(math, OP_GREATER_EQUAL, PACKED_VECTOR2_ARRAY);
- CASE_TYPE(math, OP_GREATER_EQUAL, PACKED_VECTOR3_ARRAY);
- CASE_TYPE(math, OP_GREATER_EQUAL, PACKED_COLOR_ARRAY);
- _RETURN_FAIL;
- }
-
- SWITCH_OP(math, OP_ADD, p_a.type) {
- CASE_TYPE(math, OP_ADD, ARRAY) {
- if (p_a.type != p_b.type)
- _RETURN_FAIL;
-
- const Array &array_a = *reinterpret_cast<const Array *>(p_a._data._mem);
- const Array &array_b = *reinterpret_cast<const Array *>(p_b._data._mem);
- Array sum;
- int asize = array_a.size();
- int bsize = array_b.size();
- sum.resize(asize + bsize);
- for (int i = 0; i < asize; i++) {
- sum[i] = array_a[i];
- }
- for (int i = 0; i < bsize; i++) {
- sum[i + asize] = array_b[i];
- }
- _RETURN(sum);
- }
-
- DEFAULT_OP_NUM(math, OP_ADD, INT, +, _int);
- DEFAULT_OP_NUM(math, OP_ADD, FLOAT, +, _float);
- DEFAULT_OP_STR(math, OP_ADD, STRING, +, String);
- DEFAULT_OP_LOCALMEM(math, OP_ADD, VECTOR2, +, Vector2);
- DEFAULT_OP_LOCALMEM(math, OP_ADD, VECTOR2I, +, Vector2i);
- DEFAULT_OP_LOCALMEM(math, OP_ADD, VECTOR3, +, Vector3);
- DEFAULT_OP_LOCALMEM(math, OP_ADD, VECTOR3I, +, Vector3i);
- DEFAULT_OP_LOCALMEM(math, OP_ADD, QUAT, +, Quat);
- DEFAULT_OP_LOCALMEM(math, OP_ADD, COLOR, +, Color);
-
- DEFAULT_OP_ARRAY_ADD(math, OP_ADD, PACKED_BYTE_ARRAY, uint8_t);
- DEFAULT_OP_ARRAY_ADD(math, OP_ADD, PACKED_INT32_ARRAY, int32_t);
- DEFAULT_OP_ARRAY_ADD(math, OP_ADD, PACKED_INT64_ARRAY, int64_t);
- DEFAULT_OP_ARRAY_ADD(math, OP_ADD, PACKED_FLOAT32_ARRAY, float);
- DEFAULT_OP_ARRAY_ADD(math, OP_ADD, PACKED_FLOAT64_ARRAY, double);
- DEFAULT_OP_ARRAY_ADD(math, OP_ADD, PACKED_STRING_ARRAY, String);
- DEFAULT_OP_ARRAY_ADD(math, OP_ADD, PACKED_VECTOR2_ARRAY, Vector2);
- DEFAULT_OP_ARRAY_ADD(math, OP_ADD, PACKED_VECTOR3_ARRAY, Vector3);
- DEFAULT_OP_ARRAY_ADD(math, OP_ADD, PACKED_COLOR_ARRAY, Color);
-
- CASE_TYPE(math, OP_ADD, NIL)
- CASE_TYPE(math, OP_ADD, BOOL)
- CASE_TYPE(math, OP_ADD, RECT2)
- CASE_TYPE(math, OP_ADD, RECT2I)
- CASE_TYPE(math, OP_ADD, TRANSFORM2D)
- CASE_TYPE(math, OP_ADD, PLANE)
- CASE_TYPE(math, OP_ADD, AABB)
- CASE_TYPE(math, OP_ADD, BASIS)
- CASE_TYPE(math, OP_ADD, TRANSFORM)
- CASE_TYPE(math, OP_ADD, STRING_NAME)
- CASE_TYPE(math, OP_ADD, NODE_PATH)
- CASE_TYPE(math, OP_ADD, _RID)
- CASE_TYPE(math, OP_ADD, OBJECT)
- CASE_TYPE(math, OP_ADD, CALLABLE)
- CASE_TYPE(math, OP_ADD, SIGNAL)
-
- CASE_TYPE(math, OP_ADD, DICTIONARY)
- _RETURN_FAIL;
- }
-
- SWITCH_OP(math, OP_SUBTRACT, p_a.type) {
- DEFAULT_OP_NUM(math, OP_SUBTRACT, INT, -, _int);
- DEFAULT_OP_NUM(math, OP_SUBTRACT, FLOAT, -, _float);
- DEFAULT_OP_LOCALMEM(math, OP_SUBTRACT, VECTOR2, -, Vector2);
- DEFAULT_OP_LOCALMEM(math, OP_SUBTRACT, VECTOR2I, -, Vector2i);
- DEFAULT_OP_LOCALMEM(math, OP_SUBTRACT, VECTOR3, -, Vector3);
- DEFAULT_OP_LOCALMEM(math, OP_SUBTRACT, VECTOR3I, -, Vector3i);
- DEFAULT_OP_LOCALMEM(math, OP_SUBTRACT, QUAT, -, Quat);
- DEFAULT_OP_LOCALMEM(math, OP_SUBTRACT, COLOR, -, Color);
-
- CASE_TYPE(math, OP_SUBTRACT, NIL)
- CASE_TYPE(math, OP_SUBTRACT, BOOL)
- CASE_TYPE(math, OP_SUBTRACT, STRING)
- CASE_TYPE(math, OP_SUBTRACT, RECT2)
- CASE_TYPE(math, OP_SUBTRACT, RECT2I)
- CASE_TYPE(math, OP_SUBTRACT, TRANSFORM2D)
- CASE_TYPE(math, OP_SUBTRACT, PLANE)
- CASE_TYPE(math, OP_SUBTRACT, AABB)
- CASE_TYPE(math, OP_SUBTRACT, BASIS)
- CASE_TYPE(math, OP_SUBTRACT, TRANSFORM)
- CASE_TYPE(math, OP_SUBTRACT, STRING_NAME)
- CASE_TYPE(math, OP_SUBTRACT, NODE_PATH)
- CASE_TYPE(math, OP_SUBTRACT, _RID)
- CASE_TYPE(math, OP_SUBTRACT, OBJECT)
- CASE_TYPE(math, OP_SUBTRACT, CALLABLE)
- CASE_TYPE(math, OP_SUBTRACT, SIGNAL)
-
- CASE_TYPE(math, OP_SUBTRACT, DICTIONARY)
- CASE_TYPE(math, OP_SUBTRACT, ARRAY)
- CASE_TYPE(math, OP_SUBTRACT, PACKED_BYTE_ARRAY);
- CASE_TYPE(math, OP_SUBTRACT, PACKED_INT32_ARRAY);
- CASE_TYPE(math, OP_SUBTRACT, PACKED_INT64_ARRAY);
- CASE_TYPE(math, OP_SUBTRACT, PACKED_FLOAT32_ARRAY);
- CASE_TYPE(math, OP_SUBTRACT, PACKED_FLOAT64_ARRAY);
- CASE_TYPE(math, OP_SUBTRACT, PACKED_STRING_ARRAY);
- CASE_TYPE(math, OP_SUBTRACT, PACKED_VECTOR2_ARRAY);
- CASE_TYPE(math, OP_SUBTRACT, PACKED_VECTOR3_ARRAY);
- CASE_TYPE(math, OP_SUBTRACT, PACKED_COLOR_ARRAY);
- _RETURN_FAIL;
- }
-
- SWITCH_OP(math, OP_MULTIPLY, p_a.type) {
- CASE_TYPE(math, OP_MULTIPLY, TRANSFORM2D) {
- switch (p_b.type) {
- case TRANSFORM2D: {
- _RETURN(*p_a._data._transform2d * *p_b._data._transform2d);
- }
- case VECTOR2: {
- _RETURN(p_a._data._transform2d->xform(*(const Vector2 *)p_b._data._mem));
- }
- default:
- _RETURN_FAIL;
- }
- }
-
- CASE_TYPE(math, OP_MULTIPLY, QUAT) {
- switch (p_b.type) {
- case VECTOR3: {
- _RETURN(reinterpret_cast<const Quat *>(p_a._data._mem)->xform(*(const Vector3 *)p_b._data._mem));
- }
- case QUAT: {
- _RETURN(*reinterpret_cast<const Quat *>(p_a._data._mem) * *reinterpret_cast<const Quat *>(p_b._data._mem));
- }
- case FLOAT: {
- _RETURN(*reinterpret_cast<const Quat *>(p_a._data._mem) * p_b._data._float);
- }
- case INT: {
- _RETURN(*reinterpret_cast<const Quat *>(p_a._data._mem) * p_b._data._int);
- }
- default:
- _RETURN_FAIL;
- }
- }
-
- CASE_TYPE(math, OP_MULTIPLY, BASIS) {
- switch (p_b.type) {
- case VECTOR3: {
- _RETURN(p_a._data._basis->xform(*(const Vector3 *)p_b._data._mem));
- }
- case BASIS: {
- _RETURN(*p_a._data._basis * *p_b._data._basis);
- }
- default:
- _RETURN_FAIL;
- }
- }
-
- CASE_TYPE(math, OP_MULTIPLY, TRANSFORM) {
- switch (p_b.type) {
- case VECTOR3: {
- _RETURN(p_a._data._transform->xform(*(const Vector3 *)p_b._data._mem));
- }
- case TRANSFORM: {
- _RETURN(*p_a._data._transform * *p_b._data._transform);
- }
- default:
- _RETURN_FAIL;
- }
- }
-
- CASE_TYPE(math, OP_MULTIPLY, INT) {
- if (p_b.type == INT) {
- _RETURN(p_a._data._int * p_b._data._int);
- }
- if (p_b.type == FLOAT) {
- _RETURN(p_a._data._int * p_b._data._float);
- }
- if (p_b.type == VECTOR2) {
- _RETURN(p_a._data._int * *reinterpret_cast<const Vector2 *>(p_b._data._mem));
- }
- if (p_b.type == VECTOR3) {
- _RETURN(p_a._data._int * *reinterpret_cast<const Vector3 *>(p_b._data._mem));
- }
- if (p_b.type == VECTOR2I) {
- _RETURN(p_a._data._int * *reinterpret_cast<const Vector2i *>(p_b._data._mem));
- }
- if (p_b.type == VECTOR3I) {
- _RETURN(p_a._data._int * *reinterpret_cast<const Vector3i *>(p_b._data._mem));
- }
- if (p_b.type == QUAT) {
- _RETURN(p_a._data._int * *reinterpret_cast<const Quat *>(p_b._data._mem));
- }
- if (p_b.type == COLOR) {
- _RETURN(p_a._data._int * *reinterpret_cast<const Color *>(p_b._data._mem));
- }
-
- _RETURN_FAIL
- }
-
- CASE_TYPE(math, OP_MULTIPLY, FLOAT) {
- if (p_b.type == INT) {
- _RETURN(p_a._data._float * p_b._data._int);
- }
- if (p_b.type == FLOAT) {
- _RETURN(p_a._data._float * p_b._data._float);
- }
- if (p_b.type == VECTOR2) {
- _RETURN(p_a._data._float * *reinterpret_cast<const Vector2 *>(p_b._data._mem));
- }
- if (p_b.type == VECTOR3) {
- _RETURN(p_a._data._float * *reinterpret_cast<const Vector3 *>(p_b._data._mem));
- }
- if (p_b.type == VECTOR2I) {
- _RETURN(p_a._data._float * *reinterpret_cast<const Vector2i *>(p_b._data._mem));
- }
- if (p_b.type == VECTOR3I) {
- _RETURN(p_a._data._float * *reinterpret_cast<const Vector3i *>(p_b._data._mem));
- }
- if (p_b.type == QUAT) {
- _RETURN(p_a._data._float * *reinterpret_cast<const Quat *>(p_b._data._mem));
- }
- if (p_b.type == COLOR) {
- _RETURN(p_a._data._float * *reinterpret_cast<const Color *>(p_b._data._mem));
- }
-
- _RETURN_FAIL
- }
-
- DEFAULT_OP_LOCALMEM_NUM(math, OP_MULTIPLY, VECTOR2, *, Vector2);
- DEFAULT_OP_LOCALMEM_NUM(math, OP_MULTIPLY, VECTOR2I, *, Vector2i);
- DEFAULT_OP_LOCALMEM_NUM(math, OP_MULTIPLY, VECTOR3, *, Vector3);
- DEFAULT_OP_LOCALMEM_NUM(math, OP_MULTIPLY, VECTOR3I, *, Vector3i);
- DEFAULT_OP_LOCALMEM_NUM(math, OP_MULTIPLY, COLOR, *, Color);
-
- CASE_TYPE(math, OP_MULTIPLY, NIL)
- CASE_TYPE(math, OP_MULTIPLY, BOOL)
- CASE_TYPE(math, OP_MULTIPLY, STRING)
- CASE_TYPE(math, OP_MULTIPLY, RECT2)
- CASE_TYPE(math, OP_MULTIPLY, RECT2I)
- CASE_TYPE(math, OP_MULTIPLY, PLANE)
- CASE_TYPE(math, OP_MULTIPLY, AABB)
- CASE_TYPE(math, OP_MULTIPLY, STRING_NAME)
- CASE_TYPE(math, OP_MULTIPLY, NODE_PATH)
- CASE_TYPE(math, OP_MULTIPLY, _RID)
- CASE_TYPE(math, OP_MULTIPLY, OBJECT)
- CASE_TYPE(math, OP_MULTIPLY, CALLABLE)
- CASE_TYPE(math, OP_MULTIPLY, SIGNAL)
-
- CASE_TYPE(math, OP_MULTIPLY, DICTIONARY)
- CASE_TYPE(math, OP_MULTIPLY, ARRAY)
- CASE_TYPE(math, OP_MULTIPLY, PACKED_BYTE_ARRAY);
- CASE_TYPE(math, OP_MULTIPLY, PACKED_INT32_ARRAY);
- CASE_TYPE(math, OP_MULTIPLY, PACKED_INT64_ARRAY);
- CASE_TYPE(math, OP_MULTIPLY, PACKED_FLOAT32_ARRAY);
- CASE_TYPE(math, OP_MULTIPLY, PACKED_FLOAT64_ARRAY);
- CASE_TYPE(math, OP_MULTIPLY, PACKED_STRING_ARRAY);
- CASE_TYPE(math, OP_MULTIPLY, PACKED_VECTOR2_ARRAY);
- CASE_TYPE(math, OP_MULTIPLY, PACKED_VECTOR3_ARRAY);
- CASE_TYPE(math, OP_MULTIPLY, PACKED_COLOR_ARRAY);
- _RETURN_FAIL;
- }
-
- SWITCH_OP(math, OP_DIVIDE, p_a.type) {
- CASE_TYPE(math, OP_DIVIDE, QUAT) {
- if (p_b.type != FLOAT)
- _RETURN_FAIL;
-#ifdef DEBUG_ENABLED
- if (p_b._data._float == 0) {
- r_valid = false;
- _RETURN("Division By Zero");
- }
-#endif
- _RETURN(*reinterpret_cast<const Quat *>(p_a._data._mem) / p_b._data._float);
- }
-
- DEFAULT_OP_NUM_DIV(math, OP_DIVIDE, INT, _int);
- DEFAULT_OP_NUM_DIV(math, OP_DIVIDE, FLOAT, _float);
- DEFAULT_OP_LOCALMEM_NUM(math, OP_DIVIDE, VECTOR2, /, Vector2);
- DEFAULT_OP_LOCALMEM_NUM(math, OP_DIVIDE, VECTOR2I, /, Vector2i);
- DEFAULT_OP_LOCALMEM_NUM(math, OP_DIVIDE, VECTOR3, /, Vector3);
- DEFAULT_OP_LOCALMEM_NUM(math, OP_DIVIDE, VECTOR3I, /, Vector3i);
- DEFAULT_OP_LOCALMEM_NUM(math, OP_DIVIDE, COLOR, /, Color);
-
- CASE_TYPE(math, OP_DIVIDE, NIL)
- CASE_TYPE(math, OP_DIVIDE, BOOL)
- CASE_TYPE(math, OP_DIVIDE, STRING)
- CASE_TYPE(math, OP_DIVIDE, RECT2)
- CASE_TYPE(math, OP_DIVIDE, RECT2I)
- CASE_TYPE(math, OP_DIVIDE, TRANSFORM2D)
- CASE_TYPE(math, OP_DIVIDE, PLANE)
- CASE_TYPE(math, OP_DIVIDE, AABB)
- CASE_TYPE(math, OP_DIVIDE, BASIS)
- CASE_TYPE(math, OP_DIVIDE, TRANSFORM)
- CASE_TYPE(math, OP_DIVIDE, STRING_NAME)
- CASE_TYPE(math, OP_DIVIDE, NODE_PATH)
- CASE_TYPE(math, OP_DIVIDE, _RID)
- CASE_TYPE(math, OP_DIVIDE, OBJECT)
- CASE_TYPE(math, OP_DIVIDE, CALLABLE)
- CASE_TYPE(math, OP_DIVIDE, SIGNAL)
-
- CASE_TYPE(math, OP_DIVIDE, DICTIONARY)
- CASE_TYPE(math, OP_DIVIDE, ARRAY)
- CASE_TYPE(math, OP_DIVIDE, PACKED_BYTE_ARRAY);
- CASE_TYPE(math, OP_DIVIDE, PACKED_INT32_ARRAY);
- CASE_TYPE(math, OP_DIVIDE, PACKED_INT64_ARRAY);
- CASE_TYPE(math, OP_DIVIDE, PACKED_FLOAT32_ARRAY);
- CASE_TYPE(math, OP_DIVIDE, PACKED_FLOAT64_ARRAY);
- CASE_TYPE(math, OP_DIVIDE, PACKED_STRING_ARRAY);
- CASE_TYPE(math, OP_DIVIDE, PACKED_VECTOR2_ARRAY);
- CASE_TYPE(math, OP_DIVIDE, PACKED_VECTOR3_ARRAY);
- CASE_TYPE(math, OP_DIVIDE, PACKED_COLOR_ARRAY);
- _RETURN_FAIL;
- }
-
- SWITCH_OP(math, OP_POSITIVE, p_a.type) {
- DEFAULT_OP_NUM_POS(math, OP_POSITIVE, INT, _int);
- DEFAULT_OP_NUM_POS(math, OP_POSITIVE, FLOAT, _float);
- DEFAULT_OP_LOCALMEM_POS(math, OP_POSITIVE, VECTOR3, Vector3);
- DEFAULT_OP_LOCALMEM_POS(math, OP_POSITIVE, VECTOR3I, Vector3i);
- DEFAULT_OP_LOCALMEM_POS(math, OP_POSITIVE, PLANE, Plane);
- DEFAULT_OP_LOCALMEM_POS(math, OP_POSITIVE, QUAT, Quat);
- DEFAULT_OP_LOCALMEM_POS(math, OP_POSITIVE, VECTOR2, Vector2);
- DEFAULT_OP_LOCALMEM_POS(math, OP_POSITIVE, VECTOR2I, Vector2i);
-
- CASE_TYPE(math, OP_POSITIVE, NIL)
- CASE_TYPE(math, OP_POSITIVE, BOOL)
- CASE_TYPE(math, OP_POSITIVE, STRING)
- CASE_TYPE(math, OP_POSITIVE, RECT2)
- CASE_TYPE(math, OP_POSITIVE, RECT2I)
- CASE_TYPE(math, OP_POSITIVE, TRANSFORM2D)
- CASE_TYPE(math, OP_POSITIVE, AABB)
- CASE_TYPE(math, OP_POSITIVE, BASIS)
- CASE_TYPE(math, OP_POSITIVE, TRANSFORM)
- CASE_TYPE(math, OP_POSITIVE, COLOR)
- CASE_TYPE(math, OP_POSITIVE, STRING_NAME)
- CASE_TYPE(math, OP_POSITIVE, NODE_PATH)
- CASE_TYPE(math, OP_POSITIVE, _RID)
- CASE_TYPE(math, OP_POSITIVE, OBJECT)
- CASE_TYPE(math, OP_POSITIVE, CALLABLE)
- CASE_TYPE(math, OP_POSITIVE, SIGNAL)
-
- CASE_TYPE(math, OP_POSITIVE, DICTIONARY)
- CASE_TYPE(math, OP_POSITIVE, ARRAY)
- CASE_TYPE(math, OP_POSITIVE, PACKED_BYTE_ARRAY)
- CASE_TYPE(math, OP_POSITIVE, PACKED_INT32_ARRAY)
- CASE_TYPE(math, OP_POSITIVE, PACKED_INT64_ARRAY)
- CASE_TYPE(math, OP_POSITIVE, PACKED_FLOAT32_ARRAY)
- CASE_TYPE(math, OP_POSITIVE, PACKED_FLOAT64_ARRAY)
- CASE_TYPE(math, OP_POSITIVE, PACKED_STRING_ARRAY)
- CASE_TYPE(math, OP_POSITIVE, PACKED_VECTOR2_ARRAY)
- CASE_TYPE(math, OP_POSITIVE, PACKED_VECTOR3_ARRAY)
- CASE_TYPE(math, OP_POSITIVE, PACKED_COLOR_ARRAY)
- _RETURN_FAIL;
- }
-
- SWITCH_OP(math, OP_NEGATE, p_a.type) {
- DEFAULT_OP_NUM_NEG(math, OP_NEGATE, INT, _int);
- DEFAULT_OP_NUM_NEG(math, OP_NEGATE, FLOAT, _float);
-
- DEFAULT_OP_LOCALMEM_NEG(math, OP_NEGATE, VECTOR2, Vector2);
- DEFAULT_OP_LOCALMEM_NEG(math, OP_NEGATE, VECTOR2I, Vector2i);
- DEFAULT_OP_LOCALMEM_NEG(math, OP_NEGATE, VECTOR3, Vector3);
- DEFAULT_OP_LOCALMEM_NEG(math, OP_NEGATE, VECTOR3I, Vector3i);
- DEFAULT_OP_LOCALMEM_NEG(math, OP_NEGATE, PLANE, Plane);
- DEFAULT_OP_LOCALMEM_NEG(math, OP_NEGATE, QUAT, Quat);
- DEFAULT_OP_LOCALMEM_NEG(math, OP_NEGATE, COLOR, Color);
-
- CASE_TYPE(math, OP_NEGATE, NIL)
- CASE_TYPE(math, OP_NEGATE, BOOL)
- CASE_TYPE(math, OP_NEGATE, STRING)
- CASE_TYPE(math, OP_NEGATE, RECT2)
- CASE_TYPE(math, OP_NEGATE, RECT2I)
- CASE_TYPE(math, OP_NEGATE, TRANSFORM2D)
- CASE_TYPE(math, OP_NEGATE, AABB)
- CASE_TYPE(math, OP_NEGATE, BASIS)
- CASE_TYPE(math, OP_NEGATE, TRANSFORM)
- CASE_TYPE(math, OP_NEGATE, STRING_NAME)
- CASE_TYPE(math, OP_NEGATE, NODE_PATH)
- CASE_TYPE(math, OP_NEGATE, _RID)
- CASE_TYPE(math, OP_NEGATE, OBJECT)
- CASE_TYPE(math, OP_NEGATE, CALLABLE)
- CASE_TYPE(math, OP_NEGATE, SIGNAL)
-
- CASE_TYPE(math, OP_NEGATE, DICTIONARY)
- CASE_TYPE(math, OP_NEGATE, ARRAY)
- CASE_TYPE(math, OP_NEGATE, PACKED_BYTE_ARRAY)
- CASE_TYPE(math, OP_NEGATE, PACKED_INT32_ARRAY)
- CASE_TYPE(math, OP_NEGATE, PACKED_INT64_ARRAY)
- CASE_TYPE(math, OP_NEGATE, PACKED_FLOAT32_ARRAY)
- CASE_TYPE(math, OP_NEGATE, PACKED_FLOAT64_ARRAY)
- CASE_TYPE(math, OP_NEGATE, PACKED_STRING_ARRAY)
- CASE_TYPE(math, OP_NEGATE, PACKED_VECTOR2_ARRAY)
- CASE_TYPE(math, OP_NEGATE, PACKED_VECTOR3_ARRAY)
- CASE_TYPE(math, OP_NEGATE, PACKED_COLOR_ARRAY)
- _RETURN_FAIL;
- }
-
- SWITCH_OP(math, OP_MODULE, p_a.type) {
- CASE_TYPE(math, OP_MODULE, INT) {
- if (p_b.type != INT)
- _RETURN_FAIL;
-#ifdef DEBUG_ENABLED
- if (p_b._data._int == 0) {
- r_valid = false;
- _RETURN("Division By Zero");
- }
-#endif
- _RETURN(p_a._data._int % p_b._data._int);
- }
-
- CASE_TYPE(math, OP_MODULE, STRING) {
- const String *format = reinterpret_cast<const String *>(p_a._data._mem);
-
- String result;
- bool error;
- if (p_b.type == ARRAY) {
- // e.g. "frog %s %d" % ["fish", 12]
- const Array *args = reinterpret_cast<const Array *>(p_b._data._mem);
- result = format->sprintf(*args, &error);
- } else {
- // e.g. "frog %d" % 12
- Array args;
- args.push_back(p_b);
- result = format->sprintf(args, &error);
- }
- r_valid = !error;
- _RETURN(result);
- }
-
- CASE_TYPE(math, OP_MODULE, NIL)
- CASE_TYPE(math, OP_MODULE, BOOL)
- CASE_TYPE(math, OP_MODULE, FLOAT)
- CASE_TYPE(math, OP_MODULE, VECTOR2)
- CASE_TYPE(math, OP_MODULE, VECTOR2I)
- CASE_TYPE(math, OP_MODULE, RECT2)
- CASE_TYPE(math, OP_MODULE, RECT2I)
- CASE_TYPE(math, OP_MODULE, VECTOR3)
- CASE_TYPE(math, OP_MODULE, VECTOR3I)
- CASE_TYPE(math, OP_MODULE, TRANSFORM2D)
- CASE_TYPE(math, OP_MODULE, PLANE)
- CASE_TYPE(math, OP_MODULE, QUAT)
- CASE_TYPE(math, OP_MODULE, AABB)
- CASE_TYPE(math, OP_MODULE, BASIS)
- CASE_TYPE(math, OP_MODULE, TRANSFORM)
- CASE_TYPE(math, OP_MODULE, COLOR)
- CASE_TYPE(math, OP_MODULE, STRING_NAME)
- CASE_TYPE(math, OP_MODULE, NODE_PATH)
- CASE_TYPE(math, OP_MODULE, _RID)
- CASE_TYPE(math, OP_MODULE, OBJECT)
- CASE_TYPE(math, OP_MODULE, CALLABLE)
- CASE_TYPE(math, OP_MODULE, SIGNAL)
-
- CASE_TYPE(math, OP_MODULE, DICTIONARY)
- CASE_TYPE(math, OP_MODULE, ARRAY)
- CASE_TYPE(math, OP_MODULE, PACKED_BYTE_ARRAY)
- CASE_TYPE(math, OP_MODULE, PACKED_INT32_ARRAY)
- CASE_TYPE(math, OP_MODULE, PACKED_INT64_ARRAY)
- CASE_TYPE(math, OP_MODULE, PACKED_FLOAT32_ARRAY)
- CASE_TYPE(math, OP_MODULE, PACKED_FLOAT64_ARRAY)
- CASE_TYPE(math, OP_MODULE, PACKED_STRING_ARRAY)
- CASE_TYPE(math, OP_MODULE, PACKED_VECTOR2_ARRAY)
- CASE_TYPE(math, OP_MODULE, PACKED_VECTOR3_ARRAY)
- CASE_TYPE(math, OP_MODULE, PACKED_COLOR_ARRAY)
- _RETURN_FAIL;
- }
-
- SWITCH_OP(math, OP_STRING_CONCAT, p_a.type) {
- CASE_TYPE_ALL(math, OP_STRING_CONCAT)
-
- _RETURN(p_a.operator String() + p_b.operator String());
- }
-
- SWITCH_OP(math, OP_SHIFT_LEFT, p_a.type) {
- CASE_TYPE(math, OP_SHIFT_LEFT, INT) {
- if (p_b.type != INT)
- _RETURN_FAIL;
- if (p_b._data._int < 0 || p_b._data._int >= 64)
- _RETURN_FAIL;
- _RETURN(p_a._data._int << p_b._data._int);
- }
-
- CASE_TYPE_ALL_BUT_INT(math, OP_SHIFT_LEFT)
- _RETURN_FAIL;
- }
-
- SWITCH_OP(math, OP_SHIFT_RIGHT, p_a.type) {
- CASE_TYPE(math, OP_SHIFT_RIGHT, INT) {
- if (p_b.type != INT)
- _RETURN_FAIL;
- if (p_b._data._int < 0 || p_b._data._int >= 64)
- _RETURN_FAIL;
- _RETURN(p_a._data._int >> p_b._data._int);
- }
-
- CASE_TYPE_ALL_BUT_INT(math, OP_SHIFT_RIGHT)
- _RETURN_FAIL;
- }
-
- SWITCH_OP(math, OP_BIT_AND, p_a.type) {
- CASE_TYPE(math, OP_BIT_AND, INT) {
- if (p_b.type != INT)
- _RETURN_FAIL;
- _RETURN(p_a._data._int & p_b._data._int);
- }
-
- CASE_TYPE_ALL_BUT_INT(math, OP_BIT_AND)
- _RETURN_FAIL;
- }
-
- SWITCH_OP(math, OP_BIT_OR, p_a.type) {
- CASE_TYPE(math, OP_BIT_OR, INT) {
- if (p_b.type != INT)
- _RETURN_FAIL;
- _RETURN(p_a._data._int | p_b._data._int);
- }
-
- CASE_TYPE_ALL_BUT_INT(math, OP_BIT_OR)
- _RETURN_FAIL;
- }
-
- SWITCH_OP(math, OP_BIT_XOR, p_a.type) {
- CASE_TYPE(math, OP_BIT_XOR, INT) {
- if (p_b.type != INT)
- _RETURN_FAIL;
- _RETURN(p_a._data._int ^ p_b._data._int);
- }
-
- CASE_TYPE_ALL_BUT_INT(math, OP_BIT_XOR)
- _RETURN_FAIL;
- }
-
- SWITCH_OP(math, OP_BIT_NEGATE, p_a.type) {
- CASE_TYPE(math, OP_BIT_NEGATE, INT) {
- _RETURN(~p_a._data._int);
- }
-
- CASE_TYPE_ALL_BUT_INT(math, OP_BIT_NEGATE)
- _RETURN_FAIL;
- }
-
- SWITCH_OP(math, OP_AND, p_a.type) {
- CASE_TYPE_ALL(math, OP_AND) {
- bool l = p_a.booleanize();
- bool r = p_b.booleanize();
-
- _RETURN(l && r);
- }
- }
-
- SWITCH_OP(math, OP_OR, p_a.type) {
- CASE_TYPE_ALL(math, OP_OR) {
- bool l = p_a.booleanize();
- bool r = p_b.booleanize();
-
- _RETURN(l || r);
- }
- }
-
- SWITCH_OP(math, OP_XOR, p_a.type) {
- CASE_TYPE_ALL(math, OP_XOR) {
- bool l = p_a.booleanize();
- bool r = p_b.booleanize();
-
- _RETURN((l || r) && !(l && r));
- }
- }
-
- SWITCH_OP(math, OP_NOT, p_a.type) {
- CASE_TYPE_ALL(math, OP_NOT) {
- bool l = p_a.booleanize();
- _RETURN(!l);
- }
- }
-
- SWITCH_OP(math, OP_IN, p_a.type) {
- CASE_TYPE_ALL(math, OP_IN)
- _RETURN(p_b.in(p_a, &r_valid));
- }
- }
-}
-
-void Variant::set_named(const StringName &p_index, const Variant &p_value, bool *r_valid) {
- bool valid = false;
- switch (type) {
- case VECTOR2: {
- if (p_value.type == Variant::INT) {
- Vector2 *v = reinterpret_cast<Vector2 *>(_data._mem);
- if (p_index == CoreStringNames::singleton->x) {
- v->x = p_value._data._int;
- valid = true;
- } else if (p_index == CoreStringNames::singleton->y) {
- v->y = p_value._data._int;
- valid = true;
- }
- } else if (p_value.type == Variant::FLOAT) {
- Vector2 *v = reinterpret_cast<Vector2 *>(_data._mem);
- if (p_index == CoreStringNames::singleton->x) {
- v->x = p_value._data._float;
- valid = true;
- } else if (p_index == CoreStringNames::singleton->y) {
- v->y = p_value._data._float;
- valid = true;
- }
- }
-
- } break;
- case VECTOR2I: {
- if (p_value.type == Variant::INT) {
- Vector2i *v = reinterpret_cast<Vector2i *>(_data._mem);
- if (p_index == CoreStringNames::singleton->x) {
- v->x = p_value._data._int;
- valid = true;
- } else if (p_index == CoreStringNames::singleton->y) {
- v->y = p_value._data._int;
- valid = true;
- }
- } else if (p_value.type == Variant::FLOAT) {
- Vector2i *v = reinterpret_cast<Vector2i *>(_data._mem);
- if (p_index == CoreStringNames::singleton->x) {
- v->x = p_value._data._float;
- valid = true;
- } else if (p_index == CoreStringNames::singleton->y) {
- v->y = p_value._data._float;
- valid = true;
- }
- }
-
- } break;
- case RECT2: {
- if (p_value.type == Variant::VECTOR2) {
- Rect2 *v = reinterpret_cast<Rect2 *>(_data._mem);
- //scalar name
- if (p_index == CoreStringNames::singleton->position) {
- v->position = *reinterpret_cast<const Vector2 *>(p_value._data._mem);
- valid = true;
- } else if (p_index == CoreStringNames::singleton->size) {
- v->size = *reinterpret_cast<const Vector2 *>(p_value._data._mem);
- valid = true;
- } else if (p_index == CoreStringNames::singleton->end) {
- v->size = *reinterpret_cast<const Vector2 *>(p_value._data._mem) - v->position;
- valid = true;
- }
- }
- } break;
- case RECT2I: {
- if (p_value.type == Variant::VECTOR2I) {
- Rect2i *v = reinterpret_cast<Rect2i *>(_data._mem);
- //scalar name
- if (p_index == CoreStringNames::singleton->position) {
- v->position = *reinterpret_cast<const Vector2i *>(p_value._data._mem);
- valid = true;
- } else if (p_index == CoreStringNames::singleton->size) {
- v->size = *reinterpret_cast<const Vector2i *>(p_value._data._mem);
- valid = true;
- } else if (p_index == CoreStringNames::singleton->end) {
- v->size = *reinterpret_cast<const Vector2i *>(p_value._data._mem) - v->position;
- valid = true;
- }
- }
- } break;
- case TRANSFORM2D: {
- if (p_value.type == Variant::VECTOR2) {
- Transform2D *v = _data._transform2d;
- if (p_index == CoreStringNames::singleton->x) {
- v->elements[0] = *reinterpret_cast<const Vector2 *>(p_value._data._mem);
- valid = true;
- } else if (p_index == CoreStringNames::singleton->y) {
- v->elements[1] = *reinterpret_cast<const Vector2 *>(p_value._data._mem);
- valid = true;
- } else if (p_index == CoreStringNames::singleton->origin) {
- v->elements[2] = *reinterpret_cast<const Vector2 *>(p_value._data._mem);
- valid = true;
- }
- }
-
- } break;
- case VECTOR3: {
- if (p_value.type == Variant::INT) {
- Vector3 *v = reinterpret_cast<Vector3 *>(_data._mem);
- if (p_index == CoreStringNames::singleton->x) {
- v->x = p_value._data._int;
- valid = true;
- } else if (p_index == CoreStringNames::singleton->y) {
- v->y = p_value._data._int;
- valid = true;
- } else if (p_index == CoreStringNames::singleton->z) {
- v->z = p_value._data._int;
- valid = true;
- }
- } else if (p_value.type == Variant::FLOAT) {
- Vector3 *v = reinterpret_cast<Vector3 *>(_data._mem);
- if (p_index == CoreStringNames::singleton->x) {
- v->x = p_value._data._float;
- valid = true;
- } else if (p_index == CoreStringNames::singleton->y) {
- v->y = p_value._data._float;
- valid = true;
- } else if (p_index == CoreStringNames::singleton->z) {
- v->z = p_value._data._float;
- valid = true;
- }
- }
-
- } break;
- case VECTOR3I: {
- if (p_value.type == Variant::INT) {
- Vector3i *v = reinterpret_cast<Vector3i *>(_data._mem);
- if (p_index == CoreStringNames::singleton->x) {
- v->x = p_value._data._int;
- valid = true;
- } else if (p_index == CoreStringNames::singleton->y) {
- v->y = p_value._data._int;
- valid = true;
- } else if (p_index == CoreStringNames::singleton->z) {
- v->z = p_value._data._int;
- valid = true;
- }
- } else if (p_value.type == Variant::FLOAT) {
- Vector3i *v = reinterpret_cast<Vector3i *>(_data._mem);
- if (p_index == CoreStringNames::singleton->x) {
- v->x = p_value._data._float;
- valid = true;
- } else if (p_index == CoreStringNames::singleton->y) {
- v->y = p_value._data._float;
- valid = true;
- } else if (p_index == CoreStringNames::singleton->z) {
- v->z = p_value._data._float;
- valid = true;
- }
- }
-
- } break;
- case PLANE: {
- if (p_value.type == Variant::INT) {
- Plane *v = reinterpret_cast<Plane *>(_data._mem);
- if (p_index == CoreStringNames::singleton->x) {
- v->normal.x = p_value._data._int;
- valid = true;
- } else if (p_index == CoreStringNames::singleton->y) {
- v->normal.y = p_value._data._int;
- valid = true;
- } else if (p_index == CoreStringNames::singleton->z) {
- v->normal.z = p_value._data._int;
- valid = true;
- } else if (p_index == CoreStringNames::singleton->d) {
- v->d = p_value._data._int;
- valid = true;
- }
- } else if (p_value.type == Variant::FLOAT) {
- Plane *v = reinterpret_cast<Plane *>(_data._mem);
- if (p_index == CoreStringNames::singleton->x) {
- v->normal.x = p_value._data._float;
- valid = true;
- } else if (p_index == CoreStringNames::singleton->y) {
- v->normal.y = p_value._data._float;
- valid = true;
- } else if (p_index == CoreStringNames::singleton->z) {
- v->normal.z = p_value._data._float;
- valid = true;
- } else if (p_index == CoreStringNames::singleton->d) {
- v->d = p_value._data._float;
- valid = true;
- }
-
- } else if (p_value.type == Variant::VECTOR3) {
- Plane *v = reinterpret_cast<Plane *>(_data._mem);
- if (p_index == CoreStringNames::singleton->normal) {
- v->normal = *reinterpret_cast<const Vector3 *>(p_value._data._mem);
- valid = true;
- }
- }
-
- } break;
- case QUAT: {
- if (p_value.type == Variant::INT) {
- Quat *v = reinterpret_cast<Quat *>(_data._mem);
- if (p_index == CoreStringNames::singleton->x) {
- v->x = p_value._data._int;
- valid = true;
- } else if (p_index == CoreStringNames::singleton->y) {
- v->y = p_value._data._int;
- valid = true;
- } else if (p_index == CoreStringNames::singleton->z) {
- v->z = p_value._data._int;
- valid = true;
- } else if (p_index == CoreStringNames::singleton->w) {
- v->w = p_value._data._int;
- valid = true;
- }
- } else if (p_value.type == Variant::FLOAT) {
- Quat *v = reinterpret_cast<Quat *>(_data._mem);
- if (p_index == CoreStringNames::singleton->x) {
- v->x = p_value._data._float;
- valid = true;
- } else if (p_index == CoreStringNames::singleton->y) {
- v->y = p_value._data._float;
- valid = true;
- } else if (p_index == CoreStringNames::singleton->z) {
- v->z = p_value._data._float;
- valid = true;
- } else if (p_index == CoreStringNames::singleton->w) {
- v->w = p_value._data._float;
- valid = true;
- }
- }
-
- } break;
- case AABB: {
- if (p_value.type == Variant::VECTOR3) {
- ::AABB *v = _data._aabb;
- //scalar name
- if (p_index == CoreStringNames::singleton->position) {
- v->position = *reinterpret_cast<const Vector3 *>(p_value._data._mem);
- valid = true;
- } else if (p_index == CoreStringNames::singleton->size) {
- v->size = *reinterpret_cast<const Vector3 *>(p_value._data._mem);
- valid = true;
- } else if (p_index == CoreStringNames::singleton->end) {
- v->size = *reinterpret_cast<const Vector3 *>(p_value._data._mem) - v->position;
- valid = true;
- }
- }
- } break;
- case BASIS: {
- if (p_value.type == Variant::VECTOR3) {
- Basis *v = _data._basis;
- //scalar name
- if (p_index == CoreStringNames::singleton->x) {
- v->set_axis(0, *reinterpret_cast<const Vector3 *>(p_value._data._mem));
- valid = true;
- } else if (p_index == CoreStringNames::singleton->y) {
- v->set_axis(1, *reinterpret_cast<const Vector3 *>(p_value._data._mem));
- valid = true;
- } else if (p_index == CoreStringNames::singleton->z) {
- v->set_axis(2, *reinterpret_cast<const Vector3 *>(p_value._data._mem));
- valid = true;
- }
- }
- } break;
- case TRANSFORM: {
- if (p_value.type == Variant::BASIS && p_index == CoreStringNames::singleton->basis) {
- _data._transform->basis = *p_value._data._basis;
- valid = true;
- } else if (p_value.type == Variant::VECTOR3 && p_index == CoreStringNames::singleton->origin) {
- _data._transform->origin = *reinterpret_cast<const Vector3 *>(p_value._data._mem);
- valid = true;
- }
-
- } break;
- case COLOR: {
- if (p_value.type == Variant::INT) {
- Color *v = reinterpret_cast<Color *>(_data._mem);
- if (p_index == CoreStringNames::singleton->r) {
- v->r = p_value._data._int;
- valid = true;
- } else if (p_index == CoreStringNames::singleton->g) {
- v->g = p_value._data._int;
- valid = true;
- } else if (p_index == CoreStringNames::singleton->b) {
- v->b = p_value._data._int;
- valid = true;
- } else if (p_index == CoreStringNames::singleton->a) {
- v->a = p_value._data._int;
- valid = true;
- } else if (p_index == CoreStringNames::singleton->r8) {
- v->r = p_value._data._int / 255.0;
- valid = true;
- } else if (p_index == CoreStringNames::singleton->g8) {
- v->g = p_value._data._int / 255.0;
- valid = true;
- } else if (p_index == CoreStringNames::singleton->b8) {
- v->b = p_value._data._int / 255.0;
- valid = true;
- } else if (p_index == CoreStringNames::singleton->a8) {
- v->a = p_value._data._int / 255.0;
- valid = true;
- } else if (p_index == CoreStringNames::singleton->h) {
- v->set_hsv(p_value._data._int, v->get_s(), v->get_v(), v->a);
- valid = true;
- } else if (p_index == CoreStringNames::singleton->s) {
- v->set_hsv(v->get_h(), p_value._data._int, v->get_v(), v->a);
- valid = true;
- } else if (p_index == CoreStringNames::singleton->v) {
- v->set_hsv(v->get_h(), v->get_v(), p_value._data._int, v->a);
- valid = true;
- }
- } else if (p_value.type == Variant::FLOAT) {
- Color *v = reinterpret_cast<Color *>(_data._mem);
- if (p_index == CoreStringNames::singleton->r) {
- v->r = p_value._data._float;
- valid = true;
- } else if (p_index == CoreStringNames::singleton->g) {
- v->g = p_value._data._float;
- valid = true;
- } else if (p_index == CoreStringNames::singleton->b) {
- v->b = p_value._data._float;
- valid = true;
- } else if (p_index == CoreStringNames::singleton->a) {
- v->a = p_value._data._float;
- valid = true;
- } else if (p_index == CoreStringNames::singleton->r8) {
- v->r = p_value._data._float / 255.0;
- valid = true;
- } else if (p_index == CoreStringNames::singleton->g8) {
- v->g = p_value._data._float / 255.0;
- valid = true;
- } else if (p_index == CoreStringNames::singleton->b8) {
- v->b = p_value._data._float / 255.0;
- valid = true;
- } else if (p_index == CoreStringNames::singleton->a8) {
- v->a = p_value._data._float / 255.0;
- valid = true;
- } else if (p_index == CoreStringNames::singleton->h) {
- v->set_hsv(p_value._data._float, v->get_s(), v->get_v(), v->a);
- valid = true;
- } else if (p_index == CoreStringNames::singleton->s) {
- v->set_hsv(v->get_h(), p_value._data._float, v->get_v(), v->a);
- valid = true;
- } else if (p_index == CoreStringNames::singleton->v) {
- v->set_hsv(v->get_h(), v->get_s(), p_value._data._float, v->a);
- valid = true;
- }
- }
- } break;
- case OBJECT: {
-#ifdef DEBUG_ENABLED
- if (!_get_obj().obj) {
- break;
- } else if (EngineDebugger::is_active() && ObjectDB::get_instance(_get_obj().id) == nullptr) {
- break;
- }
-
-#endif
- _get_obj().obj->set(p_index, p_value, &valid);
-
- } break;
- default: {
- set(p_index.operator String(), p_value, &valid);
- } break;
- }
-
- if (r_valid) {
- *r_valid = valid;
- }
-}
-
-Variant Variant::get_named(const StringName &p_index, bool *r_valid) const {
- if (r_valid) {
- *r_valid = true;
- }
-
- switch (type) {
- case VECTOR2: {
- const Vector2 *v = reinterpret_cast<const Vector2 *>(_data._mem);
- if (p_index == CoreStringNames::singleton->x) {
- return v->x;
- } else if (p_index == CoreStringNames::singleton->y) {
- return v->y;
- }
-
- } break;
- case VECTOR2I: {
- const Vector2i *v = reinterpret_cast<const Vector2i *>(_data._mem);
- if (p_index == CoreStringNames::singleton->x) {
- return v->x;
- } else if (p_index == CoreStringNames::singleton->y) {
- return v->y;
- }
-
- } break;
- case RECT2: {
- const Rect2 *v = reinterpret_cast<const Rect2 *>(_data._mem);
- //scalar name
- if (p_index == CoreStringNames::singleton->position) {
- return v->position;
- } else if (p_index == CoreStringNames::singleton->size) {
- return v->size;
- } else if (p_index == CoreStringNames::singleton->end) {
- return v->size + v->position;
- }
- } break;
- case RECT2I: {
- const Rect2i *v = reinterpret_cast<const Rect2i *>(_data._mem);
- //scalar name
- if (p_index == CoreStringNames::singleton->position) {
- return v->position;
- } else if (p_index == CoreStringNames::singleton->size) {
- return v->size;
- } else if (p_index == CoreStringNames::singleton->end) {
- return v->size + v->position;
- }
- } break;
- case TRANSFORM2D: {
- const Transform2D *v = _data._transform2d;
- if (p_index == CoreStringNames::singleton->x) {
- return v->elements[0];
- } else if (p_index == CoreStringNames::singleton->y) {
- return v->elements[1];
- } else if (p_index == CoreStringNames::singleton->origin) {
- return v->elements[2];
- }
-
- } break;
- case VECTOR3: {
- const Vector3 *v = reinterpret_cast<const Vector3 *>(_data._mem);
- if (p_index == CoreStringNames::singleton->x) {
- return v->x;
- } else if (p_index == CoreStringNames::singleton->y) {
- return v->y;
- } else if (p_index == CoreStringNames::singleton->z) {
- return v->z;
- }
-
- } break;
- case VECTOR3I: {
- const Vector3i *v = reinterpret_cast<const Vector3i *>(_data._mem);
- if (p_index == CoreStringNames::singleton->x) {
- return v->x;
- } else if (p_index == CoreStringNames::singleton->y) {
- return v->y;
- } else if (p_index == CoreStringNames::singleton->z) {
- return v->z;
- }
-
- } break;
- case PLANE: {
- const Plane *v = reinterpret_cast<const Plane *>(_data._mem);
- if (p_index == CoreStringNames::singleton->x) {
- return v->normal.x;
- } else if (p_index == CoreStringNames::singleton->y) {
- return v->normal.y;
- } else if (p_index == CoreStringNames::singleton->z) {
- return v->normal.z;
- } else if (p_index == CoreStringNames::singleton->d) {
- return v->d;
- } else if (p_index == CoreStringNames::singleton->normal) {
- return v->normal;
- }
-
- } break;
- case QUAT: {
- const Quat *v = reinterpret_cast<const Quat *>(_data._mem);
- if (p_index == CoreStringNames::singleton->x) {
- return v->x;
- } else if (p_index == CoreStringNames::singleton->y) {
- return v->y;
- } else if (p_index == CoreStringNames::singleton->z) {
- return v->z;
- } else if (p_index == CoreStringNames::singleton->w) {
- return v->w;
- }
-
- } break;
- case AABB: {
- const ::AABB *v = _data._aabb;
- //scalar name
- if (p_index == CoreStringNames::singleton->position) {
- return v->position;
- } else if (p_index == CoreStringNames::singleton->size) {
- return v->size;
- } else if (p_index == CoreStringNames::singleton->end) {
- return v->size + v->position;
- }
- } break;
- case BASIS: {
- const Basis *v = _data._basis;
- //scalar name
- if (p_index == CoreStringNames::singleton->x) {
- return v->get_axis(0);
- } else if (p_index == CoreStringNames::singleton->y) {
- return v->get_axis(1);
- } else if (p_index == CoreStringNames::singleton->z) {
- return v->get_axis(2);
- }
-
- } break;
- case TRANSFORM: {
- if (p_index == CoreStringNames::singleton->basis) {
- return _data._transform->basis;
- } else if (p_index == CoreStringNames::singleton->origin) {
- return _data._transform->origin;
- }
-
- } break;
- case COLOR: {
- const Color *v = reinterpret_cast<const Color *>(_data._mem);
- if (p_index == CoreStringNames::singleton->r) {
- return v->r;
- } else if (p_index == CoreStringNames::singleton->g) {
- return v->g;
- } else if (p_index == CoreStringNames::singleton->b) {
- return v->b;
- } else if (p_index == CoreStringNames::singleton->a) {
- return v->a;
- } else if (p_index == CoreStringNames::singleton->r8) {
- return int(Math::round(v->r * 255.0));
- } else if (p_index == CoreStringNames::singleton->g8) {
- return int(Math::round(v->g * 255.0));
- } else if (p_index == CoreStringNames::singleton->b8) {
- return int(Math::round(v->b * 255.0));
- } else if (p_index == CoreStringNames::singleton->a8) {
- return int(Math::round(v->a * 255.0));
- } else if (p_index == CoreStringNames::singleton->h) {
- return v->get_h();
- } else if (p_index == CoreStringNames::singleton->s) {
- return v->get_s();
- } else if (p_index == CoreStringNames::singleton->v) {
- return v->get_v();
- }
- } break;
- case OBJECT: {
-#ifdef DEBUG_ENABLED
- if (!_get_obj().obj) {
- if (r_valid) {
- *r_valid = false;
- }
- return "Instance base is null.";
- } else {
- if (EngineDebugger::is_active() && !_get_obj().id.is_reference() && ObjectDB::get_instance(_get_obj().id) == nullptr) {
- if (r_valid) {
- *r_valid = false;
- }
- return "Attempted use of stray pointer object.";
- }
- }
-
-#endif
-
- return _get_obj().obj->get(p_index, r_valid);
-
- } break;
- default: {
- return get(p_index.operator String(), r_valid);
- }
- }
-
- if (r_valid) {
- *r_valid = false;
- }
- return Variant();
-}
-
-#define DEFAULT_OP_ARRAY_CMD(m_name, m_type, skip_test, cmd) \
- case m_name: { \
- skip_test; \
- \
- if (p_index.get_type() == Variant::INT || p_index.get_type() == Variant::FLOAT) { \
- int index = p_index; \
- m_type *arr = reinterpret_cast<m_type *>(_data._mem); \
- \
- if (index < 0) \
- index += arr->size(); \
- if (index >= 0 && index < arr->size()) { \
- valid = true; \
- cmd; \
- } \
- } \
- } break;
-
-#define DEFAULT_OP_DVECTOR_SET(m_name, m_type, skip_cond) \
- case m_name: { \
- if (skip_cond) \
- return; \
- \
- if (p_index.get_type() == Variant::INT || p_index.get_type() == Variant::FLOAT) { \
- int index = p_index; \
- Vector<m_type> *arr = PackedArrayRef<m_type>::get_array_ptr(_data.packed_array); \
- \
- if (index < 0) \
- index += arr->size(); \
- if (index >= 0 && index < arr->size()) { \
- valid = true; \
- arr->set(index, p_value); \
- } \
- } \
- } break;
-
-#define DEFAULT_OP_DVECTOR_GET(m_name, m_type) \
- case m_name: { \
- if (p_index.get_type() == Variant::INT || p_index.get_type() == Variant::FLOAT) { \
- int index = p_index; \
- const Vector<m_type> *arr = &PackedArrayRef<m_type>::get_array(_data.packed_array); \
- \
- if (index < 0) \
- index += arr->size(); \
- if (index >= 0 && index < arr->size()) { \
- valid = true; \
- return arr->get(index); \
- } \
- } \
- } break;
-
-void Variant::set(const Variant &p_index, const Variant &p_value, bool *r_valid) {
- static bool _dummy = false;
-
- bool &valid = r_valid ? *r_valid : _dummy;
- valid = false;
-
- switch (type) {
- case NIL: {
- return;
- } break;
- case BOOL: {
- return;
- } break;
- case INT: {
- return;
- } break;
- case FLOAT: {
- return;
- } break;
- case STRING: {
- if (p_index.type != Variant::INT && p_index.type != Variant::FLOAT) {
- return;
- }
-
- int idx = p_index;
- String *str = reinterpret_cast<String *>(_data._mem);
- int len = str->length();
- if (idx < 0) {
- idx += len;
- }
- if (idx < 0 || idx >= len) {
- return;
- }
-
- String chr;
- if (p_value.type == Variant::INT || p_value.type == Variant::FLOAT) {
- chr = String::chr(p_value);
- } else if (p_value.type == Variant::STRING) {
- chr = p_value;
- } else {
- return;
- }
-
- *str = str->substr(0, idx) + chr + str->substr(idx + 1, len);
- valid = true;
- return;
-
- } break;
- case VECTOR2: {
- if (p_value.type != Variant::INT && p_value.type != Variant::FLOAT) {
- return;
- }
-
- if (p_index.get_type() == Variant::INT || p_index.get_type() == Variant::FLOAT) {
- // scalar index
- int idx = p_index;
-
- if (idx < 0) {
- idx += 2;
- }
- if (idx >= 0 && idx < 2) {
- Vector2 *v = reinterpret_cast<Vector2 *>(_data._mem);
- valid = true;
- (*v)[idx] = p_value;
- return;
- }
- } else if (p_index.get_type() == Variant::STRING) {
- //scalar name
-
- const String *str = reinterpret_cast<const String *>(p_index._data._mem);
- Vector2 *v = reinterpret_cast<Vector2 *>(_data._mem);
- if (*str == "x") {
- valid = true;
- v->x = p_value;
- return;
- } else if (*str == "y") {
- valid = true;
- v->y = p_value;
- return;
- }
- }
-
- } break;
- case VECTOR2I: {
- if (p_value.type != Variant::INT && p_value.type != Variant::FLOAT) {
- return;
- }
-
- if (p_index.get_type() == Variant::INT || p_index.get_type() == Variant::FLOAT) {
- // scalar index
- int idx = p_index;
-
- if (idx < 0) {
- idx += 2;
- }
- if (idx >= 0 && idx < 2) {
- Vector2i *v = reinterpret_cast<Vector2i *>(_data._mem);
- valid = true;
- (*v)[idx] = p_value;
- return;
- }
- } else if (p_index.get_type() == Variant::STRING) {
- //scalar name
-
- const String *str = reinterpret_cast<const String *>(p_index._data._mem);
- Vector2i *v = reinterpret_cast<Vector2i *>(_data._mem);
- if (*str == "x") {
- valid = true;
- v->x = p_value;
- return;
- } else if (*str == "y") {
- valid = true;
- v->y = p_value;
- return;
- }
- }
-
- } break;
- case RECT2: {
- if (p_value.type != Variant::VECTOR2) {
- return;
- }
-
- if (p_index.get_type() == Variant::STRING) {
- //scalar name
-
- const String *str = reinterpret_cast<const String *>(p_index._data._mem);
- Rect2 *v = reinterpret_cast<Rect2 *>(_data._mem);
- if (*str == "position") {
- valid = true;
- v->position = p_value;
- return;
- } else if (*str == "size") {
- valid = true;
- v->size = p_value;
- return;
- } else if (*str == "end") {
- valid = true;
- v->size = Vector2(p_value) - v->position;
- return;
- }
- }
- } break;
- case RECT2I: {
- if (p_value.type != Variant::VECTOR2I) {
- return;
- }
-
- if (p_index.get_type() == Variant::STRING) {
- //scalar name
-
- const String *str = reinterpret_cast<const String *>(p_index._data._mem);
- Rect2i *v = reinterpret_cast<Rect2i *>(_data._mem);
- if (*str == "position") {
- valid = true;
- v->position = p_value;
- return;
- } else if (*str == "size") {
- valid = true;
- v->size = p_value;
- return;
- } else if (*str == "end") {
- valid = true;
- v->size = Vector2i(p_value) - v->position;
- return;
- }
- }
- } break;
- case TRANSFORM2D: {
- if (p_value.type != Variant::VECTOR2) {
- return;
- }
-
- if (p_index.get_type() == Variant::INT || p_index.get_type() == Variant::FLOAT) {
- int index = p_index;
-
- if (index < 0) {
- index += 3;
- }
- if (index >= 0 && index < 3) {
- Transform2D *v = _data._transform2d;
-
- valid = true;
- v->elements[index] = p_value;
- return;
- }
- } else if (p_index.get_type() == Variant::STRING && p_value.get_type() == Variant::VECTOR2) {
- //scalar name
- const String *str = reinterpret_cast<const String *>(p_index._data._mem);
- Transform2D *v = _data._transform2d;
- if (*str == "x") {
- valid = true;
- v->elements[0] = p_value;
- return;
- } else if (*str == "y") {
- valid = true;
- v->elements[1] = p_value;
- return;
- } else if (*str == "origin") {
- valid = true;
- v->elements[2] = p_value;
- return;
- }
- }
-
- } break;
- case VECTOR3: {
- if (p_value.type != Variant::INT && p_value.type != Variant::FLOAT) {
- return;
- }
-
- if (p_index.get_type() == Variant::INT || p_index.get_type() == Variant::FLOAT) {
- //scalar index
- int idx = p_index;
- if (idx < 0) {
- idx += 3;
- }
- if (idx >= 0 && idx < 3) {
- Vector3 *v = reinterpret_cast<Vector3 *>(_data._mem);
- valid = true;
- (*v)[idx] = p_value;
- return;
- }
- } else if (p_index.get_type() == Variant::STRING) {
- //scalar name
- const String *str = reinterpret_cast<const String *>(p_index._data._mem);
- Vector3 *v = reinterpret_cast<Vector3 *>(_data._mem);
- if (*str == "x") {
- valid = true;
- v->x = p_value;
- return;
- } else if (*str == "y") {
- valid = true;
- v->y = p_value;
- return;
- } else if (*str == "z") {
- valid = true;
- v->z = p_value;
- return;
- }
- }
-
- } break;
- case VECTOR3I: {
- if (p_value.type != Variant::INT && p_value.type != Variant::FLOAT) {
- return;
- }
-
- if (p_index.get_type() == Variant::INT || p_index.get_type() == Variant::FLOAT) {
- //scalar index
- int idx = p_index;
- if (idx < 0) {
- idx += 3;
- }
- if (idx >= 0 && idx < 3) {
- Vector3i *v = reinterpret_cast<Vector3i *>(_data._mem);
- valid = true;
- (*v)[idx] = p_value;
- return;
- }
- } else if (p_index.get_type() == Variant::STRING) {
- //scalar name
- const String *str = reinterpret_cast<const String *>(p_index._data._mem);
- Vector3i *v = reinterpret_cast<Vector3i *>(_data._mem);
- if (*str == "x") {
- valid = true;
- v->x = p_value;
- return;
- } else if (*str == "y") {
- valid = true;
- v->y = p_value;
- return;
- } else if (*str == "z") {
- valid = true;
- v->z = p_value;
- return;
- }
- }
-
- } break;
- case PLANE: {
- if (p_index.get_type() == Variant::STRING) {
- //scalar name
- const String *str = reinterpret_cast<const String *>(p_index._data._mem);
- Plane *v = reinterpret_cast<Plane *>(_data._mem);
- if (*str == "x") {
- if (p_value.type != Variant::INT && p_value.type != Variant::FLOAT) {
- return;
- }
-
- valid = true;
- v->normal.x = p_value;
- return;
- } else if (*str == "y") {
- if (p_value.type != Variant::INT && p_value.type != Variant::FLOAT) {
- return;
- }
-
- valid = true;
- v->normal.y = p_value;
- return;
- } else if (*str == "z") {
- if (p_value.type != Variant::INT && p_value.type != Variant::FLOAT) {
- return;
- }
-
- valid = true;
- v->normal.z = p_value;
- return;
- } else if (*str == "normal") {
- if (p_value.type != Variant::VECTOR3) {
- return;
- }
-
- valid = true;
- v->normal = p_value;
- return;
- } else if (*str == "d") {
- valid = true;
- v->d = p_value;
- return;
- }
- }
-
- } break;
- case QUAT: {
- if (p_value.type != Variant::INT && p_value.type != Variant::FLOAT) {
- return;
- }
-
- if (p_index.get_type() == Variant::STRING) {
- const String *str = reinterpret_cast<const String *>(p_index._data._mem);
- Quat *v = reinterpret_cast<Quat *>(_data._mem);
- if (*str == "x") {
- valid = true;
- v->x = p_value;
- return;
- } else if (*str == "y") {
- valid = true;
- v->y = p_value;
- return;
- } else if (*str == "z") {
- valid = true;
- v->z = p_value;
- return;
- } else if (*str == "w") {
- valid = true;
- v->w = p_value;
- return;
- }
- }
-
- } break;
- case AABB: {
- if (p_value.type != Variant::VECTOR3) {
- return;
- }
-
- if (p_index.get_type() == Variant::STRING) {
- //scalar name
-
- const String *str = reinterpret_cast<const String *>(p_index._data._mem);
- ::AABB *v = _data._aabb;
- if (*str == "position") {
- valid = true;
- v->position = p_value;
- return;
- } else if (*str == "size") {
- valid = true;
- v->size = p_value;
- return;
- } else if (*str == "end") {
- valid = true;
- v->size = Vector3(p_value) - v->position;
- return;
- }
- }
- } break;
- case BASIS: {
- if (p_value.type != Variant::VECTOR3) {
- return;
- }
-
- if (p_index.get_type() == Variant::INT || p_index.get_type() == Variant::FLOAT) {
- int index = p_index;
-
- if (index < 0) {
- index += 3;
- }
- if (index >= 0 && index < 3) {
- Basis *v = _data._basis;
-
- valid = true;
- v->set_axis(index, p_value);
- return;
- }
- } else if (p_index.get_type() == Variant::STRING) {
- const String *str = reinterpret_cast<const String *>(p_index._data._mem);
- Basis *v = _data._basis;
-
- if (*str == "x") {
- valid = true;
- v->set_axis(0, p_value);
- return;
- } else if (*str == "y") {
- valid = true;
- v->set_axis(1, p_value);
- return;
- } else if (*str == "z") {
- valid = true;
- v->set_axis(2, p_value);
- return;
- }
- }
-
- } break;
- case TRANSFORM: {
- if (p_index.get_type() == Variant::INT || p_index.get_type() == Variant::FLOAT) {
- if (p_value.type != Variant::VECTOR3) {
- return;
- }
-
- int index = p_index;
-
- if (index < 0) {
- index += 4;
- }
- if (index >= 0 && index < 4) {
- Transform *v = _data._transform;
- valid = true;
- if (index == 3) {
- v->origin = p_value;
- } else {
- v->basis.set_axis(index, p_value);
- }
- return;
- }
- } else if (p_index.get_type() == Variant::STRING) {
- Transform *v = _data._transform;
- const String *str = reinterpret_cast<const String *>(p_index._data._mem);
-
- if (*str == "basis") {
- if (p_value.type != Variant::BASIS) {
- return;
- }
- valid = true;
- v->basis = p_value;
- return;
- }
- if (*str == "origin") {
- if (p_value.type != Variant::VECTOR3) {
- return;
- }
- valid = true;
- v->origin = p_value;
- return;
- }
- }
-
- } break;
- case COLOR: {
- if (p_value.type != Variant::INT && p_value.type != Variant::FLOAT) {
- return;
- }
-
- if (p_index.get_type() == Variant::STRING) {
- const String *str = reinterpret_cast<const String *>(p_index._data._mem);
- Color *v = reinterpret_cast<Color *>(_data._mem);
- if (*str == "r") {
- valid = true;
- v->r = p_value;
- return;
- } else if (*str == "g") {
- valid = true;
- v->g = p_value;
- return;
- } else if (*str == "b") {
- valid = true;
- v->b = p_value;
- return;
- } else if (*str == "a") {
- valid = true;
- v->a = p_value;
- return;
- } else if (*str == "h") {
- valid = true;
- v->set_hsv(p_value, v->get_s(), v->get_v(), v->a);
- return;
- } else if (*str == "s") {
- valid = true;
- v->set_hsv(v->get_h(), p_value, v->get_v(), v->a);
- return;
- } else if (*str == "v") {
- valid = true;
- v->set_hsv(v->get_h(), v->get_s(), p_value, v->a);
- return;
- } else if (*str == "r8") {
- valid = true;
- v->r = float(p_value) / 255.0;
- return;
- } else if (*str == "g8") {
- valid = true;
- v->g = float(p_value) / 255.0;
- return;
- } else if (*str == "b8") {
- valid = true;
- v->b = float(p_value) / 255.0;
- return;
- } else if (*str == "a8") {
- valid = true;
- v->a = float(p_value) / 255.0;
- return;
- }
- } else if (p_index.get_type() == Variant::INT) {
- int idx = p_index;
- if (idx < 0) {
- idx += 4;
- }
- if (idx >= 0 && idx < 4) {
- Color *v = reinterpret_cast<Color *>(_data._mem);
- (*v)[idx] = p_value;
- valid = true;
- }
- }
-
- } break;
- case STRING_NAME: {
- } break;
- case NODE_PATH: {
- } break;
- case _RID: {
- } break;
- case OBJECT: {
- Object *obj = _get_obj().obj;
- //only if debugging!
-
- if (obj) {
-#ifdef DEBUG_ENABLED
- if (EngineDebugger::is_active() && !_get_obj().id.is_reference() && ObjectDB::get_instance(_get_obj().id) == nullptr) {
- WARN_PRINT("Attempted use of previously freed pointer object.");
- valid = false;
- return;
- }
-#endif
-
- if (p_index.get_type() != Variant::STRING_NAME && p_index.get_type() != Variant::STRING) {
- obj->setvar(p_index, p_value, r_valid);
- return;
- }
-
- obj->set(p_index, p_value, r_valid);
- return;
- }
- } break;
- case DICTIONARY: {
- Dictionary *dic = reinterpret_cast<Dictionary *>(_data._mem);
- dic->operator[](p_index) = p_value;
- valid = true; //always valid, i guess? should this really be ok?
- return;
- } break;
- DEFAULT_OP_ARRAY_CMD(ARRAY, Array, ;, (*arr)[index] = p_value; return )
- DEFAULT_OP_DVECTOR_SET(PACKED_BYTE_ARRAY, uint8_t, p_value.type != Variant::FLOAT && p_value.type != Variant::INT)
- DEFAULT_OP_DVECTOR_SET(PACKED_INT32_ARRAY, int32_t, p_value.type != Variant::FLOAT && p_value.type != Variant::INT)
- DEFAULT_OP_DVECTOR_SET(PACKED_INT64_ARRAY, int64_t, p_value.type != Variant::FLOAT && p_value.type != Variant::INT)
- DEFAULT_OP_DVECTOR_SET(PACKED_FLOAT32_ARRAY, float, p_value.type != Variant::FLOAT && p_value.type != Variant::INT)
- DEFAULT_OP_DVECTOR_SET(PACKED_FLOAT64_ARRAY, double, p_value.type != Variant::FLOAT && p_value.type != Variant::INT)
- DEFAULT_OP_DVECTOR_SET(PACKED_STRING_ARRAY, String, p_value.type != Variant::STRING)
- DEFAULT_OP_DVECTOR_SET(PACKED_VECTOR2_ARRAY, Vector2, p_value.type != Variant::VECTOR2)
- DEFAULT_OP_DVECTOR_SET(PACKED_VECTOR3_ARRAY, Vector3, p_value.type != Variant::VECTOR3)
- DEFAULT_OP_DVECTOR_SET(PACKED_COLOR_ARRAY, Color, p_value.type != Variant::COLOR)
- default:
- return;
- }
-}
-
-Variant Variant::get(const Variant &p_index, bool *r_valid) const {
- static bool _dummy = false;
-
- bool &valid = r_valid ? *r_valid : _dummy;
-
- valid = false;
-
- switch (type) {
- case NIL: {
- return Variant();
- } break;
- case BOOL: {
- return Variant();
- } break;
- case INT: {
- return Variant();
- } break;
- case FLOAT: {
- return Variant();
- } break;
- case STRING: {
- if (p_index.get_type() == Variant::INT || p_index.get_type() == Variant::FLOAT) {
- //string index
-
- int idx = p_index;
- const String *str = reinterpret_cast<const String *>(_data._mem);
- if (idx < 0) {
- idx += str->length();
- }
- if (idx >= 0 && idx < str->length()) {
- valid = true;
- return str->substr(idx, 1);
- }
- }
-
- } break;
- case VECTOR2: {
- if (p_index.get_type() == Variant::INT || p_index.get_type() == Variant::FLOAT) {
- // scalar index
- int idx = p_index;
- if (idx < 0) {
- idx += 2;
- }
- if (idx >= 0 && idx < 2) {
- const Vector2 *v = reinterpret_cast<const Vector2 *>(_data._mem);
- valid = true;
- return (*v)[idx];
- }
- } else if (p_index.get_type() == Variant::STRING) {
- //scalar name
-
- const String *str = reinterpret_cast<const String *>(p_index._data._mem);
- const Vector2 *v = reinterpret_cast<const Vector2 *>(_data._mem);
- if (*str == "x") {
- valid = true;
- return v->x;
- } else if (*str == "y") {
- valid = true;
- return v->y;
- }
- }
-
- } break;
- case VECTOR2I: {
- if (p_index.get_type() == Variant::INT || p_index.get_type() == Variant::FLOAT) {
- // scalar index
- int idx = p_index;
- if (idx < 0) {
- idx += 2;
- }
- if (idx >= 0 && idx < 2) {
- const Vector2i *v = reinterpret_cast<const Vector2i *>(_data._mem);
- valid = true;
- return (*v)[idx];
- }
- } else if (p_index.get_type() == Variant::STRING) {
- //scalar name
-
- const String *str = reinterpret_cast<const String *>(p_index._data._mem);
- const Vector2i *v = reinterpret_cast<const Vector2i *>(_data._mem);
- if (*str == "x") {
- valid = true;
- return v->x;
- } else if (*str == "y") {
- valid = true;
- return v->y;
- }
- }
-
- } break;
- case RECT2: {
- if (p_index.get_type() == Variant::STRING) {
- //scalar name
-
- const String *str = reinterpret_cast<const String *>(p_index._data._mem);
- const Rect2 *v = reinterpret_cast<const Rect2 *>(_data._mem);
- if (*str == "position") {
- valid = true;
- return v->position;
- } else if (*str == "size") {
- valid = true;
- return v->size;
- } else if (*str == "end") {
- valid = true;
- return v->size + v->position;
- }
- }
- } break;
- case RECT2I: {
- if (p_index.get_type() == Variant::STRING) {
- //scalar name
-
- const String *str = reinterpret_cast<const String *>(p_index._data._mem);
- const Rect2i *v = reinterpret_cast<const Rect2i *>(_data._mem);
- if (*str == "position") {
- valid = true;
- return v->position;
- } else if (*str == "size") {
- valid = true;
- return v->size;
- } else if (*str == "end") {
- valid = true;
- return v->size + v->position;
- }
- }
- } break;
- case VECTOR3: {
- if (p_index.get_type() == Variant::INT || p_index.get_type() == Variant::FLOAT) {
- //scalar index
- int idx = p_index;
- if (idx < 0) {
- idx += 3;
- }
- if (idx >= 0 && idx < 3) {
- const Vector3 *v = reinterpret_cast<const Vector3 *>(_data._mem);
- valid = true;
- return (*v)[idx];
- }
- } else if (p_index.get_type() == Variant::STRING) {
- //scalar name
- const String *str = reinterpret_cast<const String *>(p_index._data._mem);
- const Vector3 *v = reinterpret_cast<const Vector3 *>(_data._mem);
- if (*str == "x") {
- valid = true;
- return v->x;
- } else if (*str == "y") {
- valid = true;
- return v->y;
- } else if (*str == "z") {
- valid = true;
- return v->z;
- }
- }
-
- } break;
- case VECTOR3I: {
- if (p_index.get_type() == Variant::INT || p_index.get_type() == Variant::FLOAT) {
- //scalar index
- int idx = p_index;
- if (idx < 0) {
- idx += 3;
- }
- if (idx >= 0 && idx < 3) {
- const Vector3i *v = reinterpret_cast<const Vector3i *>(_data._mem);
- valid = true;
- return (*v)[idx];
- }
- } else if (p_index.get_type() == Variant::STRING) {
- //scalar name
- const String *str = reinterpret_cast<const String *>(p_index._data._mem);
- const Vector3i *v = reinterpret_cast<const Vector3i *>(_data._mem);
- if (*str == "x") {
- valid = true;
- return v->x;
- } else if (*str == "y") {
- valid = true;
- return v->y;
- } else if (*str == "z") {
- valid = true;
- return v->z;
- }
- }
-
- } break;
- case TRANSFORM2D: {
- if (p_index.get_type() == Variant::INT || p_index.get_type() == Variant::FLOAT) {
- int index = p_index;
-
- if (index < 0) {
- index += 3;
- }
- if (index >= 0 && index < 3) {
- const Transform2D *v = _data._transform2d;
-
- valid = true;
- return v->elements[index];
- }
- } else if (p_index.get_type() == Variant::STRING) {
- //scalar name
- const String *str = reinterpret_cast<const String *>(p_index._data._mem);
- const Transform2D *v = _data._transform2d;
- if (*str == "x") {
- valid = true;
- return v->elements[0];
- } else if (*str == "y") {
- valid = true;
- return v->elements[1];
- } else if (*str == "origin") {
- valid = true;
- return v->elements[2];
- }
- }
-
- } break;
- case PLANE: {
- if (p_index.get_type() == Variant::STRING) {
- //scalar name
- const String *str = reinterpret_cast<const String *>(p_index._data._mem);
- const Plane *v = reinterpret_cast<const Plane *>(_data._mem);
- if (*str == "x") {
- valid = true;
- return v->normal.x;
- } else if (*str == "y") {
- valid = true;
- return v->normal.y;
- } else if (*str == "z") {
- valid = true;
- return v->normal.z;
- } else if (*str == "normal") {
- valid = true;
- return v->normal;
- } else if (*str == "d") {
- valid = true;
- return v->d;
- }
- }
-
- } break;
- case QUAT: {
- if (p_index.get_type() == Variant::STRING) {
- const String *str = reinterpret_cast<const String *>(p_index._data._mem);
- const Quat *v = reinterpret_cast<const Quat *>(_data._mem);
- if (*str == "x") {
- valid = true;
- return v->x;
- } else if (*str == "y") {
- valid = true;
- return v->y;
- } else if (*str == "z") {
- valid = true;
- return v->z;
- } else if (*str == "w") {
- valid = true;
- return v->w;
- }
- }
-
- } break;
- case AABB: {
- if (p_index.get_type() == Variant::STRING) {
- //scalar name
-
- const String *str = reinterpret_cast<const String *>(p_index._data._mem);
- const ::AABB *v = _data._aabb;
- if (*str == "position") {
- valid = true;
- return v->position;
- } else if (*str == "size") {
- valid = true;
- return v->size;
- } else if (*str == "end") {
- valid = true;
- return v->size + v->position;
- }
- }
- } break;
- case BASIS: {
- if (p_index.get_type() == Variant::INT || p_index.get_type() == Variant::FLOAT) {
- int index = p_index;
- if (index < 0) {
- index += 3;
- }
- if (index >= 0 && index < 3) {
- const Basis *v = _data._basis;
-
- valid = true;
- return v->get_axis(index);
- }
- } else if (p_index.get_type() == Variant::STRING) {
- const String *str = reinterpret_cast<const String *>(p_index._data._mem);
- const Basis *v = _data._basis;
-
- if (*str == "x") {
- valid = true;
- return v->get_axis(0);
- } else if (*str == "y") {
- valid = true;
- return v->get_axis(1);
- } else if (*str == "z") {
- valid = true;
- return v->get_axis(2);
- }
- }
-
- } break;
- case TRANSFORM: {
- if (p_index.get_type() == Variant::INT || p_index.get_type() == Variant::FLOAT) {
- int index = p_index;
- if (index < 0) {
- index += 4;
- }
- if (index >= 0 && index < 4) {
- const Transform *v = _data._transform;
- valid = true;
- return index == 3 ? v->origin : v->basis.get_axis(index);
- }
- } else if (p_index.get_type() == Variant::STRING) {
- const Transform *v = _data._transform;
- const String *str = reinterpret_cast<const String *>(p_index._data._mem);
-
- if (*str == "basis") {
- valid = true;
- return v->basis;
- }
- if (*str == "origin") {
- valid = true;
- return v->origin;
- }
- }
-
- } break;
- case COLOR: {
- if (p_index.get_type() == Variant::STRING) {
- const String *str = reinterpret_cast<const String *>(p_index._data._mem);
- const Color *v = reinterpret_cast<const Color *>(_data._mem);
- if (*str == "r") {
- valid = true;
- return v->r;
- } else if (*str == "g") {
- valid = true;
- return v->g;
- } else if (*str == "b") {
- valid = true;
- return v->b;
- } else if (*str == "a") {
- valid = true;
- return v->a;
- } else if (*str == "h") {
- valid = true;
- return v->get_h();
- } else if (*str == "s") {
- valid = true;
- return v->get_s();
- } else if (*str == "v") {
- valid = true;
- return v->get_v();
- } else if (*str == "r8") {
- valid = true;
- return (int)Math::round(v->r * 255.0);
- } else if (*str == "g8") {
- valid = true;
- return (int)Math::round(v->g * 255.0);
- } else if (*str == "b8") {
- valid = true;
- return (int)Math::round(v->b * 255.0);
- } else if (*str == "a8") {
- valid = true;
- return (int)Math::round(v->a * 255.0);
- }
- } else if (p_index.get_type() == Variant::INT) {
- int idx = p_index;
- if (idx < 0) {
- idx += 4;
- }
- if (idx >= 0 && idx < 4) {
- const Color *v = reinterpret_cast<const Color *>(_data._mem);
- valid = true;
- return (*v)[idx];
- }
- }
-
- } break;
- case STRING_NAME: {
- } break;
- case NODE_PATH: {
- } break;
- case _RID: {
- } break;
- case OBJECT: {
- Object *obj = _get_obj().obj;
- if (obj) {
-#ifdef DEBUG_ENABLED
-
- if (EngineDebugger::is_active() && !_get_obj().id.is_reference() && ObjectDB::get_instance(_get_obj().id) == nullptr) {
- valid = false;
- return "Attempted get on previously freed instance.";
- }
-#endif
-
- if (p_index.get_type() != Variant::STRING) {
- return obj->getvar(p_index, r_valid);
- }
-
- return obj->get(p_index, r_valid);
- }
-
- } break;
- case DICTIONARY: {
- const Dictionary *dic = reinterpret_cast<const Dictionary *>(_data._mem);
- const Variant *res = dic->getptr(p_index);
- if (res) {
- valid = true;
- return *res;
- }
- } break;
- DEFAULT_OP_ARRAY_CMD(ARRAY, const Array, ;, return (*arr)[index])
- DEFAULT_OP_DVECTOR_GET(PACKED_BYTE_ARRAY, uint8_t)
- DEFAULT_OP_DVECTOR_GET(PACKED_INT32_ARRAY, int32_t)
- DEFAULT_OP_DVECTOR_GET(PACKED_INT64_ARRAY, int64_t)
- DEFAULT_OP_DVECTOR_GET(PACKED_FLOAT32_ARRAY, float)
- DEFAULT_OP_DVECTOR_GET(PACKED_FLOAT64_ARRAY, double)
- DEFAULT_OP_DVECTOR_GET(PACKED_STRING_ARRAY, String)
- DEFAULT_OP_DVECTOR_GET(PACKED_VECTOR2_ARRAY, Vector2)
- DEFAULT_OP_DVECTOR_GET(PACKED_VECTOR3_ARRAY, Vector3)
- DEFAULT_OP_DVECTOR_GET(PACKED_COLOR_ARRAY, Color)
- default:
- return Variant();
- }
-
- return Variant();
-}
-
-bool Variant::in(const Variant &p_index, bool *r_valid) const {
- if (r_valid) {
- *r_valid = true;
- }
-
- switch (type) {
- case STRING: {
- if (p_index.get_type() == Variant::STRING) {
- //string index
- String idx = p_index;
- const String *str = reinterpret_cast<const String *>(_data._mem);
-
- return str->find(idx) != -1;
- }
-
- } break;
- case OBJECT: {
- Object *obj = _get_obj().obj;
- if (obj) {
- bool valid = false;
-#ifdef DEBUG_ENABLED
-
- if (EngineDebugger::is_active() && !_get_obj().id.is_reference() && ObjectDB::get_instance(_get_obj().id) == nullptr) {
- if (r_valid) {
- *r_valid = false;
- }
- return true; // Attempted get on stray pointer.
- }
-
-#endif
-
- if (p_index.get_type() != Variant::STRING) {
- obj->getvar(p_index, &valid);
- } else {
- obj->get(p_index, &valid);
- }
-
- return valid;
- } else {
- if (r_valid) {
- *r_valid = false;
- }
- }
- return false;
- } break;
- case DICTIONARY: {
- const Dictionary *dic = reinterpret_cast<const Dictionary *>(_data._mem);
- return dic->has(p_index);
-
- } break;
- case ARRAY: {
- const Array *arr = reinterpret_cast<const Array *>(_data._mem);
- int l = arr->size();
- if (l) {
- for (int i = 0; i < l; i++) {
- if (evaluate(OP_EQUAL, (*arr)[i], p_index)) {
- return true;
- }
- }
- }
-
- return false;
-
- } break;
- case PACKED_BYTE_ARRAY: {
- if (p_index.get_type() == Variant::INT || p_index.get_type() == Variant::FLOAT) {
- int index = p_index;
- const Vector<uint8_t> *arr = &PackedArrayRef<uint8_t>::get_array(_data.packed_array);
- int l = arr->size();
- if (l) {
- const uint8_t *r = arr->ptr();
- for (int i = 0; i < l; i++) {
- if (r[i] == index) {
- return true;
- }
- }
- }
-
- return false;
- }
-
- } break;
- case PACKED_INT32_ARRAY: {
- if (p_index.get_type() == Variant::INT || p_index.get_type() == Variant::FLOAT) {
- int32_t index = p_index;
- const Vector<int32_t> *arr = &PackedArrayRef<int32_t>::get_array(_data.packed_array);
- int32_t l = arr->size();
- if (l) {
- const int32_t *r = arr->ptr();
- for (int32_t i = 0; i < l; i++) {
- if (r[i] == index) {
- return true;
- }
- }
- }
-
- return false;
- }
- } break;
- case PACKED_INT64_ARRAY: {
- if (p_index.get_type() == Variant::INT || p_index.get_type() == Variant::FLOAT) {
- int64_t index = p_index;
- const Vector<int64_t> *arr = &PackedArrayRef<int64_t>::get_array(_data.packed_array);
- int64_t l = arr->size();
- if (l) {
- const int64_t *r = arr->ptr();
- for (int64_t i = 0; i < l; i++) {
- if (r[i] == index) {
- return true;
- }
- }
- }
-
- return false;
- }
- } break;
- case PACKED_FLOAT32_ARRAY: {
- if (p_index.get_type() == Variant::INT || p_index.get_type() == Variant::FLOAT) {
- real_t index = p_index;
- const Vector<float> *arr = &PackedArrayRef<float>::get_array(_data.packed_array);
- int l = arr->size();
- if (l) {
- const float *r = arr->ptr();
- for (int i = 0; i < l; i++) {
- if (r[i] == index) {
- return true;
- }
- }
- }
-
- return false;
- }
-
- } break;
- case PACKED_FLOAT64_ARRAY: {
- if (p_index.get_type() == Variant::INT || p_index.get_type() == Variant::FLOAT) {
- real_t index = p_index;
- const Vector<double> *arr = &PackedArrayRef<double>::get_array(_data.packed_array);
- int l = arr->size();
- if (l) {
- const double *r = arr->ptr();
- for (int i = 0; i < l; i++) {
- if (r[i] == index) {
- return true;
- }
- }
- }
-
- return false;
- }
-
- } break;
- case PACKED_STRING_ARRAY: {
- if (p_index.get_type() == Variant::STRING) {
- String index = p_index;
- const Vector<String> *arr = &PackedArrayRef<String>::get_array(_data.packed_array);
-
- int l = arr->size();
- if (l) {
- const String *r = arr->ptr();
- for (int i = 0; i < l; i++) {
- if (r[i] == index) {
- return true;
- }
- }
- }
-
- return false;
- }
-
- } break; //25
- case PACKED_VECTOR2_ARRAY: {
- if (p_index.get_type() == Variant::VECTOR2) {
- Vector2 index = p_index;
- const Vector<Vector2> *arr = &PackedArrayRef<Vector2>::get_array(_data.packed_array);
-
- int l = arr->size();
- if (l) {
- const Vector2 *r = arr->ptr();
- for (int i = 0; i < l; i++) {
- if (r[i] == index) {
- return true;
- }
- }
- }
-
- return false;
- }
-
- } break;
- case PACKED_VECTOR3_ARRAY: {
- if (p_index.get_type() == Variant::VECTOR3) {
- Vector3 index = p_index;
- const Vector<Vector3> *arr = &PackedArrayRef<Vector3>::get_array(_data.packed_array);
-
- int l = arr->size();
- if (l) {
- const Vector3 *r = arr->ptr();
- for (int i = 0; i < l; i++) {
- if (r[i] == index) {
- return true;
- }
- }
- }
-
- return false;
- }
-
- } break;
- case PACKED_COLOR_ARRAY: {
- if (p_index.get_type() == Variant::COLOR) {
- Color index = p_index;
- const Vector<Color> *arr = &PackedArrayRef<Color>::get_array(_data.packed_array);
-
- int l = arr->size();
- if (l) {
- const Color *r = arr->ptr();
- for (int i = 0; i < l; i++) {
- if (r[i] == index) {
- return true;
- }
- }
- }
-
- return false;
- }
- } break;
- default: {
- }
- }
-
- if (r_valid) {
- *r_valid = false;
- }
- return false;
-}
-
-void Variant::get_property_list(List<PropertyInfo> *p_list) const {
- switch (type) {
- case VECTOR2: {
- p_list->push_back(PropertyInfo(Variant::FLOAT, "x"));
- p_list->push_back(PropertyInfo(Variant::FLOAT, "y"));
-
- } break;
- case VECTOR2I: {
- p_list->push_back(PropertyInfo(Variant::INT, "x"));
- p_list->push_back(PropertyInfo(Variant::INT, "y"));
-
- } break;
- case RECT2: {
- p_list->push_back(PropertyInfo(Variant::VECTOR2, "position"));
- p_list->push_back(PropertyInfo(Variant::VECTOR2, "size"));
- p_list->push_back(PropertyInfo(Variant::VECTOR2, "end"));
-
- } break;
- case RECT2I: {
- p_list->push_back(PropertyInfo(Variant::VECTOR2I, "position"));
- p_list->push_back(PropertyInfo(Variant::VECTOR2I, "size"));
- p_list->push_back(PropertyInfo(Variant::VECTOR2I, "end"));
-
- } break;
- case VECTOR3: {
- p_list->push_back(PropertyInfo(Variant::FLOAT, "x"));
- p_list->push_back(PropertyInfo(Variant::FLOAT, "y"));
- p_list->push_back(PropertyInfo(Variant::FLOAT, "z"));
-
- } break;
- case VECTOR3I: {
- p_list->push_back(PropertyInfo(Variant::INT, "x"));
- p_list->push_back(PropertyInfo(Variant::INT, "y"));
- p_list->push_back(PropertyInfo(Variant::INT, "z"));
-
- } break;
- case TRANSFORM2D: {
- p_list->push_back(PropertyInfo(Variant::VECTOR2, "x"));
- p_list->push_back(PropertyInfo(Variant::VECTOR2, "y"));
- p_list->push_back(PropertyInfo(Variant::VECTOR2, "origin"));
-
- } break;
- case PLANE: {
- p_list->push_back(PropertyInfo(Variant::VECTOR3, "normal"));
- p_list->push_back(PropertyInfo(Variant::FLOAT, "x"));
- p_list->push_back(PropertyInfo(Variant::FLOAT, "y"));
- p_list->push_back(PropertyInfo(Variant::FLOAT, "z"));
- p_list->push_back(PropertyInfo(Variant::FLOAT, "d"));
-
- } break;
- case QUAT: {
- p_list->push_back(PropertyInfo(Variant::FLOAT, "x"));
- p_list->push_back(PropertyInfo(Variant::FLOAT, "y"));
- p_list->push_back(PropertyInfo(Variant::FLOAT, "z"));
- p_list->push_back(PropertyInfo(Variant::FLOAT, "w"));
-
- } break;
- case AABB: {
- p_list->push_back(PropertyInfo(Variant::VECTOR3, "position"));
- p_list->push_back(PropertyInfo(Variant::VECTOR3, "size"));
- p_list->push_back(PropertyInfo(Variant::VECTOR3, "end"));
- } break;
- case BASIS: {
- p_list->push_back(PropertyInfo(Variant::VECTOR3, "x"));
- p_list->push_back(PropertyInfo(Variant::VECTOR3, "y"));
- p_list->push_back(PropertyInfo(Variant::VECTOR3, "z"));
-
- } break;
- case TRANSFORM: {
- p_list->push_back(PropertyInfo(Variant::BASIS, "basis"));
- p_list->push_back(PropertyInfo(Variant::VECTOR3, "origin"));
-
- } break;
- case COLOR: {
- p_list->push_back(PropertyInfo(Variant::FLOAT, "r"));
- p_list->push_back(PropertyInfo(Variant::FLOAT, "g"));
- p_list->push_back(PropertyInfo(Variant::FLOAT, "b"));
- p_list->push_back(PropertyInfo(Variant::FLOAT, "a"));
- p_list->push_back(PropertyInfo(Variant::FLOAT, "h"));
- p_list->push_back(PropertyInfo(Variant::FLOAT, "s"));
- p_list->push_back(PropertyInfo(Variant::FLOAT, "v"));
- p_list->push_back(PropertyInfo(Variant::INT, "r8"));
- p_list->push_back(PropertyInfo(Variant::INT, "g8"));
- p_list->push_back(PropertyInfo(Variant::INT, "b8"));
- p_list->push_back(PropertyInfo(Variant::INT, "a8"));
-
- } break;
- case STRING_NAME: {
- } break;
- case NODE_PATH: {
- } break;
- case _RID: {
- } break;
- case OBJECT: {
- Object *obj = _get_obj().obj;
- if (obj) {
-#ifdef DEBUG_ENABLED
-
- if (EngineDebugger::is_active() && !_get_obj().id.is_reference() && ObjectDB::get_instance(_get_obj().id) == nullptr) {
- WARN_PRINT("Attempted get_property list on previously freed instance.");
- return;
- }
-
-#endif
-
- obj->get_property_list(p_list);
- }
-
- } break;
- case DICTIONARY: {
- const Dictionary *dic = reinterpret_cast<const Dictionary *>(_data._mem);
- List<Variant> keys;
- dic->get_key_list(&keys);
- for (List<Variant>::Element *E = keys.front(); E; E = E->next()) {
- if (E->get().get_type() == Variant::STRING) {
- p_list->push_back(PropertyInfo(Variant::STRING, E->get()));
- }
- }
- } break;
- case ARRAY:
- case PACKED_BYTE_ARRAY:
- case PACKED_INT32_ARRAY:
- case PACKED_INT64_ARRAY:
- case PACKED_FLOAT32_ARRAY:
- case PACKED_FLOAT64_ARRAY:
- case PACKED_STRING_ARRAY:
- case PACKED_VECTOR2_ARRAY:
- case PACKED_VECTOR3_ARRAY:
- case PACKED_COLOR_ARRAY: {
- //nothing
- } break;
- default: {
- }
- }
-}
-
-bool Variant::iter_init(Variant &r_iter, bool &valid) const {
- valid = true;
- switch (type) {
- case INT: {
- r_iter = 0;
- return _data._int > 0;
- } break;
- case FLOAT: {
- r_iter = 0;
- return _data._float > 0.0;
- } break;
- case VECTOR2: {
- double from = reinterpret_cast<const Vector2 *>(_data._mem)->x;
- double to = reinterpret_cast<const Vector2 *>(_data._mem)->y;
-
- r_iter = from;
-
- return from < to;
- } break;
- case VECTOR2I: {
- int64_t from = reinterpret_cast<const Vector2i *>(_data._mem)->x;
- int64_t to = reinterpret_cast<const Vector2i *>(_data._mem)->y;
-
- r_iter = from;
-
- return from < to;
- } break;
- case VECTOR3: {
- double from = reinterpret_cast<const Vector3 *>(_data._mem)->x;
- double to = reinterpret_cast<const Vector3 *>(_data._mem)->y;
- double step = reinterpret_cast<const Vector3 *>(_data._mem)->z;
-
- r_iter = from;
-
- if (from == to) {
- return false;
- } else if (from < to) {
- return step > 0;
- }
- return step < 0;
- } break;
- case VECTOR3I: {
- int64_t from = reinterpret_cast<const Vector3i *>(_data._mem)->x;
- int64_t to = reinterpret_cast<const Vector3i *>(_data._mem)->y;
- int64_t step = reinterpret_cast<const Vector3i *>(_data._mem)->z;
-
- r_iter = from;
-
- if (from == to) {
- return false;
- } else if (from < to) {
- return step > 0;
- }
- return step < 0;
- } break;
- case OBJECT: {
- if (!_get_obj().obj) {
- valid = false;
- return false;
- }
-
-#ifdef DEBUG_ENABLED
-
- if (EngineDebugger::is_active() && !_get_obj().id.is_reference() && ObjectDB::get_instance(_get_obj().id) == nullptr) {
- valid = false;
- return false;
- }
-
-#endif
- Callable::CallError ce;
- ce.error = Callable::CallError::CALL_OK;
- Array ref;
- ref.push_back(r_iter);
- Variant vref = ref;
- const Variant *refp[] = { &vref };
- Variant ret = _get_obj().obj->call(CoreStringNames::get_singleton()->_iter_init, refp, 1, ce);
-
- if (ref.size() != 1 || ce.error != Callable::CallError::CALL_OK) {
- valid = false;
- return false;
- }
-
- r_iter = ref[0];
- return ret;
- } break;
-
- case STRING: {
- const String *str = reinterpret_cast<const String *>(_data._mem);
- if (str->empty()) {
- return false;
- }
- r_iter = 0;
- return true;
- } break;
- case DICTIONARY: {
- const Dictionary *dic = reinterpret_cast<const Dictionary *>(_data._mem);
- if (dic->empty()) {
- return false;
- }
-
- const Variant *next = dic->next(nullptr);
- r_iter = *next;
- return true;
-
- } break;
- case ARRAY: {
- const Array *arr = reinterpret_cast<const Array *>(_data._mem);
- if (arr->empty()) {
- return false;
- }
- r_iter = 0;
- return true;
- } break;
- case PACKED_BYTE_ARRAY: {
- const Vector<uint8_t> *arr = &PackedArrayRef<uint8_t>::get_array(_data.packed_array);
- if (arr->size() == 0) {
- return false;
- }
- r_iter = 0;
- return true;
-
- } break;
- case PACKED_INT32_ARRAY: {
- const Vector<int32_t> *arr = &PackedArrayRef<int32_t>::get_array(_data.packed_array);
- if (arr->size() == 0) {
- return false;
- }
- r_iter = 0;
- return true;
-
- } break;
- case PACKED_INT64_ARRAY: {
- const Vector<int64_t> *arr = &PackedArrayRef<int64_t>::get_array(_data.packed_array);
- if (arr->size() == 0) {
- return false;
- }
- r_iter = 0;
- return true;
-
- } break;
- case PACKED_FLOAT32_ARRAY: {
- const Vector<float> *arr = &PackedArrayRef<float>::get_array(_data.packed_array);
- if (arr->size() == 0) {
- return false;
- }
- r_iter = 0;
- return true;
-
- } break;
- case PACKED_FLOAT64_ARRAY: {
- const Vector<double> *arr = &PackedArrayRef<double>::get_array(_data.packed_array);
- if (arr->size() == 0) {
- return false;
- }
- r_iter = 0;
- return true;
-
- } break;
- case PACKED_STRING_ARRAY: {
- const Vector<String> *arr = &PackedArrayRef<String>::get_array(_data.packed_array);
- if (arr->size() == 0) {
- return false;
- }
- r_iter = 0;
- return true;
- } break;
- case PACKED_VECTOR2_ARRAY: {
- const Vector<Vector2> *arr = &PackedArrayRef<Vector2>::get_array(_data.packed_array);
- if (arr->size() == 0) {
- return false;
- }
- r_iter = 0;
- return true;
- } break;
- case PACKED_VECTOR3_ARRAY: {
- const Vector<Vector3> *arr = &PackedArrayRef<Vector3>::get_array(_data.packed_array);
- if (arr->size() == 0) {
- return false;
- }
- r_iter = 0;
- return true;
- } break;
- case PACKED_COLOR_ARRAY: {
- const Vector<Color> *arr = &PackedArrayRef<Color>::get_array(_data.packed_array);
- if (arr->size() == 0) {
- return false;
- }
- r_iter = 0;
- return true;
-
- } break;
- default: {
- }
- }
-
- valid = false;
- return false;
-}
-
-bool Variant::iter_next(Variant &r_iter, bool &valid) const {
- valid = true;
- switch (type) {
- case INT: {
- int64_t idx = r_iter;
- idx++;
- if (idx >= _data._int) {
- return false;
- }
- r_iter = idx;
- return true;
- } break;
- case FLOAT: {
- int64_t idx = r_iter;
- idx++;
- if (idx >= _data._float) {
- return false;
- }
- r_iter = idx;
- return true;
- } break;
- case VECTOR2: {
- double to = reinterpret_cast<const Vector2 *>(_data._mem)->y;
-
- double idx = r_iter;
- idx++;
-
- if (idx >= to) {
- return false;
- }
-
- r_iter = idx;
- return true;
- } break;
- case VECTOR2I: {
- int64_t to = reinterpret_cast<const Vector2i *>(_data._mem)->y;
-
- int64_t idx = r_iter;
- idx++;
-
- if (idx >= to) {
- return false;
- }
-
- r_iter = idx;
- return true;
- } break;
- case VECTOR3: {
- double to = reinterpret_cast<const Vector3 *>(_data._mem)->y;
- double step = reinterpret_cast<const Vector3 *>(_data._mem)->z;
-
- double idx = r_iter;
- idx += step;
-
- if (step < 0 && idx <= to) {
- return false;
- }
-
- if (step > 0 && idx >= to) {
- return false;
- }
-
- r_iter = idx;
- return true;
- } break;
- case VECTOR3I: {
- int64_t to = reinterpret_cast<const Vector3i *>(_data._mem)->y;
- int64_t step = reinterpret_cast<const Vector3i *>(_data._mem)->z;
-
- int64_t idx = r_iter;
- idx += step;
-
- if (step < 0 && idx <= to) {
- return false;
- }
-
- if (step > 0 && idx >= to) {
- return false;
- }
-
- r_iter = idx;
- return true;
- } break;
- case OBJECT: {
- if (!_get_obj().obj) {
- valid = false;
- return false;
- }
-
-#ifdef DEBUG_ENABLED
-
- if (EngineDebugger::is_active() && !_get_obj().id.is_reference() && ObjectDB::get_instance(_get_obj().id) == nullptr) {
- valid = false;
- return false;
- }
-
-#endif
- Callable::CallError ce;
- ce.error = Callable::CallError::CALL_OK;
- Array ref;
- ref.push_back(r_iter);
- Variant vref = ref;
- const Variant *refp[] = { &vref };
- Variant ret = _get_obj().obj->call(CoreStringNames::get_singleton()->_iter_next, refp, 1, ce);
-
- if (ref.size() != 1 || ce.error != Callable::CallError::CALL_OK) {
- valid = false;
- return false;
- }
-
- r_iter = ref[0];
-
- return ret;
- } break;
-
- case STRING: {
- const String *str = reinterpret_cast<const String *>(_data._mem);
- int idx = r_iter;
- idx++;
- if (idx >= str->length()) {
- return false;
- }
- r_iter = idx;
- return true;
- } break;
- case DICTIONARY: {
- const Dictionary *dic = reinterpret_cast<const Dictionary *>(_data._mem);
- const Variant *next = dic->next(&r_iter);
- if (!next) {
- return false;
- }
-
- r_iter = *next;
- return true;
-
- } break;
- case ARRAY: {
- const Array *arr = reinterpret_cast<const Array *>(_data._mem);
- int idx = r_iter;
- idx++;
- if (idx >= arr->size()) {
- return false;
- }
- r_iter = idx;
- return true;
- } break;
- case PACKED_BYTE_ARRAY: {
- const Vector<uint8_t> *arr = &PackedArrayRef<uint8_t>::get_array(_data.packed_array);
- int idx = r_iter;
- idx++;
- if (idx >= arr->size()) {
- return false;
- }
- r_iter = idx;
- return true;
-
- } break;
- case PACKED_INT32_ARRAY: {
- const Vector<int32_t> *arr = &PackedArrayRef<int32_t>::get_array(_data.packed_array);
- int32_t idx = r_iter;
- idx++;
- if (idx >= arr->size()) {
- return false;
- }
- r_iter = idx;
- return true;
-
- } break;
- case PACKED_INT64_ARRAY: {
- const Vector<int64_t> *arr = &PackedArrayRef<int64_t>::get_array(_data.packed_array);
- int64_t idx = r_iter;
- idx++;
- if (idx >= arr->size()) {
- return false;
- }
- r_iter = idx;
- return true;
-
- } break;
- case PACKED_FLOAT32_ARRAY: {
- const Vector<float> *arr = &PackedArrayRef<float>::get_array(_data.packed_array);
- int idx = r_iter;
- idx++;
- if (idx >= arr->size()) {
- return false;
- }
- r_iter = idx;
- return true;
-
- } break;
- case PACKED_FLOAT64_ARRAY: {
- const Vector<double> *arr = &PackedArrayRef<double>::get_array(_data.packed_array);
- int idx = r_iter;
- idx++;
- if (idx >= arr->size()) {
- return false;
- }
- r_iter = idx;
- return true;
-
- } break;
- case PACKED_STRING_ARRAY: {
- const Vector<String> *arr = &PackedArrayRef<String>::get_array(_data.packed_array);
- int idx = r_iter;
- idx++;
- if (idx >= arr->size()) {
- return false;
- }
- r_iter = idx;
- return true;
- } break;
- case PACKED_VECTOR2_ARRAY: {
- const Vector<Vector2> *arr = &PackedArrayRef<Vector2>::get_array(_data.packed_array);
- int idx = r_iter;
- idx++;
- if (idx >= arr->size()) {
- return false;
- }
- r_iter = idx;
- return true;
- } break;
- case PACKED_VECTOR3_ARRAY: {
- const Vector<Vector3> *arr = &PackedArrayRef<Vector3>::get_array(_data.packed_array);
- int idx = r_iter;
- idx++;
- if (idx >= arr->size()) {
- return false;
- }
- r_iter = idx;
- return true;
- } break;
- case PACKED_COLOR_ARRAY: {
- const Vector<Color> *arr = &PackedArrayRef<Color>::get_array(_data.packed_array);
- int idx = r_iter;
- idx++;
- if (idx >= arr->size()) {
- return false;
- }
- r_iter = idx;
- return true;
- } break;
- default: {
- }
- }
-
- valid = false;
- return false;
-}
-
-Variant Variant::iter_get(const Variant &r_iter, bool &r_valid) const {
- r_valid = true;
- switch (type) {
- case INT: {
- return r_iter;
- } break;
- case FLOAT: {
- return r_iter;
- } break;
- case VECTOR2: {
- return r_iter;
- } break;
- case VECTOR2I: {
- return r_iter;
- } break;
- case VECTOR3: {
- return r_iter;
- } break;
- case VECTOR3I: {
- return r_iter;
- } break;
- case OBJECT: {
- if (!_get_obj().obj) {
- r_valid = false;
- return Variant();
- }
-#ifdef DEBUG_ENABLED
- if (EngineDebugger::is_active() && !_get_obj().id.is_reference() && ObjectDB::get_instance(_get_obj().id) == nullptr) {
- r_valid = false;
- return Variant();
- }
-
-#endif
- Callable::CallError ce;
- ce.error = Callable::CallError::CALL_OK;
- const Variant *refp[] = { &r_iter };
- Variant ret = _get_obj().obj->call(CoreStringNames::get_singleton()->_iter_get, refp, 1, ce);
-
- if (ce.error != Callable::CallError::CALL_OK) {
- r_valid = false;
- return Variant();
- }
-
- //r_iter=ref[0];
-
- return ret;
- } break;
-
- case STRING: {
- const String *str = reinterpret_cast<const String *>(_data._mem);
- return str->substr(r_iter, 1);
- } break;
- case DICTIONARY: {
- return r_iter; //iterator is the same as the key
-
- } break;
- case ARRAY: {
- const Array *arr = reinterpret_cast<const Array *>(_data._mem);
- int idx = r_iter;
-#ifdef DEBUG_ENABLED
- if (idx < 0 || idx >= arr->size()) {
- r_valid = false;
- return Variant();
- }
-#endif
- return arr->get(idx);
- } break;
- case PACKED_BYTE_ARRAY: {
- const Vector<uint8_t> *arr = &PackedArrayRef<uint8_t>::get_array(_data.packed_array);
- int idx = r_iter;
-#ifdef DEBUG_ENABLED
- if (idx < 0 || idx >= arr->size()) {
- r_valid = false;
- return Variant();
- }
-#endif
- return arr->get(idx);
- } break;
- case PACKED_INT32_ARRAY: {
- const Vector<int32_t> *arr = &PackedArrayRef<int32_t>::get_array(_data.packed_array);
- int32_t idx = r_iter;
-#ifdef DEBUG_ENABLED
- if (idx < 0 || idx >= arr->size()) {
- r_valid = false;
- return Variant();
- }
-#endif
- return arr->get(idx);
- } break;
- case PACKED_INT64_ARRAY: {
- const Vector<int64_t> *arr = &PackedArrayRef<int64_t>::get_array(_data.packed_array);
- int64_t idx = r_iter;
-#ifdef DEBUG_ENABLED
- if (idx < 0 || idx >= arr->size()) {
- r_valid = false;
- return Variant();
- }
-#endif
- return arr->get(idx);
- } break;
- case PACKED_FLOAT32_ARRAY: {
- const Vector<float> *arr = &PackedArrayRef<float>::get_array(_data.packed_array);
- int idx = r_iter;
-#ifdef DEBUG_ENABLED
- if (idx < 0 || idx >= arr->size()) {
- r_valid = false;
- return Variant();
- }
-#endif
- return arr->get(idx);
- } break;
- case PACKED_FLOAT64_ARRAY: {
- const Vector<double> *arr = &PackedArrayRef<double>::get_array(_data.packed_array);
- int idx = r_iter;
-#ifdef DEBUG_ENABLED
- if (idx < 0 || idx >= arr->size()) {
- r_valid = false;
- return Variant();
- }
-#endif
- return arr->get(idx);
- } break;
- case PACKED_STRING_ARRAY: {
- const Vector<String> *arr = &PackedArrayRef<String>::get_array(_data.packed_array);
- int idx = r_iter;
-#ifdef DEBUG_ENABLED
- if (idx < 0 || idx >= arr->size()) {
- r_valid = false;
- return Variant();
- }
-#endif
- return arr->get(idx);
- } break;
- case PACKED_VECTOR2_ARRAY: {
- const Vector<Vector2> *arr = &PackedArrayRef<Vector2>::get_array(_data.packed_array);
- int idx = r_iter;
-#ifdef DEBUG_ENABLED
- if (idx < 0 || idx >= arr->size()) {
- r_valid = false;
- return Variant();
- }
-#endif
- return arr->get(idx);
- } break;
- case PACKED_VECTOR3_ARRAY: {
- const Vector<Vector3> *arr = &PackedArrayRef<Vector3>::get_array(_data.packed_array);
- int idx = r_iter;
-#ifdef DEBUG_ENABLED
- if (idx < 0 || idx >= arr->size()) {
- r_valid = false;
- return Variant();
- }
-#endif
- return arr->get(idx);
- } break;
- case PACKED_COLOR_ARRAY: {
- const Vector<Color> *arr = &PackedArrayRef<Color>::get_array(_data.packed_array);
- int idx = r_iter;
-#ifdef DEBUG_ENABLED
- if (idx < 0 || idx >= arr->size()) {
- r_valid = false;
- return Variant();
- }
-#endif
- return arr->get(idx);
- } break;
- default: {
- }
- }
-
- r_valid = false;
- return Variant();
-}
-
-Variant Variant::duplicate(bool deep) const {
- switch (type) {
- case OBJECT: {
- /* breaks stuff :(
- if (deep && !_get_obj().ref.is_null()) {
- Ref<Resource> resource = _get_obj().ref;
- if (resource.is_valid()) {
- return resource->duplicate(true);
- }
- }
- */
- return *this;
- } break;
- case DICTIONARY:
- return operator Dictionary().duplicate(deep);
- case ARRAY:
- return operator Array().duplicate(deep);
- default:
- return *this;
- }
-}
-
-void Variant::blend(const Variant &a, const Variant &b, float c, Variant &r_dst) {
- if (a.type != b.type) {
- if (a.is_num() && b.is_num()) {
- real_t va = a;
- real_t vb = b;
- r_dst = va + vb * c;
- } else {
- r_dst = a;
- }
- return;
- }
-
- switch (a.type) {
- case NIL: {
- r_dst = Variant();
- }
- return;
- case INT: {
- int64_t va = a._data._int;
- int64_t vb = b._data._int;
- r_dst = int(va + vb * c + 0.5);
- }
- return;
- case FLOAT: {
- double ra = a._data._float;
- double rb = b._data._float;
- r_dst = ra + rb * c;
- }
- return;
- case VECTOR2: {
- r_dst = *reinterpret_cast<const Vector2 *>(a._data._mem) + *reinterpret_cast<const Vector2 *>(b._data._mem) * c;
- }
- return;
- case VECTOR2I: {
- int32_t vax = reinterpret_cast<const Vector2i *>(a._data._mem)->x;
- int32_t vbx = reinterpret_cast<const Vector2i *>(b._data._mem)->x;
- int32_t vay = reinterpret_cast<const Vector2i *>(a._data._mem)->y;
- int32_t vby = reinterpret_cast<const Vector2i *>(b._data._mem)->y;
- r_dst = Vector2i(int32_t(vax + vbx * c + 0.5), int32_t(vay + vby * c + 0.5));
- }
- return;
- case RECT2: {
- const Rect2 *ra = reinterpret_cast<const Rect2 *>(a._data._mem);
- const Rect2 *rb = reinterpret_cast<const Rect2 *>(b._data._mem);
- r_dst = Rect2(ra->position + rb->position * c, ra->size + rb->size * c);
- }
- return;
- case RECT2I: {
- const Rect2i *ra = reinterpret_cast<const Rect2i *>(a._data._mem);
- const Rect2i *rb = reinterpret_cast<const Rect2i *>(b._data._mem);
-
- int32_t vax = ra->position.x;
- int32_t vay = ra->position.y;
- int32_t vbx = ra->size.x;
- int32_t vby = ra->size.y;
- int32_t vcx = rb->position.x;
- int32_t vcy = rb->position.y;
- int32_t vdx = rb->size.x;
- int32_t vdy = rb->size.y;
-
- r_dst = Rect2i(int32_t(vax + vbx * c + 0.5), int32_t(vay + vby * c + 0.5), int32_t(vcx + vdx * c + 0.5), int32_t(vcy + vdy * c + 0.5));
- }
- return;
- case VECTOR3: {
- r_dst = *reinterpret_cast<const Vector3 *>(a._data._mem) + *reinterpret_cast<const Vector3 *>(b._data._mem) * c;
- }
- return;
- case VECTOR3I: {
- int32_t vax = reinterpret_cast<const Vector3i *>(a._data._mem)->x;
- int32_t vbx = reinterpret_cast<const Vector3i *>(b._data._mem)->x;
- int32_t vay = reinterpret_cast<const Vector3i *>(a._data._mem)->y;
- int32_t vby = reinterpret_cast<const Vector3i *>(b._data._mem)->y;
- int32_t vaz = reinterpret_cast<const Vector3i *>(a._data._mem)->z;
- int32_t vbz = reinterpret_cast<const Vector3i *>(b._data._mem)->z;
- r_dst = Vector3i(int32_t(vax + vbx * c + 0.5), int32_t(vay + vby * c + 0.5), int32_t(vaz + vbz * c + 0.5));
- }
- return;
- case AABB: {
- const ::AABB *ra = reinterpret_cast<const ::AABB *>(a._data._mem);
- const ::AABB *rb = reinterpret_cast<const ::AABB *>(b._data._mem);
- r_dst = ::AABB(ra->position + rb->position * c, ra->size + rb->size * c);
- }
- return;
- case QUAT: {
- Quat empty_rot;
- const Quat *qa = reinterpret_cast<const Quat *>(a._data._mem);
- const Quat *qb = reinterpret_cast<const Quat *>(b._data._mem);
- r_dst = *qa * empty_rot.slerp(*qb, c);
- }
- return;
- case COLOR: {
- const Color *ca = reinterpret_cast<const Color *>(a._data._mem);
- const Color *cb = reinterpret_cast<const Color *>(b._data._mem);
- float new_r = ca->r + cb->r * c;
- float new_g = ca->g + cb->g * c;
- float new_b = ca->b + cb->b * c;
- float new_a = ca->a + cb->a * c;
- new_r = new_r > 1.0 ? 1.0 : new_r;
- new_g = new_g > 1.0 ? 1.0 : new_g;
- new_b = new_b > 1.0 ? 1.0 : new_b;
- new_a = new_a > 1.0 ? 1.0 : new_a;
- r_dst = Color(new_r, new_g, new_b, new_a);
- }
- return;
- default: {
- r_dst = c < 0.5 ? a : b;
- }
- return;
- }
-}
-
-void Variant::interpolate(const Variant &a, const Variant &b, float c, Variant &r_dst) {
- if (a.type != b.type) {
- if (a.is_num() && b.is_num()) {
- //not as efficient but..
- real_t va = a;
- real_t vb = b;
- r_dst = va + (vb - va) * c;
-
- } else {
- r_dst = a;
- }
- return;
- }
-
- switch (a.type) {
- case NIL: {
- r_dst = Variant();
- }
- return;
- case BOOL: {
- r_dst = a;
- }
- return;
- case INT: {
- int64_t va = a._data._int;
- int64_t vb = b._data._int;
- r_dst = int(va + (vb - va) * c);
- }
- return;
- case FLOAT: {
- real_t va = a._data._float;
- real_t vb = b._data._float;
- r_dst = va + (vb - va) * c;
- }
- return;
- case STRING: {
- //this is pretty funny and bizarre, but artists like to use it for typewritter effects
- String sa = *reinterpret_cast<const String *>(a._data._mem);
- String sb = *reinterpret_cast<const String *>(b._data._mem);
- String dst;
- int sa_len = sa.length();
- int sb_len = sb.length();
- int csize = sa_len + (sb_len - sa_len) * c;
- if (csize == 0) {
- r_dst = "";
- return;
- }
- dst.resize(csize + 1);
- dst[csize] = 0;
- int split = csize / 2;
-
- for (int i = 0; i < csize; i++) {
- char32_t chr = ' ';
-
- if (i < split) {
- if (i < sa.length()) {
- chr = sa[i];
- } else if (i < sb.length()) {
- chr = sb[i];
- }
-
- } else {
- if (i < sb.length()) {
- chr = sb[i];
- } else if (i < sa.length()) {
- chr = sa[i];
- }
- }
-
- dst[i] = chr;
- }
-
- r_dst = dst;
- }
- return;
- case VECTOR2: {
- r_dst = reinterpret_cast<const Vector2 *>(a._data._mem)->lerp(*reinterpret_cast<const Vector2 *>(b._data._mem), c);
- }
- return;
- case VECTOR2I: {
- int32_t vax = reinterpret_cast<const Vector2i *>(a._data._mem)->x;
- int32_t vbx = reinterpret_cast<const Vector2i *>(b._data._mem)->x;
- int32_t vay = reinterpret_cast<const Vector2i *>(a._data._mem)->y;
- int32_t vby = reinterpret_cast<const Vector2i *>(b._data._mem)->y;
- r_dst = Vector2i(int32_t(vax + vbx * c + 0.5), int32_t(vay + vby * c + 0.5));
- }
- return;
-
- case RECT2: {
- r_dst = Rect2(reinterpret_cast<const Rect2 *>(a._data._mem)->position.lerp(reinterpret_cast<const Rect2 *>(b._data._mem)->position, c), reinterpret_cast<const Rect2 *>(a._data._mem)->size.lerp(reinterpret_cast<const Rect2 *>(b._data._mem)->size, c));
- }
- return;
- case RECT2I: {
- const Rect2i *ra = reinterpret_cast<const Rect2i *>(a._data._mem);
- const Rect2i *rb = reinterpret_cast<const Rect2i *>(b._data._mem);
-
- int32_t vax = ra->position.x;
- int32_t vay = ra->position.y;
- int32_t vbx = ra->size.x;
- int32_t vby = ra->size.y;
- int32_t vcx = rb->position.x;
- int32_t vcy = rb->position.y;
- int32_t vdx = rb->size.x;
- int32_t vdy = rb->size.y;
-
- r_dst = Rect2i(int32_t(vax + vbx * c + 0.5), int32_t(vay + vby * c + 0.5), int32_t(vcx + vdx * c + 0.5), int32_t(vcy + vdy * c + 0.5));
- }
- return;
-
- case VECTOR3: {
- r_dst = reinterpret_cast<const Vector3 *>(a._data._mem)->lerp(*reinterpret_cast<const Vector3 *>(b._data._mem), c);
- }
- return;
- case VECTOR3I: {
- int32_t vax = reinterpret_cast<const Vector3i *>(a._data._mem)->x;
- int32_t vbx = reinterpret_cast<const Vector3i *>(b._data._mem)->x;
- int32_t vay = reinterpret_cast<const Vector3i *>(a._data._mem)->y;
- int32_t vby = reinterpret_cast<const Vector3i *>(b._data._mem)->y;
- int32_t vaz = reinterpret_cast<const Vector3i *>(a._data._mem)->z;
- int32_t vbz = reinterpret_cast<const Vector3i *>(b._data._mem)->z;
- r_dst = Vector3i(int32_t(vax + vbx * c + 0.5), int32_t(vay + vby * c + 0.5), int32_t(vaz + vbz * c + 0.5));
- }
- return;
-
- case TRANSFORM2D: {
- r_dst = a._data._transform2d->interpolate_with(*b._data._transform2d, c);
- }
- return;
- case PLANE: {
- r_dst = a;
- }
- return;
- case QUAT: {
- r_dst = reinterpret_cast<const Quat *>(a._data._mem)->slerp(*reinterpret_cast<const Quat *>(b._data._mem), c);
- }
- return;
- case AABB: {
- r_dst = ::AABB(a._data._aabb->position.lerp(b._data._aabb->position, c), a._data._aabb->size.lerp(b._data._aabb->size, c));
- }
- return;
- case BASIS: {
- r_dst = Transform(*a._data._basis).interpolate_with(Transform(*b._data._basis), c).basis;
- }
- return;
- case TRANSFORM: {
- r_dst = a._data._transform->interpolate_with(*b._data._transform, c);
- }
- return;
- case COLOR: {
- r_dst = reinterpret_cast<const Color *>(a._data._mem)->lerp(*reinterpret_cast<const Color *>(b._data._mem), c);
- }
- return;
- case STRING_NAME: {
- r_dst = a;
- }
- return;
- case NODE_PATH: {
- r_dst = a;
- }
- return;
- case _RID: {
- r_dst = a;
- }
- return;
- case OBJECT: {
- r_dst = a;
- }
- return;
- case DICTIONARY: {
- }
- return;
- case ARRAY: {
- r_dst = a;
- }
- return;
- case PACKED_BYTE_ARRAY: {
- r_dst = a;
- }
- return;
- case PACKED_INT32_ARRAY: {
- const Vector<int32_t> *arr_a = &PackedArrayRef<int32_t>::get_array(a._data.packed_array);
- const Vector<int32_t> *arr_b = &PackedArrayRef<int32_t>::get_array(b._data.packed_array);
- int32_t sz = arr_a->size();
- if (sz == 0 || arr_b->size() != sz) {
- r_dst = a;
- } else {
- Vector<int32_t> v;
- v.resize(sz);
- {
- int32_t *vw = v.ptrw();
- const int32_t *ar = arr_a->ptr();
- const int32_t *br = arr_b->ptr();
-
- Variant va;
- for (int32_t i = 0; i < sz; i++) {
- Variant::interpolate(ar[i], br[i], c, va);
- vw[i] = va;
- }
- }
- r_dst = v;
- }
- }
- return;
- case PACKED_INT64_ARRAY: {
- const Vector<int64_t> *arr_a = &PackedArrayRef<int64_t>::get_array(a._data.packed_array);
- const Vector<int64_t> *arr_b = &PackedArrayRef<int64_t>::get_array(b._data.packed_array);
- int64_t sz = arr_a->size();
- if (sz == 0 || arr_b->size() != sz) {
- r_dst = a;
- } else {
- Vector<int64_t> v;
- v.resize(sz);
- {
- int64_t *vw = v.ptrw();
- const int64_t *ar = arr_a->ptr();
- const int64_t *br = arr_b->ptr();
-
- Variant va;
- for (int64_t i = 0; i < sz; i++) {
- Variant::interpolate(ar[i], br[i], c, va);
- vw[i] = va;
- }
- }
- r_dst = v;
- }
- }
- return;
- case PACKED_FLOAT32_ARRAY: {
- const Vector<float> *arr_a = &PackedArrayRef<float>::get_array(a._data.packed_array);
- const Vector<float> *arr_b = &PackedArrayRef<float>::get_array(b._data.packed_array);
- int sz = arr_a->size();
- if (sz == 0 || arr_b->size() != sz) {
- r_dst = a;
- } else {
- Vector<float> v;
- v.resize(sz);
- {
- float *vw = v.ptrw();
- const float *ar = arr_a->ptr();
- const float *br = arr_b->ptr();
-
- Variant va;
- for (int i = 0; i < sz; i++) {
- Variant::interpolate(ar[i], br[i], c, va);
- vw[i] = va;
- }
- }
- r_dst = v;
- }
- }
- return;
- case PACKED_FLOAT64_ARRAY: {
- const Vector<double> *arr_a = &PackedArrayRef<double>::get_array(a._data.packed_array);
- const Vector<double> *arr_b = &PackedArrayRef<double>::get_array(b._data.packed_array);
- int sz = arr_a->size();
- if (sz == 0 || arr_b->size() != sz) {
- r_dst = a;
- } else {
- Vector<double> v;
- v.resize(sz);
- {
- double *vw = v.ptrw();
- const double *ar = arr_a->ptr();
- const double *br = arr_b->ptr();
-
- Variant va;
- for (int i = 0; i < sz; i++) {
- Variant::interpolate(ar[i], br[i], c, va);
- vw[i] = va;
- }
- }
- r_dst = v;
- }
- }
- return;
- case PACKED_STRING_ARRAY: {
- r_dst = a;
- }
- return;
- case PACKED_VECTOR2_ARRAY: {
- const Vector<Vector2> *arr_a = &PackedArrayRef<Vector2>::get_array(a._data.packed_array);
- const Vector<Vector2> *arr_b = &PackedArrayRef<Vector2>::get_array(b._data.packed_array);
- int sz = arr_a->size();
- if (sz == 0 || arr_b->size() != sz) {
- r_dst = a;
- } else {
- Vector<Vector2> v;
- v.resize(sz);
- {
- Vector2 *vw = v.ptrw();
- const Vector2 *ar = arr_a->ptr();
- const Vector2 *br = arr_b->ptr();
-
- for (int i = 0; i < sz; i++) {
- vw[i] = ar[i].lerp(br[i], c);
- }
- }
- r_dst = v;
- }
- }
- return;
- case PACKED_VECTOR3_ARRAY: {
- const Vector<Vector3> *arr_a = &PackedArrayRef<Vector3>::get_array(a._data.packed_array);
- const Vector<Vector3> *arr_b = &PackedArrayRef<Vector3>::get_array(b._data.packed_array);
- int sz = arr_a->size();
- if (sz == 0 || arr_b->size() != sz) {
- r_dst = a;
- } else {
- Vector<Vector3> v;
- v.resize(sz);
- {
- Vector3 *vw = v.ptrw();
- const Vector3 *ar = arr_a->ptr();
- const Vector3 *br = arr_b->ptr();
-
- for (int i = 0; i < sz; i++) {
- vw[i] = ar[i].lerp(br[i], c);
- }
- }
- r_dst = v;
- }
- }
- return;
- case PACKED_COLOR_ARRAY: {
- const Vector<Color> *arr_a = &PackedArrayRef<Color>::get_array(a._data.packed_array);
- const Vector<Color> *arr_b = &PackedArrayRef<Color>::get_array(b._data.packed_array);
- int sz = arr_a->size();
- if (sz == 0 || arr_b->size() != sz) {
- r_dst = a;
- } else {
- Vector<Color> v;
- v.resize(sz);
- {
- Color *vw = v.ptrw();
- const Color *ar = arr_a->ptr();
- const Color *br = arr_b->ptr();
-
- for (int i = 0; i < sz; i++) {
- vw[i] = ar[i].lerp(br[i], c);
- }
- }
- r_dst = v;
- }
- }
- return;
- default: {
- r_dst = a;
- }
- }
-}
-
-static const char *_op_names[Variant::OP_MAX] = {
- "==",
- "!=",
- "<",
- "<=",
- ">",
- ">=",
- "+",
- "-",
- "*",
- "/",
- "- (negation)",
- "+ (positive)",
- "%",
- "+ (concatenation)",
- "<<",
- ">>",
- "&",
- "|",
- "^",
- "~",
- "and",
- "or",
- "xor",
- "not",
- "in"
-
-};
-
-String Variant::get_operator_name(Operator p_op) {
- ERR_FAIL_INDEX_V(p_op, OP_MAX, "");
- return _op_names[p_op];
-}
diff --git a/doc/classes/@GlobalScope.xml b/doc/classes/@GlobalScope.xml
index 2b1770f12b..ee65bbc07e 100644
--- a/doc/classes/@GlobalScope.xml
+++ b/doc/classes/@GlobalScope.xml
@@ -1594,43 +1594,40 @@
<constant name="OP_MODULE" value="12" enum="Variant.Operator">
Remainder/modulo operator ([code]%[/code]).
</constant>
- <constant name="OP_STRING_CONCAT" value="13" enum="Variant.Operator">
- String concatenation operator ([code]+[/code]).
- </constant>
- <constant name="OP_SHIFT_LEFT" value="14" enum="Variant.Operator">
+ <constant name="OP_SHIFT_LEFT" value="13" enum="Variant.Operator">
Left shift operator ([code]&lt;&lt;[/code]).
</constant>
- <constant name="OP_SHIFT_RIGHT" value="15" enum="Variant.Operator">
+ <constant name="OP_SHIFT_RIGHT" value="14" enum="Variant.Operator">
Right shift operator ([code]&gt;&gt;[/code]).
</constant>
- <constant name="OP_BIT_AND" value="16" enum="Variant.Operator">
+ <constant name="OP_BIT_AND" value="15" enum="Variant.Operator">
Bitwise AND operator ([code]&amp;[/code]).
</constant>
- <constant name="OP_BIT_OR" value="17" enum="Variant.Operator">
+ <constant name="OP_BIT_OR" value="16" enum="Variant.Operator">
Bitwise OR operator ([code]|[/code]).
</constant>
- <constant name="OP_BIT_XOR" value="18" enum="Variant.Operator">
+ <constant name="OP_BIT_XOR" value="17" enum="Variant.Operator">
Bitwise XOR operator ([code]^[/code]).
</constant>
- <constant name="OP_BIT_NEGATE" value="19" enum="Variant.Operator">
+ <constant name="OP_BIT_NEGATE" value="18" enum="Variant.Operator">
Bitwise NOT operator ([code]~[/code]).
</constant>
- <constant name="OP_AND" value="20" enum="Variant.Operator">
+ <constant name="OP_AND" value="19" enum="Variant.Operator">
Logical AND operator ([code]and[/code] or [code]&amp;&amp;[/code]).
</constant>
- <constant name="OP_OR" value="21" enum="Variant.Operator">
+ <constant name="OP_OR" value="20" enum="Variant.Operator">
Logical OR operator ([code]or[/code] or [code]||[/code]).
</constant>
- <constant name="OP_XOR" value="22" enum="Variant.Operator">
+ <constant name="OP_XOR" value="21" enum="Variant.Operator">
Logical XOR operator (not implemented in GDScript).
</constant>
- <constant name="OP_NOT" value="23" enum="Variant.Operator">
+ <constant name="OP_NOT" value="22" enum="Variant.Operator">
Logical NOT operator ([code]not[/code] or [code]![/code]).
</constant>
- <constant name="OP_IN" value="24" enum="Variant.Operator">
+ <constant name="OP_IN" value="23" enum="Variant.Operator">
Logical IN operator ([code]in[/code]).
</constant>
- <constant name="OP_MAX" value="25" enum="Variant.Operator">
+ <constant name="OP_MAX" value="24" enum="Variant.Operator">
Represents the size of the [enum Variant.Operator] enum.
</constant>
</constants>
diff --git a/doc/classes/AABB.xml b/doc/classes/AABB.xml
index 4f95b44f83..a4972612d9 100644
--- a/doc/classes/AABB.xml
+++ b/doc/classes/AABB.xml
@@ -17,6 +17,22 @@
<method name="AABB">
<return type="AABB">
</return>
+ <description>
+ Constructs a default-initialized [AABB] with default (zero) values of [member position] and [member size].
+ </description>
+ </method>
+ <method name="AABB">
+ <return type="AABB">
+ </return>
+ <argument index="0" name="from" type="AABB">
+ </argument>
+ <description>
+ Constructs an [AABB] as a copy of the given [AABB].
+ </description>
+ </method>
+ <method name="AABB">
+ <return type="AABB">
+ </return>
<argument index="0" name="position" type="Vector3">
</argument>
<argument index="1" name="size" type="Vector3">
diff --git a/doc/classes/Array.xml b/doc/classes/Array.xml
index d0f90f513d..86ef5bef4c 100644
--- a/doc/classes/Array.xml
+++ b/doc/classes/Array.xml
@@ -46,37 +46,44 @@
<method name="Array">
<return type="Array">
</return>
- <argument index="0" name="from" type="PackedColorArray">
+ <description>
+ Constructs an empty [Array].
+ </description>
+ </method>
+ <method name="Array">
+ <return type="Array">
+ </return>
+ <argument index="0" name="from" type="Array">
</argument>
<description>
- Constructs an array from a [PackedColorArray].
+ Constructs an [Array] as a copy of the given [Array].
</description>
</method>
<method name="Array">
<return type="Array">
</return>
- <argument index="0" name="from" type="PackedVector3Array">
+ <argument index="0" name="from" type="PackedByteArray">
</argument>
<description>
- Constructs an array from a [PackedVector3Array].
+ Constructs an array from a [PackedByteArray].
</description>
</method>
<method name="Array">
<return type="Array">
</return>
- <argument index="0" name="from" type="PackedVector2Array">
+ <argument index="0" name="from" type="PackedColorArray">
</argument>
<description>
- Constructs an array from a [PackedVector2Array].
+ Constructs an array from a [PackedColorArray].
</description>
</method>
<method name="Array">
<return type="Array">
</return>
- <argument index="0" name="from" type="PackedStringArray">
+ <argument index="0" name="from" type="PackedFloat32Array">
</argument>
<description>
- Constructs an array from a [PackedStringArray].
+ Constructs an array from a [PackedFloat32Array].
</description>
</method>
<method name="Array">
@@ -91,10 +98,10 @@
<method name="Array">
<return type="Array">
</return>
- <argument index="0" name="from" type="PackedFloat32Array">
+ <argument index="0" name="from" type="PackedInt32Array">
</argument>
<description>
- Constructs an array from a [PackedFloat32Array].
+ Constructs an array from a [PackedInt32Array].
</description>
</method>
<method name="Array">
@@ -109,19 +116,28 @@
<method name="Array">
<return type="Array">
</return>
- <argument index="0" name="from" type="PackedInt32Array">
+ <argument index="0" name="from" type="PackedStringArray">
</argument>
<description>
- Constructs an array from a [PackedInt32Array].
+ Constructs an array from a [PackedStringArray].
</description>
</method>
<method name="Array">
<return type="Array">
</return>
- <argument index="0" name="from" type="PackedByteArray">
+ <argument index="0" name="from" type="PackedVector2Array">
</argument>
<description>
- Constructs an array from a [PackedByteArray].
+ Constructs an array from a [PackedVector2Array].
+ </description>
+ </method>
+ <method name="Array">
+ <return type="Array">
+ </return>
+ <argument index="0" name="from" type="PackedVector3Array">
+ </argument>
+ <description>
+ Constructs an array from a [PackedVector3Array].
</description>
</method>
<method name="append">
diff --git a/doc/classes/Basis.xml b/doc/classes/Basis.xml
index 4201a31402..908f316e4e 100644
--- a/doc/classes/Basis.xml
+++ b/doc/classes/Basis.xml
@@ -22,20 +22,17 @@
<method name="Basis">
<return type="Basis">
</return>
- <argument index="0" name="from" type="Quat">
- </argument>
<description>
- Constructs a pure rotation basis matrix from the given quaternion.
+ Constructs a default-initialized [Basis] set to [constant IDENTITY].
</description>
</method>
<method name="Basis">
<return type="Basis">
</return>
- <argument index="0" name="from" type="Vector3">
+ <argument index="0" name="from" type="Basis">
</argument>
<description>
- Constructs a pure rotation basis matrix from the given Euler angles (in the YXZ convention: when *composing*, first Y, then X, and Z last), given in the vector format as (X angle, Y angle, Z angle).
- Consider using the [Quat] constructor instead, which uses a quaternion instead of Euler angles.
+ Constructs a [Basis] as a copy of the given [Basis].
</description>
</method>
<method name="Basis">
@@ -52,6 +49,25 @@
<method name="Basis">
<return type="Basis">
</return>
+ <argument index="0" name="euler" type="Vector3">
+ </argument>
+ <description>
+ Constructs a pure rotation basis matrix from the given Euler angles (in the YXZ convention: when *composing*, first Y, then X, and Z last), given in the vector format as (X angle, Y angle, Z angle).
+ Consider using the [Quat] constructor instead, which uses a quaternion instead of Euler angles.
+ </description>
+ </method>
+ <method name="Basis">
+ <return type="Basis">
+ </return>
+ <argument index="0" name="from" type="Quat">
+ </argument>
+ <description>
+ Constructs a pure rotation basis matrix from the given quaternion.
+ </description>
+ </method>
+ <method name="Basis">
+ <return type="Basis">
+ </return>
<argument index="0" name="x_axis" type="Vector3">
</argument>
<argument index="1" name="y_axis" type="Vector3">
diff --git a/doc/classes/Callable.xml b/doc/classes/Callable.xml
index 7aaf087540..c31efc2581 100644
--- a/doc/classes/Callable.xml
+++ b/doc/classes/Callable.xml
@@ -39,12 +39,28 @@
<method name="Callable">
<return type="Callable">
</return>
+ <description>
+ Constructs a null [Callable] with no object nor method bound.
+ </description>
+ </method>
+ <method name="Callable">
+ <return type="Callable">
+ </return>
+ <argument index="0" name="from" type="Callable">
+ </argument>
+ <description>
+ Constructs a [Callable] as a copy of the given [Callable].
+ </description>
+ </method>
+ <method name="Callable">
+ <return type="Callable">
+ </return>
<argument index="0" name="object" type="Object">
</argument>
- <argument index="1" name="method_name" type="StringName">
+ <argument index="1" name="method" type="StringName">
</argument>
<description>
- Creates a new [Callable] for the method called [code]method_name[/code] in the specified [code]object[/code].
+ Creates a new [Callable] for the method called [code]method[/code] in the specified [code]object[/code].
</description>
</method>
<method name="bind" qualifiers="vararg">
diff --git a/doc/classes/Color.xml b/doc/classes/Color.xml
index ffa0fa54c9..721fea8a19 100644
--- a/doc/classes/Color.xml
+++ b/doc/classes/Color.xml
@@ -19,71 +19,28 @@
<method name="Color">
<return type="Color">
</return>
- <argument index="0" name="from" type="String">
- </argument>
<description>
- Constructs a color from an HTML hexadecimal color string in RGB or RGBA format. See also [method @GDScript.ColorN].
- [codeblocks]
- [gdscript]
- # Each of the following creates the same color RGBA(178, 217, 10, 255).
- var c3 = Color("#b2d90a") # RGB format with "#".
- var c4 = Color("b2d90a") # RGB format.
- var c1 = Color("#b2d90aff") # RGBA format with "#".
- var c2 = Color("b2d90aff") # RGBA format.
- [/gdscript]
- [csharp]
- // Each of the following creates the same color RGBA(178, 217, 10, 255).
- var c3 = new Color("#b2d90a");
- var c4 = new Color("b2d90a"); // RGB format.
- var c1 = new Color("#b2d90aff");
- var c2 = new Color("b2d90aff"); // RGBA format.
- [/csharp]
- [/codeblocks]
- You can also use the "web color" short-hand form by only using 3 or 4 digits.
- [codeblocks]
- [gdscript]
- # Each of the following creates the same color RGBA(17, 34, 51, 255).
- var c3 = Color("#123") # RGB format with "#".
- var c4 = Color("123") # RGB format.
- var c1 = Color("#123f") # RGBA format with "#".
- var c2 = Color("123f") # RGBA format.
- [/gdscript]
- [csharp]
- // Each of the following creates the same color RGBA(17, 34, 51, 255).
- var c3 = new Color("#123");
- var c4 = new Color("123"); // RGB format.
- var c1 = new Color("#123f");
- var c2 = new Color("123f"); // RGBA format.
- [/csharp]
- [/codeblocks]
+ Constructs a default-initialized [Color] with all components set to [code]0[/code].
</description>
</method>
<method name="Color">
<return type="Color">
</return>
- <argument index="0" name="from" type="int">
+ <argument index="0" name="from" type="Color">
</argument>
<description>
- Constructs a color from a 32-bit integer (each byte represents a component of the RGBA profile).
- [codeblocks]
- [gdscript]
- var c = Color(274) # Equivalent to RGBA(0, 0, 1, 18)
- [/gdscript]
- [csharp]
- var c = new Color(274); // Equivalent to RGBA(0, 0, 1, 18)
- [/csharp]
- [/codeblocks]
+ Constructs a [Color] as a copy of the given [Color].
</description>
</method>
<method name="Color">
<return type="Color">
</return>
- <argument index="0" name="c" type="Color">
+ <argument index="0" name="from" type="Color">
</argument>
- <argument index="1" name="a" type="float">
+ <argument index="1" name="alpha" type="float">
</argument>
<description>
- Constructs a color from an existing color, but with a custom alpha value.
+ Constructs a [Color] from an existing color, but with a custom alpha value.
[codeblocks]
[gdscript]
var red = Color(Color.red, 0.5) # 50% transparent red.
@@ -103,14 +60,16 @@
</argument>
<argument index="2" name="b" type="float">
</argument>
+ <argument index="3" name="a" type="float">
+ </argument>
<description>
- Constructs a color from an RGB profile using values between 0 and 1. Alpha will always be 1.
+ Constructs a [Color] from an RGBA profile using values between 0 and 1.
[codeblocks]
[gdscript]
- var color = Color(0.2, 1.0, 0.7) # Equivalent to RGBA(51, 255, 178, 255)
+ var color = Color(0.2, 1.0, 0.7, 0.8) # Equivalent to RGBA(51, 255, 178, 204)
[/gdscript]
[csharp]
- var color = new Color(0.2f, 1.0f, 0.7f); // Equivalent to RGBA(51, 255, 178, 255)
+ var color = new Color(0.2f, 1.0f, 0.7f, 0.8f); // Equivalent to RGBA(51, 255, 178, 255, 204)
[/csharp]
[/codeblocks]
</description>
@@ -124,16 +83,14 @@
</argument>
<argument index="2" name="b" type="float">
</argument>
- <argument index="3" name="a" type="float">
- </argument>
<description>
- Constructs a color from an RGBA profile using values between 0 and 1.
+ Constructs a color from an RGB profile using values between 0 and 1. Alpha will always be 1.
[codeblocks]
[gdscript]
- var color = Color(0.2, 1.0, 0.7, 0.8) # Equivalent to RGBA(51, 255, 178, 204)
+ var color = Color(0.2, 1.0, 0.7) # Equivalent to RGBA(51, 255, 178, 255)
[/gdscript]
[csharp]
- var color = new Color(0.2f, 1.0f, 0.7f, 0.8f); // Equivalent to RGBA(51, 255, 178, 255, 204)
+ var color = new Color(0.2f, 1.0f, 0.7f); // Equivalent to RGBA(51, 255, 178, 255)
[/csharp]
[/codeblocks]
</description>
@@ -159,23 +116,6 @@
[/codeblocks]
</description>
</method>
- <method name="contrasted">
- <return type="Color">
- </return>
- <description>
- Returns the most contrasting color.
- [codeblocks]
- [gdscript]
- var color = Color(0.3, 0.4, 0.9)
- var contrasted_color = color.contrasted() # Equivalent to RGBA(204, 229, 102, 255)
- [/gdscript]
- [csharp]
- var color = new Color(0.3f, 0.4f, 0.9f);
- Color contrastedColor = color.Contrasted(); // Equivalent to RGBA(204, 229, 102, 255)
- [/csharp]
- [/codeblocks]
- </description>
- </method>
<method name="darkened">
<return type="Color">
</return>
diff --git a/doc/classes/DTLSServer.xml b/doc/classes/DTLSServer.xml
index 8c71b61553..91a04b1f28 100644
--- a/doc/classes/DTLSServer.xml
+++ b/doc/classes/DTLSServer.xml
@@ -6,8 +6,9 @@
<description>
This class is used to store the state of a DTLS server. Upon [method setup] it converts connected [PacketPeerUDP] to [PacketPeerDTLS] accepting them via [method take_connection] as DTLS clients. Under the hood, this class is used to store the DTLS state and cookies of the server. The reason of why the state and cookies are needed is outside of the scope of this documentation.
Below a small example of how to use it:
- [codeblock]
- # server.gd
+ [codeblocks]
+ [gdscript]
+ # ServerNode.gd
extends Node
var dtls := DTLSServer.new()
@@ -28,15 +29,64 @@
continue # It is normal that 50% of the connections fails due to cookie exchange.
print("Peer connected!")
peers.append(dtls_peer)
+
for p in peers:
p.poll() # Must poll to update the state.
if p.get_status() == PacketPeerDTLS.STATUS_CONNECTED:
while p.get_available_packet_count() &gt; 0:
print("Received message from client: %s" % p.get_packet().get_string_from_utf8())
p.put_packet("Hello DTLS client".to_utf8())
- [/codeblock]
- [codeblock]
- # client.gd
+ [/gdscript]
+ [csharp]
+ using Godot;
+ using System;
+ // ServerNode.cs
+ public class ServerNode : Node
+ {
+ public DTLSServer Dtls = new DTLSServer();
+ public UDPServer Server = new UDPServer();
+ public Godot.Collections.Array&lt;PacketPeerDTLS&gt; Peers = new Godot.Collections.Array&lt;PacketPeerDTLS&gt;();
+ public override void _Ready()
+ {
+ Server.Listen(4242);
+ var key = GD.Load&lt;CryptoKey&gt;("key.key"); // Your private key.
+ var cert = GD.Load&lt;X509Certificate&gt;("cert.crt"); // Your X509 certificate.
+ Dtls.Setup(key, cert);
+ }
+
+ public override void _Process(float delta)
+ {
+ while (Server.IsConnectionAvailable())
+ {
+ PacketPeerUDP peer = Server.TakeConnection();
+ PacketPeerDTLS dtlsPeer = Dtls.TakeConnection(peer);
+ if (dtlsPeer.GetStatus() != PacketPeerDTLS.Status.Handshaking)
+ {
+ continue; // It is normal that 50% of the connections fails due to cookie exchange.
+ }
+ GD.Print("Peer connected!");
+ Peers.Add(dtlsPeer);
+ }
+
+ foreach (var p in Peers)
+ {
+ p.Poll(); // Must poll to update the state.
+ if (p.GetStatus() == PacketPeerDTLS.Status.Connected)
+ {
+ while (p.GetAvailablePacketCount() &gt; 0)
+ {
+ GD.Print("Received Message From Client: " + p.GetPacket().GetStringFromUTF8());
+ p.PutPacket("Hello Dtls Client".ToUTF8());
+ }
+ }
+ }
+ }
+ }
+ [/csharp]
+ [/codeblocks]
+ [codeblocks]
+ [gdscript]
+ # ClientNode.gd
extends Node
var dtls := PacketPeerDTLS.new()
@@ -56,7 +106,42 @@
while dtls.get_available_packet_count() &gt; 0:
print("Connected: %s" % dtls.get_packet().get_string_from_utf8())
connected = true
- [/codeblock]
+ [/gdscript]
+ [csharp]
+ using Godot;
+ using System.Text;
+ // ClientNode.cs
+ public class ClientNode : Node
+ {
+ public PacketPeerDTLS Dtls = new PacketPeerDTLS();
+ public PacketPeerUDP Udp = new PacketPeerUDP();
+ public bool Connected = false;
+ public override void _Ready()
+ {
+ Udp.ConnectToHost("127.0.0.1", 4242);
+ Dtls.ConnectToPeer(Udp, false); // Use true in production for certificate validation!
+ }
+
+ public override void _Process(float delta)
+ {
+ Dtls.Poll();
+ if (Dtls.GetStatus() == PacketPeerDTLS.Status.Connected)
+ {
+ if (!Connected)
+ {
+ // Try to contact server
+ Dtls.PutPacket("The Answer Is..42!".ToUTF8());
+ }
+ while (Dtls.GetAvailablePacketCount() &gt; 0)
+ {
+ GD.Print("Connected: " + Dtls.GetPacket().GetStringFromUTF8());
+ Connected = true;
+ }
+ }
+ }
+ }
+ [/csharp]
+ [/codeblocks]
</description>
<tutorials>
</tutorials>
diff --git a/doc/classes/Decal.xml b/doc/classes/Decal.xml
index f9baa3b09a..8107d97b67 100644
--- a/doc/classes/Decal.xml
+++ b/doc/classes/Decal.xml
@@ -20,10 +20,18 @@
Returns the [Texture2D] associated with the specified [enum DecalTexture]. This is a convenience method, in most cases you should access the texture directly.
For example, instead of [code]albedo_tex = $Decal.get_texture(Decal.TEXTURE_ALBEDO)[/code], use [code]albedo_tex = $Decal.texture_albedo[/code].
One case where this is better than accessing the texture directly is when you want to copy one Decal's textures to another. For example:
- [codeblock]
+ [codeblocks]
+ [gdscript]
for i in Decal.TEXTURE_MAX:
$NewDecal.set_texture(i, $OldDecal.get_texture(i))
- [/codeblock]
+ [/gdscript]
+ [csharp]
+ for (int i = 0; i &lt; (int)Decal.DecalTexture.Max; i++)
+ {
+ GetNode&lt;Decal&gt;("NewDecal").SetTexture(i, GetNode&lt;Decal&gt;("OldDecal").GetTexture(i));
+ }
+ [/csharp]
+ [/codeblocks]
</description>
</method>
<method name="set_texture">
@@ -37,10 +45,18 @@
Sets the [Texture2D] associated with the specified [enum DecalTexture]. This is a convenience method, in most cases you should access the texture directly.
For example, instead of [code]$Decal.set_texture(Decal.TEXTURE_ALBEDO, albedo_tex)[/code], use [code]$Decal.texture_albedo = albedo_tex[/code].
One case where this is better than accessing the texture directly is when you want to copy one Decal's textures to another. For example:
- [codeblock]
+ [codeblocks]
+ [gdscript]
for i in Decal.TEXTURE_MAX:
$NewDecal.set_texture(i, $OldDecal.get_texture(i))
- [/codeblock]
+ [/gdscript]
+ [csharp]
+ for (int i = 0; i &lt; (int)Decal.DecalTexture.Max; i++)
+ {
+ GetNode&lt;Decal&gt;("NewDecal").SetTexture(i, GetNode&lt;Decal&gt;("OldDecal").GetTexture(i));
+ }
+ [/csharp]
+ [/codeblocks]
</description>
</method>
</methods>
diff --git a/doc/classes/Dictionary.xml b/doc/classes/Dictionary.xml
index cb60d6e621..a7a3632fef 100644
--- a/doc/classes/Dictionary.xml
+++ b/doc/classes/Dictionary.xml
@@ -9,7 +9,8 @@
Erasing elements while iterating over them [b]is not supported[/b] and will result in undefined behavior.
[b]Note:[/b] Dictionaries are always passed by reference. To get a copy of a dictionary which can be modified independently of the original dictionary, use [method duplicate].
Creating a dictionary:
- [codeblock]
+ [codeblocks]
+ [gdscript]
var my_dir = {} # Creates an empty dictionary.
var points_dir = {"White": 50, "Yellow": 75, "Orange": 100}
var another_dir = {
@@ -17,28 +18,74 @@
key2: value2,
key3: value3,
}
- [/codeblock]
+ [/gdscript]
+ [csharp]
+ var myDir = new Godot.Collections.Dictionary(); // Creates an empty dictionary.
+ var pointsDir = new Godot.Collections.Dictionary
+ {
+ {"White", 50},
+ {"Yellow", 75},
+ {"Orange", 100}
+ };
+ [/csharp]
+ [/codeblocks]
You can access a dictionary's values by referencing the appropriate key. In the above example, [code]points_dir["White"][/code] will return [code]50[/code]. You can also write [code]points_dir.White[/code], which is equivalent. However, you'll have to use the bracket syntax if the key you're accessing the dictionary with isn't a fixed string (such as a number or variable).
- [codeblock]
- export(String, "White", "Yellow", "Orange") var my_color
+ [codeblocks]
+ [gdscript]
+ export(string, "White", "Yellow", "Orange") var my_color
var points_dir = {"White": 50, "Yellow": 75, "Orange": 100}
-
func _ready():
# We can't use dot syntax here as `my_color` is a variable.
var points = points_dir[my_color]
- [/codeblock]
+ [/gdscript]
+ [csharp]
+ [Export(PropertyHint.Enum, "White,Yellow,Orange")]
+ public string MyColor { get; set; }
+ public Godot.Collections.Dictionary pointsDir = new Godot.Collections.Dictionary
+ {
+ {"White", 50},
+ {"Yellow", 75},
+ {"Orange", 100}
+ };
+
+ public override void _Ready()
+ {
+ int points = (int)pointsDir[MyColor];
+ }
+ [/csharp]
+ [/codeblocks]
In the above code, [code]points[/code] will be assigned the value that is paired with the appropriate color selected in [code]my_color[/code].
Dictionaries can contain more complex data:
- [codeblock]
+ [codeblocks]
+ [gdscript]
my_dir = {"First Array": [1, 2, 3, 4]} # Assigns an Array to a String key.
- [/codeblock]
+ [/gdscript]
+ [csharp]
+ var myDir = new Godot.Collections.Dictionary
+ {
+ {"First Array", new Godot.Collections.Array{1, 2, 3, 4}}
+ };
+ [/csharp]
+ [/codeblocks]
To add a key to an existing dictionary, access it like an existing key and assign to it:
- [codeblock]
+ [codeblocks]
+ [gdscript]
var points_dir = {"White": 50, "Yellow": 75, "Orange": 100}
points_dir["Blue"] = 150 # Add "Blue" as a key and assign 150 as its value.
- [/codeblock]
+ [/gdscript]
+ [csharp]
+ var pointsDir = new Godot.Collections.Dictionary
+ {
+ {"White", 50},
+ {"Yellow", 75},
+ {"Orange", 100}
+ };
+ pointsDir["blue"] = 150; // Add "Blue" as a key and assign 150 as its value.
+ [/csharp]
+ [/codeblocks]
Finally, dictionaries can contain different types of keys and values in the same dictionary:
- [codeblock]
+ [codeblocks]
+ [gdscript]
# This is a valid dictionary.
# To access the string "Nested value" below, use `my_dir.sub_dir.sub_key` or `my_dir["sub_dir"]["sub_key"]`.
# Indexing styles can be mixed and matched depending on your needs.
@@ -48,29 +95,75 @@
7: "Hello",
"sub_dir": {"sub_key": "Nested value"},
}
- [/codeblock]
+ [/gdscript]
+ [csharp]
+ // This is a valid dictionary.
+ // To access the string "Nested value" below, use `my_dir.sub_dir.sub_key` or `my_dir["sub_dir"]["sub_key"]`.
+ // Indexing styles can be mixed and matched depending on your needs.
+ var myDir = new Godot.Collections.Dictionary {
+ {"String Key", 5},
+ {4, new Godot.Collections.Array{1,2,3}},
+ {7, "Hello"},
+ {"sub_dir", new Godot.Collections.Dictionary{{"sub_key", "Nested value"}}}
+ };
+ [/csharp]
+ [/codeblocks]
[b]Note:[/b] Unlike [Array]s, you can't compare dictionaries directly:
- [codeblock]
- array1 = [1, 2, 3]
- array2 = [1, 2, 3]
+ [codeblocks]
+ [gdscript]
+ var array1 = [1, 2, 3]
+ var array2 = [1, 2, 3]
func compare_arrays():
print(array1 == array2) # Will print true.
- dir1 = {"a": 1, "b": 2, "c": 3}
- dir2 = {"a": 1, "b": 2, "c": 3}
+ var dir1 = {"a": 1, "b": 2, "c": 3}
+ var dir2 = {"a": 1, "b": 2, "c": 3}
func compare_dictionaries():
print(dir1 == dir2) # Will NOT print true.
- [/codeblock]
+ [/gdscript]
+ [csharp]
+ // You have to use GD.Hash().
+
+ public Godot.Collections.Array array1 = new Godot.Collections.Array{1, 2, 3};
+ public Godot.Collections.Array array2 = new Godot.Collections.Array{1, 2, 3};
+
+ public void CompareArrays()
+ {
+ GD.Print(array1 == array2); // Will print FALSE!!
+ GD.Print(GD.Hash(array1) == GD.Hash(array2)); // Will print true.
+ }
+
+ public Godot.Collections.Dictionary dir1 = new Godot.Collections.Dictionary{{"a", 1}, {"b", 2}, {"c", 3}};
+ public Godot.Collections.Dictionary dir2 = new Godot.Collections.Dictionary{{"a", 1}, {"b", 2}, {"c", 3}};
+
+ public void CompareDictionaries()
+ {
+ GD.Print(dir1 == dir2); // Will NOT print true.
+ }
+ [/csharp]
+ [/codeblocks]
You need to first calculate the dictionary's hash with [method hash] before you can compare them:
- [codeblock]
- dir1 = {"a": 1, "b": 2, "c": 3}
- dir2 = {"a": 1, "b": 2, "c": 3}
+ [codeblocks]
+ [gdscript]
+ var dir1 = {"a": 1, "b": 2, "c": 3}
+ var dir2 = {"a": 1, "b": 2, "c": 3}
func compare_dictionaries():
print(dir1.hash() == dir2.hash()) # Will print true.
- [/codeblock]
+ [/gdscript]
+ [csharp]
+ // You have to use GD.Hash().
+ public Godot.Collections.Dictionary dir1 = new Godot.Collections.Dictionary{{"a", 1}, {"b", 2}, {"c", 3}};
+ public Godot.Collections.Dictionary dir2 = new Godot.Collections.Dictionary{{"a", 1}, {"b", 2}, {"c", 3}};
+
+ public void CompareDictionaries()
+ {
+ GD.Print(GD.Hash(dir1) == GD.Hash(dir2)); // Will print true.
+ }
+ [/csharp]
+ [/codeblocks]
</description>
<tutorials>
<link title="GDScript basics: Dictionary">https://docs.godotengine.org/en/latest/getting_started/scripting/gdscript/gdscript_basics.html#dictionary</link>
@@ -78,6 +171,22 @@
<link title="OS Test Demo">https://godotengine.org/asset-library/asset/677</link>
</tutorials>
<methods>
+ <method name="Dictionary">
+ <return type="Dictionary">
+ </return>
+ <description>
+ Constructs an empty [Dictionary].
+ </description>
+ </method>
+ <method name="Dictionary">
+ <return type="Dictionary">
+ </return>
+ <argument index="0" name="from" type="Dictionary">
+ </argument>
+ <description>
+ Constructs a [Dictionary] as a copy of the given [Dictionary].
+ </description>
+ </method>
<method name="clear">
<return type="void">
</return>
@@ -129,11 +238,20 @@
<description>
Returns [code]true[/code] if the dictionary has a given key.
[b]Note:[/b] This is equivalent to using the [code]in[/code] operator as follows:
- [codeblock]
+ [codeblocks]
+ [gdscript]
# Will evaluate to `true`.
if "godot" in {"godot": "engine"}:
pass
- [/codeblock]
+ [/gdscript]
+ [csharp]
+ // You have to use Contains() here as an alternative to GDScript's `in` operator.
+ if (new Godot.Collections.Dictionary{{"godot", "engine"}}.Contains("godot"))
+ {
+ // I am executed.
+ }
+ [/csharp]
+ [/codeblocks]
This method (like the [code]in[/code] operator) will evaluate to [code]true[/code] as long as the key exists, even if the associated value is [code]null[/code].
</description>
</method>
@@ -151,12 +269,21 @@
</return>
<description>
Returns a hashed integer value representing the dictionary contents. This can be used to compare dictionaries by value:
- [codeblock]
+ [codeblocks]
+ [gdscript]
var dict1 = {0: 10}
var dict2 = {0: 10}
# The line below prints `true`, whereas it would have printed `false` if both variables were compared directly.
print(dict1.hash() == dict2.hash())
- [/codeblock]
+ [/gdscript]
+ [csharp]
+ var dict1 = new Godot.Collections.Dictionary{{0, 10}};
+ var dict2 = new Godot.Collections.Dictionary{{0, 10}};
+ // The line below prints `true`, whereas it would have printed `false` if both variables were compared directly.
+ // Dictionary has no Hash() method. Use GD.Hash() instead.
+ GD.Print(GD.Hash(dict1) == GD.Hash(dict2));
+ [/csharp]
+ [/codeblocks]
[b]Note:[/b] Dictionaries with the same keys/values but in a different order will have a different hash.
</description>
</method>
diff --git a/doc/classes/Directory.xml b/doc/classes/Directory.xml
index bcdadcd970..2d7292717d 100644
--- a/doc/classes/Directory.xml
+++ b/doc/classes/Directory.xml
@@ -7,7 +7,8 @@
Directory type. It is used to manage directories and their content (not restricted to the project folder).
When creating a new [Directory], it must be explicitly opened using [method open] before most methods can be used. However, [method file_exists] and [method dir_exists] can be used without opening a directory. If so, they use a path relative to [code]res://[/code].
Here is an example on how to iterate through the files of a directory:
- [codeblock]
+ [codeblocks]
+ [gdscript]
func dir_contents(path):
var dir = Directory.new()
if dir.open(path) == OK:
@@ -21,7 +22,35 @@
file_name = dir.get_next()
else:
print("An error occurred when trying to access the path.")
- [/codeblock]
+ [/gdscript]
+ [csharp]
+ public void DirContents(string path)
+ {
+ var dir = new Directory();
+ if (dir.Open(path) == Error.Ok)
+ {
+ dir.ListDirBegin();
+ string fileName = dir.GetNext();
+ while (fileName != "")
+ {
+ if (dir.CurrentIsDir())
+ {
+ GD.Print("Found directory: " + fileName);
+ }
+ else
+ {
+ GD.Print("Found file: " + fileName);
+ }
+ fileName = dir.GetNext();
+ }
+ }
+ else
+ {
+ GD.Print("An error occurred when trying to access the path.");
+ }
+ }
+ [/csharp]
+ [/codeblocks]
</description>
<tutorials>
<link title="File system">https://docs.godotengine.org/en/latest/getting_started/step_by_step/filesystem.html</link>
diff --git a/doc/classes/DisplayServer.xml b/doc/classes/DisplayServer.xml
index 53776b7752..d91ea6528a 100644
--- a/doc/classes/DisplayServer.xml
+++ b/doc/classes/DisplayServer.xml
@@ -923,7 +923,8 @@
<description>
Sets a polygonal region of the window which accepts mouse events. Mouse events outside the region will be passed through.
Passing an empty array will disable passthrough support (all mouse events will be intercepted by the window, which is the default behavior).
- [codeblock]
+ [codeblocks]
+ [gdscript]
# Set region, using Path2D node.
DisplayServer.window_set_mouse_passthrough($Path2D.curve.get_baked_points())
@@ -932,7 +933,18 @@
# Reset region to default.
DisplayServer.window_set_mouse_passthrough([])
- [/codeblock]
+ [/gdscript]
+ [csharp]
+ // Set region, using Path2D node.
+ DisplayServer.WindowSetMousePassthrough(GetNode&lt;Path2D&gt;("Path2D").Curve.GetBakedPoints());
+
+ // Set region, using Polygon2D node.
+ DisplayServer.WindowSetMousePassthrough(GetNode&lt;Polygon2D&gt;("Polygon2D").Polygon);
+
+ // Reset region to default.
+ DisplayServer.WindowSetMousePassthrough(new Vector2[] {});
+ [/csharp]
+ [/codeblocks]
[b]Note:[/b] On Windows, the portion of a window that lies outside the region is not drawn, while on Linux and macOS it is.
[b]Note:[/b] This method is implemented on Linux, macOS and Windows.
</description>
@@ -1108,6 +1120,8 @@
<constant name="WINDOW_MODE_MAXIMIZED" value="2" enum="WindowMode">
</constant>
<constant name="WINDOW_MODE_FULLSCREEN" value="3" enum="WindowMode">
+ Fullscreen window mode. Note that this is not [i]exclusive[/i] fullscreen. On Windows and Linux, a borderless window is used to emulate fullscreen. On macOS, a new desktop is used to display the running project.
+ Regardless of the platform, enabling fullscreen will change the window size to match the monitor's size. Therefore, make sure your project supports [url=https://docs.godotengine.org/en/latest/tutorials/rendering/multiple_resolutions.html]multiple resolutions[/url] when enabling fullscreen mode.
</constant>
<constant name="WINDOW_FLAG_RESIZE_DISABLED" value="0" enum="WindowFlags">
</constant>
diff --git a/doc/classes/DynamicFont.xml b/doc/classes/DynamicFont.xml
index f687937e27..d2d0c54761 100644
--- a/doc/classes/DynamicFont.xml
+++ b/doc/classes/DynamicFont.xml
@@ -6,12 +6,20 @@
<description>
DynamicFont renders vector font files (such as TTF or OTF) dynamically at runtime instead of using a prerendered texture atlas like [BitmapFont]. This trades the faster loading time of [BitmapFont]s for the ability to change font parameters like size and spacing during runtime. [DynamicFontData] is used for referencing the font file paths. DynamicFont also supports defining one or more fallback fonts, which will be used when displaying a character not supported by the main font.
DynamicFont uses the [url=https://www.freetype.org/]FreeType[/url] library for rasterization.
- [codeblock]
+ [codeblocks]
+ [gdscript]
var dynamic_font = DynamicFont.new()
dynamic_font.font_data = load("res://BarlowCondensed-Bold.ttf")
dynamic_font.size = 64
$"Label".set("custom_fonts/font", dynamic_font)
- [/codeblock]
+ [/gdscript]
+ [csharp]
+ var dynamicFont = new DynamicFont();
+ dynamicFont.FontData = ResourceLoader.Load&lt;DynamicFontData&gt;("res://BarlowCondensed-Bold.ttf");
+ dynamicFont.Size = 64;
+ GetNode("Label").Set("custom_fonts/font", dynamicFont);
+ [/csharp]
+ [/codeblocks]
[b]Note:[/b] DynamicFont doesn't support features such as kerning, right-to-left typesetting, ligatures, text shaping, variable fonts and optional font features yet. If you wish to "bake" an optional font feature into a TTF font file, you can use [url=https://fontforge.org/]FontForge[/url] to do so. In FontForge, use [b]File &gt; Generate Fonts[/b], click [b]Options[/b], choose the desired features then generate the font.
</description>
<tutorials>
diff --git a/doc/classes/EditorImportPlugin.xml b/doc/classes/EditorImportPlugin.xml
index 2a7f27ef55..e5401134bf 100644
--- a/doc/classes/EditorImportPlugin.xml
+++ b/doc/classes/EditorImportPlugin.xml
@@ -7,7 +7,8 @@
EditorImportPlugins provide a way to extend the editor's resource import functionality. Use them to import resources from custom files or to provide alternatives to the editor's existing importers. Register your [EditorPlugin] with [method EditorPlugin.add_import_plugin].
EditorImportPlugins work by associating with specific file extensions and a resource type. See [method get_recognized_extensions] and [method get_resource_type]. They may optionally specify some import presets that affect the import process. EditorImportPlugins are responsible for creating the resources and saving them in the [code].godot/imported[/code] directory.
Below is an example EditorImportPlugin that imports a [Mesh] from a file with the extension ".special" or ".spec":
- [codeblock]
+ [codeblocks]
+ [gdscript]
tool
extends EditorImportPlugin
@@ -39,14 +40,76 @@
var file = File.new()
if file.open(source_file, File.READ) != OK:
return FAILED
-
- var mesh = Mesh.new()
- # Fill the Mesh with data read in "file", left as an exercise to the reader
+ var mesh = ArrayMesh.new()
+ # Fill the Mesh with data read in "file", left as an exercise to the reader.
var filename = save_path + "." + get_save_extension()
ResourceSaver.save(filename, mesh)
return OK
- [/codeblock]
+ [/gdscript]
+ [csharp]
+ using Godot;
+ using System;
+
+ public class MySpecialPlugin : EditorImportPlugin
+ {
+ public override String GetImporterName()
+ {
+ return "my.special.plugin";
+ }
+
+ public override String GetVisibleName()
+ {
+ return "Special Mesh Importer";
+ }
+
+ public override Godot.Collections.Array GetRecognizedExtensions()
+ {
+ return new Godot.Collections.Array{"special", "spec"};
+ }
+
+ public override String GetSaveExtension()
+ {
+ return "mesh";
+ }
+
+ public override String GetResourceType()
+ {
+ return "Mesh";
+ }
+
+ public override int GetPresetCount()
+ {
+ return 1;
+ }
+
+ public override String GetPresetName(int i)
+ {
+ return "Default";
+ }
+
+ public override Godot.Collections.Array GetImportOptions(int i)
+ {
+ return new Godot.Collections.Array{new Godot.Collections.Dictionary{{"name", "myOption"}, {"defaultValue", false}}};
+ }
+
+ public override int Import(String sourceFile, String savePath, Godot.Collections.Dictionary options, Godot.Collections.Array platformVariants, Godot.Collections.Array genFiles)
+ {
+ var file = new File();
+ if (file.Open(sourceFile, File.ModeFlags.Read) != Error.Ok)
+ {
+ return (int)Error.Failed;
+ }
+
+ var mesh = new ArrayMesh();
+ // Fill the Mesh with data read in "file", left as an exercise to the reader.
+ String filename = savePath + "." + GetSaveExtension();
+ ResourceSaver.Save(filename, mesh);
+ return (int)Error.Ok;
+ }
+ }
+ [/csharp]
+ [/codeblocks]
</description>
<tutorials>
<link title="Import plugins">https://docs.godotengine.org/en/latest/tutorials/plugins/editor/import_plugins.html</link>
@@ -84,14 +147,28 @@
</argument>
<description>
This method can be overridden to hide specific import options if conditions are met. This is mainly useful for hiding options that depend on others if one of them is disabled. For example:
- [codeblock]
+ [codeblocks]
+ [gdscript]
func get_option_visibility(option, options):
# Only show the lossy quality setting if the compression mode is set to "Lossy".
if option == "compress/lossy_quality" and options.has("compress/mode"):
- return int(options["compress/mode"]) == COMPRESS_LOSSY
+ return int(options["compress/mode"]) == COMPRESS_LOSSY # This is a constant that you set
return true
- [/codeblock]
+ [/gdscript]
+ [csharp]
+ public void GetOptionVisibility(string option, Godot.Collections.Dictionary options)
+ {
+ // Only show the lossy quality setting if the compression mode is set to "Lossy".
+ if (option == "compress/lossyQuality" &amp;&amp; options.Contains("compress/mode"))
+ {
+ return (int)options["compress/mode"] == COMPRESS_LOSSY; // This is a constant you set
+ }
+
+ return true;
+ }
+ [/csharp]
+ [/codeblocks]
Return [code]true[/code] to make all options always visible.
</description>
</method>
diff --git a/doc/classes/EditorPlugin.xml b/doc/classes/EditorPlugin.xml
index 95d88e86a6..3613c408b2 100644
--- a/doc/classes/EditorPlugin.xml
+++ b/doc/classes/EditorPlugin.xml
@@ -227,21 +227,35 @@
</argument>
<description>
Called when there is a root node in the current edited scene, [method handles] is implemented and an [InputEvent] happens in the 2D viewport. Intercepts the [InputEvent], if [code]return true[/code] [EditorPlugin] consumes the [code]event[/code], otherwise forwards [code]event[/code] to other Editor classes. Example:
- [codeblock]
+ [codeblocks]
+ [gdscript]
# Prevents the InputEvent to reach other Editor classes
func forward_canvas_gui_input(event):
- var forward = true
- return forward
- [/codeblock]
+ return true
+ [/gdscript]
+ [csharp]
+ // Prevents the InputEvent to reach other Editor classes
+ public override bool ForwardCanvasGuiInput(InputEvent @event)
+ {
+ return true;
+ }
+ [/csharp]
+ [/codeblocks]
Must [code]return false[/code] in order to forward the [InputEvent] to other Editor classes. Example:
- [codeblock]
- # Consumes InputEventMouseMotion and forwards other InputEvent types
+ [codeblocks]
+ [gdscript]
+ # Consumes InputEventMouseMotion and forwards other InputEvent types.
func forward_canvas_gui_input(event):
- var forward = false
- if event is InputEventMouseMotion:
- forward = true
- return forward
- [/codeblock]
+ return event is InputEventMouseMotion
+ [/gdscript]
+ [csharp]
+ // Consumes InputEventMouseMotion and forwards other InputEvent types.
+ public override bool ForwardCanvasGuiInput(InputEvent @event)
+ {
+ return @event is InputEventMouseMotion;
+ }
+ [/csharp]
+ [/codeblocks]
</description>
</method>
<method name="forward_spatial_gui_input" qualifiers="virtual">
@@ -253,21 +267,35 @@
</argument>
<description>
Called when there is a root node in the current edited scene, [method handles] is implemented and an [InputEvent] happens in the 3D viewport. Intercepts the [InputEvent], if [code]return true[/code] [EditorPlugin] consumes the [code]event[/code], otherwise forwards [code]event[/code] to other Editor classes. Example:
- [codeblock]
- # Prevents the InputEvent to reach other Editor classes
+ [codeblocks]
+ [gdscript]
+ # Prevents the InputEvent to reach other Editor classes.
func forward_spatial_gui_input(camera, event):
- var forward = true
- return forward
- [/codeblock]
+ return true
+ [/gdscript]
+ [csharp]
+ // Prevents the InputEvent to reach other Editor classes.
+ public override bool ForwardSpatialGuiInput(Camera3D camera, InputEvent @event)
+ {
+ return true;
+ }
+ [/csharp]
+ [/codeblocks]
Must [code]return false[/code] in order to forward the [InputEvent] to other Editor classes. Example:
- [codeblock]
- # Consumes InputEventMouseMotion and forwards other InputEvent types
+ [codeblocks]
+ [gdscript]
+ # Consumes InputEventMouseMotion and forwards other InputEvent types.
func forward_spatial_gui_input(camera, event):
- var forward = false
- if event is InputEventMouseMotion:
- forward = true
- return forward
- [/codeblock]
+ return event is InputEventMouseMotion
+ [/gdscript]
+ [csharp]
+ // Consumes InputEventMouseMotion and forwards other InputEvent types.
+ public override bool ForwardSpatialGuiInput(Camera3D camera, InputEvent @event)
+ {
+ return @event is InputEventMouseMotion;
+ }
+ [/csharp]
+ [/codeblocks]
</description>
</method>
<method name="get_breakpoints" qualifiers="virtual">
@@ -291,13 +319,24 @@
Override this method in your plugin to return a [Texture2D] in order to give it an icon.
For main screen plugins, this appears at the top of the screen, to the right of the "2D", "3D", "Script", and "AssetLib" buttons.
Ideally, the plugin icon should be white with a transparent background and 16x16 pixels in size.
- [codeblock]
+ [codeblocks]
+ [gdscript]
func get_plugin_icon():
# You can use a custom icon:
return preload("res://addons/my_plugin/my_plugin_icon.svg")
# Or use a built-in icon:
return get_editor_interface().get_base_control().get_icon("Node", "EditorIcons")
- [/codeblock]
+ [/gdscript]
+ [csharp]
+ public override Texture2D GetPluginIcon()
+ {
+ // You can use a custom icon:
+ return ResourceLoader.Load&lt;Texture2D&gt;("res://addons/my_plugin/my_plugin_icon.svg");
+ // Or use a built-in icon:
+ return GetEditorInterface().GetBaseControl().GetIcon("Node", "EditorIcons");
+ }
+ [/csharp]
+ [/codeblocks]
</description>
</method>
<method name="get_plugin_name" qualifiers="virtual">
diff --git a/doc/classes/EditorScenePostImport.xml b/doc/classes/EditorScenePostImport.xml
index cb1f5d2e77..5cddecffa8 100644
--- a/doc/classes/EditorScenePostImport.xml
+++ b/doc/classes/EditorScenePostImport.xml
@@ -6,24 +6,50 @@
<description>
Imported scenes can be automatically modified right after import by setting their [b]Custom Script[/b] Import property to a [code]tool[/code] script that inherits from this class.
The [method post_import] callback receives the imported scene's root node and returns the modified version of the scene. Usage example:
- [codeblock]
- tool # Needed so it runs in editor
+ [codeblocks]
+ [gdscript]
+ tool # Needed so it runs in editor.
extends EditorScenePostImport
-
- # This sample changes all node names
-
- # Called right after the scene is imported and gets the root node
+ # This sample changes all node names.
+ # Called right after the scene is imported and gets the root node.
func post_import(scene):
# Change all node names to "modified_[oldnodename]"
iterate(scene)
return scene # Remember to return the imported scene
-
func iterate(node):
if node != null:
node.name = "modified_" + node.name
for child in node.get_children():
iterate(child)
- [/codeblock]
+ [/gdscript]
+ [csharp]
+ using Godot;
+
+ // This sample changes all node names.
+ // Called right after the scene is imported and gets the root node.
+ [Tool]
+ public class NodeRenamer : EditorScenePostImport
+ {
+ public override Object PostImport(Object scene)
+ {
+ // Change all node names to "modified_[oldnodename]"
+ Iterate(scene as Node);
+ return scene; // Remember to return the imported scene
+ }
+ public void Iterate(Node node)
+ {
+ if (node != null)
+ {
+ node.Name = "modified_" + node.Name;
+ foreach (Node child in node.GetChildren())
+ {
+ Iterate(child);
+ }
+ }
+ }
+ }
+ [/csharp]
+ [/codeblocks]
</description>
<tutorials>
<link title="Importing 3D scenes: Custom script">https://docs.godotengine.org/en/latest/getting_started/workflow/assets/importing_scenes.html#custom-script</link>
diff --git a/doc/classes/EditorScript.xml b/doc/classes/EditorScript.xml
index e96044bf48..60ccf451b8 100644
--- a/doc/classes/EditorScript.xml
+++ b/doc/classes/EditorScript.xml
@@ -7,13 +7,28 @@
Scripts extending this class and implementing its [method _run] method can be executed from the Script Editor's [b]File &gt; Run[/b] menu option (or by pressing [kbd]Ctrl + Shift + X[/kbd]) while the editor is running. This is useful for adding custom in-editor functionality to Godot. For more complex additions, consider using [EditorPlugin]s instead.
[b]Note:[/b] Extending scripts need to have [code]tool[/code] mode enabled.
[b]Example script:[/b]
- [codeblock]
+ [codeblocks]
+ [gdscript]
tool
extends EditorScript
func _run():
print("Hello from the Godot Editor!")
- [/codeblock]
+ [/gdscript]
+ [csharp]
+ using Godot;
+ using System;
+
+ [Tool]
+ public class HelloEditor : EditorScript
+ {
+ public override void _Run()
+ {
+ GD.Print("Hello from the Godot Editor!");
+ }
+ }
+ [/csharp]
+ [/codeblocks]
[b]Note:[/b] The script is run in the Editor context, which means the output is visible in the console window started with the Editor (stdout) instead of the usual Godot [b]Output[/b] dock.
</description>
<tutorials>
diff --git a/doc/classes/EditorSettings.xml b/doc/classes/EditorSettings.xml
index 0c6a2d61cd..6088ae7a43 100644
--- a/doc/classes/EditorSettings.xml
+++ b/doc/classes/EditorSettings.xml
@@ -7,15 +7,24 @@
Object that holds the project-independent editor settings. These settings are generally visible in the [b]Editor &gt; Editor Settings[/b] menu.
Property names use slash delimiters to distinguish sections. Setting values can be of any [Variant] type. It's recommended to use [code]snake_case[/code] for editor settings to be consistent with the Godot editor itself.
Accessing the settings can be done using the following methods, such as:
- [codeblock]
- # `settings.set("some/property", value)` also works as this class overrides `_set()` internally.
- settings.set_setting("some/property",value)
-
- # `settings.get("some/property", value)` also works as this class overrides `_get()` internally.
+ [codeblocks]
+ [gdscript]
+ var settings = EditorInterface.get_editor_settings()
+ # `settings.set("some/property", 10)` also works as this class overrides `_set()` internally.
+ settings.set_setting("some/property", 10)
+ # `settings.get("some/property")` also works as this class overrides `_get()` internally.
settings.get_setting("some/property")
-
var list_of_settings = settings.get_property_list()
- [/codeblock]
+ [/gdscript]
+ [csharp]
+ EditorSettings settings = GetEditorInterface().GetEditorSettings();
+ // `settings.set("some/property", value)` also works as this class overrides `_set()` internally.
+ settings.SetSetting("some/property", Value);
+ // `settings.get("some/property", value)` also works as this class overrides `_get()` internally.
+ settings.GetSetting("some/property");
+ Godot.Collections.Array listOfSettings = settings.GetPropertyList();
+ [/csharp]
+ [/codeblocks]
[b]Note:[/b] This class shouldn't be instantiated directly. Instead, access the singleton using [method EditorInterface.get_editor_settings].
</description>
<tutorials>
@@ -32,8 +41,10 @@
- [code]type[/code]: [int] (see [enum Variant.Type])
- optionally [code]hint[/code]: [int] (see [enum PropertyHint]) and [code]hint_string[/code]: [String]
[b]Example:[/b]
- [codeblock]
- editor_settings.set("category/property_name", 0)
+ [codeblocks]
+ [gdscript]
+ var settings = EditorInterface.get_editor_settings()
+ settings.set("category/property_name", 0)
var property_info = {
"name": "category/property_name",
@@ -42,8 +53,23 @@
"hint_string": "one,two,three"
}
- editor_settings.add_property_info(property_info)
- [/codeblock]
+ settings.add_property_info(property_info)
+ [/gdscript]
+ [csharp]
+ var settings = GetEditorInterface().GetEditorSettings();
+ settings.Set("category/property_name", 0);
+
+ var propertyInfo = new Godot.Collections.Dictionary
+ {
+ {"name", "category/propertyName"},
+ {"type", Variant.Type.Int},
+ {"hint", PropertyHint.Enum},
+ {"hint_string", "one,two,three"}
+ };
+
+ settings.AddPropertyInfo(propertyInfo);
+ [/csharp]
+ [/codeblocks]
</description>
</method>
<method name="erase">
diff --git a/doc/classes/EditorTranslationParserPlugin.xml b/doc/classes/EditorTranslationParserPlugin.xml
index f5204e7bab..c97459d9dc 100644
--- a/doc/classes/EditorTranslationParserPlugin.xml
+++ b/doc/classes/EditorTranslationParserPlugin.xml
@@ -9,45 +9,95 @@
When adding to [code]msgids_context_plural[/code], you must add the data using the format [code]["A", "B", "C"][/code], where [code]A[/code] represents the extracted string, [code]B[/code] represents the context, and [code]C[/code] represents the plural version of the extracted string. If you want to add only context but not plural, put [code]""[/code] for the plural slot. The idea is the same if you only want to add plural but not context. See the code below for concrete examples.
The extracted strings will be written into a POT file selected by user under "POT Generation" in "Localization" tab in "Project Settings" menu.
Below shows an example of a custom parser that extracts strings from a CSV file to write into a POT.
- [codeblock]
+ [codeblocks]
+ [gdscript]
tool
extends EditorTranslationParserPlugin
-
func parse_file(path, msgids, msgids_context_plural):
var file = File.new()
file.open(path, File.READ)
var text = file.get_as_text()
- var split_strs = text.split(",", false, 0)
+ var split_strs = text.split(",", false)
for s in split_strs:
msgids.append(s)
#print("Extracted string: " + s)
-
func get_recognized_extensions():
return ["csv"]
- [/codeblock]
+ [/gdscript]
+ [csharp]
+ using Godot;
+ using System;
+
+ [Tool]
+ public class CustomParser : EditorTranslationParserPlugin
+ {
+ public override void ParseFile(string path, Godot.Collections.Array msgids, Godot.Collections.Array msgidsContextPlural)
+ {
+ var file = new File();
+ file.Open(path, File.ModeFlags.Read);
+ string text = file.GetAsText();
+ string[] splitStrs = text.Split(",", false);
+ foreach (var s in splitStrs)
+ {
+ msgids.Add(s);
+ //GD.Print("Extracted string: " + s)
+ }
+ }
+
+ public override Godot.Collections.Array GetRecognizedExtensions()
+ {
+ return new Godot.Collections.Array{"csv"};
+ }
+ }
+ [/csharp]
+ [/codeblocks]
To add a translatable string associated with context or plural, add it to [code]msgids_context_plural[/code]:
- [codeblock]
+ [codeblocks]
+ [gdscript]
# This will add a message with msgid "Test 1", msgctxt "context", and msgid_plural "test 1 plurals".
msgids_context_plural.append(["Test 1", "context", "test 1 plurals"])
# This will add a message with msgid "A test without context" and msgid_plural "plurals".
msgids_context_plural.append(["A test without context", "", "plurals"])
# This will add a message with msgid "Only with context" and msgctxt "a friendly context".
msgids_context_plural.append(["Only with context", "a friendly context", ""])
- [/codeblock]
+ [/gdscript]
+ [csharp]
+ // This will add a message with msgid "Test 1", msgctxt "context", and msgid_plural "test 1 plurals".
+ msgidsContextPlural.Add(new Godot.Collections.Array{"Test 1", "context", "test 1 Plurals"});
+ // This will add a message with msgid "A test without context" and msgid_plural "plurals".
+ msgidsContextPlural.Add(new Godot.Collections.Array{"A test without context", "", "plurals"});
+ // This will add a message with msgid "Only with context" and msgctxt "a friendly context".
+ msgidsContextPlural.Add(new Godot.Collections.Array{"Only with context", "a friendly context", ""});
+ [/csharp]
+ [/codeblocks]
[b]Note:[/b] If you override parsing logic for standard script types (GDScript, C#, etc.), it would be better to load the [code]path[/code] argument using [method ResourceLoader.load]. This is because built-in scripts are loaded as [Resource] type, not [File] type.
For example:
- [codeblock]
+ [codeblocks]
+ [gdscript]
func parse_file(path, msgids, msgids_context_plural):
var res = ResourceLoader.load(path, "Script")
- var text = res.get_source_code()
+ var text = res.source_code
# Parsing logic.
-
func get_recognized_extensions():
return ["gd"]
- [/codeblock]
+ [/gdscript]
+ [csharp]
+ public override void ParseFile(string path, Godot.Collections.Array msgids, Godot.Collections.Array msgidsContextPlural)
+ {
+ var res = ResourceLoader.Load&lt;Script&gt;(path, "Script");
+ string text = res.SourceCode;
+ // Parsing logic.
+ }
+
+ public override Godot.Collections.Array GetRecognizedExtensions()
+ {
+ return new Godot.Collections.Array{"gd"};
+ }
+ [/csharp]
+ [/codeblocks]
</description>
<tutorials>
</tutorials>
diff --git a/doc/classes/Engine.xml b/doc/classes/Engine.xml
index 297cccaaac..fab8512e4a 100644
--- a/doc/classes/Engine.xml
+++ b/doc/classes/Engine.xml
@@ -117,12 +117,24 @@
[code]year[/code] - Holds the year the version was released in as an int
[code]string[/code] - [code]major[/code] + [code]minor[/code] + [code]patch[/code] + [code]status[/code] + [code]build[/code] in a single String
The [code]hex[/code] value is encoded as follows, from left to right: one byte for the major, one byte for the minor, one byte for the patch version. For example, "3.1.12" would be [code]0x03010C[/code]. [b]Note:[/b] It's still an int internally, and printing it will give you its decimal representation, which is not particularly meaningful. Use hexadecimal literals for easy version comparisons from code:
- [codeblock]
+ [codeblocks]
+ [gdscript]
if Engine.get_version_info().hex &gt;= 0x030200:
# Do things specific to version 3.2 or later
else:
# Do things specific to versions before 3.2
- [/codeblock]
+ [/gdscript]
+ [csharp]
+ if ((int)Engine.GetVersionInfo()["hex"] &gt;= 0x030200)
+ {
+ // Do things specific to version 3.2 or later
+ }
+ else
+ {
+ // Do things specific to versions before 3.2
+ }
+ [/csharp]
+ [/codeblocks]
</description>
</method>
<method name="has_singleton" qualifiers="const">
diff --git a/doc/classes/Expression.xml b/doc/classes/Expression.xml
index f2611dc850..d777c6fd9d 100644
--- a/doc/classes/Expression.xml
+++ b/doc/classes/Expression.xml
@@ -7,21 +7,46 @@
An expression can be made of any arithmetic operation, built-in math function call, method call of a passed instance, or built-in type construction call.
An example expression text using the built-in math functions could be [code]sqrt(pow(3, 2) + pow(4, 2))[/code].
In the following example we use a [LineEdit] node to write our expression and show the result.
- [codeblock]
- onready var expression = Expression.new()
+ [codeblocks]
+ [gdscript]
+ var expression = Expression.new()
func _ready():
$LineEdit.connect("text_entered", self, "_on_text_entered")
func _on_text_entered(command):
- var error = expression.parse(command, [])
+ var error = expression.parse(command)
if error != OK:
print(expression.get_error_text())
return
- var result = expression.execute([], null, true)
+ var result = expression.execute()
if not expression.has_execute_failed():
$LineEdit.text = str(result)
- [/codeblock]
+ [/gdscript]
+ [csharp]
+ public Expression expression = new Expression();
+
+ public override void _Ready()
+ {
+ GetNode("LineEdit").Connect("text_entered", this, nameof(OnTextEntered));
+ }
+
+ private void OnTextEntered(string command)
+ {
+ Error error = expression.Parse(command);
+ if (error != Error.Ok)
+ {
+ GD.Print(expression.GetErrorText());
+ return;
+ }
+ object result = expression.Execute();
+ if (!expression.HasExecuteFailed())
+ {
+ GetNode&lt;LineEdit&gt;("LineEdit").Text = result.ToString();
+ }
+ }
+ [/csharp]
+ [/codeblocks]
</description>
<tutorials>
</tutorials>
diff --git a/doc/classes/FuncRef.xml b/doc/classes/FuncRef.xml
deleted file mode 100644
index dc9246ad35..0000000000
--- a/doc/classes/FuncRef.xml
+++ /dev/null
@@ -1,53 +0,0 @@
-<?xml version="1.0" encoding="UTF-8" ?>
-<class name="FuncRef" inherits="Reference" version="4.0">
- <brief_description>
- Reference to a function in an object.
- </brief_description>
- <description>
- In GDScript, functions are not [i]first-class objects[/i]. This means it is impossible to store them directly as variables, return them from another function, or pass them as arguments.
- However, by creating a [FuncRef] using the [method @GDScript.funcref] function, a reference to a function in a given object can be created, passed around and called.
- </description>
- <tutorials>
- </tutorials>
- <methods>
- <method name="call_func" qualifiers="vararg">
- <return type="Variant">
- </return>
- <description>
- Calls the referenced function previously set in [member function] or [method @GDScript.funcref].
- </description>
- </method>
- <method name="call_funcv">
- <return type="Variant">
- </return>
- <argument index="0" name="arg_array" type="Array">
- </argument>
- <description>
- Calls the referenced function previously set in [member function] or [method @GDScript.funcref]. Contrarily to [method call_func], this method does not support a variable number of arguments but expects all parameters to be passed via a single [Array].
- </description>
- </method>
- <method name="is_valid" qualifiers="const">
- <return type="bool">
- </return>
- <description>
- Returns whether the object still exists and has the function assigned.
- </description>
- </method>
- <method name="set_instance">
- <return type="void">
- </return>
- <argument index="0" name="instance" type="Object">
- </argument>
- <description>
- The object containing the referenced function. This object must be of a type actually inheriting from [Object], not a built-in type such as [int], [Vector2] or [Dictionary].
- </description>
- </method>
- </methods>
- <members>
- <member name="function" type="StringName" setter="set_function" getter="get_function" default="@&quot;&quot;">
- The name of the referenced function.
- </member>
- </members>
- <constants>
- </constants>
-</class>
diff --git a/doc/classes/HTTPClient.xml b/doc/classes/HTTPClient.xml
index 9dc38b018a..ec8ca7456a 100644
--- a/doc/classes/HTTPClient.xml
+++ b/doc/classes/HTTPClient.xml
@@ -9,6 +9,7 @@
A [HTTPClient] should be reused between multiple requests or to connect to different hosts instead of creating one client per request. Supports SSL and SSL server certificate verification. HTTP status codes in the 2xx range indicate success, 3xx redirection (i.e. "try again, but over here"), 4xx something was wrong with the request, and 5xx something went wrong on the server's side.
For more information on HTTP, see https://developer.mozilla.org/en-US/docs/Web/HTTP (or read RFC 2616 to get it straight from the source: https://tools.ietf.org/html/rfc2616).
[b]Note:[/b] When performing HTTP requests from a project exported to HTML5, keep in mind the remote server may not allow requests from foreign origins due to [url=https://developer.mozilla.org/en-US/docs/Web/HTTP/CORS]CORS[/url]. If you host the server in question, you should modify its backend to allow requests from foreign origins by adding the [code]Access-Control-Allow-Origin: *[/code] HTTP header.
+ [b]Note:[/b] SSL/TLS support is currently limited to TLS 1.0, TLS 1.1, and TLS 1.2. Attempting to connect to a TLS 1.3-only server will return an error.
</description>
<tutorials>
<link title="HTTP client class">https://docs.godotengine.org/en/latest/tutorials/networking/http_client_class.html</link>
@@ -180,7 +181,7 @@
<member name="connection" type="StreamPeer" setter="set_connection" getter="get_connection">
The connection to use for this client.
</member>
- <member name="read_chunk_size" type="int" setter="set_read_chunk_size" getter="get_read_chunk_size" default="4096">
+ <member name="read_chunk_size" type="int" setter="set_read_chunk_size" getter="get_read_chunk_size" default="65536">
The size of the buffer used and maximum bytes to read per iteration. See [method read_response_body_chunk].
</member>
</members>
diff --git a/doc/classes/HTTPRequest.xml b/doc/classes/HTTPRequest.xml
index 04429d587f..6eae881ffe 100644
--- a/doc/classes/HTTPRequest.xml
+++ b/doc/classes/HTTPRequest.xml
@@ -65,11 +65,9 @@
texture_rect.texture = texture
[/codeblock]
- [b]Gzipped response bodies[/b]
- HttpRequest will automatically handle decompression of response bodies.
- A "Accept-Encoding" header will be automatically added to each of your requests, unless one is already specified.
- Any response with a "Content-Encoding: gzip" header will automatically be decompressed and delivered to you as a uncompressed bytes.
+ [b]Gzipped response bodies[/b]: HTTPRequest will automatically handle decompression of response bodies. A [code]Accept-Encoding[/code] header will be automatically added to each of your requests, unless one is already specified. Any response with a [code]Content-Encoding: gzip[/code] header will automatically be decompressed and delivered to you as uncompressed bytes.
[b]Note:[/b] When performing HTTP requests from a project exported to HTML5, keep in mind the remote server may not allow requests from foreign origins due to [url=https://developer.mozilla.org/en-US/docs/Web/HTTP/CORS]CORS[/url]. If you host the server in question, you should modify its backend to allow requests from foreign origins by adding the [code]Access-Control-Allow-Origin: *[/code] HTTP header.
+ [b]Note:[/b] SSL/TLS support is currently limited to TLS 1.0, TLS 1.1, and TLS 1.2. Attempting to connect to a TLS 1.3-only server will return an error.
</description>
<tutorials>
<link title="Making HTTP requests">https://docs.godotengine.org/en/latest/tutorials/networking/http_request_class.html</link>
@@ -153,9 +151,9 @@
<member name="body_size_limit" type="int" setter="set_body_size_limit" getter="get_body_size_limit" default="-1">
Maximum allowed size for response bodies. If the response body is compressed, this will be used as the maximum allowed size for the decompressed body.
</member>
- <member name="download_chunk_size" type="int" setter="set_download_chunk_size" getter="get_download_chunk_size" default="4096">
+ <member name="download_chunk_size" type="int" setter="set_download_chunk_size" getter="get_download_chunk_size" default="65536">
The size of the buffer used and maximum bytes to read per iteration. See [member HTTPClient.read_chunk_size].
- Set this to a higher value (e.g. 65536 for 64 KiB) when downloading large files to achieve better speeds at the cost of memory.
+ Set this to a lower value (e.g. 4096 for 4 KiB) when downloading small files to decrease memory usage at the cost of download speeds.
</member>
<member name="download_file" type="String" setter="set_download_file" getter="get_download_file" default="&quot;&quot;">
The file to download into. Will output any received file into it.
diff --git a/doc/classes/Image.xml b/doc/classes/Image.xml
index 20be20db34..3b108468de 100644
--- a/doc/classes/Image.xml
+++ b/doc/classes/Image.xml
@@ -346,6 +346,16 @@
Loads an image from file [code]path[/code]. See [url=https://docs.godotengine.org/en/latest/getting_started/workflow/assets/importing_images.html#supported-image-formats]Supported image formats[/url] for a list of supported image formats and limitations.
</description>
</method>
+ <method name="load_bmp_from_buffer">
+ <return type="int" enum="Error">
+ </return>
+ <argument index="0" name="buffer" type="PackedByteArray">
+ </argument>
+ <description>
+ Loads an image from the binary contents of a BMP file.
+ [b]Note:[/b] Godot's BMP module doesn't support 16-bit per pixel images. Only 1-bit, 4-bit, 8-bit, 24-bit, and 32-bit per pixel images are supported.
+ </description>
+ </method>
<method name="load_jpg_from_buffer">
<return type="int" enum="Error">
</return>
diff --git a/doc/classes/NodePath.xml b/doc/classes/NodePath.xml
index f711ba4d6b..980bea0d9f 100644
--- a/doc/classes/NodePath.xml
+++ b/doc/classes/NodePath.xml
@@ -28,6 +28,22 @@
<method name="NodePath">
<return type="NodePath">
</return>
+ <description>
+ Constructs an empty [NodePath].
+ </description>
+ </method>
+ <method name="NodePath">
+ <return type="NodePath">
+ </return>
+ <argument index="0" name="from" type="NodePath">
+ </argument>
+ <description>
+ Constructs a [NodePath] as a copy of the given [NodePath].
+ </description>
+ </method>
+ <method name="NodePath">
+ <return type="NodePath">
+ </return>
<argument index="0" name="from" type="String">
</argument>
<description>
diff --git a/doc/classes/PackedByteArray.xml b/doc/classes/PackedByteArray.xml
index 7c2d566466..5ac5f15fb2 100644
--- a/doc/classes/PackedByteArray.xml
+++ b/doc/classes/PackedByteArray.xml
@@ -13,6 +13,22 @@
<method name="PackedByteArray">
<return type="PackedByteArray">
</return>
+ <description>
+ Constructs an empty [PackedByteArray].
+ </description>
+ </method>
+ <method name="PackedByteArray">
+ <return type="PackedByteArray">
+ </return>
+ <argument index="0" name="from" type="PackedByteArray">
+ </argument>
+ <description>
+ Constructs a [PackedByteArray] as a copy of the given [PackedByteArray].
+ </description>
+ </method>
+ <method name="PackedByteArray">
+ <return type="PackedByteArray">
+ </return>
<argument index="0" name="from" type="Array">
</argument>
<description>
diff --git a/doc/classes/PackedColorArray.xml b/doc/classes/PackedColorArray.xml
index c42d14c5bd..e4b9e02be7 100644
--- a/doc/classes/PackedColorArray.xml
+++ b/doc/classes/PackedColorArray.xml
@@ -13,6 +13,22 @@
<method name="PackedColorArray">
<return type="PackedColorArray">
</return>
+ <description>
+ Constructs an empty [PackedColorArray].
+ </description>
+ </method>
+ <method name="PackedColorArray">
+ <return type="PackedColorArray">
+ </return>
+ <argument index="0" name="from" type="PackedColorArray">
+ </argument>
+ <description>
+ Constructs a [PackedColorArray] as a copy of the given [PackedColorArray].
+ </description>
+ </method>
+ <method name="PackedColorArray">
+ <return type="PackedColorArray">
+ </return>
<argument index="0" name="from" type="Array">
</argument>
<description>
diff --git a/doc/classes/PackedFloat32Array.xml b/doc/classes/PackedFloat32Array.xml
index dd84648251..1b2091f72b 100644
--- a/doc/classes/PackedFloat32Array.xml
+++ b/doc/classes/PackedFloat32Array.xml
@@ -14,6 +14,22 @@
<method name="PackedFloat32Array">
<return type="PackedFloat32Array">
</return>
+ <description>
+ Constructs an empty [PackedFloat32Array].
+ </description>
+ </method>
+ <method name="PackedFloat32Array">
+ <return type="PackedFloat32Array">
+ </return>
+ <argument index="0" name="from" type="PackedFloat32Array">
+ </argument>
+ <description>
+ Constructs a [PackedFloat32Array] as a copy of the given [PackedFloat32Array].
+ </description>
+ </method>
+ <method name="PackedFloat32Array">
+ <return type="PackedFloat32Array">
+ </return>
<argument index="0" name="from" type="Array">
</argument>
<description>
diff --git a/doc/classes/PackedFloat64Array.xml b/doc/classes/PackedFloat64Array.xml
index 91c3f4874b..a55ac6bacc 100644
--- a/doc/classes/PackedFloat64Array.xml
+++ b/doc/classes/PackedFloat64Array.xml
@@ -14,6 +14,22 @@
<method name="PackedFloat64Array">
<return type="PackedFloat64Array">
</return>
+ <description>
+ Constructs an empty [PackedFloat64Array].
+ </description>
+ </method>
+ <method name="PackedFloat64Array">
+ <return type="PackedFloat64Array">
+ </return>
+ <argument index="0" name="from" type="PackedFloat64Array">
+ </argument>
+ <description>
+ Constructs a [PackedFloat64Array] as a copy of the given [PackedFloat64Array].
+ </description>
+ </method>
+ <method name="PackedFloat64Array">
+ <return type="PackedFloat64Array">
+ </return>
<argument index="0" name="from" type="Array">
</argument>
<description>
diff --git a/doc/classes/PackedInt32Array.xml b/doc/classes/PackedInt32Array.xml
index a0a9922d0c..ecf8abd1eb 100644
--- a/doc/classes/PackedInt32Array.xml
+++ b/doc/classes/PackedInt32Array.xml
@@ -14,6 +14,22 @@
<method name="PackedInt32Array">
<return type="PackedInt32Array">
</return>
+ <description>
+ Constructs an empty [PackedInt32Array].
+ </description>
+ </method>
+ <method name="PackedInt32Array">
+ <return type="PackedInt32Array">
+ </return>
+ <argument index="0" name="from" type="PackedInt32Array">
+ </argument>
+ <description>
+ Constructs a [PackedInt32Array] as a copy of the given [PackedInt32Array].
+ </description>
+ </method>
+ <method name="PackedInt32Array">
+ <return type="PackedInt32Array">
+ </return>
<argument index="0" name="from" type="Array">
</argument>
<description>
diff --git a/doc/classes/PackedInt64Array.xml b/doc/classes/PackedInt64Array.xml
index 542dabcfa0..a254a6ff5f 100644
--- a/doc/classes/PackedInt64Array.xml
+++ b/doc/classes/PackedInt64Array.xml
@@ -14,6 +14,22 @@
<method name="PackedInt64Array">
<return type="PackedInt64Array">
</return>
+ <description>
+ Constructs an empty [PackedInt64Array].
+ </description>
+ </method>
+ <method name="PackedInt64Array">
+ <return type="PackedInt64Array">
+ </return>
+ <argument index="0" name="from" type="PackedInt64Array">
+ </argument>
+ <description>
+ Constructs a [PackedInt64Array] as a copy of the given [PackedInt64Array].
+ </description>
+ </method>
+ <method name="PackedInt64Array">
+ <return type="PackedInt64Array">
+ </return>
<argument index="0" name="from" type="Array">
</argument>
<description>
diff --git a/doc/classes/PackedStringArray.xml b/doc/classes/PackedStringArray.xml
index 7c710cf0fb..c50ec38a93 100644
--- a/doc/classes/PackedStringArray.xml
+++ b/doc/classes/PackedStringArray.xml
@@ -14,6 +14,22 @@
<method name="PackedStringArray">
<return type="PackedStringArray">
</return>
+ <description>
+ Constructs an empty [PackedStringArray].
+ </description>
+ </method>
+ <method name="PackedStringArray">
+ <return type="PackedStringArray">
+ </return>
+ <argument index="0" name="from" type="PackedStringArray">
+ </argument>
+ <description>
+ Constructs a [PackedStringArray] as a copy of the given [PackedStringArray].
+ </description>
+ </method>
+ <method name="PackedStringArray">
+ <return type="PackedStringArray">
+ </return>
<argument index="0" name="from" type="Array">
</argument>
<description>
diff --git a/doc/classes/PackedVector2Array.xml b/doc/classes/PackedVector2Array.xml
index 98034afc93..0bd658c488 100644
--- a/doc/classes/PackedVector2Array.xml
+++ b/doc/classes/PackedVector2Array.xml
@@ -14,6 +14,22 @@
<method name="PackedVector2Array">
<return type="PackedVector2Array">
</return>
+ <description>
+ Constructs an empty [PackedVector2Array].
+ </description>
+ </method>
+ <method name="PackedVector2Array">
+ <return type="PackedVector2Array">
+ </return>
+ <argument index="0" name="from" type="PackedVector2Array">
+ </argument>
+ <description>
+ Constructs a [PackedVector2Array] as a copy of the given [PackedVector2Array].
+ </description>
+ </method>
+ <method name="PackedVector2Array">
+ <return type="PackedVector2Array">
+ </return>
<argument index="0" name="from" type="Array">
</argument>
<description>
diff --git a/doc/classes/PackedVector3Array.xml b/doc/classes/PackedVector3Array.xml
index 3db33fbcd9..5b835f2fbf 100644
--- a/doc/classes/PackedVector3Array.xml
+++ b/doc/classes/PackedVector3Array.xml
@@ -13,6 +13,22 @@
<method name="PackedVector3Array">
<return type="PackedVector3Array">
</return>
+ <description>
+ Constructs an empty [PackedVector3Array].
+ </description>
+ </method>
+ <method name="PackedVector3Array">
+ <return type="PackedVector3Array">
+ </return>
+ <argument index="0" name="from" type="PackedVector3Array">
+ </argument>
+ <description>
+ Constructs a [PackedVector3Array] as a copy of the given [PackedVector3Array].
+ </description>
+ </method>
+ <method name="PackedVector3Array">
+ <return type="PackedVector3Array">
+ </return>
<argument index="0" name="from" type="Array">
</argument>
<description>
diff --git a/doc/classes/Plane.xml b/doc/classes/Plane.xml
index 9352eee1eb..bb0b25a552 100644
--- a/doc/classes/Plane.xml
+++ b/doc/classes/Plane.xml
@@ -13,6 +13,22 @@
<method name="Plane">
<return type="Plane">
</return>
+ <description>
+ Constructs a default-initialized [Plane] with all components set to [code]0[/code].
+ </description>
+ </method>
+ <method name="Plane">
+ <return type="Plane">
+ </return>
+ <argument index="0" name="from" type="Plane">
+ </argument>
+ <description>
+ Constructs a [Plane] as a copy of the given [Plane].
+ </description>
+ </method>
+ <method name="Plane">
+ <return type="Plane">
+ </return>
<argument index="0" name="a" type="float">
</argument>
<argument index="1" name="b" type="float">
@@ -28,25 +44,36 @@
<method name="Plane">
<return type="Plane">
</return>
- <argument index="0" name="v1" type="Vector3">
+ <argument index="0" name="normal" type="Vector3">
+ </argument>
+ <argument index="1" name="d" type="float">
</argument>
- <argument index="1" name="v2" type="Vector3">
+ <description>
+ Creates a plane from the normal and the plane's distance to the origin.
+ </description>
+ </method>
+ <method name="Plane">
+ <return type="Plane">
+ </return>
+ <argument index="0" name="point" type="Vector3">
</argument>
- <argument index="2" name="v3" type="Vector3">
+ <argument index="1" name="normal" type="Vector3">
</argument>
<description>
- Creates a plane from the three points, given in clockwise order.
+ Creates a plane from the given position and a plane normal.
</description>
</method>
<method name="Plane">
<return type="Plane">
</return>
- <argument index="0" name="normal" type="Vector3">
+ <argument index="0" name="point1" type="Vector3">
</argument>
- <argument index="1" name="d" type="float">
+ <argument index="1" name="point2" type="Vector3">
+ </argument>
+ <argument index="2" name="point3" type="Vector3">
</argument>
<description>
- Creates a plane from the normal and the plane's distance to the origin.
+ Creates a plane from the three points, given in clockwise order.
</description>
</method>
<method name="center">
diff --git a/doc/classes/ProjectSettings.xml b/doc/classes/ProjectSettings.xml
index 856c2e7c37..7ca2dae4d7 100644
--- a/doc/classes/ProjectSettings.xml
+++ b/doc/classes/ProjectSettings.xml
@@ -435,19 +435,24 @@
If [code]true[/code], the home indicator is hidden automatically. This only affects iOS devices without a physical home button.
</member>
<member name="display/window/size/always_on_top" type="bool" setter="" getter="" default="false">
- Force the window to be always on top.
+ Forces the main window to be always on top.
+ [b]Note:[/b] This setting is ignored on iOS, Android, and HTML5.
</member>
<member name="display/window/size/borderless" type="bool" setter="" getter="" default="false">
- Force the window to be borderless.
+ Forces the main window to be borderless.
+ [b]Note:[/b] This setting is ignored on iOS, Android, and HTML5.
</member>
<member name="display/window/size/fullscreen" type="bool" setter="" getter="" default="false">
- Sets the window to full screen when it starts.
+ Sets the main window to full screen when the project starts. Note that this is not [i]exclusive[/i] fullscreen. On Windows and Linux, a borderless window is used to emulate fullscreen. On macOS, a new desktop is used to display the running project.
+ Regardless of the platform, enabling fullscreen will change the window size to match the monitor's size. Therefore, make sure your project supports [url=https://docs.godotengine.org/en/latest/tutorials/rendering/multiple_resolutions.html]multiple resolutions[/url] when enabling fullscreen mode.
+ [b]Note:[/b] This setting is ignored on iOS, Android, and HTML5.
</member>
<member name="display/window/size/height" type="int" setter="" getter="" default="600">
Sets the game's main viewport height. On desktop platforms, this is the default window size. Stretch mode settings also use this as a reference when enabled.
</member>
<member name="display/window/size/resizable" type="bool" setter="" getter="" default="true">
Allows the window to be resizable by default.
+ [b]Note:[/b] This setting is ignored on iOS and Android.
</member>
<member name="display/window/size/test_height" type="int" setter="" getter="" default="0">
If greater than zero, overrides the window height when running the game. Useful for testing stretch modes.
diff --git a/doc/classes/Quat.xml b/doc/classes/Quat.xml
index 76cfa0d99d..edfe99a8b8 100644
--- a/doc/classes/Quat.xml
+++ b/doc/classes/Quat.xml
@@ -16,16 +16,27 @@
<method name="Quat">
<return type="Quat">
</return>
- <argument index="0" name="x" type="float">
- </argument>
- <argument index="1" name="y" type="float">
+ <description>
+ Constructs a default-initialized quaternion with all components set to [code]0[/code].
+ </description>
+ </method>
+ <method name="Quat">
+ <return type="Quat">
+ </return>
+ <argument index="0" name="from" type="Quat">
</argument>
- <argument index="2" name="z" type="float">
+ <description>
+ Constructs a [Quat] as a copy of the given [Quat].
+ </description>
+ </method>
+ <method name="Quat">
+ <return type="Quat">
+ </return>
+ <argument index="0" name="arc_from" type="Vector3">
</argument>
- <argument index="3" name="w" type="float">
+ <argument index="1" name="arc_to" type="Vector3">
</argument>
<description>
- Constructs a quaternion defined by the given values.
</description>
</method>
<method name="Quat">
@@ -57,6 +68,21 @@
Constructs a quaternion from the given [Basis].
</description>
</method>
+ <method name="Quat">
+ <return type="Quat">
+ </return>
+ <argument index="0" name="x" type="float">
+ </argument>
+ <argument index="1" name="y" type="float">
+ </argument>
+ <argument index="2" name="z" type="float">
+ </argument>
+ <argument index="3" name="w" type="float">
+ </argument>
+ <description>
+ Constructs a quaternion defined by the given values.
+ </description>
+ </method>
<method name="cubic_slerp">
<return type="Quat">
</return>
diff --git a/doc/classes/RID.xml b/doc/classes/RID.xml
index 644c427120..d944f7a86a 100644
--- a/doc/classes/RID.xml
+++ b/doc/classes/RID.xml
@@ -12,10 +12,17 @@
<method name="RID">
<return type="RID">
</return>
- <argument index="0" name="from" type="Object">
+ <description>
+ Constructs an empty [RID] with the invalid ID [code]0[/code].
+ </description>
+ </method>
+ <method name="RID">
+ <return type="RID">
+ </return>
+ <argument index="0" name="from" type="RID">
</argument>
<description>
- Creates a new RID instance with the ID of a given resource. When not handed a valid resource, silently stores the unused ID 0.
+ Constructs a [RID] as a copy of the given [RID].
</description>
</method>
<method name="get_id">
diff --git a/doc/classes/Rect2.xml b/doc/classes/Rect2.xml
index a72ba35a98..b970d0188c 100644
--- a/doc/classes/Rect2.xml
+++ b/doc/classes/Rect2.xml
@@ -17,6 +17,31 @@
<method name="Rect2">
<return type="Rect2">
</return>
+ <description>
+ Constructs a default-initialized [Rect2] with default (zero) values of [member position] and [member size].
+ </description>
+ </method>
+ <method name="Rect2">
+ <return type="Rect2">
+ </return>
+ <argument index="0" name="from" type="Rect2">
+ </argument>
+ <description>
+ Constructs a [Rect2] as a copy of the given [Rect2].
+ </description>
+ </method>
+ <method name="Rect2">
+ <return type="Rect2">
+ </return>
+ <argument index="0" name="from" type="Rect2i">
+ </argument>
+ <description>
+ Constructs a [Rect2] from a [Rect2i].
+ </description>
+ </method>
+ <method name="Rect2">
+ <return type="Rect2">
+ </return>
<argument index="0" name="position" type="Vector2">
</argument>
<argument index="1" name="size" type="Vector2">
@@ -40,15 +65,6 @@
Constructs a [Rect2] by x, y, width, and height.
</description>
</method>
- <method name="Rect2">
- <return type="Rect2">
- </return>
- <argument index="0" name="from" type="Rect2i">
- </argument>
- <description>
- Constructs a [Rect2] from a [Rect2i].
- </description>
- </method>
<method name="abs">
<return type="Rect2">
</return>
diff --git a/doc/classes/Rect2i.xml b/doc/classes/Rect2i.xml
index de2932e816..5c9162baf4 100644
--- a/doc/classes/Rect2i.xml
+++ b/doc/classes/Rect2i.xml
@@ -15,6 +15,31 @@
<method name="Rect2i">
<return type="Rect2i">
</return>
+ <description>
+ Constructs a default-initialized [Rect2i] with default (zero) values of [member position] and [member size].
+ </description>
+ </method>
+ <method name="Rect2i">
+ <return type="Rect2i">
+ </return>
+ <argument index="0" name="from" type="Rect2i">
+ </argument>
+ <description>
+ Constructs a [Rect2i] as a copy of the given [Rect2i].
+ </description>
+ </method>
+ <method name="Rect2i">
+ <return type="Rect2i">
+ </return>
+ <argument index="0" name="from" type="Rect2">
+ </argument>
+ <description>
+ Constructs a new [Rect2i] from [Rect2]. The floating point coordinates will be truncated.
+ </description>
+ </method>
+ <method name="Rect2i">
+ <return type="Rect2i">
+ </return>
<argument index="0" name="position" type="Vector2i">
</argument>
<argument index="1" name="size" type="Vector2i">
@@ -38,15 +63,6 @@
Constructs a [Rect2i] by x, y, width, and height.
</description>
</method>
- <method name="Rect2i">
- <return type="Rect2i">
- </return>
- <argument index="0" name="from" type="Rect2">
- </argument>
- <description>
- Constructs a new [Rect2i] from [Rect2]. The floating point coordinates will be truncated.
- </description>
- </method>
<method name="abs">
<return type="Rect2i">
</return>
diff --git a/doc/classes/Signal.xml b/doc/classes/Signal.xml
index 51490caf6f..bd091899ac 100644
--- a/doc/classes/Signal.xml
+++ b/doc/classes/Signal.xml
@@ -11,12 +11,28 @@
<method name="Signal">
<return type="Signal">
</return>
+ <description>
+ Constructs a null [Signal] with no object nor signal name bound.
+ </description>
+ </method>
+ <method name="Signal">
+ <return type="Signal">
+ </return>
+ <argument index="0" name="from" type="Signal">
+ </argument>
+ <description>
+ Constructs a [Signal] as a copy of the given [Signal].
+ </description>
+ </method>
+ <method name="Signal">
+ <return type="Signal">
+ </return>
<argument index="0" name="object" type="Object">
</argument>
- <argument index="1" name="signal_name" type="StringName">
+ <argument index="1" name="signal" type="StringName">
</argument>
<description>
- Creates a new signal named [code]signal_name[/code] in the given object.
+ Creates a new [Signal] with the name [code]signal[/code] in the specified [code]object[/code].
</description>
</method>
<method name="connect">
diff --git a/doc/classes/String.xml b/doc/classes/String.xml
index fcd8f57cd1..a600a575aa 100644
--- a/doc/classes/String.xml
+++ b/doc/classes/String.xml
@@ -13,154 +13,17 @@
<method name="String">
<return type="String">
</return>
- <argument index="0" name="from" type="bool">
- </argument>
- <description>
- Constructs a new String from the given [bool].
- </description>
- </method>
- <method name="String">
- <return type="String">
- </return>
- <argument index="0" name="from" type="int">
- </argument>
- <description>
- Constructs a new String from the given [int].
- </description>
- </method>
- <method name="String">
- <return type="String">
- </return>
- <argument index="0" name="from" type="float">
- </argument>
- <description>
- Constructs a new String from the given [float].
- </description>
- </method>
- <method name="String">
- <return type="String">
- </return>
- <argument index="0" name="from" type="Vector2">
- </argument>
- <description>
- Constructs a new String from the given [Vector2].
- </description>
- </method>
- <method name="String">
- <return type="String">
- </return>
- <argument index="0" name="from" type="Vector2i">
- </argument>
- <description>
- Constructs a new String from the given [Vector2i].
- </description>
- </method>
- <method name="String">
- <return type="String">
- </return>
- <argument index="0" name="from" type="Rect2">
- </argument>
- <description>
- Constructs a new String from the given [Rect2].
- </description>
- </method>
- <method name="String">
- <return type="String">
- </return>
- <argument index="0" name="from" type="Rect2i">
- </argument>
- <description>
- Constructs a new String from the given [Rect2i].
- </description>
- </method>
- <method name="String">
- <return type="String">
- </return>
- <argument index="0" name="from" type="Vector3">
- </argument>
- <description>
- Constructs a new String from the given [Vector3].
- </description>
- </method>
- <method name="String">
- <return type="String">
- </return>
- <argument index="0" name="from" type="Vector3i">
- </argument>
- <description>
- Constructs a new String from the given [Vector3i].
- </description>
- </method>
- <method name="String">
- <return type="String">
- </return>
- <argument index="0" name="from" type="Transform2D">
- </argument>
- <description>
- Constructs a new String from the given [Transform2D].
- </description>
- </method>
- <method name="String">
- <return type="String">
- </return>
- <argument index="0" name="from" type="Plane">
- </argument>
- <description>
- Constructs a new String from the given [Plane].
- </description>
- </method>
- <method name="String">
- <return type="String">
- </return>
- <argument index="0" name="from" type="Quat">
- </argument>
- <description>
- Constructs a new String from the given [Quat].
- </description>
- </method>
- <method name="String">
- <return type="String">
- </return>
- <argument index="0" name="from" type="AABB">
- </argument>
- <description>
- Constructs a new String from the given [AABB].
- </description>
- </method>
- <method name="String">
- <return type="String">
- </return>
- <argument index="0" name="from" type="Basis">
- </argument>
- <description>
- Constructs a new String from the given [Basis].
- </description>
- </method>
- <method name="String">
- <return type="String">
- </return>
- <argument index="0" name="from" type="Transform">
- </argument>
- <description>
- Constructs a new String from the given [Transform].
- </description>
- </method>
- <method name="String">
- <return type="String">
- </return>
- <argument index="0" name="from" type="Color">
- </argument>
<description>
- Constructs a new String from the given [Color].
+ Constructs an empty [String] ([code]""[/code]).
</description>
</method>
<method name="String">
<return type="String">
</return>
- <argument index="0" name="from" type="StringName">
+ <argument index="0" name="from" type="String">
</argument>
<description>
- Constructs a new String from the given [StringName].
+ Constructs a [String] as a copy of the given [String].
</description>
</method>
<method name="String">
@@ -175,127 +38,10 @@
<method name="String">
<return type="String">
</return>
- <argument index="0" name="from" type="RID">
- </argument>
- <description>
- Constructs a new String from the given [RID].
- </description>
- </method>
- <method name="String">
- <return type="String">
- </return>
- <argument index="0" name="from" type="Callable">
- </argument>
- <description>
- Constructs a new String from the given [Callable].
- </description>
- </method>
- <method name="String">
- <return type="String">
- </return>
- <argument index="0" name="from" type="Signal">
- </argument>
- <description>
- Constructs a new String from the given [Signal].
- </description>
- </method>
- <method name="String">
- <return type="String">
- </return>
- <argument index="0" name="from" type="Dictionary">
- </argument>
- <description>
- Constructs a new String from the given [Dictionary].
- </description>
- </method>
- <method name="String">
- <return type="String">
- </return>
- <argument index="0" name="from" type="Array">
- </argument>
- <description>
- Constructs a new String from the given [Array].
- </description>
- </method>
- <method name="String">
- <return type="String">
- </return>
- <argument index="0" name="from" type="PackedByteArray">
- </argument>
- <description>
- Constructs a new String from the given [PackedByteArray].
- </description>
- </method>
- <method name="String">
- <return type="String">
- </return>
- <argument index="0" name="from" type="PackedInt32Array">
- </argument>
- <description>
- Constructs a new String from the given [PackedInt32Array].
- </description>
- </method>
- <method name="String">
- <return type="String">
- </return>
- <argument index="0" name="from" type="PackedInt64Array">
- </argument>
- <description>
- Constructs a new String from the given [PackedInt64Array].
- </description>
- </method>
- <method name="String">
- <return type="String">
- </return>
- <argument index="0" name="from" type="PackedFloat32Array">
- </argument>
- <description>
- Constructs a new String from the given [PackedFloat32Array].
- </description>
- </method>
- <method name="String">
- <return type="String">
- </return>
- <argument index="0" name="from" type="PackedFloat64Array">
- </argument>
- <description>
- Constructs a new String from the given [PackedFloat64Array].
- </description>
- </method>
- <method name="String">
- <return type="String">
- </return>
- <argument index="0" name="from" type="PackedStringArray">
- </argument>
- <description>
- Constructs a new String from the given [PackedStringArray].
- </description>
- </method>
- <method name="String">
- <return type="String">
- </return>
- <argument index="0" name="from" type="PackedVector2Array">
- </argument>
- <description>
- Constructs a new String from the given [PackedVector2Array].
- </description>
- </method>
- <method name="String">
- <return type="String">
- </return>
- <argument index="0" name="from" type="PackedVector3Array">
- </argument>
- <description>
- Constructs a new String from the given [PackedVector3Array].
- </description>
- </method>
- <method name="String">
- <return type="String">
- </return>
- <argument index="0" name="from" type="PackedColorArray">
+ <argument index="0" name="from" type="StringName">
</argument>
<description>
- Constructs a new String from the given [PackedColorArray].
+ Constructs a new String from the given [StringName].
</description>
</method>
<method name="begins_with">
diff --git a/doc/classes/StringName.xml b/doc/classes/StringName.xml
index 5d8ac6fdcc..a847d44120 100644
--- a/doc/classes/StringName.xml
+++ b/doc/classes/StringName.xml
@@ -12,6 +12,22 @@
<method name="StringName">
<return type="StringName">
</return>
+ <description>
+ Constructs an empty [StringName].
+ </description>
+ </method>
+ <method name="StringName">
+ <return type="StringName">
+ </return>
+ <argument index="0" name="from" type="StringName">
+ </argument>
+ <description>
+ Constructs a [StringName] as a copy of the given [StringName].
+ </description>
+ </method>
+ <method name="StringName">
+ <return type="StringName">
+ </return>
<argument index="0" name="from" type="String">
</argument>
<description>
diff --git a/doc/classes/Transform.xml b/doc/classes/Transform.xml
index 8e539e64f7..920a6c704e 100644
--- a/doc/classes/Transform.xml
+++ b/doc/classes/Transform.xml
@@ -19,54 +19,43 @@
<method name="Transform">
<return type="Transform">
</return>
- <argument index="0" name="x_axis" type="Vector3">
- </argument>
- <argument index="1" name="y_axis" type="Vector3">
- </argument>
- <argument index="2" name="z_axis" type="Vector3">
- </argument>
- <argument index="3" name="origin" type="Vector3">
- </argument>
<description>
- Constructs a Transform from four [Vector3] values (matrix columns). Each axis corresponds to local basis vectors (some of which may be scaled).
+ Constructs a default-initialized [Transform] set to [constant IDENTITY].
</description>
</method>
<method name="Transform">
<return type="Transform">
</return>
- <argument index="0" name="basis" type="Basis">
- </argument>
- <argument index="1" name="origin" type="Vector3">
+ <argument index="0" name="from" type="Transform">
</argument>
<description>
- Constructs a Transform from a [Basis] and [Vector3].
+ Constructs a [Transform] as a copy of the given [Transform].
</description>
</method>
<method name="Transform">
<return type="Transform">
</return>
- <argument index="0" name="from" type="Transform2D">
+ <argument index="0" name="basis" type="Basis">
</argument>
- <description>
- Constructs a Transform from a [Transform2D].
- </description>
- </method>
- <method name="Transform">
- <return type="Transform">
- </return>
- <argument index="0" name="from" type="Quat">
+ <argument index="1" name="origin" type="Vector3">
</argument>
<description>
- Constructs a Transform from a [Quat]. The origin will be [code]Vector3(0, 0, 0)[/code].
+ Constructs a Transform from a [Basis] and [Vector3].
</description>
</method>
<method name="Transform">
<return type="Transform">
</return>
- <argument index="0" name="from" type="Basis">
+ <argument index="0" name="x_axis" type="Vector3">
+ </argument>
+ <argument index="1" name="y_axis" type="Vector3">
+ </argument>
+ <argument index="2" name="z_axis" type="Vector3">
+ </argument>
+ <argument index="3" name="origin" type="Vector3">
</argument>
<description>
- Constructs the Transform from a [Basis]. The origin will be Vector3(0, 0, 0).
+ Constructs a Transform from four [Vector3] values (matrix columns). Each axis corresponds to local basis vectors (some of which may be scaled).
</description>
</method>
<method name="affine_inverse">
diff --git a/doc/classes/Transform2D.xml b/doc/classes/Transform2D.xml
index 66adeab3a6..af67ad2bd4 100644
--- a/doc/classes/Transform2D.xml
+++ b/doc/classes/Transform2D.xml
@@ -17,6 +17,22 @@
<method name="Transform2D">
<return type="Transform2D">
</return>
+ <description>
+ Constructs a default-initialized [Transform] set to [constant IDENTITY].
+ </description>
+ </method>
+ <method name="Transform2D">
+ <return type="Transform2D">
+ </return>
+ <argument index="0" name="from" type="Transform2D">
+ </argument>
+ <description>
+ Constructs a [Transform2D] as a copy of the given [Transform2D].
+ </description>
+ </method>
+ <method name="Transform2D">
+ <return type="Transform2D">
+ </return>
<argument index="0" name="rotation" type="float">
</argument>
<argument index="1" name="position" type="Vector2">
@@ -38,15 +54,6 @@
Constructs the transform from 3 [Vector2] values representing [member x], [member y], and the [member origin] (the three column vectors).
</description>
</method>
- <method name="Transform2D">
- <return type="Transform2D">
- </return>
- <argument index="0" name="from" type="Transform">
- </argument>
- <description>
- Constructs the transform from a 3D [Transform].
- </description>
- </method>
<method name="affine_inverse">
<return type="Transform2D">
</return>
diff --git a/doc/classes/Vector2.xml b/doc/classes/Vector2.xml
index 231e0ed06a..da1526df52 100644
--- a/doc/classes/Vector2.xml
+++ b/doc/classes/Vector2.xml
@@ -20,6 +20,22 @@
<method name="Vector2">
<return type="Vector2">
</return>
+ <description>
+ Constructs a default-initialized [Vector2] with all components set to [code]0[/code].
+ </description>
+ </method>
+ <method name="Vector2">
+ <return type="Vector2">
+ </return>
+ <argument index="0" name="from" type="Vector2">
+ </argument>
+ <description>
+ Constructs a [Vector2] as a copy of the given [Vector2].
+ </description>
+ </method>
+ <method name="Vector2">
+ <return type="Vector2">
+ </return>
<argument index="0" name="from" type="Vector2i">
</argument>
<description>
diff --git a/doc/classes/Vector2i.xml b/doc/classes/Vector2i.xml
index 75ddc46dab..e5b85dff9e 100644
--- a/doc/classes/Vector2i.xml
+++ b/doc/classes/Vector2i.xml
@@ -17,12 +17,17 @@
<method name="Vector2i">
<return type="Vector2i">
</return>
- <argument index="0" name="x" type="int">
- </argument>
- <argument index="1" name="y" type="int">
+ <description>
+ Constructs a default-initialized [Vector2i] with all components set to [code]0[/code].
+ </description>
+ </method>
+ <method name="Vector2i">
+ <return type="Vector2i">
+ </return>
+ <argument index="0" name="from" type="Vector2i">
</argument>
<description>
- Constructs a new [Vector2i] from the given [code]x[/code] and [code]y[/code].
+ Constructs a [Vector2i] as a copy of the given [Vector2i].
</description>
</method>
<method name="Vector2i">
@@ -34,6 +39,17 @@
Constructs a new [Vector2i] from [Vector2]. The floating point coordinates will be truncated.
</description>
</method>
+ <method name="Vector2i">
+ <return type="Vector2i">
+ </return>
+ <argument index="0" name="x" type="int">
+ </argument>
+ <argument index="1" name="y" type="int">
+ </argument>
+ <description>
+ Constructs a new [Vector2i] from the given [code]x[/code] and [code]y[/code].
+ </description>
+ </method>
<method name="abs">
<return type="Vector2i">
</return>
diff --git a/doc/classes/Vector3.xml b/doc/classes/Vector3.xml
index 7e47f768b4..356c9501e1 100644
--- a/doc/classes/Vector3.xml
+++ b/doc/classes/Vector3.xml
@@ -20,6 +20,22 @@
<method name="Vector3">
<return type="Vector3">
</return>
+ <description>
+ Constructs a default-initialized [Vector3] with all components set to [code]0[/code].
+ </description>
+ </method>
+ <method name="Vector3">
+ <return type="Vector3">
+ </return>
+ <argument index="0" name="from" type="Vector3">
+ </argument>
+ <description>
+ Constructs a [Vector3] as a copy of the given [Vector3].
+ </description>
+ </method>
+ <method name="Vector3">
+ <return type="Vector3">
+ </return>
<argument index="0" name="from" type="Vector3i">
</argument>
<description>
diff --git a/doc/classes/Vector3i.xml b/doc/classes/Vector3i.xml
index 45e237fb23..761bddaeef 100644
--- a/doc/classes/Vector3i.xml
+++ b/doc/classes/Vector3i.xml
@@ -17,14 +17,17 @@
<method name="Vector3i">
<return type="Vector3i">
</return>
- <argument index="0" name="x" type="int">
- </argument>
- <argument index="1" name="y" type="int">
- </argument>
- <argument index="2" name="z" type="int">
+ <description>
+ Constructs a default-initialized [Vector3i] with all components set to [code]0[/code].
+ </description>
+ </method>
+ <method name="Vector3i">
+ <return type="Vector3i">
+ </return>
+ <argument index="0" name="from" type="Vector3i">
</argument>
<description>
- Returns a [Vector3i] with the given components.
+ Constructs a [Vector3i] as a copy of the given [Vector3i].
</description>
</method>
<method name="Vector3i">
@@ -36,6 +39,19 @@
Constructs a new [Vector3i] from [Vector3]. The floating point coordinates will be truncated.
</description>
</method>
+ <method name="Vector3i">
+ <return type="Vector3i">
+ </return>
+ <argument index="0" name="x" type="int">
+ </argument>
+ <argument index="1" name="y" type="int">
+ </argument>
+ <argument index="2" name="z" type="int">
+ </argument>
+ <description>
+ Returns a [Vector3i] with the given components.
+ </description>
+ </method>
<method name="abs">
<return type="Vector3i">
</return>
diff --git a/doc/classes/Window.xml b/doc/classes/Window.xml
index c1a991fca1..a0711b4214 100644
--- a/doc/classes/Window.xml
+++ b/doc/classes/Window.xml
@@ -362,6 +362,8 @@
<constant name="MODE_MAXIMIZED" value="2" enum="Mode">
</constant>
<constant name="MODE_FULLSCREEN" value="3" enum="Mode">
+ Fullscreen window mode. Note that this is not [i]exclusive[/i] fullscreen. On Windows and Linux, a borderless window is used to emulate fullscreen. On macOS, a new desktop is used to display the running project.
+ Regardless of the platform, enabling fullscreen will change the window size to match the monitor's size. Therefore, make sure your project supports [url=https://docs.godotengine.org/en/latest/tutorials/rendering/multiple_resolutions.html]multiple resolutions[/url] when enabling fullscreen mode.
</constant>
<constant name="FLAG_RESIZE_DISABLED" value="0" enum="Flags">
</constant>
diff --git a/doc/classes/bool.xml b/doc/classes/bool.xml
index ce4d000a9b..e9f4c2ecf4 100644
--- a/doc/classes/bool.xml
+++ b/doc/classes/bool.xml
@@ -94,10 +94,17 @@
<method name="bool">
<return type="bool">
</return>
- <argument index="0" name="from" type="int">
+ <description>
+ Constructs a default-initialized [bool] set to [code]false[/code].
+ </description>
+ </method>
+ <method name="bool">
+ <return type="bool">
+ </return>
+ <argument index="0" name="from" type="bool">
</argument>
<description>
- Cast an [int] value to a boolean value, this method will return [code]false[/code] if [code]0[/code] is passed in, and [code]true[/code] for all other ints.
+ Constructs a [bool] as a copy of the given [bool].
</description>
</method>
<method name="bool">
@@ -112,11 +119,10 @@
<method name="bool">
<return type="bool">
</return>
- <argument index="0" name="from" type="String">
+ <argument index="0" name="from" type="int">
</argument>
<description>
- Cast a [String] value to a boolean value, this method will return [code]false[/code] if [code]""[/code] is passed in, and [code]true[/code] for all non-empty strings.
- Examples: [code]bool("False")[/code] returns [code]true[/code], [code]bool("")[/code] returns [code]false[/code].
+ Cast an [int] value to a boolean value, this method will return [code]false[/code] if [code]0[/code] is passed in, and [code]true[/code] for all other ints.
</description>
</method>
</methods>
diff --git a/doc/classes/float.xml b/doc/classes/float.xml
index 16a696f959..8153d62bc9 100644
--- a/doc/classes/float.xml
+++ b/doc/classes/float.xml
@@ -12,28 +12,35 @@
<method name="float">
<return type="float">
</return>
- <argument index="0" name="from" type="bool">
+ <description>
+ Constructs a default-initialized [float] set to [code]0.0[/code].
+ </description>
+ </method>
+ <method name="float">
+ <return type="float">
+ </return>
+ <argument index="0" name="from" type="float">
</argument>
<description>
- Cast a [bool] value to a floating-point value, [code]float(true)[/code] will be equal to 1.0 and [code]float(false)[/code] will be equal to 0.0.
+ Constructs a [float] as a copy of the given [float].
</description>
</method>
<method name="float">
<return type="float">
</return>
- <argument index="0" name="from" type="int">
+ <argument index="0" name="from" type="bool">
</argument>
<description>
- Cast an [int] value to a floating-point value, [code]float(1)[/code] will be equal to 1.0.
+ Cast a [bool] value to a floating-point value, [code]float(true)[/code] will be equal to 1.0 and [code]float(false)[/code] will be equal to 0.0.
</description>
</method>
<method name="float">
<return type="float">
</return>
- <argument index="0" name="from" type="String">
+ <argument index="0" name="from" type="int">
</argument>
<description>
- Cast a [String] value to a floating-point value. This method accepts float value strings like [code]"1.23"[/code] and exponential notation strings for its parameter so calling [code]float("1e3")[/code] will return 1000.0 and calling [code]float("1e-3")[/code] will return 0.001. Calling this method with an invalid float string will return 0. This method stops parsing at the first invalid character and will return the parsed result so far, so calling [code]float("1a3")[/code] will return 1 while calling [code]float("1e3a2")[/code] will return 1000.0.
+ Cast an [int] value to a floating-point value, [code]float(1)[/code] will be equal to [code]1.0[/code].
</description>
</method>
</methods>
diff --git a/doc/classes/int.xml b/doc/classes/int.xml
index 2c9f0ad371..27d873831b 100644
--- a/doc/classes/int.xml
+++ b/doc/classes/int.xml
@@ -26,28 +26,35 @@
<method name="int">
<return type="int">
</return>
- <argument index="0" name="from" type="bool">
+ <description>
+ Constructs a default-initialized [int] set to [code]0[/code].
+ </description>
+ </method>
+ <method name="int">
+ <return type="int">
+ </return>
+ <argument index="0" name="from" type="int">
</argument>
<description>
- Cast a [bool] value to an integer value, [code]int(true)[/code] will be equals to 1 and [code]int(false)[/code] will be equals to 0.
+ Constructs an [int] as a copy of the given [int].
</description>
</method>
<method name="int">
<return type="int">
</return>
- <argument index="0" name="from" type="float">
+ <argument index="0" name="from" type="bool">
</argument>
<description>
- Cast a float value to an integer value, this method simply removes the number fractions, so for example [code]int(2.7)[/code] will be equals to 2, [code]int(.1)[/code] will be equals to 0 and [code]int(-2.7)[/code] will be equals to -2.
+ Cast a [bool] value to an integer value, [code]int(true)[/code] will be equals to 1 and [code]int(false)[/code] will be equals to 0.
</description>
</method>
<method name="int">
<return type="int">
</return>
- <argument index="0" name="from" type="String">
+ <argument index="0" name="from" type="float">
</argument>
<description>
- Cast a [String] value to an integer value, this method is an integer parser from a string, so calling this method with an invalid integer string will return 0, a valid string will be something like [code]'1.7'[/code]. This method will ignore all non-number characters, so calling [code]int('1e3')[/code] will return 13.
+ Cast a float value to an integer value, this method simply removes the number fractions, so for example [code]int(2.7)[/code] will be equals to 2, [code]int(.1)[/code] will be equals to 0 and [code]int(-2.7)[/code] will be equals to -2.
</description>
</method>
</methods>
diff --git a/drivers/alsa/audio_driver_alsa.cpp b/drivers/alsa/audio_driver_alsa.cpp
index 90c3d3af83..488fd4b468 100644
--- a/drivers/alsa/audio_driver_alsa.cpp
+++ b/drivers/alsa/audio_driver_alsa.cpp
@@ -32,8 +32,8 @@
#ifdef ALSA_ENABLED
+#include "core/config/project_settings.h"
#include "core/os/os.h"
-#include "core/project_settings.h"
#include <errno.h>
diff --git a/drivers/alsamidi/midi_driver_alsamidi.cpp b/drivers/alsamidi/midi_driver_alsamidi.cpp
index 69a6956c2b..07a4360cd2 100644
--- a/drivers/alsamidi/midi_driver_alsamidi.cpp
+++ b/drivers/alsamidi/midi_driver_alsamidi.cpp
@@ -33,7 +33,7 @@
#include "midi_driver_alsamidi.h"
#include "core/os/os.h"
-#include "core/print_string.h"
+#include "core/string/print_string.h"
#include <errno.h>
diff --git a/drivers/alsamidi/midi_driver_alsamidi.h b/drivers/alsamidi/midi_driver_alsamidi.h
index 6aabe8e3fd..fef87459c7 100644
--- a/drivers/alsamidi/midi_driver_alsamidi.h
+++ b/drivers/alsamidi/midi_driver_alsamidi.h
@@ -36,7 +36,7 @@
#include "core/os/midi_driver.h"
#include "core/os/mutex.h"
#include "core/os/thread.h"
-#include "core/vector.h"
+#include "core/templates/vector.h"
#include <alsa/asoundlib.h>
#include <stdio.h>
diff --git a/drivers/coreaudio/audio_driver_coreaudio.cpp b/drivers/coreaudio/audio_driver_coreaudio.cpp
index 48d0a29516..60c491f5f8 100644
--- a/drivers/coreaudio/audio_driver_coreaudio.cpp
+++ b/drivers/coreaudio/audio_driver_coreaudio.cpp
@@ -32,8 +32,8 @@
#include "audio_driver_coreaudio.h"
+#include "core/config/project_settings.h"
#include "core/os/os.h"
-#include "core/project_settings.h"
#define kOutputBus 0
#define kInputBus 1
diff --git a/drivers/coremidi/midi_driver_coremidi.cpp b/drivers/coremidi/midi_driver_coremidi.cpp
index 004c594e17..b9e7853735 100644
--- a/drivers/coremidi/midi_driver_coremidi.cpp
+++ b/drivers/coremidi/midi_driver_coremidi.cpp
@@ -32,7 +32,7 @@
#include "midi_driver_coremidi.h"
-#include "core/print_string.h"
+#include "core/string/print_string.h"
#include <CoreAudio/HostTime.h>
#include <CoreServices/CoreServices.h>
diff --git a/drivers/coremidi/midi_driver_coremidi.h b/drivers/coremidi/midi_driver_coremidi.h
index 0459544f75..02167aa891 100644
--- a/drivers/coremidi/midi_driver_coremidi.h
+++ b/drivers/coremidi/midi_driver_coremidi.h
@@ -34,7 +34,7 @@
#define MIDI_DRIVER_COREMIDI_H
#include "core/os/midi_driver.h"
-#include "core/vector.h"
+#include "core/templates/vector.h"
#include <CoreMIDI/CoreMIDI.h>
#include <stdio.h>
diff --git a/drivers/dummy/rasterizer_dummy.h b/drivers/dummy/rasterizer_dummy.h
index bef4d999af..f0e62de144 100644
--- a/drivers/dummy/rasterizer_dummy.h
+++ b/drivers/dummy/rasterizer_dummy.h
@@ -32,8 +32,8 @@
#define RASTERIZER_DUMMY_H
#include "core/math/camera_matrix.h"
-#include "core/rid_owner.h"
-#include "core/self_list.h"
+#include "core/templates/rid_owner.h"
+#include "core/templates/self_list.h"
#include "scene/resources/mesh.h"
#include "servers/rendering/rasterizer.h"
#include "servers/rendering_server.h"
diff --git a/drivers/dummy/texture_loader_dummy.cpp b/drivers/dummy/texture_loader_dummy.cpp
index ddd2943720..6158a2ac54 100644
--- a/drivers/dummy/texture_loader_dummy.cpp
+++ b/drivers/dummy/texture_loader_dummy.cpp
@@ -31,7 +31,7 @@
#include "texture_loader_dummy.h"
#include "core/os/file_access.h"
-#include "core/print_string.h"
+#include "core/string/print_string.h"
#include <string.h>
diff --git a/drivers/png/image_loader_png.cpp b/drivers/png/image_loader_png.cpp
index 79924b849c..cd0c68e947 100644
--- a/drivers/png/image_loader_png.cpp
+++ b/drivers/png/image_loader_png.cpp
@@ -31,7 +31,7 @@
#include "image_loader_png.h"
#include "core/os/os.h"
-#include "core/print_string.h"
+#include "core/string/print_string.h"
#include "drivers/png/png_driver_common.h"
#include <string.h>
diff --git a/drivers/png/png_driver_common.h b/drivers/png/png_driver_common.h
index 2099ddc536..e7ec9b96bd 100644
--- a/drivers/png/png_driver_common.h
+++ b/drivers/png/png_driver_common.h
@@ -31,7 +31,7 @@
#ifndef PNG_DRIVER_COMMON_H
#define PNG_DRIVER_COMMON_H
-#include "core/image.h"
+#include "core/io/image.h"
namespace PNGDriverCommon {
diff --git a/drivers/png/resource_saver_png.cpp b/drivers/png/resource_saver_png.cpp
index 3a0b319a45..a2d0d5881a 100644
--- a/drivers/png/resource_saver_png.cpp
+++ b/drivers/png/resource_saver_png.cpp
@@ -30,7 +30,7 @@
#include "resource_saver_png.h"
-#include "core/image.h"
+#include "core/io/image.h"
#include "core/os/file_access.h"
#include "drivers/png/png_driver_common.h"
#include "scene/resources/texture.h"
diff --git a/drivers/png/resource_saver_png.h b/drivers/png/resource_saver_png.h
index c32b383521..1d4dcfb57f 100644
--- a/drivers/png/resource_saver_png.h
+++ b/drivers/png/resource_saver_png.h
@@ -31,7 +31,7 @@
#ifndef RESOURCE_SAVER_PNG_H
#define RESOURCE_SAVER_PNG_H
-#include "core/image.h"
+#include "core/io/image.h"
#include "core/io/resource_saver.h"
class ResourceSaverPNG : public ResourceFormatSaver {
diff --git a/drivers/pulseaudio/audio_driver_pulseaudio.cpp b/drivers/pulseaudio/audio_driver_pulseaudio.cpp
index a6bc4f3b2c..5acaa3ac99 100644
--- a/drivers/pulseaudio/audio_driver_pulseaudio.cpp
+++ b/drivers/pulseaudio/audio_driver_pulseaudio.cpp
@@ -32,8 +32,8 @@
#ifdef PULSEAUDIO_ENABLED
+#include "core/config/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/unix/dir_access_unix.cpp b/drivers/unix/dir_access_unix.cpp
index 5b99a2f53f..63fa143a03 100644
--- a/drivers/unix/dir_access_unix.cpp
+++ b/drivers/unix/dir_access_unix.cpp
@@ -32,9 +32,9 @@
#if defined(UNIX_ENABLED) || defined(LIBC_FILEIO_ENABLED)
-#include "core/list.h"
#include "core/os/memory.h"
-#include "core/print_string.h"
+#include "core/string/print_string.h"
+#include "core/templates/list.h"
#include <errno.h>
#include <stdio.h>
diff --git a/drivers/unix/file_access_unix.cpp b/drivers/unix/file_access_unix.cpp
index 51c657007c..ce1e135fe0 100644
--- a/drivers/unix/file_access_unix.cpp
+++ b/drivers/unix/file_access_unix.cpp
@@ -33,7 +33,7 @@
#if defined(UNIX_ENABLED) || defined(LIBC_FILEIO_ENABLED)
#include "core/os/os.h"
-#include "core/print_string.h"
+#include "core/string/print_string.h"
#include <sys/stat.h>
#include <sys/types.h>
diff --git a/drivers/unix/os_unix.cpp b/drivers/unix/os_unix.cpp
index eec6eb8303..318638e5d0 100644
--- a/drivers/unix/os_unix.cpp
+++ b/drivers/unix/os_unix.cpp
@@ -32,10 +32,10 @@
#ifdef UNIX_ENABLED
+#include "core/config/project_settings.h"
#include "core/debugger/engine_debugger.h"
#include "core/debugger/script_debugger.h"
#include "core/os/thread_dummy.h"
-#include "core/project_settings.h"
#include "drivers/unix/dir_access_unix.h"
#include "drivers/unix/file_access_unix.h"
#include "drivers/unix/net_socket_posix.h"
diff --git a/drivers/unix/rw_lock_posix.cpp b/drivers/unix/rw_lock_posix.cpp
index 50b74e84f7..cf24d54c50 100644
--- a/drivers/unix/rw_lock_posix.cpp
+++ b/drivers/unix/rw_lock_posix.cpp
@@ -32,7 +32,7 @@
#include "rw_lock_posix.h"
-#include "core/error_macros.h"
+#include "core/error/error_macros.h"
#include "core/os/memory.h"
#include <stdio.h>
diff --git a/drivers/unix/syslog_logger.cpp b/drivers/unix/syslog_logger.cpp
index a4c7070f0e..b29d1ec541 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 "core/print_string.h"
+#include "core/string/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/thread_posix.cpp b/drivers/unix/thread_posix.cpp
index 285088342b..f4e3de7646 100644
--- a/drivers/unix/thread_posix.cpp
+++ b/drivers/unix/thread_posix.cpp
@@ -32,9 +32,9 @@
#if (defined(UNIX_ENABLED) || defined(PTHREAD_ENABLED)) && !defined(NO_THREADS)
+#include "core/object/script_language.h"
#include "core/os/memory.h"
-#include "core/safe_refcount.h"
-#include "core/script_language.h"
+#include "core/templates/safe_refcount.h"
#ifdef PTHREAD_BSD_SET_NAME
#include <pthread_np.h>
diff --git a/drivers/vulkan/rendering_device_vulkan.cpp b/drivers/vulkan/rendering_device_vulkan.cpp
index a356586698..902876616b 100644
--- a/drivers/vulkan/rendering_device_vulkan.cpp
+++ b/drivers/vulkan/rendering_device_vulkan.cpp
@@ -30,10 +30,10 @@
#include "rendering_device_vulkan.h"
-#include "core/hashfuncs.h"
+#include "core/config/project_settings.h"
#include "core/os/file_access.h"
#include "core/os/os.h"
-#include "core/project_settings.h"
+#include "core/templates/hashfuncs.h"
#include "drivers/vulkan/vulkan_context.h"
#include "thirdparty/spirv-reflect/spirv_reflect.h"
diff --git a/drivers/vulkan/rendering_device_vulkan.h b/drivers/vulkan/rendering_device_vulkan.h
index e6cbf2e01d..6463078d0a 100644
--- a/drivers/vulkan/rendering_device_vulkan.h
+++ b/drivers/vulkan/rendering_device_vulkan.h
@@ -31,9 +31,9 @@
#ifndef RENDERING_DEVICE_VULKAN_H
#define RENDERING_DEVICE_VULKAN_H
-#include "core/oa_hash_map.h"
#include "core/os/thread_safe.h"
-#include "core/rid_owner.h"
+#include "core/templates/oa_hash_map.h"
+#include "core/templates/rid_owner.h"
#include "servers/rendering/rendering_device.h"
#ifdef DEBUG_ENABLED
diff --git a/drivers/vulkan/vulkan_context.cpp b/drivers/vulkan/vulkan_context.cpp
index 8840391966..ebfd3e0454 100644
--- a/drivers/vulkan/vulkan_context.cpp
+++ b/drivers/vulkan/vulkan_context.cpp
@@ -30,9 +30,9 @@
#include "vulkan_context.h"
-#include "core/engine.h"
-#include "core/project_settings.h"
-#include "core/ustring.h"
+#include "core/config/engine.h"
+#include "core/config/project_settings.h"
+#include "core/string/ustring.h"
#include "core/version.h"
#include "vk_enum_string_helper.h"
diff --git a/drivers/vulkan/vulkan_context.h b/drivers/vulkan/vulkan_context.h
index 59e404512a..26d4b76e86 100644
--- a/drivers/vulkan/vulkan_context.h
+++ b/drivers/vulkan/vulkan_context.h
@@ -31,11 +31,11 @@
#ifndef VULKAN_CONTEXT_H
#define VULKAN_CONTEXT_H
-#include "core/error_list.h"
-#include "core/map.h"
+#include "core/error/error_list.h"
#include "core/os/mutex.h"
-#include "core/rid_owner.h"
-#include "core/ustring.h"
+#include "core/string/ustring.h"
+#include "core/templates/map.h"
+#include "core/templates/rid_owner.h"
#include "servers/display_server.h"
#include <vulkan/vulkan.h>
diff --git a/drivers/wasapi/audio_driver_wasapi.cpp b/drivers/wasapi/audio_driver_wasapi.cpp
index cd1c08b717..67e175d8d1 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 "core/config/project_settings.h"
#include "core/os/os.h"
-#include "core/project_settings.h"
#include <functiondiscoverykeys.h>
diff --git a/drivers/windows/dir_access_windows.cpp b/drivers/windows/dir_access_windows.cpp
index 03e4e30797..3c61aa7289 100644
--- a/drivers/windows/dir_access_windows.cpp
+++ b/drivers/windows/dir_access_windows.cpp
@@ -33,7 +33,7 @@
#include "dir_access_windows.h"
#include "core/os/memory.h"
-#include "core/print_string.h"
+#include "core/string/print_string.h"
#include <stdio.h>
#include <wchar.h>
diff --git a/drivers/windows/file_access_windows.cpp b/drivers/windows/file_access_windows.cpp
index dd86061ea7..ec393c98ba 100644
--- a/drivers/windows/file_access_windows.cpp
+++ b/drivers/windows/file_access_windows.cpp
@@ -33,7 +33,7 @@
#include "file_access_windows.h"
#include "core/os/os.h"
-#include "core/print_string.h"
+#include "core/string/print_string.h"
#include <shlwapi.h>
#include <windows.h>
diff --git a/drivers/windows/rw_lock_windows.cpp b/drivers/windows/rw_lock_windows.cpp
index 757c7661f5..1007689728 100644
--- a/drivers/windows/rw_lock_windows.cpp
+++ b/drivers/windows/rw_lock_windows.cpp
@@ -32,7 +32,7 @@
#include "rw_lock_windows.h"
-#include "core/error_macros.h"
+#include "core/error/error_macros.h"
#include "core/os/memory.h"
#include <stdio.h>
diff --git a/drivers/windows/thread_windows.h b/drivers/windows/thread_windows.h
index 502c418ce0..939f487fc1 100644
--- a/drivers/windows/thread_windows.h
+++ b/drivers/windows/thread_windows.h
@@ -33,8 +33,8 @@
#ifdef WINDOWS_ENABLED
+#include "core/object/script_language.h"
#include "core/os/thread.h"
-#include "core/script_language.h"
#include <windows.h>
diff --git a/drivers/winmidi/midi_driver_winmidi.cpp b/drivers/winmidi/midi_driver_winmidi.cpp
index 9cbc7f43e2..75f57b3bb9 100644
--- a/drivers/winmidi/midi_driver_winmidi.cpp
+++ b/drivers/winmidi/midi_driver_winmidi.cpp
@@ -32,7 +32,7 @@
#include "midi_driver_winmidi.h"
-#include "core/print_string.h"
+#include "core/string/print_string.h"
void MIDIDriverWinMidi::read(HMIDIIN hMidiIn, UINT wMsg, DWORD_PTR dwInstance, DWORD_PTR dwParam1, DWORD_PTR dwParam2) {
if (wMsg == MIM_DATA) {
diff --git a/drivers/winmidi/midi_driver_winmidi.h b/drivers/winmidi/midi_driver_winmidi.h
index 934eb5a493..9ed3fc2faa 100644
--- a/drivers/winmidi/midi_driver_winmidi.h
+++ b/drivers/winmidi/midi_driver_winmidi.h
@@ -34,7 +34,7 @@
#define MIDI_DRIVER_WINMIDI_H
#include "core/os/midi_driver.h"
-#include "core/vector.h"
+#include "core/templates/vector.h"
#include <stdio.h>
#include <windows.h>
diff --git a/drivers/xaudio2/audio_driver_xaudio2.cpp b/drivers/xaudio2/audio_driver_xaudio2.cpp
index 421cf6a8cf..c9ad054089 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 "core/config/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 52c984cbc0..6f30d5a492 100644
--- a/editor/animation_track_editor.cpp
+++ b/editor/animation_track_editor.cpp
@@ -228,9 +228,9 @@ public:
if (Variant::can_convert(args[idx].get_type(), t)) {
Variant old = args[idx];
Variant *ptrs[1] = { &old };
- args.write[idx] = Variant::construct(t, (const Variant **)ptrs, 1, err);
+ Variant::construct(t, args.write[idx], (const Variant **)ptrs, 1, err);
} else {
- args.write[idx] = Variant::construct(t, nullptr, 0, err);
+ Variant::construct(t, args.write[idx], nullptr, 0, err);
}
change_notify_deserved = true;
d_new["args"] = args;
@@ -846,9 +846,9 @@ public:
if (Variant::can_convert(args[idx].get_type(), t)) {
Variant old = args[idx];
Variant *ptrs[1] = { &old };
- args.write[idx] = Variant::construct(t, (const Variant **)ptrs, 1, err);
+ Variant::construct(t, args.write[idx], (const Variant **)ptrs, 1, err);
} else {
- args.write[idx] = Variant::construct(t, nullptr, 0, err);
+ Variant::construct(t, args.write[idx], nullptr, 0, err);
}
change_notify_deserved = true;
d_new["args"] = args;
@@ -3751,7 +3751,8 @@ PropertyInfo AnimationTrackEditor::_find_hint_for_track(int p_idx, NodePath &r_b
}
for (int i = 0; i < leftover_path.size() - 1; i++) {
- property_info_base = property_info_base.get_named(leftover_path[i]);
+ bool valid;
+ property_info_base = property_info_base.get_named(leftover_path[i], valid);
}
List<PropertyInfo> pinfo;
@@ -4586,7 +4587,8 @@ void AnimationTrackEditor::_add_method_key(const String &p_method) {
params.push_back(arg);
} else {
Callable::CallError ce;
- Variant arg = Variant::construct(E->get().arguments[i].type, nullptr, 0, ce);
+ Variant arg;
+ Variant::construct(E->get().arguments[i].type, arg, nullptr, 0, ce);
params.push_back(arg);
}
}
diff --git a/editor/array_property_edit.cpp b/editor/array_property_edit.cpp
index 20f947e707..0b6b1ef6a7 100644
--- a/editor/array_property_edit.cpp
+++ b/editor/array_property_edit.cpp
@@ -43,7 +43,7 @@ Variant ArrayPropertyEdit::get_array() const {
Variant arr = o->get(property);
if (!arr.is_array()) {
Callable::CallError ce;
- arr = Variant::construct(default_type, nullptr, 0, ce);
+ Variant::construct(default_type, arr, nullptr, 0, ce);
}
return arr;
}
@@ -107,7 +107,7 @@ bool ArrayPropertyEdit::_set(const StringName &p_name, const Variant &p_value) {
new_type = arr.get(size - 1).get_type();
}
if (new_type != Variant::NIL) {
- init = Variant::construct(new_type, nullptr, 0, ce);
+ Variant::construct(new_type, init, nullptr, 0, ce);
for (int i = size; i < newsize; i++) {
ur->add_do_method(this, "_set_value", i, init);
}
@@ -136,7 +136,8 @@ bool ArrayPropertyEdit::_set(const StringName &p_name, const Variant &p_value) {
Variant value = arr.get(idx);
if (value.get_type() != type && type >= 0 && type < Variant::VARIANT_MAX) {
Callable::CallError ce;
- Variant new_value = Variant::construct(Variant::Type(type), nullptr, 0, ce);
+ Variant new_value;
+ Variant::construct(Variant::Type(type), new_value, nullptr, 0, ce);
UndoRedo *ur = EditorNode::get_undo_redo();
ur->create_action(TTR("Change Array Value Type"));
diff --git a/editor/code_editor.cpp b/editor/code_editor.cpp
index ede6dde239..236d1e884e 100644
--- a/editor/code_editor.cpp
+++ b/editor/code_editor.cpp
@@ -32,7 +32,7 @@
#include "core/input/input.h"
#include "core/os/keyboard.h"
-#include "core/string_builder.h"
+#include "core/string/string_builder.h"
#include "editor/editor_scale.h"
#include "editor_node.h"
#include "editor_settings.h"
diff --git a/editor/connections_dialog.cpp b/editor/connections_dialog.cpp
index d1661fd7b3..320e5d8510 100644
--- a/editor/connections_dialog.cpp
+++ b/editor/connections_dialog.cpp
@@ -30,7 +30,7 @@
#include "connections_dialog.h"
-#include "core/print_string.h"
+#include "core/string/print_string.h"
#include "editor_node.h"
#include "editor_scale.h"
#include "editor_settings.h"
diff --git a/editor/connections_dialog.h b/editor/connections_dialog.h
index 48fdb91f5a..826c25895c 100644
--- a/editor/connections_dialog.h
+++ b/editor/connections_dialog.h
@@ -35,7 +35,7 @@
#ifndef CONNECTIONS_DIALOG_H
#define CONNECTIONS_DIALOG_H
-#include "core/undo_redo.h"
+#include "core/object/undo_redo.h"
#include "editor/editor_inspector.h"
#include "editor/scene_tree_editor.h"
#include "scene/gui/button.h"
diff --git a/editor/create_dialog.cpp b/editor/create_dialog.cpp
index 1e3dc01112..0f9c9bde7b 100644
--- a/editor/create_dialog.cpp
+++ b/editor/create_dialog.cpp
@@ -30,7 +30,7 @@
#include "create_dialog.h"
-#include "core/class_db.h"
+#include "core/object/class_db.h"
#include "core/os/keyboard.h"
#include "editor_feature_profile.h"
#include "editor_node.h"
diff --git a/editor/debugger/editor_debugger_server.h b/editor/debugger/editor_debugger_server.h
index 10a9a232ab..3ad9d3a9a9 100644
--- a/editor/debugger/editor_debugger_server.h
+++ b/editor/debugger/editor_debugger_server.h
@@ -32,7 +32,7 @@
#define EDITOR_DEBUGGER_CONNECTION_H
#include "core/debugger/remote_debugger_peer.h"
-#include "core/reference.h"
+#include "core/object/reference.h"
class EditorDebuggerServer : public Reference {
public:
diff --git a/editor/debugger/editor_performance_profiler.h b/editor/debugger/editor_performance_profiler.h
index 144dd34103..554a0650b8 100644
--- a/editor/debugger/editor_performance_profiler.h
+++ b/editor/debugger/editor_performance_profiler.h
@@ -31,8 +31,8 @@
#ifndef EDITOR_PERFORMANCE_PROFILER_H
#define EDITOR_PERFORMANCE_PROFILER_H
-#include "core/map.h"
-#include "core/ordered_hash_map.h"
+#include "core/templates/map.h"
+#include "core/templates/ordered_hash_map.h"
#include "main/performance.h"
#include "scene/gui/control.h"
#include "scene/gui/label.h"
diff --git a/editor/debugger/script_editor_debugger.cpp b/editor/debugger/script_editor_debugger.cpp
index 1fca95b6da..248073c5a2 100644
--- a/editor/debugger/script_editor_debugger.cpp
+++ b/editor/debugger/script_editor_debugger.cpp
@@ -30,11 +30,11 @@
#include "script_editor_debugger.h"
+#include "core/config/project_settings.h"
#include "core/debugger/debugger_marshalls.h"
#include "core/debugger/remote_debugger.h"
#include "core/io/marshalls.h"
-#include "core/project_settings.h"
-#include "core/ustring.h"
+#include "core/string/ustring.h"
#include "editor/debugger/editor_network_profiler.h"
#include "editor/debugger/editor_performance_profiler.h"
#include "editor/debugger/editor_profiler.h"
@@ -1023,7 +1023,7 @@ void ScriptEditorDebugger::_method_changed(Object *p_base, const StringName &p_n
for (int i = 0; i < VARIANT_ARG_MAX; i++) {
//no pointers, sorry
- if (argptr[i] && (argptr[i]->get_type() == Variant::OBJECT || argptr[i]->get_type() == Variant::_RID)) {
+ if (argptr[i] && (argptr[i]->get_type() == Variant::OBJECT || argptr[i]->get_type() == Variant::RID)) {
return;
}
}
diff --git a/editor/dependency_editor.cpp b/editor/dependency_editor.cpp
index cbf39c209a..5e87f866d8 100644
--- a/editor/dependency_editor.cpp
+++ b/editor/dependency_editor.cpp
@@ -471,28 +471,28 @@ void DependencyRemoveDialog::ok_pressed() {
// If the file we are deleting for e.g. the main scene, default environment,
// or audio bus layout, we must clear its definition in Project Settings.
- if (files_to_delete[i] == ProjectSettings::get_singleton()->get("application/config/icon")) {
+ if (files_to_delete[i] == String(ProjectSettings::get_singleton()->get("application/config/icon"))) {
ProjectSettings::get_singleton()->set("application/config/icon", "");
}
- if (files_to_delete[i] == ProjectSettings::get_singleton()->get("application/run/main_scene")) {
+ if (files_to_delete[i] == String(ProjectSettings::get_singleton()->get("application/run/main_scene"))) {
ProjectSettings::get_singleton()->set("application/run/main_scene", "");
}
- if (files_to_delete[i] == ProjectSettings::get_singleton()->get("application/boot_splash/image")) {
+ if (files_to_delete[i] == String(ProjectSettings::get_singleton()->get("application/boot_splash/image"))) {
ProjectSettings::get_singleton()->set("application/boot_splash/image", "");
}
- if (files_to_delete[i] == ProjectSettings::get_singleton()->get("rendering/environment/default_environment")) {
+ if (files_to_delete[i] == String(ProjectSettings::get_singleton()->get("rendering/environment/default_environment"))) {
ProjectSettings::get_singleton()->set("rendering/environment/default_environment", "");
}
- if (files_to_delete[i] == ProjectSettings::get_singleton()->get("display/mouse_cursor/custom_image")) {
+ if (files_to_delete[i] == String(ProjectSettings::get_singleton()->get("display/mouse_cursor/custom_image"))) {
ProjectSettings::get_singleton()->set("display/mouse_cursor/custom_image", "");
}
- if (files_to_delete[i] == ProjectSettings::get_singleton()->get("gui/theme/custom")) {
+ if (files_to_delete[i] == String(ProjectSettings::get_singleton()->get("gui/theme/custom"))) {
ProjectSettings::get_singleton()->set("gui/theme/custom", "");
}
- if (files_to_delete[i] == ProjectSettings::get_singleton()->get("gui/theme/custom_font")) {
+ if (files_to_delete[i] == String(ProjectSettings::get_singleton()->get("gui/theme/custom_font"))) {
ProjectSettings::get_singleton()->set("gui/theme/custom_font", "");
}
- if (files_to_delete[i] == ProjectSettings::get_singleton()->get("audio/default_bus_layout")) {
+ if (files_to_delete[i] == String(ProjectSettings::get_singleton()->get("audio/default_bus_layout"))) {
ProjectSettings::get_singleton()->set("audio/default_bus_layout", "");
}
diff --git a/editor/doc_data.cpp b/editor/doc_data.cpp
index 791b49319a..6767159721 100644
--- a/editor/doc_data.cpp
+++ b/editor/doc_data.cpp
@@ -30,13 +30,13 @@
#include "doc_data.h"
-#include "core/engine.h"
-#include "core/global_constants.h"
+#include "core/config/engine.h"
+#include "core/config/project_settings.h"
+#include "core/core_constants.h"
#include "core/io/compression.h"
#include "core/io/marshalls.h"
+#include "core/object/script_language.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"
@@ -561,18 +561,69 @@ void DocData::generate(bool p_basic_types) {
c.name = cname;
Callable::CallError cerror;
- Variant v = Variant::construct(Variant::Type(i), nullptr, 0, cerror);
+ Variant v;
+ Variant::construct(Variant::Type(i), v, nullptr, 0, cerror);
List<MethodInfo> method_list;
v.get_method_list(&method_list);
method_list.sort();
Variant::get_constructor_list(Variant::Type(i), &method_list);
+ for (int j = 0; j < Variant::OP_AND; j++) { //showing above 'and' is pretty confusing and there are a lot of variations
+
+ for (int k = 0; k < Variant::VARIANT_MAX; k++) {
+ Variant::Type rt = Variant::get_operator_return_type(Variant::Operator(j), Variant::Type(i), Variant::Type(k));
+ if (rt != Variant::NIL) {
+ //has operator
+ MethodInfo mi;
+ mi.name = "operator " + Variant::get_operator_name(Variant::Operator(j));
+ mi.return_val.type = rt;
+ if (k != Variant::NIL) {
+ PropertyInfo arg;
+ arg.name = "right";
+ arg.type = Variant::Type(k);
+ mi.arguments.push_back(arg);
+ }
+ method_list.push_back(mi);
+ }
+ }
+ }
+
+ if (Variant::is_keyed(Variant::Type(i))) {
+ MethodInfo mi;
+ mi.name = "operator []";
+ mi.return_val.type = Variant::NIL;
+ mi.return_val.usage = PROPERTY_USAGE_NIL_IS_VARIANT;
+
+ PropertyInfo arg;
+ arg.name = "key";
+ arg.type = Variant::NIL;
+ arg.usage = PROPERTY_USAGE_NIL_IS_VARIANT;
+ mi.arguments.push_back(arg);
+
+ method_list.push_back(mi);
+ } else if (Variant::has_indexing(Variant::Type(i))) {
+ MethodInfo mi;
+ mi.name = "operator []";
+ mi.return_val.type = Variant::get_indexed_element_type(Variant::Type(i));
+ PropertyInfo arg;
+ arg.name = "index";
+ arg.type = Variant::INT;
+ mi.arguments.push_back(arg);
+
+ method_list.push_back(mi);
+ }
+
for (List<MethodInfo>::Element *E = method_list.front(); E; E = E->next()) {
MethodInfo &mi = E->get();
MethodDoc method;
method.name = mi.name;
+ if (method.name == cname) {
+ method.qualifiers = "constructor";
+ } else if (method.name.begins_with("operator")) {
+ method.qualifiers = "operator";
+ }
for (int j = 0; j < mi.arguments.size(); j++) {
PropertyInfo arginfo = mi.arguments[j];
@@ -634,16 +685,16 @@ void DocData::generate(bool p_basic_types) {
ClassDoc &c = class_list[cname];
c.name = cname;
- for (int i = 0; i < GlobalConstants::get_global_constant_count(); i++) {
+ for (int i = 0; i < CoreConstants::get_global_constant_count(); i++) {
ConstantDoc cd;
- cd.name = GlobalConstants::get_global_constant_name(i);
- if (!GlobalConstants::get_ignore_value_in_docs(i)) {
- cd.value = itos(GlobalConstants::get_global_constant_value(i));
+ cd.name = CoreConstants::get_global_constant_name(i);
+ if (!CoreConstants::get_ignore_value_in_docs(i)) {
+ cd.value = itos(CoreConstants::get_global_constant_value(i));
cd.is_value_valid = true;
} else {
cd.is_value_valid = false;
}
- cd.enumeration = GlobalConstants::get_global_constant_enum(i);
+ cd.enumeration = CoreConstants::get_global_constant_enum(i);
c.constants.push_back(cd);
}
diff --git a/editor/doc_data.h b/editor/doc_data.h
index a35cfb59c7..2cb475d137 100644
--- a/editor/doc_data.h
+++ b/editor/doc_data.h
@@ -32,8 +32,8 @@
#define DOC_DATA_H
#include "core/io/xml_parser.h"
-#include "core/map.h"
-#include "core/variant.h"
+#include "core/templates/map.h"
+#include "core/variant/variant.h"
class DocData {
public:
@@ -43,6 +43,9 @@ public:
String enumeration;
String default_value;
bool operator<(const ArgumentDoc &p_arg) const {
+ if (name == p_arg.name) {
+ return type < p_arg.type;
+ }
return name < p_arg.name;
}
};
@@ -55,6 +58,20 @@ public:
String description;
Vector<ArgumentDoc> arguments;
bool operator<(const MethodDoc &p_method) const {
+ if (name == p_method.name) {
+ // Must be a constructor since there is no overloading.
+ // We want this arbitrary order for a class "Foo":
+ // - 1. Default constructor: Foo()
+ // - 2. Copy constructor: Foo(Foo)
+ // - 3+. Other constructors Foo(Bar, ...) based on first argument's name
+ if (arguments.size() == 0 || p_method.arguments.size() == 0) { // 1.
+ return arguments.size() < p_method.arguments.size();
+ }
+ if (arguments[0].type == return_type || p_method.arguments[0].type == p_method.return_type) { // 2.
+ return (arguments[0].type == return_type) || (p_method.arguments[0].type != p_method.return_type);
+ }
+ return arguments[0] < p_method.arguments[0];
+ }
return name < p_method.name;
}
};
diff --git a/editor/editor_atlas_packer.h b/editor/editor_atlas_packer.h
index 33dbe47efb..52ac9524ae 100644
--- a/editor/editor_atlas_packer.h
+++ b/editor/editor_atlas_packer.h
@@ -33,7 +33,7 @@
#include "core/math/vector2.h"
-#include "core/vector.h"
+#include "core/templates/vector.h"
#include "scene/resources/bit_map.h"
class EditorAtlasPacker {
diff --git a/editor/editor_autoload_settings.cpp b/editor/editor_autoload_settings.cpp
index 5d101ff2c2..2251440544 100644
--- a/editor/editor_autoload_settings.cpp
+++ b/editor/editor_autoload_settings.cpp
@@ -30,8 +30,8 @@
#include "editor_autoload_settings.h"
-#include "core/global_constants.h"
-#include "core/project_settings.h"
+#include "core/config/project_settings.h"
+#include "core/core_constants.h"
#include "editor_node.h"
#include "editor_scale.h"
#include "project_settings_editor.h"
@@ -89,8 +89,8 @@ bool EditorAutoloadSettings::_autoload_name_is_valid(const String &p_name, Strin
}
}
- for (int i = 0; i < GlobalConstants::get_global_constant_count(); i++) {
- if (GlobalConstants::get_global_constant_name(i) == p_name) {
+ for (int i = 0; i < CoreConstants::get_global_constant_count(); i++) {
+ if (CoreConstants::get_global_constant_name(i) == p_name) {
if (r_error) {
*r_error = TTR("Invalid name.") + "\n" + TTR("Must not collide with an existing global constant name.");
}
diff --git a/editor/editor_data.cpp b/editor/editor_data.cpp
index 1002c4917b..975405aec4 100644
--- a/editor/editor_data.cpp
+++ b/editor/editor_data.cpp
@@ -30,10 +30,10 @@
#include "editor_data.h"
+#include "core/config/project_settings.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 "scene/resources/packed_scene.h"
diff --git a/editor/editor_data.h b/editor/editor_data.h
index 8083dde09c..5037a6acb4 100644
--- a/editor/editor_data.h
+++ b/editor/editor_data.h
@@ -31,9 +31,9 @@
#ifndef EDITOR_DATA_H
#define EDITOR_DATA_H
-#include "core/list.h"
-#include "core/pair.h"
-#include "core/undo_redo.h"
+#include "core/object/undo_redo.h"
+#include "core/templates/list.h"
+#include "core/templates/pair.h"
#include "editor/editor_plugin.h"
#include "editor/plugins/script_editor_plugin.h"
#include "scene/resources/texture.h"
diff --git a/editor/editor_export.cpp b/editor/editor_export.cpp
index 0f86385031..97800fe961 100644
--- a/editor/editor_export.cpp
+++ b/editor/editor_export.cpp
@@ -30,6 +30,7 @@
#include "editor_export.h"
+#include "core/config/project_settings.h"
#include "core/crypto/crypto_core.h"
#include "core/io/config_file.h"
#include "core/io/file_access_encrypted.h"
@@ -37,10 +38,9 @@
#include "core/io/resource_loader.h"
#include "core/io/resource_saver.h"
#include "core/io/zip_io.h"
+#include "core/object/script_language.h"
#include "core/os/dir_access.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"
diff --git a/editor/editor_export.h b/editor/editor_export.h
index 55728f0c94..09feaad255 100644
--- a/editor/editor_export.h
+++ b/editor/editor_export.h
@@ -31,8 +31,8 @@
#ifndef EDITOR_EXPORT_H
#define EDITOR_EXPORT_H
+#include "core/io/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_feature_profile.h b/editor/editor_feature_profile.h
index d0d08c61f4..0f066b8f4a 100644
--- a/editor/editor_feature_profile.h
+++ b/editor/editor_feature_profile.h
@@ -31,8 +31,8 @@
#ifndef EDITOR_FEATURE_PROFILE_H
#define EDITOR_FEATURE_PROFILE_H
+#include "core/object/reference.h"
#include "core/os/file_access.h"
-#include "core/reference.h"
#include "editor/editor_file_dialog.h"
#include "scene/gui/dialogs.h"
#include "scene/gui/option_button.h"
diff --git a/editor/editor_file_dialog.cpp b/editor/editor_file_dialog.cpp
index 2140b6bd13..e3923a48c5 100644
--- a/editor/editor_file_dialog.cpp
+++ b/editor/editor_file_dialog.cpp
@@ -33,7 +33,7 @@
#include "core/os/file_access.h"
#include "core/os/keyboard.h"
#include "core/os/os.h"
-#include "core/print_string.h"
+#include "core/string/print_string.h"
#include "dependency_editor.h"
#include "editor_file_system.h"
#include "editor_resource_preview.h"
diff --git a/editor/editor_file_system.cpp b/editor/editor_file_system.cpp
index 3fcc06526b..c66bc9b3fa 100644
--- a/editor/editor_file_system.cpp
+++ b/editor/editor_file_system.cpp
@@ -30,13 +30,13 @@
#include "editor_file_system.h"
+#include "core/config/project_settings.h"
#include "core/io/resource_importer.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 "core/variant/variant_parser.h"
#include "editor_node.h"
#include "editor_resource_preview.h"
#include "editor_settings.h"
diff --git a/editor/editor_file_system.h b/editor/editor_file_system.h
index 02315d76f3..d5ae046c36 100644
--- a/editor/editor_file_system.h
+++ b/editor/editor_file_system.h
@@ -34,7 +34,7 @@
#include "core/os/dir_access.h"
#include "core/os/thread.h"
#include "core/os/thread_safe.h"
-#include "core/set.h"
+#include "core/templates/set.h"
#include "scene/main/node.h"
class FileAccess;
diff --git a/editor/editor_help_search.h b/editor/editor_help_search.h
index b37f74fd7e..f1aab6cc81 100644
--- a/editor/editor_help_search.h
+++ b/editor/editor_help_search.h
@@ -31,7 +31,7 @@
#ifndef EDITOR_HELP_SEARCH_H
#define EDITOR_HELP_SEARCH_H
-#include "core/ordered_hash_map.h"
+#include "core/templates/ordered_hash_map.h"
#include "editor/code_editor.h"
#include "editor/editor_help.h"
#include "editor/editor_plugin.h"
diff --git a/editor/editor_inspector.cpp b/editor/editor_inspector.cpp
index 1837b23a0b..371100652f 100644
--- a/editor/editor_inspector.cpp
+++ b/editor/editor_inspector.cpp
@@ -2278,7 +2278,7 @@ void EditorInspector::_property_checked(const String &p_path, bool p_checked) {
for (List<PropertyInfo>::Element *E = pinfo.front(); E; E = E->next()) {
if (E->get().name == p_path) {
Callable::CallError ce;
- to_create = Variant::construct(E->get().type, nullptr, 0, ce);
+ Variant::construct(E->get().type, to_create, nullptr, 0, ce);
break;
}
}
diff --git a/editor/editor_layouts_dialog.cpp b/editor/editor_layouts_dialog.cpp
index 14478b1386..c50fe81217 100644
--- a/editor/editor_layouts_dialog.cpp
+++ b/editor/editor_layouts_dialog.cpp
@@ -30,8 +30,8 @@
#include "editor_layouts_dialog.h"
-#include "core/class_db.h"
#include "core/io/config_file.h"
+#include "core/object/class_db.h"
#include "core/os/keyboard.h"
#include "editor/editor_settings.h"
#include "scene/gui/item_list.h"
diff --git a/editor/editor_node.cpp b/editor/editor_node.cpp
index 3a9715d1ab..d0d99e071a 100644
--- a/editor/editor_node.cpp
+++ b/editor/editor_node.cpp
@@ -30,21 +30,21 @@
#include "editor_node.h"
-#include "core/bind/core_bind.h"
-#include "core/class_db.h"
+#include "core/config/project_settings.h"
+#include "core/core_bind.h"
#include "core/input/input.h"
#include "core/io/config_file.h"
#include "core/io/image_loader.h"
#include "core/io/resource_loader.h"
#include "core/io/resource_saver.h"
#include "core/io/stream_peer_ssl.h"
-#include "core/message_queue.h"
+#include "core/object/class_db.h"
+#include "core/object/message_queue.h"
#include "core/os/file_access.h"
#include "core/os/keyboard.h"
#include "core/os/os.h"
-#include "core/print_string.h"
-#include "core/project_settings.h"
-#include "core/translation.h"
+#include "core/string/print_string.h"
+#include "core/string/translation.h"
#include "core/version.h"
#include "main/main.h"
#include "scene/gui/center_container.h"
diff --git a/editor/editor_plugin.h b/editor/editor_plugin.h
index dd3bf08678..11063066d6 100644
--- a/editor/editor_plugin.h
+++ b/editor/editor_plugin.h
@@ -32,7 +32,7 @@
#define EDITOR_PLUGIN_H
#include "core/io/config_file.h"
-#include "core/undo_redo.h"
+#include "core/object/undo_redo.h"
#include "editor/debugger/editor_debugger_node.h"
#include "editor/editor_inspector.h"
#include "editor/editor_translation_parser.h"
diff --git a/editor/editor_plugin_settings.cpp b/editor/editor_plugin_settings.cpp
index fe49198e8f..f984f48c1c 100644
--- a/editor/editor_plugin_settings.cpp
+++ b/editor/editor_plugin_settings.cpp
@@ -30,10 +30,10 @@
#include "editor_plugin_settings.h"
+#include "core/config/project_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 "editor_scale.h"
#include "scene/gui/margin_container.h"
diff --git a/editor/editor_plugin_settings.h b/editor/editor_plugin_settings.h
index ceb00eb12f..0b61e28449 100644
--- a/editor/editor_plugin_settings.h
+++ b/editor/editor_plugin_settings.h
@@ -31,7 +31,7 @@
#ifndef EDITORPLUGINSETTINGS_H
#define EDITORPLUGINSETTINGS_H
-#include "core/undo_redo.h"
+#include "core/object/undo_redo.h"
#include "editor/plugin_config_dialog.h"
#include "editor_data.h"
#include "property_editor.h"
diff --git a/editor/editor_properties.cpp b/editor/editor_properties.cpp
index 9e7ddd9fac..1443302f3f 100644
--- a/editor/editor_properties.cpp
+++ b/editor/editor_properties.cpp
@@ -3645,7 +3645,7 @@ bool EditorInspectorDefaultPlugin::parse_property(Object *p_object, Variant::Typ
add_property_editor(p_path, editor);
} break;
- case Variant::_RID: {
+ case Variant::RID: {
EditorPropertyRID *editor = memnew(EditorPropertyRID);
add_property_editor(p_path, editor);
} break;
diff --git a/editor/editor_properties_array_dict.cpp b/editor/editor_properties_array_dict.cpp
index 51fac6acec..56fbfbd0c2 100644
--- a/editor/editor_properties_array_dict.cpp
+++ b/editor/editor_properties_array_dict.cpp
@@ -186,7 +186,7 @@ void EditorPropertyArray::_change_type_menu(int p_index) {
Variant value;
Callable::CallError ce;
- value = Variant::construct(Variant::Type(p_index), nullptr, 0, ce);
+ Variant::construct(Variant::Type(p_index), value, nullptr, 0, ce);
Variant array = object->get_array();
array.set(changing_type_idx, value);
@@ -445,7 +445,7 @@ void EditorPropertyArray::drop_data_fw(const Point2 &p_point, const Variant &p_d
// Handle the case where array is not initialised yet
if (!array.is_array()) {
Callable::CallError ce;
- array = Variant::construct(array_type, nullptr, 0, ce);
+ Variant::construct(array_type, array, nullptr, 0, ce);
}
// Loop the file array and add to existing array
@@ -491,7 +491,7 @@ void EditorPropertyArray::_edit_pressed() {
Variant array = get_edited_object()->get(get_edited_property());
if (!array.is_array()) {
Callable::CallError ce;
- array = Variant::construct(array_type, nullptr, 0, ce);
+ Variant::construct(array_type, array, nullptr, 0, ce);
get_edited_object()->set(get_edited_property(), array);
}
@@ -524,7 +524,9 @@ void EditorPropertyArray::_length_changed(double p_page) {
for (int i = previous_size; i < size; i++) {
if (array.get(i).get_type() == Variant::NIL) {
Callable::CallError ce;
- array.set(i, Variant::construct(subtype, nullptr, 0, ce));
+ Variant r;
+ Variant::construct(subtype, r, nullptr, 0, ce);
+ array.set(i, r);
}
}
}
@@ -534,7 +536,9 @@ void EditorPropertyArray::_length_changed(double p_page) {
// Pool*Array don't initialize their elements, have to do it manually
for (int i = previous_size; i < size; i++) {
Callable::CallError ce;
- array.set(i, Variant::construct(array.get(i).get_type(), nullptr, 0, ce));
+ Variant r;
+ Variant::construct(array.get(i).get_type(), r, nullptr, 0, ce);
+ array.set(i, r);
}
}
@@ -657,7 +661,7 @@ void EditorPropertyDictionary::_change_type_menu(int p_index) {
if (changing_type_idx < 0) {
Variant value;
Callable::CallError ce;
- value = Variant::construct(Variant::Type(p_index), nullptr, 0, ce);
+ Variant::construct(Variant::Type(p_index), value, nullptr, 0, ce);
if (changing_type_idx == -1) {
object->set_new_item_key(value);
} else {
@@ -672,7 +676,7 @@ void EditorPropertyDictionary::_change_type_menu(int p_index) {
if (p_index < Variant::VARIANT_MAX) {
Variant value;
Callable::CallError ce;
- value = Variant::construct(Variant::Type(p_index), nullptr, 0, ce);
+ Variant::construct(Variant::Type(p_index), value, nullptr, 0, ce);
Variant key = dict.get_key_at_index(changing_type_idx);
dict[key] = value;
} else {
@@ -888,7 +892,7 @@ void EditorPropertyDictionary::update_property() {
prop = memnew(EditorPropertyNodePath);
} break;
- case Variant::_RID: {
+ case Variant::RID: {
prop = memnew(EditorPropertyRID);
} break;
@@ -1044,7 +1048,7 @@ void EditorPropertyDictionary::_edit_pressed() {
Variant prop_val = get_edited_object()->get(get_edited_property());
if (prop_val.get_type() == Variant::NIL) {
Callable::CallError ce;
- prop_val = Variant::construct(Variant::DICTIONARY, nullptr, 0, ce);
+ Variant::construct(Variant::DICTIONARY, prop_val, nullptr, 0, ce);
get_edited_object()->set(get_edited_property(), prop_val);
}
diff --git a/editor/editor_resource_preview.cpp b/editor/editor_resource_preview.cpp
index 9723ae188b..d1ec50d786 100644
--- a/editor/editor_resource_preview.cpp
+++ b/editor/editor_resource_preview.cpp
@@ -30,11 +30,11 @@
#include "editor_resource_preview.h"
+#include "core/config/project_settings.h"
#include "core/io/resource_loader.h"
#include "core/io/resource_saver.h"
-#include "core/message_queue.h"
+#include "core/object/message_queue.h"
#include "core/os/file_access.h"
-#include "core/project_settings.h"
#include "editor_node.h"
#include "editor_scale.h"
#include "editor_settings.h"
diff --git a/editor/editor_run.cpp b/editor/editor_run.cpp
index 7fada633c9..2bba15c017 100644
--- a/editor/editor_run.cpp
+++ b/editor/editor_run.cpp
@@ -30,7 +30,7 @@
#include "editor_run.h"
-#include "core/project_settings.h"
+#include "core/config/project_settings.h"
#include "editor_settings.h"
#include "servers/display_server.h"
diff --git a/editor/editor_run_script.h b/editor/editor_run_script.h
index 261e2a7e41..3cb751ecc8 100644
--- a/editor/editor_run_script.h
+++ b/editor/editor_run_script.h
@@ -31,7 +31,7 @@
#ifndef EDITOR_RUN_SCRIPT_H
#define EDITOR_RUN_SCRIPT_H
-#include "core/reference.h"
+#include "core/object/reference.h"
#include "editor_plugin.h"
class EditorNode;
class EditorScript : public Reference {
diff --git a/editor/editor_settings.cpp b/editor/editor_settings.cpp
index ac27c4a837..f5c1de9def 100644
--- a/editor/editor_settings.cpp
+++ b/editor/editor_settings.cpp
@@ -30,6 +30,7 @@
#include "editor_settings.h"
+#include "core/config/project_settings.h"
#include "core/io/certs_compressed.gen.h"
#include "core/io/compression.h"
#include "core/io/config_file.h"
@@ -42,7 +43,6 @@
#include "core/os/file_access.h"
#include "core/os/keyboard.h"
#include "core/os/os.h"
-#include "core/project_settings.h"
#include "core/version.h"
#include "editor/doc_translations.gen.h"
#include "editor/editor_node.h"
diff --git a/editor/editor_settings.h b/editor/editor_settings.h
index c1bb7951fa..41e6bab4ba 100644
--- a/editor/editor_settings.h
+++ b/editor/editor_settings.h
@@ -31,11 +31,11 @@
#ifndef EDITOR_SETTINGS_H
#define EDITOR_SETTINGS_H
-#include "core/class_db.h"
#include "core/io/config_file.h"
+#include "core/io/resource.h"
+#include "core/object/class_db.h"
#include "core/os/thread_safe.h"
-#include "core/resource.h"
-#include "core/translation.h"
+#include "core/string/translation.h"
#include "scene/gui/shortcut.h"
class EditorPlugin;
diff --git a/editor/editor_translation_parser.cpp b/editor/editor_translation_parser.cpp
index 7a90d20000..4e6a397840 100644
--- a/editor/editor_translation_parser.cpp
+++ b/editor/editor_translation_parser.cpp
@@ -30,10 +30,10 @@
#include "editor_translation_parser.h"
-#include "core/error_macros.h"
+#include "core/error/error_macros.h"
+#include "core/object/script_language.h"
#include "core/os/file_access.h"
-#include "core/script_language.h"
-#include "core/set.h"
+#include "core/templates/set.h"
EditorTranslationParser *EditorTranslationParser::singleton = nullptr;
diff --git a/editor/editor_translation_parser.h b/editor/editor_translation_parser.h
index 18f49b3803..bdebdd10a1 100644
--- a/editor/editor_translation_parser.h
+++ b/editor/editor_translation_parser.h
@@ -31,8 +31,8 @@
#ifndef EDITOR_TRANSLATION_PARSER_H
#define EDITOR_TRANSLATION_PARSER_H
-#include "core/error_list.h"
-#include "core/reference.h"
+#include "core/error/error_list.h"
+#include "core/object/reference.h"
class EditorTranslationParserPlugin : public Reference {
GDCLASS(EditorTranslationParserPlugin, Reference);
diff --git a/editor/editor_vcs_interface.h b/editor/editor_vcs_interface.h
index 6ef55f0a46..7de1883fd7 100644
--- a/editor/editor_vcs_interface.h
+++ b/editor/editor_vcs_interface.h
@@ -31,8 +31,8 @@
#ifndef EDITOR_VCS_INTERFACE_H
#define EDITOR_VCS_INTERFACE_H
-#include "core/class_db.h"
-#include "core/ustring.h"
+#include "core/object/class_db.h"
+#include "core/string/ustring.h"
#include "scene/gui/panel_container.h"
class EditorVCSInterface : public Object {
diff --git a/editor/fileserver/editor_file_server.h b/editor/fileserver/editor_file_server.h
index eefaa503c1..ca5a891856 100644
--- a/editor/fileserver/editor_file_server.h
+++ b/editor/fileserver/editor_file_server.h
@@ -31,10 +31,10 @@
#ifndef EDITOR_FILE_SERVER_H
#define EDITOR_FILE_SERVER_H
-#include "core/class_db.h"
#include "core/io/file_access_network.h"
#include "core/io/packet_peer.h"
#include "core/io/tcp_server.h"
+#include "core/object/class_db.h"
#include "core/os/thread.h"
class EditorFileServer : public Object {
diff --git a/editor/filesystem_dock.cpp b/editor/filesystem_dock.cpp
index 14a46d77a2..2052319e3e 100644
--- a/editor/filesystem_dock.cpp
+++ b/editor/filesystem_dock.cpp
@@ -30,13 +30,13 @@
#include "filesystem_dock.h"
+#include "core/config/project_settings.h"
#include "core/io/resource_loader.h"
-#include "core/list.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 "core/templates/list.h"
#include "editor_feature_profile.h"
#include "editor_node.h"
#include "editor_resource_preview.h"
diff --git a/editor/find_in_files.h b/editor/find_in_files.h
index 5f2c6ee174..3b949a35b4 100644
--- a/editor/find_in_files.h
+++ b/editor/find_in_files.h
@@ -31,7 +31,7 @@
#ifndef FIND_IN_FILES_H
#define FIND_IN_FILES_H
-#include "core/hash_map.h"
+#include "core/templates/hash_map.h"
#include "scene/gui/dialogs.h"
// Performs the actual search
diff --git a/editor/groups_editor.h b/editor/groups_editor.h
index d5daaa19eb..6c3489fffb 100644
--- a/editor/groups_editor.h
+++ b/editor/groups_editor.h
@@ -31,7 +31,7 @@
#ifndef GROUPS_EDITOR_H
#define GROUPS_EDITOR_H
-#include "core/undo_redo.h"
+#include "core/object/undo_redo.h"
#include "editor/scene_tree_editor.h"
#include "scene/gui/button.h"
#include "scene/gui/dialogs.h"
diff --git a/editor/icons/DirectionalLight2D.svg b/editor/icons/DirectionalLight2D.svg
new file mode 100644
index 0000000000..f30702b502
--- /dev/null
+++ b/editor/icons/DirectionalLight2D.svg
@@ -0,0 +1 @@
+<svg height="16" viewBox="0 0 16 16" width="16" xmlns="http://www.w3.org/2000/svg"><path d="m7 1v3h2v-3zm-2.5352 2.0508-1.4141 1.4141 1.4141 1.4141 1.4141-1.4141zm7.0703 0-1.4141 1.4141 1.4141 1.4141 1.4141-1.4141zm-3.5352 1.9492c-1.6569 0-3 1.3432-3 3s1.3431 3 3 3 3-1.3432 3-3-1.3431-3-3-3zm-7 2v2h3v-2zm11 0v2h3v-2zm-7.5352 3.1211-1.4141 1.4141 1.4141 1.4141 1.4141-1.4141zm7.0703 0-1.4141 1.4141 1.4141 1.4141 1.4141-1.4141zm-4.5352 1.8789v3h2v-3z" fill="#a5b7f4"/></svg>
diff --git a/editor/icons/Light2D.svg b/editor/icons/PointLight2D.svg
index d660b82c34..d660b82c34 100644
--- a/editor/icons/Light2D.svg
+++ b/editor/icons/PointLight2D.svg
diff --git a/editor/import/collada.h b/editor/import/collada.h
index 90c6c47e0b..aa0d42035f 100644
--- a/editor/import/collada.h
+++ b/editor/import/collada.h
@@ -31,9 +31,9 @@
#ifndef COLLADA_H
#define COLLADA_H
+#include "core/config/project_settings.h"
#include "core/io/xml_parser.h"
-#include "core/map.h"
-#include "core/project_settings.h"
+#include "core/templates/map.h"
#include "scene/resources/material.h"
class Collada {
diff --git a/editor/import/editor_import_plugin.cpp b/editor/import/editor_import_plugin.cpp
index 6d46d4d2e9..2658031bd9 100644
--- a/editor/import/editor_import_plugin.cpp
+++ b/editor/import/editor_import_plugin.cpp
@@ -29,7 +29,7 @@
/*************************************************************************/
#include "editor_import_plugin.h"
-#include "core/script_language.h"
+#include "core/object/script_language.h"
EditorImportPlugin::EditorImportPlugin() {
}
diff --git a/editor/import/resource_importer_bitmask.cpp b/editor/import/resource_importer_bitmask.cpp
index da2d1c9bdf..06b56fd73f 100644
--- a/editor/import/resource_importer_bitmask.cpp
+++ b/editor/import/resource_importer_bitmask.cpp
@@ -29,8 +29,8 @@
/*************************************************************************/
#include "resource_importer_bitmask.h"
-#include "core/image.h"
#include "core/io/config_file.h"
+#include "core/io/image.h"
#include "core/io/image_loader.h"
#include "editor/editor_file_system.h"
#include "editor/editor_node.h"
diff --git a/editor/import/resource_importer_bitmask.h b/editor/import/resource_importer_bitmask.h
index 0d3cb23697..83959f87cd 100644
--- a/editor/import/resource_importer_bitmask.h
+++ b/editor/import/resource_importer_bitmask.h
@@ -31,7 +31,7 @@
#ifndef RESOURCE_IMPORTER_BITMASK_H
#define RESOURCE_IMPORTER_BITMASK_H
-#include "core/image.h"
+#include "core/io/image.h"
#include "core/io/resource_importer.h"
class StreamBitMap;
diff --git a/editor/import/resource_importer_csv_translation.cpp b/editor/import/resource_importer_csv_translation.cpp
index 04e20dee86..4c6200e033 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 "core/compressed_translation.h"
#include "core/io/resource_saver.h"
#include "core/os/file_access.h"
-#include "core/translation.h"
+#include "core/string/compressed_translation.h"
+#include "core/string/translation.h"
String ResourceImporterCSVTranslation::get_importer_name() const {
return "csv_translation";
diff --git a/editor/import/resource_importer_image.h b/editor/import/resource_importer_image.h
index dc9c2c3014..703b36b091 100644
--- a/editor/import/resource_importer_image.h
+++ b/editor/import/resource_importer_image.h
@@ -31,7 +31,7 @@
#ifndef RESOURCE_IMPORTER_IMAGE_H
#define RESOURCE_IMPORTER_IMAGE_H
-#include "core/image.h"
+#include "core/io/image.h"
#include "core/io/resource_importer.h"
class ResourceImporterImage : public ResourceImporter {
diff --git a/editor/import/resource_importer_layered_texture.h b/editor/import/resource_importer_layered_texture.h
index b54923be00..7ac3d55dec 100644
--- a/editor/import/resource_importer_layered_texture.h
+++ b/editor/import/resource_importer_layered_texture.h
@@ -61,7 +61,7 @@
#ifndef RESOURCE_IMPORTER_LAYERED_TEXTURE_H
#define RESOURCE_IMPORTER_LAYERED_TEXTURE_H
-#include "core/image.h"
+#include "core/io/image.h"
#include "core/io/resource_importer.h"
class StreamTexture2D;
diff --git a/editor/import/resource_importer_texture.h b/editor/import/resource_importer_texture.h
index bc41aacae5..97c4622731 100644
--- a/editor/import/resource_importer_texture.h
+++ b/editor/import/resource_importer_texture.h
@@ -31,7 +31,7 @@
#ifndef RESOURCEIMPORTTEXTURE_H
#define RESOURCEIMPORTTEXTURE_H
-#include "core/image.h"
+#include "core/io/image.h"
#include "core/io/resource_importer.h"
#include "core/os/file_access.h"
#include "scene/resources/texture.h"
diff --git a/editor/import/resource_importer_texture_atlas.h b/editor/import/resource_importer_texture_atlas.h
index 25a662a333..9d973c3d8d 100644
--- a/editor/import/resource_importer_texture_atlas.h
+++ b/editor/import/resource_importer_texture_atlas.h
@@ -31,7 +31,7 @@
#ifndef RESOURCE_IMPORTER_TEXTURE_ATLAS_H
#define RESOURCE_IMPORTER_TEXTURE_ATLAS_H
-#include "core/image.h"
+#include "core/io/image.h"
#include "core/io/resource_importer.h"
class ResourceImporterTextureAtlas : public ResourceImporter {
GDCLASS(ResourceImporterTextureAtlas, ResourceImporter);
diff --git a/editor/input_map_editor.h b/editor/input_map_editor.h
index 87a25e91b0..b9a3ce19d4 100644
--- a/editor/input_map_editor.h
+++ b/editor/input_map_editor.h
@@ -31,7 +31,7 @@
#ifndef INPUT_MAP_EDITOR_H
#define INPUT_MAP_EDITOR_H
-#include "core/undo_redo.h"
+#include "core/object/undo_redo.h"
#include "editor/editor_data.h"
class InputMapEditor : public Control {
diff --git a/editor/localization_editor.cpp b/editor/localization_editor.cpp
index e4562c57af..e725ce482d 100644
--- a/editor/localization_editor.cpp
+++ b/editor/localization_editor.cpp
@@ -30,7 +30,7 @@
#include "localization_editor.h"
-#include "core/translation.h"
+#include "core/string/translation.h"
#include "editor_node.h"
#include "editor_translation_parser.h"
#include "pot_generator.h"
diff --git a/editor/localization_editor.h b/editor/localization_editor.h
index b7253fb31d..3c077d9c77 100644
--- a/editor/localization_editor.h
+++ b/editor/localization_editor.h
@@ -31,7 +31,7 @@
#ifndef LOCALIZATION_EDITOR_H
#define LOCALIZATION_EDITOR_H
-#include "core/undo_redo.h"
+#include "core/object/undo_redo.h"
#include "editor_file_dialog.h"
#include "scene/gui/tree.h"
diff --git a/editor/plugins/animation_blend_space_2d_editor.cpp b/editor/plugins/animation_blend_space_2d_editor.cpp
index 805df0cbb9..60a5188af7 100644
--- a/editor/plugins/animation_blend_space_2d_editor.cpp
+++ b/editor/plugins/animation_blend_space_2d_editor.cpp
@@ -30,11 +30,11 @@
#include "animation_blend_space_2d_editor.h"
+#include "core/config/project_settings.h"
#include "core/input/input.h"
#include "core/io/resource_loader.h"
#include "core/math/geometry_2d.h"
#include "core/os/keyboard.h"
-#include "core/project_settings.h"
#include "editor/editor_scale.h"
#include "scene/animation/animation_blend_tree.h"
#include "scene/animation/animation_player.h"
diff --git a/editor/plugins/animation_blend_tree_editor_plugin.cpp b/editor/plugins/animation_blend_tree_editor_plugin.cpp
index 6419f62343..38648b5f0a 100644
--- a/editor/plugins/animation_blend_tree_editor_plugin.cpp
+++ b/editor/plugins/animation_blend_tree_editor_plugin.cpp
@@ -30,10 +30,10 @@
#include "animation_blend_tree_editor_plugin.h"
+#include "core/config/project_settings.h"
#include "core/input/input.h"
#include "core/io/resource_loader.h"
#include "core/os/keyboard.h"
-#include "core/project_settings.h"
#include "editor/editor_inspector.h"
#include "editor/editor_scale.h"
#include "scene/animation/animation_player.h"
diff --git a/editor/plugins/animation_player_editor_plugin.cpp b/editor/plugins/animation_player_editor_plugin.cpp
index 6e4a39d3f0..1e56e3d11f 100644
--- a/editor/plugins/animation_player_editor_plugin.cpp
+++ b/editor/plugins/animation_player_editor_plugin.cpp
@@ -30,11 +30,11 @@
#include "animation_player_editor_plugin.h"
+#include "core/config/project_settings.h"
#include "core/input/input.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_scale.h"
#include "editor/editor_settings.h"
diff --git a/editor/plugins/animation_state_machine_editor.cpp b/editor/plugins/animation_state_machine_editor.cpp
index 885ec17cb3..4634d15941 100644
--- a/editor/plugins/animation_state_machine_editor.cpp
+++ b/editor/plugins/animation_state_machine_editor.cpp
@@ -30,11 +30,11 @@
#include "animation_state_machine_editor.h"
+#include "core/config/project_settings.h"
#include "core/input/input.h"
#include "core/io/resource_loader.h"
#include "core/math/geometry_2d.h"
#include "core/os/keyboard.h"
-#include "core/project_settings.h"
#include "editor/editor_scale.h"
#include "scene/animation/animation_blend_tree.h"
#include "scene/animation/animation_player.h"
diff --git a/editor/plugins/animation_tree_editor_plugin.cpp b/editor/plugins/animation_tree_editor_plugin.cpp
index 269c54ba2b..1bbb68d224 100644
--- a/editor/plugins/animation_tree_editor_plugin.cpp
+++ b/editor/plugins/animation_tree_editor_plugin.cpp
@@ -34,11 +34,11 @@
#include "animation_blend_space_2d_editor.h"
#include "animation_blend_tree_editor_plugin.h"
#include "animation_state_machine_editor.h"
+#include "core/config/project_settings.h"
#include "core/input/input.h"
#include "core/io/resource_loader.h"
#include "core/math/delaunay_2d.h"
#include "core/os/keyboard.h"
-#include "core/project_settings.h"
#include "editor/editor_scale.h"
#include "scene/animation/animation_blend_tree.h"
#include "scene/animation/animation_player.h"
diff --git a/editor/plugins/audio_stream_editor_plugin.cpp b/editor/plugins/audio_stream_editor_plugin.cpp
index 231f5588a4..e6f6b6f2e0 100644
--- a/editor/plugins/audio_stream_editor_plugin.cpp
+++ b/editor/plugins/audio_stream_editor_plugin.cpp
@@ -30,8 +30,8 @@
#include "audio_stream_editor_plugin.h"
+#include "core/config/project_settings.h"
#include "core/io/resource_loader.h"
-#include "core/project_settings.h"
#include "editor/audio_stream_preview.h"
#include "editor/editor_scale.h"
#include "editor/editor_settings.h"
diff --git a/editor/plugins/canvas_item_editor_plugin.cpp b/editor/plugins/canvas_item_editor_plugin.cpp
index 1af60b59a2..e1f2d2c045 100644
--- a/editor/plugins/canvas_item_editor_plugin.cpp
+++ b/editor/plugins/canvas_item_editor_plugin.cpp
@@ -30,11 +30,11 @@
#include "canvas_item_editor_plugin.h"
+#include "core/config/project_settings.h"
#include "core/input/input.h"
#include "core/math/geometry_2d.h"
#include "core/os/keyboard.h"
-#include "core/print_string.h"
-#include "core/project_settings.h"
+#include "core/string/print_string.h"
#include "editor/debugger/editor_debugger_node.h"
#include "editor/editor_node.h"
#include "editor/editor_scale.h"
diff --git a/editor/plugins/node_3d_editor_plugin.cpp b/editor/plugins/node_3d_editor_plugin.cpp
index 7002ffa109..fdbf3415db 100644
--- a/editor/plugins/node_3d_editor_plugin.cpp
+++ b/editor/plugins/node_3d_editor_plugin.cpp
@@ -30,12 +30,12 @@
#include "node_3d_editor_plugin.h"
+#include "core/config/project_settings.h"
#include "core/input/input.h"
#include "core/math/camera_matrix.h"
#include "core/os/keyboard.h"
-#include "core/print_string.h"
-#include "core/project_settings.h"
-#include "core/sort_array.h"
+#include "core/string/print_string.h"
+#include "core/templates/sort_array.h"
#include "editor/debugger/editor_debugger_node.h"
#include "editor/editor_node.h"
#include "editor/editor_scale.h"
@@ -2426,6 +2426,7 @@ void Node3DEditorViewport::_notification(int p_what) {
t.basis = t.basis * aabb_s;
RenderingServer::get_singleton()->instance_set_transform(se->sbox_instance, t);
+ RenderingServer::get_singleton()->instance_set_transform(se->sbox_instance_xray, t);
}
if (changed || (spatial_editor->is_gizmo_visible() && !exist)) {
@@ -4417,6 +4418,9 @@ Node3DEditorSelectedItem::~Node3DEditorSelectedItem() {
if (sbox_instance.is_valid()) {
RenderingServer::get_singleton()->free(sbox_instance);
}
+ if (sbox_instance_xray.is_valid()) {
+ RenderingServer::get_singleton()->free(sbox_instance_xray);
+ }
}
void Node3DEditor::select_gizmo_highlight_axis(int p_axis) {
@@ -4500,42 +4504,73 @@ Object *Node3DEditor::_get_editor_data(Object *p_what) {
Node3DEditorSelectedItem *si = memnew(Node3DEditorSelectedItem);
si->sp = sp;
- si->sbox_instance = RenderingServer::get_singleton()->instance_create2(selection_box->get_rid(), sp->get_world_3d()->get_scenario());
- RS::get_singleton()->instance_geometry_set_cast_shadows_setting(si->sbox_instance, RS::SHADOW_CASTING_SETTING_OFF);
+ si->sbox_instance = RenderingServer::get_singleton()->instance_create2(
+ selection_box->get_rid(),
+ sp->get_world_3d()->get_scenario());
+ RS::get_singleton()->instance_geometry_set_cast_shadows_setting(
+ si->sbox_instance,
+ RS::SHADOW_CASTING_SETTING_OFF);
+ si->sbox_instance_xray = RenderingServer::get_singleton()->instance_create2(
+ selection_box_xray->get_rid(),
+ sp->get_world_3d()->get_scenario());
+ RS::get_singleton()->instance_geometry_set_cast_shadows_setting(
+ si->sbox_instance_xray,
+ RS::SHADOW_CASTING_SETTING_OFF);
return si;
}
-void Node3DEditor::_generate_selection_box() {
+void Node3DEditor::_generate_selection_boxes() {
+ // Use two AABBs to create the illusion of a slightly thicker line.
AABB aabb(Vector3(), Vector3(1, 1, 1));
- aabb.grow_by(aabb.get_longest_axis_size() / 20.0);
-
+ AABB aabb_offset(Vector3(), Vector3(1, 1, 1));
+ // Grow the bounding boxes slightly to avoid Z-fighting with the mesh's edges.
+ aabb.grow_by(0.005);
+ aabb_offset.grow_by(0.01);
+
+ // Create a x-ray (visible through solid surfaces) and standard version of the selection box.
+ // Both will be drawn at the same position, but with different opacity.
+ // This lets the user see where the selection is while still having a sense of depth.
Ref<SurfaceTool> st = memnew(SurfaceTool);
+ Ref<SurfaceTool> st_xray = memnew(SurfaceTool);
st->begin(Mesh::PRIMITIVE_LINES);
+ st_xray->begin(Mesh::PRIMITIVE_LINES);
for (int i = 0; i < 12; i++) {
Vector3 a, b;
aabb.get_edge(i, a, b);
- st->add_color(Color(1.0, 1.0, 0.8, 0.8));
st->add_vertex(a);
- st->add_color(Color(1.0, 1.0, 0.8, 0.4));
- st->add_vertex(a.lerp(b, 0.2));
+ st->add_vertex(b);
+ st_xray->add_vertex(a);
+ st_xray->add_vertex(b);
+ }
- st->add_color(Color(1.0, 1.0, 0.8, 0.4));
- st->add_vertex(a.lerp(b, 0.8));
- st->add_color(Color(1.0, 1.0, 0.8, 0.8));
+ for (int i = 0; i < 12; i++) {
+ Vector3 a, b;
+ aabb_offset.get_edge(i, a, b);
+
+ st->add_vertex(a);
st->add_vertex(b);
+ st_xray->add_vertex(a);
+ st_xray->add_vertex(b);
}
Ref<StandardMaterial3D> mat = memnew(StandardMaterial3D);
mat->set_shading_mode(StandardMaterial3D::SHADING_MODE_UNSHADED);
- mat->set_albedo(Color(1, 1, 1));
+ // Use a similar color to the 2D editor selection.
+ mat->set_albedo(Color(1, 0.5, 0));
mat->set_transparency(StandardMaterial3D::TRANSPARENCY_ALPHA);
- mat->set_flag(StandardMaterial3D::FLAG_ALBEDO_FROM_VERTEX_COLOR, true);
- mat->set_flag(StandardMaterial3D::FLAG_SRGB_VERTEX_COLOR, true);
st->set_material(mat);
selection_box = st->commit();
+
+ Ref<StandardMaterial3D> mat_xray = memnew(StandardMaterial3D);
+ mat_xray->set_shading_mode(StandardMaterial3D::SHADING_MODE_UNSHADED);
+ mat_xray->set_flag(StandardMaterial3D::FLAG_DISABLE_DEPTH_TEST, true);
+ mat_xray->set_albedo(Color(1, 0.5, 0, 0.15));
+ mat_xray->set_transparency(StandardMaterial3D::TRANSPARENCY_ALPHA);
+ st_xray->set_material(mat_xray);
+ selection_box_xray = st_xray->commit();
}
Dictionary Node3DEditor::get_state() const {
@@ -4687,7 +4722,7 @@ void Node3DEditor::set_state(const Dictionary &p_state) {
}
int state = EditorNode3DGizmoPlugin::VISIBLE;
for (int i = 0; i < keys.size(); i++) {
- if (gizmo_plugins_by_name.write[j]->get_name() == keys[i]) {
+ if (gizmo_plugins_by_name.write[j]->get_name() == String(keys[i])) {
state = gizmos_status[keys[i]];
break;
}
@@ -5514,7 +5549,7 @@ void Node3DEditor::_init_indicators() {
}
}
- _generate_selection_box();
+ _generate_selection_boxes();
}
void Node3DEditor::_update_gizmos_menu() {
diff --git a/editor/plugins/node_3d_editor_plugin.h b/editor/plugins/node_3d_editor_plugin.h
index e4a384449b..4c4faef07f 100644
--- a/editor/plugins/node_3d_editor_plugin.h
+++ b/editor/plugins/node_3d_editor_plugin.h
@@ -498,6 +498,7 @@ public:
bool last_xform_dirty;
Node3D *sp;
RID sbox_instance;
+ RID sbox_instance_xray;
Node3DEditorSelectedItem() {
sp = nullptr;
@@ -613,6 +614,7 @@ private:
float snap_rotate_value;
float snap_scale_value;
+ Ref<ArrayMesh> selection_box_xray;
Ref<ArrayMesh> selection_box;
RID indicators;
RID indicators_instance;
@@ -701,7 +703,7 @@ private:
HBoxContainer *hbc_menu;
- void _generate_selection_box();
+ void _generate_selection_boxes();
UndoRedo *undo_redo;
int camera_override_viewport_id;
diff --git a/editor/plugins/resource_preloader_editor_plugin.cpp b/editor/plugins/resource_preloader_editor_plugin.cpp
index 9ab5bfd8a3..f317aebe74 100644
--- a/editor/plugins/resource_preloader_editor_plugin.cpp
+++ b/editor/plugins/resource_preloader_editor_plugin.cpp
@@ -30,8 +30,8 @@
#include "resource_preloader_editor_plugin.h"
+#include "core/config/project_settings.h"
#include "core/io/resource_loader.h"
-#include "core/project_settings.h"
#include "editor/editor_scale.h"
#include "editor/editor_settings.h"
diff --git a/editor/plugins/script_editor_plugin.cpp b/editor/plugins/script_editor_plugin.cpp
index be8ddf789b..8dd7d6d6e2 100644
--- a/editor/plugins/script_editor_plugin.cpp
+++ b/editor/plugins/script_editor_plugin.cpp
@@ -30,12 +30,12 @@
#include "script_editor_plugin.h"
+#include "core/config/project_settings.h"
#include "core/input/input.h"
#include "core/io/resource_loader.h"
#include "core/os/file_access.h"
#include "core/os/keyboard.h"
#include "core/os/os.h"
-#include "core/project_settings.h"
#include "editor/debugger/editor_debugger_node.h"
#include "editor/editor_node.h"
#include "editor/editor_run_script.h"
@@ -2397,7 +2397,7 @@ void ScriptEditor::_editor_settings_changed() {
if (current_theme == "") {
current_theme = EditorSettings::get_singleton()->get("text_editor/theme/color_theme");
- } else if (current_theme != EditorSettings::get_singleton()->get("text_editor/theme/color_theme")) {
+ } else if (current_theme != String(EditorSettings::get_singleton()->get("text_editor/theme/color_theme"))) {
current_theme = EditorSettings::get_singleton()->get("text_editor/theme/color_theme");
EditorSettings::get_singleton()->load_text_editor_theme();
}
diff --git a/editor/plugins/script_editor_plugin.h b/editor/plugins/script_editor_plugin.h
index c2b0b458eb..32f47239ef 100644
--- a/editor/plugins/script_editor_plugin.h
+++ b/editor/plugins/script_editor_plugin.h
@@ -31,7 +31,7 @@
#ifndef SCRIPT_EDITOR_PLUGIN_H
#define SCRIPT_EDITOR_PLUGIN_H
-#include "core/script_language.h"
+#include "core/object/script_language.h"
#include "editor/code_editor.h"
#include "editor/editor_help.h"
#include "editor/editor_help_search.h"
diff --git a/editor/plugins/sprite_frames_editor_plugin.cpp b/editor/plugins/sprite_frames_editor_plugin.cpp
index 5007983581..69a8a8d92c 100644
--- a/editor/plugins/sprite_frames_editor_plugin.cpp
+++ b/editor/plugins/sprite_frames_editor_plugin.cpp
@@ -30,8 +30,8 @@
#include "sprite_frames_editor_plugin.h"
+#include "core/config/project_settings.h"
#include "core/io/resource_loader.h"
-#include "core/project_settings.h"
#include "editor/editor_scale.h"
#include "editor/editor_settings.h"
#include "scene/3d/sprite_3d.h"
diff --git a/editor/plugins/texture_3d_editor_plugin.cpp b/editor/plugins/texture_3d_editor_plugin.cpp
index ba2eef8484..8447a2346f 100644
--- a/editor/plugins/texture_3d_editor_plugin.cpp
+++ b/editor/plugins/texture_3d_editor_plugin.cpp
@@ -30,8 +30,8 @@
#include "texture_3d_editor_plugin.h"
+#include "core/config/project_settings.h"
#include "core/io/resource_loader.h"
-#include "core/project_settings.h"
#include "editor/editor_settings.h"
void Texture3DEditor::_gui_input(Ref<InputEvent> p_event) {
diff --git a/editor/plugins/texture_editor_plugin.cpp b/editor/plugins/texture_editor_plugin.cpp
index b728a6700c..f8facb0fd5 100644
--- a/editor/plugins/texture_editor_plugin.cpp
+++ b/editor/plugins/texture_editor_plugin.cpp
@@ -30,8 +30,8 @@
#include "texture_editor_plugin.h"
+#include "core/config/project_settings.h"
#include "core/io/resource_loader.h"
-#include "core/project_settings.h"
#include "editor/editor_settings.h"
void TextureEditor::_gui_input(Ref<InputEvent> p_event) {
diff --git a/editor/plugins/texture_layered_editor_plugin.cpp b/editor/plugins/texture_layered_editor_plugin.cpp
index 59e87fb273..eafe4d546b 100644
--- a/editor/plugins/texture_layered_editor_plugin.cpp
+++ b/editor/plugins/texture_layered_editor_plugin.cpp
@@ -30,8 +30,8 @@
#include "texture_layered_editor_plugin.h"
+#include "core/config/project_settings.h"
#include "core/io/resource_loader.h"
-#include "core/project_settings.h"
#include "editor/editor_settings.h"
void TextureLayeredEditor::_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 6e722607f7..f599b94428 100644
--- a/editor/plugins/texture_region_editor_plugin.cpp
+++ b/editor/plugins/texture_region_editor_plugin.cpp
@@ -875,7 +875,8 @@ void TextureRegionEditor::_changed_callback(Object *p_changed, const char *p_pro
if (!is_visible()) {
return;
}
- if (p_prop == StringName("atlas") || p_prop == StringName("texture") || p_prop == StringName("region")) {
+ String prop = p_prop;
+ if (prop == "atlas" || prop == "texture" || prop == "region") {
_edit_region();
}
}
diff --git a/editor/plugins/version_control_editor_plugin.cpp b/editor/plugins/version_control_editor_plugin.cpp
index cfbe54ef61..5e98b2d98b 100644
--- a/editor/plugins/version_control_editor_plugin.cpp
+++ b/editor/plugins/version_control_editor_plugin.cpp
@@ -30,7 +30,7 @@
#include "version_control_editor_plugin.h"
-#include "core/script_language.h"
+#include "core/object/script_language.h"
#include "editor/editor_file_system.h"
#include "editor/editor_node.h"
#include "editor/editor_scale.h"
diff --git a/editor/plugins/visual_shader_editor_plugin.cpp b/editor/plugins/visual_shader_editor_plugin.cpp
index ddcba18a78..f3fc22b313 100644
--- a/editor/plugins/visual_shader_editor_plugin.cpp
+++ b/editor/plugins/visual_shader_editor_plugin.cpp
@@ -30,11 +30,11 @@
#include "visual_shader_editor_plugin.h"
+#include "core/config/project_settings.h"
#include "core/input/input.h"
#include "core/io/resource_loader.h"
#include "core/math/math_defs.h"
#include "core/os/keyboard.h"
-#include "core/project_settings.h"
#include "core/version.h"
#include "editor/editor_log.h"
#include "editor/editor_properties.h"
diff --git a/editor/pot_generator.cpp b/editor/pot_generator.cpp
index f09750efdc..9b3227ad28 100644
--- a/editor/pot_generator.cpp
+++ b/editor/pot_generator.cpp
@@ -30,8 +30,8 @@
#include "pot_generator.h"
-#include "core/error_macros.h"
-#include "core/project_settings.h"
+#include "core/config/project_settings.h"
+#include "core/error/error_macros.h"
#include "editor_translation_parser.h"
#include "plugins/packed_scene_translation_parser_plugin.h"
diff --git a/editor/pot_generator.h b/editor/pot_generator.h
index 8853b784ed..1fd2956445 100644
--- a/editor/pot_generator.h
+++ b/editor/pot_generator.h
@@ -31,9 +31,9 @@
#ifndef POT_GENERATOR_H
#define POT_GENERATOR_H
-#include "core/ordered_hash_map.h"
#include "core/os/file_access.h"
-#include "core/set.h"
+#include "core/templates/ordered_hash_map.h"
+#include "core/templates/set.h"
//#define DEBUG_POT
diff --git a/editor/progress_dialog.cpp b/editor/progress_dialog.cpp
index 541cba836b..46a656e0af 100644
--- a/editor/progress_dialog.cpp
+++ b/editor/progress_dialog.cpp
@@ -30,7 +30,7 @@
#include "progress_dialog.h"
-#include "core/message_queue.h"
+#include "core/object/message_queue.h"
#include "core/os/os.h"
#include "editor_scale.h"
#include "main/main.h"
diff --git a/editor/project_export.cpp b/editor/project_export.cpp
index 71522bb253..e8c2b1f954 100644
--- a/editor/project_export.cpp
+++ b/editor/project_export.cpp
@@ -30,14 +30,14 @@
#include "project_export.h"
-#include "core/compressed_translation.h"
+#include "core/config/project_settings.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 "core/string/compressed_translation.h"
#include "editor_data.h"
#include "editor_node.h"
#include "editor_scale.h"
diff --git a/editor/project_manager.cpp b/editor/project_manager.cpp
index 6393aa30ed..e3c2ba83f2 100644
--- a/editor/project_manager.cpp
+++ b/editor/project_manager.cpp
@@ -38,7 +38,7 @@
#include "core/os/file_access.h"
#include "core/os/keyboard.h"
#include "core/os/os.h"
-#include "core/translation.h"
+#include "core/string/translation.h"
#include "core/version.h"
#include "core/version_hash.gen.h"
#include "editor_scale.h"
diff --git a/editor/project_settings_editor.cpp b/editor/project_settings_editor.cpp
index b6621d0d1e..55d80021c8 100644
--- a/editor/project_settings_editor.cpp
+++ b/editor/project_settings_editor.cpp
@@ -30,7 +30,7 @@
#include "project_settings_editor.h"
-#include "core/project_settings.h"
+#include "core/config/project_settings.h"
#include "editor/editor_export.h"
#include "editor/editor_node.h"
#include "editor/editor_scale.h"
@@ -98,7 +98,8 @@ void ProjectSettingsEditor::_add_setting() {
// Initialize the property with the default value for the given type.
// The type list starts at 1 (as we exclude Nil), so add 1 to the selected value.
Callable::CallError ce;
- const Variant value = Variant::construct(Variant::Type(type->get_selected() + 1), nullptr, 0, ce);
+ Variant value;
+ Variant::construct(Variant::Type(type->get_selected() + 1), value, nullptr, 0, ce);
undo_redo->create_action(TTR("Add Project Setting"));
undo_redo->add_do_property(ps, setting, value);
diff --git a/editor/project_settings_editor.h b/editor/project_settings_editor.h
index 4ecd28e514..73e96d7b03 100644
--- a/editor/project_settings_editor.h
+++ b/editor/project_settings_editor.h
@@ -31,7 +31,7 @@
#ifndef PROJECT_SETTINGS_EDITOR_H
#define PROJECT_SETTINGS_EDITOR_H
-#include "core/undo_redo.h"
+#include "core/object/undo_redo.h"
#include "editor/editor_data.h"
#include "editor/editor_plugin_settings.h"
#include "editor/editor_sectioned_inspector.h"
diff --git a/editor/property_editor.cpp b/editor/property_editor.cpp
index 7f1b5347cf..1e4ed0c552 100644
--- a/editor/property_editor.cpp
+++ b/editor/property_editor.cpp
@@ -30,16 +30,16 @@
#include "property_editor.h"
-#include "core/class_db.h"
+#include "core/config/project_settings.h"
#include "core/input/input.h"
#include "core/io/image_loader.h"
#include "core/io/marshalls.h"
#include "core/io/resource_loader.h"
#include "core/math/expression.h"
+#include "core/object/class_db.h"
#include "core/os/keyboard.h"
-#include "core/pair.h"
-#include "core/print_string.h"
-#include "core/project_settings.h"
+#include "core/string/print_string.h"
+#include "core/templates/pair.h"
#include "editor/array_property_edit.h"
#include "editor/create_dialog.h"
#include "editor/dictionary_property_edit.h"
@@ -345,7 +345,7 @@ bool CustomPropertyEditor::edit(Object *p_owner, const String &p_name, Variant::
checks20[i]->hide();
}
- type = (p_variant.get_type() != Variant::NIL && p_variant.get_type() != Variant::_RID && p_type != Variant::OBJECT) ? p_variant.get_type() : p_type;
+ type = (p_variant.get_type() != Variant::NIL && p_variant.get_type() != Variant::RID && p_type != Variant::OBJECT) ? p_variant.get_type() : p_type;
switch (type) {
case Variant::BOOL: {
diff --git a/editor/property_selector.cpp b/editor/property_selector.cpp
index 27b11e4fb5..75420a1ef4 100644
--- a/editor/property_selector.cpp
+++ b/editor/property_selector.cpp
@@ -95,7 +95,7 @@ void PropertySelector::_update_search() {
} else if (type != Variant::NIL) {
Variant v;
Callable::CallError ce;
- v = Variant::construct(type, nullptr, 0, ce);
+ Variant::construct(type, v, nullptr, 0, ce);
v.get_property_list(&props);
} else {
@@ -200,7 +200,7 @@ void PropertySelector::_update_search() {
if (type != Variant::NIL) {
Variant v;
Callable::CallError ce;
- v = Variant::construct(type, nullptr, 0, ce);
+ Variant::construct(type, v, nullptr, 0, ce);
v.get_method_list(&methods);
} else {
Object *obj = ObjectDB::get_instance(script);
diff --git a/editor/pvrtc_compress.h b/editor/pvrtc_compress.h
index 77bc11b224..7b6c17d3c4 100644
--- a/editor/pvrtc_compress.h
+++ b/editor/pvrtc_compress.h
@@ -31,7 +31,7 @@
#ifndef PVRTC_COMPRESS_H
#define PVRTC_COMPRESS_H
-#include "core/image.h"
+#include "core/io/image.h"
void _pvrtc_register_compressors();
diff --git a/editor/quick_open.h b/editor/quick_open.h
index 6486ee0221..3b199f9561 100644
--- a/editor/quick_open.h
+++ b/editor/quick_open.h
@@ -31,7 +31,7 @@
#ifndef EDITOR_QUICK_OPEN_H
#define EDITOR_QUICK_OPEN_H
-#include "core/oa_hash_map.h"
+#include "core/templates/oa_hash_map.h"
#include "editor_file_system.h"
#include "scene/gui/dialogs.h"
#include "scene/gui/tree.h"
diff --git a/editor/rename_dialog.cpp b/editor/rename_dialog.cpp
index 23990bca07..318324e56d 100644
--- a/editor/rename_dialog.cpp
+++ b/editor/rename_dialog.cpp
@@ -30,7 +30,7 @@
#include "rename_dialog.h"
-#include "core/print_string.h"
+#include "core/string/print_string.h"
#include "editor_node.h"
#include "editor_scale.h"
#include "editor_settings.h"
diff --git a/editor/rename_dialog.h b/editor/rename_dialog.h
index 100426af4f..164d7ab1b0 100644
--- a/editor/rename_dialog.h
+++ b/editor/rename_dialog.h
@@ -36,7 +36,7 @@
#include "scene/gui/option_button.h"
#include "scene/gui/spin_box.h"
-#include "core/undo_redo.h"
+#include "core/object/undo_redo.h"
#include "editor/scene_tree_editor.h"
/**
diff --git a/editor/reparent_dialog.cpp b/editor/reparent_dialog.cpp
index 1615336a4b..0ff27af7c1 100644
--- a/editor/reparent_dialog.cpp
+++ b/editor/reparent_dialog.cpp
@@ -30,7 +30,7 @@
#include "reparent_dialog.h"
-#include "core/print_string.h"
+#include "core/string/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 46e9cd4676..add5047c99 100644
--- a/editor/scene_tree_dock.cpp
+++ b/editor/scene_tree_dock.cpp
@@ -30,10 +30,10 @@
#include "scene_tree_dock.h"
+#include "core/config/project_settings.h"
#include "core/input/input.h"
#include "core/io/resource_saver.h"
#include "core/os/keyboard.h"
-#include "core/project_settings.h"
#include "editor/debugger/editor_debugger_node.h"
#include "editor/editor_feature_profile.h"
#include "editor/editor_node.h"
diff --git a/editor/scene_tree_editor.cpp b/editor/scene_tree_editor.cpp
index 3dee4a229f..3ec012ce3c 100644
--- a/editor/scene_tree_editor.cpp
+++ b/editor/scene_tree_editor.cpp
@@ -30,8 +30,8 @@
#include "scene_tree_editor.h"
-#include "core/message_queue.h"
-#include "core/print_string.h"
+#include "core/object/message_queue.h"
+#include "core/string/print_string.h"
#include "editor/editor_node.h"
#include "editor/editor_scale.h"
#include "editor/node_dock.h"
diff --git a/editor/scene_tree_editor.h b/editor/scene_tree_editor.h
index 21bb0ec062..9373ef41f9 100644
--- a/editor/scene_tree_editor.h
+++ b/editor/scene_tree_editor.h
@@ -31,7 +31,7 @@
#ifndef SCENE_TREE_EDITOR_H
#define SCENE_TREE_EDITOR_H
-#include "core/undo_redo.h"
+#include "core/object/undo_redo.h"
#include "editor_data.h"
#include "editor_settings.h"
#include "scene/gui/button.h"
diff --git a/editor/script_create_dialog.cpp b/editor/script_create_dialog.cpp
index 90efb11b7d..b5f11fc6f9 100644
--- a/editor/script_create_dialog.cpp
+++ b/editor/script_create_dialog.cpp
@@ -30,11 +30,11 @@
#include "script_create_dialog.h"
+#include "core/config/project_settings.h"
#include "core/io/resource_saver.h"
+#include "core/object/script_language.h"
#include "core/os/file_access.h"
-#include "core/project_settings.h"
-#include "core/script_language.h"
-#include "core/string_builder.h"
+#include "core/string/string_builder.h"
#include "editor/create_dialog.h"
#include "editor/editor_node.h"
#include "editor/editor_scale.h"
diff --git a/editor/settings_config_dialog.cpp b/editor/settings_config_dialog.cpp
index 5da682a148..864e5976b2 100644
--- a/editor/settings_config_dialog.cpp
+++ b/editor/settings_config_dialog.cpp
@@ -30,8 +30,8 @@
#include "settings_config_dialog.h"
+#include "core/config/project_settings.h"
#include "core/os/keyboard.h"
-#include "core/project_settings.h"
#include "editor/debugger/editor_debugger_node.h"
#include "editor_file_system.h"
#include "editor_log.h"
diff --git a/editor/shader_globals_editor.h b/editor/shader_globals_editor.h
index 33f527f314..00b6cdef9f 100644
--- a/editor/shader_globals_editor.h
+++ b/editor/shader_globals_editor.h
@@ -31,7 +31,7 @@
#ifndef SHADER_GLOBALS_EDITOR_H
#define SHADER_GLOBALS_EDITOR_H
-#include "core/undo_redo.h"
+#include "core/object/undo_redo.h"
#include "editor/editor_autoload_settings.h"
#include "editor/editor_data.h"
#include "editor/editor_plugin_settings.h"
diff --git a/main/main.cpp b/main/main.cpp
index f2d057665a..0667180c28 100644
--- a/main/main.cpp
+++ b/main/main.cpp
@@ -30,6 +30,7 @@
#include "main.h"
+#include "core/config/project_settings.h"
#include "core/core_string_names.h"
#include "core/crypto/crypto.h"
#include "core/debugger/engine_debugger.h"
@@ -41,12 +42,11 @@
#include "core/io/image_loader.h"
#include "core/io/ip.h"
#include "core/io/resource_loader.h"
-#include "core/message_queue.h"
+#include "core/object/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/translation.h"
+#include "core/string/translation.h"
#include "core/version.h"
#include "core/version_hash.gen.h"
#include "drivers/register_driver_types.h"
@@ -2232,7 +2232,7 @@ bool Main::start() {
#ifdef TOOLS_ENABLED
if (editor) {
- if (game_path != GLOBAL_GET("application/run/main_scene") || !editor_node->has_scenes_in_session()) {
+ if (game_path != String(GLOBAL_GET("application/run/main_scene")) || !editor_node->has_scenes_in_session()) {
Error serr = editor_node->load_scene(local_game_path);
if (serr != OK) {
ERR_PRINT("Failed to load scene");
diff --git a/main/main.h b/main/main.h
index 75a1c0d8cd..168b2e5e86 100644
--- a/main/main.h
+++ b/main/main.h
@@ -31,7 +31,7 @@
#ifndef MAIN_H
#define MAIN_H
-#include "core/error_list.h"
+#include "core/error/error_list.h"
#include "core/os/thread.h"
#include "core/typedefs.h"
diff --git a/main/main_timer_sync.h b/main/main_timer_sync.h
index 2126381c7c..f8497140cd 100644
--- a/main/main_timer_sync.h
+++ b/main/main_timer_sync.h
@@ -31,7 +31,7 @@
#ifndef MAIN_TIMER_SYNC_H
#define MAIN_TIMER_SYNC_H
-#include "core/engine.h"
+#include "core/config/engine.h"
struct MainFrameTime {
float idle_step; // time to advance idles for (argument to process())
diff --git a/main/performance.cpp b/main/performance.cpp
index 7234511aeb..3d7971ced3 100644
--- a/main/performance.cpp
+++ b/main/performance.cpp
@@ -30,7 +30,7 @@
#include "performance.h"
-#include "core/message_queue.h"
+#include "core/object/message_queue.h"
#include "core/os/os.h"
#include "scene/main/node.h"
#include "scene/main/scene_tree.h"
diff --git a/main/performance.h b/main/performance.h
index f406433cf2..415b49b58c 100644
--- a/main/performance.h
+++ b/main/performance.h
@@ -31,8 +31,8 @@
#ifndef PERFORMANCE_H
#define PERFORMANCE_H
-#include "core/class_db.h"
-#include "core/ordered_hash_map.h"
+#include "core/object/class_db.h"
+#include "core/templates/ordered_hash_map.h"
#define PERF_WARN_OFFLINE_FUNCTION
#define PERF_WARN_PROCESS_SYNC
diff --git a/modules/assimp/editor_scene_importer_assimp.h b/modules/assimp/editor_scene_importer_assimp.h
index 7be80c4ad0..80bba6ad66 100644
--- a/modules/assimp/editor_scene_importer_assimp.h
+++ b/modules/assimp/editor_scene_importer_assimp.h
@@ -32,9 +32,9 @@
#define EDITOR_SCENE_IMPORTER_ASSIMP_H
#ifdef TOOLS_ENABLED
-#include "core/bind/core_bind.h"
+#include "core/core_bind.h"
#include "core/io/resource_importer.h"
-#include "core/vector.h"
+#include "core/templates/vector.h"
#include "editor/import/resource_importer_scene.h"
#include "editor/project_settings_editor.h"
#include "scene/3d/mesh_instance_3d.h"
diff --git a/modules/assimp/import_state.h b/modules/assimp/import_state.h
index ee22800ac4..a1cce6968b 100644
--- a/modules/assimp/import_state.h
+++ b/modules/assimp/import_state.h
@@ -31,9 +31,9 @@
#ifndef EDITOR_SCENE_IMPORT_STATE_H
#define EDITOR_SCENE_IMPORT_STATE_H
-#include "core/bind/core_bind.h"
+#include "core/core_bind.h"
#include "core/io/resource_importer.h"
-#include "core/vector.h"
+#include "core/templates/vector.h"
#include "editor/import/resource_importer_scene.h"
#include "editor/project_settings_editor.h"
#include "scene/3d/mesh_instance_3d.h"
diff --git a/modules/bmp/image_loader_bmp.cpp b/modules/bmp/image_loader_bmp.cpp
index 757afeb9e3..b08970d110 100644
--- a/modules/bmp/image_loader_bmp.cpp
+++ b/modules/bmp/image_loader_bmp.cpp
@@ -30,6 +30,8 @@
#include "image_loader_bmp.h"
+#include "core/io/file_access_memory.h"
+
Error ImageLoaderBMP::convert_to_image(Ref<Image> p_image,
const uint8_t *p_buffer,
const uint8_t *p_color_buffer,
@@ -293,9 +295,21 @@ Error ImageLoaderBMP::load_image(Ref<Image> p_image, FileAccess *f,
return err;
}
-void ImageLoaderBMP::get_recognized_extensions(
- List<String> *p_extensions) const {
+void ImageLoaderBMP::get_recognized_extensions(List<String> *p_extensions) const {
p_extensions->push_back("bmp");
}
-ImageLoaderBMP::ImageLoaderBMP() {}
+static Ref<Image> _bmp_mem_loader_func(const uint8_t *p_bmp, int p_size) {
+ FileAccessMemory memfile;
+ Error open_memfile_error = memfile.open_custom(p_bmp, p_size);
+ ERR_FAIL_COND_V_MSG(open_memfile_error, Ref<Image>(), "Could not create memfile for BMP image buffer.");
+ Ref<Image> img;
+ img.instance();
+ Error load_error = ImageLoaderBMP().load_image(img, &memfile, false, 1.0f);
+ ERR_FAIL_COND_V_MSG(load_error, Ref<Image>(), "Failed to load BMP image.");
+ return img;
+}
+
+ImageLoaderBMP::ImageLoaderBMP() {
+ Image::_bmp_mem_loader_func = _bmp_mem_loader_func;
+}
diff --git a/modules/bullet/area_bullet.h b/modules/bullet/area_bullet.h
index c0bcc858fe..152fd785c0 100644
--- a/modules/bullet/area_bullet.h
+++ b/modules/bullet/area_bullet.h
@@ -32,7 +32,7 @@
#define AREABULLET_H
#include "collision_object_bullet.h"
-#include "core/vector.h"
+#include "core/templates/vector.h"
#include "servers/physics_server_3d.h"
#include "space_bullet.h"
diff --git a/modules/bullet/bullet_physics_server.cpp b/modules/bullet/bullet_physics_server.cpp
index 8f64c11867..f7290666ad 100644
--- a/modules/bullet/bullet_physics_server.cpp
+++ b/modules/bullet/bullet_physics_server.cpp
@@ -32,9 +32,9 @@
#include "bullet_utilities.h"
#include "cone_twist_joint_bullet.h"
-#include "core/class_db.h"
-#include "core/error_macros.h"
-#include "core/ustring.h"
+#include "core/error/error_macros.h"
+#include "core/object/class_db.h"
+#include "core/string/ustring.h"
#include "generic_6dof_joint_bullet.h"
#include "hinge_joint_bullet.h"
#include "pin_joint_bullet.h"
diff --git a/modules/bullet/bullet_physics_server.h b/modules/bullet/bullet_physics_server.h
index 6078babaf8..02ba5458d8 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 "core/rid_owner.h"
+#include "core/templates/rid.h"
+#include "core/templates/rid_owner.h"
#include "joint_bullet.h"
#include "rigid_body_bullet.h"
#include "servers/physics_server_3d.h"
diff --git a/modules/bullet/collision_object_bullet.h b/modules/bullet/collision_object_bullet.h
index 36b3a9550c..e2d05f2c38 100644
--- a/modules/bullet/collision_object_bullet.h
+++ b/modules/bullet/collision_object_bullet.h
@@ -31,10 +31,10 @@
#ifndef COLLISION_OBJECT_BULLET_H
#define COLLISION_OBJECT_BULLET_H
-#include "core/class_db.h"
#include "core/math/transform.h"
#include "core/math/vector3.h"
-#include "core/vset.h"
+#include "core/object/class_db.h"
+#include "core/templates/vset.h"
#include "shape_owner_bullet.h"
#include <LinearMath/btTransform.h>
diff --git a/modules/bullet/godot_collision_dispatcher.h b/modules/bullet/godot_collision_dispatcher.h
index 5a96268ee9..13e7255abf 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 "core/int_types.h"
+#include <cstdint>
#include <btBulletDynamicsCommon.h>
diff --git a/modules/bullet/register_types.cpp b/modules/bullet/register_types.cpp
index 009d0dff63..d29b699ecd 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 "core/class_db.h"
-#include "core/project_settings.h"
+#include "core/config/project_settings.h"
+#include "core/object/class_db.h"
/**
@author AndreaCatania
diff --git a/modules/bullet/rid_bullet.h b/modules/bullet/rid_bullet.h
index 3551ca05f9..0db09b2b78 100644
--- a/modules/bullet/rid_bullet.h
+++ b/modules/bullet/rid_bullet.h
@@ -31,7 +31,7 @@
#ifndef RID_BULLET_H
#define RID_BULLET_H
-#include "core/rid.h"
+#include "core/templates/rid.h"
/**
@author AndreaCatania
diff --git a/modules/bullet/shape_bullet.cpp b/modules/bullet/shape_bullet.cpp
index fdc2944dad..c7b761e92a 100644
--- a/modules/bullet/shape_bullet.cpp
+++ b/modules/bullet/shape_bullet.cpp
@@ -34,7 +34,7 @@
#include "bullet_physics_server.h"
#include "bullet_types_converter.h"
#include "bullet_utilities.h"
-#include "core/project_settings.h"
+#include "core/config/project_settings.h"
#include "shape_owner_bullet.h"
#include <BulletCollision/CollisionDispatch/btInternalEdgeUtility.h>
diff --git a/modules/bullet/shape_bullet.h b/modules/bullet/shape_bullet.h
index a35a1d8a18..1c29dc1b1f 100644
--- a/modules/bullet/shape_bullet.h
+++ b/modules/bullet/shape_bullet.h
@@ -32,7 +32,7 @@
#define SHAPE_BULLET_H
#include "core/math/geometry_3d.h"
-#include "core/variant.h"
+#include "core/variant/variant.h"
#include "rid_bullet.h"
#include "servers/physics_server_3d.h"
diff --git a/modules/bullet/space_bullet.cpp b/modules/bullet/space_bullet.cpp
index c581d1804e..abad1beacb 100644
--- a/modules/bullet/space_bullet.cpp
+++ b/modules/bullet/space_bullet.cpp
@@ -34,8 +34,8 @@
#include "bullet_types_converter.h"
#include "bullet_utilities.h"
#include "constraint_bullet.h"
-#include "core/project_settings.h"
-#include "core/ustring.h"
+#include "core/config/project_settings.h"
+#include "core/string/ustring.h"
#include "godot_collision_configuration.h"
#include "godot_collision_dispatcher.h"
#include "rigid_body_bullet.h"
diff --git a/modules/bullet/space_bullet.h b/modules/bullet/space_bullet.h
index de281064af..e362f27d39 100644
--- a/modules/bullet/space_bullet.h
+++ b/modules/bullet/space_bullet.h
@@ -31,8 +31,8 @@
#ifndef SPACE_BULLET_H
#define SPACE_BULLET_H
-#include "core/variant.h"
-#include "core/vector.h"
+#include "core/templates/vector.h"
+#include "core/variant/variant.h"
#include "godot_result_callbacks.h"
#include "rid_bullet.h"
#include "servers/physics_server_3d.h"
diff --git a/modules/csg/csg.cpp b/modules/csg/csg.cpp
index 47982d519a..04e1c4de35 100644
--- a/modules/csg/csg.cpp
+++ b/modules/csg/csg.cpp
@@ -32,7 +32,7 @@
#include "core/math/geometry_2d.h"
#include "core/math/math_funcs.h"
-#include "core/sort_array.h"
+#include "core/templates/sort_array.h"
// Static helper functions.
diff --git a/modules/csg/csg.h b/modules/csg/csg.h
index 34ee239c17..ef1103e1ac 100644
--- a/modules/csg/csg.h
+++ b/modules/csg/csg.h
@@ -31,16 +31,16 @@
#ifndef CSG_H
#define CSG_H
-#include "core/list.h"
-#include "core/map.h"
#include "core/math/aabb.h"
#include "core/math/plane.h"
#include "core/math/transform.h"
#include "core/math/vector2.h"
#include "core/math/vector3.h"
-#include "core/oa_hash_map.h"
-#include "core/reference.h"
-#include "core/vector.h"
+#include "core/object/reference.h"
+#include "core/templates/list.h"
+#include "core/templates/map.h"
+#include "core/templates/oa_hash_map.h"
+#include "core/templates/vector.h"
#include "scene/resources/material.h"
struct CSGBrush {
diff --git a/modules/cvtt/image_compress_cvtt.cpp b/modules/cvtt/image_compress_cvtt.cpp
index 2a4f836478..5d97164dbf 100644
--- a/modules/cvtt/image_compress_cvtt.cpp
+++ b/modules/cvtt/image_compress_cvtt.cpp
@@ -32,7 +32,7 @@
#include "core/os/os.h"
#include "core/os/thread.h"
-#include "core/print_string.h"
+#include "core/string/print_string.h"
#include <ConvectionKernels.h>
diff --git a/modules/cvtt/image_compress_cvtt.h b/modules/cvtt/image_compress_cvtt.h
index c1772199af..483fb876a6 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 "core/image.h"
+#include "core/io/image.h"
void image_compress_cvtt(Image *p_image, float p_lossy_quality, Image::UsedChannels p_channels);
void image_decompress_cvtt(Image *p_image);
diff --git a/modules/denoise/lightmap_denoiser.h b/modules/denoise/lightmap_denoiser.h
index 74a9d8af86..f4e4335d9b 100644
--- a/modules/denoise/lightmap_denoiser.h
+++ b/modules/denoise/lightmap_denoiser.h
@@ -31,7 +31,7 @@
#ifndef LIGHTMAP_DENOISER_H
#define LIGHTMAP_DENOISER_H
-#include "core/class_db.h"
+#include "core/object/class_db.h"
#include "scene/3d/lightmapper.h"
struct OIDNDeviceImpl;
diff --git a/modules/denoise/register_types.cpp b/modules/denoise/register_types.cpp
index b78734a531..552495ed87 100644
--- a/modules/denoise/register_types.cpp
+++ b/modules/denoise/register_types.cpp
@@ -29,7 +29,7 @@
/*************************************************************************/
#include "register_types.h"
-#include "core/engine.h"
+#include "core/config/engine.h"
#include "lightmap_denoiser.h"
void register_denoise_types() {
diff --git a/modules/enet/register_types.cpp b/modules/enet/register_types.cpp
index 18051f756a..2683f3155b 100644
--- a/modules/enet/register_types.cpp
+++ b/modules/enet/register_types.cpp
@@ -29,7 +29,7 @@
/*************************************************************************/
#include "register_types.h"
-#include "core/error_macros.h"
+#include "core/error/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 d1ba3dc355..6cac2458f9 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 "core/image.h"
+#include "core/io/image.h"
#include "core/os/copymem.h"
#include "core/os/os.h"
-#include "core/print_string.h"
+#include "core/string/print_string.h"
static Image::Format _get_etc2_mode(Image::UsedChannels format) {
switch (format) {
diff --git a/modules/gdnative/gdnative.cpp b/modules/gdnative/gdnative.cpp
index bb2da70c3a..f397ee96c5 100644
--- a/modules/gdnative/gdnative.cpp
+++ b/modules/gdnative/gdnative.cpp
@@ -30,11 +30,11 @@
#include "gdnative.h"
-#include "core/global_constants.h"
+#include "core/config/project_settings.h"
+#include "core/core_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"
diff --git a/modules/gdnative/gdnative.h b/modules/gdnative/gdnative.h
index 6d26c2141d..bba2c04a2a 100644
--- a/modules/gdnative/gdnative.h
+++ b/modules/gdnative/gdnative.h
@@ -31,10 +31,10 @@
#ifndef GDNATIVE_H
#define GDNATIVE_H
+#include "core/io/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"
diff --git a/modules/gdnative/gdnative/aabb.cpp b/modules/gdnative/gdnative/aabb.cpp
index d5970e8004..dc1b79b9e5 100644
--- a/modules/gdnative/gdnative/aabb.cpp
+++ b/modules/gdnative/gdnative/aabb.cpp
@@ -31,7 +31,7 @@
#include "gdnative/aabb.h"
#include "core/math/aabb.h"
-#include "core/variant.h"
+#include "core/variant/variant.h"
#ifdef __cplusplus
extern "C" {
diff --git a/modules/gdnative/gdnative/array.cpp b/modules/gdnative/gdnative/array.cpp
index 59953f5182..a5567f1e6b 100644
--- a/modules/gdnative/gdnative/array.cpp
+++ b/modules/gdnative/gdnative/array.cpp
@@ -30,12 +30,12 @@
#include "gdnative/array.h"
-#include "core/array.h"
#include "core/os/memory.h"
+#include "core/variant/array.h"
-#include "core/color.h"
+#include "core/math/color.h"
-#include "core/variant.h"
+#include "core/variant/variant.h"
#ifdef __cplusplus
extern "C" {
diff --git a/modules/gdnative/gdnative/basis.cpp b/modules/gdnative/gdnative/basis.cpp
index 990fd3795d..e5891562a1 100644
--- a/modules/gdnative/gdnative/basis.cpp
+++ b/modules/gdnative/gdnative/basis.cpp
@@ -31,7 +31,7 @@
#include "gdnative/basis.h"
#include "core/math/basis.h"
-#include "core/variant.h"
+#include "core/variant/variant.h"
#ifdef __cplusplus
extern "C" {
diff --git a/modules/gdnative/gdnative/callable.cpp b/modules/gdnative/gdnative/callable.cpp
index 868b324227..f200e9f171 100644
--- a/modules/gdnative/gdnative/callable.cpp
+++ b/modules/gdnative/gdnative/callable.cpp
@@ -30,9 +30,9 @@
#include "gdnative/callable.h"
-#include "core/callable.h"
-#include "core/resource.h"
-#include "core/variant.h"
+#include "core/io/resource.h"
+#include "core/variant/callable.h"
+#include "core/variant/variant.h"
#ifdef __cplusplus
extern "C" {
diff --git a/modules/gdnative/gdnative/color.cpp b/modules/gdnative/gdnative/color.cpp
index c75e74daba..a93181e142 100644
--- a/modules/gdnative/gdnative/color.cpp
+++ b/modules/gdnative/gdnative/color.cpp
@@ -30,8 +30,8 @@
#include "gdnative/color.h"
-#include "core/color.h"
-#include "core/variant.h"
+#include "core/math/color.h"
+#include "core/variant/variant.h"
#ifdef __cplusplus
extern "C" {
@@ -148,13 +148,6 @@ godot_color GDAPI godot_color_inverted(const godot_color *p_self) {
return dest;
}
-godot_color GDAPI godot_color_contrasted(const godot_color *p_self) {
- godot_color dest;
- const Color *self = (const Color *)p_self;
- *((Color *)&dest) = self->contrasted();
- return dest;
-}
-
godot_color GDAPI godot_color_lerp(const godot_color *p_self, const godot_color *p_b, const godot_real p_t) {
godot_color dest;
const Color *self = (const Color *)p_self;
diff --git a/modules/gdnative/gdnative/dictionary.cpp b/modules/gdnative/gdnative/dictionary.cpp
index a126974815..b6900b28bb 100644
--- a/modules/gdnative/gdnative/dictionary.cpp
+++ b/modules/gdnative/gdnative/dictionary.cpp
@@ -30,10 +30,10 @@
#include "gdnative/dictionary.h"
-#include "core/variant.h"
-// core/variant.h before to avoid compile errors with MSVC
-#include "core/dictionary.h"
+#include "core/variant/variant.h"
+// core/variant/variant.h before to avoid compile errors with MSVC
#include "core/io/json.h"
+#include "core/variant/dictionary.h"
#ifdef __cplusplus
extern "C" {
diff --git a/modules/gdnative/gdnative/gdnative.cpp b/modules/gdnative/gdnative/gdnative.cpp
index e94190b07b..4142ea892b 100644
--- a/modules/gdnative/gdnative/gdnative.cpp
+++ b/modules/gdnative/gdnative/gdnative.cpp
@@ -30,12 +30,12 @@
#include "gdnative/gdnative.h"
-#include "core/class_db.h"
-#include "core/engine.h"
-#include "core/error_macros.h"
-#include "core/global_constants.h"
+#include "core/config/engine.h"
+#include "core/core_constants.h"
+#include "core/error/error_macros.h"
+#include "core/object/class_db.h"
#include "core/os/os.h"
-#include "core/variant.h"
+#include "core/variant/variant.h"
#include "modules/gdnative/gdnative.h"
@@ -101,10 +101,10 @@ godot_dictionary GDAPI godot_get_global_constants() {
godot_dictionary constants;
godot_dictionary_new(&constants);
Dictionary *p_constants = (Dictionary *)&constants;
- const int constants_count = GlobalConstants::get_global_constant_count();
+ const int constants_count = CoreConstants::get_global_constant_count();
for (int i = 0; i < constants_count; ++i) {
- const char *name = GlobalConstants::get_global_constant_name(i);
- int value = GlobalConstants::get_global_constant_value(i);
+ const char *name = CoreConstants::get_global_constant_name(i);
+ int value = CoreConstants::get_global_constant_value(i);
(*p_constants)[name] = value;
}
return constants;
diff --git a/modules/gdnative/gdnative/node_path.cpp b/modules/gdnative/gdnative/node_path.cpp
index 88ed650ebe..c031498612 100644
--- a/modules/gdnative/gdnative/node_path.cpp
+++ b/modules/gdnative/gdnative/node_path.cpp
@@ -30,8 +30,8 @@
#include "gdnative/node_path.h"
-#include "core/node_path.h"
-#include "core/variant.h"
+#include "core/string/node_path.h"
+#include "core/variant/variant.h"
#ifdef __cplusplus
extern "C" {
diff --git a/modules/gdnative/gdnative/packed_arrays.cpp b/modules/gdnative/gdnative/packed_arrays.cpp
index de93c1d9b3..9139fd89a1 100644
--- a/modules/gdnative/gdnative/packed_arrays.cpp
+++ b/modules/gdnative/gdnative/packed_arrays.cpp
@@ -30,11 +30,11 @@
#include "gdnative/packed_arrays.h"
-#include "core/array.h"
+#include "core/variant/array.h"
-#include "core/variant.h"
+#include "core/variant/variant.h"
-#include "core/color.h"
+#include "core/math/color.h"
#include "core/math/vector2.h"
#include "core/math/vector3.h"
diff --git a/modules/gdnative/gdnative/plane.cpp b/modules/gdnative/gdnative/plane.cpp
index d4ed8d00f4..99fb5ff10a 100644
--- a/modules/gdnative/gdnative/plane.cpp
+++ b/modules/gdnative/gdnative/plane.cpp
@@ -31,7 +31,7 @@
#include "gdnative/plane.h"
#include "core/math/plane.h"
-#include "core/variant.h"
+#include "core/variant/variant.h"
#ifdef __cplusplus
extern "C" {
diff --git a/modules/gdnative/gdnative/quat.cpp b/modules/gdnative/gdnative/quat.cpp
index de6308ad2a..a41886e780 100644
--- a/modules/gdnative/gdnative/quat.cpp
+++ b/modules/gdnative/gdnative/quat.cpp
@@ -31,7 +31,7 @@
#include "gdnative/quat.h"
#include "core/math/quat.h"
-#include "core/variant.h"
+#include "core/variant/variant.h"
#ifdef __cplusplus
extern "C" {
diff --git a/modules/gdnative/gdnative/rect2.cpp b/modules/gdnative/gdnative/rect2.cpp
index 516f4d75ce..bacefced5d 100644
--- a/modules/gdnative/gdnative/rect2.cpp
+++ b/modules/gdnative/gdnative/rect2.cpp
@@ -31,7 +31,7 @@
#include "gdnative/rect2.h"
#include "core/math/transform_2d.h"
-#include "core/variant.h"
+#include "core/variant/variant.h"
#ifdef __cplusplus
extern "C" {
diff --git a/modules/gdnative/gdnative/rid.cpp b/modules/gdnative/gdnative/rid.cpp
index d7a63f33a7..24af04558b 100644
--- a/modules/gdnative/gdnative/rid.cpp
+++ b/modules/gdnative/gdnative/rid.cpp
@@ -30,9 +30,9 @@
#include "gdnative/rid.h"
-#include "core/resource.h"
-#include "core/rid.h"
-#include "core/variant.h"
+#include "core/io/resource.h"
+#include "core/templates/rid.h"
+#include "core/variant/variant.h"
#ifdef __cplusplus
extern "C" {
diff --git a/modules/gdnative/gdnative/string.cpp b/modules/gdnative/gdnative/string.cpp
index 1fa19f4ff5..47c7f7b6e7 100644
--- a/modules/gdnative/gdnative/string.cpp
+++ b/modules/gdnative/gdnative/string.cpp
@@ -30,9 +30,9 @@
#include "gdnative/string.h"
-#include "core/string_name.h"
-#include "core/ustring.h"
-#include "core/variant.h"
+#include "core/string/string_name.h"
+#include "core/string/ustring.h"
+#include "core/variant/variant.h"
#include <string.h>
diff --git a/modules/gdnative/gdnative/string_name.cpp b/modules/gdnative/gdnative/string_name.cpp
index 7bbaaeeaa0..a840d74e18 100644
--- a/modules/gdnative/gdnative/string_name.cpp
+++ b/modules/gdnative/gdnative/string_name.cpp
@@ -30,8 +30,8 @@
#include "gdnative/string_name.h"
-#include "core/string_name.h"
-#include "core/ustring.h"
+#include "core/string/string_name.h"
+#include "core/string/ustring.h"
#include <string.h>
diff --git a/modules/gdnative/gdnative/transform.cpp b/modules/gdnative/gdnative/transform.cpp
index d19de93e9b..b17d6f8d4c 100644
--- a/modules/gdnative/gdnative/transform.cpp
+++ b/modules/gdnative/gdnative/transform.cpp
@@ -31,7 +31,7 @@
#include "gdnative/transform.h"
#include "core/math/transform.h"
-#include "core/variant.h"
+#include "core/variant/variant.h"
#ifdef __cplusplus
extern "C" {
diff --git a/modules/gdnative/gdnative/transform2d.cpp b/modules/gdnative/gdnative/transform2d.cpp
index c0f7878eb0..3c1105e323 100644
--- a/modules/gdnative/gdnative/transform2d.cpp
+++ b/modules/gdnative/gdnative/transform2d.cpp
@@ -31,7 +31,7 @@
#include "gdnative/transform2d.h"
#include "core/math/transform_2d.h"
-#include "core/variant.h"
+#include "core/variant/variant.h"
#ifdef __cplusplus
extern "C" {
diff --git a/modules/gdnative/gdnative/variant.cpp b/modules/gdnative/gdnative/variant.cpp
index dac4feb0e5..8e30eaae4d 100644
--- a/modules/gdnative/gdnative/variant.cpp
+++ b/modules/gdnative/gdnative/variant.cpp
@@ -30,8 +30,8 @@
#include "gdnative/variant.h"
-#include "core/reference.h"
-#include "core/variant.h"
+#include "core/object/reference.h"
+#include "core/variant/variant.h"
#ifdef __cplusplus
extern "C" {
diff --git a/modules/gdnative/gdnative/vector2.cpp b/modules/gdnative/gdnative/vector2.cpp
index 1ee716df86..1ba846d315 100644
--- a/modules/gdnative/gdnative/vector2.cpp
+++ b/modules/gdnative/gdnative/vector2.cpp
@@ -31,7 +31,7 @@
#include "gdnative/vector2.h"
#include "core/math/vector2.h"
-#include "core/variant.h"
+#include "core/variant/variant.h"
#ifdef __cplusplus
extern "C" {
diff --git a/modules/gdnative/gdnative/vector3.cpp b/modules/gdnative/gdnative/vector3.cpp
index 32cad30c17..3284afdc31 100644
--- a/modules/gdnative/gdnative/vector3.cpp
+++ b/modules/gdnative/gdnative/vector3.cpp
@@ -30,8 +30,8 @@
#include "gdnative/vector3.h"
-#include "core/variant.h"
-#include "core/vector.h"
+#include "core/templates/vector.h"
+#include "core/variant/variant.h"
#ifdef __cplusplus
extern "C" {
diff --git a/modules/gdnative/gdnative_api.json b/modules/gdnative/gdnative_api.json
index 82bfbd23de..40d0f75871 100644
--- a/modules/gdnative/gdnative_api.json
+++ b/modules/gdnative/gdnative_api.json
@@ -1255,13 +1255,6 @@
]
},
{
- "name": "godot_color_contrasted",
- "return_type": "godot_color",
- "arguments": [
- ["const godot_color *", "p_self"]
- ]
- },
- {
"name": "godot_color_lerp",
"return_type": "godot_color",
"arguments": [
diff --git a/modules/gdnative/include/gdnative/color.h b/modules/gdnative/include/gdnative/color.h
index e7737bf8e1..e64097ef57 100644
--- a/modules/gdnative/include/gdnative/color.h
+++ b/modules/gdnative/include/gdnative/color.h
@@ -93,8 +93,6 @@ godot_int GDAPI godot_color_to_argb32(const godot_color *p_self);
godot_color GDAPI godot_color_inverted(const godot_color *p_self);
-godot_color GDAPI godot_color_contrasted(const godot_color *p_self);
-
godot_color GDAPI godot_color_lerp(const godot_color *p_self, const godot_color *p_b, const godot_real p_t);
godot_color GDAPI godot_color_blend(const godot_color *p_self, const godot_color *p_over);
diff --git a/modules/gdnative/nativescript/api_generator.cpp b/modules/gdnative/nativescript/api_generator.cpp
index 8dbaec4e75..6f2f9bfea9 100644
--- a/modules/gdnative/nativescript/api_generator.cpp
+++ b/modules/gdnative/nativescript/api_generator.cpp
@@ -32,11 +32,11 @@
#ifdef TOOLS_ENABLED
-#include "core/class_db.h"
-#include "core/engine.h"
-#include "core/global_constants.h"
+#include "core/config/engine.h"
+#include "core/core_constants.h"
+#include "core/object/class_db.h"
#include "core/os/file_access.h"
-#include "core/pair.h"
+#include "core/templates/pair.h"
// helper stuff
@@ -173,19 +173,19 @@ List<ClassAPI> generate_c_api_classes() {
ClassDB::get_class_list(&classes);
classes.sort_custom<StringName::AlphCompare>();
- // Register global constants as a fake GlobalConstants singleton class
+ // Register global constants as a fake CoreConstants singleton class
{
ClassAPI global_constants_api;
- global_constants_api.class_name = "GlobalConstants";
+ global_constants_api.class_name = "CoreConstants";
global_constants_api.api_type = ClassDB::API_CORE;
global_constants_api.is_singleton = true;
- global_constants_api.singleton_name = "GlobalConstants";
+ global_constants_api.singleton_name = "CoreConstants";
global_constants_api.is_instanciable = false;
- const int constants_count = GlobalConstants::get_global_constant_count();
+ const int constants_count = CoreConstants::get_global_constant_count();
for (int i = 0; i < constants_count; ++i) {
ConstantAPI constant_api;
- constant_api.constant_name = GlobalConstants::get_global_constant_name(i);
- constant_api.constant_value = GlobalConstants::get_global_constant_value(i);
+ constant_api.constant_name = CoreConstants::get_global_constant_name(i);
+ constant_api.constant_value = CoreConstants::get_global_constant_value(i);
global_constants_api.constants.push_back(constant_api);
}
global_constants_api.constants.sort_custom<ConstantAPIComparator>();
diff --git a/modules/gdnative/nativescript/api_generator.h b/modules/gdnative/nativescript/api_generator.h
index edbb1d1f23..8555af5215 100644
--- a/modules/gdnative/nativescript/api_generator.h
+++ b/modules/gdnative/nativescript/api_generator.h
@@ -31,8 +31,8 @@
#ifndef API_GENERATOR_H
#define API_GENERATOR_H
+#include "core/string/ustring.h"
#include "core/typedefs.h"
-#include "core/ustring.h"
Error generate_c_api(const String &p_path);
diff --git a/modules/gdnative/nativescript/godot_nativescript.cpp b/modules/gdnative/nativescript/godot_nativescript.cpp
index e47548f3e9..411acbe1ad 100644
--- a/modules/gdnative/nativescript/godot_nativescript.cpp
+++ b/modules/gdnative/nativescript/godot_nativescript.cpp
@@ -30,11 +30,11 @@
#include "nativescript/godot_nativescript.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 "core/config/project_settings.h"
+#include "core/core_constants.h"
+#include "core/error/error_macros.h"
+#include "core/object/class_db.h"
+#include "core/variant/variant.h"
#include "gdnative/gdnative.h"
#include <stdint.h>
diff --git a/modules/gdnative/nativescript/nativescript.cpp b/modules/gdnative/nativescript/nativescript.cpp
index 632f4e5fee..0939cfd06a 100644
--- a/modules/gdnative/nativescript/nativescript.cpp
+++ b/modules/gdnative/nativescript/nativescript.cpp
@@ -34,12 +34,12 @@
#include "gdnative/gdnative.h"
+#include "core/config/project_settings.h"
+#include "core/core_constants.h"
#include "core/core_string_names.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"
#include "scene/resources/resource_format_text.h"
diff --git a/modules/gdnative/nativescript/nativescript.h b/modules/gdnative/nativescript/nativescript.h
index 145bf7dcb6..2aaa4be325 100644
--- a/modules/gdnative/nativescript/nativescript.h
+++ b/modules/gdnative/nativescript/nativescript.h
@@ -31,15 +31,15 @@
#ifndef NATIVE_SCRIPT_H
#define NATIVE_SCRIPT_H
+#include "core/io/resource.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/object/script_language.h"
#include "core/os/mutex.h"
#include "core/os/thread_safe.h"
-#include "core/resource.h"
-#include "core/script_language.h"
-#include "core/self_list.h"
+#include "core/templates/oa_hash_map.h"
+#include "core/templates/ordered_hash_map.h"
+#include "core/templates/self_list.h"
#include "scene/main/node.h"
#include "modules/gdnative/gdnative.h"
diff --git a/modules/gdnative/pluginscript/pluginscript_instance.cpp b/modules/gdnative/pluginscript/pluginscript_instance.cpp
index 7d17a7d5ab..0942fb40a8 100644
--- a/modules/gdnative/pluginscript/pluginscript_instance.cpp
+++ b/modules/gdnative/pluginscript/pluginscript_instance.cpp
@@ -32,7 +32,7 @@
// Godot imports
#include "core/os/os.h"
-#include "core/variant.h"
+#include "core/variant/variant.h"
// PluginScript imports
#include "pluginscript_language.h"
diff --git a/modules/gdnative/pluginscript/pluginscript_instance.h b/modules/gdnative/pluginscript/pluginscript_instance.h
index 690d1a0432..76ff9f7097 100644
--- a/modules/gdnative/pluginscript/pluginscript_instance.h
+++ b/modules/gdnative/pluginscript/pluginscript_instance.h
@@ -32,7 +32,7 @@
#define PLUGINSCRIPT_INSTANCE_H
// Godot imports
-#include "core/script_language.h"
+#include "core/object/script_language.h"
// PluginScript imports
#include <pluginscript/godot_pluginscript.h>
diff --git a/modules/gdnative/pluginscript/pluginscript_language.cpp b/modules/gdnative/pluginscript/pluginscript_language.cpp
index bccbe95033..fc9c4ebd77 100644
--- a/modules/gdnative/pluginscript/pluginscript_language.cpp
+++ b/modules/gdnative/pluginscript/pluginscript_language.cpp
@@ -29,9 +29,9 @@
/*************************************************************************/
// Godot imports
+#include "core/config/project_settings.h"
#include "core/os/file_access.h"
#include "core/os/os.h"
-#include "core/project_settings.h"
// PluginScript imports
#include "pluginscript_language.h"
#include "pluginscript_script.h"
diff --git a/modules/gdnative/pluginscript/pluginscript_language.h b/modules/gdnative/pluginscript/pluginscript_language.h
index dd6758713f..53e1e3ae9b 100644
--- a/modules/gdnative/pluginscript/pluginscript_language.h
+++ b/modules/gdnative/pluginscript/pluginscript_language.h
@@ -34,9 +34,9 @@
// Godot imports
#include "core/io/resource_loader.h"
#include "core/io/resource_saver.h"
-#include "core/map.h"
-#include "core/script_language.h"
-#include "core/self_list.h"
+#include "core/object/script_language.h"
+#include "core/templates/map.h"
+#include "core/templates/self_list.h"
// PluginScript imports
#include "pluginscript_loader.h"
#include <pluginscript/godot_pluginscript.h>
diff --git a/modules/gdnative/pluginscript/pluginscript_loader.h b/modules/gdnative/pluginscript/pluginscript_loader.h
index 35fc79c2ca..7d80f4c733 100644
--- a/modules/gdnative/pluginscript/pluginscript_loader.h
+++ b/modules/gdnative/pluginscript/pluginscript_loader.h
@@ -34,7 +34,7 @@
// Godot imports
#include "core/io/resource_loader.h"
#include "core/io/resource_saver.h"
-#include "core/script_language.h"
+#include "core/object/script_language.h"
class PluginScriptLanguage;
diff --git a/modules/gdnative/pluginscript/pluginscript_script.h b/modules/gdnative/pluginscript/pluginscript_script.h
index 9cd38cd4b4..150de05e74 100644
--- a/modules/gdnative/pluginscript/pluginscript_script.h
+++ b/modules/gdnative/pluginscript/pluginscript_script.h
@@ -32,7 +32,7 @@
#define PLUGINSCRIPT_SCRIPT_H
// Godot imports
-#include "core/script_language.h"
+#include "core/object/script_language.h"
// PluginScript imports
#include "pluginscript_language.h"
#include <pluginscript/godot_pluginscript.h>
diff --git a/modules/gdnative/pluginscript/register_types.cpp b/modules/gdnative/pluginscript/register_types.cpp
index 97a48b0e89..b354c23a9e 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/config/project_settings.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 "scene/main/scene_tree.h"
#include "pluginscript_language.h"
diff --git a/modules/gdnative/register_types.cpp b/modules/gdnative/register_types.cpp
index 3a2d0b09a3..b88bf58256 100644
--- a/modules/gdnative/register_types.cpp
+++ b/modules/gdnative/register_types.cpp
@@ -40,11 +40,11 @@
#include "videodecoder/register_types.h"
#include "xr/register_types.h"
-#include "core/engine.h"
+#include "core/config/engine.h"
+#include "core/config/project_settings.h"
#include "core/io/resource_loader.h"
#include "core/io/resource_saver.h"
#include "core/os/os.h"
-#include "core/project_settings.h"
#ifdef TOOLS_ENABLED
#include "editor/editor_export.h"
diff --git a/modules/gdnative/videodecoder/register_types.cpp b/modules/gdnative/videodecoder/register_types.cpp
index 4181d8813f..8ee1c8d183 100644
--- a/modules/gdnative/videodecoder/register_types.cpp
+++ b/modules/gdnative/videodecoder/register_types.cpp
@@ -30,7 +30,7 @@
#include "register_types.h"
-#include "core/class_db.h"
+#include "core/object/class_db.h"
#include "video_stream_gdnative.h"
static Ref<ResourceFormatLoaderVideoStreamGDNative> resource_loader_vsgdnative;
diff --git a/modules/gdnative/videodecoder/video_stream_gdnative.cpp b/modules/gdnative/videodecoder/video_stream_gdnative.cpp
index fe7c10cad9..61e882f2fe 100644
--- a/modules/gdnative/videodecoder/video_stream_gdnative.cpp
+++ b/modules/gdnative/videodecoder/video_stream_gdnative.cpp
@@ -30,7 +30,7 @@
#include "video_stream_gdnative.h"
-#include "core/project_settings.h"
+#include "core/config/project_settings.h"
#include "servers/audio_server.h"
VideoDecoderServer *VideoDecoderServer::instance = nullptr;
diff --git a/modules/gdnavigation/gd_navigation_server.h b/modules/gdnavigation/gd_navigation_server.h
index e3e02f3d7c..c00d60ced7 100644
--- a/modules/gdnavigation/gd_navigation_server.h
+++ b/modules/gdnavigation/gd_navigation_server.h
@@ -31,8 +31,8 @@
#ifndef GD_NAVIGATION_SERVER_H
#define GD_NAVIGATION_SERVER_H
-#include "core/rid.h"
-#include "core/rid_owner.h"
+#include "core/templates/rid.h"
+#include "core/templates/rid_owner.h"
#include "servers/navigation_server_3d.h"
#include "nav_map.h"
diff --git a/modules/gdnavigation/nav_rid.h b/modules/gdnavigation/nav_rid.h
index c119ecc5e0..b727fceb04 100644
--- a/modules/gdnavigation/nav_rid.h
+++ b/modules/gdnavigation/nav_rid.h
@@ -31,7 +31,7 @@
#ifndef NAV_RID_H
#define NAV_RID_H
-#include "core/rid.h"
+#include "core/templates/rid.h"
/**
@author AndreaCatania
diff --git a/modules/gdnavigation/register_types.cpp b/modules/gdnavigation/register_types.cpp
index 088b26bf17..1ae19ebe47 100644
--- a/modules/gdnavigation/register_types.cpp
+++ b/modules/gdnavigation/register_types.cpp
@@ -30,7 +30,7 @@
#include "register_types.h"
-#include "core/engine.h"
+#include "core/config/engine.h"
#include "gd_navigation_server.h"
#include "servers/navigation_server_3d.h"
diff --git a/modules/gdnavigation/rvo_agent.h b/modules/gdnavigation/rvo_agent.h
index 1ad9d3ed76..de36508edb 100644
--- a/modules/gdnavigation/rvo_agent.h
+++ b/modules/gdnavigation/rvo_agent.h
@@ -31,7 +31,7 @@
#ifndef RVO_AGENT_H
#define RVO_AGENT_H
-#include "core/class_db.h"
+#include "core/object/class_db.h"
#include "nav_rid.h"
#include <Agent.h>
diff --git a/modules/gdscript/doc_classes/@GDScript.xml b/modules/gdscript/doc_classes/@GDScript.xml
index e170667a30..60051499a5 100644
--- a/modules/gdscript/doc_classes/@GDScript.xml
+++ b/modules/gdscript/doc_classes/@GDScript.xml
@@ -386,24 +386,6 @@
[/codeblock]
</description>
</method>
- <method name="funcref">
- <return type="FuncRef">
- </return>
- <argument index="0" name="instance" type="Object">
- </argument>
- <argument index="1" name="funcname" type="String">
- </argument>
- <description>
- Returns a reference to the specified function [code]funcname[/code] in the [code]instance[/code] node. As functions aren't first-class objects in GDscript, use [code]funcref[/code] to store a [FuncRef] in a variable and call it later.
- [codeblock]
- func foo():
- return("bar")
-
- a = funcref(self, "foo")
- print(a.call_func()) # Prints bar
- [/codeblock]
- </description>
- </method>
<method name="get_stack">
<return type="Array">
</return>
@@ -921,20 +903,6 @@
[/codeblock]
</description>
</method>
- <method name="rand_range">
- <return type="float">
- </return>
- <argument index="0" name="from" type="float">
- </argument>
- <argument index="1" name="to" type="float">
- </argument>
- <description>
- Random range, any floating point value between [code]from[/code] and [code]to[/code].
- [codeblock]
- prints(rand_range(0, 1), rand_range(0, 1)) # Prints e.g. 0.135591 0.405263
- [/codeblock]
- </description>
- </method>
<method name="rand_seed">
<return type="Array">
</return>
@@ -954,6 +922,20 @@
[/codeblock]
</description>
</method>
+ <method name="randf_range">
+ <return type="float">
+ </return>
+ <argument index="0" name="from" type="float">
+ </argument>
+ <argument index="1" name="to" type="float">
+ </argument>
+ <description>
+ Random range, any floating point value between [code]from[/code] and [code]to[/code].
+ [codeblock]
+ prints(randf_range(-10, 10), randf_range(-10, 10)) # Prints e.g. -3.844535 7.45315
+ [/codeblock]
+ </description>
+ </method>
<method name="randi">
<return type="int">
</return>
@@ -967,6 +949,21 @@
[/codeblock]
</description>
</method>
+ <method name="randi_range">
+ <return type="int">
+ </return>
+ <argument index="0" name="from" type="int">
+ </argument>
+ <argument index="1" name="to" type="int">
+ </argument>
+ <description>
+ Random range, any 32-bit integer value between [code]from[/code] and [code]to[/code] (inclusive). If [code]to[/code] is lesser than [code]from[/code] they are swapped.
+ [codeblock]
+ print(randi_range(0, 1)) # Prints 0 or 1
+ print(randi_range(-10, 1000)) # Prints any number from -10 to 1000
+ [/codeblock]
+ </description>
+ </method>
<method name="randomize">
<return type="void">
</return>
diff --git a/modules/gdscript/editor/gdscript_translation_parser_plugin.h b/modules/gdscript/editor/gdscript_translation_parser_plugin.h
index 5ea416d4cc..d763df01f5 100644
--- a/modules/gdscript/editor/gdscript_translation_parser_plugin.h
+++ b/modules/gdscript/editor/gdscript_translation_parser_plugin.h
@@ -31,7 +31,7 @@
#ifndef GDSCRIPT_TRANSLATION_PARSER_PLUGIN_H
#define GDSCRIPT_TRANSLATION_PARSER_PLUGIN_H
-#include "core/set.h"
+#include "core/templates/set.h"
#include "editor/editor_translation_parser.h"
#include "modules/gdscript/gdscript_parser.h"
#include "modules/regex/regex.h"
diff --git a/modules/gdscript/gdscript.cpp b/modules/gdscript/gdscript.cpp
index e70e3f7272..53602f7a9b 100644
--- a/modules/gdscript/gdscript.cpp
+++ b/modules/gdscript/gdscript.cpp
@@ -32,13 +32,13 @@
#include <stdint.h>
+#include "core/config/engine.h"
+#include "core/config/project_settings.h"
+#include "core/core_constants.h"
#include "core/core_string_names.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_analyzer.h"
#include "gdscript_cache.h"
#include "gdscript_compiler.h"
@@ -1092,7 +1092,8 @@ bool GDScriptInstance::set(const StringName &p_name, const Variant &p_value) {
// Try conversion
Callable::CallError ce;
const Variant *value = &p_value;
- Variant converted = Variant::construct(member->data_type.builtin_type, &value, 1, ce);
+ Variant converted;
+ Variant::construct(member->data_type.builtin_type, converted, &value, 1, ce);
if (ce.error == Callable::CallError::CALL_OK) {
members.write[member->index] = converted;
return true;
@@ -1500,9 +1501,9 @@ void GDScriptLanguage::remove_named_global_constant(const StringName &p_name) {
void GDScriptLanguage::init() {
//populate global constants
- int gcc = GlobalConstants::get_global_constant_count();
+ int gcc = CoreConstants::get_global_constant_count();
for (int i = 0; i < gcc; i++) {
- _add_global(StaticCString::create(GlobalConstants::get_global_constant_name(i)), GlobalConstants::get_global_constant_value(i));
+ _add_global(StaticCString::create(CoreConstants::get_global_constant_name(i)), CoreConstants::get_global_constant_value(i));
}
_add_global(StaticCString::create("PI"), Math_PI);
diff --git a/modules/gdscript/gdscript.h b/modules/gdscript/gdscript.h
index 79317ff846..b69a6e39c0 100644
--- a/modules/gdscript/gdscript.h
+++ b/modules/gdscript/gdscript.h
@@ -35,7 +35,7 @@
#include "core/debugger/script_debugger.h"
#include "core/io/resource_loader.h"
#include "core/io/resource_saver.h"
-#include "core/script_language.h"
+#include "core/object/script_language.h"
#include "gdscript_function.h"
class GDScriptNativeClass : public Reference {
diff --git a/modules/gdscript/gdscript_analyzer.cpp b/modules/gdscript/gdscript_analyzer.cpp
index ab4edb04b9..6b23ab1616 100644
--- a/modules/gdscript/gdscript_analyzer.cpp
+++ b/modules/gdscript/gdscript_analyzer.cpp
@@ -30,12 +30,12 @@
#include "gdscript_analyzer.h"
-#include "core/class_db.h"
-#include "core/hash_map.h"
+#include "core/config/project_settings.h"
#include "core/io/resource_loader.h"
+#include "core/object/class_db.h"
+#include "core/object/script_language.h"
#include "core/os/file_access.h"
-#include "core/project_settings.h"
-#include "core/script_language.h"
+#include "core/templates/hash_map.h"
#include "gdscript.h"
// TODO: Move this to a central location (maybe core?).
@@ -1711,7 +1711,8 @@ void GDScriptAnalyzer::reduce_call(GDScriptParser::CallNode *p_call, bool is_awa
}
Callable::CallError err;
- Variant value = Variant::construct(builtin_type, (const Variant **)args.ptr(), args.size(), err);
+ Variant value;
+ Variant::construct(builtin_type, value, (const Variant **)args.ptr(), args.size(), err);
switch (err.error) {
case Callable::CallError::CALL_ERROR_INVALID_ARGUMENT:
@@ -2075,7 +2076,8 @@ void GDScriptAnalyzer::reduce_identifier_from_base(GDScriptParser::IdentifierNod
}
default: {
Callable::CallError temp;
- Variant dummy = Variant::construct(base.builtin_type, nullptr, 0, temp);
+ Variant dummy;
+ Variant::construct(base.builtin_type, dummy, nullptr, 0, temp);
List<PropertyInfo> properties;
dummy.get_property_list(&properties);
for (const List<PropertyInfo>::Element *E = properties.front(); E != nullptr; E = E->next()) {
@@ -2438,7 +2440,7 @@ void GDScriptAnalyzer::reduce_subscript(GDScriptParser::SubscriptNode *p_subscri
if (p_subscript->base->is_constant) {
// Just try to get it.
bool valid = false;
- Variant value = p_subscript->base->reduced_value.get_named(p_subscript->attribute->name, &valid);
+ Variant value = p_subscript->base->reduced_value.get_named(p_subscript->attribute->name, valid);
if (!valid) {
push_error(vformat(R"(Cannot get member "%s" from "%s".)", p_subscript->attribute->name, p_subscript->base->reduced_value), p_subscript->index);
} else {
@@ -2539,7 +2541,7 @@ void GDScriptAnalyzer::reduce_subscript(GDScriptParser::SubscriptNode *p_subscri
error = index_type.builtin_type != Variant::INT && index_type.builtin_type != Variant::STRING;
break;
// Don't support indexing, but we will check it later.
- case Variant::_RID:
+ case Variant::RID:
case Variant::BOOL:
case Variant::CALLABLE:
case Variant::FLOAT:
@@ -2572,7 +2574,7 @@ void GDScriptAnalyzer::reduce_subscript(GDScriptParser::SubscriptNode *p_subscri
switch (base_type.builtin_type) {
// Can't index at all.
- case Variant::_RID:
+ case Variant::RID:
case Variant::BOOL:
case Variant::CALLABLE:
case Variant::FLOAT:
@@ -2869,7 +2871,8 @@ bool GDScriptAnalyzer::get_function_signature(GDScriptParser::Node *p_source, GD
if (p_base_type.kind == GDScriptParser::DataType::BUILTIN) {
// Construct a base type to get methods.
Callable::CallError err;
- Variant dummy = Variant::construct(p_base_type.builtin_type, nullptr, 0, err);
+ Variant dummy;
+ Variant::construct(p_base_type.builtin_type, dummy, nullptr, 0, err);
if (err.error != Callable::CallError::CALL_OK) {
ERR_FAIL_V_MSG(false, "Could not construct base Variant type.");
}
@@ -3095,7 +3098,7 @@ GDScriptParser::DataType GDScriptAnalyzer::get_operation_type(Variant::Operator
a = a_ref;
} else {
Callable::CallError err;
- a = Variant::construct(a_type, nullptr, 0, err);
+ Variant::construct(a_type, a, nullptr, 0, err);
if (err.error != Callable::CallError::CALL_OK) {
r_valid = false;
ERR_FAIL_V_MSG(result, vformat("Could not construct value of type %s", Variant::get_type_name(a_type)));
@@ -3108,7 +3111,7 @@ GDScriptParser::DataType GDScriptAnalyzer::get_operation_type(Variant::Operator
b = b_ref;
} else {
Callable::CallError err;
- b = Variant::construct(b_type, nullptr, 0, err);
+ Variant::construct(b_type, b, nullptr, 0, err);
if (err.error != Callable::CallError::CALL_OK) {
r_valid = false;
ERR_FAIL_V_MSG(result, vformat("Could not construct value of type %s", Variant::get_type_name(b_type)));
diff --git a/modules/gdscript/gdscript_analyzer.h b/modules/gdscript/gdscript_analyzer.h
index f3cbb320b7..0a952cc621 100644
--- a/modules/gdscript/gdscript_analyzer.h
+++ b/modules/gdscript/gdscript_analyzer.h
@@ -31,9 +31,9 @@
#ifndef GDSCRIPT_ANALYZER_H
#define GDSCRIPT_ANALYZER_H
-#include "core/object.h"
-#include "core/reference.h"
-#include "core/set.h"
+#include "core/object/object.h"
+#include "core/object/reference.h"
+#include "core/templates/set.h"
#include "gdscript_cache.h"
#include "gdscript_parser.h"
diff --git a/modules/gdscript/gdscript_cache.cpp b/modules/gdscript/gdscript_cache.cpp
index 57b95f5b21..95d24a8b08 100644
--- a/modules/gdscript/gdscript_cache.cpp
+++ b/modules/gdscript/gdscript_cache.cpp
@@ -31,7 +31,7 @@
#include "gdscript_cache.h"
#include "core/os/file_access.h"
-#include "core/vector.h"
+#include "core/templates/vector.h"
#include "gdscript.h"
#include "gdscript_analyzer.h"
#include "gdscript_parser.h"
diff --git a/modules/gdscript/gdscript_cache.h b/modules/gdscript/gdscript_cache.h
index 865df34051..90c5884985 100644
--- a/modules/gdscript/gdscript_cache.h
+++ b/modules/gdscript/gdscript_cache.h
@@ -31,10 +31,10 @@
#ifndef GDSCRIPT_CACHE_H
#define GDSCRIPT_CACHE_H
-#include "core/hash_map.h"
+#include "core/object/reference.h"
#include "core/os/mutex.h"
-#include "core/reference.h"
-#include "core/set.h"
+#include "core/templates/hash_map.h"
+#include "core/templates/set.h"
#include "gdscript.h"
class GDScriptAnalyzer;
diff --git a/modules/gdscript/gdscript_codegen.h b/modules/gdscript/gdscript_codegen.h
index 31e1e6ba23..9872a61423 100644
--- a/modules/gdscript/gdscript_codegen.h
+++ b/modules/gdscript/gdscript_codegen.h
@@ -32,8 +32,8 @@
#define GDSCRIPT_CODEGEN
#include "core/io/multiplayer_api.h"
-#include "core/string_name.h"
-#include "core/variant.h"
+#include "core/string/string_name.h"
+#include "core/variant/variant.h"
#include "gdscript_function.h"
#include "gdscript_functions.h"
diff --git a/modules/gdscript/gdscript_compiler.h b/modules/gdscript/gdscript_compiler.h
index fe34d6cba3..157c801f56 100644
--- a/modules/gdscript/gdscript_compiler.h
+++ b/modules/gdscript/gdscript_compiler.h
@@ -31,7 +31,7 @@
#ifndef GDSCRIPT_COMPILER_H
#define GDSCRIPT_COMPILER_H
-#include "core/set.h"
+#include "core/templates/set.h"
#include "gdscript.h"
#include "gdscript_codegen.h"
#include "gdscript_function.h"
diff --git a/modules/gdscript/gdscript_editor.cpp b/modules/gdscript/gdscript_editor.cpp
index aec05b6771..d0acc14a04 100644
--- a/modules/gdscript/gdscript_editor.cpp
+++ b/modules/gdscript/gdscript_editor.cpp
@@ -30,8 +30,8 @@
#include "gdscript.h"
-#include "core/engine.h"
-#include "core/global_constants.h"
+#include "core/config/engine.h"
+#include "core/core_constants.h"
#include "core/os/file_access.h"
#include "gdscript_analyzer.h"
#include "gdscript_compiler.h"
@@ -39,7 +39,7 @@
#include "gdscript_tokenizer.h"
#ifdef TOOLS_ENABLED
-#include "core/project_settings.h"
+#include "core/config/project_settings.h"
#include "editor/editor_file_system.h"
#include "editor/editor_settings.h"
#endif
@@ -383,8 +383,8 @@ void GDScriptLanguage::debug_get_globals(List<String> *p_globals, List<Variant>
}
bool skip = false;
- for (int i = 0; i < GlobalConstants::get_global_constant_count(); i++) {
- if (E->key() == GlobalConstants::get_global_constant_name(i)) {
+ for (int i = 0; i < CoreConstants::get_global_constant_count(); i++) {
+ if (E->key() == CoreConstants::get_global_constant_name(i)) {
skip = true;
break;
}
@@ -973,7 +973,8 @@ static void _find_identifiers_in_base(const GDScriptCompletionIdentifier &p_base
} break;
case GDScriptParser::DataType::BUILTIN: {
Callable::CallError err;
- Variant tmp = Variant::construct(base_type.builtin_type, nullptr, 0, err);
+ Variant tmp;
+ Variant::construct(base_type.builtin_type, tmp, nullptr, 0, err);
if (err.error != Callable::CallError::CALL_OK) {
return;
}
@@ -1523,7 +1524,8 @@ static bool _guess_expression_type(GDScriptParser::CompletionContext &p_context,
found = _guess_identifier_type_from_base(c, base, id, r_type);
} else if (!found && index.type.kind == GDScriptParser::DataType::BUILTIN) {
Callable::CallError err;
- Variant base_val = Variant::construct(base.type.builtin_type, nullptr, 0, err);
+ Variant base_val;
+ Variant::construct(base.type.builtin_type, base_val, nullptr, 0, err);
bool valid = false;
Variant res = base_val.get(index.value, &valid);
if (valid) {
@@ -1560,9 +1562,14 @@ static bool _guess_expression_type(GDScriptParser::CompletionContext &p_context,
Callable::CallError ce;
bool v1_use_value = p1.value.get_type() != Variant::NIL && p1.value.get_type() != Variant::OBJECT;
- Variant v1 = (v1_use_value) ? p1.value : Variant::construct(p1.type.builtin_type, nullptr, 0, ce);
+ Variant d1;
+ Variant::construct(p1.type.builtin_type, d1, nullptr, 0, ce);
+ Variant d2;
+ Variant::construct(p2.type.builtin_type, d2, nullptr, 0, ce);
+
+ Variant v1 = (v1_use_value) ? p1.value : d1;
bool v2_use_value = p2.value.get_type() != Variant::NIL && p2.value.get_type() != Variant::OBJECT;
- Variant v2 = (v2_use_value) ? p2.value : Variant::construct(p2.type.builtin_type, nullptr, 0, ce);
+ Variant v2 = (v2_use_value) ? p2.value : d2;
// avoid potential invalid ops
if ((op->variant_op == Variant::OP_DIVIDE || op->variant_op == Variant::OP_MODULE) && v2.get_type() == Variant::INT) {
v2 = 1;
@@ -1952,7 +1959,8 @@ static bool _guess_identifier_type_from_base(GDScriptParser::CompletionContext &
} break;
case GDScriptParser::DataType::BUILTIN: {
Callable::CallError err;
- Variant tmp = Variant::construct(base_type.builtin_type, nullptr, 0, err);
+ Variant tmp;
+ Variant::construct(base_type.builtin_type, tmp, nullptr, 0, err);
if (err.error != Callable::CallError::CALL_OK) {
return false;
@@ -2102,7 +2110,8 @@ static bool _guess_method_return_type_from_base(GDScriptParser::CompletionContex
} break;
case GDScriptParser::DataType::BUILTIN: {
Callable::CallError err;
- Variant tmp = Variant::construct(base_type.builtin_type, nullptr, 0, err);
+ Variant tmp;
+ Variant::construct(base_type.builtin_type, tmp, nullptr, 0, err);
if (err.error != Callable::CallError::CALL_OK) {
return false;
}
@@ -2139,9 +2148,9 @@ static void _find_enumeration_candidates(GDScriptParser::CompletionContext &p_co
r_result.insert(option.display, option);
}
} else {
- for (int i = 0; i < GlobalConstants::get_global_constant_count(); i++) {
- if (GlobalConstants::get_global_constant_enum(i) == current_enum) {
- ScriptCodeCompletionOption option(GlobalConstants::get_global_constant_name(i), ScriptCodeCompletionOption::KIND_ENUM);
+ for (int i = 0; i < CoreConstants::get_global_constant_count(); i++) {
+ if (CoreConstants::get_global_constant_enum(i) == current_enum) {
+ ScriptCodeCompletionOption option(CoreConstants::get_global_constant_name(i), ScriptCodeCompletionOption::KIND_ENUM);
r_result.insert(option.display, option);
}
}
@@ -2257,7 +2266,7 @@ static void _find_call_arguments(GDScriptParser::CompletionContext &p_context, c
case GDScriptParser::DataType::BUILTIN: {
if (base.get_type() == Variant::NIL) {
Callable::CallError err;
- base = Variant::construct(base_type.builtin_type, nullptr, 0, err);
+ Variant::construct(base_type.builtin_type, base, nullptr, 0, err);
if (err.error != Callable::CallError::CALL_OK) {
return;
}
@@ -2883,7 +2892,7 @@ static Error _lookup_symbol_from_base(const GDScriptParser::DataType &p_base, co
v = v_ref;
} else {
Callable::CallError err;
- v = Variant::construct(base_type.builtin_type, NULL, 0, err);
+ Variant::construct(base_type.builtin_type, v, NULL, 0, err);
if (err.error != Callable::CallError::CALL_OK) {
break;
}
diff --git a/modules/gdscript/gdscript_function.cpp b/modules/gdscript/gdscript_function.cpp
index 1da0e7b4c6..59f3deb736 100644
--- a/modules/gdscript/gdscript_function.cpp
+++ b/modules/gdscript/gdscript_function.cpp
@@ -35,7 +35,7 @@
#include "gdscript_functions.h"
#ifdef DEBUG_ENABLED
-#include "core/string_builder.h"
+#include "core/string/string_builder.h"
#endif
Variant *GDScriptFunction::_get_variant(int p_address, GDScriptInstance *p_instance, GDScript *p_script, Variant &self, Variant &static_ref, Variant *p_stack, String &r_error) const {
@@ -331,7 +331,8 @@ Variant GDScriptFunction::call(GDScriptInstance *p_instance, const Variant **p_a
return Variant();
}
if (argument_types[i].kind == GDScriptDataType::BUILTIN) {
- Variant arg = Variant::construct(argument_types[i].builtin_type, &p_args[i], 1, r_err);
+ Variant arg;
+ Variant::construct(argument_types[i].builtin_type, arg, &p_args[i], 1, r_err);
memnew_placement(&stack[i], Variant(arg));
} else {
memnew_placement(&stack[i], Variant(*p_args[i]));
@@ -620,7 +621,7 @@ Variant GDScriptFunction::call(GDScriptInstance *p_instance, const Variant **p_a
const StringName *index = &_global_names_ptr[indexname];
bool valid;
- dst->set_named(*index, *value, &valid);
+ dst->set_named(*index, *value, valid);
#ifdef DEBUG_ENABLED
if (!valid) {
@@ -647,10 +648,10 @@ Variant GDScriptFunction::call(GDScriptInstance *p_instance, const Variant **p_a
bool valid;
#ifdef DEBUG_ENABLED
//allow better error message in cases where src and dst are the same stack position
- Variant ret = src->get_named(*index, &valid);
+ Variant ret = src->get_named(*index, valid);
#else
- *dst = src->get_named(*index, &valid);
+ *dst = src->get_named(*index, valid);
#endif
#ifdef DEBUG_ENABLED
if (!valid) {
@@ -755,7 +756,7 @@ Variant GDScriptFunction::call(GDScriptInstance *p_instance, const Variant **p_a
if (Variant::can_convert_strict(src->get_type(), var_type)) {
#endif // DEBUG_ENABLED
Callable::CallError ce;
- *dst = Variant::construct(var_type, const_cast<const Variant **>(&src), 1, ce);
+ Variant::construct(var_type, *dst, const_cast<const Variant **>(&src), 1, ce);
} else {
#ifdef DEBUG_ENABLED
err_text = "Trying to assign value of type '" + Variant::get_type_name(src->get_type()) +
@@ -857,7 +858,7 @@ Variant GDScriptFunction::call(GDScriptInstance *p_instance, const Variant **p_a
GD_ERR_BREAK(to_type < 0 || to_type >= Variant::VARIANT_MAX);
Callable::CallError err;
- *dst = Variant::construct(to_type, (const Variant **)&src, 1, err);
+ Variant::construct(to_type, *dst, (const Variant **)&src, 1, err);
#ifdef DEBUG_ENABLED
if (err.error != Callable::CallError::CALL_OK) {
@@ -955,7 +956,7 @@ Variant GDScriptFunction::call(GDScriptInstance *p_instance, const Variant **p_a
GET_VARIANT_PTR(dst, 3 + argc);
Callable::CallError err;
- *dst = Variant::construct(t, (const Variant **)argptrs, argc, err);
+ Variant::construct(t, *dst, (const Variant **)argptrs, argc, err);
#ifdef DEBUG_ENABLED
if (err.error != Callable::CallError::CALL_OK) {
diff --git a/modules/gdscript/gdscript_function.h b/modules/gdscript/gdscript_function.h
index c98ac09310..50eadcaf86 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 "core/object/reference.h"
+#include "core/object/script_language.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_name.h"
-#include "core/variant.h"
+#include "core/string/string_name.h"
+#include "core/templates/pair.h"
+#include "core/templates/self_list.h"
+#include "core/variant/variant.h"
class GDScriptInstance;
class GDScript;
diff --git a/modules/gdscript/gdscript_functions.cpp b/modules/gdscript/gdscript_functions.cpp
index 31ce63bc6e..0942552ba8 100644
--- a/modules/gdscript/gdscript_functions.cpp
+++ b/modules/gdscript/gdscript_functions.cpp
@@ -30,14 +30,13 @@
#include "gdscript_functions.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/object/class_db.h"
+#include "core/object/reference.h"
#include "core/os/os.h"
-#include "core/reference.h"
-#include "core/variant_parser.h"
+#include "core/variant/variant_parser.h"
#include "gdscript.h"
const char *GDScriptFunctions::get_func_name(Function p_func) {
@@ -83,7 +82,8 @@ const char *GDScriptFunctions::get_func_name(Function p_func) {
"randomize",
"randi",
"randf",
- "rand_range",
+ "randf_range",
+ "randi_range",
"seed",
"rand_seed",
"deg2rad",
@@ -99,7 +99,6 @@ const char *GDScriptFunctions::get_func_name(Function p_func) {
"clamp",
"nearest_po2",
"weakref",
- "funcref",
"convert",
"typeof",
"type_exists",
@@ -419,7 +418,7 @@ void GDScriptFunctions::call(Function p_func, const Variant **p_args, int p_arg_
Math::randomize();
r_ret = Variant();
} break;
- case MATH_RAND: {
+ case MATH_RANDI: {
VALIDATE_ARG_COUNT(0);
r_ret = Math::rand();
} break;
@@ -427,12 +426,18 @@ void GDScriptFunctions::call(Function p_func, const Variant **p_args, int p_arg_
VALIDATE_ARG_COUNT(0);
r_ret = Math::randf();
} break;
- case MATH_RANDOM: {
+ case MATH_RANDF_RANGE: {
VALIDATE_ARG_COUNT(2);
VALIDATE_ARG_NUM(0);
VALIDATE_ARG_NUM(1);
r_ret = Math::random((double)*p_args[0], (double)*p_args[1]);
} break;
+ case MATH_RANDI_RANGE: {
+ VALIDATE_ARG_COUNT(2);
+ VALIDATE_ARG_NUM(0);
+ VALIDATE_ARG_NUM(1);
+ r_ret = Math::random((int)*p_args[0], (int)*p_args[1]);
+ } break;
case MATH_SEED: {
VALIDATE_ARG_COUNT(1);
VALIDATE_ARG_NUM(0);
@@ -582,31 +587,6 @@ void GDScriptFunctions::call(Function p_func, const Variant **p_args, int p_arg_
return;
}
} break;
- case FUNC_FUNCREF: {
- VALIDATE_ARG_COUNT(2);
- if (p_args[0]->get_type() != Variant::OBJECT) {
- r_error.error = Callable::CallError::CALL_ERROR_INVALID_ARGUMENT;
- r_error.argument = 0;
- r_error.expected = Variant::OBJECT;
- r_ret = Variant();
- return;
- }
- if (p_args[1]->get_type() != Variant::STRING && p_args[1]->get_type() != Variant::NODE_PATH) {
- r_error.error = Callable::CallError::CALL_ERROR_INVALID_ARGUMENT;
- r_error.argument = 1;
- r_error.expected = Variant::STRING;
- r_ret = Variant();
- return;
- }
-
- Ref<FuncRef> fr = memnew(FuncRef);
-
- fr->set_instance(*p_args[0]);
- fr->set_function(*p_args[1]);
-
- r_ret = fr;
-
- } break;
case TYPE_CONVERT: {
VALIDATE_ARG_COUNT(2);
VALIDATE_ARG_NUM(1);
@@ -619,7 +599,7 @@ void GDScriptFunctions::call(Function p_func, const Variant **p_args, int p_arg_
return;
} else {
- r_ret = Variant::construct(Variant::Type(type), p_args, 1, r_error);
+ Variant::construct(Variant::Type(type), r_ret, p_args, 1, r_error);
}
} break;
case TYPE_OF: {
@@ -1655,7 +1635,7 @@ MethodInfo GDScriptFunctions::get_info(Function p_func) {
mi.return_val.type = Variant::NIL;
return mi;
} break;
- case MATH_RAND: {
+ case MATH_RANDI: {
MethodInfo mi("randi");
mi.return_val.type = Variant::INT;
return mi;
@@ -1665,11 +1645,16 @@ MethodInfo GDScriptFunctions::get_info(Function p_func) {
mi.return_val.type = Variant::FLOAT;
return mi;
} break;
- case MATH_RANDOM: {
- MethodInfo mi("rand_range", PropertyInfo(Variant::FLOAT, "from"), PropertyInfo(Variant::FLOAT, "to"));
+ case MATH_RANDF_RANGE: {
+ MethodInfo mi("randf_range", PropertyInfo(Variant::FLOAT, "from"), PropertyInfo(Variant::FLOAT, "to"));
mi.return_val.type = Variant::FLOAT;
return mi;
} break;
+ case MATH_RANDI_RANGE: {
+ MethodInfo mi("randi_range", PropertyInfo(Variant::INT, "from"), PropertyInfo(Variant::INT, "to"));
+ mi.return_val.type = Variant::INT;
+ return mi;
+ } break;
case MATH_SEED: {
MethodInfo mi("seed", PropertyInfo(Variant::INT, "seed"));
mi.return_val.type = Variant::NIL;
@@ -1749,13 +1734,6 @@ MethodInfo GDScriptFunctions::get_info(Function p_func) {
return mi;
} break;
- case FUNC_FUNCREF: {
- MethodInfo mi("funcref", PropertyInfo(Variant::OBJECT, "instance"), PropertyInfo(Variant::STRING, "funcname"));
- mi.return_val.type = Variant::OBJECT;
- mi.return_val.class_name = "FuncRef";
- return mi;
-
- } break;
case TYPE_CONVERT: {
MethodInfo mi("convert", PropertyInfo(Variant::NIL, "what", PROPERTY_HINT_NONE, "", PROPERTY_USAGE_DEFAULT | PROPERTY_USAGE_NIL_IS_VARIANT), PropertyInfo(Variant::INT, "type"));
mi.return_val.type = Variant::NIL;
diff --git a/modules/gdscript/gdscript_functions.h b/modules/gdscript/gdscript_functions.h
index 2c6dc02913..005b49c5da 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 "core/variant.h"
+#include "core/variant/variant.h"
class GDScriptFunctions {
public:
@@ -73,9 +73,10 @@ public:
MATH_MOVE_TOWARD,
MATH_DECTIME,
MATH_RANDOMIZE,
- MATH_RAND,
+ MATH_RANDI,
MATH_RANDF,
- MATH_RANDOM,
+ MATH_RANDF_RANGE,
+ MATH_RANDI_RANGE,
MATH_SEED,
MATH_RANDSEED,
MATH_DEG2RAD,
@@ -91,7 +92,6 @@ public:
LOGIC_CLAMP,
LOGIC_NEAREST_PO2,
OBJ_WEAKREF,
- FUNC_FUNCREF,
TYPE_CONVERT,
TYPE_OF,
TYPE_EXISTS,
diff --git a/modules/gdscript/gdscript_parser.cpp b/modules/gdscript/gdscript_parser.cpp
index 2a69db130b..1eb3846319 100644
--- a/modules/gdscript/gdscript_parser.cpp
+++ b/modules/gdscript/gdscript_parser.cpp
@@ -30,15 +30,15 @@
#include "gdscript_parser.h"
+#include "core/config/project_settings.h"
#include "core/io/resource_loader.h"
#include "core/math/math_defs.h"
#include "core/os/file_access.h"
-#include "core/project_settings.h"
#include "gdscript.h"
#ifdef DEBUG_ENABLED
#include "core/os/os.h"
-#include "core/string_builder.h"
+#include "core/string/string_builder.h"
#endif // DEBUG_ENABLED
#ifdef TOOLS_ENABLED
@@ -65,7 +65,7 @@ Variant::Type GDScriptParser::get_builtin_type(const StringName &p_type) {
builtin_types["Basis"] = Variant::BASIS;
builtin_types["Transform"] = Variant::TRANSFORM;
builtin_types["Color"] = Variant::COLOR;
- builtin_types["RID"] = Variant::_RID;
+ builtin_types["RID"] = Variant::RID;
builtin_types["Object"] = Variant::OBJECT;
builtin_types["StringName"] = Variant::STRING_NAME;
builtin_types["NodePath"] = Variant::NODE_PATH;
@@ -2802,7 +2802,9 @@ bool GDScriptParser::validate_annotation_arguments(AnnotationNode *p_annotation)
Callable::CallError error;
Vector<Variant> args = varray(string->name);
const Variant *name = args.ptr();
- p_annotation->resolved_arguments.push_back(Variant::construct(parameter.type, &(name), 1, error));
+ Variant r;
+ Variant::construct(parameter.type, r, &(name), 1, error);
+ p_annotation->resolved_arguments.push_back(r);
if (error.error != Callable::CallError::CALL_OK) {
push_error(vformat(R"(Expected %s as argument %d of annotation "%s").)", Variant::get_type_name(parameter.type), i + 1, p_annotation->name));
p_annotation->resolved_arguments.remove(p_annotation->resolved_arguments.size() - 1);
@@ -2824,7 +2826,9 @@ bool GDScriptParser::validate_annotation_arguments(AnnotationNode *p_annotation)
}
Callable::CallError error;
const Variant *args = &value;
- p_annotation->resolved_arguments.push_back(Variant::construct(parameter.type, &(args), 1, error));
+ Variant r;
+ Variant::construct(parameter.type, r, &(args), 1, error);
+ p_annotation->resolved_arguments.push_back(r);
if (error.error != Callable::CallError::CALL_OK) {
push_error(vformat(R"(Expected %s as argument %d of annotation "%s").)", Variant::get_type_name(parameter.type), i + 1, p_annotation->name));
p_annotation->resolved_arguments.remove(p_annotation->resolved_arguments.size() - 1);
diff --git a/modules/gdscript/gdscript_parser.h b/modules/gdscript/gdscript_parser.h
index 4c9473c7bd..b24acc4778 100644
--- a/modules/gdscript/gdscript_parser.h
+++ b/modules/gdscript/gdscript_parser.h
@@ -31,23 +31,23 @@
#ifndef GDSCRIPT_PARSER_H
#define GDSCRIPT_PARSER_H
-#include "core/hash_map.h"
#include "core/io/multiplayer_api.h"
-#include "core/list.h"
-#include "core/map.h"
-#include "core/reference.h"
-#include "core/resource.h"
-#include "core/script_language.h"
-#include "core/string_name.h"
-#include "core/ustring.h"
-#include "core/variant.h"
-#include "core/vector.h"
+#include "core/io/resource.h"
+#include "core/object/reference.h"
+#include "core/object/script_language.h"
+#include "core/string/string_name.h"
+#include "core/string/ustring.h"
+#include "core/templates/hash_map.h"
+#include "core/templates/list.h"
+#include "core/templates/map.h"
+#include "core/templates/vector.h"
+#include "core/variant/variant.h"
#include "gdscript_cache.h"
#include "gdscript_functions.h"
#include "gdscript_tokenizer.h"
#ifdef DEBUG_ENABLED
-#include "core/string_builder.h"
+#include "core/string/string_builder.h"
#include "gdscript_warning.h"
#endif // DEBUG_ENABLED
diff --git a/modules/gdscript/gdscript_tokenizer.cpp b/modules/gdscript/gdscript_tokenizer.cpp
index 9a40aa50ac..b91777ede1 100644
--- a/modules/gdscript/gdscript_tokenizer.cpp
+++ b/modules/gdscript/gdscript_tokenizer.cpp
@@ -30,7 +30,7 @@
#include "gdscript_tokenizer.h"
-#include "core/error_macros.h"
+#include "core/error/error_macros.h"
#ifdef TOOLS_ENABLED
#include "editor/editor_settings.h"
diff --git a/modules/gdscript/gdscript_tokenizer.h b/modules/gdscript/gdscript_tokenizer.h
index 4453982d08..d51f1f250f 100644
--- a/modules/gdscript/gdscript_tokenizer.h
+++ b/modules/gdscript/gdscript_tokenizer.h
@@ -31,10 +31,10 @@
#ifndef GDSCRIPT_TOKENIZER_H
#define GDSCRIPT_TOKENIZER_H
-#include "core/list.h"
-#include "core/set.h"
-#include "core/variant.h"
-#include "core/vector.h"
+#include "core/templates/list.h"
+#include "core/templates/set.h"
+#include "core/templates/vector.h"
+#include "core/variant/variant.h"
class GDScriptTokenizer {
public:
diff --git a/modules/gdscript/gdscript_warning.cpp b/modules/gdscript/gdscript_warning.cpp
index 105facd9d0..56704d3e0a 100644
--- a/modules/gdscript/gdscript_warning.cpp
+++ b/modules/gdscript/gdscript_warning.cpp
@@ -30,7 +30,7 @@
#include "gdscript_warning.h"
-#include "core/variant.h"
+#include "core/variant/variant.h"
#ifdef DEBUG_ENABLED
diff --git a/modules/gdscript/gdscript_warning.h b/modules/gdscript/gdscript_warning.h
index e183d6f302..e0857703d8 100644
--- a/modules/gdscript/gdscript_warning.h
+++ b/modules/gdscript/gdscript_warning.h
@@ -33,8 +33,8 @@
#ifdef DEBUG_ENABLED
-#include "core/ustring.h"
-#include "core/vector.h"
+#include "core/string/ustring.h"
+#include "core/templates/vector.h"
class GDScriptWarning {
public:
diff --git a/modules/gdscript/language_server/gdscript_extend_parser.h b/modules/gdscript/language_server/gdscript_extend_parser.h
index 0c031d7883..bb02d3dc99 100644
--- a/modules/gdscript/language_server/gdscript_extend_parser.h
+++ b/modules/gdscript/language_server/gdscript_extend_parser.h
@@ -32,7 +32,7 @@
#define GDSCRIPT_EXTEND_PARSER_H
#include "../gdscript_parser.h"
-#include "core/variant.h"
+#include "core/variant/variant.h"
#include "lsp.hpp"
#ifndef LINE_NUMBER_TO_INDEX
diff --git a/modules/gdscript/language_server/gdscript_language_protocol.cpp b/modules/gdscript/language_server/gdscript_language_protocol.cpp
index 2a67d2ff4f..6ddb0d149e 100644
--- a/modules/gdscript/language_server/gdscript_language_protocol.cpp
+++ b/modules/gdscript/language_server/gdscript_language_protocol.cpp
@@ -30,9 +30,9 @@
#include "gdscript_language_protocol.h"
+#include "core/config/project_settings.h"
#include "core/io/json.h"
#include "core/os/copymem.h"
-#include "core/project_settings.h"
#include "editor/editor_log.h"
#include "editor/editor_node.h"
diff --git a/modules/gdscript/language_server/gdscript_text_document.h b/modules/gdscript/language_server/gdscript_text_document.h
index b2fd0c31f9..2a5755bec6 100644
--- a/modules/gdscript/language_server/gdscript_text_document.h
+++ b/modules/gdscript/language_server/gdscript_text_document.h
@@ -31,8 +31,8 @@
#ifndef GDSCRIPT_TEXT_DOCUMENT_H
#define GDSCRIPT_TEXT_DOCUMENT_H
+#include "core/object/reference.h"
#include "core/os/file_access.h"
-#include "core/reference.h"
#include "lsp.hpp"
class GDScriptTextDocument : public Reference {
diff --git a/modules/gdscript/language_server/gdscript_workspace.cpp b/modules/gdscript/language_server/gdscript_workspace.cpp
index 776193e37c..f6643d07f9 100644
--- a/modules/gdscript/language_server/gdscript_workspace.cpp
+++ b/modules/gdscript/language_server/gdscript_workspace.cpp
@@ -32,8 +32,8 @@
#include "../gdscript.h"
#include "../gdscript_parser.h"
-#include "core/project_settings.h"
-#include "core/script_language.h"
+#include "core/config/project_settings.h"
+#include "core/object/script_language.h"
#include "editor/editor_file_system.h"
#include "editor/editor_help.h"
#include "editor/editor_node.h"
diff --git a/modules/gdscript/language_server/gdscript_workspace.h b/modules/gdscript/language_server/gdscript_workspace.h
index e45b06747d..fc244c6357 100644
--- a/modules/gdscript/language_server/gdscript_workspace.h
+++ b/modules/gdscript/language_server/gdscript_workspace.h
@@ -32,7 +32,7 @@
#define GDSCRIPT_WORKSPACE_H
#include "../gdscript_parser.h"
-#include "core/variant.h"
+#include "core/variant/variant.h"
#include "editor/editor_file_system.h"
#include "gdscript_extend_parser.h"
#include "lsp.hpp"
diff --git a/modules/gdscript/language_server/lsp.hpp b/modules/gdscript/language_server/lsp.hpp
index cf27a1578c..bf32c1c978 100644
--- a/modules/gdscript/language_server/lsp.hpp
+++ b/modules/gdscript/language_server/lsp.hpp
@@ -31,8 +31,8 @@
#ifndef GODOT_LSP_H
#define GODOT_LSP_H
-#include "core/class_db.h"
-#include "core/list.h"
+#include "core/object/class_db.h"
+#include "core/templates/list.h"
#include "editor/doc_data.h"
namespace lsp {
diff --git a/modules/gdscript/register_types.cpp b/modules/gdscript/register_types.cpp
index da4cbe34c7..065f01e654 100644
--- a/modules/gdscript/register_types.cpp
+++ b/modules/gdscript/register_types.cpp
@@ -59,7 +59,7 @@ GDScriptCache *gdscript_cache = nullptr;
#include "editor/gdscript_translation_parser_plugin.h"
#ifndef GDSCRIPT_NO_LSP
-#include "core/engine.h"
+#include "core/config/engine.h"
#include "language_server/gdscript_language_server.h"
#endif // !GDSCRIPT_NO_LSP
diff --git a/modules/gdscript/tests/test_gdscript.cpp b/modules/gdscript/tests/test_gdscript.cpp
index 931b683a44..50b3783388 100644
--- a/modules/gdscript/tests/test_gdscript.cpp
+++ b/modules/gdscript/tests/test_gdscript.cpp
@@ -30,12 +30,12 @@
#include "test_gdscript.h"
+#include "core/config/project_settings.h"
#include "core/io/file_access_pack.h"
#include "core/os/file_access.h"
#include "core/os/main_loop.h"
#include "core/os/os.h"
-#include "core/project_settings.h"
-#include "core/string_builder.h"
+#include "core/string/string_builder.h"
#include "scene/resources/packed_scene.h"
#include "modules/gdscript/gdscript_analyzer.h"
diff --git a/modules/gridmap/grid_map.cpp b/modules/gridmap/grid_map.cpp
index 21fa83278b..633b209f0f 100644
--- a/modules/gridmap/grid_map.cpp
+++ b/modules/gridmap/grid_map.cpp
@@ -31,7 +31,7 @@
#include "grid_map.h"
#include "core/io/marshalls.h"
-#include "core/message_queue.h"
+#include "core/object/message_queue.h"
#include "scene/3d/light_3d.h"
#include "scene/resources/mesh_library.h"
#include "scene/resources/surface_tool.h"
diff --git a/modules/gridmap/register_types.cpp b/modules/gridmap/register_types.cpp
index 906e506b62..ab384fa942 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 "core/class_db.h"
+#include "core/object/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 333b1cf377..af3741bae9 100644
--- a/modules/hdr/image_loader_hdr.cpp
+++ b/modules/hdr/image_loader_hdr.cpp
@@ -31,7 +31,7 @@
#include "image_loader_hdr.h"
#include "core/os/os.h"
-#include "core/print_string.h"
+#include "core/string/print_string.h"
Error ImageLoaderHDR::load_image(Ref<Image> p_image, FileAccess *f, bool p_force_linear, float p_scale) {
String header = f->get_token();
diff --git a/modules/jpg/image_loader_jpegd.cpp b/modules/jpg/image_loader_jpegd.cpp
index 9c7ace5cf2..e5f041c618 100644
--- a/modules/jpg/image_loader_jpegd.cpp
+++ b/modules/jpg/image_loader_jpegd.cpp
@@ -31,7 +31,7 @@
#include "image_loader_jpegd.h"
#include "core/os/os.h"
-#include "core/print_string.h"
+#include "core/string/print_string.h"
#include <jpgd.h>
#include <string.h>
diff --git a/modules/jsonrpc/jsonrpc.h b/modules/jsonrpc/jsonrpc.h
index 6f3f8003e0..c2acf84515 100644
--- a/modules/jsonrpc/jsonrpc.h
+++ b/modules/jsonrpc/jsonrpc.h
@@ -31,8 +31,8 @@
#ifndef GODOT_JSON_RPC_H
#define GODOT_JSON_RPC_H
-#include "core/class_db.h"
-#include "core/variant.h"
+#include "core/object/class_db.h"
+#include "core/variant/variant.h"
class JSONRPC : public Object {
GDCLASS(JSONRPC, Object)
diff --git a/modules/jsonrpc/register_types.cpp b/modules/jsonrpc/register_types.cpp
index 0d3e446e3e..e6affaee41 100644
--- a/modules/jsonrpc/register_types.cpp
+++ b/modules/jsonrpc/register_types.cpp
@@ -29,7 +29,7 @@
/*************************************************************************/
#include "register_types.h"
-#include "core/class_db.h"
+#include "core/object/class_db.h"
#include "jsonrpc.h"
void register_jsonrpc_types() {
diff --git a/modules/lightmapper_rd/lightmapper_rd.cpp b/modules/lightmapper_rd/lightmapper_rd.cpp
index 4de523baa0..1ef991841b 100644
--- a/modules/lightmapper_rd/lightmapper_rd.cpp
+++ b/modules/lightmapper_rd/lightmapper_rd.cpp
@@ -29,8 +29,8 @@
/*************************************************************************/
#include "lightmapper_rd.h"
+#include "core/config/project_settings.h"
#include "core/math/geometry_2d.h"
-#include "core/project_settings.h"
#include "lm_blendseams.glsl.gen.h"
#include "lm_compute.glsl.gen.h"
#include "lm_raster.glsl.gen.h"
diff --git a/modules/lightmapper_rd/lightmapper_rd.h b/modules/lightmapper_rd/lightmapper_rd.h
index cd000414cf..e17b5473a8 100644
--- a/modules/lightmapper_rd/lightmapper_rd.h
+++ b/modules/lightmapper_rd/lightmapper_rd.h
@@ -31,7 +31,7 @@
#ifndef LIGHTMAPPER_RD_H
#define LIGHTMAPPER_RD_H
-#include "core/local_vector.h"
+#include "core/templates/local_vector.h"
#include "scene/3d/lightmapper.h"
#include "scene/resources/mesh.h"
#include "servers/rendering/rendering_device.h"
diff --git a/modules/lightmapper_rd/register_types.cpp b/modules/lightmapper_rd/register_types.cpp
index 0e6d7590cc..b16adaf5d6 100644
--- a/modules/lightmapper_rd/register_types.cpp
+++ b/modules/lightmapper_rd/register_types.cpp
@@ -30,7 +30,7 @@
#include "register_types.h"
-#include "core/project_settings.h"
+#include "core/config/project_settings.h"
#include "lightmapper_rd.h"
#include "scene/3d/lightmapper.h"
diff --git a/modules/mbedtls/crypto_mbedtls.cpp b/modules/mbedtls/crypto_mbedtls.cpp
index 12a982df6e..bec792450a 100644
--- a/modules/mbedtls/crypto_mbedtls.cpp
+++ b/modules/mbedtls/crypto_mbedtls.cpp
@@ -32,10 +32,10 @@
#include "core/os/file_access.h"
-#include "core/engine.h"
+#include "core/config/engine.h"
+#include "core/config/project_settings.h"
#include "core/io/certs_compressed.gen.h"
#include "core/io/compression.h"
-#include "core/project_settings.h"
#ifdef TOOLS_ENABLED
#include "editor/editor_settings.h"
diff --git a/modules/mbedtls/crypto_mbedtls.h b/modules/mbedtls/crypto_mbedtls.h
index 2a446f9d48..e40ca08643 100644
--- a/modules/mbedtls/crypto_mbedtls.h
+++ b/modules/mbedtls/crypto_mbedtls.h
@@ -32,7 +32,7 @@
#define CRYPTO_MBEDTLS_H
#include "core/crypto/crypto.h"
-#include "core/resource.h"
+#include "core/io/resource.h"
#include <mbedtls/ctr_drbg.h>
#include <mbedtls/entropy.h>
diff --git a/modules/mbedtls/ssl_context_mbedtls.h b/modules/mbedtls/ssl_context_mbedtls.h
index baaeb6eb85..96703a7eb7 100644
--- a/modules/mbedtls/ssl_context_mbedtls.h
+++ b/modules/mbedtls/ssl_context_mbedtls.h
@@ -35,7 +35,7 @@
#include "core/os/file_access.h"
-#include "core/reference.h"
+#include "core/object/reference.h"
#include <mbedtls/config.h>
#include <mbedtls/ctr_drbg.h>
diff --git a/modules/mono/class_db_api_json.cpp b/modules/mono/class_db_api_json.cpp
index d7b2028204..e3119a8da7 100644
--- a/modules/mono/class_db_api_json.cpp
+++ b/modules/mono/class_db_api_json.cpp
@@ -32,9 +32,9 @@
#ifdef DEBUG_METHODS_ENABLED
+#include "core/config/project_settings.h"
#include "core/io/json.h"
#include "core/os/file_access.h"
-#include "core/project_settings.h"
#include "core/version.h"
void class_db_api_to_json(const String &p_output_file, ClassDB::APIType p_api) {
diff --git a/modules/mono/class_db_api_json.h b/modules/mono/class_db_api_json.h
index 7f016ac3d6..6b7f5a4d88 100644
--- a/modules/mono/class_db_api_json.h
+++ b/modules/mono/class_db_api_json.h
@@ -31,13 +31,13 @@
#ifndef CLASS_DB_API_JSON_H
#define CLASS_DB_API_JSON_H
-// 'core/method_bind.h' defines DEBUG_METHODS_ENABLED, but it looks like we
-// cannot include it here. That's why we include it through 'core/class_db.h'.
-#include "core/class_db.h"
+// 'core/object/method_bind.h' defines DEBUG_METHODS_ENABLED, but it looks like we
+// cannot include it here. That's why we include it through 'core/object/class_db.h'.
+#include "core/object/class_db.h"
#ifdef DEBUG_METHODS_ENABLED
-#include "core/ustring.h"
+#include "core/string/ustring.h"
void class_db_api_to_json(const String &p_output_file, ClassDB::APIType p_api);
diff --git a/modules/mono/csharp_script.cpp b/modules/mono/csharp_script.cpp
index 8928b6e5e3..b4537f531d 100644
--- a/modules/mono/csharp_script.cpp
+++ b/modules/mono/csharp_script.cpp
@@ -33,6 +33,7 @@
#include <mono/metadata/threads.h>
#include <stdint.h>
+#include "core/config/project_settings.h"
#include "core/debugger/engine_debugger.h"
#include "core/debugger/script_debugger.h"
#include "core/io/json.h"
@@ -40,7 +41,6 @@
#include "core/os/mutex.h"
#include "core/os/os.h"
#include "core/os/thread.h"
-#include "core/project_settings.h"
#ifdef TOOLS_ENABLED
#include "editor/bindings_generator.h"
@@ -477,7 +477,7 @@ static String variant_type_to_managed_name(const String &p_var_type_name) {
Variant::COLOR,
Variant::STRING_NAME,
Variant::NODE_PATH,
- Variant::_RID,
+ Variant::RID,
Variant::CALLABLE
};
diff --git a/modules/mono/csharp_script.h b/modules/mono/csharp_script.h
index 316fd78f2a..3e4e6c3f86 100644
--- a/modules/mono/csharp_script.h
+++ b/modules/mono/csharp_script.h
@@ -33,8 +33,8 @@
#include "core/io/resource_loader.h"
#include "core/io/resource_saver.h"
-#include "core/script_language.h"
-#include "core/self_list.h"
+#include "core/object/script_language.h"
+#include "core/templates/self_list.h"
#include "mono_gc_handle.h"
#include "mono_gd/gd_mono.h"
diff --git a/modules/mono/editor/bindings_generator.cpp b/modules/mono/editor/bindings_generator.cpp
index 4c137a2ba4..ff3122a77f 100644
--- a/modules/mono/editor/bindings_generator.cpp
+++ b/modules/mono/editor/bindings_generator.cpp
@@ -32,13 +32,13 @@
#if defined(DEBUG_METHODS_ENABLED) && defined(TOOLS_ENABLED)
-#include "core/engine.h"
-#include "core/global_constants.h"
+#include "core/config/engine.h"
+#include "core/core_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 "core/string/ucaps.h"
#include "../glue/cs_glue_version.gen.h"
#include "../godotsharp_defs.h"
@@ -2426,7 +2426,7 @@ bool BindingsGenerator::_arg_default_value_is_assignable_to_type(const Variant &
case Variant::VECTOR2:
case Variant::RECT2:
case Variant::VECTOR3:
- case Variant::_RID:
+ case Variant::RID:
case Variant::ARRAY:
case Variant::DICTIONARY:
case Variant::PACKED_BYTE_ARRAY:
@@ -2979,7 +2979,7 @@ bool BindingsGenerator::_arg_default_value_from_variant(const Variant &p_val, Ar
r_iarg.default_argument = "new %s()";
r_iarg.def_param_mode = ArgumentInterface::NULLABLE_REF;
break;
- case Variant::_RID:
+ case Variant::RID:
ERR_FAIL_COND_V_MSG(r_iarg.type.cname != name_cache.type_RID, false,
"Parameter of type '" + String(r_iarg.type.cname) + "' cannot have a default value of type '" + String(name_cache.type_RID) + "'.");
@@ -3399,7 +3399,7 @@ void BindingsGenerator::_populate_builtin_type_interfaces() {
}
void BindingsGenerator::_populate_global_constants() {
- int global_constants_count = GlobalConstants::get_global_constant_count();
+ int global_constants_count = CoreConstants::get_global_constant_count();
if (global_constants_count > 0) {
Map<String, DocData::ClassDoc>::Element *match = EditorHelp::get_doc_data()->class_list.find("@GlobalScope");
@@ -3409,7 +3409,7 @@ void BindingsGenerator::_populate_global_constants() {
const DocData::ClassDoc &global_scope_doc = match->value();
for (int i = 0; i < global_constants_count; i++) {
- String constant_name = GlobalConstants::get_global_constant_name(i);
+ String constant_name = CoreConstants::get_global_constant_name(i);
const DocData::ConstantDoc *const_doc = nullptr;
for (int j = 0; j < global_scope_doc.constants.size(); j++) {
@@ -3421,8 +3421,8 @@ void BindingsGenerator::_populate_global_constants() {
}
}
- int constant_value = GlobalConstants::get_global_constant_value(i);
- StringName enum_name = GlobalConstants::get_global_constant_enum(i);
+ int constant_value = CoreConstants::get_global_constant_value(i);
+ StringName enum_name = CoreConstants::get_global_constant_enum(i);
ConstantInterface iconstant(constant_name, snake_to_pascal_case(constant_name, true), constant_value);
iconstant.const_doc = const_doc;
diff --git a/modules/mono/editor/bindings_generator.h b/modules/mono/editor/bindings_generator.h
index 90c1c9f3ee..eeab518954 100644
--- a/modules/mono/editor/bindings_generator.h
+++ b/modules/mono/editor/bindings_generator.h
@@ -31,14 +31,14 @@
#ifndef BINDINGS_GENERATOR_H
#define BINDINGS_GENERATOR_H
-#include "core/class_db.h"
-#include "core/string_builder.h"
+#include "core/object/class_db.h"
+#include "core/string/string_builder.h"
#include "editor/doc_data.h"
#include "editor/editor_help.h"
#if defined(DEBUG_METHODS_ENABLED) && defined(TOOLS_ENABLED)
-#include "core/ustring.h"
+#include "core/string/ustring.h"
class BindingsGenerator {
struct ConstantInterface {
diff --git a/modules/mono/editor/code_completion.cpp b/modules/mono/editor/code_completion.cpp
index 942c6d26a6..9defd65190 100644
--- a/modules/mono/editor/code_completion.cpp
+++ b/modules/mono/editor/code_completion.cpp
@@ -30,7 +30,7 @@
#include "code_completion.h"
-#include "core/project_settings.h"
+#include "core/config/project_settings.h"
#include "editor/editor_file_system.h"
#include "editor/editor_settings.h"
#include "scene/gui/control.h"
diff --git a/modules/mono/editor/code_completion.h b/modules/mono/editor/code_completion.h
index 77673b766f..b9d22de0b3 100644
--- a/modules/mono/editor/code_completion.h
+++ b/modules/mono/editor/code_completion.h
@@ -31,8 +31,8 @@
#ifndef CODE_COMPLETION_H
#define CODE_COMPLETION_H
-#include "core/ustring.h"
-#include "core/variant.h"
+#include "core/string/ustring.h"
+#include "core/variant/variant.h"
namespace gdmono {
diff --git a/modules/mono/editor/godotsharp_export.cpp b/modules/mono/editor/godotsharp_export.cpp
index 2edd8c87dc..4fa753ab8b 100644
--- a/modules/mono/editor/godotsharp_export.cpp
+++ b/modules/mono/editor/godotsharp_export.cpp
@@ -32,9 +32,9 @@
#include <mono/metadata/image.h>
+#include "core/config/project_settings.h"
#include "core/io/file_access_pack.h"
#include "core/os/os.h"
-#include "core/project_settings.h"
#include "../mono_gd/gd_mono.h"
#include "../mono_gd/gd_mono_assembly.h"
diff --git a/modules/mono/editor/godotsharp_export.h b/modules/mono/editor/godotsharp_export.h
index 9ab57755de..bd0f86a74b 100644
--- a/modules/mono/editor/godotsharp_export.h
+++ b/modules/mono/editor/godotsharp_export.h
@@ -31,9 +31,9 @@
#ifndef GODOTSHARP_EXPORT_H
#define GODOTSHARP_EXPORT_H
-#include "core/dictionary.h"
-#include "core/error_list.h"
-#include "core/ustring.h"
+#include "core/error/error_list.h"
+#include "core/string/ustring.h"
+#include "core/variant/dictionary.h"
#include "../mono_gd/gd_mono_header.h"
diff --git a/modules/mono/editor/script_class_parser.cpp b/modules/mono/editor/script_class_parser.cpp
index f7d6e7e302..70940c279e 100644
--- a/modules/mono/editor/script_class_parser.cpp
+++ b/modules/mono/editor/script_class_parser.cpp
@@ -30,8 +30,8 @@
#include "script_class_parser.h"
-#include "core/map.h"
#include "core/os/os.h"
+#include "core/templates/map.h"
#include "../utils/string_utils.h"
diff --git a/modules/mono/editor/script_class_parser.h b/modules/mono/editor/script_class_parser.h
index d611e8fb74..3c55fa07a7 100644
--- a/modules/mono/editor/script_class_parser.h
+++ b/modules/mono/editor/script_class_parser.h
@@ -31,9 +31,9 @@
#ifndef SCRIPT_CLASS_PARSER_H
#define SCRIPT_CLASS_PARSER_H
-#include "core/ustring.h"
-#include "core/variant.h"
-#include "core/vector.h"
+#include "core/string/ustring.h"
+#include "core/templates/vector.h"
+#include "core/variant/variant.h"
class ScriptClassParser {
public:
diff --git a/modules/mono/glue/GodotSharp/GodotSharp/Core/Array.cs b/modules/mono/glue/GodotSharp/GodotSharp/Core/Array.cs
index f77d3052f4..ce613f7ef9 100644
--- a/modules/mono/glue/GodotSharp/GodotSharp/Core/Array.cs
+++ b/modules/mono/glue/GodotSharp/GodotSharp/Core/Array.cs
@@ -81,6 +81,11 @@ namespace Godot.Collections
return godot_icall_Array_Resize(GetPtr(), newSize);
}
+ public void Shuffle()
+ {
+ godot_icall_Array_Shuffle(GetPtr());
+ }
+
public static Array operator +(Array left, Array right)
{
return new Array(godot_icall_Array_Concatenate(left.GetPtr(), right.GetPtr()));
@@ -220,6 +225,9 @@ namespace Godot.Collections
internal extern static Error godot_icall_Array_Resize(IntPtr ptr, int newSize);
[MethodImpl(MethodImplOptions.InternalCall)]
+ internal extern static Error godot_icall_Array_Shuffle(IntPtr ptr);
+
+ [MethodImpl(MethodImplOptions.InternalCall)]
internal extern static void godot_icall_Array_Generic_GetElementTypeInfo(Type elemType, out int elemTypeEncoding, out IntPtr elemTypeClass);
[MethodImpl(MethodImplOptions.InternalCall)]
@@ -295,6 +303,11 @@ namespace Godot.Collections
return objectArray.Resize(newSize);
}
+ public void Shuffle()
+ {
+ objectArray.Shuffle();
+ }
+
public static Array<T> operator +(Array<T> left, Array<T> right)
{
return new Array<T>(left.objectArray + right.objectArray);
diff --git a/modules/mono/glue/GodotSharp/GodotSharp/Core/Color.cs b/modules/mono/glue/GodotSharp/GodotSharp/Core/Color.cs
index 3700a6194f..d0add835c0 100644
--- a/modules/mono/glue/GodotSharp/GodotSharp/Core/Color.cs
+++ b/modules/mono/glue/GodotSharp/GodotSharp/Core/Color.cs
@@ -257,20 +257,6 @@ namespace Godot
}
/// <summary>
- /// Returns the most contrasting color.
- /// </summary>
- /// <returns>The most contrasting color</returns>
- public Color Contrasted()
- {
- return new Color(
- (r + 0.5f) % 1.0f,
- (g + 0.5f) % 1.0f,
- (b + 0.5f) % 1.0f,
- a
- );
- }
-
- /// <summary>
/// Returns a new color resulting from making this color darker
/// by the specified ratio (on the range of 0 to 1).
/// </summary>
diff --git a/modules/mono/glue/GodotSharp/GodotSharp/Core/GD.cs b/modules/mono/glue/GodotSharp/GodotSharp/Core/GD.cs
index e050d1fdd1..7f4777777c 100644
--- a/modules/mono/glue/GodotSharp/GodotSharp/Core/GD.cs
+++ b/modules/mono/glue/GodotSharp/GodotSharp/Core/GD.cs
@@ -129,7 +129,12 @@ namespace Godot
public static double RandRange(double from, double to)
{
- return godot_icall_GD_rand_range(from, to);
+ return godot_icall_GD_randf_range(from, to);
+ }
+
+ public static int RandRange(int from, int to)
+ {
+ return godot_icall_GD_randi_range(from, to);
}
public static uint RandSeed(ulong seed, out ulong newSeed)
@@ -238,9 +243,11 @@ namespace Godot
[MethodImpl(MethodImplOptions.InternalCall)]
internal extern static void godot_icall_GD_randomize();
+ [MethodImpl(MethodImplOptions.InternalCall)]
+ internal extern static double godot_icall_GD_randf_range(double from, double to);
[MethodImpl(MethodImplOptions.InternalCall)]
- internal extern static double godot_icall_GD_rand_range(double from, double to);
+ internal extern static int godot_icall_GD_randi_range(int from, int to);
[MethodImpl(MethodImplOptions.InternalCall)]
internal extern static uint godot_icall_GD_rand_seed(ulong seed, out ulong newSeed);
diff --git a/modules/mono/glue/base_object_glue.cpp b/modules/mono/glue/base_object_glue.cpp
index 439fb1ab0a..544f414cba 100644
--- a/modules/mono/glue/base_object_glue.cpp
+++ b/modules/mono/glue/base_object_glue.cpp
@@ -30,9 +30,9 @@
#ifdef MONO_GLUE_ENABLED
-#include "core/class_db.h"
-#include "core/reference.h"
-#include "core/string_name.h"
+#include "core/object/class_db.h"
+#include "core/object/reference.h"
+#include "core/string/string_name.h"
#include "../csharp_script.h"
#include "../mono_gd/gd_mono_cache.h"
diff --git a/modules/mono/glue/collections_glue.cpp b/modules/mono/glue/collections_glue.cpp
index 3313e8cb77..bb3ea0f730 100644
--- a/modules/mono/glue/collections_glue.cpp
+++ b/modules/mono/glue/collections_glue.cpp
@@ -32,7 +32,7 @@
#include <mono/metadata/exception.h>
-#include "core/array.h"
+#include "core/variant/array.h"
#include "../mono_gd/gd_mono_cache.h"
#include "../mono_gd/gd_mono_class.h"
@@ -162,6 +162,10 @@ Error godot_icall_Array_Resize(Array *ptr, int new_size) {
return ptr->resize(new_size);
}
+void godot_icall_Array_Shuffle(Array *ptr) {
+ ptr->shuffle();
+}
+
void godot_icall_Array_Generic_GetElementTypeInfo(MonoReflectionType *refltype, uint32_t *type_encoding, GDMonoClass **type_class) {
MonoType *elem_type = mono_reflection_type_get_type(refltype);
@@ -322,6 +326,7 @@ void godot_register_collections_icalls() {
mono_add_internal_call("Godot.Collections.Array::godot_icall_Array_Remove", (void *)godot_icall_Array_Remove);
mono_add_internal_call("Godot.Collections.Array::godot_icall_Array_RemoveAt", (void *)godot_icall_Array_RemoveAt);
mono_add_internal_call("Godot.Collections.Array::godot_icall_Array_Resize", (void *)godot_icall_Array_Resize);
+ mono_add_internal_call("Godot.Collections.Array::godot_icall_Array_Shuffle", (void *)godot_icall_Array_Shuffle);
mono_add_internal_call("Godot.Collections.Array::godot_icall_Array_Generic_GetElementTypeInfo", (void *)godot_icall_Array_Generic_GetElementTypeInfo);
mono_add_internal_call("Godot.Collections.Array::godot_icall_Array_ToString", (void *)godot_icall_Array_ToString);
diff --git a/modules/mono/glue/gd_glue.cpp b/modules/mono/glue/gd_glue.cpp
index 5e892b616b..4c1df529fc 100644
--- a/modules/mono/glue/gd_glue.cpp
+++ b/modules/mono/glue/gd_glue.cpp
@@ -30,12 +30,12 @@
#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 "core/string/ustring.h"
+#include "core/variant/array.h"
+#include "core/variant/variant.h"
+#include "core/variant/variant_parser.h"
#include "../mono_gd/gd_mono_cache.h"
#include "../mono_gd/gd_mono_marshal.h"
@@ -193,7 +193,11 @@ void godot_icall_GD_randomize() {
Math::randomize();
}
-double godot_icall_GD_rand_range(double from, double to) {
+double godot_icall_GD_randf_range(double from, double to) {
+ return Math::random(from, to);
+}
+
+int32_t godot_icall_GD_randi_range(int32_t from, int32_t to) {
return Math::random(from, to);
}
@@ -298,7 +302,8 @@ void godot_register_gd_icalls() {
mono_add_internal_call("Godot.GD::godot_icall_GD_randf", (void *)godot_icall_GD_randf);
mono_add_internal_call("Godot.GD::godot_icall_GD_randi", (void *)godot_icall_GD_randi);
mono_add_internal_call("Godot.GD::godot_icall_GD_randomize", (void *)godot_icall_GD_randomize);
- mono_add_internal_call("Godot.GD::godot_icall_GD_rand_range", (void *)godot_icall_GD_rand_range);
+ mono_add_internal_call("Godot.GD::godot_icall_GD_randf_range", (void *)godot_icall_GD_randf_range);
+ mono_add_internal_call("Godot.GD::godot_icall_GD_randi_range", (void *)godot_icall_GD_randi_range);
mono_add_internal_call("Godot.GD::godot_icall_GD_rand_seed", (void *)godot_icall_GD_rand_seed);
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);
diff --git a/modules/mono/glue/glue_header.h b/modules/mono/glue/glue_header.h
index dc3bf47838..f4263e286e 100644
--- a/modules/mono/glue/glue_header.h
+++ b/modules/mono/glue/glue_header.h
@@ -58,15 +58,15 @@ void godot_register_glue_header_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/reference.h"
+#include "core/config/engine.h"
+#include "core/object/class_db.h"
+#include "core/object/method_bind.h"
+#include "core/object/reference.h"
+#include "core/string/node_path.h"
+#include "core/string/ustring.h"
#include "core/typedefs.h"
-#include "core/ustring.h"
+#include "core/variant/array.h"
+#include "core/variant/dictionary.h"
#include "../mono_gd/gd_mono_class.h"
#include "../mono_gd/gd_mono_internals.h"
diff --git a/modules/mono/glue/nodepath_glue.cpp b/modules/mono/glue/nodepath_glue.cpp
index 2aa75dd309..09c6d8f482 100644
--- a/modules/mono/glue/nodepath_glue.cpp
+++ b/modules/mono/glue/nodepath_glue.cpp
@@ -30,8 +30,8 @@
#ifdef MONO_GLUE_ENABLED
-#include "core/node_path.h"
-#include "core/ustring.h"
+#include "core/string/node_path.h"
+#include "core/string/ustring.h"
#include "../mono_gd/gd_mono_marshal.h"
diff --git a/modules/mono/glue/rid_glue.cpp b/modules/mono/glue/rid_glue.cpp
index a7b18c36dd..cb4f26511f 100644
--- a/modules/mono/glue/rid_glue.cpp
+++ b/modules/mono/glue/rid_glue.cpp
@@ -30,9 +30,9 @@
#ifdef MONO_GLUE_ENABLED
-#include "core/class_db.h"
-#include "core/resource.h"
-#include "core/rid.h"
+#include "core/io/resource.h"
+#include "core/object/class_db.h"
+#include "core/templates/rid.h"
#include "../mono_gd/gd_mono_marshal.h"
diff --git a/modules/mono/glue/scene_tree_glue.cpp b/modules/mono/glue/scene_tree_glue.cpp
index b43daccc1b..53d6c1436d 100644
--- a/modules/mono/glue/scene_tree_glue.cpp
+++ b/modules/mono/glue/scene_tree_glue.cpp
@@ -30,9 +30,9 @@
#ifdef MONO_GLUE_ENABLED
-#include "core/array.h"
-#include "core/class_db.h"
-#include "core/string_name.h"
+#include "core/object/class_db.h"
+#include "core/string/string_name.h"
+#include "core/variant/array.h"
#include "scene/main/node.h"
#include "scene/main/scene_tree.h"
diff --git a/modules/mono/glue/string_glue.cpp b/modules/mono/glue/string_glue.cpp
index 595b8d71f1..9271731573 100644
--- a/modules/mono/glue/string_glue.cpp
+++ b/modules/mono/glue/string_glue.cpp
@@ -30,9 +30,9 @@
#ifdef MONO_GLUE_ENABLED
-#include "core/ustring.h"
-#include "core/variant.h"
-#include "core/vector.h"
+#include "core/string/ustring.h"
+#include "core/templates/vector.h"
+#include "core/variant/variant.h"
#include "../mono_gd/gd_mono_marshal.h"
diff --git a/modules/mono/glue/string_name_glue.cpp b/modules/mono/glue/string_name_glue.cpp
index 4b2e88569b..9323e3bbb3 100644
--- a/modules/mono/glue/string_name_glue.cpp
+++ b/modules/mono/glue/string_name_glue.cpp
@@ -30,8 +30,8 @@
#ifdef MONO_GLUE_ENABLED
-#include "core/string_name.h"
-#include "core/ustring.h"
+#include "core/string/string_name.h"
+#include "core/string/ustring.h"
#include "../mono_gd/gd_mono_marshal.h"
diff --git a/modules/mono/godotsharp_dirs.cpp b/modules/mono/godotsharp_dirs.cpp
index df31823deb..4233732bff 100644
--- a/modules/mono/godotsharp_dirs.cpp
+++ b/modules/mono/godotsharp_dirs.cpp
@@ -30,9 +30,9 @@
#include "godotsharp_dirs.h"
+#include "core/config/project_settings.h"
#include "core/os/dir_access.h"
#include "core/os/os.h"
-#include "core/project_settings.h"
#ifdef TOOLS_ENABLED
#include "core/version.h"
diff --git a/modules/mono/godotsharp_dirs.h b/modules/mono/godotsharp_dirs.h
index 2ab4b0e309..6391616419 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 "core/ustring.h"
+#include "core/string/ustring.h"
namespace GodotSharpDirs {
diff --git a/modules/mono/managed_callable.h b/modules/mono/managed_callable.h
index 4f71e14a2f..bde1b41781 100644
--- a/modules/mono/managed_callable.h
+++ b/modules/mono/managed_callable.h
@@ -33,9 +33,9 @@
#include <mono/metadata/object.h>
-#include "core/callable.h"
#include "core/os/mutex.h"
-#include "core/self_list.h"
+#include "core/templates/self_list.h"
+#include "core/variant/callable.h"
#include "mono_gc_handle.h"
#include "mono_gd/gd_mono_method.h"
diff --git a/modules/mono/mono_gc_handle.h b/modules/mono/mono_gc_handle.h
index 13cfad4654..5c3a210e97 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 "core/reference.h"
+#include "core/object/reference.h"
namespace gdmono {
diff --git a/modules/mono/mono_gd/android_mono_config.h b/modules/mono/mono_gd/android_mono_config.h
index 93f708bba0..9e304939b2 100644
--- a/modules/mono/mono_gd/android_mono_config.h
+++ b/modules/mono/mono_gd/android_mono_config.h
@@ -33,7 +33,7 @@
#ifdef ANDROID_ENABLED
-#include "core/ustring.h"
+#include "core/string/ustring.h"
// This function is defined in an auto-generated source file
String get_godot_android_mono_config();
diff --git a/modules/mono/mono_gd/gd_mono.cpp b/modules/mono/mono_gd/gd_mono.cpp
index cf5ac33d20..0e335b3349 100644
--- a/modules/mono/mono_gd/gd_mono.cpp
+++ b/modules/mono/mono_gd/gd_mono.cpp
@@ -37,12 +37,12 @@
#include <mono/metadata/mono-gc.h>
#include <mono/metadata/profiler.h>
+#include "core/config/project_settings.h"
#include "core/debugger/engine_debugger.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 "../godotsharp_dirs.h"
diff --git a/modules/mono/mono_gd/gd_mono_assembly.cpp b/modules/mono/mono_gd/gd_mono_assembly.cpp
index 6e351001d4..33628b3ce3 100644
--- a/modules/mono/mono_gd/gd_mono_assembly.cpp
+++ b/modules/mono/mono_gd/gd_mono_assembly.cpp
@@ -33,11 +33,11 @@
#include <mono/metadata/mono-debug.h>
#include <mono/metadata/tokentype.h>
+#include "core/config/project_settings.h"
#include "core/io/file_access_pack.h"
-#include "core/list.h"
#include "core/os/file_access.h"
#include "core/os/os.h"
-#include "core/project_settings.h"
+#include "core/templates/list.h"
#include "../godotsharp_dirs.h"
#include "gd_mono_cache.h"
diff --git a/modules/mono/mono_gd/gd_mono_assembly.h b/modules/mono/mono_gd/gd_mono_assembly.h
index 63899dc9be..fc10480e07 100644
--- a/modules/mono/mono_gd/gd_mono_assembly.h
+++ b/modules/mono/mono_gd/gd_mono_assembly.h
@@ -34,9 +34,9 @@
#include <mono/jit/jit.h>
#include <mono/metadata/assembly.h>
-#include "core/hash_map.h"
-#include "core/map.h"
-#include "core/ustring.h"
+#include "core/string/ustring.h"
+#include "core/templates/hash_map.h"
+#include "core/templates/map.h"
#include "gd_mono_utils.h"
class GDMonoAssembly {
diff --git a/modules/mono/mono_gd/gd_mono_class.h b/modules/mono/mono_gd/gd_mono_class.h
index 44b146b87c..87db2fa033 100644
--- a/modules/mono/mono_gd/gd_mono_class.h
+++ b/modules/mono/mono_gd/gd_mono_class.h
@@ -31,8 +31,8 @@
#ifndef GD_MONO_CLASS_H
#define GD_MONO_CLASS_H
-#include "core/map.h"
-#include "core/ustring.h"
+#include "core/string/ustring.h"
+#include "core/templates/map.h"
#include "gd_mono_field.h"
#include "gd_mono_header.h"
diff --git a/modules/mono/mono_gd/gd_mono_field.cpp b/modules/mono/mono_gd/gd_mono_field.cpp
index 563c45e71f..00a1e1e507 100644
--- a/modules/mono/mono_gd/gd_mono_field.cpp
+++ b/modules/mono/mono_gd/gd_mono_field.cpp
@@ -355,7 +355,7 @@ void GDMonoField::set_value_from_variant(MonoObject *p_object, const Variant &p_
}
if (CACHED_CLASS(RID) == type_class) {
- MonoObject *managed = GDMonoUtils::create_managed_from(p_value.operator RID());
+ MonoObject *managed = GDMonoUtils::create_managed_from(p_value.operator ::RID());
mono_field_set_value(p_object, mono_field, managed);
break;
}
@@ -450,8 +450,8 @@ void GDMonoField::set_value_from_variant(MonoObject *p_object, const Variant &p_
MonoObject *managed = GDMonoUtils::create_managed_from(p_value.operator NodePath());
mono_field_set_value(p_object, mono_field, managed);
} break;
- case Variant::_RID: {
- MonoObject *managed = GDMonoUtils::create_managed_from(p_value.operator RID());
+ case Variant::RID: {
+ MonoObject *managed = GDMonoUtils::create_managed_from(p_value.operator ::RID());
mono_field_set_value(p_object, mono_field, managed);
} break;
case Variant::OBJECT: {
diff --git a/modules/mono/mono_gd/gd_mono_header.h b/modules/mono/mono_gd/gd_mono_header.h
index 0f4f888546..ffb56e7cec 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 "core/int_types.h"
+#include <cstdint>
#ifdef WIN32
#define GD_MONO_STDCALL __stdcall
diff --git a/modules/mono/mono_gd/gd_mono_internals.h b/modules/mono/mono_gd/gd_mono_internals.h
index cf7efdecd6..d1d5eca263 100644
--- a/modules/mono/mono_gd/gd_mono_internals.h
+++ b/modules/mono/mono_gd/gd_mono_internals.h
@@ -35,7 +35,7 @@
#include "../utils/macros.h"
-#include "core/class_db.h"
+#include "core/object/class_db.h"
namespace GDMonoInternals {
diff --git a/modules/mono/mono_gd/gd_mono_marshal.cpp b/modules/mono/mono_gd/gd_mono_marshal.cpp
index c460e283ea..9d193ab8ab 100644
--- a/modules/mono/mono_gd/gd_mono_marshal.cpp
+++ b/modules/mono/mono_gd/gd_mono_marshal.cpp
@@ -204,7 +204,7 @@ Variant::Type managed_to_variant_type(const ManagedType &p_type, bool *r_nil_is_
}
if (CACHED_CLASS(RID) == type_class) {
- return Variant::_RID;
+ return Variant::RID;
}
if (CACHED_CLASS(Dictionary) == type_class) {
@@ -580,7 +580,7 @@ MonoObject *variant_to_mono_object(const Variant *p_var, const ManagedType &p_ty
}
if (CACHED_CLASS(RID) == type_class) {
- return GDMonoUtils::create_managed_from(p_var->operator RID());
+ return GDMonoUtils::create_managed_from(p_var->operator ::RID());
}
// Godot.Collections.Dictionary or IDictionary
@@ -673,8 +673,8 @@ MonoObject *variant_to_mono_object(const Variant *p_var, const ManagedType &p_ty
return GDMonoUtils::create_managed_from(p_var->operator StringName());
case Variant::NODE_PATH:
return GDMonoUtils::create_managed_from(p_var->operator NodePath());
- case Variant::_RID:
- return GDMonoUtils::create_managed_from(p_var->operator RID());
+ case Variant::RID:
+ return GDMonoUtils::create_managed_from(p_var->operator ::RID());
case Variant::OBJECT:
return GDMonoUtils::unmanaged_get_managed(p_var->operator Object *());
case Variant::CALLABLE: {
diff --git a/modules/mono/mono_gd/gd_mono_marshal.h b/modules/mono/mono_gd/gd_mono_marshal.h
index a1fd975916..d2c564d67d 100644
--- a/modules/mono/mono_gd/gd_mono_marshal.h
+++ b/modules/mono/mono_gd/gd_mono_marshal.h
@@ -31,7 +31,7 @@
#ifndef GDMONOMARSHAL_H
#define GDMONOMARSHAL_H
-#include "core/variant.h"
+#include "core/variant/variant.h"
#include "../managed_callable.h"
#include "gd_mono.h"
diff --git a/modules/mono/mono_gd/gd_mono_utils.cpp b/modules/mono/mono_gd/gd_mono_utils.cpp
index 3f1155f430..2676165cbc 100644
--- a/modules/mono/mono_gd/gd_mono_utils.cpp
+++ b/modules/mono/mono_gd/gd_mono_utils.cpp
@@ -35,10 +35,10 @@
#include "core/debugger/engine_debugger.h"
#include "core/debugger/script_debugger.h"
+#include "core/object/reference.h"
#include "core/os/dir_access.h"
#include "core/os/mutex.h"
#include "core/os/os.h"
-#include "core/reference.h"
#ifdef TOOLS_ENABLED
#include "editor/debugger/editor_debugger_node.h"
diff --git a/modules/mono/mono_gd/gd_mono_utils.h b/modules/mono/mono_gd/gd_mono_utils.h
index 80569cb1c7..7088385c4f 100644
--- a/modules/mono/mono_gd/gd_mono_utils.h
+++ b/modules/mono/mono_gd/gd_mono_utils.h
@@ -37,8 +37,8 @@
#include "../utils/macros.h"
#include "gd_mono_header.h"
-#include "core/class_db.h"
-#include "core/reference.h"
+#include "core/object/class_db.h"
+#include "core/object/reference.h"
#define UNHANDLED_EXCEPTION(m_exc) \
if (unlikely(m_exc != nullptr)) { \
diff --git a/modules/mono/mono_gd/support/android_support.cpp b/modules/mono/mono_gd/support/android_support.cpp
index 8bcdeec9dd..386e0576b3 100644
--- a/modules/mono/mono_gd/support/android_support.cpp
+++ b/modules/mono/mono_gd/support/android_support.cpp
@@ -44,7 +44,7 @@
#endif
#include "core/os/os.h"
-#include "core/ustring.h"
+#include "core/string/ustring.h"
#include "platform/android/java_godot_wrapper.h"
#include "platform/android/os_android.h"
#include "platform/android/thread_jandroid.h"
diff --git a/modules/mono/mono_gd/support/android_support.h b/modules/mono/mono_gd/support/android_support.h
index dc2e6c95ed..5947395a99 100755
--- a/modules/mono/mono_gd/support/android_support.h
+++ b/modules/mono/mono_gd/support/android_support.h
@@ -33,7 +33,7 @@
#if defined(ANDROID_ENABLED)
-#include "core/ustring.h"
+#include "core/string/ustring.h"
namespace gdmono {
namespace android {
diff --git a/modules/mono/mono_gd/support/ios_support.h b/modules/mono/mono_gd/support/ios_support.h
index e28af120e3..ed251cb23a 100755
--- a/modules/mono/mono_gd/support/ios_support.h
+++ b/modules/mono/mono_gd/support/ios_support.h
@@ -33,7 +33,7 @@
#if defined(IPHONE_ENABLED)
-#include "core/ustring.h"
+#include "core/string/ustring.h"
namespace gdmono {
namespace ios {
diff --git a/modules/mono/register_types.cpp b/modules/mono/register_types.cpp
index 98c3ba1324..f5c1bda18b 100644
--- a/modules/mono/register_types.cpp
+++ b/modules/mono/register_types.cpp
@@ -30,7 +30,7 @@
#include "register_types.h"
-#include "core/engine.h"
+#include "core/config/engine.h"
#include "csharp_script.h"
diff --git a/modules/mono/signal_awaiter_utils.h b/modules/mono/signal_awaiter_utils.h
index c550315a23..18d1e43e14 100644
--- a/modules/mono/signal_awaiter_utils.h
+++ b/modules/mono/signal_awaiter_utils.h
@@ -31,7 +31,7 @@
#ifndef SIGNAL_AWAITER_UTILS_H
#define SIGNAL_AWAITER_UTILS_H
-#include "core/reference.h"
+#include "core/object/reference.h"
#include "csharp_script.h"
#include "mono_gc_handle.h"
diff --git a/modules/mono/utils/mono_reg_utils.h b/modules/mono/utils/mono_reg_utils.h
index 4ef876f2b6..cc3f1cb035 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 "core/ustring.h"
+#include "core/string/ustring.h"
struct MonoRegInfo {
String version;
diff --git a/modules/mono/utils/osx_utils.cpp b/modules/mono/utils/osx_utils.cpp
index e68466b1cf..41be198bcf 100644
--- a/modules/mono/utils/osx_utils.cpp
+++ b/modules/mono/utils/osx_utils.cpp
@@ -32,7 +32,7 @@
#ifdef OSX_ENABLED
-#include "core/print_string.h"
+#include "core/string/print_string.h"
#include <CoreFoundation/CoreFoundation.h>
#include <CoreServices/CoreServices.h>
diff --git a/modules/mono/utils/osx_utils.h b/modules/mono/utils/osx_utils.h
index 55002702f8..92faead0fb 100644
--- a/modules/mono/utils/osx_utils.h
+++ b/modules/mono/utils/osx_utils.h
@@ -28,7 +28,7 @@
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
/*************************************************************************/
-#include "core/ustring.h"
+#include "core/string/ustring.h"
#ifndef OSX_UTILS_H
#define OSX_UTILS_H
diff --git a/modules/mono/utils/path_utils.cpp b/modules/mono/utils/path_utils.cpp
index 5d1abd0c09..eb0ba8c700 100644
--- a/modules/mono/utils/path_utils.cpp
+++ b/modules/mono/utils/path_utils.cpp
@@ -30,10 +30,10 @@
#include "path_utils.h"
+#include "core/config/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
#include <windows.h>
diff --git a/modules/mono/utils/path_utils.h b/modules/mono/utils/path_utils.h
index bcd8af8bb9..458d1bb849 100644
--- a/modules/mono/utils/path_utils.h
+++ b/modules/mono/utils/path_utils.h
@@ -31,8 +31,8 @@
#ifndef PATH_UTILS_H
#define PATH_UTILS_H
-#include "core/string_builder.h"
-#include "core/ustring.h"
+#include "core/string/string_builder.h"
+#include "core/string/ustring.h"
namespace path {
diff --git a/modules/mono/utils/string_utils.h b/modules/mono/utils/string_utils.h
index 0318fec592..99f3548f31 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 "core/ustring.h"
-#include "core/variant.h"
+#include "core/string/ustring.h"
+#include "core/variant/variant.h"
#include <stdarg.h>
diff --git a/modules/opensimplex/noise_texture.h b/modules/opensimplex/noise_texture.h
index 7357e54e35..73960ba85f 100644
--- a/modules/opensimplex/noise_texture.h
+++ b/modules/opensimplex/noise_texture.h
@@ -33,8 +33,8 @@
#include "open_simplex_noise.h"
-#include "core/image.h"
-#include "core/reference.h"
+#include "core/io/image.h"
+#include "core/object/reference.h"
#include "editor/editor_node.h"
#include "editor/editor_plugin.h"
#include "editor/property_editor.h"
diff --git a/modules/opensimplex/open_simplex_noise.h b/modules/opensimplex/open_simplex_noise.h
index dce62bc1f9..835f8ed35e 100644
--- a/modules/opensimplex/open_simplex_noise.h
+++ b/modules/opensimplex/open_simplex_noise.h
@@ -31,8 +31,8 @@
#ifndef OPEN_SIMPLEX_NOISE_H
#define OPEN_SIMPLEX_NOISE_H
-#include "core/image.h"
-#include "core/reference.h"
+#include "core/io/image.h"
+#include "core/object/reference.h"
#include "scene/resources/texture.h"
#include "thirdparty/misc/open-simplex-noise.h"
diff --git a/modules/regex/regex.h b/modules/regex/regex.h
index 52b49c783e..8cf19e1ca6 100644
--- a/modules/regex/regex.h
+++ b/modules/regex/regex.h
@@ -31,12 +31,12 @@
#ifndef REGEX_H
#define REGEX_H
-#include "core/array.h"
-#include "core/dictionary.h"
-#include "core/map.h"
-#include "core/reference.h"
-#include "core/ustring.h"
-#include "core/vector.h"
+#include "core/object/reference.h"
+#include "core/string/ustring.h"
+#include "core/templates/map.h"
+#include "core/templates/vector.h"
+#include "core/variant/array.h"
+#include "core/variant/dictionary.h"
class RegExMatch : public Reference {
GDCLASS(RegExMatch, Reference);
diff --git a/modules/regex/register_types.cpp b/modules/regex/register_types.cpp
index 5d4aeba2d7..d470fcdaeb 100644
--- a/modules/regex/register_types.cpp
+++ b/modules/regex/register_types.cpp
@@ -29,7 +29,7 @@
/*************************************************************************/
#include "register_types.h"
-#include "core/class_db.h"
+#include "core/object/class_db.h"
#include "regex.h"
void register_regex_types() {
diff --git a/modules/squish/image_compress_squish.h b/modules/squish/image_compress_squish.h
index 19e6d57474..11b9e1c833 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 "core/image.h"
+#include "core/io/image.h"
void image_compress_squish(Image *p_image, float p_lossy_quality, Image::UsedChannels p_channels);
void image_decompress_squish(Image *p_image);
diff --git a/modules/stb_vorbis/register_types.cpp b/modules/stb_vorbis/register_types.cpp
index 6669d30278..13c26fc8cc 100644
--- a/modules/stb_vorbis/register_types.cpp
+++ b/modules/stb_vorbis/register_types.cpp
@@ -33,7 +33,7 @@
#include "audio_stream_ogg_vorbis.h"
#ifdef TOOLS_ENABLED
-#include "core/engine.h"
+#include "core/config/engine.h"
#include "resource_importer_ogg_vorbis.h"
#endif
diff --git a/modules/svg/image_loader_svg.h b/modules/svg/image_loader_svg.h
index ecaba5052b..8e478a40ce 100644
--- a/modules/svg/image_loader_svg.h
+++ b/modules/svg/image_loader_svg.h
@@ -32,7 +32,7 @@
#define IMAGE_LOADER_SVG_H
#include "core/io/image_loader.h"
-#include "core/ustring.h"
+#include "core/string/ustring.h"
/**
@author Daniel Ramirez <djrmuv@gmail.com>
diff --git a/modules/tga/image_loader_tga.cpp b/modules/tga/image_loader_tga.cpp
index 1475d24792..aa8b3122f4 100644
--- a/modules/tga/image_loader_tga.cpp
+++ b/modules/tga/image_loader_tga.cpp
@@ -30,10 +30,10 @@
#include "image_loader_tga.h"
-#include "core/error_macros.h"
+#include "core/error/error_macros.h"
#include "core/io/file_access_memory.h"
#include "core/os/os.h"
-#include "core/print_string.h"
+#include "core/string/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;
@@ -313,9 +313,9 @@ void ImageLoaderTGA::get_recognized_extensions(List<String> *p_extensions) const
p_extensions->push_back("tga");
}
-static Ref<Image> _tga_mem_loader_func(const uint8_t *p_png, int p_size) {
+static Ref<Image> _tga_mem_loader_func(const uint8_t *p_tga, int p_size) {
FileAccessMemory memfile;
- Error open_memfile_error = memfile.open_custom(p_png, p_size);
+ Error open_memfile_error = memfile.open_custom(p_tga, p_size);
ERR_FAIL_COND_V_MSG(open_memfile_error, Ref<Image>(), "Could not create memfile for TGA image buffer.");
Ref<Image> img;
img.instance();
diff --git a/modules/theora/video_stream_theora.cpp b/modules/theora/video_stream_theora.cpp
index 498391e44a..4f33f58ed1 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 "core/config/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 84f816acf8..867f464038 100644
--- a/modules/theora/video_stream_theora.h
+++ b/modules/theora/video_stream_theora.h
@@ -35,7 +35,7 @@
#include "core/os/file_access.h"
#include "core/os/semaphore.h"
#include "core/os/thread.h"
-#include "core/ring_buffer.h"
+#include "core/templates/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 5bdcb84244..75dc16c39a 100644
--- a/modules/tinyexr/image_loader_tinyexr.cpp
+++ b/modules/tinyexr/image_loader_tinyexr.cpp
@@ -31,7 +31,7 @@
#include "image_loader_tinyexr.h"
#include "core/os/os.h"
-#include "core/print_string.h"
+#include "core/string/print_string.h"
#include "thirdparty/tinyexr/tinyexr.h"
diff --git a/modules/upnp/register_types.cpp b/modules/upnp/register_types.cpp
index 34900206de..e66bc9d11a 100644
--- a/modules/upnp/register_types.cpp
+++ b/modules/upnp/register_types.cpp
@@ -30,7 +30,7 @@
#include "register_types.h"
-#include "core/error_macros.h"
+#include "core/error/error_macros.h"
#include "upnp.h"
#include "upnp_device.h"
diff --git a/modules/upnp/upnp.h b/modules/upnp/upnp.h
index 1c4b5549f4..e87f93e697 100644
--- a/modules/upnp/upnp.h
+++ b/modules/upnp/upnp.h
@@ -31,7 +31,7 @@
#ifndef GODOT_UPNP_H
#define GODOT_UPNP_H
-#include "core/reference.h"
+#include "core/object/reference.h"
#include "upnp_device.h"
diff --git a/modules/upnp/upnp_device.h b/modules/upnp/upnp_device.h
index 4b519fce32..a287c99b0d 100644
--- a/modules/upnp/upnp_device.h
+++ b/modules/upnp/upnp_device.h
@@ -31,7 +31,7 @@
#ifndef GODOT_UPNP_DEVICE_H
#define GODOT_UPNP_DEVICE_H
-#include "core/reference.h"
+#include "core/object/reference.h"
class UPNPDevice : public Reference {
GDCLASS(UPNPDevice, Reference);
diff --git a/modules/visual_script/doc_classes/VisualScriptBuiltinFunc.xml b/modules/visual_script/doc_classes/VisualScriptBuiltinFunc.xml
index ef4183e6f6..000fbd0140 100644
--- a/modules/visual_script/doc_classes/VisualScriptBuiltinFunc.xml
+++ b/modules/visual_script/doc_classes/VisualScriptBuiltinFunc.xml
@@ -111,61 +111,61 @@
<constant name="MATH_RANDOMIZE" value="31" enum="BuiltinFunc">
Randomize the seed (or the internal state) of the random number generator. Current implementation reseeds using a number based on time.
</constant>
- <constant name="MATH_RAND" value="32" enum="BuiltinFunc">
+ <constant name="MATH_RANDI" value="32" enum="BuiltinFunc">
Return a random 32 bits integer value. To obtain a random value between 0 to N (where N is smaller than 2^32 - 1), you can use it with the remainder function.
</constant>
<constant name="MATH_RANDF" value="33" enum="BuiltinFunc">
Return a random floating-point value between 0 and 1. To obtain a random value between 0 to N, you can use it with multiplication.
</constant>
- <constant name="MATH_RANDOM" value="34" enum="BuiltinFunc">
+ <constant name="MATH_RANDF_RANGE" value="34" enum="BuiltinFunc">
Return a random floating-point value between the two inputs.
</constant>
- <constant name="MATH_SEED" value="35" enum="BuiltinFunc">
+ <constant name="MATH_RANDI_RANGE" value="35" enum="BuiltinFunc">
+ Return a random 32-bit integer value between the two inputs.
+ </constant>
+ <constant name="MATH_SEED" value="36" enum="BuiltinFunc">
Set the seed for the random number generator.
</constant>
- <constant name="MATH_RANDSEED" value="36" enum="BuiltinFunc">
+ <constant name="MATH_RANDSEED" value="37" enum="BuiltinFunc">
Return a random value from the given seed, along with the new seed.
</constant>
- <constant name="MATH_DEG2RAD" value="37" enum="BuiltinFunc">
+ <constant name="MATH_DEG2RAD" value="38" enum="BuiltinFunc">
Convert the input from degrees to radians.
</constant>
- <constant name="MATH_RAD2DEG" value="38" enum="BuiltinFunc">
+ <constant name="MATH_RAD2DEG" value="39" enum="BuiltinFunc">
Convert the input from radians to degrees.
</constant>
- <constant name="MATH_LINEAR2DB" value="39" enum="BuiltinFunc">
+ <constant name="MATH_LINEAR2DB" value="40" enum="BuiltinFunc">
Convert the input from linear volume to decibel volume.
</constant>
- <constant name="MATH_DB2LINEAR" value="40" enum="BuiltinFunc">
+ <constant name="MATH_DB2LINEAR" value="41" enum="BuiltinFunc">
Convert the input from decibel volume to linear volume.
</constant>
- <constant name="MATH_POLAR2CARTESIAN" value="41" enum="BuiltinFunc">
+ <constant name="MATH_POLAR2CARTESIAN" value="42" enum="BuiltinFunc">
Converts a 2D point expressed in the polar coordinate system (a distance from the origin [code]r[/code] and an angle [code]th[/code]) to the cartesian coordinate system (X and Y axis).
</constant>
- <constant name="MATH_CARTESIAN2POLAR" value="42" enum="BuiltinFunc">
+ <constant name="MATH_CARTESIAN2POLAR" value="43" enum="BuiltinFunc">
Converts a 2D point expressed in the cartesian coordinate system (X and Y axis) to the polar coordinate system (a distance from the origin and an angle).
</constant>
- <constant name="MATH_WRAP" value="43" enum="BuiltinFunc">
+ <constant name="MATH_WRAP" value="44" enum="BuiltinFunc">
</constant>
- <constant name="MATH_WRAPF" value="44" enum="BuiltinFunc">
+ <constant name="MATH_WRAPF" value="45" enum="BuiltinFunc">
</constant>
- <constant name="LOGIC_MAX" value="45" enum="BuiltinFunc">
+ <constant name="LOGIC_MAX" value="46" enum="BuiltinFunc">
Return the greater of the two numbers, also known as their maximum.
</constant>
- <constant name="LOGIC_MIN" value="46" enum="BuiltinFunc">
+ <constant name="LOGIC_MIN" value="47" enum="BuiltinFunc">
Return the lesser of the two numbers, also known as their minimum.
</constant>
- <constant name="LOGIC_CLAMP" value="47" enum="BuiltinFunc">
+ <constant name="LOGIC_CLAMP" value="48" enum="BuiltinFunc">
Return the input clamped inside the given range, ensuring the result is never outside it. Equivalent to [code]min(max(input, range_low), range_high)[/code].
</constant>
- <constant name="LOGIC_NEAREST_PO2" value="48" enum="BuiltinFunc">
+ <constant name="LOGIC_NEAREST_PO2" value="49" enum="BuiltinFunc">
Return the nearest power of 2 to the input.
</constant>
- <constant name="OBJ_WEAKREF" value="49" enum="BuiltinFunc">
+ <constant name="OBJ_WEAKREF" value="50" enum="BuiltinFunc">
Create a [WeakRef] from the input.
</constant>
- <constant name="FUNC_FUNCREF" value="50" enum="BuiltinFunc">
- Create a [FuncRef] from the input.
- </constant>
<constant name="TYPE_CONVERT" value="51" enum="BuiltinFunc">
Convert between types.
</constant>
diff --git a/modules/visual_script/register_types.cpp b/modules/visual_script/register_types.cpp
index 8afed1229f..0172f29923 100644
--- a/modules/visual_script/register_types.cpp
+++ b/modules/visual_script/register_types.cpp
@@ -30,7 +30,7 @@
#include "register_types.h"
-#include "core/engine.h"
+#include "core/config/engine.h"
#include "core/io/resource_loader.h"
#include "visual_script.h"
#include "visual_script_builtin_funcs.h"
diff --git a/modules/visual_script/visual_script.cpp b/modules/visual_script/visual_script.cpp
index 1af4b46e22..1c7d5472cb 100644
--- a/modules/visual_script/visual_script.cpp
+++ b/modules/visual_script/visual_script.cpp
@@ -30,9 +30,9 @@
#include "visual_script.h"
+#include "core/config/project_settings.h"
#include "core/core_string_names.h"
#include "core/os/os.h"
-#include "core/project_settings.h"
#include "scene/main/node.h"
#include "visual_script_nodes.h"
@@ -84,10 +84,10 @@ void VisualScriptNode::validate_input_default_values() {
Callable::CallError ce;
Variant existing = default_input_values[i];
const Variant *existingp = &existing;
- default_input_values[i] = Variant::construct(expected, &existingp, 1, ce, false);
+ Variant::construct(expected, default_input_values[i], &existingp, 1, ce);
if (ce.error != Callable::CallError::CALL_OK) {
//could not convert? force..
- default_input_values[i] = Variant::construct(expected, nullptr, 0, ce, false);
+ Variant::construct(expected, default_input_values[i], nullptr, 0, ce);
}
}
}
diff --git a/modules/visual_script/visual_script.h b/modules/visual_script/visual_script.h
index cb5ed37ba1..85dab4e6cf 100644
--- a/modules/visual_script/visual_script.h
+++ b/modules/visual_script/visual_script.h
@@ -33,8 +33,8 @@
#include "core/debugger/engine_debugger.h"
#include "core/debugger/script_debugger.h"
+#include "core/object/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 177f9192b8..a27307aec2 100644
--- a/modules/visual_script/visual_script_builtin_funcs.cpp
+++ b/modules/visual_script/visual_script_builtin_funcs.cpp
@@ -30,13 +30,12 @@
#include "visual_script_builtin_funcs.h"
-#include "core/class_db.h"
-#include "core/func_ref.h"
#include "core/io/marshalls.h"
#include "core/math/math_funcs.h"
+#include "core/object/class_db.h"
+#include "core/object/reference.h"
#include "core/os/os.h"
-#include "core/reference.h"
-#include "core/variant_parser.h"
+#include "core/variant/variant_parser.h"
const char *VisualScriptBuiltinFunc::func_name[VisualScriptBuiltinFunc::FUNC_MAX] = {
"sin",
@@ -73,7 +72,8 @@ const char *VisualScriptBuiltinFunc::func_name[VisualScriptBuiltinFunc::FUNC_MAX
"randomize",
"randi",
"randf",
- "rand_range",
+ "randf_range",
+ "randi_range",
"seed",
"rand_seed",
"deg2rad",
@@ -89,7 +89,6 @@ const char *VisualScriptBuiltinFunc::func_name[VisualScriptBuiltinFunc::FUNC_MAX
"clamp",
"nearest_po2",
"weakref",
- "funcref",
"convert",
"typeof",
"type_exists",
@@ -143,7 +142,7 @@ bool VisualScriptBuiltinFunc::has_input_sequence_port() const {
int VisualScriptBuiltinFunc::get_func_argument_count(BuiltinFunc p_func) {
switch (p_func) {
case MATH_RANDOMIZE:
- case MATH_RAND:
+ case MATH_RANDI:
case MATH_RANDF:
return 0;
case MATH_SIN:
@@ -194,12 +193,12 @@ int VisualScriptBuiltinFunc::get_func_argument_count(BuiltinFunc p_func) {
case MATH_POW:
case MATH_EASE:
case MATH_STEPIFY:
- case MATH_RANDOM:
+ case MATH_RANDF_RANGE:
+ case MATH_RANDI_RANGE:
case MATH_POLAR2CARTESIAN:
case MATH_CARTESIAN2POLAR:
case LOGIC_MAX:
case LOGIC_MIN:
- case FUNC_FUNCREF:
case TYPE_CONVERT:
case COLORN:
return 2;
@@ -361,16 +360,23 @@ PropertyInfo VisualScriptBuiltinFunc::get_input_value_port_info(int p_idx) const
}
} break;
case MATH_RANDOMIZE:
- case MATH_RAND:
+ case MATH_RANDI:
case MATH_RANDF: {
} break;
- case MATH_RANDOM: {
+ case MATH_RANDF_RANGE: {
if (p_idx == 0) {
return PropertyInfo(Variant::FLOAT, "from");
} else {
return PropertyInfo(Variant::FLOAT, "to");
}
} break;
+ case MATH_RANDI_RANGE: {
+ if (p_idx == 0) {
+ return PropertyInfo(Variant::INT, "from");
+ } else {
+ return PropertyInfo(Variant::INT, "to");
+ }
+ } break;
case MATH_SEED:
case MATH_RANDSEED: {
return PropertyInfo(Variant::INT, "seed");
@@ -426,13 +432,6 @@ PropertyInfo VisualScriptBuiltinFunc::get_input_value_port_info(int p_idx) const
case OBJ_WEAKREF: {
return PropertyInfo(Variant::OBJECT, "source");
} break;
- case FUNC_FUNCREF: {
- if (p_idx == 0) {
- return PropertyInfo(Variant::OBJECT, "instance");
- } else {
- return PropertyInfo(Variant::STRING, "funcname");
- }
- } break;
case TYPE_CONVERT: {
if (p_idx == 0) {
return PropertyInfo(Variant::NIL, "what");
@@ -551,13 +550,16 @@ PropertyInfo VisualScriptBuiltinFunc::get_output_value_port_info(int p_idx) cons
} break;
case MATH_RANDOMIZE: {
} break;
- case MATH_RAND: {
+ case MATH_RANDI: {
t = Variant::INT;
} break;
case MATH_RANDF:
- case MATH_RANDOM: {
+ case MATH_RANDF_RANGE: {
t = Variant::FLOAT;
} break;
+ case MATH_RANDI_RANGE: {
+ t = Variant::INT;
+ } break;
case MATH_SEED: {
} break;
case MATH_RANDSEED: {
@@ -593,10 +595,6 @@ PropertyInfo VisualScriptBuiltinFunc::get_output_value_port_info(int p_idx) cons
t = Variant::OBJECT;
} break;
- case FUNC_FUNCREF: {
- t = Variant::OBJECT;
-
- } break;
case TYPE_CONVERT: {
} break;
case TEXT_ORD:
@@ -861,17 +859,22 @@ void VisualScriptBuiltinFunc::exec_func(BuiltinFunc p_func, const Variant **p_in
Math::randomize();
} break;
- case VisualScriptBuiltinFunc::MATH_RAND: {
+ case VisualScriptBuiltinFunc::MATH_RANDI: {
*r_return = Math::rand();
} break;
case VisualScriptBuiltinFunc::MATH_RANDF: {
*r_return = Math::randf();
} break;
- case VisualScriptBuiltinFunc::MATH_RANDOM: {
+ case VisualScriptBuiltinFunc::MATH_RANDF_RANGE: {
VALIDATE_ARG_NUM(0);
VALIDATE_ARG_NUM(1);
*r_return = Math::random((double)*p_inputs[0], (double)*p_inputs[1]);
} break;
+ case VisualScriptBuiltinFunc::MATH_RANDI_RANGE: {
+ VALIDATE_ARG_NUM(0);
+ VALIDATE_ARG_NUM(1);
+ *r_return = Math::random((int)*p_inputs[0], (int)*p_inputs[1]);
+ } break;
case VisualScriptBuiltinFunc::MATH_SEED: {
VALIDATE_ARG_NUM(0);
uint64_t seed = *p_inputs[0];
@@ -1013,30 +1016,6 @@ void VisualScriptBuiltinFunc::exec_func(BuiltinFunc p_func, const Variant **p_in
}
} break;
- case VisualScriptBuiltinFunc::FUNC_FUNCREF: {
- if (p_inputs[0]->get_type() != Variant::OBJECT) {
- r_error.error = Callable::CallError::CALL_ERROR_INVALID_ARGUMENT;
- r_error.argument = 0;
- r_error.expected = Variant::OBJECT;
-
- return;
- }
- if (p_inputs[1]->get_type() != Variant::STRING && p_inputs[1]->get_type() != Variant::NODE_PATH) {
- r_error.error = Callable::CallError::CALL_ERROR_INVALID_ARGUMENT;
- r_error.argument = 1;
- r_error.expected = Variant::STRING;
-
- return;
- }
-
- Ref<FuncRef> fr = memnew(FuncRef);
-
- fr->set_instance(*p_inputs[0]);
- fr->set_function(*p_inputs[1]);
-
- *r_return = fr;
-
- } break;
case VisualScriptBuiltinFunc::TYPE_CONVERT: {
VALIDATE_ARG_NUM(1);
int type = *p_inputs[1];
@@ -1048,7 +1027,7 @@ void VisualScriptBuiltinFunc::exec_func(BuiltinFunc p_func, const Variant **p_in
return;
} else {
- *r_return = Variant::construct(Variant::Type(type), p_inputs, 1, r_error);
+ Variant::construct(Variant::Type(type), *r_return, p_inputs, 1, r_error);
}
} break;
case VisualScriptBuiltinFunc::TYPE_OF: {
@@ -1283,9 +1262,10 @@ void VisualScriptBuiltinFunc::_bind_methods() {
BIND_ENUM_CONSTANT(MATH_MOVE_TOWARD);
BIND_ENUM_CONSTANT(MATH_DECTIME);
BIND_ENUM_CONSTANT(MATH_RANDOMIZE);
- BIND_ENUM_CONSTANT(MATH_RAND);
+ BIND_ENUM_CONSTANT(MATH_RANDI);
BIND_ENUM_CONSTANT(MATH_RANDF);
- BIND_ENUM_CONSTANT(MATH_RANDOM);
+ BIND_ENUM_CONSTANT(MATH_RANDF_RANGE);
+ BIND_ENUM_CONSTANT(MATH_RANDI_RANGE);
BIND_ENUM_CONSTANT(MATH_SEED);
BIND_ENUM_CONSTANT(MATH_RANDSEED);
BIND_ENUM_CONSTANT(MATH_DEG2RAD);
@@ -1301,7 +1281,6 @@ void VisualScriptBuiltinFunc::_bind_methods() {
BIND_ENUM_CONSTANT(LOGIC_CLAMP);
BIND_ENUM_CONSTANT(LOGIC_NEAREST_PO2);
BIND_ENUM_CONSTANT(OBJ_WEAKREF);
- BIND_ENUM_CONSTANT(FUNC_FUNCREF);
BIND_ENUM_CONSTANT(TYPE_CONVERT);
BIND_ENUM_CONSTANT(TYPE_OF);
BIND_ENUM_CONSTANT(TYPE_EXISTS);
@@ -1375,9 +1354,10 @@ void register_visual_script_builtin_func_node() {
VisualScriptLanguage::singleton->add_register_func("functions/built_in/move_toward", create_builtin_func_node<VisualScriptBuiltinFunc::MATH_MOVE_TOWARD>);
VisualScriptLanguage::singleton->add_register_func("functions/built_in/dectime", create_builtin_func_node<VisualScriptBuiltinFunc::MATH_DECTIME>);
VisualScriptLanguage::singleton->add_register_func("functions/built_in/randomize", create_builtin_func_node<VisualScriptBuiltinFunc::MATH_RANDOMIZE>);
- VisualScriptLanguage::singleton->add_register_func("functions/built_in/rand", create_builtin_func_node<VisualScriptBuiltinFunc::MATH_RAND>);
+ VisualScriptLanguage::singleton->add_register_func("functions/built_in/randi", create_builtin_func_node<VisualScriptBuiltinFunc::MATH_RANDI>);
VisualScriptLanguage::singleton->add_register_func("functions/built_in/randf", create_builtin_func_node<VisualScriptBuiltinFunc::MATH_RANDF>);
- VisualScriptLanguage::singleton->add_register_func("functions/built_in/random", create_builtin_func_node<VisualScriptBuiltinFunc::MATH_RANDOM>);
+ VisualScriptLanguage::singleton->add_register_func("functions/built_in/randf_range", create_builtin_func_node<VisualScriptBuiltinFunc::MATH_RANDF_RANGE>);
+ VisualScriptLanguage::singleton->add_register_func("functions/built_in/randi_range", create_builtin_func_node<VisualScriptBuiltinFunc::MATH_RANDI_RANGE>);
VisualScriptLanguage::singleton->add_register_func("functions/built_in/seed", create_builtin_func_node<VisualScriptBuiltinFunc::MATH_SEED>);
VisualScriptLanguage::singleton->add_register_func("functions/built_in/randseed", create_builtin_func_node<VisualScriptBuiltinFunc::MATH_RANDSEED>);
@@ -1396,7 +1376,6 @@ void register_visual_script_builtin_func_node() {
VisualScriptLanguage::singleton->add_register_func("functions/built_in/nearest_po2", create_builtin_func_node<VisualScriptBuiltinFunc::LOGIC_NEAREST_PO2>);
VisualScriptLanguage::singleton->add_register_func("functions/built_in/weakref", create_builtin_func_node<VisualScriptBuiltinFunc::OBJ_WEAKREF>);
- VisualScriptLanguage::singleton->add_register_func("functions/built_in/funcref", create_builtin_func_node<VisualScriptBuiltinFunc::FUNC_FUNCREF>);
VisualScriptLanguage::singleton->add_register_func("functions/built_in/convert", create_builtin_func_node<VisualScriptBuiltinFunc::TYPE_CONVERT>);
VisualScriptLanguage::singleton->add_register_func("functions/built_in/typeof", create_builtin_func_node<VisualScriptBuiltinFunc::TYPE_OF>);
VisualScriptLanguage::singleton->add_register_func("functions/built_in/type_exists", create_builtin_func_node<VisualScriptBuiltinFunc::TYPE_EXISTS>);
diff --git a/modules/visual_script/visual_script_builtin_funcs.h b/modules/visual_script/visual_script_builtin_funcs.h
index aee2ed79ce..361b445e30 100644
--- a/modules/visual_script/visual_script_builtin_funcs.h
+++ b/modules/visual_script/visual_script_builtin_funcs.h
@@ -70,9 +70,10 @@ public:
MATH_MOVE_TOWARD,
MATH_DECTIME,
MATH_RANDOMIZE,
- MATH_RAND,
+ MATH_RANDI,
MATH_RANDF,
- MATH_RANDOM,
+ MATH_RANDF_RANGE,
+ MATH_RANDI_RANGE,
MATH_SEED,
MATH_RANDSEED,
MATH_DEG2RAD,
@@ -88,7 +89,6 @@ public:
LOGIC_CLAMP,
LOGIC_NEAREST_PO2,
OBJ_WEAKREF,
- FUNC_FUNCREF,
TYPE_CONVERT,
TYPE_OF,
TYPE_EXISTS,
diff --git a/modules/visual_script/visual_script_editor.cpp b/modules/visual_script/visual_script_editor.cpp
index 01c674d086..1bb96a47f3 100644
--- a/modules/visual_script/visual_script_editor.cpp
+++ b/modules/visual_script/visual_script_editor.cpp
@@ -30,11 +30,11 @@
#include "visual_script_editor.h"
-#include "core/class_db.h"
#include "core/input/input.h"
+#include "core/object/class_db.h"
+#include "core/object/script_language.h"
#include "core/os/keyboard.h"
-#include "core/script_language.h"
-#include "core/variant.h"
+#include "core/variant/variant.h"
#include "editor/editor_node.h"
#include "editor/editor_resource_preview.h"
#include "editor/editor_scale.h"
@@ -388,7 +388,7 @@ static Color _color_from_type(Variant::Type p_type, bool dark_theme = true) {
case Variant::NODE_PATH:
color = Color(0.41, 0.58, 0.93);
break;
- case Variant::_RID:
+ case Variant::RID:
color = Color(0.41, 0.93, 0.6);
break;
case Variant::OBJECT:
@@ -494,7 +494,7 @@ static Color _color_from_type(Variant::Type p_type, bool dark_theme = true) {
case Variant::NODE_PATH:
color = Color(0.41, 0.58, 0.93);
break;
- case Variant::_RID:
+ case Variant::RID:
color = Color(0.17, 0.9, 0.45);
break;
case Variant::OBJECT:
@@ -885,7 +885,7 @@ void VisualScriptEditor::_update_graph(int p_only_id) {
//not the same, reconvert
Callable::CallError ce;
const Variant *existingp = &value;
- value = Variant::construct(left_type, &existingp, 1, ce, false);
+ Variant::construct(left_type, value, &existingp, 1, ce);
}
if (left_type == Variant::COLOR) {
@@ -1173,7 +1173,9 @@ String VisualScriptEditor::_sanitized_variant_text(const StringName &property_na
if (script->get_variable_info(property_name).type != Variant::NIL) {
Callable::CallError ce;
const Variant *converted = &var;
- var = Variant::construct(script->get_variable_info(property_name).type, &converted, 1, ce, false);
+ Variant n;
+ Variant::construct(script->get_variable_info(property_name).type, n, &converted, 1, ce);
+ var = n;
}
return String(var);
@@ -3959,8 +3961,9 @@ void VisualScriptEditor::_default_value_edited(Node *p_button, int p_id, int p_i
Variant existing = vsn->get_default_input_value(p_input_port);
if (pinfo.type != Variant::NIL && existing.get_type() != pinfo.type) {
Callable::CallError ce;
- const Variant *existingp = &existing;
- existing = Variant::construct(pinfo.type, &existingp, 1, ce, false);
+ Variant e = existing;
+ const Variant *existingp = &e;
+ Variant::construct(pinfo.type, existing, &existingp, 1, ce);
}
default_value_edit->set_position(Object::cast_to<Control>(p_button)->get_global_position() + Vector2(0, Object::cast_to<Control>(p_button)->get_size().y));
diff --git a/modules/visual_script/visual_script_expression.cpp b/modules/visual_script/visual_script_expression.cpp
index 60a439b291..bb015b118d 100644
--- a/modules/visual_script/visual_script_expression.cpp
+++ b/modules/visual_script/visual_script_expression.cpp
@@ -1341,7 +1341,7 @@ public:
}
bool valid;
- r_ret = base.get_named(index->name, &valid);
+ r_ret = base.get_named(index->name, valid);
if (!valid) {
r_error_str = "Invalid index '" + String(index->name) + "' for base of type " + Variant::get_type_name(base.get_type()) + ".";
return true;
@@ -1405,7 +1405,7 @@ public:
argp.write[i] = &arr[i];
}
- r_ret = Variant::construct(constructor->data_type, (const Variant **)argp.ptr(), argp.size(), ce);
+ Variant::construct(constructor->data_type, r_ret, (const Variant **)argp.ptr(), argp.size(), ce);
if (ce.error != Callable::CallError::CALL_OK) {
r_error_str = "Invalid arguments to construct '" + Variant::get_type_name(constructor->data_type) + "'.";
diff --git a/modules/visual_script/visual_script_flow_control.cpp b/modules/visual_script/visual_script_flow_control.cpp
index 3ed20fab35..36c756fc58 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 "core/config/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 68de686272..3b46af3cbd 100644
--- a/modules/visual_script/visual_script_func_nodes.cpp
+++ b/modules/visual_script/visual_script_func_nodes.cpp
@@ -30,7 +30,7 @@
#include "visual_script_func_nodes.h"
-#include "core/engine.h"
+#include "core/config/engine.h"
#include "core/io/resource_loader.h"
#include "core/os/os.h"
#include "scene/main/node.h"
@@ -976,7 +976,7 @@ void VisualScriptPropertySet::_adjust_input_index(PropertyInfo &pinfo) const {
if (index != StringName()) {
Variant v;
Callable::CallError ce;
- v = Variant::construct(pinfo.type, nullptr, 0, ce);
+ Variant::construct(pinfo.type, v, nullptr, 0, ce);
Variant i = v.get(index);
pinfo.type = i.get_type();
}
@@ -1117,7 +1117,7 @@ void VisualScriptPropertySet::_update_cache() {
Variant v;
Callable::CallError ce;
- v = Variant::construct(basic_type, nullptr, 0, ce);
+ Variant::construct(basic_type, v, nullptr, 0, ce);
List<PropertyInfo> pinfo;
v.get_property_list(&pinfo);
@@ -1336,7 +1336,8 @@ void VisualScriptPropertySet::_validate_property(PropertyInfo &property) const {
if (property.name == "index") {
Callable::CallError ce;
- Variant v = Variant::construct(type_cache.type, nullptr, 0, ce);
+ Variant v;
+ Variant::construct(type_cache.type, v, nullptr, 0, ce);
List<PropertyInfo> plist;
v.get_property_list(&plist);
String options = "";
@@ -1449,11 +1450,11 @@ public:
_FORCE_INLINE_ void _process_get(Variant &source, const Variant &p_argument, bool &valid) {
if (index != StringName() && assign_op == VisualScriptPropertySet::ASSIGN_OP_NONE) {
- source.set_named(index, p_argument, &valid);
+ source.set_named(index, p_argument, valid);
} else {
Variant value;
if (index != StringName()) {
- value = source.get_named(index, &valid);
+ value = source.get_named(index, valid);
} else {
value = source;
}
@@ -1497,7 +1498,7 @@ public:
}
if (index != StringName()) {
- source.set_named(index, value, &valid);
+ source.set_named(index, value, valid);
} else {
source = value;
}
@@ -1562,12 +1563,12 @@ public:
bool valid;
if (needs_get) {
- Variant value = v.get_named(property, &valid);
+ Variant value = v.get_named(property, valid);
_process_get(value, *p_inputs[1], valid);
- v.set_named(property, value, &valid);
+ v.set_named(property, value, valid);
} else {
- v.set_named(property, *p_inputs[1], &valid);
+ v.set_named(property, *p_inputs[1], valid);
}
if (!valid) {
@@ -1786,7 +1787,7 @@ void VisualScriptPropertyGet::_update_cache() {
Variant v;
Callable::CallError ce;
- v = Variant::construct(basic_type, nullptr, 0, ce);
+ Variant::construct(basic_type, v, nullptr, 0, ce);
List<PropertyInfo> pinfo;
v.get_property_list(&pinfo);
@@ -2012,7 +2013,8 @@ void VisualScriptPropertyGet::_validate_property(PropertyInfo &property) const {
if (property.name == "index") {
Callable::CallError ce;
- Variant v = Variant::construct(type_cache, nullptr, 0, ce);
+ Variant v;
+ Variant::construct(type_cache, v, nullptr, 0, ce);
List<PropertyInfo> plist;
v.get_property_list(&plist);
String options = "";
@@ -2111,7 +2113,7 @@ public:
*p_outputs[0] = object->get(property, &valid);
if (index != StringName()) {
- *p_outputs[0] = p_outputs[0]->get_named(index);
+ *p_outputs[0] = p_outputs[0]->get_named(index, valid);
}
if (!valid) {
@@ -2140,7 +2142,7 @@ public:
*p_outputs[0] = another->get(property, &valid);
if (index != StringName()) {
- *p_outputs[0] = p_outputs[0]->get_named(index);
+ *p_outputs[0] = p_outputs[0]->get_named(index, valid);
}
if (!valid) {
@@ -2156,7 +2158,7 @@ public:
*p_outputs[0] = v.get(property, &valid);
if (index != StringName()) {
- *p_outputs[0] = p_outputs[0]->get_named(index);
+ *p_outputs[0] = p_outputs[0]->get_named(index, valid);
}
if (!valid) {
@@ -2368,7 +2370,8 @@ void register_visual_script_func_nodes() {
Variant::Type t = Variant::Type(i);
String type_name = Variant::get_type_name(t);
Callable::CallError ce;
- Variant vt = Variant::construct(t, nullptr, 0, ce);
+ Variant vt;
+ Variant::construct(t, vt, nullptr, 0, ce);
List<MethodInfo> ml;
vt.get_method_list(&ml);
diff --git a/modules/visual_script/visual_script_nodes.cpp b/modules/visual_script/visual_script_nodes.cpp
index 28122ade99..edec270adc 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 "core/engine.h"
-#include "core/global_constants.h"
+#include "core/config/engine.h"
+#include "core/config/project_settings.h"
+#include "core/core_constants.h"
#include "core/input/input.h"
#include "core/os/os.h"
-#include "core/project_settings.h"
#include "scene/main/node.h"
#include "scene/main/scene_tree.h"
@@ -828,7 +828,6 @@ PropertyInfo VisualScriptOperator::get_input_value_port_info(int p_idx) const {
{ Variant::NIL, Variant::NIL }, //OP_NEGATE,
{ Variant::NIL, Variant::NIL }, //OP_POSITIVE,
{ Variant::INT, Variant::INT }, //OP_MODULE,
- { Variant::STRING, Variant::STRING }, //OP_STRING_CONCAT,
//bitwise
{ Variant::INT, Variant::INT }, //OP_SHIFT_LEFT,
{ Variant::INT, Variant::INT }, //OP_SHIFT_RIGHT,
@@ -873,7 +872,6 @@ PropertyInfo VisualScriptOperator::get_output_value_port_info(int p_idx) const {
Variant::NIL, //OP_NEGATE,
Variant::NIL, //OP_POSITIVE,
Variant::INT, //OP_MODULE,
- Variant::STRING, //OP_STRING_CONCAT,
//bitwise
Variant::INT, //OP_SHIFT_LEFT,
Variant::INT, //OP_SHIFT_RIGHT,
@@ -1433,7 +1431,7 @@ void VisualScriptConstant::set_constant_type(Variant::Type p_type) {
type = p_type;
Callable::CallError ce;
- value = Variant::construct(type, nullptr, 0, ce);
+ Variant::construct(type, value, nullptr, 0, ce);
ports_changed_notify();
_change_notify();
}
@@ -1756,7 +1754,7 @@ PropertyInfo VisualScriptGlobalConstant::get_input_value_port_info(int p_idx) co
}
PropertyInfo VisualScriptGlobalConstant::get_output_value_port_info(int p_idx) const {
- String name = GlobalConstants::get_global_constant_name(index);
+ String name = CoreConstants::get_global_constant_name(index);
return PropertyInfo(Variant::INT, name);
}
@@ -1780,7 +1778,7 @@ public:
//virtual int get_working_memory_size() const { return 0; }
virtual int step(const Variant **p_inputs, Variant **p_outputs, StartMode p_start_mode, Variant *p_working_mem, Callable::CallError &r_error, String &r_error_str) {
- *p_outputs[0] = GlobalConstants::get_global_constant_value(index);
+ *p_outputs[0] = CoreConstants::get_global_constant_value(index);
return 0;
}
};
@@ -1797,11 +1795,11 @@ void VisualScriptGlobalConstant::_bind_methods() {
String cc;
- for (int i = 0; i < GlobalConstants::get_global_constant_count(); i++) {
+ for (int i = 0; i < CoreConstants::get_global_constant_count(); i++) {
if (i > 0) {
cc += ",";
}
- cc += GlobalConstants::get_global_constant_name(i);
+ cc += CoreConstants::get_global_constant_name(i);
}
ADD_PROPERTY(PropertyInfo(Variant::INT, "constant", PROPERTY_HINT_ENUM, cc), "set_global_constant", "get_global_constant");
}
@@ -3257,7 +3255,7 @@ public:
virtual int step(const Variant **p_inputs, Variant **p_outputs, StartMode p_start_mode, Variant *p_working_mem, Callable::CallError &r_error, String &r_error_str) {
Callable::CallError ce;
- *p_outputs[0] = Variant::construct(type, p_inputs, argcount, ce);
+ Variant::construct(type, *p_outputs[0], p_inputs, argcount, ce);
if (ce.error != Callable::CallError::CALL_OK) {
r_error_str = "Invalid arguments for constructor";
}
@@ -3729,7 +3727,7 @@ void VisualScriptDeconstruct::_update_elements() {
elements.clear();
Variant v;
Callable::CallError ce;
- v = Variant::construct(type, nullptr, 0, ce);
+ Variant::construct(type, v, nullptr, 0, ce);
List<PropertyInfo> pinfo;
v.get_property_list(&pinfo);
@@ -3881,7 +3879,6 @@ void register_visual_script_nodes() {
VisualScriptLanguage::singleton->add_register_func("operators/math/negate", create_op_node<Variant::OP_NEGATE>);
VisualScriptLanguage::singleton->add_register_func("operators/math/positive", create_op_node<Variant::OP_POSITIVE>);
VisualScriptLanguage::singleton->add_register_func("operators/math/remainder", create_op_node<Variant::OP_MODULE>);
- VisualScriptLanguage::singleton->add_register_func("operators/math/string_concat", create_op_node<Variant::OP_STRING_CONCAT>);
//bitwise
VisualScriptLanguage::singleton->add_register_func("operators/bitwise/shift_left", create_op_node<Variant::OP_SHIFT_LEFT>);
VisualScriptLanguage::singleton->add_register_func("operators/bitwise/shift_right", create_op_node<Variant::OP_SHIFT_RIGHT>);
diff --git a/modules/visual_script/visual_script_property_selector.cpp b/modules/visual_script/visual_script_property_selector.cpp
index 3c44faab90..875270e74f 100644
--- a/modules/visual_script/visual_script_property_selector.cpp
+++ b/modules/visual_script/visual_script_property_selector.cpp
@@ -196,7 +196,7 @@ void VisualScriptPropertySelector::_update_search() {
if (type != Variant::NIL) {
Variant v;
Callable::CallError ce;
- v = Variant::construct(type, nullptr, 0, ce);
+ Variant::construct(type, v, nullptr, 0, ce);
v.get_method_list(&methods);
} else {
Object *obj = ObjectDB::get_instance(script);
diff --git a/modules/webm/video_stream_webm.cpp b/modules/webm/video_stream_webm.cpp
index 832e14d91a..2128b82e3f 100644
--- a/modules/webm/video_stream_webm.cpp
+++ b/modules/webm/video_stream_webm.cpp
@@ -30,9 +30,9 @@
#include "video_stream_webm.h"
+#include "core/config/project_settings.h"
#include "core/os/file_access.h"
#include "core/os/os.h"
-#include "core/project_settings.h"
#include "servers/audio_server.h"
#include "thirdparty/misc/yuv2rgb.h"
diff --git a/modules/webp/image_loader_webp.cpp b/modules/webp/image_loader_webp.cpp
index d5c80e7909..b169687f25 100644
--- a/modules/webp/image_loader_webp.cpp
+++ b/modules/webp/image_loader_webp.cpp
@@ -32,7 +32,7 @@
#include "core/io/marshalls.h"
#include "core/os/os.h"
-#include "core/print_string.h"
+#include "core/string/print_string.h"
#include <stdlib.h>
#include <webp/decode.h>
diff --git a/modules/webrtc/register_types.cpp b/modules/webrtc/register_types.cpp
index 5b296b1ac6..0e830f0540 100644
--- a/modules/webrtc/register_types.cpp
+++ b/modules/webrtc/register_types.cpp
@@ -29,7 +29,7 @@
/*************************************************************************/
#include "register_types.h"
-#include "core/project_settings.h"
+#include "core/config/project_settings.h"
#include "webrtc_data_channel.h"
#include "webrtc_peer_connection.h"
diff --git a/modules/webrtc/webrtc_data_channel.cpp b/modules/webrtc/webrtc_data_channel.cpp
index 7566532982..cd9e77aff8 100644
--- a/modules/webrtc/webrtc_data_channel.cpp
+++ b/modules/webrtc/webrtc_data_channel.cpp
@@ -29,7 +29,7 @@
/*************************************************************************/
#include "webrtc_data_channel.h"
-#include "core/project_settings.h"
+#include "core/config/project_settings.h"
void WebRTCDataChannel::_bind_methods() {
ClassDB::bind_method(D_METHOD("poll"), &WebRTCDataChannel::poll);
diff --git a/modules/websocket/editor_debugger_server_websocket.cpp b/modules/websocket/editor_debugger_server_websocket.cpp
index 95ea7ceafa..8eb975b323 100644
--- a/modules/websocket/editor_debugger_server_websocket.cpp
+++ b/modules/websocket/editor_debugger_server_websocket.cpp
@@ -30,7 +30,7 @@
#include "editor_debugger_server_websocket.h"
-#include "core/project_settings.h"
+#include "core/config/project_settings.h"
#include "editor/editor_settings.h"
#include "modules/websocket/remote_debugger_peer_websocket.h"
diff --git a/modules/websocket/emws_client.cpp b/modules/websocket/emws_client.cpp
index 7c31449709..93d60dca08 100644
--- a/modules/websocket/emws_client.cpp
+++ b/modules/websocket/emws_client.cpp
@@ -31,8 +31,8 @@
#ifdef JAVASCRIPT_ENABLED
#include "emws_client.h"
+#include "core/config/project_settings.h"
#include "core/io/ip.h"
-#include "core/project_settings.h"
#include "emscripten.h"
extern "C" {
diff --git a/modules/websocket/emws_client.h b/modules/websocket/emws_client.h
index ab8a0612bb..58973c52fa 100644
--- a/modules/websocket/emws_client.h
+++ b/modules/websocket/emws_client.h
@@ -33,7 +33,7 @@
#ifdef JAVASCRIPT_ENABLED
-#include "core/error_list.h"
+#include "core/error/error_list.h"
#include "emws_peer.h"
#include "websocket_client.h"
diff --git a/modules/websocket/emws_peer.h b/modules/websocket/emws_peer.h
index 9c00f2d58b..c94d7e9148 100644
--- a/modules/websocket/emws_peer.h
+++ b/modules/websocket/emws_peer.h
@@ -33,9 +33,9 @@
#ifdef JAVASCRIPT_ENABLED
-#include "core/error_list.h"
+#include "core/error/error_list.h"
#include "core/io/packet_peer.h"
-#include "core/ring_buffer.h"
+#include "core/templates/ring_buffer.h"
#include "emscripten.h"
#include "packet_buffer.h"
#include "websocket_peer.h"
diff --git a/modules/websocket/emws_server.h b/modules/websocket/emws_server.h
index bb6f35a711..1ce17855fe 100644
--- a/modules/websocket/emws_server.h
+++ b/modules/websocket/emws_server.h
@@ -33,7 +33,7 @@
#ifdef JAVASCRIPT_ENABLED
-#include "core/reference.h"
+#include "core/object/reference.h"
#include "emws_peer.h"
#include "websocket_server.h"
diff --git a/modules/websocket/packet_buffer.h b/modules/websocket/packet_buffer.h
index 9973efe297..18b47b8d50 100644
--- a/modules/websocket/packet_buffer.h
+++ b/modules/websocket/packet_buffer.h
@@ -32,7 +32,7 @@
#define PACKET_BUFFER_H
#include "core/os/copymem.h"
-#include "core/ring_buffer.h"
+#include "core/templates/ring_buffer.h"
template <class T>
class PacketBuffer {
diff --git a/modules/websocket/register_types.cpp b/modules/websocket/register_types.cpp
index bc50de414e..8979a09619 100644
--- a/modules/websocket/register_types.cpp
+++ b/modules/websocket/register_types.cpp
@@ -29,8 +29,8 @@
/*************************************************************************/
#include "register_types.h"
-#include "core/error_macros.h"
-#include "core/project_settings.h"
+#include "core/config/project_settings.h"
+#include "core/error/error_macros.h"
#ifdef JAVASCRIPT_ENABLED
#include "emscripten.h"
#include "emws_client.h"
diff --git a/modules/websocket/remote_debugger_peer_websocket.cpp b/modules/websocket/remote_debugger_peer_websocket.cpp
index a67a959e31..9a72e460e2 100644
--- a/modules/websocket/remote_debugger_peer_websocket.cpp
+++ b/modules/websocket/remote_debugger_peer_websocket.cpp
@@ -30,7 +30,7 @@
#include "remote_debugger_peer_websocket.h"
-#include "core/project_settings.h"
+#include "core/config/project_settings.h"
Error RemoteDebuggerPeerWebSocket::connect_to_host(const String &p_uri) {
Vector<String> protocols;
diff --git a/modules/websocket/websocket_client.h b/modules/websocket/websocket_client.h
index 1053be22e3..2966dc480b 100644
--- a/modules/websocket/websocket_client.h
+++ b/modules/websocket/websocket_client.h
@@ -32,7 +32,7 @@
#define WEBSOCKET_CLIENT_H
#include "core/crypto/crypto.h"
-#include "core/error_list.h"
+#include "core/error/error_list.h"
#include "websocket_multiplayer_peer.h"
#include "websocket_peer.h"
diff --git a/modules/websocket/websocket_multiplayer_peer.h b/modules/websocket/websocket_multiplayer_peer.h
index af26aef21e..54daae23a6 100644
--- a/modules/websocket/websocket_multiplayer_peer.h
+++ b/modules/websocket/websocket_multiplayer_peer.h
@@ -31,9 +31,9 @@
#ifndef WEBSOCKET_MULTIPLAYER_PEER_H
#define WEBSOCKET_MULTIPLAYER_PEER_H
-#include "core/error_list.h"
+#include "core/error/error_list.h"
#include "core/io/networked_multiplayer_peer.h"
-#include "core/list.h"
+#include "core/templates/list.h"
#include "websocket_peer.h"
class WebSocketMultiplayerPeer : public NetworkedMultiplayerPeer {
diff --git a/modules/websocket/websocket_peer.h b/modules/websocket/websocket_peer.h
index a61943b615..729fdfd340 100644
--- a/modules/websocket/websocket_peer.h
+++ b/modules/websocket/websocket_peer.h
@@ -31,7 +31,7 @@
#ifndef WEBSOCKETPEER_H
#define WEBSOCKETPEER_H
-#include "core/error_list.h"
+#include "core/error/error_list.h"
#include "core/io/packet_peer.h"
#include "websocket_macros.h"
diff --git a/modules/websocket/websocket_server.h b/modules/websocket/websocket_server.h
index 064ad4f179..34ae52a1ee 100644
--- a/modules/websocket/websocket_server.h
+++ b/modules/websocket/websocket_server.h
@@ -32,7 +32,7 @@
#define WEBSOCKET_H
#include "core/crypto/crypto.h"
-#include "core/reference.h"
+#include "core/object/reference.h"
#include "websocket_multiplayer_peer.h"
#include "websocket_peer.h"
diff --git a/modules/websocket/wsl_client.cpp b/modules/websocket/wsl_client.cpp
index 7d16c2e99f..a2b81438df 100644
--- a/modules/websocket/wsl_client.cpp
+++ b/modules/websocket/wsl_client.cpp
@@ -31,8 +31,8 @@
#ifndef JAVASCRIPT_ENABLED
#include "wsl_client.h"
+#include "core/config/project_settings.h"
#include "core/io/ip.h"
-#include "core/project_settings.h"
void WSLClient::_do_handshake() {
if (_requested < _request.size() - 1) {
diff --git a/modules/websocket/wsl_client.h b/modules/websocket/wsl_client.h
index 8355a5a737..0141ea93ea 100644
--- a/modules/websocket/wsl_client.h
+++ b/modules/websocket/wsl_client.h
@@ -33,7 +33,7 @@
#ifndef JAVASCRIPT_ENABLED
-#include "core/error_list.h"
+#include "core/error/error_list.h"
#include "core/io/stream_peer_ssl.h"
#include "core/io/stream_peer_tcp.h"
#include "websocket_client.h"
diff --git a/modules/websocket/wsl_peer.h b/modules/websocket/wsl_peer.h
index fe4abfb64c..35ac18615a 100644
--- a/modules/websocket/wsl_peer.h
+++ b/modules/websocket/wsl_peer.h
@@ -33,10 +33,10 @@
#ifndef JAVASCRIPT_ENABLED
-#include "core/error_list.h"
+#include "core/error/error_list.h"
#include "core/io/packet_peer.h"
#include "core/io/stream_peer_tcp.h"
-#include "core/ring_buffer.h"
+#include "core/templates/ring_buffer.h"
#include "packet_buffer.h"
#include "websocket_peer.h"
#include "wslay/wslay.h"
diff --git a/modules/websocket/wsl_server.cpp b/modules/websocket/wsl_server.cpp
index da7bfc70c0..9a05967e4e 100644
--- a/modules/websocket/wsl_server.cpp
+++ b/modules/websocket/wsl_server.cpp
@@ -31,8 +31,8 @@
#ifndef JAVASCRIPT_ENABLED
#include "wsl_server.h"
+#include "core/config/project_settings.h"
#include "core/os/os.h"
-#include "core/project_settings.h"
WSLServer::PendingPeer::PendingPeer() {
use_ssl = false;
diff --git a/modules/xatlas_unwrap/register_types.cpp b/modules/xatlas_unwrap/register_types.cpp
index 6242009f67..65350518c3 100644
--- a/modules/xatlas_unwrap/register_types.cpp
+++ b/modules/xatlas_unwrap/register_types.cpp
@@ -30,7 +30,7 @@
#include "register_types.h"
-#include "core/error_macros.h"
+#include "core/error/error_macros.h"
#include "core/crypto/crypto_core.h"
diff --git a/platform/android/api/api.cpp b/platform/android/api/api.cpp
index 1f140f7119..8b82733d2d 100644
--- a/platform/android/api/api.cpp
+++ b/platform/android/api/api.cpp
@@ -30,7 +30,7 @@
#include "api.h"
-#include "core/engine.h"
+#include "core/config/engine.h"
#include "java_class_wrapper.h"
#include "jni_singleton.h"
diff --git a/platform/android/api/java_class_wrapper.h b/platform/android/api/java_class_wrapper.h
index 1fa2726784..4718de29ad 100644
--- a/platform/android/api/java_class_wrapper.h
+++ b/platform/android/api/java_class_wrapper.h
@@ -31,7 +31,7 @@
#ifndef JAVA_CLASS_WRAPPER_H
#define JAVA_CLASS_WRAPPER_H
-#include "core/reference.h"
+#include "core/object/reference.h"
#ifdef ANDROID_ENABLED
#include <android/log.h>
diff --git a/platform/android/api/jni_singleton.h b/platform/android/api/jni_singleton.h
index 5e63f20d6c..7f20c354a0 100644
--- a/platform/android/api/jni_singleton.h
+++ b/platform/android/api/jni_singleton.h
@@ -31,8 +31,8 @@
#ifndef JNI_SINGLETON_H
#define JNI_SINGLETON_H
-#include <core/engine.h>
-#include <core/variant.h>
+#include <core/config/engine.h>
+#include <core/variant/variant.h>
#ifdef ANDROID_ENABLED
#include <platform/android/jni_utils.h>
#endif
diff --git a/platform/android/audio_driver_jandroid.cpp b/platform/android/audio_driver_jandroid.cpp
index 09c981b3fa..1363c5ac1e 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 "core/config/project_settings.h"
#include "core/os/os.h"
-#include "core/project_settings.h"
#include "thread_jandroid.h"
AudioDriverAndroid *AudioDriverAndroid::s_ad = nullptr;
diff --git a/platform/android/dir_access_jandroid.cpp b/platform/android/dir_access_jandroid.cpp
index ca312b427f..ba75a4b10c 100644
--- a/platform/android/dir_access_jandroid.cpp
+++ b/platform/android/dir_access_jandroid.cpp
@@ -29,7 +29,7 @@
/*************************************************************************/
#include "dir_access_jandroid.h"
-#include "core/print_string.h"
+#include "core/string/print_string.h"
#include "file_access_jandroid.h"
#include "string_android.h"
#include "thread_jandroid.h"
diff --git a/platform/android/display_server_android.cpp b/platform/android/display_server_android.cpp
index d6d64b0265..e82a12ece5 100644
--- a/platform/android/display_server_android.cpp
+++ b/platform/android/display_server_android.cpp
@@ -31,7 +31,7 @@
#include "display_server_android.h"
#include "android_keys_utils.h"
-#include "core/project_settings.h"
+#include "core/config/project_settings.h"
#include "java_godot_io_wrapper.h"
#include "java_godot_wrapper.h"
#include "os_android.h"
diff --git a/platform/android/export/export.cpp b/platform/android/export/export.cpp
index 943a473717..5007b3f570 100644
--- a/platform/android/export/export.cpp
+++ b/platform/android/export/export.cpp
@@ -31,13 +31,13 @@
#include "export.h"
#include "gradle_export_util.h"
+#include "core/config/project_settings.h"
#include "core/io/image_loader.h"
#include "core/io/marshalls.h"
#include "core/io/zip_io.h"
#include "core/os/dir_access.h"
#include "core/os/file_access.h"
#include "core/os/os.h"
-#include "core/project_settings.h"
#include "core/version.h"
#include "drivers/png/png_driver_common.h"
#include "editor/editor_export.h"
diff --git a/platform/android/file_access_android.cpp b/platform/android/file_access_android.cpp
index 05d5fb576d..11faeff3e8 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 "core/print_string.h"
+#include "core/string/print_string.h"
AAssetManager *FileAccessAndroid::asset_manager = nullptr;
diff --git a/platform/android/java_godot_io_wrapper.cpp b/platform/android/java_godot_io_wrapper.cpp
index eec385f44e..8d1db395ab 100644
--- a/platform/android/java_godot_io_wrapper.cpp
+++ b/platform/android/java_godot_io_wrapper.cpp
@@ -29,7 +29,7 @@
/*************************************************************************/
#include "java_godot_io_wrapper.h"
-#include "core/error_list.h"
+#include "core/error/error_list.h"
// JNIEnv is only valid within the thread it belongs to, in a multi threading environment
// we can't cache it.
diff --git a/platform/android/java_godot_lib_jni.cpp b/platform/android/java_godot_lib_jni.cpp
index 35bd53a958..5dc773fae2 100644
--- a/platform/android/java_godot_lib_jni.cpp
+++ b/platform/android/java_godot_lib_jni.cpp
@@ -37,9 +37,9 @@
#include "api/java_class_wrapper.h"
#include "api/jni_singleton.h"
#include "audio_driver_jandroid.h"
-#include "core/engine.h"
+#include "core/config/engine.h"
+#include "core/config/project_settings.h"
#include "core/input/input.h"
-#include "core/project_settings.h"
#include "dir_access_jandroid.h"
#include "display_server_android.h"
#include "file_access_android.h"
diff --git a/platform/android/jni_utils.h b/platform/android/jni_utils.h
index 5320715853..bda056604f 100644
--- a/platform/android/jni_utils.h
+++ b/platform/android/jni_utils.h
@@ -32,8 +32,8 @@
#define JNI_UTILS_H
#include "string_android.h"
-#include <core/engine.h>
-#include <core/variant.h>
+#include <core/config/engine.h>
+#include <core/variant/variant.h>
#include <jni.h>
struct jvalret {
diff --git a/platform/android/os_android.cpp b/platform/android/os_android.cpp
index cde3abe20c..00733f6dbb 100644
--- a/platform/android/os_android.cpp
+++ b/platform/android/os_android.cpp
@@ -30,8 +30,8 @@
#include "os_android.h"
+#include "core/config/project_settings.h"
#include "core/io/file_access_buffered_fa.h"
-#include "core/project_settings.h"
#include "drivers/unix/dir_access_unix.h"
#include "drivers/unix/file_access_unix.h"
#include "file_access_android.h"
diff --git a/platform/android/plugin/godot_plugin_config.h b/platform/android/plugin/godot_plugin_config.h
index ea3c7b4f55..ecb9c0c7f5 100644
--- a/platform/android/plugin/godot_plugin_config.h
+++ b/platform/android/plugin/godot_plugin_config.h
@@ -31,9 +31,9 @@
#ifndef GODOT_PLUGIN_CONFIG_H
#define GODOT_PLUGIN_CONFIG_H
-#include "core/error_list.h"
+#include "core/error/error_list.h"
#include "core/io/config_file.h"
-#include "core/ustring.h"
+#include "core/string/ustring.h"
static const char *PLUGIN_CONFIG_EXT = ".gdap";
diff --git a/platform/android/plugin/godot_plugin_jni.cpp b/platform/android/plugin/godot_plugin_jni.cpp
index d2528bebeb..b8e5345b85 100644
--- a/platform/android/plugin/godot_plugin_jni.cpp
+++ b/platform/android/plugin/godot_plugin_jni.cpp
@@ -30,9 +30,9 @@
#include "godot_plugin_jni.h"
-#include <core/engine.h>
-#include <core/error_macros.h>
-#include <core/project_settings.h>
+#include <core/config/engine.h>
+#include <core/config/project_settings.h>
+#include <core/error/error_macros.h>
#include <platform/android/api/jni_singleton.h>
#include <platform/android/jni_utils.h>
#include <platform/android/string_android.h>
diff --git a/platform/android/string_android.h b/platform/android/string_android.h
index 88ccd3b652..0a7dbf475d 100644
--- a/platform/android/string_android.h
+++ b/platform/android/string_android.h
@@ -30,7 +30,7 @@
#ifndef STRING_ANDROID_H
#define STRING_ANDROID_H
-#include "core/ustring.h"
+#include "core/string/ustring.h"
#include "thread_jandroid.h"
#include <jni.h>
diff --git a/platform/android/thread_jandroid.cpp b/platform/android/thread_jandroid.cpp
index 13aa313ebf..442e4d781b 100644
--- a/platform/android/thread_jandroid.cpp
+++ b/platform/android/thread_jandroid.cpp
@@ -30,9 +30,9 @@
#include "thread_jandroid.h"
+#include "core/object/script_language.h"
#include "core/os/memory.h"
-#include "core/safe_refcount.h"
-#include "core/script_language.h"
+#include "core/templates/safe_refcount.h"
static void _thread_id_key_destr_callback(void *p_value) {
memdelete(static_cast<Thread::ID *>(p_value));
diff --git a/platform/iphone/app_delegate.mm b/platform/iphone/app_delegate.mm
index 40a63d7ad2..c9891309fe 100644
--- a/platform/iphone/app_delegate.mm
+++ b/platform/iphone/app_delegate.mm
@@ -29,7 +29,7 @@
/*************************************************************************/
#import "app_delegate.h"
-#include "core/project_settings.h"
+#include "core/config/project_settings.h"
#include "drivers/coreaudio/audio_driver_coreaudio.h"
#import "godot_view.h"
#include "main/main.h"
diff --git a/platform/iphone/detect.py b/platform/iphone/detect.py
index 5ebabdd3dc..ab453c353f 100644
--- a/platform/iphone/detect.py
+++ b/platform/iphone/detect.py
@@ -119,7 +119,7 @@ def configure(env):
arch_flag = "i386" if env["arch"] == "x86" else env["arch"]
env.Append(
CCFLAGS=(
- "-arch "
+ "-fobjc-arc -arch "
+ arch_flag
+ " -fobjc-abi-version=2 -fobjc-legacy-dispatch -fmessage-length=0 -fpascal-strings -fblocks"
" -fasm-blocks -isysroot $IPHONESDK -mios-simulator-version-min=13.0"
diff --git a/platform/iphone/display_layer.mm b/platform/iphone/display_layer.mm
index 2716538b89..7420a5ebe6 100644
--- a/platform/iphone/display_layer.mm
+++ b/platform/iphone/display_layer.mm
@@ -29,8 +29,8 @@
/*************************************************************************/
#import "display_layer.h"
+#include "core/config/project_settings.h"
#include "core/os/keyboard.h"
-#include "core/project_settings.h"
#include "display_server_iphone.h"
#include "main/main.h"
#include "os_iphone.h"
diff --git a/platform/iphone/display_server_iphone.mm b/platform/iphone/display_server_iphone.mm
index d456f9cbf6..6fa5e6ee4a 100644
--- a/platform/iphone/display_server_iphone.mm
+++ b/platform/iphone/display_server_iphone.mm
@@ -30,8 +30,8 @@
#include "display_server_iphone.h"
#import "app_delegate.h"
+#include "core/config/project_settings.h"
#include "core/io/file_access_pack.h"
-#include "core/project_settings.h"
#import "device_metrics.h"
#import "godot_view.h"
#include "ios.h"
diff --git a/platform/iphone/export/export.cpp b/platform/iphone/export/export.cpp
index 19f7c8e482..cf46883b92 100644
--- a/platform/iphone/export/export.cpp
+++ b/platform/iphone/export/export.cpp
@@ -30,13 +30,13 @@
#include "export.h"
+#include "core/config/project_settings.h"
#include "core/io/image_loader.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"
diff --git a/platform/iphone/game_center.h b/platform/iphone/game_center.h
index 10c8ef52fb..cbfd616e56 100644
--- a/platform/iphone/game_center.h
+++ b/platform/iphone/game_center.h
@@ -33,7 +33,7 @@
#ifndef GAME_CENTER_H
#define GAME_CENTER_H
-#include "core/class_db.h"
+#include "core/object/class_db.h"
class GameCenter : public Object {
GDCLASS(GameCenter, Object);
diff --git a/platform/iphone/godot_iphone.mm b/platform/iphone/godot_iphone.mm
index 6d95276f37..a4119bcafd 100644
--- a/platform/iphone/godot_iphone.mm
+++ b/platform/iphone/godot_iphone.mm
@@ -28,7 +28,7 @@
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
/*************************************************************************/
-#include "core/ustring.h"
+#include "core/string/ustring.h"
#include "main/main.h"
#include "os_iphone.h"
diff --git a/platform/iphone/godot_view.mm b/platform/iphone/godot_view.mm
index 3b4344c46d..eaf7e962ce 100644
--- a/platform/iphone/godot_view.mm
+++ b/platform/iphone/godot_view.mm
@@ -30,7 +30,7 @@
#import "godot_view.h"
#include "core/os/keyboard.h"
-#include "core/ustring.h"
+#include "core/string/ustring.h"
#import "display_layer.h"
#include "display_server_iphone.h"
#import "godot_view_gesture_recognizer.h"
diff --git a/platform/iphone/godot_view_gesture_recognizer.mm b/platform/iphone/godot_view_gesture_recognizer.mm
index 71367a629c..91cc07fcf6 100644
--- a/platform/iphone/godot_view_gesture_recognizer.mm
+++ b/platform/iphone/godot_view_gesture_recognizer.mm
@@ -30,7 +30,7 @@
#import "godot_view_gesture_recognizer.h"
-#include "core/project_settings.h"
+#include "core/config/project_settings.h"
// Minimum distance for touches to move to fire
// a delay timer before scheduled time.
diff --git a/platform/iphone/godot_view_renderer.mm b/platform/iphone/godot_view_renderer.mm
index 045fb451f0..f2ff417e6f 100644
--- a/platform/iphone/godot_view_renderer.mm
+++ b/platform/iphone/godot_view_renderer.mm
@@ -29,8 +29,8 @@
/*************************************************************************/
#import "godot_view_renderer.h"
+#include "core/config/project_settings.h"
#include "core/os/keyboard.h"
-#include "core/project_settings.h"
#import "display_server_iphone.h"
#include "main/main.h"
#include "os_iphone.h"
diff --git a/platform/iphone/icloud.h b/platform/iphone/icloud.h
index 6ca1e6594a..5f59abdfc0 100644
--- a/platform/iphone/icloud.h
+++ b/platform/iphone/icloud.h
@@ -33,7 +33,7 @@
#ifndef ICLOUD_H
#define ICLOUD_H
-#include "core/class_db.h"
+#include "core/object/class_db.h"
class ICloud : public Object {
GDCLASS(ICloud, Object);
diff --git a/platform/iphone/in_app_store.h b/platform/iphone/in_app_store.h
index 1b8f84ec7b..85075e4e20 100644
--- a/platform/iphone/in_app_store.h
+++ b/platform/iphone/in_app_store.h
@@ -33,7 +33,7 @@
#ifndef IN_APP_STORE_H
#define IN_APP_STORE_H
-#include "core/class_db.h"
+#include "core/object/class_db.h"
#ifdef __OBJC__
@class GodotProductsDelegate;
diff --git a/platform/iphone/ios.h b/platform/iphone/ios.h
index 6a89cd38cb..5415c36cd9 100644
--- a/platform/iphone/ios.h
+++ b/platform/iphone/ios.h
@@ -31,7 +31,7 @@
#ifndef IOS_H
#define IOS_H
-#include "core/class_db.h"
+#include "core/object/class_db.h"
class iOS : public Object {
GDCLASS(iOS, Object);
diff --git a/platform/iphone/joypad_iphone.mm b/platform/iphone/joypad_iphone.mm
index b0a8076b56..22d7dd4bd2 100644
--- a/platform/iphone/joypad_iphone.mm
+++ b/platform/iphone/joypad_iphone.mm
@@ -29,7 +29,7 @@
/*************************************************************************/
#import "joypad_iphone.h"
-#include "core/project_settings.h"
+#include "core/config/project_settings.h"
#include "drivers/coreaudio/audio_driver_coreaudio.h"
#include "main/main.h"
diff --git a/platform/iphone/os_iphone.mm b/platform/iphone/os_iphone.mm
index e007276b4b..32e9dda92b 100644
--- a/platform/iphone/os_iphone.mm
+++ b/platform/iphone/os_iphone.mm
@@ -32,10 +32,10 @@
#include "os_iphone.h"
#import "app_delegate.h"
+#include "core/config/project_settings.h"
#include "core/io/file_access_pack.h"
#include "core/os/dir_access.h"
#include "core/os/file_access.h"
-#include "core/project_settings.h"
#include "display_server_iphone.h"
#include "drivers/unix/syslog_logger.h"
#import "godot_view.h"
diff --git a/platform/iphone/view_controller.mm b/platform/iphone/view_controller.mm
index fb25041779..e11eff423b 100644
--- a/platform/iphone/view_controller.mm
+++ b/platform/iphone/view_controller.mm
@@ -29,7 +29,7 @@
/*************************************************************************/
#import "view_controller.h"
-#include "core/project_settings.h"
+#include "core/config/project_settings.h"
#include "display_server_iphone.h"
#import "godot_view.h"
#import "godot_view_renderer.h"
diff --git a/platform/javascript/api/api.cpp b/platform/javascript/api/api.cpp
index aa0206d144..6fd6c0ddf1 100644
--- a/platform/javascript/api/api.cpp
+++ b/platform/javascript/api/api.cpp
@@ -29,7 +29,7 @@
/*************************************************************************/
#include "api.h"
-#include "core/engine.h"
+#include "core/config/engine.h"
#include "javascript_eval.h"
#include "javascript_tools_editor_plugin.h"
diff --git a/platform/javascript/api/javascript_eval.h b/platform/javascript/api/javascript_eval.h
index 26b5b9e484..389983077e 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 "core/class_db.h"
+#include "core/object/class_db.h"
class JavaScript : public Object {
private:
diff --git a/platform/javascript/api/javascript_tools_editor_plugin.cpp b/platform/javascript/api/javascript_tools_editor_plugin.cpp
index e487bf23b7..d44e8139a1 100644
--- a/platform/javascript/api/javascript_tools_editor_plugin.cpp
+++ b/platform/javascript/api/javascript_tools_editor_plugin.cpp
@@ -31,10 +31,10 @@
#if defined(TOOLS_ENABLED) && defined(JAVASCRIPT_ENABLED)
#include "javascript_tools_editor_plugin.h"
-#include "core/engine.h"
+#include "core/config/engine.h"
+#include "core/config/project_settings.h"
#include "core/os/dir_access.h"
#include "core/os/file_access.h"
-#include "core/project_settings.h"
#include "editor/editor_node.h"
#include <emscripten/emscripten.h>
diff --git a/platform/javascript/audio_driver_javascript.cpp b/platform/javascript/audio_driver_javascript.cpp
index 6ea948004e..ab6ed54cc8 100644
--- a/platform/javascript/audio_driver_javascript.cpp
+++ b/platform/javascript/audio_driver_javascript.cpp
@@ -30,7 +30,7 @@
#include "audio_driver_javascript.h"
-#include "core/project_settings.h"
+#include "core/config/project_settings.h"
#include "godot_audio.h"
#include <emscripten.h>
@@ -100,7 +100,7 @@ Error AudioDriverJavaScript::init() {
int latency = GLOBAL_GET("audio/output_latency");
channel_count = godot_audio_init(mix_rate, latency);
- buffer_length = closest_power_of_2((latency * mix_rate / 1000) * channel_count);
+ buffer_length = closest_power_of_2(latency * mix_rate / 1000);
buffer_length = godot_audio_create_processor(buffer_length, channel_count);
if (!buffer_length) {
return FAILED;
diff --git a/platform/javascript/native/library_godot_audio.js b/platform/javascript/native/library_godot_audio.js
index d300280ccd..4e7f3e2af5 100644
--- a/platform/javascript/native/library_godot_audio.js
+++ b/platform/javascript/native/library_godot_audio.js
@@ -47,7 +47,7 @@ var GodotAudio = {
godot_audio_init: function(mix_rate, latency) {
GodotAudio.ctx = new (window.AudioContext || window.webkitAudioContext)({
sampleRate: mix_rate,
- latencyHint: latency
+ // latencyHint: latency / 1000 // Do not specify, leave 'interactive' for good performance.
});
return GodotAudio.ctx.destination.channelCount;
},
diff --git a/platform/linuxbsd/SCsub b/platform/linuxbsd/SCsub
index ae75a75830..6e43ffcedb 100644
--- a/platform/linuxbsd/SCsub
+++ b/platform/linuxbsd/SCsub
@@ -18,5 +18,5 @@ common_x11 = [
prog = env.add_program("#bin/godot", ["godot_linuxbsd.cpp"] + common_x11)
-if (env["debug_symbols"] == "full" or env["debug_symbols"] == "yes") and env["separate_debug_symbols"]:
+if env["debug_symbols"] == "yes" and env["separate_debug_symbols"]:
env.AddPostAction(prog, run_in_subprocess(platform_linuxbsd_builders.make_debug_linuxbsd))
diff --git a/platform/linuxbsd/crash_handler_linuxbsd.cpp b/platform/linuxbsd/crash_handler_linuxbsd.cpp
index e2b88b7704..36c304b7f9 100644
--- a/platform/linuxbsd/crash_handler_linuxbsd.cpp
+++ b/platform/linuxbsd/crash_handler_linuxbsd.cpp
@@ -30,8 +30,8 @@
#include "crash_handler_linuxbsd.h"
+#include "core/config/project_settings.h"
#include "core/os/os.h"
-#include "core/project_settings.h"
#include "main/main.h"
#ifdef DEBUG_ENABLED
diff --git a/platform/linuxbsd/detect.py b/platform/linuxbsd/detect.py
index f5e2c72bbc..ea101e24dd 100644
--- a/platform/linuxbsd/detect.py
+++ b/platform/linuxbsd/detect.py
@@ -73,7 +73,7 @@ def get_opts():
BoolVariable("use_tsan", "Use LLVM/GCC compiler thread sanitizer (TSAN))", False),
BoolVariable("pulseaudio", "Detect and use PulseAudio", True),
BoolVariable("udev", "Use udev for gamepad connection callbacks", False),
- EnumVariable("debug_symbols", "Add debugging symbols to release builds", "yes", ("yes", "no", "full")),
+ EnumVariable("debug_symbols", "Add debugging symbols to release/release_debug builds", "yes", ("yes", "no")),
BoolVariable("separate_debug_symbols", "Create a separate file containing debugging symbols", False),
BoolVariable("touch", "Enable touch events", True),
BoolVariable("execinfo", "Use libexecinfo on systems where glibc is not available", False),
@@ -96,8 +96,6 @@ def configure(env):
env.Prepend(CCFLAGS=["-Os"])
if env["debug_symbols"] == "yes":
- env.Prepend(CCFLAGS=["-g1"])
- if env["debug_symbols"] == "full":
env.Prepend(CCFLAGS=["-g2"])
elif env["target"] == "release_debug":
@@ -108,8 +106,6 @@ def configure(env):
env.Prepend(CPPDEFINES=["DEBUG_ENABLED"])
if env["debug_symbols"] == "yes":
- env.Prepend(CCFLAGS=["-g1"])
- if env["debug_symbols"] == "full":
env.Prepend(CCFLAGS=["-g2"])
elif env["target"] == "debug":
diff --git a/platform/linuxbsd/detect_prime_x11.cpp b/platform/linuxbsd/detect_prime_x11.cpp
index 1e46d3222d..e5a9bb4737 100644
--- a/platform/linuxbsd/detect_prime_x11.cpp
+++ b/platform/linuxbsd/detect_prime_x11.cpp
@@ -33,8 +33,8 @@
#include "detect_prime.h"
-#include "core/print_string.h"
-#include "core/ustring.h"
+#include "core/string/print_string.h"
+#include "core/string/ustring.h"
#include <stdlib.h>
diff --git a/platform/linuxbsd/display_server_x11.cpp b/platform/linuxbsd/display_server_x11.cpp
index 176878bc12..35418116b4 100644
--- a/platform/linuxbsd/display_server_x11.cpp
+++ b/platform/linuxbsd/display_server_x11.cpp
@@ -32,8 +32,8 @@
#ifdef X11_ENABLED
-#include "core/print_string.h"
-#include "core/project_settings.h"
+#include "core/config/project_settings.h"
+#include "core/string/print_string.h"
#include "detect_prime_x11.h"
#include "key_mapping_x11.h"
#include "main/main.h"
diff --git a/platform/linuxbsd/display_server_x11.h b/platform/linuxbsd/display_server_x11.h
index 740bf81fd9..9ff28b9ed2 100644
--- a/platform/linuxbsd/display_server_x11.h
+++ b/platform/linuxbsd/display_server_x11.h
@@ -36,7 +36,7 @@
#include "servers/display_server.h"
#include "core/input/input.h"
-#include "core/local_vector.h"
+#include "core/templates/local_vector.h"
#include "drivers/alsa/audio_driver_alsa.h"
#include "drivers/alsamidi/midi_driver_alsamidi.h"
#include "drivers/pulseaudio/audio_driver_pulseaudio.h"
diff --git a/platform/osx/SCsub b/platform/osx/SCsub
index ad62db358b..aa95a89444 100644
--- a/platform/osx/SCsub
+++ b/platform/osx/SCsub
@@ -18,5 +18,5 @@ files = [
prog = env.add_program("#bin/godot", files)
-if (env["debug_symbols"] == "full" or env["debug_symbols"] == "yes") and env["separate_debug_symbols"]:
+if env["debug_symbols"] == "yes" and env["separate_debug_symbols"]:
env.AddPostAction(prog, run_in_subprocess(platform_osx_builders.make_debug_osx))
diff --git a/platform/osx/context_gl_osx.h b/platform/osx/context_gl_osx.h
index cce00fb35f..1d467513e2 100644
--- a/platform/osx/context_gl_osx.h
+++ b/platform/osx/context_gl_osx.h
@@ -33,7 +33,7 @@
#if defined(OPENGL_ENABLED) || defined(GLES_ENABLED)
-#include "core/error_list.h"
+#include "core/error/error_list.h"
#include "core/os/os.h"
#include <AppKit/AppKit.h>
diff --git a/platform/osx/crash_handler_osx.mm b/platform/osx/crash_handler_osx.mm
index 9fb2f63935..1429024598 100644
--- a/platform/osx/crash_handler_osx.mm
+++ b/platform/osx/crash_handler_osx.mm
@@ -30,8 +30,8 @@
#include "crash_handler_osx.h"
+#include "core/config/project_settings.h"
#include "core/os/os.h"
-#include "core/project_settings.h"
#include "main/main.h"
#include <string.h>
diff --git a/platform/osx/detect.py b/platform/osx/detect.py
index 50e9bd2653..64e1d94f39 100644
--- a/platform/osx/detect.py
+++ b/platform/osx/detect.py
@@ -31,7 +31,7 @@ def get_opts():
" validation layers)",
False,
),
- EnumVariable("debug_symbols", "Add debugging symbols to release builds", "yes", ("yes", "no", "full")),
+ EnumVariable("debug_symbols", "Add debugging symbols to release/release_debug builds", "yes", ("yes", "no")),
BoolVariable("separate_debug_symbols", "Create a separate file containing debugging symbols", False),
BoolVariable("use_ubsan", "Use LLVM/GCC compiler undefined behavior sanitizer (UBSAN)", False),
BoolVariable("use_asan", "Use LLVM/GCC compiler address sanitizer (ASAN))", False),
@@ -57,8 +57,6 @@ def configure(env):
env.Prepend(CCFLAGS=["-msse2"])
if env["debug_symbols"] == "yes":
- env.Prepend(CCFLAGS=["-g1"])
- if env["debug_symbols"] == "full":
env.Prepend(CCFLAGS=["-g2"])
elif env["target"] == "release_debug":
@@ -68,8 +66,6 @@ def configure(env):
env.Prepend(CCFLAGS=["-Os"])
env.Prepend(CPPDEFINES=["DEBUG_ENABLED"])
if env["debug_symbols"] == "yes":
- env.Prepend(CCFLAGS=["-g1"])
- if env["debug_symbols"] == "full":
env.Prepend(CCFLAGS=["-g2"])
elif env["target"] == "debug":
diff --git a/platform/osx/export/export.cpp b/platform/osx/export/export.cpp
index 9f2160dd9e..e988e51e72 100644
--- a/platform/osx/export/export.cpp
+++ b/platform/osx/export/export.cpp
@@ -30,13 +30,13 @@
#include "export.h"
+#include "core/config/project_settings.h"
#include "core/io/marshalls.h"
#include "core/io/resource_saver.h"
#include "core/io/zip_io.h"
#include "core/os/dir_access.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"
diff --git a/platform/server/detect.py b/platform/server/detect.py
index 4c5a4527ae..f9e151f956 100644
--- a/platform/server/detect.py
+++ b/platform/server/detect.py
@@ -39,7 +39,7 @@ def get_opts():
BoolVariable("use_asan", "Use LLVM/GCC compiler address sanitizer (ASAN))", False),
BoolVariable("use_lsan", "Use LLVM/GCC compiler leak sanitizer (LSAN))", False),
BoolVariable("use_tsan", "Use LLVM/GCC compiler thread sanitizer (TSAN))", False),
- EnumVariable("debug_symbols", "Add debugging symbols to release builds", "yes", ("yes", "no", "full")),
+ EnumVariable("debug_symbols", "Add debugging symbols to release/release_debug builds", "yes", ("yes", "no")),
BoolVariable("separate_debug_symbols", "Create a separate file containing debugging symbols", False),
BoolVariable("execinfo", "Use libexecinfo on systems where glibc is not available", False),
]
@@ -61,8 +61,6 @@ def configure(env):
env.Prepend(CCFLAGS=["-Os"])
if env["debug_symbols"] == "yes":
- env.Prepend(CCFLAGS=["-g1"])
- if env["debug_symbols"] == "full":
env.Prepend(CCFLAGS=["-g2"])
elif env["target"] == "release_debug":
@@ -73,8 +71,6 @@ def configure(env):
env.Prepend(CPPDEFINES=["DEBUG_ENABLED"])
if env["debug_symbols"] == "yes":
- env.Prepend(CCFLAGS=["-g1"])
- if env["debug_symbols"] == "full":
env.Prepend(CCFLAGS=["-g2"])
elif env["target"] == "debug":
diff --git a/platform/server/os_server.cpp b/platform/server/os_server.cpp
index fbe526ef6d..9937ae5b62 100644
--- a/platform/server/os_server.cpp
+++ b/platform/server/os_server.cpp
@@ -30,7 +30,7 @@
#include "os_server.h"
-#include "core/print_string.h"
+#include "core/string/print_string.h"
#include "drivers/dummy/rasterizer_dummy.h"
#include "drivers/dummy/texture_loader_dummy.h"
#include "servers/rendering/rendering_server_raster.h"
diff --git a/platform/uwp/context_egl_uwp.h b/platform/uwp/context_egl_uwp.h
index 6f333b8e6a..5e7dc1802d 100644
--- a/platform/uwp/context_egl_uwp.h
+++ b/platform/uwp/context_egl_uwp.h
@@ -35,7 +35,7 @@
#include <EGL/egl.h>
-#include "core/error_list.h"
+#include "core/error/error_list.h"
#include "core/os/os.h"
using namespace Windows::UI::Core;
diff --git a/platform/uwp/export/export.cpp b/platform/uwp/export/export.cpp
index e9e536837f..e0c03df48e 100644
--- a/platform/uwp/export/export.cpp
+++ b/platform/uwp/export/export.cpp
@@ -30,14 +30,14 @@
#include "export.h"
-#include "core/bind/core_bind.h"
-#include "core/class_db.h"
+#include "core/config/project_settings.h"
+#include "core/core_bind.h"
#include "core/crypto/crypto_core.h"
#include "core/io/marshalls.h"
#include "core/io/zip_io.h"
+#include "core/object/class_db.h"
#include "core/os/dir_access.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"
diff --git a/platform/uwp/os_uwp.cpp b/platform/uwp/os_uwp.cpp
index 44ab075816..79508055e5 100644
--- a/platform/uwp/os_uwp.cpp
+++ b/platform/uwp/os_uwp.cpp
@@ -33,8 +33,8 @@
#include "os_uwp.h"
+#include "core/config/project_settings.h"
#include "core/io/marshalls.h"
-#include "core/project_settings.h"
#include "drivers/unix/ip_unix.h"
#include "drivers/windows/dir_access_windows.h"
#include "drivers/windows/file_access_windows.h"
diff --git a/platform/uwp/os_uwp.h b/platform/uwp/os_uwp.h
index 892327bac5..88961bf143 100644
--- a/platform/uwp/os_uwp.h
+++ b/platform/uwp/os_uwp.h
@@ -35,7 +35,7 @@
#include "core/input/input.h"
#include "core/math/transform_2d.h"
#include "core/os/os.h"
-#include "core/ustring.h"
+#include "core/string/ustring.h"
#include "drivers/xaudio2/audio_driver_xaudio2.h"
#include "joypad_uwp.h"
#include "servers/audio_server.h"
diff --git a/platform/windows/SCsub b/platform/windows/SCsub
index e3f86977a4..0c9aa77803 100644
--- a/platform/windows/SCsub
+++ b/platform/windows/SCsub
@@ -32,5 +32,5 @@ if env["vsproj"]:
env.vs_srcs += ["platform/windows/" + str(x)]
if not os.getenv("VCINSTALLDIR"):
- if (env["debug_symbols"] == "full" or env["debug_symbols"] == "yes") and env["separate_debug_symbols"]:
+ if env["debug_symbols"] == "yes" and env["separate_debug_symbols"]:
env.AddPostAction(prog, run_in_subprocess(platform_windows_builders.make_debug_mingw))
diff --git a/platform/windows/context_gl_windows.h b/platform/windows/context_gl_windows.h
index 046e3437ea..0013177609 100644
--- a/platform/windows/context_gl_windows.h
+++ b/platform/windows/context_gl_windows.h
@@ -35,7 +35,7 @@
#ifndef CONTEXT_GL_WIN_H
#define CONTEXT_GL_WIN_H
-#include "core/error_list.h"
+#include "core/error/error_list.h"
#include "core/os/os.h"
#include <windows.h>
diff --git a/platform/windows/crash_handler_windows.cpp b/platform/windows/crash_handler_windows.cpp
index 02031ef6bb..7abf451062 100644
--- a/platform/windows/crash_handler_windows.cpp
+++ b/platform/windows/crash_handler_windows.cpp
@@ -30,8 +30,8 @@
#include "crash_handler_windows.h"
+#include "core/config/project_settings.h"
#include "core/os/os.h"
-#include "core/project_settings.h"
#include "main/main.h"
#ifdef CRASH_HANDLER_EXCEPTION
diff --git a/platform/windows/detect.py b/platform/windows/detect.py
index 489e45404f..934314b2f2 100644
--- a/platform/windows/detect.py
+++ b/platform/windows/detect.py
@@ -64,7 +64,7 @@ def get_opts():
# XP support dropped after EOL due to missing API for IPv6 and other issues
# Vista support dropped after EOL due to GH-10243
("target_win_version", "Targeted Windows version, >= 0x0601 (Windows 7)", "0x0601"),
- EnumVariable("debug_symbols", "Add debugging symbols to release builds", "yes", ("yes", "no", "full")),
+ EnumVariable("debug_symbols", "Add debugging symbols to release/release_debug builds", "yes", ("yes", "no")),
EnumVariable("windows_subsystem", "Windows subsystem", "default", ("default", "console", "gui")),
BoolVariable("separate_debug_symbols", "Create a separate file containing debugging symbols", False),
("msvc_version", "MSVC version to use. Ignored if VCINSTALLDIR is set in shell env.", None),
@@ -209,7 +209,7 @@ def configure_msvc(env, manual_msvc_config):
env.AppendUnique(CPPDEFINES=["DEBUG_ENABLED"])
env.Append(LINKFLAGS=["/DEBUG"])
- if env["debug_symbols"] == "full" or env["debug_symbols"] == "yes":
+ if env["debug_symbols"] == "yes":
env.AppendUnique(CCFLAGS=["/Z7"])
env.AppendUnique(LINKFLAGS=["/DEBUG"])
@@ -337,16 +337,12 @@ def configure_mingw(env):
env.Prepend(CCFLAGS=["-Os"])
if env["debug_symbols"] == "yes":
- env.Prepend(CCFLAGS=["-g1"])
- if env["debug_symbols"] == "full":
env.Prepend(CCFLAGS=["-g2"])
elif env["target"] == "release_debug":
env.Append(CCFLAGS=["-O2"])
env.Append(CPPDEFINES=["DEBUG_ENABLED"])
if env["debug_symbols"] == "yes":
- env.Prepend(CCFLAGS=["-g1"])
- if env["debug_symbols"] == "full":
env.Prepend(CCFLAGS=["-g2"])
if env["optimize"] == "speed": # optimize for speed (default)
env.Append(CCFLAGS=["-O2"])
diff --git a/platform/windows/display_server_windows.h b/platform/windows/display_server_windows.h
index 0fca2589ae..c64a1b3b09 100644
--- a/platform/windows/display_server_windows.h
+++ b/platform/windows/display_server_windows.h
@@ -33,9 +33,9 @@
#include "servers/display_server.h"
+#include "core/config/project_settings.h"
#include "core/input/input.h"
#include "core/os/os.h"
-#include "core/project_settings.h"
#include "crash_handler_windows.h"
#include "drivers/unix/ip_unix.h"
#include "drivers/wasapi/audio_driver_wasapi.h"
diff --git a/platform/windows/godot.natvis b/platform/windows/godot.natvis
index 90f0b55d0a..1f625cfb77 100644
--- a/platform/windows/godot.natvis
+++ b/platform/windows/godot.natvis
@@ -49,7 +49,7 @@
<DisplayString Condition="type == Variant::QUAT">{*(Quat *)_data._mem}</DisplayString>
<DisplayString Condition="type == Variant::COLOR">{*(Color *)_data._mem}</DisplayString>
<DisplayString Condition="type == Variant::NODE_PATH">{*(NodePath *)_data._mem}</DisplayString>
- <DisplayString Condition="type == Variant::_RID">{*(RID *)_data._mem}</DisplayString>
+ <DisplayString Condition="type == Variant::RID">{*(RID *)_data._mem}</DisplayString>
<DisplayString Condition="type == Variant::OBJECT">{*(Object *)_data._mem}</DisplayString>
<DisplayString Condition="type == Variant::DICTIONARY">{*(Dictionary *)_data._mem}</DisplayString>
<DisplayString Condition="type == Variant::ARRAY">{*(Array *)_data._mem}</DisplayString>
@@ -79,7 +79,7 @@
<Item Name="[value]" Condition="type == Variant::QUAT">*(Quat *)_data._mem</Item>
<Item Name="[value]" Condition="type == Variant::COLOR">*(Color *)_data._mem</Item>
<Item Name="[value]" Condition="type == Variant::NODE_PATH">*(NodePath *)_data._mem</Item>
- <Item Name="[value]" Condition="type == Variant::_RID">*(RID *)_data._mem</Item>
+ <Item Name="[value]" Condition="type == Variant::RID">*(RID *)_data._mem</Item>
<Item Name="[value]" Condition="type == Variant::OBJECT">*(Object *)_data._mem</Item>
<Item Name="[value]" Condition="type == Variant::DICTIONARY">*(Dictionary *)_data._mem</Item>
<Item Name="[value]" Condition="type == Variant::ARRAY">*(Array *)_data._mem</Item>
diff --git a/platform/windows/joypad_windows.cpp b/platform/windows/joypad_windows.cpp
index d1454c9096..2a5c8a7763 100644
--- a/platform/windows/joypad_windows.cpp
+++ b/platform/windows/joypad_windows.cpp
@@ -194,7 +194,7 @@ void JoypadWindows::setup_joypad_object(const DIDEVICEOBJECTINSTANCE *ob, int p_
HRESULT res;
DIPROPRANGE prop_range;
DIPROPDWORD dilong;
- DWORD ofs;
+ LONG ofs;
if (ob->guidType == GUID_XAxis)
ofs = DIJOFS_X;
else if (ob->guidType == GUID_YAxis)
@@ -395,7 +395,7 @@ void JoypadWindows::process_joypads() {
// on mingw, these constants are not constants
int count = 8;
- unsigned int axes[] = { DIJOFS_X, DIJOFS_Y, DIJOFS_Z, DIJOFS_RX, DIJOFS_RY, DIJOFS_RZ, DIJOFS_SLIDER(0), DIJOFS_SLIDER(1) };
+ LONG axes[] = { DIJOFS_X, DIJOFS_Y, DIJOFS_Z, DIJOFS_RX, DIJOFS_RY, DIJOFS_RZ, (LONG)DIJOFS_SLIDER(0), (LONG)DIJOFS_SLIDER(1) };
int values[] = { js.lX, js.lY, js.lZ, js.lRx, js.lRy, js.lRz, js.rglSlider[0], js.rglSlider[1] };
for (int j = 0; j < joy->joy_axis.size(); j++) {
diff --git a/platform/windows/joypad_windows.h b/platform/windows/joypad_windows.h
index c961abf0a5..223b44fcd6 100644
--- a/platform/windows/joypad_windows.h
+++ b/platform/windows/joypad_windows.h
@@ -77,7 +77,7 @@ private:
DWORD last_pad;
LPDIRECTINPUTDEVICE8 di_joy;
- List<DWORD> joy_axis;
+ List<LONG> joy_axis;
GUID guid;
dinput_gamepad() {
diff --git a/platform/windows/os_windows.cpp b/platform/windows/os_windows.cpp
index f73516b370..b108d74b2e 100644
--- a/platform/windows/os_windows.cpp
+++ b/platform/windows/os_windows.cpp
@@ -244,7 +244,7 @@ void OS_Windows::finalize_core() {
}
Error OS_Windows::open_dynamic_library(const String p_path, void *&p_library_handle, bool p_also_set_library_path) {
- String path = p_path;
+ String path = p_path.replace("/", "\\");
if (!FileAccess::exists(path)) {
//this code exists so gdnative can load .dll files from within the executable path
@@ -412,8 +412,10 @@ String OS_Windows::_quote_command_line_argument(const String &p_text) const {
}
Error OS_Windows::execute(const String &p_path, const List<String> &p_arguments, bool p_blocking, ProcessID *r_child_id, String *r_pipe, int *r_exitcode, bool read_stderr, Mutex *p_pipe_mutex) {
+ String path = p_path.replace("/", "\\");
+
if (p_blocking && r_pipe) {
- String argss = _quote_command_line_argument(p_path);
+ String argss = _quote_command_line_argument(path);
for (const List<String>::Element *E = p_arguments.front(); E; E = E->next()) {
argss += " " + _quote_command_line_argument(E->get());
}
@@ -446,7 +448,7 @@ Error OS_Windows::execute(const String &p_path, const List<String> &p_arguments,
return OK;
}
- String cmdline = _quote_command_line_argument(p_path);
+ String cmdline = _quote_command_line_argument(path);
const List<String>::Element *I = p_arguments.front();
while (I) {
cmdline += " " + _quote_command_line_argument(I->get());
@@ -509,7 +511,7 @@ Error OS_Windows::set_cwd(const String &p_cwd) {
String OS_Windows::get_executable_path() const {
WCHAR bufname[4096];
GetModuleFileNameW(nullptr, bufname, 4096);
- String s = String::utf16((const char16_t *)bufname);
+ String s = String::utf16((const char16_t *)bufname).replace("\\", "/");
return s;
}
diff --git a/platform/windows/os_windows.h b/platform/windows/os_windows.h
index 910a83539a..a3dbb23182 100644
--- a/platform/windows/os_windows.h
+++ b/platform/windows/os_windows.h
@@ -31,9 +31,9 @@
#ifndef OS_WINDOWS_H
#define OS_WINDOWS_H
+#include "core/config/project_settings.h"
#include "core/input/input.h"
#include "core/os/os.h"
-#include "core/project_settings.h"
#include "crash_handler_windows.h"
#include "drivers/unix/ip_unix.h"
#include "drivers/wasapi/audio_driver_wasapi.h"
diff --git a/scene/2d/area_2d.h b/scene/2d/area_2d.h
index 32226ef5a4..01426db999 100644
--- a/scene/2d/area_2d.h
+++ b/scene/2d/area_2d.h
@@ -31,7 +31,7 @@
#ifndef AREA_2D_H
#define AREA_2D_H
-#include "core/vset.h"
+#include "core/templates/vset.h"
#include "scene/2d/collision_object_2d.h"
class Area2D : public CollisionObject2D {
diff --git a/scene/2d/audio_stream_player_2d.cpp b/scene/2d/audio_stream_player_2d.cpp
index 5b89ac15b1..9bd716aeaa 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 "core/engine.h"
+#include "core/config/engine.h"
#include "scene/2d/area_2d.h"
#include "scene/main/window.h"
diff --git a/scene/2d/camera_2d.cpp b/scene/2d/camera_2d.cpp
index fd4d5981ff..e22b24c16f 100644
--- a/scene/2d/camera_2d.cpp
+++ b/scene/2d/camera_2d.cpp
@@ -30,7 +30,7 @@
#include "camera_2d.h"
-#include "core/engine.h"
+#include "core/config/engine.h"
#include "core/math/math_funcs.h"
#include "scene/scene_string_names.h"
#include "servers/rendering_server.h"
diff --git a/scene/2d/collision_polygon_2d.cpp b/scene/2d/collision_polygon_2d.cpp
index 3cbb0f72f8..64d82d715c 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 "core/engine.h"
+#include "core/config/engine.h"
#include "core/math/geometry_2d.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 d022c857f3..a5cd624235 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 "core/engine.h"
+#include "core/config/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 5b405246e2..2296e0434e 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 "core/rid.h"
+#include "core/templates/rid.h"
#include "scene/2d/node_2d.h"
#include "scene/resources/texture.h"
diff --git a/scene/2d/gpu_particles_2d.cpp b/scene/2d/gpu_particles_2d.cpp
index a9fdb103b2..a4a930455b 100644
--- a/scene/2d/gpu_particles_2d.cpp
+++ b/scene/2d/gpu_particles_2d.cpp
@@ -35,7 +35,7 @@
#include "scene/scene_string_names.h"
#ifdef TOOLS_ENABLED
-#include "core/engine.h"
+#include "core/config/engine.h"
#endif
void GPUParticles2D::set_emitting(bool p_emitting) {
diff --git a/scene/2d/gpu_particles_2d.h b/scene/2d/gpu_particles_2d.h
index f1001a39fe..0d1b82d93e 100644
--- a/scene/2d/gpu_particles_2d.h
+++ b/scene/2d/gpu_particles_2d.h
@@ -31,7 +31,7 @@
#ifndef PARTICLES_2D_H
#define PARTICLES_2D_H
-#include "core/rid.h"
+#include "core/templates/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 8df72d7aac..0e4b1836da 100644
--- a/scene/2d/joints_2d.cpp
+++ b/scene/2d/joints_2d.cpp
@@ -30,7 +30,7 @@
#include "joints_2d.h"
-#include "core/engine.h"
+#include "core/config/engine.h"
#include "physics_body_2d.h"
#include "servers/physics_server_2d.h"
diff --git a/scene/2d/light_2d.cpp b/scene/2d/light_2d.cpp
index 8e425b62da..2b373a669b 100644
--- a/scene/2d/light_2d.cpp
+++ b/scene/2d/light_2d.cpp
@@ -30,7 +30,7 @@
#include "light_2d.h"
-#include "core/engine.h"
+#include "core/config/engine.h"
#include "servers/rendering_server.h"
void Light2D::_update_light_visibility() {
diff --git a/scene/2d/light_occluder_2d.cpp b/scene/2d/light_occluder_2d.cpp
index b2ea60f895..0531762ed8 100644
--- a/scene/2d/light_occluder_2d.cpp
+++ b/scene/2d/light_occluder_2d.cpp
@@ -31,7 +31,7 @@
#include "light_occluder_2d.h"
#include "core/math/geometry_2d.h"
-#include "core/engine.h"
+#include "core/config/engine.h"
#define LINE_GRAB_WIDTH 8
diff --git a/scene/2d/line_builder.h b/scene/2d/line_builder.h
index 9e3dbbd6c1..0e033d9be1 100644
--- a/scene/2d/line_builder.h
+++ b/scene/2d/line_builder.h
@@ -31,7 +31,7 @@
#ifndef LINE_BUILDER_H
#define LINE_BUILDER_H
-#include "core/color.h"
+#include "core/math/color.h"
#include "core/math/vector2.h"
#include "line_2d.h"
#include "scene/resources/gradient.h"
diff --git a/scene/2d/navigation_agent_2d.cpp b/scene/2d/navigation_agent_2d.cpp
index 9949ac6228..1c7063d0d3 100644
--- a/scene/2d/navigation_agent_2d.cpp
+++ b/scene/2d/navigation_agent_2d.cpp
@@ -30,7 +30,7 @@
#include "navigation_agent_2d.h"
-#include "core/engine.h"
+#include "core/config/engine.h"
#include "core/math/geometry_2d.h"
#include "scene/2d/navigation_2d.h"
#include "servers/navigation_server_2d.h"
diff --git a/scene/2d/navigation_agent_2d.h b/scene/2d/navigation_agent_2d.h
index 9474392ddf..1f2377837b 100644
--- a/scene/2d/navigation_agent_2d.h
+++ b/scene/2d/navigation_agent_2d.h
@@ -31,7 +31,7 @@
#ifndef NAVIGATION_AGENT_2D_H
#define NAVIGATION_AGENT_2D_H
-#include "core/vector.h"
+#include "core/templates/vector.h"
#include "scene/main/node.h"
class Node2D;
diff --git a/scene/2d/navigation_region_2d.cpp b/scene/2d/navigation_region_2d.cpp
index 67e7176e6e..98817ec03e 100644
--- a/scene/2d/navigation_region_2d.cpp
+++ b/scene/2d/navigation_region_2d.cpp
@@ -30,8 +30,8 @@
#include "navigation_region_2d.h"
+#include "core/config/engine.h"
#include "core/core_string_names.h"
-#include "core/engine.h"
#include "core/math/geometry_2d.h"
#include "core/os/mutex.h"
#include "navigation_2d.h"
diff --git a/scene/2d/node_2d.cpp b/scene/2d/node_2d.cpp
index 72250e96b3..42c2585487 100644
--- a/scene/2d/node_2d.cpp
+++ b/scene/2d/node_2d.cpp
@@ -30,7 +30,7 @@
#include "node_2d.h"
-#include "core/message_queue.h"
+#include "core/object/message_queue.h"
#include "scene/gui/control.h"
#include "scene/main/window.h"
#include "servers/rendering_server.h"
diff --git a/scene/2d/parallax_layer.cpp b/scene/2d/parallax_layer.cpp
index ec1f1f40fa..01aa5838b4 100644
--- a/scene/2d/parallax_layer.cpp
+++ b/scene/2d/parallax_layer.cpp
@@ -30,7 +30,7 @@
#include "parallax_layer.h"
-#include "core/engine.h"
+#include "core/config/engine.h"
#include "parallax_background.h"
void ParallaxLayer::set_motion_scale(const Size2 &p_scale) {
diff --git a/scene/2d/path_2d.cpp b/scene/2d/path_2d.cpp
index d5994422e7..d305f2805e 100644
--- a/scene/2d/path_2d.cpp
+++ b/scene/2d/path_2d.cpp
@@ -30,7 +30,7 @@
#include "path_2d.h"
-#include "core/engine.h"
+#include "core/config/engine.h"
#include "core/math/geometry_2d.h"
#include "scene/scene_string_names.h"
diff --git a/scene/2d/physics_body_2d.cpp b/scene/2d/physics_body_2d.cpp
index 402eac644f..300799ff9d 100644
--- a/scene/2d/physics_body_2d.cpp
+++ b/scene/2d/physics_body_2d.cpp
@@ -30,12 +30,12 @@
#include "physics_body_2d.h"
-#include "core/class_db.h"
+#include "core/config/engine.h"
#include "core/core_string_names.h"
-#include "core/engine.h"
-#include "core/list.h"
#include "core/math/math_funcs.h"
-#include "core/rid.h"
+#include "core/object/class_db.h"
+#include "core/templates/list.h"
+#include "core/templates/rid.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 aefea56fa3..1db2d23bb8 100644
--- a/scene/2d/physics_body_2d.h
+++ b/scene/2d/physics_body_2d.h
@@ -31,7 +31,7 @@
#ifndef PHYSICS_BODY_2D_H
#define PHYSICS_BODY_2D_H
-#include "core/vset.h"
+#include "core/templates/vset.h"
#include "scene/2d/collision_object_2d.h"
#include "scene/resources/physics_material.h"
#include "servers/physics_server_2d.h"
diff --git a/scene/2d/position_2d.cpp b/scene/2d/position_2d.cpp
index a94a9f7085..8e4165cf50 100644
--- a/scene/2d/position_2d.cpp
+++ b/scene/2d/position_2d.cpp
@@ -30,7 +30,7 @@
#include "position_2d.h"
-#include "core/engine.h"
+#include "core/config/engine.h"
#include "scene/resources/texture.h"
const float DEFAULT_GIZMO_EXTENTS = 10.0;
diff --git a/scene/2d/ray_cast_2d.cpp b/scene/2d/ray_cast_2d.cpp
index a00db36077..e53f89c46d 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 "core/engine.h"
+#include "core/config/engine.h"
#include "physics_body_2d.h"
#include "servers/physics_server_2d.h"
diff --git a/scene/2d/tile_map.h b/scene/2d/tile_map.h
index b9dd8f5405..22b615a379 100644
--- a/scene/2d/tile_map.h
+++ b/scene/2d/tile_map.h
@@ -31,8 +31,8 @@
#ifndef TILE_MAP_H
#define TILE_MAP_H
-#include "core/self_list.h"
-#include "core/vset.h"
+#include "core/templates/self_list.h"
+#include "core/templates/vset.h"
#include "scene/2d/navigation_2d.h"
#include "scene/2d/node_2d.h"
#include "scene/resources/tile_set.h"
diff --git a/scene/2d/visibility_notifier_2d.cpp b/scene/2d/visibility_notifier_2d.cpp
index 9cec589cfb..e217f2a394 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 "core/engine.h"
+#include "core/config/engine.h"
#include "gpu_particles_2d.h"
#include "scene/2d/animated_sprite_2d.h"
#include "scene/2d/physics_body_2d.h"
diff --git a/scene/3d/area_3d.h b/scene/3d/area_3d.h
index 07d24f39a7..7d1f030baf 100644
--- a/scene/3d/area_3d.h
+++ b/scene/3d/area_3d.h
@@ -31,7 +31,7 @@
#ifndef AREA_3D_H
#define AREA_3D_H
-#include "core/vset.h"
+#include "core/templates/vset.h"
#include "scene/3d/collision_object_3d.h"
class Area3D : public CollisionObject3D {
diff --git a/scene/3d/audio_stream_player_3d.cpp b/scene/3d/audio_stream_player_3d.cpp
index 6e4db8f382..b093788d75 100644
--- a/scene/3d/audio_stream_player_3d.cpp
+++ b/scene/3d/audio_stream_player_3d.cpp
@@ -30,7 +30,7 @@
#include "audio_stream_player_3d.h"
-#include "core/engine.h"
+#include "core/config/engine.h"
#include "scene/3d/area_3d.h"
#include "scene/3d/camera_3d.h"
#include "scene/3d/listener_3d.h"
diff --git a/scene/3d/baked_lightmap.cpp b/scene/3d/baked_lightmap.cpp
index e867891ec0..38c9e96fbc 100644
--- a/scene/3d/baked_lightmap.cpp
+++ b/scene/3d/baked_lightmap.cpp
@@ -37,7 +37,7 @@
#include "core/os/dir_access.h"
#include "core/os/file_access.h"
#include "core/os/os.h"
-#include "core/sort_array.h"
+#include "core/templates/sort_array.h"
#include "lightmap_probe.h"
void BakedLightmapData::add_user(const NodePath &p_path, const Rect2 &p_uv_scale, int p_slice_index, int32_t p_sub_instance) {
diff --git a/scene/3d/baked_lightmap.h b/scene/3d/baked_lightmap.h
index bebb579252..8808569215 100644
--- a/scene/3d/baked_lightmap.h
+++ b/scene/3d/baked_lightmap.h
@@ -31,7 +31,7 @@
#ifndef BAKED_LIGHTMAP_H
#define BAKED_LIGHTMAP_H
-#include "core/local_vector.h"
+#include "core/templates/local_vector.h"
#include "scene/3d/light_3d.h"
#include "scene/3d/lightmapper.h"
#include "scene/3d/mesh_instance_3d.h"
diff --git a/scene/3d/camera_3d.cpp b/scene/3d/camera_3d.cpp
index ecbaca7bd1..a6433f8f58 100644
--- a/scene/3d/camera_3d.cpp
+++ b/scene/3d/camera_3d.cpp
@@ -31,7 +31,7 @@
#include "camera_3d.h"
#include "collision_object_3d.h"
-#include "core/engine.h"
+#include "core/config/engine.h"
#include "core/math/camera_matrix.h"
#include "scene/resources/material.h"
#include "scene/resources/surface_tool.h"
diff --git a/scene/3d/cpu_particles_3d.h b/scene/3d/cpu_particles_3d.h
index f44d0dfcfa..078861011b 100644
--- a/scene/3d/cpu_particles_3d.h
+++ b/scene/3d/cpu_particles_3d.h
@@ -31,7 +31,7 @@
#ifndef CPU_PARTICLES_H
#define CPU_PARTICLES_H
-#include "core/rid.h"
+#include "core/templates/rid.h"
#include "scene/3d/visual_instance_3d.h"
class CPUParticles3D : public GeometryInstance3D {
diff --git a/scene/3d/gpu_particles_3d.h b/scene/3d/gpu_particles_3d.h
index b68acef21c..f0e5f05e5b 100644
--- a/scene/3d/gpu_particles_3d.h
+++ b/scene/3d/gpu_particles_3d.h
@@ -31,7 +31,7 @@
#ifndef PARTICLES_H
#define PARTICLES_H
-#include "core/rid.h"
+#include "core/templates/rid.h"
#include "scene/3d/visual_instance_3d.h"
#include "scene/resources/material.h"
diff --git a/scene/3d/gpu_particles_collision_3d.cpp b/scene/3d/gpu_particles_collision_3d.cpp
index baaaa23185..1f0d5d587d 100644
--- a/scene/3d/gpu_particles_collision_3d.cpp
+++ b/scene/3d/gpu_particles_collision_3d.cpp
@@ -30,7 +30,7 @@
#include "gpu_particles_collision_3d.h"
-#include "core/thread_work_pool.h"
+#include "core/templates/thread_work_pool.h"
#include "mesh_instance_3d.h"
#include "scene/3d/camera_3d.h"
#include "scene/main/viewport.h"
diff --git a/scene/3d/gpu_particles_collision_3d.h b/scene/3d/gpu_particles_collision_3d.h
index 4c73c7bcb2..9b644ade6b 100644
--- a/scene/3d/gpu_particles_collision_3d.h
+++ b/scene/3d/gpu_particles_collision_3d.h
@@ -31,8 +31,8 @@
#ifndef GPU_PARTICLES_COLLISION_3D_H
#define GPU_PARTICLES_COLLISION_3D_H
-#include "core/local_vector.h"
-#include "core/rid.h"
+#include "core/templates/local_vector.h"
+#include "core/templates/rid.h"
#include "scene/3d/visual_instance_3d.h"
#include "scene/resources/material.h"
diff --git a/scene/3d/light_3d.cpp b/scene/3d/light_3d.cpp
index 46c3f18c38..2dc3cd3230 100644
--- a/scene/3d/light_3d.cpp
+++ b/scene/3d/light_3d.cpp
@@ -30,8 +30,8 @@
#include "light_3d.h"
-#include "core/engine.h"
-#include "core/project_settings.h"
+#include "core/config/engine.h"
+#include "core/config/project_settings.h"
#include "scene/resources/surface_tool.h"
bool Light3D::_can_gizmo_scale() const {
diff --git a/scene/3d/navigation_agent_3d.cpp b/scene/3d/navigation_agent_3d.cpp
index 422b566867..f9f8f276a3 100644
--- a/scene/3d/navigation_agent_3d.cpp
+++ b/scene/3d/navigation_agent_3d.cpp
@@ -30,7 +30,7 @@
#include "navigation_agent_3d.h"
-#include "core/engine.h"
+#include "core/config/engine.h"
#include "scene/3d/navigation_3d.h"
#include "servers/navigation_server_3d.h"
diff --git a/scene/3d/navigation_agent_3d.h b/scene/3d/navigation_agent_3d.h
index e80367ea50..dcfd302561 100644
--- a/scene/3d/navigation_agent_3d.h
+++ b/scene/3d/navigation_agent_3d.h
@@ -31,7 +31,7 @@
#ifndef NAVIGATION_AGENT_H
#define NAVIGATION_AGENT_H
-#include "core/vector.h"
+#include "core/templates/vector.h"
#include "scene/main/node.h"
class Node3D;
diff --git a/scene/3d/node_3d.cpp b/scene/3d/node_3d.cpp
index 138788cf2d..e8005f38ed 100644
--- a/scene/3d/node_3d.cpp
+++ b/scene/3d/node_3d.cpp
@@ -30,8 +30,8 @@
#include "node_3d.h"
-#include "core/engine.h"
-#include "core/message_queue.h"
+#include "core/config/engine.h"
+#include "core/object/message_queue.h"
#include "scene/main/scene_tree.h"
#include "scene/main/window.h"
#include "scene/scene_string_names.h"
diff --git a/scene/3d/path_3d.cpp b/scene/3d/path_3d.cpp
index d0d2d6f9f4..f25a64c567 100644
--- a/scene/3d/path_3d.cpp
+++ b/scene/3d/path_3d.cpp
@@ -30,7 +30,7 @@
#include "path_3d.h"
-#include "core/engine.h"
+#include "core/config/engine.h"
#include "scene/scene_string_names.h"
void Path3D::_notification(int p_what) {
diff --git a/scene/3d/physics_body_3d.cpp b/scene/3d/physics_body_3d.cpp
index 579088b835..a3e00d2cc3 100644
--- a/scene/3d/physics_body_3d.cpp
+++ b/scene/3d/physics_body_3d.cpp
@@ -30,11 +30,11 @@
#include "physics_body_3d.h"
-#include "core/class_db.h"
+#include "core/config/engine.h"
#include "core/core_string_names.h"
-#include "core/engine.h"
-#include "core/list.h"
-#include "core/rid.h"
+#include "core/object/class_db.h"
+#include "core/templates/list.h"
+#include "core/templates/rid.h"
#include "scene/3d/collision_shape_3d.h"
#include "scene/scene_string_names.h"
#include "servers/navigation_server_3d.h"
diff --git a/scene/3d/physics_body_3d.h b/scene/3d/physics_body_3d.h
index d3dddeae55..da947ba02e 100644
--- a/scene/3d/physics_body_3d.h
+++ b/scene/3d/physics_body_3d.h
@@ -31,7 +31,7 @@
#ifndef PHYSICS_BODY_3D_H
#define PHYSICS_BODY_3D_H
-#include "core/vset.h"
+#include "core/templates/vset.h"
#include "scene/3d/collision_object_3d.h"
#include "scene/resources/physics_material.h"
#include "servers/physics_server_3d.h"
diff --git a/scene/3d/ray_cast_3d.cpp b/scene/3d/ray_cast_3d.cpp
index 69f09ef569..811e8a331b 100644
--- a/scene/3d/ray_cast_3d.cpp
+++ b/scene/3d/ray_cast_3d.cpp
@@ -31,7 +31,7 @@
#include "ray_cast_3d.h"
#include "collision_object_3d.h"
-#include "core/engine.h"
+#include "core/config/engine.h"
#include "mesh_instance_3d.h"
#include "servers/physics_server_3d.h"
diff --git a/scene/3d/skeleton_3d.cpp b/scene/3d/skeleton_3d.cpp
index 6723ca04b9..0ae1c0e3b6 100644
--- a/scene/3d/skeleton_3d.cpp
+++ b/scene/3d/skeleton_3d.cpp
@@ -30,10 +30,10 @@
#include "skeleton_3d.h"
-#include "core/engine.h"
-#include "core/message_queue.h"
-#include "core/project_settings.h"
-#include "core/type_info.h"
+#include "core/config/engine.h"
+#include "core/config/project_settings.h"
+#include "core/object/message_queue.h"
+#include "core/variant/type_info.h"
#include "scene/3d/physics_body_3d.h"
#include "scene/resources/surface_tool.h"
#include "scene/scene_string_names.h"
diff --git a/scene/3d/skeleton_3d.h b/scene/3d/skeleton_3d.h
index a21891a32e..95c49750fa 100644
--- a/scene/3d/skeleton_3d.h
+++ b/scene/3d/skeleton_3d.h
@@ -31,7 +31,7 @@
#ifndef SKELETON_3D_H
#define SKELETON_3D_H
-#include "core/rid.h"
+#include "core/templates/rid.h"
#include "scene/3d/node_3d.h"
#include "scene/resources/skin.h"
diff --git a/scene/3d/soft_body_3d.cpp b/scene/3d/soft_body_3d.cpp
index 3b5c328e43..132c35771b 100644
--- a/scene/3d/soft_body_3d.cpp
+++ b/scene/3d/soft_body_3d.cpp
@@ -30,10 +30,10 @@
#include "soft_body_3d.h"
-#include "core/class_db.h"
-#include "core/list.h"
+#include "core/object/class_db.h"
#include "core/os/os.h"
-#include "core/rid.h"
+#include "core/templates/list.h"
+#include "core/templates/rid.h"
#include "scene/3d/collision_object_3d.h"
#include "scene/3d/physics_body_3d.h"
#include "scene/3d/skeleton_3d.h"
diff --git a/scene/3d/spring_arm_3d.cpp b/scene/3d/spring_arm_3d.cpp
index 9775ecc6c6..287d760db0 100644
--- a/scene/3d/spring_arm_3d.cpp
+++ b/scene/3d/spring_arm_3d.cpp
@@ -30,7 +30,7 @@
#include "spring_arm_3d.h"
-#include "core/engine.h"
+#include "core/config/engine.h"
#include "scene/3d/collision_object_3d.h"
#include "scene/resources/sphere_shape_3d.h"
#include "servers/physics_server_3d.h"
diff --git a/scene/3d/velocity_tracker_3d.cpp b/scene/3d/velocity_tracker_3d.cpp
index db10f3273b..eba7d44c16 100644
--- a/scene/3d/velocity_tracker_3d.cpp
+++ b/scene/3d/velocity_tracker_3d.cpp
@@ -29,7 +29,7 @@
/*************************************************************************/
#include "velocity_tracker_3d.h"
-#include "core/engine.h"
+#include "core/config/engine.h"
void VelocityTracker3D::set_track_physics_step(bool p_track_physics_step) {
physics_step = p_track_physics_step;
diff --git a/scene/3d/visibility_notifier_3d.cpp b/scene/3d/visibility_notifier_3d.cpp
index a64b0df1cc..9f5c40caf4 100644
--- a/scene/3d/visibility_notifier_3d.cpp
+++ b/scene/3d/visibility_notifier_3d.cpp
@@ -30,7 +30,7 @@
#include "visibility_notifier_3d.h"
-#include "core/engine.h"
+#include "core/config/engine.h"
#include "scene/3d/camera_3d.h"
#include "scene/3d/physics_body_3d.h"
#include "scene/animation/animation_player.h"
diff --git a/scene/3d/visual_instance_3d.h b/scene/3d/visual_instance_3d.h
index 195674f62d..51bcb411da 100644
--- a/scene/3d/visual_instance_3d.h
+++ b/scene/3d/visual_instance_3d.h
@@ -32,7 +32,7 @@
#define VISUAL_INSTANCE_H
#include "core/math/face3.h"
-#include "core/rid.h"
+#include "core/templates/rid.h"
#include "scene/3d/node_3d.h"
#include "scene/resources/material.h"
diff --git a/scene/animation/animation_player.cpp b/scene/animation/animation_player.cpp
index 4c869943e5..e9e17148d6 100644
--- a/scene/animation/animation_player.cpp
+++ b/scene/animation/animation_player.cpp
@@ -30,8 +30,8 @@
#include "animation_player.h"
-#include "core/engine.h"
-#include "core/message_queue.h"
+#include "core/config/engine.h"
+#include "core/object/message_queue.h"
#include "scene/scene_string_names.h"
#include "servers/audio/audio_stream.h"
diff --git a/scene/animation/animation_tree.cpp b/scene/animation/animation_tree.cpp
index bb5d536600..2ef3ba87b2 100644
--- a/scene/animation/animation_tree.cpp
+++ b/scene/animation/animation_tree.cpp
@@ -31,7 +31,7 @@
#include "animation_tree.h"
#include "animation_blend_tree.h"
-#include "core/engine.h"
+#include "core/config/engine.h"
#include "scene/scene_string_names.h"
#include "servers/audio/audio_stream.h"
diff --git a/scene/audio/audio_stream_player.cpp b/scene/audio/audio_stream_player.cpp
index 48f70e88cb..14aae9c7bf 100644
--- a/scene/audio/audio_stream_player.cpp
+++ b/scene/audio/audio_stream_player.cpp
@@ -30,7 +30,7 @@
#include "audio_stream_player.h"
-#include "core/engine.h"
+#include "core/config/engine.h"
void AudioStreamPlayer::_mix_to_bus(const AudioFrame *p_frames, int p_amount) {
int bus_index = AudioServer::get_singleton()->thread_find_bus_index(bus);
diff --git a/scene/debugger/scene_debugger.cpp b/scene/debugger/scene_debugger.cpp
index f57c8e58db..f848fc3e68 100644
--- a/scene/debugger/scene_debugger.cpp
+++ b/scene/debugger/scene_debugger.cpp
@@ -32,7 +32,7 @@
#include "core/debugger/engine_debugger.h"
#include "core/io/marshalls.h"
-#include "core/script_language.h"
+#include "core/object/script_language.h"
#include "scene/main/scene_tree.h"
#include "scene/main/window.h"
#include "scene/resources/packed_scene.h"
diff --git a/scene/debugger/scene_debugger.h b/scene/debugger/scene_debugger.h
index 80e329f1f2..af2d8904b5 100644
--- a/scene/debugger/scene_debugger.h
+++ b/scene/debugger/scene_debugger.h
@@ -31,10 +31,10 @@
#ifndef SCENE_DEBUGGER_H
#define SCENE_DEBUGGER_H
-#include "core/array.h"
-#include "core/class_db.h"
-#include "core/pair.h"
-#include "core/ustring.h"
+#include "core/object/class_db.h"
+#include "core/string/ustring.h"
+#include "core/templates/pair.h"
+#include "core/variant/array.h"
class Script;
diff --git a/scene/gui/button.cpp b/scene/gui/button.cpp
index e400801b66..e86ad09aa6 100644
--- a/scene/gui/button.cpp
+++ b/scene/gui/button.cpp
@@ -30,7 +30,7 @@
#include "button.h"
-#include "core/translation.h"
+#include "core/string/translation.h"
#include "servers/rendering_server.h"
Size2 Button::get_minimum_size() const {
diff --git a/scene/gui/check_button.cpp b/scene/gui/check_button.cpp
index 1ddc730dd1..790faeb4fd 100644
--- a/scene/gui/check_button.cpp
+++ b/scene/gui/check_button.cpp
@@ -30,7 +30,7 @@
#include "check_button.h"
-#include "core/print_string.h"
+#include "core/string/print_string.h"
#include "servers/rendering_server.h"
Size2 CheckButton::get_icon_size() const {
diff --git a/scene/gui/container.cpp b/scene/gui/container.cpp
index 470a7db2dc..5643110b89 100644
--- a/scene/gui/container.cpp
+++ b/scene/gui/container.cpp
@@ -29,7 +29,7 @@
/*************************************************************************/
#include "container.h"
-#include "core/message_queue.h"
+#include "core/object/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 cb35519da1..3414b04978 100644
--- a/scene/gui/control.cpp
+++ b/scene/gui/control.cpp
@@ -30,12 +30,12 @@
#include "control.h"
+#include "core/config/project_settings.h"
#include "core/math/geometry_2d.h"
-#include "core/message_queue.h"
+#include "core/object/message_queue.h"
#include "core/os/keyboard.h"
#include "core/os/os.h"
-#include "core/print_string.h"
-#include "core/project_settings.h"
+#include "core/string/print_string.h"
#include "scene/gui/label.h"
#include "scene/gui/panel.h"
#include "scene/main/canvas_layer.h"
diff --git a/scene/gui/control.h b/scene/gui/control.h
index 83e79f908f..f2f558cf4f 100644
--- a/scene/gui/control.h
+++ b/scene/gui/control.h
@@ -32,7 +32,7 @@
#define CONTROL_H
#include "core/math/transform_2d.h"
-#include "core/rid.h"
+#include "core/templates/rid.h"
#include "scene/gui/shortcut.h"
#include "scene/main/canvas_item.h"
#include "scene/main/node.h"
diff --git a/scene/gui/dialogs.cpp b/scene/gui/dialogs.cpp
index 430e98d50e..4f59f4a36a 100644
--- a/scene/gui/dialogs.cpp
+++ b/scene/gui/dialogs.cpp
@@ -31,8 +31,8 @@
#include "dialogs.h"
#include "core/os/keyboard.h"
-#include "core/print_string.h"
-#include "core/translation.h"
+#include "core/string/print_string.h"
+#include "core/string/translation.h"
#include "line_edit.h"
#ifdef TOOLS_ENABLED
diff --git a/scene/gui/file_dialog.cpp b/scene/gui/file_dialog.cpp
index 2da61bdde7..7ce4e90f28 100644
--- a/scene/gui/file_dialog.cpp
+++ b/scene/gui/file_dialog.cpp
@@ -31,7 +31,7 @@
#include "file_dialog.h"
#include "core/os/keyboard.h"
-#include "core/print_string.h"
+#include "core/string/print_string.h"
#include "scene/gui/label.h"
FileDialog::GetIconFunc FileDialog::get_icon_func = nullptr;
diff --git a/scene/gui/gradient_edit.cpp b/scene/gui/gradient_edit.cpp
index ecd4ad17ea..53d7ead548 100644
--- a/scene/gui/gradient_edit.cpp
+++ b/scene/gui/gradient_edit.cpp
@@ -357,7 +357,7 @@ void GradientEdit::_notification(int p_what) {
//Draw point markers
for (int i = 0; i < points.size(); i++) {
- Color col = points[i].color.contrasted();
+ Color col = points[i].color.inverted();
col.a = 0.9;
draw_line(Vector2(points[i].offset * total_w, 0), Vector2(points[i].offset * total_w, h / 2), col);
diff --git a/scene/gui/item_list.cpp b/scene/gui/item_list.cpp
index 54150d130d..6708b18e0a 100644
--- a/scene/gui/item_list.cpp
+++ b/scene/gui/item_list.cpp
@@ -29,8 +29,8 @@
/*************************************************************************/
#include "item_list.h"
+#include "core/config/project_settings.h"
#include "core/os/os.h"
-#include "core/project_settings.h"
void ItemList::add_item(const String &p_item, const Ref<Texture2D> &p_texture, bool p_selectable) {
Item item;
diff --git a/scene/gui/label.cpp b/scene/gui/label.cpp
index 9e3418a5c9..9df63a3c71 100644
--- a/scene/gui/label.cpp
+++ b/scene/gui/label.cpp
@@ -30,9 +30,9 @@
#include "label.h"
-#include "core/print_string.h"
-#include "core/project_settings.h"
-#include "core/translation.h"
+#include "core/config/project_settings.h"
+#include "core/string/print_string.h"
+#include "core/string/translation.h"
void Label::set_autowrap(bool p_autowrap) {
if (autowrap == p_autowrap) {
diff --git a/scene/gui/line_edit.cpp b/scene/gui/line_edit.cpp
index 1b8f04297d..5fccde3597 100644
--- a/scene/gui/line_edit.cpp
+++ b/scene/gui/line_edit.cpp
@@ -30,11 +30,11 @@
#include "line_edit.h"
-#include "core/message_queue.h"
+#include "core/object/message_queue.h"
#include "core/os/keyboard.h"
#include "core/os/os.h"
-#include "core/print_string.h"
-#include "core/translation.h"
+#include "core/string/print_string.h"
+#include "core/string/translation.h"
#include "label.h"
#include "servers/display_server.h"
#ifdef TOOLS_ENABLED
diff --git a/scene/gui/option_button.cpp b/scene/gui/option_button.cpp
index 5780cc5e71..f0e69a94a4 100644
--- a/scene/gui/option_button.cpp
+++ b/scene/gui/option_button.cpp
@@ -30,7 +30,7 @@
#include "option_button.h"
-#include "core/print_string.h"
+#include "core/string/print_string.h"
Size2 OptionButton::get_minimum_size() const {
Size2 minsize = Button::get_minimum_size();
diff --git a/scene/gui/panel.cpp b/scene/gui/panel.cpp
index d8d9beca2b..acbb6d7ab5 100644
--- a/scene/gui/panel.cpp
+++ b/scene/gui/panel.cpp
@@ -30,7 +30,7 @@
#include "panel.h"
-#include "core/print_string.h"
+#include "core/string/print_string.h"
void Panel::_notification(int p_what) {
if (p_what == NOTIFICATION_DRAW) {
diff --git a/scene/gui/popup.cpp b/scene/gui/popup.cpp
index de866fa956..49ddd5c3ee 100644
--- a/scene/gui/popup.cpp
+++ b/scene/gui/popup.cpp
@@ -30,7 +30,7 @@
#include "popup.h"
-#include "core/engine.h"
+#include "core/config/engine.h"
#include "core/os/keyboard.h"
#include "scene/gui/panel.h"
diff --git a/scene/gui/popup.h b/scene/gui/popup.h
index 3e5b89ccf3..44577811ff 100644
--- a/scene/gui/popup.h
+++ b/scene/gui/popup.h
@@ -33,7 +33,7 @@
#include "scene/main/window.h"
-#include "core/local_vector.h"
+#include "core/templates/local_vector.h"
class Popup : public Window {
GDCLASS(Popup, Window);
diff --git a/scene/gui/popup_menu.cpp b/scene/gui/popup_menu.cpp
index 578d8a96e8..0a469d8373 100644
--- a/scene/gui/popup_menu.cpp
+++ b/scene/gui/popup_menu.cpp
@@ -33,8 +33,8 @@
#include "core/input/input.h"
#include "core/os/keyboard.h"
#include "core/os/os.h"
-#include "core/print_string.h"
-#include "core/translation.h"
+#include "core/string/print_string.h"
+#include "core/string/translation.h"
String PopupMenu::_get_accel_text(int p_item) const {
ERR_FAIL_INDEX_V(p_item, items.size(), String());
diff --git a/scene/gui/reference_rect.cpp b/scene/gui/reference_rect.cpp
index 32ec0049f0..773acb2713 100644
--- a/scene/gui/reference_rect.cpp
+++ b/scene/gui/reference_rect.cpp
@@ -30,7 +30,7 @@
#include "reference_rect.h"
-#include "core/engine.h"
+#include "core/config/engine.h"
void ReferenceRect::_notification(int p_what) {
if (p_what == NOTIFICATION_DRAW) {
diff --git a/scene/gui/rich_text_effect.cpp b/scene/gui/rich_text_effect.cpp
index 2628e5ab0f..76ca8abcc7 100644
--- a/scene/gui/rich_text_effect.cpp
+++ b/scene/gui/rich_text_effect.cpp
@@ -30,7 +30,7 @@
#include "rich_text_effect.h"
-#include "core/script_language.h"
+#include "core/object/script_language.h"
void RichTextEffect::_bind_methods() {
BIND_VMETHOD(MethodInfo(Variant::BOOL, "_process_custom_fx", PropertyInfo(Variant::OBJECT, "char_fx", PROPERTY_HINT_RESOURCE_TYPE, "CharFXTransform")));
diff --git a/scene/gui/rich_text_effect.h b/scene/gui/rich_text_effect.h
index a5401f7eaa..e6b9f09e4d 100644
--- a/scene/gui/rich_text_effect.h
+++ b/scene/gui/rich_text_effect.h
@@ -31,7 +31,7 @@
#ifndef RICH_TEXT_EFFECT_H
#define RICH_TEXT_EFFECT_H
-#include "core/resource.h"
+#include "core/io/resource.h"
class RichTextEffect : public Resource {
GDCLASS(RichTextEffect, Resource);
diff --git a/scene/gui/scroll_bar.cpp b/scene/gui/scroll_bar.cpp
index 0e9ef71892..9340d98ede 100644
--- a/scene/gui/scroll_bar.cpp
+++ b/scene/gui/scroll_bar.cpp
@@ -32,7 +32,7 @@
#include "core/os/keyboard.h"
#include "core/os/os.h"
-#include "core/print_string.h"
+#include "core/string/print_string.h"
#include "scene/main/window.h"
bool ScrollBar::focus_by_default = false;
diff --git a/scene/gui/shortcut.h b/scene/gui/shortcut.h
index 0d7809e5cf..176958b397 100644
--- a/scene/gui/shortcut.h
+++ b/scene/gui/shortcut.h
@@ -32,7 +32,7 @@
#define SHORTCUT_H
#include "core/input/input_event.h"
-#include "core/resource.h"
+#include "core/io/resource.h"
class Shortcut : public Resource {
GDCLASS(Shortcut, Resource);
diff --git a/scene/gui/subviewport_container.cpp b/scene/gui/subviewport_container.cpp
index 4e1ad2ae05..c5f56fe8e2 100644
--- a/scene/gui/subviewport_container.cpp
+++ b/scene/gui/subviewport_container.cpp
@@ -30,7 +30,7 @@
#include "subviewport_container.h"
-#include "core/engine.h"
+#include "core/config/engine.h"
#include "scene/main/viewport.h"
Size2 SubViewportContainer::get_minimum_size() const {
diff --git a/scene/gui/tab_container.cpp b/scene/gui/tab_container.cpp
index bd9c2da5bc..d92f41af2d 100644
--- a/scene/gui/tab_container.cpp
+++ b/scene/gui/tab_container.cpp
@@ -30,7 +30,7 @@
#include "tab_container.h"
-#include "core/message_queue.h"
+#include "core/object/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 d47f771d1d..eefe8cc3bc 100644
--- a/scene/gui/tabs.cpp
+++ b/scene/gui/tabs.cpp
@@ -30,7 +30,7 @@
#include "tabs.h"
-#include "core/message_queue.h"
+#include "core/object/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 fb397759aa..cbe6c6bdb9 100644
--- a/scene/gui/text_edit.cpp
+++ b/scene/gui/text_edit.cpp
@@ -30,12 +30,12 @@
#include "text_edit.h"
+#include "core/config/project_settings.h"
#include "core/input/input.h"
-#include "core/message_queue.h"
+#include "core/object/message_queue.h"
+#include "core/object/script_language.h"
#include "core/os/keyboard.h"
#include "core/os/os.h"
-#include "core/project_settings.h"
-#include "core/script_language.h"
#include "scene/main/window.h"
#ifdef TOOLS_ENABLED
diff --git a/scene/gui/texture_progress.cpp b/scene/gui/texture_progress.cpp
index 484b14d11c..e0d98d1c22 100644
--- a/scene/gui/texture_progress.cpp
+++ b/scene/gui/texture_progress.cpp
@@ -30,7 +30,7 @@
#include "texture_progress.h"
-#include "core/engine.h"
+#include "core/config/engine.h"
void TextureProgress::set_under_texture(const Ref<Texture2D> &p_texture) {
under = p_texture;
diff --git a/scene/gui/tree.cpp b/scene/gui/tree.cpp
index 318496df70..bcb375d786 100644
--- a/scene/gui/tree.cpp
+++ b/scene/gui/tree.cpp
@@ -30,12 +30,12 @@
#include "tree.h"
+#include "core/config/project_settings.h"
#include "core/input/input.h"
#include "core/math/math_funcs.h"
#include "core/os/keyboard.h"
#include "core/os/os.h"
-#include "core/print_string.h"
-#include "core/project_settings.h"
+#include "core/string/print_string.h"
#include "scene/main/window.h"
#include "box_container.h"
diff --git a/scene/main/canvas_item.cpp b/scene/main/canvas_item.cpp
index 740374d09e..e6c35352f5 100644
--- a/scene/main/canvas_item.cpp
+++ b/scene/main/canvas_item.cpp
@@ -31,7 +31,7 @@
#include "canvas_item.h"
#include "core/input/input.h"
-#include "core/message_queue.h"
+#include "core/object/message_queue.h"
#include "scene/2d/canvas_group.h"
#include "scene/main/canvas_layer.h"
#include "scene/main/viewport.h"
diff --git a/scene/main/http_request.cpp b/scene/main/http_request.cpp
index da0169b60b..f484d25dc1 100644
--- a/scene/main/http_request.cpp
+++ b/scene/main/http_request.cpp
@@ -30,7 +30,7 @@
#include "http_request.h"
#include "core/io/compression.h"
-#include "core/ustring.h"
+#include "core/string/ustring.h"
void HTTPRequest::_redirect_request(const String &p_new_url) {
}
diff --git a/scene/main/node.cpp b/scene/main/node.cpp
index e7753089c7..36c3f03f70 100644
--- a/scene/main/node.cpp
+++ b/scene/main/node.cpp
@@ -32,8 +32,8 @@
#include "core/core_string_names.h"
#include "core/io/resource_loader.h"
-#include "core/message_queue.h"
-#include "core/print_string.h"
+#include "core/object/message_queue.h"
+#include "core/string/print_string.h"
#include "instance_placeholder.h"
#include "scene/debugger/scene_debugger.h"
#include "scene/resources/packed_scene.h"
diff --git a/scene/main/node.h b/scene/main/node.h
index 09943d0626..2f8a0673e9 100644
--- a/scene/main/node.h
+++ b/scene/main/node.h
@@ -31,12 +31,12 @@
#ifndef NODE_H
#define NODE_H
-#include "core/class_db.h"
-#include "core/map.h"
-#include "core/node_path.h"
-#include "core/project_settings.h"
-#include "core/script_language.h"
-#include "core/typed_array.h"
+#include "core/config/project_settings.h"
+#include "core/object/class_db.h"
+#include "core/object/script_language.h"
+#include "core/string/node_path.h"
+#include "core/templates/map.h"
+#include "core/variant/typed_array.h"
#include "scene/main/scene_tree.h"
class Viewport;
diff --git a/scene/main/scene_tree.cpp b/scene/main/scene_tree.cpp
index 40479a796f..cffd1126ee 100644
--- a/scene/main/scene_tree.cpp
+++ b/scene/main/scene_tree.cpp
@@ -30,16 +30,16 @@
#include "scene_tree.h"
+#include "core/config/project_settings.h"
#include "core/debugger/engine_debugger.h"
#include "core/input/input.h"
#include "core/io/marshalls.h"
#include "core/io/resource_loader.h"
-#include "core/message_queue.h"
+#include "core/object/message_queue.h"
#include "core/os/dir_access.h"
#include "core/os/keyboard.h"
#include "core/os/os.h"
-#include "core/print_string.h"
-#include "core/project_settings.h"
+#include "core/string/print_string.h"
#include "node.h"
#include "scene/debugger/scene_debugger.h"
#include "scene/resources/dynamic_font.h"
diff --git a/scene/main/scene_tree.h b/scene/main/scene_tree.h
index e5ab4f9958..3e5802ce2e 100644
--- a/scene/main/scene_tree.h
+++ b/scene/main/scene_tree.h
@@ -34,7 +34,7 @@
#include "core/io/multiplayer_api.h"
#include "core/os/main_loop.h"
#include "core/os/thread_safe.h"
-#include "core/self_list.h"
+#include "core/templates/self_list.h"
#include "scene/resources/mesh.h"
#include "scene/resources/world_2d.h"
#include "scene/resources/world_3d.h"
diff --git a/scene/main/shader_globals_override.cpp b/scene/main/shader_globals_override.cpp
index 86c08ca6e9..432fb5b4fb 100644
--- a/scene/main/shader_globals_override.cpp
+++ b/scene/main/shader_globals_override.cpp
@@ -202,7 +202,7 @@ void ShaderGlobalsOverride::_get_property_list(List<PropertyInfo> *p_list) const
Override o;
o.in_use = false;
Callable::CallError ce;
- o.override = Variant::construct(pinfo.type, nullptr, 0, ce);
+ Variant::construct(pinfo.type, o.override, nullptr, 0, ce);
overrides[variables[i]] = o;
}
diff --git a/scene/main/timer.cpp b/scene/main/timer.cpp
index fb55892b54..c9fce2f6c2 100644
--- a/scene/main/timer.cpp
+++ b/scene/main/timer.cpp
@@ -30,7 +30,7 @@
#include "timer.h"
-#include "core/engine.h"
+#include "core/config/engine.h"
void Timer::_notification(int p_what) {
switch (p_what) {
diff --git a/scene/main/viewport.cpp b/scene/main/viewport.cpp
index d512f1809c..17411bb490 100644
--- a/scene/main/viewport.cpp
+++ b/scene/main/viewport.cpp
@@ -30,11 +30,11 @@
#include "viewport.h"
+#include "core/config/project_settings.h"
#include "core/core_string_names.h"
#include "core/debugger/engine_debugger.h"
#include "core/input/input.h"
#include "core/os/os.h"
-#include "core/project_settings.h"
#include "scene/2d/collision_object_2d.h"
#include "scene/3d/camera_3d.h"
#include "scene/3d/collision_object_3d.h"
diff --git a/scene/register_scene_types.cpp b/scene/register_scene_types.cpp
index 9d224dc744..7997dc12e1 100644
--- a/scene/register_scene_types.cpp
+++ b/scene/register_scene_types.cpp
@@ -30,9 +30,9 @@
#include "register_scene_types.h"
-#include "core/class_db.h"
+#include "core/config/project_settings.h"
+#include "core/object/class_db.h"
#include "core/os/os.h"
-#include "core/project_settings.h"
#include "scene/2d/animated_sprite_2d.h"
#include "scene/2d/area_2d.h"
#include "scene/2d/audio_stream_player_2d.h"
diff --git a/scene/resources/animation.h b/scene/resources/animation.h
index 722a400fd6..c52431f5f6 100644
--- a/scene/resources/animation.h
+++ b/scene/resources/animation.h
@@ -31,7 +31,7 @@
#ifndef ANIMATION_H
#define ANIMATION_H
-#include "core/resource.h"
+#include "core/io/resource.h"
class Animation : public Resource {
GDCLASS(Animation, Resource);
diff --git a/scene/resources/bit_map.h b/scene/resources/bit_map.h
index 59f3b4dc3c..56ff72c094 100644
--- a/scene/resources/bit_map.h
+++ b/scene/resources/bit_map.h
@@ -31,9 +31,9 @@
#ifndef BIT_MAP_H
#define BIT_MAP_H
-#include "core/image.h"
+#include "core/io/image.h"
+#include "core/io/resource.h"
#include "core/io/resource_loader.h"
-#include "core/resource.h"
class BitMap : public Resource {
GDCLASS(BitMap, Resource);
diff --git a/scene/resources/camera_effects.h b/scene/resources/camera_effects.h
index 99fd4eb37c..9a26f3d0b2 100644
--- a/scene/resources/camera_effects.h
+++ b/scene/resources/camera_effects.h
@@ -31,8 +31,8 @@
#ifndef CAMERA_EFFECTS_H
#define CAMERA_EFFECTS_H
-#include "core/resource.h"
-#include "core/rid.h"
+#include "core/io/resource.h"
+#include "core/templates/rid.h"
class CameraEffects : public Resource {
GDCLASS(CameraEffects, Resource);
diff --git a/scene/resources/curve.h b/scene/resources/curve.h
index 57ddaf897d..6c5f4b7057 100644
--- a/scene/resources/curve.h
+++ b/scene/resources/curve.h
@@ -31,7 +31,7 @@
#ifndef CURVE_H
#define CURVE_H
-#include "core/resource.h"
+#include "core/io/resource.h"
// y(x) curve
class Curve : public Resource {
diff --git a/scene/resources/dynamic_font.h b/scene/resources/dynamic_font.h
index a881e21da8..73ba42f8a7 100644
--- a/scene/resources/dynamic_font.h
+++ b/scene/resources/dynamic_font.h
@@ -37,7 +37,7 @@
#include "core/io/resource_loader.h"
#include "core/os/mutex.h"
#include "core/os/thread_safe.h"
-#include "core/pair.h"
+#include "core/templates/pair.h"
#include "scene/resources/font.h"
#include <ft2build.h>
diff --git a/scene/resources/environment.cpp b/scene/resources/environment.cpp
index f4edab07b5..bacdb6be54 100644
--- a/scene/resources/environment.cpp
+++ b/scene/resources/environment.cpp
@@ -30,7 +30,7 @@
#include "environment.h"
-#include "core/project_settings.h"
+#include "core/config/project_settings.h"
#include "servers/rendering_server.h"
#include "texture.h"
diff --git a/scene/resources/environment.h b/scene/resources/environment.h
index 9b7247b58d..23c7f5180c 100644
--- a/scene/resources/environment.h
+++ b/scene/resources/environment.h
@@ -31,7 +31,7 @@
#ifndef ENVIRONMENT_H
#define ENVIRONMENT_H
-#include "core/resource.h"
+#include "core/io/resource.h"
#include "scene/resources/sky.h"
#include "scene/resources/texture.h"
#include "servers/rendering_server.h"
diff --git a/scene/resources/font.h b/scene/resources/font.h
index c739520da3..d8c350bb41 100644
--- a/scene/resources/font.h
+++ b/scene/resources/font.h
@@ -31,8 +31,8 @@
#ifndef FONT_H
#define FONT_H
-#include "core/map.h"
-#include "core/resource.h"
+#include "core/io/resource.h"
+#include "core/templates/map.h"
#include "scene/resources/texture.h"
class Font : public Resource {
diff --git a/scene/resources/gradient.h b/scene/resources/gradient.h
index 6518b13ee8..e839909770 100644
--- a/scene/resources/gradient.h
+++ b/scene/resources/gradient.h
@@ -31,7 +31,7 @@
#ifndef GRADIENT_H
#define GRADIENT_H
-#include "core/resource.h"
+#include "core/io/resource.h"
class Gradient : public Resource {
GDCLASS(Gradient, Resource);
diff --git a/scene/resources/material.cpp b/scene/resources/material.cpp
index a5f8cdaf88..35c967ce27 100644
--- a/scene/resources/material.cpp
+++ b/scene/resources/material.cpp
@@ -30,7 +30,7 @@
#include "material.h"
-#include "core/engine.h"
+#include "core/config/engine.h"
#ifdef TOOLS_ENABLED
#include "editor/editor_settings.h"
@@ -2637,6 +2637,8 @@ BaseMaterial3D::BaseMaterial3D(bool p_orm) :
orm = p_orm;
// Initialize to the same values as the shader
shading_mode = SHADING_MODE_PER_PIXEL;
+ transparency = TRANSPARENCY_DISABLED;
+ alpha_antialiasing_mode = ALPHA_ANTIALIASING_OFF;
set_albedo(Color(1.0, 1.0, 1.0, 1.0));
set_specular(0.5);
set_roughness(1.0);
diff --git a/scene/resources/material.h b/scene/resources/material.h
index da1808d348..caf28eea18 100644
--- a/scene/resources/material.h
+++ b/scene/resources/material.h
@@ -31,8 +31,8 @@
#ifndef MATERIAL_H
#define MATERIAL_H
-#include "core/resource.h"
-#include "core/self_list.h"
+#include "core/io/resource.h"
+#include "core/templates/self_list.h"
#include "scene/resources/shader.h"
#include "scene/resources/texture.h"
#include "servers/rendering/shader_language.h"
diff --git a/scene/resources/mesh.cpp b/scene/resources/mesh.cpp
index e9606e03e6..060846d5b6 100644
--- a/scene/resources/mesh.cpp
+++ b/scene/resources/mesh.cpp
@@ -30,7 +30,7 @@
#include "mesh.h"
-#include "core/pair.h"
+#include "core/templates/pair.h"
#include "scene/resources/concave_polygon_shape_3d.h"
#include "scene/resources/convex_polygon_shape_3d.h"
#include "surface_tool.h"
diff --git a/scene/resources/mesh.h b/scene/resources/mesh.h
index b0a30a5627..81c18eea2d 100644
--- a/scene/resources/mesh.h
+++ b/scene/resources/mesh.h
@@ -31,9 +31,9 @@
#ifndef MESH_H
#define MESH_H
+#include "core/io/resource.h"
#include "core/math/face3.h"
#include "core/math/triangle_mesh.h"
-#include "core/resource.h"
#include "scene/resources/material.h"
#include "scene/resources/shape_3d.h"
#include "servers/rendering_server.h"
diff --git a/scene/resources/mesh_library.h b/scene/resources/mesh_library.h
index 450e2c16e3..0d5fb3005b 100644
--- a/scene/resources/mesh_library.h
+++ b/scene/resources/mesh_library.h
@@ -31,8 +31,8 @@
#ifndef MESH_LIBRARY_H
#define MESH_LIBRARY_H
-#include "core/map.h"
-#include "core/resource.h"
+#include "core/io/resource.h"
+#include "core/templates/map.h"
#include "mesh.h"
#include "scene/3d/navigation_region_3d.h"
#include "shape_3d.h"
diff --git a/scene/resources/packed_scene.cpp b/scene/resources/packed_scene.cpp
index 5e8bfd9387..5ce253f970 100644
--- a/scene/resources/packed_scene.cpp
+++ b/scene/resources/packed_scene.cpp
@@ -30,10 +30,10 @@
#include "packed_scene.h"
+#include "core/config/engine.h"
+#include "core/config/project_settings.h"
#include "core/core_string_names.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/node_3d.h"
#include "scene/gui/control.h"
diff --git a/scene/resources/packed_scene.h b/scene/resources/packed_scene.h
index 004758afa5..b8b3f84ecc 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 "core/resource.h"
+#include "core/io/resource.h"
#include "scene/main/node.h"
class SceneState : public Reference {
diff --git a/scene/resources/particles_material.h b/scene/resources/particles_material.h
index 7aca708889..12fa53ef29 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 "core/rid.h"
+#include "core/templates/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 34aa7066df..e9222ffa1b 100644
--- a/scene/resources/physics_material.h
+++ b/scene/resources/physics_material.h
@@ -31,7 +31,7 @@
#ifndef PHYSICS_MATERIAL_H
#define PHYSICS_MATERIAL_H
-#include "core/resource.h"
+#include "core/io/resource.h"
#include "servers/physics_server_3d.h"
class PhysicsMaterial : public Resource {
diff --git a/scene/resources/polygon_path_finder.h b/scene/resources/polygon_path_finder.h
index baee4dc20d..44a97b4294 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 "core/resource.h"
+#include "core/io/resource.h"
class PolygonPathFinder : public Resource {
GDCLASS(PolygonPathFinder, Resource);
diff --git a/scene/resources/resource_format_text.cpp b/scene/resources/resource_format_text.cpp
index ba39593690..1d5f29ab14 100644
--- a/scene/resources/resource_format_text.cpp
+++ b/scene/resources/resource_format_text.cpp
@@ -30,9 +30,9 @@
#include "resource_format_text.h"
+#include "core/config/project_settings.h"
#include "core/io/resource_format_binary.h"
#include "core/os/dir_access.h"
-#include "core/project_settings.h"
#include "core/version.h"
//version 2: changed names for basis, aabb, Vectors, etc.
diff --git a/scene/resources/resource_format_text.h b/scene/resources/resource_format_text.h
index cf522c9364..ca7b0b021f 100644
--- a/scene/resources/resource_format_text.h
+++ b/scene/resources/resource_format_text.h
@@ -34,7 +34,7 @@
#include "core/io/resource_loader.h"
#include "core/io/resource_saver.h"
#include "core/os/file_access.h"
-#include "core/variant_parser.h"
+#include "core/variant/variant_parser.h"
#include "scene/resources/packed_scene.h"
class ResourceLoaderText {
diff --git a/scene/resources/shader.cpp b/scene/resources/shader.cpp
index 92f0353abf..76d37eaa71 100644
--- a/scene/resources/shader.cpp
+++ b/scene/resources/shader.cpp
@@ -29,6 +29,7 @@
/*************************************************************************/
#include "shader.h"
+
#include "core/os/file_access.h"
#include "scene/scene_string_names.h"
#include "servers/rendering/shader_language.h"
@@ -80,7 +81,7 @@ void Shader::get_param_list(List<PropertyInfo> *p_params) const {
params_cache[pi.name] = E->get().name;
if (p_params) {
//small little hack
- if (pi.type == Variant::_RID) {
+ if (pi.type == Variant::RID) {
pi.type = Variant::OBJECT;
}
p_params->push_back(pi);
diff --git a/scene/resources/shader.h b/scene/resources/shader.h
index 7dcec7811a..f2ea582ff0 100644
--- a/scene/resources/shader.h
+++ b/scene/resources/shader.h
@@ -31,9 +31,9 @@
#ifndef SHADER_H
#define SHADER_H
+#include "core/io/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_2d.h b/scene/resources/shape_2d.h
index bb4688a02d..495ffdd38b 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 "core/resource.h"
+#include "core/io/resource.h"
class Shape2D : public Resource {
GDCLASS(Shape2D, Resource);
diff --git a/scene/resources/shape_3d.h b/scene/resources/shape_3d.h
index eb9607e3a6..5a9c2e3b9c 100644
--- a/scene/resources/shape_3d.h
+++ b/scene/resources/shape_3d.h
@@ -31,7 +31,7 @@
#ifndef SHAPE_3D_H
#define SHAPE_3D_H
-#include "core/resource.h"
+#include "core/io/resource.h"
class ArrayMesh;
diff --git a/scene/resources/skin.h b/scene/resources/skin.h
index 57aaf1afd4..e6ed4f1768 100644
--- a/scene/resources/skin.h
+++ b/scene/resources/skin.h
@@ -31,7 +31,7 @@
#ifndef SKIN_H
#define SKIN_H
-#include "core/resource.h"
+#include "core/io/resource.h"
class Skin : public Resource {
GDCLASS(Skin, Resource)
diff --git a/scene/resources/sky_material.h b/scene/resources/sky_material.h
index 5e23020d66..5411994b7d 100644
--- a/scene/resources/sky_material.h
+++ b/scene/resources/sky_material.h
@@ -28,7 +28,7 @@
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
/*************************************************************************/
-#include "core/rid.h"
+#include "core/templates/rid.h"
#include "scene/resources/material.h"
#ifndef SKY_MATERIAL_H
diff --git a/scene/resources/style_box.h b/scene/resources/style_box.h
index c5caab1b5a..a1237776c6 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 "core/resource.h"
+#include "core/io/resource.h"
#include "scene/resources/texture.h"
#include "servers/rendering_server.h"
diff --git a/scene/resources/syntax_highlighter.cpp b/scene/resources/syntax_highlighter.cpp
index e7b49892d8..e3e4373fa9 100644
--- a/scene/resources/syntax_highlighter.cpp
+++ b/scene/resources/syntax_highlighter.cpp
@@ -30,7 +30,7 @@
#include "syntax_highlighter.h"
-#include "core/script_language.h"
+#include "core/object/script_language.h"
#include "scene/gui/text_edit.h"
Dictionary SyntaxHighlighter::get_line_syntax_highlighting(int p_line) {
diff --git a/scene/resources/syntax_highlighter.h b/scene/resources/syntax_highlighter.h
index 720227a256..62865920d3 100644
--- a/scene/resources/syntax_highlighter.h
+++ b/scene/resources/syntax_highlighter.h
@@ -31,7 +31,7 @@
#ifndef SYNTAX_HIGHLIGHTER_H
#define SYNTAX_HIGHLIGHTER_H
-#include "core/resource.h"
+#include "core/io/resource.h"
class TextEdit;
diff --git a/scene/resources/texture.h b/scene/resources/texture.h
index fd48afccda..3bc1ca8463 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.h"
#include "core/io/resource_loader.h"
#include "core/math/rect2.h"
#include "core/os/file_access.h"
#include "core/os/mutex.h"
#include "core/os/rw_lock.h"
#include "core/os/thread_safe.h"
-#include "core/resource.h"
#include "scene/resources/curve.h"
#include "scene/resources/gradient.h"
#include "servers/camera_server.h"
diff --git a/scene/resources/theme.cpp b/scene/resources/theme.cpp
index 6a85d357ff..a05abbb4c0 100644
--- a/scene/resources/theme.cpp
+++ b/scene/resources/theme.cpp
@@ -30,7 +30,7 @@
#include "theme.h"
#include "core/os/file_access.h"
-#include "core/print_string.h"
+#include "core/string/print_string.h"
void Theme::_emit_theme_changed() {
emit_changed();
diff --git a/scene/resources/theme.h b/scene/resources/theme.h
index 3c72ddd8a2..5f46ce6303 100644
--- a/scene/resources/theme.h
+++ b/scene/resources/theme.h
@@ -31,8 +31,8 @@
#ifndef THEME_H
#define THEME_H
+#include "core/io/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 dcd8f11400..4581763e9c 100644
--- a/scene/resources/tile_set.cpp
+++ b/scene/resources/tile_set.cpp
@@ -30,9 +30,9 @@
#include "tile_set.h"
-#include "core/array.h"
-#include "core/engine.h"
+#include "core/config/engine.h"
#include "core/math/geometry_2d.h"
+#include "core/variant/array.h"
bool TileSet::_set(const StringName &p_name, const Variant &p_value) {
String n = p_name;
diff --git a/scene/resources/tile_set.h b/scene/resources/tile_set.h
index aab428aa21..79f1b4aa95 100644
--- a/scene/resources/tile_set.h
+++ b/scene/resources/tile_set.h
@@ -31,8 +31,8 @@
#ifndef TILE_SET_H
#define TILE_SET_H
-#include "core/array.h"
-#include "core/resource.h"
+#include "core/io/resource.h"
+#include "core/variant/array.h"
#include "scene/2d/light_occluder_2d.h"
#include "scene/2d/navigation_region_2d.h"
#include "scene/resources/convex_polygon_shape_2d.h"
diff --git a/scene/resources/visual_shader.cpp b/scene/resources/visual_shader.cpp
index ac68b6a079..141d4b09f5 100644
--- a/scene/resources/visual_shader.cpp
+++ b/scene/resources/visual_shader.cpp
@@ -30,7 +30,7 @@
#include "visual_shader.h"
-#include "core/vmap.h"
+#include "core/templates/vmap.h"
#include "servers/rendering/shader_types.h"
#include "visual_shader_nodes.h"
diff --git a/scene/resources/visual_shader.h b/scene/resources/visual_shader.h
index e3d8dae032..41c4642ee3 100644
--- a/scene/resources/visual_shader.h
+++ b/scene/resources/visual_shader.h
@@ -31,7 +31,7 @@
#ifndef VISUAL_SHADER_H
#define VISUAL_SHADER_H
-#include "core/string_builder.h"
+#include "core/string/string_builder.h"
#include "scene/gui/control.h"
#include "scene/resources/shader.h"
diff --git a/scene/resources/world_2d.cpp b/scene/resources/world_2d.cpp
index d2bc2bea31..41d3fe20be 100644
--- a/scene/resources/world_2d.cpp
+++ b/scene/resources/world_2d.cpp
@@ -30,7 +30,7 @@
#include "world_2d.h"
-#include "core/project_settings.h"
+#include "core/config/project_settings.h"
#include "scene/2d/camera_2d.h"
#include "scene/2d/visibility_notifier_2d.h"
#include "scene/main/window.h"
@@ -341,8 +341,8 @@ void World2D::_bind_methods() {
ClassDB::bind_method(D_METHOD("get_direct_space_state"), &World2D::get_direct_space_state);
- ADD_PROPERTY(PropertyInfo(Variant::_RID, "canvas", PROPERTY_HINT_NONE, "", 0), "", "get_canvas");
- ADD_PROPERTY(PropertyInfo(Variant::_RID, "space", PROPERTY_HINT_NONE, "", 0), "", "get_space");
+ ADD_PROPERTY(PropertyInfo(Variant::RID, "canvas", PROPERTY_HINT_NONE, "", 0), "", "get_canvas");
+ ADD_PROPERTY(PropertyInfo(Variant::RID, "space", PROPERTY_HINT_NONE, "", 0), "", "get_space");
ADD_PROPERTY(PropertyInfo(Variant::OBJECT, "direct_space_state", PROPERTY_HINT_RESOURCE_TYPE, "PhysicsDirectSpaceState2D", 0), "", "get_direct_space_state");
}
diff --git a/scene/resources/world_2d.h b/scene/resources/world_2d.h
index c330719104..11614f9aa4 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 "core/project_settings.h"
-#include "core/resource.h"
+#include "core/config/project_settings.h"
+#include "core/io/resource.h"
#include "servers/physics_server_2d.h"
class VisibilityNotifier2D;
diff --git a/scene/resources/world_3d.cpp b/scene/resources/world_3d.cpp
index 8100f150ef..b8fb3825ce 100644
--- a/scene/resources/world_3d.cpp
+++ b/scene/resources/world_3d.cpp
@@ -321,8 +321,8 @@ void World3D::_bind_methods() {
ADD_PROPERTY(PropertyInfo(Variant::OBJECT, "environment", PROPERTY_HINT_RESOURCE_TYPE, "Environment"), "set_environment", "get_environment");
ADD_PROPERTY(PropertyInfo(Variant::OBJECT, "fallback_environment", PROPERTY_HINT_RESOURCE_TYPE, "Environment"), "set_fallback_environment", "get_fallback_environment");
ADD_PROPERTY(PropertyInfo(Variant::OBJECT, "camera_effects", PROPERTY_HINT_RESOURCE_TYPE, "CameraEffects"), "set_camera_effects", "get_camera_effects");
- ADD_PROPERTY(PropertyInfo(Variant::_RID, "space", PROPERTY_HINT_NONE, "", 0), "", "get_space");
- ADD_PROPERTY(PropertyInfo(Variant::_RID, "scenario", PROPERTY_HINT_NONE, "", 0), "", "get_scenario");
+ ADD_PROPERTY(PropertyInfo(Variant::RID, "space", PROPERTY_HINT_NONE, "", 0), "", "get_space");
+ ADD_PROPERTY(PropertyInfo(Variant::RID, "scenario", PROPERTY_HINT_NONE, "", 0), "", "get_scenario");
ADD_PROPERTY(PropertyInfo(Variant::OBJECT, "direct_space_state", PROPERTY_HINT_RESOURCE_TYPE, "PhysicsDirectSpaceState3D", 0), "", "get_direct_space_state");
}
diff --git a/scene/resources/world_3d.h b/scene/resources/world_3d.h
index 02a821637f..93e9c72e59 100644
--- a/scene/resources/world_3d.h
+++ b/scene/resources/world_3d.h
@@ -31,7 +31,7 @@
#ifndef WORLD_3D_H
#define WORLD_3D_H
-#include "core/resource.h"
+#include "core/io/resource.h"
#include "scene/resources/camera_effects.h"
#include "scene/resources/environment.h"
#include "servers/physics_server_3d.h"
diff --git a/scene/scene_string_names.h b/scene/scene_string_names.h
index 1ae244492e..b1168c84b9 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 "core/node_path.h"
-#include "core/string_name.h"
+#include "core/string/node_path.h"
+#include "core/string/string_name.h"
class SceneStringNames {
friend void register_scene_types();
diff --git a/servers/audio/audio_driver_dummy.cpp b/servers/audio/audio_driver_dummy.cpp
index ff0d2cad65..a2abbeb686 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 "core/config/project_settings.h"
#include "core/os/os.h"
-#include "core/project_settings.h"
Error AudioDriverDummy::init() {
active = false;
diff --git a/servers/audio/audio_effect.h b/servers/audio/audio_effect.h
index 76cb8a209c..b1be5dfea1 100644
--- a/servers/audio/audio_effect.h
+++ b/servers/audio/audio_effect.h
@@ -31,8 +31,8 @@
#ifndef AUDIOEFFECT_H
#define AUDIOEFFECT_H
+#include "core/io/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_stream.cpp b/servers/audio/audio_stream.cpp
index 2cc2f5c291..a7c9443dcf 100644
--- a/servers/audio/audio_stream.cpp
+++ b/servers/audio/audio_stream.cpp
@@ -30,8 +30,8 @@
#include "audio_stream.h"
+#include "core/config/project_settings.h"
#include "core/os/os.h"
-#include "core/project_settings.h"
//////////////////////////////
diff --git a/servers/audio/audio_stream.h b/servers/audio/audio_stream.h
index 9720196cc2..0bbb29b15c 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 "core/image.h"
-#include "core/resource.h"
+#include "core/io/image.h"
+#include "core/io/resource.h"
#include "servers/audio/audio_filter_sw.h"
#include "servers/audio_server.h"
diff --git a/servers/audio/effects/audio_stream_generator.h b/servers/audio/effects/audio_stream_generator.h
index c90983a66f..49bda0fcf9 100644
--- a/servers/audio/effects/audio_stream_generator.h
+++ b/servers/audio/effects/audio_stream_generator.h
@@ -31,7 +31,7 @@
#ifndef AUDIO_STREAM_GENERATOR_H
#define AUDIO_STREAM_GENERATOR_H
-#include "core/ring_buffer.h"
+#include "core/templates/ring_buffer.h"
#include "servers/audio/audio_stream.h"
class AudioStreamGenerator : public AudioStream {
diff --git a/servers/audio/effects/eq.cpp b/servers/audio/effects/eq.cpp
index 08a6cf55fa..15abeea5f3 100644
--- a/servers/audio/effects/eq.cpp
+++ b/servers/audio/effects/eq.cpp
@@ -31,7 +31,7 @@
// Author: reduzio@gmail.com (C) 2006
#include "eq.h"
-#include "core/error_macros.h"
+#include "core/error/error_macros.h"
#include "core/math/math_funcs.h"
#include <math.h>
diff --git a/servers/audio/effects/eq.h b/servers/audio/effects/eq.h
index 391a7aa24b..720c4dfcaf 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 "core/templates/vector.h"
#include "core/typedefs.h"
-#include "core/vector.h"
/**
@author Juan Linietsky
diff --git a/servers/audio_server.cpp b/servers/audio_server.cpp
index b899c19fdd..bea5e9e432 100644
--- a/servers/audio_server.cpp
+++ b/servers/audio_server.cpp
@@ -30,11 +30,11 @@
#include "audio_server.h"
+#include "core/config/project_settings.h"
#include "core/debugger/engine_debugger.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 31537e8326..507aea7b89 100644
--- a/servers/audio_server.h
+++ b/servers/audio_server.h
@@ -31,10 +31,10 @@
#ifndef AUDIO_SERVER_H
#define AUDIO_SERVER_H
-#include "core/class_db.h"
#include "core/math/audio_frame.h"
+#include "core/object/class_db.h"
#include "core/os/os.h"
-#include "core/variant.h"
+#include "core/variant/variant.h"
#include "servers/audio/audio_effect.h"
class AudioDriverDummy;
diff --git a/servers/camera/camera_feed.h b/servers/camera/camera_feed.h
index 52a737cd8d..dca583c9de 100644
--- a/servers/camera/camera_feed.h
+++ b/servers/camera/camera_feed.h
@@ -31,7 +31,7 @@
#ifndef CAMERA_FEED_H
#define CAMERA_FEED_H
-#include "core/image.h"
+#include "core/io/image.h"
#include "core/math/transform_2d.h"
#include "servers/camera_server.h"
#include "servers/rendering_server.h"
diff --git a/servers/camera_server.h b/servers/camera_server.h
index 7723e30974..54acce006a 100644
--- a/servers/camera_server.h
+++ b/servers/camera_server.h
@@ -31,11 +31,11 @@
#ifndef CAMERA_SERVER_H
#define CAMERA_SERVER_H
-#include "core/class_db.h"
+#include "core/object/class_db.h"
+#include "core/object/reference.h"
#include "core/os/thread_safe.h"
-#include "core/reference.h"
-#include "core/rid.h"
-#include "core/variant.h"
+#include "core/templates/rid.h"
+#include "core/variant/variant.h"
/**
@author Bastiaan Olij <mux213@gmail.com>
diff --git a/servers/display_server.h b/servers/display_server.h
index 3ee0da709b..c2ffb23531 100644
--- a/servers/display_server.h
+++ b/servers/display_server.h
@@ -31,10 +31,10 @@
#ifndef DISPLAY_SERVER_H
#define DISPLAY_SERVER_H
-#include "core/callable.h"
#include "core/input/input.h"
+#include "core/io/resource.h"
#include "core/os/os.h"
-#include "core/resource.h"
+#include "core/variant/callable.h"
class Texture2D;
diff --git a/servers/navigation_server_2d.h b/servers/navigation_server_2d.h
index 6575426e73..895e41558a 100644
--- a/servers/navigation_server_2d.h
+++ b/servers/navigation_server_2d.h
@@ -35,8 +35,8 @@
#ifndef NAVIGATION_2D_SERVER_H
#define NAVIGATION_2D_SERVER_H
-#include "core/class_db.h"
-#include "core/rid.h"
+#include "core/object/class_db.h"
+#include "core/templates/rid.h"
#include "scene/2d/navigation_region_2d.h"
// This server exposes the `NavigationServer3D` features in the 2D world.
diff --git a/servers/navigation_server_3d.h b/servers/navigation_server_3d.h
index 7a3e4f5f8f..e6421462b0 100644
--- a/servers/navigation_server_3d.h
+++ b/servers/navigation_server_3d.h
@@ -35,8 +35,8 @@
#ifndef NAVIGATION_SERVER_H
#define NAVIGATION_SERVER_H
-#include "core/class_db.h"
-#include "core/rid.h"
+#include "core/object/class_db.h"
+#include "core/templates/rid.h"
#include "scene/3d/navigation_region_3d.h"
/// This server uses the concept of internal mutability.
diff --git a/servers/physics_2d/area_2d_sw.h b/servers/physics_2d/area_2d_sw.h
index f14466f582..d6b358a657 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 "core/self_list.h"
+#include "core/templates/self_list.h"
#include "servers/physics_server_2d.h"
//#include "servers/physics_3d/query_sw.h"
diff --git a/servers/physics_2d/body_2d_sw.h b/servers/physics_2d/body_2d_sw.h
index 4a3ef718ec..bbc22a67df 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 "core/vset.h"
+#include "core/templates/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 ec5cfdbf1d..97e1c900b9 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 "core/map.h"
+#include "core/templates/map.h"
#include "space_2d_sw.h"
class BroadPhase2DBasic : public BroadPhase2DSW {
struct Element {
diff --git a/servers/physics_2d/broad_phase_2d_hash_grid.cpp b/servers/physics_2d/broad_phase_2d_hash_grid.cpp
index ec74507e03..c8b3d193c9 100644
--- a/servers/physics_2d/broad_phase_2d_hash_grid.cpp
+++ b/servers/physics_2d/broad_phase_2d_hash_grid.cpp
@@ -30,7 +30,7 @@
#include "broad_phase_2d_hash_grid.h"
#include "collision_object_2d_sw.h"
-#include "core/project_settings.h"
+#include "core/config/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 de1ada0932..54994992c9 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 "core/map.h"
+#include "core/templates/map.h"
class BroadPhase2DHashGrid : public BroadPhase2DSW {
struct PairData {
diff --git a/servers/physics_2d/collision_object_2d_sw.h b/servers/physics_2d/collision_object_2d_sw.h
index 8caa53680d..36b7073a5c 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 "core/self_list.h"
+#include "core/templates/self_list.h"
#include "servers/physics_server_2d.h"
#include "shape_2d_sw.h"
diff --git a/servers/physics_2d/physics_server_2d_sw.cpp b/servers/physics_2d/physics_server_2d_sw.cpp
index 1b396190e9..9d00d01759 100644
--- a/servers/physics_2d/physics_server_2d_sw.cpp
+++ b/servers/physics_2d/physics_server_2d_sw.cpp
@@ -33,9 +33,9 @@
#include "broad_phase_2d_basic.h"
#include "broad_phase_2d_hash_grid.h"
#include "collision_solver_2d_sw.h"
+#include "core/config/project_settings.h"
#include "core/debugger/engine_debugger.h"
#include "core/os/os.h"
-#include "core/project_settings.h"
#define FLUSH_QUERY_CHECK(m_object) \
ERR_FAIL_COND_MSG(m_object->get_space() && flushing_queries, "Can't change this state while flushing queries. Use call_deferred() or set_deferred() to change monitoring state instead.");
diff --git a/servers/physics_2d/physics_server_2d_sw.h b/servers/physics_2d/physics_server_2d_sw.h
index e88db28056..9bd9655e2c 100644
--- a/servers/physics_2d/physics_server_2d_sw.h
+++ b/servers/physics_2d/physics_server_2d_sw.h
@@ -31,7 +31,7 @@
#ifndef PHYSICS_2D_SERVER_SW
#define PHYSICS_2D_SERVER_SW
-#include "core/rid_owner.h"
+#include "core/templates/rid_owner.h"
#include "joints_2d_sw.h"
#include "servers/physics_server_2d.h"
#include "shape_2d_sw.h"
diff --git a/servers/physics_2d/physics_server_2d_wrap_mt.h b/servers/physics_2d/physics_server_2d_wrap_mt.h
index 586dbe9e12..1269cadd33 100644
--- a/servers/physics_2d/physics_server_2d_wrap_mt.h
+++ b/servers/physics_2d/physics_server_2d_wrap_mt.h
@@ -31,9 +31,9 @@
#ifndef PHYSICS2DSERVERWRAPMT_H
#define PHYSICS2DSERVERWRAPMT_H
-#include "core/command_queue_mt.h"
+#include "core/config/project_settings.h"
#include "core/os/thread.h"
-#include "core/project_settings.h"
+#include "core/templates/command_queue_mt.h"
#include "servers/physics_server_2d.h"
#ifdef DEBUG_SYNC
diff --git a/servers/physics_2d/shape_2d_sw.cpp b/servers/physics_2d/shape_2d_sw.cpp
index 87e22ef1c9..afb1112fc0 100644
--- a/servers/physics_2d/shape_2d_sw.cpp
+++ b/servers/physics_2d/shape_2d_sw.cpp
@@ -31,7 +31,7 @@
#include "shape_2d_sw.h"
#include "core/math/geometry_2d.h"
-#include "core/sort_array.h"
+#include "core/templates/sort_array.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 966dcbd651..a8ab731ead 100644
--- a/servers/physics_2d/space_2d_sw.cpp
+++ b/servers/physics_2d/space_2d_sw.cpp
@@ -32,7 +32,7 @@
#include "collision_solver_2d_sw.h"
#include "core/os/os.h"
-#include "core/pair.h"
+#include "core/templates/pair.h"
#include "physics_server_2d_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) {
if (!(p_object->get_collision_layer() & p_collision_mask)) {
diff --git a/servers/physics_2d/space_2d_sw.h b/servers/physics_2d/space_2d_sw.h
index 1eee83dfe9..5c5144ae22 100644
--- a/servers/physics_2d/space_2d_sw.h
+++ b/servers/physics_2d/space_2d_sw.h
@@ -37,8 +37,8 @@
#include "body_pair_2d_sw.h"
#include "broad_phase_2d_sw.h"
#include "collision_object_2d_sw.h"
-#include "core/hash_map.h"
-#include "core/project_settings.h"
+#include "core/config/project_settings.h"
+#include "core/templates/hash_map.h"
#include "core/typedefs.h"
class PhysicsDirectSpaceState2DSW : public PhysicsDirectSpaceState2D {
diff --git a/servers/physics_3d/area_3d_sw.h b/servers/physics_3d/area_3d_sw.h
index 6af3976167..a2efe6af51 100644
--- a/servers/physics_3d/area_3d_sw.h
+++ b/servers/physics_3d/area_3d_sw.h
@@ -32,7 +32,7 @@
#define AREA_SW_H
#include "collision_object_3d_sw.h"
-#include "core/self_list.h"
+#include "core/templates/self_list.h"
#include "servers/physics_server_3d.h"
//#include "servers/physics_3d/query_sw.h"
diff --git a/servers/physics_3d/body_3d_sw.h b/servers/physics_3d/body_3d_sw.h
index b642729404..6dbda8670a 100644
--- a/servers/physics_3d/body_3d_sw.h
+++ b/servers/physics_3d/body_3d_sw.h
@@ -33,7 +33,7 @@
#include "area_3d_sw.h"
#include "collision_object_3d_sw.h"
-#include "core/vset.h"
+#include "core/templates/vset.h"
class Constraint3DSW;
diff --git a/servers/physics_3d/broad_phase_3d_basic.cpp b/servers/physics_3d/broad_phase_3d_basic.cpp
index f5ea1897a9..15a5968087 100644
--- a/servers/physics_3d/broad_phase_3d_basic.cpp
+++ b/servers/physics_3d/broad_phase_3d_basic.cpp
@@ -29,8 +29,8 @@
/*************************************************************************/
#include "broad_phase_3d_basic.h"
-#include "core/list.h"
-#include "core/print_string.h"
+#include "core/string/print_string.h"
+#include "core/templates/list.h"
BroadPhase3DSW::ID BroadPhase3DBasic::create(CollisionObject3DSW *p_object, int p_subindex) {
ERR_FAIL_COND_V(p_object == nullptr, 0);
diff --git a/servers/physics_3d/broad_phase_3d_basic.h b/servers/physics_3d/broad_phase_3d_basic.h
index 4b644bf818..361d322e14 100644
--- a/servers/physics_3d/broad_phase_3d_basic.h
+++ b/servers/physics_3d/broad_phase_3d_basic.h
@@ -32,7 +32,7 @@
#define BROAD_PHASE_BASIC_H
#include "broad_phase_3d_sw.h"
-#include "core/map.h"
+#include "core/templates/map.h"
class BroadPhase3DBasic : public BroadPhase3DSW {
struct Element {
diff --git a/servers/physics_3d/collision_object_3d_sw.h b/servers/physics_3d/collision_object_3d_sw.h
index a3a5787ced..e1220f8855 100644
--- a/servers/physics_3d/collision_object_3d_sw.h
+++ b/servers/physics_3d/collision_object_3d_sw.h
@@ -32,7 +32,7 @@
#define COLLISION_OBJECT_SW_H
#include "broad_phase_3d_sw.h"
-#include "core/self_list.h"
+#include "core/templates/self_list.h"
#include "servers/physics_server_3d.h"
#include "shape_3d_sw.h"
diff --git a/servers/physics_3d/physics_server_3d_sw.h b/servers/physics_3d/physics_server_3d_sw.h
index d9c86312cc..a45ee7c2c8 100644
--- a/servers/physics_3d/physics_server_3d_sw.h
+++ b/servers/physics_3d/physics_server_3d_sw.h
@@ -31,7 +31,7 @@
#ifndef PHYSICS_SERVER_SW
#define PHYSICS_SERVER_SW
-#include "core/rid_owner.h"
+#include "core/templates/rid_owner.h"
#include "joints_3d_sw.h"
#include "servers/physics_server_3d.h"
#include "shape_3d_sw.h"
diff --git a/servers/physics_3d/shape_3d_sw.cpp b/servers/physics_3d/shape_3d_sw.cpp
index ca33241d29..b8b01de3c3 100644
--- a/servers/physics_3d/shape_3d_sw.cpp
+++ b/servers/physics_3d/shape_3d_sw.cpp
@@ -32,7 +32,7 @@
#include "core/math/geometry_3d.h"
#include "core/math/quick_hull.h"
-#include "core/sort_array.h"
+#include "core/templates/sort_array.h"
#define _POINT_SNAP 0.001953125
#define _EDGE_IS_VALID_SUPPORT_THRESHOLD 0.0002
diff --git a/servers/physics_3d/space_3d_sw.cpp b/servers/physics_3d/space_3d_sw.cpp
index 48f250ba35..d9170cd986 100644
--- a/servers/physics_3d/space_3d_sw.cpp
+++ b/servers/physics_3d/space_3d_sw.cpp
@@ -31,7 +31,7 @@
#include "space_3d_sw.h"
#include "collision_solver_3d_sw.h"
-#include "core/project_settings.h"
+#include "core/config/project_settings.h"
#include "physics_server_3d_sw.h"
_FORCE_INLINE_ static bool _can_collide_with(CollisionObject3DSW *p_object, uint32_t p_collision_mask, bool p_collide_with_bodies, bool p_collide_with_areas) {
diff --git a/servers/physics_3d/space_3d_sw.h b/servers/physics_3d/space_3d_sw.h
index 4aba80c8f3..6380bcc6dc 100644
--- a/servers/physics_3d/space_3d_sw.h
+++ b/servers/physics_3d/space_3d_sw.h
@@ -37,8 +37,8 @@
#include "body_pair_3d_sw.h"
#include "broad_phase_3d_sw.h"
#include "collision_object_3d_sw.h"
-#include "core/hash_map.h"
-#include "core/project_settings.h"
+#include "core/config/project_settings.h"
+#include "core/templates/hash_map.h"
#include "core/typedefs.h"
class PhysicsDirectSpaceState3DSW : public PhysicsDirectSpaceState3D {
diff --git a/servers/physics_server_2d.cpp b/servers/physics_server_2d.cpp
index 4338a6938a..1ea8985543 100644
--- a/servers/physics_server_2d.cpp
+++ b/servers/physics_server_2d.cpp
@@ -30,8 +30,8 @@
#include "physics_server_2d.h"
-#include "core/print_string.h"
-#include "core/project_settings.h"
+#include "core/config/project_settings.h"
+#include "core/string/print_string.h"
PhysicsServer2D *PhysicsServer2D::singleton = nullptr;
@@ -245,11 +245,11 @@ void PhysicsShapeQueryParameters2D::_bind_methods() {
ClassDB::bind_method(D_METHOD("is_collide_with_areas_enabled"), &PhysicsShapeQueryParameters2D::is_collide_with_areas_enabled);
ADD_PROPERTY(PropertyInfo(Variant::INT, "collision_layer", PROPERTY_HINT_LAYERS_2D_PHYSICS), "set_collision_layer", "get_collision_layer");
- ADD_PROPERTY(PropertyInfo(Variant::ARRAY, "exclude", PROPERTY_HINT_NONE, itos(Variant::_RID) + ":"), "set_exclude", "get_exclude");
+ ADD_PROPERTY(PropertyInfo(Variant::ARRAY, "exclude", PROPERTY_HINT_NONE, itos(Variant::RID) + ":"), "set_exclude", "get_exclude");
ADD_PROPERTY(PropertyInfo(Variant::FLOAT, "margin", PROPERTY_HINT_RANGE, "0,100,0.01"), "set_margin", "get_margin");
ADD_PROPERTY(PropertyInfo(Variant::VECTOR2, "motion"), "set_motion", "get_motion");
ADD_PROPERTY(PropertyInfo(Variant::OBJECT, "shape", PROPERTY_HINT_RESOURCE_TYPE, "Shape2D"), "set_shape", "get_shape");
- ADD_PROPERTY(PropertyInfo(Variant::_RID, "shape_rid"), "set_shape_rid", "get_shape_rid");
+ ADD_PROPERTY(PropertyInfo(Variant::RID, "shape_rid"), "set_shape_rid", "get_shape_rid");
ADD_PROPERTY(PropertyInfo(Variant::TRANSFORM2D, "transform"), "set_transform", "get_transform");
ADD_PROPERTY(PropertyInfo(Variant::BOOL, "collide_with_bodies"), "set_collide_with_bodies", "is_collide_with_bodies_enabled");
ADD_PROPERTY(PropertyInfo(Variant::BOOL, "collide_with_areas"), "set_collide_with_areas", "is_collide_with_areas_enabled");
@@ -504,7 +504,7 @@ void PhysicsTestMotionResult2D::_bind_methods() {
ADD_PROPERTY(PropertyInfo(Variant::VECTOR2, "collision_normal"), "", "get_collision_normal");
ADD_PROPERTY(PropertyInfo(Variant::VECTOR2, "collider_velocity"), "", "get_collider_velocity");
ADD_PROPERTY(PropertyInfo(Variant::INT, "collider_id", PROPERTY_HINT_OBJECT_ID), "", "get_collider_id");
- ADD_PROPERTY(PropertyInfo(Variant::_RID, "collider_rid"), "", "get_collider_rid");
+ ADD_PROPERTY(PropertyInfo(Variant::RID, "collider_rid"), "", "get_collider_rid");
ADD_PROPERTY(PropertyInfo(Variant::OBJECT, "collider"), "", "get_collider");
ADD_PROPERTY(PropertyInfo(Variant::INT, "collider_shape"), "", "get_collider_shape");
}
diff --git a/servers/physics_server_2d.h b/servers/physics_server_2d.h
index 40773e4ced..283a2ab58c 100644
--- a/servers/physics_server_2d.h
+++ b/servers/physics_server_2d.h
@@ -31,9 +31,9 @@
#ifndef PHYSICS_2D_SERVER_H
#define PHYSICS_2D_SERVER_H
-#include "core/class_db.h"
-#include "core/reference.h"
-#include "core/resource.h"
+#include "core/io/resource.h"
+#include "core/object/class_db.h"
+#include "core/object/reference.h"
class PhysicsDirectSpaceState2D;
diff --git a/servers/physics_server_3d.cpp b/servers/physics_server_3d.cpp
index d0266f95b5..fabd661970 100644
--- a/servers/physics_server_3d.cpp
+++ b/servers/physics_server_3d.cpp
@@ -30,8 +30,8 @@
#include "physics_server_3d.h"
-#include "core/print_string.h"
-#include "core/project_settings.h"
+#include "core/config/project_settings.h"
+#include "core/string/print_string.h"
PhysicsServer3D *PhysicsServer3D::singleton = nullptr;
@@ -238,10 +238,10 @@ void PhysicsShapeQueryParameters3D::_bind_methods() {
ClassDB::bind_method(D_METHOD("is_collide_with_areas_enabled"), &PhysicsShapeQueryParameters3D::is_collide_with_areas_enabled);
ADD_PROPERTY(PropertyInfo(Variant::INT, "collision_mask", PROPERTY_HINT_LAYERS_3D_PHYSICS), "set_collision_mask", "get_collision_mask");
- ADD_PROPERTY(PropertyInfo(Variant::ARRAY, "exclude", PROPERTY_HINT_NONE, itos(Variant::_RID) + ":"), "set_exclude", "get_exclude");
+ ADD_PROPERTY(PropertyInfo(Variant::ARRAY, "exclude", PROPERTY_HINT_NONE, itos(Variant::RID) + ":"), "set_exclude", "get_exclude");
ADD_PROPERTY(PropertyInfo(Variant::FLOAT, "margin", PROPERTY_HINT_RANGE, "0,100,0.01"), "set_margin", "get_margin");
ADD_PROPERTY(PropertyInfo(Variant::OBJECT, "shape", PROPERTY_HINT_RESOURCE_TYPE, "Shape3D"), "set_shape", "get_shape");
- ADD_PROPERTY(PropertyInfo(Variant::_RID, "shape_rid"), "set_shape_rid", "get_shape_rid");
+ ADD_PROPERTY(PropertyInfo(Variant::RID, "shape_rid"), "set_shape_rid", "get_shape_rid");
ADD_PROPERTY(PropertyInfo(Variant::TRANSFORM, "transform"), "set_transform", "get_transform");
ADD_PROPERTY(PropertyInfo(Variant::BOOL, "collide_with_bodies"), "set_collide_with_bodies", "is_collide_with_bodies_enabled");
ADD_PROPERTY(PropertyInfo(Variant::BOOL, "collide_with_areas"), "set_collide_with_areas", "is_collide_with_areas_enabled");
diff --git a/servers/physics_server_3d.h b/servers/physics_server_3d.h
index d79dc6fec0..90ef2bb8dd 100644
--- a/servers/physics_server_3d.h
+++ b/servers/physics_server_3d.h
@@ -31,8 +31,8 @@
#ifndef PHYSICS_SERVER_H
#define PHYSICS_SERVER_H
-#include "core/class_db.h"
-#include "core/resource.h"
+#include "core/io/resource.h"
+#include "core/object/class_db.h"
class PhysicsDirectSpaceState3D;
diff --git a/servers/register_server_types.cpp b/servers/register_server_types.cpp
index adca7b8055..34980aaf66 100644
--- a/servers/register_server_types.cpp
+++ b/servers/register_server_types.cpp
@@ -30,8 +30,8 @@
#include "register_server_types.h"
-#include "core/engine.h"
-#include "core/project_settings.h"
+#include "core/config/engine.h"
+#include "core/config/project_settings.h"
#include "audio/audio_effect.h"
#include "audio/audio_stream.h"
diff --git a/servers/rendering/rasterizer.cpp b/servers/rendering/rasterizer.cpp
index 566a14b655..32084c8a3e 100644
--- a/servers/rendering/rasterizer.cpp
+++ b/servers/rendering/rasterizer.cpp
@@ -31,7 +31,7 @@
#include "rasterizer.h"
#include "core/os/os.h"
-#include "core/print_string.h"
+#include "core/string/print_string.h"
Rasterizer *(*Rasterizer::_create_func)() = nullptr;
diff --git a/servers/rendering/rasterizer.h b/servers/rendering/rasterizer.h
index 02aa329b07..efaa8f138a 100644
--- a/servers/rendering/rasterizer.h
+++ b/servers/rendering/rasterizer.h
@@ -32,8 +32,8 @@
#define RASTERIZER_H
#include "core/math/camera_matrix.h"
-#include "core/pair.h"
-#include "core/self_list.h"
+#include "core/templates/pair.h"
+#include "core/templates/self_list.h"
#include "servers/rendering_server.h"
class RasterizerScene {
diff --git a/servers/rendering/rasterizer_rd/rasterizer_canvas_rd.cpp b/servers/rendering/rasterizer_rd/rasterizer_canvas_rd.cpp
index b33940b22c..01ed7b8d6a 100644
--- a/servers/rendering/rasterizer_rd/rasterizer_canvas_rd.cpp
+++ b/servers/rendering/rasterizer_rd/rasterizer_canvas_rd.cpp
@@ -29,8 +29,8 @@
/*************************************************************************/
#include "rasterizer_canvas_rd.h"
+#include "core/config/project_settings.h"
#include "core/math/math_funcs.h"
-#include "core/project_settings.h"
#include "rasterizer_rd.h"
void RasterizerCanvasRD::_update_transform_2d_to_mat4(const Transform2D &p_transform, float *p_mat4) {
@@ -328,7 +328,7 @@ void RasterizerCanvasRD::_bind_canvas_texture(RD::DrawListID p_draw_list, RID p_
bool use_normal;
bool use_specular;
- bool success = storage->canvas_texture_get_unifom_set(p_texture, p_base_filter, p_base_repeat, shader.default_version_rd_shader, CANVAS_TEXTURE_UNIFORM_SET, uniform_set, size, specular_shininess, use_normal, use_specular);
+ bool success = storage->canvas_texture_get_uniform_set(p_texture, p_base_filter, p_base_repeat, shader.default_version_rd_shader, CANVAS_TEXTURE_UNIFORM_SET, uniform_set, size, specular_shininess, use_normal, use_specular);
//something odd happened
if (!success) {
_bind_canvas_texture(p_draw_list, default_canvas_texture, p_base_filter, p_base_repeat, r_last_texture, push_constant, r_texpixel_size);
diff --git a/servers/rendering/rasterizer_rd/rasterizer_effects_rd.cpp b/servers/rendering/rasterizer_rd/rasterizer_effects_rd.cpp
index d669db1b4b..97c1e7ba70 100644
--- a/servers/rendering/rasterizer_rd/rasterizer_effects_rd.cpp
+++ b/servers/rendering/rasterizer_rd/rasterizer_effects_rd.cpp
@@ -30,8 +30,8 @@
#include "rasterizer_effects_rd.h"
+#include "core/config/project_settings.h"
#include "core/os/os.h"
-#include "core/project_settings.h"
#include "thirdparty/misc/cubemap_coeffs.h"
diff --git a/servers/rendering/rasterizer_rd/rasterizer_rd.cpp b/servers/rendering/rasterizer_rd/rasterizer_rd.cpp
index 509bd3ee73..5f8cf0ee8c 100644
--- a/servers/rendering/rasterizer_rd/rasterizer_rd.cpp
+++ b/servers/rendering/rasterizer_rd/rasterizer_rd.cpp
@@ -30,7 +30,7 @@
#include "rasterizer_rd.h"
-#include "core/project_settings.h"
+#include "core/config/project_settings.h"
void RasterizerRD::prepare_for_blitting_render_targets() {
RD::get_singleton()->prepare_screen_for_drawing();
diff --git a/servers/rendering/rasterizer_rd/rasterizer_rd.h b/servers/rendering/rasterizer_rd/rasterizer_rd.h
index cdcc6bfd73..59fb8d2049 100644
--- a/servers/rendering/rasterizer_rd/rasterizer_rd.h
+++ b/servers/rendering/rasterizer_rd/rasterizer_rd.h
@@ -32,7 +32,7 @@
#define RASTERIZER_RD_H
#include "core/os/os.h"
-#include "core/thread_work_pool.h"
+#include "core/templates/thread_work_pool.h"
#include "servers/rendering/rasterizer.h"
#include "servers/rendering/rasterizer_rd/rasterizer_canvas_rd.h"
#include "servers/rendering/rasterizer_rd/rasterizer_scene_high_end_rd.h"
diff --git a/servers/rendering/rasterizer_rd/rasterizer_scene_high_end_rd.cpp b/servers/rendering/rasterizer_rd/rasterizer_scene_high_end_rd.cpp
index 3fff593598..a275e46473 100644
--- a/servers/rendering/rasterizer_rd/rasterizer_scene_high_end_rd.cpp
+++ b/servers/rendering/rasterizer_rd/rasterizer_scene_high_end_rd.cpp
@@ -29,7 +29,7 @@
/*************************************************************************/
#include "rasterizer_scene_high_end_rd.h"
-#include "core/project_settings.h"
+#include "core/config/project_settings.h"
#include "servers/rendering/rendering_device.h"
#include "servers/rendering/rendering_server_raster.h"
diff --git a/servers/rendering/rasterizer_rd/rasterizer_scene_rd.cpp b/servers/rendering/rasterizer_rd/rasterizer_scene_rd.cpp
index 0cae141138..e1be9b0ef4 100644
--- a/servers/rendering/rasterizer_rd/rasterizer_scene_rd.cpp
+++ b/servers/rendering/rasterizer_rd/rasterizer_scene_rd.cpp
@@ -30,8 +30,8 @@
#include "rasterizer_scene_rd.h"
+#include "core/config/project_settings.h"
#include "core/os/os.h"
-#include "core/project_settings.h"
#include "rasterizer_rd.h"
#include "servers/rendering/rendering_server_raster.h"
diff --git a/servers/rendering/rasterizer_rd/rasterizer_scene_rd.h b/servers/rendering/rasterizer_rd/rasterizer_scene_rd.h
index 2ad712a9d3..3d5310bb7e 100644
--- a/servers/rendering/rasterizer_rd/rasterizer_scene_rd.h
+++ b/servers/rendering/rasterizer_rd/rasterizer_scene_rd.h
@@ -31,8 +31,8 @@
#ifndef RASTERIZER_SCENE_RD_H
#define RASTERIZER_SCENE_RD_H
-#include "core/local_vector.h"
-#include "core/rid_owner.h"
+#include "core/templates/local_vector.h"
+#include "core/templates/rid_owner.h"
#include "servers/rendering/rasterizer.h"
#include "servers/rendering/rasterizer_rd/light_cluster_builder.h"
#include "servers/rendering/rasterizer_rd/rasterizer_storage_rd.h"
diff --git a/servers/rendering/rasterizer_rd/rasterizer_storage_rd.cpp b/servers/rendering/rasterizer_rd/rasterizer_storage_rd.cpp
index 10c9293d67..8bd4362637 100644
--- a/servers/rendering/rasterizer_rd/rasterizer_storage_rd.cpp
+++ b/servers/rendering/rasterizer_rd/rasterizer_storage_rd.cpp
@@ -30,9 +30,9 @@
#include "rasterizer_storage_rd.h"
-#include "core/engine.h"
+#include "core/config/engine.h"
+#include "core/config/project_settings.h"
#include "core/io/resource_loader.h"
-#include "core/project_settings.h"
#include "rasterizer_rd.h"
#include "servers/rendering/shader_language.h"
@@ -1265,7 +1265,7 @@ void RasterizerStorageRD::canvas_texture_set_texture_repeat(RID p_canvas_texture
ct->clear_sets();
}
-bool RasterizerStorageRD::canvas_texture_get_unifom_set(RID p_texture, RS::CanvasItemTextureFilter p_base_filter, RS::CanvasItemTextureRepeat p_base_repeat, RID p_base_shader, int p_base_set, RID &r_uniform_set, Size2i &r_size, Color &r_specular_shininess, bool &r_use_normal, bool &r_use_specular) {
+bool RasterizerStorageRD::canvas_texture_get_uniform_set(RID p_texture, RS::CanvasItemTextureFilter p_base_filter, RS::CanvasItemTextureRepeat p_base_repeat, RID p_base_shader, int p_base_set, RID &r_uniform_set, Size2i &r_size, Color &r_specular_shininess, bool &r_use_normal, bool &r_use_specular) {
CanvasTexture *ct = nullptr;
Texture *t = texture_owner.getornull(p_texture);
diff --git a/servers/rendering/rasterizer_rd/rasterizer_storage_rd.h b/servers/rendering/rasterizer_rd/rasterizer_storage_rd.h
index 321bff9fdd..05cb1b4a73 100644
--- a/servers/rendering/rasterizer_rd/rasterizer_storage_rd.h
+++ b/servers/rendering/rasterizer_rd/rasterizer_storage_rd.h
@@ -31,7 +31,7 @@
#ifndef RASTERIZER_STORAGE_RD_H
#define RASTERIZER_STORAGE_RD_H
-#include "core/rid_owner.h"
+#include "core/templates/rid_owner.h"
#include "servers/rendering/rasterizer.h"
#include "servers/rendering/rasterizer_rd/rasterizer_effects_rd.h"
#include "servers/rendering/rasterizer_rd/shader_compiler_rd.h"
@@ -1185,7 +1185,7 @@ public:
virtual void canvas_texture_set_texture_filter(RID p_canvas_texture, RS::CanvasItemTextureFilter p_filter);
virtual void canvas_texture_set_texture_repeat(RID p_canvas_texture, RS::CanvasItemTextureRepeat p_repeat);
- bool canvas_texture_get_unifom_set(RID p_texture, RS::CanvasItemTextureFilter p_base_filter, RS::CanvasItemTextureRepeat p_base_repeat, RID p_base_shader, int p_base_set, RID &r_uniform_set, Size2i &r_size, Color &r_specular_shininess, bool &r_use_normal, bool &r_use_specular);
+ bool canvas_texture_get_uniform_set(RID p_texture, RS::CanvasItemTextureFilter p_base_filter, RS::CanvasItemTextureRepeat p_base_repeat, RID p_base_shader, int p_base_set, RID &r_uniform_set, Size2i &r_size, Color &r_specular_shininess, bool &r_use_normal, bool &r_use_specular);
/* SHADER API */
diff --git a/servers/rendering/rasterizer_rd/render_pipeline_vertex_format_cache_rd.h b/servers/rendering/rasterizer_rd/render_pipeline_vertex_format_cache_rd.h
index cf15e79586..6a72dbc77c 100644
--- a/servers/rendering/rasterizer_rd/render_pipeline_vertex_format_cache_rd.h
+++ b/servers/rendering/rasterizer_rd/render_pipeline_vertex_format_cache_rd.h
@@ -31,7 +31,7 @@
#ifndef RENDER_PIPELINE_CACHE_RD_H
#define RENDER_PIPELINE_CACHE_RD_H
-#include "core/spin_lock.h"
+#include "core/os/spin_lock.h"
#include "servers/rendering/rendering_device.h"
class RenderPipelineVertexFormatCacheRD {
diff --git a/servers/rendering/rasterizer_rd/shader_compiler_rd.cpp b/servers/rendering/rasterizer_rd/shader_compiler_rd.cpp
index 0a0c343e57..1a33e9a567 100644
--- a/servers/rendering/rasterizer_rd/shader_compiler_rd.cpp
+++ b/servers/rendering/rasterizer_rd/shader_compiler_rd.cpp
@@ -30,8 +30,8 @@
#include "shader_compiler_rd.h"
+#include "core/config/project_settings.h"
#include "core/os/os.h"
-#include "core/project_settings.h"
#include "rasterizer_storage_rd.h"
#include "servers/rendering_server.h"
diff --git a/servers/rendering/rasterizer_rd/shader_compiler_rd.h b/servers/rendering/rasterizer_rd/shader_compiler_rd.h
index 565520ec65..694f8fff91 100644
--- a/servers/rendering/rasterizer_rd/shader_compiler_rd.h
+++ b/servers/rendering/rasterizer_rd/shader_compiler_rd.h
@@ -31,7 +31,7 @@
#ifndef SHADER_COMPILER_RD_H
#define SHADER_COMPILER_RD_H
-#include "core/pair.h"
+#include "core/templates/pair.h"
#include "servers/rendering/shader_language.h"
#include "servers/rendering/shader_types.h"
#include "servers/rendering_server.h"
diff --git a/servers/rendering/rasterizer_rd/shader_rd.cpp b/servers/rendering/rasterizer_rd/shader_rd.cpp
index 8c57651263..865a1e1bbe 100644
--- a/servers/rendering/rasterizer_rd/shader_rd.cpp
+++ b/servers/rendering/rasterizer_rd/shader_rd.cpp
@@ -30,7 +30,7 @@
#include "shader_rd.h"
-#include "core/string_builder.h"
+#include "core/string/string_builder.h"
#include "rasterizer_rd.h"
#include "servers/rendering/rendering_device.h"
diff --git a/servers/rendering/rasterizer_rd/shader_rd.h b/servers/rendering/rasterizer_rd/shader_rd.h
index d9bb068ba6..0c379db6f2 100644
--- a/servers/rendering/rasterizer_rd/shader_rd.h
+++ b/servers/rendering/rasterizer_rd/shader_rd.h
@@ -31,11 +31,11 @@
#ifndef SHADER_RD_H
#define SHADER_RD_H
-#include "core/hash_map.h"
-#include "core/map.h"
#include "core/os/mutex.h"
-#include "core/rid_owner.h"
-#include "core/variant.h"
+#include "core/templates/hash_map.h"
+#include "core/templates/map.h"
+#include "core/templates/rid_owner.h"
+#include "core/variant/variant.h"
#include <stdio.h>
/**
diff --git a/servers/rendering/rendering_device.h b/servers/rendering/rendering_device.h
index 6df66e7b20..f1f8b3cda0 100644
--- a/servers/rendering/rendering_device.h
+++ b/servers/rendering/rendering_device.h
@@ -31,8 +31,8 @@
#ifndef RENDERING_DEVICE_H
#define RENDERING_DEVICE_H
-#include "core/class_db.h"
-#include "core/typed_array.h"
+#include "core/object/class_db.h"
+#include "core/variant/typed_array.h"
#include "servers/display_server.h"
class RDTextureFormat;
diff --git a/servers/rendering/rendering_server_raster.cpp b/servers/rendering/rendering_server_raster.cpp
index cbc91497ba..94cfb6b752 100644
--- a/servers/rendering/rendering_server_raster.cpp
+++ b/servers/rendering/rendering_server_raster.cpp
@@ -30,10 +30,10 @@
#include "rendering_server_raster.h"
+#include "core/config/project_settings.h"
#include "core/io/marshalls.h"
#include "core/os/os.h"
-#include "core/project_settings.h"
-#include "core/sort_array.h"
+#include "core/templates/sort_array.h"
#include "rendering_server_canvas.h"
#include "rendering_server_globals.h"
#include "rendering_server_scene.h"
diff --git a/servers/rendering/rendering_server_scene.h b/servers/rendering/rendering_server_scene.h
index 1b0a617627..a30aac3bb1 100644
--- a/servers/rendering/rendering_server_scene.h
+++ b/servers/rendering/rendering_server_scene.h
@@ -33,13 +33,13 @@
#include "servers/rendering/rasterizer.h"
-#include "core/local_vector.h"
#include "core/math/geometry_3d.h"
#include "core/math/octree.h"
#include "core/os/semaphore.h"
#include "core/os/thread.h"
-#include "core/rid_owner.h"
-#include "core/self_list.h"
+#include "core/templates/local_vector.h"
+#include "core/templates/rid_owner.h"
+#include "core/templates/self_list.h"
#include "servers/xr/xr_interface.h"
class RenderingServerScene {
diff --git a/servers/rendering/rendering_server_viewport.cpp b/servers/rendering/rendering_server_viewport.cpp
index 23911faa5d..c6682b1fcd 100644
--- a/servers/rendering/rendering_server_viewport.cpp
+++ b/servers/rendering/rendering_server_viewport.cpp
@@ -30,7 +30,7 @@
#include "rendering_server_viewport.h"
-#include "core/project_settings.h"
+#include "core/config/project_settings.h"
#include "rendering_server_canvas.h"
#include "rendering_server_globals.h"
#include "rendering_server_scene.h"
diff --git a/servers/rendering/rendering_server_viewport.h b/servers/rendering/rendering_server_viewport.h
index d00a06c5ee..081f63690b 100644
--- a/servers/rendering/rendering_server_viewport.h
+++ b/servers/rendering/rendering_server_viewport.h
@@ -31,8 +31,8 @@
#ifndef VISUALSERVERVIEWPORT_H
#define VISUALSERVERVIEWPORT_H
-#include "core/rid_owner.h"
-#include "core/self_list.h"
+#include "core/templates/rid_owner.h"
+#include "core/templates/self_list.h"
#include "rasterizer.h"
#include "servers/rendering_server.h"
#include "servers/xr/xr_interface.h"
diff --git a/servers/rendering/rendering_server_wrap_mt.cpp b/servers/rendering/rendering_server_wrap_mt.cpp
index ab9856e06e..40ad228fd0 100644
--- a/servers/rendering/rendering_server_wrap_mt.cpp
+++ b/servers/rendering/rendering_server_wrap_mt.cpp
@@ -29,8 +29,8 @@
/*************************************************************************/
#include "rendering_server_wrap_mt.h"
+#include "core/config/project_settings.h"
#include "core/os/os.h"
-#include "core/project_settings.h"
#include "servers/display_server.h"
void RenderingServerWrapMT::thread_exit() {
diff --git a/servers/rendering/rendering_server_wrap_mt.h b/servers/rendering/rendering_server_wrap_mt.h
index 237ba012fa..d27b851d1d 100644
--- a/servers/rendering/rendering_server_wrap_mt.h
+++ b/servers/rendering/rendering_server_wrap_mt.h
@@ -31,8 +31,8 @@
#ifndef RENDERING_SERVER_WRAP_MT_H
#define RENDERING_SERVER_WRAP_MT_H
-#include "core/command_queue_mt.h"
#include "core/os/thread.h"
+#include "core/templates/command_queue_mt.h"
#include "servers/rendering_server.h"
class RenderingServerWrapMT : public RenderingServer {
diff --git a/servers/rendering/shader_language.cpp b/servers/rendering/shader_language.cpp
index 1883b6b338..046c6ba580 100644
--- a/servers/rendering/shader_language.cpp
+++ b/servers/rendering/shader_language.cpp
@@ -30,7 +30,7 @@
#include "shader_language.h"
#include "core/os/os.h"
-#include "core/print_string.h"
+#include "core/string/print_string.h"
#include "servers/rendering_server.h"
static bool _is_text_char(char32_t c) {
diff --git a/servers/rendering/shader_language.h b/servers/rendering/shader_language.h
index 3c0a10809b..3a9f408dc0 100644
--- a/servers/rendering/shader_language.h
+++ b/servers/rendering/shader_language.h
@@ -31,13 +31,13 @@
#ifndef SHADER_LANGUAGE_H
#define SHADER_LANGUAGE_H
-#include "core/list.h"
-#include "core/map.h"
-#include "core/script_language.h"
-#include "core/string_name.h"
+#include "core/object/script_language.h"
+#include "core/string/string_name.h"
+#include "core/string/ustring.h"
+#include "core/templates/list.h"
+#include "core/templates/map.h"
#include "core/typedefs.h"
-#include "core/ustring.h"
-#include "core/variant.h"
+#include "core/variant/variant.h"
class ShaderLanguage {
public:
diff --git a/servers/rendering/shader_types.h b/servers/rendering/shader_types.h
index 7d8057a5c6..50f910babb 100644
--- a/servers/rendering/shader_types.h
+++ b/servers/rendering/shader_types.h
@@ -31,7 +31,7 @@
#ifndef SHADERTYPES_H
#define SHADERTYPES_H
-#include "core/ordered_hash_map.h"
+#include "core/templates/ordered_hash_map.h"
#include "servers/rendering_server.h"
#include "shader_language.h"
diff --git a/servers/rendering_server.cpp b/servers/rendering_server.cpp
index 121bf3ee92..cc959afdaa 100644
--- a/servers/rendering_server.cpp
+++ b/servers/rendering_server.cpp
@@ -30,7 +30,7 @@
#include "rendering_server.h"
-#include "core/project_settings.h"
+#include "core/config/project_settings.h"
RenderingServer *RenderingServer::singleton = nullptr;
RenderingServer *(*RenderingServer::create_func)() = nullptr;
diff --git a/servers/rendering_server.h b/servers/rendering_server.h
index 3aa15623eb..d676a1ba01 100644
--- a/servers/rendering_server.h
+++ b/servers/rendering_server.h
@@ -31,13 +31,13 @@
#ifndef RENDERING_SERVER_H
#define RENDERING_SERVER_H
-#include "core/class_db.h"
-#include "core/image.h"
+#include "core/io/image.h"
#include "core/math/geometry_3d.h"
#include "core/math/transform_2d.h"
-#include "core/rid.h"
-#include "core/typed_array.h"
-#include "core/variant.h"
+#include "core/object/class_db.h"
+#include "core/templates/rid.h"
+#include "core/variant/typed_array.h"
+#include "core/variant/variant.h"
#include "servers/display_server.h"
#include "servers/rendering/rendering_device.h"
#include "servers/rendering/shader_language.h"
diff --git a/servers/xr_server.cpp b/servers/xr_server.cpp
index 09800443b7..45199edd24 100644
--- a/servers/xr_server.cpp
+++ b/servers/xr_server.cpp
@@ -29,7 +29,7 @@
/*************************************************************************/
#include "xr_server.h"
-#include "core/project_settings.h"
+#include "core/config/project_settings.h"
#include "xr/xr_interface.h"
#include "xr/xr_positional_tracker.h"
diff --git a/servers/xr_server.h b/servers/xr_server.h
index e04c7b3592..d66d4e778a 100644
--- a/servers/xr_server.h
+++ b/servers/xr_server.h
@@ -31,11 +31,11 @@
#ifndef XR_SERVER_H
#define XR_SERVER_H
+#include "core/object/reference.h"
#include "core/os/os.h"
#include "core/os/thread_safe.h"
-#include "core/reference.h"
-#include "core/rid.h"
-#include "core/variant.h"
+#include "core/templates/rid.h"
+#include "core/variant/variant.h"
class XRInterface;
class XRPositionalTracker;
diff --git a/tests/test_basis.h b/tests/test_basis.h
index 05efe33788..db4e0b347f 100644
--- a/tests/test_basis.h
+++ b/tests/test_basis.h
@@ -33,7 +33,7 @@
#include "core/math/random_number_generator.h"
#include "core/os/os.h"
-#include "core/ustring.h"
+#include "core/string/ustring.h"
#include "tests/test_macros.h"
diff --git a/tests/test_class_db.h b/tests/test_class_db.h
index d0d8136874..29fe837587 100644
--- a/tests/test_class_db.h
+++ b/tests/test_class_db.h
@@ -33,12 +33,12 @@
#include "core/register_core_types.h"
-#include "core/global_constants.h"
-#include "core/ordered_hash_map.h"
+#include "core/core_constants.h"
#include "core/os/os.h"
-#include "core/string_name.h"
-#include "core/ustring.h"
-#include "core/variant.h"
+#include "core/string/string_name.h"
+#include "core/string/ustring.h"
+#include "core/templates/ordered_hash_map.h"
+#include "core/variant/variant.h"
#include "tests/test_macros.h"
@@ -255,7 +255,7 @@ bool arg_default_value_is_assignable_to_type(const Context &p_context, const Var
case Variant::VECTOR2:
case Variant::RECT2:
case Variant::VECTOR3:
- case Variant::_RID:
+ case Variant::RID:
case Variant::ARRAY:
case Variant::DICTIONARY:
case Variant::PACKED_BYTE_ARRAY:
@@ -769,16 +769,16 @@ void add_builtin_types(Context &r_context) {
}
void add_global_enums(Context &r_context) {
- int global_constants_count = GlobalConstants::get_global_constant_count();
+ int global_constants_count = CoreConstants::get_global_constant_count();
if (global_constants_count > 0) {
for (int i = 0; i < global_constants_count; i++) {
- StringName enum_name = GlobalConstants::get_global_constant_enum(i);
+ StringName enum_name = CoreConstants::get_global_constant_enum(i);
if (enum_name != StringName()) {
ConstantData constant;
- constant.name = GlobalConstants::get_global_constant_name(i);
- constant.value = GlobalConstants::get_global_constant_value(i);
+ constant.name = CoreConstants::get_global_constant_name(i);
+ constant.value = CoreConstants::get_global_constant_value(i);
EnumData enum_;
enum_.name = enum_name;
diff --git a/tests/test_color.h b/tests/test_color.h
index dfdc29ec7d..04b66811e3 100644
--- a/tests/test_color.h
+++ b/tests/test_color.h
@@ -31,7 +31,7 @@
#ifndef TEST_COLOR_H
#define TEST_COLOR_H
-#include "core/color.h"
+#include "core/math/color.h"
#include "thirdparty/doctest/doctest.h"
@@ -185,9 +185,6 @@ TEST_CASE("[Color] Manipulation methods") {
CHECK_MESSAGE(
blue.inverted().is_equal_approx(Color(1, 1, 0, 0.4)),
"Inverted color should have its red, green and blue components inverted.");
- CHECK_MESSAGE(
- blue.contrasted().is_equal_approx(Color(0.5, 0.5, 0.5, 0.4)),
- "Contrasted pure blue should be fully gray.");
const Color purple = Color(0.5, 0.2, 0.5, 0.25);
diff --git a/tests/test_command_queue.h b/tests/test_command_queue.h
index a66fd3c86e..c3cfa08b61 100644
--- a/tests/test_command_queue.h
+++ b/tests/test_command_queue.h
@@ -33,12 +33,12 @@
#include "test_command_queue.h"
-#include "core/command_queue_mt.h"
+#include "core/config/project_settings.h"
#include "core/os/mutex.h"
#include "core/os/os.h"
#include "core/os/semaphore.h"
#include "core/os/thread.h"
-#include "core/project_settings.h"
+#include "core/templates/command_queue_mt.h"
#if !defined(NO_THREADS)
diff --git a/tests/test_expression.h b/tests/test_expression.h
index a3d4877d52..c9cb0158f3 100644
--- a/tests/test_expression.h
+++ b/tests/test_expression.h
@@ -381,7 +381,7 @@ TEST_CASE("[Expression] Unusual expressions") {
ERR_PRINT_OFF;
CHECK_MESSAGE(
- expression.parse("$1.00 + €5") == OK,
+ expression.parse("$1.00 + ???5") == OK,
"The expression should parse successfully.");
CHECK_MESSAGE(
int(expression.execute()) == 0,
@@ -410,8 +410,8 @@ TEST_CASE("[Expression] Unusual expressions") {
"The expression should parse successfully.");
ERR_PRINT_OFF;
CHECK_MESSAGE(
- Math::is_zero_approx(float(expression.execute())),
- "`-25.4 / 0` should return 0.");
+ Math::is_inf(float(expression.execute())),
+ "`-25.4 / 0` should return inf.");
ERR_PRINT_ON;
CHECK_MESSAGE(
diff --git a/tests/test_gradient.h b/tests/test_gradient.h
index 88fe06b3ec..8f28dfd9b4 100644
--- a/tests/test_gradient.h
+++ b/tests/test_gradient.h
@@ -31,8 +31,8 @@
#ifndef TEST_GRADIENT_H
#define TEST_GRADIENT_H
-#include "core/class_db.h"
-#include "core/color.h"
+#include "core/math/color.h"
+#include "core/object/class_db.h"
#include "scene/resources/gradient.h"
#include "thirdparty/doctest/doctest.h"
diff --git a/tests/test_gui.cpp b/tests/test_gui.cpp
index d46a13d2c0..03c9dfd2ba 100644
--- a/tests/test_gui.cpp
+++ b/tests/test_gui.cpp
@@ -34,7 +34,7 @@
#include "core/io/image_loader.h"
#include "core/os/os.h"
-#include "core/print_string.h"
+#include "core/string/print_string.h"
#include "scene/2d/sprite_2d.h"
#include "scene/gui/button.h"
#include "scene/gui/control.h"
diff --git a/tests/test_list.h b/tests/test_list.h
index 7412fbc3c8..adeedaaf3e 100644
--- a/tests/test_list.h
+++ b/tests/test_list.h
@@ -31,7 +31,7 @@
#ifndef TEST_LIST_H
#define TEST_LIST_H
-#include "core/list.h"
+#include "core/templates/list.h"
#include "tests/test_macros.h"
diff --git a/tests/test_macros.h b/tests/test_macros.h
index 3486c68bb7..05fae128b3 100644
--- a/tests/test_macros.h
+++ b/tests/test_macros.h
@@ -31,8 +31,8 @@
#ifndef TEST_MACROS_H
#define TEST_MACROS_H
-#include "core/map.h"
-#include "core/variant.h"
+#include "core/templates/map.h"
+#include "core/variant/variant.h"
// See documentation for doctest at:
// https://github.com/onqtam/doctest/blob/master/doc/markdown/readme.md#reference
diff --git a/tests/test_main.cpp b/tests/test_main.cpp
index 871c796513..b4ddf0f1c1 100644
--- a/tests/test_main.cpp
+++ b/tests/test_main.cpp
@@ -30,7 +30,7 @@
#include "test_main.h"
-#include "core/list.h"
+#include "core/templates/list.h"
#include "test_astar.h"
#include "test_basis.h"
diff --git a/tests/test_math.cpp b/tests/test_math.cpp
index 862535b57e..e745d1609e 100644
--- a/tests/test_math.cpp
+++ b/tests/test_math.cpp
@@ -36,14 +36,14 @@
#include "core/math/geometry_2d.h"
#include "core/math/math_funcs.h"
#include "core/math/transform.h"
-#include "core/method_ptrcall.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 "core/string/print_string.h"
+#include "core/string/ustring.h"
+#include "core/templates/vmap.h"
+#include "core/variant/method_ptrcall.h"
+#include "core/variant/variant.h"
#include "scene/main/node.h"
#include "scene/resources/texture.h"
#include "servers/rendering/shader_language.h"
diff --git a/tests/test_method_bind.h b/tests/test_method_bind.h
index f4004c2090..9507a10d3e 100644
--- a/tests/test_method_bind.h
+++ b/tests/test_method_bind.h
@@ -31,7 +31,7 @@
#ifndef TEST_METHOD_BIND_H
#define TEST_METHOD_BIND_H
-#include "core/class_db.h"
+#include "core/object/class_db.h"
#include "tests/test_macros.h"
diff --git a/tests/test_oa_hash_map.cpp b/tests/test_oa_hash_map.cpp
index 9182f66b61..44717e5690 100644
--- a/tests/test_oa_hash_map.cpp
+++ b/tests/test_oa_hash_map.cpp
@@ -30,8 +30,8 @@
#include "test_oa_hash_map.h"
-#include "core/oa_hash_map.h"
#include "core/os/os.h"
+#include "core/templates/oa_hash_map.h"
namespace TestOAHashMap {
diff --git a/tests/test_ordered_hash_map.h b/tests/test_ordered_hash_map.h
index 3182c391cb..9f987e8833 100644
--- a/tests/test_ordered_hash_map.h
+++ b/tests/test_ordered_hash_map.h
@@ -31,10 +31,10 @@
#ifndef TEST_ORDERED_HASH_MAP_H
#define TEST_ORDERED_HASH_MAP_H
-#include "core/ordered_hash_map.h"
#include "core/os/os.h"
-#include "core/pair.h"
-#include "core/vector.h"
+#include "core/templates/ordered_hash_map.h"
+#include "core/templates/pair.h"
+#include "core/templates/vector.h"
#include "tests/test_macros.h"
diff --git a/tests/test_physics_2d.cpp b/tests/test_physics_2d.cpp
index c82ae920bc..54d373b454 100644
--- a/tests/test_physics_2d.cpp
+++ b/tests/test_physics_2d.cpp
@@ -30,10 +30,10 @@
#include "test_physics_2d.h"
-#include "core/map.h"
#include "core/os/main_loop.h"
#include "core/os/os.h"
-#include "core/print_string.h"
+#include "core/string/print_string.h"
+#include "core/templates/map.h"
#include "scene/resources/texture.h"
#include "servers/display_server.h"
#include "servers/physics_server_2d.h"
diff --git a/tests/test_physics_3d.cpp b/tests/test_physics_3d.cpp
index 72de2041e4..1b453be76d 100644
--- a/tests/test_physics_3d.cpp
+++ b/tests/test_physics_3d.cpp
@@ -30,12 +30,12 @@
#include "test_physics_3d.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 "core/string/print_string.h"
+#include "core/templates/map.h"
#include "servers/display_server.h"
#include "servers/physics_server_3d.h"
#include "servers/rendering_server.h"
diff --git a/tests/test_render.cpp b/tests/test_render.cpp
index d936dd72e7..8c5cac694c 100644
--- a/tests/test_render.cpp
+++ b/tests/test_render.cpp
@@ -35,7 +35,7 @@
#include "core/os/keyboard.h"
#include "core/os/main_loop.h"
#include "core/os/os.h"
-#include "core/print_string.h"
+#include "core/string/print_string.h"
#include "servers/display_server.h"
#include "servers/rendering_server.h"
diff --git a/tests/test_shader_lang.cpp b/tests/test_shader_lang.cpp
index d363ee22b5..4bfd593279 100644
--- a/tests/test_shader_lang.cpp
+++ b/tests/test_shader_lang.cpp
@@ -34,7 +34,7 @@
#include "core/os/main_loop.h"
#include "core/os/os.h"
-#include "core/print_string.h"
+#include "core/string/print_string.h"
#include "scene/gui/control.h"
#include "scene/gui/text_edit.h"
#include "servers/rendering/shader_language.h"
diff --git a/tests/test_string.h b/tests/test_string.h
index b041cb2f49..acdcaccecd 100644
--- a/tests/test_string.h
+++ b/tests/test_string.h
@@ -38,7 +38,7 @@
#include "core/io/ip_address.h"
#include "core/os/main_loop.h"
#include "core/os/os.h"
-#include "core/ustring.h"
+#include "core/string/ustring.h"
#ifdef MODULE_REGEX_ENABLED
#include "modules/regex/regex.h"
diff --git a/tests/test_variant.h b/tests/test_variant.h
index a384a3e91f..b7421c29a5 100644
--- a/tests/test_variant.h
+++ b/tests/test_variant.h
@@ -31,8 +31,8 @@
#ifndef TEST_VARIANT_H
#define TEST_VARIANT_H
-#include "core/variant.h"
-#include "core/variant_parser.h"
+#include "core/variant/variant.h"
+#include "core/variant/variant_parser.h"
#include "tests/test_macros.h"
diff --git a/thirdparty/README.md b/thirdparty/README.md
index ac1ce6d5fc..f590acaa0b 100644
--- a/thirdparty/README.md
+++ b/thirdparty/README.md
@@ -378,7 +378,7 @@ Collection of single-file libraries used in Godot components.
* License: Apache 2.0
- `open-simplex-noise.{c,h}`
* Upstream: https://github.com/smcameron/open-simplex-noise-in-c
- * Version: git (0d555e7f40527d0870906fe9469a3b1bb4020b7f, 2015) + custom changes
+ * Version: git (0fef0dbedd76f767da7e3c894822729d0f07e54d, 2020) + custom changes
* License: Unlicense
- `pcg.{cpp,h}`
* Upstream: http://www.pcg-random.org
diff --git a/thirdparty/libogg/ogg/config_types.h b/thirdparty/libogg/ogg/config_types.h
index 3574a8ad44..4dc8393fdc 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 "core/int_types.h"
+#include <stdint.h>
typedef int16_t ogg_int16_t;
typedef uint16_t ogg_uint16_t;
diff --git a/thirdparty/misc/open-simplex-noise.c b/thirdparty/misc/open-simplex-noise.c
index 42f2fbb5be..88fbd3e51d 100644
--- a/thirdparty/misc/open-simplex-noise.c
+++ b/thirdparty/misc/open-simplex-noise.c
@@ -189,14 +189,15 @@ int open_simplex_noise(int64_t seed, struct osn_context *ctx)
permGradIndex3D = ctx->permGradIndex3D;
// -- GODOT end --
+ uint64_t seedU = seed;
for (i = 0; i < 256; i++)
source[i] = (int16_t) i;
- seed = seed * 6364136223846793005LL + 1442695040888963407LL;
- seed = seed * 6364136223846793005LL + 1442695040888963407LL;
- seed = seed * 6364136223846793005LL + 1442695040888963407LL;
+ seedU = seedU * 6364136223846793005ULL + 1442695040888963407ULL;
+ seedU = seedU * 6364136223846793005ULL + 1442695040888963407ULL;
+ seedU = seedU * 6364136223846793005ULL + 1442695040888963407ULL;
for (i = 255; i >= 0; i--) {
- seed = seed * 6364136223846793005LL + 1442695040888963407LL;
- r = (int)((seed + 31) % (i + 1));
+ seedU = seedU * 6364136223846793005ULL + 1442695040888963407ULL;
+ r = (int)((seedU + 31) % (i + 1));
if (r < 0)
r += (i + 1);
perm[i] = source[r];
diff --git a/thirdparty/misc/pcg.cpp b/thirdparty/misc/pcg.cpp
index 5f4bf40460..914a353874 100644
--- a/thirdparty/misc/pcg.cpp
+++ b/thirdparty/misc/pcg.cpp
@@ -25,8 +25,31 @@ void pcg32_srandom_r(pcg32_random_t* rng, uint64_t initstate, uint64_t initseq)
}
// Source from https://github.com/imneme/pcg-c-basic/blob/master/pcg_basic.c
+// pcg32_boundedrand_r(rng, bound):
+// Generate a uniformly distributed number, r, where 0 <= r < bound
uint32_t pcg32_boundedrand_r(pcg32_random_t *rng, uint32_t bound) {
+ // To avoid bias, we need to make the range of the RNG a multiple of
+ // bound, which we do by dropping output less than a threshold.
+ // A naive scheme to calculate the threshold would be to do
+ //
+ // uint32_t threshold = 0x100000000ull % bound;
+ //
+ // but 64-bit div/mod is slower than 32-bit div/mod (especially on
+ // 32-bit platforms). In essence, we do
+ //
+ // uint32_t threshold = (0x100000000ull-bound) % bound;
+ //
+ // because this version will calculate the same modulus, but the LHS
+ // value is less than 2^32.
uint32_t threshold = -bound % bound;
+
+ // Uniformity guarantees that this loop will terminate. In practice, it
+ // should usually terminate quickly; on average (assuming all bounds are
+ // equally likely), 82.25% of the time, we can expect it to require just
+ // one iteration. In the worst case, someone passes a bound of 2^31 + 1
+ // (i.e., 2147483649), which invalidates almost 50% of the range. In
+ // practice, bounds are typically small and only a tiny amount of the range
+ // is eliminated.
for (;;) {
uint32_t r = pcg32_random_r(rng);
if (r >= threshold)
diff --git a/thirdparty/misc/triangulator.h b/thirdparty/misc/triangulator.h
index c85792fd50..24b79e7d34 100644
--- a/thirdparty/misc/triangulator.h
+++ b/thirdparty/misc/triangulator.h
@@ -21,9 +21,9 @@
#ifndef TRIANGULATOR_H
#define TRIANGULATOR_H
-#include "core/list.h"
+#include "core/templates/list.h"
#include "core/math/vector2.h"
-#include "core/set.h"
+#include "core/templates/set.h"
//2D point structure