summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--core/config/engine.cpp6
-rw-r--r--core/config/project_settings.cpp6
-rw-r--r--core/core_bind.cpp239
-rw-r--r--core/core_bind.h38
-rw-r--r--core/crypto/aes_context.h6
-rw-r--r--core/crypto/crypto.h10
-rw-r--r--core/crypto/crypto_core.h2
-rw-r--r--core/crypto/hashing_context.h6
-rw-r--r--core/debugger/remote_debugger_peer.h4
-rw-r--r--core/input/input_event.cpp2
-rw-r--r--core/input/input_map.cpp1
-rw-r--r--core/io/config_file.h8
-rw-r--r--core/io/dir_access.cpp (renamed from core/os/dir_access.cpp)2
-rw-r--r--core/io/dir_access.h (renamed from core/os/dir_access.h)0
-rw-r--r--core/io/dtls_server.cpp2
-rw-r--r--core/io/dtls_server.h4
-rw-r--r--core/io/file_access.cpp (renamed from core/os/file_access.cpp)0
-rw-r--r--core/io/file_access.h (renamed from core/os/file_access.h)0
-rw-r--r--core/io/file_access_compressed.h2
-rw-r--r--core/io/file_access_encrypted.h2
-rw-r--r--core/io/file_access_memory.cpp2
-rw-r--r--core/io/file_access_memory.h2
-rw-r--r--core/io/file_access_network.h2
-rw-r--r--core/io/file_access_pack.h4
-rw-r--r--core/io/file_access_zip.cpp2
-rw-r--r--core/io/http_client.h6
-rw-r--r--core/io/image.cpp44
-rw-r--r--core/io/image.h9
-rw-r--r--core/io/image_loader.h2
-rw-r--r--core/io/json.cpp19
-rw-r--r--core/io/json.h10
-rw-r--r--core/io/logger.cpp9
-rw-r--r--core/io/logger.h2
-rw-r--r--core/io/marshalls.cpp6
-rw-r--r--core/io/marshalls.h6
-rw-r--r--core/io/multiplayer_api.h6
-rw-r--r--core/io/net_socket.h4
-rw-r--r--core/io/packed_data_container.h4
-rw-r--r--core/io/packet_peer.h4
-rw-r--r--core/io/packet_peer_dtls.cpp2
-rw-r--r--core/io/pck_packer.cpp2
-rw-r--r--core/io/pck_packer.h6
-rw-r--r--core/io/resource.cpp2
-rw-r--r--core/io/resource.h6
-rw-r--r--core/io/resource_format_binary.cpp2
-rw-r--r--core/io/resource_format_binary.h2
-rw-r--r--core/io/resource_importer.h4
-rw-r--r--core/io/resource_loader.cpp40
-rw-r--r--core/io/resource_loader.h4
-rw-r--r--core/io/resource_saver.cpp20
-rw-r--r--core/io/resource_saver.h4
-rw-r--r--core/io/stream_peer.h6
-rw-r--r--core/io/tcp_server.h4
-rw-r--r--core/io/translation_loader_po.cpp2
-rw-r--r--core/io/translation_loader_po.h2
-rw-r--r--core/io/udp_server.h4
-rw-r--r--core/io/xml_parser.h8
-rw-r--r--core/io/zip_io.h2
-rw-r--r--core/math/a_star.h10
-rw-r--r--core/math/aabb.cpp2
-rw-r--r--core/math/basis.cpp15
-rw-r--r--core/math/color.cpp8
-rw-r--r--core/math/delaunay_3d.h2
-rw-r--r--core/math/expression.cpp2
-rw-r--r--core/math/expression.h6
-rw-r--r--core/math/plane.cpp2
-rw-r--r--core/math/quaternion.cpp2
-rw-r--r--core/math/random_number_generator.h6
-rw-r--r--core/math/rect2.cpp8
-rw-r--r--core/math/rect2.h4
-rw-r--r--core/math/transform_2d.cpp4
-rw-r--r--core/math/transform_3d.cpp5
-rw-r--r--core/math/triangle_mesh.h6
-rw-r--r--core/math/vector2.cpp8
-rw-r--r--core/math/vector2.h4
-rw-r--r--core/math/vector3.cpp2
-rw-r--r--core/math/vector3i.cpp2
-rw-r--r--core/object/object.cpp12
-rw-r--r--core/object/object.h6
-rw-r--r--core/object/object_id.h2
-rw-r--r--core/object/ref_counted.cpp (renamed from core/object/reference.cpp)24
-rw-r--r--core/object/ref_counted.h (renamed from core/object/reference.h)30
-rw-r--r--core/object/undo_redo.cpp24
-rw-r--r--core/object/undo_redo.h4
-rw-r--r--core/os/main_loop.h2
-rw-r--r--core/os/os.cpp37
-rw-r--r--core/os/os.h33
-rw-r--r--core/os/time.cpp433
-rw-r--r--core/os/time.h109
-rw-r--r--core/register_core_types.cpp5
-rw-r--r--core/string/translation_po.cpp2
-rw-r--r--core/string/ustring.cpp41
-rw-r--r--core/string/ustring.h4
-rw-r--r--core/templates/bin_sorted_array.h181
-rw-r--r--core/variant/callable.cpp2
-rw-r--r--core/variant/variant.cpp86
-rw-r--r--core/variant/variant_call.cpp4
-rw-r--r--core/variant/variant_construct.cpp6
-rw-r--r--core/variant/variant_internal.h2
-rw-r--r--core/variant/variant_parser.cpp9
-rw-r--r--core/variant/variant_parser.h2
-rw-r--r--core/variant/variant_setget.cpp6
-rw-r--r--core/variant/variant_utility.cpp2
-rw-r--r--doc/classes/@GlobalScope.xml3
-rw-r--r--doc/classes/AESContext.xml2
-rw-r--r--doc/classes/AStar.xml2
-rw-r--r--doc/classes/AStar2D.xml2
-rw-r--r--doc/classes/AnimationNode.xml118
-rw-r--r--doc/classes/AnimationTrackEditPlugin.xml2
-rw-r--r--doc/classes/Array.xml4
-rw-r--r--doc/classes/ArrayMesh.xml1
-rw-r--r--doc/classes/AudioEffectInstance.xml2
-rw-r--r--doc/classes/AudioStreamPlayback.xml2
-rw-r--r--doc/classes/BitMap.xml6
-rw-r--r--doc/classes/Camera3D.xml11
-rw-r--r--doc/classes/CameraFeed.xml2
-rw-r--r--doc/classes/CharFXTransform.xml2
-rw-r--r--doc/classes/ConfigFile.xml2
-rw-r--r--doc/classes/Control.xml206
-rw-r--r--doc/classes/Crypto.xml2
-rw-r--r--doc/classes/DTLSServer.xml2
-rw-r--r--doc/classes/Directory.xml2
-rw-r--r--doc/classes/EditorExportPlugin.xml2
-rw-r--r--doc/classes/EditorFeatureProfile.xml2
-rw-r--r--doc/classes/EditorImportPlugin.xml50
-rw-r--r--doc/classes/EditorInspectorPlugin.xml94
-rw-r--r--doc/classes/EditorNode3DGizmo.xml138
-rw-r--r--doc/classes/EditorNode3DGizmoPlugin.xml162
-rw-r--r--doc/classes/EditorPlugin.xml536
-rw-r--r--doc/classes/EditorProperty.xml18
-rw-r--r--doc/classes/EditorResourceConversionPlugin.xml2
-rw-r--r--doc/classes/EditorResourcePicker.xml50
-rw-r--r--doc/classes/EditorResourcePreviewGenerator.xml18
-rw-r--r--doc/classes/EditorSceneImporter.xml2
-rw-r--r--doc/classes/EditorScenePostImport.xml22
-rw-r--r--doc/classes/EditorScript.xml2
-rw-r--r--doc/classes/EditorSyntaxHighlighter.xml2
-rw-r--r--doc/classes/EditorTranslationParserPlugin.xml16
-rw-r--r--doc/classes/EncodedObjectAsID.xml2
-rw-r--r--doc/classes/Expression.xml2
-rw-r--r--doc/classes/File.xml4
-rw-r--r--doc/classes/FileSystemDock.xml34
-rw-r--r--doc/classes/GeometryInstance3D.xml26
-rw-r--r--doc/classes/HMACContext.xml2
-rw-r--r--doc/classes/HTTPClient.xml2
-rw-r--r--doc/classes/HashingContext.xml2
-rw-r--r--doc/classes/JSON.xml3
-rw-r--r--doc/classes/JSONParseResult.xml2
-rw-r--r--doc/classes/JSONParser.xml2
-rw-r--r--doc/classes/JavaClass.xml2
-rw-r--r--doc/classes/JavaScriptObject.xml2
-rw-r--r--doc/classes/KinematicCollision2D.xml2
-rw-r--r--doc/classes/KinematicCollision3D.xml2
-rw-r--r--doc/classes/Lightmapper.xml2
-rw-r--r--doc/classes/MeshDataTool.xml2
-rw-r--r--doc/classes/MultiplayerAPI.xml2
-rw-r--r--doc/classes/Mutex.xml2
-rw-r--r--doc/classes/Node3D.xml5
-rw-r--r--doc/classes/Node3DGizmo.xml2
-rw-r--r--doc/classes/OS.xml78
-rw-r--r--doc/classes/Object.xml4
-rw-r--r--doc/classes/PCKPacker.xml2
-rw-r--r--doc/classes/PackedDataContainerRef.xml4
-rw-r--r--doc/classes/PacketPeer.xml2
-rw-r--r--doc/classes/PhysicsShapeQueryParameters2D.xml2
-rw-r--r--doc/classes/PhysicsShapeQueryParameters3D.xml2
-rw-r--r--doc/classes/PhysicsShapeQueryResult2D.xml2
-rw-r--r--doc/classes/PhysicsShapeQueryResult3D.xml2
-rw-r--r--doc/classes/PhysicsTestMotionResult2D.xml2
-rw-r--r--doc/classes/ProjectSettings.xml14
-rw-r--r--doc/classes/RDAttachmentFormat.xml2
-rw-r--r--doc/classes/RDPipelineColorBlendState.xml2
-rw-r--r--doc/classes/RDPipelineColorBlendStateAttachment.xml2
-rw-r--r--doc/classes/RDPipelineDepthStencilState.xml2
-rw-r--r--doc/classes/RDPipelineMultisampleState.xml2
-rw-r--r--doc/classes/RDPipelineRasterizationState.xml2
-rw-r--r--doc/classes/RDSamplerState.xml2
-rw-r--r--doc/classes/RDShaderSource.xml2
-rw-r--r--doc/classes/RDTextureFormat.xml2
-rw-r--r--doc/classes/RDTextureView.xml2
-rw-r--r--doc/classes/RDUniform.xml2
-rw-r--r--doc/classes/RDVertexAttribute.xml2
-rw-r--r--doc/classes/RandomNumberGenerator.xml2
-rw-r--r--doc/classes/RefCounted.xml (renamed from doc/classes/Reference.xml)4
-rw-r--r--doc/classes/RenderingServer.xml54
-rw-r--r--doc/classes/Resource.xml4
-rw-r--r--doc/classes/ResourceFormatLoader.xml14
-rw-r--r--doc/classes/ResourceFormatSaver.xml10
-rw-r--r--doc/classes/ResourceImporter.xml2
-rw-r--r--doc/classes/SceneState.xml2
-rw-r--r--doc/classes/SceneTreeTimer.xml2
-rw-r--r--doc/classes/ScriptEditor.xml34
-rw-r--r--doc/classes/ScriptEditorBase.xml2
-rw-r--r--doc/classes/Semaphore.xml2
-rw-r--r--doc/classes/SkinReference.xml2
-rw-r--r--doc/classes/Sprite3D.xml5
-rw-r--r--doc/classes/StreamPeer.xml2
-rw-r--r--doc/classes/String.xml2
-rw-r--r--doc/classes/StyleBoxTexture.xml7
-rw-r--r--doc/classes/SurfaceTool.xml2
-rw-r--r--doc/classes/TCPServer.xml2
-rw-r--r--doc/classes/TextLine.xml2
-rw-r--r--doc/classes/TextParagraph.xml2
-rw-r--r--doc/classes/Thread.xml2
-rw-r--r--doc/classes/Time.xml270
-rw-r--r--doc/classes/Tree.xml2
-rw-r--r--doc/classes/TriangleMesh.xml2
-rw-r--r--doc/classes/UDPServer.xml2
-rw-r--r--doc/classes/Variant.xml32
-rw-r--r--doc/classes/VelocityTracker3D.xml2
-rw-r--r--doc/classes/Viewport.xml12
-rw-r--r--doc/classes/WeakRef.xml4
-rw-r--r--doc/classes/XMLParser.xml2
-rw-r--r--doc/classes/XRInterface.xml16
-rw-r--r--doc/classes/XRPositionalTracker.xml2
-rw-r--r--doc/classes/XRServer.xml4
-rw-r--r--doc/translations/ar.po26
-rw-r--r--doc/translations/ca.po26
-rw-r--r--doc/translations/classes.pot26
-rw-r--r--doc/translations/cs.po26
-rw-r--r--doc/translations/de.po26
-rw-r--r--doc/translations/es.po28
-rw-r--r--doc/translations/fa.po26
-rw-r--r--doc/translations/fi.po26
-rw-r--r--doc/translations/fr.po26
-rw-r--r--doc/translations/id.po26
-rw-r--r--doc/translations/it.po26
-rw-r--r--doc/translations/ja.po26
-rw-r--r--doc/translations/ko.po26
-rw-r--r--doc/translations/nl.po26
-rw-r--r--doc/translations/pl.po26
-rw-r--r--doc/translations/pt_BR.po26
-rw-r--r--doc/translations/ro.po26
-rw-r--r--doc/translations/ru.po26
-rw-r--r--doc/translations/sr_Cyrl.po26
-rw-r--r--doc/translations/th.po26
-rw-r--r--doc/translations/tr.po26
-rw-r--r--doc/translations/uk.po26
-rw-r--r--doc/translations/zh_Hans.po26
-rw-r--r--doc/translations/zh_Hant.po26
-rw-r--r--drivers/png/image_loader_png.cpp4
-rw-r--r--drivers/png/resource_saver_png.cpp2
-rw-r--r--drivers/unix/dir_access_unix.h2
-rw-r--r--drivers/unix/file_access_unix.h2
-rw-r--r--drivers/unix/os_unix.cpp4
-rw-r--r--drivers/vulkan/rendering_device_vulkan.cpp46
-rw-r--r--drivers/vulkan/rendering_device_vulkan.h20
-rw-r--r--drivers/vulkan/vulkan_context.cpp66
-rw-r--r--drivers/vulkan/vulkan_context.h6
-rw-r--r--drivers/windows/dir_access_windows.cpp2
-rw-r--r--drivers/windows/dir_access_windows.h2
-rw-r--r--drivers/windows/file_access_windows.h2
-rw-r--r--editor/action_map_editor.cpp6
-rw-r--r--editor/animation_track_editor.h4
-rw-r--r--editor/array_property_edit.h4
-rw-r--r--editor/audio_stream_preview.h4
-rw-r--r--editor/create_dialog.cpp6
-rw-r--r--editor/debugger/editor_debugger_server.h4
-rw-r--r--editor/dependency_editor.cpp2
-rw-r--r--editor/dictionary_property_edit.h4
-rw-r--r--editor/doc_tools.cpp2
-rw-r--r--editor/editor_asset_installer.cpp4
-rw-r--r--editor/editor_audio_buses.cpp6
-rw-r--r--editor/editor_autoload_settings.cpp6
-rw-r--r--editor/editor_data.cpp6
-rw-r--r--editor/editor_dir_dialog.h2
-rw-r--r--editor/editor_export.cpp6
-rw-r--r--editor/editor_export.h14
-rw-r--r--editor/editor_feature_profile.cpp2
-rw-r--r--editor/editor_feature_profile.h8
-rw-r--r--editor/editor_file_dialog.cpp5
-rw-r--r--editor/editor_file_dialog.h2
-rw-r--r--editor/editor_file_system.cpp21
-rw-r--r--editor/editor_file_system.h2
-rw-r--r--editor/editor_folding.cpp2
-rw-r--r--editor/editor_fonts.cpp2
-rw-r--r--editor/editor_help_search.h2
-rw-r--r--editor/editor_inspector.cpp49
-rw-r--r--editor/editor_inspector.h4
-rw-r--r--editor/editor_node.cpp11
-rw-r--r--editor/editor_node.h1
-rw-r--r--editor/editor_paths.cpp106
-rw-r--r--editor/editor_paths.h28
-rw-r--r--editor/editor_plugin.cpp152
-rw-r--r--editor/editor_plugin_settings.cpp2
-rw-r--r--editor/editor_properties.cpp2
-rw-r--r--editor/editor_properties_array_dict.cpp4
-rw-r--r--editor/editor_properties_array_dict.h8
-rw-r--r--editor/editor_resource_picker.cpp18
-rw-r--r--editor/editor_resource_preview.cpp36
-rw-r--r--editor/editor_resource_preview.h4
-rw-r--r--editor/editor_run_script.h6
-rw-r--r--editor/editor_settings.cpp129
-rw-r--r--editor/editor_settings.h1
-rw-r--r--editor/editor_themes.cpp33
-rw-r--r--editor/editor_translation_parser.cpp14
-rw-r--r--editor/editor_translation_parser.h6
-rw-r--r--editor/export_template_manager.cpp2
-rw-r--r--editor/filesystem_dock.cpp27
-rw-r--r--editor/filesystem_dock.h2
-rw-r--r--editor/find_in_files.cpp2
-rw-r--r--editor/import/editor_import_plugin.cpp72
-rw-r--r--editor/import/resource_importer_csv_translation.cpp2
-rw-r--r--editor/import/resource_importer_image.cpp2
-rw-r--r--editor/import/resource_importer_obj.cpp8
-rw-r--r--editor/import/resource_importer_scene.cpp8
-rw-r--r--editor/import/resource_importer_scene.h8
-rw-r--r--editor/import/resource_importer_shader_file.cpp2
-rw-r--r--editor/import/resource_importer_texture.cpp15
-rw-r--r--editor/import/resource_importer_texture.h2
-rw-r--r--editor/import/resource_importer_texture_atlas.cpp2
-rw-r--r--editor/import/resource_importer_wav.cpp2
-rw-r--r--editor/multi_node_edit.h4
-rw-r--r--editor/node_3d_editor_gizmos.cpp36
-rw-r--r--editor/plugin_config_dialog.cpp2
-rw-r--r--editor/plugins/collision_polygon_3d_editor_plugin.cpp2
-rw-r--r--editor/plugins/node_3d_editor_plugin.cpp80
-rw-r--r--editor/plugins/path_2d_editor_plugin.cpp2
-rw-r--r--editor/plugins/polygon_2d_editor_plugin.cpp2
-rw-r--r--editor/plugins/resource_preloader_editor_plugin.cpp6
-rw-r--r--editor/plugins/script_editor_plugin.cpp10
-rw-r--r--editor/plugins/script_text_editor.cpp6
-rw-r--r--editor/plugins/skeleton_3d_editor_plugin.cpp6
-rw-r--r--editor/plugins/sprite_frames_editor_plugin.cpp6
-rw-r--r--editor/plugins/texture_region_editor_plugin.cpp17
-rw-r--r--editor/plugins/theme_editor_plugin.cpp1507
-rw-r--r--editor/plugins/theme_editor_plugin.h115
-rw-r--r--editor/plugins/theme_editor_preview.cpp464
-rw-r--r--editor/plugins/theme_editor_preview.h118
-rw-r--r--editor/plugins/tiles/tile_set_editor.cpp4
-rw-r--r--editor/plugins/visual_shader_editor_plugin.cpp10
-rw-r--r--editor/plugins/visual_shader_editor_plugin.h8
-rw-r--r--editor/pot_generator.h2
-rw-r--r--editor/project_export.cpp10
-rw-r--r--editor/project_export.h2
-rw-r--r--editor/project_manager.cpp4
-rw-r--r--editor/property_editor.cpp70
-rw-r--r--editor/property_editor.h4
-rw-r--r--editor/scene_tree_editor.cpp6
-rw-r--r--editor/script_create_dialog.cpp2
-rw-r--r--main/main.cpp19
-rw-r--r--misc/dist/osx_template.app/Contents/Info.plist2
-rw-r--r--misc/dist/osx_tools.app/Contents/Info.plist2
-rw-r--r--modules/csg/csg.h2
-rw-r--r--modules/dds/texture_loader_dds.cpp2
-rw-r--r--modules/fbx/data/fbx_bone.h2
-rw-r--r--modules/fbx/data/fbx_material.h6
-rw-r--r--modules/fbx/data/fbx_mesh_data.h2
-rw-r--r--modules/fbx/data/fbx_node.h2
-rw-r--r--modules/fbx/data/fbx_skeleton.h4
-rw-r--r--modules/fbx/data/pivot_transform.h4
-rw-r--r--modules/fbx/tools/validation_tools.h2
-rw-r--r--modules/gdnative/doc_classes/GDNative.xml2
-rw-r--r--modules/gdnative/gdnative.cpp4
-rw-r--r--modules/gdnative/gdnative.h4
-rw-r--r--modules/gdnative/gdnative/variant.cpp12
-rw-r--r--modules/gdnative/gdnative_api.json6
-rw-r--r--modules/gdnative/include/xr/godot_xr.h27
-rw-r--r--modules/gdnative/nativescript/api_generator.cpp43
-rw-r--r--modules/gdnative/nativescript/nativescript.cpp6
-rw-r--r--modules/gdnative/pluginscript/pluginscript_language.cpp2
-rw-r--r--modules/gdnative/pluginscript/pluginscript_loader.cpp2
-rw-r--r--modules/gdnative/pluginscript/pluginscript_script.cpp6
-rw-r--r--modules/gdnative/pluginscript/register_types.cpp2
-rw-r--r--modules/gdnative/videodecoder/video_stream_gdnative.h2
-rw-r--r--modules/gdnative/xr/xr_interface_gdnative.cpp53
-rw-r--r--modules/gdnative/xr/xr_interface_gdnative.h14
-rw-r--r--modules/gdscript/doc_classes/@GDScript.xml4
-rw-r--r--modules/gdscript/gdscript.cpp38
-rw-r--r--modules/gdscript/gdscript.h12
-rw-r--r--modules/gdscript/gdscript_analyzer.cpp4
-rw-r--r--modules/gdscript/gdscript_analyzer.h2
-rw-r--r--modules/gdscript/gdscript_cache.cpp2
-rw-r--r--modules/gdscript/gdscript_cache.h4
-rw-r--r--modules/gdscript/gdscript_compiler.cpp7
-rw-r--r--modules/gdscript/gdscript_editor.cpp2
-rw-r--r--modules/gdscript/gdscript_function.h6
-rw-r--r--modules/gdscript/gdscript_lambda_callable.h2
-rw-r--r--modules/gdscript/gdscript_parser.cpp2
-rw-r--r--modules/gdscript/gdscript_parser.h2
-rw-r--r--modules/gdscript/gdscript_vm.cpp8
-rw-r--r--modules/gdscript/language_server/gdscript_language_protocol.h2
-rw-r--r--modules/gdscript/language_server/gdscript_language_server.cpp2
-rw-r--r--modules/gdscript/language_server/gdscript_text_document.h8
-rw-r--r--modules/gdscript/language_server/gdscript_workspace.h4
-rw-r--r--modules/gdscript/language_server/lsp.hpp4
-rw-r--r--modules/gdscript/register_types.cpp4
-rw-r--r--modules/gdscript/tests/gdscript_test_runner.cpp8
-rw-r--r--modules/gdscript/tests/gdscript_test_runner_suite.h8
-rw-r--r--modules/gdscript/tests/test_gdscript.cpp2
-rw-r--r--modules/glslang/register_types.cpp4
-rw-r--r--modules/gltf/editor_scene_importer_gltf.cpp2
-rw-r--r--modules/gltf/gltf_document.cpp2
-rw-r--r--modules/mbedtls/crypto_mbedtls.cpp2
-rw-r--r--modules/mbedtls/packet_peer_mbed_dtls.cpp2
-rw-r--r--modules/mbedtls/ssl_context_mbedtls.h8
-rw-r--r--modules/mbedtls/stream_peer_mbedtls.cpp2
-rw-r--r--modules/minimp3/audio_stream_mp3.cpp2
-rw-r--r--modules/minimp3/resource_importer_mp3.cpp2
-rw-r--r--modules/mobile_vr/mobile_vr_interface.cpp87
-rw-r--r--modules/mobile_vr/mobile_vr_interface.h14
-rw-r--r--modules/mono/class_db_api_json.cpp2
-rw-r--r--modules/mono/csharp_script.cpp124
-rw-r--r--modules/mono/csharp_script.h6
-rw-r--r--modules/mono/editor/GodotTools/GodotTools/Build/BuildInfo.cs2
-rw-r--r--modules/mono/editor/GodotTools/GodotTools/Build/BuildOutputView.cs2
-rw-r--r--modules/mono/editor/GodotTools/GodotTools/GodotSharpEditor.cs6
-rw-r--r--modules/mono/editor/bindings_generator.cpp29
-rw-r--r--modules/mono/editor/bindings_generator.h10
-rw-r--r--modules/mono/glue/GodotSharp/GodotSharp/Core/AABB.cs4
-rw-r--r--modules/mono/glue/GodotSharp/GodotSharp/Core/Basis.cs18
-rw-r--r--modules/mono/glue/GodotSharp/GodotSharp/Core/Color.cs4
-rw-r--r--modules/mono/glue/GodotSharp/GodotSharp/Core/Object.base.cs4
-rw-r--r--modules/mono/glue/GodotSharp/GodotSharp/Core/Plane.cs4
-rw-r--r--modules/mono/glue/GodotSharp/GodotSharp/Core/Rect2.cs4
-rw-r--r--modules/mono/glue/GodotSharp/GodotSharp/Core/Transform2D.cs18
-rw-r--r--modules/mono/glue/GodotSharp/GodotSharp/Core/Transform3D.cs18
-rw-r--r--modules/mono/glue/base_object_glue.cpp34
-rw-r--r--modules/mono/glue/glue_header.h2
-rw-r--r--modules/mono/godotsharp_dirs.cpp2
-rw-r--r--modules/mono/mono_gc_handle.h6
-rw-r--r--modules/mono/mono_gd/gd_mono.cpp4
-rw-r--r--modules/mono/mono_gd/gd_mono_assembly.cpp2
-rw-r--r--modules/mono/mono_gd/gd_mono_internals.cpp14
-rw-r--r--modules/mono/mono_gd/gd_mono_log.cpp6
-rw-r--r--modules/mono/mono_gd/gd_mono_log.h2
-rw-r--r--modules/mono/mono_gd/gd_mono_marshal.cpp4
-rw-r--r--modules/mono/mono_gd/gd_mono_utils.cpp14
-rw-r--r--modules/mono/mono_gd/gd_mono_utils.h2
-rw-r--r--modules/mono/signal_awaiter_utils.h2
-rw-r--r--modules/mono/utils/mono_reg_utils.cpp2
-rw-r--r--modules/mono/utils/path_utils.cpp6
-rw-r--r--modules/mono/utils/string_utils.cpp2
-rw-r--r--modules/opensimplex/noise_texture.h2
-rw-r--r--modules/opensimplex/open_simplex_noise.h2
-rw-r--r--modules/pvr/image_compress_pvrtc.cpp2
-rw-r--r--modules/pvr/texture_loader_pvr.cpp2
-rw-r--r--modules/raycast/raycast_occlusion_cull.h2
-rw-r--r--modules/regex/doc_classes/RegEx.xml2
-rw-r--r--modules/regex/doc_classes/RegExMatch.xml2
-rw-r--r--modules/regex/regex.h10
-rw-r--r--modules/stb_vorbis/audio_stream_ogg_vorbis.cpp2
-rw-r--r--modules/stb_vorbis/resource_importer_ogg_vorbis.cpp2
-rw-r--r--modules/tga/image_loader_tga.cpp22
-rw-r--r--modules/tga/image_loader_tga.h4
-rw-r--r--modules/theora/video_stream_theora.h2
-rw-r--r--modules/upnp/doc_classes/UPNP.xml2
-rw-r--r--modules/upnp/doc_classes/UPNPDevice.xml2
-rw-r--r--modules/upnp/upnp.h6
-rw-r--r--modules/upnp/upnp_device.h6
-rw-r--r--modules/visual_script/doc_classes/VisualScriptFunctionState.xml4
-rw-r--r--modules/visual_script/visual_script.cpp2
-rw-r--r--modules/visual_script/visual_script.h4
-rw-r--r--modules/visual_script/visual_script_builtin_funcs.cpp2
-rw-r--r--modules/visual_script/visual_script_editor.cpp6
-rw-r--r--modules/webm/video_stream_webm.cpp2
-rw-r--r--modules/webp/image_loader_webp.cpp75
-rw-r--r--modules/webrtc/doc_classes/WebRTCPeerConnection.xml2
-rw-r--r--modules/webrtc/webrtc_multiplayer.h2
-rw-r--r--modules/webrtc/webrtc_peer_connection.h4
-rw-r--r--modules/websocket/emws_server.h2
-rw-r--r--modules/websocket/websocket_server.h2
-rw-r--r--modules/websocket/wsl_server.h2
-rw-r--r--modules/webxr/webxr_interface_js.cpp27
-rw-r--r--modules/webxr/webxr_interface_js.h5
-rw-r--r--platform/android/api/java_class_wrapper.h10
-rw-r--r--platform/android/dir_access_jandroid.h2
-rw-r--r--platform/android/export/export.cpp8
-rw-r--r--platform/android/export/gradle_export_util.h4
-rw-r--r--platform/android/file_access_android.h2
-rw-r--r--platform/android/java_class_wrapper.cpp4
-rw-r--r--platform/android/plugin/godot_plugin_config.h2
-rw-r--r--platform/iphone/export/export.cpp2
-rw-r--r--platform/iphone/os_iphone.mm4
-rw-r--r--platform/iphone/plugin/godot_plugin_config.h4
-rw-r--r--platform/javascript/api/javascript_singleton.h6
-rw-r--r--platform/javascript/api/javascript_tools_editor_plugin.cpp6
-rw-r--r--platform/javascript/export/export.cpp2
-rw-r--r--platform/javascript/godot_js.h2
-rw-r--r--platform/javascript/javascript_singleton.cpp9
-rw-r--r--platform/javascript/js/libs/library_godot_display.js2
-rw-r--r--platform/javascript/js/libs/library_godot_fetch.js6
-rw-r--r--platform/javascript/js/libs/library_godot_javascript_singleton.js2
-rw-r--r--platform/javascript/package-lock.json1002
-rw-r--r--platform/javascript/package.json8
-rw-r--r--platform/linuxbsd/export/export.cpp2
-rw-r--r--platform/linuxbsd/os_linuxbsd.cpp12
-rw-r--r--platform/osx/dir_access_osx.h2
-rw-r--r--platform/osx/export/export.cpp16
-rw-r--r--platform/osx/os_osx.mm6
-rw-r--r--platform/uwp/app.cpp4
-rw-r--r--platform/uwp/export/export.cpp4
-rw-r--r--platform/windows/export/export.cpp2
-rw-r--r--platform/windows/os_windows.cpp10
-rw-r--r--scene/2d/mesh_instance_2d.cpp3
-rw-r--r--scene/2d/multimesh_instance_2d.cpp3
-rw-r--r--scene/2d/physical_bone_2d.h2
-rw-r--r--scene/2d/physics_body_2d.h4
-rw-r--r--scene/2d/sprite_2d.cpp2
-rw-r--r--scene/2d/tile_map.cpp7
-rw-r--r--scene/3d/camera_3d.cpp11
-rw-r--r--scene/3d/camera_3d.h1
-rw-r--r--scene/3d/lightmap_gi.cpp4
-rw-r--r--scene/3d/lightmapper.h12
-rw-r--r--scene/3d/node_3d.cpp62
-rw-r--r--scene/3d/node_3d.h16
-rw-r--r--scene/3d/physics_body_3d.h4
-rw-r--r--scene/3d/skeleton_3d.h4
-rw-r--r--scene/3d/sprite_3d.cpp2
-rw-r--r--scene/3d/velocity_tracker_3d.h4
-rw-r--r--scene/3d/visual_instance_3d.cpp66
-rw-r--r--scene/3d/visual_instance_3d.h30
-rw-r--r--scene/3d/xr_nodes.cpp19
-rw-r--r--scene/animation/animation_player.h4
-rw-r--r--scene/animation/animation_tree.cpp30
-rw-r--r--scene/gui/code_edit.cpp3
-rw-r--r--scene/gui/control.cpp22
-rw-r--r--scene/gui/file_dialog.h2
-rw-r--r--scene/gui/nine_patch_rect.cpp3
-rw-r--r--scene/gui/rich_text_effect.h4
-rw-r--r--scene/gui/slider.cpp2
-rw-r--r--scene/main/http_request.h2
-rw-r--r--scene/main/scene_tree.cpp2
-rw-r--r--scene/main/scene_tree.h4
-rw-r--r--scene/main/viewport.cpp3
-rw-r--r--scene/resources/audio_stream_sample.cpp2
-rw-r--r--scene/resources/mesh_data_tool.h4
-rw-r--r--scene/resources/packed_scene.h4
-rw-r--r--scene/resources/resource_format_text.cpp4
-rw-r--r--scene/resources/resource_format_text.h2
-rw-r--r--scene/resources/shader.cpp2
-rw-r--r--scene/resources/skeleton_modification_2d.cpp4
-rw-r--r--scene/resources/skeleton_modification_stack_2d.cpp2
-rw-r--r--scene/resources/style_box.cpp3
-rw-r--r--scene/resources/surface_tool.cpp8
-rw-r--r--scene/resources/surface_tool.h4
-rw-r--r--scene/resources/text_file.cpp2
-rw-r--r--scene/resources/text_line.h4
-rw-r--r--scene/resources/text_paragraph.h4
-rw-r--r--scene/resources/texture.cpp8
-rw-r--r--scene/resources/texture.h23
-rw-r--r--scene/resources/theme.cpp113
-rw-r--r--scene/resources/theme.h11
-rw-r--r--scene/resources/tile_set.cpp2
-rw-r--r--scene/scene_string_names.cpp9
-rw-r--r--scene/scene_string_names.h9
-rw-r--r--servers/audio/audio_effect.h4
-rw-r--r--servers/audio/audio_stream.h4
-rw-r--r--servers/audio/effects/audio_effect_capture.h2
-rw-r--r--servers/audio/effects/audio_effect_record.h2
-rw-r--r--servers/audio_server.cpp2
-rw-r--r--servers/camera/camera_feed.h4
-rw-r--r--servers/camera_server.h2
-rw-r--r--servers/physics_server_2d.h14
-rw-r--r--servers/physics_server_3d.h8
-rw-r--r--servers/rendering/rasterizer_dummy.h6
-rw-r--r--servers/rendering/renderer_compositor.cpp9
-rw-r--r--servers/rendering/renderer_compositor.h47
-rw-r--r--servers/rendering/renderer_rd/effects_rd.cpp58
-rw-r--r--servers/rendering/renderer_rd/effects_rd.h29
-rw-r--r--servers/rendering/renderer_rd/forward_clustered/render_forward_clustered.cpp8
-rw-r--r--servers/rendering/renderer_rd/forward_clustered/render_forward_clustered.h3
-rw-r--r--servers/rendering/renderer_rd/forward_clustered/scene_shader_forward_clustered.cpp28
-rw-r--r--servers/rendering/renderer_rd/forward_clustered/scene_shader_forward_clustered.h1
-rw-r--r--servers/rendering/renderer_rd/forward_mobile/render_forward_mobile.cpp49
-rw-r--r--servers/rendering/renderer_rd/forward_mobile/render_forward_mobile.h11
-rw-r--r--servers/rendering/renderer_rd/forward_mobile/scene_shader_forward_mobile.cpp72
-rw-r--r--servers/rendering/renderer_rd/forward_mobile/scene_shader_forward_mobile.h7
-rw-r--r--servers/rendering/renderer_rd/renderer_compositor_rd.cpp2
-rw-r--r--servers/rendering/renderer_rd/renderer_scene_render_rd.cpp71
-rw-r--r--servers/rendering/renderer_rd/renderer_scene_render_rd.h15
-rw-r--r--servers/rendering/renderer_rd/renderer_scene_sky_rd.cpp57
-rw-r--r--servers/rendering/renderer_rd/renderer_scene_sky_rd.h7
-rw-r--r--servers/rendering/renderer_rd/renderer_storage_rd.cpp30
-rw-r--r--servers/rendering/renderer_rd/renderer_storage_rd.h3
-rw-r--r--servers/rendering/renderer_rd/shader_rd.cpp4
-rw-r--r--servers/rendering/renderer_rd/shaders/scene_forward_clustered.glsl2
-rw-r--r--servers/rendering/renderer_rd/shaders/scene_forward_mobile.glsl36
-rw-r--r--servers/rendering/renderer_rd/shaders/scene_forward_mobile_inc.glsl10
-rw-r--r--servers/rendering/renderer_rd/shaders/sky.glsl31
-rw-r--r--servers/rendering/renderer_rd/shaders/tonemap.glsl35
-rw-r--r--servers/rendering/renderer_scene.h11
-rw-r--r--servers/rendering/renderer_scene_cull.cpp869
-rw-r--r--servers/rendering/renderer_scene_cull.h97
-rw-r--r--servers/rendering/renderer_scene_render.cpp150
-rw-r--r--servers/rendering/renderer_scene_render.h24
-rw-r--r--servers/rendering/renderer_storage.h2
-rw-r--r--servers/rendering/renderer_viewport.cpp132
-rw-r--r--servers/rendering/renderer_viewport.h6
-rw-r--r--servers/rendering/rendering_device.h4
-rw-r--r--servers/rendering/rendering_device_binds.h48
-rw-r--r--servers/rendering/rendering_server_default.h4
-rw-r--r--servers/rendering/shader_types.cpp8
-rw-r--r--servers/rendering_server.cpp14
-rw-r--r--servers/rendering_server.h4
-rw-r--r--servers/text_server.h2
-rw-r--r--servers/xr/xr_interface.cpp3
-rw-r--r--servers/xr/xr_interface.h22
-rw-r--r--servers/xr/xr_positional_tracker.h4
-rw-r--r--servers/xr_server.cpp4
-rw-r--r--servers/xr_server.h2
-rw-r--r--tests/test_aabb.h4
-rw-r--r--tests/test_class_db.h8
-rw-r--r--tests/test_color.h2
-rw-r--r--tests/test_file_access.h2
-rw-r--r--tests/test_main.cpp1
-rw-r--r--tests/test_math.cpp2
-rw-r--r--tests/test_object.h4
-rw-r--r--tests/test_rect2.h4
-rw-r--r--tests/test_shader_lang.cpp2
-rw-r--r--tests/test_string.h2
-rw-r--r--tests/test_time.h145
612 files changed, 8485 insertions, 4747 deletions
diff --git a/core/config/engine.cpp b/core/config/engine.cpp
index c43e32868c..99ec1aeb5b 100644
--- a/core/config/engine.cpp
+++ b/core/config/engine.cpp
@@ -232,9 +232,9 @@ Engine::Singleton::Singleton(const StringName &p_name, Object *p_ptr) :
name(p_name),
ptr(p_ptr) {
#ifdef DEBUG_ENABLED
- Reference *ref = Object::cast_to<Reference>(p_ptr);
- if (ref && !ref->is_referenced()) {
- WARN_PRINT("You must use Ref<> to ensure the lifetime of a Reference object intended to be used as a singleton.");
+ RefCounted *rc = Object::cast_to<RefCounted>(p_ptr);
+ if (rc && !rc->is_referenced()) {
+ WARN_PRINT("You must use Ref<> to ensure the lifetime of a RefCounted object intended to be used as a singleton.");
}
#endif
}
diff --git a/core/config/project_settings.cpp b/core/config/project_settings.cpp
index 9baec79d43..590c3ff50e 100644
--- a/core/config/project_settings.cpp
+++ b/core/config/project_settings.cpp
@@ -33,11 +33,11 @@
#include "core/core_bind.h"
#include "core/core_string_names.h"
#include "core/input/input_map.h"
+#include "core/io/dir_access.h"
+#include "core/io/file_access.h"
#include "core/io/file_access_network.h"
#include "core/io/file_access_pack.h"
#include "core/io/marshalls.h"
-#include "core/os/dir_access.h"
-#include "core/os/file_access.h"
#include "core/os/keyboard.h"
#include "core/os/os.h"
#include "core/variant/variant_parser.h"
@@ -62,7 +62,7 @@ String ProjectSettings::localize_path(const String &p_path) const {
}
if (p_path.begins_with("res://") || p_path.begins_with("user://") ||
- (p_path.is_abs_path() && !p_path.begins_with(resource_path))) {
+ (p_path.is_absolute_path() && !p_path.begins_with(resource_path))) {
return p_path.simplify_path();
}
diff --git a/core/core_bind.cpp b/core/core_bind.cpp
index fe0166d0e6..60759cd71c 100644
--- a/core/core_bind.cpp
+++ b/core/core_bind.cpp
@@ -42,28 +42,6 @@
#include "core/os/keyboard.h"
#include "core/os/os.h"
-/**
- * Time constants borrowed from loc_time.h
- */
-#define EPOCH_YR 1970 /* EPOCH = Jan 1 1970 00:00:00 */
-#define SECS_DAY (24L * 60L * 60L)
-#define LEAPYEAR(year) (!((year) % 4) && (((year) % 100) || !((year) % 400)))
-#define YEARSIZE(year) (LEAPYEAR(year) ? 366 : 365)
-#define SECOND_KEY "second"
-#define MINUTE_KEY "minute"
-#define HOUR_KEY "hour"
-#define DAY_KEY "day"
-#define MONTH_KEY "month"
-#define YEAR_KEY "year"
-#define WEEKDAY_KEY "weekday"
-#define DST_KEY "dst"
-
-/// Table of number of days in each month (for regular year and leap year)
-static const unsigned int MONTH_DAYS_TABLE[2][12] = {
- { 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31 },
- { 31, 29, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31 }
-};
-
////// _ResourceLoader //////
_ResourceLoader *_ResourceLoader::singleton = nullptr;
@@ -322,197 +300,6 @@ uint64_t _OS::get_static_memory_peak_usage() const {
return OS::get_singleton()->get_static_memory_peak_usage();
}
-/**
- * Get current datetime with consideration for utc and
- * dst
- */
-Dictionary _OS::get_datetime(bool utc) const {
- Dictionary dated = get_date(utc);
- Dictionary timed = get_time(utc);
-
- List<Variant> keys;
- timed.get_key_list(&keys);
-
- for (int i = 0; i < keys.size(); i++) {
- dated[keys[i]] = timed[keys[i]];
- }
-
- return dated;
-}
-
-Dictionary _OS::get_date(bool utc) const {
- OS::Date date = OS::get_singleton()->get_date(utc);
- Dictionary dated;
- dated[YEAR_KEY] = date.year;
- dated[MONTH_KEY] = date.month;
- dated[DAY_KEY] = date.day;
- dated[WEEKDAY_KEY] = date.weekday;
- dated[DST_KEY] = date.dst;
- return dated;
-}
-
-Dictionary _OS::get_time(bool utc) const {
- OS::Time time = OS::get_singleton()->get_time(utc);
- Dictionary timed;
- timed[HOUR_KEY] = time.hour;
- timed[MINUTE_KEY] = time.min;
- timed[SECOND_KEY] = time.sec;
- return timed;
-}
-
-/**
- * Get an epoch time value from a dictionary of time values
- * @p datetime must be populated with the following keys:
- * day, hour, minute, month, second, year. (dst is ignored).
- *
- * You can pass the output from
- * get_datetime_from_unix_time directly into this function
- *
- * @param datetime dictionary of date and time values to convert
- *
- * @return epoch calculated
- */
-int64_t _OS::get_unix_time_from_datetime(Dictionary datetime) const {
- // if datetime is an empty Dictionary throws an error
- ERR_FAIL_COND_V_MSG(datetime.is_empty(), 0, "Invalid datetime Dictionary: Dictionary is empty");
-
- // Bunch of conversion constants
- static const unsigned int SECONDS_PER_MINUTE = 60;
- static const unsigned int MINUTES_PER_HOUR = 60;
- static const unsigned int HOURS_PER_DAY = 24;
- static const unsigned int SECONDS_PER_HOUR = MINUTES_PER_HOUR * SECONDS_PER_MINUTE;
- static const unsigned int SECONDS_PER_DAY = SECONDS_PER_HOUR * HOURS_PER_DAY;
-
- // Get all time values from the dictionary, set to zero if it doesn't exist.
- // Risk incorrect calculation over throwing errors
- unsigned int second = ((datetime.has(SECOND_KEY)) ? static_cast<unsigned int>(datetime[SECOND_KEY]) : 0);
- unsigned int minute = ((datetime.has(MINUTE_KEY)) ? static_cast<unsigned int>(datetime[MINUTE_KEY]) : 0);
- unsigned int hour = ((datetime.has(HOUR_KEY)) ? static_cast<unsigned int>(datetime[HOUR_KEY]) : 0);
- unsigned int day = ((datetime.has(DAY_KEY)) ? static_cast<unsigned int>(datetime[DAY_KEY]) : 1);
- unsigned int month = ((datetime.has(MONTH_KEY)) ? static_cast<unsigned int>(datetime[MONTH_KEY]) : 1);
- unsigned int year = ((datetime.has(YEAR_KEY)) ? static_cast<unsigned int>(datetime[YEAR_KEY]) : 1970);
-
- /// How many days come before each month (0-12)
- static const unsigned short int DAYS_PAST_THIS_YEAR_TABLE[2][13] = {
- /* Normal years. */
- { 0, 31, 59, 90, 120, 151, 181, 212, 243, 273, 304, 334, 365 },
- /* Leap years. */
- { 0, 31, 60, 91, 121, 152, 182, 213, 244, 274, 305, 335, 366 }
- };
-
- ERR_FAIL_COND_V_MSG(second > 59, 0, "Invalid second value of: " + itos(second) + ".");
- ERR_FAIL_COND_V_MSG(minute > 59, 0, "Invalid minute value of: " + itos(minute) + ".");
- ERR_FAIL_COND_V_MSG(hour > 23, 0, "Invalid hour value of: " + itos(hour) + ".");
- ERR_FAIL_COND_V_MSG(year == 0, 0, "Years before 1 AD are not supported. Value passed: " + itos(year) + ".");
- ERR_FAIL_COND_V_MSG(month > 12 || month == 0, 0, "Invalid month value of: " + itos(month) + ".");
- // Do this check after month is tested as valid
- unsigned int days_in_month = MONTH_DAYS_TABLE[LEAPYEAR(year)][month - 1];
- ERR_FAIL_COND_V_MSG(day == 0 || day > days_in_month, 0, "Invalid day value of: " + itos(day) + ". It should be comprised between 1 and " + itos(days_in_month) + " for month " + itos(month) + ".");
-
- // Calculate all the seconds from months past in this year
- uint64_t SECONDS_FROM_MONTHS_PAST_THIS_YEAR = DAYS_PAST_THIS_YEAR_TABLE[LEAPYEAR(year)][month - 1] * SECONDS_PER_DAY;
-
- int64_t SECONDS_FROM_YEARS_PAST = 0;
- if (year >= EPOCH_YR) {
- for (unsigned int iyear = EPOCH_YR; iyear < year; iyear++) {
- SECONDS_FROM_YEARS_PAST += YEARSIZE(iyear) * SECONDS_PER_DAY;
- }
- } else {
- for (unsigned int iyear = EPOCH_YR - 1; iyear >= year; iyear--) {
- SECONDS_FROM_YEARS_PAST -= YEARSIZE(iyear) * SECONDS_PER_DAY;
- }
- }
-
- int64_t epoch =
- second +
- minute * SECONDS_PER_MINUTE +
- hour * SECONDS_PER_HOUR +
- // Subtract 1 from day, since the current day isn't over yet
- // and we cannot count all 24 hours.
- (day - 1) * SECONDS_PER_DAY +
- SECONDS_FROM_MONTHS_PAST_THIS_YEAR +
- SECONDS_FROM_YEARS_PAST;
- return epoch;
-}
-
-/**
- * Get a dictionary of time values when given epoch time
- *
- * Dictionary Time values will be a union if values from #get_time
- * and #get_date dictionaries (with the exception of dst =
- * day light standard time, as it cannot be determined from epoch)
- *
- * @param unix_time_val epoch time to convert
- *
- * @return dictionary of date and time values
- */
-Dictionary _OS::get_datetime_from_unix_time(int64_t unix_time_val) const {
- OS::Date date;
- OS::Time time;
-
- long dayclock, dayno;
- int year = EPOCH_YR;
-
- if (unix_time_val >= 0) {
- dayno = unix_time_val / SECS_DAY;
- dayclock = unix_time_val % SECS_DAY;
- /* day 0 was a thursday */
- date.weekday = static_cast<OS::Weekday>((dayno + 4) % 7);
- while (dayno >= YEARSIZE(year)) {
- dayno -= YEARSIZE(year);
- year++;
- }
- } else {
- dayno = (unix_time_val - SECS_DAY + 1) / SECS_DAY;
- dayclock = unix_time_val - dayno * SECS_DAY;
- date.weekday = static_cast<OS::Weekday>(((dayno % 7) + 11) % 7);
- do {
- year--;
- dayno += YEARSIZE(year);
- } while (dayno < 0);
- }
-
- time.sec = dayclock % 60;
- time.min = (dayclock % 3600) / 60;
- time.hour = dayclock / 3600;
- date.year = year;
-
- size_t imonth = 0;
-
- while ((unsigned long)dayno >= MONTH_DAYS_TABLE[LEAPYEAR(year)][imonth]) {
- dayno -= MONTH_DAYS_TABLE[LEAPYEAR(year)][imonth];
- imonth++;
- }
-
- /// Add 1 to month to make sure months are indexed starting at 1
- date.month = static_cast<OS::Month>(imonth + 1);
-
- date.day = dayno + 1;
-
- Dictionary timed;
- timed[HOUR_KEY] = time.hour;
- timed[MINUTE_KEY] = time.min;
- timed[SECOND_KEY] = time.sec;
- timed[YEAR_KEY] = date.year;
- timed[MONTH_KEY] = date.month;
- timed[DAY_KEY] = date.day;
- timed[WEEKDAY_KEY] = date.weekday;
-
- return timed;
-}
-
-Dictionary _OS::get_time_zone_info() const {
- OS::TimeZoneInfo info = OS::get_singleton()->get_time_zone_info();
- Dictionary infod;
- infod["bias"] = info.bias;
- infod["name"] = info.name;
- return infod;
-}
-
-double _OS::get_unix_time() const {
- return OS::get_singleton()->get_unix_time();
-}
-
/** This method uses a signed argument for better error reporting as it's used from the scripting API. */
void _OS::delay_usec(int p_usec) const {
ERR_FAIL_COND_MSG(
@@ -529,14 +316,6 @@ void _OS::delay_msec(int p_msec) const {
OS::get_singleton()->delay_usec(int64_t(p_msec) * 1000);
}
-uint32_t _OS::get_ticks_msec() const {
- return OS::get_singleton()->get_ticks_msec();
-}
-
-uint64_t _OS::get_ticks_usec() const {
- return OS::get_singleton()->get_ticks_usec();
-}
-
bool _OS::can_use_threads() const {
return OS::get_singleton()->can_use_threads();
}
@@ -716,18 +495,8 @@ void _OS::_bind_methods() {
ClassDB::bind_method(D_METHOD("get_name"), &_OS::get_name);
ClassDB::bind_method(D_METHOD("get_cmdline_args"), &_OS::get_cmdline_args);
- ClassDB::bind_method(D_METHOD("get_datetime", "utc"), &_OS::get_datetime, DEFVAL(false));
- ClassDB::bind_method(D_METHOD("get_date", "utc"), &_OS::get_date, DEFVAL(false));
- ClassDB::bind_method(D_METHOD("get_time", "utc"), &_OS::get_time, DEFVAL(false));
- ClassDB::bind_method(D_METHOD("get_time_zone_info"), &_OS::get_time_zone_info);
- ClassDB::bind_method(D_METHOD("get_unix_time"), &_OS::get_unix_time);
- ClassDB::bind_method(D_METHOD("get_datetime_from_unix_time", "unix_time_val"), &_OS::get_datetime_from_unix_time);
- ClassDB::bind_method(D_METHOD("get_unix_time_from_datetime", "datetime"), &_OS::get_unix_time_from_datetime);
-
ClassDB::bind_method(D_METHOD("delay_usec", "usec"), &_OS::delay_usec);
ClassDB::bind_method(D_METHOD("delay_msec", "msec"), &_OS::delay_msec);
- ClassDB::bind_method(D_METHOD("get_ticks_msec"), &_OS::get_ticks_msec);
- ClassDB::bind_method(D_METHOD("get_ticks_usec"), &_OS::get_ticks_usec);
ClassDB::bind_method(D_METHOD("get_locale"), &_OS::get_locale);
ClassDB::bind_method(D_METHOD("get_model_name"), &_OS::get_model_name);
@@ -2074,7 +1843,7 @@ Variant _ClassDB::instance(const StringName &p_class) const {
return Variant();
}
- Reference *r = Object::cast_to<Reference>(obj);
+ RefCounted *r = Object::cast_to<RefCounted>(obj);
if (r) {
return REF(r);
} else {
@@ -2420,12 +2189,12 @@ Variant JSONParseResult::get_result() const {
}
void _JSON::_bind_methods() {
- ClassDB::bind_method(D_METHOD("print", "value", "indent", "sort_keys"), &_JSON::print, DEFVAL(String()), DEFVAL(false));
+ ClassDB::bind_method(D_METHOD("print", "value", "indent", "sort_keys", "full_precision"), &_JSON::print, DEFVAL(String()), DEFVAL(false), DEFVAL(false));
ClassDB::bind_method(D_METHOD("parse", "json"), &_JSON::parse);
}
-String _JSON::print(const Variant &p_value, const String &p_indent, bool p_sort_keys) {
- return JSON::print(p_value, p_indent, p_sort_keys);
+String _JSON::print(const Variant &p_value, const String &p_indent, bool p_sort_keys, bool p_full_precision) {
+ return JSON::print(p_value, p_indent, p_sort_keys, p_full_precision);
}
Ref<JSONParseResult> _JSON::parse(const String &p_json) {
diff --git a/core/core_bind.h b/core/core_bind.h
index c8b0a4d7da..b161effe95 100644
--- a/core/core_bind.h
+++ b/core/core_bind.h
@@ -32,11 +32,11 @@
#define CORE_BIND_H
#include "core/io/compression.h"
+#include "core/io/dir_access.h"
+#include "core/io/file_access.h"
#include "core/io/image.h"
#include "core/io/resource_loader.h"
#include "core/io/resource_saver.h"
-#include "core/os/dir_access.h"
-#include "core/os/file_access.h"
#include "core/os/os.h"
#include "core/os/semaphore.h"
#include "core/os/thread.h"
@@ -199,14 +199,6 @@ public:
void set_use_file_access_save_and_swap(bool p_enable);
- Dictionary get_date(bool utc) const;
- Dictionary get_time(bool utc) const;
- Dictionary get_datetime(bool utc) const;
- Dictionary get_datetime_from_unix_time(int64_t unix_time_val) const;
- int64_t get_unix_time_from_datetime(Dictionary datetime) const;
- Dictionary get_time_zone_info() const;
- double get_unix_time() const;
-
uint64_t get_static_memory_usage() const;
uint64_t get_static_memory_peak_usage() const;
@@ -353,8 +345,8 @@ public:
_Geometry3D() { singleton = this; }
};
-class _File : public Reference {
- GDCLASS(_File, Reference);
+class _File : public RefCounted {
+ GDCLASS(_File, RefCounted);
FileAccess *f = nullptr;
bool big_endian = false;
@@ -455,8 +447,8 @@ public:
VARIANT_ENUM_CAST(_File::ModeFlags);
VARIANT_ENUM_CAST(_File::CompressionMode);
-class _Directory : public Reference {
- GDCLASS(_Directory, Reference);
+class _Directory : public RefCounted {
+ GDCLASS(_Directory, RefCounted);
DirAccess *d;
bool dir_open = false;
@@ -525,8 +517,8 @@ public:
~_Marshalls() { singleton = nullptr; }
};
-class _Mutex : public Reference {
- GDCLASS(_Mutex, Reference);
+class _Mutex : public RefCounted {
+ GDCLASS(_Mutex, RefCounted);
Mutex mutex;
static void _bind_methods();
@@ -537,8 +529,8 @@ public:
void unlock();
};
-class _Semaphore : public Reference {
- GDCLASS(_Semaphore, Reference);
+class _Semaphore : public RefCounted {
+ GDCLASS(_Semaphore, RefCounted);
Semaphore semaphore;
static void _bind_methods();
@@ -549,8 +541,8 @@ public:
void post();
};
-class _Thread : public Reference {
- GDCLASS(_Thread, Reference);
+class _Thread : public RefCounted {
+ GDCLASS(_Thread, RefCounted);
protected:
Variant ret;
@@ -666,8 +658,8 @@ public:
class _JSON;
-class JSONParseResult : public Reference {
- GDCLASS(JSONParseResult, Reference);
+class JSONParseResult : public RefCounted {
+ GDCLASS(JSONParseResult, RefCounted);
friend class _JSON;
@@ -706,7 +698,7 @@ protected:
public:
static _JSON *get_singleton() { return singleton; }
- String print(const Variant &p_value, const String &p_indent = "", bool p_sort_keys = false);
+ String print(const Variant &p_value, const String &p_indent = "", bool p_sort_keys = false, bool p_full_precision = false);
Ref<JSONParseResult> parse(const String &p_json);
_JSON() { singleton = this; }
diff --git a/core/crypto/aes_context.h b/core/crypto/aes_context.h
index cc00b18fd2..2f8422f537 100644
--- a/core/crypto/aes_context.h
+++ b/core/crypto/aes_context.h
@@ -32,10 +32,10 @@
#define AES_CONTEXT_H
#include "core/crypto/crypto_core.h"
-#include "core/object/reference.h"
+#include "core/object/ref_counted.h"
-class AESContext : public Reference {
- GDCLASS(AESContext, Reference);
+class AESContext : public RefCounted {
+ GDCLASS(AESContext, RefCounted);
public:
enum Mode {
diff --git a/core/crypto/crypto.h b/core/crypto/crypto.h
index 9438fcfea5..a2ccbba58a 100644
--- a/core/crypto/crypto.h
+++ b/core/crypto/crypto.h
@@ -35,7 +35,7 @@
#include "core/io/resource.h"
#include "core/io/resource_loader.h"
#include "core/io/resource_saver.h"
-#include "core/object/reference.h"
+#include "core/object/ref_counted.h"
class CryptoKey : public Resource {
GDCLASS(CryptoKey, Resource);
@@ -67,8 +67,8 @@ public:
virtual Error save(String p_path) = 0;
};
-class HMACContext : public Reference {
- GDCLASS(HMACContext, Reference);
+class HMACContext : public RefCounted {
+ GDCLASS(HMACContext, RefCounted);
protected:
static void _bind_methods();
@@ -84,8 +84,8 @@ public:
HMACContext() {}
};
-class Crypto : public Reference {
- GDCLASS(Crypto, Reference);
+class Crypto : public RefCounted {
+ GDCLASS(Crypto, RefCounted);
protected:
static void _bind_methods();
diff --git a/core/crypto/crypto_core.h b/core/crypto/crypto_core.h
index 27b380e838..7a2f4df589 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/object/reference.h"
+#include "core/object/ref_counted.h"
class CryptoCore {
public:
diff --git a/core/crypto/hashing_context.h b/core/crypto/hashing_context.h
index 892a48a4e8..31521a147c 100644
--- a/core/crypto/hashing_context.h
+++ b/core/crypto/hashing_context.h
@@ -31,10 +31,10 @@
#ifndef HASHING_CONTEXT_H
#define HASHING_CONTEXT_H
-#include "core/object/reference.h"
+#include "core/object/ref_counted.h"
-class HashingContext : public Reference {
- GDCLASS(HashingContext, Reference);
+class HashingContext : public RefCounted {
+ GDCLASS(HashingContext, RefCounted);
public:
enum HashType {
diff --git a/core/debugger/remote_debugger_peer.h b/core/debugger/remote_debugger_peer.h
index 652e2d9d20..8cba53a81c 100644
--- a/core/debugger/remote_debugger_peer.h
+++ b/core/debugger/remote_debugger_peer.h
@@ -32,12 +32,12 @@
#define REMOTE_DEBUGGER_PEER_H
#include "core/io/stream_peer_tcp.h"
-#include "core/object/reference.h"
+#include "core/object/ref_counted.h"
#include "core/os/mutex.h"
#include "core/os/thread.h"
#include "core/string/ustring.h"
-class RemoteDebuggerPeer : public Reference {
+class RemoteDebuggerPeer : public RefCounted {
protected:
int max_queued_messages = 4096;
diff --git a/core/input/input_event.cpp b/core/input/input_event.cpp
index 6f063c217f..9c1cf15342 100644
--- a/core/input/input_event.cpp
+++ b/core/input/input_event.cpp
@@ -1023,7 +1023,7 @@ static const char *_joy_button_descriptions[JOY_BUTTON_SDL_MAX] = {
String InputEventJoypadButton::as_text() const {
String text = "Joypad Button " + itos(button_index);
- if (button_index < JOY_BUTTON_SDL_MAX) {
+ if (button_index >= 0 && button_index < JOY_BUTTON_SDL_MAX) {
text += vformat(" (%s)", _joy_button_descriptions[button_index]);
}
diff --git a/core/input/input_map.cpp b/core/input/input_map.cpp
index 878ce820fb..5b96babe44 100644
--- a/core/input/input_map.cpp
+++ b/core/input/input_map.cpp
@@ -511,6 +511,7 @@ const OrderedHashMap<String, List<Ref<InputEvent>>> &InputMap::get_builtins() {
// Text Backspace and Delete
inputs = List<Ref<InputEvent>>();
inputs.push_back(InputEventKey::create_reference(KEY_BACKSPACE));
+ inputs.push_back(InputEventKey::create_reference(KEY_BACKSPACE | KEY_MASK_SHIFT));
default_builtin_cache.insert("ui_text_backspace", inputs);
inputs = List<Ref<InputEvent>>();
diff --git a/core/io/config_file.h b/core/io/config_file.h
index 1b28257c60..dbba43ace5 100644
--- a/core/io/config_file.h
+++ b/core/io/config_file.h
@@ -31,13 +31,13 @@
#ifndef CONFIG_FILE_H
#define CONFIG_FILE_H
-#include "core/object/reference.h"
-#include "core/os/file_access.h"
+#include "core/io/file_access.h"
+#include "core/object/ref_counted.h"
#include "core/templates/ordered_hash_map.h"
#include "core/variant/variant_parser.h"
-class ConfigFile : public Reference {
- GDCLASS(ConfigFile, Reference);
+class ConfigFile : public RefCounted {
+ GDCLASS(ConfigFile, RefCounted);
OrderedHashMap<String, OrderedHashMap<String, Variant>> values;
diff --git a/core/os/dir_access.cpp b/core/io/dir_access.cpp
index 39ae475c12..dfba00067f 100644
--- a/core/os/dir_access.cpp
+++ b/core/io/dir_access.cpp
@@ -31,7 +31,7 @@
#include "dir_access.h"
#include "core/config/project_settings.h"
-#include "core/os/file_access.h"
+#include "core/io/file_access.h"
#include "core/os/memory.h"
#include "core/os/os.h"
diff --git a/core/os/dir_access.h b/core/io/dir_access.h
index 16154a4850..16154a4850 100644
--- a/core/os/dir_access.h
+++ b/core/io/dir_access.h
diff --git a/core/io/dtls_server.cpp b/core/io/dtls_server.cpp
index 288b2efe0e..655fb18535 100644
--- a/core/io/dtls_server.cpp
+++ b/core/io/dtls_server.cpp
@@ -31,7 +31,7 @@
#include "dtls_server.h"
#include "core/config/project_settings.h"
-#include "core/os/file_access.h"
+#include "core/io/file_access.h"
DTLSServer *(*DTLSServer::_create)() = nullptr;
bool DTLSServer::available = false;
diff --git a/core/io/dtls_server.h b/core/io/dtls_server.h
index 92b6caf508..02a32533e1 100644
--- a/core/io/dtls_server.h
+++ b/core/io/dtls_server.h
@@ -34,8 +34,8 @@
#include "core/io/net_socket.h"
#include "core/io/packet_peer_dtls.h"
-class DTLSServer : public Reference {
- GDCLASS(DTLSServer, Reference);
+class DTLSServer : public RefCounted {
+ GDCLASS(DTLSServer, RefCounted);
protected:
static DTLSServer *(*_create)();
diff --git a/core/os/file_access.cpp b/core/io/file_access.cpp
index d21c0bd9a2..d21c0bd9a2 100644
--- a/core/os/file_access.cpp
+++ b/core/io/file_access.cpp
diff --git a/core/os/file_access.h b/core/io/file_access.h
index 5804aa2c47..5804aa2c47 100644
--- a/core/os/file_access.h
+++ b/core/io/file_access.h
diff --git a/core/io/file_access_compressed.h b/core/io/file_access_compressed.h
index 19e4f241dd..3389e020e3 100644
--- a/core/io/file_access_compressed.h
+++ b/core/io/file_access_compressed.h
@@ -32,7 +32,7 @@
#define FILE_ACCESS_COMPRESSED_H
#include "core/io/compression.h"
-#include "core/os/file_access.h"
+#include "core/io/file_access.h"
class FileAccessCompressed : public FileAccess {
Compression::Mode cmode = Compression::MODE_ZSTD;
diff --git a/core/io/file_access_encrypted.h b/core/io/file_access_encrypted.h
index 00f14099f9..decffae696 100644
--- a/core/io/file_access_encrypted.h
+++ b/core/io/file_access_encrypted.h
@@ -31,7 +31,7 @@
#ifndef FILE_ACCESS_ENCRYPTED_H
#define FILE_ACCESS_ENCRYPTED_H
-#include "core/os/file_access.h"
+#include "core/io/file_access.h"
#define ENCRYPTED_HEADER_MAGIC 0x43454447
diff --git a/core/io/file_access_memory.cpp b/core/io/file_access_memory.cpp
index d9be2a4a75..627fd2bf9c 100644
--- a/core/io/file_access_memory.cpp
+++ b/core/io/file_access_memory.cpp
@@ -31,7 +31,7 @@
#include "file_access_memory.h"
#include "core/config/project_settings.h"
-#include "core/os/dir_access.h"
+#include "core/io/dir_access.h"
#include "core/templates/map.h"
static Map<String, Vector<uint8_t>> *files = nullptr;
diff --git a/core/io/file_access_memory.h b/core/io/file_access_memory.h
index 4157531d01..14135bd68c 100644
--- a/core/io/file_access_memory.h
+++ b/core/io/file_access_memory.h
@@ -31,7 +31,7 @@
#ifndef FILE_ACCESS_MEMORY_H
#define FILE_ACCESS_MEMORY_H
-#include "core/os/file_access.h"
+#include "core/io/file_access.h"
class FileAccessMemory : public FileAccess {
uint8_t *data = nullptr;
diff --git a/core/io/file_access_network.h b/core/io/file_access_network.h
index 94b66c2480..1d9d761fbb 100644
--- a/core/io/file_access_network.h
+++ b/core/io/file_access_network.h
@@ -31,8 +31,8 @@
#ifndef FILE_ACCESS_NETWORK_H
#define FILE_ACCESS_NETWORK_H
+#include "core/io/file_access.h"
#include "core/io/stream_peer_tcp.h"
-#include "core/os/file_access.h"
#include "core/os/semaphore.h"
#include "core/os/thread.h"
diff --git a/core/io/file_access_pack.h b/core/io/file_access_pack.h
index 7a83fc938f..2f0ee62723 100644
--- a/core/io/file_access_pack.h
+++ b/core/io/file_access_pack.h
@@ -31,8 +31,8 @@
#ifndef FILE_ACCESS_PACK_H
#define FILE_ACCESS_PACK_H
-#include "core/os/dir_access.h"
-#include "core/os/file_access.h"
+#include "core/io/dir_access.h"
+#include "core/io/file_access.h"
#include "core/string/print_string.h"
#include "core/templates/list.h"
#include "core/templates/map.h"
diff --git a/core/io/file_access_zip.cpp b/core/io/file_access_zip.cpp
index b8383fd865..b5c882e9ce 100644
--- a/core/io/file_access_zip.cpp
+++ b/core/io/file_access_zip.cpp
@@ -32,7 +32,7 @@
#include "file_access_zip.h"
-#include "core/os/file_access.h"
+#include "core/io/file_access.h"
ZipArchive *ZipArchive::instance = nullptr;
diff --git a/core/io/http_client.h b/core/io/http_client.h
index ec4b86b26f..f70999836f 100644
--- a/core/io/http_client.h
+++ b/core/io/http_client.h
@@ -34,10 +34,10 @@
#include "core/io/ip.h"
#include "core/io/stream_peer.h"
#include "core/io/stream_peer_tcp.h"
-#include "core/object/reference.h"
+#include "core/object/ref_counted.h"
-class HTTPClient : public Reference {
- GDCLASS(HTTPClient, Reference);
+class HTTPClient : public RefCounted {
+ GDCLASS(HTTPClient, RefCounted);
public:
enum ResponseCode {
diff --git a/core/io/image.cpp b/core/io/image.cpp
index c36fa6e45f..9cd0ea7b5d 100644
--- a/core/io/image.cpp
+++ b/core/io/image.cpp
@@ -1428,16 +1428,23 @@ void Image::flip_x() {
}
}
+/// Get mipmap size and offset.
int Image::_get_dst_image_size(int p_width, int p_height, Format p_format, int &r_mipmaps, int p_mipmaps, int *r_mm_width, int *r_mm_height) {
+ // Data offset in mipmaps (including the original texture).
int size = 0;
+
int w = p_width;
int h = p_height;
+
+ // Current mipmap index in the loop below. p_mipmaps is the target mipmap index.
+ // In this function, mipmap 0 represents the first mipmap instead of the original texture.
int mm = 0;
int pixsize = get_format_pixel_size(p_format);
int pixshift = get_format_pixel_rshift(p_format);
int block = get_format_block_size(p_format);
- //technically, you can still compress up to 1 px no matter the format, so commenting this
+
+ // Technically, you can still compress up to 1 px no matter the format, so commenting this.
//int minw, minh;
//get_format_min_pixel_size(p_format, minw, minh);
int minw = 1, minh = 1;
@@ -1453,17 +1460,6 @@ int Image::_get_dst_image_size(int p_width, int p_height, Format p_format, int &
size += s;
- if (r_mm_width) {
- *r_mm_width = bw;
- }
- if (r_mm_height) {
- *r_mm_height = bh;
- }
-
- if (p_mipmaps >= 0 && mm == p_mipmaps) {
- break;
- }
-
if (p_mipmaps >= 0) {
w = MAX(minw, w >> 1);
h = MAX(minh, h >> 1);
@@ -1474,6 +1470,21 @@ int Image::_get_dst_image_size(int p_width, int p_height, Format p_format, int &
w = MAX(minw, w >> 1);
h = MAX(minh, h >> 1);
}
+
+ // Set mipmap size.
+ // It might be necessary to put this after the minimum mipmap size check because of the possible occurrence of "1 >> 1".
+ if (r_mm_width) {
+ *r_mm_width = bw >> 1;
+ }
+ if (r_mm_height) {
+ *r_mm_height = bh >> 1;
+ }
+
+ // Reach target mipmap.
+ if (p_mipmaps >= 0 && mm == p_mipmaps) {
+ break;
+ }
+
mm++;
}
@@ -2718,10 +2729,11 @@ void (*Image::_image_decompress_bptc)(Image *) = nullptr;
void (*Image::_image_decompress_etc1)(Image *) = nullptr;
void (*Image::_image_decompress_etc2)(Image *) = nullptr;
-Vector<uint8_t> (*Image::lossy_packer)(const Ref<Image> &, float) = nullptr;
-Ref<Image> (*Image::lossy_unpacker)(const Vector<uint8_t> &) = nullptr;
-Vector<uint8_t> (*Image::lossless_packer)(const Ref<Image> &) = nullptr;
-Ref<Image> (*Image::lossless_unpacker)(const Vector<uint8_t> &) = nullptr;
+Vector<uint8_t> (*Image::webp_lossy_packer)(const Ref<Image> &, float) = nullptr;
+Vector<uint8_t> (*Image::webp_lossless_packer)(const Ref<Image> &) = nullptr;
+Ref<Image> (*Image::webp_unpacker)(const Vector<uint8_t> &) = nullptr;
+Vector<uint8_t> (*Image::png_packer)(const Ref<Image> &) = nullptr;
+Ref<Image> (*Image::png_unpacker)(const Vector<uint8_t> &) = nullptr;
Vector<uint8_t> (*Image::basis_universal_packer)(const Ref<Image> &, Image::UsedChannels) = nullptr;
Ref<Image> (*Image::basis_universal_unpacker)(const Vector<uint8_t> &) = nullptr;
diff --git a/core/io/image.h b/core/io/image.h
index df8f9b35a1..060e54a308 100644
--- a/core/io/image.h
+++ b/core/io/image.h
@@ -148,10 +148,11 @@ public:
static void (*_image_decompress_etc1)(Image *);
static void (*_image_decompress_etc2)(Image *);
- static Vector<uint8_t> (*lossy_packer)(const Ref<Image> &p_image, float p_quality);
- static Ref<Image> (*lossy_unpacker)(const Vector<uint8_t> &p_buffer);
- static Vector<uint8_t> (*lossless_packer)(const Ref<Image> &p_image);
- static Ref<Image> (*lossless_unpacker)(const Vector<uint8_t> &p_buffer);
+ static Vector<uint8_t> (*webp_lossy_packer)(const Ref<Image> &p_image, float p_quality);
+ static Vector<uint8_t> (*webp_lossless_packer)(const Ref<Image> &p_image);
+ static Ref<Image> (*webp_unpacker)(const Vector<uint8_t> &p_buffer);
+ static Vector<uint8_t> (*png_packer)(const Ref<Image> &p_image);
+ static Ref<Image> (*png_unpacker)(const Vector<uint8_t> &p_buffer);
static Vector<uint8_t> (*basis_universal_packer)(const Ref<Image> &p_image, UsedChannels p_channels);
static Ref<Image> (*basis_universal_unpacker)(const Vector<uint8_t> &p_buffer);
diff --git a/core/io/image_loader.h b/core/io/image_loader.h
index a5d588e0b5..6d1b1e3646 100644
--- a/core/io/image_loader.h
+++ b/core/io/image_loader.h
@@ -31,9 +31,9 @@
#ifndef IMAGE_LOADER_H
#define IMAGE_LOADER_H
+#include "core/io/file_access.h"
#include "core/io/image.h"
#include "core/io/resource_loader.h"
-#include "core/os/file_access.h"
#include "core/string/ustring.h"
#include "core/templates/list.h"
diff --git a/core/io/json.cpp b/core/io/json.cpp
index 394cf216e8..e3e9d6158b 100644
--- a/core/io/json.cpp
+++ b/core/io/json.cpp
@@ -55,7 +55,7 @@ static String _make_indent(const String &p_indent, int p_size) {
return indent_text;
}
-String JSON::_print_var(const Variant &p_var, const String &p_indent, int p_cur_indent, bool p_sort_keys) {
+String JSON::_print_var(const Variant &p_var, const String &p_indent, int p_cur_indent, bool p_sort_keys, bool p_full_precision) {
String colon = ":";
String end_statement = "";
@@ -71,8 +71,17 @@ String JSON::_print_var(const Variant &p_var, const String &p_indent, int p_cur_
return p_var.operator bool() ? "true" : "false";
case Variant::INT:
return itos(p_var);
- case Variant::FLOAT:
- return rtos(p_var);
+ case Variant::FLOAT: {
+ double num = p_var;
+ if (p_full_precision) {
+ // Store unreliable digits (17) instead of just reliable
+ // digits (14) so that the value can be decoded exactly.
+ return String::num(num, 17 - (int)floor(log10(num)));
+ } else {
+ // Store only reliable digits (14) by default.
+ return String::num(num, 14 - (int)floor(log10(num)));
+ }
+ }
case Variant::PACKED_INT32_ARRAY:
case Variant::PACKED_INT64_ARRAY:
case Variant::PACKED_FLOAT32_ARRAY:
@@ -121,8 +130,8 @@ String JSON::_print_var(const Variant &p_var, const String &p_indent, int p_cur_
}
}
-String JSON::print(const Variant &p_var, const String &p_indent, bool p_sort_keys) {
- return _print_var(p_var, p_indent, 0, p_sort_keys);
+String JSON::print(const Variant &p_var, const String &p_indent, bool p_sort_keys, bool p_full_precision) {
+ return _print_var(p_var, p_indent, 0, p_sort_keys, p_full_precision);
}
Error JSON::_get_token(const char32_t *p_str, int &index, int p_len, Token &r_token, int &line, String &r_err_str) {
diff --git a/core/io/json.h b/core/io/json.h
index 537477666e..bfd2347725 100644
--- a/core/io/json.h
+++ b/core/io/json.h
@@ -31,7 +31,7 @@
#ifndef JSON_H
#define JSON_H
-#include "core/object/reference.h"
+#include "core/object/ref_counted.h"
#include "core/variant/variant.h"
class JSON {
enum TokenType {
@@ -62,7 +62,7 @@ class JSON {
static const char *tk_name[TK_MAX];
- static String _print_var(const Variant &p_var, const String &p_indent, int p_cur_indent, bool p_sort_keys);
+ static String _print_var(const Variant &p_var, const String &p_indent, int p_cur_indent, bool p_sort_keys, bool p_full_precision = false);
static Error _get_token(const char32_t *p_str, int &index, int p_len, Token &r_token, int &line, String &r_err_str);
static Error _parse_value(Variant &value, Token &token, const char32_t *p_str, int &index, int p_len, int &line, String &r_err_str);
@@ -70,12 +70,12 @@ class JSON {
static Error _parse_object(Dictionary &object, const char32_t *p_str, int &index, int p_len, int &line, String &r_err_str);
public:
- static String print(const Variant &p_var, const String &p_indent = "", bool p_sort_keys = true);
+ static String print(const Variant &p_var, const String &p_indent = "", bool p_sort_keys = true, bool p_full_precision = false);
static Error parse(const String &p_json, Variant &r_ret, String &r_err_str, int &r_err_line);
};
-class JSONParser : public Reference {
- GDCLASS(JSONParser, Reference);
+class JSONParser : public RefCounted {
+ GDCLASS(JSONParser, RefCounted);
Variant data;
String string;
diff --git a/core/io/logger.cpp b/core/io/logger.cpp
index 8a07459a1d..09539f716c 100644
--- a/core/io/logger.cpp
+++ b/core/io/logger.cpp
@@ -31,8 +31,9 @@
#include "logger.h"
#include "core/config/project_settings.h"
-#include "core/os/dir_access.h"
+#include "core/io/dir_access.h"
#include "core/os/os.h"
+#include "core/os/time.h"
#include "core/string/print_string.h"
#if defined(MINGW_ENABLED) || defined(_MSC_VER)
@@ -156,11 +157,7 @@ void RotatedFileLogger::rotate_file() {
if (FileAccess::exists(base_path)) {
if (max_files > 1) {
- char timestamp[21];
- OS::Date date = OS::get_singleton()->get_date();
- OS::Time time = OS::get_singleton()->get_time();
- sprintf(timestamp, "_%04d-%02d-%02d_%02d.%02d.%02d", date.year, date.month, date.day, time.hour, time.min, time.sec);
-
+ String timestamp = Time::get_singleton()->get_datetime_string_from_system().replace(":", ".");
String backup_name = base_path.get_basename() + timestamp;
if (base_path.get_extension() != String()) {
backup_name += "." + base_path.get_extension();
diff --git a/core/io/logger.h b/core/io/logger.h
index a12945911c..ccf68562d6 100644
--- a/core/io/logger.h
+++ b/core/io/logger.h
@@ -31,7 +31,7 @@
#ifndef LOGGER_H
#define LOGGER_H
-#include "core/os/file_access.h"
+#include "core/io/file_access.h"
#include "core/string/ustring.h"
#include "core/templates/vector.h"
diff --git a/core/io/marshalls.cpp b/core/io/marshalls.cpp
index 18e1092c26..4c58c84c14 100644
--- a/core/io/marshalls.cpp
+++ b/core/io/marshalls.cpp
@@ -30,7 +30,7 @@
#include "marshalls.h"
-#include "core/object/reference.h"
+#include "core/object/ref_counted.h"
#include "core/os/keyboard.h"
#include "core/string/print_string.h"
@@ -489,8 +489,8 @@ Error decode_variant(Variant &r_variant, const uint8_t *p_buffer, int p_len, int
obj->set(str, value);
}
- if (Object::cast_to<Reference>(obj)) {
- REF ref = REF(Object::cast_to<Reference>(obj));
+ if (Object::cast_to<RefCounted>(obj)) {
+ REF ref = REF(Object::cast_to<RefCounted>(obj));
r_variant = ref;
} else {
r_variant = obj;
diff --git a/core/io/marshalls.h b/core/io/marshalls.h
index cc0e9ba301..7fac708f97 100644
--- a/core/io/marshalls.h
+++ b/core/io/marshalls.h
@@ -31,7 +31,7 @@
#ifndef MARSHALLS_H
#define MARSHALLS_H
-#include "core/object/reference.h"
+#include "core/object/ref_counted.h"
#include "core/typedefs.h"
#include "core/variant/variant.h"
@@ -165,8 +165,8 @@ static inline double decode_double(const uint8_t *p_arr) {
return md.d;
}
-class EncodedObjectAsID : public Reference {
- GDCLASS(EncodedObjectAsID, Reference);
+class EncodedObjectAsID : public RefCounted {
+ GDCLASS(EncodedObjectAsID, RefCounted);
ObjectID id;
diff --git a/core/io/multiplayer_api.h b/core/io/multiplayer_api.h
index 6a251cf77b..43804a20ec 100644
--- a/core/io/multiplayer_api.h
+++ b/core/io/multiplayer_api.h
@@ -32,10 +32,10 @@
#define MULTIPLAYER_API_H
#include "core/io/networked_multiplayer_peer.h"
-#include "core/object/reference.h"
+#include "core/object/ref_counted.h"
-class MultiplayerAPI : public Reference {
- GDCLASS(MultiplayerAPI, Reference);
+class MultiplayerAPI : public RefCounted {
+ GDCLASS(MultiplayerAPI, RefCounted);
public:
enum RPCMode {
diff --git a/core/io/net_socket.h b/core/io/net_socket.h
index 98ff9562d9..fd7d50c704 100644
--- a/core/io/net_socket.h
+++ b/core/io/net_socket.h
@@ -32,9 +32,9 @@
#define NET_SOCKET_H
#include "core/io/ip.h"
-#include "core/object/reference.h"
+#include "core/object/ref_counted.h"
-class NetSocket : public Reference {
+class NetSocket : public RefCounted {
protected:
static NetSocket *(*_create)();
diff --git a/core/io/packed_data_container.h b/core/io/packed_data_container.h
index 7791e21bb3..40772bb2bf 100644
--- a/core/io/packed_data_container.h
+++ b/core/io/packed_data_container.h
@@ -80,8 +80,8 @@ public:
PackedDataContainer() {}
};
-class PackedDataContainerRef : public Reference {
- GDCLASS(PackedDataContainerRef, Reference);
+class PackedDataContainerRef : public RefCounted {
+ GDCLASS(PackedDataContainerRef, RefCounted);
friend class PackedDataContainer;
uint32_t offset = 0;
diff --git a/core/io/packet_peer.h b/core/io/packet_peer.h
index 9e03c44750..9a345af3d0 100644
--- a/core/io/packet_peer.h
+++ b/core/io/packet_peer.h
@@ -35,8 +35,8 @@
#include "core/object/class_db.h"
#include "core/templates/ring_buffer.h"
-class PacketPeer : public Reference {
- GDCLASS(PacketPeer, Reference);
+class PacketPeer : public RefCounted {
+ GDCLASS(PacketPeer, RefCounted);
Variant _bnd_get_var(bool p_allow_objects = false);
diff --git a/core/io/packet_peer_dtls.cpp b/core/io/packet_peer_dtls.cpp
index bac98e20e7..a6d220622b 100644
--- a/core/io/packet_peer_dtls.cpp
+++ b/core/io/packet_peer_dtls.cpp
@@ -30,7 +30,7 @@
#include "packet_peer_dtls.h"
#include "core/config/project_settings.h"
-#include "core/os/file_access.h"
+#include "core/io/file_access.h"
PacketPeerDTLS *(*PacketPeerDTLS::_create)() = nullptr;
bool PacketPeerDTLS::available = false;
diff --git a/core/io/pck_packer.cpp b/core/io/pck_packer.cpp
index cadb02b5dd..806a95398f 100644
--- a/core/io/pck_packer.cpp
+++ b/core/io/pck_packer.cpp
@@ -31,9 +31,9 @@
#include "pck_packer.h"
#include "core/crypto/crypto_core.h"
+#include "core/io/file_access.h"
#include "core/io/file_access_encrypted.h"
#include "core/io/file_access_pack.h" // PACK_HEADER_MAGIC, PACK_FORMAT_VERSION
-#include "core/os/file_access.h"
#include "core/version.h"
static int _get_pad(int p_alignment, int p_n) {
diff --git a/core/io/pck_packer.h b/core/io/pck_packer.h
index dec8f8748d..3d2ce8f240 100644
--- a/core/io/pck_packer.h
+++ b/core/io/pck_packer.h
@@ -31,12 +31,12 @@
#ifndef PCK_PACKER_H
#define PCK_PACKER_H
-#include "core/object/reference.h"
+#include "core/object/ref_counted.h"
class FileAccess;
-class PCKPacker : public Reference {
- GDCLASS(PCKPacker, Reference);
+class PCKPacker : public RefCounted {
+ GDCLASS(PCKPacker, RefCounted);
FileAccess *file = nullptr;
int alignment = 0;
diff --git a/core/io/resource.cpp b/core/io/resource.cpp
index d46e9edafa..b970e85c99 100644
--- a/core/io/resource.cpp
+++ b/core/io/resource.cpp
@@ -31,9 +31,9 @@
#include "resource.h"
#include "core/core_string_names.h"
+#include "core/io/file_access.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 "scene/main/node.h" //only so casting works
diff --git a/core/io/resource.h b/core/io/resource.h
index 75a9f928f8..028fed1c6e 100644
--- a/core/io/resource.h
+++ b/core/io/resource.h
@@ -32,7 +32,7 @@
#define RESOURCE_H
#include "core/object/class_db.h"
-#include "core/object/reference.h"
+#include "core/object/ref_counted.h"
#include "core/templates/safe_refcount.h"
#include "core/templates/self_list.h"
@@ -43,8 +43,8 @@ public:
\
private:
-class Resource : public Reference {
- GDCLASS(Resource, Reference);
+class Resource : public RefCounted {
+ GDCLASS(Resource, RefCounted);
OBJ_CATEGORY("Resources");
public:
diff --git a/core/io/resource_format_binary.cpp b/core/io/resource_format_binary.cpp
index 385f15c0cf..f83ba30514 100644
--- a/core/io/resource_format_binary.cpp
+++ b/core/io/resource_format_binary.cpp
@@ -31,10 +31,10 @@
#include "resource_format_binary.h"
#include "core/config/project_settings.h"
+#include "core/io/dir_access.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/version.h"
//#define print_bl(m_what) print_line(m_what)
diff --git a/core/io/resource_format_binary.h b/core/io/resource_format_binary.h
index 3592bbdbc4..abc7403935 100644
--- a/core/io/resource_format_binary.h
+++ b/core/io/resource_format_binary.h
@@ -31,9 +31,9 @@
#ifndef RESOURCE_FORMAT_BINARY_H
#define RESOURCE_FORMAT_BINARY_H
+#include "core/io/file_access.h"
#include "core/io/resource_loader.h"
#include "core/io/resource_saver.h"
-#include "core/os/file_access.h"
class ResourceLoaderBinary {
bool translation_remapped = false;
diff --git a/core/io/resource_importer.h b/core/io/resource_importer.h
index a14d6ba52c..2ceeb176e5 100644
--- a/core/io/resource_importer.h
+++ b/core/io/resource_importer.h
@@ -93,8 +93,8 @@ public:
ResourceFormatImporter();
};
-class ResourceImporter : public Reference {
- GDCLASS(ResourceImporter, Reference);
+class ResourceImporter : public RefCounted {
+ GDCLASS(ResourceImporter, RefCounted);
public:
virtual String get_importer_name() const = 0;
diff --git a/core/io/resource_loader.cpp b/core/io/resource_loader.cpp
index b48c48b1bc..1700766cbf 100644
--- a/core/io/resource_loader.cpp
+++ b/core/io/resource_loader.cpp
@@ -31,8 +31,8 @@
#include "resource_loader.h"
#include "core/config/project_settings.h"
+#include "core/io/file_access.h"
#include "core/io/resource_importer.h"
-#include "core/os/file_access.h"
#include "core/os/os.h"
#include "core/string/print_string.h"
#include "core/string/translation.h"
@@ -68,17 +68,17 @@ bool ResourceFormatLoader::recognize_path(const String &p_path, const String &p_
}
bool ResourceFormatLoader::handles_type(const String &p_type) const {
- if (get_script_instance() && get_script_instance()->has_method("handles_type")) {
+ if (get_script_instance() && get_script_instance()->has_method("_handles_type")) {
// I guess custom loaders for custom resources should use "Resource"
- return get_script_instance()->call("handles_type", p_type);
+ return get_script_instance()->call("_handles_type", p_type);
}
return false;
}
String ResourceFormatLoader::get_resource_type(const String &p_path) const {
- if (get_script_instance() && get_script_instance()->has_method("get_resource_type")) {
- return get_script_instance()->call("get_resource_type", p_path);
+ if (get_script_instance() && get_script_instance()->has_method("_get_resource_type")) {
+ return get_script_instance()->call("_get_resource_type", p_path);
}
return "";
@@ -101,8 +101,8 @@ bool ResourceFormatLoader::exists(const String &p_path) const {
}
void ResourceFormatLoader::get_recognized_extensions(List<String> *p_extensions) const {
- if (get_script_instance() && get_script_instance()->has_method("get_recognized_extensions")) {
- PackedStringArray exts = get_script_instance()->call("get_recognized_extensions");
+ if (get_script_instance() && get_script_instance()->has_method("_get_recognized_extensions")) {
+ PackedStringArray exts = get_script_instance()->call("_get_recognized_extensions");
{
const String *r = exts.ptr();
@@ -115,8 +115,8 @@ void ResourceFormatLoader::get_recognized_extensions(List<String> *p_extensions)
RES ResourceFormatLoader::load(const String &p_path, const String &p_original_path, Error *r_error, bool p_use_sub_threads, float *r_progress, CacheMode p_cache_mode) {
// Check user-defined loader if there's any. Hard fail if it returns an error.
- if (get_script_instance() && get_script_instance()->has_method("load")) {
- Variant res = get_script_instance()->call("load", p_path, p_original_path, p_use_sub_threads, p_cache_mode);
+ if (get_script_instance() && get_script_instance()->has_method("_load")) {
+ Variant res = get_script_instance()->call("_load", p_path, p_original_path, p_use_sub_threads, p_cache_mode);
if (res.get_type() == Variant::INT) { // Error code, abort.
if (r_error) {
@@ -135,8 +135,8 @@ RES ResourceFormatLoader::load(const String &p_path, const String &p_original_pa
}
void ResourceFormatLoader::get_dependencies(const String &p_path, List<String> *p_dependencies, bool p_add_types) {
- if (get_script_instance() && get_script_instance()->has_method("get_dependencies")) {
- PackedStringArray deps = get_script_instance()->call("get_dependencies", p_path, p_add_types);
+ if (get_script_instance() && get_script_instance()->has_method("_get_dependencies")) {
+ PackedStringArray deps = get_script_instance()->call("_get_dependencies", p_path, p_add_types);
{
const String *r = deps.ptr();
@@ -148,13 +148,13 @@ void ResourceFormatLoader::get_dependencies(const String &p_path, List<String> *
}
Error ResourceFormatLoader::rename_dependencies(const String &p_path, const Map<String, String> &p_map) {
- if (get_script_instance() && get_script_instance()->has_method("rename_dependencies")) {
+ if (get_script_instance() && get_script_instance()->has_method("_rename_dependencies")) {
Dictionary deps_dict;
for (Map<String, String>::Element *E = p_map.front(); E; E = E->next()) {
deps_dict[E->key()] = E->value();
}
- int64_t res = get_script_instance()->call("rename_dependencies", deps_dict);
+ int64_t res = get_script_instance()->call("_rename_dependencies", deps_dict);
return (Error)res;
}
@@ -163,16 +163,16 @@ Error ResourceFormatLoader::rename_dependencies(const String &p_path, const Map<
void ResourceFormatLoader::_bind_methods() {
{
- MethodInfo info = MethodInfo(Variant::NIL, "load", PropertyInfo(Variant::STRING, "path"), PropertyInfo(Variant::STRING, "original_path"), PropertyInfo(Variant::BOOL, "use_sub_threads"), PropertyInfo(Variant::INT, "cache_mode"));
+ MethodInfo info = MethodInfo(Variant::NIL, "_load", PropertyInfo(Variant::STRING, "path"), PropertyInfo(Variant::STRING, "original_path"), PropertyInfo(Variant::BOOL, "use_sub_threads"), PropertyInfo(Variant::INT, "cache_mode"));
info.return_val.usage |= PROPERTY_USAGE_NIL_IS_VARIANT;
- ClassDB::add_virtual_method(get_class_static(), info);
+ BIND_VMETHOD(info);
}
- ClassDB::add_virtual_method(get_class_static(), MethodInfo(Variant::PACKED_STRING_ARRAY, "get_recognized_extensions"));
- ClassDB::add_virtual_method(get_class_static(), MethodInfo(Variant::BOOL, "handles_type", PropertyInfo(Variant::STRING_NAME, "typename")));
- ClassDB::add_virtual_method(get_class_static(), MethodInfo(Variant::STRING, "get_resource_type", PropertyInfo(Variant::STRING, "path")));
- ClassDB::add_virtual_method(get_class_static(), MethodInfo("get_dependencies", PropertyInfo(Variant::STRING, "path"), PropertyInfo(Variant::STRING, "add_types")));
- ClassDB::add_virtual_method(get_class_static(), MethodInfo(Variant::INT, "rename_dependencies", PropertyInfo(Variant::STRING, "path"), PropertyInfo(Variant::STRING, "renames")));
+ BIND_VMETHOD(MethodInfo(Variant::PACKED_STRING_ARRAY, "_get_recognized_extensions"));
+ BIND_VMETHOD(MethodInfo(Variant::BOOL, "_handles_type", PropertyInfo(Variant::STRING_NAME, "typename")));
+ BIND_VMETHOD(MethodInfo(Variant::STRING, "_get_resource_type", PropertyInfo(Variant::STRING, "path")));
+ BIND_VMETHOD(MethodInfo("_get_dependencies", PropertyInfo(Variant::STRING, "path"), PropertyInfo(Variant::STRING, "add_types")));
+ BIND_VMETHOD(MethodInfo(Variant::INT, "_rename_dependencies", PropertyInfo(Variant::STRING, "path"), PropertyInfo(Variant::STRING, "renames")));
BIND_ENUM_CONSTANT(CACHE_MODE_IGNORE);
BIND_ENUM_CONSTANT(CACHE_MODE_REUSE);
diff --git a/core/io/resource_loader.h b/core/io/resource_loader.h
index 914d988caa..c656b9a69c 100644
--- a/core/io/resource_loader.h
+++ b/core/io/resource_loader.h
@@ -35,8 +35,8 @@
#include "core/os/semaphore.h"
#include "core/os/thread.h"
-class ResourceFormatLoader : public Reference {
- GDCLASS(ResourceFormatLoader, Reference);
+class ResourceFormatLoader : public RefCounted {
+ GDCLASS(ResourceFormatLoader, RefCounted);
public:
enum CacheMode {
diff --git a/core/io/resource_saver.cpp b/core/io/resource_saver.cpp
index 7ebc7f34b3..389a4fdbbd 100644
--- a/core/io/resource_saver.cpp
+++ b/core/io/resource_saver.cpp
@@ -30,9 +30,9 @@
#include "resource_saver.h"
#include "core/config/project_settings.h"
+#include "core/io/file_access.h"
#include "core/io/resource_loader.h"
#include "core/object/script_language.h"
-#include "core/os/file_access.h"
Ref<ResourceFormatSaver> ResourceSaver::saver[MAX_SAVERS];
@@ -41,24 +41,24 @@ bool ResourceSaver::timestamp_on_save = false;
ResourceSavedCallback ResourceSaver::save_callback = nullptr;
Error ResourceFormatSaver::save(const String &p_path, const RES &p_resource, uint32_t p_flags) {
- if (get_script_instance() && get_script_instance()->has_method("save")) {
- return (Error)get_script_instance()->call("save", p_path, p_resource, p_flags).operator int64_t();
+ if (get_script_instance() && get_script_instance()->has_method("_save")) {
+ return (Error)get_script_instance()->call("_save", p_path, p_resource, p_flags).operator int64_t();
}
return ERR_METHOD_NOT_FOUND;
}
bool ResourceFormatSaver::recognize(const RES &p_resource) const {
- if (get_script_instance() && get_script_instance()->has_method("recognize")) {
- return get_script_instance()->call("recognize", p_resource);
+ if (get_script_instance() && get_script_instance()->has_method("_recognize")) {
+ return get_script_instance()->call("_recognize", p_resource);
}
return false;
}
void ResourceFormatSaver::get_recognized_extensions(const RES &p_resource, List<String> *p_extensions) const {
- if (get_script_instance() && get_script_instance()->has_method("get_recognized_extensions")) {
- PackedStringArray exts = get_script_instance()->call("get_recognized_extensions", p_resource);
+ if (get_script_instance() && get_script_instance()->has_method("_get_recognized_extensions")) {
+ PackedStringArray exts = get_script_instance()->call("_get_recognized_extensions", p_resource);
{
const String *r = exts.ptr();
@@ -74,11 +74,11 @@ void ResourceFormatSaver::_bind_methods() {
PropertyInfo arg0 = PropertyInfo(Variant::STRING, "path");
PropertyInfo arg1 = PropertyInfo(Variant::OBJECT, "resource", PROPERTY_HINT_RESOURCE_TYPE, "Resource");
PropertyInfo arg2 = PropertyInfo(Variant::INT, "flags");
- ClassDB::add_virtual_method(get_class_static(), MethodInfo(Variant::INT, "save", arg0, arg1, arg2));
+ BIND_VMETHOD(MethodInfo(Variant::INT, "_save", arg0, arg1, arg2));
}
- ClassDB::add_virtual_method(get_class_static(), MethodInfo(Variant::PACKED_STRING_ARRAY, "get_recognized_extensions", PropertyInfo(Variant::OBJECT, "resource", PROPERTY_HINT_RESOURCE_TYPE, "Resource")));
- ClassDB::add_virtual_method(get_class_static(), MethodInfo(Variant::BOOL, "recognize", PropertyInfo(Variant::OBJECT, "resource", PROPERTY_HINT_RESOURCE_TYPE, "Resource")));
+ BIND_VMETHOD(MethodInfo(Variant::PACKED_STRING_ARRAY, "_get_recognized_extensions", PropertyInfo(Variant::OBJECT, "resource", PROPERTY_HINT_RESOURCE_TYPE, "Resource")));
+ BIND_VMETHOD(MethodInfo(Variant::BOOL, "_recognize", PropertyInfo(Variant::OBJECT, "resource", PROPERTY_HINT_RESOURCE_TYPE, "Resource")));
}
Error ResourceSaver::save(const String &p_path, const RES &p_resource, uint32_t p_flags) {
diff --git a/core/io/resource_saver.h b/core/io/resource_saver.h
index 2c9e8f1aa3..07154aac4d 100644
--- a/core/io/resource_saver.h
+++ b/core/io/resource_saver.h
@@ -33,8 +33,8 @@
#include "core/io/resource.h"
-class ResourceFormatSaver : public Reference {
- GDCLASS(ResourceFormatSaver, Reference);
+class ResourceFormatSaver : public RefCounted {
+ GDCLASS(ResourceFormatSaver, RefCounted);
protected:
static void _bind_methods();
diff --git a/core/io/stream_peer.h b/core/io/stream_peer.h
index 1e1a3e890c..effc3850af 100644
--- a/core/io/stream_peer.h
+++ b/core/io/stream_peer.h
@@ -31,10 +31,10 @@
#ifndef STREAM_PEER_H
#define STREAM_PEER_H
-#include "core/object/reference.h"
+#include "core/object/ref_counted.h"
-class StreamPeer : public Reference {
- GDCLASS(StreamPeer, Reference);
+class StreamPeer : public RefCounted {
+ GDCLASS(StreamPeer, RefCounted);
OBJ_CATEGORY("Networking");
protected:
diff --git a/core/io/tcp_server.h b/core/io/tcp_server.h
index abefa53c6f..10985a04d5 100644
--- a/core/io/tcp_server.h
+++ b/core/io/tcp_server.h
@@ -36,8 +36,8 @@
#include "core/io/stream_peer.h"
#include "core/io/stream_peer_tcp.h"
-class TCPServer : public Reference {
- GDCLASS(TCPServer, Reference);
+class TCPServer : public RefCounted {
+ GDCLASS(TCPServer, RefCounted);
protected:
enum {
diff --git a/core/io/translation_loader_po.cpp b/core/io/translation_loader_po.cpp
index 9adf912224..83d575cee8 100644
--- a/core/io/translation_loader_po.cpp
+++ b/core/io/translation_loader_po.cpp
@@ -30,7 +30,7 @@
#include "translation_loader_po.h"
-#include "core/os/file_access.h"
+#include "core/io/file_access.h"
#include "core/string/translation.h"
#include "core/string/translation_po.h"
diff --git a/core/io/translation_loader_po.h b/core/io/translation_loader_po.h
index 36d33fcac3..c52820e60d 100644
--- a/core/io/translation_loader_po.h
+++ b/core/io/translation_loader_po.h
@@ -31,8 +31,8 @@
#ifndef TRANSLATION_LOADER_PO_H
#define TRANSLATION_LOADER_PO_H
+#include "core/io/file_access.h"
#include "core/io/resource_loader.h"
-#include "core/os/file_access.h"
#include "core/string/translation.h"
class TranslationLoaderPO : public ResourceFormatLoader {
diff --git a/core/io/udp_server.h b/core/io/udp_server.h
index 60d03f37f0..e49a559c51 100644
--- a/core/io/udp_server.h
+++ b/core/io/udp_server.h
@@ -34,8 +34,8 @@
#include "core/io/net_socket.h"
#include "core/io/packet_peer_udp.h"
-class UDPServer : public Reference {
- GDCLASS(UDPServer, Reference);
+class UDPServer : public RefCounted {
+ GDCLASS(UDPServer, RefCounted);
protected:
enum {
diff --git a/core/io/xml_parser.h b/core/io/xml_parser.h
index c323301eac..1113cce715 100644
--- a/core/io/xml_parser.h
+++ b/core/io/xml_parser.h
@@ -31,8 +31,8 @@
#ifndef XML_PARSER_H
#define XML_PARSER_H
-#include "core/object/reference.h"
-#include "core/os/file_access.h"
+#include "core/io/file_access.h"
+#include "core/object/ref_counted.h"
#include "core/string/ustring.h"
#include "core/templates/vector.h"
@@ -40,8 +40,8 @@
Based on irrXML (see their zlib license). Added mainly for compatibility with their Collada loader.
*/
-class XMLParser : public Reference {
- GDCLASS(XMLParser, Reference);
+class XMLParser : public RefCounted {
+ GDCLASS(XMLParser, RefCounted);
public:
//! Enumeration of all supported source text file formats
diff --git a/core/io/zip_io.h b/core/io/zip_io.h
index 52691c65e9..776473bfa1 100644
--- a/core/io/zip_io.h
+++ b/core/io/zip_io.h
@@ -31,7 +31,7 @@
#ifndef ZIP_IO_H
#define ZIP_IO_H
-#include "core/os/file_access.h"
+#include "core/io/file_access.h"
// Not directly used in this header, but assumed available in downstream users
// like platform/*/export/export.cpp. Could be fixed, but probably better to have
diff --git a/core/math/a_star.h b/core/math/a_star.h
index 4c61abd91c..44758cb046 100644
--- a/core/math/a_star.h
+++ b/core/math/a_star.h
@@ -31,7 +31,7 @@
#ifndef A_STAR_H
#define A_STAR_H
-#include "core/object/reference.h"
+#include "core/object/ref_counted.h"
#include "core/templates/oa_hash_map.h"
/**
@@ -40,8 +40,8 @@
@author Juan Linietsky <reduzio@gmail.com>
*/
-class AStar : public Reference {
- GDCLASS(AStar, Reference);
+class AStar : public RefCounted {
+ GDCLASS(AStar, RefCounted);
friend class AStar2D;
struct Point {
@@ -157,8 +157,8 @@ public:
~AStar();
};
-class AStar2D : public Reference {
- GDCLASS(AStar2D, Reference);
+class AStar2D : public RefCounted {
+ GDCLASS(AStar2D, RefCounted);
AStar astar;
bool _solve(AStar::Point *begin_point, AStar::Point *end_point);
diff --git a/core/math/aabb.cpp b/core/math/aabb.cpp
index 2c721997d8..33aa65f15d 100644
--- a/core/math/aabb.cpp
+++ b/core/math/aabb.cpp
@@ -392,5 +392,5 @@ Variant AABB::intersects_ray_bind(const Vector3 &p_from, const Vector3 &p_dir) c
}
AABB::operator String() const {
- return String() + position + " - " + size;
+ return "[P: " + position.operator String() + ", S: " + size + "]";
}
diff --git a/core/math/basis.cpp b/core/math/basis.cpp
index 7489da34d9..aa3831d4cf 100644
--- a/core/math/basis.cpp
+++ b/core/math/basis.cpp
@@ -756,18 +756,9 @@ bool Basis::operator!=(const Basis &p_matrix) const {
}
Basis::operator String() const {
- String mtx;
- for (int i = 0; i < 3; i++) {
- for (int j = 0; j < 3; j++) {
- if (i != 0 || j != 0) {
- mtx += ", ";
- }
-
- mtx += rtos(elements[j][i]); //matrix is stored transposed for performance, so print it transposed
- }
- }
-
- return mtx;
+ return "[X: " + get_axis(0).operator String() +
+ ", Y: " + get_axis(1).operator String() +
+ ", Z: " + get_axis(2).operator String() + "]";
}
Quaternion Basis::get_quaternion() const {
diff --git a/core/math/color.cpp b/core/math/color.cpp
index 52f029ef4b..dc86cacf8f 100644
--- a/core/math/color.cpp
+++ b/core/math/color.cpp
@@ -368,7 +368,7 @@ Color Color::named(const String &p_name) {
ERR_FAIL_V_MSG(Color(), "Invalid color name: " + p_name + ".");
return Color();
}
- return get_named_color(idx);
+ return named_colors[idx].color;
}
Color Color::named(const String &p_name, const Color &p_default) {
@@ -376,7 +376,7 @@ Color Color::named(const String &p_name, const Color &p_default) {
if (idx == -1) {
return p_default;
}
- return get_named_color(idx);
+ return named_colors[idx].color;
}
int Color::find_named_color(const String &p_name) {
@@ -409,10 +409,12 @@ int Color::get_named_color_count() {
}
String Color::get_named_color_name(int p_idx) {
+ ERR_FAIL_INDEX_V(p_idx, get_named_color_count(), "");
return named_colors[p_idx].name;
}
Color Color::get_named_color(int p_idx) {
+ ERR_FAIL_INDEX_V(p_idx, get_named_color_count(), Color());
return named_colors[p_idx].color;
}
@@ -466,7 +468,7 @@ Color Color::from_hsv(float p_h, float p_s, float p_v, float p_a) const {
}
Color::operator String() const {
- return rtos(r) + ", " + rtos(g) + ", " + rtos(b) + ", " + rtos(a);
+ return "(" + String::num(r, 4) + ", " + String::num(g, 4) + ", " + String::num(b, 4) + ", " + String::num(a, 4) + ")";
}
Color Color::operator+(const Color &p_color) const {
diff --git a/core/math/delaunay_3d.h b/core/math/delaunay_3d.h
index 25cc1125db..6f7209556e 100644
--- a/core/math/delaunay_3d.h
+++ b/core/math/delaunay_3d.h
@@ -31,10 +31,10 @@
#ifndef DELAUNAY_3D_H
#define DELAUNAY_3D_H
+#include "core/io/file_access.h"
#include "core/math/aabb.h"
#include "core/math/camera_matrix.h"
#include "core/math/vector3.h"
-#include "core/os/file_access.h"
#include "core/string/print_string.h"
#include "core/templates/local_vector.h"
#include "core/templates/oa_hash_map.h"
diff --git a/core/math/expression.cpp b/core/math/expression.cpp
index f7ac44d321..0146c345f0 100644
--- a/core/math/expression.cpp
+++ b/core/math/expression.cpp
@@ -33,7 +33,7 @@
#include "core/io/marshalls.h"
#include "core/math/math_funcs.h"
#include "core/object/class_db.h"
-#include "core/object/reference.h"
+#include "core/object/ref_counted.h"
#include "core/os/os.h"
#include "core/variant/variant_parser.h"
diff --git a/core/math/expression.h b/core/math/expression.h
index a6b288ed6e..aecf662d0a 100644
--- a/core/math/expression.h
+++ b/core/math/expression.h
@@ -31,10 +31,10 @@
#ifndef EXPRESSION_H
#define EXPRESSION_H
-#include "core/object/reference.h"
+#include "core/object/ref_counted.h"
-class Expression : public Reference {
- GDCLASS(Expression, Reference);
+class Expression : public RefCounted {
+ GDCLASS(Expression, RefCounted);
private:
struct Input {
diff --git a/core/math/plane.cpp b/core/math/plane.cpp
index f1d3bbbd54..3c78b55b90 100644
--- a/core/math/plane.cpp
+++ b/core/math/plane.cpp
@@ -175,5 +175,5 @@ bool Plane::is_equal_approx(const Plane &p_plane) const {
}
Plane::operator String() const {
- return normal.operator String() + ", " + rtos(d);
+ return "[N: " + normal.operator String() + ", D: " + String::num_real(d, false) + "]";
}
diff --git a/core/math/quaternion.cpp b/core/math/quaternion.cpp
index 8de3d0cc2a..7037db7112 100644
--- a/core/math/quaternion.cpp
+++ b/core/math/quaternion.cpp
@@ -181,7 +181,7 @@ Quaternion Quaternion::cubic_slerp(const Quaternion &p_b, const Quaternion &p_pr
}
Quaternion::operator String() const {
- return String::num(x) + ", " + String::num(y) + ", " + String::num(z) + ", " + String::num(w);
+ return "(" + String::num_real(x, false) + ", " + String::num_real(y, false) + ", " + String::num_real(z, false) + ", " + String::num_real(w, false) + ")";
}
Quaternion::Quaternion(const Vector3 &p_axis, real_t p_angle) {
diff --git a/core/math/random_number_generator.h b/core/math/random_number_generator.h
index a396c2b7d7..06cd3999f3 100644
--- a/core/math/random_number_generator.h
+++ b/core/math/random_number_generator.h
@@ -32,10 +32,10 @@
#define RANDOM_NUMBER_GENERATOR_H
#include "core/math/random_pcg.h"
-#include "core/object/reference.h"
+#include "core/object/ref_counted.h"
-class RandomNumberGenerator : public Reference {
- GDCLASS(RandomNumberGenerator, Reference);
+class RandomNumberGenerator : public RefCounted {
+ GDCLASS(RandomNumberGenerator, RefCounted);
protected:
RandomPCG randbase;
diff --git a/core/math/rect2.cpp b/core/math/rect2.cpp
index 60c44999f7..f64bf560c8 100644
--- a/core/math/rect2.cpp
+++ b/core/math/rect2.cpp
@@ -263,3 +263,11 @@ next4:
return true;
}
+
+Rect2::operator String() const {
+ return "[P: " + position.operator String() + ", S: " + size + "]";
+}
+
+Rect2i::operator String() const {
+ return "[P: " + position.operator String() + ", S: " + size + "]";
+}
diff --git a/core/math/rect2.h b/core/math/rect2.h
index 1dc027cf72..ab0b489b4a 100644
--- a/core/math/rect2.h
+++ b/core/math/rect2.h
@@ -320,7 +320,7 @@ struct Rect2 {
return position + size;
}
- operator String() const { return String(position) + ", " + String(size); }
+ operator String() const;
Rect2() {}
Rect2(real_t p_x, real_t p_y, real_t p_width, real_t p_height) :
@@ -498,7 +498,7 @@ struct Rect2i {
return position + size;
}
- operator String() const { return String(position) + ", " + String(size); }
+ operator String() const;
operator Rect2() const { return Rect2(position, size); }
diff --git a/core/math/transform_2d.cpp b/core/math/transform_2d.cpp
index 9189234d04..0140f31b8a 100644
--- a/core/math/transform_2d.cpp
+++ b/core/math/transform_2d.cpp
@@ -277,5 +277,7 @@ Transform2D Transform2D::interpolate_with(const Transform2D &p_transform, real_t
}
Transform2D::operator String() const {
- return String(String() + elements[0] + ", " + elements[1] + ", " + elements[2]);
+ return "[X: " + elements[0].operator String() +
+ ", Y: " + elements[1].operator String() +
+ ", O: " + elements[2].operator String() + "]";
}
diff --git a/core/math/transform_3d.cpp b/core/math/transform_3d.cpp
index 210f0b81bb..a34d998dde 100644
--- a/core/math/transform_3d.cpp
+++ b/core/math/transform_3d.cpp
@@ -191,7 +191,10 @@ Transform3D Transform3D::operator*(const Transform3D &p_transform) const {
}
Transform3D::operator String() const {
- return basis.operator String() + " - " + origin.operator String();
+ return "[X: " + basis.get_axis(0).operator String() +
+ ", Y: " + basis.get_axis(1).operator String() +
+ ", Z: " + basis.get_axis(2).operator String() +
+ ", O: " + origin.operator String() + "]";
}
Transform3D::Transform3D(const Basis &p_basis, const Vector3 &p_origin) :
diff --git a/core/math/triangle_mesh.h b/core/math/triangle_mesh.h
index 1d1dbc114b..463b0dd5c8 100644
--- a/core/math/triangle_mesh.h
+++ b/core/math/triangle_mesh.h
@@ -32,10 +32,10 @@
#define TRIANGLE_MESH_H
#include "core/math/face3.h"
-#include "core/object/reference.h"
+#include "core/object/ref_counted.h"
-class TriangleMesh : public Reference {
- GDCLASS(TriangleMesh, Reference);
+class TriangleMesh : public RefCounted {
+ GDCLASS(TriangleMesh, RefCounted);
struct Triangle {
Vector3 normal;
diff --git a/core/math/vector2.cpp b/core/math/vector2.cpp
index ea430b15c4..eb3301f5d0 100644
--- a/core/math/vector2.cpp
+++ b/core/math/vector2.cpp
@@ -193,6 +193,10 @@ bool Vector2::is_equal_approx(const Vector2 &p_v) const {
return Math::is_equal_approx(x, p_v.x) && Math::is_equal_approx(y, p_v.y);
}
+Vector2::operator String() const {
+ return "(" + String::num_real(x, false) + ", " + String::num_real(y, false) + ")";
+}
+
/* Vector2i */
Vector2i Vector2i::clamp(const Vector2i &p_min, const Vector2i &p_max) const {
@@ -269,3 +273,7 @@ bool Vector2i::operator==(const Vector2i &p_vec2) const {
bool Vector2i::operator!=(const Vector2i &p_vec2) const {
return x != p_vec2.x || y != p_vec2.y;
}
+
+Vector2i::operator String() const {
+ return "(" + itos(x) + ", " + itos(y) + ")";
+}
diff --git a/core/math/vector2.h b/core/math/vector2.h
index b0d2049f55..78deb473b4 100644
--- a/core/math/vector2.h
+++ b/core/math/vector2.h
@@ -165,7 +165,7 @@ struct Vector2 {
Vector2 clamp(const Vector2 &p_min, const Vector2 &p_max) const;
real_t aspect() const { return width / height; }
- operator String() const { return String::num(x) + ", " + String::num(y); }
+ operator String() const;
_FORCE_INLINE_ Vector2() {}
_FORCE_INLINE_ Vector2(real_t p_x, real_t p_y) {
@@ -340,7 +340,7 @@ struct Vector2i {
Vector2i abs() const { return Vector2i(ABS(x), ABS(y)); }
Vector2i clamp(const Vector2i &p_min, const Vector2i &p_max) const;
- operator String() const { return String::num(x) + ", " + String::num(y); }
+ operator String() const;
operator Vector2() const { return Vector2(x, y); }
diff --git a/core/math/vector3.cpp b/core/math/vector3.cpp
index d5ca985244..3d59064af6 100644
--- a/core/math/vector3.cpp
+++ b/core/math/vector3.cpp
@@ -126,5 +126,5 @@ bool Vector3::is_equal_approx(const Vector3 &p_v) const {
}
Vector3::operator String() const {
- return (rtos(x) + ", " + rtos(y) + ", " + rtos(z));
+ return "(" + String::num_real(x, false) + ", " + String::num_real(y, false) + ", " + String::num_real(z, false) + ")";
}
diff --git a/core/math/vector3i.cpp b/core/math/vector3i.cpp
index a82db7f7fc..2de1e4e331 100644
--- a/core/math/vector3i.cpp
+++ b/core/math/vector3i.cpp
@@ -56,5 +56,5 @@ Vector3i Vector3i::clamp(const Vector3i &p_min, const Vector3i &p_max) const {
}
Vector3i::operator String() const {
- return (itos(x) + ", " + itos(y) + ", " + itos(z));
+ return "(" + itos(x) + ", " + itos(y) + ", " + itos(z) + ")";
}
diff --git a/core/object/object.cpp b/core/object/object.cpp
index 7e1c3855c0..799e63a512 100644
--- a/core/object/object.cpp
+++ b/core/object/object.cpp
@@ -769,7 +769,7 @@ Variant Object::call(const StringName &p_method, const Variant **p_args, int p_a
r_error.error = Callable::CallError::CALL_ERROR_TOO_MANY_ARGUMENTS;
return Variant();
}
- if (Object::cast_to<Reference>(this)) {
+ if (Object::cast_to<RefCounted>(this)) {
r_error.argument = 0;
r_error.error = Callable::CallError::CALL_ERROR_INVALID_METHOD;
ERR_FAIL_V_MSG(Variant(), "Can't 'free' a reference.");
@@ -1900,7 +1900,7 @@ ObjectID ObjectDB::add_instance(Object *p_object) {
object_slots = (ObjectSlot *)memrealloc(object_slots, sizeof(ObjectSlot) * new_slot_max);
for (uint32_t i = slot_max; i < new_slot_max; i++) {
object_slots[i].object = nullptr;
- object_slots[i].is_reference = false;
+ object_slots[i].is_ref_counted = false;
object_slots[i].next_free = i;
object_slots[i].validator = 0;
}
@@ -1913,7 +1913,7 @@ ObjectID ObjectDB::add_instance(Object *p_object) {
ERR_FAIL_COND_V(object_slots[slot].object != nullptr, ObjectID());
}
object_slots[slot].object = p_object;
- object_slots[slot].is_reference = p_object->is_reference();
+ object_slots[slot].is_ref_counted = p_object->is_ref_counted();
validator_counter = (validator_counter + 1) & OBJECTDB_VALIDATOR_MASK;
if (unlikely(validator_counter == 0)) {
validator_counter = 1;
@@ -1924,7 +1924,7 @@ ObjectID ObjectDB::add_instance(Object *p_object) {
id <<= OBJECTDB_SLOT_MAX_COUNT_BITS;
id |= uint64_t(slot);
- if (p_object->is_reference()) {
+ if (p_object->is_ref_counted()) {
id |= OBJECTDB_REFERENCE_BIT;
}
@@ -1962,7 +1962,7 @@ void ObjectDB::remove_instance(Object *p_object) {
object_slots[slot_count].next_free = slot;
//invalidate, so checks against it fail
object_slots[slot].validator = 0;
- object_slots[slot].is_reference = false;
+ object_slots[slot].is_ref_counted = false;
object_slots[slot].object = nullptr;
spin_lock.unlock();
@@ -1997,7 +1997,7 @@ void ObjectDB::cleanup() {
extra_info = " - Resource path: " + String(resource_get_path->call(obj, nullptr, 0, call_error));
}
- uint64_t id = uint64_t(i) | (uint64_t(object_slots[i].validator) << OBJECTDB_VALIDATOR_BITS) | (object_slots[i].is_reference ? OBJECTDB_REFERENCE_BIT : 0);
+ uint64_t id = uint64_t(i) | (uint64_t(object_slots[i].validator) << OBJECTDB_VALIDATOR_BITS) | (object_slots[i].is_ref_counted ? OBJECTDB_REFERENCE_BIT : 0);
print_line("Leaked instance: " + String(obj->get_class()) + ":" + itos(id) + extra_info);
count--;
diff --git a/core/object/object.h b/core/object/object.h
index 137025f323..37b2e61dfe 100644
--- a/core/object/object.h
+++ b/core/object/object.h
@@ -545,7 +545,7 @@ private:
_FORCE_INLINE_ void _construct_object(bool p_reference);
- friend class Reference;
+ friend class RefCounted;
bool type_is_reference = false;
SafeNumeric<uint32_t> instance_binding_count;
void *_script_instance_bindings[MAX_SCRIPT_INSTANCE_BINDINGS];
@@ -795,7 +795,7 @@ public:
void clear_internal_resource_paths();
- _ALWAYS_INLINE_ bool is_reference() const { return type_is_reference; }
+ _ALWAYS_INLINE_ bool is_ref_counted() const { return type_is_reference; }
Object();
virtual ~Object();
@@ -815,7 +815,7 @@ class ObjectDB {
struct ObjectSlot { //128 bits per slot
uint64_t validator : OBJECTDB_VALIDATOR_BITS;
uint64_t next_free : OBJECTDB_SLOT_MAX_COUNT_BITS;
- uint64_t is_reference : 1;
+ uint64_t is_ref_counted : 1;
Object *object;
};
diff --git a/core/object/object_id.h b/core/object/object_id.h
index 7f2496ad48..0666ec0855 100644
--- a/core/object/object_id.h
+++ b/core/object/object_id.h
@@ -42,7 +42,7 @@ class ObjectID {
uint64_t id = 0;
public:
- _ALWAYS_INLINE_ bool is_reference() const { return (id & (uint64_t(1) << 63)) != 0; }
+ _ALWAYS_INLINE_ bool is_ref_counted() const { return (id & (uint64_t(1) << 63)) != 0; }
_ALWAYS_INLINE_ bool is_valid() const { return id != 0; }
_ALWAYS_INLINE_ bool is_null() const { return id == 0; }
_ALWAYS_INLINE_ operator uint64_t() const { return id; }
diff --git a/core/object/reference.cpp b/core/object/ref_counted.cpp
index 086b761e95..9862624972 100644
--- a/core/object/reference.cpp
+++ b/core/object/ref_counted.cpp
@@ -1,5 +1,5 @@
/*************************************************************************/
-/* reference.cpp */
+/* ref_counted.cpp */
/*************************************************************************/
/* This file is part of: */
/* GODOT ENGINE */
@@ -28,11 +28,11 @@
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
/*************************************************************************/
-#include "reference.h"
+#include "ref_counted.h"
#include "core/object/script_language.h"
-bool Reference::init_ref() {
+bool RefCounted::init_ref() {
if (reference()) {
if (!is_referenced() && refcount_init.unref()) {
unreference(); // first referencing is already 1, so compensate for the ref above
@@ -44,17 +44,17 @@ bool Reference::init_ref() {
}
}
-void Reference::_bind_methods() {
- ClassDB::bind_method(D_METHOD("init_ref"), &Reference::init_ref);
- ClassDB::bind_method(D_METHOD("reference"), &Reference::reference);
- ClassDB::bind_method(D_METHOD("unreference"), &Reference::unreference);
+void RefCounted::_bind_methods() {
+ ClassDB::bind_method(D_METHOD("init_ref"), &RefCounted::init_ref);
+ ClassDB::bind_method(D_METHOD("reference"), &RefCounted::reference);
+ ClassDB::bind_method(D_METHOD("unreference"), &RefCounted::unreference);
}
-int Reference::reference_get_count() const {
+int RefCounted::reference_get_count() const {
return refcount.get();
}
-bool Reference::reference() {
+bool RefCounted::reference() {
uint32_t rc_val = refcount.refval();
bool success = rc_val != 0;
@@ -77,7 +77,7 @@ bool Reference::reference() {
return success;
}
-bool Reference::unreference() {
+bool RefCounted::unreference() {
uint32_t rc_val = refcount.unrefval();
bool die = rc_val == 0;
@@ -102,7 +102,7 @@ bool Reference::unreference() {
return die;
}
-Reference::Reference() :
+RefCounted::RefCounted() :
Object(true) {
refcount.init();
refcount_init.init();
@@ -117,7 +117,7 @@ Variant WeakRef::get_ref() const {
if (!obj) {
return Variant();
}
- Reference *r = cast_to<Reference>(obj);
+ RefCounted *r = cast_to<RefCounted>(obj);
if (r) {
return REF(r);
}
diff --git a/core/object/reference.h b/core/object/ref_counted.h
index d02cb12069..3dd7cc456b 100644
--- a/core/object/reference.h
+++ b/core/object/ref_counted.h
@@ -1,5 +1,5 @@
/*************************************************************************/
-/* reference.h */
+/* ref_counted.h */
/*************************************************************************/
/* This file is part of: */
/* GODOT ENGINE */
@@ -28,14 +28,14 @@
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
/*************************************************************************/
-#ifndef REFERENCE_H
-#define REFERENCE_H
+#ifndef REF_COUNTED_H
+#define REF_COUNTED_H
#include "core/object/class_db.h"
#include "core/templates/safe_refcount.h"
-class Reference : public Object {
- GDCLASS(Reference, Object);
+class RefCounted : public Object {
+ GDCLASS(RefCounted, Object);
SafeRefCount refcount;
SafeRefCount refcount_init;
@@ -49,8 +49,8 @@ public:
bool unreference();
int reference_get_count() const;
- Reference();
- ~Reference() {}
+ RefCounted();
+ ~RefCounted() {}
};
template <class T>
@@ -78,7 +78,7 @@ class Ref {
}
}
- //virtual Reference * get_reference() const { return reference; }
+ //virtual RefCounted * get_reference() const { return reference; }
public:
_FORCE_INLINE_ bool operator==(const T *p_ptr) const {
return reference == p_ptr;
@@ -130,7 +130,7 @@ public:
template <class T_Other>
void operator=(const Ref<T_Other> &p_from) {
- Reference *refb = const_cast<Reference *>(static_cast<const Reference *>(p_from.ptr()));
+ RefCounted *refb = const_cast<RefCounted *>(static_cast<const RefCounted *>(p_from.ptr()));
if (!refb) {
unref();
return;
@@ -179,7 +179,7 @@ public:
template <class T_Other>
Ref(const Ref<T_Other> &p_from) {
- Reference *refb = const_cast<Reference *>(static_cast<const Reference *>(p_from.ptr()));
+ RefCounted *refb = const_cast<RefCounted *>(static_cast<const RefCounted *>(p_from.ptr()));
if (!refb) {
unref();
return;
@@ -234,10 +234,10 @@ public:
}
};
-typedef Ref<Reference> REF;
+typedef Ref<RefCounted> REF;
-class WeakRef : public Reference {
- GDCLASS(WeakRef, Reference);
+class WeakRef : public RefCounted {
+ GDCLASS(WeakRef, RefCounted);
ObjectID ref;
@@ -259,7 +259,7 @@ struct PtrToArg<Ref<T>> {
}
_FORCE_INLINE_ static void encode(Ref<T> p_val, const void *p_ptr) {
- *(Ref<Reference> *)p_ptr = p_val;
+ *(Ref<RefCounted> *)p_ptr = p_val;
}
};
@@ -294,4 +294,4 @@ struct GetTypeInfo<const Ref<T> &> {
#endif // DEBUG_METHODS_ENABLED
-#endif // REFERENCE_H
+#endif // REF_COUNTED_H
diff --git a/core/object/undo_redo.cpp b/core/object/undo_redo.cpp
index e8735e335c..96c96c1efb 100644
--- a/core/object/undo_redo.cpp
+++ b/core/object/undo_redo.cpp
@@ -122,8 +122,8 @@ void UndoRedo::add_do_method(Object *p_object, const StringName &p_method, VARIA
ERR_FAIL_COND((current_action + 1) >= actions.size());
Operation do_op;
do_op.object = p_object->get_instance_id();
- if (Object::cast_to<Reference>(p_object)) {
- do_op.ref = Ref<Reference>(Object::cast_to<Reference>(p_object));
+ if (Object::cast_to<RefCounted>(p_object)) {
+ do_op.ref = Ref<RefCounted>(Object::cast_to<RefCounted>(p_object));
}
do_op.type = Operation::TYPE_METHOD;
@@ -148,8 +148,8 @@ void UndoRedo::add_undo_method(Object *p_object, const StringName &p_method, VAR
Operation undo_op;
undo_op.object = p_object->get_instance_id();
- if (Object::cast_to<Reference>(p_object)) {
- undo_op.ref = Ref<Reference>(Object::cast_to<Reference>(p_object));
+ if (Object::cast_to<RefCounted>(p_object)) {
+ undo_op.ref = Ref<RefCounted>(Object::cast_to<RefCounted>(p_object));
}
undo_op.type = Operation::TYPE_METHOD;
@@ -167,8 +167,8 @@ void UndoRedo::add_do_property(Object *p_object, const StringName &p_property, c
ERR_FAIL_COND((current_action + 1) >= actions.size());
Operation do_op;
do_op.object = p_object->get_instance_id();
- if (Object::cast_to<Reference>(p_object)) {
- do_op.ref = Ref<Reference>(Object::cast_to<Reference>(p_object));
+ if (Object::cast_to<RefCounted>(p_object)) {
+ do_op.ref = Ref<RefCounted>(Object::cast_to<RefCounted>(p_object));
}
do_op.type = Operation::TYPE_PROPERTY;
@@ -189,8 +189,8 @@ void UndoRedo::add_undo_property(Object *p_object, const StringName &p_property,
Operation undo_op;
undo_op.object = p_object->get_instance_id();
- if (Object::cast_to<Reference>(p_object)) {
- undo_op.ref = Ref<Reference>(Object::cast_to<Reference>(p_object));
+ if (Object::cast_to<RefCounted>(p_object)) {
+ undo_op.ref = Ref<RefCounted>(Object::cast_to<RefCounted>(p_object));
}
undo_op.type = Operation::TYPE_PROPERTY;
@@ -205,8 +205,8 @@ void UndoRedo::add_do_reference(Object *p_object) {
ERR_FAIL_COND((current_action + 1) >= actions.size());
Operation do_op;
do_op.object = p_object->get_instance_id();
- if (Object::cast_to<Reference>(p_object)) {
- do_op.ref = Ref<Reference>(Object::cast_to<Reference>(p_object));
+ if (Object::cast_to<RefCounted>(p_object)) {
+ do_op.ref = Ref<RefCounted>(Object::cast_to<RefCounted>(p_object));
}
do_op.type = Operation::TYPE_REFERENCE;
@@ -225,8 +225,8 @@ void UndoRedo::add_undo_reference(Object *p_object) {
Operation undo_op;
undo_op.object = p_object->get_instance_id();
- if (Object::cast_to<Reference>(p_object)) {
- undo_op.ref = Ref<Reference>(Object::cast_to<Reference>(p_object));
+ if (Object::cast_to<RefCounted>(p_object)) {
+ undo_op.ref = Ref<RefCounted>(Object::cast_to<RefCounted>(p_object));
}
undo_op.type = Operation::TYPE_REFERENCE;
diff --git a/core/object/undo_redo.h b/core/object/undo_redo.h
index a08ca7792f..8f009830e3 100644
--- a/core/object/undo_redo.h
+++ b/core/object/undo_redo.h
@@ -32,7 +32,7 @@
#define UNDO_REDO_H
#include "core/object/class_db.h"
-#include "core/object/reference.h"
+#include "core/object/ref_counted.h"
class UndoRedo : public Object {
GDCLASS(UndoRedo, Object);
@@ -61,7 +61,7 @@ private:
};
Type type;
- Ref<Reference> ref;
+ Ref<RefCounted> ref;
ObjectID object;
StringName name;
Variant args[VARIANT_ARG_MAX];
diff --git a/core/os/main_loop.h b/core/os/main_loop.h
index 25a09fe98f..34e944709b 100644
--- a/core/os/main_loop.h
+++ b/core/os/main_loop.h
@@ -32,7 +32,7 @@
#define MAIN_LOOP_H
#include "core/input/input_event.h"
-#include "core/object/reference.h"
+#include "core/object/ref_counted.h"
#include "core/object/script_language.h"
class MainLoop : public Object {
diff --git a/core/os/os.cpp b/core/os/os.cpp
index c5463cf216..535eee4797 100644
--- a/core/os/os.cpp
+++ b/core/os/os.cpp
@@ -32,8 +32,8 @@
#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/io/dir_access.h"
+#include "core/io/file_access.h"
#include "core/os/midi_driver.h"
#include "core/version_generated.gen.h"
#include "servers/audio_server.h"
@@ -47,37 +47,8 @@ OS *OS::get_singleton() {
return singleton;
}
-uint32_t OS::get_ticks_msec() const {
- return get_ticks_usec() / 1000;
-}
-
-String OS::get_iso_date_time(bool local) const {
- OS::Date date = get_date(local);
- OS::Time time = get_time(local);
-
- String timezone;
- if (!local) {
- TimeZoneInfo zone = get_time_zone_info();
- if (zone.bias >= 0) {
- timezone = "+";
- }
- timezone = timezone + itos(zone.bias / 60).pad_zeros(2) + itos(zone.bias % 60).pad_zeros(2);
- } else {
- timezone = "Z";
- }
-
- return itos(date.year).pad_zeros(2) +
- "-" +
- itos(date.month).pad_zeros(2) +
- "-" +
- itos(date.day).pad_zeros(2) +
- "T" +
- itos(time.hour).pad_zeros(2) +
- ":" +
- itos(time.min).pad_zeros(2) +
- ":" +
- itos(time.sec).pad_zeros(2) +
- timezone;
+uint64_t OS::get_ticks_msec() const {
+ return get_ticks_usec() / 1000ULL;
}
double OS::get_unix_time() const {
diff --git a/core/os/os.h b/core/os/os.h
index 5bf9dc9288..444f67431f 100644
--- a/core/os/os.h
+++ b/core/os/os.h
@@ -158,17 +158,17 @@ public:
virtual void yield();
- enum Weekday {
- DAY_SUNDAY,
- DAY_MONDAY,
- DAY_TUESDAY,
- DAY_WEDNESDAY,
- DAY_THURSDAY,
- DAY_FRIDAY,
- DAY_SATURDAY
+ enum Weekday : uint8_t {
+ WEEKDAY_SUNDAY,
+ WEEKDAY_MONDAY,
+ WEEKDAY_TUESDAY,
+ WEEKDAY_WEDNESDAY,
+ WEEKDAY_THURSDAY,
+ WEEKDAY_FRIDAY,
+ WEEKDAY_SATURDAY,
};
- enum Month {
+ enum Month : uint8_t {
/// Start at 1 to follow Windows SYSTEMTIME structure
/// https://msdn.microsoft.com/en-us/library/windows/desktop/ms724950(v=vs.85).aspx
MONTH_JANUARY = 1,
@@ -182,21 +182,21 @@ public:
MONTH_SEPTEMBER,
MONTH_OCTOBER,
MONTH_NOVEMBER,
- MONTH_DECEMBER
+ MONTH_DECEMBER,
};
struct Date {
- int year;
+ int64_t year;
Month month;
- int day;
+ uint8_t day;
Weekday weekday;
bool dst;
};
struct Time {
- int hour;
- int min;
- int sec;
+ uint8_t hour;
+ uint8_t minute;
+ uint8_t second;
};
struct TimeZoneInfo {
@@ -207,14 +207,13 @@ public:
virtual Date get_date(bool local = false) const = 0;
virtual Time get_time(bool local = false) const = 0;
virtual TimeZoneInfo get_time_zone_info() const = 0;
- virtual String get_iso_date_time(bool local = false) const;
virtual double get_unix_time() const;
virtual void delay_usec(uint32_t p_usec) const = 0;
virtual void add_frame_delay(bool p_can_draw);
virtual uint64_t get_ticks_usec() const = 0;
- uint32_t get_ticks_msec() const;
+ uint64_t get_ticks_msec() const;
virtual bool is_userfs_persistent() const { return true; }
diff --git a/core/os/time.cpp b/core/os/time.cpp
new file mode 100644
index 0000000000..a185029969
--- /dev/null
+++ b/core/os/time.cpp
@@ -0,0 +1,433 @@
+/*************************************************************************/
+/* time.cpp */
+/*************************************************************************/
+/* This file is part of: */
+/* GODOT ENGINE */
+/* https://godotengine.org */
+/*************************************************************************/
+/* Copyright (c) 2007-2021 Juan Linietsky, Ariel Manzur. */
+/* Copyright (c) 2014-2021 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 "time.h"
+
+#include "core/os/os.h"
+
+#define UNIX_EPOCH_YEAR_AD 1970 // 1970
+#define SECONDS_PER_DAY (24 * 60 * 60) // 86400
+#define IS_LEAP_YEAR(year) (!((year) % 4) && (((year) % 100) || !((year) % 400)))
+#define YEAR_SIZE(year) (IS_LEAP_YEAR(year) ? 366 : 365)
+
+#define YEAR_KEY "year"
+#define MONTH_KEY "month"
+#define DAY_KEY "day"
+#define WEEKDAY_KEY "weekday"
+#define HOUR_KEY "hour"
+#define MINUTE_KEY "minute"
+#define SECOND_KEY "second"
+#define DST_KEY "dst"
+
+// Table of number of days in each month (for regular year and leap year).
+static const uint8_t MONTH_DAYS_TABLE[2][12] = {
+ { 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31 },
+ { 31, 29, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31 }
+};
+
+VARIANT_ENUM_CAST(Time::Month);
+VARIANT_ENUM_CAST(Time::Weekday);
+
+#define UNIX_TIME_TO_HMS \
+ uint8_t hour, minute, second; \
+ { \
+ /* The time of the day (in seconds since start of day). */ \
+ uint32_t day_clock = Math::posmod(p_unix_time_val, SECONDS_PER_DAY); \
+ /* On x86 these 4 lines can be optimized to only 2 divisions. */ \
+ second = day_clock % 60; \
+ day_clock /= 60; \
+ minute = day_clock % 60; \
+ hour = day_clock / 60; \
+ }
+
+#define UNIX_TIME_TO_YMD \
+ int64_t year; \
+ Month month; \
+ uint8_t day; \
+ /* The day number since Unix epoch (0-index). Days before 1970 are negative. */ \
+ int64_t day_number = Math::floor(p_unix_time_val / (double)SECONDS_PER_DAY); \
+ { \
+ int64_t day_number_copy = day_number; \
+ year = UNIX_EPOCH_YEAR_AD; \
+ uint8_t month_zero_index = 0; \
+ while (day_number_copy >= YEAR_SIZE(year)) { \
+ day_number_copy -= YEAR_SIZE(year); \
+ year++; \
+ } \
+ while (day_number_copy < 0) { \
+ year--; \
+ day_number_copy += YEAR_SIZE(year); \
+ } \
+ /* After the above, day_number now represents the day of the year (0-index). */ \
+ while (day_number_copy >= MONTH_DAYS_TABLE[IS_LEAP_YEAR(year)][month_zero_index]) { \
+ day_number_copy -= MONTH_DAYS_TABLE[IS_LEAP_YEAR(year)][month_zero_index]; \
+ month_zero_index++; \
+ } \
+ /* After the above, day_number now represents the day of the month (0-index). */ \
+ month = (Month)(month_zero_index + 1); \
+ day = day_number_copy + 1; \
+ }
+
+#define VALIDATE_YMDHMS \
+ ERR_FAIL_COND_V_MSG(month == 0, 0, "Invalid month value of: " + itos(month) + ", months are 1-indexed and cannot be 0. See the Time.Month enum for valid values."); \
+ ERR_FAIL_COND_V_MSG(month > 12, 0, "Invalid month value of: " + itos(month) + ". See the Time.Month enum for valid values."); \
+ ERR_FAIL_COND_V_MSG(hour > 23, 0, "Invalid hour value of: " + itos(hour) + "."); \
+ ERR_FAIL_COND_V_MSG(minute > 59, 0, "Invalid minute value of: " + itos(minute) + "."); \
+ ERR_FAIL_COND_V_MSG(second > 59, 0, "Invalid second value of: " + itos(second) + " (leap seconds are not supported)."); \
+ /* Do this check after month is tested as valid. */ \
+ ERR_FAIL_COND_V_MSG(day == 0, 0, "Invalid day value of: " + itos(month) + ", days are 1-indexed and cannot be 0."); \
+ uint8_t days_in_this_month = MONTH_DAYS_TABLE[IS_LEAP_YEAR(year)][month - 1]; \
+ ERR_FAIL_COND_V_MSG(day > days_in_this_month, 0, "Invalid day value of: " + itos(day) + " which is larger than the maximum for this month, " + itos(days_in_this_month) + ".");
+
+#define YMD_TO_DAY_NUMBER \
+ /* The day number since Unix epoch (0-index). Days before 1970 are negative. */ \
+ int64_t day_number = day - 1; \
+ /* Add the days in the months to day_number. */ \
+ for (int i = 0; i < month - 1; i++) { \
+ day_number += MONTH_DAYS_TABLE[IS_LEAP_YEAR(year)][i]; \
+ } \
+ /* Add the days in the years to day_number. */ \
+ if (year >= UNIX_EPOCH_YEAR_AD) { \
+ for (int64_t iyear = UNIX_EPOCH_YEAR_AD; iyear < year; iyear++) { \
+ day_number += YEAR_SIZE(iyear); \
+ } \
+ } else { \
+ for (int64_t iyear = UNIX_EPOCH_YEAR_AD - 1; iyear >= year; iyear--) { \
+ day_number -= YEAR_SIZE(iyear); \
+ } \
+ }
+
+#define PARSE_ISO8601_STRING \
+ int64_t year = UNIX_EPOCH_YEAR_AD; \
+ Month month = MONTH_JANUARY; \
+ uint8_t day = 1; \
+ uint8_t hour = 0; \
+ uint8_t minute = 0; \
+ uint8_t second = 0; \
+ { \
+ bool has_date = false, has_time = false; \
+ String date, time; \
+ if (p_datetime.find_char('T') > 0) { \
+ has_date = has_time = true; \
+ PackedStringArray array = p_datetime.split("T"); \
+ date = array[0]; \
+ time = array[1]; \
+ } else if (p_datetime.find_char(' ') > 0) { \
+ has_date = has_time = true; \
+ PackedStringArray array = p_datetime.split(" "); \
+ date = array[0]; \
+ time = array[1]; \
+ } else if (p_datetime.find_char('-', 1) > 0) { \
+ has_date = true; \
+ date = p_datetime; \
+ } else if (p_datetime.find_char(':') > 0) { \
+ has_time = true; \
+ time = p_datetime; \
+ } \
+ /* Set the variables from the contents of the string. */ \
+ if (has_date) { \
+ PackedInt32Array array = date.split_ints("-", false); \
+ year = array[0]; \
+ month = (Month)array[1]; \
+ day = array[2]; \
+ /* Handle negative years. */ \
+ if (p_datetime.find_char('-') == 0) { \
+ year *= -1; \
+ } \
+ } \
+ if (has_time) { \
+ PackedInt32Array array = time.split_ints(":", false); \
+ hour = array[0]; \
+ minute = array[1]; \
+ second = array[2]; \
+ } \
+ }
+
+#define EXTRACT_FROM_DICTIONARY \
+ /* Get all time values from the dictionary. If it doesn't exist, set the */ \
+ /* values to the default values for Unix epoch (1970-01-01 00:00:00). */ \
+ int64_t year = p_datetime.has(YEAR_KEY) ? int64_t(p_datetime[YEAR_KEY]) : UNIX_EPOCH_YEAR_AD; \
+ Month month = Month((p_datetime.has(MONTH_KEY)) ? uint8_t(p_datetime[MONTH_KEY]) : 1); \
+ uint8_t day = p_datetime.has(DAY_KEY) ? uint8_t(p_datetime[DAY_KEY]) : 1; \
+ uint8_t hour = p_datetime.has(HOUR_KEY) ? uint8_t(p_datetime[HOUR_KEY]) : 0; \
+ uint8_t minute = p_datetime.has(MINUTE_KEY) ? uint8_t(p_datetime[MINUTE_KEY]) : 0; \
+ uint8_t second = p_datetime.has(SECOND_KEY) ? uint8_t(p_datetime[SECOND_KEY]) : 0;
+
+Time *Time::singleton = nullptr;
+
+Time *Time::get_singleton() {
+ if (!singleton) {
+ memnew(Time);
+ }
+ return singleton;
+}
+
+Dictionary Time::get_datetime_dict_from_unix_time(int64_t p_unix_time_val) const {
+ UNIX_TIME_TO_HMS
+ UNIX_TIME_TO_YMD
+ Dictionary datetime;
+ datetime[YEAR_KEY] = year;
+ datetime[MONTH_KEY] = (uint8_t)month;
+ datetime[DAY_KEY] = day;
+ // Unix epoch was a Thursday (day 0 aka 1970-01-01).
+ datetime[WEEKDAY_KEY] = Math::posmod(day_number + WEEKDAY_THURSDAY, 7);
+ datetime[HOUR_KEY] = hour;
+ datetime[MINUTE_KEY] = minute;
+ datetime[SECOND_KEY] = second;
+
+ return datetime;
+}
+
+Dictionary Time::get_date_dict_from_unix_time(int64_t p_unix_time_val) const {
+ UNIX_TIME_TO_YMD
+ Dictionary datetime;
+ datetime[YEAR_KEY] = year;
+ datetime[MONTH_KEY] = (uint8_t)month;
+ datetime[DAY_KEY] = day;
+ // Unix epoch was a Thursday (day 0 aka 1970-01-01).
+ datetime[WEEKDAY_KEY] = Math::posmod(day_number + WEEKDAY_THURSDAY, 7);
+
+ return datetime;
+}
+
+Dictionary Time::get_time_dict_from_unix_time(int64_t p_unix_time_val) const {
+ UNIX_TIME_TO_HMS
+ Dictionary datetime;
+ datetime[HOUR_KEY] = hour;
+ datetime[MINUTE_KEY] = minute;
+ datetime[SECOND_KEY] = second;
+
+ return datetime;
+}
+
+String Time::get_datetime_string_from_unix_time(int64_t p_unix_time_val, bool p_use_space) const {
+ UNIX_TIME_TO_HMS
+ UNIX_TIME_TO_YMD
+ // vformat only supports up to 6 arguments, so we need to split this up into 2 parts.
+ String timestamp = vformat("%04d-%02d-%02d", year, (uint8_t)month, day);
+ if (p_use_space) {
+ timestamp = vformat("%s %02d:%02d:%02d", timestamp, hour, minute, second);
+ } else {
+ timestamp = vformat("%sT%02d:%02d:%02d", timestamp, hour, minute, second);
+ }
+
+ return timestamp;
+}
+
+String Time::get_date_string_from_unix_time(int64_t p_unix_time_val) const {
+ UNIX_TIME_TO_YMD
+ // Android is picky about the types passed to make Variant, so we need a cast.
+ return vformat("%04d-%02d-%02d", year, (uint8_t)month, day);
+}
+
+String Time::get_time_string_from_unix_time(int64_t p_unix_time_val) const {
+ UNIX_TIME_TO_HMS
+ return vformat("%02d:%02d:%02d", hour, minute, second);
+}
+
+Dictionary Time::get_datetime_dict_from_string(String p_datetime, bool p_weekday) const {
+ PARSE_ISO8601_STRING
+ Dictionary dict;
+ dict[YEAR_KEY] = year;
+ dict[MONTH_KEY] = (uint8_t)month;
+ dict[DAY_KEY] = day;
+ if (p_weekday) {
+ YMD_TO_DAY_NUMBER
+ // Unix epoch was a Thursday (day 0 aka 1970-01-01).
+ dict[WEEKDAY_KEY] = Math::posmod(day_number + WEEKDAY_THURSDAY, 7);
+ }
+ dict[HOUR_KEY] = hour;
+ dict[MINUTE_KEY] = minute;
+ dict[SECOND_KEY] = second;
+
+ return dict;
+}
+
+String Time::get_datetime_string_from_dict(Dictionary p_datetime, bool p_use_space) const {
+ ERR_FAIL_COND_V_MSG(p_datetime.is_empty(), "", "Invalid datetime Dictionary: Dictionary is empty.");
+ EXTRACT_FROM_DICTIONARY
+ // vformat only supports up to 6 arguments, so we need to split this up into 2 parts.
+ String timestamp = vformat("%04d-%02d-%02d", year, (uint8_t)month, day);
+ if (p_use_space) {
+ timestamp = vformat("%s %02d:%02d:%02d", timestamp, hour, minute, second);
+ } else {
+ timestamp = vformat("%sT%02d:%02d:%02d", timestamp, hour, minute, second);
+ }
+ return timestamp;
+}
+
+int64_t Time::get_unix_time_from_datetime_dict(Dictionary p_datetime) const {
+ ERR_FAIL_COND_V_MSG(p_datetime.is_empty(), 0, "Invalid datetime Dictionary: Dictionary is empty");
+ EXTRACT_FROM_DICTIONARY
+ VALIDATE_YMDHMS
+ YMD_TO_DAY_NUMBER
+ return day_number * SECONDS_PER_DAY + hour * 3600 + minute * 60 + second;
+}
+
+int64_t Time::get_unix_time_from_datetime_string(String p_datetime) const {
+ PARSE_ISO8601_STRING
+ VALIDATE_YMDHMS
+ YMD_TO_DAY_NUMBER
+ return day_number * SECONDS_PER_DAY + hour * 3600 + minute * 60 + second;
+}
+
+Dictionary Time::get_datetime_dict_from_system(bool p_utc) const {
+ OS::Date date = OS::get_singleton()->get_date(p_utc);
+ OS::Time time = OS::get_singleton()->get_time(p_utc);
+ Dictionary datetime;
+ datetime[YEAR_KEY] = date.year;
+ datetime[MONTH_KEY] = (uint8_t)date.month;
+ datetime[DAY_KEY] = date.day;
+ datetime[WEEKDAY_KEY] = (uint8_t)date.weekday;
+ datetime[DST_KEY] = date.dst;
+ datetime[HOUR_KEY] = time.hour;
+ datetime[MINUTE_KEY] = time.minute;
+ datetime[SECOND_KEY] = time.second;
+ return datetime;
+}
+
+Dictionary Time::get_date_dict_from_system(bool p_utc) const {
+ OS::Date date = OS::get_singleton()->get_date(p_utc);
+ Dictionary date_dictionary;
+ date_dictionary[YEAR_KEY] = date.year;
+ date_dictionary[MONTH_KEY] = (uint8_t)date.month;
+ date_dictionary[DAY_KEY] = date.day;
+ date_dictionary[WEEKDAY_KEY] = (uint8_t)date.weekday;
+ date_dictionary[DST_KEY] = date.dst;
+ return date_dictionary;
+}
+
+Dictionary Time::get_time_dict_from_system(bool p_utc) const {
+ OS::Time time = OS::get_singleton()->get_time(p_utc);
+ Dictionary time_dictionary;
+ time_dictionary[HOUR_KEY] = time.hour;
+ time_dictionary[MINUTE_KEY] = time.minute;
+ time_dictionary[SECOND_KEY] = time.second;
+ return time_dictionary;
+}
+
+String Time::get_datetime_string_from_system(bool p_utc, bool p_use_space) const {
+ OS::Date date = OS::get_singleton()->get_date(p_utc);
+ OS::Time time = OS::get_singleton()->get_time(p_utc);
+ // vformat only supports up to 6 arguments, so we need to split this up into 2 parts.
+ String timestamp = vformat("%04d-%02d-%02d", date.year, (uint8_t)date.month, date.day);
+ if (p_use_space) {
+ timestamp = vformat("%s %02d:%02d:%02d", timestamp, time.hour, time.minute, time.second);
+ } else {
+ timestamp = vformat("%sT%02d:%02d:%02d", timestamp, time.hour, time.minute, time.second);
+ }
+
+ return timestamp;
+}
+
+String Time::get_date_string_from_system(bool p_utc) const {
+ OS::Date date = OS::get_singleton()->get_date(p_utc);
+ // Android is picky about the types passed to make Variant, so we need a cast.
+ return vformat("%04d-%02d-%02d", date.year, (uint8_t)date.month, date.day);
+}
+
+String Time::get_time_string_from_system(bool p_utc) const {
+ OS::Time time = OS::get_singleton()->get_time(p_utc);
+ return vformat("%02d:%02d:%02d", time.hour, time.minute, time.second);
+}
+
+Dictionary Time::get_time_zone_from_system() const {
+ OS::TimeZoneInfo info = OS::get_singleton()->get_time_zone_info();
+ Dictionary timezone;
+ timezone["bias"] = info.bias;
+ timezone["name"] = info.name;
+ return timezone;
+}
+
+double Time::get_unix_time_from_system() const {
+ return OS::get_singleton()->get_unix_time();
+}
+
+uint64_t Time::get_ticks_msec() const {
+ return OS::get_singleton()->get_ticks_msec();
+}
+
+uint64_t Time::get_ticks_usec() const {
+ return OS::get_singleton()->get_ticks_usec();
+}
+
+void Time::_bind_methods() {
+ ClassDB::bind_method(D_METHOD("get_datetime_dict_from_unix_time", "unix_time_val"), &Time::get_datetime_dict_from_unix_time);
+ ClassDB::bind_method(D_METHOD("get_date_dict_from_unix_time", "unix_time_val"), &Time::get_date_dict_from_unix_time);
+ ClassDB::bind_method(D_METHOD("get_time_dict_from_unix_time", "unix_time_val"), &Time::get_time_dict_from_unix_time);
+ ClassDB::bind_method(D_METHOD("get_datetime_string_from_unix_time", "unix_time_val", "use_space"), &Time::get_datetime_string_from_unix_time, DEFVAL(false));
+ ClassDB::bind_method(D_METHOD("get_date_string_from_unix_time", "unix_time_val"), &Time::get_date_string_from_unix_time);
+ ClassDB::bind_method(D_METHOD("get_time_string_from_unix_time", "unix_time_val"), &Time::get_time_string_from_unix_time);
+ ClassDB::bind_method(D_METHOD("get_datetime_dict_from_string", "datetime", "weekday"), &Time::get_datetime_dict_from_string);
+ ClassDB::bind_method(D_METHOD("get_datetime_string_from_dict", "datetime", "use_space"), &Time::get_datetime_string_from_dict);
+ ClassDB::bind_method(D_METHOD("get_unix_time_from_datetime_dict", "datetime"), &Time::get_unix_time_from_datetime_dict);
+ ClassDB::bind_method(D_METHOD("get_unix_time_from_datetime_string", "datetime"), &Time::get_unix_time_from_datetime_string);
+
+ ClassDB::bind_method(D_METHOD("get_datetime_dict_from_system", "utc"), &Time::get_datetime_dict_from_system, DEFVAL(false));
+ ClassDB::bind_method(D_METHOD("get_date_dict_from_system", "utc"), &Time::get_date_dict_from_system, DEFVAL(false));
+ ClassDB::bind_method(D_METHOD("get_time_dict_from_system", "utc"), &Time::get_time_dict_from_system, DEFVAL(false));
+ ClassDB::bind_method(D_METHOD("get_datetime_string_from_system", "utc", "use_space"), &Time::get_datetime_string_from_system, DEFVAL(false), DEFVAL(false));
+ ClassDB::bind_method(D_METHOD("get_date_string_from_system", "utc"), &Time::get_date_string_from_system, DEFVAL(false));
+ ClassDB::bind_method(D_METHOD("get_time_string_from_system", "utc"), &Time::get_time_string_from_system, DEFVAL(false));
+ ClassDB::bind_method(D_METHOD("get_time_zone_from_system"), &Time::get_time_zone_from_system);
+ ClassDB::bind_method(D_METHOD("get_unix_time_from_system"), &Time::get_unix_time_from_system);
+ ClassDB::bind_method(D_METHOD("get_ticks_msec"), &Time::get_ticks_msec);
+ ClassDB::bind_method(D_METHOD("get_ticks_usec"), &Time::get_ticks_usec);
+
+ BIND_ENUM_CONSTANT(MONTH_JANUARY);
+ BIND_ENUM_CONSTANT(MONTH_FEBRUARY);
+ BIND_ENUM_CONSTANT(MONTH_MARCH);
+ BIND_ENUM_CONSTANT(MONTH_APRIL);
+ BIND_ENUM_CONSTANT(MONTH_MAY);
+ BIND_ENUM_CONSTANT(MONTH_JUNE);
+ BIND_ENUM_CONSTANT(MONTH_JULY);
+ BIND_ENUM_CONSTANT(MONTH_AUGUST);
+ BIND_ENUM_CONSTANT(MONTH_SEPTEMBER);
+ BIND_ENUM_CONSTANT(MONTH_OCTOBER);
+ BIND_ENUM_CONSTANT(MONTH_NOVEMBER);
+ BIND_ENUM_CONSTANT(MONTH_DECEMBER);
+
+ BIND_ENUM_CONSTANT(WEEKDAY_SUNDAY);
+ BIND_ENUM_CONSTANT(WEEKDAY_MONDAY);
+ BIND_ENUM_CONSTANT(WEEKDAY_TUESDAY);
+ BIND_ENUM_CONSTANT(WEEKDAY_WEDNESDAY);
+ BIND_ENUM_CONSTANT(WEEKDAY_THURSDAY);
+ BIND_ENUM_CONSTANT(WEEKDAY_FRIDAY);
+ BIND_ENUM_CONSTANT(WEEKDAY_SATURDAY);
+}
+
+Time::Time() {
+ ERR_FAIL_COND_MSG(singleton, "Singleton for Time already exists.");
+ singleton = this;
+}
+
+Time::~Time() {
+ singleton = nullptr;
+}
diff --git a/core/os/time.h b/core/os/time.h
new file mode 100644
index 0000000000..4325f93d56
--- /dev/null
+++ b/core/os/time.h
@@ -0,0 +1,109 @@
+/*************************************************************************/
+/* time.h */
+/*************************************************************************/
+/* This file is part of: */
+/* GODOT ENGINE */
+/* https://godotengine.org */
+/*************************************************************************/
+/* Copyright (c) 2007-2021 Juan Linietsky, Ariel Manzur. */
+/* Copyright (c) 2014-2021 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 TIME_H
+#define TIME_H
+
+#include "core/object/class_db.h"
+
+// This Time class conforms with as many of the ISO 8601 standards as possible.
+// * As per ISO 8601:2004 4.3.2.1, all dates follow the Proleptic Gregorian
+// calendar. As such, the day before 1582-10-15 is 1582-10-14, not 1582-10-04.
+// See: https://en.wikipedia.org/wiki/Proleptic_Gregorian_calendar
+// * As per ISO 8601:2004 3.4.2 and 4.1.2.4, the year before 1 AD (aka 1 BC)
+// is number "0", with the year before that (2 BC) being "-1", etc.
+// Conversion methods assume "the same timezone", and do not handle DST.
+// Leap seconds are not handled, they must be done manually if desired.
+// Suffixes such as "Z" are not handled, you need to strip them away manually.
+
+class Time : public Object {
+ GDCLASS(Time, Object);
+ static void _bind_methods();
+ static Time *singleton;
+
+public:
+ static Time *get_singleton();
+
+ enum Month : uint8_t {
+ /// Start at 1 to follow Windows SYSTEMTIME structure
+ /// https://msdn.microsoft.com/en-us/library/windows/desktop/ms724950(v=vs.85).aspx
+ MONTH_JANUARY = 1,
+ MONTH_FEBRUARY,
+ MONTH_MARCH,
+ MONTH_APRIL,
+ MONTH_MAY,
+ MONTH_JUNE,
+ MONTH_JULY,
+ MONTH_AUGUST,
+ MONTH_SEPTEMBER,
+ MONTH_OCTOBER,
+ MONTH_NOVEMBER,
+ MONTH_DECEMBER,
+ };
+
+ enum Weekday : uint8_t {
+ WEEKDAY_SUNDAY,
+ WEEKDAY_MONDAY,
+ WEEKDAY_TUESDAY,
+ WEEKDAY_WEDNESDAY,
+ WEEKDAY_THURSDAY,
+ WEEKDAY_FRIDAY,
+ WEEKDAY_SATURDAY,
+ };
+
+ // Methods that convert times.
+ Dictionary get_datetime_dict_from_unix_time(int64_t p_unix_time_val) const;
+ Dictionary get_date_dict_from_unix_time(int64_t p_unix_time_val) const;
+ Dictionary get_time_dict_from_unix_time(int64_t p_unix_time_val) const;
+ String get_datetime_string_from_unix_time(int64_t p_unix_time_val, bool p_use_space = false) const;
+ String get_date_string_from_unix_time(int64_t p_unix_time_val) const;
+ String get_time_string_from_unix_time(int64_t p_unix_time_val) const;
+ Dictionary get_datetime_dict_from_string(String p_datetime, bool p_weekday = true) const;
+ String get_datetime_string_from_dict(Dictionary p_datetime, bool p_use_space = false) const;
+ int64_t get_unix_time_from_datetime_dict(Dictionary p_datetime) const;
+ int64_t get_unix_time_from_datetime_string(String p_datetime) const;
+
+ // Methods that get information from OS.
+ Dictionary get_datetime_dict_from_system(bool p_utc = false) const;
+ Dictionary get_date_dict_from_system(bool p_utc = false) const;
+ Dictionary get_time_dict_from_system(bool p_utc = false) const;
+ String get_datetime_string_from_system(bool p_utc = false, bool p_use_space = false) const;
+ String get_date_string_from_system(bool p_utc = false) const;
+ String get_time_string_from_system(bool p_utc = false) const;
+ Dictionary get_time_zone_from_system() const;
+ double get_unix_time_from_system() const;
+ uint64_t get_ticks_msec() const;
+ uint64_t get_ticks_usec() const;
+
+ Time();
+ virtual ~Time();
+};
+
+#endif // TIME_H
diff --git a/core/register_core_types.cpp b/core/register_core_types.cpp
index f1b1b98bea..f67d615418 100644
--- a/core/register_core_types.cpp
+++ b/core/register_core_types.cpp
@@ -68,6 +68,7 @@
#include "core/object/class_db.h"
#include "core/object/undo_redo.h"
#include "core/os/main_loop.h"
+#include "core/os/time.h"
#include "core/string/optimized_translation.h"
#include "core/string/translation.h"
@@ -131,7 +132,7 @@ void register_core_types() {
ClassDB::register_virtual_class<Script>();
- ClassDB::register_class<Reference>();
+ ClassDB::register_class<RefCounted>();
ClassDB::register_class<WeakRef>();
ClassDB::register_class<Resource>();
ClassDB::register_class<Image>();
@@ -258,6 +259,7 @@ void register_core_singletons() {
ClassDB::register_class<_JSON>();
ClassDB::register_class<Expression>();
ClassDB::register_class<_EngineDebugger>();
+ ClassDB::register_class<Time>();
Engine::get_singleton()->add_singleton(Engine::Singleton("ProjectSettings", ProjectSettings::get_singleton()));
Engine::get_singleton()->add_singleton(Engine::Singleton("IP", IP::get_singleton()));
@@ -274,6 +276,7 @@ void register_core_singletons() {
Engine::get_singleton()->add_singleton(Engine::Singleton("InputMap", InputMap::get_singleton()));
Engine::get_singleton()->add_singleton(Engine::Singleton("JSON", _JSON::get_singleton()));
Engine::get_singleton()->add_singleton(Engine::Singleton("EngineDebugger", _EngineDebugger::get_singleton()));
+ Engine::get_singleton()->add_singleton(Engine::Singleton("Time", Time::get_singleton()));
}
void unregister_core_types() {
diff --git a/core/string/translation_po.cpp b/core/string/translation_po.cpp
index ad768f7140..d6b84cabc9 100644
--- a/core/string/translation_po.cpp
+++ b/core/string/translation_po.cpp
@@ -30,7 +30,7 @@
#include "translation_po.h"
-#include "core/os/file_access.h"
+#include "core/io/file_access.h"
#ifdef DEBUG_TRANSLATION_PO
void TranslationPO::print_translation_map() {
diff --git a/core/string/ustring.cpp b/core/string/ustring.cpp
index 49cf171f2b..83ede0b11b 100644
--- a/core/string/ustring.cpp
+++ b/core/string/ustring.cpp
@@ -54,7 +54,7 @@
#define snprintf _snprintf_s
#endif
-#define MAX_DIGITS 6
+#define MAX_DECIMALS 32
#define UPPERCASE(m_c) (((m_c) >= 'a' && (m_c) <= 'z') ? ((m_c) - ('a' - 'A')) : (m_c))
#define LOWERCASE(m_c) (((m_c) >= 'A' && (m_c) <= 'Z') ? ((m_c) + ('a' - 'A')) : (m_c))
#define IS_DIGIT(m_d) ((m_d) >= '0' && (m_d) <= '9')
@@ -1379,8 +1379,11 @@ String String::num(double p_num, int p_decimals) {
}
#ifndef NO_USE_STDLIB
- if (p_decimals > 16) {
- p_decimals = 16;
+ if (p_decimals < 0) {
+ p_decimals = 14 - (int)floor(log10(p_num));
+ }
+ if (p_decimals > MAX_DECIMALS) {
+ p_decimals = MAX_DECIMALS;
}
char fmt[7];
@@ -1391,7 +1394,6 @@ String String::num(double p_num, int p_decimals) {
fmt[1] = 'l';
fmt[2] = 'f';
fmt[3] = 0;
-
} else if (p_decimals < 10) {
fmt[2] = '0' + p_decimals;
fmt[3] = 'l';
@@ -1458,8 +1460,9 @@ String String::num(double p_num, int p_decimals) {
double dec = p_num - (double)((int)p_num);
int digit = 0;
- if (p_decimals > MAX_DIGITS)
- p_decimals = MAX_DIGITS;
+ if (p_decimals > MAX_DECIMALS) {
+ p_decimals = MAX_DECIMALS;
+ }
int dec_int = 0;
int dec_max = 0;
@@ -1471,16 +1474,18 @@ String String::num(double p_num, int p_decimals) {
digit++;
if (p_decimals == -1) {
- if (digit == MAX_DIGITS) //no point in going to infinite
+ if (digit == MAX_DECIMALS) { //no point in going to infinite
break;
+ }
if (dec - (double)((int)dec) < 1e-6) {
break;
}
}
- if (digit == p_decimals)
+ if (digit == p_decimals) {
break;
+ }
}
dec *= 10;
int last = (int)dec % 10;
@@ -1589,7 +1594,7 @@ String String::num_uint64(uint64_t p_num, int base, bool capitalize_hex) {
return s;
}
-String String::num_real(double p_num) {
+String String::num_real(double p_num, bool p_trailing) {
if (Math::is_nan(p_num)) {
return "nan";
}
@@ -1616,7 +1621,15 @@ String String::num_real(double p_num) {
double dec = p_num - (double)((int)p_num);
int digit = 0;
- int decimals = MAX_DIGITS;
+
+#if REAL_T_IS_DOUBLE
+ int decimals = 14 - (int)floor(log10(p_num));
+#else
+ int decimals = 6 - (int)floor(log10(p_num));
+#endif
+ if (decimals > MAX_DECIMALS) {
+ decimals = MAX_DECIMALS;
+ }
int dec_int = 0;
int dec_max = 0;
@@ -1656,8 +1669,10 @@ String String::num_real(double p_num) {
dec_int /= 10;
}
sd = '.' + decimal;
- } else {
+ } else if (p_trailing) {
sd = ".0";
+ } else {
+ sd = "";
}
if (intn == 0) {
@@ -3786,7 +3801,7 @@ String String::humanize_size(uint64_t p_size) {
return String::num(p_size / divisor).pad_decimals(digits) + " " + prefixes[prefix_idx];
}
-bool String::is_abs_path() const {
+bool String::is_absolute_path() const {
if (length() > 1) {
return (operator[](0) == '/' || operator[](0) == '\\' || find(":/") != -1 || find(":\\") != -1);
} else if ((length()) == 1) {
@@ -4396,7 +4411,7 @@ bool String::is_resource_file() const {
}
bool String::is_rel_path() const {
- return !is_abs_path();
+ return !is_absolute_path();
}
String String::get_base_dir() const {
diff --git a/core/string/ustring.h b/core/string/ustring.h
index a56845deff..82cd3e1667 100644
--- a/core/string/ustring.h
+++ b/core/string/ustring.h
@@ -309,7 +309,7 @@ public:
String unquote() const;
static String num(double p_num, int p_decimals = -1);
static String num_scientific(double p_num);
- static String num_real(double p_num);
+ static String num_real(double p_num, bool p_trailing = true);
static String num_int64(int64_t p_num, int base = 10, bool capitalize_hex = false);
static String num_uint64(uint64_t p_num, int base = 10, bool capitalize_hex = false);
static String chr(char32_t p_char);
@@ -397,7 +397,7 @@ public:
_FORCE_INLINE_ bool is_empty() const { return length() == 0; }
// path functions
- bool is_abs_path() const;
+ bool is_absolute_path() const;
bool is_rel_path() const;
bool is_resource_file() const;
String path_to(const String &p_path) const;
diff --git a/core/templates/bin_sorted_array.h b/core/templates/bin_sorted_array.h
new file mode 100644
index 0000000000..be9d0b5475
--- /dev/null
+++ b/core/templates/bin_sorted_array.h
@@ -0,0 +1,181 @@
+/*************************************************************************/
+/* bin_sorted_array.h */
+/*************************************************************************/
+/* This file is part of: */
+/* GODOT ENGINE */
+/* https://godotengine.org */
+/*************************************************************************/
+/* Copyright (c) 2007-2021 Juan Linietsky, Ariel Manzur. */
+/* Copyright (c) 2014-2021 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 BIN_SORTED_ARRAY_H
+#define BIN_SORTED_ARRAY_H
+
+#include "core/templates/local_vector.h"
+#include "core/templates/paged_array.h"
+
+template <class T>
+class BinSortedArray {
+ PagedArray<T> array;
+ LocalVector<uint64_t> bin_limits;
+
+ // Implement if elements need to keep track of their own index in the array.
+ _FORCE_INLINE_ virtual void _update_idx(T &r_element, uint64_t p_idx) {}
+
+ _FORCE_INLINE_ void _swap(uint64_t p_a, uint64_t p_b) {
+ SWAP(array[p_a], array[p_b]);
+ _update_idx(array[p_a], p_a);
+ _update_idx(array[p_b], p_b);
+ }
+
+public:
+ uint64_t insert(T &p_element, uint64_t p_bin) {
+ array.push_back(p_element);
+ uint64_t new_idx = array.size() - 1;
+ _update_idx(p_element, new_idx);
+ bin_limits[0] = new_idx;
+ if (p_bin != 0) {
+ new_idx = move(new_idx, p_bin);
+ }
+ return new_idx;
+ }
+
+ uint64_t move(uint64_t p_idx, uint64_t p_bin) {
+ ERR_FAIL_COND_V(p_idx >= array.size(), -1);
+
+ uint64_t current_bin = bin_limits.size() - 1;
+ while (p_idx > bin_limits[current_bin]) {
+ current_bin--;
+ }
+
+ if (p_bin == current_bin) {
+ return p_idx;
+ }
+
+ uint64_t current_idx = p_idx;
+ if (p_bin > current_bin) {
+ while (p_bin > current_bin) {
+ uint64_t swap_idx = 0;
+
+ if (current_bin == bin_limits.size() - 1) {
+ bin_limits.push_back(0);
+ } else {
+ bin_limits[current_bin + 1]++;
+ swap_idx = bin_limits[current_bin + 1];
+ }
+
+ if (current_idx != swap_idx) {
+ _swap(current_idx, swap_idx);
+ current_idx = swap_idx;
+ }
+
+ current_bin++;
+ }
+ } else {
+ while (p_bin < current_bin) {
+ uint64_t swap_idx = bin_limits[current_bin];
+
+ if (current_idx != swap_idx) {
+ _swap(current_idx, swap_idx);
+ }
+
+ if (current_bin == bin_limits.size() - 1 && bin_limits[current_bin] == 0) {
+ bin_limits.resize(bin_limits.size() - 1);
+ } else {
+ bin_limits[current_bin]--;
+ }
+ current_idx = swap_idx;
+ current_bin--;
+ }
+ }
+
+ return current_idx;
+ }
+
+ void remove(uint64_t p_idx) {
+ ERR_FAIL_COND(p_idx >= array.size());
+ uint64_t new_idx = move(p_idx, 0);
+ uint64_t swap_idx = array.size() - 1;
+
+ if (new_idx != swap_idx) {
+ _swap(new_idx, swap_idx);
+ }
+
+ if (bin_limits[0] > 0) {
+ bin_limits[0]--;
+ }
+
+ array.pop_back();
+ }
+
+ void set_page_pool(PagedArrayPool<T> *p_page_pool) {
+ array.set_page_pool(p_page_pool);
+ }
+
+ _FORCE_INLINE_ const T &operator[](uint64_t p_index) const {
+ return array[p_index];
+ }
+
+ _FORCE_INLINE_ T &operator[](uint64_t p_index) {
+ return array[p_index];
+ }
+
+ int get_bin_count() {
+ if (array.size() == 0) {
+ return 0;
+ }
+ return bin_limits.size();
+ }
+
+ int get_bin_start(int p_bin) {
+ ERR_FAIL_COND_V(p_bin >= get_bin_count(), ~0U);
+ if ((unsigned int)p_bin == bin_limits.size() - 1) {
+ return 0;
+ }
+ return bin_limits[p_bin + 1] + 1;
+ }
+
+ int get_bin_size(int p_bin) {
+ ERR_FAIL_COND_V(p_bin >= get_bin_count(), 0);
+ if ((unsigned int)p_bin == bin_limits.size() - 1) {
+ return bin_limits[p_bin] + 1;
+ }
+ return bin_limits[p_bin] - bin_limits[p_bin + 1];
+ }
+
+ void reset() {
+ array.reset();
+ bin_limits.clear();
+ bin_limits.push_back(0);
+ }
+
+ BinSortedArray() {
+ bin_limits.push_back(0);
+ }
+
+ virtual ~BinSortedArray() {
+ reset();
+ }
+};
+
+#endif //BIN_SORTED_ARRAY_H
diff --git a/core/variant/callable.cpp b/core/variant/callable.cpp
index 5c87042f6b..34b3e3ea35 100644
--- a/core/variant/callable.cpp
+++ b/core/variant/callable.cpp
@@ -33,7 +33,7 @@
#include "callable_bind.h"
#include "core/object/message_queue.h"
#include "core/object/object.h"
-#include "core/object/reference.h"
+#include "core/object/ref_counted.h"
#include "core/object/script_language.h"
void Callable::call_deferred(const Variant **p_arguments, int p_argcount) const {
diff --git a/core/variant/variant.cpp b/core/variant/variant.cpp
index 2bde08742c..d10f41b833 100644
--- a/core/variant/variant.cpp
+++ b/core/variant/variant.cpp
@@ -1115,9 +1115,9 @@ void Variant::reference(const Variant &p_variant) {
case OBJECT: {
memnew_placement(_data._mem, ObjData);
- if (p_variant._get_obj().obj && p_variant._get_obj().id.is_reference()) {
- Reference *reference = static_cast<Reference *>(p_variant._get_obj().obj);
- if (!reference->reference()) {
+ if (p_variant._get_obj().obj && p_variant._get_obj().id.is_ref_counted()) {
+ RefCounted *ref_counted = static_cast<RefCounted *>(p_variant._get_obj().obj);
+ if (!ref_counted->reference()) {
_get_obj().obj = nullptr;
_get_obj().id = ObjectID();
break;
@@ -1301,11 +1301,11 @@ void Variant::_clear_internal() {
reinterpret_cast<NodePath *>(_data._mem)->~NodePath();
} break;
case OBJECT: {
- if (_get_obj().id.is_reference()) {
+ if (_get_obj().id.is_ref_counted()) {
//we are safe that there is a reference here
- Reference *reference = static_cast<Reference *>(_get_obj().obj);
- if (reference->unreference()) {
- memdelete(reference);
+ RefCounted *ref_counted = static_cast<RefCounted *>(_get_obj().obj);
+ if (ref_counted->unreference()) {
+ memdelete(ref_counted);
}
}
_get_obj().obj = nullptr;
@@ -1636,51 +1636,27 @@ String Variant::stringify(List<const void *> &stack) const {
case STRING:
return *reinterpret_cast<const String *>(_data._mem);
case VECTOR2:
- return "(" + operator Vector2() + ")";
+ return operator Vector2();
case VECTOR2I:
- return "(" + operator Vector2i() + ")";
+ return operator Vector2i();
case RECT2:
- return "(" + operator Rect2() + ")";
+ return operator Rect2();
case RECT2I:
- return "(" + operator Rect2i() + ")";
- case TRANSFORM2D: {
- Transform2D mat32 = operator Transform2D();
- return "(" + Variant(mat32.elements[0]).operator String() + ", " + Variant(mat32.elements[1]).operator String() + ", " + Variant(mat32.elements[2]).operator String() + ")";
- } break;
+ return operator Rect2i();
+ case TRANSFORM2D:
+ return operator Transform2D();
case VECTOR3:
- return "(" + operator Vector3() + ")";
+ return operator Vector3();
case VECTOR3I:
- return "(" + operator Vector3i() + ")";
+ return operator Vector3i();
case PLANE:
return operator Plane();
case AABB:
return operator ::AABB();
case QUATERNION:
- return "(" + operator Quaternion() + ")";
- case BASIS: {
- Basis mat3 = operator Basis();
-
- String mtx("(");
- for (int i = 0; i < 3; i++) {
- if (i != 0) {
- mtx += ", ";
- }
-
- mtx += "(";
-
- for (int j = 0; j < 3; j++) {
- if (j != 0) {
- mtx += ", ";
- }
-
- mtx += Variant(mat3.elements[i][j]).operator String();
- }
-
- mtx += ")";
- }
-
- return mtx + ")";
- } break;
+ return operator Quaternion();
+ case BASIS:
+ return operator Basis();
case TRANSFORM3D:
return operator Transform3D();
case STRING_NAME:
@@ -1688,7 +1664,7 @@ String Variant::stringify(List<const void *> &stack) const {
case NODE_PATH:
return operator NodePath();
case COLOR:
- return String::num(operator Color().r) + "," + String::num(operator Color().g) + "," + String::num(operator Color().b) + "," + String::num(operator Color().a);
+ return operator Color();
case DICTIONARY: {
const Dictionary &d = *reinterpret_cast<const Dictionary *>(_data._mem);
if (stack.find(d.id())) {
@@ -1830,7 +1806,7 @@ String Variant::stringify(List<const void *> &stack) const {
} break;
case OBJECT: {
if (_get_obj().obj) {
- if (!_get_obj().id.is_reference() && ObjectDB::get_instance(_get_obj().id) == nullptr) {
+ if (!_get_obj().id.is_ref_counted() && ObjectDB::get_instance(_get_obj().id) == nullptr) {
return "[Freed Object]";
}
@@ -2530,9 +2506,9 @@ Variant::Variant(const Object *p_object) {
memnew_placement(_data._mem, ObjData);
if (p_object) {
- if (p_object->is_reference()) {
- Reference *reference = const_cast<Reference *>(static_cast<const Reference *>(p_object));
- if (!reference->init_ref()) {
+ if (p_object->is_ref_counted()) {
+ RefCounted *ref_counted = const_cast<RefCounted *>(static_cast<const RefCounted *>(p_object));
+ if (!ref_counted->init_ref()) {
_get_obj().obj = nullptr;
_get_obj().id = ObjectID();
return;
@@ -2756,17 +2732,17 @@ void Variant::operator=(const Variant &p_variant) {
*reinterpret_cast<::RID *>(_data._mem) = *reinterpret_cast<const ::RID *>(p_variant._data._mem);
} break;
case OBJECT: {
- if (_get_obj().id.is_reference()) {
+ if (_get_obj().id.is_ref_counted()) {
//we are safe that there is a reference here
- Reference *reference = static_cast<Reference *>(_get_obj().obj);
- if (reference->unreference()) {
- memdelete(reference);
+ RefCounted *ref_counted = static_cast<RefCounted *>(_get_obj().obj);
+ if (ref_counted->unreference()) {
+ memdelete(ref_counted);
}
}
- if (p_variant._get_obj().obj && p_variant._get_obj().id.is_reference()) {
- Reference *reference = static_cast<Reference *>(p_variant._get_obj().obj);
- if (!reference->reference()) {
+ if (p_variant._get_obj().obj && p_variant._get_obj().id.is_ref_counted()) {
+ RefCounted *ref_counted = static_cast<RefCounted *>(p_variant._get_obj().obj);
+ if (!ref_counted->reference()) {
_get_obj().obj = nullptr;
_get_obj().id = ObjectID();
break;
@@ -3323,7 +3299,7 @@ bool Variant::hash_compare(const Variant &p_variant) const {
}
bool Variant::is_ref() const {
- return type == OBJECT && _get_obj().id.is_reference();
+ return type == OBJECT && _get_obj().id.is_ref_counted();
}
Vector<Variant> varray() {
diff --git a/core/variant/variant_call.cpp b/core/variant/variant_call.cpp
index a1314a11f3..05ed35c760 100644
--- a/core/variant/variant_call.cpp
+++ b/core/variant/variant_call.cpp
@@ -972,7 +972,7 @@ void Variant::call(const StringName &p_method, const Variant **p_args, int p_arg
return;
}
#ifdef DEBUG_ENABLED
- if (EngineDebugger::is_active() && !_get_obj().id.is_reference() && ObjectDB::get_instance(_get_obj().id) == nullptr) {
+ if (EngineDebugger::is_active() && !_get_obj().id.is_ref_counted() && ObjectDB::get_instance(_get_obj().id) == nullptr) {
r_error.error = Callable::CallError::CALL_ERROR_INSTANCE_IS_NULL;
return;
}
@@ -1365,7 +1365,7 @@ static void _register_variant_builtin_methods() {
// FIXME: Static function, not sure how to bind
//bind_method(String, humanize_size, sarray("size"), varray());
- bind_method(String, is_abs_path, sarray(), varray());
+ bind_method(String, is_absolute_path, sarray(), varray());
bind_method(String, is_rel_path, sarray(), varray());
bind_method(String, get_base_dir, sarray(), varray());
bind_method(String, get_file, sarray(), varray());
diff --git a/core/variant/variant_construct.cpp b/core/variant/variant_construct.cpp
index f66f33ef93..9e3ab5897b 100644
--- a/core/variant/variant_construct.cpp
+++ b/core/variant/variant_construct.cpp
@@ -836,9 +836,9 @@ String Variant::get_constructor_argument_name(Variant::Type p_type, int p_constr
void VariantInternal::object_assign(Variant *v, const Object *o) {
if (o) {
- if (o->is_reference()) {
- Reference *reference = const_cast<Reference *>(static_cast<const Reference *>(o));
- if (!reference->init_ref()) {
+ if (o->is_ref_counted()) {
+ RefCounted *ref_counted = const_cast<RefCounted *>(static_cast<const RefCounted *>(o));
+ if (!ref_counted->init_ref()) {
v->_get_obj().obj = nullptr;
v->_get_obj().id = ObjectID();
return;
diff --git a/core/variant/variant_internal.h b/core/variant/variant_internal.h
index 9e5811a082..78e1ad06ae 100644
--- a/core/variant/variant_internal.h
+++ b/core/variant/variant_internal.h
@@ -285,7 +285,7 @@ public:
v->clear();
}
- static void object_assign(Variant *v, const Object *o); // Needs Reference, so it's implemented elsewhere.
+ static void object_assign(Variant *v, const Object *o); // Needs RefCounted, so it's implemented elsewhere.
_FORCE_INLINE_ static void object_assign(Variant *v, const Variant *o) {
object_assign(v, o->_get_obj().obj);
diff --git a/core/variant/variant_parser.cpp b/core/variant/variant_parser.cpp
index 21c0d40fa5..751cb64c62 100644
--- a/core/variant/variant_parser.cpp
+++ b/core/variant/variant_parser.cpp
@@ -190,10 +190,13 @@ Error VariantParser::get_token(Stream *p_stream, Token &r_token, int &line, Stri
r_token.type = TK_COLOR;
return OK;
}
- case '@': {
+#ifndef DISABLE_DEPRECATED
+ case '@': // Compatibility with 3.x StringNames.
+#endif
+ case '&': { // StringName.
cchar = p_stream->get_char();
if (cchar != '"') {
- r_err_str = "Expected '\"' after '@'";
+ r_err_str = "Expected '\"' after '&'";
r_token.type = TK_ERROR;
return ERR_PARSE_ERROR;
}
@@ -742,7 +745,7 @@ Error VariantParser::parse_value(Token &token, Variant &value, Stream *p_stream,
return ERR_PARSE_ERROR;
}
- REF ref = REF(Object::cast_to<Reference>(obj));
+ REF ref = REF(Object::cast_to<RefCounted>(obj));
get_token(p_stream, token, line, r_err_str);
if (token.type != TK_COMMA) {
diff --git a/core/variant/variant_parser.h b/core/variant/variant_parser.h
index 5703f0200c..05fc29b5e0 100644
--- a/core/variant/variant_parser.h
+++ b/core/variant/variant_parser.h
@@ -31,8 +31,8 @@
#ifndef VARIANT_PARSER_H
#define VARIANT_PARSER_H
+#include "core/io/file_access.h"
#include "core/io/resource.h"
-#include "core/os/file_access.h"
#include "core/variant/variant.h"
class VariantParser {
diff --git a/core/variant/variant_setget.cpp b/core/variant/variant_setget.cpp
index 4f4a80e807..ae2795f2fd 100644
--- a/core/variant/variant_setget.cpp
+++ b/core/variant/variant_setget.cpp
@@ -1453,7 +1453,7 @@ bool Variant::iter_init(Variant &r_iter, bool &valid) const {
#ifdef DEBUG_ENABLED
- if (EngineDebugger::is_active() && !_get_obj().id.is_reference() && ObjectDB::get_instance(_get_obj().id) == nullptr) {
+ if (EngineDebugger::is_active() && !_get_obj().id.is_ref_counted() && ObjectDB::get_instance(_get_obj().id) == nullptr) {
valid = false;
return false;
}
@@ -1680,7 +1680,7 @@ bool Variant::iter_next(Variant &r_iter, bool &valid) const {
#ifdef DEBUG_ENABLED
- if (EngineDebugger::is_active() && !_get_obj().id.is_reference() && ObjectDB::get_instance(_get_obj().id) == nullptr) {
+ if (EngineDebugger::is_active() && !_get_obj().id.is_ref_counted() && ObjectDB::get_instance(_get_obj().id) == nullptr) {
valid = false;
return false;
}
@@ -1865,7 +1865,7 @@ Variant Variant::iter_get(const Variant &r_iter, bool &r_valid) const {
return Variant();
}
#ifdef DEBUG_ENABLED
- if (EngineDebugger::is_active() && !_get_obj().id.is_reference() && ObjectDB::get_instance(_get_obj().id) == nullptr) {
+ if (EngineDebugger::is_active() && !_get_obj().id.is_ref_counted() && ObjectDB::get_instance(_get_obj().id) == nullptr) {
r_valid = false;
return Variant();
}
diff --git a/core/variant/variant_utility.cpp b/core/variant/variant_utility.cpp
index 553f2b23a2..5d1efb4166 100644
--- a/core/variant/variant_utility.cpp
+++ b/core/variant/variant_utility.cpp
@@ -32,7 +32,7 @@
#include "core/core_string_names.h"
#include "core/io/marshalls.h"
-#include "core/object/reference.h"
+#include "core/object/ref_counted.h"
#include "core/os/os.h"
#include "core/templates/oa_hash_map.h"
#include "core/variant/binder_common.h"
diff --git a/doc/classes/@GlobalScope.xml b/doc/classes/@GlobalScope.xml
index ed0cf5bd5d..552fc41318 100644
--- a/doc/classes/@GlobalScope.xml
+++ b/doc/classes/@GlobalScope.xml
@@ -1261,6 +1261,9 @@
<member name="TextServerManager" type="TextServerManager" setter="" getter="">
The [TextServerManager] singleton.
</member>
+ <member name="Time" type="Time" setter="" getter="">
+ The [Time] singleton.
+ </member>
<member name="TranslationServer" type="TranslationServer" setter="" getter="">
The [TranslationServer] singleton.
</member>
diff --git a/doc/classes/AESContext.xml b/doc/classes/AESContext.xml
index f577bab992..9dde25028e 100644
--- a/doc/classes/AESContext.xml
+++ b/doc/classes/AESContext.xml
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8" ?>
-<class name="AESContext" inherits="Reference" version="4.0">
+<class name="AESContext" inherits="RefCounted" version="4.0">
<brief_description>
Interface to low level AES encryption features.
</brief_description>
diff --git a/doc/classes/AStar.xml b/doc/classes/AStar.xml
index fce2b90197..cc7f7072b9 100644
--- a/doc/classes/AStar.xml
+++ b/doc/classes/AStar.xml
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8" ?>
-<class name="AStar" inherits="Reference" version="4.0">
+<class name="AStar" inherits="RefCounted" version="4.0">
<brief_description>
An implementation of A* to find the shortest paths among connected points in space.
</brief_description>
diff --git a/doc/classes/AStar2D.xml b/doc/classes/AStar2D.xml
index 3efd2f604c..9edc300169 100644
--- a/doc/classes/AStar2D.xml
+++ b/doc/classes/AStar2D.xml
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8" ?>
-<class name="AStar2D" inherits="Reference" version="4.0">
+<class name="AStar2D" inherits="RefCounted" version="4.0">
<brief_description>
AStar class representation that uses 2D vectors as edges.
</brief_description>
diff --git a/doc/classes/AnimationNode.xml b/doc/classes/AnimationNode.xml
index 8204b456d9..fddd8989ab 100644
--- a/doc/classes/AnimationNode.xml
+++ b/doc/classes/AnimationNode.xml
@@ -11,6 +11,65 @@
<link title="AnimationTree">https://docs.godotengine.org/en/latest/tutorials/animation/animation_tree.html</link>
</tutorials>
<methods>
+ <method name="_get_caption" qualifiers="virtual">
+ <return type="String">
+ </return>
+ <description>
+ Gets the text caption for this node (used by some editors).
+ </description>
+ </method>
+ <method name="_get_child_by_name" qualifiers="virtual">
+ <return type="Object">
+ </return>
+ <argument index="0" name="name" type="String">
+ </argument>
+ <description>
+ Gets a child node by index (used by editors inheriting from [AnimationRootNode]).
+ </description>
+ </method>
+ <method name="_get_child_nodes" qualifiers="virtual">
+ <return type="Dictionary">
+ </return>
+ <description>
+ Gets all children nodes in order as a [code]name: node[/code] dictionary. Only useful when inheriting [AnimationRootNode].
+ </description>
+ </method>
+ <method name="_get_parameter_default_value" qualifiers="virtual">
+ <return type="Variant">
+ </return>
+ <argument index="0" name="name" type="StringName">
+ </argument>
+ <description>
+ Gets the default value of a parameter. Parameters are custom local memory used for your nodes, given a resource can be reused in multiple trees.
+ </description>
+ </method>
+ <method name="_get_parameter_list" qualifiers="virtual">
+ <return type="Array">
+ </return>
+ <description>
+ Gets the property information for parameter. Parameters are custom local memory used for your nodes, given a resource can be reused in multiple trees. Format is similar to [method Object.get_property_list].
+ </description>
+ </method>
+ <method name="_has_filter" qualifiers="virtual">
+ <return type="bool">
+ </return>
+ <description>
+ Returns [code]true[/code] whether you want the blend tree editor to display filter editing on this node.
+ </description>
+ </method>
+ <method name="_process" qualifiers="virtual">
+ <return type="void">
+ </return>
+ <argument index="0" name="time" type="float">
+ </argument>
+ <argument index="1" name="seek" type="bool">
+ </argument>
+ <description>
+ User-defined callback called when a custom node is processed. The [code]time[/code] parameter is a relative delta, unless [code]seek[/code] is [code]true[/code], in which case it is absolute.
+ Here, call the [method blend_input], [method blend_node] or [method blend_animation] functions. You can also use [method get_parameter] and [method set_parameter] to modify local memory.
+ This function should return the time left for the current animation to finish (if unsure, pass the value from the main blend being called).
+ </description>
+ </method>
<method name="add_input">
<return type="void">
</return>
@@ -77,29 +136,6 @@
Blend another animation node (in case this node contains children animation nodes). This function is only useful if you inherit from [AnimationRootNode] instead, else editors will not display your node for addition.
</description>
</method>
- <method name="get_caption" qualifiers="virtual">
- <return type="String">
- </return>
- <description>
- Gets the text caption for this node (used by some editors).
- </description>
- </method>
- <method name="get_child_by_name" qualifiers="virtual">
- <return type="Object">
- </return>
- <argument index="0" name="name" type="String">
- </argument>
- <description>
- Gets a child node by index (used by editors inheriting from [AnimationRootNode]).
- </description>
- </method>
- <method name="get_child_nodes" qualifiers="virtual">
- <return type="Dictionary">
- </return>
- <description>
- Gets all children nodes in order as a [code]name: node[/code] dictionary. Only useful when inheriting [AnimationRootNode].
- </description>
- </method>
<method name="get_input_count" qualifiers="const">
<return type="int">
</return>
@@ -125,29 +161,6 @@
Gets the value of a parameter. Parameters are custom local memory used for your nodes, given a resource can be reused in multiple trees.
</description>
</method>
- <method name="get_parameter_default_value" qualifiers="virtual">
- <return type="Variant">
- </return>
- <argument index="0" name="name" type="StringName">
- </argument>
- <description>
- Gets the default value of a parameter. Parameters are custom local memory used for your nodes, given a resource can be reused in multiple trees.
- </description>
- </method>
- <method name="get_parameter_list" qualifiers="virtual">
- <return type="Array">
- </return>
- <description>
- Gets the property information for parameter. Parameters are custom local memory used for your nodes, given a resource can be reused in multiple trees. Format is similar to [method Object.get_property_list].
- </description>
- </method>
- <method name="has_filter" qualifiers="virtual">
- <return type="bool">
- </return>
- <description>
- Returns [code]true[/code] whether you want the blend tree editor to display filter editing on this node.
- </description>
- </method>
<method name="is_path_filtered" qualifiers="const">
<return type="bool">
</return>
@@ -157,19 +170,6 @@
Returns [code]true[/code] whether a given path is filtered.
</description>
</method>
- <method name="process" qualifiers="virtual">
- <return type="void">
- </return>
- <argument index="0" name="time" type="float">
- </argument>
- <argument index="1" name="seek" type="bool">
- </argument>
- <description>
- User-defined callback called when a custom node is processed. The [code]time[/code] parameter is a relative delta, unless [code]seek[/code] is [code]true[/code], in which case it is absolute.
- Here, call the [method blend_input], [method blend_node] or [method blend_animation] functions. You can also use [method get_parameter] and [method set_parameter] to modify local memory.
- This function should return the time left for the current animation to finish (if unsure, pass the value from the main blend being called).
- </description>
- </method>
<method name="remove_input">
<return type="void">
</return>
diff --git a/doc/classes/AnimationTrackEditPlugin.xml b/doc/classes/AnimationTrackEditPlugin.xml
index 8490d48718..7b96808581 100644
--- a/doc/classes/AnimationTrackEditPlugin.xml
+++ b/doc/classes/AnimationTrackEditPlugin.xml
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8" ?>
-<class name="AnimationTrackEditPlugin" inherits="Reference" version="4.0">
+<class name="AnimationTrackEditPlugin" inherits="RefCounted" version="4.0">
<brief_description>
</brief_description>
<description>
diff --git a/doc/classes/Array.xml b/doc/classes/Array.xml
index 49775fa28b..543ec096c7 100644
--- a/doc/classes/Array.xml
+++ b/doc/classes/Array.xml
@@ -33,8 +33,8 @@
[/gdscript]
[csharp]
// Array concatenation is not possible with C# arrays, but is with Godot.Collections.Array.
- var array1 = new Godot.Collections.Array("One", 2);
- var array2 = new Godot.Collections.Array(3, "Four");
+ var array1 = new Godot.Collections.Array{"One", 2};
+ var array2 = new Godot.Collections.Array{3, "Four"};
GD.Print(array1 + array2); // Prints [One, 2, 3, Four]
[/csharp]
[/codeblocks]
diff --git a/doc/classes/ArrayMesh.xml b/doc/classes/ArrayMesh.xml
index 7826932179..f8cbc942e6 100644
--- a/doc/classes/ArrayMesh.xml
+++ b/doc/classes/ArrayMesh.xml
@@ -77,7 +77,6 @@
Creates a new surface.
Surfaces are created to be rendered using a [code]primitive[/code], which may be any of the types defined in [enum Mesh.PrimitiveType]. (As a note, when using indices, it is recommended to only use points, lines or triangles.) [method Mesh.get_surface_count] will become the [code]surf_idx[/code] for this new surface.
The [code]arrays[/code] argument is an array of arrays. See [enum Mesh.ArrayType] for the values used in this array. For example, [code]arrays[0][/code] is the array of vertices. That first vertex sub-array is always required; the others are optional. Adding an index array puts this function into "index mode" where the vertex and other arrays become the sources of data and the index array defines the vertex order. All sub-arrays must have the same length as the vertex array or be empty, except for [constant Mesh.ARRAY_INDEX] if it is used.
- Adding an index array puts this function into "index mode" where the vertex and other arrays become the sources of data, and the index array defines the order of the vertices.
</description>
</method>
<method name="clear_blend_shapes">
diff --git a/doc/classes/AudioEffectInstance.xml b/doc/classes/AudioEffectInstance.xml
index dc76880a36..9ab6028901 100644
--- a/doc/classes/AudioEffectInstance.xml
+++ b/doc/classes/AudioEffectInstance.xml
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8" ?>
-<class name="AudioEffectInstance" inherits="Reference" version="4.0">
+<class name="AudioEffectInstance" inherits="RefCounted" version="4.0">
<brief_description>
</brief_description>
<description>
diff --git a/doc/classes/AudioStreamPlayback.xml b/doc/classes/AudioStreamPlayback.xml
index da75ff206c..cb01aa75e8 100644
--- a/doc/classes/AudioStreamPlayback.xml
+++ b/doc/classes/AudioStreamPlayback.xml
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8" ?>
-<class name="AudioStreamPlayback" inherits="Reference" version="4.0">
+<class name="AudioStreamPlayback" inherits="RefCounted" version="4.0">
<brief_description>
Meta class for playing back audio.
</brief_description>
diff --git a/doc/classes/BitMap.xml b/doc/classes/BitMap.xml
index 27ead07e6f..83e598d2ba 100644
--- a/doc/classes/BitMap.xml
+++ b/doc/classes/BitMap.xml
@@ -71,6 +71,12 @@
<argument index="1" name="epsilon" type="float" default="2.0">
</argument>
<description>
+ Creates an [Array] of polygons covering a rectangular portion of the bitmap. It uses a marching squares algorithm, followed by Ramer-Douglas-Peucker (RDP) reduction of the number of vertices. Each polygon is described as a [PackedVector2Array] of its vertices.
+ To get polygons covering the whole bitmap, pass:
+ [codeblock]
+ Rect2(Vector2(), get_size())
+ [/codeblock]
+ [code]epsilon[/code] is passed to RDP to control how accurately the polygons cover the bitmap: a lower [code]epsilon[/code] corresponds to more points in the polygons.
</description>
</method>
<method name="set_bit">
diff --git a/doc/classes/Camera3D.xml b/doc/classes/Camera3D.xml
index 30f6c2b951..016eb05308 100644
--- a/doc/classes/Camera3D.xml
+++ b/doc/classes/Camera3D.xml
@@ -55,10 +55,19 @@
<argument index="0" name="world_point" type="Vector3">
</argument>
<description>
- Returns [code]true[/code] if the given position is behind the camera.
+ Returns [code]true[/code] if the given position is behind the camera (the blue part of the linked diagram). [url=https://raw.githubusercontent.com/godotengine/godot-docs/master/img/camera3d_position_frustum.png]See this diagram[/url] for an overview of position query methods.
[b]Note:[/b] A position which returns [code]false[/code] may still be outside the camera's field of view.
</description>
</method>
+ <method name="is_position_in_frustum" qualifiers="const">
+ <return type="bool">
+ </return>
+ <argument index="0" name="world_point" type="Vector3">
+ </argument>
+ <description>
+ Returns [code]true[/code] if the given position is inside the camera's frustum (the green part of the linked diagram). [url=https://raw.githubusercontent.com/godotengine/godot-docs/master/img/camera3d_position_frustum.png]See this diagram[/url] for an overview of position query methods.
+ </description>
+ </method>
<method name="make_current">
<return type="void">
</return>
diff --git a/doc/classes/CameraFeed.xml b/doc/classes/CameraFeed.xml
index 4fc124592f..fc7dcd3772 100644
--- a/doc/classes/CameraFeed.xml
+++ b/doc/classes/CameraFeed.xml
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8" ?>
-<class name="CameraFeed" inherits="Reference" version="4.0">
+<class name="CameraFeed" inherits="RefCounted" version="4.0">
<brief_description>
A camera feed gives you access to a single physical camera attached to your device.
</brief_description>
diff --git a/doc/classes/CharFXTransform.xml b/doc/classes/CharFXTransform.xml
index 7b57dc05f8..7a6a18f532 100644
--- a/doc/classes/CharFXTransform.xml
+++ b/doc/classes/CharFXTransform.xml
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8" ?>
-<class name="CharFXTransform" inherits="Reference" version="4.0">
+<class name="CharFXTransform" inherits="RefCounted" version="4.0">
<brief_description>
Controls how an individual character will be displayed in a [RichTextEffect].
</brief_description>
diff --git a/doc/classes/ConfigFile.xml b/doc/classes/ConfigFile.xml
index 38948a2d6e..8b903d8dbc 100644
--- a/doc/classes/ConfigFile.xml
+++ b/doc/classes/ConfigFile.xml
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8" ?>
-<class name="ConfigFile" inherits="Reference" version="4.0">
+<class name="ConfigFile" inherits="RefCounted" version="4.0">
<brief_description>
Helper class to handle INI-style files.
</brief_description>
diff --git a/doc/classes/Control.xml b/doc/classes/Control.xml
index 9c61fca598..33969cf4c3 100644
--- a/doc/classes/Control.xml
+++ b/doc/classes/Control.xml
@@ -22,6 +22,34 @@
<link title="All GUI Demos">https://github.com/godotengine/godot-demo-projects/tree/master/gui</link>
</tutorials>
<methods>
+ <method name="_can_drop_data" qualifiers="virtual">
+ <return type="bool">
+ </return>
+ <argument index="0" name="position" type="Vector2">
+ </argument>
+ <argument index="1" name="data" type="Variant">
+ </argument>
+ <description>
+ Godot calls this method to test if [code]data[/code] from a control's [method _get_drag_data] can be dropped at [code]position[/code]. [code]position[/code] is local to this control.
+ This method should only be used to test the data. Process the data in [method _drop_data].
+ [codeblocks]
+ [gdscript]
+ func _can_drop_data(position, data):
+ # Check position if it is relevant to you
+ # Otherwise, just check data
+ return typeof(data) == TYPE_DICTIONARY and data.has("expected")
+ [/gdscript]
+ [csharp]
+ public override bool CanDropData(Vector2 position, object data)
+ {
+ // Check position if it is relevant to you
+ // Otherwise, just check data
+ return data is Godot.Collections.Dictionary &amp;&amp; (data as Godot.Collections.Dictionary).Contains("expected");
+ }
+ [/csharp]
+ [/codeblocks]
+ </description>
+ </method>
<method name="_clips_input" qualifiers="virtual">
<return type="bool">
</return>
@@ -30,6 +58,61 @@
If not overridden, defaults to [code]false[/code].
</description>
</method>
+ <method name="_drop_data" qualifiers="virtual">
+ <return type="void">
+ </return>
+ <argument index="0" name="position" type="Vector2">
+ </argument>
+ <argument index="1" name="data" type="Variant">
+ </argument>
+ <description>
+ Godot calls this method to pass you the [code]data[/code] from a control's [method _get_drag_data] result. Godot first calls [method _can_drop_data] to test if [code]data[/code] is allowed to drop at [code]position[/code] where [code]position[/code] is local to this control.
+ [codeblocks]
+ [gdscript]
+ func _can_drop_data(position, data):
+ return typeof(data) == TYPE_DICTIONARY and data.has("color")
+ func _drop_data(position, data):
+ var color = data["color"]
+ [/gdscript]
+ [csharp]
+ public override bool CanDropData(Vector2 position, object data)
+ {
+ return data is Godot.Collections.Dictionary &amp;&amp; (data as Godot.Collections.Dictionary).Contains("color");
+ }
+ public override void DropData(Vector2 position, object data)
+ {
+ Color color = (Color)(data as Godot.Collections.Dictionary)["color"];
+ }
+ [/csharp]
+ [/codeblocks]
+ </description>
+ </method>
+ <method name="_get_drag_data" qualifiers="virtual">
+ <return type="Variant">
+ </return>
+ <argument index="0" name="position" type="Vector2">
+ </argument>
+ <description>
+ Godot calls this method to get data that can be dragged and dropped onto controls that expect drop data. Returns [code]null[/code] if there is no data to drag. Controls that want to receive drop data should implement [method _can_drop_data] and [method _drop_data]. [code]position[/code] is local to this control. Drag may be forced with [method force_drag].
+ A preview that will follow the mouse that should represent the data can be set with [method set_drag_preview]. A good time to set the preview is in this method.
+ [codeblocks]
+ [gdscript]
+ func _get_drag_data(position):
+ var mydata = make_data() # This is your custom method generating the drag data.
+ set_drag_preview(make_preview(mydata)) # This is your custom method generating the preview of the drag data.
+ return mydata
+ [/gdscript]
+ [csharp]
+ public override object GetDragData(Vector2 position)
+ {
+ object mydata = MakeData(); // This is your custom method generating the drag data.
+ SetDragPreview(MakePreview(mydata)); // This is your custom method generating the preview of the drag data.
+ return mydata;
+ }
+ [/csharp]
+ [/codeblocks]
+ </description>
+ </method>
<method name="_get_minimum_size" qualifiers="virtual">
<return type="Vector2">
</return>
@@ -68,13 +151,24 @@
[/csharp]
[/codeblocks]
The event won't trigger if:
- * clicking outside the control (see [method has_point]);
+ * clicking outside the control (see [method _has_point]);
* control has [member mouse_filter] set to [constant MOUSE_FILTER_IGNORE];
* control is obstructed by another [Control] on top of it, which doesn't have [member mouse_filter] set to [constant MOUSE_FILTER_IGNORE];
* control's parent has [member mouse_filter] set to [constant MOUSE_FILTER_STOP] or has accepted the event;
* it happens outside parent's rectangle and the parent has either [member rect_clip_content] or [method _clips_input] enabled.
</description>
</method>
+ <method name="_has_point" qualifiers="virtual">
+ <return type="bool">
+ </return>
+ <argument index="0" name="point" type="Vector2">
+ </argument>
+ <description>
+ Virtual method to be implemented by the user. Returns whether the given [code]point[/code] is inside this control.
+ If not overridden, default behavior is checking if the point is within control's Rect.
+ [b]Note:[/b] If you want to check if a point is inside the control, you can use [code]get_rect().has_point(point)[/code].
+ </description>
+ </method>
<method name="_make_custom_tooltip" qualifiers="virtual">
<return type="Control">
</return>
@@ -249,63 +343,6 @@
[/codeblocks]
</description>
</method>
- <method name="can_drop_data" qualifiers="virtual">
- <return type="bool">
- </return>
- <argument index="0" name="position" type="Vector2">
- </argument>
- <argument index="1" name="data" type="Variant">
- </argument>
- <description>
- Godot calls this method to test if [code]data[/code] from a control's [method get_drag_data] can be dropped at [code]position[/code]. [code]position[/code] is local to this control.
- This method should only be used to test the data. Process the data in [method drop_data].
- [codeblocks]
- [gdscript]
- func can_drop_data(position, data):
- # Check position if it is relevant to you
- # Otherwise, just check data
- return typeof(data) == TYPE_DICTIONARY and data.has("expected")
- [/gdscript]
- [csharp]
- public override bool CanDropData(Vector2 position, object data)
- {
- // Check position if it is relevant to you
- // Otherwise, just check data
- return data is Godot.Collections.Dictionary &amp;&amp; (data as Godot.Collections.Dictionary).Contains("expected");
- }
- [/csharp]
- [/codeblocks]
- </description>
- </method>
- <method name="drop_data" qualifiers="virtual">
- <return type="void">
- </return>
- <argument index="0" name="position" type="Vector2">
- </argument>
- <argument index="1" name="data" type="Variant">
- </argument>
- <description>
- Godot calls this method to pass you the [code]data[/code] from a control's [method get_drag_data] result. Godot first calls [method can_drop_data] to test if [code]data[/code] is allowed to drop at [code]position[/code] where [code]position[/code] is local to this control.
- [codeblocks]
- [gdscript]
- func can_drop_data(position, data):
- return typeof(data) == TYPE_DICTIONARY and data.has("color")
- func drop_data(position, data):
- var color = data["color"]
- [/gdscript]
- [csharp]
- public override bool CanDropData(Vector2 position, object data)
- {
- return data is Godot.Collections.Dictionary &amp;&amp; (data as Godot.Collections.Dictionary).Contains("color");
- }
- public override void DropData(Vector2 position, object data)
- {
- Color color = (Color)(data as Godot.Collections.Dictionary)["color"];
- }
- [/csharp]
- [/codeblocks]
- </description>
- </method>
<method name="find_next_valid_focus" qualifiers="const">
<return type="Control">
</return>
@@ -328,8 +365,8 @@
<argument index="1" name="preview" type="Control">
</argument>
<description>
- Forces drag and bypasses [method get_drag_data] and [method set_drag_preview] by passing [code]data[/code] and [code]preview[/code]. Drag will start even if the mouse is neither over nor pressed on this control.
- The methods [method can_drop_data] and [method drop_data] must be implemented on controls that want to receive drop data.
+ Forces drag and bypasses [method _get_drag_data] and [method set_drag_preview] by passing [code]data[/code] and [code]preview[/code]. Drag will start even if the mouse is neither over nor pressed on this control.
+ The methods [method _can_drop_data] and [method _drop_data] must be implemented on controls that want to receive drop data.
</description>
</method>
<method name="get_anchor" qualifiers="const">
@@ -364,32 +401,6 @@
Returns the mouse cursor shape the control displays on mouse hover. See [enum CursorShape].
</description>
</method>
- <method name="get_drag_data" qualifiers="virtual">
- <return type="Variant">
- </return>
- <argument index="0" name="position" type="Vector2">
- </argument>
- <description>
- Godot calls this method to get data that can be dragged and dropped onto controls that expect drop data. Returns [code]null[/code] if there is no data to drag. Controls that want to receive drop data should implement [method can_drop_data] and [method drop_data]. [code]position[/code] is local to this control. Drag may be forced with [method force_drag].
- A preview that will follow the mouse that should represent the data can be set with [method set_drag_preview]. A good time to set the preview is in this method.
- [codeblocks]
- [gdscript]
- func get_drag_data(position):
- var mydata = make_data() # This is your custom method generating the drag data.
- set_drag_preview(make_preview(mydata)) # This is your custom method generating the preview of the drag data.
- return mydata
- [/gdscript]
- [csharp]
- public override object GetDragData(Vector2 position)
- {
- object mydata = MakeData(); // This is your custom method generating the drag data.
- SetDragPreview(MakePreview(mydata)); // This is your custom method generating the preview of the drag data.
- return mydata;
- }
- [/csharp]
- [/codeblocks]
- </description>
- </method>
<method name="get_end" qualifiers="const">
<return type="Vector2">
</return>
@@ -577,17 +588,6 @@
Returns [code]true[/code] if this is the current focused control. See [member focus_mode].
</description>
</method>
- <method name="has_point" qualifiers="virtual">
- <return type="bool">
- </return>
- <argument index="0" name="point" type="Vector2">
- </argument>
- <description>
- Virtual method to be implemented by the user. Returns whether the given [code]point[/code] is inside this control.
- If not overridden, default behavior is checking if the point is within control's Rect.
- [b]Note:[/b] If you want to check if a point is inside the control, you can use [code]get_rect().has_point(point)[/code].
- </description>
- </method>
<method name="has_theme_color" qualifiers="const">
<return type="bool">
</return>
@@ -856,7 +856,7 @@
</argument>
<description>
Forwards the handling of this control's drag and drop to [code]target[/code] control.
- Forwarding can be implemented in the target control similar to the methods [method get_drag_data], [method can_drop_data], and [method drop_data] but with two differences:
+ Forwarding can be implemented in the target control similar to the methods [method _get_drag_data], [method _can_drop_data], and [method _drop_data] but with two differences:
1. The function name must be suffixed with [b]_fw[/b]
2. The function must take an extra argument that is the control doing the forwarding
[codeblocks]
@@ -871,13 +871,13 @@
# TargetControl.gd
extends Control
- func can_drop_data_fw(position, data, from_control):
+ func _can_drop_data_fw(position, data, from_control):
return true
- func drop_data_fw(position, data, from_control):
+ func _drop_data_fw(position, data, from_control):
my_handle_data(data) # Your handler method.
- func get_drag_data_fw(position, from_control):
+ func _get_drag_data_fw(position, from_control):
set_drag_preview(my_preview)
return my_data()
[/gdscript]
@@ -922,12 +922,12 @@
<argument index="0" name="control" type="Control">
</argument>
<description>
- Shows the given control at the mouse pointer. A good time to call this method is in [method get_drag_data]. The control must not be in the scene tree. You should not free the control, and you should not keep a reference to the control beyond the duration of the drag. It will be deleted automatically after the drag has ended.
+ Shows the given control at the mouse pointer. A good time to call this method is in [method _get_drag_data]. The control must not be in the scene tree. You should not free the control, and you should not keep a reference to the control beyond the duration of the drag. It will be deleted automatically after the drag has ended.
[codeblocks]
[gdscript]
export (Color, RGBA) var color = Color(1, 0, 0, 1)
- func get_drag_data(position):
+ func _get_drag_data(position):
# Use a control that is not in the tree
var cpb = ColorPickerButton.new()
cpb.color = color
diff --git a/doc/classes/Crypto.xml b/doc/classes/Crypto.xml
index 1f6cb40cde..deda6116f4 100644
--- a/doc/classes/Crypto.xml
+++ b/doc/classes/Crypto.xml
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8" ?>
-<class name="Crypto" inherits="Reference" version="4.0">
+<class name="Crypto" inherits="RefCounted" version="4.0">
<brief_description>
Access to advanced cryptographic functionalities.
</brief_description>
diff --git a/doc/classes/DTLSServer.xml b/doc/classes/DTLSServer.xml
index 91a04b1f28..28d68d309f 100644
--- a/doc/classes/DTLSServer.xml
+++ b/doc/classes/DTLSServer.xml
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8" ?>
-<class name="DTLSServer" inherits="Reference" version="4.0">
+<class name="DTLSServer" inherits="RefCounted" version="4.0">
<brief_description>
Helper class to implement a DTLS server.
</brief_description>
diff --git a/doc/classes/Directory.xml b/doc/classes/Directory.xml
index 2c61d723cd..dae8d83f0c 100644
--- a/doc/classes/Directory.xml
+++ b/doc/classes/Directory.xml
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8" ?>
-<class name="Directory" inherits="Reference" version="4.0">
+<class name="Directory" inherits="RefCounted" version="4.0">
<brief_description>
Type used to handle the filesystem.
</brief_description>
diff --git a/doc/classes/EditorExportPlugin.xml b/doc/classes/EditorExportPlugin.xml
index b29734de1c..d9e3003fbb 100644
--- a/doc/classes/EditorExportPlugin.xml
+++ b/doc/classes/EditorExportPlugin.xml
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8" ?>
-<class name="EditorExportPlugin" inherits="Reference" version="4.0">
+<class name="EditorExportPlugin" inherits="RefCounted" version="4.0">
<brief_description>
A script that is executed when exporting the project.
</brief_description>
diff --git a/doc/classes/EditorFeatureProfile.xml b/doc/classes/EditorFeatureProfile.xml
index e05a685dd7..0cd839f370 100644
--- a/doc/classes/EditorFeatureProfile.xml
+++ b/doc/classes/EditorFeatureProfile.xml
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8" ?>
-<class name="EditorFeatureProfile" inherits="Reference" version="4.0">
+<class name="EditorFeatureProfile" inherits="RefCounted" version="4.0">
<brief_description>
An editor feature profile which can be used to disable specific features.
</brief_description>
diff --git a/doc/classes/EditorImportPlugin.xml b/doc/classes/EditorImportPlugin.xml
index 663eb0ff5c..a532e9bc2b 100644
--- a/doc/classes/EditorImportPlugin.xml
+++ b/doc/classes/EditorImportPlugin.xml
@@ -5,45 +5,45 @@
</brief_description>
<description>
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.
+ 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":
[codeblocks]
[gdscript]
tool
extends EditorImportPlugin
- func get_importer_name():
+ func _get_importer_name():
return "my.special.plugin"
- func get_visible_name():
+ func _get_visible_name():
return "Special Mesh"
- func get_recognized_extensions():
+ func _get_recognized_extensions():
return ["special", "spec"]
- func get_save_extension():
+ func _get_save_extension():
return "mesh"
- func get_resource_type():
+ func _get_resource_type():
return "Mesh"
- func get_preset_count():
+ func _get_preset_count():
return 1
- func get_preset_name(i):
+ func _get_preset_name(i):
return "Default"
- func get_import_options(i):
+ func _get_import_options(i):
return [{"name": "my_option", "default_value": false}]
- func import(source_file, save_path, options, platform_variants, gen_files):
+ func _import(source_file, save_path, options, platform_variants, gen_files):
var file = File.new()
if file.open(source_file, File.READ) != OK:
return FAILED
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()
+ var filename = save_path + "." + _get_save_extension()
return ResourceSaver.save(filename, mesh)
[/gdscript]
[csharp]
@@ -113,7 +113,7 @@
<link title="Import plugins">https://docs.godotengine.org/en/latest/tutorials/plugins/editor/import_plugins.html</link>
</tutorials>
<methods>
- <method name="get_import_options" qualifiers="virtual">
+ <method name="_get_import_options" qualifiers="virtual">
<return type="Array">
</return>
<argument index="0" name="preset" type="int">
@@ -122,21 +122,21 @@
Gets the options and default values for the preset at this index. Returns an Array of Dictionaries with the following keys: [code]name[/code], [code]default_value[/code], [code]property_hint[/code] (optional), [code]hint_string[/code] (optional), [code]usage[/code] (optional).
</description>
</method>
- <method name="get_import_order" qualifiers="virtual">
+ <method name="_get_import_order" qualifiers="virtual">
<return type="int">
</return>
<description>
Gets the order of this importer to be run when importing resources. Higher values will be called later. Use this to ensure the importer runs after the dependencies are already imported.
</description>
</method>
- <method name="get_importer_name" qualifiers="virtual">
+ <method name="_get_importer_name" qualifiers="virtual">
<return type="String">
</return>
<description>
Gets the unique name of the importer.
</description>
</method>
- <method name="get_option_visibility" qualifiers="virtual">
+ <method name="_get_option_visibility" qualifiers="virtual">
<return type="bool">
</return>
<argument index="0" name="option" type="String">
@@ -147,7 +147,7 @@
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:
[codeblocks]
[gdscript]
- func get_option_visibility(option, options):
+ 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 # This is a constant that you set
@@ -170,14 +170,14 @@
Return [code]true[/code] to make all options always visible.
</description>
</method>
- <method name="get_preset_count" qualifiers="virtual">
+ <method name="_get_preset_count" qualifiers="virtual">
<return type="int">
</return>
<description>
- Gets the number of initial presets defined by the plugin. Use [method get_import_options] to get the default options for the preset and [method get_preset_name] to get the name of the preset.
+ Gets the number of initial presets defined by the plugin. Use [method _get_import_options] to get the default options for the preset and [method _get_preset_name] to get the name of the preset.
</description>
</method>
- <method name="get_preset_name" qualifiers="virtual">
+ <method name="_get_preset_name" qualifiers="virtual">
<return type="String">
</return>
<argument index="0" name="preset" type="int">
@@ -186,42 +186,42 @@
Gets the name of the options preset at this index.
</description>
</method>
- <method name="get_priority" qualifiers="virtual">
+ <method name="_get_priority" qualifiers="virtual">
<return type="float">
</return>
<description>
Gets the priority of this plugin for the recognized extension. Higher priority plugins will be preferred. The default priority is [code]1.0[/code].
</description>
</method>
- <method name="get_recognized_extensions" qualifiers="virtual">
+ <method name="_get_recognized_extensions" qualifiers="virtual">
<return type="Array">
</return>
<description>
Gets the list of file extensions to associate with this loader (case-insensitive). e.g. [code]["obj"][/code].
</description>
</method>
- <method name="get_resource_type" qualifiers="virtual">
+ <method name="_get_resource_type" qualifiers="virtual">
<return type="String">
</return>
<description>
Gets the Godot resource type associated with this loader. e.g. [code]"Mesh"[/code] or [code]"Animation"[/code].
</description>
</method>
- <method name="get_save_extension" qualifiers="virtual">
+ <method name="_get_save_extension" qualifiers="virtual">
<return type="String">
</return>
<description>
Gets the extension used to save this resource in the [code].godot/imported[/code] directory.
</description>
</method>
- <method name="get_visible_name" qualifiers="virtual">
+ <method name="_get_visible_name" qualifiers="virtual">
<return type="String">
</return>
<description>
Gets the name to display in the import window. You should choose this name as a continuation to "Import as", e.g. "Import as Special Mesh".
</description>
</method>
- <method name="import" qualifiers="virtual">
+ <method name="_import" qualifiers="virtual">
<return type="int">
</return>
<argument index="0" name="source_file" type="String">
diff --git a/doc/classes/EditorInspectorPlugin.xml b/doc/classes/EditorInspectorPlugin.xml
index 8204dc931e..c992d0fbb4 100644
--- a/doc/classes/EditorInspectorPlugin.xml
+++ b/doc/classes/EditorInspectorPlugin.xml
@@ -1,106 +1,100 @@
<?xml version="1.0" encoding="UTF-8" ?>
-<class name="EditorInspectorPlugin" inherits="Reference" version="4.0">
+<class name="EditorInspectorPlugin" inherits="RefCounted" version="4.0">
<brief_description>
Plugin for adding custom property editors on inspector.
</brief_description>
<description>
These plugins allow adding custom property editors to [EditorInspector].
Plugins are registered via [method EditorPlugin.add_inspector_plugin].
- When an object is edited, the [method can_handle] function is called and must return [code]true[/code] if the object type is supported.
- If supported, the function [method parse_begin] will be called, allowing to place custom controls at the beginning of the class.
- Subsequently, the [method parse_category] and [method parse_property] are called for every category and property. They offer the ability to add custom controls to the inspector too.
- Finally, [method parse_end] will be called.
+ When an object is edited, the [method _can_handle] function is called and must return [code]true[/code] if the object type is supported.
+ If supported, the function [method _parse_begin] will be called, allowing to place custom controls at the beginning of the class.
+ Subsequently, the [method _parse_category] and [method _parse_property] are called for every category and property. They offer the ability to add custom controls to the inspector too.
+ Finally, [method _parse_end] will be called.
On each of these calls, the "add" functions can be called.
</description>
<tutorials>
</tutorials>
<methods>
- <method name="add_custom_control">
- <return type="void">
+ <method name="_can_handle" qualifiers="virtual">
+ <return type="bool">
</return>
- <argument index="0" name="control" type="Control">
+ <argument index="0" name="object" type="Object">
</argument>
<description>
- Adds a custom control, not necessarily a property editor.
+ Returns [code]true[/code] if this object can be handled by this plugin.
</description>
</method>
- <method name="add_property_editor">
+ <method name="_parse_begin" qualifiers="virtual">
<return type="void">
</return>
- <argument index="0" name="property" type="String">
- </argument>
- <argument index="1" name="editor" type="Control">
- </argument>
<description>
- Adds a property editor, this must inherit [EditorProperty].
+ Called to allow adding controls at the beginning of the list.
</description>
</method>
- <method name="add_property_editor_for_multiple_properties">
+ <method name="_parse_category" qualifiers="virtual">
<return type="void">
</return>
- <argument index="0" name="label" type="String">
- </argument>
- <argument index="1" name="properties" type="PackedStringArray">
- </argument>
- <argument index="2" name="editor" type="Control">
+ <argument index="0" name="category" type="String">
</argument>
<description>
- Adds an editor that allows modifying multiple properties, this must inherit [EditorProperty].
+ Called to allow adding controls at the beginning of the category.
</description>
</method>
- <method name="can_handle" qualifiers="virtual">
- <return type="bool">
+ <method name="_parse_end" qualifiers="virtual">
+ <return type="void">
</return>
- <argument index="0" name="object" type="Object">
- </argument>
<description>
- Returns [code]true[/code] if this object can be handled by this plugin.
+ Called to allow adding controls at the end of the list.
</description>
</method>
- <method name="parse_begin" qualifiers="virtual">
- <return type="void">
+ <method name="_parse_property" qualifiers="virtual">
+ <return type="bool">
</return>
- <argument index="0" name="object" type="Object">
+ <argument index="0" name="type" type="int">
+ </argument>
+ <argument index="1" name="path" type="String">
+ </argument>
+ <argument index="2" name="hint" type="int">
+ </argument>
+ <argument index="3" name="hint_text" type="String">
+ </argument>
+ <argument index="4" name="usage" type="int">
</argument>
<description>
- Called to allow adding controls at the beginning of the list.
+ Called to allow adding property specific editors to the inspector. Usually these inherit [EditorProperty]. Returning [code]true[/code] removes the built-in editor for this property, otherwise allows to insert a custom editor before the built-in one.
</description>
</method>
- <method name="parse_category" qualifiers="virtual">
+ <method name="add_custom_control">
<return type="void">
</return>
- <argument index="0" name="object" type="Object">
- </argument>
- <argument index="1" name="category" type="String">
+ <argument index="0" name="control" type="Control">
</argument>
<description>
- Called to allow adding controls at the beginning of the category.
+ Adds a custom control, not necessarily a property editor.
</description>
</method>
- <method name="parse_end" qualifiers="virtual">
+ <method name="add_property_editor">
<return type="void">
</return>
+ <argument index="0" name="property" type="String">
+ </argument>
+ <argument index="1" name="editor" type="Control">
+ </argument>
<description>
- Called to allow adding controls at the end of the list.
+ Adds a property editor, this must inherit [EditorProperty].
</description>
</method>
- <method name="parse_property" qualifiers="virtual">
- <return type="bool">
+ <method name="add_property_editor_for_multiple_properties">
+ <return type="void">
</return>
- <argument index="0" name="object" type="Object">
- </argument>
- <argument index="1" name="type" type="int">
- </argument>
- <argument index="2" name="path" type="String">
- </argument>
- <argument index="3" name="hint" type="int">
+ <argument index="0" name="label" type="String">
</argument>
- <argument index="4" name="hint_text" type="String">
+ <argument index="1" name="properties" type="PackedStringArray">
</argument>
- <argument index="5" name="usage" type="int">
+ <argument index="2" name="editor" type="Control">
</argument>
<description>
- Called to allow adding property specific editors to the inspector. Usually these inherit [EditorProperty]. Returning [code]true[/code] removes the built-in editor for this property, otherwise allows to insert a custom editor before the built-in one.
+ Adds an editor that allows modifying multiple properties, this must inherit [EditorProperty].
</description>
</method>
</methods>
diff --git a/doc/classes/EditorNode3DGizmo.xml b/doc/classes/EditorNode3DGizmo.xml
index 45541b9263..dcc6d6ef12 100644
--- a/doc/classes/EditorNode3DGizmo.xml
+++ b/doc/classes/EditorNode3DGizmo.xml
@@ -9,13 +9,76 @@
<tutorials>
</tutorials>
<methods>
+ <method name="_commit_handle" qualifiers="virtual">
+ <return type="void">
+ </return>
+ <argument index="0" name="index" type="int">
+ </argument>
+ <argument index="1" name="restore" type="Variant">
+ </argument>
+ <argument index="2" name="cancel" type="bool" default="false">
+ </argument>
+ <description>
+ Commit a handle being edited (handles must have been previously added by [method add_handles]).
+ If the [code]cancel[/code] parameter is [code]true[/code], an option to restore the edited value to the original is provided.
+ </description>
+ </method>
+ <method name="_get_handle_name" qualifiers="virtual">
+ <return type="String">
+ </return>
+ <argument index="0" name="index" type="int">
+ </argument>
+ <description>
+ Gets the name of an edited handle (handles must have been previously added by [method add_handles]).
+ Handles can be named for reference to the user when editing.
+ </description>
+ </method>
+ <method name="_get_handle_value" qualifiers="virtual">
+ <return type="Variant">
+ </return>
+ <argument index="0" name="index" type="int">
+ </argument>
+ <description>
+ Gets actual value of a handle. This value can be anything and used for eventually undoing the motion when calling [method _commit_handle].
+ </description>
+ </method>
+ <method name="_is_handle_highlighted" qualifiers="virtual">
+ <return type="bool">
+ </return>
+ <argument index="0" name="index" type="int">
+ </argument>
+ <description>
+ Returns [code]true[/code] if the handle at index [code]index[/code] is highlighted by being hovered with the mouse.
+ </description>
+ </method>
+ <method name="_redraw" qualifiers="virtual">
+ <return type="void">
+ </return>
+ <description>
+ This function is called when the [Node3D] this gizmo refers to changes (the [method Node3D.update_gizmo] is called).
+ </description>
+ </method>
+ <method name="_set_handle" qualifiers="virtual">
+ <return type="void">
+ </return>
+ <argument index="0" name="index" type="int">
+ </argument>
+ <argument index="1" name="camera" type="Camera3D">
+ </argument>
+ <argument index="2" name="point" type="Vector2">
+ </argument>
+ <description>
+ This function is used when the user drags a gizmo handle (previously added with [method add_handles]) in screen coordinates.
+ The [Camera3D] is also provided so screen coordinates can be converted to raycasts.
+ </description>
+ </method>
<method name="add_collision_segments">
<return type="void">
</return>
<argument index="0" name="segments" type="PackedVector3Array">
</argument>
<description>
- Adds the specified [code]segments[/code] to the gizmo's collision shape for picking. Call this function during [method redraw].
+ Adds the specified [code]segments[/code] to the gizmo's collision shape for picking. Call this function during [method _redraw].
</description>
</method>
<method name="add_collision_triangles">
@@ -24,7 +87,7 @@
<argument index="0" name="triangles" type="TriangleMesh">
</argument>
<description>
- Adds collision triangles to the gizmo for picking. A [TriangleMesh] can be generated from a regular [Mesh] too. Call this function during [method redraw].
+ Adds collision triangles to the gizmo for picking. A [TriangleMesh] can be generated from a regular [Mesh] too. Call this function during [method _redraw].
</description>
</method>
<method name="add_handles">
@@ -40,7 +103,7 @@
</argument>
<description>
Adds a list of handles (points) which can be used to deform the object being edited.
- There are virtual functions which will be called upon editing of these handles. Call this function during [method redraw].
+ There are virtual functions which will be called upon editing of these handles. Call this function during [method _redraw].
</description>
</method>
<method name="add_lines">
@@ -55,7 +118,7 @@
<argument index="3" name="modulate" type="Color" default="Color( 1, 1, 1, 1 )">
</argument>
<description>
- Adds lines to the gizmo (as sets of 2 points), with a given material. The lines are used for visualizing the gizmo. Call this function during [method redraw].
+ Adds lines to the gizmo (as sets of 2 points), with a given material. The lines are used for visualizing the gizmo. Call this function during [method _redraw].
</description>
</method>
<method name="add_mesh">
@@ -70,7 +133,7 @@
<argument index="3" name="material" type="Material" default="null">
</argument>
<description>
- Adds a mesh to the gizmo with the specified [code]billboard[/code] state, [code]skeleton[/code] and [code]material[/code]. If [code]billboard[/code] is [code]true[/code], the mesh will rotate to always face the camera. Call this function during [method redraw].
+ Adds a mesh to the gizmo with the specified [code]billboard[/code] state, [code]skeleton[/code] and [code]material[/code]. If [code]billboard[/code] is [code]true[/code], the mesh will rotate to always face the camera. Call this function during [method _redraw].
</description>
</method>
<method name="add_unscaled_billboard">
@@ -83,7 +146,7 @@
<argument index="2" name="modulate" type="Color" default="Color( 1, 1, 1, 1 )">
</argument>
<description>
- Adds an unscaled billboard for visualization. Call this function during [method redraw].
+ Adds an unscaled billboard for visualization. Call this function during [method _redraw].
</description>
</method>
<method name="clear">
@@ -93,39 +156,6 @@
Removes everything in the gizmo including meshes, collisions and handles.
</description>
</method>
- <method name="commit_handle" qualifiers="virtual">
- <return type="void">
- </return>
- <argument index="0" name="index" type="int">
- </argument>
- <argument index="1" name="restore" type="Variant">
- </argument>
- <argument index="2" name="cancel" type="bool" default="false">
- </argument>
- <description>
- Commit a handle being edited (handles must have been previously added by [method add_handles]).
- If the [code]cancel[/code] parameter is [code]true[/code], an option to restore the edited value to the original is provided.
- </description>
- </method>
- <method name="get_handle_name" qualifiers="virtual">
- <return type="String">
- </return>
- <argument index="0" name="index" type="int">
- </argument>
- <description>
- Gets the name of an edited handle (handles must have been previously added by [method add_handles]).
- Handles can be named for reference to the user when editing.
- </description>
- </method>
- <method name="get_handle_value" qualifiers="virtual">
- <return type="Variant">
- </return>
- <argument index="0" name="index" type="int">
- </argument>
- <description>
- Gets actual value of a handle. This value can be anything and used for eventually undoing the motion when calling [method commit_handle].
- </description>
- </method>
<method name="get_plugin" qualifiers="const">
<return type="EditorNode3DGizmoPlugin">
</return>
@@ -140,36 +170,6 @@
Returns the Node3D node associated with this gizmo.
</description>
</method>
- <method name="is_handle_highlighted" qualifiers="virtual">
- <return type="bool">
- </return>
- <argument index="0" name="index" type="int">
- </argument>
- <description>
- Returns [code]true[/code] if the handle at index [code]index[/code] is highlighted by being hovered with the mouse.
- </description>
- </method>
- <method name="redraw" qualifiers="virtual">
- <return type="void">
- </return>
- <description>
- This function is called when the [Node3D] this gizmo refers to changes (the [method Node3D.update_gizmo] is called).
- </description>
- </method>
- <method name="set_handle" qualifiers="virtual">
- <return type="void">
- </return>
- <argument index="0" name="index" type="int">
- </argument>
- <argument index="1" name="camera" type="Camera3D">
- </argument>
- <argument index="2" name="point" type="Vector2">
- </argument>
- <description>
- This function is used when the user drags a gizmo handle (previously added with [method add_handles]) in screen coordinates.
- The [Camera3D] is also provided so screen coordinates can be converted to raycasts.
- </description>
- </method>
<method name="set_hidden">
<return type="void">
</return>
diff --git a/doc/classes/EditorNode3DGizmoPlugin.xml b/doc/classes/EditorNode3DGizmoPlugin.xml
index 34657a1c08..5551326533 100644
--- a/doc/classes/EditorNode3DGizmoPlugin.xml
+++ b/doc/classes/EditorNode3DGizmoPlugin.xml
@@ -10,25 +10,14 @@
<link title="Spatial gizmo plugins">https://docs.godotengine.org/en/latest/tutorials/plugins/editor/spatial_gizmos.html</link>
</tutorials>
<methods>
- <method name="add_material">
- <return type="void">
- </return>
- <argument index="0" name="name" type="String">
- </argument>
- <argument index="1" name="material" type="StandardMaterial3D">
- </argument>
- <description>
- Adds a new material to the internal material list for the plugin. It can then be accessed with [method get_material]. Should not be overridden.
- </description>
- </method>
- <method name="can_be_hidden" qualifiers="virtual">
+ <method name="_can_be_hidden" qualifiers="virtual">
<return type="bool">
</return>
<description>
Override this method to define whether the gizmo can be hidden or not. Returns [code]true[/code] if not overridden.
</description>
</method>
- <method name="commit_handle" qualifiers="virtual">
+ <method name="_commit_handle" qualifiers="virtual">
<return type="void">
</return>
<argument index="0" name="gizmo" type="EditorNode3DGizmo">
@@ -43,69 +32,23 @@
Override this method to commit gizmo handles. Called for this plugin's active gizmos.
</description>
</method>
- <method name="create_gizmo" qualifiers="virtual">
+ <method name="_create_gizmo" qualifiers="virtual">
<return type="EditorNode3DGizmo">
</return>
<argument index="0" name="spatial" type="Node3D">
</argument>
<description>
- Override this method to return a custom [EditorNode3DGizmo] for the spatial nodes of your choice, return [code]null[/code] for the rest of nodes. See also [method has_gizmo].
- </description>
- </method>
- <method name="create_handle_material">
- <return type="void">
- </return>
- <argument index="0" name="name" type="String">
- </argument>
- <argument index="1" name="billboard" type="bool" default="false">
- </argument>
- <argument index="2" name="texture" type="Texture2D" default="null">
- </argument>
- <description>
- Creates a handle material with its variants (selected and/or editable) and adds them to the internal material list. They can then be accessed with [method get_material] and used in [method EditorNode3DGizmo.add_handles]. Should not be overridden.
- You can optionally provide a texture to use instead of the default icon.
- </description>
- </method>
- <method name="create_icon_material">
- <return type="void">
- </return>
- <argument index="0" name="name" type="String">
- </argument>
- <argument index="1" name="texture" type="Texture2D">
- </argument>
- <argument index="2" name="on_top" type="bool" default="false">
- </argument>
- <argument index="3" name="color" type="Color" default="Color( 1, 1, 1, 1 )">
- </argument>
- <description>
- Creates an icon material with its variants (selected and/or editable) and adds them to the internal material list. They can then be accessed with [method get_material] and used in [method EditorNode3DGizmo.add_unscaled_billboard]. Should not be overridden.
- </description>
- </method>
- <method name="create_material">
- <return type="void">
- </return>
- <argument index="0" name="name" type="String">
- </argument>
- <argument index="1" name="color" type="Color">
- </argument>
- <argument index="2" name="billboard" type="bool" default="false">
- </argument>
- <argument index="3" name="on_top" type="bool" default="false">
- </argument>
- <argument index="4" name="use_vertex_color" type="bool" default="false">
- </argument>
- <description>
- Creates an unshaded material with its variants (selected and/or editable) and adds them to the internal material list. They can then be accessed with [method get_material] and used in [method EditorNode3DGizmo.add_mesh] and [method EditorNode3DGizmo.add_lines]. Should not be overridden.
+ Override this method to return a custom [EditorNode3DGizmo] for the spatial nodes of your choice, return [code]null[/code] for the rest of nodes. See also [method _has_gizmo].
</description>
</method>
- <method name="get_gizmo_name" qualifiers="virtual">
+ <method name="_get_gizmo_name" qualifiers="virtual">
<return type="String">
</return>
<description>
Override this method to provide the name that will appear in the gizmo visibility menu.
</description>
</method>
- <method name="get_handle_name" qualifiers="virtual">
+ <method name="_get_handle_name" qualifiers="virtual">
<return type="String">
</return>
<argument index="0" name="gizmo" type="EditorNode3DGizmo">
@@ -116,7 +59,7 @@
Override this method to provide gizmo's handle names. Called for this plugin's active gizmos.
</description>
</method>
- <method name="get_handle_value" qualifiers="virtual">
+ <method name="_get_handle_value" qualifiers="virtual">
<return type="Variant">
</return>
<argument index="0" name="gizmo" type="EditorNode3DGizmo">
@@ -127,18 +70,7 @@
Gets actual value of a handle from gizmo. Called for this plugin's active gizmos.
</description>
</method>
- <method name="get_material">
- <return type="StandardMaterial3D">
- </return>
- <argument index="0" name="name" type="String">
- </argument>
- <argument index="1" name="gizmo" type="EditorNode3DGizmo" default="null">
- </argument>
- <description>
- Gets material from the internal list of materials. If an [EditorNode3DGizmo] is provided, it will try to get the corresponding variant (selected and/or editable).
- </description>
- </method>
- <method name="get_priority" qualifiers="virtual">
+ <method name="_get_priority" qualifiers="virtual">
<return type="int">
</return>
<description>
@@ -146,7 +78,7 @@
All built-in editor gizmos return a priority of [code]-1[/code]. If not overridden, this method will return [code]0[/code], which means custom gizmos will automatically override built-in gizmos.
</description>
</method>
- <method name="has_gizmo" qualifiers="virtual">
+ <method name="_has_gizmo" qualifiers="virtual">
<return type="bool">
</return>
<argument index="0" name="spatial" type="Node3D">
@@ -155,7 +87,7 @@
Override this method to define which Node3D nodes have a gizmo from this plugin. Whenever a [Node3D] node is added to a scene this method is called, if it returns [code]true[/code] the node gets a generic [EditorNode3DGizmo] assigned and is added to this plugin's list of active gizmos.
</description>
</method>
- <method name="is_handle_highlighted" qualifiers="virtual">
+ <method name="_is_handle_highlighted" qualifiers="virtual">
<return type="bool">
</return>
<argument index="0" name="gizmo" type="EditorNode3DGizmo">
@@ -166,14 +98,14 @@
Gets whether a handle is highlighted or not. Called for this plugin's active gizmos.
</description>
</method>
- <method name="is_selectable_when_hidden" qualifiers="virtual">
+ <method name="_is_selectable_when_hidden" qualifiers="virtual">
<return type="bool">
</return>
<description>
Override this method to define whether Node3D with this gizmo should be selectable even when the gizmo is hidden.
</description>
</method>
- <method name="redraw" qualifiers="virtual">
+ <method name="_redraw" qualifiers="virtual">
<return type="void">
</return>
<argument index="0" name="gizmo" type="EditorNode3DGizmo">
@@ -182,7 +114,7 @@
Callback to redraw the provided gizmo. Called for this plugin's active gizmos.
</description>
</method>
- <method name="set_handle" qualifiers="virtual">
+ <method name="_set_handle" qualifiers="virtual">
<return type="void">
</return>
<argument index="0" name="gizmo" type="EditorNode3DGizmo">
@@ -197,6 +129,74 @@
Update the value of a handle after it has been updated. Called for this plugin's active gizmos.
</description>
</method>
+ <method name="add_material">
+ <return type="void">
+ </return>
+ <argument index="0" name="name" type="String">
+ </argument>
+ <argument index="1" name="material" type="StandardMaterial3D">
+ </argument>
+ <description>
+ Adds a new material to the internal material list for the plugin. It can then be accessed with [method get_material]. Should not be overridden.
+ </description>
+ </method>
+ <method name="create_handle_material">
+ <return type="void">
+ </return>
+ <argument index="0" name="name" type="String">
+ </argument>
+ <argument index="1" name="billboard" type="bool" default="false">
+ </argument>
+ <argument index="2" name="texture" type="Texture2D" default="null">
+ </argument>
+ <description>
+ Creates a handle material with its variants (selected and/or editable) and adds them to the internal material list. They can then be accessed with [method get_material] and used in [method EditorNode3DGizmo.add_handles]. Should not be overridden.
+ You can optionally provide a texture to use instead of the default icon.
+ </description>
+ </method>
+ <method name="create_icon_material">
+ <return type="void">
+ </return>
+ <argument index="0" name="name" type="String">
+ </argument>
+ <argument index="1" name="texture" type="Texture2D">
+ </argument>
+ <argument index="2" name="on_top" type="bool" default="false">
+ </argument>
+ <argument index="3" name="color" type="Color" default="Color( 1, 1, 1, 1 )">
+ </argument>
+ <description>
+ Creates an icon material with its variants (selected and/or editable) and adds them to the internal material list. They can then be accessed with [method get_material] and used in [method EditorNode3DGizmo.add_unscaled_billboard]. Should not be overridden.
+ </description>
+ </method>
+ <method name="create_material">
+ <return type="void">
+ </return>
+ <argument index="0" name="name" type="String">
+ </argument>
+ <argument index="1" name="color" type="Color">
+ </argument>
+ <argument index="2" name="billboard" type="bool" default="false">
+ </argument>
+ <argument index="3" name="on_top" type="bool" default="false">
+ </argument>
+ <argument index="4" name="use_vertex_color" type="bool" default="false">
+ </argument>
+ <description>
+ Creates an unshaded material with its variants (selected and/or editable) and adds them to the internal material list. They can then be accessed with [method get_material] and used in [method EditorNode3DGizmo.add_mesh] and [method EditorNode3DGizmo.add_lines]. Should not be overridden.
+ </description>
+ </method>
+ <method name="get_material">
+ <return type="StandardMaterial3D">
+ </return>
+ <argument index="0" name="name" type="String">
+ </argument>
+ <argument index="1" name="gizmo" type="EditorNode3DGizmo" default="null">
+ </argument>
+ <description>
+ Gets material from the internal list of materials. If an [EditorNode3DGizmo] is provided, it will try to get the corresponding variant (selected and/or editable).
+ </description>
+ </method>
</methods>
<constants>
</constants>
diff --git a/doc/classes/EditorPlugin.xml b/doc/classes/EditorPlugin.xml
index 6c40b7aa9d..0c0439e9d3 100644
--- a/doc/classes/EditorPlugin.xml
+++ b/doc/classes/EditorPlugin.xml
@@ -10,185 +10,7 @@
<link title="Editor plugins tutorial index">https://docs.godotengine.org/en/latest/tutorials/plugins/editor/index.html</link>
</tutorials>
<methods>
- <method name="add_autoload_singleton">
- <return type="void">
- </return>
- <argument index="0" name="name" type="String">
- </argument>
- <argument index="1" name="path" type="String">
- </argument>
- <description>
- Adds a script at [code]path[/code] to the Autoload list as [code]name[/code].
- </description>
- </method>
- <method name="add_control_to_bottom_panel">
- <return type="Button">
- </return>
- <argument index="0" name="control" type="Control">
- </argument>
- <argument index="1" name="title" type="String">
- </argument>
- <description>
- Adds a control to the bottom panel (together with Output, Debug, Animation, etc). Returns a reference to the button added. It's up to you to hide/show the button when needed. When your plugin is deactivated, make sure to remove your custom control with [method remove_control_from_bottom_panel] and free it with [method Node.queue_free].
- </description>
- </method>
- <method name="add_control_to_container">
- <return type="void">
- </return>
- <argument index="0" name="container" type="int" enum="EditorPlugin.CustomControlContainer">
- </argument>
- <argument index="1" name="control" type="Control">
- </argument>
- <description>
- Adds a custom control to a container (see [enum CustomControlContainer]). There are many locations where custom controls can be added in the editor UI.
- Please remember that you have to manage the visibility of your custom controls yourself (and likely hide it after adding it).
- When your plugin is deactivated, make sure to remove your custom control with [method remove_control_from_container] and free it with [method Node.queue_free].
- </description>
- </method>
- <method name="add_control_to_dock">
- <return type="void">
- </return>
- <argument index="0" name="slot" type="int" enum="EditorPlugin.DockSlot">
- </argument>
- <argument index="1" name="control" type="Control">
- </argument>
- <description>
- Adds the control to a specific dock slot (see [enum DockSlot] for options).
- If the dock is repositioned and as long as the plugin is active, the editor will save the dock position on further sessions.
- When your plugin is deactivated, make sure to remove your custom control with [method remove_control_from_docks] and free it with [method Node.queue_free].
- </description>
- </method>
- <method name="add_custom_type">
- <return type="void">
- </return>
- <argument index="0" name="type" type="String">
- </argument>
- <argument index="1" name="base" type="String">
- </argument>
- <argument index="2" name="script" type="Script">
- </argument>
- <argument index="3" name="icon" type="Texture2D">
- </argument>
- <description>
- Adds a custom type, which will appear in the list of nodes or resources. An icon can be optionally passed.
- When given node or resource is selected, the base type will be instanced (e.g. "Node3D", "Control", "Resource"), then the script will be loaded and set to this object.
- You can use the virtual method [method handles] to check if your custom object is being edited by checking the script or using the [code]is[/code] keyword.
- During run-time, this will be a simple object with a script so this function does not need to be called then.
- </description>
- </method>
- <method name="add_debugger_plugin">
- <return type="void">
- </return>
- <argument index="0" name="script" type="Script">
- </argument>
- <description>
- Adds a [Script] as debugger plugin to the Debugger. The script must extend [EditorDebuggerPlugin].
- </description>
- </method>
- <method name="add_export_plugin">
- <return type="void">
- </return>
- <argument index="0" name="plugin" type="EditorExportPlugin">
- </argument>
- <description>
- Registers a new [EditorExportPlugin]. Export plugins are used to perform tasks when the project is being exported.
- See [method add_inspector_plugin] for an example of how to register a plugin.
- </description>
- </method>
- <method name="add_import_plugin">
- <return type="void">
- </return>
- <argument index="0" name="importer" type="EditorImportPlugin">
- </argument>
- <description>
- Registers a new [EditorImportPlugin]. Import plugins are used to import custom and unsupported assets as a custom [Resource] type.
- [b]Note:[/b] If you want to import custom 3D asset formats use [method add_scene_import_plugin] instead.
- See [method add_inspector_plugin] for an example of how to register a plugin.
- </description>
- </method>
- <method name="add_inspector_plugin">
- <return type="void">
- </return>
- <argument index="0" name="plugin" type="EditorInspectorPlugin">
- </argument>
- <description>
- Registers a new [EditorInspectorPlugin]. Inspector plugins are used to extend [EditorInspector] and provide custom configuration tools for your object's properties.
- [b]Note:[/b] Always use [method remove_inspector_plugin] to remove the registered [EditorInspectorPlugin] when your [EditorPlugin] is disabled to prevent leaks and an unexpected behavior.
- [codeblocks]
- [gdscript]
- const MyInspectorPlugin = preload("res://addons/your_addon/path/to/your/script.gd")
- var inspector_plugin = MyInspectorPlugin.new()
-
- func _enter_tree():
- add_inspector_plugin(inspector_plugin)
-
- func _exit_tree():
- remove_inspector_plugin(inspector_plugin)
- [/gdscript]
- [/codeblocks]
- </description>
- </method>
- <method name="add_scene_import_plugin">
- <return type="void">
- </return>
- <argument index="0" name="scene_importer" type="EditorSceneImporter">
- </argument>
- <description>
- Registers a new [EditorSceneImporter]. Scene importers are used to import custom 3D asset formats as scenes.
- </description>
- </method>
- <method name="add_spatial_gizmo_plugin">
- <return type="void">
- </return>
- <argument index="0" name="plugin" type="EditorNode3DGizmoPlugin">
- </argument>
- <description>
- Registers a new [EditorNode3DGizmoPlugin]. Gizmo plugins are used to add custom gizmos to the 3D preview viewport for a [Node3D].
- See [method add_inspector_plugin] for an example of how to register a plugin.
- </description>
- </method>
- <method name="add_tool_menu_item">
- <return type="void">
- </return>
- <argument index="0" name="name" type="String">
- </argument>
- <argument index="1" name="callable" type="Callable">
- </argument>
- <description>
- Adds a custom menu item to [b]Project &gt; Tools[/b] named [code]name[/code]. When clicked, the provided [code]callable[/code] will be called.
- </description>
- </method>
- <method name="add_tool_submenu_item">
- <return type="void">
- </return>
- <argument index="0" name="name" type="String">
- </argument>
- <argument index="1" name="submenu" type="Object">
- </argument>
- <description>
- Adds a custom submenu under [b]Project &gt; Tools &gt;[/b] [code]name[/code]. [code]submenu[/code] should be an object of class [PopupMenu]. Use [code]remove_tool_menu_item(name)[/code] on plugin clean up to remove the menu.
- </description>
- </method>
- <method name="add_translation_parser_plugin">
- <return type="void">
- </return>
- <argument index="0" name="parser" type="EditorTranslationParserPlugin">
- </argument>
- <description>
- Registers a custom translation parser plugin for extracting translatable strings from custom files.
- </description>
- </method>
- <method name="add_undo_redo_inspector_hook_callback">
- <return type="void">
- </return>
- <argument index="0" name="callable" type="Callable">
- </argument>
- <description>
- Hooks a callback into the undo/redo action creation when a property is modified in the inspector. This allows, for example, to save other properties that may be lost when a given property is modified.
- The callback should have 4 arguments: [Object] [code]undo_redo[/code], [Object] [code]modified_object[/code], [String] [code]property[/code] and [Variant] [code]new_value[/code]. They are, respectively, the [UndoRedo] object used by the inspector, the currently modified object, the name of the modified property and the new value the property is about to take.
- </description>
- </method>
- <method name="apply_changes" qualifiers="virtual">
+ <method name="_apply_changes" qualifiers="virtual">
<return type="void">
</return>
<description>
@@ -196,29 +18,29 @@
This is used, for example, in shader editors to let the plugin know that it must apply the shader code being written by the user to the object.
</description>
</method>
- <method name="build" qualifiers="virtual">
+ <method name="_build" qualifiers="virtual">
<return type="bool">
</return>
<description>
This method is called when the editor is about to run the project. The plugin can then perform required operations before the project runs.
- This method must return a boolean. If this method returns [code]false[/code], the project will not run. The run is aborted immediately, so this also prevents all other plugins' [method build] methods from running.
+ This method must return a boolean. If this method returns [code]false[/code], the project will not run. The run is aborted immediately, so this also prevents all other plugins' [method _build] methods from running.
</description>
</method>
- <method name="clear" qualifiers="virtual">
+ <method name="_clear" qualifiers="virtual">
<return type="void">
</return>
<description>
Clear all the state and reset the object being edited to zero. This ensures your plugin does not keep editing a currently existing node, or a node from the wrong scene.
</description>
</method>
- <method name="disable_plugin" qualifiers="virtual">
+ <method name="_disable_plugin" qualifiers="virtual">
<return type="void">
</return>
<description>
Called by the engine when the user disables the [EditorPlugin] in the Plugin tab of the project settings window.
</description>
</method>
- <method name="edit" qualifiers="virtual">
+ <method name="_edit" qualifiers="virtual">
<return type="void">
</return>
<argument index="0" name="object" type="Object">
@@ -227,14 +49,14 @@
This function is used for plugins that edit specific object types (nodes or resources). It requests the editor to edit the given object.
</description>
</method>
- <method name="enable_plugin" qualifiers="virtual">
+ <method name="_enable_plugin" qualifiers="virtual">
<return type="void">
</return>
<description>
Called by the engine when the user enables the [EditorPlugin] in the Plugin tab of the project settings window.
</description>
</method>
- <method name="forward_canvas_draw_over_viewport" qualifiers="virtual">
+ <method name="_forward_canvas_draw_over_viewport" qualifiers="virtual">
<return type="void">
</return>
<argument index="0" name="overlay" type="Control">
@@ -243,11 +65,11 @@
Called by the engine when the 2D editor's viewport is updated. Use the [code]overlay[/code] [Control] for drawing. You can update the viewport manually by calling [method update_overlays].
[codeblocks]
[gdscript]
- func forward_canvas_draw_over_viewport(overlay):
+ func _forward_canvas_draw_over_viewport(overlay):
# Draw a circle at cursor position.
overlay.draw_circle(overlay.get_local_mouse_position(), 64, Color.white)
- func forward_canvas_gui_input(event):
+ func _forward_canvas_gui_input(event):
if event is InputEventMouseMotion:
# Redraw viewport when cursor is moved.
update_overlays()
@@ -274,27 +96,27 @@
[/codeblocks]
</description>
</method>
- <method name="forward_canvas_force_draw_over_viewport" qualifiers="virtual">
+ <method name="_forward_canvas_force_draw_over_viewport" qualifiers="virtual">
<return type="void">
</return>
<argument index="0" name="overlay" type="Control">
</argument>
<description>
- This method is the same as [method forward_canvas_draw_over_viewport], except it draws on top of everything. Useful when you need an extra layer that shows over anything else.
+ This method is the same as [method _forward_canvas_draw_over_viewport], except it draws on top of everything. Useful when you need an extra layer that shows over anything else.
You need to enable calling of this method by using [method set_force_draw_over_forwarding_enabled].
</description>
</method>
- <method name="forward_canvas_gui_input" qualifiers="virtual">
+ <method name="_forward_canvas_gui_input" qualifiers="virtual">
<return type="bool">
</return>
<argument index="0" name="event" type="InputEvent">
</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:
+ 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:
[codeblocks]
[gdscript]
# Prevents the InputEvent to reach other Editor classes
- func forward_canvas_gui_input(event):
+ func _forward_canvas_gui_input(event):
return true
[/gdscript]
[csharp]
@@ -309,7 +131,7 @@
[codeblocks]
[gdscript]
# Consumes InputEventMouseMotion and forwards other InputEvent types.
- func forward_canvas_gui_input(event):
+ func _forward_canvas_gui_input(event):
return event is InputEventMouseMotion
[/gdscript]
[csharp]
@@ -322,7 +144,7 @@
[/codeblocks]
</description>
</method>
- <method name="forward_spatial_draw_over_viewport" qualifiers="virtual">
+ <method name="_forward_spatial_draw_over_viewport" qualifiers="virtual">
<return type="void">
</return>
<argument index="0" name="overlay" type="Control">
@@ -331,11 +153,11 @@
Called by the engine when the 3D editor's viewport is updated. Use the [code]overlay[/code] [Control] for drawing. You can update the viewport manually by calling [method update_overlays].
[codeblocks]
[gdscript]
- func forward_spatial_draw_over_viewport(overlay):
+ func _forward_spatial_draw_over_viewport(overlay):
# Draw a circle at cursor position.
overlay.draw_circle(overlay.get_local_mouse_position(), 64)
- func forward_spatial_gui_input(camera, event):
+ func _forward_spatial_gui_input(camera, event):
if event is InputEventMouseMotion:
# Redraw viewport when cursor is moved.
update_overlays()
@@ -362,17 +184,17 @@
[/codeblocks]
</description>
</method>
- <method name="forward_spatial_force_draw_over_viewport" qualifiers="virtual">
+ <method name="_forward_spatial_force_draw_over_viewport" qualifiers="virtual">
<return type="void">
</return>
<argument index="0" name="overlay" type="Control">
</argument>
<description>
- This method is the same as [method forward_spatial_draw_over_viewport], except it draws on top of everything. Useful when you need an extra layer that shows over anything else.
+ This method is the same as [method _forward_spatial_draw_over_viewport], except it draws on top of everything. Useful when you need an extra layer that shows over anything else.
You need to enable calling of this method by using [method set_force_draw_over_forwarding_enabled].
</description>
</method>
- <method name="forward_spatial_gui_input" qualifiers="virtual">
+ <method name="_forward_spatial_gui_input" qualifiers="virtual">
<return type="bool">
</return>
<argument index="0" name="camera" type="Camera3D">
@@ -380,11 +202,11 @@
<argument index="1" name="event" type="InputEvent">
</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:
+ 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:
[codeblocks]
[gdscript]
# Prevents the InputEvent to reach other Editor classes.
- func forward_spatial_gui_input(camera, event):
+ func _forward_spatial_gui_input(camera, event):
return true
[/gdscript]
[csharp]
@@ -399,7 +221,7 @@
[codeblocks]
[gdscript]
# Consumes InputEventMouseMotion and forwards other InputEvent types.
- func forward_spatial_gui_input(camera, event):
+ func _forward_spatial_gui_input(camera, event):
return event is InputEventMouseMotion
[/gdscript]
[csharp]
@@ -412,21 +234,14 @@
[/codeblocks]
</description>
</method>
- <method name="get_breakpoints" qualifiers="virtual">
+ <method name="_get_breakpoints" qualifiers="virtual">
<return type="PackedStringArray">
</return>
<description>
This is for editors that edit script-based objects. You can return a list of breakpoints in the format ([code]script:line[/code]), for example: [code]res://path_to_script.gd:25[/code].
</description>
</method>
- <method name="get_editor_interface">
- <return type="EditorInterface">
- </return>
- <description>
- Returns the [EditorInterface] object that gives you control over Godot editor's window and its functionalities.
- </description>
- </method>
- <method name="get_plugin_icon" qualifiers="virtual">
+ <method name="_get_plugin_icon" qualifiers="virtual">
<return type="Texture2D">
</return>
<description>
@@ -435,7 +250,7 @@
Ideally, the plugin icon should be white with a transparent background and 16x16 pixels in size.
[codeblocks]
[gdscript]
- func get_plugin_icon():
+ 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:
@@ -453,7 +268,7 @@
[/codeblocks]
</description>
</method>
- <method name="get_plugin_name" qualifiers="virtual">
+ <method name="_get_plugin_name" qualifiers="virtual">
<return type="String">
</return>
<description>
@@ -461,75 +276,285 @@
For main screen plugins, this appears at the top of the screen, to the right of the "2D", "3D", "Script", and "AssetLib" buttons.
</description>
</method>
- <method name="get_script_create_dialog">
- <return type="ScriptCreateDialog">
+ <method name="_get_state" qualifiers="virtual">
+ <return type="Dictionary">
</return>
<description>
- Gets the Editor's dialogue used for making scripts.
- [b]Note:[/b] Users can configure it before use.
+ Gets the state of your plugin editor. This is used when saving the scene (so state is kept when opening it again) and for switching tabs (so state can be restored when the tab returns).
</description>
</method>
- <method name="get_state" qualifiers="virtual">
- <return type="Dictionary">
+ <method name="_get_window_layout" qualifiers="virtual">
+ <return type="void">
</return>
+ <argument index="0" name="layout" type="ConfigFile">
+ </argument>
<description>
- Gets the state of your plugin editor. This is used when saving the scene (so state is kept when opening it again) and for switching tabs (so state can be restored when the tab returns).
+ Gets the GUI layout of the plugin. This is used to save the project's editor layout when [method queue_save_layout] is called or the editor layout was changed(For example changing the position of a dock).
</description>
</method>
- <method name="get_undo_redo">
- <return type="UndoRedo">
+ <method name="_handles" qualifiers="virtual">
+ <return type="bool">
</return>
+ <argument index="0" name="object" type="Object">
+ </argument>
<description>
- Gets the undo/redo object. Most actions in the editor can be undoable, so use this object to make sure this happens when it's worth it.
+ Implement this function if your plugin edits a specific type of object (Resource or Node). If you return [code]true[/code], then you will get the functions [method _edit] and [method _make_visible] called when the editor requests them. If you have declared the methods [method _forward_canvas_gui_input] and [method _forward_spatial_gui_input] these will be called too.
+ </description>
+ </method>
+ <method name="_has_main_screen" qualifiers="virtual">
+ <return type="bool">
+ </return>
+ <description>
+ Returns [code]true[/code] if this is a main screen editor plugin (it goes in the workspace selector together with [b]2D[/b], [b]3D[/b], [b]Script[/b] and [b]AssetLib[/b]).
+ </description>
+ </method>
+ <method name="_make_visible" qualifiers="virtual">
+ <return type="void">
+ </return>
+ <argument index="0" name="visible" type="bool">
+ </argument>
+ <description>
+ This function will be called when the editor is requested to become visible. It is used for plugins that edit a specific object type.
+ Remember that you have to manage the visibility of all your editor controls manually.
+ </description>
+ </method>
+ <method name="_save_external_data" qualifiers="virtual">
+ <return type="void">
+ </return>
+ <description>
+ This method is called after the editor saves the project or when it's closed. It asks the plugin to save edited external scenes/resources.
+ </description>
+ </method>
+ <method name="_set_state" qualifiers="virtual">
+ <return type="void">
+ </return>
+ <argument index="0" name="state" type="Dictionary">
+ </argument>
+ <description>
+ Restore the state saved by [method _get_state].
</description>
</method>
- <method name="get_window_layout" qualifiers="virtual">
+ <method name="_set_window_layout" qualifiers="virtual">
<return type="void">
</return>
<argument index="0" name="layout" type="ConfigFile">
</argument>
<description>
- Gets the GUI layout of the plugin. This is used to save the project's editor layout when [method queue_save_layout] is called or the editor layout was changed(For example changing the position of a dock).
+ Restore the plugin GUI layout saved by [method _get_window_layout].
</description>
</method>
- <method name="handles" qualifiers="virtual">
- <return type="bool">
+ <method name="add_autoload_singleton">
+ <return type="void">
</return>
- <argument index="0" name="object" type="Object">
+ <argument index="0" name="name" type="String">
+ </argument>
+ <argument index="1" name="path" type="String">
</argument>
<description>
- Implement this function if your plugin edits a specific type of object (Resource or Node). If you return [code]true[/code], then you will get the functions [method edit] and [method make_visible] called when the editor requests them. If you have declared the methods [method forward_canvas_gui_input] and [method forward_spatial_gui_input] these will be called too.
+ Adds a script at [code]path[/code] to the Autoload list as [code]name[/code].
</description>
</method>
- <method name="has_main_screen" qualifiers="virtual">
- <return type="bool">
+ <method name="add_control_to_bottom_panel">
+ <return type="Button">
</return>
+ <argument index="0" name="control" type="Control">
+ </argument>
+ <argument index="1" name="title" type="String">
+ </argument>
<description>
- Returns [code]true[/code] if this is a main screen editor plugin (it goes in the workspace selector together with [b]2D[/b], [b]3D[/b], [b]Script[/b] and [b]AssetLib[/b]).
+ Adds a control to the bottom panel (together with Output, Debug, Animation, etc). Returns a reference to the button added. It's up to you to hide/show the button when needed. When your plugin is deactivated, make sure to remove your custom control with [method remove_control_from_bottom_panel] and free it with [method Node.queue_free].
</description>
</method>
- <method name="hide_bottom_panel">
+ <method name="add_control_to_container">
<return type="void">
</return>
+ <argument index="0" name="container" type="int" enum="EditorPlugin.CustomControlContainer">
+ </argument>
+ <argument index="1" name="control" type="Control">
+ </argument>
<description>
+ Adds a custom control to a container (see [enum CustomControlContainer]). There are many locations where custom controls can be added in the editor UI.
+ Please remember that you have to manage the visibility of your custom controls yourself (and likely hide it after adding it).
+ When your plugin is deactivated, make sure to remove your custom control with [method remove_control_from_container] and free it with [method Node.queue_free].
</description>
</method>
- <method name="make_bottom_panel_item_visible">
+ <method name="add_control_to_dock">
<return type="void">
</return>
- <argument index="0" name="item" type="Control">
+ <argument index="0" name="slot" type="int" enum="EditorPlugin.DockSlot">
+ </argument>
+ <argument index="1" name="control" type="Control">
</argument>
<description>
+ Adds the control to a specific dock slot (see [enum DockSlot] for options).
+ If the dock is repositioned and as long as the plugin is active, the editor will save the dock position on further sessions.
+ When your plugin is deactivated, make sure to remove your custom control with [method remove_control_from_docks] and free it with [method Node.queue_free].
</description>
</method>
- <method name="make_visible" qualifiers="virtual">
+ <method name="add_custom_type">
<return type="void">
</return>
- <argument index="0" name="visible" type="bool">
+ <argument index="0" name="type" type="String">
+ </argument>
+ <argument index="1" name="base" type="String">
+ </argument>
+ <argument index="2" name="script" type="Script">
+ </argument>
+ <argument index="3" name="icon" type="Texture2D">
+ </argument>
+ <description>
+ Adds a custom type, which will appear in the list of nodes or resources. An icon can be optionally passed.
+ When given node or resource is selected, the base type will be instanced (e.g. "Node3D", "Control", "Resource"), then the script will be loaded and set to this object.
+ You can use the virtual method [method _handles] to check if your custom object is being edited by checking the script or using the [code]is[/code] keyword.
+ During run-time, this will be a simple object with a script so this function does not need to be called then.
+ </description>
+ </method>
+ <method name="add_debugger_plugin">
+ <return type="void">
+ </return>
+ <argument index="0" name="script" type="Script">
+ </argument>
+ <description>
+ Adds a [Script] as debugger plugin to the Debugger. The script must extend [EditorDebuggerPlugin].
+ </description>
+ </method>
+ <method name="add_export_plugin">
+ <return type="void">
+ </return>
+ <argument index="0" name="plugin" type="EditorExportPlugin">
+ </argument>
+ <description>
+ Registers a new [EditorExportPlugin]. Export plugins are used to perform tasks when the project is being exported.
+ See [method add_inspector_plugin] for an example of how to register a plugin.
+ </description>
+ </method>
+ <method name="add_import_plugin">
+ <return type="void">
+ </return>
+ <argument index="0" name="importer" type="EditorImportPlugin">
+ </argument>
+ <description>
+ Registers a new [EditorImportPlugin]. Import plugins are used to import custom and unsupported assets as a custom [Resource] type.
+ [b]Note:[/b] If you want to import custom 3D asset formats use [method add_scene_import_plugin] instead.
+ See [method add_inspector_plugin] for an example of how to register a plugin.
+ </description>
+ </method>
+ <method name="add_inspector_plugin">
+ <return type="void">
+ </return>
+ <argument index="0" name="plugin" type="EditorInspectorPlugin">
+ </argument>
+ <description>
+ Registers a new [EditorInspectorPlugin]. Inspector plugins are used to extend [EditorInspector] and provide custom configuration tools for your object's properties.
+ [b]Note:[/b] Always use [method remove_inspector_plugin] to remove the registered [EditorInspectorPlugin] when your [EditorPlugin] is disabled to prevent leaks and an unexpected behavior.
+ [codeblocks]
+ [gdscript]
+ const MyInspectorPlugin = preload("res://addons/your_addon/path/to/your/script.gd")
+ var inspector_plugin = MyInspectorPlugin.new()
+
+ func _enter_tree():
+ add_inspector_plugin(inspector_plugin)
+
+ func _exit_tree():
+ remove_inspector_plugin(inspector_plugin)
+ [/gdscript]
+ [/codeblocks]
+ </description>
+ </method>
+ <method name="add_scene_import_plugin">
+ <return type="void">
+ </return>
+ <argument index="0" name="scene_importer" type="EditorSceneImporter">
+ </argument>
+ <description>
+ Registers a new [EditorSceneImporter]. Scene importers are used to import custom 3D asset formats as scenes.
+ </description>
+ </method>
+ <method name="add_spatial_gizmo_plugin">
+ <return type="void">
+ </return>
+ <argument index="0" name="plugin" type="EditorNode3DGizmoPlugin">
+ </argument>
+ <description>
+ Registers a new [EditorNode3DGizmoPlugin]. Gizmo plugins are used to add custom gizmos to the 3D preview viewport for a [Node3D].
+ See [method add_inspector_plugin] for an example of how to register a plugin.
+ </description>
+ </method>
+ <method name="add_tool_menu_item">
+ <return type="void">
+ </return>
+ <argument index="0" name="name" type="String">
+ </argument>
+ <argument index="1" name="callable" type="Callable">
+ </argument>
+ <description>
+ Adds a custom menu item to [b]Project &gt; Tools[/b] named [code]name[/code]. When clicked, the provided [code]callable[/code] will be called.
+ </description>
+ </method>
+ <method name="add_tool_submenu_item">
+ <return type="void">
+ </return>
+ <argument index="0" name="name" type="String">
+ </argument>
+ <argument index="1" name="submenu" type="Object">
+ </argument>
+ <description>
+ Adds a custom submenu under [b]Project &gt; Tools &gt;[/b] [code]name[/code]. [code]submenu[/code] should be an object of class [PopupMenu]. Use [code]remove_tool_menu_item(name)[/code] on plugin clean up to remove the menu.
+ </description>
+ </method>
+ <method name="add_translation_parser_plugin">
+ <return type="void">
+ </return>
+ <argument index="0" name="parser" type="EditorTranslationParserPlugin">
+ </argument>
+ <description>
+ Registers a custom translation parser plugin for extracting translatable strings from custom files.
+ </description>
+ </method>
+ <method name="add_undo_redo_inspector_hook_callback">
+ <return type="void">
+ </return>
+ <argument index="0" name="callable" type="Callable">
+ </argument>
+ <description>
+ Hooks a callback into the undo/redo action creation when a property is modified in the inspector. This allows, for example, to save other properties that may be lost when a given property is modified.
+ The callback should have 4 arguments: [Object] [code]undo_redo[/code], [Object] [code]modified_object[/code], [String] [code]property[/code] and [Variant] [code]new_value[/code]. They are, respectively, the [UndoRedo] object used by the inspector, the currently modified object, the name of the modified property and the new value the property is about to take.
+ </description>
+ </method>
+ <method name="get_editor_interface">
+ <return type="EditorInterface">
+ </return>
+ <description>
+ Returns the [EditorInterface] object that gives you control over Godot editor's window and its functionalities.
+ </description>
+ </method>
+ <method name="get_script_create_dialog">
+ <return type="ScriptCreateDialog">
+ </return>
+ <description>
+ Gets the Editor's dialogue used for making scripts.
+ [b]Note:[/b] Users can configure it before use.
+ </description>
+ </method>
+ <method name="get_undo_redo">
+ <return type="UndoRedo">
+ </return>
+ <description>
+ Gets the undo/redo object. Most actions in the editor can be undoable, so use this object to make sure this happens when it's worth it.
+ </description>
+ </method>
+ <method name="hide_bottom_panel">
+ <return type="void">
+ </return>
+ <description>
+ </description>
+ </method>
+ <method name="make_bottom_panel_item_visible">
+ <return type="void">
+ </return>
+ <argument index="0" name="item" type="Control">
</argument>
<description>
- This function will be called when the editor is requested to become visible. It is used for plugins that edit a specific object type.
- Remember that you have to manage the visibility of all your editor controls manually.
</description>
</method>
<method name="queue_save_layout">
@@ -667,50 +692,25 @@
Removes a callback previsously added by [method add_undo_redo_inspector_hook_callback].
</description>
</method>
- <method name="save_external_data" qualifiers="virtual">
- <return type="void">
- </return>
- <description>
- This method is called after the editor saves the project or when it's closed. It asks the plugin to save edited external scenes/resources.
- </description>
- </method>
<method name="set_force_draw_over_forwarding_enabled">
<return type="void">
</return>
<description>
- Enables calling of [method forward_canvas_force_draw_over_viewport] for the 2D editor and [method forward_spatial_force_draw_over_viewport] for the 3D editor when their viewports are updated. You need to call this method only once and it will work permanently for this plugin.
+ Enables calling of [method _forward_canvas_force_draw_over_viewport] for the 2D editor and [method _forward_spatial_force_draw_over_viewport] for the 3D editor when their viewports are updated. You need to call this method only once and it will work permanently for this plugin.
</description>
</method>
<method name="set_input_event_forwarding_always_enabled">
<return type="void">
</return>
<description>
- Use this method if you always want to receive inputs from 3D view screen inside [method forward_spatial_gui_input]. It might be especially usable if your plugin will want to use raycast in the scene.
- </description>
- </method>
- <method name="set_state" qualifiers="virtual">
- <return type="void">
- </return>
- <argument index="0" name="state" type="Dictionary">
- </argument>
- <description>
- Restore the state saved by [method get_state].
- </description>
- </method>
- <method name="set_window_layout" qualifiers="virtual">
- <return type="void">
- </return>
- <argument index="0" name="layout" type="ConfigFile">
- </argument>
- <description>
- Restore the plugin GUI layout saved by [method get_window_layout].
+ Use this method if you always want to receive inputs from 3D view screen inside [method _forward_spatial_gui_input]. It might be especially usable if your plugin will want to use raycast in the scene.
</description>
</method>
<method name="update_overlays" qualifiers="const">
<return type="int">
</return>
<description>
- Updates the overlays of the 2D and 3D editor viewport. Causes methods [method forward_canvas_draw_over_viewport], [method forward_canvas_force_draw_over_viewport], [method forward_spatial_draw_over_viewport] and [method forward_spatial_force_draw_over_viewport] to be called.
+ Updates the overlays of the 2D and 3D editor viewport. Causes methods [method _forward_canvas_draw_over_viewport], [method _forward_canvas_force_draw_over_viewport], [method _forward_spatial_draw_over_viewport] and [method _forward_spatial_force_draw_over_viewport] to be called.
</description>
</method>
</methods>
diff --git a/doc/classes/EditorProperty.xml b/doc/classes/EditorProperty.xml
index fd9fae435b..549d2c1628 100644
--- a/doc/classes/EditorProperty.xml
+++ b/doc/classes/EditorProperty.xml
@@ -9,6 +9,13 @@
<tutorials>
</tutorials>
<methods>
+ <method name="_update_property" qualifiers="virtual">
+ <return type="void">
+ </return>
+ <description>
+ When this virtual function is called, you must update your editor.
+ </description>
+ </method>
<method name="add_focusable">
<return type="void">
</return>
@@ -44,7 +51,7 @@
<return type="StringName">
</return>
<description>
- Gets the edited property. If your editor is for a single property (added via [method EditorInspectorPlugin.parse_property]), then this will return the property.
+ Gets the edited property. If your editor is for a single property (added via [method EditorInspectorPlugin._parse_property]), then this will return the property.
</description>
</method>
<method name="get_tooltip_text" qualifiers="const">
@@ -63,13 +70,6 @@
Adds controls with this function if you want them on the bottom (below the label).
</description>
</method>
- <method name="update_property" qualifiers="virtual">
- <return type="void">
- </return>
- <description>
- When this virtual function is called, you must update your editor.
- </description>
- </method>
</methods>
<members>
<member name="checkable" type="bool" setter="set_checkable" getter="is_checkable" default="false">
@@ -101,7 +101,7 @@
<argument index="1" name="value" type="Array">
</argument>
<description>
- Emit it if you want multiple properties modified at the same time. Do not use if added via [method EditorInspectorPlugin.parse_property].
+ Emit it if you want multiple properties modified at the same time. Do not use if added via [method EditorInspectorPlugin._parse_property].
</description>
</signal>
<signal name="object_id_selected">
diff --git a/doc/classes/EditorResourceConversionPlugin.xml b/doc/classes/EditorResourceConversionPlugin.xml
index 1976eb802c..1d7e98c99d 100644
--- a/doc/classes/EditorResourceConversionPlugin.xml
+++ b/doc/classes/EditorResourceConversionPlugin.xml
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8" ?>
-<class name="EditorResourceConversionPlugin" inherits="Reference" version="4.0">
+<class name="EditorResourceConversionPlugin" inherits="RefCounted" version="4.0">
<brief_description>
</brief_description>
<description>
diff --git a/doc/classes/EditorResourcePicker.xml b/doc/classes/EditorResourcePicker.xml
index 30c73daa77..0029955819 100644
--- a/doc/classes/EditorResourcePicker.xml
+++ b/doc/classes/EditorResourcePicker.xml
@@ -10,28 +10,23 @@
<tutorials>
</tutorials>
<methods>
- <method name="can_drop_data_fw" qualifiers="const">
- <return type="bool">
+ <method name="_handle_menu_selected" qualifiers="virtual">
+ <return type="void">
</return>
- <argument index="0" name="position" type="Vector2">
- </argument>
- <argument index="1" name="data" type="Variant">
- </argument>
- <argument index="2" name="from" type="Control">
+ <argument index="0" name="id" type="int">
</argument>
<description>
+ This virtual method can be implemented to handle context menu items not handled by default. See [method _set_create_options].
</description>
</method>
- <method name="drop_data_fw">
+ <method name="_set_create_options" qualifiers="virtual">
<return type="void">
</return>
- <argument index="0" name="position" type="Vector2">
- </argument>
- <argument index="1" name="data" type="Variant">
- </argument>
- <argument index="2" name="from" type="Control">
+ <argument index="0" name="menu_node" type="Object">
</argument>
<description>
+ This virtual method is called when updating the context menu of [EditorResourcePicker]. Implement this method to override the "New ..." items with your own options. [code]menu_node[/code] is a reference to the [PopupMenu] node.
+ [b]Note:[/b] Implement [method _handle_menu_selected] to handle these custom items.
</description>
</method>
<method name="get_allowed_types" qualifiers="const">
@@ -41,35 +36,6 @@
Returns a list of all allowed types and subtypes corresponding to the [member base_type]. If the [member base_type] is empty, an empty list is returned.
</description>
</method>
- <method name="get_drag_data_fw">
- <return type="Variant">
- </return>
- <argument index="0" name="position" type="Vector2">
- </argument>
- <argument index="1" name="from" type="Control">
- </argument>
- <description>
- </description>
- </method>
- <method name="handle_menu_selected" qualifiers="virtual">
- <return type="void">
- </return>
- <argument index="0" name="id" type="int">
- </argument>
- <description>
- This virtual method can be implemented to handle context menu items not handled by default. See [method set_create_options].
- </description>
- </method>
- <method name="set_create_options" qualifiers="virtual">
- <return type="void">
- </return>
- <argument index="0" name="menu_node" type="Object">
- </argument>
- <description>
- This virtual method is called when updating the context menu of [EditorResourcePicker]. Implement this method to override the "New ..." items with your own options. [code]menu_node[/code] is a reference to the [PopupMenu] node.
- [b]Note:[/b] Implement [method handle_menu_selected] to handle these custom items.
- </description>
- </method>
<method name="set_toggle_pressed">
<return type="void">
</return>
diff --git a/doc/classes/EditorResourcePreviewGenerator.xml b/doc/classes/EditorResourcePreviewGenerator.xml
index e935bf19fc..3594474e36 100644
--- a/doc/classes/EditorResourcePreviewGenerator.xml
+++ b/doc/classes/EditorResourcePreviewGenerator.xml
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8" ?>
-<class name="EditorResourcePreviewGenerator" inherits="Reference" version="4.0">
+<class name="EditorResourcePreviewGenerator" inherits="RefCounted" version="4.0">
<brief_description>
Custom generator of previews.
</brief_description>
@@ -9,15 +9,15 @@
<tutorials>
</tutorials>
<methods>
- <method name="can_generate_small_preview" qualifiers="virtual">
+ <method name="_can_generate_small_preview" qualifiers="virtual">
<return type="bool">
</return>
<description>
- If this function returns [code]true[/code], the generator will call [method generate] or [method generate_from_path] for small previews as well.
+ If this function returns [code]true[/code], the generator will call [method _generate] or [method _generate_from_path] for small previews as well.
By default, it returns [code]false[/code].
</description>
</method>
- <method name="generate" qualifiers="virtual">
+ <method name="_generate" qualifiers="virtual">
<return type="Texture2D">
</return>
<argument index="0" name="from" type="Resource">
@@ -30,7 +30,7 @@
Care must be taken because this function is always called from a thread (not the main thread).
</description>
</method>
- <method name="generate_from_path" qualifiers="virtual">
+ <method name="_generate_from_path" qualifiers="virtual">
<return type="Texture2D">
</return>
<argument index="0" name="path" type="String">
@@ -38,20 +38,20 @@
<argument index="1" name="size" type="Vector2">
</argument>
<description>
- Generate a preview directly from a path with the specified size. Implementing this is optional, as default code will load and call [method generate].
+ Generate a preview directly from a path with the specified size. Implementing this is optional, as default code will load and call [method _generate].
Returning an empty texture is an OK way to fail and let another generator take care.
Care must be taken because this function is always called from a thread (not the main thread).
</description>
</method>
- <method name="generate_small_preview_automatically" qualifiers="virtual">
+ <method name="_generate_small_preview_automatically" qualifiers="virtual">
<return type="bool">
</return>
<description>
- If this function returns [code]true[/code], the generator will automatically generate the small previews from the normal preview texture generated by the methods [method generate] or [method generate_from_path].
+ If this function returns [code]true[/code], the generator will automatically generate the small previews from the normal preview texture generated by the methods [method _generate] or [method _generate_from_path].
By default, it returns [code]false[/code].
</description>
</method>
- <method name="handles" qualifiers="virtual">
+ <method name="_handles" qualifiers="virtual">
<return type="bool">
</return>
<argument index="0" name="type" type="String">
diff --git a/doc/classes/EditorSceneImporter.xml b/doc/classes/EditorSceneImporter.xml
index aa55a1653d..8df3091057 100644
--- a/doc/classes/EditorSceneImporter.xml
+++ b/doc/classes/EditorSceneImporter.xml
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8" ?>
-<class name="EditorSceneImporter" inherits="Reference" version="4.0">
+<class name="EditorSceneImporter" inherits="RefCounted" version="4.0">
<brief_description>
Imports scenes from third-parties' 3D files.
</brief_description>
diff --git a/doc/classes/EditorScenePostImport.xml b/doc/classes/EditorScenePostImport.xml
index d1cdc4e43e..d2b5e84ff7 100644
--- a/doc/classes/EditorScenePostImport.xml
+++ b/doc/classes/EditorScenePostImport.xml
@@ -1,18 +1,18 @@
<?xml version="1.0" encoding="UTF-8" ?>
-<class name="EditorScenePostImport" inherits="Reference" version="4.0">
+<class name="EditorScenePostImport" inherits="RefCounted" version="4.0">
<brief_description>
Post-processes scenes after import.
</brief_description>
<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:
+ The [method _post_import] callback receives the imported scene's root node and returns the modified version of the scene. Usage example:
[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.
- func post_import(scene):
+ func _post_import(scene):
# Change all node names to "modified_[oldnodename]"
iterate(scene)
return scene # Remember to return the imported scene
@@ -55,14 +55,7 @@
<link title="Importing 3D scenes: Custom script">https://docs.godotengine.org/en/latest/getting_started/workflow/assets/importing_scenes.html#custom-script</link>
</tutorials>
<methods>
- <method name="get_source_file" qualifiers="const">
- <return type="String">
- </return>
- <description>
- Returns the source file path which got imported (e.g. [code]res://scene.dae[/code]).
- </description>
- </method>
- <method name="post_import" qualifiers="virtual">
+ <method name="_post_import" qualifiers="virtual">
<return type="Object">
</return>
<argument index="0" name="scene" type="Object">
@@ -71,6 +64,13 @@
Called after the scene was imported. This method must return the modified version of the scene.
</description>
</method>
+ <method name="get_source_file" qualifiers="const">
+ <return type="String">
+ </return>
+ <description>
+ Returns the source file path which got imported (e.g. [code]res://scene.dae[/code]).
+ </description>
+ </method>
</methods>
<constants>
</constants>
diff --git a/doc/classes/EditorScript.xml b/doc/classes/EditorScript.xml
index 60ccf451b8..a91ea0eb14 100644
--- a/doc/classes/EditorScript.xml
+++ b/doc/classes/EditorScript.xml
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8" ?>
-<class name="EditorScript" inherits="Reference" version="4.0">
+<class name="EditorScript" inherits="RefCounted" version="4.0">
<brief_description>
Base script that can be used to add extension functions to the editor.
</brief_description>
diff --git a/doc/classes/EditorSyntaxHighlighter.xml b/doc/classes/EditorSyntaxHighlighter.xml
index b80e81928f..d81b25345f 100644
--- a/doc/classes/EditorSyntaxHighlighter.xml
+++ b/doc/classes/EditorSyntaxHighlighter.xml
@@ -5,7 +5,7 @@
</brief_description>
<description>
Base syntax highlighter resource all editor syntax highlighters extend from, it is used in the [ScriptEditor].
- Add a syntax highlighter to an individual script by calling [method ScriptEditorBase.add_syntax_highlighter]. To apply to all scripts on open, call [method ScriptEditor.register_syntax_highlighter]
+ Add a syntax highlighter to an individual script by calling [method ScriptEditorBase._add_syntax_highlighter]. To apply to all scripts on open, call [method ScriptEditor.register_syntax_highlighter]
</description>
<tutorials>
</tutorials>
diff --git a/doc/classes/EditorTranslationParserPlugin.xml b/doc/classes/EditorTranslationParserPlugin.xml
index c97459d9dc..a9f4e90e72 100644
--- a/doc/classes/EditorTranslationParserPlugin.xml
+++ b/doc/classes/EditorTranslationParserPlugin.xml
@@ -1,10 +1,10 @@
<?xml version="1.0" encoding="UTF-8" ?>
-<class name="EditorTranslationParserPlugin" inherits="Reference" version="4.0">
+<class name="EditorTranslationParserPlugin" inherits="RefCounted" version="4.0">
<brief_description>
Plugin for adding custom parsers to extract strings that are to be translated from custom files (.csv, .json etc.).
</brief_description>
<description>
- Plugins are registered via [method EditorPlugin.add_translation_parser_plugin] method. To define the parsing and string extraction logic, override the [method parse_file] method in script.
+ Plugins are registered via [method EditorPlugin.add_translation_parser_plugin] method. To define the parsing and string extraction logic, override the [method _parse_file] method in script.
Add the extracted strings to argument [code]msgids[/code] or [code]msgids_context_plural[/code] if context or plural is used.
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.
@@ -14,7 +14,7 @@
tool
extends EditorTranslationParserPlugin
- func parse_file(path, msgids, msgids_context_plural):
+ func _parse_file(path, msgids, msgids_context_plural):
var file = File.new()
file.open(path, File.READ)
var text = file.get_as_text()
@@ -23,7 +23,7 @@
msgids.append(s)
#print("Extracted string: " + s)
- func get_recognized_extensions():
+ func _get_recognized_extensions():
return ["csv"]
[/gdscript]
[csharp]
@@ -76,12 +76,12 @@
For example:
[codeblocks]
[gdscript]
- func parse_file(path, msgids, msgids_context_plural):
+ func _parse_file(path, msgids, msgids_context_plural):
var res = ResourceLoader.load(path, "Script")
var text = res.source_code
# Parsing logic.
- func get_recognized_extensions():
+ func _get_recognized_extensions():
return ["gd"]
[/gdscript]
[csharp]
@@ -102,14 +102,14 @@
<tutorials>
</tutorials>
<methods>
- <method name="get_recognized_extensions" qualifiers="virtual">
+ <method name="_get_recognized_extensions" qualifiers="virtual">
<return type="Array">
</return>
<description>
Gets the list of file extensions to associate with this parser, e.g. [code]["csv"][/code].
</description>
</method>
- <method name="parse_file" qualifiers="virtual">
+ <method name="_parse_file" qualifiers="virtual">
<return type="void">
</return>
<argument index="0" name="path" type="String">
diff --git a/doc/classes/EncodedObjectAsID.xml b/doc/classes/EncodedObjectAsID.xml
index 1e4fde453b..e3e36590a3 100644
--- a/doc/classes/EncodedObjectAsID.xml
+++ b/doc/classes/EncodedObjectAsID.xml
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8" ?>
-<class name="EncodedObjectAsID" inherits="Reference" version="4.0">
+<class name="EncodedObjectAsID" inherits="RefCounted" version="4.0">
<brief_description>
Holds a reference to an [Object]'s instance ID.
</brief_description>
diff --git a/doc/classes/Expression.xml b/doc/classes/Expression.xml
index d777c6fd9d..e41de4c4ed 100644
--- a/doc/classes/Expression.xml
+++ b/doc/classes/Expression.xml
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8" ?>
-<class name="Expression" inherits="Reference" version="4.0">
+<class name="Expression" inherits="RefCounted" version="4.0">
<brief_description>
A class that stores an expression you can execute.
</brief_description>
diff --git a/doc/classes/File.xml b/doc/classes/File.xml
index ea3b82dc54..7feaaa2040 100644
--- a/doc/classes/File.xml
+++ b/doc/classes/File.xml
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8" ?>
-<class name="File" inherits="Reference" version="4.0">
+<class name="File" inherits="RefCounted" version="4.0">
<brief_description>
Type to handle file reading and writing operations.
</brief_description>
@@ -188,7 +188,7 @@
<argument index="0" name="file" type="String">
</argument>
<description>
- Returns the last time the [code]file[/code] was modified in unix timestamp format or returns a [String] "ERROR IN [code]file[/code]". This unix timestamp can be converted to datetime by using [method OS.get_datetime_from_unix_time].
+ Returns the last time the [code]file[/code] was modified in Unix timestamp format or returns a [String] "ERROR IN [code]file[/code]". This Unix timestamp can be converted to another format using the [Time] singleton.
</description>
</method>
<method name="get_pascal_string">
diff --git a/doc/classes/FileSystemDock.xml b/doc/classes/FileSystemDock.xml
index c553f90e37..15f92e90e3 100644
--- a/doc/classes/FileSystemDock.xml
+++ b/doc/classes/FileSystemDock.xml
@@ -7,40 +7,6 @@
<tutorials>
</tutorials>
<methods>
- <method name="can_drop_data_fw" qualifiers="const">
- <return type="bool">
- </return>
- <argument index="0" name="position" type="Vector2">
- </argument>
- <argument index="1" name="data" type="Variant">
- </argument>
- <argument index="2" name="from" type="Control">
- </argument>
- <description>
- </description>
- </method>
- <method name="drop_data_fw">
- <return type="void">
- </return>
- <argument index="0" name="position" type="Vector2">
- </argument>
- <argument index="1" name="data" type="Variant">
- </argument>
- <argument index="2" name="from" type="Control">
- </argument>
- <description>
- </description>
- </method>
- <method name="get_drag_data_fw">
- <return type="Variant">
- </return>
- <argument index="0" name="position" type="Vector2">
- </argument>
- <argument index="1" name="from" type="Control">
- </argument>
- <description>
- </description>
- </method>
<method name="navigate_to_path">
<return type="void">
</return>
diff --git a/doc/classes/GeometryInstance3D.xml b/doc/classes/GeometryInstance3D.xml
index b2c3bfc3ed..667ca2dacf 100644
--- a/doc/classes/GeometryInstance3D.xml
+++ b/doc/classes/GeometryInstance3D.xml
@@ -52,25 +52,21 @@
</member>
<member name="lod_bias" type="float" setter="set_lod_bias" getter="get_lod_bias" default="1.0">
</member>
- <member name="lod_max_distance" type="float" setter="set_lod_max_distance" getter="get_lod_max_distance" default="0.0">
- The GeometryInstance3D's max LOD distance.
- [b]Note:[/b] This property currently has no effect.
+ <member name="material_override" type="Material" setter="set_material_override" getter="get_material_override">
+ The material override for the whole geometry.
+ If a material is assigned to this property, it will be used instead of any material set in any material slot of the mesh.
</member>
- <member name="lod_max_hysteresis" type="float" setter="set_lod_max_hysteresis" getter="get_lod_max_hysteresis" default="0.0">
- The GeometryInstance3D's max LOD margin.
- [b]Note:[/b] This property currently has no effect.
+ <member name="visibility_range_begin" type="float" setter="set_visibility_range_begin" getter="get_visibility_range_begin" default="0.0">
+ Starting distance from which the GeometryInstance3D will be visible, taking [member visibility_range_begin_margin] into account as well. The default value of 0 is used to disable the range check.
</member>
- <member name="lod_min_distance" type="float" setter="set_lod_min_distance" getter="get_lod_min_distance" default="0.0">
- The GeometryInstance3D's min LOD distance.
- [b]Note:[/b] This property currently has no effect.
+ <member name="visibility_range_begin_margin" type="float" setter="set_visibility_range_begin_margin" getter="get_visibility_range_begin_margin" default="0.0">
+ Margin for the [member visibility_range_begin] threshold. The GeometryInstance3D will only change its visibility state when it goes over or under the [member visibility_range_begin] threshold by this amount.
</member>
- <member name="lod_min_hysteresis" type="float" setter="set_lod_min_hysteresis" getter="get_lod_min_hysteresis" default="0.0">
- The GeometryInstance3D's min LOD margin.
- [b]Note:[/b] This property currently has no effect.
+ <member name="visibility_range_end" type="float" setter="set_visibility_range_end" getter="get_visibility_range_end" default="0.0">
+ Distance from which the GeometryInstance3D will be hidden, taking [member visibility_range_end_margin] into account as well. The default value of 0 is used to disable the range check..
</member>
- <member name="material_override" type="Material" setter="set_material_override" getter="get_material_override">
- The material override for the whole geometry.
- If a material is assigned to this property, it will be used instead of any material set in any material slot of the mesh.
+ <member name="visibility_range_end_margin" type="float" setter="set_visibility_range_end_margin" getter="get_visibility_range_end_margin" default="0.0">
+ Margin for the [member visibility_range_end] threshold. The GeometryInstance3D will only change its visibility state when it goes over or under the [member visibility_range_end] threshold by this amount.
</member>
</members>
<constants>
diff --git a/doc/classes/HMACContext.xml b/doc/classes/HMACContext.xml
index 00d528ef8f..9fa96e5ddf 100644
--- a/doc/classes/HMACContext.xml
+++ b/doc/classes/HMACContext.xml
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8" ?>
-<class name="HMACContext" inherits="Reference" version="4.0">
+<class name="HMACContext" inherits="RefCounted" version="4.0">
<brief_description>
Used to create an HMAC for a message using a key.
</brief_description>
diff --git a/doc/classes/HTTPClient.xml b/doc/classes/HTTPClient.xml
index ddfcdf7724..a549994a69 100644
--- a/doc/classes/HTTPClient.xml
+++ b/doc/classes/HTTPClient.xml
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8" ?>
-<class name="HTTPClient" inherits="Reference" version="4.0">
+<class name="HTTPClient" inherits="RefCounted" version="4.0">
<brief_description>
Low-level hyper-text transfer protocol client.
</brief_description>
diff --git a/doc/classes/HashingContext.xml b/doc/classes/HashingContext.xml
index e020293d76..1c7b7ca937 100644
--- a/doc/classes/HashingContext.xml
+++ b/doc/classes/HashingContext.xml
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8" ?>
-<class name="HashingContext" inherits="Reference" version="4.0">
+<class name="HashingContext" inherits="RefCounted" version="4.0">
<brief_description>
Context to compute cryptographic hashes over multiple iterations.
</brief_description>
diff --git a/doc/classes/JSON.xml b/doc/classes/JSON.xml
index a9fb50c262..7baff7aa39 100644
--- a/doc/classes/JSON.xml
+++ b/doc/classes/JSON.xml
@@ -27,9 +27,12 @@
</argument>
<argument index="2" name="sort_keys" type="bool" default="false">
</argument>
+ <argument index="3" name="full_precision" type="bool" default="false">
+ </argument>
<description>
Converts a [Variant] var to JSON text and returns the result. Useful for serializing data to store or send over the network.
[b]Note:[/b] The JSON specification does not define integer or float types, but only a [i]number[/i] type. Therefore, converting a Variant to JSON text will convert all numerical values to [float] types.
+ [b]Note:[/b] If [code]full_precision[/code] is true, when printing floats, the unreliable digits are printed in addition to the reliable digits to guarantee exact decoding.
Use [code]indent[/code] parameter to pretty print the output.
[b]Example output:[/b]
[codeblock]
diff --git a/doc/classes/JSONParseResult.xml b/doc/classes/JSONParseResult.xml
index bc94f74b07..7311343b68 100644
--- a/doc/classes/JSONParseResult.xml
+++ b/doc/classes/JSONParseResult.xml
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8" ?>
-<class name="JSONParseResult" inherits="Reference" version="4.0">
+<class name="JSONParseResult" inherits="RefCounted" version="4.0">
<brief_description>
Data class wrapper for decoded JSON.
</brief_description>
diff --git a/doc/classes/JSONParser.xml b/doc/classes/JSONParser.xml
index 31ba295418..991629f255 100644
--- a/doc/classes/JSONParser.xml
+++ b/doc/classes/JSONParser.xml
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8" ?>
-<class name="JSONParser" inherits="Reference" version="4.0">
+<class name="JSONParser" inherits="RefCounted" version="4.0">
<brief_description>
</brief_description>
<description>
diff --git a/doc/classes/JavaClass.xml b/doc/classes/JavaClass.xml
index 69b7a9b718..0b6a44fe14 100644
--- a/doc/classes/JavaClass.xml
+++ b/doc/classes/JavaClass.xml
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8" ?>
-<class name="JavaClass" inherits="Reference" version="4.0">
+<class name="JavaClass" inherits="RefCounted" version="4.0">
<brief_description>
</brief_description>
<description>
diff --git a/doc/classes/JavaScriptObject.xml b/doc/classes/JavaScriptObject.xml
index a9e9c77e89..087fe163b4 100644
--- a/doc/classes/JavaScriptObject.xml
+++ b/doc/classes/JavaScriptObject.xml
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8" ?>
-<class name="JavaScriptObject" inherits="Reference" version="4.0">
+<class name="JavaScriptObject" inherits="RefCounted" version="4.0">
<brief_description>
A wrapper class for native JavaScript objects.
</brief_description>
diff --git a/doc/classes/KinematicCollision2D.xml b/doc/classes/KinematicCollision2D.xml
index 8748f89618..5480d7d55f 100644
--- a/doc/classes/KinematicCollision2D.xml
+++ b/doc/classes/KinematicCollision2D.xml
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8" ?>
-<class name="KinematicCollision2D" inherits="Reference" version="4.0">
+<class name="KinematicCollision2D" inherits="RefCounted" version="4.0">
<brief_description>
Collision data for [method PhysicsBody2D.move_and_collide] collisions.
</brief_description>
diff --git a/doc/classes/KinematicCollision3D.xml b/doc/classes/KinematicCollision3D.xml
index 8eac15ebf4..329efab474 100644
--- a/doc/classes/KinematicCollision3D.xml
+++ b/doc/classes/KinematicCollision3D.xml
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8" ?>
-<class name="KinematicCollision3D" inherits="Reference" version="4.0">
+<class name="KinematicCollision3D" inherits="RefCounted" version="4.0">
<brief_description>
Collision data for [method PhysicsBody3D.move_and_collide] collisions.
</brief_description>
diff --git a/doc/classes/Lightmapper.xml b/doc/classes/Lightmapper.xml
index e80194858a..79fae42d68 100644
--- a/doc/classes/Lightmapper.xml
+++ b/doc/classes/Lightmapper.xml
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8" ?>
-<class name="Lightmapper" inherits="Reference" version="4.0">
+<class name="Lightmapper" inherits="RefCounted" version="4.0">
<brief_description>
</brief_description>
<description>
diff --git a/doc/classes/MeshDataTool.xml b/doc/classes/MeshDataTool.xml
index 3c679047a0..da02511dc0 100644
--- a/doc/classes/MeshDataTool.xml
+++ b/doc/classes/MeshDataTool.xml
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8" ?>
-<class name="MeshDataTool" inherits="Reference" version="4.0">
+<class name="MeshDataTool" inherits="RefCounted" version="4.0">
<brief_description>
Helper tool to access and edit [Mesh] data.
</brief_description>
diff --git a/doc/classes/MultiplayerAPI.xml b/doc/classes/MultiplayerAPI.xml
index b2be92dbbd..5de5703d95 100644
--- a/doc/classes/MultiplayerAPI.xml
+++ b/doc/classes/MultiplayerAPI.xml
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8" ?>
-<class name="MultiplayerAPI" inherits="Reference" version="4.0">
+<class name="MultiplayerAPI" inherits="RefCounted" version="4.0">
<brief_description>
High-level multiplayer API.
</brief_description>
diff --git a/doc/classes/Mutex.xml b/doc/classes/Mutex.xml
index f5f6308401..dfda614f8e 100644
--- a/doc/classes/Mutex.xml
+++ b/doc/classes/Mutex.xml
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8" ?>
-<class name="Mutex" inherits="Reference" version="4.0">
+<class name="Mutex" inherits="RefCounted" version="4.0">
<brief_description>
A synchronization mutex (mutual exclusion).
</brief_description>
diff --git a/doc/classes/Node3D.xml b/doc/classes/Node3D.xml
index a6237708c6..1c161803db 100644
--- a/doc/classes/Node3D.xml
+++ b/doc/classes/Node3D.xml
@@ -20,7 +20,7 @@
Forces the transform to update. Transform changes in physics are not instant for performance reasons. Transforms are accumulated and then set. Use this if you need an up-to-date transform when doing physics operations.
</description>
</method>
- <method name="get_parent_spatial" qualifiers="const">
+ <method name="get_parent_node_3d" qualifiers="const">
<return type="Node3D">
</return>
<description>
@@ -310,6 +310,9 @@
<member name="transform" type="Transform3D" setter="set_transform" getter="get_transform" default="Transform3D( 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0 )">
Local space [Transform3D] of this node, with respect to the parent node.
</member>
+ <member name="visibility_parent" type="NodePath" setter="set_visibility_parent" getter="get_visibility_parent" default="NodePath(&quot;&quot;)">
+ Defines the visibility range parent for this node and its subtree. The visibility parent must be a GeometryInstance3D. Any visual instance will only be visible if the visibility parent (and all of its visibility ancestors) is hidden by being closer to the camera than its own [member GeometryInstance3D.visibility_range_begin]. Nodes hidden via the [member Node3D.visible] property are essentially removed from the visibility dependency tree, so dependant instances will not take the hidden node or its ancestors into account.
+ </member>
<member name="visible" type="bool" setter="set_visible" getter="is_visible" default="true">
If [code]true[/code], this node is drawn. The node is only visible if all of its antecedents are visible as well (in other words, [method is_visible_in_tree] must return [code]true[/code]).
</member>
diff --git a/doc/classes/Node3DGizmo.xml b/doc/classes/Node3DGizmo.xml
index 55080614fc..c561047332 100644
--- a/doc/classes/Node3DGizmo.xml
+++ b/doc/classes/Node3DGizmo.xml
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8" ?>
-<class name="Node3DGizmo" inherits="Reference" version="4.0">
+<class name="Node3DGizmo" inherits="RefCounted" version="4.0">
<brief_description>
</brief_description>
<description>
diff --git a/doc/classes/OS.xml b/doc/classes/OS.xml
index c755c73465..bfcd5b1beb 100644
--- a/doc/classes/OS.xml
+++ b/doc/classes/OS.xml
@@ -176,34 +176,6 @@
[b]Note:[/b] This method is implemented on Linux, macOS and Windows.
</description>
</method>
- <method name="get_date" qualifiers="const">
- <return type="Dictionary">
- </return>
- <argument index="0" name="utc" type="bool" default="false">
- </argument>
- <description>
- Returns current date as a dictionary of keys: [code]year[/code], [code]month[/code], [code]day[/code], [code]weekday[/code], [code]dst[/code] (Daylight Savings Time).
- </description>
- </method>
- <method name="get_datetime" qualifiers="const">
- <return type="Dictionary">
- </return>
- <argument index="0" name="utc" type="bool" default="false">
- </argument>
- <description>
- Returns current datetime as a dictionary of keys: [code]year[/code], [code]month[/code], [code]day[/code], [code]weekday[/code], [code]dst[/code] (Daylight Savings Time), [code]hour[/code], [code]minute[/code], [code]second[/code].
- </description>
- </method>
- <method name="get_datetime_from_unix_time" qualifiers="const">
- <return type="Dictionary">
- </return>
- <argument index="0" name="unix_time_val" type="int">
- </argument>
- <description>
- Gets a dictionary of time values corresponding to the given UNIX epoch time (in seconds).
- The returned Dictionary's values will be the same as [method get_datetime], with the exception of Daylight Savings Time as it cannot be determined from the epoch.
- </description>
- </method>
<method name="get_environment" qualifiers="const">
<return type="String">
</return>
@@ -320,36 +292,6 @@
[b]Note:[/b] Thread IDs are not deterministic and may be reused across application restarts.
</description>
</method>
- <method name="get_ticks_msec" qualifiers="const">
- <return type="int">
- </return>
- <description>
- Returns the amount of time passed in milliseconds since the engine started.
- </description>
- </method>
- <method name="get_ticks_usec" qualifiers="const">
- <return type="int">
- </return>
- <description>
- Returns the amount of time passed in microseconds since the engine started.
- </description>
- </method>
- <method name="get_time" qualifiers="const">
- <return type="Dictionary">
- </return>
- <argument index="0" name="utc" type="bool" default="false">
- </argument>
- <description>
- Returns current time as a dictionary of keys: hour, minute, second.
- </description>
- </method>
- <method name="get_time_zone_info" qualifiers="const">
- <return type="Dictionary">
- </return>
- <description>
- Returns the current time zone as a dictionary with the keys: bias and name.
- </description>
- </method>
<method name="get_unique_id" qualifiers="const">
<return type="String">
</return>
@@ -359,26 +301,6 @@
[b]Note:[/b] Returns an empty string on HTML5 and UWP, as this method isn't implemented on those platforms yet.
</description>
</method>
- <method name="get_unix_time" qualifiers="const">
- <return type="float">
- </return>
- <description>
- Returns the current UNIX epoch timestamp in seconds.
- [b]Important:[/b] This is the system clock that the user can manually set. [b]Never use[/b] this method for precise time calculation since its results are also subject to automatic adjustments by the operating system. [b]Always use[/b] [method get_ticks_usec] or [method get_ticks_msec] for precise time calculation instead, since they are guaranteed to be monotonic (i.e. never decrease).
- </description>
- </method>
- <method name="get_unix_time_from_datetime" qualifiers="const">
- <return type="int">
- </return>
- <argument index="0" name="datetime" type="Dictionary">
- </argument>
- <description>
- Gets an epoch time value from a dictionary of time values.
- [code]datetime[/code] must be populated with the following keys: [code]year[/code], [code]month[/code], [code]day[/code], [code]hour[/code], [code]minute[/code], [code]second[/code].
- If the dictionary is empty [code]0[/code] is returned. If some keys are omitted, they default to the equivalent values for the UNIX epoch timestamp 0 (1970-01-01 at 00:00:00 UTC).
- You can pass the output from [method get_datetime_from_unix_time] directly into this function. Daylight Savings Time ([code]dst[/code]), if present, is ignored.
- </description>
- </method>
<method name="get_user_data_dir" qualifiers="const">
<return type="String">
</return>
diff --git a/doc/classes/Object.xml b/doc/classes/Object.xml
index 7da9c1ac38..f5dcd6bcdc 100644
--- a/doc/classes/Object.xml
+++ b/doc/classes/Object.xml
@@ -7,7 +7,7 @@
Every class which is not a built-in type inherits from this class.
You can construct Objects from scripting languages, using [code]Object.new()[/code] in GDScript, [code]new Object[/code] in C#, or the "Construct Object" node in VisualScript.
Objects do not manage memory. If a class inherits from Object, you will have to delete instances of it manually. To do so, call the [method free] method from your script or delete the instance from C++.
- Some classes that extend Object add memory management. This is the case of [Reference], which counts references and deletes itself automatically when no longer referenced. [Node], another fundamental type, deletes all its children when freed from memory.
+ Some classes that extend Object add memory management. This is the case of [RefCounted], which counts references and deletes itself automatically when no longer referenced. [Node], another fundamental type, deletes all its children when freed from memory.
Objects export properties, which are mainly useful for storage and editing, but not really so much in programming. Properties are exported in [method _get_property_list] and handled in [method _get] and [method _set]. However, scripting languages and C++ have simpler means to export them.
Property membership can be tested directly in GDScript using [code]in[/code]:
[codeblocks]
@@ -26,7 +26,7 @@
[/codeblocks]
The [code]in[/code] operator will evaluate to [code]true[/code] as long as the key exists, even if the value is [code]null[/code].
Objects also receive notifications. Notifications are a simple way to notify the object about different events, so they can all be handled together. See [method _notification].
- [b]Note:[/b] Unlike references to a [Reference], references to an Object stored in a variable can become invalid without warning. Therefore, it's recommended to use [Reference] for data classes instead of [Object].
+ [b]Note:[/b] Unlike references to a [RefCounted], references to an Object stored in a variable can become invalid without warning. Therefore, it's recommended to use [RefCounted] for data classes instead of [Object].
</description>
<tutorials>
<link title="When and how to avoid using nodes for everything">https://docs.godotengine.org/en/latest/getting_started/workflow/best_practices/node_alternatives.html</link>
diff --git a/doc/classes/PCKPacker.xml b/doc/classes/PCKPacker.xml
index e3c78e08f1..40e8683c93 100644
--- a/doc/classes/PCKPacker.xml
+++ b/doc/classes/PCKPacker.xml
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8" ?>
-<class name="PCKPacker" inherits="Reference" version="4.0">
+<class name="PCKPacker" inherits="RefCounted" version="4.0">
<brief_description>
Creates packages that can be loaded into a running project.
</brief_description>
diff --git a/doc/classes/PackedDataContainerRef.xml b/doc/classes/PackedDataContainerRef.xml
index f0f59675de..bfd5a6f1c1 100644
--- a/doc/classes/PackedDataContainerRef.xml
+++ b/doc/classes/PackedDataContainerRef.xml
@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="UTF-8" ?>
-<class name="PackedDataContainerRef" inherits="Reference" version="4.0">
+<class name="PackedDataContainerRef" inherits="RefCounted" version="4.0">
<brief_description>
- Reference version of [PackedDataContainer].
+ Reference-counted version of [PackedDataContainer].
</brief_description>
<description>
</description>
diff --git a/doc/classes/PacketPeer.xml b/doc/classes/PacketPeer.xml
index e3e2f63e14..0a758c2cd6 100644
--- a/doc/classes/PacketPeer.xml
+++ b/doc/classes/PacketPeer.xml
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8" ?>
-<class name="PacketPeer" inherits="Reference" version="4.0">
+<class name="PacketPeer" inherits="RefCounted" version="4.0">
<brief_description>
Abstraction and base class for packet-based protocols.
</brief_description>
diff --git a/doc/classes/PhysicsShapeQueryParameters2D.xml b/doc/classes/PhysicsShapeQueryParameters2D.xml
index 4d7fc61517..92bd9b136a 100644
--- a/doc/classes/PhysicsShapeQueryParameters2D.xml
+++ b/doc/classes/PhysicsShapeQueryParameters2D.xml
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8" ?>
-<class name="PhysicsShapeQueryParameters2D" inherits="Reference" version="4.0">
+<class name="PhysicsShapeQueryParameters2D" inherits="RefCounted" version="4.0">
<brief_description>
Parameters to be sent to a 2D shape physics query.
</brief_description>
diff --git a/doc/classes/PhysicsShapeQueryParameters3D.xml b/doc/classes/PhysicsShapeQueryParameters3D.xml
index 79bc29057f..087c52a650 100644
--- a/doc/classes/PhysicsShapeQueryParameters3D.xml
+++ b/doc/classes/PhysicsShapeQueryParameters3D.xml
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8" ?>
-<class name="PhysicsShapeQueryParameters3D" inherits="Reference" version="4.0">
+<class name="PhysicsShapeQueryParameters3D" inherits="RefCounted" version="4.0">
<brief_description>
Parameters to be sent to a 3D shape physics query.
</brief_description>
diff --git a/doc/classes/PhysicsShapeQueryResult2D.xml b/doc/classes/PhysicsShapeQueryResult2D.xml
index 227683cc33..07b7bc90e2 100644
--- a/doc/classes/PhysicsShapeQueryResult2D.xml
+++ b/doc/classes/PhysicsShapeQueryResult2D.xml
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8" ?>
-<class name="PhysicsShapeQueryResult2D" inherits="Reference" version="4.0">
+<class name="PhysicsShapeQueryResult2D" inherits="RefCounted" version="4.0">
<brief_description>
Result of a 2D shape query in [PhysicsServer2D].
</brief_description>
diff --git a/doc/classes/PhysicsShapeQueryResult3D.xml b/doc/classes/PhysicsShapeQueryResult3D.xml
index 4555c4e242..d0ca227a68 100644
--- a/doc/classes/PhysicsShapeQueryResult3D.xml
+++ b/doc/classes/PhysicsShapeQueryResult3D.xml
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8" ?>
-<class name="PhysicsShapeQueryResult3D" inherits="Reference" version="4.0">
+<class name="PhysicsShapeQueryResult3D" inherits="RefCounted" version="4.0">
<brief_description>
Result of a 3D shape query in [PhysicsServer3D].
</brief_description>
diff --git a/doc/classes/PhysicsTestMotionResult2D.xml b/doc/classes/PhysicsTestMotionResult2D.xml
index 301cff2885..2744aa17a1 100644
--- a/doc/classes/PhysicsTestMotionResult2D.xml
+++ b/doc/classes/PhysicsTestMotionResult2D.xml
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8" ?>
-<class name="PhysicsTestMotionResult2D" inherits="Reference" version="4.0">
+<class name="PhysicsTestMotionResult2D" inherits="RefCounted" version="4.0">
<brief_description>
</brief_description>
<description>
diff --git a/doc/classes/ProjectSettings.xml b/doc/classes/ProjectSettings.xml
index efd4793b4c..360ccc597e 100644
--- a/doc/classes/ProjectSettings.xml
+++ b/doc/classes/ProjectSettings.xml
@@ -1574,20 +1574,31 @@
<member name="rendering/textures/default_filters/use_nearest_mipmap_filter" type="bool" setter="" getter="" default="false">
If [code]true[/code], uses nearest-neighbor mipmap filtering when using mipmaps (also called "bilinear filtering"), which will result in visible seams appearing between mipmap stages. This may increase performance in mobile as less memory bandwidth is used. If [code]false[/code], linear mipmap filtering (also called "trilinear filtering") is used.
</member>
+ <member name="rendering/textures/lossless_compression/force_png" type="bool" setter="" getter="" default="false">
+ If [code]true[/code], the texture importer will import lossless textures using the PNG format. Otherwise, it will default to using WebP.
+ </member>
+ <member name="rendering/textures/lossless_compression/webp_compression_level" type="int" setter="" getter="" default="2">
+ The default compression level for lossless WebP. Higher levels result in smaller files at the cost of compression speed. Decompression speed is mostly unaffected by the compression level. Supported values are 0 to 9. Note that compression levels above 6 are very slow and offer very little savings.
+ </member>
<member name="rendering/textures/vram_compression/import_bptc" type="bool" setter="" getter="" default="false">
If [code]true[/code], the texture importer will import VRAM-compressed textures using the BPTC algorithm. This texture compression algorithm is only supported on desktop platforms, and only when using the Vulkan renderer.
+ [b]Note:[/b] Changing this setting does [i]not[/i] impact textures that were already imported before. To make this setting apply to textures that were already imported, exit the editor, remove the [code].godot/imported/[/code] folder located inside the project folder then restart the editor.
</member>
<member name="rendering/textures/vram_compression/import_etc" type="bool" setter="" getter="" default="false">
If [code]true[/code], the texture importer will import VRAM-compressed textures using the Ericsson Texture Compression algorithm. This algorithm doesn't support alpha channels in textures.
+ [b]Note:[/b] Changing this setting does [i]not[/i] impact textures that were already imported before. To make this setting apply to textures that were already imported, exit the editor, remove the [code].godot/imported/[/code] folder located inside the project folder then restart the editor.
</member>
<member name="rendering/textures/vram_compression/import_etc2" type="bool" setter="" getter="" default="true">
If [code]true[/code], the texture importer will import VRAM-compressed textures using the Ericsson Texture Compression 2 algorithm. This texture compression algorithm is only supported when using the Vulkan renderer.
+ [b]Note:[/b] Changing this setting does [i]not[/i] impact textures that were already imported before. To make this setting apply to textures that were already imported, exit the editor, remove the [code].godot/imported/[/code] folder located inside the project folder then restart the editor.
</member>
<member name="rendering/textures/vram_compression/import_pvrtc" type="bool" setter="" getter="" default="false">
If [code]true[/code], the texture importer will import VRAM-compressed textures using the PowerVR Texture Compression algorithm. This texture compression algorithm is only supported on iOS.
+ [b]Note:[/b] Changing this setting does [i]not[/i] impact textures that were already imported before. To make this setting apply to textures that were already imported, exit the editor, remove the [code].godot/imported/[/code] folder located inside the project folder then restart the editor.
</member>
<member name="rendering/textures/vram_compression/import_s3tc" type="bool" setter="" getter="" default="true">
If [code]true[/code], the texture importer will import VRAM-compressed textures using the S3 Texture Compression algorithm. This algorithm is only supported on desktop platforms and consoles.
+ [b]Note:[/b] Changing this setting does [i]not[/i] impact textures that were already imported before. To make this setting apply to textures that were already imported, exit the editor, remove the [code].godot/imported/[/code] folder located inside the project folder then restart the editor.
</member>
<member name="rendering/vulkan/descriptor_pools/max_descriptors_per_pool" type="int" setter="" getter="" default="64">
</member>
@@ -1601,6 +1612,9 @@
</member>
<member name="rendering/vulkan/staging_buffer/texture_upload_region_size_px" type="int" setter="" getter="" default="64">
</member>
+ <member name="rendering/xr/enabled" type="bool" setter="" getter="" default="false">
+ If [code]true[/code], XR support is enabled in Godot, this ensures required shaders are compiled.
+ </member>
<member name="world/2d/cell_size" type="int" setter="" getter="" default="100">
Cell size used for the 2D hash grid that [VisibilityNotifier2D] uses (in pixels).
</member>
diff --git a/doc/classes/RDAttachmentFormat.xml b/doc/classes/RDAttachmentFormat.xml
index 4ee7b9b28e..b73377bf77 100644
--- a/doc/classes/RDAttachmentFormat.xml
+++ b/doc/classes/RDAttachmentFormat.xml
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8" ?>
-<class name="RDAttachmentFormat" inherits="Reference" version="4.0">
+<class name="RDAttachmentFormat" inherits="RefCounted" version="4.0">
<brief_description>
</brief_description>
<description>
diff --git a/doc/classes/RDPipelineColorBlendState.xml b/doc/classes/RDPipelineColorBlendState.xml
index adc6f1f6a3..1424a0d653 100644
--- a/doc/classes/RDPipelineColorBlendState.xml
+++ b/doc/classes/RDPipelineColorBlendState.xml
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8" ?>
-<class name="RDPipelineColorBlendState" inherits="Reference" version="4.0">
+<class name="RDPipelineColorBlendState" inherits="RefCounted" version="4.0">
<brief_description>
</brief_description>
<description>
diff --git a/doc/classes/RDPipelineColorBlendStateAttachment.xml b/doc/classes/RDPipelineColorBlendStateAttachment.xml
index 7f118b5f0b..a6a1900cb5 100644
--- a/doc/classes/RDPipelineColorBlendStateAttachment.xml
+++ b/doc/classes/RDPipelineColorBlendStateAttachment.xml
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8" ?>
-<class name="RDPipelineColorBlendStateAttachment" inherits="Reference" version="4.0">
+<class name="RDPipelineColorBlendStateAttachment" inherits="RefCounted" version="4.0">
<brief_description>
</brief_description>
<description>
diff --git a/doc/classes/RDPipelineDepthStencilState.xml b/doc/classes/RDPipelineDepthStencilState.xml
index 562ff52819..76e0506bca 100644
--- a/doc/classes/RDPipelineDepthStencilState.xml
+++ b/doc/classes/RDPipelineDepthStencilState.xml
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8" ?>
-<class name="RDPipelineDepthStencilState" inherits="Reference" version="4.0">
+<class name="RDPipelineDepthStencilState" inherits="RefCounted" version="4.0">
<brief_description>
</brief_description>
<description>
diff --git a/doc/classes/RDPipelineMultisampleState.xml b/doc/classes/RDPipelineMultisampleState.xml
index 4658c7d9ba..8c90f02301 100644
--- a/doc/classes/RDPipelineMultisampleState.xml
+++ b/doc/classes/RDPipelineMultisampleState.xml
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8" ?>
-<class name="RDPipelineMultisampleState" inherits="Reference" version="4.0">
+<class name="RDPipelineMultisampleState" inherits="RefCounted" version="4.0">
<brief_description>
</brief_description>
<description>
diff --git a/doc/classes/RDPipelineRasterizationState.xml b/doc/classes/RDPipelineRasterizationState.xml
index 5064dd6deb..3f8c50cf42 100644
--- a/doc/classes/RDPipelineRasterizationState.xml
+++ b/doc/classes/RDPipelineRasterizationState.xml
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8" ?>
-<class name="RDPipelineRasterizationState" inherits="Reference" version="4.0">
+<class name="RDPipelineRasterizationState" inherits="RefCounted" version="4.0">
<brief_description>
</brief_description>
<description>
diff --git a/doc/classes/RDSamplerState.xml b/doc/classes/RDSamplerState.xml
index ab31960b7c..9a9d55948c 100644
--- a/doc/classes/RDSamplerState.xml
+++ b/doc/classes/RDSamplerState.xml
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8" ?>
-<class name="RDSamplerState" inherits="Reference" version="4.0">
+<class name="RDSamplerState" inherits="RefCounted" version="4.0">
<brief_description>
</brief_description>
<description>
diff --git a/doc/classes/RDShaderSource.xml b/doc/classes/RDShaderSource.xml
index c1cfd34bb7..68fc43d8ef 100644
--- a/doc/classes/RDShaderSource.xml
+++ b/doc/classes/RDShaderSource.xml
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8" ?>
-<class name="RDShaderSource" inherits="Reference" version="4.0">
+<class name="RDShaderSource" inherits="RefCounted" version="4.0">
<brief_description>
</brief_description>
<description>
diff --git a/doc/classes/RDTextureFormat.xml b/doc/classes/RDTextureFormat.xml
index e41ddff368..ccfa6d1b95 100644
--- a/doc/classes/RDTextureFormat.xml
+++ b/doc/classes/RDTextureFormat.xml
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8" ?>
-<class name="RDTextureFormat" inherits="Reference" version="4.0">
+<class name="RDTextureFormat" inherits="RefCounted" version="4.0">
<brief_description>
</brief_description>
<description>
diff --git a/doc/classes/RDTextureView.xml b/doc/classes/RDTextureView.xml
index 73b2a7ae4a..db140ae775 100644
--- a/doc/classes/RDTextureView.xml
+++ b/doc/classes/RDTextureView.xml
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8" ?>
-<class name="RDTextureView" inherits="Reference" version="4.0">
+<class name="RDTextureView" inherits="RefCounted" version="4.0">
<brief_description>
</brief_description>
<description>
diff --git a/doc/classes/RDUniform.xml b/doc/classes/RDUniform.xml
index bc8a21e985..666935d663 100644
--- a/doc/classes/RDUniform.xml
+++ b/doc/classes/RDUniform.xml
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8" ?>
-<class name="RDUniform" inherits="Reference" version="4.0">
+<class name="RDUniform" inherits="RefCounted" version="4.0">
<brief_description>
</brief_description>
<description>
diff --git a/doc/classes/RDVertexAttribute.xml b/doc/classes/RDVertexAttribute.xml
index 56fe40b51d..3499918cc8 100644
--- a/doc/classes/RDVertexAttribute.xml
+++ b/doc/classes/RDVertexAttribute.xml
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8" ?>
-<class name="RDVertexAttribute" inherits="Reference" version="4.0">
+<class name="RDVertexAttribute" inherits="RefCounted" version="4.0">
<brief_description>
</brief_description>
<description>
diff --git a/doc/classes/RandomNumberGenerator.xml b/doc/classes/RandomNumberGenerator.xml
index 6312cd18aa..6fcb79b5fe 100644
--- a/doc/classes/RandomNumberGenerator.xml
+++ b/doc/classes/RandomNumberGenerator.xml
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8" ?>
-<class name="RandomNumberGenerator" inherits="Reference" version="4.0">
+<class name="RandomNumberGenerator" inherits="RefCounted" version="4.0">
<brief_description>
A class for generating pseudo-random numbers.
</brief_description>
diff --git a/doc/classes/Reference.xml b/doc/classes/RefCounted.xml
index 724d2db924..cf96514203 100644
--- a/doc/classes/Reference.xml
+++ b/doc/classes/RefCounted.xml
@@ -1,12 +1,12 @@
<?xml version="1.0" encoding="UTF-8" ?>
-<class name="Reference" inherits="Object" version="4.0">
+<class name="RefCounted" inherits="Object" version="4.0">
<brief_description>
Base class for reference-counted objects.
</brief_description>
<description>
Base class for any object that keeps a reference count. [Resource] and many other helper objects inherit this class.
Unlike other [Object] types, References keep an internal reference counter so that they are automatically released when no longer in use, and only then. References therefore do not need to be freed manually with [method Object.free].
- In the vast majority of use cases, instantiating and using [Reference]-derived types is all you need to do. The methods provided in this class are only for advanced users, and can cause issues if misused.
+ In the vast majority of use cases, instantiating and using [RefCounted]-derived types is all you need to do. The methods provided in this class are only for advanced users, and can cause issues if misused.
[b]Note:[/b] In C#, references will not be freed instantly after they are no longer in use. Instead, garbage collection will run periodically and will free references that are no longer in use. This means that unused references will linger on for a while before being removed.
</description>
<tutorials>
diff --git a/doc/classes/RenderingServer.xml b/doc/classes/RenderingServer.xml
index ba19176788..9b9644093f 100644
--- a/doc/classes/RenderingServer.xml
+++ b/doc/classes/RenderingServer.xml
@@ -1175,17 +1175,6 @@
Once finished with your RID, you will want to free the RID using the RenderingServer's [method free_rid] static method.
</description>
</method>
- <method name="instance_geometry_set_as_instance_lod">
- <return type="void">
- </return>
- <argument index="0" name="instance" type="RID">
- </argument>
- <argument index="1" name="as_lod_of_instance" type="RID">
- </argument>
- <description>
- Not implemented in Godot 3.x.
- </description>
- </method>
<method name="instance_geometry_set_cast_shadows_setting">
<return type="void">
</return>
@@ -1197,45 +1186,45 @@
Sets the shadow casting setting to one of [enum ShadowCastingSetting]. Equivalent to [member GeometryInstance3D.cast_shadow].
</description>
</method>
- <method name="instance_geometry_set_draw_range">
+ <method name="instance_geometry_set_flag">
<return type="void">
</return>
<argument index="0" name="instance" type="RID">
</argument>
- <argument index="1" name="min" type="float">
- </argument>
- <argument index="2" name="max" type="float">
- </argument>
- <argument index="3" name="min_margin" type="float">
+ <argument index="1" name="flag" type="int" enum="RenderingServer.InstanceFlags">
</argument>
- <argument index="4" name="max_margin" type="float">
+ <argument index="2" name="enabled" type="bool">
</argument>
<description>
- Not implemented in Godot 3.x.
+ Sets the flag for a given [enum InstanceFlags]. See [enum InstanceFlags] for more details.
</description>
</method>
- <method name="instance_geometry_set_flag">
+ <method name="instance_geometry_set_material_override">
<return type="void">
</return>
<argument index="0" name="instance" type="RID">
</argument>
- <argument index="1" name="flag" type="int" enum="RenderingServer.InstanceFlags">
- </argument>
- <argument index="2" name="enabled" type="bool">
+ <argument index="1" name="material" type="RID">
</argument>
<description>
- Sets the flag for a given [enum InstanceFlags]. See [enum InstanceFlags] for more details.
+ Sets a material that will override the material for all surfaces on the mesh associated with this instance. Equivalent to [member GeometryInstance3D.material_override].
</description>
</method>
- <method name="instance_geometry_set_material_override">
+ <method name="instance_geometry_set_visibility_range">
<return type="void">
</return>
<argument index="0" name="instance" type="RID">
</argument>
- <argument index="1" name="material" type="RID">
+ <argument index="1" name="min" type="float">
+ </argument>
+ <argument index="2" name="max" type="float">
+ </argument>
+ <argument index="3" name="min_margin" type="float">
+ </argument>
+ <argument index="4" name="max_margin" type="float">
</argument>
<description>
- Sets a material that will override the material for all surfaces on the mesh associated with this instance. Equivalent to [member GeometryInstance3D.material_override].
+ Sets the visibility range values for the given geometry instance. Equivalent to [member GeometryInstance3D.visibility_range_begin] and related properties.
</description>
</method>
<method name="instance_set_base">
@@ -1341,6 +1330,17 @@
Sets the world space transform of the instance. Equivalent to [member Node3D.transform].
</description>
</method>
+ <method name="instance_set_visibility_parent">
+ <return type="void">
+ </return>
+ <argument index="0" name="instance" type="RID">
+ </argument>
+ <argument index="1" name="parent" type="RID">
+ </argument>
+ <description>
+ Sets the visibility parent for the given instance. Equivalent to [member Node3D.visibility_parent].
+ </description>
+ </method>
<method name="instance_set_visible">
<return type="void">
</return>
diff --git a/doc/classes/Resource.xml b/doc/classes/Resource.xml
index 75736798fd..6edb3b1a11 100644
--- a/doc/classes/Resource.xml
+++ b/doc/classes/Resource.xml
@@ -1,10 +1,10 @@
<?xml version="1.0" encoding="UTF-8" ?>
-<class name="Resource" inherits="Reference" version="4.0">
+<class name="Resource" inherits="RefCounted" version="4.0">
<brief_description>
Base class for all resources.
</brief_description>
<description>
- Resource is the base class for all Godot-specific resource types, serving primarily as data containers. Since they inherit from [Reference], resources are reference-counted and freed when no longer in use. They are also cached once loaded from disk, so that any further attempts to load a resource from a given path will return the same reference (all this in contrast to a [Node], which is not reference-counted and can be instanced from disk as many times as desired). Resources can be saved externally on disk or bundled into another object, such as a [Node] or another resource.
+ Resource is the base class for all Godot-specific resource types, serving primarily as data containers. Since they inherit from [RefCounted], resources are reference-counted and freed when no longer in use. They are also cached once loaded from disk, so that any further attempts to load a resource from a given path will return the same reference (all this in contrast to a [Node], which is not reference-counted and can be instanced from disk as many times as desired). Resources can be saved externally on disk or bundled into another object, such as a [Node] or another resource.
[b]Note:[/b] In C#, resources will not be freed instantly after they are no longer in use. Instead, garbage collection will run periodically and will free resources that are no longer in use. This means that unused resources will linger on for a while before being removed.
</description>
<tutorials>
diff --git a/doc/classes/ResourceFormatLoader.xml b/doc/classes/ResourceFormatLoader.xml
index 9943f644cf..6abe5c813b 100644
--- a/doc/classes/ResourceFormatLoader.xml
+++ b/doc/classes/ResourceFormatLoader.xml
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8" ?>
-<class name="ResourceFormatLoader" inherits="Reference" version="4.0">
+<class name="ResourceFormatLoader" inherits="RefCounted" version="4.0">
<brief_description>
Loads a specific resource type from a file.
</brief_description>
@@ -11,7 +11,7 @@
<tutorials>
</tutorials>
<methods>
- <method name="get_dependencies" qualifiers="virtual">
+ <method name="_get_dependencies" qualifiers="virtual">
<return type="void">
</return>
<argument index="0" name="path" type="String">
@@ -23,14 +23,14 @@
[b]Note:[/b] Custom resource types defined by scripts aren't known by the [ClassDB], so you might just return [code]"Resource"[/code] for them.
</description>
</method>
- <method name="get_recognized_extensions" qualifiers="virtual">
+ <method name="_get_recognized_extensions" qualifiers="virtual">
<return type="PackedStringArray">
</return>
<description>
Gets the list of extensions for files this loader is able to read.
</description>
</method>
- <method name="get_resource_type" qualifiers="virtual">
+ <method name="_get_resource_type" qualifiers="virtual">
<return type="String">
</return>
<argument index="0" name="path" type="String">
@@ -40,7 +40,7 @@
[b]Note:[/b] Custom resource types defined by scripts aren't known by the [ClassDB], so you might just return [code]"Resource"[/code] for them.
</description>
</method>
- <method name="handles_type" qualifiers="virtual">
+ <method name="_handles_type" qualifiers="virtual">
<return type="bool">
</return>
<argument index="0" name="typename" type="StringName">
@@ -50,7 +50,7 @@
[b]Note:[/b] Custom resource types defined by scripts aren't known by the [ClassDB], so you might just handle [code]"Resource"[/code] for them.
</description>
</method>
- <method name="load" qualifiers="virtual">
+ <method name="_load" qualifiers="virtual">
<return type="Variant">
</return>
<argument index="0" name="path" type="String">
@@ -66,7 +66,7 @@
The [code]cache_mode[/code] property defines whether and how the cache should be used or updated when loading the resource. See [enum CacheMode] for details.
</description>
</method>
- <method name="rename_dependencies" qualifiers="virtual">
+ <method name="_rename_dependencies" qualifiers="virtual">
<return type="int">
</return>
<argument index="0" name="path" type="String">
diff --git a/doc/classes/ResourceFormatSaver.xml b/doc/classes/ResourceFormatSaver.xml
index 69f8b43898..df71e05d02 100644
--- a/doc/classes/ResourceFormatSaver.xml
+++ b/doc/classes/ResourceFormatSaver.xml
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8" ?>
-<class name="ResourceFormatSaver" inherits="Reference" version="4.0">
+<class name="ResourceFormatSaver" inherits="RefCounted" version="4.0">
<brief_description>
Saves a specific resource type to a file.
</brief_description>
@@ -10,16 +10,16 @@
<tutorials>
</tutorials>
<methods>
- <method name="get_recognized_extensions" qualifiers="virtual">
+ <method name="_get_recognized_extensions" qualifiers="virtual">
<return type="PackedStringArray">
</return>
<argument index="0" name="resource" type="Resource">
</argument>
<description>
- Returns the list of extensions available for saving the resource object, provided it is recognized (see [method recognize]).
+ Returns the list of extensions available for saving the resource object, provided it is recognized (see [method _recognize]).
</description>
</method>
- <method name="recognize" qualifiers="virtual">
+ <method name="_recognize" qualifiers="virtual">
<return type="bool">
</return>
<argument index="0" name="resource" type="Resource">
@@ -28,7 +28,7 @@
Returns whether the given resource object can be saved by this saver.
</description>
</method>
- <method name="save" qualifiers="virtual">
+ <method name="_save" qualifiers="virtual">
<return type="int">
</return>
<argument index="0" name="path" type="String">
diff --git a/doc/classes/ResourceImporter.xml b/doc/classes/ResourceImporter.xml
index 0475d2c94d..59900b1b73 100644
--- a/doc/classes/ResourceImporter.xml
+++ b/doc/classes/ResourceImporter.xml
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8" ?>
-<class name="ResourceImporter" inherits="Reference" version="4.0">
+<class name="ResourceImporter" inherits="RefCounted" version="4.0">
<brief_description>
</brief_description>
<description>
diff --git a/doc/classes/SceneState.xml b/doc/classes/SceneState.xml
index abc429d5fe..f9e0ef76b9 100644
--- a/doc/classes/SceneState.xml
+++ b/doc/classes/SceneState.xml
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8" ?>
-<class name="SceneState" inherits="Reference" version="4.0">
+<class name="SceneState" inherits="RefCounted" version="4.0">
<brief_description>
A script interface to a scene file's data.
</brief_description>
diff --git a/doc/classes/SceneTreeTimer.xml b/doc/classes/SceneTreeTimer.xml
index b223bf6821..4eef754345 100644
--- a/doc/classes/SceneTreeTimer.xml
+++ b/doc/classes/SceneTreeTimer.xml
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8" ?>
-<class name="SceneTreeTimer" inherits="Reference" version="4.0">
+<class name="SceneTreeTimer" inherits="RefCounted" version="4.0">
<brief_description>
One-shot timer.
</brief_description>
diff --git a/doc/classes/ScriptEditor.xml b/doc/classes/ScriptEditor.xml
index 28620bd29b..31dbf7453f 100644
--- a/doc/classes/ScriptEditor.xml
+++ b/doc/classes/ScriptEditor.xml
@@ -9,30 +9,6 @@
<tutorials>
</tutorials>
<methods>
- <method name="can_drop_data_fw" qualifiers="const">
- <return type="bool">
- </return>
- <argument index="0" name="point" type="Vector2">
- </argument>
- <argument index="1" name="data" type="Variant">
- </argument>
- <argument index="2" name="from" type="Control">
- </argument>
- <description>
- </description>
- </method>
- <method name="drop_data_fw">
- <return type="void">
- </return>
- <argument index="0" name="point" type="Vector2">
- </argument>
- <argument index="1" name="data" type="Variant">
- </argument>
- <argument index="2" name="from" type="Control">
- </argument>
- <description>
- </description>
- </method>
<method name="get_current_editor" qualifiers="const">
<return type="ScriptEditorBase">
</return>
@@ -47,16 +23,6 @@
Returns a [Script] that is currently active in editor.
</description>
</method>
- <method name="get_drag_data_fw">
- <return type="Variant">
- </return>
- <argument index="0" name="point" type="Vector2">
- </argument>
- <argument index="1" name="from" type="Control">
- </argument>
- <description>
- </description>
- </method>
<method name="get_open_script_editors" qualifiers="const">
<return type="Array">
</return>
diff --git a/doc/classes/ScriptEditorBase.xml b/doc/classes/ScriptEditorBase.xml
index e5c4c32450..a135062bd8 100644
--- a/doc/classes/ScriptEditorBase.xml
+++ b/doc/classes/ScriptEditorBase.xml
@@ -9,7 +9,7 @@
<tutorials>
</tutorials>
<methods>
- <method name="add_syntax_highlighter" qualifiers="virtual">
+ <method name="_add_syntax_highlighter" qualifiers="virtual">
<return type="void">
</return>
<argument index="0" name="highlighter" type="Object">
diff --git a/doc/classes/Semaphore.xml b/doc/classes/Semaphore.xml
index f311e1c72f..e8b405e52a 100644
--- a/doc/classes/Semaphore.xml
+++ b/doc/classes/Semaphore.xml
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8" ?>
-<class name="Semaphore" inherits="Reference" version="4.0">
+<class name="Semaphore" inherits="RefCounted" version="4.0">
<brief_description>
A synchronization semaphore.
</brief_description>
diff --git a/doc/classes/SkinReference.xml b/doc/classes/SkinReference.xml
index 8fc163f88d..3f8bc3be82 100644
--- a/doc/classes/SkinReference.xml
+++ b/doc/classes/SkinReference.xml
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8" ?>
-<class name="SkinReference" inherits="Reference" version="4.0">
+<class name="SkinReference" inherits="RefCounted" version="4.0">
<brief_description>
</brief_description>
<description>
diff --git a/doc/classes/Sprite3D.xml b/doc/classes/Sprite3D.xml
index a7d61a6bab..8c4b9e7d10 100644
--- a/doc/classes/Sprite3D.xml
+++ b/doc/classes/Sprite3D.xml
@@ -39,6 +39,11 @@
Emitted when the [member frame] changes.
</description>
</signal>
+ <signal name="texture_changed">
+ <description>
+ Emitted when the [member texture] changes.
+ </description>
+ </signal>
</signals>
<constants>
</constants>
diff --git a/doc/classes/StreamPeer.xml b/doc/classes/StreamPeer.xml
index f120103916..5367a572f1 100644
--- a/doc/classes/StreamPeer.xml
+++ b/doc/classes/StreamPeer.xml
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8" ?>
-<class name="StreamPeer" inherits="Reference" version="4.0">
+<class name="StreamPeer" inherits="RefCounted" version="4.0">
<brief_description>
Abstraction and base class for stream-based protocols.
</brief_description>
diff --git a/doc/classes/String.xml b/doc/classes/String.xml
index a81defa16c..d0c5f0ea86 100644
--- a/doc/classes/String.xml
+++ b/doc/classes/String.xml
@@ -275,7 +275,7 @@
Returns a copy of the string with the substring [code]what[/code] inserted at the given position.
</description>
</method>
- <method name="is_abs_path" qualifiers="const">
+ <method name="is_absolute_path" qualifiers="const">
<return type="bool">
</return>
<description>
diff --git a/doc/classes/StyleBoxTexture.xml b/doc/classes/StyleBoxTexture.xml
index 895d0c357d..f4a1f1f01d 100644
--- a/doc/classes/StyleBoxTexture.xml
+++ b/doc/classes/StyleBoxTexture.xml
@@ -127,13 +127,6 @@
The texture to use when drawing this style box.
</member>
</members>
- <signals>
- <signal name="texture_changed">
- <description>
- Emitted when the stylebox's texture is changed.
- </description>
- </signal>
- </signals>
<constants>
<constant name="AXIS_STRETCH_MODE_STRETCH" value="0" enum="AxisStretchMode">
Stretch the stylebox's texture. This results in visible distortion unless the texture size matches the stylebox's size perfectly.
diff --git a/doc/classes/SurfaceTool.xml b/doc/classes/SurfaceTool.xml
index d434f5c2c9..56b47f4a24 100644
--- a/doc/classes/SurfaceTool.xml
+++ b/doc/classes/SurfaceTool.xml
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8" ?>
-<class name="SurfaceTool" inherits="Reference" version="4.0">
+<class name="SurfaceTool" inherits="RefCounted" version="4.0">
<brief_description>
Helper tool to create geometry.
</brief_description>
diff --git a/doc/classes/TCPServer.xml b/doc/classes/TCPServer.xml
index 28f06ad3ae..7160055c6d 100644
--- a/doc/classes/TCPServer.xml
+++ b/doc/classes/TCPServer.xml
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8" ?>
-<class name="TCPServer" inherits="Reference" version="4.0">
+<class name="TCPServer" inherits="RefCounted" version="4.0">
<brief_description>
A TCP server.
</brief_description>
diff --git a/doc/classes/TextLine.xml b/doc/classes/TextLine.xml
index c21da09edb..ddbae0e977 100644
--- a/doc/classes/TextLine.xml
+++ b/doc/classes/TextLine.xml
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8" ?>
-<class name="TextLine" inherits="Reference" version="4.0">
+<class name="TextLine" inherits="RefCounted" version="4.0">
<brief_description>
Holds a line of text.
</brief_description>
diff --git a/doc/classes/TextParagraph.xml b/doc/classes/TextParagraph.xml
index 8df53b8423..e9afe47ee8 100644
--- a/doc/classes/TextParagraph.xml
+++ b/doc/classes/TextParagraph.xml
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8" ?>
-<class name="TextParagraph" inherits="Reference" version="4.0">
+<class name="TextParagraph" inherits="RefCounted" version="4.0">
<brief_description>
Holds a paragraph of text.
</brief_description>
diff --git a/doc/classes/Thread.xml b/doc/classes/Thread.xml
index 88f46e3937..5ac9416b72 100644
--- a/doc/classes/Thread.xml
+++ b/doc/classes/Thread.xml
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8" ?>
-<class name="Thread" inherits="Reference" version="4.0">
+<class name="Thread" inherits="RefCounted" version="4.0">
<brief_description>
A unit of execution in a process.
</brief_description>
diff --git a/doc/classes/Time.xml b/doc/classes/Time.xml
new file mode 100644
index 0000000000..0c7c090e97
--- /dev/null
+++ b/doc/classes/Time.xml
@@ -0,0 +1,270 @@
+<?xml version="1.0" encoding="UTF-8" ?>
+<class name="Time" inherits="Object" version="4.0">
+ <brief_description>
+ Time singleton for working with time.
+ </brief_description>
+ <description>
+ The Time singleton allows converting time between various formats and also getting time information from the system.
+ This class conforms with as many of the ISO 8601 standards as possible. All dates follow the Proleptic Gregorian calendar. As such, the day before [code]1582-10-15[/code] is [code]1582-10-14[/code], not [code]1582-10-04[/code]. The year before 1 AD (aka 1 BC) is number [code]0[/code], with the year before that (2 BC) being [code]-1[/code], etc.
+ Conversion methods assume "the same timezone", and do not handle timezone conversions or DST automatically. Leap seconds are also not handled, they must be done manually if desired. Suffixes such as "Z" are not handled, you need to strip them away manually.
+ [b]Important:[/b] The [code]_from_system[/code] methods use the system clock that the user can manually set. [b]Never use[/b] this method for precise time calculation since its results are subject to automatic adjustments by the user or the operating system. [b]Always use[/b] [method get_ticks_usec] or [method get_ticks_msec] for precise time calculation instead, since they are guaranteed to be monotonic (i.e. never decrease).
+ </description>
+ <tutorials>
+ </tutorials>
+ <methods>
+ <method name="get_date_dict_from_system" qualifiers="const">
+ <return type="Dictionary">
+ </return>
+ <argument index="0" name="utc" type="bool" default="false">
+ </argument>
+ <description>
+ Returns the current date as a dictionary of keys: [code]year[/code], [code]month[/code], [code]day[/code], [code]weekday[/code], and [code]dst[/code] (Daylight Savings Time).
+ The returned values are in the system's local time when [code]utc[/code] is false, otherwise they are in UTC.
+ </description>
+ </method>
+ <method name="get_date_dict_from_unix_time" qualifiers="const">
+ <return type="Dictionary">
+ </return>
+ <argument index="0" name="unix_time_val" type="int">
+ </argument>
+ <description>
+ Converts the given Unix timestamp to a dictionary of keys: [code]year[/code], [code]month[/code], [code]day[/code], and [code]weekday[/code].
+ </description>
+ </method>
+ <method name="get_date_string_from_system" qualifiers="const">
+ <return type="String">
+ </return>
+ <argument index="0" name="utc" type="bool" default="false">
+ </argument>
+ <description>
+ Returns the current date as an ISO 8601 date string (YYYY-MM-DD).
+ The returned values are in the system's local time when [code]utc[/code] is false, otherwise they are in UTC.
+ </description>
+ </method>
+ <method name="get_date_string_from_unix_time" qualifiers="const">
+ <return type="String">
+ </return>
+ <argument index="0" name="unix_time_val" type="int">
+ </argument>
+ <description>
+ Converts the given Unix timestamp to an ISO 8601 date string (YYYY-MM-DD).
+ </description>
+ </method>
+ <method name="get_datetime_dict_from_string" qualifiers="const">
+ <return type="Dictionary">
+ </return>
+ <argument index="0" name="datetime" type="String">
+ </argument>
+ <argument index="1" name="weekday" type="bool">
+ </argument>
+ <description>
+ Converts the given ISO 8601 date and time string (YYYY-MM-DDTHH:MM:SS) to a dictionary of keys: [code]year[/code], [code]month[/code], [code]day[/code], [code]weekday[/code], [code]hour[/code], [code]minute[/code], and [code]second[/code].
+ If [code]weekday[/code] is false, then the [code]weekday[/code] entry is excluded (the calculation is relatively expensive).
+ </description>
+ </method>
+ <method name="get_datetime_dict_from_system" qualifiers="const">
+ <return type="Dictionary">
+ </return>
+ <argument index="0" name="utc" type="bool" default="false">
+ </argument>
+ <description>
+ Returns the current date as a dictionary of keys: [code]year[/code], [code]month[/code], [code]day[/code], [code]weekday[/code], [code]hour[/code], [code]minute[/code], and [code]second[/code].
+ </description>
+ </method>
+ <method name="get_datetime_dict_from_unix_time" qualifiers="const">
+ <return type="Dictionary">
+ </return>
+ <argument index="0" name="unix_time_val" type="int">
+ </argument>
+ <description>
+ Converts the given Unix timestamp to a dictionary of keys: [code]year[/code], [code]month[/code], [code]day[/code], and [code]weekday[/code].
+ The returned Dictionary's values will be the same as the [method get_datetime_dict_from_system] if the Unix timestamp is the current time, with the exception of Daylight Savings Time as it cannot be determined from the epoch.
+ </description>
+ </method>
+ <method name="get_datetime_string_from_dict" qualifiers="const">
+ <return type="String">
+ </return>
+ <argument index="0" name="datetime" type="Dictionary">
+ </argument>
+ <argument index="1" name="use_space" type="bool">
+ </argument>
+ <description>
+ Converts the given dictionary of keys to an ISO 8601 date and time string (YYYY-MM-DDTHH:MM:SS).
+ The given dictionary can be populated with the following keys: [code]year[/code], [code]month[/code], [code]day[/code], [code]hour[/code], [code]minute[/code], and [code]second[/code]. Any other entries (including [code]dst[/code]) are ignored.
+ If the dictionary is empty, [code]0[/code] is returned. If some keys are omitted, they default to the equivalent values for the Unix epoch timestamp 0 (1970-01-01 at 00:00:00).
+ If [code]use_space[/code] is true, use a space instead of the letter T in the middle.
+ </description>
+ </method>
+ <method name="get_datetime_string_from_system" qualifiers="const">
+ <return type="String">
+ </return>
+ <argument index="0" name="utc" type="bool" default="false">
+ </argument>
+ <argument index="1" name="use_space" type="bool" default="false">
+ </argument>
+ <description>
+ Returns the current date and time as a dictionary of keys: [code]year[/code], [code]month[/code], [code]day[/code], [code]weekday[/code], [code]dst[/code] (Daylight Savings Time), [code]hour[/code], [code]minute[/code], and [code]second[/code].
+ The returned values are in the system's local time when [code]utc[/code] is false, otherwise they are in UTC.
+ If [code]use_space[/code] is true, use a space instead of the letter T in the middle.
+ </description>
+ </method>
+ <method name="get_datetime_string_from_unix_time" qualifiers="const">
+ <return type="String">
+ </return>
+ <argument index="0" name="unix_time_val" type="int">
+ </argument>
+ <argument index="1" name="use_space" type="bool" default="false">
+ </argument>
+ <description>
+ Converts the given Unix timestamp to an ISO 8601 date and time string (YYYY-MM-DDTHH:MM:SS).
+ If [code]use_space[/code] is true, use a space instead of the letter T in the middle.
+ </description>
+ </method>
+ <method name="get_ticks_msec" qualifiers="const">
+ <return type="int">
+ </return>
+ <description>
+ Returns the amount of time passed in milliseconds since the engine started.
+ </description>
+ </method>
+ <method name="get_ticks_usec" qualifiers="const">
+ <return type="int">
+ </return>
+ <description>
+ Returns the amount of time passed in microseconds since the engine started.
+ </description>
+ </method>
+ <method name="get_time_dict_from_system" qualifiers="const">
+ <return type="Dictionary">
+ </return>
+ <argument index="0" name="utc" type="bool" default="false">
+ </argument>
+ <description>
+ Returns the current time as a dictionary of keys: [code]hour[/code], [code]minute[/code], and [code]second[/code].
+ The returned values are in the system's local time when [code]utc[/code] is false, otherwise they are in UTC.
+ </description>
+ </method>
+ <method name="get_time_dict_from_unix_time" qualifiers="const">
+ <return type="Dictionary">
+ </return>
+ <argument index="0" name="unix_time_val" type="int">
+ </argument>
+ <description>
+ Converts the given time to a dictionary of keys: [code]hour[/code], [code]minute[/code], and [code]second[/code].
+ </description>
+ </method>
+ <method name="get_time_string_from_system" qualifiers="const">
+ <return type="String">
+ </return>
+ <argument index="0" name="utc" type="bool" default="false">
+ </argument>
+ <description>
+ Returns the current time as an ISO 8601 time string (HH:MM:SS).
+ The returned values are in the system's local time when [code]utc[/code] is false, otherwise they are in UTC.
+ </description>
+ </method>
+ <method name="get_time_string_from_unix_time" qualifiers="const">
+ <return type="String">
+ </return>
+ <argument index="0" name="unix_time_val" type="int">
+ </argument>
+ <description>
+ Converts the given Unix timestamp to an ISO 8601 time string (HH:MM:SS).
+ </description>
+ </method>
+ <method name="get_time_zone_from_system" qualifiers="const">
+ <return type="Dictionary">
+ </return>
+ <description>
+ Returns the current time zone as a dictionary of keys: [code]bias[/code] and [code]name[/code]. The [code]bias[/code] value is the offset from UTC in minutes, since not all time zones are multiples of an hour from UTC.
+ </description>
+ </method>
+ <method name="get_unix_time_from_datetime_dict" qualifiers="const">
+ <return type="int">
+ </return>
+ <argument index="0" name="datetime" type="Dictionary">
+ </argument>
+ <description>
+ Converts a dictionary of time values to a Unix timestamp.
+ The given dictionary can be populated with the following keys: [code]year[/code], [code]month[/code], [code]day[/code], [code]hour[/code], [code]minute[/code], and [code]second[/code]. Any other entries (including [code]dst[/code]) are ignored.
+ If the dictionary is empty, [code]0[/code] is returned. If some keys are omitted, they default to the equivalent values for the Unix epoch timestamp 0 (1970-01-01 at 00:00:00).
+ You can pass the output from [method get_datetime_dict_from_unix_time] directly into this function and get the same as what was put in.
+ </description>
+ </method>
+ <method name="get_unix_time_from_datetime_string" qualifiers="const">
+ <return type="int">
+ </return>
+ <argument index="0" name="datetime" type="String">
+ </argument>
+ <description>
+ Converts the given ISO 8601 date and/or time string to a Unix timestamp. The string can contain a date only, a time only, or both.
+ </description>
+ </method>
+ <method name="get_unix_time_from_system" qualifiers="const">
+ <return type="float">
+ </return>
+ <description>
+ Returns the current Unix timestamp in seconds based on the system time.
+ </description>
+ </method>
+ </methods>
+ <constants>
+ <constant name="MONTH_JANUARY" value="1" enum="Month">
+ The month of January, represented numerically as [code]01[/code].
+ </constant>
+ <constant name="MONTH_FEBRUARY" value="2" enum="Month">
+ The month of February, represented numerically as [code]02[/code].
+ </constant>
+ <constant name="MONTH_MARCH" value="3" enum="Month">
+ The month of March, represented numerically as [code]03[/code].
+ </constant>
+ <constant name="MONTH_APRIL" value="4" enum="Month">
+ The month of April, represented numerically as [code]04[/code].
+ </constant>
+ <constant name="MONTH_MAY" value="5" enum="Month">
+ The month of May, represented numerically as [code]05[/code].
+ </constant>
+ <constant name="MONTH_JUNE" value="6" enum="Month">
+ The month of June, represented numerically as [code]06[/code].
+ </constant>
+ <constant name="MONTH_JULY" value="7" enum="Month">
+ The month of July, represented numerically as [code]07[/code].
+ </constant>
+ <constant name="MONTH_AUGUST" value="8" enum="Month">
+ The month of August, represented numerically as [code]08[/code].
+ </constant>
+ <constant name="MONTH_SEPTEMBER" value="9" enum="Month">
+ The month of September, represented numerically as [code]09[/code].
+ </constant>
+ <constant name="MONTH_OCTOBER" value="10" enum="Month">
+ The month of October, represented numerically as [code]10[/code].
+ </constant>
+ <constant name="MONTH_NOVEMBER" value="11" enum="Month">
+ The month of November, represented numerically as [code]11[/code].
+ </constant>
+ <constant name="MONTH_DECEMBER" value="12" enum="Month">
+ The month of December, represented numerically as [code]12[/code].
+ </constant>
+ <constant name="WEEKDAY_SUNDAY" value="0" enum="Weekday">
+ The day of the week Sunday, represented numerically as [code]0[/code].
+ </constant>
+ <constant name="WEEKDAY_MONDAY" value="1" enum="Weekday">
+ The day of the week Monday, represented numerically as [code]1[/code].
+ </constant>
+ <constant name="WEEKDAY_TUESDAY" value="2" enum="Weekday">
+ The day of the week Tuesday, represented numerically as [code]2[/code].
+ </constant>
+ <constant name="WEEKDAY_WEDNESDAY" value="3" enum="Weekday">
+ The day of the week Wednesday, represented numerically as [code]3[/code].
+ </constant>
+ <constant name="WEEKDAY_THURSDAY" value="4" enum="Weekday">
+ The day of the week Thursday, represented numerically as [code]4[/code].
+ </constant>
+ <constant name="WEEKDAY_FRIDAY" value="5" enum="Weekday">
+ The day of the week Friday, represented numerically as [code]5[/code].
+ </constant>
+ <constant name="WEEKDAY_SATURDAY" value="6" enum="Weekday">
+ The day of the week Saturday, represented numerically as [code]6[/code].
+ </constant>
+ </constants>
+</class>
diff --git a/doc/classes/Tree.xml b/doc/classes/Tree.xml
index c31467c67e..fe83bf9c2d 100644
--- a/doc/classes/Tree.xml
+++ b/doc/classes/Tree.xml
@@ -361,7 +361,7 @@
The number of columns.
</member>
<member name="drop_mode_flags" type="int" setter="set_drop_mode_flags" getter="get_drop_mode_flags" default="0">
- The drop mode as an OR combination of flags. See [enum DropModeFlags] constants. Once dropping is done, reverts to [constant DROP_MODE_DISABLED]. Setting this during [method Control.can_drop_data] is recommended.
+ The drop mode as an OR combination of flags. See [enum DropModeFlags] constants. Once dropping is done, reverts to [constant DROP_MODE_DISABLED]. Setting this during [method Control._can_drop_data] is recommended.
This controls the drop sections, i.e. the decision and drawing of possible drop locations based on the mouse position.
</member>
<member name="focus_mode" type="int" setter="set_focus_mode" getter="get_focus_mode" override="true" enum="Control.FocusMode" default="2" />
diff --git a/doc/classes/TriangleMesh.xml b/doc/classes/TriangleMesh.xml
index 39bee0c2b3..cfdb6fe33e 100644
--- a/doc/classes/TriangleMesh.xml
+++ b/doc/classes/TriangleMesh.xml
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8" ?>
-<class name="TriangleMesh" inherits="Reference" version="4.0">
+<class name="TriangleMesh" inherits="RefCounted" version="4.0">
<brief_description>
Internal mesh type.
</brief_description>
diff --git a/doc/classes/UDPServer.xml b/doc/classes/UDPServer.xml
index 6f3ccb8a17..5e2906450c 100644
--- a/doc/classes/UDPServer.xml
+++ b/doc/classes/UDPServer.xml
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8" ?>
-<class name="UDPServer" inherits="Reference" version="4.0">
+<class name="UDPServer" inherits="RefCounted" version="4.0">
<brief_description>
Helper class to implement a UDP server.
</brief_description>
diff --git a/doc/classes/Variant.xml b/doc/classes/Variant.xml
index 775bd58bcf..240c1c909f 100644
--- a/doc/classes/Variant.xml
+++ b/doc/classes/Variant.xml
@@ -5,20 +5,30 @@
</brief_description>
<description>
In computer programming, a Variant class is a class that is designed to store a variety of other types. Dynamic programming languages like PHP, Lua, JavaScript and GDScript like to use them to store variables' data on the backend. With these Variants, properties are able to change value types freely.
- [codeblock]
+ [codeblocks]
+ [gdscript]
var foo = 2 # foo is dynamically an integer
foo = "Now foo is a string!"
- foo = Reference.new() # foo is an Object
+ foo = RefCounted.new() # foo is an Object
var bar: int = 2 # bar is a statically typed integer.
# bar = "Uh oh! I can't make static variables become a different type!"
- [/codeblock]
+ [/gdscript]
+ [csharp]
+ // ... but C# is statically typed. Once a variable has a type it cannot be changed. However you can use the var keyword in methods to let the compiler decide the type automatically.
+ var foo = 2; // Foo is a 32-bit integer (int). Be cautious, integers in GDScript are 64-bit and the direct C# equivalent is "long".
+ // foo = "foo was and will always be an integer. It cannot be turned into a string!";
+ var boo = "Boo is a string!";
+ var ref = new Reference(); // var is especially useful when used together with a constructor.
+ [/csharp]
+ [/codeblocks]
Godot tracks all scripting API variables within Variants. Without even realizing it, you use Variants all the time. When a particular language enforces its own rules for keeping data typed, then that language is applying its own custom logic over the base Variant scripting API.
- GDScript automatically wrap values in them. It keeps all data in plain Variants by default and then optionally enforces custom static typing rules on variable types.
- VisualScript tracks properties inside Variants as well, but it also uses static typing. The GUI interface enforces that properties have a particular type that doesn't change over time.
- C# is statically typed, but uses the Mono [code]object[/code] type in place of Godot's Variant class when it needs to represent a dynamic value. [code]object[/code] is the Mono runtime's equivalent of the same concept.
- The statically-typed language NativeScript C++ does not define a built-in Variant-like class. Godot's GDNative bindings provide their own godot::Variant class for users; Any point at which the C++ code starts interacting with the Godot runtime is a place where you might have to start wrapping data inside Variant objects.
The global [method @GlobalScope.typeof] function returns the enumerated value of the Variant type stored in the current variable (see [enum Variant.Type]).
- [codeblock]
+ [codeblocks]
+ [gdscript]
var foo = 2
match typeof(foo):
TYPE_NIL:
@@ -32,7 +42,19 @@
# Note also that there is not yet any way to get a script's `class_name` string easily.
# To fetch that value, you need to dig deeply into a hidden ProjectSettings setting: an Array of Dictionaries called "_global_script_classes".
# Open your project.godot file to see it up close.
- [/codeblock]
+ [/gdscript]
+ [csharp]
+ int foo = 2;
+ if (foo == null)
+ {
+ GD.Print("foo is null");
+ }
+ if (foo is int)
+ {
+ GD.Print("foo is an integer");
+ }
+ [/csharp]
+ [/codeblocks]
A Variant takes up only 20 bytes and can store almost any engine datatype inside of it. Variants are rarely used to hold information for long periods of time. Instead, they are used mainly for communication, editing, serialization and moving data around.
Godot has specifically invested in making its Variant class as flexible as possible; so much so that it is used for a multitude of operations to facilitate communication between all of Godot's systems.
A Variant:
diff --git a/doc/classes/VelocityTracker3D.xml b/doc/classes/VelocityTracker3D.xml
index 98f7533c76..2d5e3a4d30 100644
--- a/doc/classes/VelocityTracker3D.xml
+++ b/doc/classes/VelocityTracker3D.xml
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8" ?>
-<class name="VelocityTracker3D" inherits="Reference" version="4.0">
+<class name="VelocityTracker3D" inherits="RefCounted" version="4.0">
<brief_description>
</brief_description>
<description>
diff --git a/doc/classes/Viewport.xml b/doc/classes/Viewport.xml
index 7f05b14765..96d63b27ad 100644
--- a/doc/classes/Viewport.xml
+++ b/doc/classes/Viewport.xml
@@ -81,10 +81,16 @@
<description>
Returns the viewport's texture.
[b]Note:[/b] Due to the way OpenGL works, the resulting [ViewportTexture] is flipped vertically. You can use [method Image.flip_y] on the result of [method Texture2D.get_image] to flip it back, for example:
- [codeblock]
+ [codeblocks]
+ [gdscript]
var img = get_viewport().get_texture().get_image()
img.flip_y()
- [/codeblock]
+ [/gdscript]
+ [csharp]
+ Image img = GetViewport().GetTexture().GetImage();
+ img.FlipY();
+ [/csharp]
+ [/codeblocks]
</description>
</method>
<method name="get_viewport_rid" qualifiers="const">
@@ -105,7 +111,7 @@
<return type="Variant">
</return>
<description>
- Returns the drag data from the GUI, that was previously returned by [method Control.get_drag_data].
+ Returns the drag data from the GUI, that was previously returned by [method Control._get_drag_data].
</description>
</method>
<method name="gui_is_dragging" qualifiers="const">
diff --git a/doc/classes/WeakRef.xml b/doc/classes/WeakRef.xml
index 4140df5828..6c9a7de67f 100644
--- a/doc/classes/WeakRef.xml
+++ b/doc/classes/WeakRef.xml
@@ -1,10 +1,10 @@
<?xml version="1.0" encoding="UTF-8" ?>
-<class name="WeakRef" inherits="Reference" version="4.0">
+<class name="WeakRef" inherits="RefCounted" version="4.0">
<brief_description>
Holds an [Object], but does not contribute to the reference count if the object is a reference.
</brief_description>
<description>
- A weakref can hold a [Reference], without contributing to the reference counter. A weakref can be created from an [Object] using [method @GlobalScope.weakref]. If this object is not a reference, weakref still works, however, it does not have any effect on the object. Weakrefs are useful in cases where multiple classes have variables that refer to each other. Without weakrefs, using these classes could lead to memory leaks, since both references keep each other from being released. Making part of the variables a weakref can prevent this cyclic dependency, and allows the references to be released.
+ A weakref can hold a [RefCounted], without contributing to the reference counter. A weakref can be created from an [Object] using [method @GlobalScope.weakref]. If this object is not a reference, weakref still works, however, it does not have any effect on the object. Weakrefs are useful in cases where multiple classes have variables that refer to each other. Without weakrefs, using these classes could lead to memory leaks, since both references keep each other from being released. Making part of the variables a weakref can prevent this cyclic dependency, and allows the references to be released.
</description>
<tutorials>
</tutorials>
diff --git a/doc/classes/XMLParser.xml b/doc/classes/XMLParser.xml
index 2849ea62ab..ab5c58c51c 100644
--- a/doc/classes/XMLParser.xml
+++ b/doc/classes/XMLParser.xml
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8" ?>
-<class name="XMLParser" inherits="Reference" version="4.0">
+<class name="XMLParser" inherits="RefCounted" version="4.0">
<brief_description>
Low-level class for creating parsers for [url=https://en.wikipedia.org/wiki/XML]XML[/url] files.
</brief_description>
diff --git a/doc/classes/XRInterface.xml b/doc/classes/XRInterface.xml
index 034cb51be3..fec98007c3 100644
--- a/doc/classes/XRInterface.xml
+++ b/doc/classes/XRInterface.xml
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8" ?>
-<class name="XRInterface" inherits="Reference" version="4.0">
+<class name="XRInterface" inherits="RefCounted" version="4.0">
<brief_description>
Base class for an AR/VR interface implementation.
</brief_description>
@@ -46,6 +46,13 @@
If supported, returns the status of our tracking. This will allow you to provide feedback to the user whether there are issues with positional tracking.
</description>
</method>
+ <method name="get_view_count">
+ <return type="int">
+ </return>
+ <description>
+ Returns the number of views that need to be rendered for this device. 1 for Monoscopic, 2 for Stereoscopic.
+ </description>
+ </method>
<method name="initialize">
<return type="bool">
</return>
@@ -57,13 +64,6 @@
While currently not used, you can activate additional interfaces. You may wish to do this if you want to track controllers from other platforms. However, at this point in time only one interface can render to an HMD.
</description>
</method>
- <method name="is_stereo">
- <return type="bool">
- </return>
- <description>
- Returns [code]true[/code] if the current output of this interface is in stereo.
- </description>
- </method>
<method name="uninitialize">
<return type="void">
</return>
diff --git a/doc/classes/XRPositionalTracker.xml b/doc/classes/XRPositionalTracker.xml
index 2cf8e1d6f5..cd8cb71cd9 100644
--- a/doc/classes/XRPositionalTracker.xml
+++ b/doc/classes/XRPositionalTracker.xml
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8" ?>
-<class name="XRPositionalTracker" inherits="Reference" version="4.0">
+<class name="XRPositionalTracker" inherits="RefCounted" version="4.0">
<brief_description>
A tracked object.
</brief_description>
diff --git a/doc/classes/XRServer.xml b/doc/classes/XRServer.xml
index 8284fa4a89..149e177700 100644
--- a/doc/classes/XRServer.xml
+++ b/doc/classes/XRServer.xml
@@ -96,7 +96,7 @@
<return type="int">
</return>
<description>
- Returns the absolute timestamp (in μs) of the last [XRServer] commit of the AR/VR eyes to [RenderingServer]. The value comes from an internal call to [method OS.get_ticks_usec].
+ Returns the absolute timestamp (in μs) of the last [XRServer] commit of the AR/VR eyes to [RenderingServer]. The value comes from an internal call to [method Time.get_ticks_usec].
</description>
</method>
<method name="get_last_frame_usec">
@@ -110,7 +110,7 @@
<return type="int">
</return>
<description>
- Returns the absolute timestamp (in μs) of the last [XRServer] process callback. The value comes from an internal call to [method OS.get_ticks_usec].
+ Returns the absolute timestamp (in μs) of the last [XRServer] process callback. The value comes from an internal call to [method Time.get_ticks_usec].
</description>
</method>
<method name="get_reference_frame" qualifiers="const">
diff --git a/doc/translations/ar.po b/doc/translations/ar.po
index b4ae664714..77a3d39f27 100644
--- a/doc/translations/ar.po
+++ b/doc/translations/ar.po
@@ -33036,7 +33036,7 @@ msgid ""
"to delete instances of it manually. To do so, call the [method free] method "
"from your script or delete the instance from C++.\n"
"Some classes that extend Object add memory management. This is the case of "
-"[Reference], which counts references and deletes itself automatically when "
+"[RefCounted], which counts references and deletes itself automatically when "
"no longer referenced. [Node], another fundamental type, deletes all its "
"children when freed from memory.\n"
"Objects export properties, which are mainly useful for storage and editing, "
@@ -33055,12 +33055,12 @@ msgid ""
"Objects also receive notifications. Notifications are a simple way to notify "
"the object about different events, so they can all be handled together. See "
"[method _notification].\n"
-"[b]Note:[/b] Unlike references to a [Reference], references to an Object "
+"[b]Note:[/b] Unlike references to a [RefCounted], references to an Object "
"stored in a variable can become invalid without warning. Therefore, it's "
-"recommended to use [Reference] for data classes instead of [Object]."
+"recommended to use [RefCounted] for data classes instead of [Object]."
msgstr ""
-#: doc/classes/Object.xml:23 doc/classes/Reference.xml:12
+#: doc/classes/Object.xml:23 doc/classes/RefCounted.xml:12
#: doc/classes/Resource.xml:11
msgid ""
"https://docs.godotengine.org/en/latest/getting_started/workflow/"
@@ -34557,7 +34557,7 @@ msgid "Changes the [Color] at the given index."
msgstr ""
#: doc/classes/PackedDataContainerRef.xml:4
-msgid "Reference version of [PackedDataContainer]."
+msgid "RefCounted version of [PackedDataContainer]."
msgstr ""
#: doc/classes/PackedFloat32Array.xml:4
@@ -41765,30 +41765,30 @@ msgid ""
"the half extents."
msgstr ""
-#: doc/classes/Reference.xml:4
+#: doc/classes/RefCounted.xml:4
msgid "Base class for reference-counted objects."
msgstr ""
-#: doc/classes/Reference.xml:7
+#: doc/classes/RefCounted.xml:7
msgid ""
"Base class for any object that keeps a reference count. [Resource] and many "
"other helper objects inherit this class.\n"
"Unlike [Object]s, References keep an internal reference counter so that they "
"are automatically released when no longer in use, and only then. References "
"therefore do not need to be freed manually with [method Object.free].\n"
-"In the vast majority of use cases, instantiating and using [Reference]-"
+"In the vast majority of use cases, instantiating and using [RefCounted]-"
"derived types is all you need to do. The methods provided in this class are "
"only for advanced users, and can cause issues if misused."
msgstr ""
-#: doc/classes/Reference.xml:19
+#: doc/classes/RefCounted.xml:19
msgid ""
"Initializes the internal reference counter. Use this only if you really know "
"what you are doing.\n"
"Returns whether the initialization was successful."
msgstr ""
-#: doc/classes/Reference.xml:27
+#: doc/classes/RefCounted.xml:27
msgid ""
"Increments the internal reference counter. Use this only if you really know "
"what you are doing.\n"
@@ -41796,7 +41796,7 @@ msgid ""
"code] otherwise."
msgstr ""
-#: doc/classes/Reference.xml:35
+#: doc/classes/RefCounted.xml:35
msgid ""
"Decrements the internal reference counter. Use this only if you really know "
"what you are doing.\n"
@@ -54060,7 +54060,7 @@ msgid ""
"[codeblock]\n"
"var foo = 2 # foo is dynamically an integer\n"
"foo = \"Now foo is a string!\"\n"
-"foo = Reference.new() # foo is an Object\n"
+"foo = RefCounted.new() # foo is an Object\n"
"var bar: int = 2 # bar is a statically typed integer.\n"
"# bar = \"Uh oh! I can't make static variables become a different type!\"\n"
"[/codeblock]\n"
@@ -59139,7 +59139,7 @@ msgstr ""
#: doc/classes/WeakRef.xml:7
msgid ""
-"A weakref can hold a [Reference], without contributing to the reference "
+"A weakref can hold a [RefCounted], without contributing to the reference "
"counter. A weakref can be created from an [Object] using [method @GDScript."
"weakref]. If this object is not a reference, weakref still works, however, "
"it does not have any effect on the object. Weakrefs are useful in cases "
diff --git a/doc/translations/ca.po b/doc/translations/ca.po
index 6485111b20..8ea801181d 100644
--- a/doc/translations/ca.po
+++ b/doc/translations/ca.po
@@ -33067,7 +33067,7 @@ msgid ""
"to delete instances of it manually. To do so, call the [method free] method "
"from your script or delete the instance from C++.\n"
"Some classes that extend Object add memory management. This is the case of "
-"[Reference], which counts references and deletes itself automatically when "
+"[RefCounted], which counts references and deletes itself automatically when "
"no longer referenced. [Node], another fundamental type, deletes all its "
"children when freed from memory.\n"
"Objects export properties, which are mainly useful for storage and editing, "
@@ -33086,12 +33086,12 @@ msgid ""
"Objects also receive notifications. Notifications are a simple way to notify "
"the object about different events, so they can all be handled together. See "
"[method _notification].\n"
-"[b]Note:[/b] Unlike references to a [Reference], references to an Object "
+"[b]Note:[/b] Unlike references to a [RefCounted], references to an Object "
"stored in a variable can become invalid without warning. Therefore, it's "
-"recommended to use [Reference] for data classes instead of [Object]."
+"recommended to use [RefCounted] for data classes instead of [Object]."
msgstr ""
-#: doc/classes/Object.xml:23 doc/classes/Reference.xml:12
+#: doc/classes/Object.xml:23 doc/classes/RefCounted.xml:12
#: doc/classes/Resource.xml:11
msgid ""
"https://docs.godotengine.org/en/latest/getting_started/workflow/"
@@ -34588,7 +34588,7 @@ msgid "Changes the [Color] at the given index."
msgstr ""
#: doc/classes/PackedDataContainerRef.xml:4
-msgid "Reference version of [PackedDataContainer]."
+msgid "RefCounted version of [PackedDataContainer]."
msgstr ""
#: doc/classes/PackedFloat32Array.xml:4
@@ -41796,30 +41796,30 @@ msgid ""
"the half extents."
msgstr ""
-#: doc/classes/Reference.xml:4
+#: doc/classes/RefCounted.xml:4
msgid "Base class for reference-counted objects."
msgstr ""
-#: doc/classes/Reference.xml:7
+#: doc/classes/RefCounted.xml:7
msgid ""
"Base class for any object that keeps a reference count. [Resource] and many "
"other helper objects inherit this class.\n"
"Unlike [Object]s, References keep an internal reference counter so that they "
"are automatically released when no longer in use, and only then. References "
"therefore do not need to be freed manually with [method Object.free].\n"
-"In the vast majority of use cases, instantiating and using [Reference]-"
+"In the vast majority of use cases, instantiating and using [RefCounted]-"
"derived types is all you need to do. The methods provided in this class are "
"only for advanced users, and can cause issues if misused."
msgstr ""
-#: doc/classes/Reference.xml:19
+#: doc/classes/RefCounted.xml:19
msgid ""
"Initializes the internal reference counter. Use this only if you really know "
"what you are doing.\n"
"Returns whether the initialization was successful."
msgstr ""
-#: doc/classes/Reference.xml:27
+#: doc/classes/RefCounted.xml:27
msgid ""
"Increments the internal reference counter. Use this only if you really know "
"what you are doing.\n"
@@ -41827,7 +41827,7 @@ msgid ""
"code] otherwise."
msgstr ""
-#: doc/classes/Reference.xml:35
+#: doc/classes/RefCounted.xml:35
msgid ""
"Decrements the internal reference counter. Use this only if you really know "
"what you are doing.\n"
@@ -54091,7 +54091,7 @@ msgid ""
"[codeblock]\n"
"var foo = 2 # foo is dynamically an integer\n"
"foo = \"Now foo is a string!\"\n"
-"foo = Reference.new() # foo is an Object\n"
+"foo = RefCounted.new() # foo is an Object\n"
"var bar: int = 2 # bar is a statically typed integer.\n"
"# bar = \"Uh oh! I can't make static variables become a different type!\"\n"
"[/codeblock]\n"
@@ -59170,7 +59170,7 @@ msgstr ""
#: doc/classes/WeakRef.xml:7
msgid ""
-"A weakref can hold a [Reference], without contributing to the reference "
+"A weakref can hold a [RefCounted], without contributing to the reference "
"counter. A weakref can be created from an [Object] using [method @GDScript."
"weakref]. If this object is not a reference, weakref still works, however, "
"it does not have any effect on the object. Weakrefs are useful in cases "
diff --git a/doc/translations/classes.pot b/doc/translations/classes.pot
index d14b0d9b1f..d12fa78b0e 100644
--- a/doc/translations/classes.pot
+++ b/doc/translations/classes.pot
@@ -33037,7 +33037,7 @@ msgid ""
"to delete instances of it manually. To do so, call the [method free] method "
"from your script or delete the instance from C++.\n"
"Some classes that extend Object add memory management. This is the case of "
-"[Reference], which counts references and deletes itself automatically when "
+"[RefCounted], which counts references and deletes itself automatically when "
"no longer referenced. [Node], another fundamental type, deletes all its "
"children when freed from memory.\n"
"Objects export properties, which are mainly useful for storage and editing, "
@@ -33056,12 +33056,12 @@ msgid ""
"Objects also receive notifications. Notifications are a simple way to notify "
"the object about different events, so they can all be handled together. See "
"[method _notification].\n"
-"[b]Note:[/b] Unlike references to a [Reference], references to an Object "
+"[b]Note:[/b] Unlike references to a [RefCounted], references to an Object "
"stored in a variable can become invalid without warning. Therefore, it's "
-"recommended to use [Reference] for data classes instead of [Object]."
+"recommended to use [RefCounted] for data classes instead of [Object]."
msgstr ""
-#: doc/classes/Object.xml:23 doc/classes/Reference.xml:12
+#: doc/classes/Object.xml:23 doc/classes/RefCounted.xml:12
#: doc/classes/Resource.xml:11
msgid ""
"https://docs.godotengine.org/en/latest/getting_started/workflow/"
@@ -34558,7 +34558,7 @@ msgid "Changes the [Color] at the given index."
msgstr ""
#: doc/classes/PackedDataContainerRef.xml:4
-msgid "Reference version of [PackedDataContainer]."
+msgid "RefCounted version of [PackedDataContainer]."
msgstr ""
#: doc/classes/PackedFloat32Array.xml:4
@@ -41766,30 +41766,30 @@ msgid ""
"the half extents."
msgstr ""
-#: doc/classes/Reference.xml:4
+#: doc/classes/RefCounted.xml:4
msgid "Base class for reference-counted objects."
msgstr ""
-#: doc/classes/Reference.xml:7
+#: doc/classes/RefCounted.xml:7
msgid ""
"Base class for any object that keeps a reference count. [Resource] and many "
"other helper objects inherit this class.\n"
"Unlike [Object]s, References keep an internal reference counter so that they "
"are automatically released when no longer in use, and only then. References "
"therefore do not need to be freed manually with [method Object.free].\n"
-"In the vast majority of use cases, instantiating and using [Reference]-"
+"In the vast majority of use cases, instantiating and using [RefCounted]-"
"derived types is all you need to do. The methods provided in this class are "
"only for advanced users, and can cause issues if misused."
msgstr ""
-#: doc/classes/Reference.xml:19
+#: doc/classes/RefCounted.xml:19
msgid ""
"Initializes the internal reference counter. Use this only if you really know "
"what you are doing.\n"
"Returns whether the initialization was successful."
msgstr ""
-#: doc/classes/Reference.xml:27
+#: doc/classes/RefCounted.xml:27
msgid ""
"Increments the internal reference counter. Use this only if you really know "
"what you are doing.\n"
@@ -41797,7 +41797,7 @@ msgid ""
"code] otherwise."
msgstr ""
-#: doc/classes/Reference.xml:35
+#: doc/classes/RefCounted.xml:35
msgid ""
"Decrements the internal reference counter. Use this only if you really know "
"what you are doing.\n"
@@ -54061,7 +54061,7 @@ msgid ""
"[codeblock]\n"
"var foo = 2 # foo is dynamically an integer\n"
"foo = \"Now foo is a string!\"\n"
-"foo = Reference.new() # foo is an Object\n"
+"foo = RefCounted.new() # foo is an Object\n"
"var bar: int = 2 # bar is a statically typed integer.\n"
"# bar = \"Uh oh! I can't make static variables become a different type!\"\n"
"[/codeblock]\n"
@@ -59140,7 +59140,7 @@ msgstr ""
#: doc/classes/WeakRef.xml:7
msgid ""
-"A weakref can hold a [Reference], without contributing to the reference "
+"A weakref can hold a [RefCounted], without contributing to the reference "
"counter. A weakref can be created from an [Object] using [method @GDScript."
"weakref]. If this object is not a reference, weakref still works, however, "
"it does not have any effect on the object. Weakrefs are useful in cases "
diff --git a/doc/translations/cs.po b/doc/translations/cs.po
index 7b958a5049..a267656497 100644
--- a/doc/translations/cs.po
+++ b/doc/translations/cs.po
@@ -33536,7 +33536,7 @@ msgid ""
"to delete instances of it manually. To do so, call the [method free] method "
"from your script or delete the instance from C++.\n"
"Some classes that extend Object add memory management. This is the case of "
-"[Reference], which counts references and deletes itself automatically when "
+"[RefCounted], which counts references and deletes itself automatically when "
"no longer referenced. [Node], another fundamental type, deletes all its "
"children when freed from memory.\n"
"Objects export properties, which are mainly useful for storage and editing, "
@@ -33555,12 +33555,12 @@ msgid ""
"Objects also receive notifications. Notifications are a simple way to notify "
"the object about different events, so they can all be handled together. See "
"[method _notification].\n"
-"[b]Note:[/b] Unlike references to a [Reference], references to an Object "
+"[b]Note:[/b] Unlike references to a [RefCounted], references to an Object "
"stored in a variable can become invalid without warning. Therefore, it's "
-"recommended to use [Reference] for data classes instead of [Object]."
+"recommended to use [RefCounted] for data classes instead of [Object]."
msgstr ""
-#: doc/classes/Object.xml:23 doc/classes/Reference.xml:12
+#: doc/classes/Object.xml:23 doc/classes/RefCounted.xml:12
#: doc/classes/Resource.xml:11
msgid ""
"https://docs.godotengine.org/en/latest/getting_started/workflow/"
@@ -35058,7 +35058,7 @@ msgid "Changes the [Color] at the given index."
msgstr ""
#: doc/classes/PackedDataContainerRef.xml:4
-msgid "Reference version of [PackedDataContainer]."
+msgid "RefCounted version of [PackedDataContainer]."
msgstr ""
#: doc/classes/PackedFloat32Array.xml:4
@@ -42266,30 +42266,30 @@ msgid ""
"the half extents."
msgstr ""
-#: doc/classes/Reference.xml:4
+#: doc/classes/RefCounted.xml:4
msgid "Base class for reference-counted objects."
msgstr ""
-#: doc/classes/Reference.xml:7
+#: doc/classes/RefCounted.xml:7
msgid ""
"Base class for any object that keeps a reference count. [Resource] and many "
"other helper objects inherit this class.\n"
"Unlike [Object]s, References keep an internal reference counter so that they "
"are automatically released when no longer in use, and only then. References "
"therefore do not need to be freed manually with [method Object.free].\n"
-"In the vast majority of use cases, instantiating and using [Reference]-"
+"In the vast majority of use cases, instantiating and using [RefCounted]-"
"derived types is all you need to do. The methods provided in this class are "
"only for advanced users, and can cause issues if misused."
msgstr ""
-#: doc/classes/Reference.xml:19
+#: doc/classes/RefCounted.xml:19
msgid ""
"Initializes the internal reference counter. Use this only if you really know "
"what you are doing.\n"
"Returns whether the initialization was successful."
msgstr ""
-#: doc/classes/Reference.xml:27
+#: doc/classes/RefCounted.xml:27
msgid ""
"Increments the internal reference counter. Use this only if you really know "
"what you are doing.\n"
@@ -42297,7 +42297,7 @@ msgid ""
"code] otherwise."
msgstr ""
-#: doc/classes/Reference.xml:35
+#: doc/classes/RefCounted.xml:35
msgid ""
"Decrements the internal reference counter. Use this only if you really know "
"what you are doing.\n"
@@ -54562,7 +54562,7 @@ msgid ""
"[codeblock]\n"
"var foo = 2 # foo is dynamically an integer\n"
"foo = \"Now foo is a string!\"\n"
-"foo = Reference.new() # foo is an Object\n"
+"foo = RefCounted.new() # foo is an Object\n"
"var bar: int = 2 # bar is a statically typed integer.\n"
"# bar = \"Uh oh! I can't make static variables become a different type!\"\n"
"[/codeblock]\n"
@@ -59645,7 +59645,7 @@ msgstr ""
#: doc/classes/WeakRef.xml:7
msgid ""
-"A weakref can hold a [Reference], without contributing to the reference "
+"A weakref can hold a [RefCounted], without contributing to the reference "
"counter. A weakref can be created from an [Object] using [method @GDScript."
"weakref]. If this object is not a reference, weakref still works, however, "
"it does not have any effect on the object. Weakrefs are useful in cases "
diff --git a/doc/translations/de.po b/doc/translations/de.po
index 2e3e219ba6..181d64d525 100644
--- a/doc/translations/de.po
+++ b/doc/translations/de.po
@@ -33453,7 +33453,7 @@ msgid ""
"to delete instances of it manually. To do so, call the [method free] method "
"from your script or delete the instance from C++.\n"
"Some classes that extend Object add memory management. This is the case of "
-"[Reference], which counts references and deletes itself automatically when "
+"[RefCounted], which counts references and deletes itself automatically when "
"no longer referenced. [Node], another fundamental type, deletes all its "
"children when freed from memory.\n"
"Objects export properties, which are mainly useful for storage and editing, "
@@ -33472,12 +33472,12 @@ msgid ""
"Objects also receive notifications. Notifications are a simple way to notify "
"the object about different events, so they can all be handled together. See "
"[method _notification].\n"
-"[b]Note:[/b] Unlike references to a [Reference], references to an Object "
+"[b]Note:[/b] Unlike references to a [RefCounted], references to an Object "
"stored in a variable can become invalid without warning. Therefore, it's "
-"recommended to use [Reference] for data classes instead of [Object]."
+"recommended to use [RefCounted] for data classes instead of [Object]."
msgstr ""
-#: doc/classes/Object.xml:23 doc/classes/Reference.xml:12
+#: doc/classes/Object.xml:23 doc/classes/RefCounted.xml:12
#: doc/classes/Resource.xml:11
#, fuzzy
msgid ""
@@ -34984,7 +34984,7 @@ msgid "Changes the [Color] at the given index."
msgstr ""
#: doc/classes/PackedDataContainerRef.xml:4
-msgid "Reference version of [PackedDataContainer]."
+msgid "RefCounted version of [PackedDataContainer]."
msgstr ""
#: doc/classes/PackedFloat32Array.xml:4
@@ -42226,30 +42226,30 @@ msgid ""
"the half extents."
msgstr ""
-#: doc/classes/Reference.xml:4
+#: doc/classes/RefCounted.xml:4
msgid "Base class for reference-counted objects."
msgstr ""
-#: doc/classes/Reference.xml:7
+#: doc/classes/RefCounted.xml:7
msgid ""
"Base class for any object that keeps a reference count. [Resource] and many "
"other helper objects inherit this class.\n"
"Unlike [Object]s, References keep an internal reference counter so that they "
"are automatically released when no longer in use, and only then. References "
"therefore do not need to be freed manually with [method Object.free].\n"
-"In the vast majority of use cases, instantiating and using [Reference]-"
+"In the vast majority of use cases, instantiating and using [RefCounted]-"
"derived types is all you need to do. The methods provided in this class are "
"only for advanced users, and can cause issues if misused."
msgstr ""
-#: doc/classes/Reference.xml:19
+#: doc/classes/RefCounted.xml:19
msgid ""
"Initializes the internal reference counter. Use this only if you really know "
"what you are doing.\n"
"Returns whether the initialization was successful."
msgstr ""
-#: doc/classes/Reference.xml:27
+#: doc/classes/RefCounted.xml:27
msgid ""
"Increments the internal reference counter. Use this only if you really know "
"what you are doing.\n"
@@ -42257,7 +42257,7 @@ msgid ""
"code] otherwise."
msgstr ""
-#: doc/classes/Reference.xml:35
+#: doc/classes/RefCounted.xml:35
msgid ""
"Decrements the internal reference counter. Use this only if you really know "
"what you are doing.\n"
@@ -54558,7 +54558,7 @@ msgid ""
"[codeblock]\n"
"var foo = 2 # foo is dynamically an integer\n"
"foo = \"Now foo is a string!\"\n"
-"foo = Reference.new() # foo is an Object\n"
+"foo = RefCounted.new() # foo is an Object\n"
"var bar: int = 2 # bar is a statically typed integer.\n"
"# bar = \"Uh oh! I can't make static variables become a different type!\"\n"
"[/codeblock]\n"
@@ -59796,7 +59796,7 @@ msgstr ""
#: doc/classes/WeakRef.xml:7
msgid ""
-"A weakref can hold a [Reference], without contributing to the reference "
+"A weakref can hold a [RefCounted], without contributing to the reference "
"counter. A weakref can be created from an [Object] using [method @GDScript."
"weakref]. If this object is not a reference, weakref still works, however, "
"it does not have any effect on the object. Weakrefs are useful in cases "
diff --git a/doc/translations/es.po b/doc/translations/es.po
index 3078c1bf90..7df36316b7 100644
--- a/doc/translations/es.po
+++ b/doc/translations/es.po
@@ -44834,7 +44834,7 @@ msgid ""
"to delete instances of it manually. To do so, call the [method free] method "
"from your script or delete the instance from C++.\n"
"Some classes that extend Object add memory management. This is the case of "
-"[Reference], which counts references and deletes itself automatically when "
+"[RefCounted], which counts references and deletes itself automatically when "
"no longer referenced. [Node], another fundamental type, deletes all its "
"children when freed from memory.\n"
"Objects export properties, which are mainly useful for storage and editing, "
@@ -44853,9 +44853,9 @@ msgid ""
"Objects also receive notifications. Notifications are a simple way to notify "
"the object about different events, so they can all be handled together. See "
"[method _notification].\n"
-"[b]Note:[/b] Unlike references to a [Reference], references to an Object "
+"[b]Note:[/b] Unlike references to a [RefCounted], references to an Object "
"stored in a variable can become invalid without warning. Therefore, it's "
-"recommended to use [Reference] for data classes instead of [Object]."
+"recommended to use [RefCounted] for data classes instead of [Object]."
msgstr ""
"Toda clase que no es un tipo integrado hereda de esta clase.\n"
"Puedes construir Objetos desde lenguajes de scripting, usando [code]Object."
@@ -44866,7 +44866,7 @@ msgstr ""
"llama al método [method free] desde tu script o elimina la instancia desde C+"
"+.\n"
"Algunas clases que extienden a Object añaden gestión de memoria. Este es el "
-"caso de [Reference], que cuenta las referencias y se borra a sí misma "
+"caso de [RefCounted], que cuenta las referencias y se borra a sí misma "
"automáticamente cuando deja de estar referenciada. [Node], otro tipo "
"fundamental, borra todos sus hijos cuando se libera de la memoria.\n"
"Los objetos exportan propiedades, que son principalmente útiles para el "
@@ -44887,7 +44887,7 @@ msgstr ""
"sencilla de notificar al objeto sobre diferentes eventos, de modo que todos "
"ellos pueden ser manejados juntos. Véase [method _notification]."
-#: doc/classes/Object.xml:23 doc/classes/Reference.xml:12
+#: doc/classes/Object.xml:23 doc/classes/RefCounted.xml:12
#: doc/classes/Resource.xml:11
#, fuzzy
msgid ""
@@ -46525,7 +46525,7 @@ msgid "Changes the [Color] at the given index."
msgstr ""
#: doc/classes/PackedDataContainerRef.xml:4
-msgid "Reference version of [PackedDataContainer]."
+msgid "RefCounted version of [PackedDataContainer]."
msgstr ""
#: doc/classes/PackedFloat32Array.xml:4
@@ -53779,30 +53779,30 @@ msgid ""
"the half extents."
msgstr ""
-#: doc/classes/Reference.xml:4
+#: doc/classes/RefCounted.xml:4
msgid "Base class for reference-counted objects."
msgstr ""
-#: doc/classes/Reference.xml:7
+#: doc/classes/RefCounted.xml:7
msgid ""
"Base class for any object that keeps a reference count. [Resource] and many "
"other helper objects inherit this class.\n"
"Unlike [Object]s, References keep an internal reference counter so that they "
"are automatically released when no longer in use, and only then. References "
"therefore do not need to be freed manually with [method Object.free].\n"
-"In the vast majority of use cases, instantiating and using [Reference]-"
+"In the vast majority of use cases, instantiating and using [RefCounted]-"
"derived types is all you need to do. The methods provided in this class are "
"only for advanced users, and can cause issues if misused."
msgstr ""
-#: doc/classes/Reference.xml:19
+#: doc/classes/RefCounted.xml:19
msgid ""
"Initializes the internal reference counter. Use this only if you really know "
"what you are doing.\n"
"Returns whether the initialization was successful."
msgstr ""
-#: doc/classes/Reference.xml:27
+#: doc/classes/RefCounted.xml:27
msgid ""
"Increments the internal reference counter. Use this only if you really know "
"what you are doing.\n"
@@ -53810,7 +53810,7 @@ msgid ""
"code] otherwise."
msgstr ""
-#: doc/classes/Reference.xml:35
+#: doc/classes/RefCounted.xml:35
msgid ""
"Decrements the internal reference counter. Use this only if you really know "
"what you are doing.\n"
@@ -66189,7 +66189,7 @@ msgid ""
"[codeblock]\n"
"var foo = 2 # foo is dynamically an integer\n"
"foo = \"Now foo is a string!\"\n"
-"foo = Reference.new() # foo is an Object\n"
+"foo = RefCounted.new() # foo is an Object\n"
"var bar: int = 2 # bar is a statically typed integer.\n"
"# bar = \"Uh oh! I can't make static variables become a different type!\"\n"
"[/codeblock]\n"
@@ -71348,7 +71348,7 @@ msgstr ""
#: doc/classes/WeakRef.xml:7
msgid ""
-"A weakref can hold a [Reference], without contributing to the reference "
+"A weakref can hold a [RefCounted], without contributing to the reference "
"counter. A weakref can be created from an [Object] using [method @GDScript."
"weakref]. If this object is not a reference, weakref still works, however, "
"it does not have any effect on the object. Weakrefs are useful in cases "
diff --git a/doc/translations/fa.po b/doc/translations/fa.po
index 733d3bb969..e440146dd3 100644
--- a/doc/translations/fa.po
+++ b/doc/translations/fa.po
@@ -33042,7 +33042,7 @@ msgid ""
"to delete instances of it manually. To do so, call the [method free] method "
"from your script or delete the instance from C++.\n"
"Some classes that extend Object add memory management. This is the case of "
-"[Reference], which counts references and deletes itself automatically when "
+"[RefCounted], which counts references and deletes itself automatically when "
"no longer referenced. [Node], another fundamental type, deletes all its "
"children when freed from memory.\n"
"Objects export properties, which are mainly useful for storage and editing, "
@@ -33061,12 +33061,12 @@ msgid ""
"Objects also receive notifications. Notifications are a simple way to notify "
"the object about different events, so they can all be handled together. See "
"[method _notification].\n"
-"[b]Note:[/b] Unlike references to a [Reference], references to an Object "
+"[b]Note:[/b] Unlike references to a [RefCounted], references to an Object "
"stored in a variable can become invalid without warning. Therefore, it's "
-"recommended to use [Reference] for data classes instead of [Object]."
+"recommended to use [RefCounted] for data classes instead of [Object]."
msgstr ""
-#: doc/classes/Object.xml:23 doc/classes/Reference.xml:12
+#: doc/classes/Object.xml:23 doc/classes/RefCounted.xml:12
#: doc/classes/Resource.xml:11
msgid ""
"https://docs.godotengine.org/en/latest/getting_started/workflow/"
@@ -34563,7 +34563,7 @@ msgid "Changes the [Color] at the given index."
msgstr ""
#: doc/classes/PackedDataContainerRef.xml:4
-msgid "Reference version of [PackedDataContainer]."
+msgid "RefCounted version of [PackedDataContainer]."
msgstr ""
#: doc/classes/PackedFloat32Array.xml:4
@@ -41771,30 +41771,30 @@ msgid ""
"the half extents."
msgstr ""
-#: doc/classes/Reference.xml:4
+#: doc/classes/RefCounted.xml:4
msgid "Base class for reference-counted objects."
msgstr ""
-#: doc/classes/Reference.xml:7
+#: doc/classes/RefCounted.xml:7
msgid ""
"Base class for any object that keeps a reference count. [Resource] and many "
"other helper objects inherit this class.\n"
"Unlike [Object]s, References keep an internal reference counter so that they "
"are automatically released when no longer in use, and only then. References "
"therefore do not need to be freed manually with [method Object.free].\n"
-"In the vast majority of use cases, instantiating and using [Reference]-"
+"In the vast majority of use cases, instantiating and using [RefCounted]-"
"derived types is all you need to do. The methods provided in this class are "
"only for advanced users, and can cause issues if misused."
msgstr ""
-#: doc/classes/Reference.xml:19
+#: doc/classes/RefCounted.xml:19
msgid ""
"Initializes the internal reference counter. Use this only if you really know "
"what you are doing.\n"
"Returns whether the initialization was successful."
msgstr ""
-#: doc/classes/Reference.xml:27
+#: doc/classes/RefCounted.xml:27
msgid ""
"Increments the internal reference counter. Use this only if you really know "
"what you are doing.\n"
@@ -41802,7 +41802,7 @@ msgid ""
"code] otherwise."
msgstr ""
-#: doc/classes/Reference.xml:35
+#: doc/classes/RefCounted.xml:35
msgid ""
"Decrements the internal reference counter. Use this only if you really know "
"what you are doing.\n"
@@ -54066,7 +54066,7 @@ msgid ""
"[codeblock]\n"
"var foo = 2 # foo is dynamically an integer\n"
"foo = \"Now foo is a string!\"\n"
-"foo = Reference.new() # foo is an Object\n"
+"foo = RefCounted.new() # foo is an Object\n"
"var bar: int = 2 # bar is a statically typed integer.\n"
"# bar = \"Uh oh! I can't make static variables become a different type!\"\n"
"[/codeblock]\n"
@@ -59145,7 +59145,7 @@ msgstr ""
#: doc/classes/WeakRef.xml:7
msgid ""
-"A weakref can hold a [Reference], without contributing to the reference "
+"A weakref can hold a [RefCounted], without contributing to the reference "
"counter. A weakref can be created from an [Object] using [method @GDScript."
"weakref]. If this object is not a reference, weakref still works, however, "
"it does not have any effect on the object. Weakrefs are useful in cases "
diff --git a/doc/translations/fi.po b/doc/translations/fi.po
index 0a40863a52..92ec4f29dd 100644
--- a/doc/translations/fi.po
+++ b/doc/translations/fi.po
@@ -33055,7 +33055,7 @@ msgid ""
"to delete instances of it manually. To do so, call the [method free] method "
"from your script or delete the instance from C++.\n"
"Some classes that extend Object add memory management. This is the case of "
-"[Reference], which counts references and deletes itself automatically when "
+"[RefCounted], which counts references and deletes itself automatically when "
"no longer referenced. [Node], another fundamental type, deletes all its "
"children when freed from memory.\n"
"Objects export properties, which are mainly useful for storage and editing, "
@@ -33074,12 +33074,12 @@ msgid ""
"Objects also receive notifications. Notifications are a simple way to notify "
"the object about different events, so they can all be handled together. See "
"[method _notification].\n"
-"[b]Note:[/b] Unlike references to a [Reference], references to an Object "
+"[b]Note:[/b] Unlike references to a [RefCounted], references to an Object "
"stored in a variable can become invalid without warning. Therefore, it's "
-"recommended to use [Reference] for data classes instead of [Object]."
+"recommended to use [RefCounted] for data classes instead of [Object]."
msgstr ""
-#: doc/classes/Object.xml:23 doc/classes/Reference.xml:12
+#: doc/classes/Object.xml:23 doc/classes/RefCounted.xml:12
#: doc/classes/Resource.xml:11
msgid ""
"https://docs.godotengine.org/en/latest/getting_started/workflow/"
@@ -34576,7 +34576,7 @@ msgid "Changes the [Color] at the given index."
msgstr ""
#: doc/classes/PackedDataContainerRef.xml:4
-msgid "Reference version of [PackedDataContainer]."
+msgid "RefCounted version of [PackedDataContainer]."
msgstr ""
#: doc/classes/PackedFloat32Array.xml:4
@@ -41784,30 +41784,30 @@ msgid ""
"the half extents."
msgstr ""
-#: doc/classes/Reference.xml:4
+#: doc/classes/RefCounted.xml:4
msgid "Base class for reference-counted objects."
msgstr ""
-#: doc/classes/Reference.xml:7
+#: doc/classes/RefCounted.xml:7
msgid ""
"Base class for any object that keeps a reference count. [Resource] and many "
"other helper objects inherit this class.\n"
"Unlike [Object]s, References keep an internal reference counter so that they "
"are automatically released when no longer in use, and only then. References "
"therefore do not need to be freed manually with [method Object.free].\n"
-"In the vast majority of use cases, instantiating and using [Reference]-"
+"In the vast majority of use cases, instantiating and using [RefCounted]-"
"derived types is all you need to do. The methods provided in this class are "
"only for advanced users, and can cause issues if misused."
msgstr ""
-#: doc/classes/Reference.xml:19
+#: doc/classes/RefCounted.xml:19
msgid ""
"Initializes the internal reference counter. Use this only if you really know "
"what you are doing.\n"
"Returns whether the initialization was successful."
msgstr ""
-#: doc/classes/Reference.xml:27
+#: doc/classes/RefCounted.xml:27
msgid ""
"Increments the internal reference counter. Use this only if you really know "
"what you are doing.\n"
@@ -41815,7 +41815,7 @@ msgid ""
"code] otherwise."
msgstr ""
-#: doc/classes/Reference.xml:35
+#: doc/classes/RefCounted.xml:35
msgid ""
"Decrements the internal reference counter. Use this only if you really know "
"what you are doing.\n"
@@ -54080,7 +54080,7 @@ msgid ""
"[codeblock]\n"
"var foo = 2 # foo is dynamically an integer\n"
"foo = \"Now foo is a string!\"\n"
-"foo = Reference.new() # foo is an Object\n"
+"foo = RefCounted.new() # foo is an Object\n"
"var bar: int = 2 # bar is a statically typed integer.\n"
"# bar = \"Uh oh! I can't make static variables become a different type!\"\n"
"[/codeblock]\n"
@@ -59168,7 +59168,7 @@ msgstr ""
#: doc/classes/WeakRef.xml:7
msgid ""
-"A weakref can hold a [Reference], without contributing to the reference "
+"A weakref can hold a [RefCounted], without contributing to the reference "
"counter. A weakref can be created from an [Object] using [method @GDScript."
"weakref]. If this object is not a reference, weakref still works, however, "
"it does not have any effect on the object. Weakrefs are useful in cases "
diff --git a/doc/translations/fr.po b/doc/translations/fr.po
index f3e26ebc61..7717474c0f 100644
--- a/doc/translations/fr.po
+++ b/doc/translations/fr.po
@@ -33403,7 +33403,7 @@ msgid ""
"to delete instances of it manually. To do so, call the [method free] method "
"from your script or delete the instance from C++.\n"
"Some classes that extend Object add memory management. This is the case of "
-"[Reference], which counts references and deletes itself automatically when "
+"[RefCounted], which counts references and deletes itself automatically when "
"no longer referenced. [Node], another fundamental type, deletes all its "
"children when freed from memory.\n"
"Objects export properties, which are mainly useful for storage and editing, "
@@ -33422,12 +33422,12 @@ msgid ""
"Objects also receive notifications. Notifications are a simple way to notify "
"the object about different events, so they can all be handled together. See "
"[method _notification].\n"
-"[b]Note:[/b] Unlike references to a [Reference], references to an Object "
+"[b]Note:[/b] Unlike references to a [RefCounted], references to an Object "
"stored in a variable can become invalid without warning. Therefore, it's "
-"recommended to use [Reference] for data classes instead of [Object]."
+"recommended to use [RefCounted] for data classes instead of [Object]."
msgstr ""
-#: doc/classes/Object.xml:23 doc/classes/Reference.xml:12
+#: doc/classes/Object.xml:23 doc/classes/RefCounted.xml:12
#: doc/classes/Resource.xml:11
msgid ""
"https://docs.godotengine.org/en/latest/getting_started/workflow/"
@@ -34927,7 +34927,7 @@ msgid "Changes the [Color] at the given index."
msgstr ""
#: doc/classes/PackedDataContainerRef.xml:4
-msgid "Reference version of [PackedDataContainer]."
+msgid "RefCounted version of [PackedDataContainer]."
msgstr ""
#: doc/classes/PackedFloat32Array.xml:4
@@ -42142,30 +42142,30 @@ msgid ""
"the half extents."
msgstr ""
-#: doc/classes/Reference.xml:4
+#: doc/classes/RefCounted.xml:4
msgid "Base class for reference-counted objects."
msgstr ""
-#: doc/classes/Reference.xml:7
+#: doc/classes/RefCounted.xml:7
msgid ""
"Base class for any object that keeps a reference count. [Resource] and many "
"other helper objects inherit this class.\n"
"Unlike [Object]s, References keep an internal reference counter so that they "
"are automatically released when no longer in use, and only then. References "
"therefore do not need to be freed manually with [method Object.free].\n"
-"In the vast majority of use cases, instantiating and using [Reference]-"
+"In the vast majority of use cases, instantiating and using [RefCounted]-"
"derived types is all you need to do. The methods provided in this class are "
"only for advanced users, and can cause issues if misused."
msgstr ""
-#: doc/classes/Reference.xml:19
+#: doc/classes/RefCounted.xml:19
msgid ""
"Initializes the internal reference counter. Use this only if you really know "
"what you are doing.\n"
"Returns whether the initialization was successful."
msgstr ""
-#: doc/classes/Reference.xml:27
+#: doc/classes/RefCounted.xml:27
msgid ""
"Increments the internal reference counter. Use this only if you really know "
"what you are doing.\n"
@@ -42173,7 +42173,7 @@ msgid ""
"code] otherwise."
msgstr ""
-#: doc/classes/Reference.xml:35
+#: doc/classes/RefCounted.xml:35
msgid ""
"Decrements the internal reference counter. Use this only if you really know "
"what you are doing.\n"
@@ -54519,7 +54519,7 @@ msgid ""
"[codeblock]\n"
"var foo = 2 # foo is dynamically an integer\n"
"foo = \"Now foo is a string!\"\n"
-"foo = Reference.new() # foo is an Object\n"
+"foo = RefCounted.new() # foo is an Object\n"
"var bar: int = 2 # bar is a statically typed integer.\n"
"# bar = \"Uh oh! I can't make static variables become a different type!\"\n"
"[/codeblock]\n"
@@ -59618,7 +59618,7 @@ msgstr ""
#: doc/classes/WeakRef.xml:7
msgid ""
-"A weakref can hold a [Reference], without contributing to the reference "
+"A weakref can hold a [RefCounted], without contributing to the reference "
"counter. A weakref can be created from an [Object] using [method @GDScript."
"weakref]. If this object is not a reference, weakref still works, however, "
"it does not have any effect on the object. Weakrefs are useful in cases "
diff --git a/doc/translations/id.po b/doc/translations/id.po
index 1bce3d6b50..edfd392f4f 100644
--- a/doc/translations/id.po
+++ b/doc/translations/id.po
@@ -33068,7 +33068,7 @@ msgid ""
"to delete instances of it manually. To do so, call the [method free] method "
"from your script or delete the instance from C++.\n"
"Some classes that extend Object add memory management. This is the case of "
-"[Reference], which counts references and deletes itself automatically when "
+"[RefCounted], which counts references and deletes itself automatically when "
"no longer referenced. [Node], another fundamental type, deletes all its "
"children when freed from memory.\n"
"Objects export properties, which are mainly useful for storage and editing, "
@@ -33087,12 +33087,12 @@ msgid ""
"Objects also receive notifications. Notifications are a simple way to notify "
"the object about different events, so they can all be handled together. See "
"[method _notification].\n"
-"[b]Note:[/b] Unlike references to a [Reference], references to an Object "
+"[b]Note:[/b] Unlike references to a [RefCounted], references to an Object "
"stored in a variable can become invalid without warning. Therefore, it's "
-"recommended to use [Reference] for data classes instead of [Object]."
+"recommended to use [RefCounted] for data classes instead of [Object]."
msgstr ""
-#: doc/classes/Object.xml:23 doc/classes/Reference.xml:12
+#: doc/classes/Object.xml:23 doc/classes/RefCounted.xml:12
#: doc/classes/Resource.xml:11
msgid ""
"https://docs.godotengine.org/en/latest/getting_started/workflow/"
@@ -34589,7 +34589,7 @@ msgid "Changes the [Color] at the given index."
msgstr ""
#: doc/classes/PackedDataContainerRef.xml:4
-msgid "Reference version of [PackedDataContainer]."
+msgid "RefCounted version of [PackedDataContainer]."
msgstr ""
#: doc/classes/PackedFloat32Array.xml:4
@@ -41797,30 +41797,30 @@ msgid ""
"the half extents."
msgstr ""
-#: doc/classes/Reference.xml:4
+#: doc/classes/RefCounted.xml:4
msgid "Base class for reference-counted objects."
msgstr ""
-#: doc/classes/Reference.xml:7
+#: doc/classes/RefCounted.xml:7
msgid ""
"Base class for any object that keeps a reference count. [Resource] and many "
"other helper objects inherit this class.\n"
"Unlike [Object]s, References keep an internal reference counter so that they "
"are automatically released when no longer in use, and only then. References "
"therefore do not need to be freed manually with [method Object.free].\n"
-"In the vast majority of use cases, instantiating and using [Reference]-"
+"In the vast majority of use cases, instantiating and using [RefCounted]-"
"derived types is all you need to do. The methods provided in this class are "
"only for advanced users, and can cause issues if misused."
msgstr ""
-#: doc/classes/Reference.xml:19
+#: doc/classes/RefCounted.xml:19
msgid ""
"Initializes the internal reference counter. Use this only if you really know "
"what you are doing.\n"
"Returns whether the initialization was successful."
msgstr ""
-#: doc/classes/Reference.xml:27
+#: doc/classes/RefCounted.xml:27
msgid ""
"Increments the internal reference counter. Use this only if you really know "
"what you are doing.\n"
@@ -41828,7 +41828,7 @@ msgid ""
"code] otherwise."
msgstr ""
-#: doc/classes/Reference.xml:35
+#: doc/classes/RefCounted.xml:35
msgid ""
"Decrements the internal reference counter. Use this only if you really know "
"what you are doing.\n"
@@ -54092,7 +54092,7 @@ msgid ""
"[codeblock]\n"
"var foo = 2 # foo is dynamically an integer\n"
"foo = \"Now foo is a string!\"\n"
-"foo = Reference.new() # foo is an Object\n"
+"foo = RefCounted.new() # foo is an Object\n"
"var bar: int = 2 # bar is a statically typed integer.\n"
"# bar = \"Uh oh! I can't make static variables become a different type!\"\n"
"[/codeblock]\n"
@@ -59171,7 +59171,7 @@ msgstr ""
#: doc/classes/WeakRef.xml:7
msgid ""
-"A weakref can hold a [Reference], without contributing to the reference "
+"A weakref can hold a [RefCounted], without contributing to the reference "
"counter. A weakref can be created from an [Object] using [method @GDScript."
"weakref]. If this object is not a reference, weakref still works, however, "
"it does not have any effect on the object. Weakrefs are useful in cases "
diff --git a/doc/translations/it.po b/doc/translations/it.po
index 18e162476c..353eae4116 100644
--- a/doc/translations/it.po
+++ b/doc/translations/it.po
@@ -33334,7 +33334,7 @@ msgid ""
"to delete instances of it manually. To do so, call the [method free] method "
"from your script or delete the instance from C++.\n"
"Some classes that extend Object add memory management. This is the case of "
-"[Reference], which counts references and deletes itself automatically when "
+"[RefCounted], which counts references and deletes itself automatically when "
"no longer referenced. [Node], another fundamental type, deletes all its "
"children when freed from memory.\n"
"Objects export properties, which are mainly useful for storage and editing, "
@@ -33353,12 +33353,12 @@ msgid ""
"Objects also receive notifications. Notifications are a simple way to notify "
"the object about different events, so they can all be handled together. See "
"[method _notification].\n"
-"[b]Note:[/b] Unlike references to a [Reference], references to an Object "
+"[b]Note:[/b] Unlike references to a [RefCounted], references to an Object "
"stored in a variable can become invalid without warning. Therefore, it's "
-"recommended to use [Reference] for data classes instead of [Object]."
+"recommended to use [RefCounted] for data classes instead of [Object]."
msgstr ""
-#: doc/classes/Object.xml:23 doc/classes/Reference.xml:12
+#: doc/classes/Object.xml:23 doc/classes/RefCounted.xml:12
#: doc/classes/Resource.xml:11
msgid ""
"https://docs.godotengine.org/en/latest/getting_started/workflow/"
@@ -34856,7 +34856,7 @@ msgid "Changes the [Color] at the given index."
msgstr ""
#: doc/classes/PackedDataContainerRef.xml:4
-msgid "Reference version of [PackedDataContainer]."
+msgid "RefCounted version of [PackedDataContainer]."
msgstr ""
#: doc/classes/PackedFloat32Array.xml:4
@@ -42067,30 +42067,30 @@ msgid ""
"the half extents."
msgstr ""
-#: doc/classes/Reference.xml:4
+#: doc/classes/RefCounted.xml:4
msgid "Base class for reference-counted objects."
msgstr ""
-#: doc/classes/Reference.xml:7
+#: doc/classes/RefCounted.xml:7
msgid ""
"Base class for any object that keeps a reference count. [Resource] and many "
"other helper objects inherit this class.\n"
"Unlike [Object]s, References keep an internal reference counter so that they "
"are automatically released when no longer in use, and only then. References "
"therefore do not need to be freed manually with [method Object.free].\n"
-"In the vast majority of use cases, instantiating and using [Reference]-"
+"In the vast majority of use cases, instantiating and using [RefCounted]-"
"derived types is all you need to do. The methods provided in this class are "
"only for advanced users, and can cause issues if misused."
msgstr ""
-#: doc/classes/Reference.xml:19
+#: doc/classes/RefCounted.xml:19
msgid ""
"Initializes the internal reference counter. Use this only if you really know "
"what you are doing.\n"
"Returns whether the initialization was successful."
msgstr ""
-#: doc/classes/Reference.xml:27
+#: doc/classes/RefCounted.xml:27
msgid ""
"Increments the internal reference counter. Use this only if you really know "
"what you are doing.\n"
@@ -42098,7 +42098,7 @@ msgid ""
"code] otherwise."
msgstr ""
-#: doc/classes/Reference.xml:35
+#: doc/classes/RefCounted.xml:35
msgid ""
"Decrements the internal reference counter. Use this only if you really know "
"what you are doing.\n"
@@ -54365,7 +54365,7 @@ msgid ""
"[codeblock]\n"
"var foo = 2 # foo is dynamically an integer\n"
"foo = \"Now foo is a string!\"\n"
-"foo = Reference.new() # foo is an Object\n"
+"foo = RefCounted.new() # foo is an Object\n"
"var bar: int = 2 # bar is a statically typed integer.\n"
"# bar = \"Uh oh! I can't make static variables become a different type!\"\n"
"[/codeblock]\n"
@@ -59459,7 +59459,7 @@ msgstr ""
#: doc/classes/WeakRef.xml:7
msgid ""
-"A weakref can hold a [Reference], without contributing to the reference "
+"A weakref can hold a [RefCounted], without contributing to the reference "
"counter. A weakref can be created from an [Object] using [method @GDScript."
"weakref]. If this object is not a reference, weakref still works, however, "
"it does not have any effect on the object. Weakrefs are useful in cases "
diff --git a/doc/translations/ja.po b/doc/translations/ja.po
index ede80a35ef..1424b24153 100644
--- a/doc/translations/ja.po
+++ b/doc/translations/ja.po
@@ -34306,7 +34306,7 @@ msgid ""
"to delete instances of it manually. To do so, call the [method free] method "
"from your script or delete the instance from C++.\n"
"Some classes that extend Object add memory management. This is the case of "
-"[Reference], which counts references and deletes itself automatically when "
+"[RefCounted], which counts references and deletes itself automatically when "
"no longer referenced. [Node], another fundamental type, deletes all its "
"children when freed from memory.\n"
"Objects export properties, which are mainly useful for storage and editing, "
@@ -34325,12 +34325,12 @@ msgid ""
"Objects also receive notifications. Notifications are a simple way to notify "
"the object about different events, so they can all be handled together. See "
"[method _notification].\n"
-"[b]Note:[/b] Unlike references to a [Reference], references to an Object "
+"[b]Note:[/b] Unlike references to a [RefCounted], references to an Object "
"stored in a variable can become invalid without warning. Therefore, it's "
-"recommended to use [Reference] for data classes instead of [Object]."
+"recommended to use [RefCounted] for data classes instead of [Object]."
msgstr ""
-#: doc/classes/Object.xml:23 doc/classes/Reference.xml:12
+#: doc/classes/Object.xml:23 doc/classes/RefCounted.xml:12
#: doc/classes/Resource.xml:11
#, fuzzy
msgid ""
@@ -35830,7 +35830,7 @@ msgid "Changes the [Color] at the given index."
msgstr ""
#: doc/classes/PackedDataContainerRef.xml:4
-msgid "Reference version of [PackedDataContainer]."
+msgid "RefCounted version of [PackedDataContainer]."
msgstr ""
#: doc/classes/PackedFloat32Array.xml:4
@@ -43046,30 +43046,30 @@ msgid ""
"the half extents."
msgstr ""
-#: doc/classes/Reference.xml:4
+#: doc/classes/RefCounted.xml:4
msgid "Base class for reference-counted objects."
msgstr ""
-#: doc/classes/Reference.xml:7
+#: doc/classes/RefCounted.xml:7
msgid ""
"Base class for any object that keeps a reference count. [Resource] and many "
"other helper objects inherit this class.\n"
"Unlike [Object]s, References keep an internal reference counter so that they "
"are automatically released when no longer in use, and only then. References "
"therefore do not need to be freed manually with [method Object.free].\n"
-"In the vast majority of use cases, instantiating and using [Reference]-"
+"In the vast majority of use cases, instantiating and using [RefCounted]-"
"derived types is all you need to do. The methods provided in this class are "
"only for advanced users, and can cause issues if misused."
msgstr ""
-#: doc/classes/Reference.xml:19
+#: doc/classes/RefCounted.xml:19
msgid ""
"Initializes the internal reference counter. Use this only if you really know "
"what you are doing.\n"
"Returns whether the initialization was successful."
msgstr ""
-#: doc/classes/Reference.xml:27
+#: doc/classes/RefCounted.xml:27
msgid ""
"Increments the internal reference counter. Use this only if you really know "
"what you are doing.\n"
@@ -43077,7 +43077,7 @@ msgid ""
"code] otherwise."
msgstr ""
-#: doc/classes/Reference.xml:35
+#: doc/classes/RefCounted.xml:35
msgid ""
"Decrements the internal reference counter. Use this only if you really know "
"what you are doing.\n"
@@ -55349,7 +55349,7 @@ msgid ""
"[codeblock]\n"
"var foo = 2 # foo is dynamically an integer\n"
"foo = \"Now foo is a string!\"\n"
-"foo = Reference.new() # foo is an Object\n"
+"foo = RefCounted.new() # foo is an Object\n"
"var bar: int = 2 # bar is a statically typed integer.\n"
"# bar = \"Uh oh! I can't make static variables become a different type!\"\n"
"[/codeblock]\n"
@@ -60446,7 +60446,7 @@ msgstr ""
#: doc/classes/WeakRef.xml:7
msgid ""
-"A weakref can hold a [Reference], without contributing to the reference "
+"A weakref can hold a [RefCounted], without contributing to the reference "
"counter. A weakref can be created from an [Object] using [method @GDScript."
"weakref]. If this object is not a reference, weakref still works, however, "
"it does not have any effect on the object. Weakrefs are useful in cases "
diff --git a/doc/translations/ko.po b/doc/translations/ko.po
index e71cd06ba7..8e8aef2eaf 100644
--- a/doc/translations/ko.po
+++ b/doc/translations/ko.po
@@ -33044,7 +33044,7 @@ msgid ""
"to delete instances of it manually. To do so, call the [method free] method "
"from your script or delete the instance from C++.\n"
"Some classes that extend Object add memory management. This is the case of "
-"[Reference], which counts references and deletes itself automatically when "
+"[RefCounted], which counts references and deletes itself automatically when "
"no longer referenced. [Node], another fundamental type, deletes all its "
"children when freed from memory.\n"
"Objects export properties, which are mainly useful for storage and editing, "
@@ -33063,12 +33063,12 @@ msgid ""
"Objects also receive notifications. Notifications are a simple way to notify "
"the object about different events, so they can all be handled together. See "
"[method _notification].\n"
-"[b]Note:[/b] Unlike references to a [Reference], references to an Object "
+"[b]Note:[/b] Unlike references to a [RefCounted], references to an Object "
"stored in a variable can become invalid without warning. Therefore, it's "
-"recommended to use [Reference] for data classes instead of [Object]."
+"recommended to use [RefCounted] for data classes instead of [Object]."
msgstr ""
-#: doc/classes/Object.xml:23 doc/classes/Reference.xml:12
+#: doc/classes/Object.xml:23 doc/classes/RefCounted.xml:12
#: doc/classes/Resource.xml:11
msgid ""
"https://docs.godotengine.org/en/latest/getting_started/workflow/"
@@ -34565,7 +34565,7 @@ msgid "Changes the [Color] at the given index."
msgstr ""
#: doc/classes/PackedDataContainerRef.xml:4
-msgid "Reference version of [PackedDataContainer]."
+msgid "RefCounted version of [PackedDataContainer]."
msgstr ""
#: doc/classes/PackedFloat32Array.xml:4
@@ -41773,30 +41773,30 @@ msgid ""
"the half extents."
msgstr ""
-#: doc/classes/Reference.xml:4
+#: doc/classes/RefCounted.xml:4
msgid "Base class for reference-counted objects."
msgstr ""
-#: doc/classes/Reference.xml:7
+#: doc/classes/RefCounted.xml:7
msgid ""
"Base class for any object that keeps a reference count. [Resource] and many "
"other helper objects inherit this class.\n"
"Unlike [Object]s, References keep an internal reference counter so that they "
"are automatically released when no longer in use, and only then. References "
"therefore do not need to be freed manually with [method Object.free].\n"
-"In the vast majority of use cases, instantiating and using [Reference]-"
+"In the vast majority of use cases, instantiating and using [RefCounted]-"
"derived types is all you need to do. The methods provided in this class are "
"only for advanced users, and can cause issues if misused."
msgstr ""
-#: doc/classes/Reference.xml:19
+#: doc/classes/RefCounted.xml:19
msgid ""
"Initializes the internal reference counter. Use this only if you really know "
"what you are doing.\n"
"Returns whether the initialization was successful."
msgstr ""
-#: doc/classes/Reference.xml:27
+#: doc/classes/RefCounted.xml:27
msgid ""
"Increments the internal reference counter. Use this only if you really know "
"what you are doing.\n"
@@ -41804,7 +41804,7 @@ msgid ""
"code] otherwise."
msgstr ""
-#: doc/classes/Reference.xml:35
+#: doc/classes/RefCounted.xml:35
msgid ""
"Decrements the internal reference counter. Use this only if you really know "
"what you are doing.\n"
@@ -54068,7 +54068,7 @@ msgid ""
"[codeblock]\n"
"var foo = 2 # foo is dynamically an integer\n"
"foo = \"Now foo is a string!\"\n"
-"foo = Reference.new() # foo is an Object\n"
+"foo = RefCounted.new() # foo is an Object\n"
"var bar: int = 2 # bar is a statically typed integer.\n"
"# bar = \"Uh oh! I can't make static variables become a different type!\"\n"
"[/codeblock]\n"
@@ -59149,7 +59149,7 @@ msgstr ""
#: doc/classes/WeakRef.xml:7
msgid ""
-"A weakref can hold a [Reference], without contributing to the reference "
+"A weakref can hold a [RefCounted], without contributing to the reference "
"counter. A weakref can be created from an [Object] using [method @GDScript."
"weakref]. If this object is not a reference, weakref still works, however, "
"it does not have any effect on the object. Weakrefs are useful in cases "
diff --git a/doc/translations/nl.po b/doc/translations/nl.po
index 032ff95bdb..096e59f497 100644
--- a/doc/translations/nl.po
+++ b/doc/translations/nl.po
@@ -33070,7 +33070,7 @@ msgid ""
"to delete instances of it manually. To do so, call the [method free] method "
"from your script or delete the instance from C++.\n"
"Some classes that extend Object add memory management. This is the case of "
-"[Reference], which counts references and deletes itself automatically when "
+"[RefCounted], which counts references and deletes itself automatically when "
"no longer referenced. [Node], another fundamental type, deletes all its "
"children when freed from memory.\n"
"Objects export properties, which are mainly useful for storage and editing, "
@@ -33089,12 +33089,12 @@ msgid ""
"Objects also receive notifications. Notifications are a simple way to notify "
"the object about different events, so they can all be handled together. See "
"[method _notification].\n"
-"[b]Note:[/b] Unlike references to a [Reference], references to an Object "
+"[b]Note:[/b] Unlike references to a [RefCounted], references to an Object "
"stored in a variable can become invalid without warning. Therefore, it's "
-"recommended to use [Reference] for data classes instead of [Object]."
+"recommended to use [RefCounted] for data classes instead of [Object]."
msgstr ""
-#: doc/classes/Object.xml:23 doc/classes/Reference.xml:12
+#: doc/classes/Object.xml:23 doc/classes/RefCounted.xml:12
#: doc/classes/Resource.xml:11
msgid ""
"https://docs.godotengine.org/en/latest/getting_started/workflow/"
@@ -34591,7 +34591,7 @@ msgid "Changes the [Color] at the given index."
msgstr ""
#: doc/classes/PackedDataContainerRef.xml:4
-msgid "Reference version of [PackedDataContainer]."
+msgid "RefCounted version of [PackedDataContainer]."
msgstr ""
#: doc/classes/PackedFloat32Array.xml:4
@@ -41799,30 +41799,30 @@ msgid ""
"the half extents."
msgstr ""
-#: doc/classes/Reference.xml:4
+#: doc/classes/RefCounted.xml:4
msgid "Base class for reference-counted objects."
msgstr ""
-#: doc/classes/Reference.xml:7
+#: doc/classes/RefCounted.xml:7
msgid ""
"Base class for any object that keeps a reference count. [Resource] and many "
"other helper objects inherit this class.\n"
"Unlike [Object]s, References keep an internal reference counter so that they "
"are automatically released when no longer in use, and only then. References "
"therefore do not need to be freed manually with [method Object.free].\n"
-"In the vast majority of use cases, instantiating and using [Reference]-"
+"In the vast majority of use cases, instantiating and using [RefCounted]-"
"derived types is all you need to do. The methods provided in this class are "
"only for advanced users, and can cause issues if misused."
msgstr ""
-#: doc/classes/Reference.xml:19
+#: doc/classes/RefCounted.xml:19
msgid ""
"Initializes the internal reference counter. Use this only if you really know "
"what you are doing.\n"
"Returns whether the initialization was successful."
msgstr ""
-#: doc/classes/Reference.xml:27
+#: doc/classes/RefCounted.xml:27
msgid ""
"Increments the internal reference counter. Use this only if you really know "
"what you are doing.\n"
@@ -41830,7 +41830,7 @@ msgid ""
"code] otherwise."
msgstr ""
-#: doc/classes/Reference.xml:35
+#: doc/classes/RefCounted.xml:35
msgid ""
"Decrements the internal reference counter. Use this only if you really know "
"what you are doing.\n"
@@ -54094,7 +54094,7 @@ msgid ""
"[codeblock]\n"
"var foo = 2 # foo is dynamically an integer\n"
"foo = \"Now foo is a string!\"\n"
-"foo = Reference.new() # foo is an Object\n"
+"foo = RefCounted.new() # foo is an Object\n"
"var bar: int = 2 # bar is a statically typed integer.\n"
"# bar = \"Uh oh! I can't make static variables become a different type!\"\n"
"[/codeblock]\n"
@@ -59173,7 +59173,7 @@ msgstr ""
#: doc/classes/WeakRef.xml:7
msgid ""
-"A weakref can hold a [Reference], without contributing to the reference "
+"A weakref can hold a [RefCounted], without contributing to the reference "
"counter. A weakref can be created from an [Object] using [method @GDScript."
"weakref]. If this object is not a reference, weakref still works, however, "
"it does not have any effect on the object. Weakrefs are useful in cases "
diff --git a/doc/translations/pl.po b/doc/translations/pl.po
index b0c94b55be..5ef41b155a 100644
--- a/doc/translations/pl.po
+++ b/doc/translations/pl.po
@@ -33089,7 +33089,7 @@ msgid ""
"to delete instances of it manually. To do so, call the [method free] method "
"from your script or delete the instance from C++.\n"
"Some classes that extend Object add memory management. This is the case of "
-"[Reference], which counts references and deletes itself automatically when "
+"[RefCounted], which counts references and deletes itself automatically when "
"no longer referenced. [Node], another fundamental type, deletes all its "
"children when freed from memory.\n"
"Objects export properties, which are mainly useful for storage and editing, "
@@ -33108,12 +33108,12 @@ msgid ""
"Objects also receive notifications. Notifications are a simple way to notify "
"the object about different events, so they can all be handled together. See "
"[method _notification].\n"
-"[b]Note:[/b] Unlike references to a [Reference], references to an Object "
+"[b]Note:[/b] Unlike references to a [RefCounted], references to an Object "
"stored in a variable can become invalid without warning. Therefore, it's "
-"recommended to use [Reference] for data classes instead of [Object]."
+"recommended to use [RefCounted] for data classes instead of [Object]."
msgstr ""
-#: doc/classes/Object.xml:23 doc/classes/Reference.xml:12
+#: doc/classes/Object.xml:23 doc/classes/RefCounted.xml:12
#: doc/classes/Resource.xml:11
msgid ""
"https://docs.godotengine.org/en/latest/getting_started/workflow/"
@@ -34610,7 +34610,7 @@ msgid "Changes the [Color] at the given index."
msgstr ""
#: doc/classes/PackedDataContainerRef.xml:4
-msgid "Reference version of [PackedDataContainer]."
+msgid "RefCounted version of [PackedDataContainer]."
msgstr ""
#: doc/classes/PackedFloat32Array.xml:4
@@ -41818,30 +41818,30 @@ msgid ""
"the half extents."
msgstr ""
-#: doc/classes/Reference.xml:4
+#: doc/classes/RefCounted.xml:4
msgid "Base class for reference-counted objects."
msgstr ""
-#: doc/classes/Reference.xml:7
+#: doc/classes/RefCounted.xml:7
msgid ""
"Base class for any object that keeps a reference count. [Resource] and many "
"other helper objects inherit this class.\n"
"Unlike [Object]s, References keep an internal reference counter so that they "
"are automatically released when no longer in use, and only then. References "
"therefore do not need to be freed manually with [method Object.free].\n"
-"In the vast majority of use cases, instantiating and using [Reference]-"
+"In the vast majority of use cases, instantiating and using [RefCounted]-"
"derived types is all you need to do. The methods provided in this class are "
"only for advanced users, and can cause issues if misused."
msgstr ""
-#: doc/classes/Reference.xml:19
+#: doc/classes/RefCounted.xml:19
msgid ""
"Initializes the internal reference counter. Use this only if you really know "
"what you are doing.\n"
"Returns whether the initialization was successful."
msgstr ""
-#: doc/classes/Reference.xml:27
+#: doc/classes/RefCounted.xml:27
msgid ""
"Increments the internal reference counter. Use this only if you really know "
"what you are doing.\n"
@@ -41849,7 +41849,7 @@ msgid ""
"code] otherwise."
msgstr ""
-#: doc/classes/Reference.xml:35
+#: doc/classes/RefCounted.xml:35
msgid ""
"Decrements the internal reference counter. Use this only if you really know "
"what you are doing.\n"
@@ -54117,7 +54117,7 @@ msgid ""
"[codeblock]\n"
"var foo = 2 # foo is dynamically an integer\n"
"foo = \"Now foo is a string!\"\n"
-"foo = Reference.new() # foo is an Object\n"
+"foo = RefCounted.new() # foo is an Object\n"
"var bar: int = 2 # bar is a statically typed integer.\n"
"# bar = \"Uh oh! I can't make static variables become a different type!\"\n"
"[/codeblock]\n"
@@ -59203,7 +59203,7 @@ msgstr ""
#: doc/classes/WeakRef.xml:7
msgid ""
-"A weakref can hold a [Reference], without contributing to the reference "
+"A weakref can hold a [RefCounted], without contributing to the reference "
"counter. A weakref can be created from an [Object] using [method @GDScript."
"weakref]. If this object is not a reference, weakref still works, however, "
"it does not have any effect on the object. Weakrefs are useful in cases "
diff --git a/doc/translations/pt_BR.po b/doc/translations/pt_BR.po
index a508d38859..ef62950d51 100644
--- a/doc/translations/pt_BR.po
+++ b/doc/translations/pt_BR.po
@@ -33083,7 +33083,7 @@ msgid ""
"to delete instances of it manually. To do so, call the [method free] method "
"from your script or delete the instance from C++.\n"
"Some classes that extend Object add memory management. This is the case of "
-"[Reference], which counts references and deletes itself automatically when "
+"[RefCounted], which counts references and deletes itself automatically when "
"no longer referenced. [Node], another fundamental type, deletes all its "
"children when freed from memory.\n"
"Objects export properties, which are mainly useful for storage and editing, "
@@ -33102,12 +33102,12 @@ msgid ""
"Objects also receive notifications. Notifications are a simple way to notify "
"the object about different events, so they can all be handled together. See "
"[method _notification].\n"
-"[b]Note:[/b] Unlike references to a [Reference], references to an Object "
+"[b]Note:[/b] Unlike references to a [RefCounted], references to an Object "
"stored in a variable can become invalid without warning. Therefore, it's "
-"recommended to use [Reference] for data classes instead of [Object]."
+"recommended to use [RefCounted] for data classes instead of [Object]."
msgstr ""
-#: doc/classes/Object.xml:23 doc/classes/Reference.xml:12
+#: doc/classes/Object.xml:23 doc/classes/RefCounted.xml:12
#: doc/classes/Resource.xml:11
msgid ""
"https://docs.godotengine.org/en/latest/getting_started/workflow/"
@@ -34604,7 +34604,7 @@ msgid "Changes the [Color] at the given index."
msgstr ""
#: doc/classes/PackedDataContainerRef.xml:4
-msgid "Reference version of [PackedDataContainer]."
+msgid "RefCounted version of [PackedDataContainer]."
msgstr ""
#: doc/classes/PackedFloat32Array.xml:4
@@ -41812,30 +41812,30 @@ msgid ""
"the half extents."
msgstr ""
-#: doc/classes/Reference.xml:4
+#: doc/classes/RefCounted.xml:4
msgid "Base class for reference-counted objects."
msgstr ""
-#: doc/classes/Reference.xml:7
+#: doc/classes/RefCounted.xml:7
msgid ""
"Base class for any object that keeps a reference count. [Resource] and many "
"other helper objects inherit this class.\n"
"Unlike [Object]s, References keep an internal reference counter so that they "
"are automatically released when no longer in use, and only then. References "
"therefore do not need to be freed manually with [method Object.free].\n"
-"In the vast majority of use cases, instantiating and using [Reference]-"
+"In the vast majority of use cases, instantiating and using [RefCounted]-"
"derived types is all you need to do. The methods provided in this class are "
"only for advanced users, and can cause issues if misused."
msgstr ""
-#: doc/classes/Reference.xml:19
+#: doc/classes/RefCounted.xml:19
msgid ""
"Initializes the internal reference counter. Use this only if you really know "
"what you are doing.\n"
"Returns whether the initialization was successful."
msgstr ""
-#: doc/classes/Reference.xml:27
+#: doc/classes/RefCounted.xml:27
msgid ""
"Increments the internal reference counter. Use this only if you really know "
"what you are doing.\n"
@@ -41843,7 +41843,7 @@ msgid ""
"code] otherwise."
msgstr ""
-#: doc/classes/Reference.xml:35
+#: doc/classes/RefCounted.xml:35
msgid ""
"Decrements the internal reference counter. Use this only if you really know "
"what you are doing.\n"
@@ -54108,7 +54108,7 @@ msgid ""
"[codeblock]\n"
"var foo = 2 # foo is dynamically an integer\n"
"foo = \"Now foo is a string!\"\n"
-"foo = Reference.new() # foo is an Object\n"
+"foo = RefCounted.new() # foo is an Object\n"
"var bar: int = 2 # bar is a statically typed integer.\n"
"# bar = \"Uh oh! I can't make static variables become a different type!\"\n"
"[/codeblock]\n"
@@ -59194,7 +59194,7 @@ msgstr ""
#: doc/classes/WeakRef.xml:7
msgid ""
-"A weakref can hold a [Reference], without contributing to the reference "
+"A weakref can hold a [RefCounted], without contributing to the reference "
"counter. A weakref can be created from an [Object] using [method @GDScript."
"weakref]. If this object is not a reference, weakref still works, however, "
"it does not have any effect on the object. Weakrefs are useful in cases "
diff --git a/doc/translations/ro.po b/doc/translations/ro.po
index 96c0161312..5f018aa497 100644
--- a/doc/translations/ro.po
+++ b/doc/translations/ro.po
@@ -33044,7 +33044,7 @@ msgid ""
"to delete instances of it manually. To do so, call the [method free] method "
"from your script or delete the instance from C++.\n"
"Some classes that extend Object add memory management. This is the case of "
-"[Reference], which counts references and deletes itself automatically when "
+"[RefCounted], which counts references and deletes itself automatically when "
"no longer referenced. [Node], another fundamental type, deletes all its "
"children when freed from memory.\n"
"Objects export properties, which are mainly useful for storage and editing, "
@@ -33063,12 +33063,12 @@ msgid ""
"Objects also receive notifications. Notifications are a simple way to notify "
"the object about different events, so they can all be handled together. See "
"[method _notification].\n"
-"[b]Note:[/b] Unlike references to a [Reference], references to an Object "
+"[b]Note:[/b] Unlike references to a [RefCounted], references to an Object "
"stored in a variable can become invalid without warning. Therefore, it's "
-"recommended to use [Reference] for data classes instead of [Object]."
+"recommended to use [RefCounted] for data classes instead of [Object]."
msgstr ""
-#: doc/classes/Object.xml:23 doc/classes/Reference.xml:12
+#: doc/classes/Object.xml:23 doc/classes/RefCounted.xml:12
#: doc/classes/Resource.xml:11
msgid ""
"https://docs.godotengine.org/en/latest/getting_started/workflow/"
@@ -34565,7 +34565,7 @@ msgid "Changes the [Color] at the given index."
msgstr ""
#: doc/classes/PackedDataContainerRef.xml:4
-msgid "Reference version of [PackedDataContainer]."
+msgid "RefCounted version of [PackedDataContainer]."
msgstr ""
#: doc/classes/PackedFloat32Array.xml:4
@@ -41773,30 +41773,30 @@ msgid ""
"the half extents."
msgstr ""
-#: doc/classes/Reference.xml:4
+#: doc/classes/RefCounted.xml:4
msgid "Base class for reference-counted objects."
msgstr ""
-#: doc/classes/Reference.xml:7
+#: doc/classes/RefCounted.xml:7
msgid ""
"Base class for any object that keeps a reference count. [Resource] and many "
"other helper objects inherit this class.\n"
"Unlike [Object]s, References keep an internal reference counter so that they "
"are automatically released when no longer in use, and only then. References "
"therefore do not need to be freed manually with [method Object.free].\n"
-"In the vast majority of use cases, instantiating and using [Reference]-"
+"In the vast majority of use cases, instantiating and using [RefCounted]-"
"derived types is all you need to do. The methods provided in this class are "
"only for advanced users, and can cause issues if misused."
msgstr ""
-#: doc/classes/Reference.xml:19
+#: doc/classes/RefCounted.xml:19
msgid ""
"Initializes the internal reference counter. Use this only if you really know "
"what you are doing.\n"
"Returns whether the initialization was successful."
msgstr ""
-#: doc/classes/Reference.xml:27
+#: doc/classes/RefCounted.xml:27
msgid ""
"Increments the internal reference counter. Use this only if you really know "
"what you are doing.\n"
@@ -41804,7 +41804,7 @@ msgid ""
"code] otherwise."
msgstr ""
-#: doc/classes/Reference.xml:35
+#: doc/classes/RefCounted.xml:35
msgid ""
"Decrements the internal reference counter. Use this only if you really know "
"what you are doing.\n"
@@ -54068,7 +54068,7 @@ msgid ""
"[codeblock]\n"
"var foo = 2 # foo is dynamically an integer\n"
"foo = \"Now foo is a string!\"\n"
-"foo = Reference.new() # foo is an Object\n"
+"foo = RefCounted.new() # foo is an Object\n"
"var bar: int = 2 # bar is a statically typed integer.\n"
"# bar = \"Uh oh! I can't make static variables become a different type!\"\n"
"[/codeblock]\n"
@@ -59147,7 +59147,7 @@ msgstr ""
#: doc/classes/WeakRef.xml:7
msgid ""
-"A weakref can hold a [Reference], without contributing to the reference "
+"A weakref can hold a [RefCounted], without contributing to the reference "
"counter. A weakref can be created from an [Object] using [method @GDScript."
"weakref]. If this object is not a reference, weakref still works, however, "
"it does not have any effect on the object. Weakrefs are useful in cases "
diff --git a/doc/translations/ru.po b/doc/translations/ru.po
index 1108967bc9..0d227beff7 100644
--- a/doc/translations/ru.po
+++ b/doc/translations/ru.po
@@ -33581,7 +33581,7 @@ msgid ""
"to delete instances of it manually. To do so, call the [method free] method "
"from your script or delete the instance from C++.\n"
"Some classes that extend Object add memory management. This is the case of "
-"[Reference], which counts references and deletes itself automatically when "
+"[RefCounted], which counts references and deletes itself automatically when "
"no longer referenced. [Node], another fundamental type, deletes all its "
"children when freed from memory.\n"
"Objects export properties, which are mainly useful for storage and editing, "
@@ -33600,12 +33600,12 @@ msgid ""
"Objects also receive notifications. Notifications are a simple way to notify "
"the object about different events, so they can all be handled together. See "
"[method _notification].\n"
-"[b]Note:[/b] Unlike references to a [Reference], references to an Object "
+"[b]Note:[/b] Unlike references to a [RefCounted], references to an Object "
"stored in a variable can become invalid without warning. Therefore, it's "
-"recommended to use [Reference] for data classes instead of [Object]."
+"recommended to use [RefCounted] for data classes instead of [Object]."
msgstr ""
-#: doc/classes/Object.xml:23 doc/classes/Reference.xml:12
+#: doc/classes/Object.xml:23 doc/classes/RefCounted.xml:12
#: doc/classes/Resource.xml:11
msgid ""
"https://docs.godotengine.org/en/latest/getting_started/workflow/"
@@ -35104,7 +35104,7 @@ msgid "Changes the [Color] at the given index."
msgstr ""
#: doc/classes/PackedDataContainerRef.xml:4
-msgid "Reference version of [PackedDataContainer]."
+msgid "RefCounted version of [PackedDataContainer]."
msgstr ""
#: doc/classes/PackedFloat32Array.xml:4
@@ -42362,30 +42362,30 @@ msgid ""
"the half extents."
msgstr ""
-#: doc/classes/Reference.xml:4
+#: doc/classes/RefCounted.xml:4
msgid "Base class for reference-counted objects."
msgstr ""
-#: doc/classes/Reference.xml:7
+#: doc/classes/RefCounted.xml:7
msgid ""
"Base class for any object that keeps a reference count. [Resource] and many "
"other helper objects inherit this class.\n"
"Unlike [Object]s, References keep an internal reference counter so that they "
"are automatically released when no longer in use, and only then. References "
"therefore do not need to be freed manually with [method Object.free].\n"
-"In the vast majority of use cases, instantiating and using [Reference]-"
+"In the vast majority of use cases, instantiating and using [RefCounted]-"
"derived types is all you need to do. The methods provided in this class are "
"only for advanced users, and can cause issues if misused."
msgstr ""
-#: doc/classes/Reference.xml:19
+#: doc/classes/RefCounted.xml:19
msgid ""
"Initializes the internal reference counter. Use this only if you really know "
"what you are doing.\n"
"Returns whether the initialization was successful."
msgstr ""
-#: doc/classes/Reference.xml:27
+#: doc/classes/RefCounted.xml:27
msgid ""
"Increments the internal reference counter. Use this only if you really know "
"what you are doing.\n"
@@ -42393,7 +42393,7 @@ msgid ""
"code] otherwise."
msgstr ""
-#: doc/classes/Reference.xml:35
+#: doc/classes/RefCounted.xml:35
msgid ""
"Decrements the internal reference counter. Use this only if you really know "
"what you are doing.\n"
@@ -54666,7 +54666,7 @@ msgid ""
"[codeblock]\n"
"var foo = 2 # foo is dynamically an integer\n"
"foo = \"Now foo is a string!\"\n"
-"foo = Reference.new() # foo is an Object\n"
+"foo = RefCounted.new() # foo is an Object\n"
"var bar: int = 2 # bar is a statically typed integer.\n"
"# bar = \"Uh oh! I can't make static variables become a different type!\"\n"
"[/codeblock]\n"
@@ -59891,7 +59891,7 @@ msgstr ""
#: doc/classes/WeakRef.xml:7
msgid ""
-"A weakref can hold a [Reference], without contributing to the reference "
+"A weakref can hold a [RefCounted], without contributing to the reference "
"counter. A weakref can be created from an [Object] using [method @GDScript."
"weakref]. If this object is not a reference, weakref still works, however, "
"it does not have any effect on the object. Weakrefs are useful in cases "
diff --git a/doc/translations/sr_Cyrl.po b/doc/translations/sr_Cyrl.po
index d7d2911b97..d53711d996 100644
--- a/doc/translations/sr_Cyrl.po
+++ b/doc/translations/sr_Cyrl.po
@@ -33054,7 +33054,7 @@ msgid ""
"to delete instances of it manually. To do so, call the [method free] method "
"from your script or delete the instance from C++.\n"
"Some classes that extend Object add memory management. This is the case of "
-"[Reference], which counts references and deletes itself automatically when "
+"[RefCounted], which counts references and deletes itself automatically when "
"no longer referenced. [Node], another fundamental type, deletes all its "
"children when freed from memory.\n"
"Objects export properties, which are mainly useful for storage and editing, "
@@ -33073,12 +33073,12 @@ msgid ""
"Objects also receive notifications. Notifications are a simple way to notify "
"the object about different events, so they can all be handled together. See "
"[method _notification].\n"
-"[b]Note:[/b] Unlike references to a [Reference], references to an Object "
+"[b]Note:[/b] Unlike references to a [RefCounted], references to an Object "
"stored in a variable can become invalid without warning. Therefore, it's "
-"recommended to use [Reference] for data classes instead of [Object]."
+"recommended to use [RefCounted] for data classes instead of [Object]."
msgstr ""
-#: doc/classes/Object.xml:23 doc/classes/Reference.xml:12
+#: doc/classes/Object.xml:23 doc/classes/RefCounted.xml:12
#: doc/classes/Resource.xml:11
msgid ""
"https://docs.godotengine.org/en/latest/getting_started/workflow/"
@@ -34575,7 +34575,7 @@ msgid "Changes the [Color] at the given index."
msgstr ""
#: doc/classes/PackedDataContainerRef.xml:4
-msgid "Reference version of [PackedDataContainer]."
+msgid "RefCounted version of [PackedDataContainer]."
msgstr ""
#: doc/classes/PackedFloat32Array.xml:4
@@ -41783,30 +41783,30 @@ msgid ""
"the half extents."
msgstr ""
-#: doc/classes/Reference.xml:4
+#: doc/classes/RefCounted.xml:4
msgid "Base class for reference-counted objects."
msgstr ""
-#: doc/classes/Reference.xml:7
+#: doc/classes/RefCounted.xml:7
msgid ""
"Base class for any object that keeps a reference count. [Resource] and many "
"other helper objects inherit this class.\n"
"Unlike [Object]s, References keep an internal reference counter so that they "
"are automatically released when no longer in use, and only then. References "
"therefore do not need to be freed manually with [method Object.free].\n"
-"In the vast majority of use cases, instantiating and using [Reference]-"
+"In the vast majority of use cases, instantiating and using [RefCounted]-"
"derived types is all you need to do. The methods provided in this class are "
"only for advanced users, and can cause issues if misused."
msgstr ""
-#: doc/classes/Reference.xml:19
+#: doc/classes/RefCounted.xml:19
msgid ""
"Initializes the internal reference counter. Use this only if you really know "
"what you are doing.\n"
"Returns whether the initialization was successful."
msgstr ""
-#: doc/classes/Reference.xml:27
+#: doc/classes/RefCounted.xml:27
msgid ""
"Increments the internal reference counter. Use this only if you really know "
"what you are doing.\n"
@@ -41814,7 +41814,7 @@ msgid ""
"code] otherwise."
msgstr ""
-#: doc/classes/Reference.xml:35
+#: doc/classes/RefCounted.xml:35
msgid ""
"Decrements the internal reference counter. Use this only if you really know "
"what you are doing.\n"
@@ -54078,7 +54078,7 @@ msgid ""
"[codeblock]\n"
"var foo = 2 # foo is dynamically an integer\n"
"foo = \"Now foo is a string!\"\n"
-"foo = Reference.new() # foo is an Object\n"
+"foo = RefCounted.new() # foo is an Object\n"
"var bar: int = 2 # bar is a statically typed integer.\n"
"# bar = \"Uh oh! I can't make static variables become a different type!\"\n"
"[/codeblock]\n"
@@ -59157,7 +59157,7 @@ msgstr ""
#: doc/classes/WeakRef.xml:7
msgid ""
-"A weakref can hold a [Reference], without contributing to the reference "
+"A weakref can hold a [RefCounted], without contributing to the reference "
"counter. A weakref can be created from an [Object] using [method @GDScript."
"weakref]. If this object is not a reference, weakref still works, however, "
"it does not have any effect on the object. Weakrefs are useful in cases "
diff --git a/doc/translations/th.po b/doc/translations/th.po
index 5031ecfb0e..7686e22f19 100644
--- a/doc/translations/th.po
+++ b/doc/translations/th.po
@@ -33060,7 +33060,7 @@ msgid ""
"to delete instances of it manually. To do so, call the [method free] method "
"from your script or delete the instance from C++.\n"
"Some classes that extend Object add memory management. This is the case of "
-"[Reference], which counts references and deletes itself automatically when "
+"[RefCounted], which counts references and deletes itself automatically when "
"no longer referenced. [Node], another fundamental type, deletes all its "
"children when freed from memory.\n"
"Objects export properties, which are mainly useful for storage and editing, "
@@ -33079,12 +33079,12 @@ msgid ""
"Objects also receive notifications. Notifications are a simple way to notify "
"the object about different events, so they can all be handled together. See "
"[method _notification].\n"
-"[b]Note:[/b] Unlike references to a [Reference], references to an Object "
+"[b]Note:[/b] Unlike references to a [RefCounted], references to an Object "
"stored in a variable can become invalid without warning. Therefore, it's "
-"recommended to use [Reference] for data classes instead of [Object]."
+"recommended to use [RefCounted] for data classes instead of [Object]."
msgstr ""
-#: doc/classes/Object.xml:23 doc/classes/Reference.xml:12
+#: doc/classes/Object.xml:23 doc/classes/RefCounted.xml:12
#: doc/classes/Resource.xml:11
msgid ""
"https://docs.godotengine.org/en/latest/getting_started/workflow/"
@@ -34581,7 +34581,7 @@ msgid "Changes the [Color] at the given index."
msgstr ""
#: doc/classes/PackedDataContainerRef.xml:4
-msgid "Reference version of [PackedDataContainer]."
+msgid "RefCounted version of [PackedDataContainer]."
msgstr ""
#: doc/classes/PackedFloat32Array.xml:4
@@ -41789,30 +41789,30 @@ msgid ""
"the half extents."
msgstr ""
-#: doc/classes/Reference.xml:4
+#: doc/classes/RefCounted.xml:4
msgid "Base class for reference-counted objects."
msgstr ""
-#: doc/classes/Reference.xml:7
+#: doc/classes/RefCounted.xml:7
msgid ""
"Base class for any object that keeps a reference count. [Resource] and many "
"other helper objects inherit this class.\n"
"Unlike [Object]s, References keep an internal reference counter so that they "
"are automatically released when no longer in use, and only then. References "
"therefore do not need to be freed manually with [method Object.free].\n"
-"In the vast majority of use cases, instantiating and using [Reference]-"
+"In the vast majority of use cases, instantiating and using [RefCounted]-"
"derived types is all you need to do. The methods provided in this class are "
"only for advanced users, and can cause issues if misused."
msgstr ""
-#: doc/classes/Reference.xml:19
+#: doc/classes/RefCounted.xml:19
msgid ""
"Initializes the internal reference counter. Use this only if you really know "
"what you are doing.\n"
"Returns whether the initialization was successful."
msgstr ""
-#: doc/classes/Reference.xml:27
+#: doc/classes/RefCounted.xml:27
msgid ""
"Increments the internal reference counter. Use this only if you really know "
"what you are doing.\n"
@@ -41820,7 +41820,7 @@ msgid ""
"code] otherwise."
msgstr ""
-#: doc/classes/Reference.xml:35
+#: doc/classes/RefCounted.xml:35
msgid ""
"Decrements the internal reference counter. Use this only if you really know "
"what you are doing.\n"
@@ -54084,7 +54084,7 @@ msgid ""
"[codeblock]\n"
"var foo = 2 # foo is dynamically an integer\n"
"foo = \"Now foo is a string!\"\n"
-"foo = Reference.new() # foo is an Object\n"
+"foo = RefCounted.new() # foo is an Object\n"
"var bar: int = 2 # bar is a statically typed integer.\n"
"# bar = \"Uh oh! I can't make static variables become a different type!\"\n"
"[/codeblock]\n"
@@ -59163,7 +59163,7 @@ msgstr ""
#: doc/classes/WeakRef.xml:7
msgid ""
-"A weakref can hold a [Reference], without contributing to the reference "
+"A weakref can hold a [RefCounted], without contributing to the reference "
"counter. A weakref can be created from an [Object] using [method @GDScript."
"weakref]. If this object is not a reference, weakref still works, however, "
"it does not have any effect on the object. Weakrefs are useful in cases "
diff --git a/doc/translations/tr.po b/doc/translations/tr.po
index a317f4ee83..df9897f1d6 100644
--- a/doc/translations/tr.po
+++ b/doc/translations/tr.po
@@ -33036,7 +33036,7 @@ msgid ""
"to delete instances of it manually. To do so, call the [method free] method "
"from your script or delete the instance from C++.\n"
"Some classes that extend Object add memory management. This is the case of "
-"[Reference], which counts references and deletes itself automatically when "
+"[RefCounted], which counts references and deletes itself automatically when "
"no longer referenced. [Node], another fundamental type, deletes all its "
"children when freed from memory.\n"
"Objects export properties, which are mainly useful for storage and editing, "
@@ -33055,12 +33055,12 @@ msgid ""
"Objects also receive notifications. Notifications are a simple way to notify "
"the object about different events, so they can all be handled together. See "
"[method _notification].\n"
-"[b]Note:[/b] Unlike references to a [Reference], references to an Object "
+"[b]Note:[/b] Unlike references to a [RefCounted], references to an Object "
"stored in a variable can become invalid without warning. Therefore, it's "
-"recommended to use [Reference] for data classes instead of [Object]."
+"recommended to use [RefCounted] for data classes instead of [Object]."
msgstr ""
-#: doc/classes/Object.xml:23 doc/classes/Reference.xml:12
+#: doc/classes/Object.xml:23 doc/classes/RefCounted.xml:12
#: doc/classes/Resource.xml:11
msgid ""
"https://docs.godotengine.org/en/latest/getting_started/workflow/"
@@ -34557,7 +34557,7 @@ msgid "Changes the [Color] at the given index."
msgstr ""
#: doc/classes/PackedDataContainerRef.xml:4
-msgid "Reference version of [PackedDataContainer]."
+msgid "RefCounted version of [PackedDataContainer]."
msgstr ""
#: doc/classes/PackedFloat32Array.xml:4
@@ -41765,30 +41765,30 @@ msgid ""
"the half extents."
msgstr ""
-#: doc/classes/Reference.xml:4
+#: doc/classes/RefCounted.xml:4
msgid "Base class for reference-counted objects."
msgstr ""
-#: doc/classes/Reference.xml:7
+#: doc/classes/RefCounted.xml:7
msgid ""
"Base class for any object that keeps a reference count. [Resource] and many "
"other helper objects inherit this class.\n"
"Unlike [Object]s, References keep an internal reference counter so that they "
"are automatically released when no longer in use, and only then. References "
"therefore do not need to be freed manually with [method Object.free].\n"
-"In the vast majority of use cases, instantiating and using [Reference]-"
+"In the vast majority of use cases, instantiating and using [RefCounted]-"
"derived types is all you need to do. The methods provided in this class are "
"only for advanced users, and can cause issues if misused."
msgstr ""
-#: doc/classes/Reference.xml:19
+#: doc/classes/RefCounted.xml:19
msgid ""
"Initializes the internal reference counter. Use this only if you really know "
"what you are doing.\n"
"Returns whether the initialization was successful."
msgstr ""
-#: doc/classes/Reference.xml:27
+#: doc/classes/RefCounted.xml:27
msgid ""
"Increments the internal reference counter. Use this only if you really know "
"what you are doing.\n"
@@ -41796,7 +41796,7 @@ msgid ""
"code] otherwise."
msgstr ""
-#: doc/classes/Reference.xml:35
+#: doc/classes/RefCounted.xml:35
msgid ""
"Decrements the internal reference counter. Use this only if you really know "
"what you are doing.\n"
@@ -54060,7 +54060,7 @@ msgid ""
"[codeblock]\n"
"var foo = 2 # foo is dynamically an integer\n"
"foo = \"Now foo is a string!\"\n"
-"foo = Reference.new() # foo is an Object\n"
+"foo = RefCounted.new() # foo is an Object\n"
"var bar: int = 2 # bar is a statically typed integer.\n"
"# bar = \"Uh oh! I can't make static variables become a different type!\"\n"
"[/codeblock]\n"
@@ -59139,7 +59139,7 @@ msgstr ""
#: doc/classes/WeakRef.xml:7
msgid ""
-"A weakref can hold a [Reference], without contributing to the reference "
+"A weakref can hold a [RefCounted], without contributing to the reference "
"counter. A weakref can be created from an [Object] using [method @GDScript."
"weakref]. If this object is not a reference, weakref still works, however, "
"it does not have any effect on the object. Weakrefs are useful in cases "
diff --git a/doc/translations/uk.po b/doc/translations/uk.po
index 8ca75e8b19..d1296da87a 100644
--- a/doc/translations/uk.po
+++ b/doc/translations/uk.po
@@ -33122,7 +33122,7 @@ msgid ""
"to delete instances of it manually. To do so, call the [method free] method "
"from your script or delete the instance from C++.\n"
"Some classes that extend Object add memory management. This is the case of "
-"[Reference], which counts references and deletes itself automatically when "
+"[RefCounted], which counts references and deletes itself automatically when "
"no longer referenced. [Node], another fundamental type, deletes all its "
"children when freed from memory.\n"
"Objects export properties, which are mainly useful for storage and editing, "
@@ -33141,12 +33141,12 @@ msgid ""
"Objects also receive notifications. Notifications are a simple way to notify "
"the object about different events, so they can all be handled together. See "
"[method _notification].\n"
-"[b]Note:[/b] Unlike references to a [Reference], references to an Object "
+"[b]Note:[/b] Unlike references to a [RefCounted], references to an Object "
"stored in a variable can become invalid without warning. Therefore, it's "
-"recommended to use [Reference] for data classes instead of [Object]."
+"recommended to use [RefCounted] for data classes instead of [Object]."
msgstr ""
-#: doc/classes/Object.xml:23 doc/classes/Reference.xml:12
+#: doc/classes/Object.xml:23 doc/classes/RefCounted.xml:12
#: doc/classes/Resource.xml:11
msgid ""
"https://docs.godotengine.org/en/latest/getting_started/workflow/"
@@ -34643,7 +34643,7 @@ msgid "Changes the [Color] at the given index."
msgstr ""
#: doc/classes/PackedDataContainerRef.xml:4
-msgid "Reference version of [PackedDataContainer]."
+msgid "RefCounted version of [PackedDataContainer]."
msgstr ""
#: doc/classes/PackedFloat32Array.xml:4
@@ -41851,30 +41851,30 @@ msgid ""
"the half extents."
msgstr ""
-#: doc/classes/Reference.xml:4
+#: doc/classes/RefCounted.xml:4
msgid "Base class for reference-counted objects."
msgstr ""
-#: doc/classes/Reference.xml:7
+#: doc/classes/RefCounted.xml:7
msgid ""
"Base class for any object that keeps a reference count. [Resource] and many "
"other helper objects inherit this class.\n"
"Unlike [Object]s, References keep an internal reference counter so that they "
"are automatically released when no longer in use, and only then. References "
"therefore do not need to be freed manually with [method Object.free].\n"
-"In the vast majority of use cases, instantiating and using [Reference]-"
+"In the vast majority of use cases, instantiating and using [RefCounted]-"
"derived types is all you need to do. The methods provided in this class are "
"only for advanced users, and can cause issues if misused."
msgstr ""
-#: doc/classes/Reference.xml:19
+#: doc/classes/RefCounted.xml:19
msgid ""
"Initializes the internal reference counter. Use this only if you really know "
"what you are doing.\n"
"Returns whether the initialization was successful."
msgstr ""
-#: doc/classes/Reference.xml:27
+#: doc/classes/RefCounted.xml:27
msgid ""
"Increments the internal reference counter. Use this only if you really know "
"what you are doing.\n"
@@ -41882,7 +41882,7 @@ msgid ""
"code] otherwise."
msgstr ""
-#: doc/classes/Reference.xml:35
+#: doc/classes/RefCounted.xml:35
msgid ""
"Decrements the internal reference counter. Use this only if you really know "
"what you are doing.\n"
@@ -54147,7 +54147,7 @@ msgid ""
"[codeblock]\n"
"var foo = 2 # foo is dynamically an integer\n"
"foo = \"Now foo is a string!\"\n"
-"foo = Reference.new() # foo is an Object\n"
+"foo = RefCounted.new() # foo is an Object\n"
"var bar: int = 2 # bar is a statically typed integer.\n"
"# bar = \"Uh oh! I can't make static variables become a different type!\"\n"
"[/codeblock]\n"
@@ -59237,7 +59237,7 @@ msgstr ""
#: doc/classes/WeakRef.xml:7
msgid ""
-"A weakref can hold a [Reference], without contributing to the reference "
+"A weakref can hold a [RefCounted], without contributing to the reference "
"counter. A weakref can be created from an [Object] using [method @GDScript."
"weakref]. If this object is not a reference, weakref still works, however, "
"it does not have any effect on the object. Weakrefs are useful in cases "
diff --git a/doc/translations/zh_Hans.po b/doc/translations/zh_Hans.po
index aee852699c..edfb11dec1 100644
--- a/doc/translations/zh_Hans.po
+++ b/doc/translations/zh_Hans.po
@@ -33272,7 +33272,7 @@ msgid ""
"to delete instances of it manually. To do so, call the [method free] method "
"from your script or delete the instance from C++.\n"
"Some classes that extend Object add memory management. This is the case of "
-"[Reference], which counts references and deletes itself automatically when "
+"[RefCounted], which counts references and deletes itself automatically when "
"no longer referenced. [Node], another fundamental type, deletes all its "
"children when freed from memory.\n"
"Objects export properties, which are mainly useful for storage and editing, "
@@ -33291,12 +33291,12 @@ msgid ""
"Objects also receive notifications. Notifications are a simple way to notify "
"the object about different events, so they can all be handled together. See "
"[method _notification].\n"
-"[b]Note:[/b] Unlike references to a [Reference], references to an Object "
+"[b]Note:[/b] Unlike references to a [RefCounted], references to an Object "
"stored in a variable can become invalid without warning. Therefore, it's "
-"recommended to use [Reference] for data classes instead of [Object]."
+"recommended to use [RefCounted] for data classes instead of [Object]."
msgstr ""
-#: doc/classes/Object.xml:23 doc/classes/Reference.xml:12
+#: doc/classes/Object.xml:23 doc/classes/RefCounted.xml:12
#: doc/classes/Resource.xml:11
msgid ""
"https://docs.godotengine.org/en/latest/getting_started/workflow/"
@@ -34794,7 +34794,7 @@ msgid "Changes the [Color] at the given index."
msgstr ""
#: doc/classes/PackedDataContainerRef.xml:4
-msgid "Reference version of [PackedDataContainer]."
+msgid "RefCounted version of [PackedDataContainer]."
msgstr ""
#: doc/classes/PackedFloat32Array.xml:4
@@ -42002,30 +42002,30 @@ msgid ""
"the half extents."
msgstr ""
-#: doc/classes/Reference.xml:4
+#: doc/classes/RefCounted.xml:4
msgid "Base class for reference-counted objects."
msgstr ""
-#: doc/classes/Reference.xml:7
+#: doc/classes/RefCounted.xml:7
msgid ""
"Base class for any object that keeps a reference count. [Resource] and many "
"other helper objects inherit this class.\n"
"Unlike [Object]s, References keep an internal reference counter so that they "
"are automatically released when no longer in use, and only then. References "
"therefore do not need to be freed manually with [method Object.free].\n"
-"In the vast majority of use cases, instantiating and using [Reference]-"
+"In the vast majority of use cases, instantiating and using [RefCounted]-"
"derived types is all you need to do. The methods provided in this class are "
"only for advanced users, and can cause issues if misused."
msgstr ""
-#: doc/classes/Reference.xml:19
+#: doc/classes/RefCounted.xml:19
msgid ""
"Initializes the internal reference counter. Use this only if you really know "
"what you are doing.\n"
"Returns whether the initialization was successful."
msgstr ""
-#: doc/classes/Reference.xml:27
+#: doc/classes/RefCounted.xml:27
msgid ""
"Increments the internal reference counter. Use this only if you really know "
"what you are doing.\n"
@@ -42033,7 +42033,7 @@ msgid ""
"code] otherwise."
msgstr ""
-#: doc/classes/Reference.xml:35
+#: doc/classes/RefCounted.xml:35
msgid ""
"Decrements the internal reference counter. Use this only if you really know "
"what you are doing.\n"
@@ -54298,7 +54298,7 @@ msgid ""
"[codeblock]\n"
"var foo = 2 # foo is dynamically an integer\n"
"foo = \"Now foo is a string!\"\n"
-"foo = Reference.new() # foo is an Object\n"
+"foo = RefCounted.new() # foo is an Object\n"
"var bar: int = 2 # bar is a statically typed integer.\n"
"# bar = \"Uh oh! I can't make static variables become a different type!\"\n"
"[/codeblock]\n"
@@ -59381,7 +59381,7 @@ msgstr ""
#: doc/classes/WeakRef.xml:7
msgid ""
-"A weakref can hold a [Reference], without contributing to the reference "
+"A weakref can hold a [RefCounted], without contributing to the reference "
"counter. A weakref can be created from an [Object] using [method @GDScript."
"weakref]. If this object is not a reference, weakref still works, however, "
"it does not have any effect on the object. Weakrefs are useful in cases "
diff --git a/doc/translations/zh_Hant.po b/doc/translations/zh_Hant.po
index 242c8cc086..3afec7ead8 100644
--- a/doc/translations/zh_Hant.po
+++ b/doc/translations/zh_Hant.po
@@ -33073,7 +33073,7 @@ msgid ""
"to delete instances of it manually. To do so, call the [method free] method "
"from your script or delete the instance from C++.\n"
"Some classes that extend Object add memory management. This is the case of "
-"[Reference], which counts references and deletes itself automatically when "
+"[RefCounted], which counts references and deletes itself automatically when "
"no longer referenced. [Node], another fundamental type, deletes all its "
"children when freed from memory.\n"
"Objects export properties, which are mainly useful for storage and editing, "
@@ -33092,12 +33092,12 @@ msgid ""
"Objects also receive notifications. Notifications are a simple way to notify "
"the object about different events, so they can all be handled together. See "
"[method _notification].\n"
-"[b]Note:[/b] Unlike references to a [Reference], references to an Object "
+"[b]Note:[/b] Unlike references to a [RefCounted], references to an Object "
"stored in a variable can become invalid without warning. Therefore, it's "
-"recommended to use [Reference] for data classes instead of [Object]."
+"recommended to use [RefCounted] for data classes instead of [Object]."
msgstr ""
-#: doc/classes/Object.xml:23 doc/classes/Reference.xml:12
+#: doc/classes/Object.xml:23 doc/classes/RefCounted.xml:12
#: doc/classes/Resource.xml:11
msgid ""
"https://docs.godotengine.org/en/latest/getting_started/workflow/"
@@ -34594,7 +34594,7 @@ msgid "Changes the [Color] at the given index."
msgstr ""
#: doc/classes/PackedDataContainerRef.xml:4
-msgid "Reference version of [PackedDataContainer]."
+msgid "RefCounted version of [PackedDataContainer]."
msgstr ""
#: doc/classes/PackedFloat32Array.xml:4
@@ -41802,30 +41802,30 @@ msgid ""
"the half extents."
msgstr ""
-#: doc/classes/Reference.xml:4
+#: doc/classes/RefCounted.xml:4
msgid "Base class for reference-counted objects."
msgstr ""
-#: doc/classes/Reference.xml:7
+#: doc/classes/RefCounted.xml:7
msgid ""
"Base class for any object that keeps a reference count. [Resource] and many "
"other helper objects inherit this class.\n"
"Unlike [Object]s, References keep an internal reference counter so that they "
"are automatically released when no longer in use, and only then. References "
"therefore do not need to be freed manually with [method Object.free].\n"
-"In the vast majority of use cases, instantiating and using [Reference]-"
+"In the vast majority of use cases, instantiating and using [RefCounted]-"
"derived types is all you need to do. The methods provided in this class are "
"only for advanced users, and can cause issues if misused."
msgstr ""
-#: doc/classes/Reference.xml:19
+#: doc/classes/RefCounted.xml:19
msgid ""
"Initializes the internal reference counter. Use this only if you really know "
"what you are doing.\n"
"Returns whether the initialization was successful."
msgstr ""
-#: doc/classes/Reference.xml:27
+#: doc/classes/RefCounted.xml:27
msgid ""
"Increments the internal reference counter. Use this only if you really know "
"what you are doing.\n"
@@ -41833,7 +41833,7 @@ msgid ""
"code] otherwise."
msgstr ""
-#: doc/classes/Reference.xml:35
+#: doc/classes/RefCounted.xml:35
msgid ""
"Decrements the internal reference counter. Use this only if you really know "
"what you are doing.\n"
@@ -54098,7 +54098,7 @@ msgid ""
"[codeblock]\n"
"var foo = 2 # foo is dynamically an integer\n"
"foo = \"Now foo is a string!\"\n"
-"foo = Reference.new() # foo is an Object\n"
+"foo = RefCounted.new() # foo is an Object\n"
"var bar: int = 2 # bar is a statically typed integer.\n"
"# bar = \"Uh oh! I can't make static variables become a different type!\"\n"
"[/codeblock]\n"
@@ -59181,7 +59181,7 @@ msgstr ""
#: doc/classes/WeakRef.xml:7
msgid ""
-"A weakref can hold a [Reference], without contributing to the reference "
+"A weakref can hold a [RefCounted], without contributing to the reference "
"counter. A weakref can be created from an [Object] using [method @GDScript."
"weakref]. If this object is not a reference, weakref still works, however, "
"it does not have any effect on the object. Weakrefs are useful in cases "
diff --git a/drivers/png/image_loader_png.cpp b/drivers/png/image_loader_png.cpp
index 8b2e786146..8cc76b01e1 100644
--- a/drivers/png/image_loader_png.cpp
+++ b/drivers/png/image_loader_png.cpp
@@ -101,6 +101,6 @@ Vector<uint8_t> ImageLoaderPNG::lossless_pack_png(const Ref<Image> &p_image) {
ImageLoaderPNG::ImageLoaderPNG() {
Image::_png_mem_loader_func = load_mem_png;
- Image::lossless_unpacker = lossless_unpack_png;
- Image::lossless_packer = lossless_pack_png;
+ Image::png_unpacker = lossless_unpack_png;
+ Image::png_packer = lossless_pack_png;
}
diff --git a/drivers/png/resource_saver_png.cpp b/drivers/png/resource_saver_png.cpp
index b737a287d1..2971880985 100644
--- a/drivers/png/resource_saver_png.cpp
+++ b/drivers/png/resource_saver_png.cpp
@@ -30,8 +30,8 @@
#include "resource_saver_png.h"
+#include "core/io/file_access.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/unix/dir_access_unix.h b/drivers/unix/dir_access_unix.h
index 28a7053d25..8b19308967 100644
--- a/drivers/unix/dir_access_unix.h
+++ b/drivers/unix/dir_access_unix.h
@@ -33,7 +33,7 @@
#if defined(UNIX_ENABLED) || defined(LIBC_FILEIO_ENABLED)
-#include "core/os/dir_access.h"
+#include "core/io/dir_access.h"
#include <dirent.h>
#include <sys/stat.h>
diff --git a/drivers/unix/file_access_unix.h b/drivers/unix/file_access_unix.h
index 5b1599c67f..8b27c308e1 100644
--- a/drivers/unix/file_access_unix.h
+++ b/drivers/unix/file_access_unix.h
@@ -31,7 +31,7 @@
#ifndef FILE_ACCESS_UNIX_H
#define FILE_ACCESS_UNIX_H
-#include "core/os/file_access.h"
+#include "core/io/file_access.h"
#include "core/os/memory.h"
#include <stdio.h>
diff --git a/drivers/unix/os_unix.cpp b/drivers/unix/os_unix.cpp
index 15cd7bee92..a5c61bbea5 100644
--- a/drivers/unix/os_unix.cpp
+++ b/drivers/unix/os_unix.cpp
@@ -195,8 +195,8 @@ OS::Time OS_Unix::get_time(bool utc) const {
}
Time ret;
ret.hour = lt.tm_hour;
- ret.min = lt.tm_min;
- ret.sec = lt.tm_sec;
+ ret.minute = lt.tm_min;
+ ret.second = lt.tm_sec;
get_time_zone_info();
return ret;
}
diff --git a/drivers/vulkan/rendering_device_vulkan.cpp b/drivers/vulkan/rendering_device_vulkan.cpp
index dc92e04a43..c69b516f37 100644
--- a/drivers/vulkan/rendering_device_vulkan.cpp
+++ b/drivers/vulkan/rendering_device_vulkan.cpp
@@ -31,7 +31,7 @@
#include "rendering_device_vulkan.h"
#include "core/config/project_settings.h"
-#include "core/os/file_access.h"
+#include "core/io/file_access.h"
#include "core/os/os.h"
#include "core/templates/hashfuncs.h"
#include "drivers/vulkan/vulkan_context.h"
@@ -3244,7 +3244,7 @@ bool RenderingDeviceVulkan::texture_is_format_supported_for_usage(DataFormat p_f
/**** ATTACHMENT ****/
/********************/
-VkRenderPass RenderingDeviceVulkan::_render_pass_create(const Vector<AttachmentFormat> &p_format, InitialAction p_initial_color_action, FinalAction p_final_color_action, InitialAction p_initial_depth_action, FinalAction p_final_depth_action, int *r_color_attachment_count) {
+VkRenderPass RenderingDeviceVulkan::_render_pass_create(const Vector<AttachmentFormat> &p_format, InitialAction p_initial_color_action, FinalAction p_final_color_action, InitialAction p_initial_depth_action, FinalAction p_final_depth_action, int *r_color_attachment_count, uint32_t p_view_count) {
Vector<VkAttachmentDescription> attachments;
Vector<VkAttachmentReference> color_references;
Vector<VkAttachmentReference> depth_stencil_references;
@@ -3469,6 +3469,31 @@ VkRenderPass RenderingDeviceVulkan::_render_pass_create(const Vector<AttachmentF
render_pass_create_info.dependencyCount = 0;
render_pass_create_info.pDependencies = nullptr;
+ const uint32_t view_mask = (1 << p_view_count) - 1;
+ const uint32_t correlation_mask = (1 << p_view_count) - 1;
+ VkRenderPassMultiviewCreateInfo render_pass_multiview_create_info;
+
+ if (p_view_count > 1) {
+ const VulkanContext::MultiviewCapabilities capabilities = context->get_multiview_capabilities();
+
+ // For now this only works with multiview!
+ ERR_FAIL_COND_V_MSG(!capabilities.is_supported, VK_NULL_HANDLE, "Multiview not supported");
+
+ // Make sure we limit this to the number of views we support.
+ ERR_FAIL_COND_V_MSG(p_view_count > capabilities.max_view_count, VK_NULL_HANDLE, "Hardware does not support requested number of views for Multiview render pass");
+
+ render_pass_multiview_create_info.sType = VK_STRUCTURE_TYPE_RENDER_PASS_MULTIVIEW_CREATE_INFO;
+ render_pass_multiview_create_info.pNext = nullptr;
+ render_pass_multiview_create_info.subpassCount = 1;
+ render_pass_multiview_create_info.pViewMasks = &view_mask;
+ render_pass_multiview_create_info.dependencyCount = 0;
+ render_pass_multiview_create_info.pViewOffsets = nullptr;
+ render_pass_multiview_create_info.correlationMaskCount = 1;
+ render_pass_multiview_create_info.pCorrelationMasks = &correlation_mask;
+
+ render_pass_create_info.pNext = &render_pass_multiview_create_info;
+ }
+
VkRenderPass render_pass;
VkResult res = vkCreateRenderPass(device, &render_pass_create_info, nullptr, &render_pass);
ERR_FAIL_COND_V_MSG(res, VK_NULL_HANDLE, "vkCreateRenderPass failed with error " + itos(res) + ".");
@@ -3479,11 +3504,12 @@ VkRenderPass RenderingDeviceVulkan::_render_pass_create(const Vector<AttachmentF
return render_pass;
}
-RenderingDevice::FramebufferFormatID RenderingDeviceVulkan::framebuffer_format_create(const Vector<AttachmentFormat> &p_format) {
+RenderingDevice::FramebufferFormatID RenderingDeviceVulkan::framebuffer_format_create(const Vector<AttachmentFormat> &p_format, uint32_t p_view_count) {
_THREAD_SAFE_METHOD_
FramebufferFormatKey key;
key.attachments = p_format;
+ key.view_count = p_view_count;
const Map<FramebufferFormatKey, FramebufferFormatID>::Element *E = framebuffer_format_cache.find(key);
if (E) {
@@ -3492,7 +3518,7 @@ RenderingDevice::FramebufferFormatID RenderingDeviceVulkan::framebuffer_format_c
}
int color_references;
- VkRenderPass render_pass = _render_pass_create(p_format, INITIAL_ACTION_CLEAR, FINAL_ACTION_READ, INITIAL_ACTION_CLEAR, FINAL_ACTION_READ, &color_references); //actions don't matter for this use case
+ VkRenderPass render_pass = _render_pass_create(p_format, INITIAL_ACTION_CLEAR, FINAL_ACTION_READ, INITIAL_ACTION_CLEAR, FINAL_ACTION_READ, &color_references, p_view_count); //actions don't matter for this use case
if (render_pass == VK_NULL_HANDLE) { //was likely invalid
return INVALID_ID;
@@ -3505,6 +3531,7 @@ RenderingDevice::FramebufferFormatID RenderingDeviceVulkan::framebuffer_format_c
fb_format.color_attachments = color_references;
fb_format.render_pass = render_pass;
fb_format.samples = p_format[0].samples;
+ fb_format.view_count = p_view_count;
framebuffer_formats[id] = fb_format;
return id;
}
@@ -3580,11 +3607,12 @@ RID RenderingDeviceVulkan::framebuffer_create_empty(const Size2i &p_size, Textur
framebuffer.format_id = framebuffer_format_create_empty(p_samples);
ERR_FAIL_COND_V(p_format_check != INVALID_FORMAT_ID && framebuffer.format_id != p_format_check, RID());
framebuffer.size = p_size;
+ framebuffer.view_count = 1;
return framebuffer_owner.make_rid(framebuffer);
}
-RID RenderingDeviceVulkan::framebuffer_create(const Vector<RID> &p_texture_attachments, FramebufferFormatID p_format_check) {
+RID RenderingDeviceVulkan::framebuffer_create(const Vector<RID> &p_texture_attachments, FramebufferFormatID p_format_check, uint32_t p_view_count) {
_THREAD_SAFE_METHOD_
Vector<AttachmentFormat> attachments;
@@ -3594,6 +3622,8 @@ RID RenderingDeviceVulkan::framebuffer_create(const Vector<RID> &p_texture_attac
Texture *texture = texture_owner.getornull(p_texture_attachments[i]);
ERR_FAIL_COND_V_MSG(!texture, RID(), "Texture index supplied for framebuffer (" + itos(i) + ") is not a valid texture.");
+ ERR_FAIL_COND_V_MSG(texture->layers != p_view_count, RID(), "Layers of our texture doesn't match view count for this framebuffer");
+
if (i == 0) {
size.width = texture->width;
size.height = texture->height;
@@ -3609,7 +3639,7 @@ RID RenderingDeviceVulkan::framebuffer_create(const Vector<RID> &p_texture_attac
attachments.push_back(af);
}
- FramebufferFormatID format_id = framebuffer_format_create(attachments);
+ FramebufferFormatID format_id = framebuffer_format_create(attachments, p_view_count);
if (format_id == INVALID_ID) {
return RID();
}
@@ -3621,6 +3651,7 @@ RID RenderingDeviceVulkan::framebuffer_create(const Vector<RID> &p_texture_attac
framebuffer.format_id = format_id;
framebuffer.texture_ids = p_texture_attachments;
framebuffer.size = size;
+ framebuffer.view_count = p_view_count;
RID id = framebuffer_owner.make_rid(framebuffer);
@@ -5904,12 +5935,13 @@ Error RenderingDeviceVulkan::_draw_list_setup_framebuffer(Framebuffer *p_framebu
vk.final_color_action = p_final_color_action;
vk.initial_depth_action = p_initial_depth_action;
vk.final_depth_action = p_final_depth_action;
+ vk.view_count = p_framebuffer->view_count;
if (!p_framebuffer->framebuffers.has(vk)) {
//need to create this version
Framebuffer::Version version;
- version.render_pass = _render_pass_create(framebuffer_formats[p_framebuffer->format_id].E->key().attachments, p_initial_color_action, p_final_color_action, p_initial_depth_action, p_final_depth_action);
+ version.render_pass = _render_pass_create(framebuffer_formats[p_framebuffer->format_id].E->key().attachments, p_initial_color_action, p_final_color_action, p_initial_depth_action, p_final_depth_action, nullptr, p_framebuffer->view_count);
VkFramebufferCreateInfo framebuffer_create_info;
framebuffer_create_info.sType = VK_STRUCTURE_TYPE_FRAMEBUFFER_CREATE_INFO;
diff --git a/drivers/vulkan/rendering_device_vulkan.h b/drivers/vulkan/rendering_device_vulkan.h
index a2527d5c33..f4fe9cf956 100644
--- a/drivers/vulkan/rendering_device_vulkan.h
+++ b/drivers/vulkan/rendering_device_vulkan.h
@@ -234,7 +234,12 @@ class RenderingDeviceVulkan : public RenderingDevice {
struct FramebufferFormatKey {
Vector<AttachmentFormat> attachments;
+ uint32_t view_count = 1;
bool operator<(const FramebufferFormatKey &p_key) const {
+ if (view_count != p_key.view_count) {
+ return view_count < p_key.view_count;
+ }
+
int as = attachments.size();
int bs = p_key.attachments.size();
if (as != bs) {
@@ -261,7 +266,7 @@ class RenderingDeviceVulkan : public RenderingDevice {
}
};
- VkRenderPass _render_pass_create(const Vector<AttachmentFormat> &p_format, InitialAction p_initial_action, FinalAction p_final_action, InitialAction p_initial_depth_action, FinalAction p_final_depthcolor_action, int *r_color_attachment_count = nullptr);
+ VkRenderPass _render_pass_create(const Vector<AttachmentFormat> &p_format, InitialAction p_initial_action, FinalAction p_final_action, InitialAction p_initial_depth_action, FinalAction p_final_depthcolor_action, int *r_color_attachment_count = nullptr, uint32_t p_view_count = 1);
// This is a cache and it's never freed, it ensures
// IDs for a given format are always unique.
@@ -271,6 +276,7 @@ class RenderingDeviceVulkan : public RenderingDevice {
VkRenderPass render_pass = VK_NULL_HANDLE; //here for constructing shaders, never used, see section (7.2. Render Pass Compatibility from Vulkan spec)
int color_attachments = 0; //used for pipeline validation
TextureSamples samples;
+ uint32_t view_count = 1; // number of views
};
Map<FramebufferFormatID, FramebufferFormat> framebuffer_formats;
@@ -282,11 +288,16 @@ class RenderingDeviceVulkan : public RenderingDevice {
FinalAction final_color_action;
InitialAction initial_depth_action;
FinalAction final_depth_action;
+ uint32_t view_count;
bool operator<(const VersionKey &p_key) const {
if (initial_color_action == p_key.initial_color_action) {
if (final_color_action == p_key.final_color_action) {
if (initial_depth_action == p_key.initial_depth_action) {
- return final_depth_action < p_key.final_depth_action;
+ if (final_depth_action == p_key.final_depth_action) {
+ return view_count < p_key.view_count;
+ } else {
+ return final_depth_action < p_key.final_depth_action;
+ }
} else {
return initial_depth_action < p_key.initial_depth_action;
}
@@ -309,6 +320,7 @@ class RenderingDeviceVulkan : public RenderingDevice {
Map<VersionKey, Version> framebuffers;
Size2 size;
+ uint32_t view_count;
};
RID_Owner<Framebuffer, true> framebuffer_owner;
@@ -938,11 +950,11 @@ public:
/**** FRAMEBUFFER ****/
/*********************/
- virtual FramebufferFormatID framebuffer_format_create(const Vector<AttachmentFormat> &p_format);
+ virtual FramebufferFormatID framebuffer_format_create(const Vector<AttachmentFormat> &p_format, uint32_t p_view_count = 1);
virtual FramebufferFormatID framebuffer_format_create_empty(TextureSamples p_samples = TEXTURE_SAMPLES_1);
virtual TextureSamples framebuffer_format_get_texture_samples(FramebufferFormatID p_format);
- virtual RID framebuffer_create(const Vector<RID> &p_texture_attachments, FramebufferFormatID p_format_check = INVALID_ID);
+ virtual RID framebuffer_create(const Vector<RID> &p_texture_attachments, FramebufferFormatID p_format_check = INVALID_ID, uint32_t p_view_count = 1);
virtual RID framebuffer_create_empty(const Size2i &p_size, TextureSamples p_samples = TEXTURE_SAMPLES_1, FramebufferFormatID p_format_check = INVALID_ID);
virtual FramebufferFormatID framebuffer_get_format(RID p_framebuffer);
diff --git a/drivers/vulkan/vulkan_context.cpp b/drivers/vulkan/vulkan_context.cpp
index 38455bdbed..6ed43b5d31 100644
--- a/drivers/vulkan/vulkan_context.cpp
+++ b/drivers/vulkan/vulkan_context.cpp
@@ -337,6 +337,9 @@ Error VulkanContext::_initialize_extensions() {
extension_names[enabled_extension_count++] = VK_EXT_DEBUG_UTILS_EXTENSION_NAME;
enabled_debug_utils = true;
}
+ if (!strcmp(VK_KHR_GET_PHYSICAL_DEVICE_PROPERTIES_2_EXTENSION_NAME, instance_extensions[i].extensionName)) {
+ extension_names[enabled_extension_count++] = VK_KHR_GET_PHYSICAL_DEVICE_PROPERTIES_2_EXTENSION_NAME;
+ }
if (enabled_extension_count >= MAX_EXTENSIONS) {
free(instance_extensions);
ERR_FAIL_V_MSG(ERR_BUG, "Enabled extension count reaches MAX_EXTENSIONS, BUG");
@@ -504,6 +507,8 @@ Error VulkanContext::_check_capabilities() {
// assume not supported until proven otherwise
multiview_capabilities.is_supported = false;
+ multiview_capabilities.geometry_shader_is_supported = false;
+ multiview_capabilities.tessellation_shader_is_supported = false;
multiview_capabilities.max_view_count = 0;
multiview_capabilities.max_instance_count = 0;
subgroup_capabilities.size = 0;
@@ -529,7 +534,8 @@ Error VulkanContext::_check_capabilities() {
device_features_func(gpu, &device_features);
multiview_capabilities.is_supported = multiview_features.multiview;
- // For now we ignore if multiview is available in geometry and tessellation as we do not currently support those
+ multiview_capabilities.geometry_shader_is_supported = multiview_features.multiviewGeometryShader;
+ multiview_capabilities.tessellation_shader_is_supported = multiview_features.multiviewTessellationShader;
}
// check extended properties
@@ -573,7 +579,7 @@ Error VulkanContext::_check_capabilities() {
#ifdef DEBUG_ENABLED
print_line("- Vulkan multiview supported:");
- print_line(" max views: " + itos(multiview_capabilities.max_view_count));
+ print_line(" max view count: " + itos(multiview_capabilities.max_view_count));
print_line(" max instances: " + itos(multiview_capabilities.max_instance_count));
} else {
print_line("- Vulkan multiview not supported");
@@ -694,8 +700,25 @@ Error VulkanContext::_create_physical_device() {
free(physical_devices);
ERR_FAIL_V(ERR_CANT_CREATE);
}
- /* for now, just grab the first physical device */
+
+ // TODO: At least on Linux Laptops integrated GPUs fail with Vulkan in many instances.
+ // The device should really be a preference, but for now choosing a discrete GPU over the
+ // integrated one is better than the default.
+
+ // Default to first device
uint32_t device_index = 0;
+
+ for (uint32_t i = 0; i < gpu_count; ++i) {
+ VkPhysicalDeviceProperties props;
+ vkGetPhysicalDeviceProperties(physical_devices[i], &props);
+
+ if (props.deviceType == VkPhysicalDeviceType::VK_PHYSICAL_DEVICE_TYPE_DISCRETE_GPU) {
+ // Prefer discrete GPU.
+ device_index = i;
+ break;
+ }
+ }
+
gpu = physical_devices[device_index];
free(physical_devices);
@@ -755,6 +778,10 @@ Error VulkanContext::_create_physical_device() {
swapchainExtFound = 1;
extension_names[enabled_extension_count++] = VK_KHR_SWAPCHAIN_EXTENSION_NAME;
}
+ if (!strcmp(VK_KHR_MULTIVIEW_EXTENSION_NAME, device_extensions[i].extensionName)) {
+ // if multiview is supported, enable it
+ extension_names[enabled_extension_count++] = VK_KHR_MULTIVIEW_EXTENSION_NAME;
+ }
if (enabled_extension_count >= MAX_EXTENSIONS) {
free(device_extensions);
ERR_FAIL_V_MSG(ERR_BUG, "Enabled extension count reaches MAX_EXTENSIONS, BUG");
@@ -947,6 +974,39 @@ Error VulkanContext::_create_device() {
queues[1].flags = 0;
sdevice.queueCreateInfoCount = 2;
}
+
+#ifdef VK_VERSION_1_2
+ VkPhysicalDeviceVulkan11Features vulkan11features;
+
+ vulkan11features.sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_VULKAN_1_1_FEATURES;
+ vulkan11features.pNext = nullptr;
+ // !BAS! Need to figure out which ones of these we want enabled...
+ vulkan11features.storageBuffer16BitAccess = 0;
+ vulkan11features.uniformAndStorageBuffer16BitAccess = 0;
+ vulkan11features.storagePushConstant16 = 0;
+ vulkan11features.storageInputOutput16 = 0;
+ vulkan11features.multiview = multiview_capabilities.is_supported;
+ vulkan11features.multiviewGeometryShader = multiview_capabilities.geometry_shader_is_supported;
+ vulkan11features.multiviewTessellationShader = multiview_capabilities.tessellation_shader_is_supported;
+ vulkan11features.variablePointersStorageBuffer = 0;
+ vulkan11features.variablePointers = 0;
+ vulkan11features.protectedMemory = 0;
+ vulkan11features.samplerYcbcrConversion = 0;
+ vulkan11features.shaderDrawParameters = 0;
+
+ sdevice.pNext = &vulkan11features;
+#elif VK_VERSION_1_1
+ VkPhysicalDeviceMultiviewFeatures multiview_features;
+
+ multiview_features.sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_MULTIVIEW_FEATURES;
+ multiview_features.pNext = nullptr;
+ multiview_features.multiview = multiview_capabilities.is_supported;
+ multiview_features.multiviewGeometryShader = multiview_capabilities.geometry_shader_is_supported;
+ multiview_features.multiviewTessellationShader = multiview_capabilities.tessellation_shader_is_supported;
+
+ sdevice.pNext = &multiview_features;
+#endif
+
err = vkCreateDevice(gpu, &sdevice, nullptr, &device);
ERR_FAIL_COND_V(err, ERR_CANT_CREATE);
diff --git a/drivers/vulkan/vulkan_context.h b/drivers/vulkan/vulkan_context.h
index 3d9b295c5a..738ead4f96 100644
--- a/drivers/vulkan/vulkan_context.h
+++ b/drivers/vulkan/vulkan_context.h
@@ -56,8 +56,10 @@ public:
struct MultiviewCapabilities {
bool is_supported;
- int32_t max_view_count;
- int32_t max_instance_count;
+ bool geometry_shader_is_supported;
+ bool tessellation_shader_is_supported;
+ uint32_t max_view_count;
+ uint32_t max_instance_count;
};
private:
diff --git a/drivers/windows/dir_access_windows.cpp b/drivers/windows/dir_access_windows.cpp
index 55f9e6de17..325bae5b56 100644
--- a/drivers/windows/dir_access_windows.cpp
+++ b/drivers/windows/dir_access_windows.cpp
@@ -208,7 +208,7 @@ String DirAccessWindows::get_current_dir(bool p_include_drive) {
bool DirAccessWindows::file_exists(String p_file) {
GLOBAL_LOCK_FUNCTION
- if (!p_file.is_abs_path()) {
+ if (!p_file.is_absolute_path()) {
p_file = get_current_dir().plus_file(p_file);
}
diff --git a/drivers/windows/dir_access_windows.h b/drivers/windows/dir_access_windows.h
index b151b631e9..1ba4e70e42 100644
--- a/drivers/windows/dir_access_windows.h
+++ b/drivers/windows/dir_access_windows.h
@@ -33,7 +33,7 @@
#ifdef WINDOWS_ENABLED
-#include "core/os/dir_access.h"
+#include "core/io/dir_access.h"
/**
@author Juan Linietsky <reduz@gmail.com>
diff --git a/drivers/windows/file_access_windows.h b/drivers/windows/file_access_windows.h
index 95f3a75548..7280fc3237 100644
--- a/drivers/windows/file_access_windows.h
+++ b/drivers/windows/file_access_windows.h
@@ -33,7 +33,7 @@
#ifdef WINDOWS_ENABLED
-#include "core/os/file_access.h"
+#include "core/io/file_access.h"
#include "core/os/memory.h"
#include <stdio.h>
diff --git a/editor/action_map_editor.cpp b/editor/action_map_editor.cpp
index d195561a85..cc07d589c5 100644
--- a/editor/action_map_editor.cpp
+++ b/editor/action_map_editor.cpp
@@ -969,9 +969,9 @@ void ActionMapEditor::_notification(int p_what) {
}
void ActionMapEditor::_bind_methods() {
- ClassDB::bind_method(D_METHOD("get_drag_data_fw"), &ActionMapEditor::get_drag_data_fw);
- ClassDB::bind_method(D_METHOD("can_drop_data_fw"), &ActionMapEditor::can_drop_data_fw);
- ClassDB::bind_method(D_METHOD("drop_data_fw"), &ActionMapEditor::drop_data_fw);
+ ClassDB::bind_method(D_METHOD("_get_drag_data_fw"), &ActionMapEditor::get_drag_data_fw);
+ ClassDB::bind_method(D_METHOD("_can_drop_data_fw"), &ActionMapEditor::can_drop_data_fw);
+ ClassDB::bind_method(D_METHOD("_drop_data_fw"), &ActionMapEditor::drop_data_fw);
ADD_SIGNAL(MethodInfo("action_added", PropertyInfo(Variant::STRING, "name")));
ADD_SIGNAL(MethodInfo("action_edited", PropertyInfo(Variant::STRING, "name"), PropertyInfo(Variant::DICTIONARY, "new_action")));
diff --git a/editor/animation_track_editor.h b/editor/animation_track_editor.h
index 756eb4acb6..f1d8139511 100644
--- a/editor/animation_track_editor.h
+++ b/editor/animation_track_editor.h
@@ -236,8 +236,8 @@ public:
AnimationTrackEdit();
};
-class AnimationTrackEditPlugin : public Reference {
- GDCLASS(AnimationTrackEditPlugin, Reference);
+class AnimationTrackEditPlugin : public RefCounted {
+ GDCLASS(AnimationTrackEditPlugin, RefCounted);
public:
virtual AnimationTrackEdit *create_value_track_edit(Object *p_object, Variant::Type p_type, const String &p_property, PropertyHint p_hint, const String &p_hint_string, int p_usage);
diff --git a/editor/array_property_edit.h b/editor/array_property_edit.h
index fa3dcbe038..d7e11936a3 100644
--- a/editor/array_property_edit.h
+++ b/editor/array_property_edit.h
@@ -33,8 +33,8 @@
#include "scene/main/node.h"
-class ArrayPropertyEdit : public Reference {
- GDCLASS(ArrayPropertyEdit, Reference);
+class ArrayPropertyEdit : public RefCounted {
+ GDCLASS(ArrayPropertyEdit, RefCounted);
int page;
ObjectID obj;
diff --git a/editor/audio_stream_preview.h b/editor/audio_stream_preview.h
index accc7275c0..61567598ed 100644
--- a/editor/audio_stream_preview.h
+++ b/editor/audio_stream_preview.h
@@ -36,8 +36,8 @@
#include "scene/main/node.h"
#include "servers/audio/audio_stream.h"
-class AudioStreamPreview : public Reference {
- GDCLASS(AudioStreamPreview, Reference);
+class AudioStreamPreview : public RefCounted {
+ GDCLASS(AudioStreamPreview, RefCounted);
friend class AudioStream;
Vector<uint8_t> preview;
float length;
diff --git a/editor/create_dialog.cpp b/editor/create_dialog.cpp
index 1c0a55e4ec..968b24893c 100644
--- a/editor/create_dialog.cpp
+++ b/editor/create_dialog.cpp
@@ -643,9 +643,9 @@ void CreateDialog::_load_favorites_and_history() {
void CreateDialog::_bind_methods() {
ClassDB::bind_method(D_METHOD("_save_and_update_favorite_list"), &CreateDialog::_save_and_update_favorite_list);
- ClassDB::bind_method("get_drag_data_fw", &CreateDialog::get_drag_data_fw);
- ClassDB::bind_method("can_drop_data_fw", &CreateDialog::can_drop_data_fw);
- ClassDB::bind_method("drop_data_fw", &CreateDialog::drop_data_fw);
+ ClassDB::bind_method("_get_drag_data_fw", &CreateDialog::get_drag_data_fw);
+ ClassDB::bind_method("_can_drop_data_fw", &CreateDialog::can_drop_data_fw);
+ ClassDB::bind_method("_drop_data_fw", &CreateDialog::drop_data_fw);
ADD_SIGNAL(MethodInfo("create"));
ADD_SIGNAL(MethodInfo("favorites_updated"));
diff --git a/editor/debugger/editor_debugger_server.h b/editor/debugger/editor_debugger_server.h
index 6458421e7a..6216d0df3d 100644
--- a/editor/debugger/editor_debugger_server.h
+++ b/editor/debugger/editor_debugger_server.h
@@ -32,9 +32,9 @@
#define EDITOR_DEBUGGER_CONNECTION_H
#include "core/debugger/remote_debugger_peer.h"
-#include "core/object/reference.h"
+#include "core/object/ref_counted.h"
-class EditorDebuggerServer : public Reference {
+class EditorDebuggerServer : public RefCounted {
public:
typedef EditorDebuggerServer *(*CreateServerFunc)(const String &p_uri);
diff --git a/editor/dependency_editor.cpp b/editor/dependency_editor.cpp
index c085205f63..7534b419fe 100644
--- a/editor/dependency_editor.cpp
+++ b/editor/dependency_editor.cpp
@@ -30,8 +30,8 @@
#include "dependency_editor.h"
+#include "core/io/file_access.h"
#include "core/io/resource_loader.h"
-#include "core/os/file_access.h"
#include "editor_node.h"
#include "editor_scale.h"
#include "scene/gui/margin_container.h"
diff --git a/editor/dictionary_property_edit.h b/editor/dictionary_property_edit.h
index e0fd945491..d1401c5e5f 100644
--- a/editor/dictionary_property_edit.h
+++ b/editor/dictionary_property_edit.h
@@ -33,8 +33,8 @@
#include "scene/main/node.h"
-class DictionaryPropertyEdit : public Reference {
- GDCLASS(DictionaryPropertyEdit, Reference);
+class DictionaryPropertyEdit : public RefCounted {
+ GDCLASS(DictionaryPropertyEdit, RefCounted);
ObjectID obj;
StringName property;
diff --git a/editor/doc_tools.cpp b/editor/doc_tools.cpp
index e29c9593c3..d3df4d91a6 100644
--- a/editor/doc_tools.cpp
+++ b/editor/doc_tools.cpp
@@ -34,9 +34,9 @@
#include "core/config/project_settings.h"
#include "core/core_constants.h"
#include "core/io/compression.h"
+#include "core/io/dir_access.h"
#include "core/io/marshalls.h"
#include "core/object/script_language.h"
-#include "core/os/dir_access.h"
#include "core/version.h"
#include "scene/resources/theme.h"
diff --git a/editor/editor_asset_installer.cpp b/editor/editor_asset_installer.cpp
index e7937a8e3c..38f417a8ce 100644
--- a/editor/editor_asset_installer.cpp
+++ b/editor/editor_asset_installer.cpp
@@ -30,9 +30,9 @@
#include "editor_asset_installer.h"
+#include "core/io/dir_access.h"
+#include "core/io/file_access.h"
#include "core/io/zip_io.h"
-#include "core/os/dir_access.h"
-#include "core/os/file_access.h"
#include "editor_node.h"
#include "progress_dialog.h"
diff --git a/editor/editor_audio_buses.cpp b/editor/editor_audio_buses.cpp
index 4317760379..13296e2f23 100644
--- a/editor/editor_audio_buses.cpp
+++ b/editor/editor_audio_buses.cpp
@@ -757,9 +757,9 @@ void EditorAudioBus::_bind_methods() {
ClassDB::bind_method("update_bus", &EditorAudioBus::update_bus);
ClassDB::bind_method("update_send", &EditorAudioBus::update_send);
ClassDB::bind_method("_gui_input", &EditorAudioBus::_gui_input);
- ClassDB::bind_method("get_drag_data_fw", &EditorAudioBus::get_drag_data_fw);
- ClassDB::bind_method("can_drop_data_fw", &EditorAudioBus::can_drop_data_fw);
- ClassDB::bind_method("drop_data_fw", &EditorAudioBus::drop_data_fw);
+ ClassDB::bind_method("_get_drag_data_fw", &EditorAudioBus::get_drag_data_fw);
+ ClassDB::bind_method("_can_drop_data_fw", &EditorAudioBus::can_drop_data_fw);
+ ClassDB::bind_method("_drop_data_fw", &EditorAudioBus::drop_data_fw);
ADD_SIGNAL(MethodInfo("duplicate_request"));
ADD_SIGNAL(MethodInfo("delete_request"));
diff --git a/editor/editor_autoload_settings.cpp b/editor/editor_autoload_settings.cpp
index d46df05f6e..a39e693912 100644
--- a/editor/editor_autoload_settings.cpp
+++ b/editor/editor_autoload_settings.cpp
@@ -749,9 +749,9 @@ void EditorAutoloadSettings::autoload_remove(const String &p_name) {
void EditorAutoloadSettings::_bind_methods() {
ClassDB::bind_method("_autoload_open", &EditorAutoloadSettings::_autoload_open);
- ClassDB::bind_method("get_drag_data_fw", &EditorAutoloadSettings::get_drag_data_fw);
- ClassDB::bind_method("can_drop_data_fw", &EditorAutoloadSettings::can_drop_data_fw);
- ClassDB::bind_method("drop_data_fw", &EditorAutoloadSettings::drop_data_fw);
+ ClassDB::bind_method("_get_drag_data_fw", &EditorAutoloadSettings::get_drag_data_fw);
+ ClassDB::bind_method("_can_drop_data_fw", &EditorAutoloadSettings::can_drop_data_fw);
+ ClassDB::bind_method("_drop_data_fw", &EditorAutoloadSettings::drop_data_fw);
ClassDB::bind_method("update_autoload", &EditorAutoloadSettings::update_autoload);
ClassDB::bind_method("autoload_add", &EditorAutoloadSettings::autoload_add);
diff --git a/editor/editor_data.cpp b/editor/editor_data.cpp
index 6405af3876..56c6a416af 100644
--- a/editor/editor_data.cpp
+++ b/editor/editor_data.cpp
@@ -31,9 +31,9 @@
#include "editor_data.h"
#include "core/config/project_settings.h"
+#include "core/io/dir_access.h"
+#include "core/io/file_access.h"
#include "core/io/resource_loader.h"
-#include "core/os/dir_access.h"
-#include "core/os/file_access.h"
#include "editor_node.h"
#include "editor_settings.h"
#include "scene/resources/packed_scene.h"
@@ -83,7 +83,7 @@ void EditorHistory::cleanup_history() {
void EditorHistory::_add_object(ObjectID p_object, const String &p_property, int p_level_change, bool p_inspector_only) {
Object *obj = ObjectDB::get_instance(p_object);
ERR_FAIL_COND(!obj);
- Reference *r = Object::cast_to<Reference>(obj);
+ RefCounted *r = Object::cast_to<RefCounted>(obj);
Obj o;
if (r) {
o.ref = REF(r);
diff --git a/editor/editor_dir_dialog.h b/editor/editor_dir_dialog.h
index 05451b7bda..ef473b0779 100644
--- a/editor/editor_dir_dialog.h
+++ b/editor/editor_dir_dialog.h
@@ -31,7 +31,7 @@
#ifndef EDITOR_DIR_DIALOG_H
#define EDITOR_DIR_DIALOG_H
-#include "core/os/dir_access.h"
+#include "core/io/dir_access.h"
#include "editor/editor_file_system.h"
#include "scene/gui/dialogs.h"
#include "scene/gui/tree.h"
diff --git a/editor/editor_export.cpp b/editor/editor_export.cpp
index 40313fbeff..7c5a06107d 100644
--- a/editor/editor_export.cpp
+++ b/editor/editor_export.cpp
@@ -33,14 +33,14 @@
#include "core/config/project_settings.h"
#include "core/crypto/crypto_core.h"
#include "core/io/config_file.h"
+#include "core/io/dir_access.h"
+#include "core/io/file_access.h"
#include "core/io/file_access_encrypted.h"
#include "core/io/file_access_pack.h" // PACK_HEADER_MAGIC, PACK_FORMAT_VERSION
#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/version.h"
#include "editor/editor_file_system.h"
#include "editor/plugins/script_editor_plugin.h"
@@ -151,7 +151,7 @@ void EditorExportPreset::set_export_path(const String &p_path) {
export_path = p_path;
/* NOTE(SonerSound): if there is a need to implement a PropertyHint that specifically indicates a relative path,
* this should be removed. */
- if (export_path.is_abs_path()) {
+ if (export_path.is_absolute_path()) {
String res_path = OS::get_singleton()->get_resource_dir();
export_path = res_path.path_to_file(export_path);
}
diff --git a/editor/editor_export.h b/editor/editor_export.h
index c96c8fdbce..c9401df9c2 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/dir_access.h"
#include "core/io/resource.h"
-#include "core/os/dir_access.h"
#include "scene/main/node.h"
#include "scene/main/timer.h"
#include "scene/resources/texture.h"
@@ -42,8 +42,8 @@ class EditorExportPlatform;
class EditorFileSystemDirectory;
struct EditorProgress;
-class EditorExportPreset : public Reference {
- GDCLASS(EditorExportPreset, Reference);
+class EditorExportPreset : public RefCounted {
+ GDCLASS(EditorExportPreset, RefCounted);
public:
enum ExportFilter {
@@ -161,8 +161,8 @@ struct SharedObject {
SharedObject() {}
};
-class EditorExportPlatform : public Reference {
- GDCLASS(EditorExportPlatform, Reference);
+class EditorExportPlatform : public RefCounted {
+ GDCLASS(EditorExportPlatform, RefCounted);
public:
typedef Error (*EditorExportSaveFunction)(void *p_userdata, const String &p_path, const Vector<uint8_t> &p_data, int p_file, int p_total, const Vector<String> &p_enc_in_filters, const Vector<String> &p_enc_ex_filters, const Vector<uint8_t> &p_key);
@@ -284,8 +284,8 @@ public:
EditorExportPlatform();
};
-class EditorExportPlugin : public Reference {
- GDCLASS(EditorExportPlugin, Reference);
+class EditorExportPlugin : public RefCounted {
+ GDCLASS(EditorExportPlugin, RefCounted);
friend class EditorExportPlatform;
diff --git a/editor/editor_feature_profile.cpp b/editor/editor_feature_profile.cpp
index d232153206..51c6b473ad 100644
--- a/editor/editor_feature_profile.cpp
+++ b/editor/editor_feature_profile.cpp
@@ -30,8 +30,8 @@
#include "editor_feature_profile.h"
+#include "core/io/dir_access.h"
#include "core/io/json.h"
-#include "core/os/dir_access.h"
#include "editor/editor_settings.h"
#include "editor_node.h"
#include "editor_scale.h"
diff --git a/editor/editor_feature_profile.h b/editor/editor_feature_profile.h
index e118b5f287..d31498bfc6 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/io/file_access.h"
+#include "core/object/ref_counted.h"
#include "editor/editor_file_dialog.h"
#include "editor_help.h"
#include "scene/gui/dialogs.h"
@@ -41,8 +41,8 @@
#include "scene/gui/split_container.h"
#include "scene/gui/tree.h"
-class EditorFeatureProfile : public Reference {
- GDCLASS(EditorFeatureProfile, Reference);
+class EditorFeatureProfile : public RefCounted {
+ GDCLASS(EditorFeatureProfile, RefCounted);
public:
enum Feature {
diff --git a/editor/editor_file_dialog.cpp b/editor/editor_file_dialog.cpp
index 75815fa750..991d76ce72 100644
--- a/editor/editor_file_dialog.cpp
+++ b/editor/editor_file_dialog.cpp
@@ -30,7 +30,7 @@
#include "editor_file_dialog.h"
-#include "core/os/file_access.h"
+#include "core/io/file_access.h"
#include "core/os/keyboard.h"
#include "core/os/os.h"
#include "core/string/print_string.h"
@@ -294,6 +294,9 @@ void EditorFileDialog::_post_popup() {
if (res && name == "res://") {
name = "/";
} else {
+ if (name.ends_with("/")) {
+ name = name.substr(0, name.length() - 1);
+ }
name = name.get_file() + "/";
}
bool exists = dir_access->dir_exists(recentd[i]);
diff --git a/editor/editor_file_dialog.h b/editor/editor_file_dialog.h
index 5a5e3a8807..f7879838d4 100644
--- a/editor/editor_file_dialog.h
+++ b/editor/editor_file_dialog.h
@@ -31,7 +31,7 @@
#ifndef EDITORFILEDIALOG_H
#define EDITORFILEDIALOG_H
-#include "core/os/dir_access.h"
+#include "core/io/dir_access.h"
#include "scene/gui/box_container.h"
#include "scene/gui/dialogs.h"
#include "scene/gui/item_list.h"
diff --git a/editor/editor_file_system.cpp b/editor/editor_file_system.cpp
index 69663b9ed9..c61b097ccd 100644
--- a/editor/editor_file_system.cpp
+++ b/editor/editor_file_system.cpp
@@ -31,10 +31,10 @@
#include "editor_file_system.h"
#include "core/config/project_settings.h"
+#include "core/io/file_access.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/variant/variant_parser.h"
#include "editor_node.h"
@@ -1934,19 +1934,6 @@ void EditorFileSystem::_reimport_thread(uint32_t p_index, ImportThreadData *p_im
}
void EditorFileSystem::reimport_files(const Vector<String> &p_files) {
- {
- // Ensure that ProjectSettings::IMPORTED_FILES_PATH exists.
- DirAccess *da = DirAccess::open("res://");
- if (da->change_dir(ProjectSettings::IMPORTED_FILES_PATH) != OK) {
- Error err = da->make_dir_recursive(ProjectSettings::IMPORTED_FILES_PATH);
- if (err || da->change_dir(ProjectSettings::IMPORTED_FILES_PATH) != OK) {
- memdelete(da);
- ERR_FAIL_MSG("Failed to create '" + ProjectSettings::IMPORTED_FILES_PATH + "' folder.");
- }
- }
- memdelete(da);
- }
-
importing = true;
EditorProgress pr("reimport", TTR("(Re)Importing Assets"), p_files.size());
@@ -2177,13 +2164,9 @@ EditorFileSystem::EditorFileSystem() {
scanning_changes = false;
scanning_changes_done = false;
- DirAccess *da = DirAccess::create(DirAccess::ACCESS_RESOURCES);
- if (da->change_dir(ProjectSettings::IMPORTED_FILES_PATH) != OK) {
- da->make_dir(ProjectSettings::IMPORTED_FILES_PATH);
- }
// This should probably also work on Unix and use the string it returns for FAT32 or exFAT
+ DirAccessRef da = DirAccess::create(DirAccess::ACCESS_RESOURCES);
using_fat32_or_exfat = (da->get_filesystem_type() == "FAT32" || da->get_filesystem_type() == "exFAT");
- memdelete(da);
scan_total = 0;
update_script_classes_queued.clear();
diff --git a/editor/editor_file_system.h b/editor/editor_file_system.h
index 855c320856..04879bad6d 100644
--- a/editor/editor_file_system.h
+++ b/editor/editor_file_system.h
@@ -31,7 +31,7 @@
#ifndef EDITOR_FILE_SYSTEM_H
#define EDITOR_FILE_SYSTEM_H
-#include "core/os/dir_access.h"
+#include "core/io/dir_access.h"
#include "core/os/thread.h"
#include "core/os/thread_safe.h"
#include "core/templates/safe_refcount.h"
diff --git a/editor/editor_folding.cpp b/editor/editor_folding.cpp
index 97a2c67c26..4030aecbf5 100644
--- a/editor/editor_folding.cpp
+++ b/editor/editor_folding.cpp
@@ -30,7 +30,7 @@
#include "editor_folding.h"
-#include "core/os/file_access.h"
+#include "core/io/file_access.h"
#include "editor_inspector.h"
#include "editor_settings.h"
diff --git a/editor/editor_fonts.cpp b/editor/editor_fonts.cpp
index 8a5142459c..2f5451fba3 100644
--- a/editor/editor_fonts.cpp
+++ b/editor/editor_fonts.cpp
@@ -31,7 +31,7 @@
#include "editor_fonts.h"
#include "builtin_fonts.gen.h"
-#include "core/os/dir_access.h"
+#include "core/io/dir_access.h"
#include "editor_scale.h"
#include "editor_settings.h"
#include "scene/resources/default_theme/default_theme.h"
diff --git a/editor/editor_help_search.h b/editor/editor_help_search.h
index 350a02315f..75da2d5aba 100644
--- a/editor/editor_help_search.h
+++ b/editor/editor_help_search.h
@@ -83,7 +83,7 @@ public:
EditorHelpSearch();
};
-class EditorHelpSearch::Runner : public Reference {
+class EditorHelpSearch::Runner : public RefCounted {
enum Phase {
PHASE_MATCH_CLASSES_INIT,
PHASE_MATCH_CLASSES,
diff --git a/editor/editor_inspector.cpp b/editor/editor_inspector.cpp
index 20abe72750..69709315ff 100644
--- a/editor/editor_inspector.cpp
+++ b/editor/editor_inspector.cpp
@@ -380,7 +380,7 @@ StringName EditorProperty::get_edited_property() {
void EditorProperty::update_property() {
if (get_script_instance()) {
- get_script_instance()->call("update_property");
+ get_script_instance()->call("_update_property");
}
}
@@ -753,7 +753,7 @@ void EditorProperty::_gui_input(const Ref<InputEvent> &p_event) {
call_deferred("emit_changed", property, object->get(property).operator int64_t() + 1, "", false);
}
- call_deferred("update_property");
+ call_deferred("_update_property");
}
}
if (delete_rect.has_point(mpos)) {
@@ -965,9 +965,7 @@ void EditorProperty::_bind_methods() {
ADD_SIGNAL(MethodInfo("object_id_selected", PropertyInfo(Variant::STRING_NAME, "property"), PropertyInfo(Variant::INT, "id")));
ADD_SIGNAL(MethodInfo("selected", PropertyInfo(Variant::STRING, "path"), PropertyInfo(Variant::INT, "focusable_idx")));
- MethodInfo vm;
- vm.name = "update_property";
- BIND_VMETHOD(vm);
+ BIND_VMETHOD(MethodInfo("_update_property"));
}
EditorProperty::EditorProperty() {
@@ -1023,20 +1021,20 @@ void EditorInspectorPlugin::add_property_editor_for_multiple_properties(const St
bool EditorInspectorPlugin::can_handle(Object *p_object) {
if (get_script_instance()) {
- return get_script_instance()->call("can_handle", p_object);
+ return get_script_instance()->call("_can_handle", p_object);
}
return false;
}
void EditorInspectorPlugin::parse_begin(Object *p_object) {
if (get_script_instance()) {
- get_script_instance()->call("parse_begin", p_object);
+ get_script_instance()->call("_parse_begin", p_object);
}
}
void EditorInspectorPlugin::parse_category(Object *p_object, const String &p_parse_category) {
if (get_script_instance()) {
- get_script_instance()->call("parse_category", p_object, p_parse_category);
+ get_script_instance()->call("_parse_category", p_object, p_parse_category);
}
}
@@ -1050,14 +1048,14 @@ bool EditorInspectorPlugin::parse_property(Object *p_object, Variant::Type p_typ
};
Callable::CallError err;
- return get_script_instance()->call("parse_property", (const Variant **)&argptr, 6, err);
+ return get_script_instance()->call("_parse_property", (const Variant **)&argptr, 6, err);
}
return false;
}
void EditorInspectorPlugin::parse_end() {
if (get_script_instance()) {
- get_script_instance()->call("parse_end");
+ get_script_instance()->call("_parse_end");
}
}
@@ -1066,30 +1064,11 @@ void EditorInspectorPlugin::_bind_methods() {
ClassDB::bind_method(D_METHOD("add_property_editor", "property", "editor"), &EditorInspectorPlugin::add_property_editor);
ClassDB::bind_method(D_METHOD("add_property_editor_for_multiple_properties", "label", "properties", "editor"), &EditorInspectorPlugin::add_property_editor_for_multiple_properties);
- MethodInfo vm;
- vm.name = "can_handle";
- vm.return_val.type = Variant::BOOL;
- vm.arguments.push_back(PropertyInfo(Variant::OBJECT, "object"));
- BIND_VMETHOD(vm);
- vm.name = "parse_begin";
- vm.return_val.type = Variant::NIL;
- BIND_VMETHOD(vm);
- vm.name = "parse_category";
- vm.arguments.push_back(PropertyInfo(Variant::STRING, "category"));
- BIND_VMETHOD(vm);
- vm.arguments.pop_back();
- vm.name = "parse_property";
- vm.return_val.type = Variant::BOOL;
- vm.arguments.push_back(PropertyInfo(Variant::INT, "type"));
- vm.arguments.push_back(PropertyInfo(Variant::STRING, "path"));
- vm.arguments.push_back(PropertyInfo(Variant::INT, "hint"));
- vm.arguments.push_back(PropertyInfo(Variant::STRING, "hint_text"));
- vm.arguments.push_back(PropertyInfo(Variant::INT, "usage"));
- BIND_VMETHOD(vm);
- vm.arguments.clear();
- vm.name = "parse_end";
- vm.return_val.type = Variant::NIL;
- BIND_VMETHOD(vm);
+ BIND_VMETHOD(MethodInfo(Variant::BOOL, "_can_handle", PropertyInfo(Variant::OBJECT, "object")));
+ BIND_VMETHOD(MethodInfo(Variant::NIL, "_parse_begin"));
+ BIND_VMETHOD(MethodInfo(Variant::NIL, "_parse_category", PropertyInfo(Variant::STRING, "category")));
+ BIND_VMETHOD(MethodInfo(Variant::BOOL, "_parse_property", PropertyInfo(Variant::INT, "type"), PropertyInfo(Variant::STRING, "path"), PropertyInfo(Variant::INT, "hint"), PropertyInfo(Variant::STRING, "hint_text"), PropertyInfo(Variant::INT, "usage")));
+ BIND_VMETHOD(MethodInfo(Variant::NIL, "_parse_end"));
}
////////////////////////////////////////////////
@@ -1290,7 +1269,7 @@ void EditorInspectorSection::_notification(int p_what) {
Control *editor_property = Object::cast_to<Control>(vbox->get_child(child_idx));
// Test can_drop_data and can_drop_data_fw, since can_drop_data only works if set up with forwarding or if script attached.
- if (editor_property && (editor_property->can_drop_data(Point2(), dd) || editor_property->call("can_drop_data_fw", Point2(), dd, this))) {
+ if (editor_property && (editor_property->can_drop_data(Point2(), dd) || editor_property->call("_can_drop_data_fw", Point2(), dd, this))) {
children_can_drop = true;
break;
}
diff --git a/editor/editor_inspector.h b/editor/editor_inspector.h
index 348dea7086..e4bcab3e3f 100644
--- a/editor/editor_inspector.h
+++ b/editor/editor_inspector.h
@@ -175,8 +175,8 @@ public:
EditorProperty();
};
-class EditorInspectorPlugin : public Reference {
- GDCLASS(EditorInspectorPlugin, Reference);
+class EditorInspectorPlugin : public RefCounted {
+ GDCLASS(EditorInspectorPlugin, RefCounted);
friend class EditorInspector;
struct AddedEditor {
diff --git a/editor/editor_node.cpp b/editor/editor_node.cpp
index 22d04add18..9a94597f0b 100644
--- a/editor/editor_node.cpp
+++ b/editor/editor_node.cpp
@@ -34,15 +34,16 @@
#include "core/core_bind.h"
#include "core/input/input.h"
#include "core/io/config_file.h"
+#include "core/io/file_access.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/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/os/time.h"
#include "core/string/print_string.h"
#include "core/string/translation.h"
#include "core/version.h"
@@ -770,7 +771,7 @@ void EditorNode::_resources_changed(const Vector<String> &p_resources) {
if (!res->editor_can_reload_from_file()) {
continue;
}
- if (!res->get_path().is_resource_file() && !res->get_path().is_abs_path()) {
+ if (!res->get_path().is_resource_file() && !res->get_path().is_absolute_path()) {
continue;
}
if (!FileAccess::exists(res->get_path())) {
@@ -2823,7 +2824,7 @@ void EditorNode::_request_screenshot() {
}
void EditorNode::_screenshot(bool p_use_utc) {
- String name = "editor_screenshot_" + OS::get_singleton()->get_iso_date_time(p_use_utc).replace(":", "") + ".png";
+ String name = "editor_screenshot_" + Time::get_singleton()->get_datetime_string_from_system(p_use_utc).replace(":", "") + ".png";
NodePath path = String("user://") + name;
_save_screenshot(path);
if (EditorSettings::get_singleton()->get("interface/editor/automatically_open_screenshots")) {
@@ -3727,10 +3728,6 @@ bool EditorNode::is_scene_in_use(const String &p_path) {
return false;
}
-void EditorNode::register_editor_paths(bool p_for_project_manager) {
- EditorPaths::create(p_for_project_manager);
-}
-
void EditorNode::register_editor_types() {
ResourceLoader::set_timestamp_on_load(true);
ResourceSaver::set_timestamp_on_save(true);
diff --git a/editor/editor_node.h b/editor/editor_node.h
index 9625b318e0..ce42fd3c8a 100644
--- a/editor/editor_node.h
+++ b/editor/editor_node.h
@@ -798,7 +798,6 @@ public:
Error export_preset(const String &p_preset, const String &p_path, bool p_debug, bool p_pack_only);
- static void register_editor_paths(bool p_for_project_manager);
static void register_editor_types();
static void unregister_editor_types();
diff --git a/editor/editor_paths.cpp b/editor/editor_paths.cpp
index 474da4fb96..323707ec6c 100644
--- a/editor/editor_paths.cpp
+++ b/editor/editor_paths.cpp
@@ -29,8 +29,12 @@
/*************************************************************************/
#include "editor_paths.h"
-#include "core/os/dir_access.h"
+
+#include "core/config/engine.h"
+#include "core/config/project_settings.h"
+#include "core/io/dir_access.h"
#include "core/os/os.h"
+#include "main/main.h" // For `is_project_manager`.
EditorPaths *EditorPaths::singleton = nullptr;
@@ -41,23 +45,32 @@ bool EditorPaths::are_paths_valid() const {
String EditorPaths::get_data_dir() const {
return data_dir;
}
+
String EditorPaths::get_config_dir() const {
return config_dir;
}
+
String EditorPaths::get_cache_dir() const {
return cache_dir;
}
+
+String EditorPaths::get_project_data_dir() const {
+ return project_data_dir;
+}
+
bool EditorPaths::is_self_contained() const {
return self_contained;
}
+
String EditorPaths::get_self_contained_file() const {
return self_contained_file;
}
-void EditorPaths::create(bool p_for_project_manager) {
+void EditorPaths::create() {
ERR_FAIL_COND(singleton != nullptr);
- memnew(EditorPaths(p_for_project_manager));
+ memnew(EditorPaths());
}
+
void EditorPaths::free() {
ERR_FAIL_COND(singleton == nullptr);
memdelete(singleton);
@@ -71,9 +84,10 @@ void EditorPaths::_bind_methods() {
ClassDB::bind_method(D_METHOD("get_self_contained_file"), &EditorPaths::get_self_contained_file);
}
-EditorPaths::EditorPaths(bool p_for_project_mamanger) {
+EditorPaths::EditorPaths() {
singleton = this;
+ // Self-contained mode if a `._sc_` or `_sc_` file is present in executable dir.
String exe_path = OS::get_singleton()->get_executable_path().get_base_dir();
{
DirAccessRef d = DirAccess::create_for_path(exe_path);
@@ -100,13 +114,13 @@ EditorPaths::EditorPaths(bool p_for_project_mamanger) {
cache_path = exe_path;
cache_dir = data_dir.plus_file("cache");
} else {
- // Typically XDG_DATA_HOME or %APPDATA%
+ // Typically XDG_DATA_HOME or %APPDATA%.
data_path = OS::get_singleton()->get_data_path();
data_dir = data_path.plus_file(OS::get_singleton()->get_godot_dir_name());
- // Can be different from data_path e.g. on Linux or macOS
+ // Can be different from data_path e.g. on Linux or macOS.
config_path = OS::get_singleton()->get_config_path();
config_dir = config_path.plus_file(OS::get_singleton()->get_godot_dir_name());
- // Can be different from above paths, otherwise a subfolder of data_dir
+ // Can be different from above paths, otherwise a subfolder of data_dir.
cache_path = OS::get_singleton()->get_cache_path();
if (cache_path == data_path) {
cache_dir = data_dir.plus_file("cache");
@@ -116,37 +130,85 @@ EditorPaths::EditorPaths(bool p_for_project_mamanger) {
}
paths_valid = (data_path != "" && config_path != "" && cache_path != "");
+ ERR_FAIL_COND_MSG(!paths_valid, "Editor data, config, or cache paths are invalid.");
+
+ // Validate or create each dir and its relevant subdirectories.
- if (paths_valid) {
- DirAccessRef dir = DirAccess::create(DirAccess::ACCESS_FILESYSTEM);
+ DirAccessRef dir = DirAccess::create(DirAccess::ACCESS_FILESYSTEM);
+
+ // Data dir.
+ {
if (dir->change_dir(data_dir) != OK) {
dir->make_dir_recursive(data_dir);
if (dir->change_dir(data_dir) != OK) {
- ERR_PRINT("Cannot create data directory!");
+ ERR_PRINT("Could not create editor data directory: " + data_dir);
paths_valid = false;
}
}
- // Validate/create cache dir
+ if (!dir->dir_exists("templates")) {
+ dir->make_dir("templates");
+ }
+ }
- if (dir->change_dir(EditorPaths::get_singleton()->get_cache_dir()) != OK) {
+ // Config dir.
+ {
+ if (dir->change_dir(config_dir) != OK) {
+ dir->make_dir_recursive(config_dir);
+ if (dir->change_dir(config_dir) != OK) {
+ ERR_PRINT("Could not create editor config directory: " + config_dir);
+ paths_valid = false;
+ }
+ }
+
+ if (!dir->dir_exists("text_editor_themes")) {
+ dir->make_dir("text_editor_themes");
+ }
+ if (!dir->dir_exists("script_templates")) {
+ dir->make_dir("script_templates");
+ }
+ if (!dir->dir_exists("feature_profiles")) {
+ dir->make_dir("feature_profiles");
+ }
+ }
+
+ // Cache dir.
+ {
+ if (dir->change_dir(cache_dir) != OK) {
dir->make_dir_recursive(cache_dir);
if (dir->change_dir(cache_dir) != OK) {
- ERR_PRINT("Cannot create cache directory!");
+ ERR_PRINT("Could not create editor cache directory: " + cache_dir);
+ paths_valid = false;
}
}
+ }
- if (p_for_project_mamanger) {
- Engine::get_singleton()->set_shader_cache_path(get_data_dir());
- } else {
- DirAccessRef dir2 = DirAccess::open("res://");
- if (dir2->change_dir(".godot") != OK) { //ensure the .godot subdir exists
- if (dir2->make_dir(".godot") != OK) {
- ERR_PRINT("Cannot create res://.godot directory!");
- }
+ // Validate or create project-specific editor data dir (`res://.godot`),
+ // including shader cache subdir.
+
+ if (Main::is_project_manager()) {
+ // Nothing to create, use shared editor data dir for shader cache.
+ Engine::get_singleton()->set_shader_cache_path(data_dir);
+ } else {
+ DirAccessRef dir_res = DirAccess::create(DirAccess::ACCESS_RESOURCES);
+ if (dir_res->change_dir(project_data_dir) != OK) {
+ dir_res->make_dir_recursive(project_data_dir);
+ if (dir_res->change_dir(project_data_dir) != OK) {
+ ERR_PRINT("Could not create project data directory (" + project_data_dir + ") in: " + dir_res->get_current_dir());
+ paths_valid = false;
}
+ }
+ Engine::get_singleton()->set_shader_cache_path(project_data_dir);
- Engine::get_singleton()->set_shader_cache_path("res://.godot");
+ // Editor metadata dir.
+ if (!dir_res->dir_exists("editor")) {
+ dir_res->make_dir("editor");
+ }
+ // Imported assets dir.
+ if (!dir_res->dir_exists(ProjectSettings::IMPORTED_FILES_PATH)) {
+ dir_res->make_dir(ProjectSettings::IMPORTED_FILES_PATH);
}
}
+
+ print_line("paths valid: " + itos((int)paths_valid));
}
diff --git a/editor/editor_paths.h b/editor/editor_paths.h
index c1be33f5c2..2c156b7c96 100644
--- a/editor/editor_paths.h
+++ b/editor/editor_paths.h
@@ -28,20 +28,22 @@
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
/*************************************************************************/
-#ifndef EDITORPATHS_H
-#define EDITORPATHS_H
+#ifndef EDITOR_PATHS_H
+#define EDITOR_PATHS_H
-#include "core/config/engine.h"
+#include "core/object/class_db.h"
+#include "core/string/ustring.h"
class EditorPaths : public Object {
GDCLASS(EditorPaths, Object)
- bool paths_valid = false;
- String data_dir; //editor data dir
- String config_dir; //editor config dir
- String cache_dir; //editor cache dir
- bool self_contained = false; //true if running self contained
- String self_contained_file; //self contained file with configuration
+ bool paths_valid = false; // If any of the paths can't be created, this is false.
+ String data_dir; // Editor data (templates, shader cache, etc.).
+ String config_dir; // Editor config (settings, profiles, themes, etc.).
+ String cache_dir; // Editor cache (thumbnails, tmp generated files).
+ String project_data_dir = "res://.godot"; // Project-specific data (metadata, shader cache, etc.).
+ bool self_contained = false; // Self-contained means everything goes to `editor_data` dir.
+ String self_contained_file; // Self-contained file with configuration.
static EditorPaths *singleton;
@@ -54,6 +56,8 @@ public:
String get_data_dir() const;
String get_config_dir() const;
String get_cache_dir() const;
+ String get_project_data_dir() const;
+
bool is_self_contained() const;
String get_self_contained_file() const;
@@ -61,10 +65,10 @@ public:
return singleton;
}
- static void create(bool p_for_project_manager);
+ static void create();
static void free();
- EditorPaths(bool p_for_project_mamanger = false);
+ EditorPaths();
};
-#endif // EDITORPATHS_H
+#endif // EDITOR_PATHS_H
diff --git a/editor/editor_plugin.cpp b/editor/editor_plugin.cpp
index a12bf036bc..63de06d5e2 100644
--- a/editor/editor_plugin.cpp
+++ b/editor/editor_plugin.cpp
@@ -553,21 +553,21 @@ void EditorPlugin::notify_resource_saved(const Ref<Resource> &p_resource) {
}
bool EditorPlugin::forward_canvas_gui_input(const Ref<InputEvent> &p_event) {
- if (get_script_instance() && get_script_instance()->has_method("forward_canvas_gui_input")) {
- return get_script_instance()->call("forward_canvas_gui_input", p_event);
+ if (get_script_instance() && get_script_instance()->has_method("_forward_canvas_gui_input")) {
+ return get_script_instance()->call("_forward_canvas_gui_input", p_event);
}
return false;
}
void EditorPlugin::forward_canvas_draw_over_viewport(Control *p_overlay) {
- if (get_script_instance() && get_script_instance()->has_method("forward_canvas_draw_over_viewport")) {
- get_script_instance()->call("forward_canvas_draw_over_viewport", p_overlay);
+ if (get_script_instance() && get_script_instance()->has_method("_forward_canvas_draw_over_viewport")) {
+ get_script_instance()->call("_forward_canvas_draw_over_viewport", p_overlay);
}
}
void EditorPlugin::forward_canvas_force_draw_over_viewport(Control *p_overlay) {
- if (get_script_instance() && get_script_instance()->has_method("forward_canvas_force_draw_over_viewport")) {
- get_script_instance()->call("forward_canvas_force_draw_over_viewport", p_overlay);
+ if (get_script_instance() && get_script_instance()->has_method("_forward_canvas_force_draw_over_viewport")) {
+ get_script_instance()->call("_forward_canvas_force_draw_over_viewport", p_overlay);
}
}
@@ -591,110 +591,110 @@ int EditorPlugin::update_overlays() const {
}
bool EditorPlugin::forward_spatial_gui_input(Camera3D *p_camera, const Ref<InputEvent> &p_event) {
- if (get_script_instance() && get_script_instance()->has_method("forward_spatial_gui_input")) {
- return get_script_instance()->call("forward_spatial_gui_input", p_camera, p_event);
+ if (get_script_instance() && get_script_instance()->has_method("_forward_spatial_gui_input")) {
+ return get_script_instance()->call("_forward_spatial_gui_input", p_camera, p_event);
}
return false;
}
void EditorPlugin::forward_spatial_draw_over_viewport(Control *p_overlay) {
- if (get_script_instance() && get_script_instance()->has_method("forward_spatial_draw_over_viewport")) {
- get_script_instance()->call("forward_spatial_draw_over_viewport", p_overlay);
+ if (get_script_instance() && get_script_instance()->has_method("_forward_spatial_draw_over_viewport")) {
+ get_script_instance()->call("_forward_spatial_draw_over_viewport", p_overlay);
}
}
void EditorPlugin::forward_spatial_force_draw_over_viewport(Control *p_overlay) {
- if (get_script_instance() && get_script_instance()->has_method("forward_spatial_force_draw_over_viewport")) {
- get_script_instance()->call("forward_spatial_force_draw_over_viewport", p_overlay);
+ if (get_script_instance() && get_script_instance()->has_method("_forward_spatial_force_draw_over_viewport")) {
+ get_script_instance()->call("_forward_spatial_force_draw_over_viewport", p_overlay);
}
}
String EditorPlugin::get_name() const {
- if (get_script_instance() && get_script_instance()->has_method("get_plugin_name")) {
- return get_script_instance()->call("get_plugin_name");
+ if (get_script_instance() && get_script_instance()->has_method("_get_plugin_name")) {
+ return get_script_instance()->call("_get_plugin_name");
}
return String();
}
const Ref<Texture2D> EditorPlugin::get_icon() const {
- if (get_script_instance() && get_script_instance()->has_method("get_plugin_icon")) {
- return get_script_instance()->call("get_plugin_icon");
+ if (get_script_instance() && get_script_instance()->has_method("_get_plugin_icon")) {
+ return get_script_instance()->call("_get_plugin_icon");
}
return Ref<Texture2D>();
}
bool EditorPlugin::has_main_screen() const {
- if (get_script_instance() && get_script_instance()->has_method("has_main_screen")) {
- return get_script_instance()->call("has_main_screen");
+ if (get_script_instance() && get_script_instance()->has_method("_has_main_screen")) {
+ return get_script_instance()->call("_has_main_screen");
}
return false;
}
void EditorPlugin::make_visible(bool p_visible) {
- if (get_script_instance() && get_script_instance()->has_method("make_visible")) {
- get_script_instance()->call("make_visible", p_visible);
+ if (get_script_instance() && get_script_instance()->has_method("_make_visible")) {
+ get_script_instance()->call("_make_visible", p_visible);
}
}
void EditorPlugin::edit(Object *p_object) {
- if (get_script_instance() && get_script_instance()->has_method("edit")) {
+ if (get_script_instance() && get_script_instance()->has_method("_edit")) {
if (p_object->is_class("Resource")) {
- get_script_instance()->call("edit", Ref<Resource>(Object::cast_to<Resource>(p_object)));
+ get_script_instance()->call("_edit", Ref<Resource>(Object::cast_to<Resource>(p_object)));
} else {
- get_script_instance()->call("edit", p_object);
+ get_script_instance()->call("_edit", p_object);
}
}
}
bool EditorPlugin::handles(Object *p_object) const {
- if (get_script_instance() && get_script_instance()->has_method("handles")) {
- return get_script_instance()->call("handles", p_object);
+ if (get_script_instance() && get_script_instance()->has_method("_handles")) {
+ return get_script_instance()->call("_handles", p_object);
}
return false;
}
Dictionary EditorPlugin::get_state() const {
- if (get_script_instance() && get_script_instance()->has_method("get_state")) {
- return get_script_instance()->call("get_state");
+ if (get_script_instance() && get_script_instance()->has_method("_get_state")) {
+ return get_script_instance()->call("_get_state");
}
return Dictionary();
}
void EditorPlugin::set_state(const Dictionary &p_state) {
- if (get_script_instance() && get_script_instance()->has_method("set_state")) {
- get_script_instance()->call("set_state", p_state);
+ if (get_script_instance() && get_script_instance()->has_method("_set_state")) {
+ get_script_instance()->call("_set_state", p_state);
}
}
void EditorPlugin::clear() {
- if (get_script_instance() && get_script_instance()->has_method("clear")) {
- get_script_instance()->call("clear");
+ if (get_script_instance() && get_script_instance()->has_method("_clear")) {
+ get_script_instance()->call("_clear");
}
}
// if editor references external resources/scenes, save them
void EditorPlugin::save_external_data() {
- if (get_script_instance() && get_script_instance()->has_method("save_external_data")) {
- get_script_instance()->call("save_external_data");
+ if (get_script_instance() && get_script_instance()->has_method("_save_external_data")) {
+ get_script_instance()->call("_save_external_data");
}
}
// if changes are pending in editor, apply them
void EditorPlugin::apply_changes() {
- if (get_script_instance() && get_script_instance()->has_method("apply_changes")) {
- get_script_instance()->call("apply_changes");
+ if (get_script_instance() && get_script_instance()->has_method("_apply_changes")) {
+ get_script_instance()->call("_apply_changes");
}
}
void EditorPlugin::get_breakpoints(List<String> *p_breakpoints) {
- if (get_script_instance() && get_script_instance()->has_method("get_breakpoints")) {
- PackedStringArray arr = get_script_instance()->call("get_breakpoints");
+ if (get_script_instance() && get_script_instance()->has_method("_get_breakpoints")) {
+ PackedStringArray arr = get_script_instance()->call("_get_breakpoints");
for (int i = 0; i < arr.size(); i++) {
p_breakpoints->push_back(arr[i]);
}
@@ -717,52 +717,64 @@ void EditorPlugin::remove_undo_redo_inspector_hook_callback(Callable p_callable)
}
void EditorPlugin::add_translation_parser_plugin(const Ref<EditorTranslationParserPlugin> &p_parser) {
+ ERR_FAIL_COND(!p_parser.is_valid());
EditorTranslationParser::get_singleton()->add_parser(p_parser, EditorTranslationParser::CUSTOM);
}
void EditorPlugin::remove_translation_parser_plugin(const Ref<EditorTranslationParserPlugin> &p_parser) {
+ ERR_FAIL_COND(!p_parser.is_valid());
EditorTranslationParser::get_singleton()->remove_parser(p_parser, EditorTranslationParser::CUSTOM);
}
void EditorPlugin::add_import_plugin(const Ref<EditorImportPlugin> &p_importer) {
+ ERR_FAIL_COND(!p_importer.is_valid());
ResourceFormatImporter::get_singleton()->add_importer(p_importer);
EditorFileSystem::get_singleton()->call_deferred("scan");
}
void EditorPlugin::remove_import_plugin(const Ref<EditorImportPlugin> &p_importer) {
+ ERR_FAIL_COND(!p_importer.is_valid());
ResourceFormatImporter::get_singleton()->remove_importer(p_importer);
EditorFileSystem::get_singleton()->call_deferred("scan");
}
void EditorPlugin::add_export_plugin(const Ref<EditorExportPlugin> &p_exporter) {
+ ERR_FAIL_COND(!p_exporter.is_valid());
EditorExport::get_singleton()->add_export_plugin(p_exporter);
}
void EditorPlugin::remove_export_plugin(const Ref<EditorExportPlugin> &p_exporter) {
+ ERR_FAIL_COND(!p_exporter.is_valid());
EditorExport::get_singleton()->remove_export_plugin(p_exporter);
}
void EditorPlugin::add_spatial_gizmo_plugin(const Ref<EditorNode3DGizmoPlugin> &p_gizmo_plugin) {
+ ERR_FAIL_COND(!p_gizmo_plugin.is_valid());
Node3DEditor::get_singleton()->add_gizmo_plugin(p_gizmo_plugin);
}
void EditorPlugin::remove_spatial_gizmo_plugin(const Ref<EditorNode3DGizmoPlugin> &p_gizmo_plugin) {
+ ERR_FAIL_COND(!p_gizmo_plugin.is_valid());
Node3DEditor::get_singleton()->remove_gizmo_plugin(p_gizmo_plugin);
}
void EditorPlugin::add_inspector_plugin(const Ref<EditorInspectorPlugin> &p_plugin) {
+ ERR_FAIL_COND(!p_plugin.is_valid());
EditorInspector::add_inspector_plugin(p_plugin);
}
void EditorPlugin::remove_inspector_plugin(const Ref<EditorInspectorPlugin> &p_plugin) {
+ ERR_FAIL_COND(!p_plugin.is_valid());
EditorInspector::remove_inspector_plugin(p_plugin);
}
void EditorPlugin::add_scene_import_plugin(const Ref<EditorSceneImporter> &p_importer) {
+ ERR_FAIL_COND(!p_importer.is_valid());
ResourceImporterScene::get_singleton()->add_importer(p_importer);
}
void EditorPlugin::remove_scene_import_plugin(const Ref<EditorSceneImporter> &p_importer) {
+ ERR_FAIL_COND(!p_importer.is_valid());
ResourceImporterScene::get_singleton()->remove_importer(p_importer);
}
@@ -779,8 +791,8 @@ int find(const PackedStringArray &a, const String &v) {
void EditorPlugin::enable_plugin() {
// Called when the plugin gets enabled in project settings, after it's added to the tree.
// You can implement it to register autoloads.
- if (get_script_instance() && get_script_instance()->has_method("enable_plugin")) {
- get_script_instance()->call("enable_plugin");
+ if (get_script_instance() && get_script_instance()->has_method("_enable_plugin")) {
+ get_script_instance()->call("_enable_plugin");
}
}
@@ -788,26 +800,26 @@ void EditorPlugin::disable_plugin() {
// Last function called when the plugin gets disabled in project settings.
// Implement it to cleanup things from the project, such as unregister autoloads.
- if (get_script_instance() && get_script_instance()->has_method("disable_plugin")) {
- get_script_instance()->call("disable_plugin");
+ if (get_script_instance() && get_script_instance()->has_method("_disable_plugin")) {
+ get_script_instance()->call("_disable_plugin");
}
}
void EditorPlugin::set_window_layout(Ref<ConfigFile> p_layout) {
- if (get_script_instance() && get_script_instance()->has_method("set_window_layout")) {
- get_script_instance()->call("set_window_layout", p_layout);
+ if (get_script_instance() && get_script_instance()->has_method("_set_window_layout")) {
+ get_script_instance()->call("_set_window_layout", p_layout);
}
}
void EditorPlugin::get_window_layout(Ref<ConfigFile> p_layout) {
- if (get_script_instance() && get_script_instance()->has_method("get_window_layout")) {
- get_script_instance()->call("get_window_layout", p_layout);
+ if (get_script_instance() && get_script_instance()->has_method("_get_window_layout")) {
+ get_script_instance()->call("_get_window_layout", p_layout);
}
}
bool EditorPlugin::build() {
- if (get_script_instance() && get_script_instance()->has_method("build")) {
- return get_script_instance()->call("build");
+ if (get_script_instance() && get_script_instance()->has_method("_build")) {
+ return get_script_instance()->call("_build");
}
return true;
@@ -898,29 +910,29 @@ void EditorPlugin::_bind_methods() {
ClassDB::bind_method(D_METHOD("add_debugger_plugin", "script"), &EditorPlugin::add_debugger_plugin);
ClassDB::bind_method(D_METHOD("remove_debugger_plugin", "script"), &EditorPlugin::remove_debugger_plugin);
- ClassDB::add_virtual_method(get_class_static(), MethodInfo(Variant::BOOL, "forward_canvas_gui_input", PropertyInfo(Variant::OBJECT, "event", PROPERTY_HINT_RESOURCE_TYPE, "InputEvent")));
- ClassDB::add_virtual_method(get_class_static(), MethodInfo("forward_canvas_draw_over_viewport", PropertyInfo(Variant::OBJECT, "overlay", PROPERTY_HINT_RESOURCE_TYPE, "Control")));
- ClassDB::add_virtual_method(get_class_static(), MethodInfo("forward_canvas_force_draw_over_viewport", PropertyInfo(Variant::OBJECT, "overlay", PROPERTY_HINT_RESOURCE_TYPE, "Control")));
- ClassDB::add_virtual_method(get_class_static(), MethodInfo(Variant::BOOL, "forward_spatial_gui_input", PropertyInfo(Variant::OBJECT, "camera", PROPERTY_HINT_RESOURCE_TYPE, "Camera3D"), PropertyInfo(Variant::OBJECT, "event", PROPERTY_HINT_RESOURCE_TYPE, "InputEvent")));
- ClassDB::add_virtual_method(get_class_static(), MethodInfo("forward_spatial_draw_over_viewport", PropertyInfo(Variant::OBJECT, "overlay", PROPERTY_HINT_RESOURCE_TYPE, "Control")));
- ClassDB::add_virtual_method(get_class_static(), MethodInfo("forward_spatial_force_draw_over_viewport", PropertyInfo(Variant::OBJECT, "overlay", PROPERTY_HINT_RESOURCE_TYPE, "Control")));
- ClassDB::add_virtual_method(get_class_static(), MethodInfo(Variant::STRING, "get_plugin_name"));
- ClassDB::add_virtual_method(get_class_static(), MethodInfo(PropertyInfo(Variant::OBJECT, "icon", PROPERTY_HINT_RESOURCE_TYPE, "Texture2D"), "get_plugin_icon"));
- ClassDB::add_virtual_method(get_class_static(), MethodInfo(Variant::BOOL, "has_main_screen"));
- ClassDB::add_virtual_method(get_class_static(), MethodInfo("make_visible", PropertyInfo(Variant::BOOL, "visible")));
- ClassDB::add_virtual_method(get_class_static(), MethodInfo("edit", PropertyInfo(Variant::OBJECT, "object")));
- ClassDB::add_virtual_method(get_class_static(), MethodInfo(Variant::BOOL, "handles", PropertyInfo(Variant::OBJECT, "object")));
- ClassDB::add_virtual_method(get_class_static(), MethodInfo(Variant::DICTIONARY, "get_state"));
- ClassDB::add_virtual_method(get_class_static(), MethodInfo("set_state", PropertyInfo(Variant::DICTIONARY, "state")));
- ClassDB::add_virtual_method(get_class_static(), MethodInfo("clear"));
- ClassDB::add_virtual_method(get_class_static(), MethodInfo("save_external_data"));
- ClassDB::add_virtual_method(get_class_static(), MethodInfo("apply_changes"));
- ClassDB::add_virtual_method(get_class_static(), MethodInfo(Variant::PACKED_STRING_ARRAY, "get_breakpoints"));
- ClassDB::add_virtual_method(get_class_static(), MethodInfo("set_window_layout", PropertyInfo(Variant::OBJECT, "layout", PROPERTY_HINT_RESOURCE_TYPE, "ConfigFile")));
- ClassDB::add_virtual_method(get_class_static(), MethodInfo("get_window_layout", PropertyInfo(Variant::OBJECT, "layout", PROPERTY_HINT_RESOURCE_TYPE, "ConfigFile")));
- ClassDB::add_virtual_method(get_class_static(), MethodInfo(Variant::BOOL, "build"));
- ClassDB::add_virtual_method(get_class_static(), MethodInfo("enable_plugin"));
- ClassDB::add_virtual_method(get_class_static(), MethodInfo("disable_plugin"));
+ BIND_VMETHOD(MethodInfo(Variant::BOOL, "_forward_canvas_gui_input", PropertyInfo(Variant::OBJECT, "event", PROPERTY_HINT_RESOURCE_TYPE, "InputEvent")));
+ BIND_VMETHOD(MethodInfo("_forward_canvas_draw_over_viewport", PropertyInfo(Variant::OBJECT, "overlay", PROPERTY_HINT_RESOURCE_TYPE, "Control")));
+ BIND_VMETHOD(MethodInfo("_forward_canvas_force_draw_over_viewport", PropertyInfo(Variant::OBJECT, "overlay", PROPERTY_HINT_RESOURCE_TYPE, "Control")));
+ BIND_VMETHOD(MethodInfo(Variant::BOOL, "_forward_spatial_gui_input", PropertyInfo(Variant::OBJECT, "camera", PROPERTY_HINT_RESOURCE_TYPE, "Camera3D"), PropertyInfo(Variant::OBJECT, "event", PROPERTY_HINT_RESOURCE_TYPE, "InputEvent")));
+ BIND_VMETHOD(MethodInfo("_forward_spatial_draw_over_viewport", PropertyInfo(Variant::OBJECT, "overlay", PROPERTY_HINT_RESOURCE_TYPE, "Control")));
+ BIND_VMETHOD(MethodInfo("_forward_spatial_force_draw_over_viewport", PropertyInfo(Variant::OBJECT, "overlay", PROPERTY_HINT_RESOURCE_TYPE, "Control")));
+ BIND_VMETHOD(MethodInfo(Variant::STRING, "_get_plugin_name"));
+ BIND_VMETHOD(MethodInfo(PropertyInfo(Variant::OBJECT, "icon", PROPERTY_HINT_RESOURCE_TYPE, "Texture2D"), "_get_plugin_icon"));
+ BIND_VMETHOD(MethodInfo(Variant::BOOL, "_has_main_screen"));
+ BIND_VMETHOD(MethodInfo("_make_visible", PropertyInfo(Variant::BOOL, "visible")));
+ BIND_VMETHOD(MethodInfo("_edit", PropertyInfo(Variant::OBJECT, "object")));
+ BIND_VMETHOD(MethodInfo(Variant::BOOL, "_handles", PropertyInfo(Variant::OBJECT, "object")));
+ BIND_VMETHOD(MethodInfo(Variant::DICTIONARY, "_get_state"));
+ BIND_VMETHOD(MethodInfo("_set_state", PropertyInfo(Variant::DICTIONARY, "state")));
+ BIND_VMETHOD(MethodInfo("_clear"));
+ BIND_VMETHOD(MethodInfo("_save_external_data"));
+ BIND_VMETHOD(MethodInfo("_apply_changes"));
+ BIND_VMETHOD(MethodInfo(Variant::PACKED_STRING_ARRAY, "_get_breakpoints"));
+ BIND_VMETHOD(MethodInfo("_set_window_layout", PropertyInfo(Variant::OBJECT, "layout", PROPERTY_HINT_RESOURCE_TYPE, "ConfigFile")));
+ BIND_VMETHOD(MethodInfo("_get_window_layout", PropertyInfo(Variant::OBJECT, "layout", PROPERTY_HINT_RESOURCE_TYPE, "ConfigFile")));
+ BIND_VMETHOD(MethodInfo(Variant::BOOL, "_build"));
+ BIND_VMETHOD(MethodInfo("_enable_plugin"));
+ BIND_VMETHOD(MethodInfo("_disable_plugin"));
ADD_SIGNAL(MethodInfo("scene_changed", PropertyInfo(Variant::OBJECT, "scene_root", PROPERTY_HINT_RESOURCE_TYPE, "Node")));
ADD_SIGNAL(MethodInfo("scene_closed", PropertyInfo(Variant::STRING, "filepath")));
diff --git a/editor/editor_plugin_settings.cpp b/editor/editor_plugin_settings.cpp
index e5b62513ff..1db24bb908 100644
--- a/editor/editor_plugin_settings.cpp
+++ b/editor/editor_plugin_settings.cpp
@@ -32,7 +32,7 @@
#include "core/config/project_settings.h"
#include "core/io/config_file.h"
-#include "core/os/file_access.h"
+#include "core/io/file_access.h"
#include "core/os/main_loop.h"
#include "editor_node.h"
#include "editor_scale.h"
diff --git a/editor/editor_properties.cpp b/editor/editor_properties.cpp
index ece7094767..0feee447a4 100644
--- a/editor/editor_properties.cpp
+++ b/editor/editor_properties.cpp
@@ -2261,7 +2261,7 @@ void EditorPropertyNodePath::_node_selected(const NodePath &p_path) {
base_node = get_edited_object()->call("get_root_path");
}
- if (!base_node && Object::cast_to<Reference>(get_edited_object())) {
+ if (!base_node && Object::cast_to<RefCounted>(get_edited_object())) {
Node *to_node = get_node(p_path);
ERR_FAIL_COND(!to_node);
path = get_tree()->get_edited_scene_root()->get_path_to(to_node);
diff --git a/editor/editor_properties_array_dict.cpp b/editor/editor_properties_array_dict.cpp
index bfa85f4aab..66fabcd940 100644
--- a/editor/editor_properties_array_dict.cpp
+++ b/editor/editor_properties_array_dict.cpp
@@ -567,8 +567,8 @@ void EditorPropertyArray::setup(Variant::Type p_array_type, const String &p_hint
}
void EditorPropertyArray::_bind_methods() {
- ClassDB::bind_method(D_METHOD("can_drop_data_fw"), &EditorPropertyArray::can_drop_data_fw);
- ClassDB::bind_method(D_METHOD("drop_data_fw"), &EditorPropertyArray::drop_data_fw);
+ ClassDB::bind_method(D_METHOD("_can_drop_data_fw"), &EditorPropertyArray::can_drop_data_fw);
+ ClassDB::bind_method(D_METHOD("_drop_data_fw"), &EditorPropertyArray::drop_data_fw);
}
EditorPropertyArray::EditorPropertyArray() {
diff --git a/editor/editor_properties_array_dict.h b/editor/editor_properties_array_dict.h
index fa5adc788d..aa2d8744b1 100644
--- a/editor/editor_properties_array_dict.h
+++ b/editor/editor_properties_array_dict.h
@@ -36,8 +36,8 @@
#include "editor/filesystem_dock.h"
#include "scene/gui/button.h"
-class EditorPropertyArrayObject : public Reference {
- GDCLASS(EditorPropertyArrayObject, Reference);
+class EditorPropertyArrayObject : public RefCounted {
+ GDCLASS(EditorPropertyArrayObject, RefCounted);
Variant array;
@@ -52,8 +52,8 @@ public:
EditorPropertyArrayObject();
};
-class EditorPropertyDictionaryObject : public Reference {
- GDCLASS(EditorPropertyDictionaryObject, Reference);
+class EditorPropertyDictionaryObject : public RefCounted {
+ GDCLASS(EditorPropertyDictionaryObject, RefCounted);
Variant new_item_key;
Variant new_item_value;
diff --git a/editor/editor_resource_picker.cpp b/editor/editor_resource_picker.cpp
index d1a0bfeded..1ea8c71f85 100644
--- a/editor/editor_resource_picker.cpp
+++ b/editor/editor_resource_picker.cpp
@@ -361,8 +361,8 @@ void EditorResourcePicker::_edit_menu_cbk(int p_which) {
void EditorResourcePicker::set_create_options(Object *p_menu_node) {
// If a subclass implements this method, use it to replace all create items.
- if (get_script_instance() && get_script_instance()->has_method("set_create_options")) {
- get_script_instance()->call("set_create_options", p_menu_node);
+ if (get_script_instance() && get_script_instance()->has_method("_set_create_options")) {
+ get_script_instance()->call("_set_create_options", p_menu_node);
return;
}
@@ -418,8 +418,8 @@ void EditorResourcePicker::set_create_options(Object *p_menu_node) {
}
bool EditorResourcePicker::handle_menu_selected(int p_which) {
- if (get_script_instance() && get_script_instance()->has_method("handle_menu_selected")) {
- return get_script_instance()->call("handle_menu_selected", p_which);
+ if (get_script_instance() && get_script_instance()->has_method("_handle_menu_selected")) {
+ return get_script_instance()->call("_handle_menu_selected", p_which);
}
return false;
@@ -625,9 +625,9 @@ void EditorResourcePicker::drop_data_fw(const Point2 &p_point, const Variant &p_
void EditorResourcePicker::_bind_methods() {
ClassDB::bind_method(D_METHOD("_update_resource_preview"), &EditorResourcePicker::_update_resource_preview);
- ClassDB::bind_method(D_METHOD("get_drag_data_fw", "position", "from"), &EditorResourcePicker::get_drag_data_fw);
- ClassDB::bind_method(D_METHOD("can_drop_data_fw", "position", "data", "from"), &EditorResourcePicker::can_drop_data_fw);
- ClassDB::bind_method(D_METHOD("drop_data_fw", "position", "data", "from"), &EditorResourcePicker::drop_data_fw);
+ ClassDB::bind_method(D_METHOD("_get_drag_data_fw", "position", "from"), &EditorResourcePicker::get_drag_data_fw);
+ ClassDB::bind_method(D_METHOD("_can_drop_data_fw", "position", "data", "from"), &EditorResourcePicker::can_drop_data_fw);
+ ClassDB::bind_method(D_METHOD("_drop_data_fw", "position", "data", "from"), &EditorResourcePicker::drop_data_fw);
ClassDB::bind_method(D_METHOD("set_base_type", "base_type"), &EditorResourcePicker::set_base_type);
ClassDB::bind_method(D_METHOD("get_base_type"), &EditorResourcePicker::get_base_type);
@@ -640,8 +640,8 @@ void EditorResourcePicker::_bind_methods() {
ClassDB::bind_method(D_METHOD("set_editable", "enable"), &EditorResourcePicker::set_editable);
ClassDB::bind_method(D_METHOD("is_editable"), &EditorResourcePicker::is_editable);
- ClassDB::add_virtual_method(get_class_static(), MethodInfo("set_create_options", PropertyInfo(Variant::OBJECT, "menu_node")));
- ClassDB::add_virtual_method(get_class_static(), MethodInfo("handle_menu_selected", PropertyInfo(Variant::INT, "id")));
+ ClassDB::add_virtual_method(get_class_static(), MethodInfo("_set_create_options", PropertyInfo(Variant::OBJECT, "menu_node")));
+ ClassDB::add_virtual_method(get_class_static(), MethodInfo("_handle_menu_selected", PropertyInfo(Variant::INT, "id")));
ADD_PROPERTY(PropertyInfo(Variant::STRING, "base_type"), "set_base_type", "get_base_type");
ADD_PROPERTY(PropertyInfo(Variant::OBJECT, "edited_resource", PROPERTY_HINT_RESOURCE_TYPE, "Resource", 0), "set_edited_resource", "get_edited_resource");
diff --git a/editor/editor_resource_preview.cpp b/editor/editor_resource_preview.cpp
index 35cf08b4d7..0f1b70936a 100644
--- a/editor/editor_resource_preview.cpp
+++ b/editor/editor_resource_preview.cpp
@@ -31,31 +31,31 @@
#include "editor_resource_preview.h"
#include "core/config/project_settings.h"
+#include "core/io/file_access.h"
#include "core/io/resource_loader.h"
#include "core/io/resource_saver.h"
#include "core/object/message_queue.h"
-#include "core/os/file_access.h"
#include "editor_node.h"
#include "editor_scale.h"
#include "editor_settings.h"
bool EditorResourcePreviewGenerator::handles(const String &p_type) const {
- if (get_script_instance() && get_script_instance()->has_method("handles")) {
- return get_script_instance()->call("handles", p_type);
+ if (get_script_instance() && get_script_instance()->has_method("_handles")) {
+ return get_script_instance()->call("_handles", p_type);
}
- ERR_FAIL_V_MSG(false, "EditorResourcePreviewGenerator::handles needs to be overridden.");
+ ERR_FAIL_V_MSG(false, "EditorResourcePreviewGenerator::_handles needs to be overridden.");
}
Ref<Texture2D> EditorResourcePreviewGenerator::generate(const RES &p_from, const Size2 &p_size) const {
- if (get_script_instance() && get_script_instance()->has_method("generate")) {
- return get_script_instance()->call("generate", p_from, p_size);
+ if (get_script_instance() && get_script_instance()->has_method("_generate")) {
+ return get_script_instance()->call("_generate", p_from, p_size);
}
- ERR_FAIL_V_MSG(Ref<Texture2D>(), "EditorResourcePreviewGenerator::generate needs to be overridden.");
+ ERR_FAIL_V_MSG(Ref<Texture2D>(), "EditorResourcePreviewGenerator::_generate needs to be overridden.");
}
Ref<Texture2D> EditorResourcePreviewGenerator::generate_from_path(const String &p_path, const Size2 &p_size) const {
- if (get_script_instance() && get_script_instance()->has_method("generate_from_path")) {
- return get_script_instance()->call("generate_from_path", p_path, p_size);
+ if (get_script_instance() && get_script_instance()->has_method("_generate_from_path")) {
+ return get_script_instance()->call("_generate_from_path", p_path, p_size);
}
RES res = ResourceLoader::load(p_path);
@@ -66,27 +66,27 @@ Ref<Texture2D> EditorResourcePreviewGenerator::generate_from_path(const String &
}
bool EditorResourcePreviewGenerator::generate_small_preview_automatically() const {
- if (get_script_instance() && get_script_instance()->has_method("generate_small_preview_automatically")) {
- return get_script_instance()->call("generate_small_preview_automatically");
+ if (get_script_instance() && get_script_instance()->has_method("_generate_small_preview_automatically")) {
+ return get_script_instance()->call("_generate_small_preview_automatically");
}
return false;
}
bool EditorResourcePreviewGenerator::can_generate_small_preview() const {
- if (get_script_instance() && get_script_instance()->has_method("can_generate_small_preview")) {
- return get_script_instance()->call("can_generate_small_preview");
+ if (get_script_instance() && get_script_instance()->has_method("_can_generate_small_preview")) {
+ return get_script_instance()->call("_can_generate_small_preview");
}
return false;
}
void EditorResourcePreviewGenerator::_bind_methods() {
- ClassDB::add_virtual_method(get_class_static(), MethodInfo(Variant::BOOL, "handles", PropertyInfo(Variant::STRING, "type")));
- ClassDB::add_virtual_method(get_class_static(), MethodInfo(CLASS_INFO(Texture2D), "generate", PropertyInfo(Variant::OBJECT, "from", PROPERTY_HINT_RESOURCE_TYPE, "Resource"), PropertyInfo(Variant::VECTOR2, "size")));
- ClassDB::add_virtual_method(get_class_static(), MethodInfo(CLASS_INFO(Texture2D), "generate_from_path", PropertyInfo(Variant::STRING, "path", PROPERTY_HINT_FILE), PropertyInfo(Variant::VECTOR2, "size")));
- ClassDB::add_virtual_method(get_class_static(), MethodInfo(Variant::BOOL, "generate_small_preview_automatically"));
- ClassDB::add_virtual_method(get_class_static(), MethodInfo(Variant::BOOL, "can_generate_small_preview"));
+ BIND_VMETHOD(MethodInfo(Variant::BOOL, "_handles", PropertyInfo(Variant::STRING, "type")));
+ BIND_VMETHOD(MethodInfo(CLASS_INFO(Texture2D), "_generate", PropertyInfo(Variant::OBJECT, "from", PROPERTY_HINT_RESOURCE_TYPE, "Resource"), PropertyInfo(Variant::VECTOR2, "size")));
+ BIND_VMETHOD(MethodInfo(CLASS_INFO(Texture2D), "_generate_from_path", PropertyInfo(Variant::STRING, "path", PROPERTY_HINT_FILE), PropertyInfo(Variant::VECTOR2, "size")));
+ BIND_VMETHOD(MethodInfo(Variant::BOOL, "_generate_small_preview_automatically"));
+ BIND_VMETHOD(MethodInfo(Variant::BOOL, "_can_generate_small_preview"));
}
EditorResourcePreviewGenerator::EditorResourcePreviewGenerator() {
diff --git a/editor/editor_resource_preview.h b/editor/editor_resource_preview.h
index ffeb22162e..67f83220d0 100644
--- a/editor/editor_resource_preview.h
+++ b/editor/editor_resource_preview.h
@@ -37,8 +37,8 @@
#include "scene/main/node.h"
#include "scene/resources/texture.h"
-class EditorResourcePreviewGenerator : public Reference {
- GDCLASS(EditorResourcePreviewGenerator, Reference);
+class EditorResourcePreviewGenerator : public RefCounted {
+ GDCLASS(EditorResourcePreviewGenerator, RefCounted);
protected:
static void _bind_methods();
diff --git a/editor/editor_run_script.h b/editor/editor_run_script.h
index 83987ecba1..c8412c3c92 100644
--- a/editor/editor_run_script.h
+++ b/editor/editor_run_script.h
@@ -31,11 +31,11 @@
#ifndef EDITOR_RUN_SCRIPT_H
#define EDITOR_RUN_SCRIPT_H
-#include "core/object/reference.h"
+#include "core/object/ref_counted.h"
#include "editor_plugin.h"
class EditorNode;
-class EditorScript : public Reference {
- GDCLASS(EditorScript, Reference);
+class EditorScript : public RefCounted {
+ GDCLASS(EditorScript, RefCounted);
EditorNode *editor;
diff --git a/editor/editor_settings.cpp b/editor/editor_settings.cpp
index 71dc1b531a..fa7980b95f 100644
--- a/editor/editor_settings.cpp
+++ b/editor/editor_settings.cpp
@@ -35,13 +35,13 @@
#include "core/io/certs_compressed.gen.h"
#include "core/io/compression.h"
#include "core/io/config_file.h"
+#include "core/io/dir_access.h"
+#include "core/io/file_access.h"
#include "core/io/file_access_memory.h"
#include "core/io/ip.h"
#include "core/io/resource_loader.h"
#include "core/io/resource_saver.h"
#include "core/io/translation_loader_po.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/version.h"
@@ -768,8 +768,8 @@ void EditorSettings::_load_defaults(Ref<ConfigFile> p_extra_config) {
for (int i = 0; i < list.size(); i++) {
String name = list[i].replace("/", "::");
set("projects/" + name, list[i]);
- };
- };
+ }
+ }
if (p_extra_config->has_section("presets")) {
List<String> keys;
@@ -779,9 +779,9 @@ void EditorSettings::_load_defaults(Ref<ConfigFile> p_extra_config) {
String key = E->get();
Variant val = p_extra_config->get_value("presets", key);
set(key, val);
- };
- };
- };
+ }
+ }
+ }
}
void EditorSettings::_load_godot2_text_editor_theme() {
@@ -871,9 +871,8 @@ static void _create_script_templates(const String &p_path) {
Dictionary templates = _get_builtin_script_templates();
List<Variant> keys;
templates.get_key_list(&keys);
- FileAccess *file = FileAccess::create(FileAccess::ACCESS_FILESYSTEM);
-
- DirAccess *dir = DirAccess::create(DirAccess::ACCESS_FILESYSTEM);
+ FileAccessRef file = FileAccess::create(FileAccess::ACCESS_FILESYSTEM);
+ DirAccessRef dir = DirAccess::create(DirAccess::ACCESS_FILESYSTEM);
dir->change_dir(p_path);
for (int i = 0; i < keys.size(); i++) {
if (!dir->file_exists(keys[i])) {
@@ -883,9 +882,6 @@ static void _create_script_templates(const String &p_path) {
file->close();
}
}
-
- memdelete(dir);
- memdelete(file);
}
// PUBLIC METHODS
@@ -895,103 +891,48 @@ EditorSettings *EditorSettings::get_singleton() {
}
void EditorSettings::create() {
+ // IMPORTANT: create() *must* create a valid EditorSettings singleton,
+ // as the rest of the engine code will assume it. As such, it should never
+ // return (incl. via ERR_FAIL) without initializing the singleton member.
+
if (singleton.ptr()) {
- return; //pointless
+ ERR_PRINT("Can't recreate EditorSettings as it already exists.");
+ return;
}
+ ClassDB::register_class<EditorSettings>(); // Otherwise it can't be unserialized.
+
+ String config_file_path;
Ref<ConfigFile> extra_config = memnew(ConfigFile);
+ if (!EditorPaths::get_singleton()) {
+ ERR_PRINT("Bug (please report): EditorPaths haven't been initialized, EditorSettings cannot be created properly.");
+ goto fail;
+ }
+
if (EditorPaths::get_singleton()->is_self_contained()) {
Error err = extra_config->load(EditorPaths::get_singleton()->get_self_contained_file());
if (err != OK) {
- ERR_PRINT("Can't load extra config from path :" + EditorPaths::get_singleton()->get_self_contained_file());
+ ERR_PRINT("Can't load extra config from path: " + EditorPaths::get_singleton()->get_self_contained_file());
}
}
- DirAccess *dir = nullptr;
-
- ClassDB::register_class<EditorSettings>(); //otherwise it can't be unserialized
-
- String config_file_path;
-
if (EditorPaths::get_singleton()->are_paths_valid()) {
- // Validate/create data dir and subdirectories
-
- String data_dir = EditorPaths::get_singleton()->get_data_dir();
-
- dir = DirAccess::create(DirAccess::ACCESS_FILESYSTEM);
- if (dir->change_dir(data_dir) != OK) {
- dir->make_dir_recursive(data_dir);
- if (dir->change_dir(data_dir) != OK) {
- ERR_PRINT("Cannot create data directory!");
- memdelete(dir);
- goto fail;
- }
- }
-
- if (dir->change_dir("templates") != OK) {
- dir->make_dir("templates");
- } else {
- dir->change_dir("..");
- }
+ _create_script_templates(EditorPaths::get_singleton()->get_config_dir().plus_file("script_templates"));
- // Validate/create config dir and subdirectories
-
- if (dir->change_dir(EditorPaths::get_singleton()->get_config_dir()) != OK) {
- dir->make_dir_recursive(EditorPaths::get_singleton()->get_config_dir());
- if (dir->change_dir(EditorPaths::get_singleton()->get_config_dir()) != OK) {
- ERR_PRINT("Cannot create config directory!");
- memdelete(dir);
- goto fail;
- }
- }
-
- if (dir->change_dir("text_editor_themes") != OK) {
- dir->make_dir("text_editor_themes");
- } else {
- dir->change_dir("..");
- }
-
- if (dir->change_dir("script_templates") != OK) {
- dir->make_dir("script_templates");
- } else {
- dir->change_dir("..");
- }
-
- if (dir->change_dir("feature_profiles") != OK) {
- dir->make_dir("feature_profiles");
- } else {
- dir->change_dir("..");
- }
-
- _create_script_templates(dir->get_current_dir().plus_file("script_templates"));
-
- {
- // Validate/create project-specific editor settings dir.
- DirAccessRef da = DirAccess::create(DirAccess::ACCESS_RESOURCES);
- if (da->change_dir(EditorSettings::PROJECT_EDITOR_SETTINGS_PATH) != OK) {
- Error err = da->make_dir_recursive(EditorSettings::PROJECT_EDITOR_SETTINGS_PATH);
- if (err || da->change_dir(EditorSettings::PROJECT_EDITOR_SETTINGS_PATH) != OK) {
- ERR_FAIL_MSG("Failed to create '" + EditorSettings::PROJECT_EDITOR_SETTINGS_PATH + "' folder.");
- }
- }
- }
-
- // Validate editor config file
+ // Validate editor config file.
+ DirAccessRef dir = DirAccess::open(EditorPaths::get_singleton()->get_config_dir());
String config_file_name = "editor_settings-" + itos(VERSION_MAJOR) + ".tres";
config_file_path = EditorPaths::get_singleton()->get_config_dir().plus_file(config_file_name);
if (!dir->file_exists(config_file_name)) {
- memdelete(dir);
goto fail;
}
- memdelete(dir);
-
singleton = ResourceLoader::load(config_file_path, "EditorSettings");
if (singleton.is_null()) {
- WARN_PRINT("Could not open config file.");
+ ERR_PRINT("Could not load editor settings from path: " + config_file_path);
goto fail;
}
@@ -1009,7 +950,6 @@ void EditorSettings::create() {
}
fail:
-
// patch init projects
String exe_path = OS::get_singleton()->get_executable_path().get_base_dir();
@@ -1017,9 +957,9 @@ fail:
Vector<String> list = extra_config->get_value("init_projects", "list");
for (int i = 0; i < list.size(); i++) {
list.write[i] = exe_path.plus_file(list[i]);
- };
+ }
extra_config->set_value("init_projects", "list", list);
- };
+ }
singleton = Ref<EditorSettings>(memnew(EditorSettings));
singleton->save_changed_setting = true;
@@ -1251,16 +1191,15 @@ void EditorSettings::add_property_hint(const PropertyInfo &p_hint) {
hints[p_hint.name] = p_hint;
}
-// Data directories
+// Editor data and config directories
+// EditorPaths::create() is responsible for the creation of these directories.
String EditorSettings::get_templates_dir() const {
return EditorPaths::get_singleton()->get_data_dir().plus_file("templates");
}
-// Config directories
-
String EditorSettings::get_project_settings_dir() const {
- return EditorSettings::PROJECT_EDITOR_SETTINGS_PATH;
+ return EditorPaths::get_singleton()->get_project_data_dir().plus_file("editor");
}
String EditorSettings::get_text_editor_themes_dir() const {
@@ -1275,8 +1214,6 @@ String EditorSettings::get_project_script_templates_dir() const {
return ProjectSettings::get_singleton()->get("editor/script/templates_search_path");
}
-// Cache directory
-
String EditorSettings::get_feature_profiles_dir() const {
return EditorPaths::get_singleton()->get_config_dir().plus_file("feature_profiles");
}
diff --git a/editor/editor_settings.h b/editor/editor_settings.h
index 4c361403a9..d6a9a9d1b9 100644
--- a/editor/editor_settings.h
+++ b/editor/editor_settings.h
@@ -47,7 +47,6 @@ class EditorSettings : public Resource {
_THREAD_SAFE_CLASS_
public:
- inline static const String PROJECT_EDITOR_SETTINGS_PATH = "res://.godot/editor";
struct Plugin {
EditorPlugin *instance = nullptr;
String path;
diff --git a/editor/editor_themes.cpp b/editor/editor_themes.cpp
index 64f7500e8c..fa543b7455 100644
--- a/editor/editor_themes.cpp
+++ b/editor/editor_themes.cpp
@@ -960,14 +960,6 @@ Ref<Theme> create_editor_theme(const Ref<Theme> p_theme) {
style_content_panel->set_border_color(dark_color_2);
theme->set_stylebox("panel", "TabContainer", style_content_panel);
- // this is the stylebox used in 3d and 2d viewports (no borders)
- Ref<StyleBoxFlat> style_content_panel_vp = style_content_panel->duplicate();
- style_content_panel_vp->set_default_margin(SIDE_LEFT, border_width * 2);
- style_content_panel_vp->set_default_margin(SIDE_TOP, default_margin_size * EDSCALE);
- style_content_panel_vp->set_default_margin(SIDE_RIGHT, border_width * 2);
- style_content_panel_vp->set_default_margin(SIDE_BOTTOM, border_width * 2);
- theme->set_stylebox("Content", "EditorStyles", style_content_panel_vp);
-
// These styleboxes can be used on tabs against the base color background (e.g. nested tabs).
Ref<StyleBoxFlat> style_tab_selected_odd = style_tab_selected->duplicate();
style_tab_selected_odd->set_bg_color(disabled_bg_color);
@@ -977,6 +969,22 @@ Ref<Theme> create_editor_theme(const Ref<Theme> p_theme) {
style_content_panel_odd->set_bg_color(disabled_bg_color);
theme->set_stylebox("panel_odd", "TabContainer", style_content_panel_odd);
+ // This stylebox is used in 3d and 2d viewports (no borders).
+ Ref<StyleBoxFlat> style_content_panel_vp = style_content_panel->duplicate();
+ style_content_panel_vp->set_default_margin(SIDE_LEFT, border_width * 2);
+ style_content_panel_vp->set_default_margin(SIDE_TOP, default_margin_size * EDSCALE);
+ style_content_panel_vp->set_default_margin(SIDE_RIGHT, border_width * 2);
+ style_content_panel_vp->set_default_margin(SIDE_BOTTOM, border_width * 2);
+ theme->set_stylebox("Content", "EditorStyles", style_content_panel_vp);
+
+ // This stylebox is used by preview tabs in the Theme Editor.
+ Ref<StyleBoxFlat> style_theme_preview_tab = style_tab_selected_odd->duplicate();
+ style_theme_preview_tab->set_expand_margin_size(SIDE_BOTTOM, 5 * EDSCALE);
+ theme->set_stylebox("ThemeEditorPreviewFG", "EditorStyles", style_theme_preview_tab);
+ Ref<StyleBoxFlat> style_theme_preview_bg_tab = style_tab_unselected->duplicate();
+ style_theme_preview_bg_tab->set_expand_margin_size(SIDE_BOTTOM, 2 * EDSCALE);
+ theme->set_stylebox("ThemeEditorPreviewBG", "EditorStyles", style_theme_preview_bg_tab);
+
// Separators
theme->set_stylebox("separator", "HSeparator", make_line_stylebox(separator_color, MAX(Math::round(EDSCALE), border_width)));
theme->set_stylebox("separator", "VSeparator", make_line_stylebox(separator_color, MAX(Math::round(EDSCALE), border_width), 0, 0, true));
@@ -1346,6 +1354,15 @@ Ref<Theme> create_editor_theme(const Ref<Theme> p_theme) {
style_info_3d_viewport->set_border_width_all(0);
theme->set_stylebox("Information3dViewport", "EditorStyles", style_info_3d_viewport);
+ // Theme editor.
+ theme->set_color("preview_picker_overlay_color", "ThemeEditor", Color(0.1, 0.1, 0.1, 0.25));
+ Color theme_preview_picker_bg_color = accent_color;
+ theme_preview_picker_bg_color.a = 0.2;
+ Ref<StyleBoxFlat> theme_preview_picker_sb = make_flat_stylebox(theme_preview_picker_bg_color, 0, 0, 0, 0);
+ theme_preview_picker_sb->set_border_color(accent_color);
+ theme_preview_picker_sb->set_border_width_all(1.0 * EDSCALE);
+ theme->set_stylebox("preview_picker_overlay", "ThemeEditor", theme_preview_picker_sb);
+
// adaptive script theme constants
// for comments and elements with lower relevance
const Color dim_color = Color(font_color.r, font_color.g, font_color.b, 0.5);
diff --git a/editor/editor_translation_parser.cpp b/editor/editor_translation_parser.cpp
index 49d5cf1fd3..27d428e682 100644
--- a/editor/editor_translation_parser.cpp
+++ b/editor/editor_translation_parser.cpp
@@ -31,8 +31,8 @@
#include "editor_translation_parser.h"
#include "core/error/error_macros.h"
+#include "core/io/file_access.h"
#include "core/object/script_language.h"
-#include "core/os/file_access.h"
#include "core/templates/set.h"
EditorTranslationParser *EditorTranslationParser::singleton = nullptr;
@@ -42,10 +42,10 @@ Error EditorTranslationParserPlugin::parse_file(const String &p_path, Vector<Str
return ERR_UNAVAILABLE;
}
- if (get_script_instance()->has_method("parse_file")) {
+ if (get_script_instance()->has_method("_parse_file")) {
Array ids;
Array ids_ctx_plural;
- get_script_instance()->call("parse_file", p_path, ids, ids_ctx_plural);
+ get_script_instance()->call("_parse_file", p_path, ids, ids_ctx_plural);
// Add user's extracted translatable messages.
for (int i = 0; i < ids.size(); i++) {
@@ -75,8 +75,8 @@ void EditorTranslationParserPlugin::get_recognized_extensions(List<String> *r_ex
return;
}
- if (get_script_instance()->has_method("get_recognized_extensions")) {
- Array extensions = get_script_instance()->call("get_recognized_extensions");
+ if (get_script_instance()->has_method("_get_recognized_extensions")) {
+ Array extensions = get_script_instance()->call("_get_recognized_extensions");
for (int i = 0; i < extensions.size(); i++) {
r_extensions->push_back(extensions[i]);
}
@@ -86,8 +86,8 @@ void EditorTranslationParserPlugin::get_recognized_extensions(List<String> *r_ex
}
void EditorTranslationParserPlugin::_bind_methods() {
- ClassDB::add_virtual_method(get_class_static(), MethodInfo(Variant::NIL, "parse_file", PropertyInfo(Variant::STRING, "path"), PropertyInfo(Variant::ARRAY, "msgids"), PropertyInfo(Variant::ARRAY, "msgids_context_plural")));
- ClassDB::add_virtual_method(get_class_static(), MethodInfo(Variant::ARRAY, "get_recognized_extensions"));
+ BIND_VMETHOD(MethodInfo(Variant::NIL, "_parse_file", PropertyInfo(Variant::STRING, "path"), PropertyInfo(Variant::ARRAY, "msgids"), PropertyInfo(Variant::ARRAY, "msgids_context_plural")));
+ BIND_VMETHOD(MethodInfo(Variant::ARRAY, "_get_recognized_extensions"));
}
/////////////////////////
diff --git a/editor/editor_translation_parser.h b/editor/editor_translation_parser.h
index 4f8f3537f2..7013bbb8c4 100644
--- a/editor/editor_translation_parser.h
+++ b/editor/editor_translation_parser.h
@@ -32,10 +32,10 @@
#define EDITOR_TRANSLATION_PARSER_H
#include "core/error/error_list.h"
-#include "core/object/reference.h"
+#include "core/object/ref_counted.h"
-class EditorTranslationParserPlugin : public Reference {
- GDCLASS(EditorTranslationParserPlugin, Reference);
+class EditorTranslationParserPlugin : public RefCounted {
+ GDCLASS(EditorTranslationParserPlugin, RefCounted);
protected:
static void _bind_methods();
diff --git a/editor/export_template_manager.cpp b/editor/export_template_manager.cpp
index 39d7c7acd4..76c6fcc3d3 100644
--- a/editor/export_template_manager.cpp
+++ b/editor/export_template_manager.cpp
@@ -31,9 +31,9 @@
#include "export_template_manager.h"
#include "core/input/input.h"
+#include "core/io/dir_access.h"
#include "core/io/json.h"
#include "core/io/zip_io.h"
-#include "core/os/dir_access.h"
#include "core/os/keyboard.h"
#include "core/version.h"
#include "editor_node.h"
diff --git a/editor/filesystem_dock.cpp b/editor/filesystem_dock.cpp
index ce98f699ae..46bb6a1632 100644
--- a/editor/filesystem_dock.cpp
+++ b/editor/filesystem_dock.cpp
@@ -31,9 +31,9 @@
#include "filesystem_dock.h"
#include "core/config/project_settings.h"
+#include "core/io/dir_access.h"
+#include "core/io/file_access.h"
#include "core/io/resource_loader.h"
-#include "core/os/dir_access.h"
-#include "core/os/file_access.h"
#include "core/os/keyboard.h"
#include "core/os/os.h"
#include "core/templates/list.h"
@@ -2751,9 +2751,9 @@ void FileSystemDock::_bind_methods() {
ClassDB::bind_method(D_METHOD("_tree_thumbnail_done"), &FileSystemDock::_tree_thumbnail_done);
ClassDB::bind_method(D_METHOD("_select_file"), &FileSystemDock::_select_file);
- ClassDB::bind_method(D_METHOD("get_drag_data_fw", "position", "from"), &FileSystemDock::get_drag_data_fw);
- ClassDB::bind_method(D_METHOD("can_drop_data_fw", "position", "data", "from"), &FileSystemDock::can_drop_data_fw);
- ClassDB::bind_method(D_METHOD("drop_data_fw", "position", "data", "from"), &FileSystemDock::drop_data_fw);
+ ClassDB::bind_method(D_METHOD("_get_drag_data_fw", "position", "from"), &FileSystemDock::get_drag_data_fw);
+ ClassDB::bind_method(D_METHOD("_can_drop_data_fw", "position", "data", "from"), &FileSystemDock::can_drop_data_fw);
+ ClassDB::bind_method(D_METHOD("_drop_data_fw", "position", "data", "from"), &FileSystemDock::drop_data_fw);
ClassDB::bind_method(D_METHOD("navigate_to_path", "path"), &FileSystemDock::navigate_to_path);
ClassDB::bind_method(D_METHOD("_update_import_dock"), &FileSystemDock::_update_import_dock);
@@ -2777,22 +2777,7 @@ FileSystemDock::FileSystemDock(EditorNode *p_editor) {
// `KEY_MASK_CMD | KEY_C` conflicts with other editor shortcuts.
ED_SHORTCUT("filesystem_dock/copy_path", TTR("Copy Path"), KEY_MASK_CMD | KEY_MASK_SHIFT | KEY_C);
ED_SHORTCUT("filesystem_dock/duplicate", TTR("Duplicate..."), KEY_MASK_CMD | KEY_D);
-
-#if defined(WINDOWS_ENABLED)
- // TRANSLATORS: This string is only used on Windows, as it refers to the system trash
- // as "Recycle Bin" instead of "Trash". Make sure to use the translation of "Recycle Bin"
- // recommended by Microsoft for the target language.
- ED_SHORTCUT("filesystem_dock/delete", TTR("Move to Recycle Bin"), KEY_DELETE);
-#elif defined(OSX_ENABLED)
- // TRANSLATORS: This string is only used on macOS, as it refers to the system trash
- // as "Bin" instead of "Trash". Make sure to use the translation of "Bin"
- // recommended by Apple for the target language.
- ED_SHORTCUT("filesystem_dock/delete", TTR("Move to Bin"), KEY_DELETE);
-#else
- // TRANSLATORS: This string is only used on platforms other than Windows and macOS.
- ED_SHORTCUT("filesystem_dock/delete", TTR("Move to Trash"), KEY_DELETE);
-#endif
-
+ ED_SHORTCUT("filesystem_dock/delete", TTR("Delete"), KEY_DELETE);
ED_SHORTCUT("filesystem_dock/rename", TTR("Rename..."), KEY_F2);
VBoxContainer *top_vbc = memnew(VBoxContainer);
diff --git a/editor/filesystem_dock.h b/editor/filesystem_dock.h
index 8783c402cd..12c567fb69 100644
--- a/editor/filesystem_dock.h
+++ b/editor/filesystem_dock.h
@@ -43,7 +43,7 @@
#include "scene/gui/tree.h"
#include "scene/main/timer.h"
-#include "core/os/dir_access.h"
+#include "core/io/dir_access.h"
#include "core/os/thread.h"
#include "create_dialog.h"
diff --git a/editor/find_in_files.cpp b/editor/find_in_files.cpp
index d9b956ed08..17d24a295c 100644
--- a/editor/find_in_files.cpp
+++ b/editor/find_in_files.cpp
@@ -30,7 +30,7 @@
#include "find_in_files.h"
-#include "core/os/dir_access.h"
+#include "core/io/dir_access.h"
#include "core/os/os.h"
#include "editor_node.h"
#include "editor_scale.h"
diff --git a/editor/import/editor_import_plugin.cpp b/editor/import/editor_import_plugin.cpp
index 44aff874eb..8660289c40 100644
--- a/editor/import/editor_import_plugin.cpp
+++ b/editor/import/editor_import_plugin.cpp
@@ -35,63 +35,63 @@ EditorImportPlugin::EditorImportPlugin() {
}
String EditorImportPlugin::get_importer_name() const {
- ERR_FAIL_COND_V(!(get_script_instance() && get_script_instance()->has_method("get_importer_name")), "");
- return get_script_instance()->call("get_importer_name");
+ ERR_FAIL_COND_V(!(get_script_instance() && get_script_instance()->has_method("_get_importer_name")), "");
+ return get_script_instance()->call("_get_importer_name");
}
String EditorImportPlugin::get_visible_name() const {
- ERR_FAIL_COND_V(!(get_script_instance() && get_script_instance()->has_method("get_visible_name")), "");
- return get_script_instance()->call("get_visible_name");
+ ERR_FAIL_COND_V(!(get_script_instance() && get_script_instance()->has_method("_get_visible_name")), "");
+ return get_script_instance()->call("_get_visible_name");
}
void EditorImportPlugin::get_recognized_extensions(List<String> *p_extensions) const {
- ERR_FAIL_COND(!(get_script_instance() && get_script_instance()->has_method("get_recognized_extensions")));
- Array extensions = get_script_instance()->call("get_recognized_extensions");
+ ERR_FAIL_COND(!(get_script_instance() && get_script_instance()->has_method("_get_recognized_extensions")));
+ Array extensions = get_script_instance()->call("_get_recognized_extensions");
for (int i = 0; i < extensions.size(); i++) {
p_extensions->push_back(extensions[i]);
}
}
String EditorImportPlugin::get_preset_name(int p_idx) const {
- ERR_FAIL_COND_V(!(get_script_instance() && get_script_instance()->has_method("get_preset_name")), "");
- return get_script_instance()->call("get_preset_name", p_idx);
+ ERR_FAIL_COND_V(!(get_script_instance() && get_script_instance()->has_method("_get_preset_name")), "");
+ return get_script_instance()->call("_get_preset_name", p_idx);
}
int EditorImportPlugin::get_preset_count() const {
- ERR_FAIL_COND_V(!(get_script_instance() && get_script_instance()->has_method("get_preset_count")), 0);
- return get_script_instance()->call("get_preset_count");
+ ERR_FAIL_COND_V(!(get_script_instance() && get_script_instance()->has_method("_get_preset_count")), 0);
+ return get_script_instance()->call("_get_preset_count");
}
String EditorImportPlugin::get_save_extension() const {
- ERR_FAIL_COND_V(!(get_script_instance() && get_script_instance()->has_method("get_save_extension")), "");
- return get_script_instance()->call("get_save_extension");
+ ERR_FAIL_COND_V(!(get_script_instance() && get_script_instance()->has_method("_get_save_extension")), "");
+ return get_script_instance()->call("_get_save_extension");
}
String EditorImportPlugin::get_resource_type() const {
- ERR_FAIL_COND_V(!(get_script_instance() && get_script_instance()->has_method("get_resource_type")), "");
- return get_script_instance()->call("get_resource_type");
+ ERR_FAIL_COND_V(!(get_script_instance() && get_script_instance()->has_method("_get_resource_type")), "");
+ return get_script_instance()->call("_get_resource_type");
}
float EditorImportPlugin::get_priority() const {
- if (!(get_script_instance() && get_script_instance()->has_method("get_priority"))) {
+ if (!(get_script_instance() && get_script_instance()->has_method("_get_priority"))) {
return ResourceImporter::get_priority();
}
- return get_script_instance()->call("get_priority");
+ return get_script_instance()->call("_get_priority");
}
int EditorImportPlugin::get_import_order() const {
- if (!(get_script_instance() && get_script_instance()->has_method("get_import_order"))) {
+ if (!(get_script_instance() && get_script_instance()->has_method("_get_import_order"))) {
return ResourceImporter::get_import_order();
}
- return get_script_instance()->call("get_import_order");
+ return get_script_instance()->call("_get_import_order");
}
void EditorImportPlugin::get_import_options(List<ResourceImporter::ImportOption> *r_options, int p_preset) const {
- ERR_FAIL_COND(!(get_script_instance() && get_script_instance()->has_method("get_import_options")));
+ ERR_FAIL_COND(!(get_script_instance() && get_script_instance()->has_method("_get_import_options")));
Array needed;
needed.push_back("name");
needed.push_back("default_value");
- Array options = get_script_instance()->call("get_import_options", p_preset);
+ Array options = get_script_instance()->call("_get_import_options", p_preset);
for (int i = 0; i < options.size(); i++) {
Dictionary d = options[i];
ERR_FAIL_COND(!d.has_all(needed));
@@ -119,18 +119,18 @@ void EditorImportPlugin::get_import_options(List<ResourceImporter::ImportOption>
}
bool EditorImportPlugin::get_option_visibility(const String &p_option, const Map<StringName, Variant> &p_options) const {
- ERR_FAIL_COND_V(!(get_script_instance() && get_script_instance()->has_method("get_option_visibility")), true);
+ ERR_FAIL_COND_V(!(get_script_instance() && get_script_instance()->has_method("_get_option_visibility")), true);
Dictionary d;
Map<StringName, Variant>::Element *E = p_options.front();
while (E) {
d[E->key()] = E->get();
E = E->next();
}
- return get_script_instance()->call("get_option_visibility", p_option, d);
+ return get_script_instance()->call("_get_option_visibility", p_option, d);
}
Error EditorImportPlugin::import(const String &p_source_file, const String &p_save_path, const Map<StringName, Variant> &p_options, List<String> *r_platform_variants, List<String> *r_gen_files, Variant *r_metadata) {
- ERR_FAIL_COND_V(!(get_script_instance() && get_script_instance()->has_method("import")), ERR_UNAVAILABLE);
+ ERR_FAIL_COND_V(!(get_script_instance() && get_script_instance()->has_method("_import")), ERR_UNAVAILABLE);
Dictionary options;
Array platform_variants, gen_files;
@@ -139,7 +139,7 @@ Error EditorImportPlugin::import(const String &p_source_file, const String &p_sa
options[E->key()] = E->get();
E = E->next();
}
- Error err = (Error)get_script_instance()->call("import", p_source_file, p_save_path, options, platform_variants, gen_files).operator int64_t();
+ Error err = (Error)get_script_instance()->call("_import", p_source_file, p_save_path, options, platform_variants, gen_files).operator int64_t();
for (int i = 0; i < platform_variants.size(); i++) {
r_platform_variants->push_back(platform_variants[i]);
@@ -151,16 +151,16 @@ Error EditorImportPlugin::import(const String &p_source_file, const String &p_sa
}
void EditorImportPlugin::_bind_methods() {
- ClassDB::add_virtual_method(get_class_static(), MethodInfo(Variant::STRING, "get_importer_name"));
- ClassDB::add_virtual_method(get_class_static(), MethodInfo(Variant::STRING, "get_visible_name"));
- ClassDB::add_virtual_method(get_class_static(), MethodInfo(Variant::INT, "get_preset_count"));
- ClassDB::add_virtual_method(get_class_static(), MethodInfo(Variant::STRING, "get_preset_name", PropertyInfo(Variant::INT, "preset")));
- ClassDB::add_virtual_method(get_class_static(), MethodInfo(Variant::ARRAY, "get_recognized_extensions"));
- ClassDB::add_virtual_method(get_class_static(), MethodInfo(Variant::ARRAY, "get_import_options", PropertyInfo(Variant::INT, "preset")));
- ClassDB::add_virtual_method(get_class_static(), MethodInfo(Variant::STRING, "get_save_extension"));
- ClassDB::add_virtual_method(get_class_static(), MethodInfo(Variant::STRING, "get_resource_type"));
- ClassDB::add_virtual_method(get_class_static(), MethodInfo(Variant::FLOAT, "get_priority"));
- ClassDB::add_virtual_method(get_class_static(), MethodInfo(Variant::INT, "get_import_order"));
- ClassDB::add_virtual_method(get_class_static(), MethodInfo(Variant::BOOL, "get_option_visibility", PropertyInfo(Variant::STRING, "option"), PropertyInfo(Variant::DICTIONARY, "options")));
- ClassDB::add_virtual_method(get_class_static(), MethodInfo(Variant::INT, "import", PropertyInfo(Variant::STRING, "source_file"), PropertyInfo(Variant::STRING, "save_path"), PropertyInfo(Variant::DICTIONARY, "options"), PropertyInfo(Variant::ARRAY, "platform_variants"), PropertyInfo(Variant::ARRAY, "gen_files")));
+ BIND_VMETHOD(MethodInfo(Variant::STRING, "_get_importer_name"));
+ BIND_VMETHOD(MethodInfo(Variant::STRING, "_get_visible_name"));
+ BIND_VMETHOD(MethodInfo(Variant::INT, "_get_preset_count"));
+ BIND_VMETHOD(MethodInfo(Variant::STRING, "_get_preset_name", PropertyInfo(Variant::INT, "preset")));
+ BIND_VMETHOD(MethodInfo(Variant::ARRAY, "_get_recognized_extensions"));
+ BIND_VMETHOD(MethodInfo(Variant::ARRAY, "_get_import_options", PropertyInfo(Variant::INT, "preset")));
+ BIND_VMETHOD(MethodInfo(Variant::STRING, "_get_save_extension"));
+ BIND_VMETHOD(MethodInfo(Variant::STRING, "_get_resource_type"));
+ BIND_VMETHOD(MethodInfo(Variant::FLOAT, "_get_priority"));
+ BIND_VMETHOD(MethodInfo(Variant::INT, "_get_import_order"));
+ BIND_VMETHOD(MethodInfo(Variant::BOOL, "_get_option_visibility", PropertyInfo(Variant::STRING, "option"), PropertyInfo(Variant::DICTIONARY, "options")));
+ BIND_VMETHOD(MethodInfo(Variant::INT, "_import", PropertyInfo(Variant::STRING, "source_file"), PropertyInfo(Variant::STRING, "save_path"), PropertyInfo(Variant::DICTIONARY, "options"), PropertyInfo(Variant::ARRAY, "platform_variants"), PropertyInfo(Variant::ARRAY, "gen_files")));
}
diff --git a/editor/import/resource_importer_csv_translation.cpp b/editor/import/resource_importer_csv_translation.cpp
index 4a4d9d8f06..c9e446a1a2 100644
--- a/editor/import/resource_importer_csv_translation.cpp
+++ b/editor/import/resource_importer_csv_translation.cpp
@@ -30,8 +30,8 @@
#include "resource_importer_csv_translation.h"
+#include "core/io/file_access.h"
#include "core/io/resource_saver.h"
-#include "core/os/file_access.h"
#include "core/string/optimized_translation.h"
#include "core/string/translation.h"
diff --git a/editor/import/resource_importer_image.cpp b/editor/import/resource_importer_image.cpp
index c5b2a8dc3a..2dea359188 100644
--- a/editor/import/resource_importer_image.cpp
+++ b/editor/import/resource_importer_image.cpp
@@ -30,9 +30,9 @@
#include "resource_importer_image.h"
+#include "core/io/file_access.h"
#include "core/io/image_loader.h"
#include "core/io/resource_saver.h"
-#include "core/os/file_access.h"
#include "scene/resources/texture.h"
String ResourceImporterImage::get_importer_name() const {
diff --git a/editor/import/resource_importer_obj.cpp b/editor/import/resource_importer_obj.cpp
index dd62c72d8a..3aa17ee581 100644
--- a/editor/import/resource_importer_obj.cpp
+++ b/editor/import/resource_importer_obj.cpp
@@ -30,8 +30,8 @@
#include "resource_importer_obj.h"
+#include "core/io/file_access.h"
#include "core/io/resource_saver.h"
-#include "core/os/file_access.h"
#include "editor/import/scene_importer_mesh.h"
#include "editor/import/scene_importer_mesh_node_3d.h"
#include "scene/3d/mesh_instance_3d.h"
@@ -126,7 +126,7 @@ static Error _parse_material_library(const String &p_path, Map<String, Ref<Stand
String p = l.replace("map_Kd", "").replace("\\", "/").strip_edges();
String path;
- if (p.is_abs_path()) {
+ if (p.is_absolute_path()) {
path = p;
} else {
path = base_path.plus_file(p);
@@ -146,7 +146,7 @@ static Error _parse_material_library(const String &p_path, Map<String, Ref<Stand
String p = l.replace("map_Ks", "").replace("\\", "/").strip_edges();
String path;
- if (p.is_abs_path()) {
+ if (p.is_absolute_path()) {
path = p;
} else {
path = base_path.plus_file(p);
@@ -166,7 +166,7 @@ static Error _parse_material_library(const String &p_path, Map<String, Ref<Stand
String p = l.replace("map_Ns", "").replace("\\", "/").strip_edges();
String path;
- if (p.is_abs_path()) {
+ if (p.is_absolute_path()) {
path = p;
} else {
path = base_path.plus_file(p);
diff --git a/editor/import/resource_importer_scene.cpp b/editor/import/resource_importer_scene.cpp
index b589a6aaa0..08aa2fecbb 100644
--- a/editor/import/resource_importer_scene.cpp
+++ b/editor/import/resource_importer_scene.cpp
@@ -120,13 +120,13 @@ void EditorSceneImporter::_bind_methods() {
/////////////////////////////////
void EditorScenePostImport::_bind_methods() {
- BIND_VMETHOD(MethodInfo(Variant::OBJECT, "post_import", PropertyInfo(Variant::OBJECT, "scene")));
+ BIND_VMETHOD(MethodInfo(Variant::OBJECT, "_post_import", PropertyInfo(Variant::OBJECT, "scene")));
ClassDB::bind_method(D_METHOD("get_source_file"), &EditorScenePostImport::get_source_file);
}
Node *EditorScenePostImport::post_import(Node *p_scene) {
if (get_script_instance()) {
- return get_script_instance()->call("post_import", p_scene);
+ return get_script_instance()->call("_post_import", p_scene);
}
return p_scene;
@@ -1213,7 +1213,7 @@ void ResourceImporterScene::_generate_meshes(Node *p_node, const Dictionary &p_m
Node3D *n = src_mesh_node;
while (n) {
xf = n->get_transform() * xf;
- n = n->get_parent_spatial();
+ n = n->get_parent_node_3d();
}
Vector<uint8_t> lightmap_cache;
@@ -1508,7 +1508,7 @@ Error ResourceImporterScene::import(const String &p_source_file, const String &p
if (!scene) {
EditorNode::add_io_error(
TTR("Error running post-import script:") + " " + post_import_script_path + "\n" +
- TTR("Did you return a Node-derived object in the `post_import()` method?"));
+ TTR("Did you return a Node-derived object in the `_post_import()` method?"));
return err;
}
}
diff --git a/editor/import/resource_importer_scene.h b/editor/import/resource_importer_scene.h
index 8cb84abce2..c6e5836a23 100644
--- a/editor/import/resource_importer_scene.h
+++ b/editor/import/resource_importer_scene.h
@@ -42,8 +42,8 @@ class Material;
class AnimationPlayer;
class EditorSceneImporterMesh;
-class EditorSceneImporter : public Reference {
- GDCLASS(EditorSceneImporter, Reference);
+class EditorSceneImporter : public RefCounted {
+ GDCLASS(EditorSceneImporter, RefCounted);
protected:
static void _bind_methods();
@@ -69,8 +69,8 @@ public:
EditorSceneImporter() {}
};
-class EditorScenePostImport : public Reference {
- GDCLASS(EditorScenePostImport, Reference);
+class EditorScenePostImport : public RefCounted {
+ GDCLASS(EditorScenePostImport, RefCounted);
String source_file;
diff --git a/editor/import/resource_importer_shader_file.cpp b/editor/import/resource_importer_shader_file.cpp
index f4d20a6296..70119bfd1c 100644
--- a/editor/import/resource_importer_shader_file.cpp
+++ b/editor/import/resource_importer_shader_file.cpp
@@ -30,9 +30,9 @@
#include "resource_importer_shader_file.h"
+#include "core/io/file_access.h"
#include "core/io/marshalls.h"
#include "core/io/resource_saver.h"
-#include "core/os/file_access.h"
#include "editor/editor_node.h"
#include "editor/plugins/shader_file_editor_plugin.h"
#include "servers/rendering/rendering_device_binds.h"
diff --git a/editor/import/resource_importer_texture.cpp b/editor/import/resource_importer_texture.cpp
index 74b30f4e3e..809f47bad9 100644
--- a/editor/import/resource_importer_texture.cpp
+++ b/editor/import/resource_importer_texture.cpp
@@ -218,14 +218,21 @@ void ResourceImporterTexture::get_import_options(List<ImportOption> *r_options,
void ResourceImporterTexture::save_to_stex_format(FileAccess *f, const Ref<Image> &p_image, CompressMode p_compress_mode, Image::UsedChannels p_channels, Image::CompressMode p_compress_format, float p_lossy_quality) {
switch (p_compress_mode) {
case COMPRESS_LOSSLESS: {
- f->store_32(StreamTexture2D::DATA_FORMAT_LOSSLESS);
+ bool lossless_force_png = ProjectSettings::get_singleton()->get("rendering/textures/lossless_compression/force_png");
+ bool use_webp = !lossless_force_png && p_image->get_width() <= 16383 && p_image->get_height() <= 16383; // WebP has a size limit
+ f->store_32(use_webp ? StreamTexture2D::DATA_FORMAT_WEBP : StreamTexture2D::DATA_FORMAT_PNG);
f->store_16(p_image->get_width());
f->store_16(p_image->get_height());
f->store_32(p_image->get_mipmap_count());
f->store_32(p_image->get_format());
for (int i = 0; i < p_image->get_mipmap_count() + 1; i++) {
- Vector<uint8_t> data = Image::lossless_packer(p_image->get_image_from_mipmap(i));
+ Vector<uint8_t> data;
+ if (use_webp) {
+ data = Image::webp_lossless_packer(p_image->get_image_from_mipmap(i));
+ } else {
+ data = Image::png_packer(p_image->get_image_from_mipmap(i));
+ }
int data_len = data.size();
f->store_32(data_len);
@@ -235,14 +242,14 @@ void ResourceImporterTexture::save_to_stex_format(FileAccess *f, const Ref<Image
} break;
case COMPRESS_LOSSY: {
- f->store_32(StreamTexture2D::DATA_FORMAT_LOSSY);
+ f->store_32(StreamTexture2D::DATA_FORMAT_WEBP);
f->store_16(p_image->get_width());
f->store_16(p_image->get_height());
f->store_32(p_image->get_mipmap_count());
f->store_32(p_image->get_format());
for (int i = 0; i < p_image->get_mipmap_count() + 1; i++) {
- Vector<uint8_t> data = Image::lossy_packer(p_image->get_image_from_mipmap(i), p_lossy_quality);
+ Vector<uint8_t> data = Image::webp_lossy_packer(p_image->get_image_from_mipmap(i), p_lossy_quality);
int data_len = data.size();
f->store_32(data_len);
diff --git a/editor/import/resource_importer_texture.h b/editor/import/resource_importer_texture.h
index 0d551a965c..41220009cd 100644
--- a/editor/import/resource_importer_texture.h
+++ b/editor/import/resource_importer_texture.h
@@ -31,9 +31,9 @@
#ifndef RESOURCEIMPORTTEXTURE_H
#define RESOURCEIMPORTTEXTURE_H
+#include "core/io/file_access.h"
#include "core/io/image.h"
#include "core/io/resource_importer.h"
-#include "core/os/file_access.h"
#include "scene/resources/texture.h"
#include "servers/rendering_server.h"
diff --git a/editor/import/resource_importer_texture_atlas.cpp b/editor/import/resource_importer_texture_atlas.cpp
index 4c3ae59951..d5d1a14be3 100644
--- a/editor/import/resource_importer_texture_atlas.cpp
+++ b/editor/import/resource_importer_texture_atlas.cpp
@@ -31,10 +31,10 @@
#include "resource_importer_texture_atlas.h"
#include "atlas_import_failed.xpm"
+#include "core/io/file_access.h"
#include "core/io/image_loader.h"
#include "core/io/resource_saver.h"
#include "core/math/geometry_2d.h"
-#include "core/os/file_access.h"
#include "editor/editor_atlas_packer.h"
#include "scene/resources/mesh.h"
#include "scene/resources/texture.h"
diff --git a/editor/import/resource_importer_wav.cpp b/editor/import/resource_importer_wav.cpp
index bcc55b330b..e615212569 100644
--- a/editor/import/resource_importer_wav.cpp
+++ b/editor/import/resource_importer_wav.cpp
@@ -30,9 +30,9 @@
#include "resource_importer_wav.h"
+#include "core/io/file_access.h"
#include "core/io/marshalls.h"
#include "core/io/resource_saver.h"
-#include "core/os/file_access.h"
#include "scene/resources/audio_stream_sample.h"
const float TRIM_DB_LIMIT = -50;
diff --git a/editor/multi_node_edit.h b/editor/multi_node_edit.h
index 0544eb2d50..2efecb9f65 100644
--- a/editor/multi_node_edit.h
+++ b/editor/multi_node_edit.h
@@ -33,8 +33,8 @@
#include "scene/main/node.h"
-class MultiNodeEdit : public Reference {
- GDCLASS(MultiNodeEdit, Reference);
+class MultiNodeEdit : public RefCounted {
+ GDCLASS(MultiNodeEdit, RefCounted);
List<NodePath> nodes;
struct PLData {
diff --git a/editor/node_3d_editor_gizmos.cpp b/editor/node_3d_editor_gizmos.cpp
index 9323c31fae..5c69a1e975 100644
--- a/editor/node_3d_editor_gizmos.cpp
+++ b/editor/node_3d_editor_gizmos.cpp
@@ -104,8 +104,8 @@ void EditorNode3DGizmo::clear() {
}
void EditorNode3DGizmo::redraw() {
- if (get_script_instance() && get_script_instance()->has_method("redraw")) {
- get_script_instance()->call("redraw");
+ if (get_script_instance() && get_script_instance()->has_method("_redraw")) {
+ get_script_instance()->call("_redraw");
return;
}
@@ -114,8 +114,8 @@ void EditorNode3DGizmo::redraw() {
}
String EditorNode3DGizmo::get_handle_name(int p_idx) const {
- if (get_script_instance() && get_script_instance()->has_method("get_handle_name")) {
- return get_script_instance()->call("get_handle_name", p_idx);
+ if (get_script_instance() && get_script_instance()->has_method("_get_handle_name")) {
+ return get_script_instance()->call("_get_handle_name", p_idx);
}
ERR_FAIL_COND_V(!gizmo_plugin, "");
@@ -123,8 +123,8 @@ String EditorNode3DGizmo::get_handle_name(int p_idx) const {
}
bool EditorNode3DGizmo::is_handle_highlighted(int p_idx) const {
- if (get_script_instance() && get_script_instance()->has_method("is_handle_highlighted")) {
- return get_script_instance()->call("is_handle_highlighted", p_idx);
+ if (get_script_instance() && get_script_instance()->has_method("_is_handle_highlighted")) {
+ return get_script_instance()->call("_is_handle_highlighted", p_idx);
}
ERR_FAIL_COND_V(!gizmo_plugin, false);
@@ -132,8 +132,8 @@ bool EditorNode3DGizmo::is_handle_highlighted(int p_idx) const {
}
Variant EditorNode3DGizmo::get_handle_value(int p_idx) {
- if (get_script_instance() && get_script_instance()->has_method("get_handle_value")) {
- return get_script_instance()->call("get_handle_value", p_idx);
+ if (get_script_instance() && get_script_instance()->has_method("_get_handle_value")) {
+ return get_script_instance()->call("_get_handle_value", p_idx);
}
ERR_FAIL_COND_V(!gizmo_plugin, Variant());
@@ -141,8 +141,8 @@ Variant EditorNode3DGizmo::get_handle_value(int p_idx) {
}
void EditorNode3DGizmo::set_handle(int p_idx, Camera3D *p_camera, const Point2 &p_point) {
- if (get_script_instance() && get_script_instance()->has_method("set_handle")) {
- get_script_instance()->call("set_handle", p_idx, p_camera, p_point);
+ if (get_script_instance() && get_script_instance()->has_method("_set_handle")) {
+ get_script_instance()->call("_set_handle", p_idx, p_camera, p_point);
return;
}
@@ -151,8 +151,8 @@ void EditorNode3DGizmo::set_handle(int p_idx, Camera3D *p_camera, const Point2 &
}
void EditorNode3DGizmo::commit_handle(int p_idx, const Variant &p_restore, bool p_cancel) {
- if (get_script_instance() && get_script_instance()->has_method("commit_handle")) {
- get_script_instance()->call("commit_handle", p_idx, p_restore, p_cancel);
+ if (get_script_instance() && get_script_instance()->has_method("_commit_handle")) {
+ get_script_instance()->call("_commit_handle", p_idx, p_restore, p_cancel);
return;
}
@@ -739,16 +739,16 @@ void EditorNode3DGizmo::_bind_methods() {
ClassDB::bind_method(D_METHOD("clear"), &EditorNode3DGizmo::clear);
ClassDB::bind_method(D_METHOD("set_hidden", "hidden"), &EditorNode3DGizmo::set_hidden);
- BIND_VMETHOD(MethodInfo("redraw"));
- BIND_VMETHOD(MethodInfo(Variant::STRING, "get_handle_name", PropertyInfo(Variant::INT, "index")));
- BIND_VMETHOD(MethodInfo(Variant::BOOL, "is_handle_highlighted", PropertyInfo(Variant::INT, "index")));
+ BIND_VMETHOD(MethodInfo("_redraw"));
+ BIND_VMETHOD(MethodInfo(Variant::STRING, "_get_handle_name", PropertyInfo(Variant::INT, "index")));
+ BIND_VMETHOD(MethodInfo(Variant::BOOL, "_is_handle_highlighted", PropertyInfo(Variant::INT, "index")));
- MethodInfo hvget(Variant::NIL, "get_handle_value", PropertyInfo(Variant::INT, "index"));
+ MethodInfo hvget(Variant::NIL, "_get_handle_value", PropertyInfo(Variant::INT, "index"));
hvget.return_val.usage |= PROPERTY_USAGE_NIL_IS_VARIANT;
BIND_VMETHOD(hvget);
- BIND_VMETHOD(MethodInfo("set_handle", PropertyInfo(Variant::INT, "index"), PropertyInfo(Variant::OBJECT, "camera", PROPERTY_HINT_RESOURCE_TYPE, "Camera3D"), PropertyInfo(Variant::VECTOR2, "point")));
- MethodInfo cm = MethodInfo("commit_handle", PropertyInfo(Variant::INT, "index"), PropertyInfo(Variant::NIL, "restore"), PropertyInfo(Variant::BOOL, "cancel"));
+ BIND_VMETHOD(MethodInfo("_set_handle", PropertyInfo(Variant::INT, "index"), PropertyInfo(Variant::OBJECT, "camera", PROPERTY_HINT_RESOURCE_TYPE, "Camera3D"), PropertyInfo(Variant::VECTOR2, "point")));
+ MethodInfo cm = MethodInfo("_commit_handle", PropertyInfo(Variant::INT, "index"), PropertyInfo(Variant::NIL, "restore"), PropertyInfo(Variant::BOOL, "cancel"));
cm.default_arguments.push_back(false);
BIND_VMETHOD(cm);
}
diff --git a/editor/plugin_config_dialog.cpp b/editor/plugin_config_dialog.cpp
index 7dda61f0bf..f55d77d782 100644
--- a/editor/plugin_config_dialog.cpp
+++ b/editor/plugin_config_dialog.cpp
@@ -30,7 +30,7 @@
#include "plugin_config_dialog.h"
#include "core/io/config_file.h"
-#include "core/os/dir_access.h"
+#include "core/io/dir_access.h"
#include "editor/editor_node.h"
#include "editor/editor_plugin.h"
#include "editor/editor_scale.h"
diff --git a/editor/plugins/collision_polygon_3d_editor_plugin.cpp b/editor/plugins/collision_polygon_3d_editor_plugin.cpp
index 6e71133c4f..a0df7e289e 100644
--- a/editor/plugins/collision_polygon_3d_editor_plugin.cpp
+++ b/editor/plugins/collision_polygon_3d_editor_plugin.cpp
@@ -32,8 +32,8 @@
#include "canvas_item_editor_plugin.h"
#include "core/input/input.h"
+#include "core/io/file_access.h"
#include "core/math/geometry_2d.h"
-#include "core/os/file_access.h"
#include "core/os/keyboard.h"
#include "editor/editor_settings.h"
#include "node_3d_editor_plugin.h"
diff --git a/editor/plugins/node_3d_editor_plugin.cpp b/editor/plugins/node_3d_editor_plugin.cpp
index 6ab15f763f..46c35291ac 100644
--- a/editor/plugins/node_3d_editor_plugin.cpp
+++ b/editor/plugins/node_3d_editor_plugin.cpp
@@ -3551,8 +3551,8 @@ Dictionary Node3DEditorViewport::get_state() const {
void Node3DEditorViewport::_bind_methods() {
ClassDB::bind_method(D_METHOD("update_transform_gizmo_view"), &Node3DEditorViewport::update_transform_gizmo_view); // Used by call_deferred.
- ClassDB::bind_method(D_METHOD("can_drop_data_fw"), &Node3DEditorViewport::can_drop_data_fw);
- ClassDB::bind_method(D_METHOD("drop_data_fw"), &Node3DEditorViewport::drop_data_fw);
+ ClassDB::bind_method(D_METHOD("_can_drop_data_fw"), &Node3DEditorViewport::can_drop_data_fw);
+ ClassDB::bind_method(D_METHOD("_drop_data_fw"), &Node3DEditorViewport::drop_data_fw);
ADD_SIGNAL(MethodInfo("toggle_maximize_view", PropertyInfo(Variant::OBJECT, "viewport")));
ADD_SIGNAL(MethodInfo("clicked", PropertyInfo(Variant::OBJECT, "viewport")));
@@ -5056,11 +5056,11 @@ void Node3DEditor::_update_camera_override_button(bool p_game_running) {
if (p_game_running) {
button->set_disabled(false);
- button->set_tooltip(TTR("Game Camera Override\nNo game instance running."));
+ button->set_tooltip(TTR("Project Camera Override\nOverrides the running project's camera with the editor viewport camera."));
} else {
button->set_disabled(true);
button->set_pressed(false);
- button->set_tooltip(TTR("Game Camera Override\nOverrides game camera with editor viewport camera."));
+ button->set_tooltip(TTR("Project Camera Override\nNo project instance running. Run the project from the editor to use this feature."));
}
}
@@ -7475,15 +7475,15 @@ Ref<StandardMaterial3D> EditorNode3DGizmoPlugin::get_material(const String &p_na
}
String EditorNode3DGizmoPlugin::get_gizmo_name() const {
- if (get_script_instance() && get_script_instance()->has_method("get_gizmo_name")) {
- return get_script_instance()->call("get_gizmo_name");
+ if (get_script_instance() && get_script_instance()->has_method("_get_gizmo_name")) {
+ return get_script_instance()->call("_get_gizmo_name");
}
return TTR("Nameless gizmo");
}
int EditorNode3DGizmoPlugin::get_priority() const {
- if (get_script_instance() && get_script_instance()->has_method("get_priority")) {
- return get_script_instance()->call("get_priority");
+ if (get_script_instance() && get_script_instance()->has_method("_get_priority")) {
+ return get_script_instance()->call("_get_priority");
}
return 0;
}
@@ -7510,8 +7510,8 @@ Ref<EditorNode3DGizmo> EditorNode3DGizmoPlugin::get_gizmo(Node3D *p_spatial) {
void EditorNode3DGizmoPlugin::_bind_methods() {
#define GIZMO_REF PropertyInfo(Variant::OBJECT, "gizmo", PROPERTY_HINT_RESOURCE_TYPE, "EditorNode3DGizmo")
- BIND_VMETHOD(MethodInfo(Variant::BOOL, "has_gizmo", PropertyInfo(Variant::OBJECT, "spatial", PROPERTY_HINT_RESOURCE_TYPE, "Node3D")));
- BIND_VMETHOD(MethodInfo(GIZMO_REF, "create_gizmo", PropertyInfo(Variant::OBJECT, "spatial", PROPERTY_HINT_RESOURCE_TYPE, "Node3D")));
+ BIND_VMETHOD(MethodInfo(Variant::BOOL, "_has_gizmo", PropertyInfo(Variant::OBJECT, "spatial", PROPERTY_HINT_RESOURCE_TYPE, "Node3D")));
+ BIND_VMETHOD(MethodInfo(GIZMO_REF, "_create_gizmo", PropertyInfo(Variant::OBJECT, "spatial", PROPERTY_HINT_RESOURCE_TYPE, "Node3D")));
ClassDB::bind_method(D_METHOD("create_material", "name", "color", "billboard", "on_top", "use_vertex_color"), &EditorNode3DGizmoPlugin::create_material, DEFVAL(false), DEFVAL(false), DEFVAL(false));
ClassDB::bind_method(D_METHOD("create_icon_material", "name", "texture", "on_top", "color"), &EditorNode3DGizmoPlugin::create_icon_material, DEFVAL(false), DEFVAL(Color(1, 1, 1, 1)));
@@ -7520,38 +7520,38 @@ void EditorNode3DGizmoPlugin::_bind_methods() {
ClassDB::bind_method(D_METHOD("get_material", "name", "gizmo"), &EditorNode3DGizmoPlugin::get_material, DEFVAL(Ref<EditorNode3DGizmo>()));
- BIND_VMETHOD(MethodInfo(Variant::STRING, "get_gizmo_name"));
- BIND_VMETHOD(MethodInfo(Variant::INT, "get_priority"));
- BIND_VMETHOD(MethodInfo(Variant::BOOL, "can_be_hidden"));
- BIND_VMETHOD(MethodInfo(Variant::BOOL, "is_selectable_when_hidden"));
+ BIND_VMETHOD(MethodInfo(Variant::STRING, "_get_gizmo_name"));
+ BIND_VMETHOD(MethodInfo(Variant::INT, "_get_priority"));
+ BIND_VMETHOD(MethodInfo(Variant::BOOL, "_can_be_hidden"));
+ BIND_VMETHOD(MethodInfo(Variant::BOOL, "_is_selectable_when_hidden"));
- BIND_VMETHOD(MethodInfo("redraw", GIZMO_REF));
- BIND_VMETHOD(MethodInfo(Variant::STRING, "get_handle_name", GIZMO_REF, PropertyInfo(Variant::INT, "index")));
+ BIND_VMETHOD(MethodInfo("_redraw", GIZMO_REF));
+ BIND_VMETHOD(MethodInfo(Variant::STRING, "_get_handle_name", GIZMO_REF, PropertyInfo(Variant::INT, "index")));
- MethodInfo hvget(Variant::NIL, "get_handle_value", GIZMO_REF, PropertyInfo(Variant::INT, "index"));
+ MethodInfo hvget(Variant::NIL, "_get_handle_value", GIZMO_REF, PropertyInfo(Variant::INT, "index"));
hvget.return_val.usage |= PROPERTY_USAGE_NIL_IS_VARIANT;
BIND_VMETHOD(hvget);
- BIND_VMETHOD(MethodInfo("set_handle", GIZMO_REF, PropertyInfo(Variant::INT, "index"), PropertyInfo(Variant::OBJECT, "camera", PROPERTY_HINT_RESOURCE_TYPE, "Camera3D"), PropertyInfo(Variant::VECTOR2, "point")));
- MethodInfo cm = MethodInfo("commit_handle", GIZMO_REF, PropertyInfo(Variant::INT, "index"), PropertyInfo(Variant::NIL, "restore"), PropertyInfo(Variant::BOOL, "cancel"));
+ BIND_VMETHOD(MethodInfo("_set_handle", GIZMO_REF, PropertyInfo(Variant::INT, "index"), PropertyInfo(Variant::OBJECT, "camera", PROPERTY_HINT_RESOURCE_TYPE, "Camera3D"), PropertyInfo(Variant::VECTOR2, "point")));
+ MethodInfo cm = MethodInfo("_commit_handle", GIZMO_REF, PropertyInfo(Variant::INT, "index"), PropertyInfo(Variant::NIL, "restore"), PropertyInfo(Variant::BOOL, "cancel"));
cm.default_arguments.push_back(false);
BIND_VMETHOD(cm);
- BIND_VMETHOD(MethodInfo(Variant::BOOL, "is_handle_highlighted", GIZMO_REF, PropertyInfo(Variant::INT, "index")));
+ BIND_VMETHOD(MethodInfo(Variant::BOOL, "_is_handle_highlighted", GIZMO_REF, PropertyInfo(Variant::INT, "index")));
#undef GIZMO_REF
}
bool EditorNode3DGizmoPlugin::has_gizmo(Node3D *p_spatial) {
- if (get_script_instance() && get_script_instance()->has_method("has_gizmo")) {
- return get_script_instance()->call("has_gizmo", p_spatial);
+ if (get_script_instance() && get_script_instance()->has_method("_has_gizmo")) {
+ return get_script_instance()->call("_has_gizmo", p_spatial);
}
return false;
}
Ref<EditorNode3DGizmo> EditorNode3DGizmoPlugin::create_gizmo(Node3D *p_spatial) {
- if (get_script_instance() && get_script_instance()->has_method("create_gizmo")) {
- return get_script_instance()->call("create_gizmo", p_spatial);
+ if (get_script_instance() && get_script_instance()->has_method("_create_gizmo")) {
+ return get_script_instance()->call("_create_gizmo", p_spatial);
}
Ref<EditorNode3DGizmo> ref;
@@ -7562,55 +7562,55 @@ Ref<EditorNode3DGizmo> EditorNode3DGizmoPlugin::create_gizmo(Node3D *p_spatial)
}
bool EditorNode3DGizmoPlugin::can_be_hidden() const {
- if (get_script_instance() && get_script_instance()->has_method("can_be_hidden")) {
- return get_script_instance()->call("can_be_hidden");
+ if (get_script_instance() && get_script_instance()->has_method("_can_be_hidden")) {
+ return get_script_instance()->call("_can_be_hidden");
}
return true;
}
bool EditorNode3DGizmoPlugin::is_selectable_when_hidden() const {
- if (get_script_instance() && get_script_instance()->has_method("is_selectable_when_hidden")) {
- return get_script_instance()->call("is_selectable_when_hidden");
+ if (get_script_instance() && get_script_instance()->has_method("_is_selectable_when_hidden")) {
+ return get_script_instance()->call("_is_selectable_when_hidden");
}
return false;
}
void EditorNode3DGizmoPlugin::redraw(EditorNode3DGizmo *p_gizmo) {
- if (get_script_instance() && get_script_instance()->has_method("redraw")) {
+ if (get_script_instance() && get_script_instance()->has_method("_redraw")) {
Ref<EditorNode3DGizmo> ref(p_gizmo);
- get_script_instance()->call("redraw", ref);
+ get_script_instance()->call("_redraw", ref);
}
}
String EditorNode3DGizmoPlugin::get_handle_name(const EditorNode3DGizmo *p_gizmo, int p_idx) const {
- if (get_script_instance() && get_script_instance()->has_method("get_handle_name")) {
- return get_script_instance()->call("get_handle_name", p_gizmo, p_idx);
+ if (get_script_instance() && get_script_instance()->has_method("_get_handle_name")) {
+ return get_script_instance()->call("_get_handle_name", p_gizmo, p_idx);
}
return "";
}
Variant EditorNode3DGizmoPlugin::get_handle_value(EditorNode3DGizmo *p_gizmo, int p_idx) const {
- if (get_script_instance() && get_script_instance()->has_method("get_handle_value")) {
- return get_script_instance()->call("get_handle_value", p_gizmo, p_idx);
+ if (get_script_instance() && get_script_instance()->has_method("_get_handle_value")) {
+ return get_script_instance()->call("_get_handle_value", p_gizmo, p_idx);
}
return Variant();
}
void EditorNode3DGizmoPlugin::set_handle(EditorNode3DGizmo *p_gizmo, int p_idx, Camera3D *p_camera, const Point2 &p_point) {
- if (get_script_instance() && get_script_instance()->has_method("set_handle")) {
- get_script_instance()->call("set_handle", p_gizmo, p_idx, p_camera, p_point);
+ if (get_script_instance() && get_script_instance()->has_method("_set_handle")) {
+ get_script_instance()->call("_set_handle", p_gizmo, p_idx, p_camera, p_point);
}
}
void EditorNode3DGizmoPlugin::commit_handle(EditorNode3DGizmo *p_gizmo, int p_idx, const Variant &p_restore, bool p_cancel) {
- if (get_script_instance() && get_script_instance()->has_method("commit_handle")) {
- get_script_instance()->call("commit_handle", p_gizmo, p_idx, p_restore, p_cancel);
+ if (get_script_instance() && get_script_instance()->has_method("_commit_handle")) {
+ get_script_instance()->call("_commit_handle", p_gizmo, p_idx, p_restore, p_cancel);
}
}
bool EditorNode3DGizmoPlugin::is_handle_highlighted(const EditorNode3DGizmo *p_gizmo, int p_idx) const {
- if (get_script_instance() && get_script_instance()->has_method("is_handle_highlighted")) {
- return get_script_instance()->call("is_handle_highlighted", p_gizmo, p_idx);
+ if (get_script_instance() && get_script_instance()->has_method("_is_handle_highlighted")) {
+ return get_script_instance()->call("_is_handle_highlighted", p_gizmo, p_idx);
}
return false;
}
diff --git a/editor/plugins/path_2d_editor_plugin.cpp b/editor/plugins/path_2d_editor_plugin.cpp
index 208abeb87f..838e67b5e7 100644
--- a/editor/plugins/path_2d_editor_plugin.cpp
+++ b/editor/plugins/path_2d_editor_plugin.cpp
@@ -31,7 +31,7 @@
#include "path_2d_editor_plugin.h"
#include "canvas_item_editor_plugin.h"
-#include "core/os/file_access.h"
+#include "core/io/file_access.h"
#include "core/os/keyboard.h"
#include "editor/editor_scale.h"
#include "editor/editor_settings.h"
diff --git a/editor/plugins/polygon_2d_editor_plugin.cpp b/editor/plugins/polygon_2d_editor_plugin.cpp
index d2ea7a10dc..8a14db0cfd 100644
--- a/editor/plugins/polygon_2d_editor_plugin.cpp
+++ b/editor/plugins/polygon_2d_editor_plugin.cpp
@@ -32,8 +32,8 @@
#include "canvas_item_editor_plugin.h"
#include "core/input/input.h"
+#include "core/io/file_access.h"
#include "core/math/geometry_2d.h"
-#include "core/os/file_access.h"
#include "core/os/keyboard.h"
#include "editor/editor_scale.h"
#include "editor/editor_settings.h"
diff --git a/editor/plugins/resource_preloader_editor_plugin.cpp b/editor/plugins/resource_preloader_editor_plugin.cpp
index b4b8e82124..b8b2c6d343 100644
--- a/editor/plugins/resource_preloader_editor_plugin.cpp
+++ b/editor/plugins/resource_preloader_editor_plugin.cpp
@@ -339,9 +339,9 @@ void ResourcePreloaderEditor::_bind_methods() {
ClassDB::bind_method(D_METHOD("_update_library"), &ResourcePreloaderEditor::_update_library);
ClassDB::bind_method(D_METHOD("_remove_resource", "to_remove"), &ResourcePreloaderEditor::_remove_resource);
- ClassDB::bind_method(D_METHOD("get_drag_data_fw"), &ResourcePreloaderEditor::get_drag_data_fw);
- ClassDB::bind_method(D_METHOD("can_drop_data_fw"), &ResourcePreloaderEditor::can_drop_data_fw);
- ClassDB::bind_method(D_METHOD("drop_data_fw"), &ResourcePreloaderEditor::drop_data_fw);
+ ClassDB::bind_method(D_METHOD("_get_drag_data_fw"), &ResourcePreloaderEditor::get_drag_data_fw);
+ ClassDB::bind_method(D_METHOD("_can_drop_data_fw"), &ResourcePreloaderEditor::can_drop_data_fw);
+ ClassDB::bind_method(D_METHOD("_drop_data_fw"), &ResourcePreloaderEditor::drop_data_fw);
}
ResourcePreloaderEditor::ResourcePreloaderEditor() {
diff --git a/editor/plugins/script_editor_plugin.cpp b/editor/plugins/script_editor_plugin.cpp
index d66217ec2d..0410ab3a45 100644
--- a/editor/plugins/script_editor_plugin.cpp
+++ b/editor/plugins/script_editor_plugin.cpp
@@ -32,8 +32,8 @@
#include "core/config/project_settings.h"
#include "core/input/input.h"
+#include "core/io/file_access.h"
#include "core/io/resource_loader.h"
-#include "core/os/file_access.h"
#include "core/os/keyboard.h"
#include "core/os/os.h"
#include "editor/debugger/editor_debugger_node.h"
@@ -230,7 +230,7 @@ void ScriptEditorBase::_bind_methods() {
ADD_SIGNAL(MethodInfo("search_in_files_requested", PropertyInfo(Variant::STRING, "text")));
ADD_SIGNAL(MethodInfo("replace_in_files_requested", PropertyInfo(Variant::STRING, "text")));
- BIND_VMETHOD(MethodInfo("add_syntax_highlighter", PropertyInfo(Variant::OBJECT, "highlighter")));
+ BIND_VMETHOD(MethodInfo("_add_syntax_highlighter", PropertyInfo(Variant::OBJECT, "highlighter")));
}
static bool _is_built_in_script(Script *p_script) {
@@ -3276,9 +3276,9 @@ void ScriptEditor::_bind_methods() {
ClassDB::bind_method(D_METHOD("register_syntax_highlighter", "syntax_highlighter"), &ScriptEditor::register_syntax_highlighter);
ClassDB::bind_method(D_METHOD("unregister_syntax_highlighter", "syntax_highlighter"), &ScriptEditor::unregister_syntax_highlighter);
- ClassDB::bind_method(D_METHOD("get_drag_data_fw", "point", "from"), &ScriptEditor::get_drag_data_fw);
- ClassDB::bind_method(D_METHOD("can_drop_data_fw", "point", "data", "from"), &ScriptEditor::can_drop_data_fw);
- ClassDB::bind_method(D_METHOD("drop_data_fw", "point", "data", "from"), &ScriptEditor::drop_data_fw);
+ ClassDB::bind_method(D_METHOD("_get_drag_data_fw", "point", "from"), &ScriptEditor::get_drag_data_fw);
+ ClassDB::bind_method(D_METHOD("_can_drop_data_fw", "point", "data", "from"), &ScriptEditor::can_drop_data_fw);
+ ClassDB::bind_method(D_METHOD("_drop_data_fw", "point", "data", "from"), &ScriptEditor::drop_data_fw);
ClassDB::bind_method(D_METHOD("goto_line", "line_number"), &ScriptEditor::_goto_script_line2);
ClassDB::bind_method(D_METHOD("get_current_script"), &ScriptEditor::_get_current_script);
diff --git a/editor/plugins/script_text_editor.cpp b/editor/plugins/script_text_editor.cpp
index 8fa6b66eda..1f6da30547 100644
--- a/editor/plugins/script_text_editor.cpp
+++ b/editor/plugins/script_text_editor.cpp
@@ -1343,9 +1343,9 @@ void ScriptTextEditor::_notification(int p_what) {
void ScriptTextEditor::_bind_methods() {
ClassDB::bind_method("_update_connected_methods", &ScriptTextEditor::_update_connected_methods);
- ClassDB::bind_method("get_drag_data_fw", &ScriptTextEditor::get_drag_data_fw);
- ClassDB::bind_method("can_drop_data_fw", &ScriptTextEditor::can_drop_data_fw);
- ClassDB::bind_method("drop_data_fw", &ScriptTextEditor::drop_data_fw);
+ ClassDB::bind_method("_get_drag_data_fw", &ScriptTextEditor::get_drag_data_fw);
+ ClassDB::bind_method("_can_drop_data_fw", &ScriptTextEditor::can_drop_data_fw);
+ ClassDB::bind_method("_drop_data_fw", &ScriptTextEditor::drop_data_fw);
ClassDB::bind_method(D_METHOD("add_syntax_highlighter", "highlighter"), &ScriptTextEditor::add_syntax_highlighter);
}
diff --git a/editor/plugins/skeleton_3d_editor_plugin.cpp b/editor/plugins/skeleton_3d_editor_plugin.cpp
index 6dc98503ca..a97584ebce 100644
--- a/editor/plugins/skeleton_3d_editor_plugin.cpp
+++ b/editor/plugins/skeleton_3d_editor_plugin.cpp
@@ -666,9 +666,9 @@ void Skeleton3DEditor::_bind_methods() {
ClassDB::bind_method(D_METHOD("_update_properties"), &Skeleton3DEditor::_update_properties);
ClassDB::bind_method(D_METHOD("_on_click_option"), &Skeleton3DEditor::_on_click_option);
- ClassDB::bind_method(D_METHOD("get_drag_data_fw"), &Skeleton3DEditor::get_drag_data_fw);
- ClassDB::bind_method(D_METHOD("can_drop_data_fw"), &Skeleton3DEditor::can_drop_data_fw);
- ClassDB::bind_method(D_METHOD("drop_data_fw"), &Skeleton3DEditor::drop_data_fw);
+ ClassDB::bind_method(D_METHOD("_get_drag_data_fw"), &Skeleton3DEditor::get_drag_data_fw);
+ ClassDB::bind_method(D_METHOD("_can_drop_data_fw"), &Skeleton3DEditor::can_drop_data_fw);
+ ClassDB::bind_method(D_METHOD("_drop_data_fw"), &Skeleton3DEditor::drop_data_fw);
ClassDB::bind_method(D_METHOD("move_skeleton_bone"), &Skeleton3DEditor::move_skeleton_bone);
}
diff --git a/editor/plugins/sprite_frames_editor_plugin.cpp b/editor/plugins/sprite_frames_editor_plugin.cpp
index 59bc8f9e55..a5a3d624ec 100644
--- a/editor/plugins/sprite_frames_editor_plugin.cpp
+++ b/editor/plugins/sprite_frames_editor_plugin.cpp
@@ -964,9 +964,9 @@ void SpriteFramesEditor::drop_data_fw(const Point2 &p_point, const Variant &p_da
void SpriteFramesEditor::_bind_methods() {
ClassDB::bind_method(D_METHOD("_update_library", "skipsel"), &SpriteFramesEditor::_update_library, DEFVAL(false));
- ClassDB::bind_method(D_METHOD("get_drag_data_fw"), &SpriteFramesEditor::get_drag_data_fw);
- ClassDB::bind_method(D_METHOD("can_drop_data_fw"), &SpriteFramesEditor::can_drop_data_fw);
- ClassDB::bind_method(D_METHOD("drop_data_fw"), &SpriteFramesEditor::drop_data_fw);
+ ClassDB::bind_method(D_METHOD("_get_drag_data_fw"), &SpriteFramesEditor::get_drag_data_fw);
+ ClassDB::bind_method(D_METHOD("_can_drop_data_fw"), &SpriteFramesEditor::can_drop_data_fw);
+ ClassDB::bind_method(D_METHOD("_drop_data_fw"), &SpriteFramesEditor::drop_data_fw);
}
SpriteFramesEditor::SpriteFramesEditor() {
diff --git a/editor/plugins/texture_region_editor_plugin.cpp b/editor/plugins/texture_region_editor_plugin.cpp
index 9526160674..686ff0f9ef 100644
--- a/editor/plugins/texture_region_editor_plugin.cpp
+++ b/editor/plugins/texture_region_editor_plugin.cpp
@@ -863,13 +863,13 @@ Sprite2D *TextureRegionEditor::get_sprite() {
void TextureRegionEditor::edit(Object *p_obj) {
if (node_sprite) {
- node_sprite->disconnect("changed", callable_mp(this, &TextureRegionEditor::_texture_changed));
+ node_sprite->disconnect("texture_changed", callable_mp(this, &TextureRegionEditor::_texture_changed));
}
if (node_sprite_3d) {
- node_sprite_3d->disconnect("changed", callable_mp(this, &TextureRegionEditor::_texture_changed));
+ node_sprite_3d->disconnect("texture_changed", callable_mp(this, &TextureRegionEditor::_texture_changed));
}
if (node_ninepatch) {
- node_ninepatch->disconnect("changed", callable_mp(this, &TextureRegionEditor::_texture_changed));
+ node_ninepatch->disconnect("texture_changed", callable_mp(this, &TextureRegionEditor::_texture_changed));
}
if (obj_styleBox.is_valid()) {
obj_styleBox->disconnect("changed", callable_mp(this, &TextureRegionEditor::_texture_changed));
@@ -881,13 +881,22 @@ void TextureRegionEditor::edit(Object *p_obj) {
node_sprite = Object::cast_to<Sprite2D>(p_obj);
node_sprite_3d = Object::cast_to<Sprite3D>(p_obj);
node_ninepatch = Object::cast_to<NinePatchRect>(p_obj);
+
+ bool is_resource = false;
if (Object::cast_to<StyleBoxTexture>(p_obj)) {
obj_styleBox = Ref<StyleBoxTexture>(Object::cast_to<StyleBoxTexture>(p_obj));
+ is_resource = true;
}
if (Object::cast_to<AtlasTexture>(p_obj)) {
atlas_tex = Ref<AtlasTexture>(Object::cast_to<AtlasTexture>(p_obj));
+ is_resource = true;
+ }
+
+ if (is_resource) {
+ p_obj->connect("changed", callable_mp(this, &TextureRegionEditor::_texture_changed));
+ } else {
+ p_obj->connect("texture_changed", callable_mp(this, &TextureRegionEditor::_texture_changed));
}
- p_obj->connect("changed", callable_mp(this, &TextureRegionEditor::_texture_changed));
_edit_region();
} else {
node_sprite = nullptr;
diff --git a/editor/plugins/theme_editor_plugin.cpp b/editor/plugins/theme_editor_plugin.cpp
index f1c73f99dc..6607bf6cad 100644
--- a/editor/plugins/theme_editor_plugin.cpp
+++ b/editor/plugins/theme_editor_plugin.cpp
@@ -30,12 +30,10 @@
#include "theme_editor_plugin.h"
-#include "core/os/file_access.h"
#include "core/os/keyboard.h"
-#include "core/version.h"
+#include "editor/editor_resource_picker.h"
#include "editor/editor_scale.h"
#include "editor/progress_dialog.h"
-#include "scene/gui/progress_bar.h"
void ThemeItemImportTree::_update_items_tree() {
import_items_tree->clear();
@@ -756,7 +754,9 @@ void ThemeItemImportTree::_import_selected() {
return;
}
- ProgressDialog::get_singleton()->add_task("import_theme_items", TTR("Importing Theme Items"), selected_items.size());
+ // Prevent changes from immediatelly being reported while the operation is still ongoing.
+ edited_theme->_freeze_change_propagation();
+ ProgressDialog::get_singleton()->add_task("import_theme_items", TTR("Importing Theme Items"), selected_items.size() + 2);
int idx = 0;
for (Map<ThemeItem, ItemCheckedState>::Element *E = selected_items.front(); E; E = E->next()) {
@@ -814,6 +814,12 @@ void ThemeItemImportTree::_import_selected() {
idx++;
}
+ // Allow changes to be reported now that the operation is finished.
+ ProgressDialog::get_singleton()->task_step("import_theme_items", TTR("Updating the editor"), idx++);
+ edited_theme->_unfreeze_and_propagate_changes();
+ // Make sure the task is not ended before the editor freezes to update the Inspector.
+ ProgressDialog::get_singleton()->task_step("import_theme_items", TTR("Finalizing"), idx++);
+
ProgressDialog::get_singleton()->end_task("import_theme_items");
emit_signal("items_imported");
}
@@ -1201,7 +1207,7 @@ void ThemeItemEditorDialog::_close_dialog() {
}
void ThemeItemEditorDialog::_dialog_about_to_show() {
- ERR_FAIL_COND(edited_theme.is_null());
+ ERR_FAIL_COND_MSG(edited_theme.is_null(), "Invalid state of the Theme Editor; the Theme resource is missing.");
_update_edit_types();
@@ -1458,6 +1464,9 @@ void ThemeItemEditorDialog::_add_theme_type() {
edited_theme->add_color_type(edit_add_type_value->get_text());
edited_theme->add_constant_type(edit_add_type_value->get_text());
_update_edit_types();
+
+ // Force emit a change so that other parts of the editor can update.
+ edited_theme->emit_changed();
}
void ThemeItemEditorDialog::_add_theme_item(Theme::DataType p_data_type, String p_item_name, String p_item_type) {
@@ -1488,15 +1497,24 @@ void ThemeItemEditorDialog::_add_theme_item(Theme::DataType p_data_type, String
void ThemeItemEditorDialog::_remove_data_type_items(Theme::DataType p_data_type, String p_item_type) {
List<StringName> names;
+ // Prevent changes from immediatelly being reported while the operation is still ongoing.
+ edited_theme->_freeze_change_propagation();
+
edited_theme->get_theme_item_list(p_data_type, p_item_type, &names);
for (List<StringName>::Element *E = names.front(); E; E = E->next()) {
edited_theme->clear_theme_item(p_data_type, E->get(), p_item_type);
}
+
+ // Allow changes to be reported now that the operation is finished.
+ edited_theme->_unfreeze_and_propagate_changes();
}
void ThemeItemEditorDialog::_remove_class_items() {
List<StringName> names;
+ // Prevent changes from immediatelly being reported while the operation is still ongoing.
+ edited_theme->_freeze_change_propagation();
+
for (int dt = 0; dt < Theme::DATA_TYPE_MAX; dt++) {
Theme::DataType data_type = (Theme::DataType)dt;
@@ -1509,12 +1527,18 @@ void ThemeItemEditorDialog::_remove_class_items() {
}
}
+ // Allow changes to be reported now that the operation is finished.
+ edited_theme->_unfreeze_and_propagate_changes();
+
_update_edit_item_tree(edited_item_type);
}
void ThemeItemEditorDialog::_remove_custom_items() {
List<StringName> names;
+ // Prevent changes from immediatelly being reported while the operation is still ongoing.
+ edited_theme->_freeze_change_propagation();
+
for (int dt = 0; dt < Theme::DATA_TYPE_MAX; dt++) {
Theme::DataType data_type = (Theme::DataType)dt;
@@ -1527,12 +1551,18 @@ void ThemeItemEditorDialog::_remove_custom_items() {
}
}
+ // Allow changes to be reported now that the operation is finished.
+ edited_theme->_unfreeze_and_propagate_changes();
+
_update_edit_item_tree(edited_item_type);
}
void ThemeItemEditorDialog::_remove_all_items() {
List<StringName> names;
+ // Prevent changes from immediatelly being reported while the operation is still ongoing.
+ edited_theme->_freeze_change_propagation();
+
for (int dt = 0; dt < Theme::DATA_TYPE_MAX; dt++) {
Theme::DataType data_type = (Theme::DataType)dt;
@@ -1543,6 +1573,9 @@ void ThemeItemEditorDialog::_remove_all_items() {
}
}
+ // Allow changes to be reported now that the operation is finished.
+ edited_theme->_unfreeze_and_propagate_changes();
+
_update_edit_item_tree(edited_item_type);
}
@@ -1907,268 +1940,1310 @@ ThemeItemEditorDialog::ThemeItemEditorDialog() {
confirm_closing_dialog->connect("confirmed", callable_mp(this, &ThemeItemEditorDialog::_close_dialog));
}
+VBoxContainer *ThemeTypeEditor::_create_item_list(Theme::DataType p_data_type) {
+ VBoxContainer *items_tab = memnew(VBoxContainer);
+ items_tab->set_custom_minimum_size(Size2(0, 160) * EDSCALE);
+ data_type_tabs->add_child(items_tab);
+ data_type_tabs->set_tab_title(data_type_tabs->get_tab_count() - 1, "");
+
+ ScrollContainer *items_sc = memnew(ScrollContainer);
+ items_sc->set_v_size_flags(SIZE_EXPAND_FILL);
+ items_sc->set_enable_h_scroll(false);
+ items_tab->add_child(items_sc);
+ VBoxContainer *items_list = memnew(VBoxContainer);
+ items_list->set_h_size_flags(SIZE_EXPAND_FILL);
+ items_sc->add_child(items_list);
+
+ HBoxContainer *item_add_hb = memnew(HBoxContainer);
+ items_tab->add_child(item_add_hb);
+ LineEdit *item_add_edit = memnew(LineEdit);
+ item_add_edit->set_h_size_flags(SIZE_EXPAND_FILL);
+ item_add_hb->add_child(item_add_edit);
+ item_add_edit->connect("text_entered", callable_mp(this, &ThemeTypeEditor::_item_add_lineedit_cbk), varray(p_data_type, item_add_edit));
+ Button *item_add_button = memnew(Button);
+ item_add_button->set_text(TTR("Add"));
+ item_add_hb->add_child(item_add_button);
+ item_add_button->connect("pressed", callable_mp(this, &ThemeTypeEditor::_item_add_cbk), varray(p_data_type, item_add_edit));
+
+ return items_list;
+}
+
+void ThemeTypeEditor::_update_type_list() {
+ ERR_FAIL_COND(edited_theme.is_null());
+
+ if (updating) {
+ return;
+ }
+ updating = true;
+
+ Control *focused = get_focus_owner();
+ if (focused) {
+ if (focusables.has(focused)) {
+ // If focus is currently on one of the internal property editors, don't update.
+ updating = false;
+ return;
+ }
+
+ Node *focus_parent = focused->get_parent();
+ while (focus_parent) {
+ Control *c = Object::cast_to<Control>(focus_parent);
+ if (c && focusables.has(c)) {
+ // If focus is currently on one of the internal property editors, don't update.
+ updating = false;
+ return;
+ }
+
+ focus_parent = focus_parent->get_parent();
+ }
+ }
+
+ List<StringName> theme_types;
+ edited_theme->get_type_list(&theme_types);
+ theme_types.sort_custom<StringName::AlphCompare>();
+
+ theme_type_list->clear();
+
+ if (theme_types.size() > 0) {
+ theme_type_list->set_disabled(false);
+
+ bool item_reselected = false;
+ int e_idx = 0;
+ for (List<StringName>::Element *E = theme_types.front(); E; E = E->next()) {
+ Ref<Texture2D> item_icon;
+ if (E->get() == "") {
+ item_icon = get_theme_icon("NodeDisabled", "EditorIcons");
+ } else {
+ item_icon = EditorNode::get_singleton()->get_class_icon(E->get(), "NodeDisabled");
+ }
+ theme_type_list->add_icon_item(item_icon, E->get());
+
+ if (E->get() == edited_type) {
+ theme_type_list->select(e_idx);
+ item_reselected = true;
+ }
+ e_idx++;
+ }
+
+ if (!item_reselected) {
+ theme_type_list->select(0);
+ _list_type_selected(0);
+ } else {
+ _update_type_items();
+ }
+ } else {
+ theme_type_list->set_disabled(true);
+ theme_type_list->add_item(TTR("None"));
+
+ edited_type = "";
+ _update_type_items();
+ }
+
+ updating = false;
+}
+
+void ThemeTypeEditor::_update_type_list_debounced() {
+ update_debounce_timer->start();
+}
+
+void ThemeTypeEditor::_update_add_type_options(const String &p_filter) {
+ add_type_options->clear();
+
+ List<StringName> names;
+ Theme::get_default()->get_type_list(&names);
+ names.sort_custom<StringName::AlphCompare>();
+
+ for (List<StringName>::Element *E = names.front(); E; E = E->next()) {
+ if (!p_filter.is_subsequence_ofi(String(E->get()))) {
+ continue;
+ }
+
+ Ref<Texture2D> item_icon;
+ if (E->get() == "") {
+ item_icon = get_theme_icon("NodeDisabled", "EditorIcons");
+ } else {
+ item_icon = EditorNode::get_singleton()->get_class_icon(E->get(), "NodeDisabled");
+ }
+
+ add_type_options->add_item(E->get(), item_icon);
+ }
+}
+
+OrderedHashMap<StringName, bool> ThemeTypeEditor::_get_type_items(String p_type_name, void (Theme::*get_list_func)(StringName, List<StringName> *) const, bool include_default) {
+ OrderedHashMap<StringName, bool> items;
+ List<StringName> names;
+
+ if (include_default) {
+ names.clear();
+ (Theme::get_default().operator->()->*get_list_func)(p_type_name, &names);
+ names.sort_custom<StringName::AlphCompare>();
+ for (List<StringName>::Element *E = names.front(); E; E = E->next()) {
+ items[E->get()] = false;
+ }
+ }
+
+ {
+ names.clear();
+ (edited_theme.operator->()->*get_list_func)(p_type_name, &names);
+ names.sort_custom<StringName::AlphCompare>();
+ for (List<StringName>::Element *E = names.front(); E; E = E->next()) {
+ items[E->get()] = true;
+ }
+ }
+
+ List<StringName> keys;
+ for (OrderedHashMap<StringName, bool>::Element E = items.front(); E; E = E.next()) {
+ keys.push_back(E.key());
+ }
+ keys.sort_custom<StringName::AlphCompare>();
+
+ OrderedHashMap<StringName, bool> ordered_items;
+ for (List<StringName>::Element *E = keys.front(); E; E = E->next()) {
+ ordered_items[E->get()] = items[E->get()];
+ }
+
+ return ordered_items;
+}
+
+HBoxContainer *ThemeTypeEditor::_create_property_control(Theme::DataType p_data_type, String p_item_name, bool p_editable) {
+ HBoxContainer *item_control = memnew(HBoxContainer);
+
+ HBoxContainer *item_name_container = memnew(HBoxContainer);
+ item_name_container->set_h_size_flags(SIZE_EXPAND_FILL);
+ item_name_container->set_stretch_ratio(2.0);
+ item_control->add_child(item_name_container);
+
+ Label *item_name = memnew(Label);
+ item_name->set_h_size_flags(SIZE_EXPAND_FILL);
+ item_name->set_clip_text(true);
+ item_name->set_text(p_item_name);
+ item_name->set_tooltip(p_item_name);
+ item_name_container->add_child(item_name);
+
+ if (p_editable) {
+ LineEdit *item_name_edit = memnew(LineEdit);
+ item_name_edit->set_h_size_flags(SIZE_EXPAND_FILL);
+ item_name_edit->set_text(p_item_name);
+ item_name_container->add_child(item_name_edit);
+ item_name_edit->connect("text_entered", callable_mp(this, &ThemeTypeEditor::_item_rename_entered), varray(p_data_type, p_item_name, item_name_container));
+ item_name_edit->hide();
+
+ Button *item_rename_button = memnew(Button);
+ item_rename_button->set_icon(get_theme_icon("Edit", "EditorIcons"));
+ item_rename_button->set_tooltip(TTR("Rename Item"));
+ item_rename_button->set_flat(true);
+ item_name_container->add_child(item_rename_button);
+ item_rename_button->connect("pressed", callable_mp(this, &ThemeTypeEditor::_item_rename_cbk), varray(p_data_type, p_item_name, item_name_container));
+
+ Button *item_remove_button = memnew(Button);
+ item_remove_button->set_icon(get_theme_icon("Remove", "EditorIcons"));
+ item_remove_button->set_tooltip(TTR("Remove Item"));
+ item_remove_button->set_flat(true);
+ item_name_container->add_child(item_remove_button);
+ item_remove_button->connect("pressed", callable_mp(this, &ThemeTypeEditor::_item_remove_cbk), varray(p_data_type, p_item_name));
+
+ Button *item_rename_confirm_button = memnew(Button);
+ item_rename_confirm_button->set_icon(get_theme_icon("ImportCheck", "EditorIcons"));
+ item_rename_confirm_button->set_tooltip(TTR("Confirm Item Rename"));
+ item_rename_confirm_button->set_flat(true);
+ item_name_container->add_child(item_rename_confirm_button);
+ item_rename_confirm_button->connect("pressed", callable_mp(this, &ThemeTypeEditor::_item_rename_confirmed), varray(p_data_type, p_item_name, item_name_container));
+ item_rename_confirm_button->hide();
+
+ Button *item_rename_cancel_button = memnew(Button);
+ item_rename_cancel_button->set_icon(get_theme_icon("ImportFail", "EditorIcons"));
+ item_rename_cancel_button->set_tooltip(TTR("Cancel Item Rename"));
+ item_rename_cancel_button->set_flat(true);
+ item_name_container->add_child(item_rename_cancel_button);
+ item_rename_cancel_button->connect("pressed", callable_mp(this, &ThemeTypeEditor::_item_rename_canceled), varray(p_data_type, p_item_name, item_name_container));
+ item_rename_cancel_button->hide();
+ } else {
+ item_name->add_theme_color_override("font_color", get_theme_color("disabled_font_color", "Editor"));
+
+ Button *item_override_button = memnew(Button);
+ item_override_button->set_icon(get_theme_icon("Add", "EditorIcons"));
+ item_override_button->set_tooltip(TTR("Override Item"));
+ item_override_button->set_flat(true);
+ item_name_container->add_child(item_override_button);
+ item_override_button->connect("pressed", callable_mp(this, &ThemeTypeEditor::_item_override_cbk), varray(p_data_type, p_item_name));
+ }
+
+ return item_control;
+}
+
+void ThemeTypeEditor::_add_focusable(Control *p_control) {
+ focusables.append(p_control);
+}
+
+void ThemeTypeEditor::_update_type_items() {
+ bool show_default = show_default_items_button->is_pressed();
+ List<StringName> names;
+
+ focusables.clear();
+
+ // Colors.
+ {
+ for (int i = color_items_list->get_child_count() - 1; i >= 0; i--) {
+ Node *node = color_items_list->get_child(i);
+ node->queue_delete();
+ color_items_list->remove_child(node);
+ }
+
+ OrderedHashMap<StringName, bool> color_items = _get_type_items(edited_type, &Theme::get_color_list, show_default);
+ for (OrderedHashMap<StringName, bool>::Element E = color_items.front(); E; E = E.next()) {
+ HBoxContainer *item_control = _create_property_control(Theme::DATA_TYPE_COLOR, E.key(), E.get());
+ ColorPickerButton *item_editor = memnew(ColorPickerButton);
+ item_editor->set_h_size_flags(SIZE_EXPAND_FILL);
+ item_control->add_child(item_editor);
+
+ if (E.get()) {
+ item_editor->set_pick_color(edited_theme->get_color(E.key(), edited_type));
+ item_editor->connect("color_changed", callable_mp(this, &ThemeTypeEditor::_color_item_changed), varray(E.key()));
+ } else {
+ item_editor->set_pick_color(Theme::get_default()->get_color(E.key(), edited_type));
+ item_editor->set_disabled(true);
+ }
+
+ _add_focusable(item_editor);
+ color_items_list->add_child(item_control);
+ }
+ }
+
+ // Constants.
+ {
+ for (int i = constant_items_list->get_child_count() - 1; i >= 0; i--) {
+ Node *node = constant_items_list->get_child(i);
+ node->queue_delete();
+ constant_items_list->remove_child(node);
+ }
+
+ OrderedHashMap<StringName, bool> constant_items = _get_type_items(edited_type, &Theme::get_constant_list, show_default);
+ for (OrderedHashMap<StringName, bool>::Element E = constant_items.front(); E; E = E.next()) {
+ HBoxContainer *item_control = _create_property_control(Theme::DATA_TYPE_CONSTANT, E.key(), E.get());
+ SpinBox *item_editor = memnew(SpinBox);
+ item_editor->set_h_size_flags(SIZE_EXPAND_FILL);
+ item_editor->set_min(-100000);
+ item_editor->set_max(100000);
+ item_editor->set_step(1);
+ item_editor->set_allow_lesser(true);
+ item_editor->set_allow_greater(true);
+ item_control->add_child(item_editor);
+
+ if (E.get()) {
+ item_editor->set_value(edited_theme->get_constant(E.key(), edited_type));
+ item_editor->connect("value_changed", callable_mp(this, &ThemeTypeEditor::_constant_item_changed), varray(E.key()));
+ } else {
+ item_editor->set_value(Theme::get_default()->get_constant(E.key(), edited_type));
+ item_editor->set_editable(false);
+ }
+
+ _add_focusable(item_editor);
+ constant_items_list->add_child(item_control);
+ }
+ }
+
+ // Fonts.
+ {
+ for (int i = font_items_list->get_child_count() - 1; i >= 0; i--) {
+ Node *node = font_items_list->get_child(i);
+ node->queue_delete();
+ font_items_list->remove_child(node);
+ }
+
+ OrderedHashMap<StringName, bool> font_items = _get_type_items(edited_type, &Theme::get_font_list, show_default);
+ for (OrderedHashMap<StringName, bool>::Element E = font_items.front(); E; E = E.next()) {
+ HBoxContainer *item_control = _create_property_control(Theme::DATA_TYPE_FONT, E.key(), E.get());
+ EditorResourcePicker *item_editor = memnew(EditorResourcePicker);
+ item_editor->set_h_size_flags(SIZE_EXPAND_FILL);
+ item_editor->set_base_type("Font");
+ item_control->add_child(item_editor);
+
+ if (E.get()) {
+ if (edited_theme->has_font(E.key(), edited_type)) {
+ item_editor->set_edited_resource(edited_theme->get_font(E.key(), edited_type));
+ } else {
+ item_editor->set_edited_resource(RES());
+ }
+ item_editor->connect("resource_selected", callable_mp(this, &ThemeTypeEditor::_edit_resource_item), varray(item_control));
+ item_editor->connect("resource_changed", callable_mp(this, &ThemeTypeEditor::_font_item_changed), varray(E.key()));
+ } else {
+ if (Theme::get_default()->has_font(E.key(), edited_type)) {
+ item_editor->set_edited_resource(Theme::get_default()->get_font(E.key(), edited_type));
+ } else {
+ item_editor->set_edited_resource(RES());
+ }
+ item_editor->set_editable(false);
+ }
+
+ _add_focusable(item_editor);
+ font_items_list->add_child(item_control);
+ }
+ }
+
+ // Fonts sizes.
+ {
+ for (int i = font_size_items_list->get_child_count() - 1; i >= 0; i--) {
+ Node *node = font_size_items_list->get_child(i);
+ node->queue_delete();
+ font_size_items_list->remove_child(node);
+ }
+
+ OrderedHashMap<StringName, bool> font_size_items = _get_type_items(edited_type, &Theme::get_font_size_list, show_default);
+ for (OrderedHashMap<StringName, bool>::Element E = font_size_items.front(); E; E = E.next()) {
+ HBoxContainer *item_control = _create_property_control(Theme::DATA_TYPE_FONT_SIZE, E.key(), E.get());
+ SpinBox *item_editor = memnew(SpinBox);
+ item_editor->set_h_size_flags(SIZE_EXPAND_FILL);
+ item_editor->set_min(-100000);
+ item_editor->set_max(100000);
+ item_editor->set_step(1);
+ item_editor->set_allow_lesser(true);
+ item_editor->set_allow_greater(true);
+ item_control->add_child(item_editor);
+
+ if (E.get()) {
+ item_editor->set_value(edited_theme->get_font_size(E.key(), edited_type));
+ item_editor->connect("value_changed", callable_mp(this, &ThemeTypeEditor::_font_size_item_changed), varray(E.key()));
+ } else {
+ item_editor->set_value(Theme::get_default()->get_font_size(E.key(), edited_type));
+ item_editor->set_editable(false);
+ }
+
+ _add_focusable(item_editor);
+ font_size_items_list->add_child(item_control);
+ }
+ }
+
+ // Icons.
+ {
+ for (int i = icon_items_list->get_child_count() - 1; i >= 0; i--) {
+ Node *node = icon_items_list->get_child(i);
+ node->queue_delete();
+ icon_items_list->remove_child(node);
+ }
+
+ OrderedHashMap<StringName, bool> icon_items = _get_type_items(edited_type, &Theme::get_icon_list, show_default);
+ for (OrderedHashMap<StringName, bool>::Element E = icon_items.front(); E; E = E.next()) {
+ HBoxContainer *item_control = _create_property_control(Theme::DATA_TYPE_ICON, E.key(), E.get());
+ EditorResourcePicker *item_editor = memnew(EditorResourcePicker);
+ item_editor->set_h_size_flags(SIZE_EXPAND_FILL);
+ item_editor->set_base_type("Texture2D");
+ item_control->add_child(item_editor);
+
+ if (E.get()) {
+ if (edited_theme->has_icon(E.key(), edited_type)) {
+ item_editor->set_edited_resource(edited_theme->get_icon(E.key(), edited_type));
+ } else {
+ item_editor->set_edited_resource(RES());
+ }
+ item_editor->connect("resource_selected", callable_mp(this, &ThemeTypeEditor::_edit_resource_item), varray(item_control));
+ item_editor->connect("resource_changed", callable_mp(this, &ThemeTypeEditor::_icon_item_changed), varray(E.key()));
+ } else {
+ if (Theme::get_default()->has_icon(E.key(), edited_type)) {
+ item_editor->set_edited_resource(Theme::get_default()->get_icon(E.key(), edited_type));
+ } else {
+ item_editor->set_edited_resource(RES());
+ }
+ item_editor->set_editable(false);
+ }
+
+ _add_focusable(item_editor);
+ icon_items_list->add_child(item_control);
+ }
+ }
+
+ // Styleboxes.
+ {
+ for (int i = stylebox_items_list->get_child_count() - 1; i >= 0; i--) {
+ Node *node = stylebox_items_list->get_child(i);
+ node->queue_delete();
+ stylebox_items_list->remove_child(node);
+ }
+
+ if (leading_stylebox.pinned) {
+ HBoxContainer *item_control = _create_property_control(Theme::DATA_TYPE_STYLEBOX, leading_stylebox.item_name, true);
+ EditorResourcePicker *item_editor = memnew(EditorResourcePicker);
+ item_editor->set_h_size_flags(SIZE_EXPAND_FILL);
+ item_editor->set_stretch_ratio(1.5);
+ item_editor->set_base_type("StyleBox");
+
+ Button *pin_leader_button = memnew(Button);
+ pin_leader_button->set_flat(true);
+ pin_leader_button->set_toggle_mode(true);
+ pin_leader_button->set_pressed(true);
+ pin_leader_button->set_icon(get_theme_icon("Pin", "EditorIcons"));
+ pin_leader_button->set_tooltip(TTR("Unpin this StyleBox as a main style."));
+ item_control->add_child(pin_leader_button);
+ pin_leader_button->connect("pressed", callable_mp(this, &ThemeTypeEditor::_unpin_leading_stylebox));
+
+ item_control->add_child(item_editor);
+
+ if (leading_stylebox.stylebox.is_valid()) {
+ item_editor->set_edited_resource(leading_stylebox.stylebox);
+ } else {
+ item_editor->set_edited_resource(RES());
+ }
+ item_editor->connect("resource_selected", callable_mp(this, &ThemeTypeEditor::_edit_resource_item), varray(item_control));
+ item_editor->connect("resource_changed", callable_mp(this, &ThemeTypeEditor::_stylebox_item_changed), varray(leading_stylebox.item_name));
+
+ stylebox_items_list->add_child(item_control);
+ stylebox_items_list->add_child(memnew(HSeparator));
+ }
+
+ OrderedHashMap<StringName, bool> stylebox_items = _get_type_items(edited_type, &Theme::get_stylebox_list, show_default);
+ for (OrderedHashMap<StringName, bool>::Element E = stylebox_items.front(); E; E = E.next()) {
+ if (leading_stylebox.pinned && leading_stylebox.item_name == E.key()) {
+ continue;
+ }
+
+ HBoxContainer *item_control = _create_property_control(Theme::DATA_TYPE_STYLEBOX, E.key(), E.get());
+ EditorResourcePicker *item_editor = memnew(EditorResourcePicker);
+ item_editor->set_h_size_flags(SIZE_EXPAND_FILL);
+ item_editor->set_stretch_ratio(1.5);
+ item_editor->set_base_type("StyleBox");
+
+ if (E.get()) {
+ Ref<StyleBox> stylebox_value;
+ if (edited_theme->has_stylebox(E.key(), edited_type)) {
+ stylebox_value = edited_theme->get_stylebox(E.key(), edited_type);
+ item_editor->set_edited_resource(stylebox_value);
+ } else {
+ item_editor->set_edited_resource(RES());
+ }
+ item_editor->connect("resource_selected", callable_mp(this, &ThemeTypeEditor::_edit_resource_item), varray(item_control));
+ item_editor->connect("resource_changed", callable_mp(this, &ThemeTypeEditor::_stylebox_item_changed), varray(E.key()));
+
+ Button *pin_leader_button = memnew(Button);
+ pin_leader_button->set_flat(true);
+ pin_leader_button->set_toggle_mode(true);
+ pin_leader_button->set_icon(get_theme_icon("Pin", "EditorIcons"));
+ pin_leader_button->set_tooltip(TTR("Pin this StyleBox as a main style. Editing its properties will update the same properties in all other StyleBoxes of this type."));
+ item_control->add_child(pin_leader_button);
+ pin_leader_button->connect("pressed", callable_mp(this, &ThemeTypeEditor::_pin_leading_stylebox), varray(stylebox_value, E.key()));
+ } else {
+ if (Theme::get_default()->has_stylebox(E.key(), edited_type)) {
+ item_editor->set_edited_resource(Theme::get_default()->get_stylebox(E.key(), edited_type));
+ } else {
+ item_editor->set_edited_resource(RES());
+ }
+ item_editor->set_editable(false);
+ }
+
+ item_control->add_child(item_editor);
+ _add_focusable(item_editor);
+ stylebox_items_list->add_child(item_control);
+ }
+ }
+}
+
+void ThemeTypeEditor::_list_type_selected(int p_index) {
+ edited_type = theme_type_list->get_item_text(p_index);
+ _update_type_items();
+}
+
+void ThemeTypeEditor::_add_type_button_cbk() {
+ add_type_dialog->popup_centered(Size2(560, 420) * EDSCALE);
+ add_type_filter->grab_focus();
+}
+
+void ThemeTypeEditor::_add_type_filter_cbk(const String &p_value) {
+ _update_add_type_options(p_value);
+}
+
+void ThemeTypeEditor::_add_type_options_cbk(int p_index) {
+ add_type_filter->set_text(add_type_options->get_item_text(p_index));
+}
+
+void ThemeTypeEditor::_add_type_dialog_confirmed() {
+ select_type(add_type_filter->get_text().strip_edges());
+}
+
+void ThemeTypeEditor::_add_type_dialog_entered(const String &p_value) {
+ select_type(p_value.strip_edges());
+ add_type_dialog->hide();
+}
+
+void ThemeTypeEditor::_add_type_dialog_activated(int p_index) {
+ select_type(add_type_options->get_item_text(p_index));
+ add_type_dialog->hide();
+}
+
+void ThemeTypeEditor::_add_default_type_items() {
+ List<StringName> names;
+
+ updating = true;
+ // Prevent changes from immediatelly being reported while the operation is still ongoing.
+ edited_theme->_freeze_change_propagation();
+
+ {
+ names.clear();
+ Theme::get_default()->get_icon_list(edited_type, &names);
+ for (List<StringName>::Element *E = names.front(); E; E = E->next()) {
+ if (!edited_theme->has_icon(E->get(), edited_type)) {
+ edited_theme->set_icon(E->get(), edited_type, Ref<Texture2D>());
+ }
+ }
+ }
+ {
+ names.clear();
+ Theme::get_default()->get_stylebox_list(edited_type, &names);
+ for (List<StringName>::Element *E = names.front(); E; E = E->next()) {
+ if (!edited_theme->has_stylebox(E->get(), edited_type)) {
+ edited_theme->set_stylebox(E->get(), edited_type, Ref<StyleBox>());
+ }
+ }
+ }
+ {
+ names.clear();
+ Theme::get_default()->get_font_list(edited_type, &names);
+ for (List<StringName>::Element *E = names.front(); E; E = E->next()) {
+ if (!edited_theme->has_font(E->get(), edited_type)) {
+ edited_theme->set_font(E->get(), edited_type, Ref<Font>());
+ }
+ }
+ }
+ {
+ names.clear();
+ Theme::get_default()->get_font_size_list(edited_type, &names);
+ for (List<StringName>::Element *E = names.front(); E; E = E->next()) {
+ if (!edited_theme->has_font_size(E->get(), edited_type)) {
+ edited_theme->set_font_size(E->get(), edited_type, Theme::get_default()->get_font_size(E->get(), edited_type));
+ }
+ }
+ }
+ {
+ names.clear();
+ Theme::get_default()->get_color_list(edited_type, &names);
+ for (List<StringName>::Element *E = names.front(); E; E = E->next()) {
+ if (!edited_theme->has_color(E->get(), edited_type)) {
+ edited_theme->set_color(E->get(), edited_type, Theme::get_default()->get_color(E->get(), edited_type));
+ }
+ }
+ }
+ {
+ names.clear();
+ Theme::get_default()->get_constant_list(edited_type, &names);
+ for (List<StringName>::Element *E = names.front(); E; E = E->next()) {
+ if (!edited_theme->has_constant(E->get(), edited_type)) {
+ edited_theme->set_constant(E->get(), edited_type, Theme::get_default()->get_constant(E->get(), edited_type));
+ }
+ }
+ }
+
+ // Allow changes to be reported now that the operation is finished.
+ edited_theme->_unfreeze_and_propagate_changes();
+ updating = false;
+
+ _update_type_items();
+}
+
+void ThemeTypeEditor::_item_add_cbk(int p_data_type, Control *p_control) {
+ LineEdit *le = Object::cast_to<LineEdit>(p_control);
+ if (le->get_text().strip_edges().is_empty()) {
+ return;
+ }
+
+ String item_name = le->get_text().strip_edges();
+ switch (p_data_type) {
+ case Theme::DATA_TYPE_COLOR: {
+ edited_theme->set_color(item_name, edited_type, Color());
+ } break;
+ case Theme::DATA_TYPE_CONSTANT: {
+ edited_theme->set_constant(item_name, edited_type, 0);
+ } break;
+ case Theme::DATA_TYPE_FONT: {
+ edited_theme->set_font(item_name, edited_type, Ref<Font>());
+ } break;
+ case Theme::DATA_TYPE_FONT_SIZE: {
+ edited_theme->set_font_size(item_name, edited_type, -1);
+ } break;
+ case Theme::DATA_TYPE_ICON: {
+ edited_theme->set_icon(item_name, edited_type, Ref<Texture2D>());
+ } break;
+ case Theme::DATA_TYPE_STYLEBOX: {
+ edited_theme->set_stylebox(item_name, edited_type, Ref<StyleBox>());
+ } break;
+ }
+
+ le->set_text("");
+}
+
+void ThemeTypeEditor::_item_add_lineedit_cbk(String p_value, int p_data_type, Control *p_control) {
+ _item_add_cbk(p_data_type, p_control);
+}
+
+void ThemeTypeEditor::_item_override_cbk(int p_data_type, String p_item_name) {
+ switch (p_data_type) {
+ case Theme::DATA_TYPE_COLOR: {
+ edited_theme->set_color(p_item_name, edited_type, Theme::get_default()->get_color(p_item_name, edited_type));
+ } break;
+ case Theme::DATA_TYPE_CONSTANT: {
+ edited_theme->set_constant(p_item_name, edited_type, Theme::get_default()->get_constant(p_item_name, edited_type));
+ } break;
+ case Theme::DATA_TYPE_FONT: {
+ edited_theme->set_font(p_item_name, edited_type, Ref<Font>());
+ } break;
+ case Theme::DATA_TYPE_FONT_SIZE: {
+ edited_theme->set_font_size(p_item_name, edited_type, Theme::get_default()->get_font_size(p_item_name, edited_type));
+ } break;
+ case Theme::DATA_TYPE_ICON: {
+ edited_theme->set_icon(p_item_name, edited_type, Ref<Texture2D>());
+ } break;
+ case Theme::DATA_TYPE_STYLEBOX: {
+ edited_theme->set_stylebox(p_item_name, edited_type, Ref<StyleBox>());
+ } break;
+ }
+}
+
+void ThemeTypeEditor::_item_remove_cbk(int p_data_type, String p_item_name) {
+ switch (p_data_type) {
+ case Theme::DATA_TYPE_COLOR: {
+ edited_theme->clear_color(p_item_name, edited_type);
+ } break;
+ case Theme::DATA_TYPE_CONSTANT: {
+ edited_theme->clear_constant(p_item_name, edited_type);
+ } break;
+ case Theme::DATA_TYPE_FONT: {
+ edited_theme->clear_font(p_item_name, edited_type);
+ } break;
+ case Theme::DATA_TYPE_FONT_SIZE: {
+ edited_theme->clear_font_size(p_item_name, edited_type);
+ } break;
+ case Theme::DATA_TYPE_ICON: {
+ edited_theme->clear_icon(p_item_name, edited_type);
+ } break;
+ case Theme::DATA_TYPE_STYLEBOX: {
+ edited_theme->clear_stylebox(p_item_name, edited_type);
+ } break;
+ }
+}
+
+void ThemeTypeEditor::_item_rename_cbk(int p_data_type, String p_item_name, Control *p_control) {
+ // Label
+ Object::cast_to<Label>(p_control->get_child(0))->hide();
+ // Label buttons
+ Object::cast_to<Button>(p_control->get_child(2))->hide();
+ Object::cast_to<Button>(p_control->get_child(3))->hide();
+
+ // LineEdit
+ Object::cast_to<LineEdit>(p_control->get_child(1))->set_text(p_item_name);
+ Object::cast_to<LineEdit>(p_control->get_child(1))->show();
+ // LineEdit buttons
+ Object::cast_to<Button>(p_control->get_child(4))->show();
+ Object::cast_to<Button>(p_control->get_child(5))->show();
+}
+
+void ThemeTypeEditor::_item_rename_confirmed(int p_data_type, String p_item_name, Control *p_control) {
+ LineEdit *le = Object::cast_to<LineEdit>(p_control->get_child(1));
+ if (le->get_text().strip_edges().is_empty()) {
+ return;
+ }
+
+ String new_name = le->get_text().strip_edges();
+ if (new_name == p_item_name) {
+ _item_rename_canceled(p_data_type, p_item_name, p_control);
+ return;
+ }
+
+ switch (p_data_type) {
+ case Theme::DATA_TYPE_COLOR: {
+ edited_theme->rename_color(p_item_name, new_name, edited_type);
+ } break;
+ case Theme::DATA_TYPE_CONSTANT: {
+ edited_theme->rename_constant(p_item_name, new_name, edited_type);
+ } break;
+ case Theme::DATA_TYPE_FONT: {
+ edited_theme->rename_font(p_item_name, new_name, edited_type);
+ } break;
+ case Theme::DATA_TYPE_FONT_SIZE: {
+ edited_theme->rename_font_size(p_item_name, new_name, edited_type);
+ } break;
+ case Theme::DATA_TYPE_ICON: {
+ edited_theme->rename_icon(p_item_name, new_name, edited_type);
+ } break;
+ case Theme::DATA_TYPE_STYLEBOX: {
+ edited_theme->rename_stylebox(p_item_name, new_name, edited_type);
+ } break;
+ }
+}
+
+void ThemeTypeEditor::_item_rename_entered(String p_value, int p_data_type, String p_item_name, Control *p_control) {
+ _item_rename_confirmed(p_data_type, p_item_name, p_control);
+}
+
+void ThemeTypeEditor::_item_rename_canceled(int p_data_type, String p_item_name, Control *p_control) {
+ // LineEdit
+ Object::cast_to<LineEdit>(p_control->get_child(1))->hide();
+ // LineEdit buttons
+ Object::cast_to<Button>(p_control->get_child(4))->hide();
+ Object::cast_to<Button>(p_control->get_child(5))->hide();
+
+ // Label
+ Object::cast_to<Label>(p_control->get_child(0))->show();
+ // Label buttons
+ Object::cast_to<Button>(p_control->get_child(2))->show();
+ Object::cast_to<Button>(p_control->get_child(3))->show();
+}
+
+void ThemeTypeEditor::_color_item_changed(Color p_value, String p_item_name) {
+ edited_theme->set_color(p_item_name, edited_type, p_value);
+}
+
+void ThemeTypeEditor::_constant_item_changed(float p_value, String p_item_name) {
+ edited_theme->set_constant(p_item_name, edited_type, int(p_value));
+}
+
+void ThemeTypeEditor::_font_size_item_changed(float p_value, String p_item_name) {
+ edited_theme->set_font_size(p_item_name, edited_type, int(p_value));
+}
+
+void ThemeTypeEditor::_edit_resource_item(RES p_resource, Control *p_editor) {
+ EditorNode::get_singleton()->edit_resource(p_resource);
+}
+
+void ThemeTypeEditor::_font_item_changed(Ref<Font> p_value, String p_item_name) {
+ edited_theme->set_font(p_item_name, edited_type, p_value);
+}
+
+void ThemeTypeEditor::_icon_item_changed(Ref<Texture2D> p_value, String p_item_name) {
+ edited_theme->set_icon(p_item_name, edited_type, p_value);
+}
+
+void ThemeTypeEditor::_stylebox_item_changed(Ref<StyleBox> p_value, String p_item_name) {
+ edited_theme->set_stylebox(p_item_name, edited_type, p_value);
+
+ if (leading_stylebox.pinned && leading_stylebox.item_name == p_item_name) {
+ if (leading_stylebox.stylebox.is_valid()) {
+ leading_stylebox.stylebox->disconnect("changed", callable_mp(this, &ThemeTypeEditor::_update_stylebox_from_leading));
+ }
+
+ leading_stylebox.stylebox = p_value;
+ leading_stylebox.ref_stylebox = (p_value.is_valid() ? p_value->duplicate() : RES());
+ if (p_value.is_valid()) {
+ leading_stylebox.stylebox->connect("changed", callable_mp(this, &ThemeTypeEditor::_update_stylebox_from_leading));
+ }
+ }
+}
+
+void ThemeTypeEditor::_pin_leading_stylebox(Ref<StyleBox> p_stylebox, String p_item_name) {
+ if (leading_stylebox.stylebox.is_valid()) {
+ leading_stylebox.stylebox->disconnect("changed", callable_mp(this, &ThemeTypeEditor::_update_stylebox_from_leading));
+ }
+
+ LeadingStylebox leader;
+ leader.pinned = true;
+ leader.item_name = p_item_name;
+ leader.stylebox = p_stylebox;
+ leader.ref_stylebox = (p_stylebox.is_valid() ? p_stylebox->duplicate() : RES());
+
+ leading_stylebox = leader;
+ if (leading_stylebox.stylebox.is_valid()) {
+ leading_stylebox.stylebox->connect("changed", callable_mp(this, &ThemeTypeEditor::_update_stylebox_from_leading));
+ }
+
+ _update_type_items();
+}
+
+void ThemeTypeEditor::_unpin_leading_stylebox() {
+ if (leading_stylebox.stylebox.is_valid()) {
+ leading_stylebox.stylebox->disconnect("changed", callable_mp(this, &ThemeTypeEditor::_update_stylebox_from_leading));
+ }
+
+ LeadingStylebox leader;
+ leader.pinned = false;
+ leading_stylebox = leader;
+
+ _update_type_items();
+}
+
+void ThemeTypeEditor::_update_stylebox_from_leading() {
+ if (!leading_stylebox.pinned || leading_stylebox.stylebox.is_null()) {
+ return;
+ }
+
+ // Prevent changes from immediatelly being reported while the operation is still ongoing.
+ edited_theme->_freeze_change_propagation();
+
+ List<StringName> names;
+ edited_theme->get_stylebox_list(edited_type, &names);
+ List<Ref<StyleBox>> styleboxes;
+ for (List<StringName>::Element *E = names.front(); E; E = E->next()) {
+ if (E->get() == leading_stylebox.item_name) {
+ continue;
+ }
+
+ Ref<StyleBox> sb = edited_theme->get_stylebox(E->get(), edited_type);
+ if (sb->get_class() == leading_stylebox.stylebox->get_class()) {
+ styleboxes.push_back(sb);
+ }
+ }
+
+ List<PropertyInfo> props;
+ leading_stylebox.stylebox->get_property_list(&props);
+ for (List<PropertyInfo>::Element *E = props.front(); E; E = E->next()) {
+ if (!(E->get().usage & PROPERTY_USAGE_STORAGE)) {
+ continue;
+ }
+
+ Variant value = leading_stylebox.stylebox->get(E->get().name);
+ Variant ref_value = leading_stylebox.ref_stylebox->get(E->get().name);
+ if (value == ref_value) {
+ continue;
+ }
+
+ for (List<Ref<StyleBox>>::Element *F = styleboxes.front(); F; F = F->next()) {
+ Ref<StyleBox> sb = F->get();
+ sb->set(E->get().name, value);
+ }
+ }
+
+ leading_stylebox.ref_stylebox = leading_stylebox.stylebox->duplicate();
+
+ // Allow changes to be reported now that the operation is finished.
+ edited_theme->_unfreeze_and_propagate_changes();
+}
+
+void ThemeTypeEditor::_notification(int p_what) {
+ switch (p_what) {
+ case NOTIFICATION_ENTER_TREE:
+ case NOTIFICATION_THEME_CHANGED: {
+ add_type_button->set_icon(get_theme_icon("Add", "EditorIcons"));
+
+ data_type_tabs->set_tab_icon(0, get_theme_icon("Color", "EditorIcons"));
+ data_type_tabs->set_tab_icon(1, get_theme_icon("MemberConstant", "EditorIcons"));
+ data_type_tabs->set_tab_icon(2, get_theme_icon("Font", "EditorIcons"));
+ data_type_tabs->set_tab_icon(3, get_theme_icon("FontSize", "EditorIcons"));
+ data_type_tabs->set_tab_icon(4, get_theme_icon("ImageTexture", "EditorIcons"));
+ data_type_tabs->set_tab_icon(5, get_theme_icon("StyleBoxFlat", "EditorIcons"));
+
+ data_type_tabs->add_theme_style_override("tab_selected", get_theme_stylebox("tab_selected_odd", "TabContainer"));
+ data_type_tabs->add_theme_style_override("panel", get_theme_stylebox("panel_odd", "TabContainer"));
+
+ _update_add_type_options();
+ } break;
+ }
+}
+
+void ThemeTypeEditor::set_edited_theme(const Ref<Theme> &p_theme) {
+ if (edited_theme.is_valid()) {
+ edited_theme->disconnect("changed", callable_mp(this, &ThemeTypeEditor::_update_type_list_debounced));
+ }
+
+ edited_theme = p_theme;
+ edited_theme->connect("changed", callable_mp(this, &ThemeTypeEditor::_update_type_list_debounced));
+ _update_type_list();
+}
+
+void ThemeTypeEditor::select_type(String p_type_name) {
+ edited_type = p_type_name;
+ bool type_exists = false;
+
+ for (int i = 0; i < theme_type_list->get_item_count(); i++) {
+ String type_name = theme_type_list->get_item_text(i);
+ if (type_name == edited_type) {
+ theme_type_list->select(i);
+ type_exists = true;
+ break;
+ }
+ }
+
+ if (type_exists) {
+ _update_type_items();
+ } else {
+ edited_theme->add_icon_type(edited_type);
+ edited_theme->add_stylebox_type(edited_type);
+ edited_theme->add_font_type(edited_type);
+ edited_theme->add_font_size_type(edited_type);
+ edited_theme->add_color_type(edited_type);
+ edited_theme->add_constant_type(edited_type);
+
+ _update_type_list();
+ }
+}
+
+ThemeTypeEditor::ThemeTypeEditor() {
+ VBoxContainer *main_vb = memnew(VBoxContainer);
+ add_child(main_vb);
+
+ HBoxContainer *type_list_hb = memnew(HBoxContainer);
+ main_vb->add_child(type_list_hb);
+
+ Label *type_list_label = memnew(Label);
+ type_list_label->set_text(TTR("Type:"));
+ type_list_hb->add_child(type_list_label);
+
+ theme_type_list = memnew(OptionButton);
+ theme_type_list->set_h_size_flags(SIZE_EXPAND_FILL);
+ type_list_hb->add_child(theme_type_list);
+ theme_type_list->connect("item_selected", callable_mp(this, &ThemeTypeEditor::_list_type_selected));
+
+ add_type_button = memnew(Button);
+ add_type_button->set_tooltip(TTR("Add Type"));
+ type_list_hb->add_child(add_type_button);
+ add_type_button->connect("pressed", callable_mp(this, &ThemeTypeEditor::_add_type_button_cbk));
+
+ add_type_dialog = memnew(ConfirmationDialog);
+ add_type_dialog->set_title(TTR("Add Item Type"));
+ type_list_hb->add_child(add_type_dialog);
+ add_type_dialog->connect("confirmed", callable_mp(this, &ThemeTypeEditor::_add_type_dialog_confirmed));
+
+ VBoxContainer *add_type_vb = memnew(VBoxContainer);
+ add_type_dialog->add_child(add_type_vb);
+
+ Label *add_type_filter_label = memnew(Label);
+ add_type_filter_label->set_text(TTR("Name:"));
+ add_type_vb->add_child(add_type_filter_label);
+ add_type_filter = memnew(LineEdit);
+ add_type_vb->add_child(add_type_filter);
+ add_type_filter->connect("text_changed", callable_mp(this, &ThemeTypeEditor::_add_type_filter_cbk));
+ add_type_filter->connect("text_entered", callable_mp(this, &ThemeTypeEditor::_add_type_dialog_entered));
+ Label *add_type_options_label = memnew(Label);
+ add_type_options_label->set_text(TTR("Node Types:"));
+ add_type_vb->add_child(add_type_options_label);
+ add_type_options = memnew(ItemList);
+ add_type_options->set_v_size_flags(SIZE_EXPAND_FILL);
+ add_type_vb->add_child(add_type_options);
+ add_type_options->connect("item_selected", callable_mp(this, &ThemeTypeEditor::_add_type_options_cbk));
+ add_type_options->connect("item_activated", callable_mp(this, &ThemeTypeEditor::_add_type_dialog_activated));
+
+ HBoxContainer *type_controls = memnew(HBoxContainer);
+ main_vb->add_child(type_controls);
+
+ show_default_items_button = memnew(CheckButton);
+ show_default_items_button->set_h_size_flags(SIZE_EXPAND_FILL);
+ show_default_items_button->set_text(TTR("Show Default"));
+ show_default_items_button->set_tooltip(TTR("Show default type items alongside items that have been overridden."));
+ show_default_items_button->set_pressed(true);
+ type_controls->add_child(show_default_items_button);
+ show_default_items_button->connect("pressed", callable_mp(this, &ThemeTypeEditor::_update_type_items));
+
+ Button *add_default_items_button = memnew(Button);
+ add_default_items_button->set_h_size_flags(SIZE_EXPAND_FILL);
+ add_default_items_button->set_text(TTR("Override All"));
+ add_default_items_button->set_tooltip(TTR("Override all default type items."));
+ type_controls->add_child(add_default_items_button);
+ add_default_items_button->connect("pressed", callable_mp(this, &ThemeTypeEditor::_add_default_type_items));
+
+ data_type_tabs = memnew(TabContainer);
+ main_vb->add_child(data_type_tabs);
+ data_type_tabs->set_v_size_flags(SIZE_EXPAND_FILL);
+ data_type_tabs->set_use_hidden_tabs_for_min_size(true);
+
+ color_items_list = _create_item_list(Theme::DATA_TYPE_COLOR);
+ constant_items_list = _create_item_list(Theme::DATA_TYPE_CONSTANT);
+ font_items_list = _create_item_list(Theme::DATA_TYPE_FONT);
+ font_size_items_list = _create_item_list(Theme::DATA_TYPE_FONT_SIZE);
+ icon_items_list = _create_item_list(Theme::DATA_TYPE_ICON);
+ stylebox_items_list = _create_item_list(Theme::DATA_TYPE_STYLEBOX);
+
+ update_debounce_timer = memnew(Timer);
+ update_debounce_timer->set_one_shot(true);
+ update_debounce_timer->set_wait_time(0.5);
+ update_debounce_timer->connect("timeout", callable_mp(this, &ThemeTypeEditor::_update_type_list));
+ add_child(update_debounce_timer);
+}
+
void ThemeEditor::edit(const Ref<Theme> &p_theme) {
+ if (theme == p_theme) {
+ return;
+ }
+
theme = p_theme;
+ theme_type_editor->set_edited_theme(p_theme);
theme_edit_dialog->set_edited_theme(p_theme);
- main_panel->set_theme(p_theme);
- main_container->set_theme(p_theme);
-}
-void ThemeEditor::_propagate_redraw(Control *p_at) {
- p_at->notification(NOTIFICATION_THEME_CHANGED);
- p_at->minimum_size_changed();
- p_at->update();
- for (int i = 0; i < p_at->get_child_count(); i++) {
- Control *a = Object::cast_to<Control>(p_at->get_child(i));
- if (a) {
- _propagate_redraw(a);
+ for (int i = 0; i < preview_tabs_content->get_child_count(); i++) {
+ ThemeEditorPreview *preview_tab = Object::cast_to<ThemeEditorPreview>(preview_tabs_content->get_child(i));
+ if (!preview_tab) {
+ continue;
}
+
+ preview_tab->set_preview_theme(p_theme);
}
+
+ theme_name->set_text(TTR("Theme") + ": " + theme->get_path().get_file());
+}
+
+Ref<Theme> ThemeEditor::get_edited_theme() {
+ return theme;
}
-void ThemeEditor::_refresh_interval() {
- _propagate_redraw(main_panel);
- _propagate_redraw(main_container);
+void ThemeEditor::_theme_save_button_cbk(bool p_save_as) {
+ ERR_FAIL_COND_MSG(theme.is_null(), "Invalid state of the Theme Editor; the Theme resource is missing.");
+
+ if (p_save_as) {
+ EditorNode::get_singleton()->save_resource_as(theme);
+ } else {
+ EditorNode::get_singleton()->save_resource(theme);
+ }
}
void ThemeEditor::_theme_edit_button_cbk() {
theme_edit_dialog->popup_centered(Size2(850, 760) * EDSCALE);
}
+void ThemeEditor::_add_preview_button_cbk() {
+ preview_scene_dialog->popup_file_dialog();
+}
+
+void ThemeEditor::_preview_scene_dialog_cbk(const String &p_path) {
+ SceneThemeEditorPreview *preview_tab = memnew(SceneThemeEditorPreview);
+ if (!preview_tab->set_preview_scene(p_path)) {
+ return;
+ }
+
+ _add_preview_tab(preview_tab, p_path.get_file(), get_theme_icon("PackedScene", "EditorIcons"));
+ preview_tab->connect("scene_invalidated", callable_mp(this, &ThemeEditor::_remove_preview_tab_invalid), varray(preview_tab));
+ preview_tab->connect("scene_reloaded", callable_mp(this, &ThemeEditor::_update_preview_tab), varray(preview_tab));
+}
+
+void ThemeEditor::_add_preview_tab(ThemeEditorPreview *p_preview_tab, const String &p_preview_name, const Ref<Texture2D> &p_icon) {
+ p_preview_tab->set_preview_theme(theme);
+
+ preview_tabs->add_tab(p_preview_name, p_icon);
+ preview_tabs_content->add_child(p_preview_tab);
+ preview_tabs->set_tab_right_button(preview_tabs->get_tab_count() - 1, EditorNode::get_singleton()->get_gui_base()->get_theme_icon("close", "Tabs"));
+ p_preview_tab->connect("control_picked", callable_mp(this, &ThemeEditor::_preview_control_picked));
+
+ preview_tabs->set_current_tab(preview_tabs->get_tab_count() - 1);
+}
+
+void ThemeEditor::_change_preview_tab(int p_tab) {
+ ERR_FAIL_INDEX_MSG(p_tab, preview_tabs_content->get_child_count(), "Attempting to open a preview tab that doesn't exist.");
+
+ for (int i = 0; i < preview_tabs_content->get_child_count(); i++) {
+ Control *c = Object::cast_to<Control>(preview_tabs_content->get_child(i));
+ if (!c) {
+ continue;
+ }
+
+ c->set_visible(i == p_tab);
+ }
+}
+
+void ThemeEditor::_remove_preview_tab(int p_tab) {
+ ERR_FAIL_INDEX_MSG(p_tab, preview_tabs_content->get_child_count(), "Attempting to remove a preview tab that doesn't exist.");
+
+ ThemeEditorPreview *preview_tab = Object::cast_to<ThemeEditorPreview>(preview_tabs_content->get_child(p_tab));
+ ERR_FAIL_COND_MSG(Object::cast_to<DefaultThemeEditorPreview>(preview_tab), "Attemptying to remove the default preview tab.");
+
+ if (preview_tab) {
+ preview_tab->disconnect("control_picked", callable_mp(this, &ThemeEditor::_preview_control_picked));
+ if (preview_tab->is_connected("scene_invalidated", callable_mp(this, &ThemeEditor::_remove_preview_tab_invalid))) {
+ preview_tab->disconnect("scene_invalidated", callable_mp(this, &ThemeEditor::_remove_preview_tab_invalid));
+ }
+ if (preview_tab->is_connected("scene_reloaded", callable_mp(this, &ThemeEditor::_update_preview_tab))) {
+ preview_tab->disconnect("scene_reloaded", callable_mp(this, &ThemeEditor::_update_preview_tab));
+ }
+
+ preview_tabs_content->remove_child(preview_tab);
+ preview_tabs->remove_tab(p_tab);
+ _change_preview_tab(preview_tabs->get_current_tab());
+ }
+}
+
+void ThemeEditor::_remove_preview_tab_invalid(Node *p_tab_control) {
+ int tab_index = p_tab_control->get_index();
+ _remove_preview_tab(tab_index);
+}
+
+void ThemeEditor::_update_preview_tab(Node *p_tab_control) {
+ if (!Object::cast_to<SceneThemeEditorPreview>(p_tab_control)) {
+ return;
+ }
+
+ int tab_index = p_tab_control->get_index();
+ SceneThemeEditorPreview *scene_preview = Object::cast_to<SceneThemeEditorPreview>(p_tab_control);
+ preview_tabs->set_tab_title(tab_index, scene_preview->get_preview_scene_path().get_file());
+}
+
+void ThemeEditor::_preview_control_picked(String p_class_name) {
+ theme_type_editor->select_type(p_class_name);
+}
+
void ThemeEditor::_notification(int p_what) {
switch (p_what) {
- case NOTIFICATION_PROCESS: {
- time_left -= get_process_delta_time();
- if (time_left < 0) {
- time_left = 1.5;
- _refresh_interval();
- }
+ case NOTIFICATION_ENTER_TREE:
+ case NOTIFICATION_THEME_CHANGED: {
+ preview_tabs->add_theme_style_override("tab_selected", get_theme_stylebox("ThemeEditorPreviewFG", "EditorStyles"));
+ preview_tabs->add_theme_style_override("tab_unselected", get_theme_stylebox("ThemeEditorPreviewBG", "EditorStyles"));
+ preview_tabs_content->add_theme_style_override("panel", get_theme_stylebox("panel_odd", "TabContainer"));
+
+ add_preview_button->set_icon(get_theme_icon("Add", "EditorIcons"));
} break;
}
}
-void ThemeEditor::_bind_methods() {
-}
-
ThemeEditor::ThemeEditor() {
HBoxContainer *top_menu = memnew(HBoxContainer);
add_child(top_menu);
- top_menu->add_child(memnew(Label(TTR("Preview:"))));
+ theme_name = memnew(Label);
+ theme_name->set_text(TTR("Theme") + ": ");
+ top_menu->add_child(theme_name);
+
top_menu->add_spacer(false);
- theme_edit_button = memnew(Button);
- theme_edit_button->set_text(TTR("Manage Items"));
+ Button *theme_save_button = memnew(Button);
+ theme_save_button->set_text(TTR("Save"));
+ theme_save_button->set_flat(true);
+ theme_save_button->connect("pressed", callable_mp(this, &ThemeEditor::_theme_save_button_cbk), varray(false));
+ top_menu->add_child(theme_save_button);
+
+ Button *theme_save_as_button = memnew(Button);
+ theme_save_as_button->set_text(TTR("Save As..."));
+ theme_save_as_button->set_flat(true);
+ theme_save_as_button->connect("pressed", callable_mp(this, &ThemeEditor::_theme_save_button_cbk), varray(true));
+ top_menu->add_child(theme_save_as_button);
+
+ top_menu->add_child(memnew(VSeparator));
+
+ Button *theme_edit_button = memnew(Button);
+ theme_edit_button->set_text(TTR("Manage Items..."));
theme_edit_button->set_tooltip(TTR("Add, remove, organize and import Theme items."));
theme_edit_button->set_flat(true);
theme_edit_button->connect("pressed", callable_mp(this, &ThemeEditor::_theme_edit_button_cbk));
top_menu->add_child(theme_edit_button);
- ScrollContainer *scroll = memnew(ScrollContainer);
- add_child(scroll);
- scroll->set_enable_v_scroll(true);
- scroll->set_enable_h_scroll(true);
- scroll->set_v_size_flags(SIZE_EXPAND_FILL);
-
- MarginContainer *root_container = memnew(MarginContainer);
- scroll->add_child(root_container);
- root_container->set_theme(Theme::get_default());
- root_container->set_clip_contents(true);
- root_container->set_custom_minimum_size(Size2(700, 0) * EDSCALE);
- root_container->set_v_size_flags(SIZE_EXPAND_FILL);
- root_container->set_h_size_flags(SIZE_EXPAND_FILL);
-
- //// Preview Controls ////
-
- main_panel = memnew(Panel);
- root_container->add_child(main_panel);
-
- main_container = memnew(MarginContainer);
- root_container->add_child(main_container);
- main_container->add_theme_constant_override("margin_right", 4 * EDSCALE);
- main_container->add_theme_constant_override("margin_top", 4 * EDSCALE);
- main_container->add_theme_constant_override("margin_left", 4 * EDSCALE);
- main_container->add_theme_constant_override("margin_bottom", 4 * EDSCALE);
-
- HBoxContainer *main_hb = memnew(HBoxContainer);
- main_container->add_child(main_hb);
-
- VBoxContainer *first_vb = memnew(VBoxContainer);
- main_hb->add_child(first_vb);
- first_vb->set_h_size_flags(SIZE_EXPAND_FILL);
- first_vb->add_theme_constant_override("separation", 10 * EDSCALE);
-
- first_vb->add_child(memnew(Label("Label")));
-
- first_vb->add_child(memnew(Button("Button")));
- Button *bt = memnew(Button);
- bt->set_text(TTR("Toggle Button"));
- bt->set_toggle_mode(true);
- bt->set_pressed(true);
- first_vb->add_child(bt);
- bt = memnew(Button);
- bt->set_text(TTR("Disabled Button"));
- bt->set_disabled(true);
- first_vb->add_child(bt);
- Button *tb = memnew(Button);
- tb->set_flat(true);
- tb->set_text("Button");
- first_vb->add_child(tb);
-
- CheckButton *cb = memnew(CheckButton);
- cb->set_text("CheckButton");
- first_vb->add_child(cb);
- CheckBox *cbx = memnew(CheckBox);
- cbx->set_text("CheckBox");
- first_vb->add_child(cbx);
-
- MenuButton *test_menu_button = memnew(MenuButton);
- test_menu_button->set_text("MenuButton");
- test_menu_button->get_popup()->add_item(TTR("Item"));
- test_menu_button->get_popup()->add_item(TTR("Disabled Item"));
- test_menu_button->get_popup()->set_item_disabled(1, true);
- test_menu_button->get_popup()->add_separator();
- test_menu_button->get_popup()->add_check_item(TTR("Check Item"));
- test_menu_button->get_popup()->add_check_item(TTR("Checked Item"));
- test_menu_button->get_popup()->set_item_checked(4, true);
- test_menu_button->get_popup()->add_separator();
- test_menu_button->get_popup()->add_radio_check_item(TTR("Radio Item"));
- test_menu_button->get_popup()->add_radio_check_item(TTR("Checked Radio Item"));
- test_menu_button->get_popup()->set_item_checked(7, true);
- test_menu_button->get_popup()->add_separator(TTR("Named Sep."));
-
- PopupMenu *test_submenu = memnew(PopupMenu);
- test_menu_button->get_popup()->add_child(test_submenu);
- test_submenu->set_name("submenu");
- test_menu_button->get_popup()->add_submenu_item(TTR("Submenu"), "submenu");
- test_submenu->add_item(TTR("Subitem 1"));
- test_submenu->add_item(TTR("Subitem 2"));
- first_vb->add_child(test_menu_button);
-
- OptionButton *test_option_button = memnew(OptionButton);
- test_option_button->add_item("OptionButton");
- test_option_button->add_separator();
- test_option_button->add_item(TTR("Has"));
- test_option_button->add_item(TTR("Many"));
- test_option_button->add_item(TTR("Options"));
- first_vb->add_child(test_option_button);
- first_vb->add_child(memnew(ColorPickerButton));
-
- VBoxContainer *second_vb = memnew(VBoxContainer);
- second_vb->set_h_size_flags(SIZE_EXPAND_FILL);
- main_hb->add_child(second_vb);
- second_vb->add_theme_constant_override("separation", 10 * EDSCALE);
- LineEdit *le = memnew(LineEdit);
- le->set_text("LineEdit");
- second_vb->add_child(le);
- le = memnew(LineEdit);
- le->set_text(TTR("Disabled LineEdit"));
- le->set_editable(false);
- second_vb->add_child(le);
- TextEdit *te = memnew(TextEdit);
- te->set_text("TextEdit");
- te->set_custom_minimum_size(Size2(0, 100) * EDSCALE);
- second_vb->add_child(te);
- second_vb->add_child(memnew(SpinBox));
-
- HBoxContainer *vhb = memnew(HBoxContainer);
- second_vb->add_child(vhb);
- vhb->set_custom_minimum_size(Size2(0, 100) * EDSCALE);
- vhb->add_child(memnew(VSlider));
- VScrollBar *vsb = memnew(VScrollBar);
- vsb->set_page(25);
- vhb->add_child(vsb);
- vhb->add_child(memnew(VSeparator));
- VBoxContainer *hvb = memnew(VBoxContainer);
- vhb->add_child(hvb);
- hvb->set_alignment(ALIGN_CENTER);
- hvb->set_h_size_flags(SIZE_EXPAND_FILL);
- hvb->add_child(memnew(HSlider));
- HScrollBar *hsb = memnew(HScrollBar);
- hsb->set_page(25);
- hvb->add_child(hsb);
- HSlider *hs = memnew(HSlider);
- hs->set_editable(false);
- hvb->add_child(hs);
- hvb->add_child(memnew(HSeparator));
- ProgressBar *pb = memnew(ProgressBar);
- pb->set_value(50);
- hvb->add_child(pb);
-
- VBoxContainer *third_vb = memnew(VBoxContainer);
- third_vb->set_h_size_flags(SIZE_EXPAND_FILL);
- third_vb->add_theme_constant_override("separation", 10 * EDSCALE);
- main_hb->add_child(third_vb);
-
- TabContainer *tc = memnew(TabContainer);
- third_vb->add_child(tc);
- tc->set_custom_minimum_size(Size2(0, 135) * EDSCALE);
- Control *tcc = memnew(Control);
- tcc->set_name(TTR("Tab 1"));
- tc->add_child(tcc);
- tcc = memnew(Control);
- tcc->set_name(TTR("Tab 2"));
- tc->add_child(tcc);
- tcc = memnew(Control);
- tcc->set_name(TTR("Tab 3"));
- tc->add_child(tcc);
- tc->set_tab_disabled(2, true);
-
- Tree *test_tree = memnew(Tree);
- third_vb->add_child(test_tree);
- test_tree->set_custom_minimum_size(Size2(0, 175) * EDSCALE);
- test_tree->add_theme_constant_override("draw_relationship_lines", 1);
-
- TreeItem *item = test_tree->create_item();
- item->set_text(0, "Tree");
- item = test_tree->create_item(test_tree->get_root());
- item->set_text(0, "Item");
- item = test_tree->create_item(test_tree->get_root());
- item->set_editable(0, true);
- item->set_text(0, TTR("Editable Item"));
- TreeItem *sub_tree = test_tree->create_item(test_tree->get_root());
- sub_tree->set_text(0, TTR("Subtree"));
- item = test_tree->create_item(sub_tree);
- item->set_cell_mode(0, TreeItem::CELL_MODE_CHECK);
- item->set_editable(0, true);
- item->set_text(0, "Check Item");
- item = test_tree->create_item(sub_tree);
- item->set_cell_mode(0, TreeItem::CELL_MODE_RANGE);
- item->set_editable(0, true);
- item->set_range_config(0, 0, 20, 0.1);
- item->set_range(0, 2);
- item = test_tree->create_item(sub_tree);
- item->set_cell_mode(0, TreeItem::CELL_MODE_RANGE);
- item->set_editable(0, true);
- item->set_text(0, TTR("Has,Many,Options"));
- item->set_range(0, 2);
-
- main_hb->add_theme_constant_override("separation", 20 * EDSCALE);
-
theme_edit_dialog = memnew(ThemeItemEditorDialog);
theme_edit_dialog->hide();
- add_child(theme_edit_dialog);
+ top_menu->add_child(theme_edit_dialog);
+
+ HSplitContainer *main_hs = memnew(HSplitContainer);
+ main_hs->set_v_size_flags(SIZE_EXPAND_FILL);
+ add_child(main_hs);
+
+ VBoxContainer *preview_tabs_vb = memnew(VBoxContainer);
+ preview_tabs_vb->set_h_size_flags(SIZE_EXPAND_FILL);
+ preview_tabs_vb->set_custom_minimum_size(Size2(520, 0) * EDSCALE);
+ preview_tabs_vb->add_theme_constant_override("separation", 2 * EDSCALE);
+ main_hs->add_child(preview_tabs_vb);
+ HBoxContainer *preview_tabbar_hb = memnew(HBoxContainer);
+ preview_tabs_vb->add_child(preview_tabbar_hb);
+ preview_tabs_content = memnew(PanelContainer);
+ preview_tabs_content->set_v_size_flags(SIZE_EXPAND_FILL);
+ preview_tabs_content->set_draw_behind_parent(true);
+ preview_tabs_vb->add_child(preview_tabs_content);
+
+ preview_tabs = memnew(Tabs);
+ preview_tabs->set_tab_align(Tabs::ALIGN_LEFT);
+ preview_tabs->set_h_size_flags(SIZE_EXPAND_FILL);
+ preview_tabbar_hb->add_child(preview_tabs);
+ preview_tabs->connect("tab_changed", callable_mp(this, &ThemeEditor::_change_preview_tab));
+ preview_tabs->connect("right_button_pressed", callable_mp(this, &ThemeEditor::_remove_preview_tab));
+
+ HBoxContainer *add_preview_button_hb = memnew(HBoxContainer);
+ preview_tabbar_hb->add_child(add_preview_button_hb);
+ add_preview_button = memnew(Button);
+ add_preview_button->set_text(TTR("Add Preview"));
+ add_preview_button_hb->add_child(add_preview_button);
+ add_preview_button->connect("pressed", callable_mp(this, &ThemeEditor::_add_preview_button_cbk));
+
+ DefaultThemeEditorPreview *default_preview_tab = memnew(DefaultThemeEditorPreview);
+ preview_tabs_content->add_child(default_preview_tab);
+ default_preview_tab->connect("control_picked", callable_mp(this, &ThemeEditor::_preview_control_picked));
+ preview_tabs->add_tab(TTR("Default Preview"));
+
+ preview_scene_dialog = memnew(EditorFileDialog);
+ preview_scene_dialog->set_file_mode(EditorFileDialog::FILE_MODE_OPEN_FILE);
+ preview_scene_dialog->set_title(TTR("Select UI Scene:"));
+ List<String> ext;
+ ResourceLoader::get_recognized_extensions_for_type("PackedScene", &ext);
+ for (List<String>::Element *E = ext.front(); E; E = E->next()) {
+ preview_scene_dialog->add_filter("*." + E->get() + "; Scene");
+ }
+ main_hs->add_child(preview_scene_dialog);
+ preview_scene_dialog->connect("file_selected", callable_mp(this, &ThemeEditor::_preview_scene_dialog_cbk));
+
+ theme_type_editor = memnew(ThemeTypeEditor);
+ main_hs->add_child(theme_type_editor);
+ theme_type_editor->set_custom_minimum_size(Size2(360, 0) * EDSCALE);
}
void ThemeEditorPlugin::edit(Object *p_node) {
if (Object::cast_to<Theme>(p_node)) {
theme_editor->edit(Object::cast_to<Theme>(p_node));
+ } else if (Object::cast_to<Font>(p_node) || Object::cast_to<StyleBox>(p_node) || Object::cast_to<Texture2D>(p_node)) {
+ // Do nothing, keep editing the existing theme.
} else {
theme_editor->edit(Ref<Theme>());
}
}
bool ThemeEditorPlugin::handles(Object *p_node) const {
- return p_node->is_class("Theme");
+ if (Object::cast_to<Theme>(p_node)) {
+ return true;
+ }
+
+ Ref<Theme> edited_theme = theme_editor->get_edited_theme();
+ if (edited_theme.is_null()) {
+ return false;
+ }
+
+ // If we are editing a theme already and this particular resource happens to belong to it,
+ // then we just keep editing it, despite not being able to directly handle it.
+ // This only goes one layer deep, but if required this can be extended to support, say, FontData inside of Font.
+ bool belongs_to_theme = false;
+
+ if (Object::cast_to<Font>(p_node)) {
+ Ref<Font> font_item = Object::cast_to<Font>(p_node);
+ List<StringName> types;
+ List<StringName> names;
+
+ edited_theme->get_font_type_list(&types);
+ for (List<StringName>::Element *E = types.front(); E; E = E->next()) {
+ names.clear();
+ edited_theme->get_font_list(E->get(), &names);
+
+ for (List<StringName>::Element *F = names.front(); F; F = F->next()) {
+ if (font_item == edited_theme->get_font(F->get(), E->get())) {
+ belongs_to_theme = true;
+ break;
+ }
+ }
+ }
+ } else if (Object::cast_to<StyleBox>(p_node)) {
+ Ref<StyleBox> stylebox_item = Object::cast_to<StyleBox>(p_node);
+ List<StringName> types;
+ List<StringName> names;
+
+ edited_theme->get_stylebox_type_list(&types);
+ for (List<StringName>::Element *E = types.front(); E; E = E->next()) {
+ names.clear();
+ edited_theme->get_stylebox_list(E->get(), &names);
+
+ for (List<StringName>::Element *F = names.front(); F; F = F->next()) {
+ if (stylebox_item == edited_theme->get_stylebox(F->get(), E->get())) {
+ belongs_to_theme = true;
+ break;
+ }
+ }
+ }
+ } else if (Object::cast_to<Texture2D>(p_node)) {
+ Ref<Texture2D> icon_item = Object::cast_to<Texture2D>(p_node);
+ List<StringName> types;
+ List<StringName> names;
+
+ edited_theme->get_icon_type_list(&types);
+ for (List<StringName>::Element *E = types.front(); E; E = E->next()) {
+ names.clear();
+ edited_theme->get_icon_list(E->get(), &names);
+
+ for (List<StringName>::Element *F = names.front(); F; F = F->next()) {
+ if (icon_item == edited_theme->get_icon(F->get(), E->get())) {
+ belongs_to_theme = true;
+ break;
+ }
+ }
+ }
+ }
+
+ return belongs_to_theme;
}
void ThemeEditorPlugin::make_visible(bool p_visible) {
if (p_visible) {
- theme_editor->set_process(true);
button->show();
editor->make_bottom_panel_item_visible(theme_editor);
} else {
- theme_editor->set_process(false);
if (theme_editor->is_visible_in_tree()) {
editor->hide_bottom_panel();
}
diff --git a/editor/plugins/theme_editor_plugin.h b/editor/plugins/theme_editor_plugin.h
index c42ebf1a19..77baf46395 100644
--- a/editor/plugins/theme_editor_plugin.h
+++ b/editor/plugins/theme_editor_plugin.h
@@ -31,13 +31,13 @@
#ifndef THEME_EDITOR_PLUGIN_H
#define THEME_EDITOR_PLUGIN_H
-#include "scene/gui/check_box.h"
-#include "scene/gui/file_dialog.h"
#include "scene/gui/margin_container.h"
#include "scene/gui/option_button.h"
#include "scene/gui/scroll_container.h"
+#include "scene/gui/tabs.h"
#include "scene/gui/texture_rect.h"
#include "scene/resources/theme.h"
+#include "theme_editor_preview.h"
#include "editor/editor_node.h"
@@ -263,30 +263,123 @@ public:
ThemeItemEditorDialog();
};
+class ThemeTypeEditor : public MarginContainer {
+ GDCLASS(ThemeTypeEditor, MarginContainer);
+
+ Ref<Theme> edited_theme;
+ String edited_type;
+ bool updating = false;
+
+ struct LeadingStylebox {
+ bool pinned = false;
+ StringName item_name;
+ Ref<StyleBox> stylebox;
+ Ref<StyleBox> ref_stylebox;
+ };
+
+ LeadingStylebox leading_stylebox;
+
+ OptionButton *theme_type_list;
+ Button *add_type_button;
+ ConfirmationDialog *add_type_dialog;
+ LineEdit *add_type_filter;
+ ItemList *add_type_options;
+
+ CheckButton *show_default_items_button;
+
+ TabContainer *data_type_tabs;
+ VBoxContainer *color_items_list;
+ VBoxContainer *constant_items_list;
+ VBoxContainer *font_items_list;
+ VBoxContainer *font_size_items_list;
+ VBoxContainer *icon_items_list;
+ VBoxContainer *stylebox_items_list;
+
+ Vector<Control *> focusables;
+ Timer *update_debounce_timer;
+
+ VBoxContainer *_create_item_list(Theme::DataType p_data_type);
+ void _update_type_list();
+ void _update_type_list_debounced();
+ void _update_add_type_options(const String &p_filter = "");
+ OrderedHashMap<StringName, bool> _get_type_items(String p_type_name, void (Theme::*get_list_func)(StringName, List<StringName> *) const, bool include_default);
+ HBoxContainer *_create_property_control(Theme::DataType p_data_type, String p_item_name, bool p_editable);
+ void _add_focusable(Control *p_control);
+ void _update_type_items();
+
+ void _list_type_selected(int p_index);
+ void _select_type(String p_type_name);
+ void _add_type_button_cbk();
+ void _add_type_filter_cbk(const String &p_value);
+ void _add_type_options_cbk(int p_index);
+ void _add_type_dialog_confirmed();
+ void _add_type_dialog_entered(const String &p_value);
+ void _add_type_dialog_activated(int p_index);
+ void _add_default_type_items();
+
+ void _item_add_cbk(int p_data_type, Control *p_control);
+ void _item_add_lineedit_cbk(String p_value, int p_data_type, Control *p_control);
+ void _item_override_cbk(int p_data_type, String p_item_name);
+ void _item_remove_cbk(int p_data_type, String p_item_name);
+ void _item_rename_cbk(int p_data_type, String p_item_name, Control *p_control);
+ void _item_rename_confirmed(int p_data_type, String p_item_name, Control *p_control);
+ void _item_rename_entered(String p_value, int p_data_type, String p_item_name, Control *p_control);
+ void _item_rename_canceled(int p_data_type, String p_item_name, Control *p_control);
+
+ void _color_item_changed(Color p_value, String p_item_name);
+ void _constant_item_changed(float p_value, String p_item_name);
+ void _font_size_item_changed(float p_value, String p_item_name);
+ void _edit_resource_item(RES p_resource, Control *p_editor);
+ void _font_item_changed(Ref<Font> p_value, String p_item_name);
+ void _icon_item_changed(Ref<Texture2D> p_value, String p_item_name);
+ void _stylebox_item_changed(Ref<StyleBox> p_value, String p_item_name);
+ void _pin_leading_stylebox(Ref<StyleBox> p_stylebox, String p_item_name);
+ void _unpin_leading_stylebox();
+ void _update_stylebox_from_leading();
+
+protected:
+ void _notification(int p_what);
+
+public:
+ void set_edited_theme(const Ref<Theme> &p_theme);
+ void select_type(String p_type_name);
+
+ ThemeTypeEditor();
+};
+
class ThemeEditor : public VBoxContainer {
GDCLASS(ThemeEditor, VBoxContainer);
Ref<Theme> theme;
- double time_left = 0;
+ Tabs *preview_tabs;
+ PanelContainer *preview_tabs_content;
+ Button *add_preview_button;
+ EditorFileDialog *preview_scene_dialog;
- Button *theme_edit_button;
- ThemeItemEditorDialog *theme_edit_dialog;
+ ThemeTypeEditor *theme_type_editor;
- Panel *main_panel;
- MarginContainer *main_container;
- Tree *test_tree;
+ Label *theme_name;
+ ThemeItemEditorDialog *theme_edit_dialog;
+ void _theme_save_button_cbk(bool p_save_as);
void _theme_edit_button_cbk();
- void _propagate_redraw(Control *p_at);
- void _refresh_interval();
+
+ void _add_preview_button_cbk();
+ void _preview_scene_dialog_cbk(const String &p_path);
+ void _add_preview_tab(ThemeEditorPreview *p_preview_tab, const String &p_preview_name, const Ref<Texture2D> &p_icon);
+ void _change_preview_tab(int p_tab);
+ void _remove_preview_tab(int p_tab);
+ void _remove_preview_tab_invalid(Node *p_tab_control);
+ void _update_preview_tab(Node *p_tab_control);
+ void _preview_control_picked(String p_class_name);
protected:
void _notification(int p_what);
- static void _bind_methods();
public:
void edit(const Ref<Theme> &p_theme);
+ Ref<Theme> get_edited_theme();
ThemeEditor();
};
diff --git a/editor/plugins/theme_editor_preview.cpp b/editor/plugins/theme_editor_preview.cpp
new file mode 100644
index 0000000000..766f8508c1
--- /dev/null
+++ b/editor/plugins/theme_editor_preview.cpp
@@ -0,0 +1,464 @@
+/*************************************************************************/
+/* theme_editor_preview.cpp */
+/*************************************************************************/
+/* This file is part of: */
+/* GODOT ENGINE */
+/* https://godotengine.org */
+/*************************************************************************/
+/* Copyright (c) 2007-2021 Juan Linietsky, Ariel Manzur. */
+/* Copyright (c) 2014-2021 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 "theme_editor_preview.h"
+
+#include "core/input/input.h"
+#include "core/math/math_funcs.h"
+#include "scene/resources/packed_scene.h"
+
+#include "editor/editor_scale.h"
+
+void ThemeEditorPreview::set_preview_theme(const Ref<Theme> &p_theme) {
+ preview_content->set_theme(p_theme);
+}
+
+void ThemeEditorPreview::add_preview_overlay(Control *p_overlay) {
+ preview_overlay->add_child(p_overlay);
+ p_overlay->hide();
+}
+
+void ThemeEditorPreview::_propagate_redraw(Control *p_at) {
+ p_at->notification(NOTIFICATION_THEME_CHANGED);
+ p_at->minimum_size_changed();
+ p_at->update();
+ for (int i = 0; i < p_at->get_child_count(); i++) {
+ Control *a = Object::cast_to<Control>(p_at->get_child(i));
+ if (a) {
+ _propagate_redraw(a);
+ }
+ }
+}
+
+void ThemeEditorPreview::_refresh_interval() {
+ // In case the project settings have changed.
+ preview_bg->set_color(GLOBAL_GET("rendering/environment/defaults/default_clear_color"));
+
+ _propagate_redraw(preview_bg);
+ _propagate_redraw(preview_content);
+}
+
+void ThemeEditorPreview::_preview_visibility_changed() {
+ set_process(is_visible());
+}
+
+void ThemeEditorPreview::_picker_button_cbk() {
+ picker_overlay->set_visible(picker_button->is_pressed());
+}
+
+Control *ThemeEditorPreview::_find_hovered_control(Control *p_parent, Vector2 p_mouse_position) {
+ Control *found = nullptr;
+
+ for (int i = 0; i < p_parent->get_child_count(); i++) {
+ Control *cc = Object::cast_to<Control>(p_parent->get_child(i));
+ if (!cc || !cc->is_visible()) {
+ continue;
+ }
+
+ Rect2 crect = cc->get_rect();
+ if (crect.has_point(p_mouse_position)) {
+ // Check if there is a child control under mouse.
+ if (cc->get_child_count() > 0) {
+ found = _find_hovered_control(cc, p_mouse_position - cc->get_position());
+ }
+
+ // If there are no applicable children, use the control itself.
+ if (!found) {
+ found = cc;
+ }
+ break;
+ }
+ }
+
+ return found;
+}
+
+void ThemeEditorPreview::_draw_picker_overlay() {
+ if (!picker_button->is_pressed()) {
+ return;
+ }
+
+ picker_overlay->draw_rect(Rect2(Vector2(0.0, 0.0), picker_overlay->get_size()), get_theme_color("preview_picker_overlay_color", "ThemeEditor"));
+ if (hovered_control) {
+ Rect2 highlight_rect = hovered_control->get_global_rect();
+ highlight_rect.position = picker_overlay->get_global_transform().affine_inverse().xform(highlight_rect.position);
+
+ picker_overlay->draw_style_box(get_theme_stylebox("preview_picker_overlay", "ThemeEditor"), highlight_rect);
+ }
+}
+
+void ThemeEditorPreview::_gui_input_picker_overlay(const Ref<InputEvent> &p_event) {
+ if (!picker_button->is_pressed()) {
+ return;
+ }
+
+ Ref<InputEventMouseButton> mb = p_event;
+
+ if (mb.is_valid() && mb->is_pressed() && mb->get_button_index() == MOUSE_BUTTON_LEFT) {
+ if (hovered_control) {
+ StringName theme_type = hovered_control->get_theme_custom_type();
+ if (theme_type == StringName()) {
+ theme_type = hovered_control->get_class_name();
+ }
+
+ emit_signal("control_picked", theme_type);
+ picker_button->set_pressed(false);
+ picker_overlay->set_visible(false);
+ }
+ }
+
+ Ref<InputEventMouseMotion> mm = p_event;
+
+ if (mm.is_valid()) {
+ Vector2 mp = preview_content->get_local_mouse_position();
+ hovered_control = _find_hovered_control(preview_content, mp);
+ picker_overlay->update();
+ }
+}
+
+void ThemeEditorPreview::_notification(int p_what) {
+ switch (p_what) {
+ case NOTIFICATION_ENTER_TREE: {
+ if (is_visible_in_tree()) {
+ set_process(true);
+ }
+
+ connect("visibility_changed", callable_mp(this, &ThemeEditorPreview::_preview_visibility_changed));
+ [[fallthrough]];
+ }
+ case NOTIFICATION_THEME_CHANGED: {
+ picker_button->set_icon(get_theme_icon("ColorPick", "EditorIcons"));
+ } break;
+ case NOTIFICATION_PROCESS: {
+ time_left -= get_process_delta_time();
+ if (time_left < 0) {
+ time_left = 1.5;
+ _refresh_interval();
+ }
+ } break;
+ }
+}
+
+void ThemeEditorPreview::_bind_methods() {
+ ADD_SIGNAL(MethodInfo("control_picked", PropertyInfo(Variant::STRING, "class_name")));
+}
+
+ThemeEditorPreview::ThemeEditorPreview() {
+ preview_toolbar = memnew(HBoxContainer);
+ add_child(preview_toolbar);
+
+ picker_button = memnew(Button);
+ preview_toolbar->add_child(picker_button);
+ picker_button->set_flat(true);
+ picker_button->set_toggle_mode(true);
+ picker_button->set_tooltip(TTR("Toggle the control picker, allowing to visually select control types for edit."));
+ picker_button->connect("pressed", callable_mp(this, &ThemeEditorPreview::_picker_button_cbk));
+
+ MarginContainer *preview_body = memnew(MarginContainer);
+ preview_body->set_custom_minimum_size(Size2(480, 0) * EDSCALE);
+ preview_body->set_v_size_flags(SIZE_EXPAND_FILL);
+ add_child(preview_body);
+
+ ScrollContainer *preview_container = memnew(ScrollContainer);
+ preview_container->set_enable_v_scroll(true);
+ preview_container->set_enable_h_scroll(true);
+ preview_body->add_child(preview_container);
+
+ MarginContainer *preview_root = memnew(MarginContainer);
+ preview_container->add_child(preview_root);
+ preview_root->set_theme(Theme::get_default());
+ preview_root->set_clip_contents(true);
+ preview_root->set_custom_minimum_size(Size2(450, 0) * EDSCALE);
+ preview_root->set_v_size_flags(SIZE_EXPAND_FILL);
+ preview_root->set_h_size_flags(SIZE_EXPAND_FILL);
+
+ preview_bg = memnew(ColorRect);
+ preview_bg->set_anchors_and_offsets_preset(PRESET_WIDE);
+ preview_bg->set_color(GLOBAL_GET("rendering/environment/defaults/default_clear_color"));
+ preview_root->add_child(preview_bg);
+
+ preview_content = memnew(MarginContainer);
+ preview_root->add_child(preview_content);
+ preview_content->add_theme_constant_override("margin_right", 4 * EDSCALE);
+ preview_content->add_theme_constant_override("margin_top", 4 * EDSCALE);
+ preview_content->add_theme_constant_override("margin_left", 4 * EDSCALE);
+ preview_content->add_theme_constant_override("margin_bottom", 4 * EDSCALE);
+
+ preview_overlay = memnew(MarginContainer);
+ preview_overlay->set_mouse_filter(MOUSE_FILTER_IGNORE);
+ preview_body->add_child(preview_overlay);
+
+ picker_overlay = memnew(Control);
+ add_preview_overlay(picker_overlay);
+ picker_overlay->connect("draw", callable_mp(this, &ThemeEditorPreview::_draw_picker_overlay));
+ picker_overlay->connect("gui_input", callable_mp(this, &ThemeEditorPreview::_gui_input_picker_overlay));
+}
+
+DefaultThemeEditorPreview::DefaultThemeEditorPreview() {
+ Panel *main_panel = memnew(Panel);
+ preview_content->add_child(main_panel);
+
+ MarginContainer *main_mc = memnew(MarginContainer);
+ main_mc->add_theme_constant_override("margin_right", 4 * EDSCALE);
+ main_mc->add_theme_constant_override("margin_top", 4 * EDSCALE);
+ main_mc->add_theme_constant_override("margin_left", 4 * EDSCALE);
+ main_mc->add_theme_constant_override("margin_bottom", 4 * EDSCALE);
+ preview_content->add_child(main_mc);
+
+ HBoxContainer *main_hb = memnew(HBoxContainer);
+ main_mc->add_child(main_hb);
+ main_hb->add_theme_constant_override("separation", 20 * EDSCALE);
+
+ VBoxContainer *first_vb = memnew(VBoxContainer);
+ main_hb->add_child(first_vb);
+ first_vb->set_h_size_flags(SIZE_EXPAND_FILL);
+ first_vb->add_theme_constant_override("separation", 10 * EDSCALE);
+
+ first_vb->add_child(memnew(Label("Label")));
+
+ first_vb->add_child(memnew(Button("Button")));
+ Button *bt = memnew(Button);
+ bt->set_text(TTR("Toggle Button"));
+ bt->set_toggle_mode(true);
+ bt->set_pressed(true);
+ first_vb->add_child(bt);
+ bt = memnew(Button);
+ bt->set_text(TTR("Disabled Button"));
+ bt->set_disabled(true);
+ first_vb->add_child(bt);
+ Button *tb = memnew(Button);
+ tb->set_flat(true);
+ tb->set_text("Button");
+ first_vb->add_child(tb);
+
+ CheckButton *cb = memnew(CheckButton);
+ cb->set_text("CheckButton");
+ first_vb->add_child(cb);
+ CheckBox *cbx = memnew(CheckBox);
+ cbx->set_text("CheckBox");
+ first_vb->add_child(cbx);
+
+ MenuButton *test_menu_button = memnew(MenuButton);
+ test_menu_button->set_text("MenuButton");
+ test_menu_button->get_popup()->add_item(TTR("Item"));
+ test_menu_button->get_popup()->add_item(TTR("Disabled Item"));
+ test_menu_button->get_popup()->set_item_disabled(1, true);
+ test_menu_button->get_popup()->add_separator();
+ test_menu_button->get_popup()->add_check_item(TTR("Check Item"));
+ test_menu_button->get_popup()->add_check_item(TTR("Checked Item"));
+ test_menu_button->get_popup()->set_item_checked(4, true);
+ test_menu_button->get_popup()->add_separator();
+ test_menu_button->get_popup()->add_radio_check_item(TTR("Radio Item"));
+ test_menu_button->get_popup()->add_radio_check_item(TTR("Checked Radio Item"));
+ test_menu_button->get_popup()->set_item_checked(7, true);
+ test_menu_button->get_popup()->add_separator(TTR("Named Sep."));
+
+ PopupMenu *test_submenu = memnew(PopupMenu);
+ test_menu_button->get_popup()->add_child(test_submenu);
+ test_submenu->set_name("submenu");
+ test_menu_button->get_popup()->add_submenu_item(TTR("Submenu"), "submenu");
+ test_submenu->add_item(TTR("Subitem 1"));
+ test_submenu->add_item(TTR("Subitem 2"));
+ first_vb->add_child(test_menu_button);
+
+ OptionButton *test_option_button = memnew(OptionButton);
+ test_option_button->add_item("OptionButton");
+ test_option_button->add_separator();
+ test_option_button->add_item(TTR("Has"));
+ test_option_button->add_item(TTR("Many"));
+ test_option_button->add_item(TTR("Options"));
+ first_vb->add_child(test_option_button);
+ first_vb->add_child(memnew(ColorPickerButton));
+
+ VBoxContainer *second_vb = memnew(VBoxContainer);
+ second_vb->set_h_size_flags(SIZE_EXPAND_FILL);
+ main_hb->add_child(second_vb);
+ second_vb->add_theme_constant_override("separation", 10 * EDSCALE);
+ LineEdit *le = memnew(LineEdit);
+ le->set_text("LineEdit");
+ second_vb->add_child(le);
+ le = memnew(LineEdit);
+ le->set_text(TTR("Disabled LineEdit"));
+ le->set_editable(false);
+ second_vb->add_child(le);
+ TextEdit *te = memnew(TextEdit);
+ te->set_text("TextEdit");
+ te->set_custom_minimum_size(Size2(0, 100) * EDSCALE);
+ second_vb->add_child(te);
+ second_vb->add_child(memnew(SpinBox));
+
+ HBoxContainer *vhb = memnew(HBoxContainer);
+ second_vb->add_child(vhb);
+ vhb->set_custom_minimum_size(Size2(0, 100) * EDSCALE);
+ vhb->add_child(memnew(VSlider));
+ VScrollBar *vsb = memnew(VScrollBar);
+ vsb->set_page(25);
+ vhb->add_child(vsb);
+ vhb->add_child(memnew(VSeparator));
+ VBoxContainer *hvb = memnew(VBoxContainer);
+ vhb->add_child(hvb);
+ hvb->set_alignment(BoxContainer::ALIGN_CENTER);
+ hvb->set_h_size_flags(SIZE_EXPAND_FILL);
+ hvb->add_child(memnew(HSlider));
+ HScrollBar *hsb = memnew(HScrollBar);
+ hsb->set_page(25);
+ hvb->add_child(hsb);
+ HSlider *hs = memnew(HSlider);
+ hs->set_editable(false);
+ hvb->add_child(hs);
+ hvb->add_child(memnew(HSeparator));
+ ProgressBar *pb = memnew(ProgressBar);
+ pb->set_value(50);
+ hvb->add_child(pb);
+
+ VBoxContainer *third_vb = memnew(VBoxContainer);
+ third_vb->set_h_size_flags(SIZE_EXPAND_FILL);
+ third_vb->add_theme_constant_override("separation", 10 * EDSCALE);
+ main_hb->add_child(third_vb);
+
+ TabContainer *tc = memnew(TabContainer);
+ third_vb->add_child(tc);
+ tc->set_custom_minimum_size(Size2(0, 135) * EDSCALE);
+ Control *tcc = memnew(Control);
+ tcc->set_name(TTR("Tab 1"));
+ tc->add_child(tcc);
+ tcc = memnew(Control);
+ tcc->set_name(TTR("Tab 2"));
+ tc->add_child(tcc);
+ tcc = memnew(Control);
+ tcc->set_name(TTR("Tab 3"));
+ tc->add_child(tcc);
+ tc->set_tab_disabled(2, true);
+
+ Tree *test_tree = memnew(Tree);
+ third_vb->add_child(test_tree);
+ test_tree->set_custom_minimum_size(Size2(0, 175) * EDSCALE);
+
+ TreeItem *item = test_tree->create_item();
+ item->set_text(0, "Tree");
+ item = test_tree->create_item(test_tree->get_root());
+ item->set_text(0, "Item");
+ item = test_tree->create_item(test_tree->get_root());
+ item->set_editable(0, true);
+ item->set_text(0, TTR("Editable Item"));
+ TreeItem *sub_tree = test_tree->create_item(test_tree->get_root());
+ sub_tree->set_text(0, TTR("Subtree"));
+ item = test_tree->create_item(sub_tree);
+ item->set_cell_mode(0, TreeItem::CELL_MODE_CHECK);
+ item->set_editable(0, true);
+ item->set_text(0, "Check Item");
+ item = test_tree->create_item(sub_tree);
+ item->set_cell_mode(0, TreeItem::CELL_MODE_RANGE);
+ item->set_editable(0, true);
+ item->set_range_config(0, 0, 20, 0.1);
+ item->set_range(0, 2);
+ item = test_tree->create_item(sub_tree);
+ item->set_cell_mode(0, TreeItem::CELL_MODE_RANGE);
+ item->set_editable(0, true);
+ item->set_text(0, TTR("Has,Many,Options"));
+ item->set_range(0, 2);
+}
+
+void SceneThemeEditorPreview::_reload_scene() {
+ if (loaded_scene.is_null()) {
+ return;
+ }
+
+ if (loaded_scene->get_path().is_empty() || !ResourceLoader::exists(loaded_scene->get_path())) {
+ EditorNode::get_singleton()->show_warning(TTR("Invalid path, the PackedScene resource was probably moved or removed."));
+ emit_signal("scene_invalidated");
+ return;
+ }
+
+ for (int i = preview_content->get_child_count() - 1; i >= 0; i--) {
+ Node *node = preview_content->get_child(i);
+ node->queue_delete();
+ preview_content->remove_child(node);
+ }
+
+ Node *instance = loaded_scene->instance();
+ if (!instance || !Object::cast_to<Control>(instance)) {
+ EditorNode::get_singleton()->show_warning(TTR("Invalid PackedScene resource, must have a Control node at its root."));
+ emit_signal("scene_invalidated");
+ return;
+ }
+
+ preview_content->add_child(instance);
+ emit_signal("scene_reloaded");
+}
+
+void SceneThemeEditorPreview::_notification(int p_what) {
+ switch (p_what) {
+ case NOTIFICATION_ENTER_TREE:
+ case NOTIFICATION_THEME_CHANGED: {
+ reload_scene_button->set_icon(get_theme_icon("Reload", "EditorIcons"));
+ } break;
+ }
+}
+
+void SceneThemeEditorPreview::_bind_methods() {
+ ADD_SIGNAL(MethodInfo("scene_invalidated"));
+ ADD_SIGNAL(MethodInfo("scene_reloaded"));
+}
+
+bool SceneThemeEditorPreview::set_preview_scene(const String &p_path) {
+ loaded_scene = ResourceLoader::load(p_path);
+ if (loaded_scene.is_null()) {
+ EditorNode::get_singleton()->show_warning(TTR("Invalid file, not a PackedScene resource."));
+ return false;
+ }
+
+ Node *instance = loaded_scene->instance();
+ if (!instance || !Object::cast_to<Control>(instance)) {
+ EditorNode::get_singleton()->show_warning(TTR("Invalid PackedScene resource, must have a Control node at its root."));
+ return false;
+ }
+
+ preview_content->add_child(instance);
+ return true;
+}
+
+String SceneThemeEditorPreview::get_preview_scene_path() const {
+ if (loaded_scene.is_null()) {
+ return "";
+ }
+
+ return loaded_scene->get_path();
+}
+
+SceneThemeEditorPreview::SceneThemeEditorPreview() {
+ preview_toolbar->add_child(memnew(VSeparator));
+
+ reload_scene_button = memnew(Button);
+ reload_scene_button->set_flat(true);
+ reload_scene_button->set_tooltip(TTR("Reload the scene to reflect its most actual state."));
+ preview_toolbar->add_child(reload_scene_button);
+ reload_scene_button->connect("pressed", callable_mp(this, &SceneThemeEditorPreview::_reload_scene));
+}
diff --git a/editor/plugins/theme_editor_preview.h b/editor/plugins/theme_editor_preview.h
new file mode 100644
index 0000000000..efb7e424d4
--- /dev/null
+++ b/editor/plugins/theme_editor_preview.h
@@ -0,0 +1,118 @@
+/*************************************************************************/
+/* theme_editor_preview.h */
+/*************************************************************************/
+/* This file is part of: */
+/* GODOT ENGINE */
+/* https://godotengine.org */
+/*************************************************************************/
+/* Copyright (c) 2007-2021 Juan Linietsky, Ariel Manzur. */
+/* Copyright (c) 2014-2021 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 THEME_EDITOR_PREVIEW_H
+#define THEME_EDITOR_PREVIEW_H
+
+#include "scene/gui/box_container.h"
+#include "scene/gui/check_box.h"
+#include "scene/gui/check_button.h"
+#include "scene/gui/color_picker.h"
+#include "scene/gui/color_rect.h"
+#include "scene/gui/label.h"
+#include "scene/gui/margin_container.h"
+#include "scene/gui/menu_button.h"
+#include "scene/gui/option_button.h"
+#include "scene/gui/panel.h"
+#include "scene/gui/progress_bar.h"
+#include "scene/gui/scroll_container.h"
+#include "scene/gui/separator.h"
+#include "scene/gui/spin_box.h"
+#include "scene/gui/tab_container.h"
+#include "scene/gui/text_edit.h"
+#include "scene/gui/tree.h"
+#include "scene/resources/theme.h"
+
+#include "editor/editor_node.h"
+
+class ThemeEditorPreview : public VBoxContainer {
+ GDCLASS(ThemeEditorPreview, VBoxContainer);
+
+ ColorRect *preview_bg;
+ MarginContainer *preview_overlay;
+ Control *picker_overlay;
+ Control *hovered_control = nullptr;
+
+ double time_left = 0;
+
+ void _propagate_redraw(Control *p_at);
+ void _refresh_interval();
+ void _preview_visibility_changed();
+
+ void _picker_button_cbk();
+ Control *_find_hovered_control(Control *p_parent, Vector2 p_mouse_position);
+
+ void _draw_picker_overlay();
+ void _gui_input_picker_overlay(const Ref<InputEvent> &p_event);
+
+protected:
+ HBoxContainer *preview_toolbar;
+ MarginContainer *preview_content;
+ Button *picker_button;
+
+ void add_preview_overlay(Control *p_overlay);
+
+ void _notification(int p_what);
+ static void _bind_methods();
+
+public:
+ void set_preview_theme(const Ref<Theme> &p_theme);
+
+ ThemeEditorPreview();
+};
+
+class DefaultThemeEditorPreview : public ThemeEditorPreview {
+ GDCLASS(DefaultThemeEditorPreview, ThemeEditorPreview);
+
+public:
+ DefaultThemeEditorPreview();
+};
+
+class SceneThemeEditorPreview : public ThemeEditorPreview {
+ GDCLASS(SceneThemeEditorPreview, ThemeEditorPreview);
+
+ Ref<PackedScene> loaded_scene;
+
+ Button *reload_scene_button;
+
+ void _reload_scene();
+
+protected:
+ void _notification(int p_what);
+ static void _bind_methods();
+
+public:
+ bool set_preview_scene(const String &p_path);
+ String get_preview_scene_path() const;
+
+ SceneThemeEditorPreview();
+};
+
+#endif // THEME_EDITOR_PREVIEW_H
diff --git a/editor/plugins/tiles/tile_set_editor.cpp b/editor/plugins/tiles/tile_set_editor.cpp
index 6078c986cb..11842981f3 100644
--- a/editor/plugins/tiles/tile_set_editor.cpp
+++ b/editor/plugins/tiles/tile_set_editor.cpp
@@ -436,8 +436,8 @@ void TileSetEditor::_undo_redo_inspector_callback(Object *p_undo_redo, Object *p
}
void TileSetEditor::_bind_methods() {
- ClassDB::bind_method(D_METHOD("can_drop_data_fw"), &TileSetEditor::can_drop_data_fw);
- ClassDB::bind_method(D_METHOD("drop_data_fw"), &TileSetEditor::drop_data_fw);
+ ClassDB::bind_method(D_METHOD("_can_drop_data_fw"), &TileSetEditor::can_drop_data_fw);
+ ClassDB::bind_method(D_METHOD("_drop_data_fw"), &TileSetEditor::drop_data_fw);
}
TileDataEditor *TileSetEditor::get_tile_data_editor(String p_property) {
diff --git a/editor/plugins/visual_shader_editor_plugin.cpp b/editor/plugins/visual_shader_editor_plugin.cpp
index 2bb9e64262..9217f2ac4c 100644
--- a/editor/plugins/visual_shader_editor_plugin.cpp
+++ b/editor/plugins/visual_shader_editor_plugin.cpp
@@ -72,13 +72,13 @@ const int MAX_FLOAT_CONST_DEFS = sizeof(float_constant_defs) / sizeof(FloatConst
Control *VisualShaderNodePlugin::create_editor(const Ref<Resource> &p_parent_resource, const Ref<VisualShaderNode> &p_node) {
if (get_script_instance()) {
- return get_script_instance()->call("create_editor", p_parent_resource, p_node);
+ return get_script_instance()->call("_create_editor", p_parent_resource, p_node);
}
return nullptr;
}
void VisualShaderNodePlugin::_bind_methods() {
- BIND_VMETHOD(MethodInfo(Variant::OBJECT, "create_editor", PropertyInfo(Variant::OBJECT, "parent_resource", PROPERTY_HINT_RESOURCE_TYPE, "Resource"), PropertyInfo(Variant::OBJECT, "for_node", PROPERTY_HINT_RESOURCE_TYPE, "VisualShaderNode")));
+ BIND_VMETHOD(MethodInfo(Variant::OBJECT, "_create_editor", PropertyInfo(Variant::OBJECT, "parent_resource", PROPERTY_HINT_RESOURCE_TYPE, "Resource"), PropertyInfo(Variant::OBJECT, "for_node", PROPERTY_HINT_RESOURCE_TYPE, "VisualShaderNode")));
}
///////////////////
@@ -3694,9 +3694,9 @@ void VisualShaderEditor::_bind_methods() {
ClassDB::bind_method("_update_uniform", &VisualShaderEditor::_update_uniform);
ClassDB::bind_method("_expand_output_port", &VisualShaderEditor::_expand_output_port);
- ClassDB::bind_method(D_METHOD("get_drag_data_fw"), &VisualShaderEditor::get_drag_data_fw);
- ClassDB::bind_method(D_METHOD("can_drop_data_fw"), &VisualShaderEditor::can_drop_data_fw);
- ClassDB::bind_method(D_METHOD("drop_data_fw"), &VisualShaderEditor::drop_data_fw);
+ ClassDB::bind_method(D_METHOD("_get_drag_data_fw"), &VisualShaderEditor::get_drag_data_fw);
+ ClassDB::bind_method(D_METHOD("_can_drop_data_fw"), &VisualShaderEditor::can_drop_data_fw);
+ ClassDB::bind_method(D_METHOD("_drop_data_fw"), &VisualShaderEditor::drop_data_fw);
ClassDB::bind_method("_is_available", &VisualShaderEditor::_is_available);
}
diff --git a/editor/plugins/visual_shader_editor_plugin.h b/editor/plugins/visual_shader_editor_plugin.h
index ad57850e9d..fa98c6b780 100644
--- a/editor/plugins/visual_shader_editor_plugin.h
+++ b/editor/plugins/visual_shader_editor_plugin.h
@@ -41,8 +41,8 @@
#include "scene/gui/tree.h"
#include "scene/resources/visual_shader.h"
-class VisualShaderNodePlugin : public Reference {
- GDCLASS(VisualShaderNodePlugin, Reference);
+class VisualShaderNodePlugin : public RefCounted {
+ GDCLASS(VisualShaderNodePlugin, RefCounted);
protected:
static void _bind_methods();
@@ -51,8 +51,8 @@ public:
virtual Control *create_editor(const Ref<Resource> &p_parent_resource, const Ref<VisualShaderNode> &p_node);
};
-class VisualShaderGraphPlugin : public Reference {
- GDCLASS(VisualShaderGraphPlugin, Reference);
+class VisualShaderGraphPlugin : public RefCounted {
+ GDCLASS(VisualShaderGraphPlugin, RefCounted);
private:
struct InputPort {
diff --git a/editor/pot_generator.h b/editor/pot_generator.h
index ab055e0c0e..61300064ba 100644
--- a/editor/pot_generator.h
+++ b/editor/pot_generator.h
@@ -31,7 +31,7 @@
#ifndef POT_GENERATOR_H
#define POT_GENERATOR_H
-#include "core/os/file_access.h"
+#include "core/io/file_access.h"
#include "core/templates/ordered_hash_map.h"
#include "core/templates/set.h"
diff --git a/editor/project_export.cpp b/editor/project_export.cpp
index 9b99372735..7ca2d4d324 100644
--- a/editor/project_export.cpp
+++ b/editor/project_export.cpp
@@ -31,11 +31,11 @@
#include "project_export.h"
#include "core/config/project_settings.h"
+#include "core/io/dir_access.h"
+#include "core/io/file_access.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/string/optimized_translation.h"
#include "editor_data.h"
@@ -978,9 +978,9 @@ void ProjectExportDialog::_export_all(bool p_debug) {
}
void ProjectExportDialog::_bind_methods() {
- ClassDB::bind_method("get_drag_data_fw", &ProjectExportDialog::get_drag_data_fw);
- ClassDB::bind_method("can_drop_data_fw", &ProjectExportDialog::can_drop_data_fw);
- ClassDB::bind_method("drop_data_fw", &ProjectExportDialog::drop_data_fw);
+ ClassDB::bind_method("_get_drag_data_fw", &ProjectExportDialog::get_drag_data_fw);
+ ClassDB::bind_method("_can_drop_data_fw", &ProjectExportDialog::can_drop_data_fw);
+ ClassDB::bind_method("_drop_data_fw", &ProjectExportDialog::drop_data_fw);
ClassDB::bind_method("_export_all", &ProjectExportDialog::_export_all);
ClassDB::bind_method("set_export_path", &ProjectExportDialog::set_export_path);
ClassDB::bind_method("get_export_path", &ProjectExportDialog::get_export_path);
diff --git a/editor/project_export.h b/editor/project_export.h
index cfd4934c34..aeace708b8 100644
--- a/editor/project_export.h
+++ b/editor/project_export.h
@@ -31,7 +31,7 @@
#ifndef PROJECT_EXPORT_SETTINGS_H
#define PROJECT_EXPORT_SETTINGS_H
-#include "core/os/dir_access.h"
+#include "core/io/dir_access.h"
#include "core/os/thread.h"
#include "editor/editor_export.h"
#include "editor/editor_file_dialog.h"
diff --git a/editor/project_manager.cpp b/editor/project_manager.cpp
index 1b596ce599..12490f687e 100644
--- a/editor/project_manager.cpp
+++ b/editor/project_manager.cpp
@@ -31,11 +31,11 @@
#include "project_manager.h"
#include "core/io/config_file.h"
+#include "core/io/dir_access.h"
+#include "core/io/file_access.h"
#include "core/io/resource_saver.h"
#include "core/io/stream_peer_ssl.h"
#include "core/io/zip_io.h"
-#include "core/os/dir_access.h"
-#include "core/os/file_access.h"
#include "core/os/keyboard.h"
#include "core/os/os.h"
#include "core/string/translation.h"
diff --git a/editor/property_editor.cpp b/editor/property_editor.cpp
index 7a4b0964fa..c44f8d9a4b 100644
--- a/editor/property_editor.cpp
+++ b/editor/property_editor.cpp
@@ -1446,6 +1446,8 @@ void CustomPropertyEditor::_modified(String p_string) {
return;
}
+ Variant prev_v = v;
+
updating = true;
switch (type) {
case Variant::INT: {
@@ -1459,14 +1461,18 @@ void CustomPropertyEditor::_modified(String p_string) {
} else {
v = expr->execute(Array(), nullptr, false);
}
- emit_signal("variant_changed");
+ if (v != prev_v) {
+ emit_signal("variant_changed");
+ }
} break;
case Variant::FLOAT: {
if (hint != PROPERTY_HINT_EXP_EASING) {
String text = TS->parse_number(value_editor[0]->get_text());
v = _parse_real_expression(text);
- emit_signal("variant_changed");
+ if (v != prev_v) {
+ emit_signal("variant_changed");
+ }
}
} break;
@@ -1479,7 +1485,9 @@ void CustomPropertyEditor::_modified(String p_string) {
vec.x = _parse_real_expression(value_editor[0]->get_text());
vec.y = _parse_real_expression(value_editor[1]->get_text());
v = vec;
- _emit_changed_whole_or_field();
+ if (v != prev_v) {
+ _emit_changed_whole_or_field();
+ }
} break;
case Variant::RECT2: {
@@ -1490,7 +1498,9 @@ void CustomPropertyEditor::_modified(String p_string) {
r2.size.x = _parse_real_expression(value_editor[2]->get_text());
r2.size.y = _parse_real_expression(value_editor[3]->get_text());
v = r2;
- _emit_changed_whole_or_field();
+ if (v != prev_v) {
+ _emit_changed_whole_or_field();
+ }
} break;
@@ -1500,7 +1510,9 @@ void CustomPropertyEditor::_modified(String p_string) {
vec.y = _parse_real_expression(value_editor[1]->get_text());
vec.z = _parse_real_expression(value_editor[2]->get_text());
v = vec;
- _emit_changed_whole_or_field();
+ if (v != prev_v) {
+ _emit_changed_whole_or_field();
+ }
} break;
case Variant::PLANE: {
@@ -1510,7 +1522,9 @@ void CustomPropertyEditor::_modified(String p_string) {
pl.normal.z = _parse_real_expression(value_editor[2]->get_text());
pl.d = _parse_real_expression(value_editor[3]->get_text());
v = pl;
- _emit_changed_whole_or_field();
+ if (v != prev_v) {
+ _emit_changed_whole_or_field();
+ }
} break;
case Variant::QUATERNION: {
@@ -1520,7 +1534,9 @@ void CustomPropertyEditor::_modified(String p_string) {
q.z = _parse_real_expression(value_editor[2]->get_text());
q.w = _parse_real_expression(value_editor[3]->get_text());
v = q;
- _emit_changed_whole_or_field();
+ if (v != prev_v) {
+ _emit_changed_whole_or_field();
+ }
} break;
case Variant::AABB: {
@@ -1534,7 +1550,9 @@ void CustomPropertyEditor::_modified(String p_string) {
size.y = _parse_real_expression(value_editor[4]->get_text());
size.z = _parse_real_expression(value_editor[5]->get_text());
v = AABB(pos, size);
- _emit_changed_whole_or_field();
+ if (v != prev_v) {
+ _emit_changed_whole_or_field();
+ }
} break;
case Variant::TRANSFORM2D: {
@@ -1544,7 +1562,9 @@ void CustomPropertyEditor::_modified(String p_string) {
}
v = m;
- _emit_changed_whole_or_field();
+ if (v != prev_v) {
+ _emit_changed_whole_or_field();
+ }
} break;
case Variant::BASIS: {
@@ -1554,7 +1574,9 @@ void CustomPropertyEditor::_modified(String p_string) {
}
v = m;
- _emit_changed_whole_or_field();
+ if (v != prev_v) {
+ _emit_changed_whole_or_field();
+ }
} break;
case Variant::TRANSFORM3D: {
@@ -1570,7 +1592,9 @@ void CustomPropertyEditor::_modified(String p_string) {
origin.z = _parse_real_expression(value_editor[11]->get_text());
v = Transform3D(basis, origin);
- _emit_changed_whole_or_field();
+ if (v != prev_v) {
+ _emit_changed_whole_or_field();
+ }
} break;
case Variant::COLOR: {
@@ -1578,7 +1602,9 @@ void CustomPropertyEditor::_modified(String p_string) {
case Variant::NODE_PATH: {
v = NodePath(value_editor[0]->get_text());
- emit_signal("variant_changed");
+ if (v != prev_v) {
+ emit_signal("variant_changed");
+ }
} break;
case Variant::DICTIONARY: {
} break;
@@ -1654,25 +1680,7 @@ void CustomPropertyEditor::_focus_enter() {
}
void CustomPropertyEditor::_focus_exit() {
- switch (type) {
- case Variant::FLOAT:
- case Variant::STRING:
- case Variant::VECTOR2:
- case Variant::RECT2:
- case Variant::VECTOR3:
- case Variant::PLANE:
- case Variant::QUATERNION:
- case Variant::AABB:
- case Variant::TRANSFORM2D:
- case Variant::BASIS:
- case Variant::TRANSFORM3D: {
- for (int i = 0; i < MAX_VALUE_EDITORS; ++i) {
- value_editor[i]->select(0, 0);
- }
- } break;
- default: {
- }
- }
+ _modified(String());
}
void CustomPropertyEditor::config_action_buttons(const List<String> &p_strings) {
diff --git a/editor/property_editor.h b/editor/property_editor.h
index c6929f3b42..8a587b50b0 100644
--- a/editor/property_editor.h
+++ b/editor/property_editor.h
@@ -50,8 +50,8 @@ class PropertyValueEvaluator;
class CreateDialog;
class PropertySelector;
-class EditorResourceConversionPlugin : public Reference {
- GDCLASS(EditorResourceConversionPlugin, Reference);
+class EditorResourceConversionPlugin : public RefCounted {
+ GDCLASS(EditorResourceConversionPlugin, RefCounted);
protected:
static void _bind_methods();
diff --git a/editor/scene_tree_editor.cpp b/editor/scene_tree_editor.cpp
index 6f9b0ae873..a5620f8cc5 100644
--- a/editor/scene_tree_editor.cpp
+++ b/editor/scene_tree_editor.cpp
@@ -1129,9 +1129,9 @@ void SceneTreeEditor::_bind_methods() {
ClassDB::bind_method("_rename_node", &SceneTreeEditor::_rename_node);
ClassDB::bind_method("_test_update_tree", &SceneTreeEditor::_test_update_tree);
- ClassDB::bind_method(D_METHOD("get_drag_data_fw"), &SceneTreeEditor::get_drag_data_fw);
- ClassDB::bind_method(D_METHOD("can_drop_data_fw"), &SceneTreeEditor::can_drop_data_fw);
- ClassDB::bind_method(D_METHOD("drop_data_fw"), &SceneTreeEditor::drop_data_fw);
+ ClassDB::bind_method(D_METHOD("_get_drag_data_fw"), &SceneTreeEditor::get_drag_data_fw);
+ ClassDB::bind_method(D_METHOD("_can_drop_data_fw"), &SceneTreeEditor::can_drop_data_fw);
+ ClassDB::bind_method(D_METHOD("_drop_data_fw"), &SceneTreeEditor::drop_data_fw);
ClassDB::bind_method(D_METHOD("update_tree"), &SceneTreeEditor::update_tree);
diff --git a/editor/script_create_dialog.cpp b/editor/script_create_dialog.cpp
index c2bfdaae96..650decfd49 100644
--- a/editor/script_create_dialog.cpp
+++ b/editor/script_create_dialog.cpp
@@ -31,9 +31,9 @@
#include "script_create_dialog.h"
#include "core/config/project_settings.h"
+#include "core/io/file_access.h"
#include "core/io/resource_saver.h"
#include "core/object/script_language.h"
-#include "core/os/file_access.h"
#include "core/string/string_builder.h"
#include "editor/create_dialog.h"
#include "editor/editor_node.h"
diff --git a/main/main.cpp b/main/main.cpp
index d67761db55..7d4e4ef372 100644
--- a/main/main.cpp
+++ b/main/main.cpp
@@ -36,6 +36,7 @@
#include "core/debugger/engine_debugger.h"
#include "core/input/input.h"
#include "core/input/input_map.h"
+#include "core/io/dir_access.h"
#include "core/io/file_access_network.h"
#include "core/io/file_access_pack.h"
#include "core/io/file_access_zip.h"
@@ -43,8 +44,8 @@
#include "core/io/ip.h"
#include "core/io/resource_loader.h"
#include "core/object/message_queue.h"
-#include "core/os/dir_access.h"
#include "core/os/os.h"
+#include "core/os/time.h"
#include "core/register_core_types.h"
#include "core/string/translation.h"
#include "core/version.h"
@@ -101,6 +102,7 @@ static InputMap *input_map = nullptr;
static TranslationServer *translation_server = nullptr;
static Performance *performance = nullptr;
static PackedData *packed_data = nullptr;
+static Time *time_singleton = nullptr;
#ifdef MINIZIP_ENABLED
static ZipArchive *zip_packed_data = nullptr;
#endif
@@ -532,6 +534,7 @@ Error Main::setup(const char *execpath, int argc, char *argv[], bool p_second_ph
MAIN_PRINT("Main: Initialize Globals");
input_map = memnew(InputMap);
+ time_singleton = memnew(Time);
globals = memnew(ProjectSettings);
register_core_settings(); //here globals are present
@@ -1402,6 +1405,9 @@ error:
if (input_map) {
memdelete(input_map);
}
+ if (time_singleton) {
+ memdelete(time_singleton);
+ }
if (translation_server) {
memdelete(translation_server);
}
@@ -1447,7 +1453,7 @@ Error Main::setup2(Thread::ID p_main_tid_override) {
#ifdef TOOLS_ENABLED
if (editor || project_manager) {
- EditorNode::register_editor_paths(project_manager);
+ EditorPaths::create();
}
#endif
@@ -2373,10 +2379,8 @@ bool Main::start() {
}
// Load SSL Certificates from Editor Settings (or builtin)
- Crypto::load_default_certificates(EditorSettings::get_singleton()->get_setting(
- "network/ssl/editor_ssl_certificates")
- .
- operator String());
+ Crypto::load_default_certificates(
+ EditorSettings::get_singleton()->get_setting("network/ssl/editor_ssl_certificates").operator String());
}
#endif
}
@@ -2667,6 +2671,9 @@ void Main::cleanup(bool p_force) {
if (input_map) {
memdelete(input_map);
}
+ if (time_singleton) {
+ memdelete(time_singleton);
+ }
if (translation_server) {
memdelete(translation_server);
}
diff --git a/misc/dist/osx_template.app/Contents/Info.plist b/misc/dist/osx_template.app/Contents/Info.plist
index aad24935d0..8e221df946 100644
--- a/misc/dist/osx_template.app/Contents/Info.plist
+++ b/misc/dist/osx_template.app/Contents/Info.plist
@@ -36,6 +36,8 @@
</array>
<key>NSPrincipalClass</key>
<string>NSApplication</string>
+ <key>LSApplicationCategoryType</key>
+ <string>public.app-category.$app_category</string>
<key>LSMinimumSystemVersion</key>
<string>10.12</string>
<key>LSMinimumSystemVersionByArchitecture</key>
diff --git a/misc/dist/osx_tools.app/Contents/Info.plist b/misc/dist/osx_tools.app/Contents/Info.plist
index 1c682f339f..8e70d4c203 100644
--- a/misc/dist/osx_tools.app/Contents/Info.plist
+++ b/misc/dist/osx_tools.app/Contents/Info.plist
@@ -38,6 +38,8 @@
</array>
<key>NSPrincipalClass</key>
<string>NSApplication</string>
+ <key>LSApplicationCategoryType</key>
+ <string>public.app-category.developer-tools</string>
<key>LSMinimumSystemVersion</key>
<string>10.12</string>
<key>LSMinimumSystemVersionByArchitecture</key>
diff --git a/modules/csg/csg.h b/modules/csg/csg.h
index 4bd79e15a9..c872860486 100644
--- a/modules/csg/csg.h
+++ b/modules/csg/csg.h
@@ -36,7 +36,7 @@
#include "core/math/transform_3d.h"
#include "core/math/vector2.h"
#include "core/math/vector3.h"
-#include "core/object/reference.h"
+#include "core/object/ref_counted.h"
#include "core/templates/list.h"
#include "core/templates/map.h"
#include "core/templates/oa_hash_map.h"
diff --git a/modules/dds/texture_loader_dds.cpp b/modules/dds/texture_loader_dds.cpp
index 2fef576b77..fced61a600 100644
--- a/modules/dds/texture_loader_dds.cpp
+++ b/modules/dds/texture_loader_dds.cpp
@@ -30,7 +30,7 @@
#include "texture_loader_dds.h"
-#include "core/os/file_access.h"
+#include "core/io/file_access.h"
#define PF_FOURCC(s) ((uint32_t)(((s)[3] << 24U) | ((s)[2] << 16U) | ((s)[1] << 8U) | ((s)[0])))
diff --git a/modules/fbx/data/fbx_bone.h b/modules/fbx/data/fbx_bone.h
index efba147b89..83918ad1e2 100644
--- a/modules/fbx/data/fbx_bone.h
+++ b/modules/fbx/data/fbx_bone.h
@@ -38,7 +38,7 @@
struct PivotTransform;
-struct FBXBone : public Reference {
+struct FBXBone : public RefCounted {
uint64_t parent_bone_id = 0;
uint64_t bone_id = 0;
diff --git a/modules/fbx/data/fbx_material.h b/modules/fbx/data/fbx_material.h
index 23310b8e1d..5fd4d9212b 100644
--- a/modules/fbx/data/fbx_material.h
+++ b/modules/fbx/data/fbx_material.h
@@ -33,10 +33,10 @@
#include "tools/import_utils.h"
-#include "core/object/reference.h"
+#include "core/object/ref_counted.h"
#include "core/string/ustring.h"
-struct FBXMaterial : public Reference {
+struct FBXMaterial : public RefCounted {
String material_name = String();
bool warning_non_pbr_material = false;
FBXDocParser::Material *material = nullptr;
@@ -266,7 +266,7 @@ struct FBXMaterial : public Reference {
/* storing the texture properties like color */
template <class T>
- struct TexturePropertyMapping : Reference {
+ struct TexturePropertyMapping : RefCounted {
StandardMaterial3D::TextureParam map_mode = StandardMaterial3D::TextureParam::TEXTURE_ALBEDO;
const T property = T();
};
diff --git a/modules/fbx/data/fbx_mesh_data.h b/modules/fbx/data/fbx_mesh_data.h
index c4eaa7d170..7486c5c59c 100644
--- a/modules/fbx/data/fbx_mesh_data.h
+++ b/modules/fbx/data/fbx_mesh_data.h
@@ -78,7 +78,7 @@ struct VertexData {
};
// Caches mesh information and instantiates meshes for you using helper functions.
-struct FBXMeshData : Reference {
+struct FBXMeshData : RefCounted {
struct MorphVertexData {
// TODO we have only these??
/// Each element is a vertex. Not supposed to be void.
diff --git a/modules/fbx/data/fbx_node.h b/modules/fbx/data/fbx_node.h
index a6f62f3388..75461e397d 100644
--- a/modules/fbx/data/fbx_node.h
+++ b/modules/fbx/data/fbx_node.h
@@ -40,7 +40,7 @@
class Node3D;
struct PivotTransform;
-struct FBXNode : Reference, ModelAbstraction {
+struct FBXNode : RefCounted, ModelAbstraction {
uint64_t current_node_id = 0;
String node_name = String();
Node3D *godot_node = nullptr;
diff --git a/modules/fbx/data/fbx_skeleton.h b/modules/fbx/data/fbx_skeleton.h
index df937cde49..b6103df949 100644
--- a/modules/fbx/data/fbx_skeleton.h
+++ b/modules/fbx/data/fbx_skeleton.h
@@ -35,14 +35,14 @@
#include "fbx_node.h"
#include "model_abstraction.h"
-#include "core/object/reference.h"
+#include "core/object/ref_counted.h"
#include "scene/3d/skeleton_3d.h"
struct FBXNode;
struct ImportState;
struct FBXBone;
-struct FBXSkeleton : Reference {
+struct FBXSkeleton : RefCounted {
Ref<FBXNode> fbx_node = Ref<FBXNode>();
Vector<Ref<FBXBone>> skeleton_bones = Vector<Ref<FBXBone>>();
Skeleton3D *skeleton = nullptr;
diff --git a/modules/fbx/data/pivot_transform.h b/modules/fbx/data/pivot_transform.h
index 29cf7a3d0e..099b268075 100644
--- a/modules/fbx/data/pivot_transform.h
+++ b/modules/fbx/data/pivot_transform.h
@@ -32,7 +32,7 @@
#define PIVOT_TRANSFORM_H
#include "core/math/transform_3d.h"
-#include "core/object/reference.h"
+#include "core/object/ref_counted.h"
#include "model_abstraction.h"
@@ -55,7 +55,7 @@ enum TransformationComp {
TransformationComp_MAXIMUM
};
// Abstract away pivot data so its simpler to handle
-struct PivotTransform : Reference, ModelAbstraction {
+struct PivotTransform : RefCounted, ModelAbstraction {
// at the end we want to keep geometric_ everything, post and pre rotation
// these are used during animation data processing / keyframe ingestion the rest can be simplified down / out.
Quaternion pre_rotation = Quaternion();
diff --git a/modules/fbx/tools/validation_tools.h b/modules/fbx/tools/validation_tools.h
index fe0c92b22f..6c15eb7e12 100644
--- a/modules/fbx/tools/validation_tools.h
+++ b/modules/fbx/tools/validation_tools.h
@@ -33,8 +33,8 @@
#ifdef TOOLS_ENABLED
+#include "core/io/file_access.h"
#include "core/io/json.h"
-#include "core/os/file_access.h"
#include "core/string/ustring.h"
#include "core/templates/local_vector.h"
#include "core/templates/map.h"
diff --git a/modules/gdnative/doc_classes/GDNative.xml b/modules/gdnative/doc_classes/GDNative.xml
index 44d9e32ed8..4f1530598c 100644
--- a/modules/gdnative/doc_classes/GDNative.xml
+++ b/modules/gdnative/doc_classes/GDNative.xml
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8" ?>
-<class name="GDNative" inherits="Reference" version="4.0">
+<class name="GDNative" inherits="RefCounted" version="4.0">
<brief_description>
</brief_description>
<description>
diff --git a/modules/gdnative/gdnative.cpp b/modules/gdnative/gdnative.cpp
index 7c3b76e4d7..e552f443cf 100644
--- a/modules/gdnative/gdnative.cpp
+++ b/modules/gdnative/gdnative.cpp
@@ -32,9 +32,9 @@
#include "core/config/project_settings.h"
#include "core/core_constants.h"
+#include "core/io/dir_access.h"
+#include "core/io/file_access.h"
#include "core/io/file_access_encrypted.h"
-#include "core/os/dir_access.h"
-#include "core/os/file_access.h"
#include "core/os/os.h"
#include "scene/main/scene_tree.h"
diff --git a/modules/gdnative/gdnative.h b/modules/gdnative/gdnative.h
index a28c58ec0d..0cc6487ea4 100644
--- a/modules/gdnative/gdnative.h
+++ b/modules/gdnative/gdnative.h
@@ -138,8 +138,8 @@ struct GDNativeCallRegistry {
Vector<StringName> get_native_call_types();
};
-class GDNative : public Reference {
- GDCLASS(GDNative, Reference);
+class GDNative : public RefCounted {
+ GDCLASS(GDNative, RefCounted);
Ref<GDNativeLibrary> library;
diff --git a/modules/gdnative/gdnative/variant.cpp b/modules/gdnative/gdnative/variant.cpp
index 24f50a94f5..cfb57137bb 100644
--- a/modules/gdnative/gdnative/variant.cpp
+++ b/modules/gdnative/gdnative/variant.cpp
@@ -30,7 +30,7 @@
#include "gdnative/variant.h"
-#include "core/object/reference.h"
+#include "core/object/ref_counted.h"
#include "core/variant/variant.h"
#ifdef __cplusplus
@@ -200,17 +200,17 @@ void GDAPI godot_variant_new_signal(godot_variant *r_dest, const godot_signal *p
void GDAPI godot_variant_new_object(godot_variant *r_dest, const godot_object *p_obj) {
Variant *dest = (Variant *)r_dest;
const Object *obj = (const Object *)p_obj;
- const Reference *reference = Object::cast_to<Reference>(obj);
+ const RefCounted *ref_counted = Object::cast_to<RefCounted>(obj);
REF ref;
- if (reference) {
- ref = REF(reference);
+ if (ref_counted) {
+ ref = REF(ref_counted);
}
if (!ref.is_null()) {
memnew_placement_custom(dest, Variant, Variant(ref));
} else {
#if defined(DEBUG_METHODS_ENABLED)
- if (reference) {
- ERR_PRINT("Reference object has 0 refcount in godot_variant_new_object - you lost it somewhere.");
+ if (ref_counted) {
+ ERR_PRINT("RefCounted object has 0 refcount in godot_variant_new_object - you lost it somewhere.");
}
#endif
memnew_placement_custom(dest, Variant, Variant(obj));
diff --git a/modules/gdnative/gdnative_api.json b/modules/gdnative/gdnative_api.json
index 175a6a3c91..8c65447e5d 100644
--- a/modules/gdnative/gdnative_api.json
+++ b/modules/gdnative/gdnative_api.json
@@ -5068,7 +5068,7 @@
},
{
"name": "godot_xr_get_worldscale",
- "return_type": "godot_float",
+ "return_type": "godot_real_t",
"arguments": []
},
{
@@ -5189,7 +5189,7 @@
"p_exis"
],
[
- "godot_float",
+ "godot_real_t",
"p_value"
],
[
@@ -5200,7 +5200,7 @@
},
{
"name": "godot_xr_get_controller_rumble",
- "return_type": "godot_float",
+ "return_type": "godot_real_t",
"arguments": [
[
"godot_int",
diff --git a/modules/gdnative/include/xr/godot_xr.h b/modules/gdnative/include/xr/godot_xr.h
index e09244f3f9..53cb830cbb 100644
--- a/modules/gdnative/include/xr/godot_xr.h
+++ b/modules/gdnative/include/xr/godot_xr.h
@@ -41,8 +41,8 @@ extern "C" {
// version info to detect whether a call is available
// Use these to populate version in your plugin
-#define GODOTVR_API_MAJOR 1
-#define GODOTVR_API_MINOR 1
+#define GODOTVR_API_MAJOR 4
+#define GODOTVR_API_MINOR 0
typedef struct {
godot_gdnative_api_version version; /* version of our API */
@@ -52,24 +52,31 @@ typedef struct {
godot_int (*get_capabilities)(const void *);
godot_bool (*get_anchor_detection_is_enabled)(const void *);
void (*set_anchor_detection_is_enabled)(void *, godot_bool);
- godot_bool (*is_stereo)(const void *);
+ godot_int (*get_view_count)(const void *);
godot_bool (*is_initialized)(const void *);
godot_bool (*initialize)(void *);
void (*uninitialize)(void *);
godot_vector2 (*get_render_targetsize)(const void *);
- godot_transform3d (*get_transform_for_eye)(void *, godot_int, godot_transform3d *);
- void (*fill_projection_for_eye)(void *, godot_float *, godot_int, godot_float, godot_float, godot_float);
- void (*commit_for_eye)(void *, godot_int, godot_rid *, godot_rect2 *);
+
+ godot_transform3d (*get_camera_transform)(void *);
+ godot_transform3d (*get_transform_for_view)(void *, godot_int, godot_transform3d *);
+ void (*fill_projection_for_view)(void *, godot_real_t *, godot_int, godot_real_t, godot_real_t, godot_real_t);
+ void (*commit_views)(void *, godot_rid *, godot_rect2 *);
+
void (*process)(void *);
- godot_int (*get_external_texture_for_eye)(void *, godot_int);
void (*notification)(void *, godot_int);
godot_int (*get_camera_feed_id)(void *);
+
+ // possibly deprecate but adding/keeping as a reminder these are in Godot 3
+ void (*commit_for_eye)(void *, godot_int, godot_rid *, godot_rect2 *);
+ godot_int (*get_external_texture_for_eye)(void *, godot_int);
+ godot_int (*get_external_depth_for_eye)(void *, godot_int);
} godot_xr_interface_gdnative;
void GDAPI godot_xr_register_interface(const godot_xr_interface_gdnative *p_interface);
// helper functions to access XRServer data
-godot_float GDAPI godot_xr_get_worldscale();
+godot_real_t GDAPI godot_xr_get_worldscale();
godot_transform3d GDAPI godot_xr_get_reference_frame();
// helper functions for rendering
@@ -81,8 +88,8 @@ godot_int GDAPI godot_xr_add_controller(char *p_device_name, godot_int p_hand, g
void GDAPI godot_xr_remove_controller(godot_int p_controller_id);
void GDAPI godot_xr_set_controller_transform(godot_int p_controller_id, godot_transform3d *p_transform, godot_bool p_tracks_orientation, godot_bool p_tracks_position);
void GDAPI godot_xr_set_controller_button(godot_int p_controller_id, godot_int p_button, godot_bool p_is_pressed);
-void GDAPI godot_xr_set_controller_axis(godot_int p_controller_id, godot_int p_axis, godot_float p_value, godot_bool p_can_be_negative);
-godot_float GDAPI godot_xr_get_controller_rumble(godot_int p_controller_id);
+void GDAPI godot_xr_set_controller_axis(godot_int p_controller_id, godot_int p_axis, godot_real_t p_value, godot_bool p_can_be_negative);
+godot_real_t GDAPI godot_xr_get_controller_rumble(godot_int p_controller_id);
#ifdef __cplusplus
}
diff --git a/modules/gdnative/nativescript/api_generator.cpp b/modules/gdnative/nativescript/api_generator.cpp
index f184c84615..57717010f7 100644
--- a/modules/gdnative/nativescript/api_generator.cpp
+++ b/modules/gdnative/nativescript/api_generator.cpp
@@ -34,10 +34,11 @@
#include "core/config/engine.h"
#include "core/core_constants.h"
+#include "core/io/file_access.h"
#include "core/object/class_db.h"
-#include "core/os/file_access.h"
#include "core/string/string_builder.h"
#include "core/templates/pair.h"
+#include "core/variant/variant_parser.h"
// helper stuff
@@ -121,7 +122,7 @@ struct ClassAPI {
String singleton_name;
bool is_instantiable = false;
// @Unclear
- bool is_reference = false;
+ bool is_ref_counted = false;
bool has_indexing = false; // For builtin types.
String indexed_type; // For builtin types.
bool is_keyed = false; // For builtin types.
@@ -254,10 +255,10 @@ List<ClassAPI> generate_c_api_classes() {
{
List<StringName> inheriters;
- ClassDB::get_inheriters_from_class("Reference", &inheriters);
- bool is_reference = !!inheriters.find(class_name) || class_name == "Reference";
+ ClassDB::get_inheriters_from_class("RefCounted", &inheriters);
+ bool is_ref_counted = !!inheriters.find(class_name) || class_name == "RefCounted";
// @Unclear
- class_api.is_reference = !class_api.is_singleton && is_reference;
+ class_api.is_ref_counted = !class_api.is_singleton && is_ref_counted;
}
// constants
@@ -509,10 +510,10 @@ List<ClassAPI> generate_c_builtin_api_types() {
case Variant::PACKED_VECTOR2_ARRAY:
case Variant::PACKED_VECTOR3_ARRAY:
case Variant::PACKED_COLOR_ARRAY:
- class_api.is_reference = true;
+ class_api.is_ref_counted = true;
break;
default:
- class_api.is_reference = false;
+ class_api.is_ref_counted = false;
break;
}
@@ -638,6 +639,7 @@ static List<String> generate_c_api_json(const List<ClassAPI> &p_api) {
// I'm sorry for the \t mess
List<String> source;
+ VariantWriter writer;
source.push_back("[\n");
@@ -652,7 +654,7 @@ static List<String> generate_c_api_json(const List<ClassAPI> &p_api) {
source.push_back(String("\t\t\"singleton\": ") + (api.is_singleton ? "true" : "false") + ",\n");
source.push_back("\t\t\"singleton_name\": \"" + api.singleton_name + "\",\n");
source.push_back(String("\t\t\"instantiable\": ") + (api.is_instantiable ? "true" : "false") + ",\n");
- source.push_back(String("\t\t\"is_reference\": ") + (api.is_reference ? "true" : "false") + ",\n");
+ source.push_back(String("\t\t\"is_ref_counted\": ") + (api.is_ref_counted ? "true" : "false") + ",\n");
source.push_back("\t\t\"constants\": {\n");
for (List<ConstantAPI>::Element *e = api.constants.front(); e; e = e->next()) {
@@ -682,7 +684,12 @@ static List<String> generate_c_api_json(const List<ClassAPI> &p_api) {
source.push_back("\t\t\t\t\t\t\"name\": \"" + e->get().argument_names[i] + "\",\n");
source.push_back("\t\t\t\t\t\t\"type\": \"" + e->get().argument_types[i] + "\",\n");
source.push_back(String("\t\t\t\t\t\t\"has_default_value\": ") + (e->get().default_arguments.has(i) ? "true" : "false") + ",\n");
- source.push_back("\t\t\t\t\t\t\"default_value\": \"" + (e->get().default_arguments.has(i) ? (String)e->get().default_arguments[i] : "") + "\"\n");
+ String default_value;
+ if (e->get().default_arguments.has(i)) {
+ writer.write_to_string(e->get().default_arguments[i], default_value);
+ default_value = default_value.replace("\n", "").json_escape();
+ }
+ source.push_back("\t\t\t\t\t\t\"default_value\": \"" + default_value + "\"\n");
source.push_back(String("\t\t\t\t\t}") + ((i < e->get().argument_names.size() - 1) ? "," : "") + "\n");
}
source.push_back("\t\t\t\t]\n");
@@ -708,7 +715,12 @@ static List<String> generate_c_api_json(const List<ClassAPI> &p_api) {
source.push_back("\t\t\t\t\t\t\"name\": \"" + e->get().argument_names[i] + "\",\n");
source.push_back("\t\t\t\t\t\t\"type\": \"" + e->get().argument_types[i] + "\",\n");
source.push_back(String("\t\t\t\t\t\t\"has_default_value\": ") + (e->get().default_arguments.has(i) ? "true" : "false") + ",\n");
- source.push_back("\t\t\t\t\t\t\"default_value\": \"" + (e->get().default_arguments.has(i) ? (String)e->get().default_arguments[i] : "") + "\"\n");
+ String default_value;
+ if (e->get().default_arguments.has(i)) {
+ writer.write_to_string(e->get().default_arguments[i], default_value);
+ default_value = default_value.replace("\n", "").json_escape();
+ }
+ source.push_back("\t\t\t\t\t\t\"default_value\": \"" + default_value + "\"\n");
source.push_back(String("\t\t\t\t\t}") + ((i < e->get().argument_names.size() - 1) ? "," : "") + "\n");
}
source.push_back("\t\t\t\t]\n");
@@ -756,6 +768,8 @@ static void append_indented(StringBuilder &p_source, const char *p_text) {
}
static void write_builtin_method(StringBuilder &p_source, const MethodAPI &p_method) {
+ VariantWriter writer;
+
append_indented(p_source, vformat(R"("name": "%s",)", p_method.method_name));
append_indented(p_source, vformat(R"("return_type": "%s",)", p_method.return_type));
append_indented(p_source, vformat(R"("is_const": %s,)", p_method.is_const ? "true" : "false"));
@@ -771,7 +785,12 @@ static void write_builtin_method(StringBuilder &p_source, const MethodAPI &p_met
append_indented(p_source, vformat(R"("name": "%s",)", p_method.argument_names[i]));
append_indented(p_source, vformat(R"("type": "%s",)", p_method.argument_types[i]));
append_indented(p_source, vformat(R"("has_default_value": %s,)", p_method.default_arguments.has(i) ? "true" : "false"));
- append_indented(p_source, vformat(R"("default_value": "%s")", p_method.default_arguments.has(i) ? p_method.default_arguments[i].operator String() : ""));
+ String default_value;
+ if (p_method.default_arguments.has(i)) {
+ writer.write_to_string(p_method.default_arguments[i], default_value);
+ default_value = default_value.replace("\n", "").json_escape();
+ }
+ append_indented(p_source, vformat(R"("default_value": "%s")", default_value));
indent_level--;
append_indented(p_source, i < p_method.argument_count - 1 ? "}," : "}");
@@ -794,7 +813,7 @@ static List<String> generate_c_builtin_api_json(const List<ClassAPI> &p_api) {
append_indented(source, vformat(R"("name": "%s",)", class_api.class_name));
append_indented(source, vformat(R"("is_instantiable": %s,)", class_api.is_instantiable ? "true" : "false"));
- append_indented(source, vformat(R"("is_reference": %s,)", class_api.is_reference ? "true" : "false"));
+ append_indented(source, vformat(R"("is_ref_counted": %s,)", class_api.is_ref_counted ? "true" : "false"));
append_indented(source, vformat(R"("has_indexing": %s,)", class_api.has_indexing ? "true" : "false"));
append_indented(source, vformat(R"("indexed_type": "%s",)", class_api.has_indexing && class_api.indexed_type == "Nil" ? "Variant" : class_api.indexed_type));
append_indented(source, vformat(R"("is_keyed": %s,)", class_api.is_keyed ? "true" : "false"));
diff --git a/modules/gdnative/nativescript/nativescript.cpp b/modules/gdnative/nativescript/nativescript.cpp
index 03e25f49e6..6c2d038654 100644
--- a/modules/gdnative/nativescript/nativescript.cpp
+++ b/modules/gdnative/nativescript/nativescript.cpp
@@ -37,8 +37,8 @@
#include "core/config/project_settings.h"
#include "core/core_constants.h"
#include "core/core_string_names.h"
+#include "core/io/file_access.h"
#include "core/io/file_access_encrypted.h"
-#include "core/os/file_access.h"
#include "core/os/os.h"
#include "main/main.h"
@@ -505,7 +505,7 @@ Variant NativeScript::_new(const Variant **p_args, int p_argcount, Callable::Cal
if (!(script_data->base_native_type == "")) {
owner = ClassDB::instance(script_data->base_native_type);
} else {
- owner = memnew(Reference);
+ owner = memnew(RefCounted);
}
if (!owner) {
@@ -513,7 +513,7 @@ Variant NativeScript::_new(const Variant **p_args, int p_argcount, Callable::Cal
return Variant();
}
- Reference *r = Object::cast_to<Reference>(owner);
+ RefCounted *r = Object::cast_to<RefCounted>(owner);
if (r) {
ref = REF(r);
}
diff --git a/modules/gdnative/pluginscript/pluginscript_language.cpp b/modules/gdnative/pluginscript/pluginscript_language.cpp
index 1360cf0299..0291ae560b 100644
--- a/modules/gdnative/pluginscript/pluginscript_language.cpp
+++ b/modules/gdnative/pluginscript/pluginscript_language.cpp
@@ -30,7 +30,7 @@
// Godot imports
#include "core/config/project_settings.h"
-#include "core/os/file_access.h"
+#include "core/io/file_access.h"
#include "core/os/os.h"
// PluginScript imports
#include "pluginscript_language.h"
diff --git a/modules/gdnative/pluginscript/pluginscript_loader.cpp b/modules/gdnative/pluginscript/pluginscript_loader.cpp
index f2165cd225..462452a897 100644
--- a/modules/gdnative/pluginscript/pluginscript_loader.cpp
+++ b/modules/gdnative/pluginscript/pluginscript_loader.cpp
@@ -29,7 +29,7 @@
/*************************************************************************/
// Godot imports
-#include "core/os/file_access.h"
+#include "core/io/file_access.h"
// Pythonscript imports
#include "pluginscript_language.h"
#include "pluginscript_loader.h"
diff --git a/modules/gdnative/pluginscript/pluginscript_script.cpp b/modules/gdnative/pluginscript/pluginscript_script.cpp
index 6bb11d3e8f..1dabb1db63 100644
--- a/modules/gdnative/pluginscript/pluginscript_script.cpp
+++ b/modules/gdnative/pluginscript/pluginscript_script.cpp
@@ -29,7 +29,7 @@
/*************************************************************************/
// Godot imports
-#include "core/os/file_access.h"
+#include "core/io/file_access.h"
// PluginScript imports
#include "pluginscript_instance.h"
#include "pluginscript_script.h"
@@ -94,7 +94,7 @@ Variant PluginScript::_new(const Variant **p_args, int p_argcount, Callable::Cal
Object *owner = nullptr;
if (get_instance_base_type() == "") {
- owner = memnew(Reference);
+ owner = memnew(RefCounted);
} else {
owner = ClassDB::instance(get_instance_base_type());
}
@@ -104,7 +104,7 @@ Variant PluginScript::_new(const Variant **p_args, int p_argcount, Callable::Cal
return Variant();
}
- Reference *r = Object::cast_to<Reference>(owner);
+ RefCounted *r = Object::cast_to<RefCounted>(owner);
if (r) {
ref = REF(r);
}
diff --git a/modules/gdnative/pluginscript/register_types.cpp b/modules/gdnative/pluginscript/register_types.cpp
index b94538b2f7..433544178f 100644
--- a/modules/gdnative/pluginscript/register_types.cpp
+++ b/modules/gdnative/pluginscript/register_types.cpp
@@ -31,9 +31,9 @@
#include "register_types.h"
#include "core/config/project_settings.h"
+#include "core/io/dir_access.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 "scene/main/scene_tree.h"
diff --git a/modules/gdnative/videodecoder/video_stream_gdnative.h b/modules/gdnative/videodecoder/video_stream_gdnative.h
index 140888cd4b..c605dbb433 100644
--- a/modules/gdnative/videodecoder/video_stream_gdnative.h
+++ b/modules/gdnative/videodecoder/video_stream_gdnative.h
@@ -32,7 +32,7 @@
#define VIDEO_STREAM_GDNATIVE_H
#include "../gdnative.h"
-#include "core/os/file_access.h"
+#include "core/io/file_access.h"
#include "scene/resources/texture.h"
#include "scene/resources/video_stream.h"
diff --git a/modules/gdnative/xr/xr_interface_gdnative.cpp b/modules/gdnative/xr/xr_interface_gdnative.cpp
index 258fb75000..ff959affa3 100644
--- a/modules/gdnative/xr/xr_interface_gdnative.cpp
+++ b/modules/gdnative/xr/xr_interface_gdnative.cpp
@@ -70,8 +70,13 @@ void XRInterfaceGDNative::set_interface(const godot_xr_interface_gdnative *p_int
// this should only be called once, just being paranoid..
if (interface) {
cleanup();
+ interface = NULL;
}
+ // validate
+ ERR_FAIL_NULL(p_interface);
+ ERR_FAIL_COND_MSG(p_interface->version.major < 4, "This is an incompatible GDNative XR plugin.");
+
// bind to our interface
interface = p_interface;
@@ -119,14 +124,14 @@ int XRInterfaceGDNative::get_camera_feed_id() {
return (unsigned int)interface->get_camera_feed_id(data);
}
-bool XRInterfaceGDNative::is_stereo() {
- bool stereo;
+uint32_t XRInterfaceGDNative::get_view_count() {
+ uint32_t view_count;
- ERR_FAIL_COND_V(interface == nullptr, false);
+ ERR_FAIL_COND_V(interface == nullptr, 1);
- stereo = interface->is_stereo(data);
+ view_count = interface->get_view_count(data);
- return stereo;
+ return view_count;
}
bool XRInterfaceGDNative::is_initialized() const {
@@ -173,28 +178,52 @@ Size2 XRInterfaceGDNative::get_render_targetsize() {
return *vec;
}
-Transform3D XRInterfaceGDNative::get_transform_for_eye(XRInterface::Eyes p_eye, const Transform3D &p_cam_transform) {
+Transform3D XRInterfaceGDNative::get_camera_transform() {
Transform3D *ret;
ERR_FAIL_COND_V(interface == nullptr, Transform3D());
- godot_transform3d t = interface->get_transform_for_eye(data, (int)p_eye, (godot_transform3d *)&p_cam_transform);
+ godot_transform3d t = interface->get_camera_transform(data);
ret = (Transform3D *)&t;
return *ret;
}
-CameraMatrix XRInterfaceGDNative::get_projection_for_eye(XRInterface::Eyes p_eye, real_t p_aspect, real_t p_z_near, real_t p_z_far) {
+Transform3D XRInterfaceGDNative::get_transform_for_view(uint32_t p_view, const Transform3D &p_cam_transform) {
+ Transform3D *ret;
+
+ ERR_FAIL_COND_V(interface == nullptr, Transform3D());
+
+ godot_transform3d t = interface->get_transform_for_view(data, (int)p_view, (godot_transform3d *)&p_cam_transform);
+
+ ret = (Transform3D *)&t;
+
+ return *ret;
+}
+
+CameraMatrix XRInterfaceGDNative::get_projection_for_view(uint32_t p_view, real_t p_aspect, real_t p_z_near, real_t p_z_far) {
CameraMatrix cm;
ERR_FAIL_COND_V(interface == nullptr, CameraMatrix());
- interface->fill_projection_for_eye(data, (godot_float *)cm.matrix, (godot_int)p_eye, p_aspect, p_z_near, p_z_far);
+ interface->fill_projection_for_view(data, (godot_real_t *)cm.matrix, (godot_int)p_view, p_aspect, p_z_near, p_z_far);
return cm;
}
+Vector<BlitToScreen> XRInterfaceGDNative::commit_views(RID p_render_target, const Rect2 &p_screen_rect) {
+ // possibly move this as a member variable and add a callback to populate?
+ Vector<BlitToScreen> blit_to_screen;
+
+ ERR_FAIL_COND_V(interface == nullptr, blit_to_screen);
+
+ // must implement
+ interface->commit_views(data, (godot_rid *)&p_render_target, (godot_rect2 *)&p_screen_rect);
+
+ return blit_to_screen;
+}
+
unsigned int XRInterfaceGDNative::get_external_texture_for_eye(XRInterface::Eyes p_eye) {
ERR_FAIL_COND_V(interface == nullptr, 0);
@@ -234,7 +263,7 @@ void GDAPI godot_xr_register_interface(const godot_xr_interface_gdnative *p_inte
XRServer::get_singleton()->add_interface(new_interface);
}
-godot_float GDAPI godot_xr_get_worldscale() {
+godot_real_t GDAPI godot_xr_get_worldscale() {
XRServer *xr_server = XRServer::get_singleton();
ERR_FAIL_NULL_V(xr_server, 1.0);
@@ -388,7 +417,7 @@ void GDAPI godot_xr_set_controller_button(godot_int p_controller_id, godot_int p
}
}
-void GDAPI godot_xr_set_controller_axis(godot_int p_controller_id, godot_int p_axis, godot_float p_value, godot_bool p_can_be_negative) {
+void GDAPI godot_xr_set_controller_axis(godot_int p_controller_id, godot_int p_axis, godot_real_t p_value, godot_bool p_can_be_negative) {
XRServer *xr_server = XRServer::get_singleton();
ERR_FAIL_NULL(xr_server);
@@ -407,7 +436,7 @@ void GDAPI godot_xr_set_controller_axis(godot_int p_controller_id, godot_int p_a
}
}
-godot_float GDAPI godot_xr_get_controller_rumble(godot_int p_controller_id) {
+godot_real_t GDAPI godot_xr_get_controller_rumble(godot_int p_controller_id) {
XRServer *xr_server = XRServer::get_singleton();
ERR_FAIL_NULL_V(xr_server, 0.0);
diff --git a/modules/gdnative/xr/xr_interface_gdnative.h b/modules/gdnative/xr/xr_interface_gdnative.h
index 42098ebeff..42e9206c1f 100644
--- a/modules/gdnative/xr/xr_interface_gdnative.h
+++ b/modules/gdnative/xr/xr_interface_gdnative.h
@@ -72,20 +72,24 @@ public:
/** rendering and internal **/
virtual Size2 get_render_targetsize() override;
- virtual bool is_stereo() override;
- virtual Transform3D get_transform_for_eye(XRInterface::Eyes p_eye, const Transform3D &p_cam_transform) override;
+ virtual uint32_t get_view_count() override;
+ virtual Transform3D get_camera_transform() override;
+ virtual Transform3D get_transform_for_view(uint32_t p_view, const Transform3D &p_cam_transform) override;
// we expose a Vector<float> version of this function to GDNative
Vector<float> _get_projection_for_eye(XRInterface::Eyes p_eye, real_t p_aspect, real_t p_z_near, real_t p_z_far);
// and a CameraMatrix version to XRServer
- virtual CameraMatrix get_projection_for_eye(XRInterface::Eyes p_eye, real_t p_aspect, real_t p_z_near, real_t p_z_far) override;
+ virtual CameraMatrix get_projection_for_view(uint32_t p_view, real_t p_aspect, real_t p_z_near, real_t p_z_far) override;
- virtual unsigned int get_external_texture_for_eye(XRInterface::Eyes p_eye) override;
- virtual void commit_for_eye(XRInterface::Eyes p_eye, RID p_render_target, const Rect2 &p_screen_rect) override;
+ virtual Vector<BlitToScreen> commit_views(RID p_render_target, const Rect2 &p_screen_rect) override;
virtual void process() override;
virtual void notification(int p_what) override;
+
+ // deprecated
+ virtual void commit_for_eye(XRInterface::Eyes p_eye, RID p_render_target, const Rect2 &p_screen_rect) override;
+ virtual unsigned int get_external_texture_for_eye(XRInterface::Eyes p_eye) override;
};
#endif // XR_INTERFACE_GDNATIVE_H
diff --git a/modules/gdscript/doc_classes/@GDScript.xml b/modules/gdscript/doc_classes/@GDScript.xml
index 9e974b6fdc..58620f2b3e 100644
--- a/modules/gdscript/doc_classes/@GDScript.xml
+++ b/modules/gdscript/doc_classes/@GDScript.xml
@@ -240,10 +240,10 @@
</method>
</methods>
<constants>
- <constant name="PI" value="3.141593">
+ <constant name="PI" value="3.14159265358979">
Constant that represents how many times the diameter of a circle fits around its perimeter. This is equivalent to [code]TAU / 2[/code].
</constant>
- <constant name="TAU" value="6.283185">
+ <constant name="TAU" value="6.28318530717959">
The circle constant, the circumference of the unit circle in radians.
</constant>
<constant name="INF" value="inf">
diff --git a/modules/gdscript/gdscript.cpp b/modules/gdscript/gdscript.cpp
index e99c3d6cca..1567576009 100644
--- a/modules/gdscript/gdscript.cpp
+++ b/modules/gdscript/gdscript.cpp
@@ -36,8 +36,8 @@
#include "core/config/project_settings.h"
#include "core/core_constants.h"
#include "core/core_string_names.h"
+#include "core/io/file_access.h"
#include "core/io/file_access_encrypted.h"
-#include "core/os/file_access.h"
#include "core/os/os.h"
#include "gdscript_analyzer.h"
#include "gdscript_cache.h"
@@ -75,9 +75,9 @@ Variant GDScriptNativeClass::_new() {
Object *o = instance();
ERR_FAIL_COND_V_MSG(!o, Variant(), "Class type: '" + String(name) + "' is not instantiable.");
- Reference *ref = Object::cast_to<Reference>(o);
- if (ref) {
- return REF(ref);
+ RefCounted *rc = Object::cast_to<RefCounted>(o);
+ if (rc) {
+ return REF(rc);
} else {
return o;
}
@@ -98,11 +98,11 @@ void GDScript::_super_implicit_constructor(GDScript *p_script, GDScriptInstance
p_script->implicit_initializer->call(p_instance, nullptr, 0, r_error);
}
-GDScriptInstance *GDScript::_create_instance(const Variant **p_args, int p_argcount, Object *p_owner, bool p_isref, Callable::CallError &r_error) {
+GDScriptInstance *GDScript::_create_instance(const Variant **p_args, int p_argcount, Object *p_owner, bool p_is_ref_counted, Callable::CallError &r_error) {
/* STEP 1, CREATE */
GDScriptInstance *instance = memnew(GDScriptInstance);
- instance->base_ref = p_isref;
+ instance->base_ref_counted = p_is_ref_counted;
instance->members.resize(member_indices.size());
instance->script = Ref<GDScript>(this);
instance->owner = p_owner;
@@ -172,11 +172,11 @@ Variant GDScript::_new(const Variant **p_args, int p_argcount, Callable::CallErr
if (_baseptr->native.ptr()) {
owner = _baseptr->native->instance();
} else {
- owner = memnew(Reference); //by default, no base means use reference
+ owner = memnew(RefCounted); //by default, no base means use reference
}
ERR_FAIL_COND_V_MSG(!owner, Variant(), "Can't inherit from a virtual class.");
- Reference *r = Object::cast_to<Reference>(owner);
+ RefCounted *r = Object::cast_to<RefCounted>(owner);
if (r) {
ref = REF(r);
}
@@ -353,14 +353,14 @@ ScriptInstance *GDScript::instance_create(Object *p_this) {
}
Callable::CallError unchecked_error;
- return _create_instance(nullptr, 0, p_this, Object::cast_to<Reference>(p_this) != nullptr, unchecked_error);
+ return _create_instance(nullptr, 0, p_this, Object::cast_to<RefCounted>(p_this) != nullptr, unchecked_error);
}
PlaceHolderScriptInstance *GDScript::placeholder_instance_create(Object *p_this) {
#ifdef TOOLS_ENABLED
PlaceHolderScriptInstance *si = memnew(PlaceHolderScriptInstance(GDScriptLanguage::get_singleton(), Ref<Script>(this), p_this));
placeholders.insert(si);
- _update_exports();
+ _update_exports(nullptr, false, si);
return si;
#else
return nullptr;
@@ -584,7 +584,7 @@ void GDScript::_update_doc() {
}
#endif
-bool GDScript::_update_exports(bool *r_err, bool p_recursive_call) {
+bool GDScript::_update_exports(bool *r_err, bool p_recursive_call, PlaceHolderScriptInstance *p_instance_to_update) {
#ifdef TOOLS_ENABLED
static Vector<GDScript *> base_caches;
@@ -721,15 +721,19 @@ bool GDScript::_update_exports(bool *r_err, bool p_recursive_call) {
}
}
- if (placeholders.size()) { //hm :(
+ if ((changed || p_instance_to_update) && placeholders.size()) { //hm :(
// update placeholders if any
Map<StringName, Variant> values;
List<PropertyInfo> propnames;
_update_exports_values(values, propnames);
- for (Set<PlaceHolderScriptInstance *>::Element *E = placeholders.front(); E; E = E->next()) {
- E->get()->update(propnames, values);
+ if (changed) {
+ for (Set<PlaceHolderScriptInstance *>::Element *E = placeholders.front(); E; E = E->next()) {
+ E->get()->update(propnames, values);
+ }
+ } else {
+ p_instance_to_update->update(propnames, values);
}
}
@@ -1576,7 +1580,7 @@ void GDScriptInstance::reload_members() {
GDScriptInstance::GDScriptInstance() {
owner = nullptr;
- base_ref = false;
+ base_ref_counted = false;
}
GDScriptInstance::~GDScriptInstance() {
@@ -2064,7 +2068,7 @@ String GDScriptLanguage::get_global_class_name(const String &p_path, String *r_b
if (err == OK) {
const GDScriptParser::ClassNode *c = parser.get_tree();
if (r_icon_path) {
- if (c->icon_path.is_empty() || c->icon_path.is_abs_path()) {
+ if (c->icon_path.is_empty() || c->icon_path.is_absolute_path()) {
*r_icon_path = c->icon_path;
} else if (c->icon_path.is_rel_path()) {
*r_icon_path = p_path.get_base_dir().plus_file(c->icon_path).simplify_path();
@@ -2132,7 +2136,7 @@ String GDScriptLanguage::get_global_class_name(const String &p_path, String *r_b
break;
}
} else {
- *r_base_type = "Reference";
+ *r_base_type = "RefCounted";
subclass = nullptr;
}
}
diff --git a/modules/gdscript/gdscript.h b/modules/gdscript/gdscript.h
index 8b1b859ca2..602553bb1a 100644
--- a/modules/gdscript/gdscript.h
+++ b/modules/gdscript/gdscript.h
@@ -39,8 +39,8 @@
#include "core/object/script_language.h"
#include "gdscript_function.h"
-class GDScriptNativeClass : public Reference {
- GDCLASS(GDScriptNativeClass, Reference);
+class GDScriptNativeClass : public RefCounted {
+ GDCLASS(GDScriptNativeClass, RefCounted);
StringName name;
@@ -132,7 +132,7 @@ class GDScript : public Script {
SelfList<GDScriptFunctionState>::List pending_func_states;
void _super_implicit_constructor(GDScript *p_script, GDScriptInstance *p_instance, Callable::CallError &r_error);
- GDScriptInstance *_create_instance(const Variant **p_args, int p_argcount, Object *p_owner, bool p_isref, Callable::CallError &r_error);
+ GDScriptInstance *_create_instance(const Variant **p_args, int p_argcount, Object *p_owner, bool p_is_ref_counted, Callable::CallError &r_error);
void _set_subclass_path(Ref<GDScript> &p_sc, const String &p_path);
@@ -148,7 +148,7 @@ class GDScript : public Script {
#endif
- bool _update_exports(bool *r_err = nullptr, bool p_recursive_call = false);
+ bool _update_exports(bool *r_err = nullptr, bool p_recursive_call = false, PlaceHolderScriptInstance *p_instance_to_update = nullptr);
void _save_orphaned_subclasses();
void _init_rpc_methods_properties();
@@ -157,7 +157,7 @@ class GDScript : public Script {
void _get_script_method_list(List<MethodInfo> *r_list, bool p_include_base) const;
void _get_script_signal_list(List<MethodInfo> *r_list, bool p_include_base) const;
- // This method will map the class name from "Reference" to "MyClass.InnerClass".
+ // This method will map the class name from "RefCounted" to "MyClass.InnerClass".
static String _get_gdscript_reference_class_name(const GDScript *p_gdscript);
protected:
@@ -270,7 +270,7 @@ class GDScriptInstance : public ScriptInstance {
Map<StringName, int> member_indices_cache; //used only for hot script reloading
#endif
Vector<Variant> members;
- bool base_ref;
+ bool base_ref_counted;
SelfList<GDScriptFunctionState>::List pending_func_states;
diff --git a/modules/gdscript/gdscript_analyzer.cpp b/modules/gdscript/gdscript_analyzer.cpp
index e92adee8e8..c3edc813d2 100644
--- a/modules/gdscript/gdscript_analyzer.cpp
+++ b/modules/gdscript/gdscript_analyzer.cpp
@@ -31,10 +31,10 @@
#include "gdscript_analyzer.h"
#include "core/config/project_settings.h"
+#include "core/io/file_access.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/templates/hash_map.h"
#include "gdscript.h"
#include "gdscript_utility_functions.h"
@@ -163,7 +163,7 @@ Error GDScriptAnalyzer::resolve_inheritance(GDScriptParser::ClassNode *p_class,
if (!p_class->extends_used) {
result.type_source = GDScriptParser::DataType::ANNOTATED_INFERRED;
result.kind = GDScriptParser::DataType::NATIVE;
- result.native_type = "Reference";
+ result.native_type = "RefCounted";
} else {
result.type_source = GDScriptParser::DataType::ANNOTATED_EXPLICIT;
diff --git a/modules/gdscript/gdscript_analyzer.h b/modules/gdscript/gdscript_analyzer.h
index aabf407c76..8cd3fcf837 100644
--- a/modules/gdscript/gdscript_analyzer.h
+++ b/modules/gdscript/gdscript_analyzer.h
@@ -32,7 +32,7 @@
#define GDSCRIPT_ANALYZER_H
#include "core/object/object.h"
-#include "core/object/reference.h"
+#include "core/object/ref_counted.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 601cdb4080..a3b1fb93f9 100644
--- a/modules/gdscript/gdscript_cache.cpp
+++ b/modules/gdscript/gdscript_cache.cpp
@@ -30,7 +30,7 @@
#include "gdscript_cache.h"
-#include "core/os/file_access.h"
+#include "core/io/file_access.h"
#include "core/templates/vector.h"
#include "gdscript.h"
#include "gdscript_analyzer.h"
diff --git a/modules/gdscript/gdscript_cache.h b/modules/gdscript/gdscript_cache.h
index d1d2a2abbf..943638d29f 100644
--- a/modules/gdscript/gdscript_cache.h
+++ b/modules/gdscript/gdscript_cache.h
@@ -31,7 +31,7 @@
#ifndef GDSCRIPT_CACHE_H
#define GDSCRIPT_CACHE_H
-#include "core/object/reference.h"
+#include "core/object/ref_counted.h"
#include "core/os/mutex.h"
#include "core/templates/hash_map.h"
#include "core/templates/set.h"
@@ -40,7 +40,7 @@
class GDScriptAnalyzer;
class GDScriptParser;
-class GDScriptParserRef : public Reference {
+class GDScriptParserRef : public RefCounted {
public:
enum Status {
EMPTY,
diff --git a/modules/gdscript/gdscript_compiler.cpp b/modules/gdscript/gdscript_compiler.cpp
index c7ca9449c2..6d6b9e15af 100644
--- a/modules/gdscript/gdscript_compiler.cpp
+++ b/modules/gdscript/gdscript_compiler.cpp
@@ -2282,9 +2282,10 @@ Error GDScriptCompiler::_parse_class_level(GDScript *p_script, const GDScriptPar
}
prop_info.hint = export_info.hint;
prop_info.hint_string = export_info.hint_string;
- prop_info.usage = export_info.usage;
+ prop_info.usage = export_info.usage | PROPERTY_USAGE_SCRIPT_VARIABLE;
+ } else {
+ prop_info.usage = PROPERTY_USAGE_SCRIPT_VARIABLE;
}
- prop_info.usage |= PROPERTY_USAGE_SCRIPT_VARIABLE;
#ifdef TOOLS_ENABLED
p_script->doc_variables[name] = variable->doc_description;
#endif
@@ -2511,7 +2512,7 @@ Error GDScriptCompiler::_parse_class_blocks(GDScript *p_script, const GDScriptPa
p_script->placeholders.erase(psi); //remove placeholder
GDScriptInstance *instance = memnew(GDScriptInstance);
- instance->base_ref = Object::cast_to<Reference>(E->get());
+ instance->base_ref_counted = Object::cast_to<RefCounted>(E->get());
instance->members.resize(p_script->member_indices.size());
instance->script = Ref<GDScript>(p_script);
instance->owner = E->get();
diff --git a/modules/gdscript/gdscript_editor.cpp b/modules/gdscript/gdscript_editor.cpp
index 504c7414f6..9aad14c2be 100644
--- a/modules/gdscript/gdscript_editor.cpp
+++ b/modules/gdscript/gdscript_editor.cpp
@@ -32,7 +32,7 @@
#include "core/config/engine.h"
#include "core/core_constants.h"
-#include "core/os/file_access.h"
+#include "core/io/file_access.h"
#include "gdscript_analyzer.h"
#include "gdscript_compiler.h"
#include "gdscript_parser.h"
diff --git a/modules/gdscript/gdscript_function.h b/modules/gdscript/gdscript_function.h
index cd1704cb03..553c2ecc01 100644
--- a/modules/gdscript/gdscript_function.h
+++ b/modules/gdscript/gdscript_function.h
@@ -31,7 +31,7 @@
#ifndef GDSCRIPT_FUNCTION_H
#define GDSCRIPT_FUNCTION_H
-#include "core/object/reference.h"
+#include "core/object/ref_counted.h"
#include "core/object/script_language.h"
#include "core/os/thread.h"
#include "core/string/string_name.h"
@@ -597,8 +597,8 @@ public:
~GDScriptFunction();
};
-class GDScriptFunctionState : public Reference {
- GDCLASS(GDScriptFunctionState, Reference);
+class GDScriptFunctionState : public RefCounted {
+ GDCLASS(GDScriptFunctionState, RefCounted);
friend class GDScriptFunction;
GDScriptFunction *function = nullptr;
GDScriptFunction::CallState state;
diff --git a/modules/gdscript/gdscript_lambda_callable.h b/modules/gdscript/gdscript_lambda_callable.h
index 357c845250..336778d549 100644
--- a/modules/gdscript/gdscript_lambda_callable.h
+++ b/modules/gdscript/gdscript_lambda_callable.h
@@ -31,7 +31,7 @@
#ifndef GDSCRIPT_LAMBDA_CALLABLE
#define GDSCRIPT_LAMBDA_CALLABLE
-#include "core/object/reference.h"
+#include "core/object/ref_counted.h"
#include "core/templates/vector.h"
#include "core/variant/callable.h"
#include "core/variant/variant.h"
diff --git a/modules/gdscript/gdscript_parser.cpp b/modules/gdscript/gdscript_parser.cpp
index 1af54ea8df..ab40b99bb4 100644
--- a/modules/gdscript/gdscript_parser.cpp
+++ b/modules/gdscript/gdscript_parser.cpp
@@ -31,9 +31,9 @@
#include "gdscript_parser.h"
#include "core/config/project_settings.h"
+#include "core/io/file_access.h"
#include "core/io/resource_loader.h"
#include "core/math/math_defs.h"
-#include "core/os/file_access.h"
#include "gdscript.h"
#ifdef DEBUG_ENABLED
diff --git a/modules/gdscript/gdscript_parser.h b/modules/gdscript/gdscript_parser.h
index ee5e411cad..9e0b60a407 100644
--- a/modules/gdscript/gdscript_parser.h
+++ b/modules/gdscript/gdscript_parser.h
@@ -33,7 +33,7 @@
#include "core/io/multiplayer_api.h"
#include "core/io/resource.h"
-#include "core/object/reference.h"
+#include "core/object/ref_counted.h"
#include "core/object/script_language.h"
#include "core/string/string_name.h"
#include "core/string/ustring.h"
diff --git a/modules/gdscript/gdscript_vm.cpp b/modules/gdscript/gdscript_vm.cpp
index 318ec966ae..8a261a88e3 100644
--- a/modules/gdscript/gdscript_vm.cpp
+++ b/modules/gdscript/gdscript_vm.cpp
@@ -1989,7 +1989,10 @@ Variant GDScriptFunction::call(GDScriptInstance *p_instance, const Variant **p_a
ip += instr_arg_count;
- int self_fun = _code_ptr[ip + 1];
+ int argc = _code_ptr[ip + 1];
+ GD_ERR_BREAK(argc < 0);
+
+ int self_fun = _code_ptr[ip + 2];
#ifdef DEBUG_ENABLED
if (self_fun < 0 || self_fun >= _global_names_count) {
err_text = "compiler bug, function name not found";
@@ -1998,9 +2001,6 @@ Variant GDScriptFunction::call(GDScriptInstance *p_instance, const Variant **p_a
#endif
const StringName *methodname = &_global_names_ptr[self_fun];
- int argc = _code_ptr[ip + 2];
- GD_ERR_BREAK(argc < 0);
-
Variant **argptrs = instruction_args;
GET_INSTRUCTION_ARG(dst, argc);
diff --git a/modules/gdscript/language_server/gdscript_language_protocol.h b/modules/gdscript/language_server/gdscript_language_protocol.h
index a5c5a233b1..969c38eab6 100644
--- a/modules/gdscript/language_server/gdscript_language_protocol.h
+++ b/modules/gdscript/language_server/gdscript_language_protocol.h
@@ -46,7 +46,7 @@ class GDScriptLanguageProtocol : public JSONRPC {
GDCLASS(GDScriptLanguageProtocol, JSONRPC)
private:
- struct LSPeer : Reference {
+ struct LSPeer : RefCounted {
Ref<StreamPeerTCP> connection;
uint8_t req_buf[LSP_MAX_BUFFER_SIZE];
diff --git a/modules/gdscript/language_server/gdscript_language_server.cpp b/modules/gdscript/language_server/gdscript_language_server.cpp
index 340a7b9343..33597c286f 100644
--- a/modules/gdscript/language_server/gdscript_language_server.cpp
+++ b/modules/gdscript/language_server/gdscript_language_server.cpp
@@ -30,7 +30,7 @@
#include "gdscript_language_server.h"
-#include "core/os/file_access.h"
+#include "core/io/file_access.h"
#include "core/os/os.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 792e601bc1..17f1d5d5e3 100644
--- a/modules/gdscript/language_server/gdscript_text_document.h
+++ b/modules/gdscript/language_server/gdscript_text_document.h
@@ -31,12 +31,12 @@
#ifndef GDSCRIPT_TEXT_DOCUMENT_H
#define GDSCRIPT_TEXT_DOCUMENT_H
-#include "core/object/reference.h"
-#include "core/os/file_access.h"
+#include "core/io/file_access.h"
+#include "core/object/ref_counted.h"
#include "lsp.hpp"
-class GDScriptTextDocument : public Reference {
- GDCLASS(GDScriptTextDocument, Reference)
+class GDScriptTextDocument : public RefCounted {
+ GDCLASS(GDScriptTextDocument, RefCounted)
protected:
static void _bind_methods();
diff --git a/modules/gdscript/language_server/gdscript_workspace.h b/modules/gdscript/language_server/gdscript_workspace.h
index 27616a2989..8b166a873c 100644
--- a/modules/gdscript/language_server/gdscript_workspace.h
+++ b/modules/gdscript/language_server/gdscript_workspace.h
@@ -37,8 +37,8 @@
#include "gdscript_extend_parser.h"
#include "lsp.hpp"
-class GDScriptWorkspace : public Reference {
- GDCLASS(GDScriptWorkspace, Reference);
+class GDScriptWorkspace : public RefCounted {
+ GDCLASS(GDScriptWorkspace, RefCounted);
private:
void _get_owners(EditorFileSystemDirectory *efsd, String p_path, List<String> &owners);
diff --git a/modules/gdscript/language_server/lsp.hpp b/modules/gdscript/language_server/lsp.hpp
index 47bcfeaefc..a7dcfdb22d 100644
--- a/modules/gdscript/language_server/lsp.hpp
+++ b/modules/gdscript/language_server/lsp.hpp
@@ -766,7 +766,7 @@ struct MarkupContent {
// Use namespace instead of enumeration to follow the LSP specifications
// lsp::EnumName::EnumValue is OK but lsp::EnumValue is not
-// And here C++ compilers are unhappy with our enumeration name like Color, File, Reference etc.
+// And here C++ compilers are unhappy with our enumeration name like Color, File, RefCounted etc.
/**
* The kind of a completion entry.
*/
@@ -788,7 +788,7 @@ static const int Keyword = 14;
static const int Snippet = 15;
static const int Color = 16;
static const int File = 17;
-static const int Reference = 18;
+static const int RefCounted = 18;
static const int Folder = 19;
static const int EnumMember = 20;
static const int Constant = 21;
diff --git a/modules/gdscript/register_types.cpp b/modules/gdscript/register_types.cpp
index 2d2f94f5e0..867142019f 100644
--- a/modules/gdscript/register_types.cpp
+++ b/modules/gdscript/register_types.cpp
@@ -30,10 +30,10 @@
#include "register_types.h"
+#include "core/io/dir_access.h"
+#include "core/io/file_access.h"
#include "core/io/file_access_encrypted.h"
#include "core/io/resource_loader.h"
-#include "core/os/dir_access.h"
-#include "core/os/file_access.h"
#include "gdscript.h"
#include "gdscript_analyzer.h"
#include "gdscript_cache.h"
diff --git a/modules/gdscript/tests/gdscript_test_runner.cpp b/modules/gdscript/tests/gdscript_test_runner.cpp
index e20e427597..67bc927517 100644
--- a/modules/gdscript/tests/gdscript_test_runner.cpp
+++ b/modules/gdscript/tests/gdscript_test_runner.cpp
@@ -37,8 +37,8 @@
#include "core/config/project_settings.h"
#include "core/core_string_names.h"
+#include "core/io/dir_access.h"
#include "core/io/file_access_pack.h"
-#include "core/os/dir_access.h"
#include "core/os/os.h"
#include "core/string/string_builder.h"
#include "scene/resources/packed_scene.h"
@@ -511,9 +511,9 @@ GDScriptTest::TestResult GDScriptTest::execute_test_code(bool p_is_generating) {
// Create object instance for test.
Object *obj = ClassDB::instance(script->get_native()->get_name());
- Ref<Reference> obj_ref;
- if (obj->is_reference()) {
- obj_ref = Ref<Reference>(Object::cast_to<Reference>(obj));
+ Ref<RefCounted> obj_ref;
+ if (obj->is_ref_counted()) {
+ obj_ref = Ref<RefCounted>(Object::cast_to<RefCounted>(obj));
}
obj->set_script(script);
GDScriptInstance *instance = static_cast<GDScriptInstance *>(obj->get_script_instance());
diff --git a/modules/gdscript/tests/gdscript_test_runner_suite.h b/modules/gdscript/tests/gdscript_test_runner_suite.h
index 8fd77239cd..cf4e61f07d 100644
--- a/modules/gdscript/tests/gdscript_test_runner_suite.h
+++ b/modules/gdscript/tests/gdscript_test_runner_suite.h
@@ -51,7 +51,7 @@ TEST_SUITE("[Modules][GDScript]") {
TEST_CASE("[Modules][GDScript] Load source code dynamically and run it") {
Ref<GDScript> gdscript = memnew(GDScript);
gdscript->set_source_code(R"(
-extends Reference
+extends RefCounted
func _init():
set_meta("result", 42)
@@ -64,9 +64,9 @@ func _init():
CHECK_MESSAGE(error == OK, "The script should parse successfully.");
// Run the script by assigning it to a reference-counted object.
- Ref<Reference> reference = memnew(Reference);
- reference->set_script(gdscript);
- CHECK_MESSAGE(int(reference->get_meta("result")) == 42, "The script should assign object metadata successfully.");
+ Ref<RefCounted> ref_counted = memnew(RefCounted);
+ ref_counted->set_script(gdscript);
+ CHECK_MESSAGE(int(ref_counted->get_meta("result")) == 42, "The script should assign object metadata successfully.");
}
} // namespace GDScriptTests
diff --git a/modules/gdscript/tests/test_gdscript.cpp b/modules/gdscript/tests/test_gdscript.cpp
index fc73b5bb72..c37d52febd 100644
--- a/modules/gdscript/tests/test_gdscript.cpp
+++ b/modules/gdscript/tests/test_gdscript.cpp
@@ -31,8 +31,8 @@
#include "test_gdscript.h"
#include "core/config/project_settings.h"
+#include "core/io/file_access.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/string/string_builder.h"
diff --git a/modules/glslang/register_types.cpp b/modules/glslang/register_types.cpp
index 8979eabfc3..730c6b89f7 100644
--- a/modules/glslang/register_types.cpp
+++ b/modules/glslang/register_types.cpp
@@ -116,6 +116,10 @@ static Vector<uint8_t> _compile_shader_glsl(RenderingDevice::ShaderStage p_stage
}
}
+ if (p_capabilities->supports_multiview) {
+ preamble += "#define has_VK_KHR_multiview 1\n";
+ }
+
if (preamble != "") {
shader.setPreamble(preamble.c_str());
}
diff --git a/modules/gltf/editor_scene_importer_gltf.cpp b/modules/gltf/editor_scene_importer_gltf.cpp
index 35f44ca122..21b4bb75fb 100644
--- a/modules/gltf/editor_scene_importer_gltf.cpp
+++ b/modules/gltf/editor_scene_importer_gltf.cpp
@@ -29,10 +29,10 @@
/*************************************************************************/
#include "core/crypto/crypto_core.h"
+#include "core/io/file_access.h"
#include "core/io/json.h"
#include "core/math/disjoint_set.h"
#include "core/math/math_defs.h"
-#include "core/os/file_access.h"
#include "core/os/os.h"
#include "editor/import/resource_importer_scene.h"
#include "modules/gltf/gltf_state.h"
diff --git a/modules/gltf/gltf_document.cpp b/modules/gltf/gltf_document.cpp
index fa93704fd9..bc4de76344 100644
--- a/modules/gltf/gltf_document.cpp
+++ b/modules/gltf/gltf_document.cpp
@@ -49,9 +49,9 @@
#include "core/core_bind.h"
#include "core/crypto/crypto_core.h"
+#include "core/io/file_access.h"
#include "core/io/json.h"
#include "core/math/disjoint_set.h"
-#include "core/os/file_access.h"
#include "core/variant/typed_array.h"
#include "core/version.h"
#include "core/version_hash.gen.h"
diff --git a/modules/mbedtls/crypto_mbedtls.cpp b/modules/mbedtls/crypto_mbedtls.cpp
index c389609984..3cd2da3d85 100644
--- a/modules/mbedtls/crypto_mbedtls.cpp
+++ b/modules/mbedtls/crypto_mbedtls.cpp
@@ -30,7 +30,7 @@
#include "crypto_mbedtls.h"
-#include "core/os/file_access.h"
+#include "core/io/file_access.h"
#include "core/config/engine.h"
#include "core/config/project_settings.h"
diff --git a/modules/mbedtls/packet_peer_mbed_dtls.cpp b/modules/mbedtls/packet_peer_mbed_dtls.cpp
index d77d946a77..11c9f64e21 100644
--- a/modules/mbedtls/packet_peer_mbed_dtls.cpp
+++ b/modules/mbedtls/packet_peer_mbed_dtls.cpp
@@ -31,8 +31,8 @@
#include "packet_peer_mbed_dtls.h"
#include "mbedtls/platform_util.h"
+#include "core/io/file_access.h"
#include "core/io/stream_peer_ssl.h"
-#include "core/os/file_access.h"
int PacketPeerMbedDTLS::bio_send(void *ctx, const unsigned char *buf, size_t len) {
if (buf == nullptr || len <= 0) {
diff --git a/modules/mbedtls/ssl_context_mbedtls.h b/modules/mbedtls/ssl_context_mbedtls.h
index 30632018a8..1b55a54a10 100644
--- a/modules/mbedtls/ssl_context_mbedtls.h
+++ b/modules/mbedtls/ssl_context_mbedtls.h
@@ -33,9 +33,9 @@
#include "crypto_mbedtls.h"
-#include "core/os/file_access.h"
+#include "core/io/file_access.h"
-#include "core/object/reference.h"
+#include "core/object/ref_counted.h"
#include <mbedtls/config.h>
#include <mbedtls/ctr_drbg.h>
@@ -46,7 +46,7 @@
class SSLContextMbedTLS;
-class CookieContextMbedTLS : public Reference {
+class CookieContextMbedTLS : public RefCounted {
friend class SSLContextMbedTLS;
protected:
@@ -63,7 +63,7 @@ public:
~CookieContextMbedTLS();
};
-class SSLContextMbedTLS : public Reference {
+class SSLContextMbedTLS : public RefCounted {
protected:
bool inited = false;
diff --git a/modules/mbedtls/stream_peer_mbedtls.cpp b/modules/mbedtls/stream_peer_mbedtls.cpp
index 8e40451806..bc72b04fa4 100644
--- a/modules/mbedtls/stream_peer_mbedtls.cpp
+++ b/modules/mbedtls/stream_peer_mbedtls.cpp
@@ -30,8 +30,8 @@
#include "stream_peer_mbedtls.h"
+#include "core/io/file_access.h"
#include "core/io/stream_peer_tcp.h"
-#include "core/os/file_access.h"
int StreamPeerMbedTLS::bio_send(void *ctx, const unsigned char *buf, size_t len) {
if (buf == nullptr || len <= 0) {
diff --git a/modules/minimp3/audio_stream_mp3.cpp b/modules/minimp3/audio_stream_mp3.cpp
index 24ec206191..600bbe9bb5 100644
--- a/modules/minimp3/audio_stream_mp3.cpp
+++ b/modules/minimp3/audio_stream_mp3.cpp
@@ -35,7 +35,7 @@
#include "audio_stream_mp3.h"
-#include "core/os/file_access.h"
+#include "core/io/file_access.h"
void AudioStreamPlaybackMP3::_mix_internal(AudioFrame *p_buffer, int p_frames) {
ERR_FAIL_COND(!active);
diff --git a/modules/minimp3/resource_importer_mp3.cpp b/modules/minimp3/resource_importer_mp3.cpp
index f5137965da..dc16125726 100644
--- a/modules/minimp3/resource_importer_mp3.cpp
+++ b/modules/minimp3/resource_importer_mp3.cpp
@@ -30,8 +30,8 @@
#include "resource_importer_mp3.h"
+#include "core/io/file_access.h"
#include "core/io/resource_saver.h"
-#include "core/os/file_access.h"
#include "scene/resources/texture.h"
String ResourceImporterMP3::get_importer_name() const {
diff --git a/modules/mobile_vr/mobile_vr_interface.cpp b/modules/mobile_vr/mobile_vr_interface.cpp
index 40b1745c35..590b95ab79 100644
--- a/modules/mobile_vr/mobile_vr_interface.cpp
+++ b/modules/mobile_vr/mobile_vr_interface.cpp
@@ -300,9 +300,9 @@ real_t MobileVRInterface::get_k2() const {
return k2;
};
-bool MobileVRInterface::is_stereo() {
+uint32_t MobileVRInterface::get_view_count() {
// needs stereo...
- return true;
+ return 2;
};
bool MobileVRInterface::is_initialized() const {
@@ -361,7 +361,29 @@ Size2 MobileVRInterface::get_render_targetsize() {
return target_size;
};
-Transform3D MobileVRInterface::get_transform_for_eye(XRInterface::Eyes p_eye, const Transform3D &p_cam_transform) {
+Transform3D MobileVRInterface::get_camera_transform() {
+ _THREAD_SAFE_METHOD_
+
+ Transform3D transform_for_eye;
+
+ XRServer *xr_server = XRServer::get_singleton();
+ ERR_FAIL_NULL_V(xr_server, transform_for_eye);
+
+ if (initialized) {
+ float world_scale = xr_server->get_world_scale();
+
+ // just scale our origin point of our transform
+ Transform3D hmd_transform;
+ hmd_transform.basis = orientation;
+ hmd_transform.origin = Vector3(0.0, eye_height * world_scale, 0.0);
+
+ transform_for_eye = (xr_server->get_reference_frame()) * hmd_transform;
+ }
+
+ return transform_for_eye;
+};
+
+Transform3D MobileVRInterface::get_transform_for_view(uint32_t p_view, const Transform3D &p_cam_transform) {
_THREAD_SAFE_METHOD_
Transform3D transform_for_eye;
@@ -374,12 +396,12 @@ Transform3D MobileVRInterface::get_transform_for_eye(XRInterface::Eyes p_eye, co
// we don't need to check for the existence of our HMD, doesn't affect our values...
// note * 0.01 to convert cm to m and * 0.5 as we're moving half in each direction...
- if (p_eye == XRInterface::EYE_LEFT) {
+ if (p_view == 0) {
transform_for_eye.origin.x = -(intraocular_dist * 0.01 * 0.5 * world_scale);
- } else if (p_eye == XRInterface::EYE_RIGHT) {
+ } else if (p_view == 1) {
transform_for_eye.origin.x = intraocular_dist * 0.01 * 0.5 * world_scale;
} else {
- // for mono we don't reposition, we want our center position.
+ // should not have any other values..
};
// just scale our origin point of our transform
@@ -396,21 +418,13 @@ Transform3D MobileVRInterface::get_transform_for_eye(XRInterface::Eyes p_eye, co
return transform_for_eye;
};
-CameraMatrix MobileVRInterface::get_projection_for_eye(XRInterface::Eyes p_eye, real_t p_aspect, real_t p_z_near, real_t p_z_far) {
+CameraMatrix MobileVRInterface::get_projection_for_view(uint32_t p_view, real_t p_aspect, real_t p_z_near, real_t p_z_far) {
_THREAD_SAFE_METHOD_
CameraMatrix eye;
- if (p_eye == XRInterface::EYE_MONO) {
- ///@TODO for now hardcode some of this, what is really needed here is that this needs to be in sync with the real camera's properties
- // which probably means implementing a specific class for iOS and Android. For now this is purely here as an example.
- // Note also that if you use a normal viewport with AR/VR turned off you can still use the tracker output of this interface
- // to position a stock standard Godot camera and have control over this.
- // This will make more sense when we implement ARkit on iOS (probably a separate interface).
- eye.set_perspective(60.0, p_aspect, p_z_near, p_z_far, false);
- } else {
- eye.set_for_hmd(p_eye == XRInterface::EYE_LEFT ? 1 : 2, p_aspect, intraocular_dist, display_width, display_to_lens, oversample, p_z_near, p_z_far);
- };
+ aspect = p_aspect;
+ eye.set_for_hmd(p_view + 1, p_aspect, intraocular_dist, display_width, display_to_lens, oversample, p_z_near, p_z_far);
return eye;
};
@@ -440,6 +454,45 @@ void MobileVRInterface::commit_for_eye(XRInterface::Eyes p_eye, RID p_render_tar
eye_center.y = 0.0;
}
+Vector<BlitToScreen> MobileVRInterface::commit_views(RID p_render_target, const Rect2 &p_screen_rect) {
+ _THREAD_SAFE_METHOD_
+
+ Vector<BlitToScreen> blit_to_screen;
+
+ // We must have a valid render target
+ ERR_FAIL_COND_V(!p_render_target.is_valid(), blit_to_screen);
+
+ // Because we are rendering to our device we must use our main viewport!
+ ERR_FAIL_COND_V(p_screen_rect == Rect2(), blit_to_screen);
+
+ // and add our blits
+ BlitToScreen blit;
+ blit.render_target = p_render_target;
+ blit.multi_view.use_layer = true;
+ blit.lens_distortion.apply = true;
+ blit.lens_distortion.k1 = k1;
+ blit.lens_distortion.k2 = k2;
+ blit.lens_distortion.upscale = oversample;
+ blit.lens_distortion.aspect_ratio = aspect;
+
+ // left eye
+ blit.rect = p_screen_rect;
+ blit.rect.size.width *= 0.5;
+ blit.multi_view.layer = 0;
+ blit.lens_distortion.eye_center.x = ((-intraocular_dist / 2.0) + (display_width / 4.0)) / (display_width / 2.0);
+ blit_to_screen.push_back(blit);
+
+ // right eye
+ blit.rect = p_screen_rect;
+ blit.rect.size.width *= 0.5;
+ blit.rect.position.x = blit.rect.size.width;
+ blit.multi_view.layer = 1;
+ blit.lens_distortion.eye_center.x = ((intraocular_dist / 2.0) - (display_width / 4.0)) / (display_width / 2.0);
+ blit_to_screen.push_back(blit);
+
+ return blit_to_screen;
+}
+
void MobileVRInterface::process() {
_THREAD_SAFE_METHOD_
diff --git a/modules/mobile_vr/mobile_vr_interface.h b/modules/mobile_vr/mobile_vr_interface.h
index aad40ebb5b..29ce0f92c8 100644
--- a/modules/mobile_vr/mobile_vr_interface.h
+++ b/modules/mobile_vr/mobile_vr_interface.h
@@ -63,9 +63,9 @@ private:
real_t display_to_lens = 4.0;
real_t oversample = 1.5;
- //@TODO not yet used, these are needed in our distortion shader...
real_t k1 = 0.215;
real_t k2 = 0.215;
+ real_t aspect = 1.0;
/*
logic for processing our sensor data, this was originally in our positional tracker logic but I think
@@ -138,16 +138,20 @@ public:
virtual void uninitialize() override;
virtual Size2 get_render_targetsize() override;
- virtual bool is_stereo() override;
- virtual Transform3D get_transform_for_eye(XRInterface::Eyes p_eye, const Transform3D &p_cam_transform) override;
- virtual CameraMatrix get_projection_for_eye(XRInterface::Eyes p_eye, real_t p_aspect, real_t p_z_near, real_t p_z_far) override;
- virtual void commit_for_eye(XRInterface::Eyes p_eye, RID p_render_target, const Rect2 &p_screen_rect) override;
+ virtual uint32_t get_view_count() override;
+ virtual Transform3D get_camera_transform() override;
+ virtual Transform3D get_transform_for_view(uint32_t p_view, const Transform3D &p_cam_transform) override;
+ virtual CameraMatrix get_projection_for_view(uint32_t p_view, real_t p_aspect, real_t p_z_near, real_t p_z_far) override;
+ virtual Vector<BlitToScreen> commit_views(RID p_render_target, const Rect2 &p_screen_rect) override;
virtual void process() override;
virtual void notification(int p_what) override {}
MobileVRInterface();
~MobileVRInterface();
+
+ // deprecated
+ virtual void commit_for_eye(XRInterface::Eyes p_eye, RID p_render_target, const Rect2 &p_screen_rect) override;
};
#endif // !MOBILE_VR_INTERFACE_H
diff --git a/modules/mono/class_db_api_json.cpp b/modules/mono/class_db_api_json.cpp
index 553c6eca53..bd02ec0eac 100644
--- a/modules/mono/class_db_api_json.cpp
+++ b/modules/mono/class_db_api_json.cpp
@@ -33,8 +33,8 @@
#ifdef DEBUG_METHODS_ENABLED
#include "core/config/project_settings.h"
+#include "core/io/file_access.h"
#include "core/io/json.h"
-#include "core/os/file_access.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/csharp_script.cpp b/modules/mono/csharp_script.cpp
index ac248bcff8..576256b6ec 100644
--- a/modules/mono/csharp_script.cpp
+++ b/modules/mono/csharp_script.cpp
@@ -37,8 +37,8 @@
#include "core/config/project_settings.h"
#include "core/debugger/engine_debugger.h"
#include "core/debugger/script_debugger.h"
+#include "core/io/file_access.h"
#include "core/io/json.h"
-#include "core/os/file_access.h"
#include "core/os/mutex.h"
#include "core/os/os.h"
#include "core/os/thread.h"
@@ -863,13 +863,13 @@ void CSharpLanguage::reload_assemblies(bool p_soft_reload) {
List<Ref<CSharpScript>> to_reload;
// We need to keep reference instances alive during reloading
- List<Ref<Reference>> ref_instances;
+ List<Ref<RefCounted>> rc_instances;
for (Map<Object *, CSharpScriptBinding>::Element *E = script_bindings.front(); E; E = E->next()) {
CSharpScriptBinding &script_binding = E->value();
- Reference *ref = Object::cast_to<Reference>(script_binding.owner);
- if (ref) {
- ref_instances.push_back(Ref<Reference>(ref));
+ RefCounted *rc = Object::cast_to<RefCounted>(script_binding.owner);
+ if (rc) {
+ rc_instances.push_back(Ref<RefCounted>(rc));
}
}
@@ -892,9 +892,9 @@ void CSharpLanguage::reload_assemblies(bool p_soft_reload) {
Object *obj = F->get();
script->pending_reload_instances.insert(obj->get_instance_id());
- Reference *ref = Object::cast_to<Reference>(obj);
- if (ref) {
- ref_instances.push_back(Ref<Reference>(ref));
+ RefCounted *rc = Object::cast_to<RefCounted>(obj);
+ if (rc) {
+ rc_instances.push_back(Ref<RefCounted>(rc));
}
}
@@ -903,9 +903,9 @@ void CSharpLanguage::reload_assemblies(bool p_soft_reload) {
Object *obj = F->get()->get_owner();
script->pending_reload_instances.insert(obj->get_instance_id());
- Reference *ref = Object::cast_to<Reference>(obj);
- if (ref) {
- ref_instances.push_back(Ref<Reference>(ref));
+ RefCounted *rc = Object::cast_to<RefCounted>(obj);
+ if (rc) {
+ rc_instances.push_back(Ref<RefCounted>(rc));
}
}
#endif
@@ -1438,16 +1438,16 @@ bool CSharpLanguage::setup_csharp_script_binding(CSharpScriptBinding &r_script_b
r_script_binding.owner = p_object;
// Tie managed to unmanaged
- Reference *ref = Object::cast_to<Reference>(p_object);
+ RefCounted *rc = Object::cast_to<RefCounted>(p_object);
- if (ref) {
+ if (rc) {
// Unsafe refcount increment. The managed instance also counts as a reference.
// This way if the unmanaged world has no references to our owner
// but the managed instance is alive, the refcount will be 1 instead of 0.
- // See: godot_icall_Reference_Dtor(MonoObject *p_obj, Object *p_ptr)
+ // See: godot_icall_RefCounted_Dtor(MonoObject *p_obj, Object *p_ptr)
- ref->reference();
- CSharpLanguage::get_singleton()->post_unsafe_reference(ref);
+ rc->reference();
+ CSharpLanguage::get_singleton()->post_unsafe_reference(rc);
}
return true;
@@ -1511,10 +1511,10 @@ void CSharpLanguage::free_instance_binding_data(void *p_data) {
}
void CSharpLanguage::refcount_incremented_instance_binding(Object *p_object) {
- Reference *ref_owner = Object::cast_to<Reference>(p_object);
+ RefCounted *rc_owner = Object::cast_to<RefCounted>(p_object);
#ifdef DEBUG_ENABLED
- CRASH_COND(!ref_owner);
+ CRASH_COND(!rc_owner);
CRASH_COND(!p_object->has_script_instance_binding(get_language_index()));
#endif
@@ -1528,7 +1528,7 @@ void CSharpLanguage::refcount_incremented_instance_binding(Object *p_object) {
return;
}
- if (ref_owner->reference_get_count() > 1 && gchandle.is_weak()) { // The managed side also holds a reference, hence 1 instead of 0
+ if (rc_owner->reference_get_count() > 1 && gchandle.is_weak()) { // The managed side also holds a reference, hence 1 instead of 0
GD_MONO_SCOPE_THREAD_ATTACH;
// The reference count was increased after the managed side was the only one referencing our owner.
@@ -1548,10 +1548,10 @@ void CSharpLanguage::refcount_incremented_instance_binding(Object *p_object) {
}
bool CSharpLanguage::refcount_decremented_instance_binding(Object *p_object) {
- Reference *ref_owner = Object::cast_to<Reference>(p_object);
+ RefCounted *rc_owner = Object::cast_to<RefCounted>(p_object);
#ifdef DEBUG_ENABLED
- CRASH_COND(!ref_owner);
+ CRASH_COND(!rc_owner);
CRASH_COND(!p_object->has_script_instance_binding(get_language_index()));
#endif
@@ -1561,7 +1561,7 @@ bool CSharpLanguage::refcount_decremented_instance_binding(Object *p_object) {
CSharpScriptBinding &script_binding = ((Map<Object *, CSharpScriptBinding>::Element *)data)->get();
MonoGCHandleData &gchandle = script_binding.gchandle;
- int refcount = ref_owner->reference_get_count();
+ int refcount = rc_owner->reference_get_count();
if (!script_binding.inited) {
return refcount == 0;
@@ -1592,13 +1592,13 @@ bool CSharpLanguage::refcount_decremented_instance_binding(Object *p_object) {
CSharpInstance *CSharpInstance::create_for_managed_type(Object *p_owner, CSharpScript *p_script, const MonoGCHandleData &p_gchandle) {
CSharpInstance *instance = memnew(CSharpInstance(Ref<CSharpScript>(p_script)));
- Reference *ref = Object::cast_to<Reference>(p_owner);
+ RefCounted *rc = Object::cast_to<RefCounted>(p_owner);
- instance->base_ref = ref != nullptr;
+ instance->base_ref_counted = rc != nullptr;
instance->owner = p_owner;
instance->gchandle = p_gchandle;
- if (instance->base_ref) {
+ if (instance->base_ref_counted) {
instance->_reference_owner_unsafe();
}
@@ -1900,7 +1900,7 @@ Variant CSharpInstance::call(const StringName &p_method, const Variant **p_args,
bool CSharpInstance::_reference_owner_unsafe() {
#ifdef DEBUG_ENABLED
- CRASH_COND(!base_ref);
+ CRASH_COND(!base_ref_counted);
CRASH_COND(owner == nullptr);
CRASH_COND(unsafe_referenced); // already referenced
#endif
@@ -1911,7 +1911,7 @@ bool CSharpInstance::_reference_owner_unsafe() {
// See: _unreference_owner_unsafe()
// May not me referenced yet, so we must use init_ref() instead of reference()
- if (static_cast<Reference *>(owner)->init_ref()) {
+ if (static_cast<RefCounted *>(owner)->init_ref()) {
CSharpLanguage::get_singleton()->post_unsafe_reference(owner);
unsafe_referenced = true;
}
@@ -1921,7 +1921,7 @@ bool CSharpInstance::_reference_owner_unsafe() {
bool CSharpInstance::_unreference_owner_unsafe() {
#ifdef DEBUG_ENABLED
- CRASH_COND(!base_ref);
+ CRASH_COND(!base_ref_counted);
CRASH_COND(owner == nullptr);
#endif
@@ -1938,7 +1938,7 @@ bool CSharpInstance::_unreference_owner_unsafe() {
// Destroying the owner here means self destructing, so we defer the owner destruction to the caller.
CSharpLanguage::get_singleton()->pre_unsafe_unreference(owner);
- return static_cast<Reference *>(owner)->unreference();
+ return static_cast<RefCounted *>(owner)->unreference();
}
MonoObject *CSharpInstance::_internal_new_managed() {
@@ -1970,7 +1970,7 @@ MonoObject *CSharpInstance::_internal_new_managed() {
// Tie managed to unmanaged
gchandle = MonoGCHandleData::new_strong_handle(mono_object);
- if (base_ref) {
+ if (base_ref_counted) {
_reference_owner_unsafe(); // Here, after assigning the gchandle (for the refcount_incremented callback)
}
@@ -1987,7 +1987,7 @@ void CSharpInstance::mono_object_disposed(MonoObject *p_obj) {
disconnect_event_signals();
#ifdef DEBUG_ENABLED
- CRASH_COND(base_ref);
+ CRASH_COND(base_ref_counted);
CRASH_COND(gchandle.is_released());
#endif
CSharpLanguage::get_singleton()->release_script_gchandle(p_obj, gchandle);
@@ -1995,7 +1995,7 @@ void CSharpInstance::mono_object_disposed(MonoObject *p_obj) {
void CSharpInstance::mono_object_disposed_baseref(MonoObject *p_obj, bool p_is_finalizer, bool &r_delete_owner, bool &r_remove_script_instance) {
#ifdef DEBUG_ENABLED
- CRASH_COND(!base_ref);
+ CRASH_COND(!base_ref_counted);
CRASH_COND(gchandle.is_released());
#endif
@@ -2056,13 +2056,13 @@ void CSharpInstance::disconnect_event_signals() {
void CSharpInstance::refcount_incremented() {
#ifdef DEBUG_ENABLED
- CRASH_COND(!base_ref);
+ CRASH_COND(!base_ref_counted);
CRASH_COND(owner == nullptr);
#endif
- Reference *ref_owner = Object::cast_to<Reference>(owner);
+ RefCounted *rc_owner = Object::cast_to<RefCounted>(owner);
- if (ref_owner->reference_get_count() > 1 && gchandle.is_weak()) { // The managed side also holds a reference, hence 1 instead of 0
+ if (rc_owner->reference_get_count() > 1 && gchandle.is_weak()) { // The managed side also holds a reference, hence 1 instead of 0
GD_MONO_SCOPE_THREAD_ATTACH;
// The reference count was increased after the managed side was the only one referencing our owner.
@@ -2078,13 +2078,13 @@ void CSharpInstance::refcount_incremented() {
bool CSharpInstance::refcount_decremented() {
#ifdef DEBUG_ENABLED
- CRASH_COND(!base_ref);
+ CRASH_COND(!base_ref_counted);
CRASH_COND(owner == nullptr);
#endif
- Reference *ref_owner = Object::cast_to<Reference>(owner);
+ RefCounted *rc_owner = Object::cast_to<RefCounted>(owner);
- int refcount = ref_owner->reference_get_count();
+ int refcount = rc_owner->reference_get_count();
if (refcount == 1 && !gchandle.is_weak()) { // The managed side also holds a reference, hence 1 instead of 0
GD_MONO_SCOPE_THREAD_ATTACH;
@@ -2119,12 +2119,12 @@ void CSharpInstance::notification(int p_notification) {
predelete_notified = true;
- if (base_ref) {
- // It's not safe to proceed if the owner derives Reference and the refcount reached 0.
+ if (base_ref_counted) {
+ // It's not safe to proceed if the owner derives RefCounted and the refcount reached 0.
// At this point, Dispose() was already called (manually or from the finalizer) so
// that's not a problem. The refcount wouldn't have reached 0 otherwise, since the
// managed side references it and Dispose() needs to be called to release it.
- // However, this means C# Reference scripts can't receive NOTIFICATION_PREDELETE, but
+ // However, this means C# RefCounted scripts can't receive NOTIFICATION_PREDELETE, but
// this is likely the case with GDScript as well: https://github.com/godotengine/godot/issues/6784
return;
}
@@ -2250,15 +2250,15 @@ CSharpInstance::~CSharpInstance() {
}
// If not being called from the owner's destructor, and we still hold a reference to the owner
- if (base_ref && !ref_dying && owner && unsafe_referenced) {
+ if (base_ref_counted && !ref_dying && owner && unsafe_referenced) {
// The owner's script or script instance is being replaced (or removed)
// Transfer ownership to an "instance binding"
- Reference *ref_owner = static_cast<Reference *>(owner);
+ RefCounted *rc_owner = static_cast<RefCounted *>(owner);
// We will unreference the owner before referencing it again, so we need to keep it alive
- Ref<Reference> scope_keep_owner_alive(ref_owner);
+ Ref<RefCounted> scope_keep_owner_alive(rc_owner);
(void)scope_keep_owner_alive;
// Unreference the owner here, before the new "instance binding" references it.
@@ -2283,7 +2283,7 @@ CSharpInstance::~CSharpInstance() {
#ifdef DEBUG_ENABLED
// The "instance binding" holds a reference so the refcount should be at least 2 before `scope_keep_owner_alive` goes out of scope
- CRASH_COND(ref_owner->reference_get_count() <= 1);
+ CRASH_COND(rc_owner->reference_get_count() <= 1);
#endif
}
@@ -2370,7 +2370,7 @@ void CSharpScript::_update_member_info_no_exports() {
}
#endif
-bool CSharpScript::_update_exports() {
+bool CSharpScript::_update_exports(PlaceHolderScriptInstance *p_instance_to_update) {
#ifdef TOOLS_ENABLED
bool is_editor = Engine::get_singleton()->is_editor_hint();
if (is_editor) {
@@ -2511,7 +2511,7 @@ bool CSharpScript::_update_exports() {
#ifdef TOOLS_ENABLED
if (is_editor) {
// Need to check this here, before disposal
- bool base_ref = Object::cast_to<Reference>(tmp_native) != nullptr;
+ bool base_ref_counted = Object::cast_to<RefCounted>(tmp_native) != nullptr;
// Dispose the temporary managed instance
@@ -2526,7 +2526,7 @@ bool CSharpScript::_update_exports() {
GDMonoUtils::free_gchandle(tmp_pinned_gchandle);
tmp_object = nullptr;
- if (tmp_native && !base_ref) {
+ if (tmp_native && !base_ref_counted) {
Node *node = Object::cast_to<Node>(tmp_native);
if (node && node->is_inside_tree()) {
ERR_PRINT("Temporary instance was added to the scene tree.");
@@ -2542,14 +2542,18 @@ bool CSharpScript::_update_exports() {
if (is_editor) {
placeholder_fallback_enabled = false;
- if (placeholders.size()) {
+ if ((changed || p_instance_to_update) && placeholders.size()) {
// Update placeholders if any
Map<StringName, Variant> values;
List<PropertyInfo> propnames;
_update_exports_values(values, propnames);
- for (Set<PlaceHolderScriptInstance *>::Element *E = placeholders.front(); E; E = E->next()) {
- E->get()->update(propnames, values);
+ if (changed) {
+ for (Set<PlaceHolderScriptInstance *>::Element *E = placeholders.front(); E; E = E->next()) {
+ E->get()->update(propnames, values);
+ }
+ } else {
+ p_instance_to_update->update(propnames, values);
}
}
}
@@ -3077,7 +3081,7 @@ StringName CSharpScript::get_instance_base_type() const {
}
}
-CSharpInstance *CSharpScript::_create_instance(const Variant **p_args, int p_argcount, Object *p_owner, bool p_isref, Callable::CallError &r_error) {
+CSharpInstance *CSharpScript::_create_instance(const Variant **p_args, int p_argcount, Object *p_owner, bool p_is_ref_counted, Callable::CallError &r_error) {
GD_MONO_ASSERT_THREAD_ATTACHED;
/* STEP 1, CREATE */
@@ -3093,10 +3097,10 @@ CSharpInstance *CSharpScript::_create_instance(const Variant **p_args, int p_arg
ERR_FAIL_V_MSG(nullptr, "Constructor not found.");
}
- Ref<Reference> ref;
- if (p_isref) {
+ Ref<RefCounted> ref;
+ if (p_is_ref_counted) {
// Hold it alive. Important if we have to dispose a script instance binding before creating the CSharpInstance.
- ref = Ref<Reference>(static_cast<Reference *>(p_owner));
+ ref = Ref<RefCounted>(static_cast<RefCounted *>(p_owner));
}
// If the object had a script instance binding, dispose it before adding the CSharpInstance
@@ -3122,7 +3126,7 @@ CSharpInstance *CSharpScript::_create_instance(const Variant **p_args, int p_arg
}
CSharpInstance *instance = memnew(CSharpInstance(Ref<CSharpScript>(this)));
- instance->base_ref = p_isref;
+ instance->base_ref_counted = p_is_ref_counted;
instance->owner = p_owner;
instance->owner->set_script_instance(instance);
@@ -3147,7 +3151,7 @@ CSharpInstance *CSharpScript::_create_instance(const Variant **p_args, int p_arg
// Tie managed to unmanaged
instance->gchandle = MonoGCHandleData::new_strong_handle(mono_object);
- if (instance->base_ref) {
+ if (instance->base_ref_counted) {
instance->_reference_owner_unsafe(); // Here, after assigning the gchandle (for the refcount_incremented callback)
}
@@ -3182,7 +3186,7 @@ Variant CSharpScript::_new(const Variant **p_args, int p_argcount, Callable::Cal
Object *owner = ClassDB::instance(NATIVE_GDMONOCLASS_NAME(native));
REF ref;
- Reference *r = Object::cast_to<Reference>(owner);
+ RefCounted *r = Object::cast_to<RefCounted>(owner);
if (r) {
ref = REF(r);
}
@@ -3223,14 +3227,14 @@ ScriptInstance *CSharpScript::instance_create(Object *p_this) {
GD_MONO_SCOPE_THREAD_ATTACH;
Callable::CallError unchecked_error;
- return _create_instance(nullptr, 0, p_this, Object::cast_to<Reference>(p_this) != nullptr, unchecked_error);
+ return _create_instance(nullptr, 0, p_this, Object::cast_to<RefCounted>(p_this) != nullptr, unchecked_error);
}
PlaceHolderScriptInstance *CSharpScript::placeholder_instance_create(Object *p_this) {
#ifdef TOOLS_ENABLED
PlaceHolderScriptInstance *si = memnew(PlaceHolderScriptInstance(CSharpLanguage::get_singleton(), Ref<Script>(this), p_this));
placeholders.insert(si);
- _update_exports();
+ _update_exports(si);
return si;
#else
return nullptr;
diff --git a/modules/mono/csharp_script.h b/modules/mono/csharp_script.h
index b389e900f4..965e882c5b 100644
--- a/modules/mono/csharp_script.h
+++ b/modules/mono/csharp_script.h
@@ -163,14 +163,14 @@ private:
void load_script_signals(GDMonoClass *p_class, GDMonoClass *p_native_class);
bool _get_signal(GDMonoClass *p_class, GDMonoMethod *p_delegate_invoke, Vector<SignalParameter> &params);
- bool _update_exports();
+ bool _update_exports(PlaceHolderScriptInstance *p_instance_to_update = nullptr);
bool _get_member_export(IMonoClassMember *p_member, bool p_inspect_export, PropertyInfo &r_prop_info, bool &r_exported);
#ifdef TOOLS_ENABLED
static int _try_get_member_export_hint(IMonoClassMember *p_member, ManagedType p_type, Variant::Type p_variant_type, bool p_allow_generics, PropertyHint &r_hint, String &r_hint_string);
#endif
- CSharpInstance *_create_instance(const Variant **p_args, int p_argcount, Object *p_owner, bool p_isref, Callable::CallError &r_error);
+ CSharpInstance *_create_instance(const Variant **p_args, int p_argcount, Object *p_owner, bool p_is_ref_counted, Callable::CallError &r_error);
Variant _new(const Variant **p_args, int p_argcount, Callable::CallError &r_error);
// Do not use unless you know what you are doing
@@ -251,7 +251,7 @@ class CSharpInstance : public ScriptInstance {
friend class CSharpLanguage;
Object *owner = nullptr;
- bool base_ref = false;
+ bool base_ref_counted = false;
bool ref_dying = false;
bool unsafe_referenced = false;
bool predelete_notified = false;
diff --git a/modules/mono/editor/GodotTools/GodotTools/Build/BuildInfo.cs b/modules/mono/editor/GodotTools/GodotTools/Build/BuildInfo.cs
index 51055dc9b9..27737c3da0 100644
--- a/modules/mono/editor/GodotTools/GodotTools/Build/BuildInfo.cs
+++ b/modules/mono/editor/GodotTools/GodotTools/Build/BuildInfo.cs
@@ -7,7 +7,7 @@ using Path = System.IO.Path;
namespace GodotTools.Build
{
[Serializable]
- public sealed class BuildInfo : Reference // TODO Remove Reference once we have proper serialization
+ public sealed class BuildInfo : RefCounted // TODO Remove RefCounted once we have proper serialization
{
public string Solution { get; }
public string[] Targets { get; }
diff --git a/modules/mono/editor/GodotTools/GodotTools/Build/BuildOutputView.cs b/modules/mono/editor/GodotTools/GodotTools/Build/BuildOutputView.cs
index 1a1639aac7..c380707587 100644
--- a/modules/mono/editor/GodotTools/GodotTools/Build/BuildOutputView.cs
+++ b/modules/mono/editor/GodotTools/GodotTools/Build/BuildOutputView.cs
@@ -11,7 +11,7 @@ namespace GodotTools.Build
public class BuildOutputView : VBoxContainer, ISerializationListener
{
[Serializable]
- private class BuildIssue : Reference // TODO Remove Reference once we have proper serialization
+ private class BuildIssue : RefCounted // TODO Remove RefCounted once we have proper serialization
{
public bool Warning { get; set; }
public string File { get; set; }
diff --git a/modules/mono/editor/GodotTools/GodotTools/GodotSharpEditor.cs b/modules/mono/editor/GodotTools/GodotTools/GodotSharpEditor.cs
index 58561c5097..c71c44d79d 100644
--- a/modules/mono/editor/GodotTools/GodotTools/GodotSharpEditor.cs
+++ b/modules/mono/editor/GodotTools/GodotTools/GodotSharpEditor.cs
@@ -371,7 +371,7 @@ namespace GodotTools
return (ExternalEditorId)editorSettings.GetSetting("mono/editor/external_editor") != ExternalEditorId.None;
}
- public override bool Build()
+ public override bool _Build()
{
return BuildManager.EditorBuildCallback();
}
@@ -413,9 +413,9 @@ namespace GodotTools
bottomPanelBtn.Icon = MSBuildPanel.BuildOutputView.BuildStateIcon;
}
- public override void EnablePlugin()
+ public override void _EnablePlugin()
{
- base.EnablePlugin();
+ base._EnablePlugin();
if (Instance != null)
throw new InvalidOperationException();
diff --git a/modules/mono/editor/bindings_generator.cpp b/modules/mono/editor/bindings_generator.cpp
index 94c5195b83..7e944ed4a5 100644
--- a/modules/mono/editor/bindings_generator.cpp
+++ b/modules/mono/editor/bindings_generator.cpp
@@ -35,8 +35,8 @@
#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/io/dir_access.h"
+#include "core/io/file_access.h"
#include "core/os/os.h"
#include "core/string/ucaps.h"
#include "main/main.h"
@@ -1260,7 +1260,7 @@ Error BindingsGenerator::_generate_cs_type(const TypeInterface &itype, const Str
CRASH_COND(itype.cname != name_cache.type_Object);
CRASH_COND(!itype.is_instantiable);
CRASH_COND(itype.api_type != ClassDB::API_CORE);
- CRASH_COND(itype.is_reference);
+ CRASH_COND(itype.is_ref_counted);
CRASH_COND(itype.is_singleton);
}
@@ -2284,8 +2284,8 @@ Error BindingsGenerator::_generate_glue_method(const BindingsGenerator::TypeInte
}
if (return_type->is_object_type) {
- ptrcall_return_type = return_type->is_reference ? "Ref<Reference>" : return_type->c_type;
- initialization = return_type->is_reference ? "" : " = nullptr";
+ ptrcall_return_type = return_type->is_ref_counted ? "Ref<RefCounted>" : return_type->c_type;
+ initialization = return_type->is_ref_counted ? "" : " = nullptr";
} else {
ptrcall_return_type = return_type->c_type;
}
@@ -2600,12 +2600,12 @@ bool BindingsGenerator::_populate_object_type_interfaces() {
itype.base_name = ClassDB::get_parent_class(type_cname);
itype.is_singleton = Engine::get_singleton()->has_singleton(itype.proxy_name);
itype.is_instantiable = class_info->creation_func && !itype.is_singleton;
- itype.is_reference = ClassDB::is_parent_class(type_cname, name_cache.type_Reference);
- itype.memory_own = itype.is_reference;
+ itype.is_ref_counted = ClassDB::is_parent_class(type_cname, name_cache.type_RefCounted);
+ itype.memory_own = itype.is_ref_counted;
itype.c_out = "\treturn ";
itype.c_out += C_METHOD_UNMANAGED_GET_MANAGED;
- itype.c_out += itype.is_reference ? "(%1.ptr());\n" : "(%1);\n";
+ itype.c_out += itype.is_ref_counted ? "(%1.ptr());\n" : "(%1);\n";
itype.cs_in = itype.is_singleton ? BINDINGS_PTR_FIELD : "Object." CS_SMETHOD_GETINSTANCE "(%0)";
@@ -2741,7 +2741,7 @@ bool BindingsGenerator::_populate_object_type_interfaces() {
imethod.return_type.cname = return_info.class_name;
bool bad_reference_hint = !imethod.is_virtual && return_info.hint != PROPERTY_HINT_RESOURCE_TYPE &&
- ClassDB::is_parent_class(return_info.class_name, name_cache.type_Reference);
+ ClassDB::is_parent_class(return_info.class_name, name_cache.type_RefCounted);
ERR_FAIL_COND_V_MSG(bad_reference_hint, false,
String() + "Return type is reference but hint is not '" _STR(PROPERTY_HINT_RESOURCE_TYPE) "'." +
" Are you returning a reference type by pointer? Method: '" + itype.name + "." + imethod.name + "'.");
@@ -3053,28 +3053,25 @@ bool BindingsGenerator::_arg_default_value_from_variant(const Variant &p_val, Ar
break;
case Variant::PLANE: {
Plane plane = p_val.operator Plane();
- r_iarg.default_argument = "new Plane(new Vector3(" + plane.normal.operator String() + "), " + rtos(plane.d) + ")";
+ r_iarg.default_argument = "new Plane(new Vector3" + plane.normal.operator String() + ", " + rtos(plane.d) + ")";
r_iarg.def_param_mode = ArgumentInterface::NULLABLE_VAL;
} break;
case Variant::AABB: {
AABB aabb = p_val.operator ::AABB();
- r_iarg.default_argument = "new AABB(new Vector3(" + aabb.position.operator String() + "), new Vector3(" + aabb.position.operator String() + "))";
+ r_iarg.default_argument = "new AABB(new Vector3" + aabb.position.operator String() + ", new Vector3" + aabb.position.operator String() + ")";
r_iarg.def_param_mode = ArgumentInterface::NULLABLE_VAL;
} break;
case Variant::RECT2: {
Rect2 rect = p_val.operator Rect2();
- r_iarg.default_argument = "new Rect2(new Vector2(" + rect.position.operator String() + "), new Vector2(" + rect.position.operator String() + "))";
+ r_iarg.default_argument = "new Rect2(new Vector2" + rect.position.operator String() + ", new Vector2" + rect.position.operator String() + ")";
r_iarg.def_param_mode = ArgumentInterface::NULLABLE_VAL;
} break;
case Variant::RECT2I: {
Rect2i rect = p_val.operator Rect2i();
- r_iarg.default_argument = "new Rect2i(new Vector2i(" + rect.position.operator String() + "), new Vector2i(" + rect.position.operator String() + "))";
+ r_iarg.default_argument = "new Rect2i(new Vector2i" + rect.position.operator String() + ", new Vector2i" + rect.position.operator String() + ")";
r_iarg.def_param_mode = ArgumentInterface::NULLABLE_VAL;
} break;
case Variant::COLOR:
- r_iarg.default_argument = "new %s(" + r_iarg.default_argument + ")";
- r_iarg.def_param_mode = ArgumentInterface::NULLABLE_VAL;
- break;
case Variant::VECTOR2:
case Variant::VECTOR2I:
case Variant::VECTOR3:
diff --git a/modules/mono/editor/bindings_generator.h b/modules/mono/editor/bindings_generator.h
index 876046176b..48c0e02723 100644
--- a/modules/mono/editor/bindings_generator.h
+++ b/modules/mono/editor/bindings_generator.h
@@ -216,7 +216,7 @@ class BindingsGenerator {
bool is_enum = false;
bool is_object_type = false;
bool is_singleton = false;
- bool is_reference = false;
+ bool is_ref_counted = false;
/**
* Used only by Object-derived types.
@@ -228,7 +228,7 @@ class BindingsGenerator {
/**
* Used only by Object-derived types.
* Determines if the C# class owns the native handle and must free it somehow when disposed.
- * e.g.: Reference types must notify when the C# instance is disposed, for proper refcounting.
+ * e.g.: RefCounted types must notify when the C# instance is disposed, for proper refcounting.
*/
bool memory_own = false;
@@ -295,7 +295,7 @@ class BindingsGenerator {
* VarArg (fictitious type to represent variable arguments): Array
* float: double (because ptrcall only supports double)
* int: int64_t (because ptrcall only supports int64_t and uint64_t)
- * Reference types override this for the type of the return variable: Ref<Reference>
+ * RefCounted types override this for the type of the return variable: Ref<RefCounted>
*/
String c_type;
@@ -534,7 +534,7 @@ class BindingsGenerator {
StringName type_Variant = StaticCString::create("Variant");
StringName type_VarArg = StaticCString::create("VarArg");
StringName type_Object = StaticCString::create("Object");
- StringName type_Reference = StaticCString::create("Reference");
+ StringName type_RefCounted = StaticCString::create("RefCounted");
StringName type_RID = StaticCString::create("RID");
StringName type_String = StaticCString::create("String");
StringName type_StringName = StaticCString::create("StringName");
@@ -623,7 +623,7 @@ class BindingsGenerator {
}
inline String get_unique_sig(const TypeInterface &p_type) {
- if (p_type.is_reference) {
+ if (p_type.is_ref_counted) {
return "Ref";
} else if (p_type.is_object_type) {
return "Obj";
diff --git a/modules/mono/glue/GodotSharp/GodotSharp/Core/AABB.cs b/modules/mono/glue/GodotSharp/GodotSharp/Core/AABB.cs
index 3aecce50f5..2b641a8937 100644
--- a/modules/mono/glue/GodotSharp/GodotSharp/Core/AABB.cs
+++ b/modules/mono/glue/GodotSharp/GodotSharp/Core/AABB.cs
@@ -676,7 +676,7 @@ namespace Godot
public override string ToString()
{
- return String.Format("{0} - {1}", new object[]
+ return String.Format("{0}, {1}", new object[]
{
_position.ToString(),
_size.ToString()
@@ -685,7 +685,7 @@ namespace Godot
public string ToString(string format)
{
- return String.Format("{0} - {1}", new object[]
+ return String.Format("{0}, {1}", new object[]
{
_position.ToString(format),
_size.ToString(format)
diff --git a/modules/mono/glue/GodotSharp/GodotSharp/Core/Basis.cs b/modules/mono/glue/GodotSharp/GodotSharp/Core/Basis.cs
index 01525e593f..5dbf5d5657 100644
--- a/modules/mono/glue/GodotSharp/GodotSharp/Core/Basis.cs
+++ b/modules/mono/glue/GodotSharp/GodotSharp/Core/Basis.cs
@@ -863,22 +863,16 @@ namespace Godot
public override string ToString()
{
- return String.Format("({0}, {1}, {2})", new object[]
- {
- Row0.ToString(),
- Row1.ToString(),
- Row2.ToString()
- });
+ return "[X: " + x.ToString() +
+ ", Y: " + y.ToString() +
+ ", Z: " + z.ToString() + "]";
}
public string ToString(string format)
{
- return String.Format("({0}, {1}, {2})", new object[]
- {
- Row0.ToString(format),
- Row1.ToString(format),
- Row2.ToString(format)
- });
+ return "[X: " + x.ToString(format) +
+ ", Y: " + y.ToString(format) +
+ ", Z: " + z.ToString(format) + "]";
}
}
}
diff --git a/modules/mono/glue/GodotSharp/GodotSharp/Core/Color.cs b/modules/mono/glue/GodotSharp/GodotSharp/Core/Color.cs
index 24b9218197..155ffcff32 100644
--- a/modules/mono/glue/GodotSharp/GodotSharp/Core/Color.cs
+++ b/modules/mono/glue/GodotSharp/GodotSharp/Core/Color.cs
@@ -1010,12 +1010,12 @@ namespace Godot
public override string ToString()
{
- return String.Format("{0},{1},{2},{3}", r.ToString(), g.ToString(), b.ToString(), a.ToString());
+ return String.Format("({0}, {1}, {2}, {3})", r.ToString(), g.ToString(), b.ToString(), a.ToString());
}
public string ToString(string format)
{
- return String.Format("{0},{1},{2},{3}", r.ToString(format), g.ToString(format), b.ToString(format), a.ToString(format));
+ return String.Format("({0}, {1}, {2}, {3})", r.ToString(format), g.ToString(format), b.ToString(format), a.ToString(format));
}
}
}
diff --git a/modules/mono/glue/GodotSharp/GodotSharp/Core/Object.base.cs b/modules/mono/glue/GodotSharp/GodotSharp/Core/Object.base.cs
index 48582d5ad8..d486d79557 100644
--- a/modules/mono/glue/GodotSharp/GodotSharp/Core/Object.base.cs
+++ b/modules/mono/glue/GodotSharp/GodotSharp/Core/Object.base.cs
@@ -66,7 +66,7 @@ namespace Godot
if (memoryOwn)
{
memoryOwn = false;
- godot_icall_Reference_Disposed(this, ptr, !disposing);
+ godot_icall_RefCounted_Disposed(this, ptr, !disposing);
}
else
{
@@ -129,7 +129,7 @@ namespace Godot
internal static extern void godot_icall_Object_Disposed(Object obj, IntPtr ptr);
[MethodImpl(MethodImplOptions.InternalCall)]
- internal static extern void godot_icall_Reference_Disposed(Object obj, IntPtr ptr, bool isFinalizer);
+ internal static extern void godot_icall_RefCounted_Disposed(Object obj, IntPtr ptr, bool isFinalizer);
[MethodImpl(MethodImplOptions.InternalCall)]
internal static extern void godot_icall_Object_ConnectEventSignals(IntPtr obj);
diff --git a/modules/mono/glue/GodotSharp/GodotSharp/Core/Plane.cs b/modules/mono/glue/GodotSharp/GodotSharp/Core/Plane.cs
index 2f8b5f297c..ad6ca51e8b 100644
--- a/modules/mono/glue/GodotSharp/GodotSharp/Core/Plane.cs
+++ b/modules/mono/glue/GodotSharp/GodotSharp/Core/Plane.cs
@@ -355,7 +355,7 @@ namespace Godot
public override string ToString()
{
- return String.Format("({0}, {1})", new object[]
+ return String.Format("{0}, {1}", new object[]
{
_normal.ToString(),
D.ToString()
@@ -364,7 +364,7 @@ namespace Godot
public string ToString(string format)
{
- return String.Format("({0}, {1})", new object[]
+ return String.Format("{0}, {1}", new object[]
{
_normal.ToString(format),
D.ToString(format)
diff --git a/modules/mono/glue/GodotSharp/GodotSharp/Core/Rect2.cs b/modules/mono/glue/GodotSharp/GodotSharp/Core/Rect2.cs
index 868c3536fe..612fb64a3d 100644
--- a/modules/mono/glue/GodotSharp/GodotSharp/Core/Rect2.cs
+++ b/modules/mono/glue/GodotSharp/GodotSharp/Core/Rect2.cs
@@ -405,7 +405,7 @@ namespace Godot
public override string ToString()
{
- return String.Format("({0}, {1})", new object[]
+ return String.Format("{0}, {1}", new object[]
{
_position.ToString(),
_size.ToString()
@@ -414,7 +414,7 @@ namespace Godot
public string ToString(string format)
{
- return String.Format("({0}, {1})", new object[]
+ return String.Format("{0}, {1}", new object[]
{
_position.ToString(format),
_size.ToString(format)
diff --git a/modules/mono/glue/GodotSharp/GodotSharp/Core/Transform2D.cs b/modules/mono/glue/GodotSharp/GodotSharp/Core/Transform2D.cs
index bc0f81b2a7..fe93592667 100644
--- a/modules/mono/glue/GodotSharp/GodotSharp/Core/Transform2D.cs
+++ b/modules/mono/glue/GodotSharp/GodotSharp/Core/Transform2D.cs
@@ -492,22 +492,16 @@ namespace Godot
public override string ToString()
{
- return String.Format("({0}, {1}, {2})", new object[]
- {
- x.ToString(),
- y.ToString(),
- origin.ToString()
- });
+ return "[X: " + x.ToString() +
+ ", Y: " + y.ToString() +
+ ", O: " + origin.ToString() + "]";
}
public string ToString(string format)
{
- return String.Format("({0}, {1}, {2})", new object[]
- {
- x.ToString(format),
- y.ToString(format),
- origin.ToString(format)
- });
+ return "[X: " + x.ToString(format) +
+ ", Y: " + y.ToString(format) +
+ ", O: " + origin.ToString(format) + "]";
}
}
}
diff --git a/modules/mono/glue/GodotSharp/GodotSharp/Core/Transform3D.cs b/modules/mono/glue/GodotSharp/GodotSharp/Core/Transform3D.cs
index 50cc95fb95..26b1a9e8b2 100644
--- a/modules/mono/glue/GodotSharp/GodotSharp/Core/Transform3D.cs
+++ b/modules/mono/glue/GodotSharp/GodotSharp/Core/Transform3D.cs
@@ -393,20 +393,18 @@ namespace Godot
public override string ToString()
{
- return String.Format("{0} - {1}", new object[]
- {
- basis.ToString(),
- origin.ToString()
- });
+ return "[X: " + basis.x.ToString() +
+ ", Y: " + basis.y.ToString() +
+ ", Z: " + basis.z.ToString() +
+ ", O: " + origin.ToString() + "]";
}
public string ToString(string format)
{
- return String.Format("{0} - {1}", new object[]
- {
- basis.ToString(format),
- origin.ToString(format)
- });
+ return "[X: " + basis.x.ToString(format) +
+ ", Y: " + basis.y.ToString(format) +
+ ", Z: " + basis.z.ToString(format) +
+ ", O: " + origin.ToString(format) + "]";
}
}
}
diff --git a/modules/mono/glue/base_object_glue.cpp b/modules/mono/glue/base_object_glue.cpp
index 34a96eba17..2b6d2761ca 100644
--- a/modules/mono/glue/base_object_glue.cpp
+++ b/modules/mono/glue/base_object_glue.cpp
@@ -31,7 +31,7 @@
#ifdef MONO_GLUE_ENABLED
#include "core/object/class_db.h"
-#include "core/object/reference.h"
+#include "core/object/ref_counted.h"
#include "core/string/string_name.h"
#include "../csharp_script.h"
@@ -78,17 +78,17 @@ void godot_icall_Object_Disposed(MonoObject *p_obj, Object *p_ptr) {
}
}
-void godot_icall_Reference_Disposed(MonoObject *p_obj, Object *p_ptr, MonoBoolean p_is_finalizer) {
+void godot_icall_RefCounted_Disposed(MonoObject *p_obj, Object *p_ptr, MonoBoolean p_is_finalizer) {
#ifdef DEBUG_ENABLED
CRASH_COND(p_ptr == nullptr);
- // This is only called with Reference derived classes
- CRASH_COND(!Object::cast_to<Reference>(p_ptr));
+ // This is only called with RefCounted derived classes
+ CRASH_COND(!Object::cast_to<RefCounted>(p_ptr));
#endif
- Reference *ref = static_cast<Reference *>(p_ptr);
+ RefCounted *rc = static_cast<RefCounted *>(p_ptr);
- if (ref->get_script_instance()) {
- CSharpInstance *cs_instance = CAST_CSHARP_INSTANCE(ref->get_script_instance());
+ if (rc->get_script_instance()) {
+ CSharpInstance *cs_instance = CAST_CSHARP_INSTANCE(rc->get_script_instance());
if (cs_instance) {
if (!cs_instance->is_destructing_script_instance()) {
bool delete_owner;
@@ -97,9 +97,9 @@ void godot_icall_Reference_Disposed(MonoObject *p_obj, Object *p_ptr, MonoBoolea
cs_instance->mono_object_disposed_baseref(p_obj, p_is_finalizer, delete_owner, remove_script_instance);
if (delete_owner) {
- memdelete(ref);
+ memdelete(rc);
} else if (remove_script_instance) {
- ref->set_script_instance(nullptr);
+ rc->set_script_instance(nullptr);
}
}
return;
@@ -108,11 +108,11 @@ void godot_icall_Reference_Disposed(MonoObject *p_obj, Object *p_ptr, MonoBoolea
// Unsafe refcount decrement. The managed instance also counts as a reference.
// See: CSharpLanguage::alloc_instance_binding_data(Object *p_object)
- CSharpLanguage::get_singleton()->pre_unsafe_unreference(ref);
- if (ref->unreference()) {
- memdelete(ref);
+ CSharpLanguage::get_singleton()->pre_unsafe_unreference(rc);
+ if (rc->unreference()) {
+ memdelete(rc);
} else {
- void *data = ref->get_script_instance_binding(CSharpLanguage::get_singleton()->get_language_index());
+ void *data = rc->get_script_instance_binding(CSharpLanguage::get_singleton()->get_language_index());
if (data) {
CSharpScriptBinding &script_binding = ((Map<Object *, CSharpScriptBinding>::Element *)data)->get();
@@ -145,10 +145,10 @@ MonoObject *godot_icall_Object_weakref(Object *p_ptr) {
}
Ref<WeakRef> wref;
- Reference *ref = Object::cast_to<Reference>(p_ptr);
+ RefCounted *rc = Object::cast_to<RefCounted>(p_ptr);
- if (ref) {
- REF r = ref;
+ if (rc) {
+ REF r = rc;
if (!r.is_valid()) {
return nullptr;
}
@@ -242,7 +242,7 @@ MonoString *godot_icall_Object_ToString(Object *p_ptr) {
void godot_register_object_icalls() {
GDMonoUtils::add_internal_call("Godot.Object::godot_icall_Object_Ctor", godot_icall_Object_Ctor);
GDMonoUtils::add_internal_call("Godot.Object::godot_icall_Object_Disposed", godot_icall_Object_Disposed);
- GDMonoUtils::add_internal_call("Godot.Object::godot_icall_Reference_Disposed", godot_icall_Reference_Disposed);
+ GDMonoUtils::add_internal_call("Godot.Object::godot_icall_RefCounted_Disposed", godot_icall_RefCounted_Disposed);
GDMonoUtils::add_internal_call("Godot.Object::godot_icall_Object_ConnectEventSignals", godot_icall_Object_ConnectEventSignals);
GDMonoUtils::add_internal_call("Godot.Object::godot_icall_Object_ClassDB_get_method", godot_icall_Object_ClassDB_get_method);
GDMonoUtils::add_internal_call("Godot.Object::godot_icall_Object_ToString", godot_icall_Object_ToString);
diff --git a/modules/mono/glue/glue_header.h b/modules/mono/glue/glue_header.h
index 3db52d7c30..eed3bd2167 100644
--- a/modules/mono/glue/glue_header.h
+++ b/modules/mono/glue/glue_header.h
@@ -61,7 +61,7 @@ void godot_register_glue_header_icalls() {
#include "core/config/engine.h"
#include "core/object/class_db.h"
#include "core/object/method_bind.h"
-#include "core/object/reference.h"
+#include "core/object/ref_counted.h"
#include "core/string/node_path.h"
#include "core/string/ustring.h"
#include "core/typedefs.h"
diff --git a/modules/mono/godotsharp_dirs.cpp b/modules/mono/godotsharp_dirs.cpp
index 68134b9b20..375ad413c4 100644
--- a/modules/mono/godotsharp_dirs.cpp
+++ b/modules/mono/godotsharp_dirs.cpp
@@ -31,7 +31,7 @@
#include "godotsharp_dirs.h"
#include "core/config/project_settings.h"
-#include "core/os/dir_access.h"
+#include "core/io/dir_access.h"
#include "core/os/os.h"
#ifdef TOOLS_ENABLED
diff --git a/modules/mono/mono_gc_handle.h b/modules/mono/mono_gc_handle.h
index f435aab3dd..d0e51d159f 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/object/reference.h"
+#include "core/object/ref_counted.h"
namespace gdmono {
@@ -79,8 +79,8 @@ struct MonoGCHandleData {
static MonoGCHandleData new_weak_handle(MonoObject *p_object);
};
-class MonoGCHandleRef : public Reference {
- GDCLASS(MonoGCHandleRef, Reference);
+class MonoGCHandleRef : public RefCounted {
+ GDCLASS(MonoGCHandleRef, RefCounted);
MonoGCHandleData data;
diff --git a/modules/mono/mono_gd/gd_mono.cpp b/modules/mono/mono_gd/gd_mono.cpp
index c523d381f6..a3acfbd995 100644
--- a/modules/mono/mono_gd/gd_mono.cpp
+++ b/modules/mono/mono_gd/gd_mono.cpp
@@ -39,8 +39,8 @@
#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/io/dir_access.h"
+#include "core/io/file_access.h"
#include "core/os/os.h"
#include "core/os/thread.h"
diff --git a/modules/mono/mono_gd/gd_mono_assembly.cpp b/modules/mono/mono_gd/gd_mono_assembly.cpp
index a1556bace5..67d6f3ef29 100644
--- a/modules/mono/mono_gd/gd_mono_assembly.cpp
+++ b/modules/mono/mono_gd/gd_mono_assembly.cpp
@@ -34,8 +34,8 @@
#include <mono/metadata/tokentype.h>
#include "core/config/project_settings.h"
+#include "core/io/file_access.h"
#include "core/io/file_access_pack.h"
-#include "core/os/file_access.h"
#include "core/os/os.h"
#include "core/templates/list.h"
diff --git a/modules/mono/mono_gd/gd_mono_internals.cpp b/modules/mono/mono_gd/gd_mono_internals.cpp
index fa93c6533a..d7df18d5da 100644
--- a/modules/mono/mono_gd/gd_mono_internals.cpp
+++ b/modules/mono/mono_gd/gd_mono_internals.cpp
@@ -51,7 +51,7 @@ void tie_managed_to_unmanaged(MonoObject *managed, Object *unmanaged) {
// All mono objects created from the managed world (e.g.: 'new Player()')
// need to have a CSharpScript in order for their methods to be callable from the unmanaged side
- Reference *ref = Object::cast_to<Reference>(unmanaged);
+ RefCounted *rc = Object::cast_to<RefCounted>(unmanaged);
GDMonoClass *klass = GDMonoUtils::get_object_class(managed);
@@ -73,18 +73,18 @@ void tie_managed_to_unmanaged(MonoObject *managed, Object *unmanaged) {
script_binding.inited = true;
script_binding.type_name = NATIVE_GDMONOCLASS_NAME(klass);
script_binding.wrapper_class = klass;
- script_binding.gchandle = ref ? MonoGCHandleData::new_weak_handle(managed) : MonoGCHandleData::new_strong_handle(managed);
+ script_binding.gchandle = rc ? MonoGCHandleData::new_weak_handle(managed) : MonoGCHandleData::new_strong_handle(managed);
script_binding.owner = unmanaged;
- if (ref) {
+ if (rc) {
// Unsafe refcount increment. The managed instance also counts as a reference.
// This way if the unmanaged world has no references to our owner
// but the managed instance is alive, the refcount will be 1 instead of 0.
- // See: godot_icall_Reference_Dtor(MonoObject *p_obj, Object *p_ptr)
+ // See: godot_icall_RefCounted_Dtor(MonoObject *p_obj, Object *p_ptr)
// May not me referenced yet, so we must use init_ref() instead of reference()
- if (ref->init_ref()) {
- CSharpLanguage::get_singleton()->post_unsafe_reference(ref);
+ if (rc->init_ref()) {
+ CSharpLanguage::get_singleton()->post_unsafe_reference(rc);
}
}
@@ -99,7 +99,7 @@ void tie_managed_to_unmanaged(MonoObject *managed, Object *unmanaged) {
return;
}
- MonoGCHandleData gchandle = ref ? MonoGCHandleData::new_weak_handle(managed) : MonoGCHandleData::new_strong_handle(managed);
+ MonoGCHandleData gchandle = rc ? MonoGCHandleData::new_weak_handle(managed) : MonoGCHandleData::new_strong_handle(managed);
Ref<CSharpScript> script = CSharpScript::create_for_managed_type(klass, native);
diff --git a/modules/mono/mono_gd/gd_mono_log.cpp b/modules/mono/mono_gd/gd_mono_log.cpp
index dafd36c36b..179bbfb40c 100644
--- a/modules/mono/mono_gd/gd_mono_log.cpp
+++ b/modules/mono/mono_gd/gd_mono_log.cpp
@@ -32,7 +32,7 @@
#include <stdlib.h> // abort
-#include "core/os/dir_access.h"
+#include "core/io/dir_access.h"
#include "core/os/os.h"
#include "../godotsharp_dirs.h"
@@ -161,8 +161,8 @@ void GDMonoLog::initialize() {
OS::Time time_now = OS::get_singleton()->get_time();
String log_file_name = str_format("%04d-%02d-%02d_%02d.%02d.%02d",
- date_now.year, date_now.month, date_now.day,
- time_now.hour, time_now.min, time_now.sec);
+ (int)date_now.year, (int)date_now.month, (int)date_now.day,
+ (int)time_now.hour, (int)time_now.minute, (int)time_now.second);
log_file_name += str_format("_%d", OS::get_singleton()->get_process_id());
diff --git a/modules/mono/mono_gd/gd_mono_log.h b/modules/mono/mono_gd/gd_mono_log.h
index f7a53156ab..9ddbd251ac 100644
--- a/modules/mono/mono_gd/gd_mono_log.h
+++ b/modules/mono/mono_gd/gd_mono_log.h
@@ -41,7 +41,7 @@
#endif
#ifdef GD_MONO_LOG_ENABLED
-#include "core/os/file_access.h"
+#include "core/io/file_access.h"
#endif
class GDMonoLog {
diff --git a/modules/mono/mono_gd/gd_mono_marshal.cpp b/modules/mono/mono_gd/gd_mono_marshal.cpp
index c8f80e7777..9f2977bfa2 100644
--- a/modules/mono/mono_gd/gd_mono_marshal.cpp
+++ b/modules/mono/mono_gd/gd_mono_marshal.cpp
@@ -1136,8 +1136,8 @@ Variant mono_object_to_variant_impl(MonoObject *p_obj, const ManagedType &p_type
if (CACHED_CLASS(GodotObject)->is_assignable_from(type_class)) {
Object *ptr = unbox<Object *>(CACHED_FIELD(GodotObject, ptr)->get_value(p_obj));
if (ptr != nullptr) {
- Reference *ref = Object::cast_to<Reference>(ptr);
- return ref ? Variant(Ref<Reference>(ref)) : Variant(ptr);
+ RefCounted *rc = Object::cast_to<RefCounted>(ptr);
+ return rc ? Variant(Ref<RefCounted>(rc)) : Variant(ptr);
}
return Variant();
}
diff --git a/modules/mono/mono_gd/gd_mono_utils.cpp b/modules/mono/mono_gd/gd_mono_utils.cpp
index 6e0a263c7f..df45cb8e92 100644
--- a/modules/mono/mono_gd/gd_mono_utils.cpp
+++ b/modules/mono/mono_gd/gd_mono_utils.cpp
@@ -35,8 +35,8 @@
#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/io/dir_access.h"
+#include "core/object/ref_counted.h"
#include "core/os/mutex.h"
#include "core/os/os.h"
@@ -108,15 +108,15 @@ MonoObject *unmanaged_get_managed(Object *unmanaged) {
gchandle = MonoGCHandleData::new_strong_handle(mono_object);
// Tie managed to unmanaged
- Reference *ref = Object::cast_to<Reference>(unmanaged);
+ RefCounted *rc = Object::cast_to<RefCounted>(unmanaged);
- if (ref) {
+ if (rc) {
// Unsafe refcount increment. The managed instance also counts as a reference.
// This way if the unmanaged world has no references to our owner
// but the managed instance is alive, the refcount will be 1 instead of 0.
- // See: godot_icall_Reference_Dtor(MonoObject *p_obj, Object *p_ptr)
- ref->reference();
- CSharpLanguage::get_singleton()->post_unsafe_reference(ref);
+ // See: godot_icall_RefCounted_Dtor(MonoObject *p_obj, Object *p_ptr)
+ rc->reference();
+ CSharpLanguage::get_singleton()->post_unsafe_reference(rc);
}
return mono_object;
diff --git a/modules/mono/mono_gd/gd_mono_utils.h b/modules/mono/mono_gd/gd_mono_utils.h
index 9e024418e1..773501e93d 100644
--- a/modules/mono/mono_gd/gd_mono_utils.h
+++ b/modules/mono/mono_gd/gd_mono_utils.h
@@ -41,7 +41,7 @@
#endif
#include "core/object/class_db.h"
-#include "core/object/reference.h"
+#include "core/object/ref_counted.h"
#define UNHANDLED_EXCEPTION(m_exc) \
if (unlikely(m_exc != nullptr)) { \
diff --git a/modules/mono/signal_awaiter_utils.h b/modules/mono/signal_awaiter_utils.h
index 4c77f8cfed..e12ea45b3f 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/object/reference.h"
+#include "core/object/ref_counted.h"
#include "csharp_script.h"
#include "mono_gc_handle.h"
diff --git a/modules/mono/utils/mono_reg_utils.cpp b/modules/mono/utils/mono_reg_utils.cpp
index bb1265e959..6b616dd52d 100644
--- a/modules/mono/utils/mono_reg_utils.cpp
+++ b/modules/mono/utils/mono_reg_utils.cpp
@@ -29,7 +29,7 @@
/*************************************************************************/
#include "mono_reg_utils.h"
-#include "core/os/dir_access.h"
+#include "core/io/dir_access.h"
#ifdef WINDOWS_ENABLED
diff --git a/modules/mono/utils/path_utils.cpp b/modules/mono/utils/path_utils.cpp
index 93d44628ac..ec04d50704 100644
--- a/modules/mono/utils/path_utils.cpp
+++ b/modules/mono/utils/path_utils.cpp
@@ -31,8 +31,8 @@
#include "path_utils.h"
#include "core/config/project_settings.h"
-#include "core/os/dir_access.h"
-#include "core/os/file_access.h"
+#include "core/io/dir_access.h"
+#include "core/io/file_access.h"
#include "core/os/os.h"
#ifdef WINDOWS_ENABLED
@@ -80,7 +80,7 @@ String cwd() {
}
String abspath(const String &p_path) {
- if (p_path.is_abs_path()) {
+ if (p_path.is_absolute_path()) {
return p_path.simplify_path();
} else {
return path::join(path::cwd(), p_path).simplify_path();
diff --git a/modules/mono/utils/string_utils.cpp b/modules/mono/utils/string_utils.cpp
index ee68458268..053618ebe4 100644
--- a/modules/mono/utils/string_utils.cpp
+++ b/modules/mono/utils/string_utils.cpp
@@ -30,7 +30,7 @@
#include "string_utils.h"
-#include "core/os/file_access.h"
+#include "core/io/file_access.h"
#include <stdio.h>
#include <stdlib.h>
diff --git a/modules/opensimplex/noise_texture.h b/modules/opensimplex/noise_texture.h
index 20a53bb58b..6237b6460d 100644
--- a/modules/opensimplex/noise_texture.h
+++ b/modules/opensimplex/noise_texture.h
@@ -34,7 +34,7 @@
#include "open_simplex_noise.h"
#include "core/io/image.h"
-#include "core/object/reference.h"
+#include "core/object/ref_counted.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 bb50c523d2..dcf922a8bf 100644
--- a/modules/opensimplex/open_simplex_noise.h
+++ b/modules/opensimplex/open_simplex_noise.h
@@ -32,7 +32,7 @@
#define OPEN_SIMPLEX_NOISE_H
#include "core/io/image.h"
-#include "core/object/reference.h"
+#include "core/object/ref_counted.h"
#include "scene/resources/texture.h"
#include "thirdparty/misc/open-simplex-noise.h"
diff --git a/modules/pvr/image_compress_pvrtc.cpp b/modules/pvr/image_compress_pvrtc.cpp
index 6cb9837f49..4d0430fa92 100644
--- a/modules/pvr/image_compress_pvrtc.cpp
+++ b/modules/pvr/image_compress_pvrtc.cpp
@@ -31,7 +31,7 @@
#include "image_compress_pvrtc.h"
#include "core/io/image.h"
-#include "core/object/reference.h"
+#include "core/object/ref_counted.h"
#include <PvrTcEncoder.h>
#include <RgbaBitmap.h>
diff --git a/modules/pvr/texture_loader_pvr.cpp b/modules/pvr/texture_loader_pvr.cpp
index 83f032ca2b..cb12976090 100644
--- a/modules/pvr/texture_loader_pvr.cpp
+++ b/modules/pvr/texture_loader_pvr.cpp
@@ -30,7 +30,7 @@
#include "texture_loader_pvr.h"
-#include "core/os/file_access.h"
+#include "core/io/file_access.h"
static void _pvrtc_decompress(Image *p_img);
diff --git a/modules/raycast/raycast_occlusion_cull.h b/modules/raycast/raycast_occlusion_cull.h
index d9ca57cf24..85710a790c 100644
--- a/modules/raycast/raycast_occlusion_cull.h
+++ b/modules/raycast/raycast_occlusion_cull.h
@@ -34,7 +34,7 @@
#include "core/io/image.h"
#include "core/math/camera_matrix.h"
#include "core/object/object.h"
-#include "core/object/reference.h"
+#include "core/object/ref_counted.h"
#include "core/templates/local_vector.h"
#include "core/templates/rid_owner.h"
#include "scene/resources/mesh.h"
diff --git a/modules/regex/doc_classes/RegEx.xml b/modules/regex/doc_classes/RegEx.xml
index b21f5d1e7a..7f5a0dfecb 100644
--- a/modules/regex/doc_classes/RegEx.xml
+++ b/modules/regex/doc_classes/RegEx.xml
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8" ?>
-<class name="RegEx" inherits="Reference" version="4.0">
+<class name="RegEx" inherits="RefCounted" version="4.0">
<brief_description>
Class for searching text for patterns using regular expressions.
</brief_description>
diff --git a/modules/regex/doc_classes/RegExMatch.xml b/modules/regex/doc_classes/RegExMatch.xml
index a45de60aef..cfe00f83ee 100644
--- a/modules/regex/doc_classes/RegExMatch.xml
+++ b/modules/regex/doc_classes/RegExMatch.xml
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8" ?>
-<class name="RegExMatch" inherits="Reference" version="4.0">
+<class name="RegExMatch" inherits="RefCounted" version="4.0">
<brief_description>
Contains the results of a [RegEx] search.
</brief_description>
diff --git a/modules/regex/regex.h b/modules/regex/regex.h
index f5773042fb..68fe2bc6e0 100644
--- a/modules/regex/regex.h
+++ b/modules/regex/regex.h
@@ -31,15 +31,15 @@
#ifndef REGEX_H
#define REGEX_H
-#include "core/object/reference.h"
+#include "core/object/ref_counted.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);
+class RegExMatch : public RefCounted {
+ GDCLASS(RegExMatch, RefCounted);
struct Range {
int start = 0;
@@ -68,8 +68,8 @@ public:
int get_end(const Variant &p_name) const;
};
-class RegEx : public Reference {
- GDCLASS(RegEx, Reference);
+class RegEx : public RefCounted {
+ GDCLASS(RegEx, RefCounted);
void *general_ctx;
void *code = nullptr;
diff --git a/modules/stb_vorbis/audio_stream_ogg_vorbis.cpp b/modules/stb_vorbis/audio_stream_ogg_vorbis.cpp
index e8e481de2d..78b4749939 100644
--- a/modules/stb_vorbis/audio_stream_ogg_vorbis.cpp
+++ b/modules/stb_vorbis/audio_stream_ogg_vorbis.cpp
@@ -30,7 +30,7 @@
#include "audio_stream_ogg_vorbis.h"
-#include "core/os/file_access.h"
+#include "core/io/file_access.h"
void AudioStreamPlaybackOGGVorbis::_mix_internal(AudioFrame *p_buffer, int p_frames) {
ERR_FAIL_COND(!active);
diff --git a/modules/stb_vorbis/resource_importer_ogg_vorbis.cpp b/modules/stb_vorbis/resource_importer_ogg_vorbis.cpp
index e3aa630cef..a0de5e5f0f 100644
--- a/modules/stb_vorbis/resource_importer_ogg_vorbis.cpp
+++ b/modules/stb_vorbis/resource_importer_ogg_vorbis.cpp
@@ -30,8 +30,8 @@
#include "resource_importer_ogg_vorbis.h"
+#include "core/io/file_access.h"
#include "core/io/resource_saver.h"
-#include "core/os/file_access.h"
#include "scene/resources/texture.h"
String ResourceImporterOGGVorbis::get_importer_name() const {
diff --git a/modules/tga/image_loader_tga.cpp b/modules/tga/image_loader_tga.cpp
index 3cfd4ff36a..6eaa2d24a8 100644
--- a/modules/tga/image_loader_tga.cpp
+++ b/modules/tga/image_loader_tga.cpp
@@ -35,7 +35,7 @@
#include "core/os/os.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 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, size_t p_input_size) {
Error error;
Vector<uint8_t> pixels;
@@ -56,11 +56,14 @@ Error ImageLoaderTGA::decode_tga_rle(const uint8_t *p_compressed_buffer, size_t
compressed_pos += 1;
count = (c & 0x7f) + 1;
- if (output_pos + count * p_pixel_size > output_pos) {
+ if (output_pos + count * p_pixel_size > p_output_size) {
return ERR_PARSE_ERROR;
}
if (c & 0x80) {
+ if (compressed_pos + p_pixel_size > p_input_size) {
+ return ERR_PARSE_ERROR;
+ }
for (size_t i = 0; i < p_pixel_size; i++) {
pixels_w[i] = p_compressed_buffer[compressed_pos];
compressed_pos += 1;
@@ -72,6 +75,9 @@ Error ImageLoaderTGA::decode_tga_rle(const uint8_t *p_compressed_buffer, size_t
output_pos += p_pixel_size;
}
} else {
+ if (compressed_pos + count * p_pixel_size > p_input_size) {
+ return ERR_PARSE_ERROR;
+ }
count *= p_pixel_size;
for (size_t i = 0; i < count; i++) {
p_uncompressed_buffer[output_pos] = p_compressed_buffer[compressed_pos];
@@ -83,7 +89,7 @@ Error ImageLoaderTGA::decode_tga_rle(const uint8_t *p_compressed_buffer, size_t
return OK;
}
-Error ImageLoaderTGA::convert_to_image(Ref<Image> p_image, const uint8_t *p_buffer, const tga_header_s &p_header, const uint8_t *p_palette, const bool p_is_monochrome, size_t p_output_size) {
+Error ImageLoaderTGA::convert_to_image(Ref<Image> p_image, const uint8_t *p_buffer, const tga_header_s &p_header, const uint8_t *p_palette, const bool p_is_monochrome, size_t p_input_size) {
#define TGA_PUT_PIXEL(r, g, b, a) \
int image_data_ofs = ((y * width) + x); \
image_data_w[image_data_ofs * 4 + 0] = r; \
@@ -134,7 +140,7 @@ Error ImageLoaderTGA::convert_to_image(Ref<Image> p_image, const uint8_t *p_buff
if (p_is_monochrome) {
while (y != y_end) {
while (x != x_end) {
- if (i > p_output_size) {
+ if (i >= p_input_size) {
return ERR_PARSE_ERROR;
}
uint8_t shade = p_buffer[i];
@@ -150,7 +156,7 @@ Error ImageLoaderTGA::convert_to_image(Ref<Image> p_image, const uint8_t *p_buff
} else {
while (y != y_end) {
while (x != x_end) {
- if (i > p_output_size) {
+ if (i >= p_input_size) {
return ERR_PARSE_ERROR;
}
uint8_t index = p_buffer[i];
@@ -181,7 +187,7 @@ Error ImageLoaderTGA::convert_to_image(Ref<Image> p_image, const uint8_t *p_buff
} else if (p_header.pixel_depth == 24) {
while (y != y_end) {
while (x != x_end) {
- if (i + 2 > p_output_size) {
+ if (i + 2 >= p_input_size) {
return ERR_PARSE_ERROR;
}
@@ -200,7 +206,7 @@ Error ImageLoaderTGA::convert_to_image(Ref<Image> p_image, const uint8_t *p_buff
} else if (p_header.pixel_depth == 32) {
while (y != y_end) {
while (x != x_end) {
- if (i + 3 > p_output_size) {
+ if (i + 3 >= p_input_size) {
return ERR_PARSE_ERROR;
}
@@ -307,7 +313,7 @@ Error ImageLoaderTGA::load_image(Ref<Image> p_image, FileAccess *f, bool p_force
const uint8_t *buffer = nullptr;
if (is_encoded) {
- err = decode_tga_rle(src_image_r, pixel_size, uncompressed_buffer_w, buffer_size);
+ err = decode_tga_rle(src_image_r, pixel_size, uncompressed_buffer_w, buffer_size, src_image_len);
if (err == OK) {
uncompressed_buffer_r = uncompressed_buffer.ptr();
diff --git a/modules/tga/image_loader_tga.h b/modules/tga/image_loader_tga.h
index cb2ce07edd..e4463a322f 100644
--- a/modules/tga/image_loader_tga.h
+++ b/modules/tga/image_loader_tga.h
@@ -72,8 +72,8 @@ class ImageLoaderTGA : public ImageFormatLoader {
uint8_t pixel_depth = 0;
uint8_t image_descriptor = 0;
};
- static Error decode_tga_rle(const uint8_t *p_compressed_buffer, size_t p_pixel_size, uint8_t *p_uncompressed_buffer, size_t p_output_size);
- static Error convert_to_image(Ref<Image> p_image, const uint8_t *p_buffer, const tga_header_s &p_header, const uint8_t *p_palette, const bool p_is_monochrome, size_t p_output_size);
+ static Error decode_tga_rle(const uint8_t *p_compressed_buffer, size_t p_pixel_size, uint8_t *p_uncompressed_buffer, size_t p_output_size, size_t p_input_size);
+ static Error convert_to_image(Ref<Image> p_image, const uint8_t *p_buffer, const tga_header_s &p_header, const uint8_t *p_palette, const bool p_is_monochrome, size_t p_input_size);
public:
virtual Error load_image(Ref<Image> p_image, FileAccess *f, bool p_force_linear, float p_scale);
diff --git a/modules/theora/video_stream_theora.h b/modules/theora/video_stream_theora.h
index 2685a8a013..760173d0df 100644
--- a/modules/theora/video_stream_theora.h
+++ b/modules/theora/video_stream_theora.h
@@ -31,8 +31,8 @@
#ifndef VIDEO_STREAM_THEORA_H
#define VIDEO_STREAM_THEORA_H
+#include "core/io/file_access.h"
#include "core/io/resource_loader.h"
-#include "core/os/file_access.h"
#include "core/os/semaphore.h"
#include "core/os/thread.h"
#include "core/templates/ring_buffer.h"
diff --git a/modules/upnp/doc_classes/UPNP.xml b/modules/upnp/doc_classes/UPNP.xml
index 785c8dad50..09a2c8a88c 100644
--- a/modules/upnp/doc_classes/UPNP.xml
+++ b/modules/upnp/doc_classes/UPNP.xml
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8" ?>
-<class name="UPNP" inherits="Reference" version="4.0">
+<class name="UPNP" inherits="RefCounted" version="4.0">
<brief_description>
UPNP network functions.
</brief_description>
diff --git a/modules/upnp/doc_classes/UPNPDevice.xml b/modules/upnp/doc_classes/UPNPDevice.xml
index f3b96bb89d..f7b5386d86 100644
--- a/modules/upnp/doc_classes/UPNPDevice.xml
+++ b/modules/upnp/doc_classes/UPNPDevice.xml
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8" ?>
-<class name="UPNPDevice" inherits="Reference" version="4.0">
+<class name="UPNPDevice" inherits="RefCounted" version="4.0">
<brief_description>
UPNP device.
</brief_description>
diff --git a/modules/upnp/upnp.h b/modules/upnp/upnp.h
index a0cca96bc8..b961a9667f 100644
--- a/modules/upnp/upnp.h
+++ b/modules/upnp/upnp.h
@@ -31,14 +31,14 @@
#ifndef GODOT_UPNP_H
#define GODOT_UPNP_H
-#include "core/object/reference.h"
+#include "core/object/ref_counted.h"
#include "upnp_device.h"
#include <miniupnpc/miniupnpc.h>
-class UPNP : public Reference {
- GDCLASS(UPNP, Reference);
+class UPNP : public RefCounted {
+ GDCLASS(UPNP, RefCounted);
private:
String discover_multicast_if = "";
diff --git a/modules/upnp/upnp_device.h b/modules/upnp/upnp_device.h
index 126e761a56..0a66c36ab9 100644
--- a/modules/upnp/upnp_device.h
+++ b/modules/upnp/upnp_device.h
@@ -31,10 +31,10 @@
#ifndef GODOT_UPNP_DEVICE_H
#define GODOT_UPNP_DEVICE_H
-#include "core/object/reference.h"
+#include "core/object/ref_counted.h"
-class UPNPDevice : public Reference {
- GDCLASS(UPNPDevice, Reference);
+class UPNPDevice : public RefCounted {
+ GDCLASS(UPNPDevice, RefCounted);
public:
enum IGDStatus {
diff --git a/modules/visual_script/doc_classes/VisualScriptFunctionState.xml b/modules/visual_script/doc_classes/VisualScriptFunctionState.xml
index 68083614a6..9ed71bf10e 100644
--- a/modules/visual_script/doc_classes/VisualScriptFunctionState.xml
+++ b/modules/visual_script/doc_classes/VisualScriptFunctionState.xml
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8" ?>
-<class name="VisualScriptFunctionState" inherits="Reference" version="4.0">
+<class name="VisualScriptFunctionState" inherits="RefCounted" version="4.0">
<brief_description>
</brief_description>
<description>
@@ -28,7 +28,7 @@
<method name="resume">
<return type="Variant">
</return>
- <argument index="0" name="args" type="Array" default="null">
+ <argument index="0" name="args" type="Array" default="[ ]">
</argument>
<description>
</description>
diff --git a/modules/visual_script/visual_script.cpp b/modules/visual_script/visual_script.cpp
index c9ed912ac1..7badb1b717 100644
--- a/modules/visual_script/visual_script.cpp
+++ b/modules/visual_script/visual_script.cpp
@@ -2204,7 +2204,7 @@ Variant VisualScriptFunctionState::resume(Array p_args) {
void VisualScriptFunctionState::_bind_methods() {
ClassDB::bind_method(D_METHOD("connect_to_signal", "obj", "signals", "args"), &VisualScriptFunctionState::connect_to_signal);
- ClassDB::bind_method(D_METHOD("resume", "args"), &VisualScriptFunctionState::resume, DEFVAL(Variant()));
+ ClassDB::bind_method(D_METHOD("resume", "args"), &VisualScriptFunctionState::resume, DEFVAL(Array()));
ClassDB::bind_method(D_METHOD("is_valid"), &VisualScriptFunctionState::is_valid);
ClassDB::bind_vararg_method(METHOD_FLAGS_DEFAULT, "_signal_callback", &VisualScriptFunctionState::_signal_callback, MethodInfo("_signal_callback"));
}
diff --git a/modules/visual_script/visual_script.h b/modules/visual_script/visual_script.h
index 3c4a26a2a3..438ec99a56 100644
--- a/modules/visual_script/visual_script.h
+++ b/modules/visual_script/visual_script.h
@@ -449,8 +449,8 @@ public:
~VisualScriptInstance();
};
-class VisualScriptFunctionState : public Reference {
- GDCLASS(VisualScriptFunctionState, Reference);
+class VisualScriptFunctionState : public RefCounted {
+ GDCLASS(VisualScriptFunctionState, RefCounted);
friend class VisualScriptInstance;
ObjectID instance_id;
diff --git a/modules/visual_script/visual_script_builtin_funcs.cpp b/modules/visual_script/visual_script_builtin_funcs.cpp
index df34ec22ce..a3133f126d 100644
--- a/modules/visual_script/visual_script_builtin_funcs.cpp
+++ b/modules/visual_script/visual_script_builtin_funcs.cpp
@@ -33,7 +33,7 @@
#include "core/io/marshalls.h"
#include "core/math/math_funcs.h"
#include "core/object/class_db.h"
-#include "core/object/reference.h"
+#include "core/object/ref_counted.h"
#include "core/os/os.h"
#include "core/variant/variant_parser.h"
diff --git a/modules/visual_script/visual_script_editor.cpp b/modules/visual_script/visual_script_editor.cpp
index 5cfc228fae..f5a365f199 100644
--- a/modules/visual_script/visual_script_editor.cpp
+++ b/modules/visual_script/visual_script_editor.cpp
@@ -4243,9 +4243,9 @@ void VisualScriptEditor::_bind_methods() {
ClassDB::bind_method("_create_new_node_from_name", &VisualScriptEditor::_create_new_node_from_name);
- ClassDB::bind_method("get_drag_data_fw", &VisualScriptEditor::get_drag_data_fw);
- ClassDB::bind_method("can_drop_data_fw", &VisualScriptEditor::can_drop_data_fw);
- ClassDB::bind_method("drop_data_fw", &VisualScriptEditor::drop_data_fw);
+ ClassDB::bind_method("_get_drag_data_fw", &VisualScriptEditor::get_drag_data_fw);
+ ClassDB::bind_method("_can_drop_data_fw", &VisualScriptEditor::can_drop_data_fw);
+ ClassDB::bind_method("_drop_data_fw", &VisualScriptEditor::drop_data_fw);
ClassDB::bind_method("_input", &VisualScriptEditor::_input);
diff --git a/modules/webm/video_stream_webm.cpp b/modules/webm/video_stream_webm.cpp
index 34addb5c9f..6ec0bde7bd 100644
--- a/modules/webm/video_stream_webm.cpp
+++ b/modules/webm/video_stream_webm.cpp
@@ -31,7 +31,7 @@
#include "video_stream_webm.h"
#include "core/config/project_settings.h"
-#include "core/os/file_access.h"
+#include "core/io/file_access.h"
#include "core/os/os.h"
#include "servers/audio_server.h"
diff --git a/modules/webp/image_loader_webp.cpp b/modules/webp/image_loader_webp.cpp
index 1f2a456619..772445190c 100644
--- a/modules/webp/image_loader_webp.cpp
+++ b/modules/webp/image_loader_webp.cpp
@@ -30,6 +30,7 @@
#include "image_loader_webp.h"
+#include "core/config/project_settings.h"
#include "core/io/marshalls.h"
#include "core/os/os.h"
#include "core/string/print_string.h"
@@ -69,12 +70,77 @@ static Vector<uint8_t> _webp_lossy_pack(const Ref<Image> &p_image, float p_quali
w[2] = 'B';
w[3] = 'P';
memcpy(&w[4], dst_buff, dst_size);
- free(dst_buff);
+ WebPFree(dst_buff);
return dst;
}
-static Ref<Image> _webp_lossy_unpack(const Vector<uint8_t> &p_buffer) {
+static Vector<uint8_t> _webp_lossless_pack(const Ref<Image> &p_image) {
+ ERR_FAIL_COND_V(p_image.is_null() || p_image->is_empty(), Vector<uint8_t>());
+
+ int compression_level = ProjectSettings::get_singleton()->get("rendering/textures/lossless_compression/webp_compression_level");
+ compression_level = CLAMP(compression_level, 0, 9);
+
+ Ref<Image> img = p_image->duplicate();
+ if (img->detect_alpha()) {
+ img->convert(Image::FORMAT_RGBA8);
+ } else {
+ img->convert(Image::FORMAT_RGB8);
+ }
+
+ Size2 s(img->get_width(), img->get_height());
+ Vector<uint8_t> data = img->get_data();
+ const uint8_t *r = data.ptr();
+
+ // we need to use the more complex API in order to access the 'exact' flag...
+
+ WebPConfig config;
+ WebPPicture pic;
+ if (!WebPConfigInit(&config) || !WebPConfigLosslessPreset(&config, compression_level) || !WebPPictureInit(&pic)) {
+ ERR_FAIL_V(Vector<uint8_t>());
+ }
+
+ WebPMemoryWriter wrt;
+ config.exact = 1;
+ pic.use_argb = 1;
+ pic.width = s.width;
+ pic.height = s.height;
+ pic.writer = WebPMemoryWrite;
+ pic.custom_ptr = &wrt;
+ WebPMemoryWriterInit(&wrt);
+
+ bool success_import = false;
+ if (img->get_format() == Image::FORMAT_RGB8) {
+ success_import = WebPPictureImportRGB(&pic, r, 3 * s.width);
+ } else {
+ success_import = WebPPictureImportRGBA(&pic, r, 4 * s.width);
+ }
+ bool success_encode = false;
+ if (success_import) {
+ success_encode = WebPEncode(&config, &pic);
+ }
+ WebPPictureFree(&pic);
+
+ if (!success_encode) {
+ WebPMemoryWriterClear(&wrt);
+ ERR_FAIL_V_MSG(Vector<uint8_t>(), "WebP packing failed.");
+ }
+
+ // copy from wrt
+ Vector<uint8_t> dst;
+ dst.resize(4 + wrt.size);
+ uint8_t *w = dst.ptrw();
+ w[0] = 'W';
+ w[1] = 'E';
+ w[2] = 'B';
+ w[3] = 'P';
+ memcpy(&w[4], wrt.mem, wrt.size);
+ WebPMemoryWriterClear(&wrt);
+
+ return dst;
+}
+
+static Ref<Image> _webp_unpack(const Vector<uint8_t> &p_buffer) {
int size = p_buffer.size() - 4;
ERR_FAIL_COND_V(size <= 0, Ref<Image>());
const uint8_t *r = p_buffer.ptr();
@@ -168,6 +234,7 @@ void ImageLoaderWEBP::get_recognized_extensions(List<String> *p_extensions) cons
ImageLoaderWEBP::ImageLoaderWEBP() {
Image::_webp_mem_loader_func = _webp_mem_loader_func;
- Image::lossy_packer = _webp_lossy_pack;
- Image::lossy_unpacker = _webp_lossy_unpack;
+ Image::webp_lossy_packer = _webp_lossy_pack;
+ Image::webp_lossless_packer = _webp_lossless_pack;
+ Image::webp_unpacker = _webp_unpack;
}
diff --git a/modules/webrtc/doc_classes/WebRTCPeerConnection.xml b/modules/webrtc/doc_classes/WebRTCPeerConnection.xml
index 3b53892a3d..62e524825d 100644
--- a/modules/webrtc/doc_classes/WebRTCPeerConnection.xml
+++ b/modules/webrtc/doc_classes/WebRTCPeerConnection.xml
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8" ?>
-<class name="WebRTCPeerConnection" inherits="Reference" version="4.0">
+<class name="WebRTCPeerConnection" inherits="RefCounted" version="4.0">
<brief_description>
Interface to a WebRTC peer connection.
</brief_description>
diff --git a/modules/webrtc/webrtc_multiplayer.h b/modules/webrtc/webrtc_multiplayer.h
index 6b4ae6fcc8..2ddb98f656 100644
--- a/modules/webrtc/webrtc_multiplayer.h
+++ b/modules/webrtc/webrtc_multiplayer.h
@@ -48,7 +48,7 @@ private:
CH_RESERVED_MAX = 3
};
- class ConnectedPeer : public Reference {
+ class ConnectedPeer : public RefCounted {
public:
Ref<WebRTCPeerConnection> connection;
List<Ref<WebRTCDataChannel>> channels;
diff --git a/modules/webrtc/webrtc_peer_connection.h b/modules/webrtc/webrtc_peer_connection.h
index ae75864489..fcfb9ae9ae 100644
--- a/modules/webrtc/webrtc_peer_connection.h
+++ b/modules/webrtc/webrtc_peer_connection.h
@@ -34,8 +34,8 @@
#include "core/io/packet_peer.h"
#include "modules/webrtc/webrtc_data_channel.h"
-class WebRTCPeerConnection : public Reference {
- GDCLASS(WebRTCPeerConnection, Reference);
+class WebRTCPeerConnection : public RefCounted {
+ GDCLASS(WebRTCPeerConnection, RefCounted);
public:
enum ConnectionState {
diff --git a/modules/websocket/emws_server.h b/modules/websocket/emws_server.h
index e7285ccb86..d36e3a3557 100644
--- a/modules/websocket/emws_server.h
+++ b/modules/websocket/emws_server.h
@@ -33,7 +33,7 @@
#ifdef JAVASCRIPT_ENABLED
-#include "core/object/reference.h"
+#include "core/object/ref_counted.h"
#include "emws_peer.h"
#include "websocket_server.h"
diff --git a/modules/websocket/websocket_server.h b/modules/websocket/websocket_server.h
index 10da51fce5..bc5e591e7b 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/object/reference.h"
+#include "core/object/ref_counted.h"
#include "websocket_multiplayer_peer.h"
#include "websocket_peer.h"
diff --git a/modules/websocket/wsl_server.h b/modules/websocket/wsl_server.h
index c2cf9df58b..39177a16a8 100644
--- a/modules/websocket/wsl_server.h
+++ b/modules/websocket/wsl_server.h
@@ -46,7 +46,7 @@ class WSLServer : public WebSocketServer {
GDCIIMPL(WSLServer, WebSocketServer);
private:
- class PendingPeer : public Reference {
+ class PendingPeer : public RefCounted {
private:
bool _parse_request(const Vector<String> p_protocols);
diff --git a/modules/webxr/webxr_interface_js.cpp b/modules/webxr/webxr_interface_js.cpp
index a628cb0549..13981e73e1 100644
--- a/modules/webxr/webxr_interface_js.cpp
+++ b/modules/webxr/webxr_interface_js.cpp
@@ -265,7 +265,7 @@ void WebXRInterfaceJS::uninitialize() {
};
};
-Transform WebXRInterfaceJS::_js_matrix_to_transform(float *p_js_matrix) {
+Transform3D WebXRInterfaceJS::_js_matrix_to_transform(float *p_js_matrix) {
Transform3D transform;
transform.basis.elements[0].x = p_js_matrix[0];
@@ -305,13 +305,30 @@ Size2 WebXRInterfaceJS::get_render_targetsize() {
return render_targetsize;
};
-Transform WebXRInterfaceJS::get_transform_for_eye(XRInterface::Eyes p_eye, const Transform3D &p_cam_transform) {
+Transform3D WebXRInterfaceJS::get_camera_transform() {
Transform3D transform_for_eye;
XRServer *xr_server = XRServer::get_singleton();
ERR_FAIL_NULL_V(xr_server, transform_for_eye);
- float *js_matrix = godot_webxr_get_transform_for_eye(p_eye);
+ float *js_matrix = godot_webxr_get_transform_for_eye(0);
+ if (!initialized || js_matrix == nullptr) {
+ return transform_for_eye;
+ }
+
+ transform_for_eye = _js_matrix_to_transform(js_matrix);
+ free(js_matrix);
+
+ return xr_server->get_reference_frame() * transform_for_eye;
+};
+
+Transform3D WebXRInterfaceJS::get_transform_for_view(uint32_t p_view, const Transform3D &p_cam_transform) {
+ Transform3D transform_for_eye;
+
+ XRServer *xr_server = XRServer::get_singleton();
+ ERR_FAIL_NULL_V(xr_server, transform_for_eye);
+
+ float *js_matrix = godot_webxr_get_transform_for_eye(p_view + 1);
if (!initialized || js_matrix == nullptr) {
transform_for_eye = p_cam_transform;
return transform_for_eye;
@@ -323,10 +340,10 @@ Transform WebXRInterfaceJS::get_transform_for_eye(XRInterface::Eyes p_eye, const
return p_cam_transform * xr_server->get_reference_frame() * transform_for_eye;
};
-CameraMatrix WebXRInterfaceJS::get_projection_for_eye(XRInterface::Eyes p_eye, real_t p_aspect, real_t p_z_near, real_t p_z_far) {
+CameraMatrix WebXRInterfaceJS::get_projection_for_view(uint32_t p_view, real_t p_aspect, real_t p_z_near, real_t p_z_far) {
CameraMatrix eye;
- float *js_matrix = godot_webxr_get_projection_for_eye(p_eye);
+ float *js_matrix = godot_webxr_get_projection_for_eye(p_view + 1);
if (!initialized || js_matrix == nullptr) {
return eye;
}
diff --git a/modules/webxr/webxr_interface_js.h b/modules/webxr/webxr_interface_js.h
index e9274a06e4..723ab952cd 100644
--- a/modules/webxr/webxr_interface_js.h
+++ b/modules/webxr/webxr_interface_js.h
@@ -84,8 +84,9 @@ public:
virtual Size2 get_render_targetsize() override;
virtual bool is_stereo() override;
- virtual Transform get_transform_for_eye(XRInterface::Eyes p_eye, const Transform3D &p_cam_transform) override;
- virtual CameraMatrix get_projection_for_eye(XRInterface::Eyes p_eye, real_t p_aspect, real_t p_z_near, real_t p_z_far) override;
+ virtual Transform3D get_camera_transform() override;
+ virtual Transform3D get_transform_for_view(uint32_t p_view, const Transform3D &p_cam_transform) override;
+ virtual CameraMatrix get_projection_for_view(uint32_t p_view, real_t p_aspect, real_t p_z_near, real_t p_z_far) override;
virtual unsigned int get_external_texture_for_eye(XRInterface::Eyes p_eye) override;
virtual void commit_for_eye(XRInterface::Eyes p_eye, RID p_render_target, const Rect2 &p_screen_rect) override;
diff --git a/platform/android/api/java_class_wrapper.h b/platform/android/api/java_class_wrapper.h
index d6c7a1abe5..ff7bf43573 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/object/reference.h"
+#include "core/object/ref_counted.h"
#ifdef ANDROID_ENABLED
#include <android/log.h>
@@ -42,8 +42,8 @@
class JavaObject;
#endif
-class JavaClass : public Reference {
- GDCLASS(JavaClass, Reference);
+class JavaClass : public RefCounted {
+ GDCLASS(JavaClass, RefCounted);
#ifdef ANDROID_ENABLED
enum ArgumentType{
@@ -184,8 +184,8 @@ public:
JavaClass();
};
-class JavaObject : public Reference {
- GDCLASS(JavaObject, Reference);
+class JavaObject : public RefCounted {
+ GDCLASS(JavaObject, RefCounted);
#ifdef ANDROID_ENABLED
Ref<JavaClass> base_class;
diff --git a/platform/android/dir_access_jandroid.h b/platform/android/dir_access_jandroid.h
index 7b9cbeea47..cdf98187ed 100644
--- a/platform/android/dir_access_jandroid.h
+++ b/platform/android/dir_access_jandroid.h
@@ -31,7 +31,7 @@
#ifndef DIR_ACCESS_JANDROID_H
#define DIR_ACCESS_JANDROID_H
-#include "core/os/dir_access.h"
+#include "core/io/dir_access.h"
#include "java_godot_lib_jni.h"
#include <stdio.h>
diff --git a/platform/android/export/export.cpp b/platform/android/export/export.cpp
index c45828e194..1a0c206e28 100644
--- a/platform/android/export/export.cpp
+++ b/platform/android/export/export.cpp
@@ -31,11 +31,11 @@
#include "export.h"
#include "core/config/project_settings.h"
+#include "core/io/dir_access.h"
+#include "core/io/file_access.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/templates/safe_refcount.h"
#include "core/version.h"
@@ -609,9 +609,9 @@ class EditorExportPlatformAndroid : public EditorExportPlatform {
zip_fileinfo zipfi;
zipfi.tmz_date.tm_hour = time.hour;
zipfi.tmz_date.tm_mday = date.day;
- zipfi.tmz_date.tm_min = time.min;
+ zipfi.tmz_date.tm_min = time.minute;
zipfi.tmz_date.tm_mon = date.month - 1; // tm_mon is zero indexed
- zipfi.tmz_date.tm_sec = time.sec;
+ zipfi.tmz_date.tm_sec = time.second;
zipfi.tmz_date.tm_year = date.year;
zipfi.dosDate = 0;
zipfi.external_fa = 0;
diff --git a/platform/android/export/gradle_export_util.h b/platform/android/export/gradle_export_util.h
index 0bb94dcc97..6ab678b8a1 100644
--- a/platform/android/export/gradle_export_util.h
+++ b/platform/android/export/gradle_export_util.h
@@ -31,9 +31,9 @@
#ifndef GODOT_GRADLE_EXPORT_UTIL_H
#define GODOT_GRADLE_EXPORT_UTIL_H
+#include "core/io/dir_access.h"
+#include "core/io/file_access.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 "editor/editor_export.h"
diff --git a/platform/android/file_access_android.h b/platform/android/file_access_android.h
index 8890e0f645..bb4ce36947 100644
--- a/platform/android/file_access_android.h
+++ b/platform/android/file_access_android.h
@@ -31,7 +31,7 @@
#ifndef FILE_ACCESS_ANDROID_H
#define FILE_ACCESS_ANDROID_H
-#include "core/os/file_access.h"
+#include "core/io/file_access.h"
#include <android/asset_manager.h>
#include <android/log.h>
#include <stdio.h>
diff --git a/platform/android/java_class_wrapper.cpp b/platform/android/java_class_wrapper.cpp
index f49b0e843a..ed6b5c3e14 100644
--- a/platform/android/java_class_wrapper.cpp
+++ b/platform/android/java_class_wrapper.cpp
@@ -102,7 +102,7 @@ bool JavaClass::_call_method(JavaObject *p_instance, const StringName &p_method,
if (p_args[i]->get_type() != Variant::OBJECT)
arg_expected = Variant::OBJECT;
else {
- Ref<Reference> ref = *p_args[i];
+ Ref<RefCounted> ref = *p_args[i];
if (!ref.is_null()) {
if (Object::cast_to<JavaObject>(ref.ptr())) {
Ref<JavaObject> jo = ref;
@@ -488,7 +488,7 @@ Variant JavaClass::call(const StringName &p_method, const Variant **p_args, int
return ret;
}
- return Reference::call(p_method, p_args, p_argcount, r_error);
+ return RefCounted::call(p_method, p_args, p_argcount, r_error);
}
JavaClass::JavaClass() {
diff --git a/platform/android/plugin/godot_plugin_config.h b/platform/android/plugin/godot_plugin_config.h
index c5c1c690a2..6b708548ae 100644
--- a/platform/android/plugin/godot_plugin_config.h
+++ b/platform/android/plugin/godot_plugin_config.h
@@ -102,7 +102,7 @@ struct PluginConfigAndroid {
static inline String resolve_local_dependency_path(String plugin_config_dir, String dependency_path) {
String absolute_path;
if (!dependency_path.is_empty()) {
- if (dependency_path.is_abs_path()) {
+ if (dependency_path.is_absolute_path()) {
absolute_path = ProjectSettings::get_singleton()->globalize_path(dependency_path);
} else {
absolute_path = plugin_config_dir.plus_file(dependency_path);
diff --git a/platform/iphone/export/export.cpp b/platform/iphone/export/export.cpp
index 73723b98a0..e2df573b09 100644
--- a/platform/iphone/export/export.cpp
+++ b/platform/iphone/export/export.cpp
@@ -31,11 +31,11 @@
#include "export.h"
#include "core/config/project_settings.h"
+#include "core/io/file_access.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/templates/safe_refcount.h"
#include "core/version.h"
diff --git a/platform/iphone/os_iphone.mm b/platform/iphone/os_iphone.mm
index 458834ce3a..1f08901082 100644
--- a/platform/iphone/os_iphone.mm
+++ b/platform/iphone/os_iphone.mm
@@ -33,9 +33,9 @@
#include "os_iphone.h"
#import "app_delegate.h"
#include "core/config/project_settings.h"
+#include "core/io/dir_access.h"
+#include "core/io/file_access.h"
#include "core/io/file_access_pack.h"
-#include "core/os/dir_access.h"
-#include "core/os/file_access.h"
#include "display_server_iphone.h"
#include "drivers/unix/syslog_logger.h"
#import "godot_view.h"
diff --git a/platform/iphone/plugin/godot_plugin_config.h b/platform/iphone/plugin/godot_plugin_config.h
index e2546e733c..4d0c67bfff 100644
--- a/platform/iphone/plugin/godot_plugin_config.h
+++ b/platform/iphone/plugin/godot_plugin_config.h
@@ -104,7 +104,7 @@ static inline String resolve_local_dependency_path(String plugin_config_dir, Str
return absolute_path;
}
- if (dependency_path.is_abs_path()) {
+ if (dependency_path.is_absolute_path()) {
return dependency_path;
}
@@ -121,7 +121,7 @@ static inline String resolve_system_dependency_path(String dependency_path) {
return absolute_path;
}
- if (dependency_path.is_abs_path()) {
+ if (dependency_path.is_absolute_path()) {
return dependency_path;
}
diff --git a/platform/javascript/api/javascript_singleton.h b/platform/javascript/api/javascript_singleton.h
index 1615efa87e..9d7a392278 100644
--- a/platform/javascript/api/javascript_singleton.h
+++ b/platform/javascript/api/javascript_singleton.h
@@ -32,11 +32,11 @@
#define JAVASCRIPT_SINGLETON_H
#include "core/object/class_db.h"
-#include "core/object/reference.h"
+#include "core/object/ref_counted.h"
-class JavaScriptObject : public Reference {
+class JavaScriptObject : public RefCounted {
private:
- GDCLASS(JavaScriptObject, Reference);
+ GDCLASS(JavaScriptObject, RefCounted);
protected:
virtual bool _set(const StringName &p_name, const Variant &p_value) { return false; }
diff --git a/platform/javascript/api/javascript_tools_editor_plugin.cpp b/platform/javascript/api/javascript_tools_editor_plugin.cpp
index b35ccd087f..54f541f607 100644
--- a/platform/javascript/api/javascript_tools_editor_plugin.cpp
+++ b/platform/javascript/api/javascript_tools_editor_plugin.cpp
@@ -33,15 +33,15 @@
#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/io/dir_access.h"
+#include "core/io/file_access.h"
#include "editor/editor_node.h"
#include <emscripten/emscripten.h>
// JavaScript functions defined in library_godot_editor_tools.js
extern "C" {
-extern int godot_js_os_download_buffer(const uint8_t *p_buf, int p_buf_size, const char *p_name, const char *p_mime);
+extern void godot_js_os_download_buffer(const uint8_t *p_buf, int p_buf_size, const char *p_name, const char *p_mime);
}
static void _javascript_editor_init_callback() {
diff --git a/platform/javascript/export/export.cpp b/platform/javascript/export/export.cpp
index 8ce294f31b..7e49feee61 100644
--- a/platform/javascript/export/export.cpp
+++ b/platform/javascript/export/export.cpp
@@ -39,7 +39,7 @@
#include "platform/javascript/logo.gen.h"
#include "platform/javascript/run_icon.gen.h"
-class EditorHTTPServer : public Reference {
+class EditorHTTPServer : public RefCounted {
private:
Ref<TCPServer> server;
Map<String, String> mimes;
diff --git a/platform/javascript/godot_js.h b/platform/javascript/godot_js.h
index 8927a83cb3..d332af2c31 100644
--- a/platform/javascript/godot_js.h
+++ b/platform/javascript/godot_js.h
@@ -84,7 +84,7 @@ extern void godot_js_display_cursor_set_custom_shape(const char *p_shape, const
extern void godot_js_display_cursor_set_visible(int p_visible);
// Display gamepad
-extern char *godot_js_display_gamepad_cb(void (*p_on_change)(int p_index, int p_connected, const char *p_id, const char *p_guid));
+extern void godot_js_display_gamepad_cb(void (*p_on_change)(int p_index, int p_connected, const char *p_id, const char *p_guid));
extern int godot_js_display_gamepad_sample();
extern int godot_js_display_gamepad_sample_count();
extern int godot_js_display_gamepad_sample_get(int p_idx, float r_btns[16], int32_t *r_btns_num, float r_axes[10], int32_t *r_axes_num, int32_t *r_standard);
diff --git a/platform/javascript/javascript_singleton.cpp b/platform/javascript/javascript_singleton.cpp
index 5ef67c0cdd..c441ed0517 100644
--- a/platform/javascript/javascript_singleton.cpp
+++ b/platform/javascript/javascript_singleton.cpp
@@ -28,12 +28,16 @@
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
/*************************************************************************/
-#ifdef JAVASCRIPT_EVAL_ENABLED
-
#include "api/javascript_singleton.h"
#include "emscripten.h"
extern "C" {
+extern void godot_js_os_download_buffer(const uint8_t *p_buf, int p_buf_size, const char *p_name, const char *p_mime);
+}
+
+#ifdef JAVASCRIPT_EVAL_ENABLED
+
+extern "C" {
typedef union {
int64_t i;
double r;
@@ -301,7 +305,6 @@ union js_eval_ret {
};
extern int godot_js_eval(const char *p_js, int p_use_global_ctx, union js_eval_ret *p_union_ptr, void *p_byte_arr, void *p_byte_arr_write, void *(*p_callback)(void *p_ptr, void *p_ptr2, int p_len));
-extern int godot_js_os_download_buffer(const uint8_t *p_buf, int p_buf_size, const char *p_name, const char *p_mime);
}
void *resize_PackedByteArray_and_open_write(void *p_arr, void *r_write, int p_len) {
diff --git a/platform/javascript/js/libs/library_godot_display.js b/platform/javascript/js/libs/library_godot_display.js
index 91cab5eacc..affae90370 100644
--- a/platform/javascript/js/libs/library_godot_display.js
+++ b/platform/javascript/js/libs/library_godot_display.js
@@ -683,7 +683,7 @@ const GodotDisplay = {
return GodotDisplayScreen.exitFullscreen();
},
- godot_js_display_desired_size_set__sig: 'v',
+ godot_js_display_desired_size_set__sig: 'vii',
godot_js_display_desired_size_set: function (width, height) {
GodotDisplayScreen.desired_size = [width, height];
GodotDisplayScreen.updateSize();
diff --git a/platform/javascript/js/libs/library_godot_fetch.js b/platform/javascript/js/libs/library_godot_fetch.js
index 04b90aea9c..615f9de8b0 100644
--- a/platform/javascript/js/libs/library_godot_fetch.js
+++ b/platform/javascript/js/libs/library_godot_fetch.js
@@ -126,7 +126,7 @@ const GodotFetch = {
},
},
- godot_js_fetch_create__sig: 'iii',
+ godot_js_fetch_create__sig: 'iiiiiii',
godot_js_fetch_create: function (p_method, p_url, p_headers, p_headers_size, p_body, p_body_size) {
const method = GodotRuntime.parseString(p_method);
const url = GodotRuntime.parseString(p_url);
@@ -176,7 +176,7 @@ const GodotFetch = {
return obj.status;
},
- godot_js_fetch_read_headers__sig: 'iii',
+ godot_js_fetch_read_headers__sig: 'iiii',
godot_js_fetch_read_headers: function (p_id, p_parse_cb, p_ref) {
const obj = IDHandler.get(p_id);
if (!obj || !obj.response) {
@@ -193,7 +193,7 @@ const GodotFetch = {
return 0;
},
- godot_js_fetch_read_chunk__sig: 'ii',
+ godot_js_fetch_read_chunk__sig: 'iiii',
godot_js_fetch_read_chunk: function (p_id, p_buf, p_buf_size) {
const obj = IDHandler.get(p_id);
if (!obj || !obj.response) {
diff --git a/platform/javascript/js/libs/library_godot_javascript_singleton.js b/platform/javascript/js/libs/library_godot_javascript_singleton.js
index 09ef4a1a5d..cb80273ca8 100644
--- a/platform/javascript/js/libs/library_godot_javascript_singleton.js
+++ b/platform/javascript/js/libs/library_godot_javascript_singleton.js
@@ -196,7 +196,7 @@ const GodotJSWrapper = {
}
},
- godot_js_wrapper_create_cb__sig: 'vii',
+ godot_js_wrapper_create_cb__sig: 'iii',
godot_js_wrapper_create_cb: function (p_ref, p_func) {
const func = GodotRuntime.get_func(p_func);
let id = 0;
diff --git a/platform/javascript/package-lock.json b/platform/javascript/package-lock.json
index 8bf5c52ff6..8003619576 100644
--- a/platform/javascript/package-lock.json
+++ b/platform/javascript/package-lock.json
@@ -5,27 +5,27 @@
"requires": true,
"dependencies": {
"@babel/code-frame": {
- "version": "7.10.4",
- "resolved": "https://registry.npmjs.org/@babel/code-frame/-/code-frame-7.10.4.tgz",
- "integrity": "sha512-vG6SvB6oYEhvgisZNFRmRCUkLz11c7rp+tbNTynGqc6mS1d5ATd/sGyV6W0KZZnXRKMTzZDRgQT3Ou9jhpAfUg==",
+ "version": "7.12.11",
+ "resolved": "https://registry.npmjs.org/@babel/code-frame/-/code-frame-7.12.11.tgz",
+ "integrity": "sha512-Zt1yodBx1UcyiePMSkWnU4hPqhwq7hGi2nFL1LeA3EUl+q2LQx16MISgJ0+z7dnmgvP9QtIleuETGOiOH1RcIw==",
"dev": true,
"requires": {
"@babel/highlight": "^7.10.4"
}
},
"@babel/helper-validator-identifier": {
- "version": "7.10.4",
- "resolved": "https://registry.npmjs.org/@babel/helper-validator-identifier/-/helper-validator-identifier-7.10.4.tgz",
- "integrity": "sha512-3U9y+43hz7ZM+rzG24Qe2mufW5KhvFg/NhnNph+i9mgCtdTCtMJuI1TMkrIUiK7Ix4PYlRF9I5dhqaLYA/ADXw==",
+ "version": "7.14.5",
+ "resolved": "https://registry.npmjs.org/@babel/helper-validator-identifier/-/helper-validator-identifier-7.14.5.tgz",
+ "integrity": "sha512-5lsetuxCLilmVGyiLEfoHBRX8UCFD+1m2x3Rj97WrW3V7H3u4RWRXA4evMjImCsin2J2YT0QaVDGf+z8ondbAg==",
"dev": true
},
"@babel/highlight": {
- "version": "7.10.4",
- "resolved": "https://registry.npmjs.org/@babel/highlight/-/highlight-7.10.4.tgz",
- "integrity": "sha512-i6rgnR/YgPEQzZZnbTHHuZdlE8qyoBNalD6F+q4vAFlcMEcqmkoG+mPqJYJCo63qPf74+Y1UZsl3l6f7/RIkmA==",
+ "version": "7.14.5",
+ "resolved": "https://registry.npmjs.org/@babel/highlight/-/highlight-7.14.5.tgz",
+ "integrity": "sha512-qf9u2WFWVV0MppaL877j2dBtQIDgmidgjGk5VIMw3OadXvYaXn66U1BFlH2t4+t3i+8PhedppRv+i40ABzd+gg==",
"dev": true,
"requires": {
- "@babel/helper-validator-identifier": "^7.10.4",
+ "@babel/helper-validator-identifier": "^7.14.5",
"chalk": "^2.0.0",
"js-tokens": "^4.0.0"
},
@@ -40,39 +40,38 @@
"escape-string-regexp": "^1.0.5",
"supports-color": "^5.3.0"
}
+ },
+ "escape-string-regexp": {
+ "version": "1.0.5",
+ "resolved": "https://registry.npmjs.org/escape-string-regexp/-/escape-string-regexp-1.0.5.tgz",
+ "integrity": "sha1-G2HAViGQqN/2rjuyzwIAyhMLhtQ=",
+ "dev": true
}
}
},
"@babel/parser": {
- "version": "7.14.1",
- "resolved": "https://registry.npmjs.org/@babel/parser/-/parser-7.14.1.tgz",
- "integrity": "sha512-muUGEKu8E/ftMTPlNp+mc6zL3E9zKWmF5sDHZ5MSsoTP9Wyz64AhEf9kD08xYJ7w6Hdcu8H550ircnPyWSIF0Q==",
+ "version": "7.14.5",
+ "resolved": "https://registry.npmjs.org/@babel/parser/-/parser-7.14.5.tgz",
+ "integrity": "sha512-TM8C+xtH/9n1qzX+JNHi7AN2zHMTiPUtspO0ZdHflW8KaskkALhMmuMHb4bCmNdv9VAPzJX3/bXqkVLnAvsPfg==",
"dev": true
},
"@eslint/eslintrc": {
- "version": "0.1.3",
- "resolved": "https://registry.npmjs.org/@eslint/eslintrc/-/eslintrc-0.1.3.tgz",
- "integrity": "sha512-4YVwPkANLeNtRjMekzux1ci8hIaH5eGKktGqR0d3LWsKNn5B2X/1Z6Trxy7jQXl9EBGE6Yj02O+t09FMeRllaA==",
+ "version": "0.4.2",
+ "resolved": "https://registry.npmjs.org/@eslint/eslintrc/-/eslintrc-0.4.2.tgz",
+ "integrity": "sha512-8nmGq/4ycLpIwzvhI4tNDmQztZ8sp+hI7cyG8i1nQDhkAbRzHpXPidRAHlNvCZQpJTKw5ItIpMw9RSToGF00mg==",
"dev": true,
"requires": {
"ajv": "^6.12.4",
"debug": "^4.1.1",
"espree": "^7.3.0",
- "globals": "^12.1.0",
+ "globals": "^13.9.0",
"ignore": "^4.0.6",
"import-fresh": "^3.2.1",
"js-yaml": "^3.13.1",
- "lodash": "^4.17.19",
"minimatch": "^3.0.4",
"strip-json-comments": "^3.1.1"
}
},
- "@types/color-name": {
- "version": "1.1.1",
- "resolved": "https://registry.npmjs.org/@types/color-name/-/color-name-1.1.1.tgz",
- "integrity": "sha512-rr+OQyAjxze7GgWrSaJwydHStIhHq2lvY3BOC2Mj7KnzI7XK0Uw1TOOdI9lDoajEbSWLiYgoo4f1R51erQfhPQ==",
- "dev": true
- },
"@types/json5": {
"version": "0.0.29",
"resolved": "https://registry.npmjs.org/@types/json5/-/json5-0.0.29.tgz",
@@ -80,9 +79,9 @@
"dev": true
},
"acorn": {
- "version": "7.4.0",
- "resolved": "https://registry.npmjs.org/acorn/-/acorn-7.4.0.tgz",
- "integrity": "sha512-+G7P8jJmCHr+S+cLfQxygbWhXy+8YTVGzAkpEbcLo2mLoL7tij/VG41QSHACSf5QgYRhMZYHuNc6drJaO0Da+w==",
+ "version": "7.4.1",
+ "resolved": "https://registry.npmjs.org/acorn/-/acorn-7.4.1.tgz",
+ "integrity": "sha512-nQyp0o1/mNdbTO1PO6kHkwSrmgZ0MT/jCCpNiwbUjGoRN4dlBhqJtoQuCnEOKzgTVwg0ZWiCoQy6SxMebQVh8A==",
"dev": true
},
"acorn-jsx": {
@@ -92,9 +91,9 @@
"dev": true
},
"ajv": {
- "version": "6.12.5",
- "resolved": "https://registry.npmjs.org/ajv/-/ajv-6.12.5.tgz",
- "integrity": "sha512-lRF8RORchjpKG50/WFf8xmg7sgCLFiYNNnqdKflk63whMQcWR5ngGjiSXkL9bjxy6B2npOK2HSMN49jEBMSkag==",
+ "version": "6.12.6",
+ "resolved": "https://registry.npmjs.org/ajv/-/ajv-6.12.6.tgz",
+ "integrity": "sha512-j3fVLgvTo527anyYyJOGTYJbG+vnnQYvE0m5mmkc1TK+nxAppkCLMIL0aZ4dblVCNoGShhm+kzE4ZUykBoMg4g==",
"dev": true,
"requires": {
"fast-deep-equal": "^3.1.1",
@@ -134,78 +133,39 @@
}
},
"array-includes": {
- "version": "3.1.1",
- "resolved": "https://registry.npmjs.org/array-includes/-/array-includes-3.1.1.tgz",
- "integrity": "sha512-c2VXaCHl7zPsvpkFsw4nxvFie4fh1ur9bpcgsVkIjqn0H/Xwdg+7fv3n2r/isyS8EBj5b06M9kHyZuIr4El6WQ==",
+ "version": "3.1.3",
+ "resolved": "https://registry.npmjs.org/array-includes/-/array-includes-3.1.3.tgz",
+ "integrity": "sha512-gcem1KlBU7c9rB+Rq8/3PPKsK2kjqeEBa3bD5kkQo4nYlOHQCJqIJFqBXDEfwaRuYTT4E+FxA9xez7Gf/e3Q7A==",
"dev": true,
"requires": {
+ "call-bind": "^1.0.2",
"define-properties": "^1.1.3",
- "es-abstract": "^1.17.0",
+ "es-abstract": "^1.18.0-next.2",
+ "get-intrinsic": "^1.1.1",
"is-string": "^1.0.5"
- },
- "dependencies": {
- "es-abstract": {
- "version": "1.17.6",
- "resolved": "https://registry.npmjs.org/es-abstract/-/es-abstract-1.17.6.tgz",
- "integrity": "sha512-Fr89bON3WFyUi5EvAeI48QTWX0AyekGgLA8H+c+7fbfCkJwRWRMLd8CQedNEyJuoYYhmtEqY92pgte1FAhBlhw==",
- "dev": true,
- "requires": {
- "es-to-primitive": "^1.2.1",
- "function-bind": "^1.1.1",
- "has": "^1.0.3",
- "has-symbols": "^1.0.1",
- "is-callable": "^1.2.0",
- "is-regex": "^1.1.0",
- "object-inspect": "^1.7.0",
- "object-keys": "^1.1.1",
- "object.assign": "^4.1.0",
- "string.prototype.trimend": "^1.0.1",
- "string.prototype.trimstart": "^1.0.1"
- }
- }
}
},
"array.prototype.flat": {
- "version": "1.2.3",
- "resolved": "https://registry.npmjs.org/array.prototype.flat/-/array.prototype.flat-1.2.3.tgz",
- "integrity": "sha512-gBlRZV0VSmfPIeWfuuy56XZMvbVfbEUnOXUvt3F/eUUUSyzlgLxhEX4YAEpxNAogRGehPSnfXyPtYyKAhkzQhQ==",
+ "version": "1.2.4",
+ "resolved": "https://registry.npmjs.org/array.prototype.flat/-/array.prototype.flat-1.2.4.tgz",
+ "integrity": "sha512-4470Xi3GAPAjZqFcljX2xzckv1qeKPizoNkiS0+O4IoPR2ZNpcjE0pkhdihlDouK+x6QOast26B4Q/O9DJnwSg==",
"dev": true,
"requires": {
+ "call-bind": "^1.0.0",
"define-properties": "^1.1.3",
- "es-abstract": "^1.17.0-next.1"
- },
- "dependencies": {
- "es-abstract": {
- "version": "1.17.6",
- "resolved": "https://registry.npmjs.org/es-abstract/-/es-abstract-1.17.6.tgz",
- "integrity": "sha512-Fr89bON3WFyUi5EvAeI48QTWX0AyekGgLA8H+c+7fbfCkJwRWRMLd8CQedNEyJuoYYhmtEqY92pgte1FAhBlhw==",
- "dev": true,
- "requires": {
- "es-to-primitive": "^1.2.1",
- "function-bind": "^1.1.1",
- "has": "^1.0.3",
- "has-symbols": "^1.0.1",
- "is-callable": "^1.2.0",
- "is-regex": "^1.1.0",
- "object-inspect": "^1.7.0",
- "object-keys": "^1.1.1",
- "object.assign": "^4.1.0",
- "string.prototype.trimend": "^1.0.1",
- "string.prototype.trimstart": "^1.0.1"
- }
- }
+ "es-abstract": "^1.18.0-next.1"
}
},
"astral-regex": {
- "version": "1.0.0",
- "resolved": "https://registry.npmjs.org/astral-regex/-/astral-regex-1.0.0.tgz",
- "integrity": "sha512-+Ryf6g3BKoRc7jfp7ad8tM4TtMiaWvbF/1/sQcZPkkS7ag3D5nMBCe2UfOTONtAkaG0tO0ij3C5Lwmf1EiyjHg==",
+ "version": "2.0.0",
+ "resolved": "https://registry.npmjs.org/astral-regex/-/astral-regex-2.0.0.tgz",
+ "integrity": "sha512-Z7tMw1ytTXt5jqMcOP+OQteU1VuNK9Y02uuJtKQ1Sv69jXQKKg5cibLwGJow8yzZP+eAc18EmLGPal0bp36rvQ==",
"dev": true
},
"balanced-match": {
- "version": "1.0.0",
- "resolved": "https://registry.npmjs.org/balanced-match/-/balanced-match-1.0.0.tgz",
- "integrity": "sha1-ibTRmasr7kneFk6gK4nORi1xt2c=",
+ "version": "1.0.2",
+ "resolved": "https://registry.npmjs.org/balanced-match/-/balanced-match-1.0.2.tgz",
+ "integrity": "sha512-3oSeUO0TMV67hN1AmbXsK4yaqU7tjiHlbxRDZOpH0KW9+CeX4bRAaX0Anxt0tx2MrpRpWwQaPwIlISEJhYU5Pw==",
"dev": true
},
"bluebird": {
@@ -224,6 +184,16 @@
"concat-map": "0.0.1"
}
},
+ "call-bind": {
+ "version": "1.0.2",
+ "resolved": "https://registry.npmjs.org/call-bind/-/call-bind-1.0.2.tgz",
+ "integrity": "sha512-7O+FbCihrB5WGbFYesctwmTKae6rOiIzmz1icreWJ+0aA7LJfuqhEso2T9ncpcFtzMQtzXf2QGGueWJGTYsqrA==",
+ "dev": true,
+ "requires": {
+ "function-bind": "^1.1.1",
+ "get-intrinsic": "^1.0.2"
+ }
+ },
"callsites": {
"version": "3.1.0",
"resolved": "https://registry.npmjs.org/callsites/-/callsites-3.1.0.tgz",
@@ -231,18 +201,18 @@
"dev": true
},
"catharsis": {
- "version": "0.8.11",
- "resolved": "https://registry.npmjs.org/catharsis/-/catharsis-0.8.11.tgz",
- "integrity": "sha512-a+xUyMV7hD1BrDQA/3iPV7oc+6W26BgVJO05PGEoatMyIuPScQKsde6i3YorWX1qs+AZjnJ18NqdKoCtKiNh1g==",
+ "version": "0.9.0",
+ "resolved": "https://registry.npmjs.org/catharsis/-/catharsis-0.9.0.tgz",
+ "integrity": "sha512-prMTQVpcns/tzFgFVkVp6ak6RykZyWb3gu8ckUpd6YkTlacOd3DXGJjIpD4Q6zJirizvaiAjSSHlOsA+6sNh2A==",
"dev": true,
"requires": {
- "lodash": "^4.17.14"
+ "lodash": "^4.17.15"
}
},
"chalk": {
- "version": "4.1.0",
- "resolved": "https://registry.npmjs.org/chalk/-/chalk-4.1.0.tgz",
- "integrity": "sha512-qwx12AxXe2Q5xQ43Ac//I6v5aXTipYrSESdOgzrN+9XjgEpyjpKuvSGaN4qE93f7TQTlerQQ8S+EQ0EyDoVL1A==",
+ "version": "4.1.1",
+ "resolved": "https://registry.npmjs.org/chalk/-/chalk-4.1.1.tgz",
+ "integrity": "sha512-diHzdDKxcU+bAsUboHLPEDQiw0qEe0qd7SYUn3HgcFlWgbDcfLGswOHYeGrHKzG9z6UYf01d9VFMfZxPM1xZSg==",
"dev": true,
"requires": {
"ansi-styles": "^4.1.0",
@@ -250,12 +220,11 @@
},
"dependencies": {
"ansi-styles": {
- "version": "4.2.1",
- "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-4.2.1.tgz",
- "integrity": "sha512-9VGjrMsG1vePxcSweQsN20KY/c4zN0h9fLjqAbwbPfahM3t+NL+M9HC8xeXG2I8pX5NoamTGNuomEUFI7fcUjA==",
+ "version": "4.3.0",
+ "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-4.3.0.tgz",
+ "integrity": "sha512-zbB9rCJAT1rbjiVDb2hqKFHNYLxgtk8NURxZ3IZwD3F6NtxbXZQCnnSi1Lkx+IDohdPlFp222wVALIheZJQSEg==",
"dev": true,
"requires": {
- "@types/color-name": "^1.1.1",
"color-convert": "^2.0.1"
}
},
@@ -313,15 +282,9 @@
"dev": true
},
"confusing-browser-globals": {
- "version": "1.0.9",
- "resolved": "https://registry.npmjs.org/confusing-browser-globals/-/confusing-browser-globals-1.0.9.tgz",
- "integrity": "sha512-KbS1Y0jMtyPgIxjO7ZzMAuUpAKMt1SzCL9fsrKsX6b0zJPTaT0SiSPmewwVZg9UAO83HVIlEhZF84LIjZ0lmAw==",
- "dev": true
- },
- "contains-path": {
- "version": "0.1.0",
- "resolved": "https://registry.npmjs.org/contains-path/-/contains-path-0.1.0.tgz",
- "integrity": "sha1-/ozxhP9mcLa67wGp1IYaXL7EEgo=",
+ "version": "1.0.10",
+ "resolved": "https://registry.npmjs.org/confusing-browser-globals/-/confusing-browser-globals-1.0.10.tgz",
+ "integrity": "sha512-gNld/3lySHwuhaVluJUKLePYirM3QNCKzVxqAdhJII9/WXKVX5PURzMVJspS1jTslSqjeuG4KMVTSouit5YPHA==",
"dev": true
},
"cross-spawn": {
@@ -336,12 +299,12 @@
}
},
"debug": {
- "version": "4.1.1",
- "resolved": "https://registry.npmjs.org/debug/-/debug-4.1.1.tgz",
- "integrity": "sha512-pYAIzeRo8J6KPEaJ0VWOh5Pzkbw/RetuzehGM7QRRX5he4fPHx2rdKMB256ehJCkX+XRQm16eZLqLNS8RSZXZw==",
+ "version": "4.3.1",
+ "resolved": "https://registry.npmjs.org/debug/-/debug-4.3.1.tgz",
+ "integrity": "sha512-doEwdvm4PCeK4K3RQN2ZC2BYUBaxwLARCqZmMjtF8a51J2Rb0xpVloFRnCODwqjpwnAoao4pelN8l3RJdv3gRQ==",
"dev": true,
"requires": {
- "ms": "^2.1.1"
+ "ms": "2.1.2"
}
},
"deep-is": {
@@ -369,9 +332,9 @@
}
},
"emoji-regex": {
- "version": "7.0.3",
- "resolved": "https://registry.npmjs.org/emoji-regex/-/emoji-regex-7.0.3.tgz",
- "integrity": "sha512-CwBLREIQ7LvYFB0WyRvwhq5N5qPhc6PMjD6bYggFlI5YyDgl+0vxq5VHbMOFqLg7hfWzmu8T5Z1QofhmTIhItA==",
+ "version": "8.0.0",
+ "resolved": "https://registry.npmjs.org/emoji-regex/-/emoji-regex-8.0.0.tgz",
+ "integrity": "sha512-MSjYzcWNOA0ewAHpz0MxpYFvwg6yjy1NG3xteoqz644VCo/RPgnr1/GGt+ic3iJTzQ8Eu3TdM14SawnVUmGE6A==",
"dev": true
},
"enquirer": {
@@ -399,23 +362,27 @@
}
},
"es-abstract": {
- "version": "1.18.0-next.0",
- "resolved": "https://registry.npmjs.org/es-abstract/-/es-abstract-1.18.0-next.0.tgz",
- "integrity": "sha512-elZXTZXKn51hUBdJjSZGYRujuzilgXo8vSPQzjGYXLvSlGiCo8VO8ZGV3kjo9a0WNJJ57hENagwbtlRuHuzkcQ==",
+ "version": "1.18.3",
+ "resolved": "https://registry.npmjs.org/es-abstract/-/es-abstract-1.18.3.tgz",
+ "integrity": "sha512-nQIr12dxV7SSxE6r6f1l3DtAeEYdsGpps13dR0TwJg1S8gyp4ZPgy3FZcHBgbiQqnoqSTb+oC+kO4UQ0C/J8vw==",
"dev": true,
"requires": {
+ "call-bind": "^1.0.2",
"es-to-primitive": "^1.2.1",
"function-bind": "^1.1.1",
+ "get-intrinsic": "^1.1.1",
"has": "^1.0.3",
- "has-symbols": "^1.0.1",
- "is-callable": "^1.2.0",
- "is-negative-zero": "^2.0.0",
- "is-regex": "^1.1.1",
- "object-inspect": "^1.8.0",
+ "has-symbols": "^1.0.2",
+ "is-callable": "^1.2.3",
+ "is-negative-zero": "^2.0.1",
+ "is-regex": "^1.1.3",
+ "is-string": "^1.0.6",
+ "object-inspect": "^1.10.3",
"object-keys": "^1.1.1",
- "object.assign": "^4.1.0",
- "string.prototype.trimend": "^1.0.1",
- "string.prototype.trimstart": "^1.0.1"
+ "object.assign": "^4.1.2",
+ "string.prototype.trimend": "^1.0.4",
+ "string.prototype.trimstart": "^1.0.4",
+ "unbox-primitive": "^1.0.1"
}
},
"es-to-primitive": {
@@ -430,35 +397,37 @@
}
},
"escape-string-regexp": {
- "version": "1.0.5",
- "resolved": "https://registry.npmjs.org/escape-string-regexp/-/escape-string-regexp-1.0.5.tgz",
- "integrity": "sha1-G2HAViGQqN/2rjuyzwIAyhMLhtQ=",
+ "version": "4.0.0",
+ "resolved": "https://registry.npmjs.org/escape-string-regexp/-/escape-string-regexp-4.0.0.tgz",
+ "integrity": "sha512-TtpcNJ3XAzx3Gq8sWRzJaVajRs0uVxA2YAkdb1jm2YkPz4G6egUFAyA3n5vtEIZefPk5Wa4UXbKuS5fKkJWdgA==",
"dev": true
},
"eslint": {
- "version": "7.9.0",
- "resolved": "https://registry.npmjs.org/eslint/-/eslint-7.9.0.tgz",
- "integrity": "sha512-V6QyhX21+uXp4T+3nrNfI3hQNBDa/P8ga7LoQOenwrlEFXrEnUEE+ok1dMtaS3b6rmLXhT1TkTIsG75HMLbknA==",
+ "version": "7.28.0",
+ "resolved": "https://registry.npmjs.org/eslint/-/eslint-7.28.0.tgz",
+ "integrity": "sha512-UMfH0VSjP0G4p3EWirscJEQ/cHqnT/iuH6oNZOB94nBjWbMnhGEPxsZm1eyIW0C/9jLI0Fow4W5DXLjEI7mn1g==",
"dev": true,
"requires": {
- "@babel/code-frame": "^7.0.0",
- "@eslint/eslintrc": "^0.1.3",
+ "@babel/code-frame": "7.12.11",
+ "@eslint/eslintrc": "^0.4.2",
"ajv": "^6.10.0",
"chalk": "^4.0.0",
"cross-spawn": "^7.0.2",
"debug": "^4.0.1",
"doctrine": "^3.0.0",
"enquirer": "^2.3.5",
- "eslint-scope": "^5.1.0",
+ "escape-string-regexp": "^4.0.0",
+ "eslint-scope": "^5.1.1",
"eslint-utils": "^2.1.0",
- "eslint-visitor-keys": "^1.3.0",
- "espree": "^7.3.0",
- "esquery": "^1.2.0",
+ "eslint-visitor-keys": "^2.0.0",
+ "espree": "^7.3.1",
+ "esquery": "^1.4.0",
"esutils": "^2.0.2",
- "file-entry-cache": "^5.0.1",
+ "fast-deep-equal": "^3.1.3",
+ "file-entry-cache": "^6.0.1",
"functional-red-black-tree": "^1.0.1",
- "glob-parent": "^5.0.0",
- "globals": "^12.1.0",
+ "glob-parent": "^5.1.2",
+ "globals": "^13.6.0",
"ignore": "^4.0.6",
"import-fresh": "^3.0.0",
"imurmurhash": "^0.1.4",
@@ -466,7 +435,7 @@
"js-yaml": "^3.13.1",
"json-stable-stringify-without-jsonify": "^1.0.1",
"levn": "^0.4.1",
- "lodash": "^4.17.19",
+ "lodash.merge": "^4.6.2",
"minimatch": "^3.0.4",
"natural-compare": "^1.4.0",
"optionator": "^0.9.1",
@@ -475,19 +444,19 @@
"semver": "^7.2.1",
"strip-ansi": "^6.0.0",
"strip-json-comments": "^3.1.0",
- "table": "^5.2.3",
+ "table": "^6.0.9",
"text-table": "^0.2.0",
"v8-compile-cache": "^2.0.3"
}
},
"eslint-config-airbnb-base": {
- "version": "14.2.0",
- "resolved": "https://registry.npmjs.org/eslint-config-airbnb-base/-/eslint-config-airbnb-base-14.2.0.tgz",
- "integrity": "sha512-Snswd5oC6nJaevs3nZoLSTvGJBvzTfnBqOIArkf3cbyTyq9UD79wOk8s+RiL6bhca0p/eRO6veczhf6A/7Jy8Q==",
+ "version": "14.2.1",
+ "resolved": "https://registry.npmjs.org/eslint-config-airbnb-base/-/eslint-config-airbnb-base-14.2.1.tgz",
+ "integrity": "sha512-GOrQyDtVEc1Xy20U7vsB2yAoB4nBlfH5HZJeatRXHleO+OS5Ot+MWij4Dpltw4/DyIkqUfqz1epfhVR5XWWQPA==",
"dev": true,
"requires": {
- "confusing-browser-globals": "^1.0.9",
- "object.assign": "^4.1.0",
+ "confusing-browser-globals": "^1.0.10",
+ "object.assign": "^4.1.2",
"object.entries": "^1.1.2"
}
},
@@ -519,50 +488,46 @@
}
},
"eslint-module-utils": {
- "version": "2.6.0",
- "resolved": "https://registry.npmjs.org/eslint-module-utils/-/eslint-module-utils-2.6.0.tgz",
- "integrity": "sha512-6j9xxegbqe8/kZY8cYpcp0xhbK0EgJlg3g9mib3/miLaExuuwc3n5UEfSnU6hWMbT0FAYVvDbL9RrRgpUeQIvA==",
+ "version": "2.6.1",
+ "resolved": "https://registry.npmjs.org/eslint-module-utils/-/eslint-module-utils-2.6.1.tgz",
+ "integrity": "sha512-ZXI9B8cxAJIH4nfkhTwcRTEAnrVfobYqwjWy/QMCZ8rHkZHFjf9yO4BzpiF9kCSfNlMG54eKigISHpX0+AaT4A==",
"dev": true,
"requires": {
- "debug": "^2.6.9",
+ "debug": "^3.2.7",
"pkg-dir": "^2.0.0"
},
"dependencies": {
"debug": {
- "version": "2.6.9",
- "resolved": "https://registry.npmjs.org/debug/-/debug-2.6.9.tgz",
- "integrity": "sha512-bC7ElrdJaJnPbAP+1EotYvqZsb3ecl5wi6Bfi6BJTUcNowp6cvspg0jXznRTKDjm/E7AdgFBVeAPVMNcKGsHMA==",
+ "version": "3.2.7",
+ "resolved": "https://registry.npmjs.org/debug/-/debug-3.2.7.tgz",
+ "integrity": "sha512-CFjzYYAi4ThfiQvizrFQevTTXHtnCqWfe7x1AhgEscTz6ZbLbfoLRLPugTQyBth6f8ZERVUSyWHFD/7Wu4t1XQ==",
"dev": true,
"requires": {
- "ms": "2.0.0"
+ "ms": "^2.1.1"
}
- },
- "ms": {
- "version": "2.0.0",
- "resolved": "https://registry.npmjs.org/ms/-/ms-2.0.0.tgz",
- "integrity": "sha1-VgiurfwAvmwpAd9fmGF4jeDVl8g=",
- "dev": true
}
}
},
"eslint-plugin-import": {
- "version": "2.22.0",
- "resolved": "https://registry.npmjs.org/eslint-plugin-import/-/eslint-plugin-import-2.22.0.tgz",
- "integrity": "sha512-66Fpf1Ln6aIS5Gr/55ts19eUuoDhAbZgnr6UxK5hbDx6l/QgQgx61AePq+BV4PP2uXQFClgMVzep5zZ94qqsxg==",
+ "version": "2.23.4",
+ "resolved": "https://registry.npmjs.org/eslint-plugin-import/-/eslint-plugin-import-2.23.4.tgz",
+ "integrity": "sha512-6/wP8zZRsnQFiR3iaPFgh5ImVRM1WN5NUWfTIRqwOdeiGJlBcSk82o1FEVq8yXmy4lkIzTo7YhHCIxlU/2HyEQ==",
"dev": true,
"requires": {
- "array-includes": "^3.1.1",
- "array.prototype.flat": "^1.2.3",
- "contains-path": "^0.1.0",
+ "array-includes": "^3.1.3",
+ "array.prototype.flat": "^1.2.4",
"debug": "^2.6.9",
- "doctrine": "1.5.0",
- "eslint-import-resolver-node": "^0.3.3",
- "eslint-module-utils": "^2.6.0",
+ "doctrine": "^2.1.0",
+ "eslint-import-resolver-node": "^0.3.4",
+ "eslint-module-utils": "^2.6.1",
+ "find-up": "^2.0.0",
"has": "^1.0.3",
+ "is-core-module": "^2.4.0",
"minimatch": "^3.0.4",
- "object.values": "^1.1.1",
- "read-pkg-up": "^2.0.0",
- "resolve": "^1.17.0",
+ "object.values": "^1.1.3",
+ "pkg-up": "^2.0.0",
+ "read-pkg-up": "^3.0.0",
+ "resolve": "^1.20.0",
"tsconfig-paths": "^3.9.0"
},
"dependencies": {
@@ -576,13 +541,12 @@
}
},
"doctrine": {
- "version": "1.5.0",
- "resolved": "https://registry.npmjs.org/doctrine/-/doctrine-1.5.0.tgz",
- "integrity": "sha1-N53Ocw9hZvds76TmcHoVmwLFpvo=",
+ "version": "2.1.0",
+ "resolved": "https://registry.npmjs.org/doctrine/-/doctrine-2.1.0.tgz",
+ "integrity": "sha512-35mSku4ZXK0vfCuHEDAwt55dg2jNajHZ1odvF+8SSr82EsZY4QmXfuWso8oEd8zRhVObSN18aM0CjSdoBX7zIw==",
"dev": true,
"requires": {
- "esutils": "^2.0.2",
- "isarray": "^1.0.0"
+ "esutils": "^2.0.2"
}
},
"ms": {
@@ -610,23 +574,39 @@
"dev": true,
"requires": {
"eslint-visitor-keys": "^1.1.0"
+ },
+ "dependencies": {
+ "eslint-visitor-keys": {
+ "version": "1.3.0",
+ "resolved": "https://registry.npmjs.org/eslint-visitor-keys/-/eslint-visitor-keys-1.3.0.tgz",
+ "integrity": "sha512-6J72N8UNa462wa/KFODt/PJ3IU60SDpC3QXC1Hjc1BXXpfL2C9R5+AU7jhe0F6GREqVMh4Juu+NY7xn+6dipUQ==",
+ "dev": true
+ }
}
},
"eslint-visitor-keys": {
- "version": "1.3.0",
- "resolved": "https://registry.npmjs.org/eslint-visitor-keys/-/eslint-visitor-keys-1.3.0.tgz",
- "integrity": "sha512-6J72N8UNa462wa/KFODt/PJ3IU60SDpC3QXC1Hjc1BXXpfL2C9R5+AU7jhe0F6GREqVMh4Juu+NY7xn+6dipUQ==",
+ "version": "2.1.0",
+ "resolved": "https://registry.npmjs.org/eslint-visitor-keys/-/eslint-visitor-keys-2.1.0.tgz",
+ "integrity": "sha512-0rSmRBzXgDzIsD6mGdJgevzgezI534Cer5L/vyMX0kHzT/jiB43jRhd9YUlMGYLQy2zprNmoT8qasCGtY+QaKw==",
"dev": true
},
"espree": {
- "version": "7.3.0",
- "resolved": "https://registry.npmjs.org/espree/-/espree-7.3.0.tgz",
- "integrity": "sha512-dksIWsvKCixn1yrEXO8UosNSxaDoSYpq9reEjZSbHLpT5hpaCAKTLBwq0RHtLrIr+c0ByiYzWT8KTMRzoRCNlw==",
+ "version": "7.3.1",
+ "resolved": "https://registry.npmjs.org/espree/-/espree-7.3.1.tgz",
+ "integrity": "sha512-v3JCNCE64umkFpmkFGqzVKsOT0tN1Zr+ueqLZfpV1Ob8e+CEgPWa+OxCoGH3tnhimMKIaBm4m/vaRpJ/krRz2g==",
"dev": true,
"requires": {
"acorn": "^7.4.0",
- "acorn-jsx": "^5.2.0",
+ "acorn-jsx": "^5.3.1",
"eslint-visitor-keys": "^1.3.0"
+ },
+ "dependencies": {
+ "eslint-visitor-keys": {
+ "version": "1.3.0",
+ "resolved": "https://registry.npmjs.org/eslint-visitor-keys/-/eslint-visitor-keys-1.3.0.tgz",
+ "integrity": "sha512-6J72N8UNa462wa/KFODt/PJ3IU60SDpC3QXC1Hjc1BXXpfL2C9R5+AU7jhe0F6GREqVMh4Juu+NY7xn+6dipUQ==",
+ "dev": true
+ }
}
},
"esprima": {
@@ -636,9 +616,9 @@
"dev": true
},
"esquery": {
- "version": "1.3.1",
- "resolved": "https://registry.npmjs.org/esquery/-/esquery-1.3.1.tgz",
- "integrity": "sha512-olpvt9QG0vniUBZspVRN6lwB7hOZoTRtT+jzR+tS4ffYx2mzbw+z0XCOk44aaLYKApNX5nMm+E+P6o25ip/DHQ==",
+ "version": "1.4.0",
+ "resolved": "https://registry.npmjs.org/esquery/-/esquery-1.4.0.tgz",
+ "integrity": "sha512-cCDispWt5vHHtwMY2YrAQ4ibFkAL8RbH5YGBnZBc90MolvvfkkQcJro/aZiAQUlQ3qgrYS6D6v8Gc5G5CQsc9w==",
"dev": true,
"requires": {
"estraverse": "^5.1.0"
@@ -700,12 +680,12 @@
"dev": true
},
"file-entry-cache": {
- "version": "5.0.1",
- "resolved": "https://registry.npmjs.org/file-entry-cache/-/file-entry-cache-5.0.1.tgz",
- "integrity": "sha512-bCg29ictuBaKUwwArK4ouCaqDgLZcysCFLmM/Yn/FDoqndh/9vNuQfXRDvTuXKLxfD/JtZQGKFT8MGcJBK644g==",
+ "version": "6.0.1",
+ "resolved": "https://registry.npmjs.org/file-entry-cache/-/file-entry-cache-6.0.1.tgz",
+ "integrity": "sha512-7Gps/XWymbLk2QLYK4NzpMOrYjMhdIxXuIvy2QBsLE6ljuodKvdkWs/cpyJJ3CVIVpH0Oi1Hvg1ovbMzLdFBBg==",
"dev": true,
"requires": {
- "flat-cache": "^2.0.1"
+ "flat-cache": "^3.0.4"
}
},
"find-up": {
@@ -718,20 +698,19 @@
}
},
"flat-cache": {
- "version": "2.0.1",
- "resolved": "https://registry.npmjs.org/flat-cache/-/flat-cache-2.0.1.tgz",
- "integrity": "sha512-LoQe6yDuUMDzQAEH8sgmh4Md6oZnc/7PjtwjNFSzveXqSHt6ka9fPBuso7IGf9Rz4uqnSnWiFH2B/zj24a5ReA==",
+ "version": "3.0.4",
+ "resolved": "https://registry.npmjs.org/flat-cache/-/flat-cache-3.0.4.tgz",
+ "integrity": "sha512-dm9s5Pw7Jc0GvMYbshN6zchCA9RgQlzzEZX3vylR9IqFfS8XciblUXOKfW6SiuJ0e13eDYZoZV5wdrev7P3Nwg==",
"dev": true,
"requires": {
- "flatted": "^2.0.0",
- "rimraf": "2.6.3",
- "write": "1.0.3"
+ "flatted": "^3.1.0",
+ "rimraf": "^3.0.2"
}
},
"flatted": {
- "version": "2.0.2",
- "resolved": "https://registry.npmjs.org/flatted/-/flatted-2.0.2.tgz",
- "integrity": "sha512-r5wGx7YeOwNWNlCA0wQ86zKyDLMQr+/RB8xy74M4hTphfmjlijTSSXGuH8rnvKZnfT9i+75zmd8jcKdMR4O6jA==",
+ "version": "3.1.1",
+ "resolved": "https://registry.npmjs.org/flatted/-/flatted-3.1.1.tgz",
+ "integrity": "sha512-zAoAQiudy+r5SvnSw3KJy5os/oRJYHzrzja/tBDqrZtNhUw8bt6y8OBzMWcjWr+8liV8Eb6yOhw8WZ7VFZ5ZzA==",
"dev": true
},
"fs.realpath": {
@@ -752,10 +731,21 @@
"integrity": "sha1-GwqzvVU7Kg1jmdKcDj6gslIHgyc=",
"dev": true
},
+ "get-intrinsic": {
+ "version": "1.1.1",
+ "resolved": "https://registry.npmjs.org/get-intrinsic/-/get-intrinsic-1.1.1.tgz",
+ "integrity": "sha512-kWZrnVM42QCiEA2Ig1bG8zjoIMOgxWwYCEeNdwY6Tv/cOSeGpcoX4pXHfKUxNKVoArnrEr2e9srnAxxGIraS9Q==",
+ "dev": true,
+ "requires": {
+ "function-bind": "^1.1.1",
+ "has": "^1.0.3",
+ "has-symbols": "^1.0.1"
+ }
+ },
"glob": {
- "version": "7.1.6",
- "resolved": "https://registry.npmjs.org/glob/-/glob-7.1.6.tgz",
- "integrity": "sha512-LwaxwyZ72Lk7vZINtNNrywX0ZuLyStrdDtabefZKAY5ZGJhVtgdznluResxNmPitE0SAO+O26sWTHeKSI2wMBA==",
+ "version": "7.1.7",
+ "resolved": "https://registry.npmjs.org/glob/-/glob-7.1.7.tgz",
+ "integrity": "sha512-OvD9ENzPLbegENnYP5UUfJIirTg4+XwMWGaQfQTY0JenxNvvIKP3U3/tAQSPIu/lHxXYSZmpXlUHeqAIdKzBLQ==",
"dev": true,
"requires": {
"fs.realpath": "^1.0.0",
@@ -767,27 +757,27 @@
}
},
"glob-parent": {
- "version": "5.1.1",
- "resolved": "https://registry.npmjs.org/glob-parent/-/glob-parent-5.1.1.tgz",
- "integrity": "sha512-FnI+VGOpnlGHWZxthPGR+QhR78fuiK0sNLkHQv+bL9fQi57lNNdquIbna/WrfROrolq8GK5Ek6BiMwqL/voRYQ==",
+ "version": "5.1.2",
+ "resolved": "https://registry.npmjs.org/glob-parent/-/glob-parent-5.1.2.tgz",
+ "integrity": "sha512-AOIgSQCepiJYwP3ARnGx+5VnTu2HBYdzbGP45eLw1vr3zB3vZLeyed1sC9hnbcOc9/SrMyM5RPQrkGz4aS9Zow==",
"dev": true,
"requires": {
"is-glob": "^4.0.1"
}
},
"globals": {
- "version": "12.4.0",
- "resolved": "https://registry.npmjs.org/globals/-/globals-12.4.0.tgz",
- "integrity": "sha512-BWICuzzDvDoH54NHKCseDanAhE3CeDorgDL5MT6LMXXj2WCnd9UC2szdk4AWLfjdgNBCXLUanXYcpBBKOSWGwg==",
+ "version": "13.9.0",
+ "resolved": "https://registry.npmjs.org/globals/-/globals-13.9.0.tgz",
+ "integrity": "sha512-74/FduwI/JaIrr1H8e71UbDE+5x7pIPs1C2rrwC52SszOo043CsWOZEMW7o2Y58xwm9b+0RBKDxY5n2sUpEFxA==",
"dev": true,
"requires": {
- "type-fest": "^0.8.1"
+ "type-fest": "^0.20.2"
}
},
"graceful-fs": {
- "version": "4.2.4",
- "resolved": "https://registry.npmjs.org/graceful-fs/-/graceful-fs-4.2.4.tgz",
- "integrity": "sha512-WjKPNJF79dtJAVniUlGGWHYGz2jWxT6VhN/4m1NdkbZ2nOsEF+cI1Edgql5zCRhs/VsQYRvrXctxktVXZUkixw==",
+ "version": "4.2.6",
+ "resolved": "https://registry.npmjs.org/graceful-fs/-/graceful-fs-4.2.6.tgz",
+ "integrity": "sha512-nTnJ528pbqxYanhpDYsi4Rd8MAeaBA67+RZ10CM1m3bTAVFEDcd5AuA4a6W5YkGZ1iNXHzZz8T6TBKLeBuNriQ==",
"dev": true
},
"has": {
@@ -799,6 +789,12 @@
"function-bind": "^1.1.1"
}
},
+ "has-bigints": {
+ "version": "1.0.1",
+ "resolved": "https://registry.npmjs.org/has-bigints/-/has-bigints-1.0.1.tgz",
+ "integrity": "sha512-LSBS2LjbNBTf6287JEbEzvJgftkF5qFkmCo9hDRpAzKhUOlJ+hx8dd4USs00SgsUNwc4617J9ki5YtEClM2ffA==",
+ "dev": true
+ },
"has-flag": {
"version": "3.0.0",
"resolved": "https://registry.npmjs.org/has-flag/-/has-flag-3.0.0.tgz",
@@ -806,9 +802,9 @@
"dev": true
},
"has-symbols": {
- "version": "1.0.1",
- "resolved": "https://registry.npmjs.org/has-symbols/-/has-symbols-1.0.1.tgz",
- "integrity": "sha512-PLcsoqu++dmEIZB+6totNFKq/7Do+Z0u4oT0zKOJNl3lYK6vGwwu2hjHs+68OEZbTjiUE9bgOABXbP/GvrS0Kg==",
+ "version": "1.0.2",
+ "resolved": "https://registry.npmjs.org/has-symbols/-/has-symbols-1.0.2.tgz",
+ "integrity": "sha512-chXa79rL/UC2KlX17jo3vRGz0azaWEx5tGqZg5pO3NUyEJVB17dMruQlzCCOfUvElghKcm5194+BCRvi2Rv/Gw==",
"dev": true
},
"hosted-git-info": {
@@ -824,9 +820,9 @@
"dev": true
},
"import-fresh": {
- "version": "3.2.1",
- "resolved": "https://registry.npmjs.org/import-fresh/-/import-fresh-3.2.1.tgz",
- "integrity": "sha512-6e1q1cnWP2RXD9/keSkxHScg508CdXqXWgWBaETNhyuBFz+kUZlKboh+ISK+bU++DmbHimVBrOz/zzPe0sZ3sQ==",
+ "version": "3.3.0",
+ "resolved": "https://registry.npmjs.org/import-fresh/-/import-fresh-3.3.0.tgz",
+ "integrity": "sha512-veYYhQa+D1QBKznvhUHxb8faxlrwUnxseDAbAp457E0wLNio2bOSKnjYDhMj+YiAq61xrMGhQk9iXVk5FzgQMw==",
"dev": true,
"requires": {
"parent-module": "^1.0.0",
@@ -861,16 +857,40 @@
"integrity": "sha1-d8mYQFJ6qOyxqLppe4BkWnqSap0=",
"dev": true
},
+ "is-bigint": {
+ "version": "1.0.2",
+ "resolved": "https://registry.npmjs.org/is-bigint/-/is-bigint-1.0.2.tgz",
+ "integrity": "sha512-0JV5+SOCQkIdzjBK9buARcV804Ddu7A0Qet6sHi3FimE9ne6m4BGQZfRn+NZiXbBk4F4XmHfDZIipLj9pX8dSA==",
+ "dev": true
+ },
+ "is-boolean-object": {
+ "version": "1.1.1",
+ "resolved": "https://registry.npmjs.org/is-boolean-object/-/is-boolean-object-1.1.1.tgz",
+ "integrity": "sha512-bXdQWkECBUIAcCkeH1unwJLIpZYaa5VvuygSyS/c2lf719mTKZDU5UdDRlpd01UjADgmW8RfqaP+mRaVPdr/Ng==",
+ "dev": true,
+ "requires": {
+ "call-bind": "^1.0.2"
+ }
+ },
"is-callable": {
- "version": "1.2.1",
- "resolved": "https://registry.npmjs.org/is-callable/-/is-callable-1.2.1.tgz",
- "integrity": "sha512-wliAfSzx6V+6WfMOmus1xy0XvSgf/dlStkvTfq7F0g4bOIW0PSUbnyse3NhDwdyYS1ozfUtAAySqTws3z9Eqgg==",
+ "version": "1.2.3",
+ "resolved": "https://registry.npmjs.org/is-callable/-/is-callable-1.2.3.tgz",
+ "integrity": "sha512-J1DcMe8UYTBSrKezuIUTUwjXsho29693unXM2YhJUTR2txK/eG47bvNa/wipPFmZFgr/N6f1GA66dv0mEyTIyQ==",
"dev": true
},
+ "is-core-module": {
+ "version": "2.4.0",
+ "resolved": "https://registry.npmjs.org/is-core-module/-/is-core-module-2.4.0.tgz",
+ "integrity": "sha512-6A2fkfq1rfeQZjxrZJGerpLCTHRNEBiSgnu0+obeJpEPZRUooHgsizvzv0ZjJwOz3iWIHdJtVWJ/tmPr3D21/A==",
+ "dev": true,
+ "requires": {
+ "has": "^1.0.3"
+ }
+ },
"is-date-object": {
- "version": "1.0.2",
- "resolved": "https://registry.npmjs.org/is-date-object/-/is-date-object-1.0.2.tgz",
- "integrity": "sha512-USlDT524woQ08aoZFzh3/Z6ch9Y/EWXEHQ/AaRN0SkKq4t2Jw2R2339tSXmwuVoY7LLlBCbOIlx2myP/L5zk0g==",
+ "version": "1.0.4",
+ "resolved": "https://registry.npmjs.org/is-date-object/-/is-date-object-1.0.4.tgz",
+ "integrity": "sha512-/b4ZVsG7Z5XVtIxs/h9W8nvfLgSAyKYdtGWQLbqy6jA1icmgjf8WCoTKgeS4wy5tYaPePouzFMANbnj94c2Z+A==",
"dev": true
},
"is-extglob": {
@@ -880,9 +900,9 @@
"dev": true
},
"is-fullwidth-code-point": {
- "version": "2.0.0",
- "resolved": "https://registry.npmjs.org/is-fullwidth-code-point/-/is-fullwidth-code-point-2.0.0.tgz",
- "integrity": "sha1-o7MKXE8ZkYMWeqq5O+764937ZU8=",
+ "version": "3.0.0",
+ "resolved": "https://registry.npmjs.org/is-fullwidth-code-point/-/is-fullwidth-code-point-3.0.0.tgz",
+ "integrity": "sha512-zymm5+u+sCsSWyD9qNaejV3DFvhCKclKdizYaJUuHA83RLjb7nSuGnddCHGv0hk+KY7BMAlsWeK4Ueg6EV6XQg==",
"dev": true
},
"is-glob": {
@@ -895,41 +915,42 @@
}
},
"is-negative-zero": {
- "version": "2.0.0",
- "resolved": "https://registry.npmjs.org/is-negative-zero/-/is-negative-zero-2.0.0.tgz",
- "integrity": "sha1-lVOxIbD6wohp2p7UWeIMdUN4hGE=",
+ "version": "2.0.1",
+ "resolved": "https://registry.npmjs.org/is-negative-zero/-/is-negative-zero-2.0.1.tgz",
+ "integrity": "sha512-2z6JzQvZRa9A2Y7xC6dQQm4FSTSTNWjKIYYTt4246eMTJmIo0Q+ZyOsU66X8lxK1AbB92dFeglPLrhwpeRKO6w==",
+ "dev": true
+ },
+ "is-number-object": {
+ "version": "1.0.5",
+ "resolved": "https://registry.npmjs.org/is-number-object/-/is-number-object-1.0.5.tgz",
+ "integrity": "sha512-RU0lI/n95pMoUKu9v1BZP5MBcZuNSVJkMkAG2dJqC4z2GlkGUNeH68SuHuBKBD/XFe+LHZ+f9BKkLET60Niedw==",
"dev": true
},
"is-regex": {
- "version": "1.1.1",
- "resolved": "https://registry.npmjs.org/is-regex/-/is-regex-1.1.1.tgz",
- "integrity": "sha512-1+QkEcxiLlB7VEyFtyBg94e08OAsvq7FUBgApTq/w2ymCLyKJgDPsybBENVtA7XCQEgEXxKPonG+mvYRxh/LIg==",
+ "version": "1.1.3",
+ "resolved": "https://registry.npmjs.org/is-regex/-/is-regex-1.1.3.tgz",
+ "integrity": "sha512-qSVXFz28HM7y+IWX6vLCsexdlvzT1PJNFSBuaQLQ5o0IEw8UDYW6/2+eCMVyIsbM8CNLX2a/QWmSpyxYEHY7CQ==",
"dev": true,
"requires": {
- "has-symbols": "^1.0.1"
+ "call-bind": "^1.0.2",
+ "has-symbols": "^1.0.2"
}
},
"is-string": {
- "version": "1.0.5",
- "resolved": "https://registry.npmjs.org/is-string/-/is-string-1.0.5.tgz",
- "integrity": "sha512-buY6VNRjhQMiF1qWDouloZlQbRhDPCebwxSjxMjxgemYT46YMd2NR0/H+fBhEfWX4A/w9TBJ+ol+okqJKFE6vQ==",
+ "version": "1.0.6",
+ "resolved": "https://registry.npmjs.org/is-string/-/is-string-1.0.6.tgz",
+ "integrity": "sha512-2gdzbKUuqtQ3lYNrUTQYoClPhm7oQu4UdpSZMp1/DGgkHBT8E2Z1l0yMdb6D4zNAxwDiMv8MdulKROJGNl0Q0w==",
"dev": true
},
"is-symbol": {
- "version": "1.0.3",
- "resolved": "https://registry.npmjs.org/is-symbol/-/is-symbol-1.0.3.tgz",
- "integrity": "sha512-OwijhaRSgqvhm/0ZdAcXNZt9lYdKFpcRDT5ULUuYXPoT794UNOdU+gpT6Rzo7b4V2HUl/op6GqY894AZwv9faQ==",
+ "version": "1.0.4",
+ "resolved": "https://registry.npmjs.org/is-symbol/-/is-symbol-1.0.4.tgz",
+ "integrity": "sha512-C/CPBqKWnvdcxqIARxyOh4v1UUEOCHpgDa0WYgpKDFMszcrPcffg5uhwSgPCLD2WWxmq6isisz87tzT01tuGhg==",
"dev": true,
"requires": {
- "has-symbols": "^1.0.1"
+ "has-symbols": "^1.0.2"
}
},
- "isarray": {
- "version": "1.0.0",
- "resolved": "https://registry.npmjs.org/isarray/-/isarray-1.0.0.tgz",
- "integrity": "sha1-u5NdSFgsuhaMBoNJV6VKPgcSTxE=",
- "dev": true
- },
"isexe": {
"version": "2.0.0",
"resolved": "https://registry.npmjs.org/isexe/-/isexe-2.0.0.tgz",
@@ -943,9 +964,9 @@
"dev": true
},
"js-yaml": {
- "version": "3.14.0",
- "resolved": "https://registry.npmjs.org/js-yaml/-/js-yaml-3.14.0.tgz",
- "integrity": "sha512-/4IbIeHcD9VMHFqDR/gQ7EdZdLimOvW2DdcxFjdyyZ9NsbS+ccrXqVWDtab/lRl5AlUqmpBx8EhPaWR+OtY17A==",
+ "version": "3.14.1",
+ "resolved": "https://registry.npmjs.org/js-yaml/-/js-yaml-3.14.1.tgz",
+ "integrity": "sha512-okMH7OXXJ7YrN9Ok3/SXrnu4iX9yOk+25nqX4imS2npuvTYDmo/QEZoqwZkYaIDk3jVvBOTOIEgEhaLOynBS9g==",
"dev": true,
"requires": {
"argparse": "^1.0.7",
@@ -962,13 +983,14 @@
}
},
"jsdoc": {
- "version": "github:jsdoc/jsdoc#544a992824631fc652183d8b0b4b1281dc961560",
- "from": "github:jsdoc/jsdoc#544a992824631fc652183d8b0b4b1281dc961560",
+ "version": "3.6.7",
+ "resolved": "https://registry.npmjs.org/jsdoc/-/jsdoc-3.6.7.tgz",
+ "integrity": "sha512-sxKt7h0vzCd+3Y81Ey2qinupL6DpRSZJclS04ugHDNmRUXGzqicMJ6iwayhSA0S0DwwX30c5ozyUthr1QKF6uw==",
"dev": true,
"requires": {
"@babel/parser": "^7.9.4",
"bluebird": "^3.7.2",
- "catharsis": "^0.8.11",
+ "catharsis": "^0.9.0",
"escape-string-regexp": "^2.0.0",
"js2xmlparser": "^4.0.1",
"klaw": "^3.0.0",
@@ -979,7 +1001,7 @@
"requizzle": "^0.2.3",
"strip-json-comments": "^3.1.0",
"taffydb": "2.6.2",
- "underscore": "~1.12.1"
+ "underscore": "~1.13.1"
},
"dependencies": {
"escape-string-regexp": {
@@ -987,15 +1009,15 @@
"resolved": "https://registry.npmjs.org/escape-string-regexp/-/escape-string-regexp-2.0.0.tgz",
"integrity": "sha512-UpzcLCXolUWcNu5HtVMHYdXJjArjsF9C0aNnquZYY4uW/Vu0miy5YoWvbV345HauVvcAUnpRuhMMcqTcGOY2+w==",
"dev": true
- },
- "mkdirp": {
- "version": "1.0.4",
- "resolved": "https://registry.npmjs.org/mkdirp/-/mkdirp-1.0.4.tgz",
- "integrity": "sha512-vVqVZQyf3WLx2Shd0qJ9xuvqgAyKPLAiqITEtqW0oIUjzo3PePDd6fW9iFz30ef7Ysp/oiWqbhszeGWW2T6Gzw==",
- "dev": true
}
}
},
+ "json-parse-better-errors": {
+ "version": "1.0.2",
+ "resolved": "https://registry.npmjs.org/json-parse-better-errors/-/json-parse-better-errors-1.0.2.tgz",
+ "integrity": "sha512-mrqyZKfX5EhL7hvqcV6WG1yYjnjeuYDzDhhcAAUrq8Po85NBQBJP+ZDUT75qZQ98IkUoBqdkExkukOU7Ts2wrw==",
+ "dev": true
+ },
"json-schema-traverse": {
"version": "0.4.1",
"resolved": "https://registry.npmjs.org/json-schema-traverse/-/json-schema-traverse-0.4.1.tgz",
@@ -1046,14 +1068,14 @@
}
},
"load-json-file": {
- "version": "2.0.0",
- "resolved": "https://registry.npmjs.org/load-json-file/-/load-json-file-2.0.0.tgz",
- "integrity": "sha1-eUfkIUmvgNaWy/eXvKq8/h/inKg=",
+ "version": "4.0.0",
+ "resolved": "https://registry.npmjs.org/load-json-file/-/load-json-file-4.0.0.tgz",
+ "integrity": "sha1-L19Fq5HjMhYjT9U62rZo607AmTs=",
"dev": true,
"requires": {
"graceful-fs": "^4.1.2",
- "parse-json": "^2.2.0",
- "pify": "^2.0.0",
+ "parse-json": "^4.0.0",
+ "pify": "^3.0.0",
"strip-bom": "^3.0.0"
}
},
@@ -1073,6 +1095,33 @@
"integrity": "sha512-v2kDEe57lecTulaDIuNTPy3Ry4gLGJ6Z1O3vE1krgXZNrsQ+LFTGHVxVjcXPs17LhbZVGedAJv8XZ1tvj5FvSg==",
"dev": true
},
+ "lodash.clonedeep": {
+ "version": "4.5.0",
+ "resolved": "https://registry.npmjs.org/lodash.clonedeep/-/lodash.clonedeep-4.5.0.tgz",
+ "integrity": "sha1-4j8/nE+Pvd6HJSnBBxhXoIblzO8=",
+ "dev": true
+ },
+ "lodash.merge": {
+ "version": "4.6.2",
+ "resolved": "https://registry.npmjs.org/lodash.merge/-/lodash.merge-4.6.2.tgz",
+ "integrity": "sha512-0KpjqXRVvrYyCsX1swR/XTK0va6VQkQM6MNo7PqW77ByjAhoARA8EfrP1N4+KlKj8YS0ZUCtRT/YUuhyYDujIQ==",
+ "dev": true
+ },
+ "lodash.truncate": {
+ "version": "4.4.2",
+ "resolved": "https://registry.npmjs.org/lodash.truncate/-/lodash.truncate-4.4.2.tgz",
+ "integrity": "sha1-WjUNoLERO4N+z//VgSy+WNbq4ZM=",
+ "dev": true
+ },
+ "lru-cache": {
+ "version": "6.0.0",
+ "resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-6.0.0.tgz",
+ "integrity": "sha512-Jo6dJ04CmSjuznwJSS3pUeWmd/H0ffTlkXXgwZi+eq1UCmqQwCh+eLsYOYCwY991i2Fah4h1BEMCx4qThGbsiA==",
+ "dev": true,
+ "requires": {
+ "yallist": "^4.0.0"
+ }
+ },
"markdown-it": {
"version": "10.0.0",
"resolved": "https://registry.npmjs.org/markdown-it/-/markdown-it-10.0.0.tgz",
@@ -1093,9 +1142,9 @@
"dev": true
},
"marked": {
- "version": "2.0.3",
- "resolved": "https://registry.npmjs.org/marked/-/marked-2.0.3.tgz",
- "integrity": "sha512-5otztIIcJfPc2qGTN8cVtOJEjNJZ0jwa46INMagrYfk0EvqtRuEHLsEe0LrFS0/q+ZRKT0+kXK7P2T1AN5lWRA==",
+ "version": "2.0.7",
+ "resolved": "https://registry.npmjs.org/marked/-/marked-2.0.7.tgz",
+ "integrity": "sha512-BJXxkuIfJchcXOJWTT2DOL+yFWifFv2yGYOUzvXg8Qz610QKw+sHCvTMYwA+qWGhlA2uivBezChZ/pBy1tWdkQ==",
"dev": true
},
"mdurl": {
@@ -1120,13 +1169,10 @@
"dev": true
},
"mkdirp": {
- "version": "0.5.5",
- "resolved": "https://registry.npmjs.org/mkdirp/-/mkdirp-0.5.5.tgz",
- "integrity": "sha512-NKmAlESf6jMGym1++R0Ra7wvhV+wFW63FaSOFPwRahvea0gMUcGUhVeAg/0BC0wiv9ih5NYPB1Wn1UEI1/L+xQ==",
- "dev": true,
- "requires": {
- "minimist": "^1.2.5"
- }
+ "version": "1.0.4",
+ "resolved": "https://registry.npmjs.org/mkdirp/-/mkdirp-1.0.4.tgz",
+ "integrity": "sha512-vVqVZQyf3WLx2Shd0qJ9xuvqgAyKPLAiqITEtqW0oIUjzo3PePDd6fW9iFz30ef7Ysp/oiWqbhszeGWW2T6Gzw==",
+ "dev": true
},
"ms": {
"version": "2.1.2",
@@ -1161,9 +1207,9 @@
}
},
"object-inspect": {
- "version": "1.8.0",
- "resolved": "https://registry.npmjs.org/object-inspect/-/object-inspect-1.8.0.tgz",
- "integrity": "sha512-jLdtEOB112fORuypAyl/50VRVIBIdVQOSUUGQHzJ4xBSbit81zRarz7GThkEFZy1RceYrWYcPcBFPQwHyAc1gA==",
+ "version": "1.10.3",
+ "resolved": "https://registry.npmjs.org/object-inspect/-/object-inspect-1.10.3.tgz",
+ "integrity": "sha512-e5mCJlSH7poANfC8z8S9s9S2IN5/4Zb3aZ33f5s8YqoazCFzNLloLU8r5VCG+G7WoqLvAAZoVMcy3tp/3X0Plw==",
"dev": true
},
"object-keys": {
@@ -1173,80 +1219,37 @@
"dev": true
},
"object.assign": {
- "version": "4.1.1",
- "resolved": "https://registry.npmjs.org/object.assign/-/object.assign-4.1.1.tgz",
- "integrity": "sha512-VT/cxmx5yaoHSOTSyrCygIDFco+RsibY2NM0a4RdEeY/4KgqezwFtK1yr3U67xYhqJSlASm2pKhLVzPj2lr4bA==",
+ "version": "4.1.2",
+ "resolved": "https://registry.npmjs.org/object.assign/-/object.assign-4.1.2.tgz",
+ "integrity": "sha512-ixT2L5THXsApyiUPYKmW+2EHpXXe5Ii3M+f4e+aJFAHao5amFRW6J0OO6c/LU8Be47utCx2GL89hxGB6XSmKuQ==",
"dev": true,
"requires": {
+ "call-bind": "^1.0.0",
"define-properties": "^1.1.3",
- "es-abstract": "^1.18.0-next.0",
"has-symbols": "^1.0.1",
"object-keys": "^1.1.1"
}
},
"object.entries": {
- "version": "1.1.2",
- "resolved": "https://registry.npmjs.org/object.entries/-/object.entries-1.1.2.tgz",
- "integrity": "sha512-BQdB9qKmb/HyNdMNWVr7O3+z5MUIx3aiegEIJqjMBbBf0YT9RRxTJSim4mzFqtyr7PDAHigq0N9dO0m0tRakQA==",
+ "version": "1.1.4",
+ "resolved": "https://registry.npmjs.org/object.entries/-/object.entries-1.1.4.tgz",
+ "integrity": "sha512-h4LWKWE+wKQGhtMjZEBud7uLGhqyLwj8fpHOarZhD2uY3C9cRtk57VQ89ke3moByLXMedqs3XCHzyb4AmA2DjA==",
"dev": true,
"requires": {
+ "call-bind": "^1.0.2",
"define-properties": "^1.1.3",
- "es-abstract": "^1.17.5",
- "has": "^1.0.3"
- },
- "dependencies": {
- "es-abstract": {
- "version": "1.17.6",
- "resolved": "https://registry.npmjs.org/es-abstract/-/es-abstract-1.17.6.tgz",
- "integrity": "sha512-Fr89bON3WFyUi5EvAeI48QTWX0AyekGgLA8H+c+7fbfCkJwRWRMLd8CQedNEyJuoYYhmtEqY92pgte1FAhBlhw==",
- "dev": true,
- "requires": {
- "es-to-primitive": "^1.2.1",
- "function-bind": "^1.1.1",
- "has": "^1.0.3",
- "has-symbols": "^1.0.1",
- "is-callable": "^1.2.0",
- "is-regex": "^1.1.0",
- "object-inspect": "^1.7.0",
- "object-keys": "^1.1.1",
- "object.assign": "^4.1.0",
- "string.prototype.trimend": "^1.0.1",
- "string.prototype.trimstart": "^1.0.1"
- }
- }
+ "es-abstract": "^1.18.2"
}
},
"object.values": {
- "version": "1.1.1",
- "resolved": "https://registry.npmjs.org/object.values/-/object.values-1.1.1.tgz",
- "integrity": "sha512-WTa54g2K8iu0kmS/us18jEmdv1a4Wi//BZ/DTVYEcH0XhLM5NYdpDHja3gt57VrZLcNAO2WGA+KpWsDBaHt6eA==",
+ "version": "1.1.4",
+ "resolved": "https://registry.npmjs.org/object.values/-/object.values-1.1.4.tgz",
+ "integrity": "sha512-TnGo7j4XSnKQoK3MfvkzqKCi0nVe/D9I9IjwTNYdb/fxYHpjrluHVOgw0AF6jrRFGMPHdfuidR09tIDiIvnaSg==",
"dev": true,
"requires": {
+ "call-bind": "^1.0.2",
"define-properties": "^1.1.3",
- "es-abstract": "^1.17.0-next.1",
- "function-bind": "^1.1.1",
- "has": "^1.0.3"
- },
- "dependencies": {
- "es-abstract": {
- "version": "1.17.6",
- "resolved": "https://registry.npmjs.org/es-abstract/-/es-abstract-1.17.6.tgz",
- "integrity": "sha512-Fr89bON3WFyUi5EvAeI48QTWX0AyekGgLA8H+c+7fbfCkJwRWRMLd8CQedNEyJuoYYhmtEqY92pgte1FAhBlhw==",
- "dev": true,
- "requires": {
- "es-to-primitive": "^1.2.1",
- "function-bind": "^1.1.1",
- "has": "^1.0.3",
- "has-symbols": "^1.0.1",
- "is-callable": "^1.2.0",
- "is-regex": "^1.1.0",
- "object-inspect": "^1.7.0",
- "object-keys": "^1.1.1",
- "object.assign": "^4.1.0",
- "string.prototype.trimend": "^1.0.1",
- "string.prototype.trimstart": "^1.0.1"
- }
- }
+ "es-abstract": "^1.18.2"
}
},
"once": {
@@ -1306,12 +1309,13 @@
}
},
"parse-json": {
- "version": "2.2.0",
- "resolved": "https://registry.npmjs.org/parse-json/-/parse-json-2.2.0.tgz",
- "integrity": "sha1-9ID0BDTvgHQfhGkJn43qGPVaTck=",
+ "version": "4.0.0",
+ "resolved": "https://registry.npmjs.org/parse-json/-/parse-json-4.0.0.tgz",
+ "integrity": "sha1-vjX1Qlvh9/bHRxhPmKeIy5lHfuA=",
"dev": true,
"requires": {
- "error-ex": "^1.2.0"
+ "error-ex": "^1.3.1",
+ "json-parse-better-errors": "^1.0.1"
}
},
"path-exists": {
@@ -1333,24 +1337,24 @@
"dev": true
},
"path-parse": {
- "version": "1.0.6",
- "resolved": "https://registry.npmjs.org/path-parse/-/path-parse-1.0.6.tgz",
- "integrity": "sha512-GSmOT2EbHrINBf9SR7CDELwlJ8AENk3Qn7OikK4nFYAu3Ote2+JYNVvkpAEQm3/TLNEJFD/xZJjzyxg3KBWOzw==",
+ "version": "1.0.7",
+ "resolved": "https://registry.npmjs.org/path-parse/-/path-parse-1.0.7.tgz",
+ "integrity": "sha512-LDJzPVEEEPR+y48z93A0Ed0yXb8pAByGWo/k5YYdYgpY2/2EsOsksJrq7lOHxryrVOn1ejG6oAp8ahvOIQD8sw==",
"dev": true
},
"path-type": {
- "version": "2.0.0",
- "resolved": "https://registry.npmjs.org/path-type/-/path-type-2.0.0.tgz",
- "integrity": "sha1-8BLMuEFbcJb8LaoQVMPXI4lZTHM=",
+ "version": "3.0.0",
+ "resolved": "https://registry.npmjs.org/path-type/-/path-type-3.0.0.tgz",
+ "integrity": "sha512-T2ZUsdZFHgA3u4e5PfPbjd7HDDpxPnQb5jN0SrDsjNSuVXHJqtwTnWqG0B1jZrgmJ/7lj1EmVIByWt1gxGkWvg==",
"dev": true,
"requires": {
- "pify": "^2.0.0"
+ "pify": "^3.0.0"
}
},
"pify": {
- "version": "2.3.0",
- "resolved": "https://registry.npmjs.org/pify/-/pify-2.3.0.tgz",
- "integrity": "sha1-7RQaasBDqEnqWISY59yosVMw6Qw=",
+ "version": "3.0.0",
+ "resolved": "https://registry.npmjs.org/pify/-/pify-3.0.0.tgz",
+ "integrity": "sha1-5aSs0sEB/fPZpNB/DbxNtJ3SgXY=",
"dev": true
},
"pkg-dir": {
@@ -1362,6 +1366,15 @@
"find-up": "^2.1.0"
}
},
+ "pkg-up": {
+ "version": "2.0.0",
+ "resolved": "https://registry.npmjs.org/pkg-up/-/pkg-up-2.0.0.tgz",
+ "integrity": "sha1-yBmscoBZpGHKscOImivjxJoATX8=",
+ "dev": true,
+ "requires": {
+ "find-up": "^2.1.0"
+ }
+ },
"prelude-ls": {
"version": "1.2.1",
"resolved": "https://registry.npmjs.org/prelude-ls/-/prelude-ls-1.2.1.tgz",
@@ -1381,30 +1394,36 @@
"dev": true
},
"read-pkg": {
- "version": "2.0.0",
- "resolved": "https://registry.npmjs.org/read-pkg/-/read-pkg-2.0.0.tgz",
- "integrity": "sha1-jvHAYjxqbbDcZxPEv6xGMysjaPg=",
+ "version": "3.0.0",
+ "resolved": "https://registry.npmjs.org/read-pkg/-/read-pkg-3.0.0.tgz",
+ "integrity": "sha1-nLxoaXj+5l0WwA4rGcI3/Pbjg4k=",
"dev": true,
"requires": {
- "load-json-file": "^2.0.0",
+ "load-json-file": "^4.0.0",
"normalize-package-data": "^2.3.2",
- "path-type": "^2.0.0"
+ "path-type": "^3.0.0"
}
},
"read-pkg-up": {
- "version": "2.0.0",
- "resolved": "https://registry.npmjs.org/read-pkg-up/-/read-pkg-up-2.0.0.tgz",
- "integrity": "sha1-a3KoBImE4MQeeVEP1en6mbO1Sb4=",
+ "version": "3.0.0",
+ "resolved": "https://registry.npmjs.org/read-pkg-up/-/read-pkg-up-3.0.0.tgz",
+ "integrity": "sha1-PtSWaF26D4/hGNBpHcUfSh/5bwc=",
"dev": true,
"requires": {
"find-up": "^2.0.0",
- "read-pkg": "^2.0.0"
+ "read-pkg": "^3.0.0"
}
},
"regexpp": {
- "version": "3.1.0",
- "resolved": "https://registry.npmjs.org/regexpp/-/regexpp-3.1.0.tgz",
- "integrity": "sha512-ZOIzd8yVsQQA7j8GCSlPGXwg5PfmA1mrq0JP4nGhh54LaKN3xdai/vHUDu74pKwV8OxseMS65u2NImosQcSD0Q==",
+ "version": "3.2.0",
+ "resolved": "https://registry.npmjs.org/regexpp/-/regexpp-3.2.0.tgz",
+ "integrity": "sha512-pq2bWo9mVD43nbts2wGv17XLiNLya+GklZ8kaDLV2Z08gDCsGpnKn9BFMepvWuHCbyVvY7J5o5+BVvoQbmlJLg==",
+ "dev": true
+ },
+ "require-from-string": {
+ "version": "2.0.2",
+ "resolved": "https://registry.npmjs.org/require-from-string/-/require-from-string-2.0.2.tgz",
+ "integrity": "sha512-Xf0nWe6RseziFMu+Ap9biiUbmplq6S9/p+7w7YXP/JBHhrUDDUhwa+vANyubuqfZWTveU//DYVGsDG7RKL/vEw==",
"dev": true
},
"requizzle": {
@@ -1417,11 +1436,12 @@
}
},
"resolve": {
- "version": "1.17.0",
- "resolved": "https://registry.npmjs.org/resolve/-/resolve-1.17.0.tgz",
- "integrity": "sha512-ic+7JYiV8Vi2yzQGFWOkiZD5Z9z7O2Zhm9XMaTxdJExKasieFCr+yXZ/WmXsckHiKl12ar0y6XiXDx3m4RHn1w==",
+ "version": "1.20.0",
+ "resolved": "https://registry.npmjs.org/resolve/-/resolve-1.20.0.tgz",
+ "integrity": "sha512-wENBPt4ySzg4ybFQW2TT1zMQucPK95HSh/nq2CFTZVOGut2+pQvSsgtda4d26YrYcr067wjbmzOG8byDPBX63A==",
"dev": true,
"requires": {
+ "is-core-module": "^2.2.0",
"path-parse": "^1.0.6"
}
},
@@ -1432,19 +1452,22 @@
"dev": true
},
"rimraf": {
- "version": "2.6.3",
- "resolved": "https://registry.npmjs.org/rimraf/-/rimraf-2.6.3.tgz",
- "integrity": "sha512-mwqeW5XsA2qAejG46gYdENaxXjx9onRNCfn7L0duuP4hCuTIi/QO7PDK07KJfp1d+izWPrzEJDcSqBa0OZQriA==",
+ "version": "3.0.2",
+ "resolved": "https://registry.npmjs.org/rimraf/-/rimraf-3.0.2.tgz",
+ "integrity": "sha512-JZkJMZkAGFFPP2YqXZXPbMlMBgsxzE8ILs4lMIX/2o0L9UBw9O/Y3o6wFw/i9YLapcUJWwqbi3kdxIPdC62TIA==",
"dev": true,
"requires": {
"glob": "^7.1.3"
}
},
"semver": {
- "version": "7.3.2",
- "resolved": "https://registry.npmjs.org/semver/-/semver-7.3.2.tgz",
- "integrity": "sha512-OrOb32TeeambH6UrhtShmF7CRDqhL6/5XpPNp2DuRH6+9QLw/orhp72j87v8Qa1ScDkvrrBNpZcDejAirJmfXQ==",
- "dev": true
+ "version": "7.3.5",
+ "resolved": "https://registry.npmjs.org/semver/-/semver-7.3.5.tgz",
+ "integrity": "sha512-PoeGJYh8HK4BTO/a9Tf6ZG3veo/A7ZVsYrSA6J8ny9nb3B1VrpkuN+z9OE5wfE5p6H4LchYZsegiQgbJD94ZFQ==",
+ "dev": true,
+ "requires": {
+ "lru-cache": "^6.0.0"
+ }
},
"shebang-command": {
"version": "2.0.0",
@@ -1462,14 +1485,40 @@
"dev": true
},
"slice-ansi": {
- "version": "2.1.0",
- "resolved": "https://registry.npmjs.org/slice-ansi/-/slice-ansi-2.1.0.tgz",
- "integrity": "sha512-Qu+VC3EwYLldKa1fCxuuvULvSJOKEgk9pi8dZeCVK7TqBfUNTH4sFkk4joj8afVSfAYgJoSOetjx9QWOJ5mYoQ==",
+ "version": "4.0.0",
+ "resolved": "https://registry.npmjs.org/slice-ansi/-/slice-ansi-4.0.0.tgz",
+ "integrity": "sha512-qMCMfhY040cVHT43K9BFygqYbUPFZKHOg7K73mtTWJRb8pyP3fzf4Ixd5SzdEJQ6MRUg/WBnOLxghZtKKurENQ==",
"dev": true,
"requires": {
- "ansi-styles": "^3.2.0",
- "astral-regex": "^1.0.0",
- "is-fullwidth-code-point": "^2.0.0"
+ "ansi-styles": "^4.0.0",
+ "astral-regex": "^2.0.0",
+ "is-fullwidth-code-point": "^3.0.0"
+ },
+ "dependencies": {
+ "ansi-styles": {
+ "version": "4.3.0",
+ "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-4.3.0.tgz",
+ "integrity": "sha512-zbB9rCJAT1rbjiVDb2hqKFHNYLxgtk8NURxZ3IZwD3F6NtxbXZQCnnSi1Lkx+IDohdPlFp222wVALIheZJQSEg==",
+ "dev": true,
+ "requires": {
+ "color-convert": "^2.0.1"
+ }
+ },
+ "color-convert": {
+ "version": "2.0.1",
+ "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-2.0.1.tgz",
+ "integrity": "sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ==",
+ "dev": true,
+ "requires": {
+ "color-name": "~1.1.4"
+ }
+ },
+ "color-name": {
+ "version": "1.1.4",
+ "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.4.tgz",
+ "integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==",
+ "dev": true
+ }
}
},
"spdx-correct": {
@@ -1499,9 +1548,9 @@
}
},
"spdx-license-ids": {
- "version": "3.0.6",
- "resolved": "https://registry.npmjs.org/spdx-license-ids/-/spdx-license-ids-3.0.6.tgz",
- "integrity": "sha512-+orQK83kyMva3WyPf59k1+Y525csj5JejicWut55zeTWANuN17qSiSLUXWtzHeNWORSvT7GLDJ/E/XiIWoXBTw==",
+ "version": "3.0.9",
+ "resolved": "https://registry.npmjs.org/spdx-license-ids/-/spdx-license-ids-3.0.9.tgz",
+ "integrity": "sha512-Ki212dKK4ogX+xDo4CtOZBVIwhsKBEfsEEcwmJfLQzirgc2jIWdzg40Unxz/HzEUqM1WFzVlQSMF9kZZ2HboLQ==",
"dev": true
},
"sprintf-js": {
@@ -1511,93 +1560,34 @@
"dev": true
},
"string-width": {
- "version": "3.1.0",
- "resolved": "https://registry.npmjs.org/string-width/-/string-width-3.1.0.tgz",
- "integrity": "sha512-vafcv6KjVZKSgz06oM/H6GDBrAtz8vdhQakGjFIvNrHA6y3HCF1CInLy+QLq8dTJPQ1b+KDUqDFctkdRW44e1w==",
+ "version": "4.2.2",
+ "resolved": "https://registry.npmjs.org/string-width/-/string-width-4.2.2.tgz",
+ "integrity": "sha512-XBJbT3N4JhVumXE0eoLU9DCjcaF92KLNqTmFCnG1pf8duUxFGwtP6AD6nkjw9a3IdiRtL3E2w3JDiE/xi3vOeA==",
"dev": true,
"requires": {
- "emoji-regex": "^7.0.1",
- "is-fullwidth-code-point": "^2.0.0",
- "strip-ansi": "^5.1.0"
- },
- "dependencies": {
- "ansi-regex": {
- "version": "4.1.0",
- "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-4.1.0.tgz",
- "integrity": "sha512-1apePfXM1UOSqw0o9IiFAovVz9M5S1Dg+4TrDwfMewQ6p/rmMueb7tWZjQ1rx4Loy1ArBggoqGpfqqdI4rondg==",
- "dev": true
- },
- "strip-ansi": {
- "version": "5.2.0",
- "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-5.2.0.tgz",
- "integrity": "sha512-DuRs1gKbBqsMKIZlrffwlug8MHkcnpjs5VPmL1PAh+mA30U0DTotfDZ0d2UUsXpPmPmMMJ6W773MaA3J+lbiWA==",
- "dev": true,
- "requires": {
- "ansi-regex": "^4.1.0"
- }
- }
+ "emoji-regex": "^8.0.0",
+ "is-fullwidth-code-point": "^3.0.0",
+ "strip-ansi": "^6.0.0"
}
},
"string.prototype.trimend": {
- "version": "1.0.1",
- "resolved": "https://registry.npmjs.org/string.prototype.trimend/-/string.prototype.trimend-1.0.1.tgz",
- "integrity": "sha512-LRPxFUaTtpqYsTeNKaFOw3R4bxIzWOnbQ837QfBylo8jIxtcbK/A/sMV7Q+OAV/vWo+7s25pOE10KYSjaSO06g==",
+ "version": "1.0.4",
+ "resolved": "https://registry.npmjs.org/string.prototype.trimend/-/string.prototype.trimend-1.0.4.tgz",
+ "integrity": "sha512-y9xCjw1P23Awk8EvTpcyL2NIr1j7wJ39f+k6lvRnSMz+mz9CGz9NYPelDk42kOz6+ql8xjfK8oYzy3jAP5QU5A==",
"dev": true,
"requires": {
- "define-properties": "^1.1.3",
- "es-abstract": "^1.17.5"
- },
- "dependencies": {
- "es-abstract": {
- "version": "1.17.6",
- "resolved": "https://registry.npmjs.org/es-abstract/-/es-abstract-1.17.6.tgz",
- "integrity": "sha512-Fr89bON3WFyUi5EvAeI48QTWX0AyekGgLA8H+c+7fbfCkJwRWRMLd8CQedNEyJuoYYhmtEqY92pgte1FAhBlhw==",
- "dev": true,
- "requires": {
- "es-to-primitive": "^1.2.1",
- "function-bind": "^1.1.1",
- "has": "^1.0.3",
- "has-symbols": "^1.0.1",
- "is-callable": "^1.2.0",
- "is-regex": "^1.1.0",
- "object-inspect": "^1.7.0",
- "object-keys": "^1.1.1",
- "object.assign": "^4.1.0",
- "string.prototype.trimend": "^1.0.1",
- "string.prototype.trimstart": "^1.0.1"
- }
- }
+ "call-bind": "^1.0.2",
+ "define-properties": "^1.1.3"
}
},
"string.prototype.trimstart": {
- "version": "1.0.1",
- "resolved": "https://registry.npmjs.org/string.prototype.trimstart/-/string.prototype.trimstart-1.0.1.tgz",
- "integrity": "sha512-XxZn+QpvrBI1FOcg6dIpxUPgWCPuNXvMD72aaRaUQv1eD4e/Qy8i/hFTe0BUmD60p/QA6bh1avmuPTfNjqVWRw==",
+ "version": "1.0.4",
+ "resolved": "https://registry.npmjs.org/string.prototype.trimstart/-/string.prototype.trimstart-1.0.4.tgz",
+ "integrity": "sha512-jh6e984OBfvxS50tdY2nRZnoC5/mLFKOREQfw8t5yytkoUsJRNxvI/E39qu1sD0OtWI3OC0XgKSmcWwziwYuZw==",
"dev": true,
"requires": {
- "define-properties": "^1.1.3",
- "es-abstract": "^1.17.5"
- },
- "dependencies": {
- "es-abstract": {
- "version": "1.17.6",
- "resolved": "https://registry.npmjs.org/es-abstract/-/es-abstract-1.17.6.tgz",
- "integrity": "sha512-Fr89bON3WFyUi5EvAeI48QTWX0AyekGgLA8H+c+7fbfCkJwRWRMLd8CQedNEyJuoYYhmtEqY92pgte1FAhBlhw==",
- "dev": true,
- "requires": {
- "es-to-primitive": "^1.2.1",
- "function-bind": "^1.1.1",
- "has": "^1.0.3",
- "has-symbols": "^1.0.1",
- "is-callable": "^1.2.0",
- "is-regex": "^1.1.0",
- "object-inspect": "^1.7.0",
- "object-keys": "^1.1.1",
- "object.assign": "^4.1.0",
- "string.prototype.trimend": "^1.0.1",
- "string.prototype.trimstart": "^1.0.1"
- }
- }
+ "call-bind": "^1.0.2",
+ "define-properties": "^1.1.3"
}
},
"strip-ansi": {
@@ -1631,15 +1621,37 @@
}
},
"table": {
- "version": "5.4.6",
- "resolved": "https://registry.npmjs.org/table/-/table-5.4.6.tgz",
- "integrity": "sha512-wmEc8m4fjnob4gt5riFRtTu/6+4rSe12TpAELNSqHMfF3IqnA+CH37USM6/YR3qRZv7e56kAEAtd6nKZaxe0Ug==",
+ "version": "6.7.1",
+ "resolved": "https://registry.npmjs.org/table/-/table-6.7.1.tgz",
+ "integrity": "sha512-ZGum47Yi6KOOFDE8m223td53ath2enHcYLgOCjGr5ngu8bdIARQk6mN/wRMv4yMRcHnCSnHbCEha4sobQx5yWg==",
"dev": true,
"requires": {
- "ajv": "^6.10.2",
- "lodash": "^4.17.14",
- "slice-ansi": "^2.1.0",
- "string-width": "^3.0.0"
+ "ajv": "^8.0.1",
+ "lodash.clonedeep": "^4.5.0",
+ "lodash.truncate": "^4.4.2",
+ "slice-ansi": "^4.0.0",
+ "string-width": "^4.2.0",
+ "strip-ansi": "^6.0.0"
+ },
+ "dependencies": {
+ "ajv": {
+ "version": "8.6.0",
+ "resolved": "https://registry.npmjs.org/ajv/-/ajv-8.6.0.tgz",
+ "integrity": "sha512-cnUG4NSBiM4YFBxgZIj/In3/6KX+rQ2l2YPRVcvAMQGWEPKuXoPIhxzwqh31jA3IPbI4qEOp/5ILI4ynioXsGQ==",
+ "dev": true,
+ "requires": {
+ "fast-deep-equal": "^3.1.1",
+ "json-schema-traverse": "^1.0.0",
+ "require-from-string": "^2.0.2",
+ "uri-js": "^4.2.2"
+ }
+ },
+ "json-schema-traverse": {
+ "version": "1.0.0",
+ "resolved": "https://registry.npmjs.org/json-schema-traverse/-/json-schema-traverse-1.0.0.tgz",
+ "integrity": "sha512-NM8/P9n3XjXhIZn1lLhkFaACTOURQXjWhV4BA/RnOv8xvgqtqpAX9IO4mRQxSx1Rlo4tqzeqb0sOlruaOy3dug==",
+ "dev": true
+ }
}
},
"taffydb": {
@@ -1676,9 +1688,9 @@
}
},
"type-fest": {
- "version": "0.8.1",
- "resolved": "https://registry.npmjs.org/type-fest/-/type-fest-0.8.1.tgz",
- "integrity": "sha512-4dbzIzqvjtgiM5rw1k5rEHtBANKmdudhGyBEajN01fEyhaAIhsoKNy6y7+IN93IfpFtwY9iqi7kD+xwKhQsNJA==",
+ "version": "0.20.2",
+ "resolved": "https://registry.npmjs.org/type-fest/-/type-fest-0.20.2.tgz",
+ "integrity": "sha512-Ne+eE4r0/iWnpAxD852z3A+N0Bt5RN//NjJwRd2VFHEmrywxf5vsZlh4R6lixl6B+wz/8d+maTSAkN1FIkI3LQ==",
"dev": true
},
"uc.micro": {
@@ -1687,25 +1699,37 @@
"integrity": "sha512-8Y75pvTYkLJW2hWQHXxoqRgV7qb9B+9vFEtidML+7koHUFapnVJAZ6cKs+Qjz5Aw3aZWHMC6u0wJE3At+nSGwA==",
"dev": true
},
+ "unbox-primitive": {
+ "version": "1.0.1",
+ "resolved": "https://registry.npmjs.org/unbox-primitive/-/unbox-primitive-1.0.1.tgz",
+ "integrity": "sha512-tZU/3NqK3dA5gpE1KtyiJUrEB0lxnGkMFHptJ7q6ewdZ8s12QrODwNbhIJStmJkd1QDXa1NRA8aF2A1zk/Ypyw==",
+ "dev": true,
+ "requires": {
+ "function-bind": "^1.1.1",
+ "has-bigints": "^1.0.1",
+ "has-symbols": "^1.0.2",
+ "which-boxed-primitive": "^1.0.2"
+ }
+ },
"underscore": {
- "version": "1.12.1",
- "resolved": "https://registry.npmjs.org/underscore/-/underscore-1.12.1.tgz",
- "integrity": "sha512-hEQt0+ZLDVUMhebKxL4x1BTtDY7bavVofhZ9KZ4aI26X9SRaE+Y3m83XUL1UP2jn8ynjndwCCpEHdUG+9pP1Tw==",
+ "version": "1.13.1",
+ "resolved": "https://registry.npmjs.org/underscore/-/underscore-1.13.1.tgz",
+ "integrity": "sha512-hzSoAVtJF+3ZtiFX0VgfFPHEDRm7Y/QPjGyNo4TVdnDTdft3tr8hEkD25a1jC+TjTuE7tkHGKkhwCgs9dgBB2g==",
"dev": true
},
"uri-js": {
- "version": "4.4.0",
- "resolved": "https://registry.npmjs.org/uri-js/-/uri-js-4.4.0.tgz",
- "integrity": "sha512-B0yRTzYdUCCn9n+F4+Gh4yIDtMQcaJsmYBDsTSG8g/OejKBodLQ2IHfN3bM7jUsRXndopT7OIXWdYqc1fjmV6g==",
+ "version": "4.4.1",
+ "resolved": "https://registry.npmjs.org/uri-js/-/uri-js-4.4.1.tgz",
+ "integrity": "sha512-7rKUyy33Q1yc98pQ1DAmLtwX109F7TIfWlW1Ydo8Wl1ii1SeHieeh0HHfPeL2fMXK6z0s8ecKs9frCuLJvndBg==",
"dev": true,
"requires": {
"punycode": "^2.1.0"
}
},
"v8-compile-cache": {
- "version": "2.1.1",
- "resolved": "https://registry.npmjs.org/v8-compile-cache/-/v8-compile-cache-2.1.1.tgz",
- "integrity": "sha512-8OQ9CL+VWyt3JStj7HX7/ciTL2V3Rl1Wf5OL+SNTm0yK1KvtReVulksyeRnCANHHuUxHlQig+JJDlUhBt1NQDQ==",
+ "version": "2.3.0",
+ "resolved": "https://registry.npmjs.org/v8-compile-cache/-/v8-compile-cache-2.3.0.tgz",
+ "integrity": "sha512-l8lCEmLcLYZh4nbunNZvQCJc5pv7+RCwa8q/LdUx8u7lsWvPDKmpodJAJNwkAhJC//dFY48KuIEmjtd4RViDrA==",
"dev": true
},
"validate-npm-package-license": {
@@ -1727,6 +1751,19 @@
"isexe": "^2.0.0"
}
},
+ "which-boxed-primitive": {
+ "version": "1.0.2",
+ "resolved": "https://registry.npmjs.org/which-boxed-primitive/-/which-boxed-primitive-1.0.2.tgz",
+ "integrity": "sha512-bwZdv0AKLpplFY2KZRX6TvyuN7ojjr7lwkg6ml0roIy9YeuSr7JS372qlNW18UQYzgYK9ziGcerWqZOmEn9VNg==",
+ "dev": true,
+ "requires": {
+ "is-bigint": "^1.0.1",
+ "is-boolean-object": "^1.1.0",
+ "is-number-object": "^1.0.4",
+ "is-string": "^1.0.5",
+ "is-symbol": "^1.0.3"
+ }
+ },
"word-wrap": {
"version": "1.2.3",
"resolved": "https://registry.npmjs.org/word-wrap/-/word-wrap-1.2.3.tgz",
@@ -1739,20 +1776,17 @@
"integrity": "sha1-tSQ9jz7BqjXxNkYFvA0QNuMKtp8=",
"dev": true
},
- "write": {
- "version": "1.0.3",
- "resolved": "https://registry.npmjs.org/write/-/write-1.0.3.tgz",
- "integrity": "sha512-/lg70HAjtkUgWPVZhZcm+T4hkL8Zbtp1nFNOn3lRrxnlv50SRBv7cR7RqR+GMsd3hUXy9hWBo4CHTbFTcOYwig==",
- "dev": true,
- "requires": {
- "mkdirp": "^0.5.1"
- }
- },
"xmlcreate": {
"version": "2.0.3",
"resolved": "https://registry.npmjs.org/xmlcreate/-/xmlcreate-2.0.3.tgz",
"integrity": "sha512-HgS+X6zAztGa9zIK3Y3LXuJes33Lz9x+YyTxgrkIdabu2vqcGOWwdfCpf1hWLRrd553wd4QCDf6BBO6FfdsRiQ==",
"dev": true
+ },
+ "yallist": {
+ "version": "4.0.0",
+ "resolved": "https://registry.npmjs.org/yallist/-/yallist-4.0.0.tgz",
+ "integrity": "sha512-3wdGidZyq5PB084XLES5TpOSRA3wjXAlIWMhum2kRcv/41Sn2emQ0dycQW4uZXLejwKvg6EsvbdlVL+FYEct7A==",
+ "dev": true
}
}
}
diff --git a/platform/javascript/package.json b/platform/javascript/package.json
index 53748503f9..9dafae30c5 100644
--- a/platform/javascript/package.json
+++ b/platform/javascript/package.json
@@ -20,9 +20,9 @@
"author": "Godot Engine contributors",
"license": "MIT",
"devDependencies": {
- "eslint": "^7.9.0",
- "eslint-config-airbnb-base": "^14.2.0",
- "eslint-plugin-import": "^2.22.0",
- "jsdoc": "github:jsdoc/jsdoc#544a992824631fc652183d8b0b4b1281dc961560"
+ "eslint": "^7.28.0",
+ "eslint-config-airbnb-base": "^14.2.1",
+ "eslint-plugin-import": "^2.23.4",
+ "jsdoc": "^3.6.7"
}
}
diff --git a/platform/linuxbsd/export/export.cpp b/platform/linuxbsd/export/export.cpp
index cb95068314..3ee088dd35 100644
--- a/platform/linuxbsd/export/export.cpp
+++ b/platform/linuxbsd/export/export.cpp
@@ -30,7 +30,7 @@
#include "export.h"
-#include "core/os/file_access.h"
+#include "core/io/file_access.h"
#include "editor/editor_export.h"
#include "platform/linuxbsd/logo.gen.h"
#include "scene/resources/texture.h"
diff --git a/platform/linuxbsd/os_linuxbsd.cpp b/platform/linuxbsd/os_linuxbsd.cpp
index 23e448fbd7..c6a2fa5be7 100644
--- a/platform/linuxbsd/os_linuxbsd.cpp
+++ b/platform/linuxbsd/os_linuxbsd.cpp
@@ -30,7 +30,7 @@
#include "os_linuxbsd.h"
-#include "core/os/dir_access.h"
+#include "core/io/dir_access.h"
#include "main/main.h"
#ifdef X11_ENABLED
@@ -166,7 +166,7 @@ bool OS_LinuxBSD::_check_internal_feature_support(const String &p_feature) {
String OS_LinuxBSD::get_config_path() const {
if (has_environment("XDG_CONFIG_HOME")) {
- if (get_environment("XDG_CONFIG_HOME").is_abs_path()) {
+ if (get_environment("XDG_CONFIG_HOME").is_absolute_path()) {
return get_environment("XDG_CONFIG_HOME");
} else {
WARN_PRINT_ONCE("`XDG_CONFIG_HOME` is a relative path. Ignoring its value and falling back to `$HOME/.config` or `.` per the XDG Base Directory specification.");
@@ -181,7 +181,7 @@ String OS_LinuxBSD::get_config_path() const {
String OS_LinuxBSD::get_data_path() const {
if (has_environment("XDG_DATA_HOME")) {
- if (get_environment("XDG_DATA_HOME").is_abs_path()) {
+ if (get_environment("XDG_DATA_HOME").is_absolute_path()) {
return get_environment("XDG_DATA_HOME");
} else {
WARN_PRINT_ONCE("`XDG_DATA_HOME` is a relative path. Ignoring its value and falling back to `$HOME/.local/share` or `get_config_path()` per the XDG Base Directory specification.");
@@ -196,7 +196,7 @@ String OS_LinuxBSD::get_data_path() const {
String OS_LinuxBSD::get_cache_path() const {
if (has_environment("XDG_CACHE_HOME")) {
- if (get_environment("XDG_CACHE_HOME").is_abs_path()) {
+ if (get_environment("XDG_CACHE_HOME").is_absolute_path()) {
return get_environment("XDG_CACHE_HOME");
} else {
WARN_PRINT_ONCE("`XDG_CACHE_HOME` is a relative path. Ignoring its value and falling back to `$HOME/.cache` or `get_config_path()` per the XDG Base Directory specification.");
@@ -425,8 +425,8 @@ Error OS_LinuxBSD::move_to_trash(const String &p_path) {
// Generates the .trashinfo file
OS::Date date = OS::get_singleton()->get_date(false);
OS::Time time = OS::get_singleton()->get_time(false);
- String timestamp = vformat("%04d-%02d-%02dT%02d:%02d:", date.year, date.month, date.day, time.hour, time.min);
- timestamp = vformat("%s%02d", timestamp, time.sec); // vformat only supports up to 6 arguments.
+ String timestamp = vformat("%04d-%02d-%02dT%02d:%02d:", date.year, date.month, date.day, time.hour, time.minute);
+ timestamp = vformat("%s%02d", timestamp, time.second); // vformat only supports up to 6 arguments.
String trash_info = "[Trash Info]\nPath=" + p_path.uri_encode() + "\nDeletionDate=" + timestamp + "\n";
{
Error err;
diff --git a/platform/osx/dir_access_osx.h b/platform/osx/dir_access_osx.h
index f61581979f..a894723e64 100644
--- a/platform/osx/dir_access_osx.h
+++ b/platform/osx/dir_access_osx.h
@@ -38,7 +38,7 @@
#include <sys/types.h>
#include <unistd.h>
-#include "core/os/dir_access.h"
+#include "core/io/dir_access.h"
#include "drivers/unix/dir_access_unix.h"
class DirAccessOSX : public DirAccessUnix {
diff --git a/platform/osx/export/export.cpp b/platform/osx/export/export.cpp
index 6d995412ab..f52853ca9e 100644
--- a/platform/osx/export/export.cpp
+++ b/platform/osx/export/export.cpp
@@ -31,11 +31,11 @@
#include "export.h"
#include "core/config/project_settings.h"
+#include "core/io/dir_access.h"
+#include "core/io/file_access.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/version.h"
#include "editor/editor_export.h"
@@ -147,6 +147,7 @@ void EditorExportPlatformOSX::get_export_options(List<ExportOption> *r_options)
r_options->push_back(ExportOption(PropertyInfo(Variant::STRING, "application/icon", PROPERTY_HINT_FILE, "*.png,*.icns"), ""));
r_options->push_back(ExportOption(PropertyInfo(Variant::STRING, "application/bundle_identifier", PROPERTY_HINT_PLACEHOLDER_TEXT, "com.example.game"), ""));
r_options->push_back(ExportOption(PropertyInfo(Variant::STRING, "application/signature"), ""));
+ r_options->push_back(ExportOption(PropertyInfo(Variant::STRING, "application/app_category", PROPERTY_HINT_ENUM, "Business,Developer-tools,Education,Entertainment,Finance,Games,Action-games,Adventure-games,Arcade-games,Board-games,Card-games,Casino-games,Dice-games,Educational-games,Family-games,Kids-games,Music-games,Puzzle-games,Racing-games,Role-playing-games,Simulation-games,Sports-games,Strategy-games,Trivia-games,Word-games,Graphics-design,Healthcare-fitness,Lifestyle,Medical,Music,News,Photography,Productivity,Reference,Social-networking,Sports,Travel,Utilities,Video,Weather"), "Games"));
r_options->push_back(ExportOption(PropertyInfo(Variant::STRING, "application/short_version"), "1.0"));
r_options->push_back(ExportOption(PropertyInfo(Variant::STRING, "application/version"), "1.0"));
r_options->push_back(ExportOption(PropertyInfo(Variant::STRING, "application/copyright"), ""));
@@ -386,6 +387,9 @@ void EditorExportPlatformOSX::_fix_plist(const Ref<EditorExportPreset> &p_preset
strnew += lines[i].replace("$version", p_preset->get("application/version")) + "\n";
} else if (lines[i].find("$signature") != -1) {
strnew += lines[i].replace("$signature", p_preset->get("application/signature")) + "\n";
+ } else if (lines[i].find("$app_category") != -1) {
+ String cat = p_preset->get("application/app_category");
+ strnew += lines[i].replace("$app_category", cat.to_lower()) + "\n";
} else if (lines[i].find("$copyright") != -1) {
strnew += lines[i].replace("$copyright", p_preset->get("application/copyright")) + "\n";
} else if (lines[i].find("$highres") != -1) {
@@ -1000,9 +1004,9 @@ void EditorExportPlatformOSX::_zip_folder_recursive(zipFile &p_zip, const String
zip_fileinfo zipfi;
zipfi.tmz_date.tm_hour = time.hour;
zipfi.tmz_date.tm_mday = date.day;
- zipfi.tmz_date.tm_min = time.min;
+ zipfi.tmz_date.tm_min = time.minute;
zipfi.tmz_date.tm_mon = date.month - 1; // Note: "tm" month range - 0..11, Godot month range - 1..12, http://www.cplusplus.com/reference/ctime/tm/
- zipfi.tmz_date.tm_sec = time.sec;
+ zipfi.tmz_date.tm_sec = time.second;
zipfi.tmz_date.tm_year = date.year;
zipfi.dosDate = 0;
// 0120000: symbolic link type
@@ -1045,9 +1049,9 @@ void EditorExportPlatformOSX::_zip_folder_recursive(zipFile &p_zip, const String
zip_fileinfo zipfi;
zipfi.tmz_date.tm_hour = time.hour;
zipfi.tmz_date.tm_mday = date.day;
- zipfi.tmz_date.tm_min = time.min;
+ zipfi.tmz_date.tm_min = time.minute;
zipfi.tmz_date.tm_mon = date.month - 1; // Note: "tm" month range - 0..11, Godot month range - 1..12, http://www.cplusplus.com/reference/ctime/tm/
- zipfi.tmz_date.tm_sec = time.sec;
+ zipfi.tmz_date.tm_sec = time.second;
zipfi.tmz_date.tm_year = date.year;
zipfi.dosDate = 0;
// 0100000: regular file type
diff --git a/platform/osx/os_osx.mm b/platform/osx/os_osx.mm
index 9e3f0350e9..b65d84d900 100644
--- a/platform/osx/os_osx.mm
+++ b/platform/osx/os_osx.mm
@@ -190,7 +190,7 @@ MainLoop *OS_OSX::get_main_loop() const {
String OS_OSX::get_config_path() const {
// The XDG Base Directory specification technically only applies on Linux/*BSD, but it doesn't hurt to support it on macOS as well.
if (has_environment("XDG_CONFIG_HOME")) {
- if (get_environment("XDG_CONFIG_HOME").is_abs_path()) {
+ if (get_environment("XDG_CONFIG_HOME").is_absolute_path()) {
return get_environment("XDG_CONFIG_HOME");
} else {
WARN_PRINT_ONCE("`XDG_CONFIG_HOME` is a relative path. Ignoring its value and falling back to `$HOME/Library/Application Support` or `.` per the XDG Base Directory specification.");
@@ -205,7 +205,7 @@ String OS_OSX::get_config_path() const {
String OS_OSX::get_data_path() const {
// The XDG Base Directory specification technically only applies on Linux/*BSD, but it doesn't hurt to support it on macOS as well.
if (has_environment("XDG_DATA_HOME")) {
- if (get_environment("XDG_DATA_HOME").is_abs_path()) {
+ if (get_environment("XDG_DATA_HOME").is_absolute_path()) {
return get_environment("XDG_DATA_HOME");
} else {
WARN_PRINT_ONCE("`XDG_DATA_HOME` is a relative path. Ignoring its value and falling back to `get_config_path()` per the XDG Base Directory specification.");
@@ -217,7 +217,7 @@ String OS_OSX::get_data_path() const {
String OS_OSX::get_cache_path() const {
// The XDG Base Directory specification technically only applies on Linux/*BSD, but it doesn't hurt to support it on macOS as well.
if (has_environment("XDG_CACHE_HOME")) {
- if (get_environment("XDG_CACHE_HOME").is_abs_path()) {
+ if (get_environment("XDG_CACHE_HOME").is_absolute_path()) {
return get_environment("XDG_CACHE_HOME");
} else {
WARN_PRINT_ONCE("`XDG_CACHE_HOME` is a relative path. Ignoring its value and falling back to `$HOME/Libary/Caches` or `get_config_path()` per the XDG Base Directory specification.");
diff --git a/platform/uwp/app.cpp b/platform/uwp/app.cpp
index bac8620086..67f054aeaa 100644
--- a/platform/uwp/app.cpp
+++ b/platform/uwp/app.cpp
@@ -34,8 +34,8 @@
#include "app.h"
-#include "core/os/dir_access.h"
-#include "core/os/file_access.h"
+#include "core/io/dir_access.h"
+#include "core/io/file_access.h"
#include "core/os/keyboard.h"
#include "main/main.h"
diff --git a/platform/uwp/export/export.cpp b/platform/uwp/export/export.cpp
index 351aaa5957..1b14aac3da 100644
--- a/platform/uwp/export/export.cpp
+++ b/platform/uwp/export/export.cpp
@@ -33,11 +33,11 @@
#include "core/config/project_settings.h"
#include "core/core_bind.h"
#include "core/crypto/crypto_core.h"
+#include "core/io/dir_access.h"
+#include "core/io/file_access.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/version.h"
#include "editor/editor_export.h"
#include "editor/editor_node.h"
diff --git a/platform/windows/export/export.cpp b/platform/windows/export/export.cpp
index 222597b3ff..803d9371f5 100644
--- a/platform/windows/export/export.cpp
+++ b/platform/windows/export/export.cpp
@@ -28,7 +28,7 @@
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
/*************************************************************************/
-#include "core/os/file_access.h"
+#include "core/io/file_access.h"
#include "core/os/os.h"
#include "editor/editor_export.h"
#include "editor/editor_node.h"
diff --git a/platform/windows/os_windows.cpp b/platform/windows/os_windows.cpp
index ccf13488ab..c956fe49ae 100644
--- a/platform/windows/os_windows.cpp
+++ b/platform/windows/os_windows.cpp
@@ -315,8 +315,8 @@ OS::Time OS_Windows::get_time(bool utc) const {
Time time;
time.hour = systemtime.wHour;
- time.min = systemtime.wMinute;
- time.sec = systemtime.wSecond;
+ time.minute = systemtime.wMinute;
+ time.second = systemtime.wSecond;
return time;
}
@@ -633,7 +633,7 @@ MainLoop *OS_Windows::get_main_loop() const {
String OS_Windows::get_config_path() const {
// The XDG Base Directory specification technically only applies on Linux/*BSD, but it doesn't hurt to support it on Windows as well.
if (has_environment("XDG_CONFIG_HOME")) {
- if (get_environment("XDG_CONFIG_HOME").is_abs_path()) {
+ if (get_environment("XDG_CONFIG_HOME").is_absolute_path()) {
return get_environment("XDG_CONFIG_HOME");
} else {
WARN_PRINT_ONCE("`XDG_CONFIG_HOME` is a relative path. Ignoring its value and falling back to `%APPDATA%` or `.` per the XDG Base Directory specification.");
@@ -648,7 +648,7 @@ String OS_Windows::get_config_path() const {
String OS_Windows::get_data_path() const {
// The XDG Base Directory specification technically only applies on Linux/*BSD, but it doesn't hurt to support it on Windows as well.
if (has_environment("XDG_DATA_HOME")) {
- if (get_environment("XDG_DATA_HOME").is_abs_path()) {
+ if (get_environment("XDG_DATA_HOME").is_absolute_path()) {
return get_environment("XDG_DATA_HOME");
} else {
WARN_PRINT_ONCE("`XDG_DATA_HOME` is a relative path. Ignoring its value and falling back to `get_config_path()` per the XDG Base Directory specification.");
@@ -660,7 +660,7 @@ String OS_Windows::get_data_path() const {
String OS_Windows::get_cache_path() const {
// The XDG Base Directory specification technically only applies on Linux/*BSD, but it doesn't hurt to support it on Windows as well.
if (has_environment("XDG_CACHE_HOME")) {
- if (get_environment("XDG_CACHE_HOME").is_abs_path()) {
+ if (get_environment("XDG_CACHE_HOME").is_absolute_path()) {
return get_environment("XDG_CACHE_HOME");
} else {
WARN_PRINT_ONCE("`XDG_CACHE_HOME` is a relative path. Ignoring its value and falling back to `%TEMP%` or `get_config_path()` per the XDG Base Directory specification.");
diff --git a/scene/2d/mesh_instance_2d.cpp b/scene/2d/mesh_instance_2d.cpp
index b7a0028199..15008390b7 100644
--- a/scene/2d/mesh_instance_2d.cpp
+++ b/scene/2d/mesh_instance_2d.cpp
@@ -29,6 +29,7 @@
/*************************************************************************/
#include "mesh_instance_2d.h"
+#include "scene/scene_string_names.h"
void MeshInstance2D::_notification(int p_what) {
if (p_what == NOTIFICATION_DRAW) {
@@ -70,7 +71,7 @@ void MeshInstance2D::set_texture(const Ref<Texture2D> &p_texture) {
}
texture = p_texture;
update();
- emit_signal("texture_changed");
+ emit_signal(SceneStringNames::get_singleton()->texture_changed);
}
void MeshInstance2D::set_normal_map(const Ref<Texture2D> &p_texture) {
diff --git a/scene/2d/multimesh_instance_2d.cpp b/scene/2d/multimesh_instance_2d.cpp
index 72a899370e..1bff2f337d 100644
--- a/scene/2d/multimesh_instance_2d.cpp
+++ b/scene/2d/multimesh_instance_2d.cpp
@@ -29,6 +29,7 @@
/*************************************************************************/
#include "multimesh_instance_2d.h"
+#include "scene/scene_string_names.h"
void MultiMeshInstance2D::_notification(int p_what) {
if (p_what == NOTIFICATION_DRAW) {
@@ -70,7 +71,7 @@ void MultiMeshInstance2D::set_texture(const Ref<Texture2D> &p_texture) {
}
texture = p_texture;
update();
- emit_signal("texture_changed");
+ emit_signal(SceneStringNames::get_singleton()->texture_changed);
}
Ref<Texture2D> MultiMeshInstance2D::get_texture() const {
diff --git a/scene/2d/physical_bone_2d.h b/scene/2d/physical_bone_2d.h
index d650a0426f..46a2772bad 100644
--- a/scene/2d/physical_bone_2d.h
+++ b/scene/2d/physical_bone_2d.h
@@ -44,7 +44,7 @@ protected:
static void _bind_methods();
private:
- Skeleton2D *parent_skeleton;
+ Skeleton2D *parent_skeleton = nullptr;
int bone2d_index = -1;
NodePath bone2d_nodepath;
bool follow_bone_when_simulating = false;
diff --git a/scene/2d/physics_body_2d.h b/scene/2d/physics_body_2d.h
index cd39a1996c..423f792132 100644
--- a/scene/2d/physics_body_2d.h
+++ b/scene/2d/physics_body_2d.h
@@ -338,8 +338,8 @@ public:
~CharacterBody2D();
};
-class KinematicCollision2D : public Reference {
- GDCLASS(KinematicCollision2D, Reference);
+class KinematicCollision2D : public RefCounted {
+ GDCLASS(KinematicCollision2D, RefCounted);
PhysicsBody2D *owner = nullptr;
friend class PhysicsBody2D;
diff --git a/scene/2d/sprite_2d.cpp b/scene/2d/sprite_2d.cpp
index 20169b1075..40e0f4523f 100644
--- a/scene/2d/sprite_2d.cpp
+++ b/scene/2d/sprite_2d.cpp
@@ -153,7 +153,7 @@ void Sprite2D::set_texture(const Ref<Texture2D> &p_texture) {
}
update();
- emit_signal("texture_changed");
+ emit_signal(SceneStringNames::get_singleton()->texture_changed);
item_rect_changed();
}
diff --git a/scene/2d/tile_map.cpp b/scene/2d/tile_map.cpp
index e79dfb019c..e39c8841cd 100644
--- a/scene/2d/tile_map.cpp
+++ b/scene/2d/tile_map.cpp
@@ -711,12 +711,17 @@ Map<Vector2i, TileMapQuadrant> &TileMap::get_quadrant_map() {
void TileMap::fix_invalid_tiles() {
ERR_FAIL_COND_MSG(tile_set.is_null(), "Cannot fix invalid tiles if Tileset is not open.");
+
+ Set<Vector2i> coords;
for (Map<Vector2i, TileMapCell>::Element *E = tile_map.front(); E; E = E->next()) {
TileSetSource *source = *tile_set->get_source(E->get().source_id);
if (!source || !source->has_tile(E->get().get_atlas_coords()) || !source->has_alternative_tile(E->get().get_atlas_coords(), E->get().alternative_tile)) {
- set_cell(E->key(), -1, TileSetSource::INVALID_ATLAS_COORDS, TileSetSource::INVALID_TILE_ALTERNATIVE);
+ coords.insert(E->key());
}
}
+ for (Set<Vector2i>::Element *E = coords.front(); E; E = E->next()) {
+ set_cell(E->get(), -1, TileSetSource::INVALID_ATLAS_COORDS, TileSetSource::INVALID_TILE_ALTERNATIVE);
+ }
}
void TileMap::_recreate_quadrants() {
diff --git a/scene/3d/camera_3d.cpp b/scene/3d/camera_3d.cpp
index 1c9418ae83..6b8851b4f8 100644
--- a/scene/3d/camera_3d.cpp
+++ b/scene/3d/camera_3d.cpp
@@ -500,6 +500,7 @@ void Camera3D::_bind_methods() {
ClassDB::bind_method(D_METHOD("set_doppler_tracking", "mode"), &Camera3D::set_doppler_tracking);
ClassDB::bind_method(D_METHOD("get_doppler_tracking"), &Camera3D::get_doppler_tracking);
ClassDB::bind_method(D_METHOD("get_frustum"), &Camera3D::get_frustum);
+ ClassDB::bind_method(D_METHOD("is_position_in_frustum", "world_point"), &Camera3D::is_position_in_frustum);
ClassDB::bind_method(D_METHOD("get_camera_rid"), &Camera3D::get_camera);
ClassDB::bind_method(D_METHOD("set_cull_mask_bit", "layer", "enable"), &Camera3D::set_cull_mask_bit);
@@ -623,6 +624,16 @@ Vector<Plane> Camera3D::get_frustum() const {
return cm.get_projection_planes(get_camera_transform());
}
+bool Camera3D::is_position_in_frustum(const Vector3 &p_position) const {
+ Vector<Plane> frustum = get_frustum();
+ for (int i = 0; i < frustum.size(); i++) {
+ if (frustum[i].is_point_over(p_position)) {
+ return false;
+ }
+ }
+ return true;
+}
+
void Camera3D::set_v_offset(float p_offset) {
v_offset = p_offset;
_update_camera();
diff --git a/scene/3d/camera_3d.h b/scene/3d/camera_3d.h
index d9ebe78f1a..c6efc8f9a9 100644
--- a/scene/3d/camera_3d.h
+++ b/scene/3d/camera_3d.h
@@ -153,6 +153,7 @@ public:
bool get_cull_mask_bit(int p_layer) const;
virtual Vector<Plane> get_frustum() const;
+ bool is_position_in_frustum(const Vector3 &p_position) const;
void set_environment(const Ref<Environment> &p_environment);
Ref<Environment> get_environment() const;
diff --git a/scene/3d/lightmap_gi.cpp b/scene/3d/lightmap_gi.cpp
index cc1177d541..a3f681e53c 100644
--- a/scene/3d/lightmap_gi.cpp
+++ b/scene/3d/lightmap_gi.cpp
@@ -31,11 +31,11 @@
#include "lightmap_gi.h"
#include "core/io/config_file.h"
+#include "core/io/dir_access.h"
+#include "core/io/file_access.h"
#include "core/io/resource_saver.h"
#include "core/math/camera_matrix.h"
#include "core/math/delaunay_3d.h"
-#include "core/os/dir_access.h"
-#include "core/os/file_access.h"
#include "core/os/os.h"
#include "core/templates/sort_array.h"
#include "lightmap_probe.h"
diff --git a/scene/3d/lightmapper.h b/scene/3d/lightmapper.h
index f63515f666..3a6a88d435 100644
--- a/scene/3d/lightmapper.h
+++ b/scene/3d/lightmapper.h
@@ -44,8 +44,8 @@
#endif
-class LightmapDenoiser : public Reference {
- GDCLASS(LightmapDenoiser, Reference)
+class LightmapDenoiser : public RefCounted {
+ GDCLASS(LightmapDenoiser, RefCounted)
protected:
static LightmapDenoiser *(*create_function)();
@@ -54,8 +54,8 @@ public:
static Ref<LightmapDenoiser> create();
};
-class LightmapRaycaster : public Reference {
- GDCLASS(LightmapRaycaster, Reference)
+class LightmapRaycaster : public RefCounted {
+ GDCLASS(LightmapRaycaster, RefCounted)
protected:
static LightmapRaycaster *(*create_function)();
@@ -121,8 +121,8 @@ public:
static Ref<LightmapRaycaster> create();
};
-class Lightmapper : public Reference {
- GDCLASS(Lightmapper, Reference)
+class Lightmapper : public RefCounted {
+ GDCLASS(Lightmapper, RefCounted)
public:
enum GenerateProbes {
GENERATE_PROBES_DISABLED,
diff --git a/scene/3d/node_3d.cpp b/scene/3d/node_3d.cpp
index e96e4df55c..e96b8ee1f9 100644
--- a/scene/3d/node_3d.cpp
+++ b/scene/3d/node_3d.cpp
@@ -32,6 +32,7 @@
#include "core/config/engine.h"
#include "core/object/message_queue.h"
+#include "scene/3d/visual_instance_3d.h"
#include "scene/main/scene_tree.h"
#include "scene/main/window.h"
#include "scene/scene_string_names.h"
@@ -148,6 +149,7 @@ void Node3D::_notification(int p_what) {
_notify_dirty();
notification(NOTIFICATION_ENTER_WORLD);
+ _update_visibility_parent(true);
} break;
case NOTIFICATION_EXIT_TREE: {
@@ -161,6 +163,7 @@ void Node3D::_notification(int p_what) {
data.parent = nullptr;
data.C = nullptr;
data.top_level_active = false;
+ _update_visibility_parent(true);
} break;
case NOTIFICATION_ENTER_WORLD: {
data.inside_world = true;
@@ -282,8 +285,12 @@ Transform3D Node3D::get_local_gizmo_transform() const {
}
#endif
-Node3D *Node3D::get_parent_spatial() const {
- return data.parent;
+Node3D *Node3D::get_parent_node_3d() const {
+ if (data.top_level) {
+ return nullptr;
+ }
+
+ return Object::cast_to<Node3D>(get_parent());
}
Transform3D Node3D::get_relative_transform(const Node *p_parent) const {
@@ -690,6 +697,51 @@ void Node3D::force_update_transform() {
notification(NOTIFICATION_TRANSFORM_CHANGED);
}
+void Node3D::_update_visibility_parent(bool p_update_root) {
+ RID new_parent;
+
+ if (!visibility_parent_path.is_empty()) {
+ if (!p_update_root) {
+ return;
+ }
+ Node *parent = get_node_or_null(visibility_parent_path);
+ ERR_FAIL_COND_MSG(!parent, "Can't find visibility parent node at path: " + visibility_parent_path);
+ ERR_FAIL_COND_MSG(parent == this, "The visibility parent can't be the same node.");
+ GeometryInstance3D *gi = Object::cast_to<GeometryInstance3D>(parent);
+ ERR_FAIL_COND_MSG(!gi, "The visibility parent node must be a GeometryInstance3D, at path: " + visibility_parent_path);
+ new_parent = gi ? gi->get_instance() : RID();
+ } else if (data.parent) {
+ new_parent = data.parent->data.visibility_parent;
+ }
+
+ if (new_parent == data.visibility_parent) {
+ return;
+ }
+
+ data.visibility_parent = new_parent;
+
+ VisualInstance3D *vi = Object::cast_to<VisualInstance3D>(this);
+ if (vi) {
+ RS::get_singleton()->instance_set_visibility_parent(vi->get_instance(), data.visibility_parent);
+ }
+
+ for (List<Node3D *>::Element *E = data.children.front(); E; E = E->next()) {
+ Node3D *c = E->get();
+ c->_update_visibility_parent(false);
+ }
+}
+
+void Node3D::set_visibility_parent(const NodePath &p_path) {
+ visibility_parent_path = p_path;
+ if (is_inside_tree()) {
+ _update_visibility_parent(true);
+ }
+}
+
+NodePath Node3D::get_visibility_parent() const {
+ return visibility_parent_path;
+}
+
void Node3D::_bind_methods() {
ClassDB::bind_method(D_METHOD("set_transform", "local"), &Node3D::set_transform);
ClassDB::bind_method(D_METHOD("get_transform"), &Node3D::get_transform);
@@ -703,7 +755,7 @@ void Node3D::_bind_methods() {
ClassDB::bind_method(D_METHOD("get_scale"), &Node3D::get_scale);
ClassDB::bind_method(D_METHOD("set_global_transform", "global"), &Node3D::set_global_transform);
ClassDB::bind_method(D_METHOD("get_global_transform"), &Node3D::get_global_transform);
- ClassDB::bind_method(D_METHOD("get_parent_spatial"), &Node3D::get_parent_spatial);
+ ClassDB::bind_method(D_METHOD("get_parent_node_3d"), &Node3D::get_parent_node_3d);
ClassDB::bind_method(D_METHOD("set_ignore_transform_notification", "enabled"), &Node3D::set_ignore_transform_notification);
ClassDB::bind_method(D_METHOD("set_as_top_level", "enable"), &Node3D::set_as_top_level);
ClassDB::bind_method(D_METHOD("is_set_as_top_level"), &Node3D::is_set_as_top_level);
@@ -713,6 +765,9 @@ void Node3D::_bind_methods() {
ClassDB::bind_method(D_METHOD("force_update_transform"), &Node3D::force_update_transform);
+ ClassDB::bind_method(D_METHOD("set_visibility_parent", "path"), &Node3D::set_visibility_parent);
+ ClassDB::bind_method(D_METHOD("get_visibility_parent"), &Node3D::get_visibility_parent);
+
ClassDB::bind_method(D_METHOD("_update_gizmo"), &Node3D::_update_gizmo);
ClassDB::bind_method(D_METHOD("update_gizmo"), &Node3D::update_gizmo);
@@ -768,6 +823,7 @@ void Node3D::_bind_methods() {
ADD_PROPERTY(PropertyInfo(Variant::TRANSFORM3D, "transform", PROPERTY_HINT_NONE, ""), "set_transform", "get_transform");
ADD_GROUP("Visibility", "");
ADD_PROPERTY(PropertyInfo(Variant::BOOL, "visible"), "set_visible", "is_visible");
+ ADD_PROPERTY(PropertyInfo(Variant::NODE_PATH, "visibility_parent", PROPERTY_HINT_NODE_PATH_VALID_TYPES, "GeometryInstance3D"), "set_visibility_parent", "get_visibility_parent");
ADD_PROPERTY(PropertyInfo(Variant::OBJECT, "gizmo", PROPERTY_HINT_RESOURCE_TYPE, "Node3DGizmo", 0), "set_gizmo", "get_gizmo");
ADD_SIGNAL(MethodInfo("visibility_changed"));
diff --git a/scene/3d/node_3d.h b/scene/3d/node_3d.h
index 09a96bf8ca..c7e36cf2ec 100644
--- a/scene/3d/node_3d.h
+++ b/scene/3d/node_3d.h
@@ -34,8 +34,8 @@
#include "scene/main/node.h"
#include "scene/main/scene_tree.h"
-class Node3DGizmo : public Reference {
- GDCLASS(Node3DGizmo, Reference);
+class Node3DGizmo : public RefCounted {
+ GDCLASS(Node3DGizmo, RefCounted);
public:
virtual void create() = 0;
@@ -75,6 +75,8 @@ class Node3D : public Node {
bool top_level = false;
bool inside_world = false;
+ RID visibility_parent;
+
int children_lock = 0;
Node3D *parent = nullptr;
List<Node3D *> children;
@@ -95,12 +97,17 @@ class Node3D : public Node {
} data;
+ NodePath visibility_parent_path;
+
void _update_gizmo();
void _notify_dirty();
void _propagate_transform_changed(Node3D *p_origin);
void _propagate_visibility_changed();
+ void _propagate_visibility_parent();
+ void _update_visibility_parent(bool p_update_root);
+
protected:
_FORCE_INLINE_ void set_ignore_transform_notification(bool p_ignore) { data.ignore_notification = p_ignore; }
@@ -118,7 +125,7 @@ public:
NOTIFICATION_LOCAL_TRANSFORM_CHANGED = 44,
};
- Node3D *get_parent_spatial() const;
+ Node3D *get_parent_node_3d() const;
Ref<World3D> get_world_3d() const;
@@ -196,6 +203,9 @@ public:
void force_update_transform();
+ void set_visibility_parent(const NodePath &p_path);
+ NodePath get_visibility_parent() const;
+
Node3D();
};
diff --git a/scene/3d/physics_body_3d.h b/scene/3d/physics_body_3d.h
index a25cb06bc3..8df3635be0 100644
--- a/scene/3d/physics_body_3d.h
+++ b/scene/3d/physics_body_3d.h
@@ -339,8 +339,8 @@ public:
~CharacterBody3D();
};
-class KinematicCollision3D : public Reference {
- GDCLASS(KinematicCollision3D, Reference);
+class KinematicCollision3D : public RefCounted {
+ GDCLASS(KinematicCollision3D, RefCounted);
PhysicsBody3D *owner = nullptr;
friend class PhysicsBody3D;
diff --git a/scene/3d/skeleton_3d.h b/scene/3d/skeleton_3d.h
index 9be7dce5d2..2f6e416c8c 100644
--- a/scene/3d/skeleton_3d.h
+++ b/scene/3d/skeleton_3d.h
@@ -40,8 +40,8 @@ typedef int BoneId;
class PhysicalBone3D;
class Skeleton3D;
-class SkinReference : public Reference {
- GDCLASS(SkinReference, Reference)
+class SkinReference : public RefCounted {
+ GDCLASS(SkinReference, RefCounted)
friend class Skeleton3D;
Skeleton3D *skeleton_node;
diff --git a/scene/3d/sprite_3d.cpp b/scene/3d/sprite_3d.cpp
index be474e82e0..9ec461d973 100644
--- a/scene/3d/sprite_3d.cpp
+++ b/scene/3d/sprite_3d.cpp
@@ -505,6 +505,7 @@ void Sprite3D::set_texture(const Ref<Texture2D> &p_texture) {
texture->connect(CoreStringNames::get_singleton()->changed, callable_mp(this, &Sprite3D::_texture_changed));
}
_queue_update();
+ emit_signal(SceneStringNames::get_singleton()->texture_changed);
}
Ref<Texture2D> Sprite3D::get_texture() const {
@@ -663,6 +664,7 @@ void Sprite3D::_bind_methods() {
ADD_PROPERTY(PropertyInfo(Variant::RECT2, "region_rect"), "set_region_rect", "get_region_rect");
ADD_SIGNAL(MethodInfo("frame_changed"));
+ ADD_SIGNAL(MethodInfo("texture_changed"));
}
Sprite3D::Sprite3D() {
diff --git a/scene/3d/velocity_tracker_3d.h b/scene/3d/velocity_tracker_3d.h
index e971f4755a..827c3f5bd8 100644
--- a/scene/3d/velocity_tracker_3d.h
+++ b/scene/3d/velocity_tracker_3d.h
@@ -33,8 +33,8 @@
#include "scene/3d/node_3d.h"
-class VelocityTracker3D : public Reference {
- GDCLASS(VelocityTracker3D, Reference);
+class VelocityTracker3D : public RefCounted {
+ GDCLASS(VelocityTracker3D, RefCounted);
struct PositionHistory {
uint64_t frame = 0;
diff --git a/scene/3d/visual_instance_3d.cpp b/scene/3d/visual_instance_3d.cpp
index 6971c1ce2a..c16e3c2d78 100644
--- a/scene/3d/visual_instance_3d.cpp
+++ b/scene/3d/visual_instance_3d.cpp
@@ -150,40 +150,40 @@ Ref<Material> GeometryInstance3D::get_material_override() const {
return material_override;
}
-void GeometryInstance3D::set_lod_min_distance(float p_dist) {
- lod_min_distance = p_dist;
- RS::get_singleton()->instance_geometry_set_draw_range(get_instance(), lod_min_distance, lod_max_distance, lod_min_hysteresis, lod_max_hysteresis);
+void GeometryInstance3D::set_visibility_range_begin(float p_dist) {
+ visibility_range_begin = p_dist;
+ RS::get_singleton()->instance_geometry_set_visibility_range(get_instance(), visibility_range_begin, visibility_range_end, visibility_range_begin_margin, visibility_range_end_margin);
}
-float GeometryInstance3D::get_lod_min_distance() const {
- return lod_min_distance;
+float GeometryInstance3D::get_visibility_range_begin() const {
+ return visibility_range_begin;
}
-void GeometryInstance3D::set_lod_max_distance(float p_dist) {
- lod_max_distance = p_dist;
- RS::get_singleton()->instance_geometry_set_draw_range(get_instance(), lod_min_distance, lod_max_distance, lod_min_hysteresis, lod_max_hysteresis);
+void GeometryInstance3D::set_visibility_range_end(float p_dist) {
+ visibility_range_end = p_dist;
+ RS::get_singleton()->instance_geometry_set_visibility_range(get_instance(), visibility_range_begin, visibility_range_end, visibility_range_begin_margin, visibility_range_end_margin);
}
-float GeometryInstance3D::get_lod_max_distance() const {
- return lod_max_distance;
+float GeometryInstance3D::get_visibility_range_end() const {
+ return visibility_range_end;
}
-void GeometryInstance3D::set_lod_min_hysteresis(float p_dist) {
- lod_min_hysteresis = p_dist;
- RS::get_singleton()->instance_geometry_set_draw_range(get_instance(), lod_min_distance, lod_max_distance, lod_min_hysteresis, lod_max_hysteresis);
+void GeometryInstance3D::set_visibility_range_begin_margin(float p_dist) {
+ visibility_range_begin_margin = p_dist;
+ RS::get_singleton()->instance_geometry_set_visibility_range(get_instance(), visibility_range_begin, visibility_range_end, visibility_range_begin_margin, visibility_range_end_margin);
}
-float GeometryInstance3D::get_lod_min_hysteresis() const {
- return lod_min_hysteresis;
+float GeometryInstance3D::get_visibility_range_begin_margin() const {
+ return visibility_range_begin_margin;
}
-void GeometryInstance3D::set_lod_max_hysteresis(float p_dist) {
- lod_max_hysteresis = p_dist;
- RS::get_singleton()->instance_geometry_set_draw_range(get_instance(), lod_min_distance, lod_max_distance, lod_min_hysteresis, lod_max_hysteresis);
+void GeometryInstance3D::set_visibility_range_end_margin(float p_dist) {
+ visibility_range_end_margin = p_dist;
+ RS::get_singleton()->instance_geometry_set_visibility_range(get_instance(), visibility_range_begin, visibility_range_end, visibility_range_begin_margin, visibility_range_end_margin);
}
-float GeometryInstance3D::get_lod_max_hysteresis() const {
- return lod_max_hysteresis;
+float GeometryInstance3D::get_visibility_range_end_margin() const {
+ return visibility_range_end_margin;
}
void GeometryInstance3D::_notification(int p_what) {
@@ -357,17 +357,17 @@ void GeometryInstance3D::_bind_methods() {
ClassDB::bind_method(D_METHOD("set_lod_bias", "bias"), &GeometryInstance3D::set_lod_bias);
ClassDB::bind_method(D_METHOD("get_lod_bias"), &GeometryInstance3D::get_lod_bias);
- ClassDB::bind_method(D_METHOD("set_lod_max_hysteresis", "mode"), &GeometryInstance3D::set_lod_max_hysteresis);
- ClassDB::bind_method(D_METHOD("get_lod_max_hysteresis"), &GeometryInstance3D::get_lod_max_hysteresis);
+ ClassDB::bind_method(D_METHOD("set_visibility_range_end_margin", "distance"), &GeometryInstance3D::set_visibility_range_end_margin);
+ ClassDB::bind_method(D_METHOD("get_visibility_range_end_margin"), &GeometryInstance3D::get_visibility_range_end_margin);
- ClassDB::bind_method(D_METHOD("set_lod_max_distance", "mode"), &GeometryInstance3D::set_lod_max_distance);
- ClassDB::bind_method(D_METHOD("get_lod_max_distance"), &GeometryInstance3D::get_lod_max_distance);
+ ClassDB::bind_method(D_METHOD("set_visibility_range_end", "distance"), &GeometryInstance3D::set_visibility_range_end);
+ ClassDB::bind_method(D_METHOD("get_visibility_range_end"), &GeometryInstance3D::get_visibility_range_end);
- ClassDB::bind_method(D_METHOD("set_lod_min_hysteresis", "mode"), &GeometryInstance3D::set_lod_min_hysteresis);
- ClassDB::bind_method(D_METHOD("get_lod_min_hysteresis"), &GeometryInstance3D::get_lod_min_hysteresis);
+ ClassDB::bind_method(D_METHOD("set_visibility_range_begin_margin", "distance"), &GeometryInstance3D::set_visibility_range_begin_margin);
+ ClassDB::bind_method(D_METHOD("get_visibility_range_begin_margin"), &GeometryInstance3D::get_visibility_range_begin_margin);
- ClassDB::bind_method(D_METHOD("set_lod_min_distance", "mode"), &GeometryInstance3D::set_lod_min_distance);
- ClassDB::bind_method(D_METHOD("get_lod_min_distance"), &GeometryInstance3D::get_lod_min_distance);
+ ClassDB::bind_method(D_METHOD("set_visibility_range_begin", "distance"), &GeometryInstance3D::set_visibility_range_begin);
+ ClassDB::bind_method(D_METHOD("get_visibility_range_begin"), &GeometryInstance3D::get_visibility_range_begin);
ClassDB::bind_method(D_METHOD("set_shader_instance_uniform", "uniform", "value"), &GeometryInstance3D::set_shader_instance_uniform);
ClassDB::bind_method(D_METHOD("get_shader_instance_uniform", "uniform"), &GeometryInstance3D::get_shader_instance_uniform);
@@ -398,11 +398,11 @@ void GeometryInstance3D::_bind_methods() {
ADD_PROPERTY(PropertyInfo(Variant::INT, "gi_mode", PROPERTY_HINT_ENUM, "Disabled,Baked,Dynamic"), "set_gi_mode", "get_gi_mode");
ADD_PROPERTY(PropertyInfo(Variant::INT, "gi_lightmap_scale", PROPERTY_HINT_ENUM, "1x,2x,4x,8x"), "set_lightmap_scale", "get_lightmap_scale");
- ADD_GROUP("LOD", "lod_");
- ADD_PROPERTY(PropertyInfo(Variant::INT, "lod_min_distance", PROPERTY_HINT_RANGE, "0,32768,0.01"), "set_lod_min_distance", "get_lod_min_distance");
- ADD_PROPERTY(PropertyInfo(Variant::INT, "lod_min_hysteresis", PROPERTY_HINT_RANGE, "0,32768,0.01"), "set_lod_min_hysteresis", "get_lod_min_hysteresis");
- ADD_PROPERTY(PropertyInfo(Variant::INT, "lod_max_distance", PROPERTY_HINT_RANGE, "0,32768,0.01"), "set_lod_max_distance", "get_lod_max_distance");
- ADD_PROPERTY(PropertyInfo(Variant::INT, "lod_max_hysteresis", PROPERTY_HINT_RANGE, "0,32768,0.01"), "set_lod_max_hysteresis", "get_lod_max_hysteresis");
+ ADD_GROUP("Visibility Range", "visibility_range_");
+ ADD_PROPERTY(PropertyInfo(Variant::FLOAT, "visibility_range_begin", PROPERTY_HINT_RANGE, "0.0,4096.0,0.01"), "set_visibility_range_begin", "get_visibility_range_begin");
+ ADD_PROPERTY(PropertyInfo(Variant::FLOAT, "visibility_range_begin_margin", PROPERTY_HINT_RANGE, "0.0,4096.0,0.01"), "set_visibility_range_begin_margin", "get_visibility_range_begin_margin");
+ ADD_PROPERTY(PropertyInfo(Variant::FLOAT, "visibility_range_end", PROPERTY_HINT_RANGE, "0.0,4096.0,0.01"), "set_visibility_range_end", "get_visibility_range_end");
+ ADD_PROPERTY(PropertyInfo(Variant::FLOAT, "visibility_range_end_margin", PROPERTY_HINT_RANGE, "0.0,4096.0,0.01"), "set_visibility_range_end_margin", "get_visibility_range_end_margin");
//ADD_SIGNAL( MethodInfo("visibility_changed"));
diff --git a/scene/3d/visual_instance_3d.h b/scene/3d/visual_instance_3d.h
index 68d29ef81e..2d5699859b 100644
--- a/scene/3d/visual_instance_3d.h
+++ b/scene/3d/visual_instance_3d.h
@@ -107,10 +107,13 @@ public:
private:
ShadowCastingSetting shadow_casting_setting = SHADOW_CASTING_SETTING_ON;
Ref<Material> material_override;
- float lod_min_distance = 0.0;
- float lod_max_distance = 0.0;
- float lod_min_hysteresis = 0.0;
- float lod_max_hysteresis = 0.0;
+
+ float visibility_range_begin = 0.0;
+ float visibility_range_end = 0.0;
+ float visibility_range_begin_margin = 0.0;
+ float visibility_range_end_margin = 0.0;
+
+ Vector<NodePath> visibility_range_children;
float lod_bias = 1.0;
@@ -136,17 +139,20 @@ public:
void set_cast_shadows_setting(ShadowCastingSetting p_shadow_casting_setting);
ShadowCastingSetting get_cast_shadows_setting() const;
- void set_lod_min_distance(float p_dist);
- float get_lod_min_distance() const;
+ void set_visibility_range_begin(float p_dist);
+ float get_visibility_range_begin() const;
+
+ void set_visibility_range_end(float p_dist);
+ float get_visibility_range_end() const;
- void set_lod_max_distance(float p_dist);
- float get_lod_max_distance() const;
+ void set_visibility_range_begin_margin(float p_dist);
+ float get_visibility_range_begin_margin() const;
- void set_lod_min_hysteresis(float p_dist);
- float get_lod_min_hysteresis() const;
+ void set_visibility_range_end_margin(float p_dist);
+ float get_visibility_range_end_margin() const;
- void set_lod_max_hysteresis(float p_dist);
- float get_lod_max_hysteresis() const;
+ void set_visibility_range_parent(const Node *p_parent);
+ void clear_visibility_range_parent();
void set_material_override(const Ref<Material> &p_material);
Ref<Material> get_material_override() const;
diff --git a/scene/3d/xr_nodes.cpp b/scene/3d/xr_nodes.cpp
index 09662f3e7a..4f2c816934 100644
--- a/scene/3d/xr_nodes.cpp
+++ b/scene/3d/xr_nodes.cpp
@@ -86,7 +86,8 @@ Vector3 XRCamera3D::project_local_ray_normal(const Point2 &p_pos) const {
Vector2 cpos = get_viewport()->get_camera_coords(p_pos);
Vector3 ray;
- CameraMatrix cm = xr_interface->get_projection_for_eye(XRInterface::EYE_MONO, viewport_size.aspect(), get_near(), get_far());
+ // Just use the first view, if multiple views are supported this function has no good result
+ CameraMatrix cm = xr_interface->get_projection_for_view(0, viewport_size.aspect(), get_near(), get_far());
Vector2 screen_he = cm.get_viewport_half_extents();
ray = Vector3(((cpos.x / viewport_size.width) * 2.0 - 1.0) * screen_he.x, ((1.0 - (cpos.y / viewport_size.height)) * 2.0 - 1.0) * screen_he.y, -get_near()).normalized();
@@ -108,7 +109,8 @@ Point2 XRCamera3D::unproject_position(const Vector3 &p_pos) const {
Size2 viewport_size = get_viewport()->get_visible_rect().size;
- CameraMatrix cm = xr_interface->get_projection_for_eye(XRInterface::EYE_MONO, viewport_size.aspect(), get_near(), get_far());
+ // Just use the first view, if multiple views are supported this function has no good result
+ CameraMatrix cm = xr_interface->get_projection_for_view(0, viewport_size.aspect(), get_near(), get_far());
Plane p(get_camera_transform().xform_inv(p_pos), 1.0);
@@ -137,7 +139,8 @@ Vector3 XRCamera3D::project_position(const Point2 &p_point, float p_z_depth) con
Size2 viewport_size = get_viewport()->get_visible_rect().size;
- CameraMatrix cm = xr_interface->get_projection_for_eye(XRInterface::EYE_MONO, viewport_size.aspect(), get_near(), get_far());
+ // Just use the first view, if multiple views are supported this function has no good result
+ CameraMatrix cm = xr_interface->get_projection_for_view(0, viewport_size.aspect(), get_near(), get_far());
Vector2 vp_he = cm.get_viewport_half_extents();
@@ -165,7 +168,8 @@ Vector<Plane> XRCamera3D::get_frustum() const {
ERR_FAIL_COND_V(!is_inside_world(), Vector<Plane>());
Size2 viewport_size = get_viewport()->get_visible_rect().size;
- CameraMatrix cm = xr_interface->get_projection_for_eye(XRInterface::EYE_MONO, viewport_size.aspect(), get_near(), get_far());
+ // TODO Just use the first view for now, this is mostly for debugging so we may look into using our combined projection here.
+ CameraMatrix cm = xr_interface->get_projection_for_view(0, viewport_size.aspect(), get_near(), get_far());
return cm.get_projection_planes(get_camera_transform());
};
@@ -516,6 +520,11 @@ TypedArray<String> XROrigin3D::get_configuration_warnings() const {
}
}
+ bool xr_enabled = GLOBAL_GET("rendering/xr/enabled");
+ if (!xr_enabled) {
+ warnings.push_back(TTR("XR is not enabled in rendering project settings. Stereoscopic output is not supported unless this is enabled."));
+ }
+
return warnings;
};
@@ -571,7 +580,7 @@ void XROrigin3D::_notification(int p_what) {
Ref<XRInterface> xr_interface = xr_server->get_primary_interface();
if (xr_interface.is_valid() && tracked_camera != nullptr) {
// get our positioning transform for our headset
- Transform3D t = xr_interface->get_transform_for_eye(XRInterface::EYE_MONO, Transform3D());
+ Transform3D t = xr_interface->get_camera_transform();
// now apply this to our camera
tracked_camera->set_transform(t);
diff --git a/scene/animation/animation_player.h b/scene/animation/animation_player.h
index 7922635438..7cd9de1fa1 100644
--- a/scene/animation/animation_player.h
+++ b/scene/animation/animation_player.h
@@ -37,8 +37,8 @@
#include "scene/resources/animation.h"
#ifdef TOOLS_ENABLED
-class AnimatedValuesBackup : public Reference {
- GDCLASS(AnimatedValuesBackup, Reference);
+class AnimatedValuesBackup : public RefCounted {
+ GDCLASS(AnimatedValuesBackup, RefCounted);
struct Entry {
Object *object = nullptr;
diff --git a/scene/animation/animation_tree.cpp b/scene/animation/animation_tree.cpp
index 7369713e69..6fac70bdd5 100644
--- a/scene/animation/animation_tree.cpp
+++ b/scene/animation/animation_tree.cpp
@@ -37,7 +37,7 @@
void AnimationNode::get_parameter_list(List<PropertyInfo> *r_list) const {
if (get_script_instance()) {
- Array parameters = get_script_instance()->call("get_parameter_list");
+ Array parameters = get_script_instance()->call("_get_parameter_list");
for (int i = 0; i < parameters.size(); i++) {
Dictionary d = parameters[i];
ERR_CONTINUE(d.is_empty());
@@ -48,7 +48,7 @@ void AnimationNode::get_parameter_list(List<PropertyInfo> *r_list) const {
Variant AnimationNode::get_parameter_default_value(const StringName &p_parameter) const {
if (get_script_instance()) {
- return get_script_instance()->call("get_parameter_default_value", p_parameter);
+ return get_script_instance()->call("_get_parameter_default_value", p_parameter);
}
return Variant();
}
@@ -73,7 +73,7 @@ Variant AnimationNode::get_parameter(const StringName &p_name) const {
void AnimationNode::get_child_nodes(List<ChildNode> *r_child_nodes) {
if (get_script_instance()) {
- Dictionary cn = get_script_instance()->call("get_child_nodes");
+ Dictionary cn = get_script_instance()->call("_get_child_nodes");
List<Variant> keys;
cn.get_key_list(&keys);
for (List<Variant>::Element *E = keys.front(); E; E = E->next()) {
@@ -299,7 +299,7 @@ String AnimationNode::get_input_name(int p_input) {
String AnimationNode::get_caption() const {
if (get_script_instance()) {
- return get_script_instance()->call("get_caption");
+ return get_script_instance()->call("_get_caption");
}
return "Node";
@@ -330,7 +330,7 @@ void AnimationNode::remove_input(int p_index) {
float AnimationNode::process(float p_time, bool p_seek) {
if (get_script_instance()) {
- return get_script_instance()->call("process", p_time, p_seek);
+ return get_script_instance()->call("_process", p_time, p_seek);
}
return 0;
@@ -357,6 +357,10 @@ bool AnimationNode::is_path_filtered(const NodePath &p_path) const {
}
bool AnimationNode::has_filter() const {
+ if (get_script_instance()) {
+ return get_script_instance()->call("_has_filter");
+ }
+
return false;
}
@@ -387,7 +391,7 @@ void AnimationNode::_validate_property(PropertyInfo &property) const {
Ref<AnimationNode> AnimationNode::get_child_by_name(const StringName &p_name) {
if (get_script_instance()) {
- return get_script_instance()->call("get_child_by_name", p_name);
+ return get_script_instance()->call("_get_child_by_name", p_name);
}
return Ref<AnimationNode>();
}
@@ -418,17 +422,17 @@ void AnimationNode::_bind_methods() {
ADD_PROPERTY(PropertyInfo(Variant::BOOL, "filter_enabled", PROPERTY_HINT_NONE, "", PROPERTY_USAGE_NOEDITOR), "set_filter_enabled", "is_filter_enabled");
ADD_PROPERTY(PropertyInfo(Variant::ARRAY, "filters", PROPERTY_HINT_NONE, "", PROPERTY_USAGE_NOEDITOR | PROPERTY_USAGE_INTERNAL), "_set_filters", "_get_filters");
- BIND_VMETHOD(MethodInfo(Variant::DICTIONARY, "get_child_nodes"));
- BIND_VMETHOD(MethodInfo(Variant::ARRAY, "get_parameter_list"));
- BIND_VMETHOD(MethodInfo(Variant::OBJECT, "get_child_by_name", PropertyInfo(Variant::STRING, "name")));
+ BIND_VMETHOD(MethodInfo(Variant::DICTIONARY, "_get_child_nodes"));
+ BIND_VMETHOD(MethodInfo(Variant::ARRAY, "_get_parameter_list"));
+ BIND_VMETHOD(MethodInfo(Variant::OBJECT, "_get_child_by_name", PropertyInfo(Variant::STRING, "name")));
{
- MethodInfo mi = MethodInfo(Variant::NIL, "get_parameter_default_value", PropertyInfo(Variant::STRING_NAME, "name"));
+ MethodInfo mi = MethodInfo(Variant::NIL, "_get_parameter_default_value", PropertyInfo(Variant::STRING_NAME, "name"));
mi.return_val.usage = PROPERTY_USAGE_NIL_IS_VARIANT;
BIND_VMETHOD(mi);
}
- BIND_VMETHOD(MethodInfo("process", PropertyInfo(Variant::FLOAT, "time"), PropertyInfo(Variant::BOOL, "seek")));
- BIND_VMETHOD(MethodInfo(Variant::STRING, "get_caption"));
- BIND_VMETHOD(MethodInfo(Variant::BOOL, "has_filter"));
+ BIND_VMETHOD(MethodInfo("_process", PropertyInfo(Variant::FLOAT, "time"), PropertyInfo(Variant::BOOL, "seek")));
+ BIND_VMETHOD(MethodInfo(Variant::STRING, "_get_caption"));
+ BIND_VMETHOD(MethodInfo(Variant::BOOL, "_has_filter"));
ADD_SIGNAL(MethodInfo("removed_from_graph"));
diff --git a/scene/gui/code_edit.cpp b/scene/gui/code_edit.cpp
index d5000e88d7..48e327ce78 100644
--- a/scene/gui/code_edit.cpp
+++ b/scene/gui/code_edit.cpp
@@ -1526,6 +1526,9 @@ void CodeEdit::_clear_delimiters(DelimiterType p_type) {
}
}
delimiter_cache.clear();
+ if (!setting_delimiters) {
+ _update_delimiter_cache();
+ }
}
TypedArray<String> CodeEdit::_get_delimiters(DelimiterType p_type) const {
diff --git a/scene/gui/control.cpp b/scene/gui/control.cpp
index 5afe813ee0..c84627c21e 100644
--- a/scene/gui/control.cpp
+++ b/scene/gui/control.cpp
@@ -662,7 +662,7 @@ bool Control::has_point(const Point2 &p_point) const {
Variant v = p_point;
const Variant *p = &v;
Callable::CallError ce;
- Variant ret = get_script_instance()->call(SceneStringNames::get_singleton()->has_point, &p, 1, ce);
+ Variant ret = get_script_instance()->call(SceneStringNames::get_singleton()->_has_point, &p, 1, ce);
if (ce.error == Callable::CallError::CALL_OK) {
return ret;
}
@@ -687,7 +687,7 @@ Variant Control::get_drag_data(const Point2 &p_point) {
Object *obj = ObjectDB::get_instance(data.drag_owner);
if (obj) {
Control *c = Object::cast_to<Control>(obj);
- return c->call("get_drag_data_fw", p_point, this);
+ return c->call("_get_drag_data_fw", p_point, this);
}
}
@@ -695,7 +695,7 @@ Variant Control::get_drag_data(const Point2 &p_point) {
Variant v = p_point;
const Variant *p = &v;
Callable::CallError ce;
- Variant ret = get_script_instance()->call(SceneStringNames::get_singleton()->get_drag_data, &p, 1, ce);
+ Variant ret = get_script_instance()->call(SceneStringNames::get_singleton()->_get_drag_data, &p, 1, ce);
if (ce.error == Callable::CallError::CALL_OK) {
return ret;
}
@@ -709,7 +709,7 @@ bool Control::can_drop_data(const Point2 &p_point, const Variant &p_data) const
Object *obj = ObjectDB::get_instance(data.drag_owner);
if (obj) {
Control *c = Object::cast_to<Control>(obj);
- return c->call("can_drop_data_fw", p_point, p_data, this);
+ return c->call("_can_drop_data_fw", p_point, p_data, this);
}
}
@@ -717,7 +717,7 @@ bool Control::can_drop_data(const Point2 &p_point, const Variant &p_data) const
Variant v = p_point;
const Variant *p[2] = { &v, &p_data };
Callable::CallError ce;
- Variant ret = get_script_instance()->call(SceneStringNames::get_singleton()->can_drop_data, p, 2, ce);
+ Variant ret = get_script_instance()->call(SceneStringNames::get_singleton()->_can_drop_data, p, 2, ce);
if (ce.error == Callable::CallError::CALL_OK) {
return ret;
}
@@ -731,7 +731,7 @@ void Control::drop_data(const Point2 &p_point, const Variant &p_data) {
Object *obj = ObjectDB::get_instance(data.drag_owner);
if (obj) {
Control *c = Object::cast_to<Control>(obj);
- c->call("drop_data_fw", p_point, p_data, this);
+ c->call("_drop_data_fw", p_point, p_data, this);
return;
}
}
@@ -740,7 +740,7 @@ void Control::drop_data(const Point2 &p_point, const Variant &p_data) {
Variant v = p_point;
const Variant *p[2] = { &v, &p_data };
Callable::CallError ce;
- Variant ret = get_script_instance()->call(SceneStringNames::get_singleton()->drop_data, p, 2, ce);
+ Variant ret = get_script_instance()->call(SceneStringNames::get_singleton()->_drop_data, p, 2, ce);
if (ce.error == Callable::CallError::CALL_OK) {
return;
}
@@ -2775,12 +2775,12 @@ void Control::_bind_methods() {
BIND_VMETHOD(MethodInfo("_gui_input", PropertyInfo(Variant::OBJECT, "event", PROPERTY_HINT_RESOURCE_TYPE, "InputEvent")));
BIND_VMETHOD(MethodInfo(Variant::VECTOR2, "_get_minimum_size"));
- MethodInfo get_drag_data = MethodInfo("get_drag_data", PropertyInfo(Variant::VECTOR2, "position"));
+ MethodInfo get_drag_data = MethodInfo("_get_drag_data", PropertyInfo(Variant::VECTOR2, "position"));
get_drag_data.return_val.usage |= PROPERTY_USAGE_NIL_IS_VARIANT;
BIND_VMETHOD(get_drag_data);
- BIND_VMETHOD(MethodInfo(Variant::BOOL, "can_drop_data", PropertyInfo(Variant::VECTOR2, "position"), PropertyInfo(Variant::NIL, "data")));
- BIND_VMETHOD(MethodInfo("drop_data", PropertyInfo(Variant::VECTOR2, "position"), PropertyInfo(Variant::NIL, "data")));
+ BIND_VMETHOD(MethodInfo(Variant::BOOL, "_can_drop_data", PropertyInfo(Variant::VECTOR2, "position"), PropertyInfo(Variant::NIL, "data")));
+ BIND_VMETHOD(MethodInfo("_drop_data", PropertyInfo(Variant::VECTOR2, "position"), PropertyInfo(Variant::NIL, "data")));
BIND_VMETHOD(MethodInfo(
PropertyInfo(Variant::OBJECT, "control", PROPERTY_HINT_RESOURCE_TYPE, "Control"),
"_make_custom_tooltip", PropertyInfo(Variant::STRING, "for_text")));
@@ -2940,5 +2940,5 @@ void Control::_bind_methods() {
ADD_SIGNAL(MethodInfo("minimum_size_changed"));
ADD_SIGNAL(MethodInfo("theme_changed"));
- BIND_VMETHOD(MethodInfo(Variant::BOOL, "has_point", PropertyInfo(Variant::VECTOR2, "point")));
+ BIND_VMETHOD(MethodInfo(Variant::BOOL, "_has_point", PropertyInfo(Variant::VECTOR2, "point")));
}
diff --git a/scene/gui/file_dialog.h b/scene/gui/file_dialog.h
index 4996f00cb3..55774b488c 100644
--- a/scene/gui/file_dialog.h
+++ b/scene/gui/file_dialog.h
@@ -32,7 +32,7 @@
#define FILE_DIALOG_H
#include "box_container.h"
-#include "core/os/dir_access.h"
+#include "core/io/dir_access.h"
#include "scene/gui/dialogs.h"
#include "scene/gui/line_edit.h"
#include "scene/gui/option_button.h"
diff --git a/scene/gui/nine_patch_rect.cpp b/scene/gui/nine_patch_rect.cpp
index 29a38ad5e3..8bf25ac915 100644
--- a/scene/gui/nine_patch_rect.cpp
+++ b/scene/gui/nine_patch_rect.cpp
@@ -30,6 +30,7 @@
#include "nine_patch_rect.h"
+#include "scene/scene_string_names.h"
#include "servers/rendering_server.h"
void NinePatchRect::_notification(int p_what) {
@@ -97,7 +98,7 @@ void NinePatchRect::set_texture(const Ref<Texture2D> &p_tex) {
texture->set_flags(texture->get_flags()&(~Texture::FLAG_REPEAT)); //remove repeat from texture, it looks bad in sprites
*/
minimum_size_changed();
- emit_signal("texture_changed");
+ emit_signal(SceneStringNames::get_singleton()->texture_changed);
}
Ref<Texture2D> NinePatchRect::get_texture() const {
diff --git a/scene/gui/rich_text_effect.h b/scene/gui/rich_text_effect.h
index f2e2823eff..d809fd502f 100644
--- a/scene/gui/rich_text_effect.h
+++ b/scene/gui/rich_text_effect.h
@@ -47,8 +47,8 @@ public:
RichTextEffect();
};
-class CharFXTransform : public Reference {
- GDCLASS(CharFXTransform, Reference);
+class CharFXTransform : public RefCounted {
+ GDCLASS(CharFXTransform, RefCounted);
protected:
static void _bind_methods();
diff --git a/scene/gui/slider.cpp b/scene/gui/slider.cpp
index a407ef21cb..5947f3b99e 100644
--- a/scene/gui/slider.cpp
+++ b/scene/gui/slider.cpp
@@ -172,7 +172,7 @@ void Slider::_notification(int p_what) {
int widget_width = style->get_minimum_size().width + style->get_center_size().width;
float areasize = size.height - grabber->get_size().height;
style->draw(ci, Rect2i(Point2i(size.width / 2 - widget_width / 2, 0), Size2i(widget_width, size.height)));
- grabber_area->draw(ci, Rect2i(Point2i((size.width - widget_width) / 2, size.height - areasize * ratio - grabber->get_size().height / 2), Size2i(widget_width, areasize * ratio + grabber->get_size().width / 2)));
+ grabber_area->draw(ci, Rect2i(Point2i((size.width - widget_width) / 2, size.height - areasize * ratio - grabber->get_size().height / 2), Size2i(widget_width, areasize * ratio + grabber->get_size().height / 2)));
if (ticks > 1) {
int grabber_offset = (grabber->get_size().height / 2 - tick->get_height() / 2);
diff --git a/scene/main/http_request.h b/scene/main/http_request.h
index 92b0ff28e9..22e822253f 100644
--- a/scene/main/http_request.h
+++ b/scene/main/http_request.h
@@ -31,8 +31,8 @@
#ifndef HTTPREQUEST_H
#define HTTPREQUEST_H
+#include "core/io/file_access.h"
#include "core/io/http_client.h"
-#include "core/os/file_access.h"
#include "core/os/thread.h"
#include "core/templates/safe_refcount.h"
#include "node.h"
diff --git a/scene/main/scene_tree.cpp b/scene/main/scene_tree.cpp
index 3e08f86fc9..e4ba93feec 100644
--- a/scene/main/scene_tree.cpp
+++ b/scene/main/scene_tree.cpp
@@ -33,10 +33,10 @@
#include "core/config/project_settings.h"
#include "core/debugger/engine_debugger.h"
#include "core/input/input.h"
+#include "core/io/dir_access.h"
#include "core/io/marshalls.h"
#include "core/io/resource_loader.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/string/print_string.h"
diff --git a/scene/main/scene_tree.h b/scene/main/scene_tree.h
index a2f2adb8f8..78c4c14e97 100644
--- a/scene/main/scene_tree.h
+++ b/scene/main/scene_tree.h
@@ -48,8 +48,8 @@ class Material;
class Mesh;
class SceneDebugger;
-class SceneTreeTimer : public Reference {
- GDCLASS(SceneTreeTimer, Reference);
+class SceneTreeTimer : public RefCounted {
+ GDCLASS(SceneTreeTimer, RefCounted);
float time_left = 0.0;
bool process_always = true;
diff --git a/scene/main/viewport.cpp b/scene/main/viewport.cpp
index 17c0023b09..5369792194 100644
--- a/scene/main/viewport.cpp
+++ b/scene/main/viewport.cpp
@@ -2547,6 +2547,8 @@ void Viewport::_gui_remove_control(Control *p_control) {
}
Window *Viewport::get_base_window() const {
+ ERR_FAIL_COND_V(!is_inside_tree(), nullptr);
+
Viewport *v = const_cast<Viewport *>(this);
Window *w = Object::cast_to<Window>(v);
while (!w) {
@@ -3336,6 +3338,7 @@ bool Viewport::is_input_handled() const {
return local_input_handled;
} else {
const Viewport *vp = this;
+ ERR_FAIL_COND_V(!is_inside_tree(), false);
while (true) {
if (Object::cast_to<Window>(vp)) {
break;
diff --git a/scene/resources/audio_stream_sample.cpp b/scene/resources/audio_stream_sample.cpp
index 9a9f019dda..81062feb46 100644
--- a/scene/resources/audio_stream_sample.cpp
+++ b/scene/resources/audio_stream_sample.cpp
@@ -30,8 +30,8 @@
#include "audio_stream_sample.h"
+#include "core/io/file_access.h"
#include "core/io/marshalls.h"
-#include "core/os/file_access.h"
void AudioStreamPlaybackSample::start(float p_from_pos) {
if (base->format == AudioStreamSample::FORMAT_IMA_ADPCM) {
diff --git a/scene/resources/mesh_data_tool.h b/scene/resources/mesh_data_tool.h
index f5c8f11437..b0ebfba7ee 100644
--- a/scene/resources/mesh_data_tool.h
+++ b/scene/resources/mesh_data_tool.h
@@ -33,8 +33,8 @@
#include "scene/resources/mesh.h"
-class MeshDataTool : public Reference {
- GDCLASS(MeshDataTool, Reference);
+class MeshDataTool : public RefCounted {
+ GDCLASS(MeshDataTool, RefCounted);
int format = 0;
struct Vertex {
diff --git a/scene/resources/packed_scene.h b/scene/resources/packed_scene.h
index 78a0aeaa9a..e85b933439 100644
--- a/scene/resources/packed_scene.h
+++ b/scene/resources/packed_scene.h
@@ -34,8 +34,8 @@
#include "core/io/resource.h"
#include "scene/main/node.h"
-class SceneState : public Reference {
- GDCLASS(SceneState, Reference);
+class SceneState : public RefCounted {
+ GDCLASS(SceneState, RefCounted);
Vector<StringName> names;
Vector<Variant> variants;
diff --git a/scene/resources/resource_format_text.cpp b/scene/resources/resource_format_text.cpp
index 2414704a57..2a60f54fdd 100644
--- a/scene/resources/resource_format_text.cpp
+++ b/scene/resources/resource_format_text.cpp
@@ -31,14 +31,14 @@
#include "resource_format_text.h"
#include "core/config/project_settings.h"
+#include "core/io/dir_access.h"
#include "core/io/resource_format_binary.h"
-#include "core/os/dir_access.h"
#include "core/version.h"
//version 2: changed names for basis, aabb, Vectors, etc.
#define FORMAT_VERSION 2
-#include "core/os/dir_access.h"
+#include "core/io/dir_access.h"
#include "core/version.h"
#define _printerr() ERR_PRINT(String(res_path + ":" + itos(lines) + " - Parse Error: " + error_text).utf8().get_data());
diff --git a/scene/resources/resource_format_text.h b/scene/resources/resource_format_text.h
index 2dc683415d..f5d9cca859 100644
--- a/scene/resources/resource_format_text.h
+++ b/scene/resources/resource_format_text.h
@@ -31,9 +31,9 @@
#ifndef RESOURCE_FORMAT_TEXT_H
#define RESOURCE_FORMAT_TEXT_H
+#include "core/io/file_access.h"
#include "core/io/resource_loader.h"
#include "core/io/resource_saver.h"
-#include "core/os/file_access.h"
#include "core/variant/variant_parser.h"
#include "scene/resources/packed_scene.h"
diff --git a/scene/resources/shader.cpp b/scene/resources/shader.cpp
index 0ad21b0f0f..cbd44315b7 100644
--- a/scene/resources/shader.cpp
+++ b/scene/resources/shader.cpp
@@ -30,7 +30,7 @@
#include "shader.h"
-#include "core/os/file_access.h"
+#include "core/io/file_access.h"
#include "scene/scene_string_names.h"
#include "servers/rendering/shader_language.h"
#include "servers/rendering_server.h"
diff --git a/scene/resources/skeleton_modification_2d.cpp b/scene/resources/skeleton_modification_2d.cpp
index 9b07293965..b52a60006a 100644
--- a/scene/resources/skeleton_modification_2d.cpp
+++ b/scene/resources/skeleton_modification_2d.cpp
@@ -216,7 +216,9 @@ void SkeletonModification2D::set_editor_draw_gizmo(bool p_draw_gizmo) {
editor_draw_gizmo = p_draw_gizmo;
#ifdef TOOLS_ENABLED
if (is_setup) {
- stack->set_editor_gizmos_dirty(true);
+ if (stack) {
+ stack->set_editor_gizmos_dirty(true);
+ }
}
#endif // TOOLS_ENABLED
}
diff --git a/scene/resources/skeleton_modification_stack_2d.cpp b/scene/resources/skeleton_modification_stack_2d.cpp
index d12ec4add3..72c1c330ef 100644
--- a/scene/resources/skeleton_modification_stack_2d.cpp
+++ b/scene/resources/skeleton_modification_stack_2d.cpp
@@ -160,6 +160,8 @@ Ref<SkeletonModification2D> SkeletonModificationStack2D::get_modification(int p_
}
void SkeletonModificationStack2D::add_modification(Ref<SkeletonModification2D> p_mod) {
+ ERR_FAIL_COND(!p_mod.is_valid());
+
p_mod->_setup_modification(this);
modifications.push_back(p_mod);
diff --git a/scene/resources/style_box.cpp b/scene/resources/style_box.cpp
index 2159f1bc97..87371224e0 100644
--- a/scene/resources/style_box.cpp
+++ b/scene/resources/style_box.cpp
@@ -121,7 +121,6 @@ void StyleBoxTexture::set_texture(Ref<Texture2D> p_texture) {
} else {
region_rect = Rect2(Point2(), texture->get_size());
}
- emit_signal("texture_changed");
emit_changed();
}
@@ -285,8 +284,6 @@ void StyleBoxTexture::_bind_methods() {
ClassDB::bind_method(D_METHOD("set_v_axis_stretch_mode", "mode"), &StyleBoxTexture::set_v_axis_stretch_mode);
ClassDB::bind_method(D_METHOD("get_v_axis_stretch_mode"), &StyleBoxTexture::get_v_axis_stretch_mode);
- ADD_SIGNAL(MethodInfo("texture_changed"));
-
ADD_PROPERTY(PropertyInfo(Variant::OBJECT, "texture", PROPERTY_HINT_RESOURCE_TYPE, "Texture2D"), "set_texture", "get_texture");
ADD_PROPERTY(PropertyInfo(Variant::RECT2, "region_rect"), "set_region_rect", "get_region_rect");
ADD_GROUP("Margin", "margin_");
diff --git a/scene/resources/surface_tool.cpp b/scene/resources/surface_tool.cpp
index f728376310..1e78561bec 100644
--- a/scene/resources/surface_tool.cpp
+++ b/scene/resources/surface_tool.cpp
@@ -370,13 +370,13 @@ Array SurfaceTool::commit_to_arrays() {
for (uint32_t idx = 0; idx < vertex_array.size(); idx++) {
const Vertex &v = vertex_array[idx];
- w[idx + 0] = v.tangent.x;
- w[idx + 1] = v.tangent.y;
- w[idx + 2] = v.tangent.z;
+ w[idx * 4 + 0] = v.tangent.x;
+ w[idx * 4 + 1] = v.tangent.y;
+ w[idx * 4 + 2] = v.tangent.z;
//float d = v.tangent.dot(v.binormal,v.normal);
float d = v.binormal.dot(v.normal.cross(v.tangent));
- w[idx + 3] = d < 0 ? -1 : 1;
+ w[idx * 4 + 3] = d < 0 ? -1 : 1;
}
a[i] = array;
diff --git a/scene/resources/surface_tool.h b/scene/resources/surface_tool.h
index 4674f0cc69..bde6702759 100644
--- a/scene/resources/surface_tool.h
+++ b/scene/resources/surface_tool.h
@@ -35,8 +35,8 @@
#include "scene/resources/mesh.h"
#include "thirdparty/misc/mikktspace.h"
-class SurfaceTool : public Reference {
- GDCLASS(SurfaceTool, Reference);
+class SurfaceTool : public RefCounted {
+ GDCLASS(SurfaceTool, RefCounted);
public:
struct Vertex {
diff --git a/scene/resources/text_file.cpp b/scene/resources/text_file.cpp
index 564c65adb9..33bb0a83e9 100644
--- a/scene/resources/text_file.cpp
+++ b/scene/resources/text_file.cpp
@@ -30,7 +30,7 @@
#include "text_file.h"
-#include "core/os/file_access.h"
+#include "core/io/file_access.h"
bool TextFile::has_text() const {
return text != "";
diff --git a/scene/resources/text_line.h b/scene/resources/text_line.h
index 74d4f2c32c..1b5c1a3123 100644
--- a/scene/resources/text_line.h
+++ b/scene/resources/text_line.h
@@ -36,8 +36,8 @@
/*************************************************************************/
-class TextLine : public Reference {
- GDCLASS(TextLine, Reference);
+class TextLine : public RefCounted {
+ GDCLASS(TextLine, RefCounted);
RID rid;
int spacing_top = 0;
diff --git a/scene/resources/text_paragraph.h b/scene/resources/text_paragraph.h
index 4396b07130..a34e745090 100644
--- a/scene/resources/text_paragraph.h
+++ b/scene/resources/text_paragraph.h
@@ -36,8 +36,8 @@
/*************************************************************************/
-class TextParagraph : public Reference {
- GDCLASS(TextParagraph, Reference);
+class TextParagraph : public RefCounted {
+ GDCLASS(TextParagraph, RefCounted);
RID dropcap_rid;
int dropcap_lines = 0;
diff --git a/scene/resources/texture.cpp b/scene/resources/texture.cpp
index 4475179431..064563d4b5 100644
--- a/scene/resources/texture.cpp
+++ b/scene/resources/texture.cpp
@@ -327,7 +327,7 @@ Ref<Image> StreamTexture2D::load_image_from_file(FileAccess *f, int p_size_limit
uint32_t mipmaps = f->get_32();
Image::Format format = Image::Format(f->get_32());
- if (data_format == DATA_FORMAT_LOSSLESS || data_format == DATA_FORMAT_LOSSY || data_format == DATA_FORMAT_BASIS_UNIVERSAL) {
+ if (data_format == DATA_FORMAT_PNG || data_format == DATA_FORMAT_WEBP || data_format == DATA_FORMAT_BASIS_UNIVERSAL) {
//look for a PNG or WEBP file inside
int sw = w;
@@ -360,10 +360,10 @@ Ref<Image> StreamTexture2D::load_image_from_file(FileAccess *f, int p_size_limit
Ref<Image> img;
if (data_format == DATA_FORMAT_BASIS_UNIVERSAL) {
img = Image::basis_universal_unpacker(pv);
- } else if (data_format == DATA_FORMAT_LOSSLESS) {
- img = Image::lossless_unpacker(pv);
+ } else if (data_format == DATA_FORMAT_PNG) {
+ img = Image::png_unpacker(pv);
} else {
- img = Image::lossy_unpacker(pv);
+ img = Image::webp_unpacker(pv);
}
if (img.is_null() || img->is_empty()) {
diff --git a/scene/resources/texture.h b/scene/resources/texture.h
index df8c00f8ff..3b1815266d 100644
--- a/scene/resources/texture.h
+++ b/scene/resources/texture.h
@@ -31,10 +31,10 @@
#ifndef TEXTURE_H
#define TEXTURE_H
+#include "core/io/file_access.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"
@@ -136,8 +136,8 @@ class StreamTexture2D : public Texture2D {
public:
enum DataFormat {
DATA_FORMAT_IMAGE,
- DATA_FORMAT_LOSSLESS,
- DATA_FORMAT_LOSSY,
+ DATA_FORMAT_PNG,
+ DATA_FORMAT_WEBP,
DATA_FORMAT_BASIS_UNIVERSAL,
};
@@ -146,9 +146,6 @@ public:
};
enum FormatBits {
- FORMAT_MASK_IMAGE_FORMAT = (1 << 20) - 1,
- FORMAT_BIT_LOSSLESS = 1 << 20,
- FORMAT_BIT_LOSSY = 1 << 21,
FORMAT_BIT_STREAM = 1 << 22,
FORMAT_BIT_HAS_MIPMAPS = 1 << 23,
FORMAT_BIT_DETECT_3D = 1 << 24,
@@ -389,8 +386,8 @@ class StreamTextureLayered : public TextureLayered {
public:
enum DataFormat {
DATA_FORMAT_IMAGE,
- DATA_FORMAT_LOSSLESS,
- DATA_FORMAT_LOSSY,
+ DATA_FORMAT_PNG,
+ DATA_FORMAT_WEBP,
DATA_FORMAT_BASIS_UNIVERSAL,
};
@@ -399,9 +396,6 @@ public:
};
enum FormatBits {
- FORMAT_MASK_IMAGE_FORMAT = (1 << 20) - 1,
- FORMAT_BIT_LOSSLESS = 1 << 20,
- FORMAT_BIT_LOSSY = 1 << 21,
FORMAT_BIT_STREAM = 1 << 22,
FORMAT_BIT_HAS_MIPMAPS = 1 << 23,
};
@@ -532,8 +526,8 @@ class StreamTexture3D : public Texture3D {
public:
enum DataFormat {
DATA_FORMAT_IMAGE,
- DATA_FORMAT_LOSSLESS,
- DATA_FORMAT_LOSSY,
+ DATA_FORMAT_PNG,
+ DATA_FORMAT_WEBP,
DATA_FORMAT_BASIS_UNIVERSAL,
};
@@ -542,9 +536,6 @@ public:
};
enum FormatBits {
- FORMAT_MASK_IMAGE_FORMAT = (1 << 20) - 1,
- FORMAT_BIT_LOSSLESS = 1 << 20,
- FORMAT_BIT_LOSSY = 1 << 21,
FORMAT_BIT_STREAM = 1 << 22,
FORMAT_BIT_HAS_MIPMAPS = 1 << 23,
};
diff --git a/scene/resources/theme.cpp b/scene/resources/theme.cpp
index 12309f7488..89ac033207 100644
--- a/scene/resources/theme.cpp
+++ b/scene/resources/theme.cpp
@@ -29,10 +29,15 @@
/*************************************************************************/
#include "theme.h"
-#include "core/os/file_access.h"
+#include "core/io/file_access.h"
#include "core/string/print_string.h"
void Theme::_emit_theme_changed() {
+ if (no_change_propagation) {
+ return;
+ }
+
+ notify_property_list_changed();
emit_changed();
}
@@ -415,8 +420,7 @@ void Theme::set_default_theme_font(const Ref<Font> &p_default_font) {
default_theme_font->connect("changed", callable_mp(this, &Theme::_emit_theme_changed), varray(), CONNECT_REFERENCE_COUNTED);
}
- notify_property_list_changed();
- emit_changed();
+ _emit_theme_changed();
}
Ref<Font> Theme::get_default_theme_font() const {
@@ -430,8 +434,7 @@ void Theme::set_default_theme_font_size(int p_font_size) {
default_theme_font_size = p_font_size;
- notify_property_list_changed();
- emit_changed();
+ _emit_theme_changed();
}
int Theme::get_default_theme_font_size() const {
@@ -478,8 +481,6 @@ void Theme::set_default_font_size(int p_font_size) {
}
void Theme::set_icon(const StringName &p_name, const StringName &p_theme_type, const Ref<Texture2D> &p_icon) {
- bool new_value = !icon_map.has(p_theme_type) || !icon_map[p_theme_type].has(p_name);
-
if (icon_map[p_theme_type].has(p_name) && icon_map[p_theme_type][p_name].is_valid()) {
icon_map[p_theme_type][p_name]->disconnect("changed", callable_mp(this, &Theme::_emit_theme_changed));
}
@@ -490,10 +491,7 @@ void Theme::set_icon(const StringName &p_name, const StringName &p_theme_type, c
icon_map[p_theme_type][p_name]->connect("changed", callable_mp(this, &Theme::_emit_theme_changed), varray(), CONNECT_REFERENCE_COUNTED);
}
- if (new_value) {
- notify_property_list_changed();
- emit_changed();
- }
+ _emit_theme_changed();
}
Ref<Texture2D> Theme::get_icon(const StringName &p_name, const StringName &p_theme_type) const {
@@ -520,8 +518,7 @@ void Theme::rename_icon(const StringName &p_old_name, const StringName &p_name,
icon_map[p_theme_type][p_name] = icon_map[p_theme_type][p_old_name];
icon_map[p_theme_type].erase(p_old_name);
- notify_property_list_changed();
- emit_changed();
+ _emit_theme_changed();
}
void Theme::clear_icon(const StringName &p_name, const StringName &p_theme_type) {
@@ -534,8 +531,7 @@ void Theme::clear_icon(const StringName &p_name, const StringName &p_theme_type)
icon_map[p_theme_type].erase(p_name);
- notify_property_list_changed();
- emit_changed();
+ _emit_theme_changed();
}
void Theme::get_icon_list(StringName p_theme_type, List<StringName> *p_list) const {
@@ -569,8 +565,6 @@ void Theme::get_icon_type_list(List<StringName> *p_list) const {
}
void Theme::set_stylebox(const StringName &p_name, const StringName &p_theme_type, const Ref<StyleBox> &p_style) {
- bool new_value = !style_map.has(p_theme_type) || !style_map[p_theme_type].has(p_name);
-
if (style_map[p_theme_type].has(p_name) && style_map[p_theme_type][p_name].is_valid()) {
style_map[p_theme_type][p_name]->disconnect("changed", callable_mp(this, &Theme::_emit_theme_changed));
}
@@ -581,10 +575,7 @@ void Theme::set_stylebox(const StringName &p_name, const StringName &p_theme_typ
style_map[p_theme_type][p_name]->connect("changed", callable_mp(this, &Theme::_emit_theme_changed), varray(), CONNECT_REFERENCE_COUNTED);
}
- if (new_value) {
- notify_property_list_changed();
- }
- emit_changed();
+ _emit_theme_changed();
}
Ref<StyleBox> Theme::get_stylebox(const StringName &p_name, const StringName &p_theme_type) const {
@@ -611,8 +602,7 @@ void Theme::rename_stylebox(const StringName &p_old_name, const StringName &p_na
style_map[p_theme_type][p_name] = style_map[p_theme_type][p_old_name];
style_map[p_theme_type].erase(p_old_name);
- notify_property_list_changed();
- emit_changed();
+ _emit_theme_changed();
}
void Theme::clear_stylebox(const StringName &p_name, const StringName &p_theme_type) {
@@ -625,8 +615,7 @@ void Theme::clear_stylebox(const StringName &p_name, const StringName &p_theme_t
style_map[p_theme_type].erase(p_name);
- notify_property_list_changed();
- emit_changed();
+ _emit_theme_changed();
}
void Theme::get_stylebox_list(StringName p_theme_type, List<StringName> *p_list) const {
@@ -660,8 +649,6 @@ void Theme::get_stylebox_type_list(List<StringName> *p_list) const {
}
void Theme::set_font(const StringName &p_name, const StringName &p_theme_type, const Ref<Font> &p_font) {
- bool new_value = !font_map.has(p_theme_type) || !font_map[p_theme_type].has(p_name);
-
if (font_map[p_theme_type][p_name].is_valid()) {
font_map[p_theme_type][p_name]->disconnect("changed", callable_mp(this, &Theme::_emit_theme_changed));
}
@@ -672,10 +659,7 @@ void Theme::set_font(const StringName &p_name, const StringName &p_theme_type, c
font_map[p_theme_type][p_name]->connect("changed", callable_mp(this, &Theme::_emit_theme_changed), varray(), CONNECT_REFERENCE_COUNTED);
}
- if (new_value) {
- notify_property_list_changed();
- emit_changed();
- }
+ _emit_theme_changed();
}
Ref<Font> Theme::get_font(const StringName &p_name, const StringName &p_theme_type) const {
@@ -704,8 +688,7 @@ void Theme::rename_font(const StringName &p_old_name, const StringName &p_name,
font_map[p_theme_type][p_name] = font_map[p_theme_type][p_old_name];
font_map[p_theme_type].erase(p_old_name);
- notify_property_list_changed();
- emit_changed();
+ _emit_theme_changed();
}
void Theme::clear_font(const StringName &p_name, const StringName &p_theme_type) {
@@ -717,8 +700,8 @@ void Theme::clear_font(const StringName &p_name, const StringName &p_theme_type)
}
font_map[p_theme_type].erase(p_name);
- notify_property_list_changed();
- emit_changed();
+
+ _emit_theme_changed();
}
void Theme::get_font_list(StringName p_theme_type, List<StringName> *p_list) const {
@@ -752,14 +735,9 @@ void Theme::get_font_type_list(List<StringName> *p_list) const {
}
void Theme::set_font_size(const StringName &p_name, const StringName &p_theme_type, int p_font_size) {
- bool new_value = !font_size_map.has(p_theme_type) || !font_size_map[p_theme_type].has(p_name);
-
font_size_map[p_theme_type][p_name] = p_font_size;
- if (new_value) {
- notify_property_list_changed();
- emit_changed();
- }
+ _emit_theme_changed();
}
int Theme::get_font_size(const StringName &p_name, const StringName &p_theme_type) const {
@@ -788,8 +766,7 @@ void Theme::rename_font_size(const StringName &p_old_name, const StringName &p_n
font_size_map[p_theme_type][p_name] = font_size_map[p_theme_type][p_old_name];
font_size_map[p_theme_type].erase(p_old_name);
- notify_property_list_changed();
- emit_changed();
+ _emit_theme_changed();
}
void Theme::clear_font_size(const StringName &p_name, const StringName &p_theme_type) {
@@ -797,8 +774,8 @@ void Theme::clear_font_size(const StringName &p_name, const StringName &p_theme_
ERR_FAIL_COND_MSG(!font_size_map[p_theme_type].has(p_name), "Cannot clear the font size '" + String(p_name) + "' because it does not exist.");
font_size_map[p_theme_type].erase(p_name);
- notify_property_list_changed();
- emit_changed();
+
+ _emit_theme_changed();
}
void Theme::get_font_size_list(StringName p_theme_type, List<StringName> *p_list) const {
@@ -832,14 +809,9 @@ void Theme::get_font_size_type_list(List<StringName> *p_list) const {
}
void Theme::set_color(const StringName &p_name, const StringName &p_theme_type, const Color &p_color) {
- bool new_value = !color_map.has(p_theme_type) || !color_map[p_theme_type].has(p_name);
-
color_map[p_theme_type][p_name] = p_color;
- if (new_value) {
- notify_property_list_changed();
- emit_changed();
- }
+ _emit_theme_changed();
}
Color Theme::get_color(const StringName &p_name, const StringName &p_theme_type) const {
@@ -866,8 +838,7 @@ void Theme::rename_color(const StringName &p_old_name, const StringName &p_name,
color_map[p_theme_type][p_name] = color_map[p_theme_type][p_old_name];
color_map[p_theme_type].erase(p_old_name);
- notify_property_list_changed();
- emit_changed();
+ _emit_theme_changed();
}
void Theme::clear_color(const StringName &p_name, const StringName &p_theme_type) {
@@ -875,8 +846,8 @@ void Theme::clear_color(const StringName &p_name, const StringName &p_theme_type
ERR_FAIL_COND_MSG(!color_map[p_theme_type].has(p_name), "Cannot clear the color '" + String(p_name) + "' because it does not exist.");
color_map[p_theme_type].erase(p_name);
- notify_property_list_changed();
- emit_changed();
+
+ _emit_theme_changed();
}
void Theme::get_color_list(StringName p_theme_type, List<StringName> *p_list) const {
@@ -910,13 +881,9 @@ void Theme::get_color_type_list(List<StringName> *p_list) const {
}
void Theme::set_constant(const StringName &p_name, const StringName &p_theme_type, int p_constant) {
- bool new_value = !constant_map.has(p_theme_type) || !constant_map[p_theme_type].has(p_name);
constant_map[p_theme_type][p_name] = p_constant;
- if (new_value) {
- notify_property_list_changed();
- emit_changed();
- }
+ _emit_theme_changed();
}
int Theme::get_constant(const StringName &p_name, const StringName &p_theme_type) const {
@@ -943,8 +910,7 @@ void Theme::rename_constant(const StringName &p_old_name, const StringName &p_na
constant_map[p_theme_type][p_name] = constant_map[p_theme_type][p_old_name];
constant_map[p_theme_type].erase(p_old_name);
- notify_property_list_changed();
- emit_changed();
+ _emit_theme_changed();
}
void Theme::clear_constant(const StringName &p_name, const StringName &p_theme_type) {
@@ -952,8 +918,8 @@ void Theme::clear_constant(const StringName &p_name, const StringName &p_theme_t
ERR_FAIL_COND_MSG(!constant_map[p_theme_type].has(p_name), "Cannot clear the constant '" + String(p_name) + "' because it does not exist.");
constant_map[p_theme_type].erase(p_name);
- notify_property_list_changed();
- emit_changed();
+
+ _emit_theme_changed();
}
void Theme::get_constant_list(StringName p_theme_type, List<StringName> *p_list) const {
@@ -1217,8 +1183,17 @@ void Theme::get_theme_item_type_list(DataType p_data_type, List<StringName> *p_l
}
}
+void Theme::_freeze_change_propagation() {
+ no_change_propagation = true;
+}
+
+void Theme::_unfreeze_and_propagate_changes() {
+ no_change_propagation = false;
+ _emit_theme_changed();
+}
+
void Theme::clear() {
- //these need disconnecting
+ // These items need disconnecting.
{
const StringName *K = nullptr;
while ((K = icon_map.next(K))) {
@@ -1264,8 +1239,7 @@ void Theme::clear() {
color_map.clear();
constant_map.clear();
- notify_property_list_changed();
- emit_changed();
+ _emit_theme_changed();
}
void Theme::copy_default_theme() {
@@ -1279,6 +1253,8 @@ void Theme::copy_theme(const Ref<Theme> &p_other) {
return;
}
+ _freeze_change_propagation();
+
// These items need reconnecting, so add them normally.
{
const StringName *K = nullptr;
@@ -1315,8 +1291,7 @@ void Theme::copy_theme(const Ref<Theme> &p_other) {
color_map = p_other->color_map;
constant_map = p_other->constant_map;
- notify_property_list_changed();
- emit_changed();
+ _unfreeze_and_propagate_changes();
}
void Theme::get_type_list(List<StringName> *p_list) const {
diff --git a/scene/resources/theme.h b/scene/resources/theme.h
index 4de1f065e1..fe64fd7290 100644
--- a/scene/resources/theme.h
+++ b/scene/resources/theme.h
@@ -41,6 +41,12 @@ class Theme : public Resource {
GDCLASS(Theme, Resource);
RES_BASE_EXTENSION("theme");
+#ifdef TOOLS_ENABLED
+ friend class ThemeItemImportTree;
+ friend class ThemeItemEditorDialog;
+ friend class ThemeTypeEditor;
+#endif
+
public:
enum DataType {
DATA_TYPE_COLOR,
@@ -53,6 +59,8 @@ public:
};
private:
+ bool no_change_propagation = false;
+
void _emit_theme_changed();
HashMap<StringName, HashMap<StringName, Ref<Texture2D>>> icon_map;
@@ -96,6 +104,9 @@ protected:
static void _bind_methods();
+ void _freeze_change_propagation();
+ void _unfreeze_and_propagate_changes();
+
virtual void reset_state() override;
public:
diff --git a/scene/resources/tile_set.cpp b/scene/resources/tile_set.cpp
index 2220df06f6..0d6f3c07f0 100644
--- a/scene/resources/tile_set.cpp
+++ b/scene/resources/tile_set.cpp
@@ -2454,6 +2454,7 @@ int TileData::get_terrain_set() const {
}
void TileData::set_peering_bit_terrain(TileSet::CellNeighbor p_peering_bit, int p_terrain_index) {
+ ERR_FAIL_INDEX(p_peering_bit, TileSet::CELL_NEIGHBOR_MAX);
ERR_FAIL_COND(p_terrain_index < -1);
if (tile_set) {
ERR_FAIL_COND(p_terrain_index >= tile_set->get_terrains_count(terrain_set));
@@ -2464,6 +2465,7 @@ void TileData::set_peering_bit_terrain(TileSet::CellNeighbor p_peering_bit, int
}
int TileData::get_peering_bit_terrain(TileSet::CellNeighbor p_peering_bit) const {
+ ERR_FAIL_INDEX_V(p_peering_bit, TileSet::CELL_NEIGHBOR_MAX, -1);
return terrain_peering_bits[p_peering_bit];
}
diff --git a/scene/scene_string_names.cpp b/scene/scene_string_names.cpp
index 7575ccd5c3..8acab79c9e 100644
--- a/scene/scene_string_names.cpp
+++ b/scene/scene_string_names.cpp
@@ -155,13 +155,13 @@ SceneStringNames::SceneStringNames() {
area_entered = StaticCString::create("area_entered");
area_exited = StaticCString::create("area_exited");
- has_point = StaticCString::create("has_point");
+ _has_point = StaticCString::create("_has_point");
line_separation = StaticCString::create("line_separation");
- get_drag_data = StaticCString::create("get_drag_data");
- drop_data = StaticCString::create("drop_data");
- can_drop_data = StaticCString::create("can_drop_data");
+ _get_drag_data = StaticCString::create("_get_drag_data");
+ _drop_data = StaticCString::create("_drop_data");
+ _can_drop_data = StaticCString::create("_can_drop_data");
_im_update = StaticCString::create("_im_update"); // Sprite3D
@@ -175,6 +175,7 @@ SceneStringNames::SceneStringNames() {
_toggled = StaticCString::create("_toggled");
frame_changed = StaticCString::create("frame_changed");
+ texture_changed = StaticCString::create("texture_changed");
playback_speed = StaticCString::create("playback/speed");
playback_active = StaticCString::create("playback/active");
diff --git a/scene/scene_string_names.h b/scene/scene_string_names.h
index a5b489eddc..0c528a45f7 100644
--- a/scene/scene_string_names.h
+++ b/scene/scene_string_names.h
@@ -138,10 +138,10 @@ public:
StringName grouped;
StringName ungrouped;
- StringName has_point;
- StringName get_drag_data;
- StringName can_drop_data;
- StringName drop_data;
+ StringName _has_point;
+ StringName _get_drag_data;
+ StringName _can_drop_data;
+ StringName _drop_data;
StringName screen_entered;
StringName screen_exited;
@@ -184,6 +184,7 @@ public:
StringName _mouse_exit;
StringName frame_changed;
+ StringName texture_changed;
StringName playback_speed;
StringName playback_active;
diff --git a/servers/audio/audio_effect.h b/servers/audio/audio_effect.h
index 4556db9b93..5d14f03199 100644
--- a/servers/audio/audio_effect.h
+++ b/servers/audio/audio_effect.h
@@ -34,8 +34,8 @@
#include "core/io/resource.h"
#include "core/math/audio_frame.h"
-class AudioEffectInstance : public Reference {
- GDCLASS(AudioEffectInstance, Reference);
+class AudioEffectInstance : public RefCounted {
+ GDCLASS(AudioEffectInstance, RefCounted);
public:
virtual void process(const AudioFrame *p_src_frames, AudioFrame *p_dst_frames, int p_frame_count) = 0;
diff --git a/servers/audio/audio_stream.h b/servers/audio/audio_stream.h
index 93566783be..0d426f99b2 100644
--- a/servers/audio/audio_stream.h
+++ b/servers/audio/audio_stream.h
@@ -36,8 +36,8 @@
#include "servers/audio/audio_filter_sw.h"
#include "servers/audio_server.h"
-class AudioStreamPlayback : public Reference {
- GDCLASS(AudioStreamPlayback, Reference);
+class AudioStreamPlayback : public RefCounted {
+ GDCLASS(AudioStreamPlayback, RefCounted);
public:
virtual void start(float p_from_pos = 0.0) = 0;
diff --git a/servers/audio/effects/audio_effect_capture.h b/servers/audio/effects/audio_effect_capture.h
index 81d4ed6b0f..82686d5b4c 100644
--- a/servers/audio/effects/audio_effect_capture.h
+++ b/servers/audio/effects/audio_effect_capture.h
@@ -33,7 +33,7 @@
#include "core/config/engine.h"
#include "core/math/audio_frame.h"
-#include "core/object/reference.h"
+#include "core/object/ref_counted.h"
#include "core/templates/vector.h"
#include "servers/audio/audio_effect.h"
#include "servers/audio_server.h"
diff --git a/servers/audio/effects/audio_effect_record.h b/servers/audio/effects/audio_effect_record.h
index b97ec43946..8f56e227e0 100644
--- a/servers/audio/effects/audio_effect_record.h
+++ b/servers/audio/effects/audio_effect_record.h
@@ -31,8 +31,8 @@
#ifndef AUDIOEFFECTRECORD_H
#define AUDIOEFFECTRECORD_H
+#include "core/io/file_access.h"
#include "core/io/marshalls.h"
-#include "core/os/file_access.h"
#include "core/os/os.h"
#include "core/os/thread.h"
#include "editor/import/resource_importer_wav.h"
diff --git a/servers/audio_server.cpp b/servers/audio_server.cpp
index 0e816fd4f8..acfdfa783a 100644
--- a/servers/audio_server.cpp
+++ b/servers/audio_server.cpp
@@ -32,8 +32,8 @@
#include "core/config/project_settings.h"
#include "core/debugger/engine_debugger.h"
+#include "core/io/file_access.h"
#include "core/io/resource_loader.h"
-#include "core/os/file_access.h"
#include "core/os/os.h"
#include "scene/resources/audio_stream_sample.h"
#include "servers/audio/audio_driver_dummy.h"
diff --git a/servers/camera/camera_feed.h b/servers/camera/camera_feed.h
index eb4ef155bc..fac7ae1b2d 100644
--- a/servers/camera/camera_feed.h
+++ b/servers/camera/camera_feed.h
@@ -43,8 +43,8 @@
camera feeds that can be used as the background for our environment.
**/
-class CameraFeed : public Reference {
- GDCLASS(CameraFeed, Reference);
+class CameraFeed : public RefCounted {
+ GDCLASS(CameraFeed, RefCounted);
public:
enum FeedDataType {
diff --git a/servers/camera_server.h b/servers/camera_server.h
index 97aa8f74ba..7390129df9 100644
--- a/servers/camera_server.h
+++ b/servers/camera_server.h
@@ -32,7 +32,7 @@
#define CAMERA_SERVER_H
#include "core/object/class_db.h"
-#include "core/object/reference.h"
+#include "core/object/ref_counted.h"
#include "core/os/thread_safe.h"
#include "core/templates/rid.h"
#include "core/variant/variant.h"
diff --git a/servers/physics_server_2d.h b/servers/physics_server_2d.h
index 35430e4a46..df39d6ae50 100644
--- a/servers/physics_server_2d.h
+++ b/servers/physics_server_2d.h
@@ -33,7 +33,7 @@
#include "core/io/resource.h"
#include "core/object/class_db.h"
-#include "core/object/reference.h"
+#include "core/object/ref_counted.h"
class PhysicsDirectSpaceState2D;
@@ -95,8 +95,8 @@ public:
class PhysicsShapeQueryResult2D;
//used for script
-class PhysicsShapeQueryParameters2D : public Reference {
- GDCLASS(PhysicsShapeQueryParameters2D, Reference);
+class PhysicsShapeQueryParameters2D : public RefCounted {
+ GDCLASS(PhysicsShapeQueryParameters2D, RefCounted);
friend class PhysicsDirectSpaceState2D;
RES shape_ref;
@@ -203,8 +203,8 @@ public:
PhysicsDirectSpaceState2D();
};
-class PhysicsShapeQueryResult2D : public Reference {
- GDCLASS(PhysicsShapeQueryResult2D, Reference);
+class PhysicsShapeQueryResult2D : public RefCounted {
+ GDCLASS(PhysicsShapeQueryResult2D, RefCounted);
Vector<PhysicsDirectSpaceState2D::ShapeResult> result;
@@ -597,8 +597,8 @@ public:
~PhysicsServer2D();
};
-class PhysicsTestMotionResult2D : public Reference {
- GDCLASS(PhysicsTestMotionResult2D, Reference);
+class PhysicsTestMotionResult2D : public RefCounted {
+ GDCLASS(PhysicsTestMotionResult2D, RefCounted);
PhysicsServer2D::MotionResult result;
friend class PhysicsServer2D;
diff --git a/servers/physics_server_3d.h b/servers/physics_server_3d.h
index ec4914641a..d9b805de87 100644
--- a/servers/physics_server_3d.h
+++ b/servers/physics_server_3d.h
@@ -96,8 +96,8 @@ public:
class PhysicsShapeQueryResult3D;
-class PhysicsShapeQueryParameters3D : public Reference {
- GDCLASS(PhysicsShapeQueryParameters3D, Reference);
+class PhysicsShapeQueryParameters3D : public RefCounted {
+ GDCLASS(PhysicsShapeQueryParameters3D, RefCounted);
friend class PhysicsDirectSpaceState3D;
RES shape_ref;
@@ -196,8 +196,8 @@ public:
PhysicsDirectSpaceState3D();
};
-class PhysicsShapeQueryResult3D : public Reference {
- GDCLASS(PhysicsShapeQueryResult3D, Reference);
+class PhysicsShapeQueryResult3D : public RefCounted {
+ GDCLASS(PhysicsShapeQueryResult3D, RefCounted);
Vector<PhysicsDirectSpaceState3D::ShapeResult> result;
diff --git a/servers/rendering/rasterizer_dummy.h b/servers/rendering/rasterizer_dummy.h
index 96c9137c6e..b44088e822 100644
--- a/servers/rendering/rasterizer_dummy.h
+++ b/servers/rendering/rasterizer_dummy.h
@@ -175,7 +175,7 @@ public:
void voxel_gi_set_quality(RS::VoxelGIQuality) override {}
- void render_scene(RID p_render_buffers, const Transform3D &p_cam_transform, const CameraMatrix &p_cam_projection, bool p_cam_ortogonal, const PagedArray<GeometryInstance *> &p_instances, const PagedArray<RID> &p_lights, const PagedArray<RID> &p_reflection_probes, const PagedArray<RID> &p_voxel_gi_instances, const PagedArray<RID> &p_decals, const PagedArray<RID> &p_lightmaps, RID p_environment, RID p_camera_effects, RID p_shadow_atlas, RID p_occluder_debug_tex, RID p_reflection_atlas, RID p_reflection_probe, int p_reflection_probe_pass, float p_screen_lod_threshold, const RenderShadowData *p_render_shadows, int p_render_shadow_count, const RenderSDFGIData *p_render_sdfgi_regions, int p_render_sdfgi_region_count, const RenderSDFGIUpdateData *p_sdfgi_update_data = nullptr) override {}
+ void render_scene(RID p_render_buffers, const CameraData *p_camera_data, const PagedArray<GeometryInstance *> &p_instances, const PagedArray<RID> &p_lights, const PagedArray<RID> &p_reflection_probes, const PagedArray<RID> &p_voxel_gi_instances, const PagedArray<RID> &p_decals, const PagedArray<RID> &p_lightmaps, RID p_environment, RID p_camera_effects, RID p_shadow_atlas, RID p_occluder_debug_tex, RID p_reflection_atlas, RID p_reflection_probe, int p_reflection_probe_pass, float p_screen_lod_threshold, const RenderShadowData *p_render_shadows, int p_render_shadow_count, const RenderSDFGIData *p_render_sdfgi_regions, int p_render_sdfgi_region_count, const RenderSDFGIUpdateData *p_sdfgi_update_data = nullptr) override {}
void render_material(const Transform3D &p_cam_transform, const CameraMatrix &p_cam_projection, bool p_cam_ortogonal, const PagedArray<GeometryInstance *> &p_instances, RID p_framebuffer, const Rect2i &p_region) override {}
void render_particle_collider_heightfield(RID p_collider, const Transform3D &p_transform, const PagedArray<GeometryInstance *> &p_instances) override {}
@@ -184,7 +184,7 @@ public:
void set_debug_draw_mode(RS::ViewportDebugDraw p_debug_draw) override {}
RID render_buffers_create() override { return RID(); }
- void render_buffers_configure(RID p_render_buffers, RID p_render_target, int p_width, int p_height, RS::ViewportMSAA p_msaa, RS::ViewportScreenSpaceAA p_screen_space_aa, bool p_use_debanding) override {}
+ void render_buffers_configure(RID p_render_buffers, RID p_render_target, int p_width, int p_height, RS::ViewportMSAA p_msaa, RS::ViewportScreenSpaceAA p_screen_space_aa, bool p_use_debanding, uint32_t p_view_count) override {}
void gi_set_use_half_resolution(bool p_enable) override {}
void screen_space_roughness_limiter_set_active(bool p_enable, float p_amount, float p_curve) override {}
@@ -649,7 +649,7 @@ public:
RID render_target_create() override { return RID(); }
void render_target_set_position(RID p_render_target, int p_x, int p_y) override {}
- void render_target_set_size(RID p_render_target, int p_width, int p_height) override {}
+ void render_target_set_size(RID p_render_target, int p_width, int p_height, uint32_t p_view_count) override {}
RID render_target_get_texture(RID p_render_target) override { return RID(); }
void render_target_set_external_texture(RID p_render_target, unsigned int p_texture_id) override {}
void render_target_set_flag(RID p_render_target, RenderTargetFlags p_flag, bool p_value) override {}
diff --git a/servers/rendering/renderer_compositor.cpp b/servers/rendering/renderer_compositor.cpp
index 8861522d34..80c4625261 100644
--- a/servers/rendering/renderer_compositor.cpp
+++ b/servers/rendering/renderer_compositor.cpp
@@ -30,6 +30,7 @@
#include "renderer_compositor.h"
+#include "core/config/project_settings.h"
#include "core/os/os.h"
#include "core/string/print_string.h"
@@ -39,4 +40,12 @@ RendererCompositor *RendererCompositor::create() {
return _create_func();
}
+bool RendererCompositor::is_xr_enabled() const {
+ return xr_enabled;
+}
+
+RendererCompositor::RendererCompositor() {
+ xr_enabled = GLOBAL_GET("rendering/xr/enabled");
+}
+
RendererCanvasRender *RendererCanvasRender::singleton = nullptr;
diff --git a/servers/rendering/renderer_compositor.h b/servers/rendering/renderer_compositor.h
index 41aaba0f4c..eabdebf4b3 100644
--- a/servers/rendering/renderer_compositor.h
+++ b/servers/rendering/renderer_compositor.h
@@ -40,7 +40,31 @@
#include "servers/rendering/renderer_storage.h"
#include "servers/rendering_server.h"
+struct BlitToScreen {
+ RID render_target;
+ Rect2i rect;
+
+ struct {
+ bool use_layer = false;
+ uint32_t layer = 0;
+ } multi_view;
+
+ struct {
+ //lens distorted parameters for VR
+ bool apply = false;
+ Vector2 eye_center;
+ float k1 = 0.0;
+ float k2 = 0.0;
+
+ float upscale = 1.0;
+ float aspect_ratio = 1.0;
+ } lens_distortion;
+};
+
class RendererCompositor {
+private:
+ bool xr_enabled = false;
+
protected:
static RendererCompositor *(*_create_func)();
@@ -56,27 +80,6 @@ public:
virtual void initialize() = 0;
virtual void begin_frame(double frame_step) = 0;
- struct BlitToScreen {
- RID render_target;
- Rect2i rect;
-
- struct {
- bool use_layer = false;
- uint32_t layer = 0;
- } multi_view;
-
- struct {
- //lens distorted parameters for VR
- bool apply = false;
- Vector2 eye_center;
- float k1 = 0.0;
- float k2 = 0.0;
-
- float upscale = 1.0;
- float aspect_ratio = 1.0;
- } lens_distortion;
- };
-
virtual void prepare_for_blitting_render_targets() = 0;
virtual void blit_render_targets_to_screen(DisplayServer::WindowID p_screen, const BlitToScreen *p_render_targets, int p_amount) = 0;
@@ -86,7 +89,9 @@ public:
virtual float get_frame_delta_time() const = 0;
virtual bool is_low_end() const = 0;
+ virtual bool is_xr_enabled() const;
+ RendererCompositor();
virtual ~RendererCompositor() {}
};
diff --git a/servers/rendering/renderer_rd/effects_rd.cpp b/servers/rendering/renderer_rd/effects_rd.cpp
index 872f7b5beb..4fd5520e56 100644
--- a/servers/rendering/renderer_rd/effects_rd.cpp
+++ b/servers/rendering/renderer_rd/effects_rd.cpp
@@ -34,6 +34,7 @@
#include "core/math/math_defs.h"
#include "core/os/os.h"
+#include "servers/rendering/renderer_rd/renderer_compositor_rd.h"
#include "thirdparty/misc/cubemap_coeffs.h"
static _FORCE_INLINE_ void store_transform_3x3(const Basis &p_basis, float *p_array) {
@@ -732,6 +733,11 @@ void EffectsRD::tonemapper(RID p_source_color, RID p_dst_framebuffer, const Tone
tonemap.push_constant.pixel_size[0] = 1.0 / p_settings.texture_size.x;
tonemap.push_constant.pixel_size[1] = 1.0 / p_settings.texture_size.y;
+ if (p_settings.view_count > 1) {
+ // Use MULTIVIEW versions
+ mode += 4;
+ }
+
RD::DrawListID draw_list = RD::get_singleton()->draw_list_begin(p_dst_framebuffer, RD::INITIAL_ACTION_DROP, RD::FINAL_ACTION_READ, RD::INITIAL_ACTION_DROP, RD::FINAL_ACTION_DISCARD);
RD::get_singleton()->draw_list_bind_render_pipeline(draw_list, tonemap.pipelines[mode].get_render_pipeline(RD::INVALID_ID, RD::get_singleton()->framebuffer_get_format(p_dst_framebuffer)));
RD::get_singleton()->draw_list_bind_uniform_set(draw_list, _get_uniform_set_from_texture(p_source_color), 0);
@@ -934,10 +940,10 @@ void EffectsRD::bokeh_dof(RID p_base_texture, RID p_depth_texture, const Size2i
RD::get_singleton()->compute_list_end();
}
-void EffectsRD::gather_ssao(RD::ComputeListID p_compute_list, const Vector<RID> p_ao_slices, const SSAOSettings &p_settings, bool p_adaptive_base_pass) {
- RD::get_singleton()->compute_list_bind_uniform_set(p_compute_list, ssao.gather_uniform_set, 0);
+void EffectsRD::gather_ssao(RD::ComputeListID p_compute_list, const Vector<RID> p_ao_slices, const SSAOSettings &p_settings, bool p_adaptive_base_pass, RID p_gather_uniform_set, RID p_importance_map_uniform_set) {
+ RD::get_singleton()->compute_list_bind_uniform_set(p_compute_list, p_gather_uniform_set, 0);
if ((p_settings.quality == RS::ENV_SSAO_QUALITY_ULTRA) && !p_adaptive_base_pass) {
- RD::get_singleton()->compute_list_bind_uniform_set(p_compute_list, ssao.importance_map_uniform_set, 1);
+ RD::get_singleton()->compute_list_bind_uniform_set(p_compute_list, p_importance_map_uniform_set, 1);
}
for (int i = 0; i < 4; i++) {
@@ -960,7 +966,7 @@ void EffectsRD::gather_ssao(RD::ComputeListID p_compute_list, const Vector<RID>
RD::get_singleton()->compute_list_add_barrier(p_compute_list);
}
-void EffectsRD::generate_ssao(RID p_depth_buffer, RID p_normal_buffer, RID p_depth_mipmaps_texture, const Vector<RID> &p_depth_mipmaps, RID p_ao, const Vector<RID> p_ao_slices, RID p_ao_pong, const Vector<RID> p_ao_pong_slices, RID p_upscale_buffer, RID p_importance_map, RID p_importance_map_pong, const CameraMatrix &p_projection, const SSAOSettings &p_settings, bool p_invalidate_uniform_sets) {
+void EffectsRD::generate_ssao(RID p_depth_buffer, RID p_normal_buffer, RID p_depth_mipmaps_texture, const Vector<RID> &p_depth_mipmaps, RID p_ao, const Vector<RID> p_ao_slices, RID p_ao_pong, const Vector<RID> p_ao_pong_slices, RID p_upscale_buffer, RID p_importance_map, RID p_importance_map_pong, const CameraMatrix &p_projection, const SSAOSettings &p_settings, bool p_invalidate_uniform_sets, RID &r_downsample_uniform_set, RID &r_gather_uniform_set, RID &r_importance_map_uniform_set) {
RD::ComputeListID compute_list = RD::get_singleton()->compute_list_begin();
RD::get_singleton()->draw_command_begin_label("SSAO");
/* FIRST PASS */
@@ -990,7 +996,7 @@ void EffectsRD::generate_ssao(RID p_depth_buffer, RID p_normal_buffer, RID p_dep
u.ids.push_back(p_depth_mipmaps[3]);
uniforms.push_back(u);
}
- ssao.downsample_uniform_set = RD::get_singleton()->uniform_set_create(uniforms, ssao.downsample_shader.version_get_shader(ssao.downsample_shader_version, 2), 2);
+ r_downsample_uniform_set = RD::get_singleton()->uniform_set_create(uniforms, ssao.downsample_shader.version_get_shader(ssao.downsample_shader_version, 2), 2);
}
float depth_linearize_mul = -p_projection.matrix[3][2];
@@ -1025,7 +1031,7 @@ void EffectsRD::generate_ssao(RID p_depth_buffer, RID p_normal_buffer, RID p_dep
RD::get_singleton()->compute_list_bind_uniform_set(compute_list, _get_compute_uniform_set_from_texture(p_depth_buffer), 0);
RD::get_singleton()->compute_list_bind_uniform_set(compute_list, _get_uniform_set_from_image(p_depth_mipmaps[0]), 1);
if (p_settings.quality > RS::ENV_SSAO_QUALITY_MEDIUM) {
- RD::get_singleton()->compute_list_bind_uniform_set(compute_list, ssao.downsample_uniform_set, 2);
+ RD::get_singleton()->compute_list_bind_uniform_set(compute_list, r_downsample_uniform_set, 2);
}
RD::get_singleton()->compute_list_set_push_constant(compute_list, &ssao.downsample_push_constant, sizeof(SSAODownsamplePushConstant));
@@ -1109,7 +1115,7 @@ void EffectsRD::generate_ssao(RID p_depth_buffer, RID p_normal_buffer, RID p_dep
u.ids.push_back(ssao.gather_constants_buffer);
uniforms.push_back(u);
}
- ssao.gather_uniform_set = RD::get_singleton()->uniform_set_create(uniforms, ssao.gather_shader.version_get_shader(ssao.gather_shader_version, 0), 0);
+ r_gather_uniform_set = RD::get_singleton()->uniform_set_create(uniforms, ssao.gather_shader.version_get_shader(ssao.gather_shader_version, 0), 0);
}
if (p_invalidate_uniform_sets) {
@@ -1136,7 +1142,7 @@ void EffectsRD::generate_ssao(RID p_depth_buffer, RID p_normal_buffer, RID p_dep
u.ids.push_back(ssao.importance_map_load_counter);
uniforms.push_back(u);
}
- ssao.importance_map_uniform_set = RD::get_singleton()->uniform_set_create(uniforms, ssao.gather_shader.version_get_shader(ssao.gather_shader_version, 2), 1);
+ r_importance_map_uniform_set = RD::get_singleton()->uniform_set_create(uniforms, ssao.gather_shader.version_get_shader(ssao.gather_shader_version, 2), 1);
}
if (p_settings.quality == RS::ENV_SSAO_QUALITY_ULTRA) {
@@ -1147,7 +1153,7 @@ void EffectsRD::generate_ssao(RID p_depth_buffer, RID p_normal_buffer, RID p_dep
ssao.importance_map_push_constant.power = p_settings.power;
//base pass
RD::get_singleton()->compute_list_bind_compute_pipeline(compute_list, ssao.pipelines[SSAO_GATHER_BASE]);
- gather_ssao(compute_list, p_ao_pong_slices, p_settings, true);
+ gather_ssao(compute_list, p_ao_pong_slices, p_settings, true, r_gather_uniform_set, RID());
//generate importance map
RD::get_singleton()->compute_list_bind_compute_pipeline(compute_list, ssao.pipelines[SSAO_GENERATE_IMPORTANCE_MAP]);
@@ -1178,7 +1184,7 @@ void EffectsRD::generate_ssao(RID p_depth_buffer, RID p_normal_buffer, RID p_dep
RD::get_singleton()->compute_list_bind_compute_pipeline(compute_list, ssao.pipelines[SSAO_GATHER]);
}
- gather_ssao(compute_list, p_ao_slices, p_settings, false);
+ gather_ssao(compute_list, p_ao_slices, p_settings, false, r_gather_uniform_set, r_importance_map_uniform_set);
RD::get_singleton()->draw_command_end_label(); // Gather SSAO
}
@@ -1365,15 +1371,18 @@ void EffectsRD::cubemap_filter(RID p_source_cubemap, Vector<RID> p_dest_cubemap,
RD::get_singleton()->compute_list_end();
}
-void EffectsRD::render_sky(RD::DrawListID p_list, float p_time, RID p_fb, RID p_samplers, RID p_fog, PipelineCacheRD *p_pipeline, RID p_uniform_set, RID p_texture_set, const CameraMatrix &p_camera, const Basis &p_orientation, float p_multiplier, const Vector3 &p_position) {
+void EffectsRD::render_sky(RD::DrawListID p_list, float p_time, RID p_fb, RID p_samplers, RID p_fog, PipelineCacheRD *p_pipeline, RID p_uniform_set, RID p_texture_set, uint32_t p_view_count, const CameraMatrix *p_projections, const Basis &p_orientation, float p_multiplier, const Vector3 &p_position) {
SkyPushConstant sky_push_constant;
memset(&sky_push_constant, 0, sizeof(SkyPushConstant));
- sky_push_constant.proj[0] = p_camera.matrix[2][0];
- sky_push_constant.proj[1] = p_camera.matrix[0][0];
- sky_push_constant.proj[2] = p_camera.matrix[2][1];
- sky_push_constant.proj[3] = p_camera.matrix[1][1];
+ for (uint32_t v = 0; v < p_view_count; v++) {
+ // We only need key components of our projection matrix
+ sky_push_constant.projections[v][0] = p_projections[v].matrix[2][0];
+ sky_push_constant.projections[v][1] = p_projections[v].matrix[0][0];
+ sky_push_constant.projections[v][2] = p_projections[v].matrix[2][1];
+ sky_push_constant.projections[v][3] = p_projections[v].matrix[1][1];
+ }
sky_push_constant.position[0] = p_position.x;
sky_push_constant.position[1] = p_position.y;
sky_push_constant.position[2] = p_position.z;
@@ -1553,12 +1562,29 @@ EffectsRD::EffectsRD() {
tonemap_modes.push_back("\n#define USE_1D_LUT\n");
tonemap_modes.push_back("\n#define USE_GLOW_FILTER_BICUBIC\n#define USE_1D_LUT\n");
+ // multiview versions of our shaders
+ tonemap_modes.push_back("\n#define MULTIVIEW\n");
+ tonemap_modes.push_back("\n#define MULTIVIEW\n#define USE_GLOW_FILTER_BICUBIC\n");
+ tonemap_modes.push_back("\n#define MULTIVIEW\n#define USE_1D_LUT\n");
+ tonemap_modes.push_back("\n#define MULTIVIEW\n#define USE_GLOW_FILTER_BICUBIC\n#define USE_1D_LUT\n");
+
tonemap.shader.initialize(tonemap_modes);
+ if (!RendererCompositorRD::singleton->is_xr_enabled()) {
+ tonemap.shader.set_variant_enabled(TONEMAP_MODE_NORMAL_MULTIVIEW, false);
+ tonemap.shader.set_variant_enabled(TONEMAP_MODE_BICUBIC_GLOW_FILTER_MULTIVIEW, false);
+ tonemap.shader.set_variant_enabled(TONEMAP_MODE_1D_LUT_MULTIVIEW, false);
+ tonemap.shader.set_variant_enabled(TONEMAP_MODE_BICUBIC_GLOW_FILTER_1D_LUT_MULTIVIEW, false);
+ }
+
tonemap.shader_version = tonemap.shader.version_create();
for (int i = 0; i < TONEMAP_MODE_MAX; i++) {
- tonemap.pipelines[i].setup(tonemap.shader.version_get_shader(tonemap.shader_version, i), RD::RENDER_PRIMITIVE_TRIANGLES, RD::PipelineRasterizationState(), RD::PipelineMultisampleState(), RD::PipelineDepthStencilState(), RD::PipelineColorBlendState::create_disabled(), 0);
+ if (tonemap.shader.is_variant_enabled(i)) {
+ tonemap.pipelines[i].setup(tonemap.shader.version_get_shader(tonemap.shader_version, i), RD::RENDER_PRIMITIVE_TRIANGLES, RD::PipelineRasterizationState(), RD::PipelineMultisampleState(), RD::PipelineDepthStencilState(), RD::PipelineColorBlendState::create_disabled(), 0);
+ } else {
+ tonemap.pipelines[i].clear();
+ }
}
}
diff --git a/servers/rendering/renderer_rd/effects_rd.h b/servers/rendering/renderer_rd/effects_rd.h
index ab0100f8f9..8b31ffbbd0 100644
--- a/servers/rendering/renderer_rd/effects_rd.h
+++ b/servers/rendering/renderer_rd/effects_rd.h
@@ -55,6 +55,7 @@
#include "servers/rendering/renderer_rd/shaders/ssao_interleave.glsl.gen.h"
#include "servers/rendering/renderer_rd/shaders/subsurface_scattering.glsl.gen.h"
#include "servers/rendering/renderer_rd/shaders/tonemap.glsl.gen.h"
+#include "servers/rendering/renderer_scene_render.h"
#include "servers/rendering_server.h"
@@ -170,6 +171,12 @@ class EffectsRD {
TONEMAP_MODE_BICUBIC_GLOW_FILTER,
TONEMAP_MODE_1D_LUT,
TONEMAP_MODE_BICUBIC_GLOW_FILTER_1D_LUT,
+
+ TONEMAP_MODE_NORMAL_MULTIVIEW,
+ TONEMAP_MODE_BICUBIC_GLOW_FILTER_MULTIVIEW,
+ TONEMAP_MODE_1D_LUT_MULTIVIEW,
+ TONEMAP_MODE_BICUBIC_GLOW_FILTER_1D_LUT_MULTIVIEW,
+
TONEMAP_MODE_MAX
};
@@ -378,12 +385,10 @@ class EffectsRD {
SSAODownsamplePushConstant downsample_push_constant;
SsaoDownsampleShaderRD downsample_shader;
RID downsample_shader_version;
- RID downsample_uniform_set;
SSAOGatherPushConstant gather_push_constant;
SsaoShaderRD gather_shader;
RID gather_shader_version;
- RID gather_uniform_set;
RID gather_constants_buffer;
bool gather_initialized = false;
@@ -391,7 +396,6 @@ class EffectsRD {
SsaoImportanceMapShaderRD importance_map_shader;
RID importance_map_shader_version;
RID importance_map_load_counter;
- RID importance_map_uniform_set;
RID counter_uniform_set;
SSAOBlurPushConstant blur_push_constant;
@@ -453,12 +457,12 @@ class EffectsRD {
} filter;
struct SkyPushConstant {
- float orientation[12];
- float proj[4];
- float position[3];
- float multiplier;
- float time;
- float pad[3];
+ float orientation[12]; // 48 - 48
+ float projections[RendererSceneRender::MAX_RENDER_VIEWS][4]; // 2 x 16 - 64, if we ever need more then 3 we should consider adding this to a set.
+ float position[3]; // 12 - 92
+ float multiplier; // 4 - 96
+ float time; // 4 - 100
+ float pad[3]; // 12 - 112
};
enum SpecularMergeMode {
@@ -714,6 +718,7 @@ public:
bool use_fxaa = false;
bool use_debanding = false;
Vector2i texture_size;
+ uint32_t view_count = 1;
};
struct SSAOSettings {
@@ -738,13 +743,13 @@ public:
void tonemapper(RID p_source_color, RID p_dst_framebuffer, const TonemapSettings &p_settings);
- void gather_ssao(RD::ComputeListID p_compute_list, const Vector<RID> p_ao_slices, const SSAOSettings &p_settings, bool p_adaptive_base_pass);
- void generate_ssao(RID p_depth_buffer, RID p_normal_buffer, RID p_depth_mipmaps_texture, const Vector<RID> &depth_mipmaps, RID p_ao, const Vector<RID> p_ao_slices, RID p_ao_pong, const Vector<RID> p_ao_pong_slices, RID p_upscale_buffer, RID p_importance_map, RID p_importance_map_pong, const CameraMatrix &p_projection, const SSAOSettings &p_settings, bool p_invalidate_uniform_sets);
+ void gather_ssao(RD::ComputeListID p_compute_list, const Vector<RID> p_ao_slices, const SSAOSettings &p_settings, bool p_adaptive_base_pass, RID p_gather_uniform_set, RID p_importance_map_uniform_set);
+ void generate_ssao(RID p_depth_buffer, RID p_normal_buffer, RID p_depth_mipmaps_texture, const Vector<RID> &depth_mipmaps, RID p_ao, const Vector<RID> p_ao_slices, RID p_ao_pong, const Vector<RID> p_ao_pong_slices, RID p_upscale_buffer, RID p_importance_map, RID p_importance_map_pong, const CameraMatrix &p_projection, const SSAOSettings &p_settings, bool p_invalidate_uniform_sets, RID &r_downsample_uniform_set, RID &r_gather_uniform_set, RID &r_importance_map_uniform_set);
void roughness_limit(RID p_source_normal, RID p_roughness, const Size2i &p_size, float p_curve);
void cubemap_downsample(RID p_source_cubemap, RID p_dest_cubemap, const Size2i &p_size);
void cubemap_filter(RID p_source_cubemap, Vector<RID> p_dest_cubemap, bool p_use_array);
- void render_sky(RD::DrawListID p_list, float p_time, RID p_fb, RID p_samplers, RID p_fog, PipelineCacheRD *p_pipeline, RID p_uniform_set, RID p_texture_set, const CameraMatrix &p_camera, const Basis &p_orientation, float p_multiplier, const Vector3 &p_position);
+ void render_sky(RD::DrawListID p_list, float p_time, RID p_fb, RID p_samplers, RID p_fog, PipelineCacheRD *p_pipeline, RID p_uniform_set, RID p_texture_set, uint32_t p_view_count, const CameraMatrix *p_projections, const Basis &p_orientation, float p_multiplier, const Vector3 &p_position);
void screen_space_reflection(RID p_diffuse, RID p_normal_roughness, RS::EnvironmentSSRRoughnessQuality p_roughness_quality, RID p_blur_radius, RID p_blur_radius2, RID p_metallic, const Color &p_metallic_mask, RID p_depth, RID p_scale_depth, RID p_scale_normal, RID p_output, RID p_output_blur, const Size2i &p_screen_size, int p_max_steps, float p_fade_in, float p_fade_out, float p_tolerance, const CameraMatrix &p_camera);
void merge_specular(RID p_dest_framebuffer, RID p_specular, RID p_base, RID p_reflection);
diff --git a/servers/rendering/renderer_rd/forward_clustered/render_forward_clustered.cpp b/servers/rendering/renderer_rd/forward_clustered/render_forward_clustered.cpp
index e1c2836f6c..1653453c5c 100644
--- a/servers/rendering/renderer_rd/forward_clustered/render_forward_clustered.cpp
+++ b/servers/rendering/renderer_rd/forward_clustered/render_forward_clustered.cpp
@@ -183,9 +183,11 @@ void RenderForwardClustered::RenderBufferDataForwardClustered::clear() {
}
}
-void RenderForwardClustered::RenderBufferDataForwardClustered::configure(RID p_color_buffer, RID p_depth_buffer, int p_width, int p_height, RS::ViewportMSAA p_msaa) {
+void RenderForwardClustered::RenderBufferDataForwardClustered::configure(RID p_color_buffer, RID p_depth_buffer, int p_width, int p_height, RS::ViewportMSAA p_msaa, uint32_t p_view_count) {
clear();
+ ERR_FAIL_COND_MSG(p_view_count != 1, "Multiple views is currently not supported in this renderer, please use the mobile renderer for VR support");
+
msaa = p_msaa;
width = p_width;
@@ -1091,6 +1093,8 @@ void RenderForwardClustered::_setup_lightmaps(const PagedArray<RID> &p_lightmaps
}
void RenderForwardClustered::_render_scene(RenderDataRD *p_render_data, const Color &p_default_bg_color) {
+ ERR_FAIL_COND_MSG(p_render_data->view_count != 1, "Multiview is currently not supported in the clustered renderer. Please use the mobile renderer for VR.");
+
RenderBufferDataForwardClustered *render_buffer = nullptr;
if (p_render_data->render_buffers.is_valid()) {
render_buffer = (RenderBufferDataForwardClustered *)render_buffers_get_data(p_render_data->render_buffers);
@@ -1431,7 +1435,7 @@ void RenderForwardClustered::_render_scene(RenderDataRD *p_render_data, const Co
projection = correction * p_render_data->cam_projection;
}
RD::get_singleton()->draw_command_begin_label("Draw Sky");
- sky.draw(env, can_continue_color, can_continue_depth, opaque_framebuffer, projection, p_render_data->cam_transform, time);
+ sky.draw(env, can_continue_color, can_continue_depth, opaque_framebuffer, 1, &projection, p_render_data->cam_transform, time);
RD::get_singleton()->draw_command_end_label();
}
diff --git a/servers/rendering/renderer_rd/forward_clustered/render_forward_clustered.h b/servers/rendering/renderer_rd/forward_clustered/render_forward_clustered.h
index e276e55de2..579c8de05e 100644
--- a/servers/rendering/renderer_rd/forward_clustered/render_forward_clustered.h
+++ b/servers/rendering/renderer_rd/forward_clustered/render_forward_clustered.h
@@ -103,7 +103,7 @@ class RenderForwardClustered : public RendererSceneRenderRD {
void ensure_specular();
void ensure_voxelgi();
void clear();
- virtual void configure(RID p_color_buffer, RID p_depth_buffer, int p_width, int p_height, RS::ViewportMSAA p_msaa);
+ virtual void configure(RID p_color_buffer, RID p_depth_buffer, int p_width, int p_height, RS::ViewportMSAA p_msaa, uint32_t p_view_count);
~RenderBufferDataForwardClustered();
};
@@ -204,7 +204,6 @@ class RenderForwardClustered : public RendererSceneRenderRD {
struct UBO {
float projection_matrix[16];
float inv_projection_matrix[16];
-
float camera_matrix[16];
float inv_camera_matrix[16];
diff --git a/servers/rendering/renderer_rd/forward_clustered/scene_shader_forward_clustered.cpp b/servers/rendering/renderer_rd/forward_clustered/scene_shader_forward_clustered.cpp
index dcfdf14784..f125931df8 100644
--- a/servers/rendering/renderer_rd/forward_clustered/scene_shader_forward_clustered.cpp
+++ b/servers/rendering/renderer_rd/forward_clustered/scene_shader_forward_clustered.cpp
@@ -560,17 +560,18 @@ void SceneShaderForwardClustered::init(RendererStorageRD *p_storage, const Strin
{
Vector<String> shader_versions;
- shader_versions.push_back("\n#define MODE_RENDER_DEPTH\n");
- shader_versions.push_back("\n#define MODE_RENDER_DEPTH\n#define MODE_DUAL_PARABOLOID\n");
- shader_versions.push_back("\n#define MODE_RENDER_DEPTH\n#define MODE_RENDER_NORMAL_ROUGHNESS\n");
- shader_versions.push_back("\n#define MODE_RENDER_DEPTH\n#define MODE_RENDER_NORMAL_ROUGHNESS\n#define MODE_RENDER_VOXEL_GI\n");
- shader_versions.push_back("\n#define MODE_RENDER_DEPTH\n#define MODE_RENDER_MATERIAL\n");
- shader_versions.push_back("\n#define MODE_RENDER_DEPTH\n#define MODE_RENDER_SDF\n");
- shader_versions.push_back("");
- shader_versions.push_back("\n#define USE_FORWARD_GI\n");
- shader_versions.push_back("\n#define MODE_MULTIPLE_RENDER_TARGETS\n");
- shader_versions.push_back("\n#define USE_LIGHTMAP\n");
- shader_versions.push_back("\n#define MODE_MULTIPLE_RENDER_TARGETS\n#define USE_LIGHTMAP\n");
+ shader_versions.push_back("\n#define MODE_RENDER_DEPTH\n"); // SHADER_VERSION_DEPTH_PASS
+ shader_versions.push_back("\n#define MODE_RENDER_DEPTH\n#define MODE_DUAL_PARABOLOID\n"); // SHADER_VERSION_DEPTH_PASS_DP
+ shader_versions.push_back("\n#define MODE_RENDER_DEPTH\n#define MODE_RENDER_NORMAL_ROUGHNESS\n"); // SHADER_VERSION_DEPTH_PASS_WITH_NORMAL_AND_ROUGHNESS
+ shader_versions.push_back("\n#define MODE_RENDER_DEPTH\n#define MODE_RENDER_NORMAL_ROUGHNESS\n#define MODE_RENDER_VOXEL_GI\n"); // SHADER_VERSION_DEPTH_PASS_WITH_NORMAL_AND_ROUGHNESS_AND_GIPROBE
+ shader_versions.push_back("\n#define MODE_RENDER_DEPTH\n#define MODE_RENDER_MATERIAL\n"); // SHADER_VERSION_DEPTH_PASS_WITH_MATERIAL
+ shader_versions.push_back("\n#define MODE_RENDER_DEPTH\n#define MODE_RENDER_SDF\n"); // SHADER_VERSION_DEPTH_PASS_WITH_SDF
+ shader_versions.push_back(""); // SHADER_VERSION_COLOR_PASS
+ shader_versions.push_back("\n#define USE_FORWARD_GI\n"); // SHADER_VERSION_COLOR_PASS_WITH_FORWARD_GI
+ shader_versions.push_back("\n#define MODE_MULTIPLE_RENDER_TARGETS\n"); // SHADER_VERSION_COLOR_PASS_WITH_SEPARATE_SPECULAR
+ shader_versions.push_back("\n#define USE_LIGHTMAP\n"); // SHADER_VERSION_LIGHTMAP_COLOR_PASS
+ shader_versions.push_back("\n#define MODE_MULTIPLE_RENDER_TARGETS\n#define USE_LIGHTMAP\n"); // SHADER_VERSION_LIGHTMAP_COLOR_PASS_WITH_SEPARATE_SPECULAR
+
shader.initialize(shader_versions, p_defines);
}
@@ -656,6 +657,11 @@ void SceneShaderForwardClustered::init(RendererStorageRD *p_storage, const Strin
actions.renames["CUSTOM2"] = "custom2_attrib";
actions.renames["CUSTOM3"] = "custom3_attrib";
+ // not implemented but need these just in case code is in the shaders
+ actions.renames["VIEW_INDEX"] = "0";
+ actions.renames["VIEW_MONO_LEFT"] = "0";
+ actions.renames["VIEW_RIGHT"] = "1";
+
//for light
actions.renames["VIEW"] = "view";
actions.renames["LIGHT_COLOR"] = "light_color";
diff --git a/servers/rendering/renderer_rd/forward_clustered/scene_shader_forward_clustered.h b/servers/rendering/renderer_rd/forward_clustered/scene_shader_forward_clustered.h
index 6845133825..8add9f8095 100644
--- a/servers/rendering/renderer_rd/forward_clustered/scene_shader_forward_clustered.h
+++ b/servers/rendering/renderer_rd/forward_clustered/scene_shader_forward_clustered.h
@@ -56,6 +56,7 @@ public:
SHADER_VERSION_COLOR_PASS_WITH_SEPARATE_SPECULAR,
SHADER_VERSION_LIGHTMAP_COLOR_PASS,
SHADER_VERSION_LIGHTMAP_COLOR_PASS_WITH_SEPARATE_SPECULAR,
+
SHADER_VERSION_MAX
};
diff --git a/servers/rendering/renderer_rd/forward_mobile/render_forward_mobile.cpp b/servers/rendering/renderer_rd/forward_mobile/render_forward_mobile.cpp
index 370d8eca4e..ae09d215ff 100644
--- a/servers/rendering/renderer_rd/forward_mobile/render_forward_mobile.cpp
+++ b/servers/rendering/renderer_rd/forward_mobile/render_forward_mobile.cpp
@@ -53,13 +53,14 @@ void RenderForwardMobile::RenderBufferDataForwardMobile::clear() {
color_fb = RID();
}
-void RenderForwardMobile::RenderBufferDataForwardMobile::configure(RID p_color_buffer, RID p_depth_buffer, int p_width, int p_height, RS::ViewportMSAA p_msaa) {
+void RenderForwardMobile::RenderBufferDataForwardMobile::configure(RID p_color_buffer, RID p_depth_buffer, int p_width, int p_height, RS::ViewportMSAA p_msaa, uint32_t p_view_count) {
clear();
msaa = p_msaa;
width = p_width;
height = p_height;
+ view_count = p_view_count;
color = p_color_buffer;
depth = p_depth_buffer;
@@ -71,13 +72,18 @@ void RenderForwardMobile::RenderBufferDataForwardMobile::configure(RID p_color_b
fb.push_back(p_color_buffer);
fb.push_back(depth);
- color_fb = RD::get_singleton()->framebuffer_create(fb);
+ color_fb = RD::get_singleton()->framebuffer_create(fb, RenderingDevice::INVALID_ID, view_count);
} else {
RD::TextureFormat tf;
+ if (view_count > 1) {
+ tf.texture_type = RD::TEXTURE_TYPE_2D_ARRAY;
+ } else {
+ tf.texture_type = RD::TEXTURE_TYPE_2D;
+ }
tf.format = RD::DATA_FORMAT_R16G16B16A16_SFLOAT;
tf.width = p_width;
tf.height = p_height;
- tf.texture_type = RD::TEXTURE_TYPE_2D;
+ tf.array_layers = view_count; // create a layer for every view
tf.usage_bits = RD::TEXTURE_USAGE_COLOR_ATTACHMENT_BIT | RD::TEXTURE_USAGE_CAN_COPY_FROM_BIT | RD::TEXTURE_USAGE_SAMPLING_BIT;
RD::TextureSamples ts[RS::VIEWPORT_MSAA_MAX] = {
@@ -103,7 +109,7 @@ void RenderForwardMobile::RenderBufferDataForwardMobile::configure(RID p_color_b
fb.push_back(color_msaa);
fb.push_back(depth_msaa);
- color_fb = RD::get_singleton()->framebuffer_create(fb);
+ color_fb = RD::get_singleton()->framebuffer_create(fb, RenderingDevice::INVALID_ID, view_count);
}
}
}
@@ -479,7 +485,7 @@ void RenderForwardMobile::_render_scene(RenderDataRD *p_render_data, const Color
Vector<Color> c;
c.push_back(clear_color.to_linear());
- RenderListParameters render_list_params(render_list[RENDER_LIST_OPAQUE].elements.ptr(), render_list[RENDER_LIST_OPAQUE].element_info.ptr(), render_list[RENDER_LIST_OPAQUE].elements.size(), reverse_cull, PASS_MODE_COLOR, rp_uniform_set, get_debug_draw_mode() == RS::VIEWPORT_DEBUG_DRAW_WIREFRAME, Vector2(), p_render_data->lod_camera_plane, p_render_data->lod_distance_multiplier, p_render_data->screen_lod_threshold);
+ RenderListParameters render_list_params(render_list[RENDER_LIST_OPAQUE].elements.ptr(), render_list[RENDER_LIST_OPAQUE].element_info.ptr(), render_list[RENDER_LIST_OPAQUE].elements.size(), reverse_cull, PASS_MODE_COLOR, rp_uniform_set, get_debug_draw_mode() == RS::VIEWPORT_DEBUG_DRAW_WIREFRAME, Vector2(), p_render_data->lod_camera_plane, p_render_data->lod_distance_multiplier, p_render_data->screen_lod_threshold, p_render_data->view_count);
_render_list_with_threads(&render_list_params, opaque_framebuffer, keep_color ? RD::INITIAL_ACTION_KEEP : RD::INITIAL_ACTION_CLEAR, will_continue_color ? RD::FINAL_ACTION_CONTINUE : RD::FINAL_ACTION_READ, RD::INITIAL_ACTION_CLEAR, will_continue_depth ? RD::FINAL_ACTION_CONTINUE : RD::FINAL_ACTION_READ, c, 1.0, 0);
}
@@ -488,14 +494,16 @@ void RenderForwardMobile::_render_scene(RenderDataRD *p_render_data, const Color
if (draw_sky || draw_sky_fog_only) {
RENDER_TIMESTAMP("Render Sky");
- CameraMatrix projection = p_render_data->cam_projection;
+ RD::get_singleton()->draw_command_begin_label("Draw Sky");
+
if (p_render_data->reflection_probe.is_valid()) {
CameraMatrix correction;
correction.set_depth_correction(true);
- projection = correction * p_render_data->cam_projection;
+ CameraMatrix projection = correction * p_render_data->cam_projection;
+ sky.draw(env, can_continue_color, can_continue_depth, opaque_framebuffer, 1, &projection, p_render_data->cam_transform, time);
+ } else {
+ sky.draw(env, can_continue_color, can_continue_depth, opaque_framebuffer, p_render_data->view_count, p_render_data->view_projection, p_render_data->cam_transform, time);
}
- RD::get_singleton()->draw_command_begin_label("Draw Sky");
- sky.draw(env, can_continue_color, can_continue_depth, opaque_framebuffer, projection, p_render_data->cam_transform, time);
RD::get_singleton()->draw_command_end_label();
}
@@ -522,7 +530,7 @@ void RenderForwardMobile::_render_scene(RenderDataRD *p_render_data, const Color
_setup_environment(p_render_data, p_render_data->reflection_probe.is_valid(), screen_size, !p_render_data->reflection_probe.is_valid(), p_default_bg_color, false);
{
- RenderListParameters render_list_params(render_list[RENDER_LIST_ALPHA].elements.ptr(), render_list[RENDER_LIST_ALPHA].element_info.ptr(), render_list[RENDER_LIST_ALPHA].elements.size(), reverse_cull, PASS_MODE_COLOR, rp_uniform_set, get_debug_draw_mode() == RS::VIEWPORT_DEBUG_DRAW_WIREFRAME, Vector2(), p_render_data->lod_camera_plane, p_render_data->lod_distance_multiplier, p_render_data->screen_lod_threshold);
+ RenderListParameters render_list_params(render_list[RENDER_LIST_ALPHA].elements.ptr(), render_list[RENDER_LIST_ALPHA].element_info.ptr(), render_list[RENDER_LIST_ALPHA].elements.size(), reverse_cull, PASS_MODE_COLOR, rp_uniform_set, get_debug_draw_mode() == RS::VIEWPORT_DEBUG_DRAW_WIREFRAME, Vector2(), p_render_data->lod_camera_plane, p_render_data->lod_distance_multiplier, p_render_data->screen_lod_threshold, p_render_data->view_count);
_render_list_with_threads(&render_list_params, alpha_framebuffer, can_continue_color ? RD::INITIAL_ACTION_CONTINUE : RD::INITIAL_ACTION_KEEP, RD::FINAL_ACTION_READ, can_continue_depth ? RD::INITIAL_ACTION_CONTINUE : RD::INITIAL_ACTION_KEEP, RD::FINAL_ACTION_READ);
}
@@ -555,6 +563,7 @@ void RenderForwardMobile::_render_shadow_append(RID p_framebuffer, const PagedAr
RenderDataRD render_data;
render_data.cam_projection = p_projection;
render_data.cam_transform = p_transform;
+ render_data.view_projection[0] = p_projection;
render_data.z_near = 0.0;
render_data.z_far = p_zfar;
render_data.instances = &p_instances;
@@ -622,7 +631,7 @@ void RenderForwardMobile::_render_shadow_end(uint32_t p_barrier) {
for (uint32_t i = 0; i < scene_state.shadow_passes.size(); i++) {
SceneState::ShadowPass &shadow_pass = scene_state.shadow_passes[i];
- RenderListParameters render_list_parameters(render_list[RENDER_LIST_SECONDARY].elements.ptr() + shadow_pass.element_from, render_list[RENDER_LIST_SECONDARY].element_info.ptr() + shadow_pass.element_from, shadow_pass.element_count, shadow_pass.flip_cull, shadow_pass.pass_mode, shadow_pass.rp_uniform_set, false, Vector2(), shadow_pass.camera_plane, shadow_pass.lod_distance_multiplier, shadow_pass.screen_lod_threshold, shadow_pass.element_from, RD::BARRIER_MASK_NO_BARRIER);
+ RenderListParameters render_list_parameters(render_list[RENDER_LIST_SECONDARY].elements.ptr() + shadow_pass.element_from, render_list[RENDER_LIST_SECONDARY].element_info.ptr() + shadow_pass.element_from, shadow_pass.element_count, shadow_pass.flip_cull, shadow_pass.pass_mode, shadow_pass.rp_uniform_set, false, Vector2(), shadow_pass.camera_plane, shadow_pass.lod_distance_multiplier, shadow_pass.screen_lod_threshold, 1, shadow_pass.element_from, RD::BARRIER_MASK_NO_BARRIER);
_render_list_with_threads(&render_list_parameters, shadow_pass.framebuffer, RD::INITIAL_ACTION_DROP, RD::FINAL_ACTION_DISCARD, shadow_pass.initial_depth_action, shadow_pass.final_depth_action, Vector<Color>(), 1.0, 0, shadow_pass.rect);
}
@@ -647,6 +656,7 @@ void RenderForwardMobile::_render_material(const Transform3D &p_cam_transform, c
RenderDataRD render_data;
render_data.cam_projection = p_cam_projection;
render_data.cam_transform = p_cam_transform;
+ render_data.view_projection[0] = p_cam_projection;
render_data.instances = &p_instances;
_setup_environment(&render_data, true, Vector2(1, 1), false, Color());
@@ -757,6 +767,7 @@ void RenderForwardMobile::_render_particle_collider_heightfield(RID p_fb, const
RenderDataRD render_data;
render_data.cam_projection = p_cam_projection;
render_data.cam_transform = p_cam_transform;
+ render_data.view_projection[0] = p_cam_projection;
render_data.z_near = 0.0;
render_data.z_far = p_cam_projection.get_z_far();
render_data.instances = &p_instances;
@@ -1089,6 +1100,12 @@ void RenderForwardMobile::_setup_environment(const RenderDataRD *p_render_data,
RendererStorageRD::store_transform(p_render_data->cam_transform, scene_state.ubo.camera_matrix);
RendererStorageRD::store_transform(p_render_data->cam_transform.affine_inverse(), scene_state.ubo.inv_camera_matrix);
+ for (uint32_t v = 0; v < p_render_data->view_count; v++) {
+ projection = correction * p_render_data->view_projection[v];
+ RendererStorageRD::store_camera(projection, scene_state.ubo.projection_matrix_view[v]);
+ RendererStorageRD::store_camera(projection.inverse(), scene_state.ubo.inv_projection_matrix_view[v]);
+ }
+
scene_state.ubo.z_far = p_render_data->z_far;
scene_state.ubo.z_near = p_render_data->z_near;
@@ -1426,18 +1443,20 @@ void RenderForwardMobile::_render_list_template(RenderingDevice::DrawListID p_dr
case PASS_MODE_COLOR:
case PASS_MODE_COLOR_TRANSPARENT: {
if (element_info.uses_lightmap) {
- shader_version = SceneShaderForwardMobile::SHADER_VERSION_LIGHTMAP_COLOR_PASS;
+ shader_version = p_params->view_count > 1 ? SceneShaderForwardMobile::SHADER_VERSION_LIGHTMAP_COLOR_PASS_MULTIVIEW : SceneShaderForwardMobile::SHADER_VERSION_LIGHTMAP_COLOR_PASS;
} else {
- shader_version = SceneShaderForwardMobile::SHADER_VERSION_COLOR_PASS;
+ shader_version = p_params->view_count > 1 ? SceneShaderForwardMobile::SHADER_VERSION_COLOR_PASS_MULTIVIEW : SceneShaderForwardMobile::SHADER_VERSION_COLOR_PASS;
}
} break;
case PASS_MODE_SHADOW: {
- shader_version = SceneShaderForwardMobile::SHADER_VERSION_SHADOW_PASS;
+ shader_version = p_params->view_count > 1 ? SceneShaderForwardMobile::SHADER_VERSION_SHADOW_PASS_MULTIVIEW : SceneShaderForwardMobile::SHADER_VERSION_SHADOW_PASS;
} break;
case PASS_MODE_SHADOW_DP: {
- shader_version = SceneShaderForwardMobile::SHADER_VERSION_DEPTH_PASS_DP;
+ ERR_FAIL_COND_MSG(p_params->view_count > 1, "Multiview not supported for shadow DP pass");
+ shader_version = SceneShaderForwardMobile::SHADER_VERSION_SHADOW_PASS_DP;
} break;
case PASS_MODE_DEPTH_MATERIAL: {
+ ERR_FAIL_COND_MSG(p_params->view_count > 1, "Multiview not supported for material pass");
shader_version = SceneShaderForwardMobile::SHADER_VERSION_DEPTH_PASS_WITH_MATERIAL;
} break;
}
diff --git a/servers/rendering/renderer_rd/forward_mobile/render_forward_mobile.h b/servers/rendering/renderer_rd/forward_mobile/render_forward_mobile.h
index a2189693d0..99cbd45b10 100644
--- a/servers/rendering/renderer_rd/forward_mobile/render_forward_mobile.h
+++ b/servers/rendering/renderer_rd/forward_mobile/render_forward_mobile.h
@@ -85,9 +85,10 @@ protected:
RID color_fb;
int width, height;
+ uint32_t view_count;
void clear();
- virtual void configure(RID p_color_buffer, RID p_depth_buffer, int p_width, int p_height, RS::ViewportMSAA p_msaa);
+ virtual void configure(RID p_color_buffer, RID p_depth_buffer, int p_width, int p_height, RS::ViewportMSAA p_msaa, uint32_t p_view_count);
~RenderBufferDataForwardMobile();
};
@@ -120,6 +121,7 @@ protected:
bool reverse_cull = false;
PassMode pass_mode = PASS_MODE_COLOR;
// bool no_gi = false;
+ uint32_t view_count = 1;
RID render_pass_uniform_set;
bool force_wireframe = false;
Vector2 uv_offset;
@@ -130,13 +132,14 @@ protected:
uint32_t element_offset = 0;
uint32_t barrier = RD::BARRIER_MASK_ALL;
- RenderListParameters(GeometryInstanceSurfaceDataCache **p_elements, RenderElementInfo *p_element_info, int p_element_count, bool p_reverse_cull, PassMode p_pass_mode, RID p_render_pass_uniform_set, bool p_force_wireframe = false, const Vector2 &p_uv_offset = Vector2(), const Plane &p_lod_plane = Plane(), float p_lod_distance_multiplier = 0.0, float p_screen_lod_threshold = 0.0, uint32_t p_element_offset = 0, uint32_t p_barrier = RD::BARRIER_MASK_ALL) {
+ RenderListParameters(GeometryInstanceSurfaceDataCache **p_elements, RenderElementInfo *p_element_info, int p_element_count, bool p_reverse_cull, PassMode p_pass_mode, RID p_render_pass_uniform_set, bool p_force_wireframe = false, const Vector2 &p_uv_offset = Vector2(), const Plane &p_lod_plane = Plane(), float p_lod_distance_multiplier = 0.0, float p_screen_lod_threshold = 0.0, uint32_t p_view_count = 1, uint32_t p_element_offset = 0, uint32_t p_barrier = RD::BARRIER_MASK_ALL) {
elements = p_elements;
element_info = p_element_info;
element_count = p_element_count;
reverse_cull = p_reverse_cull;
pass_mode = p_pass_mode;
// no_gi = p_no_gi;
+ view_count = p_view_count;
render_pass_uniform_set = p_render_pass_uniform_set;
force_wireframe = p_force_wireframe;
uv_offset = p_uv_offset;
@@ -196,10 +199,12 @@ protected:
struct UBO {
float projection_matrix[16];
float inv_projection_matrix[16];
-
float camera_matrix[16];
float inv_camera_matrix[16];
+ float projection_matrix_view[RendererSceneRender::MAX_RENDER_VIEWS][16];
+ float inv_projection_matrix_view[RendererSceneRender::MAX_RENDER_VIEWS][16];
+
float viewport_size[2];
float screen_pixel_size[2];
diff --git a/servers/rendering/renderer_rd/forward_mobile/scene_shader_forward_mobile.cpp b/servers/rendering/renderer_rd/forward_mobile/scene_shader_forward_mobile.cpp
index 0d9dfbc51b..b5fb9fbc62 100644
--- a/servers/rendering/renderer_rd/forward_mobile/scene_shader_forward_mobile.cpp
+++ b/servers/rendering/renderer_rd/forward_mobile/scene_shader_forward_mobile.cpp
@@ -32,6 +32,7 @@
#include "core/config/project_settings.h"
#include "core/math/math_defs.h"
#include "render_forward_mobile.h"
+#include "servers/rendering/renderer_rd/renderer_compositor_rd.h"
using namespace RendererSceneRenderImplementation;
@@ -291,12 +292,12 @@ void SceneShaderForwardMobile::ShaderData::set_code(const String &p_code) {
multisample_state.enable_alpha_to_one = true;
}
- if (k == SHADER_VERSION_COLOR_PASS || k == SHADER_VERSION_LIGHTMAP_COLOR_PASS) {
+ if (k == SHADER_VERSION_COLOR_PASS || k == SHADER_VERSION_COLOR_PASS_MULTIVIEW || k == SHADER_VERSION_LIGHTMAP_COLOR_PASS || k == SHADER_VERSION_LIGHTMAP_COLOR_PASS_MULTIVIEW) {
blend_state = blend_state_blend;
if (depth_draw == DEPTH_DRAW_OPAQUE) {
depth_stencil.enable_depth_write = false; //alpha does not draw depth
}
- } else if (k == SHADER_VERSION_SHADOW_PASS || k == SHADER_VERSION_DEPTH_PASS_DP) {
+ } else if (k == SHADER_VERSION_SHADOW_PASS || k == SHADER_VERSION_SHADOW_PASS_MULTIVIEW || k == SHADER_VERSION_SHADOW_PASS_DP) {
//none, blend state contains nothing
} else if (k == SHADER_VERSION_DEPTH_PASS_WITH_MATERIAL) {
blend_state = RD::PipelineColorBlendState::create_disabled(5); //writes to normal and roughness in opaque way
@@ -304,57 +305,16 @@ void SceneShaderForwardMobile::ShaderData::set_code(const String &p_code) {
pipelines[i][j][k].clear();
continue; // do not use this version (will error if using it is attempted)
}
-
- /*
- if (k == SHADER_VERSION_COLOR_PASS || k == SHADER_VERSION_COLOR_PASS_WITH_FORWARD_GI || k == SHADER_VERSION_LIGHTMAP_COLOR_PASS) {
- blend_state = blend_state_blend;
- if (depth_draw == DEPTH_DRAW_OPAQUE) {
- depth_stencil.enable_depth_write = false; //alpha does not draw depth
- }
- } else if (uses_depth_pre_pass && (k == SHADER_VERSION_DEPTH_PASS || k == SHADER_VERSION_DEPTH_PASS_DP || k == SHADER_VERSION_DEPTH_PASS_WITH_NORMAL_AND_ROUGHNESS || k == SHADER_VERSION_DEPTH_PASS_WITH_MATERIAL)) {
- if (k == SHADER_VERSION_DEPTH_PASS || k == SHADER_VERSION_DEPTH_PASS_DP) {
- //none, blend state contains nothing
- } else if (k == SHADER_VERSION_DEPTH_PASS_WITH_MATERIAL) {
- blend_state = RD::PipelineColorBlendState::create_disabled(5); //writes to normal and roughness in opaque way
- } else {
- blend_state = blend_state_opaque; //writes to normal and roughness in opaque way
- }
- } else {
- pipelines[i][j][k].clear();
- continue; // do not use this version (will error if using it is attempted)
- }
- */
} else {
- if (k == SHADER_VERSION_COLOR_PASS || k == SHADER_VERSION_LIGHTMAP_COLOR_PASS) {
+ if (k == SHADER_VERSION_COLOR_PASS || k == SHADER_VERSION_COLOR_PASS_MULTIVIEW || k == SHADER_VERSION_LIGHTMAP_COLOR_PASS || k == SHADER_VERSION_LIGHTMAP_COLOR_PASS_MULTIVIEW) {
blend_state = blend_state_opaque;
- } else if (k == SHADER_VERSION_SHADOW_PASS || k == SHADER_VERSION_DEPTH_PASS_DP) {
+ } else if (k == SHADER_VERSION_SHADOW_PASS || k == SHADER_VERSION_SHADOW_PASS_MULTIVIEW || k == SHADER_VERSION_SHADOW_PASS_DP) {
//none, leave empty
} else if (k == SHADER_VERSION_DEPTH_PASS_WITH_MATERIAL) {
blend_state = RD::PipelineColorBlendState::create_disabled(5); //writes to normal and roughness in opaque way
} else {
// ???
}
-
- /*
- if (k == SHADER_VERSION_COLOR_PASS || k == SHADER_VERSION_COLOR_PASS_WITH_FORWARD_GI || k == SHADER_VERSION_LIGHTMAP_COLOR_PASS) {
- blend_state = blend_state_opaque;
- } else if (k == SHADER_VERSION_DEPTH_PASS || k == SHADER_VERSION_DEPTH_PASS_DP) {
- //none, leave empty
- } else if (k == SHADER_VERSION_DEPTH_PASS_WITH_NORMAL_AND_ROUGHNESS) {
- blend_state = blend_state_depth_normal_roughness;
- } else if (k == SHADER_VERSION_DEPTH_PASS_WITH_NORMAL_AND_ROUGHNESS_AND_VOXEL_GI) {
- blend_state = blend_state_depth_normal_roughness_giprobe;
- } else if (k == SHADER_VERSION_DEPTH_PASS_WITH_MATERIAL) {
- blend_state = RD::PipelineColorBlendState::create_disabled(5); //writes to normal and roughness in opaque way
- } else if (k == SHADER_VERSION_DEPTH_PASS_WITH_SDF) {
- blend_state = RD::PipelineColorBlendState(); //no color targets for SDF
- } else {
- //specular write
- blend_state = blend_state_opaque_specular;
- depth_stencil.enable_depth_test = false;
- depth_stencil.enable_depth_write = false;
- }
- */
}
RID shader_variant = shader_singleton->shader.version_get_shader(version, k);
@@ -585,10 +545,22 @@ void SceneShaderForwardMobile::init(RendererStorageRD *p_storage, const String p
Vector<String> shader_versions;
shader_versions.push_back(""); // SHADER_VERSION_COLOR_PASS
shader_versions.push_back("\n#define USE_LIGHTMAP\n"); // SHADER_VERSION_LIGHTMAP_COLOR_PASS
- shader_versions.push_back("\n#define MODE_RENDER_DEPTH\n"); // !BAS! SHADER_VERSION_SHADOW_PASS, should probably change this to MODE_RENDER_SHADOW because we don't have a depth pass here...
- shader_versions.push_back("\n#define MODE_RENDER_DEPTH\n#define MODE_DUAL_PARABOLOID\n"); // SHADER_VERSION_DEPTH_PASS_DP (maybe rename to SHADER_VERSION_SHADOW_PASS_DP?)
+ shader_versions.push_back("\n#define MODE_RENDER_DEPTH\n"); // SHADER_VERSION_SHADOW_PASS, should probably change this to MODE_RENDER_SHADOW because we don't have a depth pass here...
+ shader_versions.push_back("\n#define MODE_RENDER_DEPTH\n#define MODE_DUAL_PARABOLOID\n"); // SHADER_VERSION_SHADOW_PASS_DP
shader_versions.push_back("\n#define MODE_RENDER_DEPTH\n#define MODE_RENDER_MATERIAL\n"); // SHADER_VERSION_DEPTH_PASS_WITH_MATERIAL
+
+ // multiview versions of our shaders
+ shader_versions.push_back("\n#define USE_MULTIVIEW\n"); // SHADER_VERSION_COLOR_PASS_MULTIVIEW
+ shader_versions.push_back("\n#define USE_MULTIVIEW\n#define USE_LIGHTMAP\n"); // SHADER_VERSION_LIGHTMAP_COLOR_PASS_MULTIVIEW
+ shader_versions.push_back("\n#define USE_MULTIVIEW\n#define MODE_RENDER_DEPTH\n"); // SHADER_VERSION_SHADOW_PASS_MULTIVIEW
+
shader.initialize(shader_versions, p_defines);
+
+ if (!RendererCompositorRD::singleton->is_xr_enabled()) {
+ shader.set_variant_enabled(SHADER_VERSION_COLOR_PASS_MULTIVIEW, false);
+ shader.set_variant_enabled(SHADER_VERSION_LIGHTMAP_COLOR_PASS_MULTIVIEW, false);
+ shader.set_variant_enabled(SHADER_VERSION_SHADOW_PASS_MULTIVIEW, false);
+ }
}
storage->shader_set_data_request_function(RendererStorageRD::SHADER_TYPE_3D, _create_shader_funcs);
@@ -603,7 +575,7 @@ void SceneShaderForwardMobile::init(RendererStorageRD *p_storage, const String p
actions.renames["INV_CAMERA_MATRIX"] = "scene_data.inv_camera_matrix";
actions.renames["CAMERA_MATRIX"] = "scene_data.camera_matrix";
actions.renames["PROJECTION_MATRIX"] = "projection_matrix";
- actions.renames["INV_PROJECTION_MATRIX"] = "scene_data.inv_projection_matrix";
+ actions.renames["INV_PROJECTION_MATRIX"] = "inv_projection_matrix";
actions.renames["MODELVIEW_MATRIX"] = "modelview";
actions.renames["MODELVIEW_NORMAL_MATRIX"] = "modelview_normal";
@@ -673,6 +645,10 @@ void SceneShaderForwardMobile::init(RendererStorageRD *p_storage, const String p
actions.renames["CUSTOM2"] = "custom2_attrib";
actions.renames["CUSTOM3"] = "custom3_attrib";
+ actions.renames["VIEW_INDEX"] = "ViewIndex";
+ actions.renames["VIEW_MONO_LEFT"] = "0";
+ actions.renames["VIEW_RIGHT"] = "1";
+
//for light
actions.renames["VIEW"] = "view";
actions.renames["LIGHT_COLOR"] = "light_color";
diff --git a/servers/rendering/renderer_rd/forward_mobile/scene_shader_forward_mobile.h b/servers/rendering/renderer_rd/forward_mobile/scene_shader_forward_mobile.h
index 1517197d25..f4f6ceeb1d 100644
--- a/servers/rendering/renderer_rd/forward_mobile/scene_shader_forward_mobile.h
+++ b/servers/rendering/renderer_rd/forward_mobile/scene_shader_forward_mobile.h
@@ -47,8 +47,13 @@ public:
SHADER_VERSION_COLOR_PASS,
SHADER_VERSION_LIGHTMAP_COLOR_PASS,
SHADER_VERSION_SHADOW_PASS,
- SHADER_VERSION_DEPTH_PASS_DP,
+ SHADER_VERSION_SHADOW_PASS_DP,
SHADER_VERSION_DEPTH_PASS_WITH_MATERIAL,
+
+ SHADER_VERSION_COLOR_PASS_MULTIVIEW,
+ SHADER_VERSION_LIGHTMAP_COLOR_PASS_MULTIVIEW,
+ SHADER_VERSION_SHADOW_PASS_MULTIVIEW,
+
SHADER_VERSION_MAX
};
diff --git a/servers/rendering/renderer_rd/renderer_compositor_rd.cpp b/servers/rendering/renderer_rd/renderer_compositor_rd.cpp
index 1337d36762..f9ac7c8fa3 100644
--- a/servers/rendering/renderer_rd/renderer_compositor_rd.cpp
+++ b/servers/rendering/renderer_rd/renderer_compositor_rd.cpp
@@ -31,7 +31,7 @@
#include "renderer_compositor_rd.h"
#include "core/config/project_settings.h"
-#include "core/os/dir_access.h"
+#include "core/io/dir_access.h"
void RendererCompositorRD::prepare_for_blitting_render_targets() {
RD::get_singleton()->prepare_screen_for_drawing();
diff --git a/servers/rendering/renderer_rd/renderer_scene_render_rd.cpp b/servers/rendering/renderer_rd/renderer_scene_render_rd.cpp
index ff7e6c502f..be98fb42c0 100644
--- a/servers/rendering/renderer_rd/renderer_scene_render_rd.cpp
+++ b/servers/rendering/renderer_rd/renderer_scene_render_rd.cpp
@@ -1728,7 +1728,7 @@ void RendererSceneRenderRD::_process_ssao(RID p_render_buffers, RID p_environmen
settings.half_screen_size = Size2i(buffer_width, buffer_height);
settings.quarter_screen_size = Size2i(half_width, half_height);
- storage->get_effects()->generate_ssao(rb->depth_texture, p_normal_buffer, rb->ssao.depth, rb->ssao.depth_slices, rb->ssao.ao_deinterleaved, rb->ssao.ao_deinterleaved_slices, rb->ssao.ao_pong, rb->ssao.ao_pong_slices, rb->ssao.ao_final, rb->ssao.importance_map[0], rb->ssao.importance_map[1], p_projection, settings, uniform_sets_are_invalid);
+ storage->get_effects()->generate_ssao(rb->depth_texture, p_normal_buffer, rb->ssao.depth, rb->ssao.depth_slices, rb->ssao.ao_deinterleaved, rb->ssao.ao_deinterleaved_slices, rb->ssao.ao_pong, rb->ssao.ao_pong_slices, rb->ssao.ao_final, rb->ssao.importance_map[0], rb->ssao.importance_map[1], p_projection, settings, uniform_sets_are_invalid, rb->ssao.downsample_uniform_set, rb->ssao.gather_uniform_set, rb->ssao.importance_map_uniform_set);
}
void RendererSceneRenderRD::_render_buffers_post_process_and_tonemap(const RenderDataRD *p_render_data) {
@@ -1857,6 +1857,8 @@ void RendererSceneRenderRD::_render_buffers_post_process_and_tonemap(const Rende
}
}
+ tonemap.view_count = p_render_data->view_count;
+
storage->get_effects()->tonemapper(rb->texture, storage->render_target_get_rd_framebuffer(rb->render_target), tonemap);
}
@@ -2112,7 +2114,9 @@ float RendererSceneRenderRD::render_buffers_get_volumetric_fog_detail_spread(RID
return rb->volumetric_fog->spread;
}
-void RendererSceneRenderRD::render_buffers_configure(RID p_render_buffers, RID p_render_target, int p_width, int p_height, RS::ViewportMSAA p_msaa, RenderingServer::ViewportScreenSpaceAA p_screen_space_aa, bool p_use_debanding) {
+void RendererSceneRenderRD::render_buffers_configure(RID p_render_buffers, RID p_render_target, int p_width, int p_height, RS::ViewportMSAA p_msaa, RenderingServer::ViewportScreenSpaceAA p_screen_space_aa, bool p_use_debanding, uint32_t p_view_count) {
+ ERR_FAIL_COND_MSG(p_view_count == 0, "Must have atleast 1 view");
+
RenderBuffers *rb = render_buffers_owner.getornull(p_render_buffers);
rb->width = p_width;
rb->height = p_height;
@@ -2120,6 +2124,7 @@ void RendererSceneRenderRD::render_buffers_configure(RID p_render_buffers, RID p
rb->msaa = p_msaa;
rb->screen_space_aa = p_screen_space_aa;
rb->use_debanding = p_use_debanding;
+ rb->view_count = p_view_count;
if (is_clustered_enabled()) {
if (rb->cluster_builder == nullptr) {
@@ -2132,9 +2137,13 @@ void RendererSceneRenderRD::render_buffers_configure(RID p_render_buffers, RID p
{
RD::TextureFormat tf;
+ if (rb->view_count > 1) {
+ tf.texture_type = RD::TEXTURE_TYPE_2D_ARRAY;
+ }
tf.format = RD::DATA_FORMAT_R16G16B16A16_SFLOAT;
tf.width = rb->width;
tf.height = rb->height;
+ tf.array_layers = rb->view_count; // create a layer for every view
tf.usage_bits = RD::TEXTURE_USAGE_SAMPLING_BIT | RD::TEXTURE_USAGE_STORAGE_BIT;
if (rb->msaa != RS::VIEWPORT_MSAA_DISABLED) {
tf.usage_bits |= RD::TEXTURE_USAGE_CAN_COPY_TO_BIT | RD::TEXTURE_USAGE_STORAGE_BIT;
@@ -2147,6 +2156,9 @@ void RendererSceneRenderRD::render_buffers_configure(RID p_render_buffers, RID p
{
RD::TextureFormat tf;
+ if (rb->view_count > 1) {
+ tf.texture_type = RD::TEXTURE_TYPE_2D_ARRAY;
+ }
if (rb->msaa == RS::VIEWPORT_MSAA_DISABLED) {
tf.format = RD::get_singleton()->texture_is_format_supported_for_usage(RD::DATA_FORMAT_D24_UNORM_S8_UINT, RD::TEXTURE_USAGE_DEPTH_STENCIL_ATTACHMENT_BIT) ? RD::DATA_FORMAT_D24_UNORM_S8_UINT : RD::DATA_FORMAT_D32_SFLOAT_S8_UINT;
} else {
@@ -2156,6 +2168,7 @@ void RendererSceneRenderRD::render_buffers_configure(RID p_render_buffers, RID p
tf.width = p_width;
tf.height = p_height;
tf.usage_bits = RD::TEXTURE_USAGE_SAMPLING_BIT;
+ tf.array_layers = rb->view_count; // create a layer for every view
if (rb->msaa != RS::VIEWPORT_MSAA_DISABLED) {
tf.usage_bits |= RD::TEXTURE_USAGE_CAN_COPY_TO_BIT | RD::TEXTURE_USAGE_STORAGE_BIT;
@@ -2166,7 +2179,7 @@ void RendererSceneRenderRD::render_buffers_configure(RID p_render_buffers, RID p
rb->depth_texture = RD::get_singleton()->texture_create(tf, RD::TextureView());
}
- rb->data->configure(rb->texture, rb->depth_texture, p_width, p_height, p_msaa);
+ rb->data->configure(rb->texture, rb->depth_texture, p_width, p_height, p_msaa, p_view_count);
if (is_clustered_enabled()) {
rb->cluster_builder->setup(Size2i(p_width, p_height), max_cluster_elements, rb->depth_texture, storage->sampler_rd_get_default(RS::CANVAS_ITEM_TEXTURE_FILTER_NEAREST, RS::CANVAS_ITEM_TEXTURE_REPEAT_DISABLED), rb->texture);
@@ -3498,11 +3511,9 @@ void RendererSceneRenderRD::_pre_opaque_render(RenderDataRD *p_render_data, bool
if (p_render_data->render_buffers.is_valid() && p_use_gi) {
RenderBuffers *rb = render_buffers_owner.getornull(p_render_data->render_buffers);
ERR_FAIL_COND(rb == nullptr);
- if (rb->sdfgi == nullptr) {
- return;
+ if (rb->sdfgi != nullptr) {
+ rb->sdfgi->store_probes();
}
-
- rb->sdfgi->store_probes();
}
render_state.cube_shadows.clear();
@@ -3630,7 +3641,7 @@ void RendererSceneRenderRD::_pre_opaque_render(RenderDataRD *p_render_data, bool
}
}
-void RendererSceneRenderRD::render_scene(RID p_render_buffers, const Transform3D &p_cam_transform, const CameraMatrix &p_cam_projection, bool p_cam_ortogonal, const PagedArray<GeometryInstance *> &p_instances, const PagedArray<RID> &p_lights, const PagedArray<RID> &p_reflection_probes, const PagedArray<RID> &p_voxel_gi_instances, const PagedArray<RID> &p_decals, const PagedArray<RID> &p_lightmaps, RID p_environment, RID p_camera_effects, RID p_shadow_atlas, RID p_occluder_debug_tex, RID p_reflection_atlas, RID p_reflection_probe, int p_reflection_probe_pass, float p_screen_lod_threshold, const RenderShadowData *p_render_shadows, int p_render_shadow_count, const RenderSDFGIData *p_render_sdfgi_regions, int p_render_sdfgi_region_count, const RenderSDFGIUpdateData *p_sdfgi_update_data) {
+void RendererSceneRenderRD::render_scene(RID p_render_buffers, const CameraData *p_camera_data, const PagedArray<GeometryInstance *> &p_instances, const PagedArray<RID> &p_lights, const PagedArray<RID> &p_reflection_probes, const PagedArray<RID> &p_voxel_gi_instances, const PagedArray<RID> &p_decals, const PagedArray<RID> &p_lightmaps, RID p_environment, RID p_camera_effects, RID p_shadow_atlas, RID p_occluder_debug_tex, RID p_reflection_atlas, RID p_reflection_probe, int p_reflection_probe_pass, float p_screen_lod_threshold, const RenderShadowData *p_render_shadows, int p_render_shadow_count, const RenderSDFGIData *p_render_sdfgi_regions, int p_render_sdfgi_region_count, const RenderSDFGIUpdateData *p_sdfgi_update_data) {
// getting this here now so we can direct call a bunch of things more easily
RenderBuffers *rb = nullptr;
if (p_render_buffers.is_valid()) {
@@ -3643,11 +3654,19 @@ void RendererSceneRenderRD::render_scene(RID p_render_buffers, const Transform3D
{
render_data.render_buffers = p_render_buffers;
- render_data.cam_transform = p_cam_transform;
- render_data.cam_projection = p_cam_projection;
- render_data.cam_ortogonal = p_cam_projection.is_orthogonal(); // !BAS! Shouldn't this be p_cam_ortogonal ?
- render_data.z_near = p_cam_projection.get_z_near();
- render_data.z_far = p_cam_projection.get_z_far();
+ // Our first camera is used by default
+ render_data.cam_transform = p_camera_data->main_transform;
+ render_data.cam_projection = p_camera_data->main_projection;
+ render_data.view_projection[0] = p_camera_data->main_projection;
+ render_data.cam_ortogonal = p_camera_data->is_ortogonal;
+
+ render_data.view_count = p_camera_data->view_count;
+ for (uint32_t v = 0; v < p_camera_data->view_count; v++) {
+ render_data.view_projection[v] = p_camera_data->view_projection[v];
+ }
+
+ render_data.z_near = p_camera_data->main_projection.get_z_near();
+ render_data.z_far = p_camera_data->main_projection.get_z_far();
render_data.instances = &p_instances;
render_data.lights = &p_lights;
@@ -3662,8 +3681,9 @@ void RendererSceneRenderRD::render_scene(RID p_render_buffers, const Transform3D
render_data.reflection_probe = p_reflection_probe;
render_data.reflection_probe_pass = p_reflection_probe_pass;
- render_data.lod_distance_multiplier = p_cam_projection.get_lod_multiplier();
- render_data.lod_camera_plane = Plane(p_cam_transform.get_origin(), -p_cam_transform.basis.get_axis(Vector3::AXIS_Z));
+ // this should be the same for all cameras..
+ render_data.lod_distance_multiplier = p_camera_data->main_projection.get_lod_multiplier();
+ render_data.lod_camera_plane = Plane(p_camera_data->main_transform.get_origin(), -p_camera_data->main_transform.basis.get_axis(Vector3::AXIS_Z));
if (get_debug_draw_mode() == RS::VIEWPORT_DEBUG_DRAW_DISABLE_LOD) {
render_data.screen_lod_threshold = 0.0;
@@ -3730,17 +3750,18 @@ void RendererSceneRenderRD::render_scene(RID p_render_buffers, const Transform3D
current_cluster_builder = nullptr;
}
- if (rb != nullptr && rb->sdfgi != nullptr) {
- rb->sdfgi->update_cascades();
-
- rb->sdfgi->pre_process_gi(p_cam_transform, &render_data, this);
- }
-
render_state.voxel_gi_count = 0;
- if (rb != nullptr && rb->sdfgi != nullptr) {
- gi.setup_voxel_gi_instances(render_data.render_buffers, render_data.cam_transform, *render_data.voxel_gi_instances, render_state.voxel_gi_count, this);
- rb->sdfgi->update_light();
+ if (rb != nullptr) {
+ if (rb->sdfgi) {
+ rb->sdfgi->update_cascades();
+ rb->sdfgi->pre_process_gi(render_data.cam_transform, &render_data, this);
+ rb->sdfgi->update_light();
+ }
+
+ if (p_voxel_gi_instances.size()) {
+ gi.setup_voxel_gi_instances(render_data.render_buffers, render_data.cam_transform, *render_data.voxel_gi_instances, render_state.voxel_gi_count, this);
+ }
}
render_state.depth_prepass_used = false;
@@ -3782,7 +3803,7 @@ void RendererSceneRenderRD::render_scene(RID p_render_buffers, const Transform3D
_render_buffers_post_process_and_tonemap(&render_data);
_render_buffers_debug_draw(p_render_buffers, p_shadow_atlas, p_occluder_debug_tex);
if (debug_draw == RS::VIEWPORT_DEBUG_DRAW_SDFGI && rb != nullptr && rb->sdfgi != nullptr) {
- rb->sdfgi->debug_draw(p_cam_projection, p_cam_transform, rb->width, rb->height, rb->render_target, rb->texture);
+ rb->sdfgi->debug_draw(render_data.cam_projection, render_data.cam_transform, rb->width, rb->height, rb->render_target, rb->texture);
}
}
}
diff --git a/servers/rendering/renderer_rd/renderer_scene_render_rd.h b/servers/rendering/renderer_rd/renderer_scene_render_rd.h
index c8fcbecc95..9a793e42c5 100644
--- a/servers/rendering/renderer_rd/renderer_scene_render_rd.h
+++ b/servers/rendering/renderer_rd/renderer_scene_render_rd.h
@@ -50,6 +50,10 @@ struct RenderDataRD {
CameraMatrix cam_projection = CameraMatrix();
bool cam_ortogonal = false;
+ // For stereo rendering
+ uint32_t view_count = 1;
+ CameraMatrix view_projection[RendererSceneRender::MAX_RENDER_VIEWS];
+
float z_near = 0.0;
float z_far = 0.0;
@@ -87,7 +91,7 @@ protected:
double time_step = 0;
struct RenderBufferData {
- virtual void configure(RID p_color_buffer, RID p_depth_buffer, int p_width, int p_height, RS::ViewportMSAA p_msaa) = 0;
+ virtual void configure(RID p_color_buffer, RID p_depth_buffer, int p_width, int p_height, RS::ViewportMSAA p_msaa, uint32_t p_view_count) = 0;
virtual ~RenderBufferData() {}
};
virtual RenderBufferData *_create_render_buffer_data() = 0;
@@ -411,6 +415,7 @@ private:
RS::ViewportMSAA msaa = RS::VIEWPORT_MSAA_DISABLED;
RS::ViewportScreenSpaceAA screen_space_aa = RS::VIEWPORT_SCREEN_SPACE_AA_DISABLED;
bool use_debanding = false;
+ uint32_t view_count = 1;
RID render_target;
@@ -454,6 +459,10 @@ private:
Vector<RID> ao_pong_slices;
RID ao_final;
RID importance_map[2];
+
+ RID downsample_uniform_set;
+ RID gather_uniform_set;
+ RID importance_map_uniform_set;
} ssao;
struct SSR {
@@ -1118,7 +1127,7 @@ public:
/* render buffers */
RID render_buffers_create();
- void render_buffers_configure(RID p_render_buffers, RID p_render_target, int p_width, int p_height, RS::ViewportMSAA p_msaa, RS::ViewportScreenSpaceAA p_screen_space_aa, bool p_use_debanding);
+ void render_buffers_configure(RID p_render_buffers, RID p_render_target, int p_width, int p_height, RS::ViewportMSAA p_msaa, RS::ViewportScreenSpaceAA p_screen_space_aa, bool p_use_debanding, uint32_t p_view_count);
void gi_set_use_half_resolution(bool p_enable);
RID render_buffers_get_ao_texture(RID p_render_buffers);
@@ -1147,7 +1156,7 @@ public:
float render_buffers_get_volumetric_fog_end(RID p_render_buffers);
float render_buffers_get_volumetric_fog_detail_spread(RID p_render_buffers);
- void render_scene(RID p_render_buffers, const Transform3D &p_cam_transform, const CameraMatrix &p_cam_projection, bool p_cam_ortogonal, const PagedArray<GeometryInstance *> &p_instances, const PagedArray<RID> &p_lights, const PagedArray<RID> &p_reflection_probes, const PagedArray<RID> &p_voxel_gi_instances, const PagedArray<RID> &p_decals, const PagedArray<RID> &p_lightmaps, RID p_environment, RID p_camera_effects, RID p_shadow_atlas, RID p_occluder_debug_tex, RID p_reflection_atlas, RID p_reflection_probe, int p_reflection_probe_pass, float p_screen_lod_threshold, const RenderShadowData *p_render_shadows, int p_render_shadow_count, const RenderSDFGIData *p_render_sdfgi_regions, int p_render_sdfgi_region_count, const RenderSDFGIUpdateData *p_sdfgi_update_data = nullptr);
+ void render_scene(RID p_render_buffers, const CameraData *p_camera_data, const PagedArray<GeometryInstance *> &p_instances, const PagedArray<RID> &p_lights, const PagedArray<RID> &p_reflection_probes, const PagedArray<RID> &p_voxel_gi_instances, const PagedArray<RID> &p_decals, const PagedArray<RID> &p_lightmaps, RID p_environment, RID p_camera_effects, RID p_shadow_atlas, RID p_occluder_debug_tex, RID p_reflection_atlas, RID p_reflection_probe, int p_reflection_probe_pass, float p_screen_lod_threshold, const RenderShadowData *p_render_shadows, int p_render_shadow_count, const RenderSDFGIData *p_render_sdfgi_regions, int p_render_sdfgi_region_count, const RenderSDFGIUpdateData *p_sdfgi_update_data = nullptr);
void render_material(const Transform3D &p_cam_transform, const CameraMatrix &p_cam_projection, bool p_cam_ortogonal, const PagedArray<GeometryInstance *> &p_instances, RID p_framebuffer, const Rect2i &p_region);
diff --git a/servers/rendering/renderer_rd/renderer_scene_sky_rd.cpp b/servers/rendering/renderer_rd/renderer_scene_sky_rd.cpp
index e68f466015..1aa01dd16e 100644
--- a/servers/rendering/renderer_rd/renderer_scene_sky_rd.cpp
+++ b/servers/rendering/renderer_rd/renderer_scene_sky_rd.cpp
@@ -32,6 +32,7 @@
#include "core/config/project_settings.h"
#include "core/math/math_defs.h"
#include "renderer_scene_render_rd.h"
+#include "servers/rendering/renderer_rd/renderer_compositor_rd.h"
#include "servers/rendering/rendering_server_default.h"
////////////////////////////////////////////////////////////////////////////////
@@ -126,8 +127,12 @@ void RendererSceneSkyRD::SkyShaderData::set_code(const String &p_code) {
depth_stencil_state.enable_depth_test = true;
depth_stencil_state.depth_compare_operator = RD::COMPARE_OP_LESS_OR_EQUAL;
- RID shader_variant = scene_singleton->sky.sky_shader.shader.version_get_shader(version, i);
- pipelines[i].setup(shader_variant, RD::RENDER_PRIMITIVE_TRIANGLES, RD::PipelineRasterizationState(), RD::PipelineMultisampleState(), depth_stencil_state, RD::PipelineColorBlendState::create_disabled(), 0);
+ if (scene_singleton->sky.sky_shader.shader.is_variant_enabled(i)) {
+ RID shader_variant = scene_singleton->sky.sky_shader.shader.version_get_shader(version, i);
+ pipelines[i].setup(shader_variant, RD::RENDER_PRIMITIVE_TRIANGLES, RD::PipelineRasterizationState(), RD::PipelineMultisampleState(), depth_stencil_state, RD::PipelineColorBlendState::create_disabled(), 0);
+ } else {
+ pipelines[i].clear();
+ }
}
valid = true;
@@ -694,7 +699,18 @@ void RendererSceneSkyRD::init(RendererStorageRD *p_storage) {
sky_modes.push_back("\n#define USE_CUBEMAP_PASS\n"); // Cubemap
sky_modes.push_back("\n#define USE_CUBEMAP_PASS\n#define USE_HALF_RES_PASS\n"); // Half Res Cubemap
sky_modes.push_back("\n#define USE_CUBEMAP_PASS\n#define USE_QUARTER_RES_PASS\n"); // Quarter res Cubemap
+
+ sky_modes.push_back("\n#define USE_MULTIVIEW\n"); // Full size multiview
+ sky_modes.push_back("\n#define USE_HALF_RES_PASS\n#define USE_MULTIVIEW\n"); // Half Res multiview
+ sky_modes.push_back("\n#define USE_QUARTER_RES_PASS\n#define USE_MULTIVIEW\n"); // Quarter res multiview
+
sky_shader.shader.initialize(sky_modes, defines);
+
+ if (!RendererCompositorRD::singleton->is_xr_enabled()) {
+ sky_shader.shader.set_variant_enabled(SKY_VERSION_BACKGROUND_MULTIVIEW, false);
+ sky_shader.shader.set_variant_enabled(SKY_VERSION_HALF_RES_MULTIVIEW, false);
+ sky_shader.shader.set_variant_enabled(SKY_VERSION_QUARTER_RES_MULTIVIEW, false);
+ }
}
// register our shader funds
@@ -1140,7 +1156,7 @@ void RendererSceneSkyRD::update(RendererSceneEnvironmentRD *p_env, const CameraM
RID texture_uniform_set = sky->get_textures(storage, SKY_TEXTURE_SET_CUBEMAP_QUARTER_RES, sky_shader.default_shader_rd);
cubemap_draw_list = RD::get_singleton()->draw_list_begin(sky->reflection.layers[0].mipmaps[2].framebuffers[i], RD::INITIAL_ACTION_KEEP, RD::FINAL_ACTION_READ, RD::INITIAL_ACTION_KEEP, RD::FINAL_ACTION_DISCARD);
- storage->get_effects()->render_sky(cubemap_draw_list, p_time, sky->reflection.layers[0].mipmaps[2].framebuffers[i], sky_scene_state.uniform_set, sky_scene_state.fog_uniform_set, pipeline, material->uniform_set, texture_uniform_set, cm, local_view.basis, multiplier, p_transform.origin);
+ storage->get_effects()->render_sky(cubemap_draw_list, p_time, sky->reflection.layers[0].mipmaps[2].framebuffers[i], sky_scene_state.uniform_set, sky_scene_state.fog_uniform_set, pipeline, material->uniform_set, texture_uniform_set, 1, &cm, local_view.basis, multiplier, p_transform.origin);
RD::get_singleton()->draw_list_end();
}
}
@@ -1158,7 +1174,7 @@ void RendererSceneSkyRD::update(RendererSceneEnvironmentRD *p_env, const CameraM
RID texture_uniform_set = sky->get_textures(storage, SKY_TEXTURE_SET_CUBEMAP_HALF_RES, sky_shader.default_shader_rd);
cubemap_draw_list = RD::get_singleton()->draw_list_begin(sky->reflection.layers[0].mipmaps[1].framebuffers[i], RD::INITIAL_ACTION_KEEP, RD::FINAL_ACTION_READ, RD::INITIAL_ACTION_KEEP, RD::FINAL_ACTION_DISCARD);
- storage->get_effects()->render_sky(cubemap_draw_list, p_time, sky->reflection.layers[0].mipmaps[1].framebuffers[i], sky_scene_state.uniform_set, sky_scene_state.fog_uniform_set, pipeline, material->uniform_set, texture_uniform_set, cm, local_view.basis, multiplier, p_transform.origin);
+ storage->get_effects()->render_sky(cubemap_draw_list, p_time, sky->reflection.layers[0].mipmaps[1].framebuffers[i], sky_scene_state.uniform_set, sky_scene_state.fog_uniform_set, pipeline, material->uniform_set, texture_uniform_set, 1, &cm, local_view.basis, multiplier, p_transform.origin);
RD::get_singleton()->draw_list_end();
}
}
@@ -1172,7 +1188,7 @@ void RendererSceneSkyRD::update(RendererSceneEnvironmentRD *p_env, const CameraM
RID texture_uniform_set = sky->get_textures(storage, SKY_TEXTURE_SET_CUBEMAP, sky_shader.default_shader_rd);
cubemap_draw_list = RD::get_singleton()->draw_list_begin(sky->reflection.layers[0].mipmaps[0].framebuffers[i], RD::INITIAL_ACTION_KEEP, RD::FINAL_ACTION_READ, RD::INITIAL_ACTION_KEEP, RD::FINAL_ACTION_DISCARD);
- storage->get_effects()->render_sky(cubemap_draw_list, p_time, sky->reflection.layers[0].mipmaps[0].framebuffers[i], sky_scene_state.uniform_set, sky_scene_state.fog_uniform_set, pipeline, material->uniform_set, texture_uniform_set, cm, local_view.basis, multiplier, p_transform.origin);
+ storage->get_effects()->render_sky(cubemap_draw_list, p_time, sky->reflection.layers[0].mipmaps[0].framebuffers[i], sky_scene_state.uniform_set, sky_scene_state.fog_uniform_set, pipeline, material->uniform_set, texture_uniform_set, 1, &cm, local_view.basis, multiplier, p_transform.origin);
RD::get_singleton()->draw_list_end();
}
@@ -1213,9 +1229,12 @@ void RendererSceneSkyRD::update(RendererSceneEnvironmentRD *p_env, const CameraM
}
}
-void RendererSceneSkyRD::draw(RendererSceneEnvironmentRD *p_env, bool p_can_continue_color, bool p_can_continue_depth, RID p_fb, const CameraMatrix &p_projection, const Transform3D &p_transform, double p_time) {
+void RendererSceneSkyRD::draw(RendererSceneEnvironmentRD *p_env, bool p_can_continue_color, bool p_can_continue_depth, RID p_fb, uint32_t p_view_count, const CameraMatrix *p_projections, const Transform3D &p_transform, double p_time) {
ERR_FAIL_COND(!p_env);
+ ERR_FAIL_COND(p_view_count == 0);
+ ERR_FAIL_COND(p_view_count > RendererSceneRender::MAX_RENDER_VIEWS);
+
Sky *sky = get_sky(p_env->sky);
ERR_FAIL_COND(!sky);
@@ -1257,24 +1276,28 @@ void RendererSceneSkyRD::draw(RendererSceneEnvironmentRD *p_env, bool p_can_cont
float multiplier = p_env->bg_energy;
float custom_fov = p_env->sky_custom_fov;
+
// Camera
CameraMatrix camera;
+ uint32_t view_count = p_view_count;
+ const CameraMatrix *projections = p_projections;
if (custom_fov) {
- float near_plane = p_projection.get_z_near();
- float far_plane = p_projection.get_z_far();
- float aspect = p_projection.get_aspect();
+ // With custom fov we don't support stereo...
+ float near_plane = p_projections[0].get_z_near();
+ float far_plane = p_projections[0].get_z_far();
+ float aspect = p_projections[0].get_aspect();
camera.set_perspective(custom_fov, aspect, near_plane, far_plane);
- } else {
- camera = p_projection;
+ view_count = 1;
+ projections = &camera;
}
sky_transform = p_transform.basis * sky_transform;
if (shader_data->uses_quarter_res) {
- PipelineCacheRD *pipeline = &shader_data->pipelines[SKY_VERSION_QUARTER_RES];
+ PipelineCacheRD *pipeline = &shader_data->pipelines[view_count > 1 ? SKY_VERSION_QUARTER_RES_MULTIVIEW : SKY_VERSION_QUARTER_RES];
RID texture_uniform_set = sky->get_textures(storage, SKY_TEXTURE_SET_QUARTER_RES, sky_shader.default_shader_rd);
@@ -1282,12 +1305,12 @@ void RendererSceneSkyRD::draw(RendererSceneEnvironmentRD *p_env, bool p_can_cont
clear_colors.push_back(Color(0.0, 0.0, 0.0));
RD::DrawListID draw_list = RD::get_singleton()->draw_list_begin(sky->quarter_res_framebuffer, RD::INITIAL_ACTION_CLEAR, RD::FINAL_ACTION_READ, RD::INITIAL_ACTION_CLEAR, RD::FINAL_ACTION_DISCARD, clear_colors);
- storage->get_effects()->render_sky(draw_list, p_time, sky->quarter_res_framebuffer, sky_scene_state.uniform_set, sky_scene_state.fog_uniform_set, pipeline, material->uniform_set, texture_uniform_set, camera, sky_transform, multiplier, p_transform.origin);
+ storage->get_effects()->render_sky(draw_list, p_time, sky->quarter_res_framebuffer, sky_scene_state.uniform_set, sky_scene_state.fog_uniform_set, pipeline, material->uniform_set, texture_uniform_set, view_count, projections, sky_transform, multiplier, p_transform.origin);
RD::get_singleton()->draw_list_end();
}
if (shader_data->uses_half_res) {
- PipelineCacheRD *pipeline = &shader_data->pipelines[SKY_VERSION_HALF_RES];
+ PipelineCacheRD *pipeline = &shader_data->pipelines[view_count > 1 ? SKY_VERSION_HALF_RES_MULTIVIEW : SKY_VERSION_HALF_RES];
RID texture_uniform_set = sky->get_textures(storage, SKY_TEXTURE_SET_HALF_RES, sky_shader.default_shader_rd);
@@ -1295,11 +1318,11 @@ void RendererSceneSkyRD::draw(RendererSceneEnvironmentRD *p_env, bool p_can_cont
clear_colors.push_back(Color(0.0, 0.0, 0.0));
RD::DrawListID draw_list = RD::get_singleton()->draw_list_begin(sky->half_res_framebuffer, RD::INITIAL_ACTION_CLEAR, RD::FINAL_ACTION_READ, RD::INITIAL_ACTION_CLEAR, RD::FINAL_ACTION_DISCARD, clear_colors);
- storage->get_effects()->render_sky(draw_list, p_time, sky->half_res_framebuffer, sky_scene_state.uniform_set, sky_scene_state.fog_uniform_set, pipeline, material->uniform_set, texture_uniform_set, camera, sky_transform, multiplier, p_transform.origin);
+ storage->get_effects()->render_sky(draw_list, p_time, sky->half_res_framebuffer, sky_scene_state.uniform_set, sky_scene_state.fog_uniform_set, pipeline, material->uniform_set, texture_uniform_set, view_count, projections, sky_transform, multiplier, p_transform.origin);
RD::get_singleton()->draw_list_end();
}
- PipelineCacheRD *pipeline = &shader_data->pipelines[SKY_VERSION_BACKGROUND];
+ PipelineCacheRD *pipeline = &shader_data->pipelines[view_count > 1 ? SKY_VERSION_BACKGROUND_MULTIVIEW : SKY_VERSION_BACKGROUND];
RID texture_uniform_set;
if (sky) {
@@ -1309,7 +1332,7 @@ void RendererSceneSkyRD::draw(RendererSceneEnvironmentRD *p_env, bool p_can_cont
}
RD::DrawListID draw_list = RD::get_singleton()->draw_list_begin(p_fb, RD::INITIAL_ACTION_CONTINUE, p_can_continue_color ? RD::FINAL_ACTION_CONTINUE : RD::FINAL_ACTION_READ, RD::INITIAL_ACTION_CONTINUE, p_can_continue_depth ? RD::FINAL_ACTION_CONTINUE : RD::FINAL_ACTION_READ);
- storage->get_effects()->render_sky(draw_list, p_time, p_fb, sky_scene_state.uniform_set, sky_scene_state.fog_uniform_set, pipeline, material->uniform_set, texture_uniform_set, camera, sky_transform, multiplier, p_transform.origin);
+ storage->get_effects()->render_sky(draw_list, p_time, p_fb, sky_scene_state.uniform_set, sky_scene_state.fog_uniform_set, pipeline, material->uniform_set, texture_uniform_set, view_count, projections, sky_transform, multiplier, p_transform.origin);
RD::get_singleton()->draw_list_end();
}
diff --git a/servers/rendering/renderer_rd/renderer_scene_sky_rd.h b/servers/rendering/renderer_rd/renderer_scene_sky_rd.h
index 063e4e662e..200902bff2 100644
--- a/servers/rendering/renderer_rd/renderer_scene_sky_rd.h
+++ b/servers/rendering/renderer_rd/renderer_scene_sky_rd.h
@@ -72,6 +72,11 @@ public:
SKY_VERSION_CUBEMAP,
SKY_VERSION_CUBEMAP_HALF_RES,
SKY_VERSION_CUBEMAP_QUARTER_RES,
+
+ SKY_VERSION_BACKGROUND_MULTIVIEW,
+ SKY_VERSION_HALF_RES_MULTIVIEW,
+ SKY_VERSION_QUARTER_RES_MULTIVIEW,
+
SKY_VERSION_MAX
};
@@ -270,7 +275,7 @@ public:
void setup(RendererSceneEnvironmentRD *p_env, RID p_render_buffers, const CameraMatrix &p_projection, const Transform3D &p_transform, const Size2i p_screen_size, RendererSceneRenderRD *p_scene_render);
void update(RendererSceneEnvironmentRD *p_env, const CameraMatrix &p_projection, const Transform3D &p_transform, double p_time);
- void draw(RendererSceneEnvironmentRD *p_env, bool p_can_continue_color, bool p_can_continue_depth, RID p_fb, const CameraMatrix &p_projection, const Transform3D &p_transform, double p_time);
+ void draw(RendererSceneEnvironmentRD *p_env, bool p_can_continue_color, bool p_can_continue_depth, RID p_fb, uint32_t p_view_count, const CameraMatrix *p_projections, const Transform3D &p_transform, double p_time);
void invalidate_sky(Sky *p_sky);
void update_dirty_skys();
diff --git a/servers/rendering/renderer_rd/renderer_storage_rd.cpp b/servers/rendering/renderer_rd/renderer_storage_rd.cpp
index 05993829d1..64be54115f 100644
--- a/servers/rendering/renderer_rd/renderer_storage_rd.cpp
+++ b/servers/rendering/renderer_rd/renderer_storage_rd.cpp
@@ -1440,8 +1440,10 @@ void RendererStorageRD::shader_set_code(RID p_shader, const String &p_code) {
material->shader_type = new_type;
}
- for (Map<StringName, RID>::Element *E = shader->default_texture_parameter.front(); E; E = E->next()) {
- shader->data->set_default_texture_param(E->key(), E->get());
+ if (shader->data) {
+ for (Map<StringName, RID>::Element *E = shader->default_texture_parameter.front(); E; E = E->next()) {
+ shader->data->set_default_texture_param(E->key(), E->get());
+ }
}
}
@@ -3823,7 +3825,7 @@ void RendererStorageRD::_update_dirty_multimeshes() {
if (multimesh->data_cache_used_dirty_regions) {
uint32_t data_cache_dirty_region_count = (multimesh->instances - 1) / MULTIMESH_DIRTY_REGION_SIZE + 1;
- uint32_t visible_region_count = (visible_instances - 1) / MULTIMESH_DIRTY_REGION_SIZE + 1;
+ uint32_t visible_region_count = visible_instances == 0 ? 0 : (visible_instances - 1) / MULTIMESH_DIRTY_REGION_SIZE + 1;
uint32_t region_size = multimesh->stride_cache * MULTIMESH_DIRTY_REGION_SIZE * sizeof(float);
@@ -6911,9 +6913,13 @@ void RendererStorageRD::_update_render_target(RenderTarget *rt) {
rd_format.width = rt->size.width;
rd_format.height = rt->size.height;
rd_format.depth = 1;
- rd_format.array_layers = 1;
+ rd_format.array_layers = rt->view_count; // for stereo we create two (or more) layers, need to see if we can make fallback work like this too if we don't have multiview
rd_format.mipmaps = 1;
- rd_format.texture_type = RD::TEXTURE_TYPE_2D;
+ if (rd_format.array_layers > 1) { // why are we not using rt->texture_type ??
+ rd_format.texture_type = RD::TEXTURE_TYPE_2D_ARRAY;
+ } else {
+ rd_format.texture_type = RD::TEXTURE_TYPE_2D;
+ }
rd_format.samples = RD::TEXTURE_SAMPLES_1;
rd_format.usage_bits = RD::TEXTURE_USAGE_SAMPLING_BIT | RD::TEXTURE_USAGE_COLOR_ATTACHMENT_BIT | RD::TEXTURE_USAGE_CAN_COPY_FROM_BIT;
rd_format.shareable_formats.push_back(rt->color_format);
@@ -6925,7 +6931,7 @@ void RendererStorageRD::_update_render_target(RenderTarget *rt) {
Vector<RID> fb_textures;
fb_textures.push_back(rt->color);
- rt->framebuffer = RD::get_singleton()->framebuffer_create(fb_textures);
+ rt->framebuffer = RD::get_singleton()->framebuffer_create(fb_textures, RenderingDevice::INVALID_ID, rt->view_count);
if (rt->framebuffer.is_null()) {
_clear_render_target(rt);
ERR_FAIL_COND(rt->framebuffer.is_null());
@@ -7039,12 +7045,15 @@ void RendererStorageRD::render_target_set_position(RID p_render_target, int p_x,
//unused for this render target
}
-void RendererStorageRD::render_target_set_size(RID p_render_target, int p_width, int p_height) {
+void RendererStorageRD::render_target_set_size(RID p_render_target, int p_width, int p_height, uint32_t p_view_count) {
RenderTarget *rt = render_target_owner.getornull(p_render_target);
ERR_FAIL_COND(!rt);
- rt->size.x = p_width;
- rt->size.y = p_height;
- _update_render_target(rt);
+ if (rt->size.x != p_width || rt->size.y != p_height || rt->view_count != p_view_count) {
+ rt->size.x = p_width;
+ rt->size.y = p_height;
+ rt->view_count = p_view_count;
+ _update_render_target(rt);
+ }
}
RID RendererStorageRD::render_target_get_texture(RID p_render_target) {
@@ -8552,6 +8561,7 @@ bool RendererStorageRD::free(RID p_rid) {
if (texture_owner.owns(p_rid)) {
Texture *t = texture_owner.getornull(p_rid);
+ ERR_FAIL_COND_V(!t, false);
ERR_FAIL_COND_V(t->is_render_target, false);
if (RD::get_singleton()->texture_is_valid(t->rd_texture_srgb)) {
diff --git a/servers/rendering/renderer_rd/renderer_storage_rd.h b/servers/rendering/renderer_rd/renderer_storage_rd.h
index 8bfab545fd..28a1044705 100644
--- a/servers/rendering/renderer_rd/renderer_storage_rd.h
+++ b/servers/rendering/renderer_rd/renderer_storage_rd.h
@@ -1125,6 +1125,7 @@ private:
struct RenderTarget {
Size2i size;
+ uint32_t view_count;
RID framebuffer;
RID color;
@@ -2282,7 +2283,7 @@ public:
RID render_target_create();
void render_target_set_position(RID p_render_target, int p_x, int p_y);
- void render_target_set_size(RID p_render_target, int p_width, int p_height);
+ void render_target_set_size(RID p_render_target, int p_width, int p_height, uint32_t p_view_count);
RID render_target_get_texture(RID p_render_target);
void render_target_set_external_texture(RID p_render_target, unsigned int p_texture_id);
void render_target_set_flag(RID p_render_target, RenderTargetFlags p_flag, bool p_value);
diff --git a/servers/rendering/renderer_rd/shader_rd.cpp b/servers/rendering/renderer_rd/shader_rd.cpp
index 6f29ff42bc..27305cc938 100644
--- a/servers/rendering/renderer_rd/shader_rd.cpp
+++ b/servers/rendering/renderer_rd/shader_rd.cpp
@@ -31,8 +31,8 @@
#include "shader_rd.h"
#include "core/io/compression.h"
-#include "core/os/dir_access.h"
-#include "core/os/file_access.h"
+#include "core/io/dir_access.h"
+#include "core/io/file_access.h"
#include "renderer_compositor_rd.h"
#include "servers/rendering/rendering_device.h"
#include "thirdparty/misc/smolv.h"
diff --git a/servers/rendering/renderer_rd/shaders/scene_forward_clustered.glsl b/servers/rendering/renderer_rd/shaders/scene_forward_clustered.glsl
index 23f56fd42d..ce02d5c4d0 100644
--- a/servers/rendering/renderer_rd/shaders/scene_forward_clustered.glsl
+++ b/servers/rendering/renderer_rd/shaders/scene_forward_clustered.glsl
@@ -850,7 +850,7 @@ void main() {
if (scene_data.roughness_limiter_enabled) {
//http://www.jp.square-enix.com/tech/library/pdf/ImprovedGeometricSpecularAA.pdf
float roughness2 = roughness * roughness;
- vec3 dndu = dFdx(normal), dndv = dFdx(normal);
+ vec3 dndu = dFdx(normal), dndv = dFdy(normal);
float variance = scene_data.roughness_limiter_amount * (dot(dndu, dndu) + dot(dndv, dndv));
float kernelRoughness2 = min(2.0 * variance, scene_data.roughness_limiter_limit); //limit effect
float filteredRoughness2 = min(1.0, roughness2 + kernelRoughness2);
diff --git a/servers/rendering/renderer_rd/shaders/scene_forward_mobile.glsl b/servers/rendering/renderer_rd/shaders/scene_forward_mobile.glsl
index d488c99b6d..aa8a0b96c5 100644
--- a/servers/rendering/renderer_rd/shaders/scene_forward_mobile.glsl
+++ b/servers/rendering/renderer_rd/shaders/scene_forward_mobile.glsl
@@ -96,6 +96,18 @@ layout(location = 8) out float dp_clip;
#endif
+#ifdef USE_MULTIVIEW
+#ifdef has_VK_KHR_multiview
+#define ViewIndex gl_ViewIndex
+#else
+// !BAS! This needs to become an input once we implement our fallback!
+#define ViewIndex 0
+#endif
+#else
+// Set to zero, not supported in non stereo
+#define ViewIndex 0
+#endif //USE_MULTIVIEW
+
invariant gl_Position;
#GLOBALS
@@ -234,7 +246,13 @@ void main() {
vec4 position;
#endif
+#ifdef USE_MULTIVIEW
+ mat4 projection_matrix = scene_data.projection_matrix_view[ViewIndex];
+ mat4 inv_projection_matrix = scene_data.inv_projection_matrix_view[ViewIndex];
+#else
mat4 projection_matrix = scene_data.projection_matrix;
+ mat4 inv_projection_matrix = scene_data.inv_projection_matrix;
+#endif //USE_MULTIVIEW
//using world coordinates
#if !defined(SKIP_TRANSFORM_USED) && defined(VERTEX_WORLD_COORDS_USED)
@@ -386,10 +404,26 @@ layout(location = 8) in float dp_clip;
#endif
+#ifdef USE_MULTIVIEW
+#ifdef has_VK_KHR_multiview
+#define ViewIndex gl_ViewIndex
+#else
+// !BAS! This needs to become an input once we implement our fallback!
+#define ViewIndex 0
+#endif
+#else
+// Set to zero, not supported in non stereo
+#define ViewIndex 0
+#endif //USE_MULTIVIEW
+
//defines to keep compatibility with vertex
#define world_matrix draw_call.transform
+#ifdef USE_MULTIVIEW
+#define projection_matrix scene_data.projection_matrix_view[ViewIndex]
+#else
#define projection_matrix scene_data.projection_matrix
+#endif
#if defined(ENABLE_SSS) && defined(ENABLE_TRANSMITTANCE)
//both required for transmittance to be enabled
@@ -761,7 +795,7 @@ void main() {
if (scene_data.roughness_limiter_enabled) {
//http://www.jp.square-enix.com/tech/library/pdf/ImprovedGeometricSpecularAA.pdf
float roughness2 = roughness * roughness;
- vec3 dndu = dFdx(normal), dndv = dFdx(normal);
+ vec3 dndu = dFdx(normal), dndv = dFdy(normal);
float variance = scene_data.roughness_limiter_amount * (dot(dndu, dndu) + dot(dndv, dndv));
float kernelRoughness2 = min(2.0 * variance, scene_data.roughness_limiter_limit); //limit effect
float filteredRoughness2 = min(1.0, roughness2 + kernelRoughness2);
diff --git a/servers/rendering/renderer_rd/shaders/scene_forward_mobile_inc.glsl b/servers/rendering/renderer_rd/shaders/scene_forward_mobile_inc.glsl
index 656a764a89..7fcd84695d 100644
--- a/servers/rendering/renderer_rd/shaders/scene_forward_mobile_inc.glsl
+++ b/servers/rendering/renderer_rd/shaders/scene_forward_mobile_inc.glsl
@@ -1,4 +1,9 @@
#define M_PI 3.14159265359
+#define MAX_VIEWS 2
+
+#if defined(USE_MULTIVIEW) && defined(has_VK_KHR_multiview)
+#extension GL_EXT_multiview : enable
+#endif
#include "decal_data_inc.glsl"
@@ -121,10 +126,13 @@ global_variables;
layout(set = 1, binding = 0, std140) uniform SceneData {
mat4 projection_matrix;
mat4 inv_projection_matrix;
-
mat4 camera_matrix;
mat4 inv_camera_matrix;
+ // only used for multiview
+ mat4 projection_matrix_view[MAX_VIEWS];
+ mat4 inv_projection_matrix_view[MAX_VIEWS];
+
vec2 viewport_size;
vec2 screen_pixel_size;
diff --git a/servers/rendering/renderer_rd/shaders/sky.glsl b/servers/rendering/renderer_rd/shaders/sky.glsl
index 9924da37d5..41c6325bc5 100644
--- a/servers/rendering/renderer_rd/shaders/sky.glsl
+++ b/servers/rendering/renderer_rd/shaders/sky.glsl
@@ -4,11 +4,17 @@
#VERSION_DEFINES
+#define MAX_VIEWS 2
+
+#if defined(USE_MULTIVIEW) && defined(has_VK_KHR_multiview)
+#extension GL_EXT_multiview : enable
+#endif
+
layout(location = 0) out vec2 uv_interp;
layout(push_constant, binding = 1, std430) uniform Params {
mat3 orientation;
- vec4 proj;
+ vec4 projections[MAX_VIEWS];
vec4 position_multiplier;
float time;
}
@@ -26,15 +32,29 @@ void main() {
#VERSION_DEFINES
+#ifdef USE_MULTIVIEW
+#ifdef has_VK_KHR_multiview
+#extension GL_EXT_multiview : enable
+#define ViewIndex gl_ViewIndex
+#else // has_VK_KHR_multiview
+// !BAS! This needs to become an input once we implement our fallback!
+#define ViewIndex 0
+#endif // has_VK_KHR_multiview
+#else // USE_MULTIVIEW
+// Set to zero, not supported in non stereo
+#define ViewIndex 0
+#endif //USE_MULTIVIEW
+
#define M_PI 3.14159265359
+#define MAX_VIEWS 2
layout(location = 0) in vec2 uv_interp;
layout(push_constant, binding = 1, std430) uniform Params {
mat3 orientation;
- vec4 proj;
+ vec4 projections[MAX_VIEWS];
vec4 position_multiplier;
- float time; //TODO consider adding vec2 screen res, and float radiance size
+ float time;
}
params;
@@ -85,7 +105,6 @@ struct DirectionalLightData {
layout(set = 0, binding = 3, std140) uniform DirectionalLights {
DirectionalLightData data[MAX_DIRECTIONAL_LIGHT_DATA_STRUCTS];
}
-
directional_lights;
#ifdef MATERIAL_UNIFORMS_USED
@@ -154,8 +173,8 @@ vec4 fog_process(vec3 view, vec3 sky_color) {
void main() {
vec3 cube_normal;
cube_normal.z = -1.0;
- cube_normal.x = (cube_normal.z * (-uv_interp.x - params.proj.x)) / params.proj.y;
- cube_normal.y = -(cube_normal.z * (-uv_interp.y - params.proj.z)) / params.proj.w;
+ cube_normal.x = (cube_normal.z * (-uv_interp.x - params.projections[ViewIndex].x)) / params.projections[ViewIndex].y;
+ cube_normal.y = -(cube_normal.z * (-uv_interp.y - params.projections[ViewIndex].z)) / params.projections[ViewIndex].w;
cube_normal = mat3(params.orientation) * cube_normal;
cube_normal.z = -cube_normal.z;
cube_normal = normalize(cube_normal);
diff --git a/servers/rendering/renderer_rd/shaders/tonemap.glsl b/servers/rendering/renderer_rd/shaders/tonemap.glsl
index 86b4da6b08..23f83b3b9c 100644
--- a/servers/rendering/renderer_rd/shaders/tonemap.glsl
+++ b/servers/rendering/renderer_rd/shaders/tonemap.glsl
@@ -4,6 +4,12 @@
#VERSION_DEFINES
+#ifdef MULTIVIEW
+#ifdef has_VK_KHR_multiview
+#extension GL_EXT_multiview : enable
+#endif
+#endif
+
layout(location = 0) out vec2 uv_interp;
void main() {
@@ -18,9 +24,22 @@ void main() {
#VERSION_DEFINES
+#ifdef MULTIVIEW
+#ifdef has_VK_KHR_multiview
+#extension GL_EXT_multiview : enable
+#define ViewIndex gl_ViewIndex
+#else // has_VK_KHR_multiview
+#define ViewIndex 0
+#endif // has_VK_KHR_multiview
+#endif //MULTIVIEW
+
layout(location = 0) in vec2 uv_interp;
+#ifdef MULTIVIEW
+layout(set = 0, binding = 0) uniform sampler2DArray source_color;
+#else
layout(set = 0, binding = 0) uniform sampler2D source_color;
+#endif
layout(set = 1, binding = 0) uniform sampler2D source_auto_exposure;
layout(set = 2, binding = 0) uniform sampler2D source_glow;
#ifdef USE_1D_LUT
@@ -277,10 +296,17 @@ vec3 do_fxaa(vec3 color, float exposure, vec2 uv_interp) {
const float FXAA_REDUCE_MUL = (1.0 / 8.0);
const float FXAA_SPAN_MAX = 8.0;
+#ifdef MULTIVIEW
+ vec3 rgbNW = textureLod(source_color, vec3(uv_interp + vec2(-1.0, -1.0) * params.pixel_size, ViewIndex), 0.0).xyz * exposure;
+ vec3 rgbNE = textureLod(source_color, vec3(uv_interp + vec2(1.0, -1.0) * params.pixel_size, ViewIndex), 0.0).xyz * exposure;
+ vec3 rgbSW = textureLod(source_color, vec3(uv_interp + vec2(-1.0, 1.0) * params.pixel_size, ViewIndex), 0.0).xyz * exposure;
+ vec3 rgbSE = textureLod(source_color, vec3(uv_interp + vec2(1.0, 1.0) * params.pixel_size, ViewIndex), 0.0).xyz * exposure;
+#else
vec3 rgbNW = textureLod(source_color, uv_interp + vec2(-1.0, -1.0) * params.pixel_size, 0.0).xyz * exposure;
vec3 rgbNE = textureLod(source_color, uv_interp + vec2(1.0, -1.0) * params.pixel_size, 0.0).xyz * exposure;
vec3 rgbSW = textureLod(source_color, uv_interp + vec2(-1.0, 1.0) * params.pixel_size, 0.0).xyz * exposure;
vec3 rgbSE = textureLod(source_color, uv_interp + vec2(1.0, 1.0) * params.pixel_size, 0.0).xyz * exposure;
+#endif
vec3 rgbM = color;
vec3 luma = vec3(0.299, 0.587, 0.114);
float lumaNW = dot(rgbNW, luma);
@@ -305,8 +331,13 @@ vec3 do_fxaa(vec3 color, float exposure, vec2 uv_interp) {
dir * rcpDirMin)) *
params.pixel_size;
+#ifdef MULTIVIEW
+ vec3 rgbA = 0.5 * exposure * (textureLod(source_color, vec3(uv_interp + dir * (1.0 / 3.0 - 0.5), ViewIndex), 0.0).xyz + textureLod(source_color, vec3(uv_interp + dir * (2.0 / 3.0 - 0.5), ViewIndex), 0.0).xyz);
+ vec3 rgbB = rgbA * 0.5 + 0.25 * exposure * (textureLod(source_color, vec3(uv_interp + dir * -0.5, ViewIndex), 0.0).xyz + textureLod(source_color, vec3(uv_interp + dir * 0.5, ViewIndex), 0.0).xyz);
+#else
vec3 rgbA = 0.5 * exposure * (textureLod(source_color, uv_interp + dir * (1.0 / 3.0 - 0.5), 0.0).xyz + textureLod(source_color, uv_interp + dir * (2.0 / 3.0 - 0.5), 0.0).xyz);
vec3 rgbB = rgbA * 0.5 + 0.25 * exposure * (textureLod(source_color, uv_interp + dir * -0.5, 0.0).xyz + textureLod(source_color, uv_interp + dir * 0.5, 0.0).xyz);
+#endif
float lumaB = dot(rgbB, luma);
if ((lumaB < lumaMin) || (lumaB > lumaMax)) {
@@ -329,7 +360,11 @@ vec3 screen_space_dither(vec2 frag_coord) {
}
void main() {
+#ifdef MULTIVIEW
+ vec3 color = textureLod(source_color, vec3(uv_interp, ViewIndex), 0.0f).rgb;
+#else
vec3 color = textureLod(source_color, uv_interp, 0.0f).rgb;
+#endif
// Exposure
diff --git a/servers/rendering/renderer_scene.h b/servers/rendering/renderer_scene.h
index 355c092dba..3b25498ed8 100644
--- a/servers/rendering/renderer_scene.h
+++ b/servers/rendering/renderer_scene.h
@@ -63,6 +63,8 @@ public:
virtual void scenario_set_reflection_atlas_size(RID p_scenario, int p_reflection_size, int p_reflection_count) = 0;
virtual bool is_scenario(RID p_scenario) const = 0;
virtual RID scenario_get_environment(RID p_scenario) = 0;
+ virtual void scenario_add_viewport_visibility_mask(RID p_scenario, RID p_viewport) = 0;
+ virtual void scenario_remove_viewport_visibility_mask(RID p_scenario, RID p_viewport) = 0;
virtual RID instance_allocate() = 0;
virtual void instance_initialize(RID p_rid) = 0;
@@ -82,6 +84,7 @@ public:
virtual void instance_set_exterior(RID p_instance, bool p_enabled) = 0;
virtual void instance_set_extra_visibility_margin(RID p_instance, real_t p_margin) = 0;
+ virtual void instance_set_visibility_parent(RID p_instance, RID p_parent_instance) = 0;
// don't use these in a game!
virtual Vector<ObjectID> instances_cull_aabb(const AABB &p_aabb, RID p_scenario = RID()) const = 0;
@@ -92,8 +95,7 @@ public:
virtual void instance_geometry_set_cast_shadows_setting(RID p_instance, RS::ShadowCastingSetting p_shadow_casting_setting) = 0;
virtual void instance_geometry_set_material_override(RID p_instance, RID p_material) = 0;
- virtual void instance_geometry_set_draw_range(RID p_instance, float p_min, float p_max, float p_min_margin, float p_max_margin) = 0;
- virtual void instance_geometry_set_as_instance_lod(RID p_instance, RID p_as_lod_of_instance) = 0;
+ virtual void instance_geometry_set_visibility_range(RID p_instance, float p_min, float p_max, float p_min_margin, float p_max_margin) = 0;
virtual void instance_geometry_set_lightmap(RID p_instance, RID p_lightmap, const Rect2 &p_lightmap_uv_scale, int p_slice_index) = 0;
virtual void instance_geometry_set_lod_bias(RID p_instance, float p_lod_bias) = 0;
@@ -189,7 +191,7 @@ public:
virtual RID render_buffers_create() = 0;
- virtual void render_buffers_configure(RID p_render_buffers, RID p_render_target, int p_width, int p_height, RS::ViewportMSAA p_msaa, RS::ViewportScreenSpaceAA p_screen_space_aa, bool p_use_debanding) = 0;
+ virtual void render_buffers_configure(RID p_render_buffers, RID p_render_target, int p_width, int p_height, RS::ViewportMSAA p_msaa, RS::ViewportScreenSpaceAA p_screen_space_aa, bool p_use_debanding, uint32_t p_view_count) = 0;
virtual void gi_set_use_half_resolution(bool p_enable) = 0;
@@ -201,8 +203,7 @@ public:
virtual void sdfgi_set_debug_probe_select(const Vector3 &p_position, const Vector3 &p_dir) = 0;
virtual void render_empty_scene(RID p_render_buffers, RID p_scenario, RID p_shadow_atlas) = 0;
- virtual void render_camera(RID p_render_buffers, RID p_camera, RID p_scenario, RID p_viewport, Size2 p_viewport_size, float p_lod_threshold, RID p_shadow_atlas) = 0;
- virtual void render_camera(RID p_render_buffers, Ref<XRInterface> &p_interface, XRInterface::Eyes p_eye, RID p_camera, RID p_scenario, RID p_viewport, Size2 p_viewport_size, float p_lod_threshold, RID p_shadow_atlas) = 0;
+ virtual void render_camera(RID p_render_buffers, RID p_camera, RID p_scenario, RID p_viewport, Size2 p_viewport_size, float p_lod_threshold, RID p_shadow_atlas, Ref<XRInterface> &p_xr_interface) = 0;
virtual void update() = 0;
virtual void render_probes() = 0;
diff --git a/servers/rendering/renderer_scene_cull.cpp b/servers/rendering/renderer_scene_cull.cpp
index a001aea5f4..2c66b22089 100644
--- a/servers/rendering/renderer_scene_cull.cpp
+++ b/servers/rendering/renderer_scene_cull.cpp
@@ -323,6 +323,7 @@ void RendererSceneCull::scenario_initialize(RID p_rid) {
scenario->instance_aabbs.set_page_pool(&instance_aabb_page_pool);
scenario->instance_data.set_page_pool(&instance_data_page_pool);
+ scenario->instance_visibility.set_page_pool(&instance_visibility_data_page_pool);
RendererSceneOcclusionCull::get_singleton()->add_scenario(p_rid);
@@ -369,6 +370,37 @@ RID RendererSceneCull::scenario_get_environment(RID p_scenario) {
return scenario->environment;
}
+void RendererSceneCull::scenario_remove_viewport_visibility_mask(RID p_scenario, RID p_viewport) {
+ Scenario *scenario = scenario_owner.getornull(p_scenario);
+ ERR_FAIL_COND(!scenario);
+ if (!scenario->viewport_visibility_masks.has(p_viewport)) {
+ return;
+ }
+
+ uint64_t mask = scenario->viewport_visibility_masks[p_viewport];
+ scenario->used_viewport_visibility_bits &= ~mask;
+ scenario->viewport_visibility_masks.erase(p_viewport);
+}
+
+void RendererSceneCull::scenario_add_viewport_visibility_mask(RID p_scenario, RID p_viewport) {
+ Scenario *scenario = scenario_owner.getornull(p_scenario);
+ ERR_FAIL_COND(!scenario);
+ ERR_FAIL_COND(scenario->viewport_visibility_masks.has(p_viewport));
+
+ uint64_t new_mask = 1;
+ while (new_mask & scenario->used_viewport_visibility_bits) {
+ new_mask <<= 1;
+ }
+
+ if (new_mask == 0) {
+ ERR_PRINT("Only 64 viewports per scenario allowed when using visibility ranges.");
+ new_mask = ((uint64_t)1) << 63;
+ }
+
+ scenario->viewport_visibility_masks[p_viewport] = new_mask;
+ scenario->used_viewport_visibility_bits |= new_mask;
+}
+
/* INSTANCING API */
void RendererSceneCull::_instance_queue_update(Instance *p_instance, bool p_update_aabb, bool p_update_dependencies) {
@@ -1103,10 +1135,142 @@ void RendererSceneCull::instance_geometry_set_material_override(RID p_instance,
}
}
-void RendererSceneCull::instance_geometry_set_draw_range(RID p_instance, float p_min, float p_max, float p_min_margin, float p_max_margin) {
+void RendererSceneCull::instance_geometry_set_visibility_range(RID p_instance, float p_min, float p_max, float p_min_margin, float p_max_margin) {
+ Instance *instance = instance_owner.getornull(p_instance);
+ ERR_FAIL_COND(!instance);
+
+ instance->visibility_range_begin = p_min;
+ instance->visibility_range_end = p_max;
+ instance->visibility_range_begin_margin = p_min_margin;
+ instance->visibility_range_end_margin = p_max_margin;
+
+ _update_instance_visibility_dependencies(instance);
+
+ if (instance->scenario && instance->visibility_index != -1) {
+ InstanceVisibilityData &vd = instance->scenario->instance_visibility[instance->visibility_index];
+ vd.range_begin = instance->visibility_range_begin;
+ vd.range_end = instance->visibility_range_end;
+ vd.range_begin_margin = instance->visibility_range_begin_margin;
+ vd.range_end_margin = instance->visibility_range_end_margin;
+ }
+}
+
+void RendererSceneCull::instance_set_visibility_parent(RID p_instance, RID p_parent_instance) {
+ Instance *instance = instance_owner.getornull(p_instance);
+ ERR_FAIL_COND(!instance);
+
+ Instance *old_parent = instance->visibility_parent;
+ if (old_parent) {
+ if ((1 << old_parent->base_type) & RS::INSTANCE_GEOMETRY_MASK && old_parent->base_data) {
+ InstanceGeometryData *old_parent_geom = static_cast<InstanceGeometryData *>(old_parent->base_data);
+ old_parent_geom->visibility_dependencies.erase(instance);
+ _update_instance_visibility_depth(old_parent);
+ }
+ instance->visibility_parent = nullptr;
+ }
+
+ Instance *parent = instance_owner.getornull(p_parent_instance);
+ ERR_FAIL_COND(p_parent_instance.is_valid() && !parent);
+
+ if (parent) {
+ if ((1 << parent->base_type) & RS::INSTANCE_GEOMETRY_MASK && parent->base_data) {
+ InstanceGeometryData *parent_geom = static_cast<InstanceGeometryData *>(parent->base_data);
+ parent_geom->visibility_dependencies.insert(instance);
+ _update_instance_visibility_depth(parent);
+ }
+ instance->visibility_parent = parent;
+ }
+
+ _update_instance_visibility_dependencies(instance);
+}
+
+void RendererSceneCull::_update_instance_visibility_depth(Instance *p_instance) {
+ bool cycle_detected = false;
+ Set<Instance *> traversed_nodes;
+
+ {
+ Instance *instance = p_instance;
+ while (instance && ((1 << instance->base_type) & RS::INSTANCE_GEOMETRY_MASK) && instance->base_data) {
+ InstanceGeometryData *geom = static_cast<InstanceGeometryData *>(instance->base_data);
+ if (!geom->visibility_dependencies.is_empty()) {
+ uint32_t depth = 0;
+ for (Set<Instance *>::Element *E = geom->visibility_dependencies.front(); E; E = E->next()) {
+ if (((1 << E->get()->base_type) & RS::INSTANCE_GEOMETRY_MASK) == 0 || !E->get()->base_data) {
+ continue;
+ }
+ InstanceGeometryData *child_geom = static_cast<InstanceGeometryData *>(E->get()->base_data);
+ depth = MAX(depth, child_geom->visibility_dependencies_depth);
+ }
+ geom->visibility_dependencies_depth = depth + 1;
+ } else {
+ geom->visibility_dependencies_depth = 0;
+ }
+
+ if (instance->scenario && instance->visibility_index != -1) {
+ instance->scenario->instance_visibility.move(instance->visibility_index, geom->visibility_dependencies_depth);
+ }
+
+ traversed_nodes.insert(instance);
+
+ instance = instance->visibility_parent;
+ if (traversed_nodes.has(instance)) {
+ cycle_detected = true;
+ break;
+ }
+ }
+ }
+
+ if (cycle_detected) {
+ ERR_PRINT("Cycle detected in the visibility dependecies tree.");
+ for (Set<Instance *>::Element *E = traversed_nodes.front(); E; E = E->next()) {
+ Instance *instance = E->get();
+ InstanceGeometryData *geom = static_cast<InstanceGeometryData *>(instance->base_data);
+ geom->visibility_dependencies_depth = 0;
+ if (instance->scenario && instance->visibility_index != -1) {
+ instance->scenario->instance_visibility.move(instance->visibility_index, geom->visibility_dependencies_depth);
+ }
+ }
+ }
}
-void RendererSceneCull::instance_geometry_set_as_instance_lod(RID p_instance, RID p_as_lod_of_instance) {
+void RendererSceneCull::_update_instance_visibility_dependencies(Instance *p_instance) {
+ bool is_geometry_instance = ((1 << p_instance->base_type) & RS::INSTANCE_GEOMETRY_MASK) && p_instance->base_data;
+ bool has_visibility_range = p_instance->visibility_range_begin > 0.0 || p_instance->visibility_range_end > 0.0;
+ bool needs_visibility_cull = has_visibility_range && is_geometry_instance && p_instance->array_index != -1;
+
+ if (!needs_visibility_cull && p_instance->visibility_index != -1) {
+ p_instance->scenario->instance_visibility.remove(p_instance->visibility_index);
+ p_instance->visibility_index = -1;
+ } else if (needs_visibility_cull && p_instance->visibility_index == -1) {
+ InstanceVisibilityData vd;
+ vd.instance = p_instance;
+ vd.range_begin = p_instance->visibility_range_begin;
+ vd.range_end = p_instance->visibility_range_end;
+ vd.range_begin_margin = p_instance->visibility_range_begin_margin;
+ vd.range_end_margin = p_instance->visibility_range_end_margin;
+ vd.position = p_instance->transformed_aabb.get_position() + p_instance->transformed_aabb.get_size() / 2.0f;
+ vd.array_index = p_instance->array_index;
+
+ InstanceGeometryData *geom_data = static_cast<InstanceGeometryData *>(p_instance->base_data);
+ p_instance->scenario->instance_visibility.insert(vd, geom_data->visibility_dependencies_depth);
+ }
+
+ if (p_instance->scenario && p_instance->array_index != -1) {
+ p_instance->scenario->instance_data[p_instance->array_index].visibility_index = p_instance->visibility_index;
+
+ InstanceGeometryData *geom_data = static_cast<InstanceGeometryData *>(p_instance->base_data);
+ if ((has_visibility_range || p_instance->visibility_parent) && (p_instance->visibility_index == -1 || (geom_data && geom_data->visibility_dependencies_depth == 0))) {
+ p_instance->scenario->instance_data[p_instance->array_index].flags |= InstanceData::FLAG_VISIBILITY_DEPENDENCY_NEEDS_CHECK;
+ } else {
+ p_instance->scenario->instance_data[p_instance->array_index].flags &= ~InstanceData::FLAG_VISIBILITY_DEPENDENCY_NEEDS_CHECK;
+ }
+
+ if (p_instance->visibility_parent) {
+ p_instance->scenario->instance_data[p_instance->array_index].parent_array_index = p_instance->visibility_parent->array_index;
+ } else {
+ p_instance->scenario->instance_data[p_instance->array_index].parent_array_index = -1;
+ }
+ }
}
void RendererSceneCull::instance_geometry_set_lightmap(RID p_instance, RID p_lightmap, const Rect2 &p_lightmap_uv_scale, int p_slice_index) {
@@ -1352,12 +1516,23 @@ void RendererSceneCull::_update_instance(Instance *p_instance) {
idata.layer_mask = p_instance->layer_mask;
idata.flags = p_instance->base_type; //changing it means de-indexing, so this never needs to be changed later
idata.base_rid = p_instance->base;
+ idata.parent_array_index = p_instance->visibility_parent ? p_instance->visibility_parent->array_index : -1;
+ idata.visibility_index = p_instance->visibility_index;
+
switch (p_instance->base_type) {
case RS::INSTANCE_MESH:
case RS::INSTANCE_MULTIMESH:
case RS::INSTANCE_IMMEDIATE:
case RS::INSTANCE_PARTICLES: {
- idata.instance_geometry = static_cast<InstanceGeometryData *>(p_instance->base_data)->geometry_instance;
+ InstanceGeometryData *geom = static_cast<InstanceGeometryData *>(p_instance->base_data);
+ idata.instance_geometry = geom->geometry_instance;
+
+ for (Set<Instance *>::Element *E = geom->visibility_dependencies.front(); E; E = E->next()) {
+ Instance *dep_instance = E->get();
+ if (dep_instance->array_index != -1) {
+ dep_instance->scenario->instance_data[dep_instance->array_index].parent_array_index = p_instance->array_index;
+ }
+ }
} break;
case RS::INSTANCE_LIGHT: {
idata.instance_data_rid = static_cast<InstanceLightData *>(p_instance->base_data)->instance.get_id();
@@ -1404,6 +1579,7 @@ void RendererSceneCull::_update_instance(Instance *p_instance) {
p_instance->scenario->instance_data.push_back(idata);
p_instance->scenario->instance_aabbs.push_back(InstanceBounds(p_instance->transformed_aabb));
+ _update_instance_visibility_dependencies(p_instance);
} else {
if ((1 << p_instance->base_type) & RS::INSTANCE_GEOMETRY_MASK) {
p_instance->scenario->indexers[Scenario::INDEXER_GEOMETRY].update(p_instance->indexer_id, bvh_aabb);
@@ -1413,6 +1589,10 @@ void RendererSceneCull::_update_instance(Instance *p_instance) {
p_instance->scenario->instance_aabbs[p_instance->array_index] = InstanceBounds(p_instance->transformed_aabb);
}
+ if (p_instance->visibility_index != -1) {
+ p_instance->scenario->instance_visibility[p_instance->visibility_index].position = p_instance->transformed_aabb.get_position() + p_instance->transformed_aabb.get_size() / 2.0f;
+ }
+
//move instance and repair
pair_pass++;
@@ -1486,9 +1666,24 @@ void RendererSceneCull::_unpair_instance(Instance *p_instance) {
//replace this by last
int32_t swap_with_index = p_instance->scenario->instance_data.size() - 1;
if (swap_with_index != p_instance->array_index) {
- p_instance->scenario->instance_data[swap_with_index].instance->array_index = p_instance->array_index; //swap
+ Instance *swapped_instance = p_instance->scenario->instance_data[swap_with_index].instance;
+ swapped_instance->array_index = p_instance->array_index; //swap
p_instance->scenario->instance_data[p_instance->array_index] = p_instance->scenario->instance_data[swap_with_index];
p_instance->scenario->instance_aabbs[p_instance->array_index] = p_instance->scenario->instance_aabbs[swap_with_index];
+
+ if (swapped_instance->visibility_index != -1) {
+ swapped_instance->scenario->instance_visibility[swapped_instance->visibility_index].array_index = swapped_instance->array_index;
+ }
+
+ if ((1 << swapped_instance->base_type) & RS::INSTANCE_GEOMETRY_MASK) {
+ InstanceGeometryData *geom = static_cast<InstanceGeometryData *>(swapped_instance->base_data);
+ for (Set<Instance *>::Element *E = geom->visibility_dependencies.front(); E; E = E->next()) {
+ Instance *dep_instance = E->get();
+ if (dep_instance != p_instance && dep_instance->array_index != -1) {
+ dep_instance->scenario->instance_data[dep_instance->array_index].parent_array_index = swapped_instance->array_index;
+ }
+ }
+ }
}
// pop last
@@ -1505,7 +1700,16 @@ void RendererSceneCull::_unpair_instance(Instance *p_instance) {
scene_render->geometry_instance_pair_reflection_probe_instances(geom->geometry_instance, nullptr, 0);
scene_render->geometry_instance_pair_decal_instances(geom->geometry_instance, nullptr, 0);
scene_render->geometry_instance_pair_voxel_gi_instances(geom->geometry_instance, nullptr, 0);
+
+ for (Set<Instance *>::Element *E = geom->visibility_dependencies.front(); E; E = E->next()) {
+ Instance *dep_instance = E->get();
+ if (dep_instance->array_index != -1) {
+ dep_instance->scenario->instance_data[dep_instance->array_index].parent_array_index = -1;
+ }
+ }
}
+
+ _update_instance_visibility_dependencies(p_instance);
}
void RendererSceneCull::_update_instance_aabb(Instance *p_instance) {
@@ -2186,153 +2390,159 @@ bool RendererSceneCull::_light_instance_update_shadow(Instance *p_instance, cons
return animated_material_found;
}
-void RendererSceneCull::render_camera(RID p_render_buffers, RID p_camera, RID p_scenario, RID p_viewport, Size2 p_viewport_size, float p_screen_lod_threshold, RID p_shadow_atlas) {
-// render to mono camera
+void RendererSceneCull::render_camera(RID p_render_buffers, RID p_camera, RID p_scenario, RID p_viewport, Size2 p_viewport_size, float p_screen_lod_threshold, RID p_shadow_atlas, Ref<XRInterface> &p_xr_interface) {
#ifndef _3D_DISABLED
Camera *camera = camera_owner.getornull(p_camera);
ERR_FAIL_COND(!camera);
- /* STEP 1 - SETUP CAMERA */
- CameraMatrix camera_matrix;
- bool ortho = false;
-
- switch (camera->type) {
- case Camera::ORTHOGONAL: {
- camera_matrix.set_orthogonal(
- camera->size,
- p_viewport_size.width / (float)p_viewport_size.height,
- camera->znear,
- camera->zfar,
- camera->vaspect);
- ortho = true;
- } break;
- case Camera::PERSPECTIVE: {
- camera_matrix.set_perspective(
- camera->fov,
- p_viewport_size.width / (float)p_viewport_size.height,
- camera->znear,
- camera->zfar,
- camera->vaspect);
- ortho = false;
+ RendererSceneRender::CameraData camera_data;
+
+ // Setup Camera(s)
+ if (p_xr_interface.is_null()) {
+ // Normal camera
+ Transform3D transform = camera->transform;
+ CameraMatrix projection;
+ bool vaspect = camera->vaspect;
+ bool is_ortogonal = false;
+
+ switch (camera->type) {
+ case Camera::ORTHOGONAL: {
+ projection.set_orthogonal(
+ camera->size,
+ p_viewport_size.width / (float)p_viewport_size.height,
+ camera->znear,
+ camera->zfar,
+ camera->vaspect);
+ is_ortogonal = true;
+ } break;
+ case Camera::PERSPECTIVE: {
+ projection.set_perspective(
+ camera->fov,
+ p_viewport_size.width / (float)p_viewport_size.height,
+ camera->znear,
+ camera->zfar,
+ camera->vaspect);
- } break;
- case Camera::FRUSTUM: {
- camera_matrix.set_frustum(
- camera->size,
- p_viewport_size.width / (float)p_viewport_size.height,
- camera->offset,
- camera->znear,
- camera->zfar,
- camera->vaspect);
- ortho = false;
- } break;
+ } break;
+ case Camera::FRUSTUM: {
+ projection.set_frustum(
+ camera->size,
+ p_viewport_size.width / (float)p_viewport_size.height,
+ camera->offset,
+ camera->znear,
+ camera->zfar,
+ camera->vaspect);
+ } break;
+ }
+
+ camera_data.set_camera(transform, projection, is_ortogonal, vaspect);
+ } else {
+ // Setup our camera for our XR interface.
+ // We can support multiple views here each with their own camera
+ Transform3D transforms[RendererSceneRender::MAX_RENDER_VIEWS];
+ CameraMatrix projections[RendererSceneRender::MAX_RENDER_VIEWS];
+
+ uint32_t view_count = p_xr_interface->get_view_count();
+ ERR_FAIL_COND_MSG(view_count > RendererSceneRender::MAX_RENDER_VIEWS, "Requested view count is not supported");
+
+ float aspect = p_viewport_size.width / (float)p_viewport_size.height;
+
+ Transform3D world_origin = XRServer::get_singleton()->get_world_origin();
+
+ // We ignore our camera position, it will have been positioned with a slightly old tracking position.
+ // Instead we take our origin point and have our XR interface add fresh tracking data! Whoohoo!
+ for (uint32_t v = 0; v < view_count; v++) {
+ transforms[v] = p_xr_interface->get_transform_for_view(v, world_origin);
+ projections[v] = p_xr_interface->get_projection_for_view(v, aspect, camera->znear, camera->zfar);
+ }
+
+ if (view_count == 1) {
+ camera_data.set_camera(transforms[0], projections[0], false, camera->vaspect);
+ } else if (view_count == 2) {
+ camera_data.set_multiview_camera(view_count, transforms, projections, false, camera->vaspect);
+ } else {
+ // this won't be called (see fail check above) but keeping this comment to indicate we may support more then 2 views in the future...
+ }
}
RID environment = _render_get_environment(p_camera, p_scenario);
RENDER_TIMESTAMP("Update occlusion buffer")
- RendererSceneOcclusionCull::get_singleton()->buffer_update(p_viewport, camera->transform, camera_matrix, ortho, RendererThreadPool::singleton->thread_work_pool);
+ // For now just cull on the first camera
+ RendererSceneOcclusionCull::get_singleton()->buffer_update(p_viewport, camera_data.main_transform, camera_data.main_projection, camera_data.is_ortogonal, RendererThreadPool::singleton->thread_work_pool);
- _render_scene(camera->transform, camera_matrix, ortho, camera->vaspect, p_render_buffers, environment, camera->effects, camera->visible_layers, p_scenario, p_viewport, p_shadow_atlas, RID(), -1, p_screen_lod_threshold);
+ _render_scene(&camera_data, p_render_buffers, environment, camera->effects, camera->visible_layers, p_scenario, p_viewport, p_shadow_atlas, RID(), -1, p_screen_lod_threshold);
#endif
}
-void RendererSceneCull::render_camera(RID p_render_buffers, Ref<XRInterface> &p_interface, XRInterface::Eyes p_eye, RID p_camera, RID p_scenario, RID p_viewport, Size2 p_viewport_size, float p_screen_lod_threshold, RID p_shadow_atlas) {
- // render for AR/VR interface
-#if 0
- Camera *camera = camera_owner.getornull(p_camera);
- ERR_FAIL_COND(!camera);
+void RendererSceneCull::_visibility_cull_threaded(uint32_t p_thread, VisibilityCullData *cull_data) {
+ uint32_t total_threads = RendererThreadPool::singleton->thread_work_pool.get_thread_count();
+ uint32_t bin_from = p_thread * cull_data->cull_count / total_threads;
+ uint32_t bin_to = (p_thread + 1 == total_threads) ? cull_data->cull_count : ((p_thread + 1) * cull_data->cull_count / total_threads);
- /* SETUP CAMERA, we are ignoring type and FOV here */
- float aspect = p_viewport_size.width / (float)p_viewport_size.height;
- CameraMatrix camera_matrix = p_interface->get_projection_for_eye(p_eye, aspect, camera->znear, camera->zfar);
+ _visibility_cull(*cull_data, cull_data->cull_offset + bin_from, cull_data->cull_offset + bin_to);
+}
- // We also ignore our camera position, it will have been positioned with a slightly old tracking position.
- // Instead we take our origin point and have our ar/vr interface add fresh tracking data! Whoohoo!
- Transform3D world_origin = XRServer::get_singleton()->get_world_origin();
- Transform3D cam_transform = p_interface->get_transform_for_eye(p_eye, world_origin);
+void RendererSceneCull::_visibility_cull(const VisibilityCullData &cull_data, uint64_t p_from, uint64_t p_to) {
+ Scenario *scenario = cull_data.scenario;
+ for (unsigned int i = p_from; i < p_to; i++) {
+ InstanceVisibilityData &vd = scenario->instance_visibility[i];
+ InstanceData &idata = scenario->instance_data[vd.array_index];
- RID environment = _render_get_environment(p_camera, p_scenario);
+ if (idata.parent_array_index >= 0) {
+ uint32_t parent_flags = scenario->instance_data[idata.parent_array_index].flags;
+ if ((parent_flags & InstanceData::FLAG_VISIBILITY_DEPENDENCY_HIDDEN) || (parent_flags & InstanceData::FLAG_VISIBILITY_DEPENDENCY_HIDDEN_CLOSE_RANGE) == 0) {
+ idata.flags |= InstanceData::FLAG_VISIBILITY_DEPENDENCY_HIDDEN;
+ idata.flags &= ~InstanceData::FLAG_VISIBILITY_DEPENDENCY_HIDDEN_CLOSE_RANGE;
+ continue;
+ }
+ }
- // For stereo render we only prepare for our left eye and then reuse the outcome for our right eye
- if (p_eye == XRInterface::EYE_LEFT) {
- // Center our transform, we assume basis is equal.
- Transform3D mono_transform = cam_transform;
- Transform3D right_transform = p_interface->get_transform_for_eye(XRInterface::EYE_RIGHT, world_origin);
- mono_transform.origin += right_transform.origin;
- mono_transform.origin *= 0.5;
-
- // We need to combine our projection frustums for culling.
- // Ideally we should use our clipping planes for this and combine them,
- // however our shadow map logic uses our projection matrix.
- // Note: as our left and right frustums should be mirrored, we don't need our right projection matrix.
-
- // - get some base values we need
- float eye_dist = (mono_transform.origin - cam_transform.origin).length();
- float z_near = camera_matrix.get_z_near(); // get our near plane
- float z_far = camera_matrix.get_z_far(); // get our far plane
- float width = (2.0 * z_near) / camera_matrix.matrix[0][0];
- float x_shift = width * camera_matrix.matrix[2][0];
- float height = (2.0 * z_near) / camera_matrix.matrix[1][1];
- float y_shift = height * camera_matrix.matrix[2][1];
-
- // printf("Eye_dist = %f, Near = %f, Far = %f, Width = %f, Shift = %f\n", eye_dist, z_near, z_far, width, x_shift);
-
- // - calculate our near plane size (horizontal only, right_near is mirrored)
- float left_near = -eye_dist - ((width - x_shift) * 0.5);
-
- // - calculate our far plane size (horizontal only, right_far is mirrored)
- float left_far = -eye_dist - (z_far * (width - x_shift) * 0.5 / z_near);
- float left_far_right_eye = eye_dist - (z_far * (width + x_shift) * 0.5 / z_near);
- if (left_far > left_far_right_eye) {
- // on displays smaller then double our iod, the right eye far frustrum can overtake the left eyes.
- left_far = left_far_right_eye;
- }
-
- // - figure out required z-shift
- float slope = (left_far - left_near) / (z_far - z_near);
- float z_shift = (left_near / slope) - z_near;
-
- // - figure out new vertical near plane size (this will be slightly oversized thanks to our z-shift)
- float top_near = (height - y_shift) * 0.5;
- top_near += (top_near / z_near) * z_shift;
- float bottom_near = -(height + y_shift) * 0.5;
- bottom_near += (bottom_near / z_near) * z_shift;
-
- // printf("Left_near = %f, Left_far = %f, Top_near = %f, Bottom_near = %f, Z_shift = %f\n", left_near, left_far, top_near, bottom_near, z_shift);
-
- // - generate our frustum
- CameraMatrix combined_matrix;
- combined_matrix.set_frustum(left_near, -left_near, bottom_near, top_near, z_near + z_shift, z_far + z_shift);
-
- // and finally move our camera back
- Transform3D apply_z_shift;
- apply_z_shift.origin = Vector3(0.0, 0.0, z_shift); // z negative is forward so this moves it backwards
- mono_transform *= apply_z_shift;
-
- // now prepare our scene with our adjusted transform projection matrix
- _prepare_scene(mono_transform, combined_matrix, false, false, p_render_buffers, environment, camera->visible_layers, p_scenario, p_shadow_atlas, RID(), p_screen_lod_threshold);
- } else if (p_eye == XRInterface::EYE_MONO) {
- // For mono render, prepare as per usual
- _prepare_scene(cam_transform, camera_matrix, false, false, p_render_buffers, environment, camera->visible_layers, p_scenario, p_shadow_atlas, RID(), p_screen_lod_threshold);
- }
-
- // And render our scene...
- _render_scene(p_render_buffers, cam_transform, camera_matrix, false, environment, camera->effects, p_scenario, p_shadow_atlas, RID(), -1, p_screen_lod_threshold);
-#endif
-};
+ int range_check = _visibility_range_check(vd, cull_data.camera_position, cull_data.viewport_mask);
+
+ if (range_check == -1) {
+ idata.flags |= InstanceData::FLAG_VISIBILITY_DEPENDENCY_HIDDEN;
+ idata.flags &= ~InstanceData::FLAG_VISIBILITY_DEPENDENCY_HIDDEN_CLOSE_RANGE;
+ } else if (range_check == 1) {
+ idata.flags &= ~InstanceData::FLAG_VISIBILITY_DEPENDENCY_HIDDEN;
+ idata.flags |= InstanceData::FLAG_VISIBILITY_DEPENDENCY_HIDDEN_CLOSE_RANGE;
+ } else {
+ idata.flags &= ~InstanceData::FLAG_VISIBILITY_DEPENDENCY_HIDDEN;
+ idata.flags &= ~InstanceData::FLAG_VISIBILITY_DEPENDENCY_HIDDEN_CLOSE_RANGE;
+ }
+ }
+}
-void RendererSceneCull::_frustum_cull_threaded(uint32_t p_thread, CullData *cull_data) {
+int RendererSceneCull::_visibility_range_check(InstanceVisibilityData &r_vis_data, const Vector3 &p_camera_pos, uint64_t p_viewport_mask) {
+ float dist = p_camera_pos.distance_to(r_vis_data.position);
+
+ bool in_range_last_frame = p_viewport_mask & r_vis_data.viewport_state;
+ float begin_offset = in_range_last_frame ? -r_vis_data.range_begin_margin : r_vis_data.range_begin_margin;
+ float end_offset = in_range_last_frame ? r_vis_data.range_end_margin : -r_vis_data.range_end_margin;
+
+ if (r_vis_data.range_end > 0.0f && dist > r_vis_data.range_end + end_offset) {
+ r_vis_data.viewport_state &= ~p_viewport_mask;
+ return -1;
+ } else if (r_vis_data.range_begin > 0.0f && dist < r_vis_data.range_begin + begin_offset) {
+ r_vis_data.viewport_state &= ~p_viewport_mask;
+ return 1;
+ } else {
+ r_vis_data.viewport_state |= p_viewport_mask;
+ return 0;
+ }
+}
+
+void RendererSceneCull::_scene_cull_threaded(uint32_t p_thread, CullData *cull_data) {
uint32_t cull_total = cull_data->scenario->instance_data.size();
uint32_t total_threads = RendererThreadPool::singleton->thread_work_pool.get_thread_count();
uint32_t cull_from = p_thread * cull_total / total_threads;
uint32_t cull_to = (p_thread + 1 == total_threads) ? cull_total : ((p_thread + 1) * cull_total / total_threads);
- _frustum_cull(*cull_data, frustum_cull_result_threads[p_thread], cull_from, cull_to);
+ _scene_cull(*cull_data, scene_cull_result_threads[p_thread], cull_from, cull_to);
}
-void RendererSceneCull::_frustum_cull(CullData &cull_data, FrustumCullResult &cull_result, uint64_t p_from, uint64_t p_to) {
+void RendererSceneCull::_scene_cull(CullData &cull_data, InstanceCullResult &cull_result, uint64_t p_from, uint64_t p_to) {
uint64_t frame_number = RSG::rasterizer->get_frame_number();
float lightmap_probe_update_speed = RSG::storage->lightmap_get_probe_capture_update_speed() * RSG::rasterizer->get_frame_delta_time();
@@ -2347,177 +2557,192 @@ void RendererSceneCull::_frustum_cull(CullData &cull_data, FrustumCullResult &cu
for (uint64_t i = p_from; i < p_to; i++) {
bool mesh_visible = false;
- if (cull_data.scenario->instance_aabbs[i].in_frustum(cull_data.cull->frustum) && (cull_data.occlusion_buffer == nullptr || cull_data.scenario->instance_data[i].flags & InstanceData::FLAG_IGNORE_OCCLUSION_CULLING ||
- !cull_data.occlusion_buffer->is_occluded(cull_data.scenario->instance_aabbs[i].bounds, cull_data.cam_transform.origin, inv_cam_transform, *cull_data.camera_matrix, z_near))) {
- InstanceData &idata = cull_data.scenario->instance_data[i];
- uint32_t base_type = idata.flags & InstanceData::FLAG_BASE_TYPE_MASK;
-
- if ((cull_data.visible_layers & idata.layer_mask) == 0) {
- //failure
- } else if (base_type == RS::INSTANCE_LIGHT) {
- cull_result.lights.push_back(idata.instance);
- cull_result.light_instances.push_back(RID::from_uint64(idata.instance_data_rid));
- if (cull_data.shadow_atlas.is_valid() && RSG::storage->light_has_shadow(idata.base_rid)) {
- scene_render->light_instance_mark_visible(RID::from_uint64(idata.instance_data_rid)); //mark it visible for shadow allocation later
- }
-
- } else if (base_type == RS::INSTANCE_REFLECTION_PROBE) {
- if (cull_data.render_reflection_probe != idata.instance) {
- //avoid entering The Matrix
+ InstanceData &idata = cull_data.scenario->instance_data[i];
+ uint32_t visibility_flags = idata.flags & (InstanceData::FLAG_VISIBILITY_DEPENDENCY_HIDDEN_CLOSE_RANGE | InstanceData::FLAG_VISIBILITY_DEPENDENCY_HIDDEN);
+ int32_t visibility_check = -1;
- if ((idata.flags & InstanceData::FLAG_REFLECTION_PROBE_DIRTY) || scene_render->reflection_probe_instance_needs_redraw(RID::from_uint64(idata.instance_data_rid))) {
- InstanceReflectionProbeData *reflection_probe = static_cast<InstanceReflectionProbeData *>(idata.instance->base_data);
- cull_data.cull->lock.lock();
- if (!reflection_probe->update_list.in_list()) {
- reflection_probe->render_step = 0;
- reflection_probe_render_list.add_last(&reflection_probe->update_list);
- }
- cull_data.cull->lock.unlock();
+#define HIDDEN_BY_VISIBILITY_CHECKS (visibility_flags == InstanceData::FLAG_VISIBILITY_DEPENDENCY_HIDDEN_CLOSE_RANGE || visibility_flags == InstanceData::FLAG_VISIBILITY_DEPENDENCY_HIDDEN)
+#define LAYER_CHECK (cull_data.visible_layers & idata.layer_mask)
+#define IN_FRUSTUM(f) (cull_data.scenario->instance_aabbs[i].in_frustum(f))
+#define VIS_RANGE_CHECK ((idata.visibility_index == -1) || _visibility_range_check(cull_data.scenario->instance_visibility[idata.visibility_index], cull_data.cam_transform.origin, cull_data.visibility_cull_data->viewport_mask) == 0)
+#define VIS_PARENT_CHECK ((idata.parent_array_index == -1) || ((cull_data.scenario->instance_data[idata.parent_array_index].flags & InstanceData::FLAG_VISIBILITY_DEPENDENCY_NEEDS_CHECK) == InstanceData::FLAG_VISIBILITY_DEPENDENCY_HIDDEN_CLOSE_RANGE))
+#define VIS_CHECK (visibility_check < 0 ? (visibility_check = (visibility_flags != InstanceData::FLAG_VISIBILITY_DEPENDENCY_NEEDS_CHECK || (VIS_RANGE_CHECK && VIS_PARENT_CHECK))) : visibility_check)
+#define OCCLUSION_CULLED (cull_data.occlusion_buffer != nullptr && cull_data.scenario->instance_data[i].flags & InstanceData::FLAG_IGNORE_OCCLUSION_CULLING && cull_data.occlusion_buffer->is_occluded(cull_data.scenario->instance_aabbs[i].bounds, cull_data.cam_transform.origin, inv_cam_transform, *cull_data.camera_matrix, z_near))
- idata.flags &= ~uint32_t(InstanceData::FLAG_REFLECTION_PROBE_DIRTY);
+ if (!HIDDEN_BY_VISIBILITY_CHECKS) {
+ if (LAYER_CHECK && IN_FRUSTUM(cull_data.cull->frustum) && VIS_CHECK && !OCCLUSION_CULLED) {
+ uint32_t base_type = idata.flags & InstanceData::FLAG_BASE_TYPE_MASK;
+ if (base_type == RS::INSTANCE_LIGHT) {
+ cull_result.lights.push_back(idata.instance);
+ cull_result.light_instances.push_back(RID::from_uint64(idata.instance_data_rid));
+ if (cull_data.shadow_atlas.is_valid() && RSG::storage->light_has_shadow(idata.base_rid)) {
+ scene_render->light_instance_mark_visible(RID::from_uint64(idata.instance_data_rid)); //mark it visible for shadow allocation later
}
- if (scene_render->reflection_probe_instance_has_reflection(RID::from_uint64(idata.instance_data_rid))) {
- cull_result.reflections.push_back(RID::from_uint64(idata.instance_data_rid));
- }
- }
- } else if (base_type == RS::INSTANCE_DECAL) {
- cull_result.decals.push_back(RID::from_uint64(idata.instance_data_rid));
+ } else if (base_type == RS::INSTANCE_REFLECTION_PROBE) {
+ if (cull_data.render_reflection_probe != idata.instance) {
+ //avoid entering The Matrix
- } else if (base_type == RS::INSTANCE_VOXEL_GI) {
- InstanceVoxelGIData *voxel_gi = static_cast<InstanceVoxelGIData *>(idata.instance->base_data);
- cull_data.cull->lock.lock();
- if (!voxel_gi->update_element.in_list()) {
- voxel_gi_update_list.add(&voxel_gi->update_element);
- }
- cull_data.cull->lock.unlock();
- cull_result.voxel_gi_instances.push_back(RID::from_uint64(idata.instance_data_rid));
+ if ((idata.flags & InstanceData::FLAG_REFLECTION_PROBE_DIRTY) || scene_render->reflection_probe_instance_needs_redraw(RID::from_uint64(idata.instance_data_rid))) {
+ InstanceReflectionProbeData *reflection_probe = static_cast<InstanceReflectionProbeData *>(idata.instance->base_data);
+ cull_data.cull->lock.lock();
+ if (!reflection_probe->update_list.in_list()) {
+ reflection_probe->render_step = 0;
+ reflection_probe_render_list.add_last(&reflection_probe->update_list);
+ }
+ cull_data.cull->lock.unlock();
- } else if (base_type == RS::INSTANCE_LIGHTMAP) {
- cull_result.lightmaps.push_back(RID::from_uint64(idata.instance_data_rid));
- } else if (((1 << base_type) & RS::INSTANCE_GEOMETRY_MASK) && !(idata.flags & InstanceData::FLAG_CAST_SHADOWS_ONLY)) {
- bool keep = true;
+ idata.flags &= ~uint32_t(InstanceData::FLAG_REFLECTION_PROBE_DIRTY);
+ }
- if (idata.flags & InstanceData::FLAG_REDRAW_IF_VISIBLE) {
- RenderingServerDefault::redraw_request();
- }
+ if (scene_render->reflection_probe_instance_has_reflection(RID::from_uint64(idata.instance_data_rid))) {
+ cull_result.reflections.push_back(RID::from_uint64(idata.instance_data_rid));
+ }
+ }
+ } else if (base_type == RS::INSTANCE_DECAL) {
+ cull_result.decals.push_back(RID::from_uint64(idata.instance_data_rid));
+
+ } else if (base_type == RS::INSTANCE_VOXEL_GI) {
+ InstanceVoxelGIData *voxel_gi = static_cast<InstanceVoxelGIData *>(idata.instance->base_data);
+ cull_data.cull->lock.lock();
+ if (!voxel_gi->update_element.in_list()) {
+ voxel_gi_update_list.add(&voxel_gi->update_element);
+ }
+ cull_data.cull->lock.unlock();
+ cull_result.voxel_gi_instances.push_back(RID::from_uint64(idata.instance_data_rid));
- if (base_type == RS::INSTANCE_MESH) {
- mesh_visible = true;
- } else if (base_type == RS::INSTANCE_PARTICLES) {
- //particles visible? process them
- if (RSG::storage->particles_is_inactive(idata.base_rid)) {
- //but if nothing is going on, don't do it.
- keep = false;
- } else {
- cull_data.cull->lock.lock();
- RSG::storage->particles_request_process(idata.base_rid);
- cull_data.cull->lock.unlock();
- RSG::storage->particles_set_view_axis(idata.base_rid, -cull_data.cam_transform.basis.get_axis(2).normalized(), cull_data.cam_transform.basis.get_axis(1).normalized());
- //particles visible? request redraw
+ } else if (base_type == RS::INSTANCE_LIGHTMAP) {
+ cull_result.lightmaps.push_back(RID::from_uint64(idata.instance_data_rid));
+ } else if (((1 << base_type) & RS::INSTANCE_GEOMETRY_MASK) && !(idata.flags & InstanceData::FLAG_CAST_SHADOWS_ONLY)) {
+ bool keep = true;
+
+ if (idata.flags & InstanceData::FLAG_REDRAW_IF_VISIBLE) {
RenderingServerDefault::redraw_request();
}
- }
-
- if (geometry_instance_pair_mask & (1 << RS::INSTANCE_LIGHT) && (idata.flags & InstanceData::FLAG_GEOM_LIGHTING_DIRTY)) {
- InstanceGeometryData *geom = static_cast<InstanceGeometryData *>(idata.instance->base_data);
- uint32_t idx = 0;
- for (Set<Instance *>::Element *E = geom->lights.front(); E; E = E->next()) {
- InstanceLightData *light = static_cast<InstanceLightData *>(E->get()->base_data);
- instance_pair_buffer[idx++] = light->instance;
- if (idx == MAX_INSTANCE_PAIRS) {
- break;
+ if (base_type == RS::INSTANCE_MESH) {
+ mesh_visible = true;
+ } else if (base_type == RS::INSTANCE_PARTICLES) {
+ //particles visible? process them
+ if (RSG::storage->particles_is_inactive(idata.base_rid)) {
+ //but if nothing is going on, don't do it.
+ keep = false;
+ } else {
+ cull_data.cull->lock.lock();
+ RSG::storage->particles_request_process(idata.base_rid);
+ cull_data.cull->lock.unlock();
+ RSG::storage->particles_set_view_axis(idata.base_rid, -cull_data.cam_transform.basis.get_axis(2).normalized(), cull_data.cam_transform.basis.get_axis(1).normalized());
+ //particles visible? request redraw
+ RenderingServerDefault::redraw_request();
}
}
- scene_render->geometry_instance_pair_light_instances(geom->geometry_instance, instance_pair_buffer, idx);
- idata.flags &= ~uint32_t(InstanceData::FLAG_GEOM_LIGHTING_DIRTY);
- }
+ if (geometry_instance_pair_mask & (1 << RS::INSTANCE_LIGHT) && (idata.flags & InstanceData::FLAG_GEOM_LIGHTING_DIRTY)) {
+ InstanceGeometryData *geom = static_cast<InstanceGeometryData *>(idata.instance->base_data);
+ uint32_t idx = 0;
- if (geometry_instance_pair_mask & (1 << RS::INSTANCE_REFLECTION_PROBE) && (idata.flags & InstanceData::FLAG_GEOM_REFLECTION_DIRTY)) {
- InstanceGeometryData *geom = static_cast<InstanceGeometryData *>(idata.instance->base_data);
- uint32_t idx = 0;
+ for (Set<Instance *>::Element *E = geom->lights.front(); E; E = E->next()) {
+ InstanceLightData *light = static_cast<InstanceLightData *>(E->get()->base_data);
+ instance_pair_buffer[idx++] = light->instance;
+ if (idx == MAX_INSTANCE_PAIRS) {
+ break;
+ }
+ }
+
+ scene_render->geometry_instance_pair_light_instances(geom->geometry_instance, instance_pair_buffer, idx);
+ idata.flags &= ~uint32_t(InstanceData::FLAG_GEOM_LIGHTING_DIRTY);
+ }
+
+ if (geometry_instance_pair_mask & (1 << RS::INSTANCE_REFLECTION_PROBE) && (idata.flags & InstanceData::FLAG_GEOM_REFLECTION_DIRTY)) {
+ InstanceGeometryData *geom = static_cast<InstanceGeometryData *>(idata.instance->base_data);
+ uint32_t idx = 0;
- for (Set<Instance *>::Element *E = geom->reflection_probes.front(); E; E = E->next()) {
- InstanceReflectionProbeData *reflection_probe = static_cast<InstanceReflectionProbeData *>(E->get()->base_data);
+ for (Set<Instance *>::Element *E = geom->reflection_probes.front(); E; E = E->next()) {
+ InstanceReflectionProbeData *reflection_probe = static_cast<InstanceReflectionProbeData *>(E->get()->base_data);
- instance_pair_buffer[idx++] = reflection_probe->instance;
- if (idx == MAX_INSTANCE_PAIRS) {
- break;
+ instance_pair_buffer[idx++] = reflection_probe->instance;
+ if (idx == MAX_INSTANCE_PAIRS) {
+ break;
+ }
}
- }
- scene_render->geometry_instance_pair_reflection_probe_instances(geom->geometry_instance, instance_pair_buffer, idx);
- idata.flags &= ~uint32_t(InstanceData::FLAG_GEOM_REFLECTION_DIRTY);
- }
+ scene_render->geometry_instance_pair_reflection_probe_instances(geom->geometry_instance, instance_pair_buffer, idx);
+ idata.flags &= ~uint32_t(InstanceData::FLAG_GEOM_REFLECTION_DIRTY);
+ }
- if (geometry_instance_pair_mask & (1 << RS::INSTANCE_DECAL) && (idata.flags & InstanceData::FLAG_GEOM_DECAL_DIRTY)) {
- InstanceGeometryData *geom = static_cast<InstanceGeometryData *>(idata.instance->base_data);
- uint32_t idx = 0;
+ if (geometry_instance_pair_mask & (1 << RS::INSTANCE_DECAL) && (idata.flags & InstanceData::FLAG_GEOM_DECAL_DIRTY)) {
+ InstanceGeometryData *geom = static_cast<InstanceGeometryData *>(idata.instance->base_data);
+ uint32_t idx = 0;
- for (Set<Instance *>::Element *E = geom->decals.front(); E; E = E->next()) {
- InstanceDecalData *decal = static_cast<InstanceDecalData *>(E->get()->base_data);
+ for (Set<Instance *>::Element *E = geom->decals.front(); E; E = E->next()) {
+ InstanceDecalData *decal = static_cast<InstanceDecalData *>(E->get()->base_data);
- instance_pair_buffer[idx++] = decal->instance;
- if (idx == MAX_INSTANCE_PAIRS) {
- break;
+ instance_pair_buffer[idx++] = decal->instance;
+ if (idx == MAX_INSTANCE_PAIRS) {
+ break;
+ }
}
+ scene_render->geometry_instance_pair_decal_instances(geom->geometry_instance, instance_pair_buffer, idx);
+ idata.flags &= ~uint32_t(InstanceData::FLAG_GEOM_DECAL_DIRTY);
}
- scene_render->geometry_instance_pair_decal_instances(geom->geometry_instance, instance_pair_buffer, idx);
- idata.flags &= ~uint32_t(InstanceData::FLAG_GEOM_DECAL_DIRTY);
- }
- if (idata.flags & InstanceData::FLAG_GEOM_VOXEL_GI_DIRTY) {
- InstanceGeometryData *geom = static_cast<InstanceGeometryData *>(idata.instance->base_data);
- uint32_t idx = 0;
- for (Set<Instance *>::Element *E = geom->voxel_gi_instances.front(); E; E = E->next()) {
- InstanceVoxelGIData *voxel_gi = static_cast<InstanceVoxelGIData *>(E->get()->base_data);
+ if (idata.flags & InstanceData::FLAG_GEOM_VOXEL_GI_DIRTY) {
+ InstanceGeometryData *geom = static_cast<InstanceGeometryData *>(idata.instance->base_data);
+ uint32_t idx = 0;
+ for (Set<Instance *>::Element *E = geom->voxel_gi_instances.front(); E; E = E->next()) {
+ InstanceVoxelGIData *voxel_gi = static_cast<InstanceVoxelGIData *>(E->get()->base_data);
- instance_pair_buffer[idx++] = voxel_gi->probe_instance;
- if (idx == MAX_INSTANCE_PAIRS) {
- break;
+ instance_pair_buffer[idx++] = voxel_gi->probe_instance;
+ if (idx == MAX_INSTANCE_PAIRS) {
+ break;
+ }
}
- }
- scene_render->geometry_instance_pair_voxel_gi_instances(geom->geometry_instance, instance_pair_buffer, idx);
- idata.flags &= ~uint32_t(InstanceData::FLAG_GEOM_VOXEL_GI_DIRTY);
- }
+ scene_render->geometry_instance_pair_voxel_gi_instances(geom->geometry_instance, instance_pair_buffer, idx);
+ idata.flags &= ~uint32_t(InstanceData::FLAG_GEOM_VOXEL_GI_DIRTY);
+ }
- if ((idata.flags & InstanceData::FLAG_LIGHTMAP_CAPTURE) && idata.instance->last_frame_pass != frame_number && !idata.instance->lightmap_target_sh.is_empty() && !idata.instance->lightmap_sh.is_empty()) {
- InstanceGeometryData *geom = static_cast<InstanceGeometryData *>(idata.instance->base_data);
- Color *sh = idata.instance->lightmap_sh.ptrw();
- const Color *target_sh = idata.instance->lightmap_target_sh.ptr();
- for (uint32_t j = 0; j < 9; j++) {
- sh[j] = sh[j].lerp(target_sh[j], MIN(1.0, lightmap_probe_update_speed));
+ if ((idata.flags & InstanceData::FLAG_LIGHTMAP_CAPTURE) && idata.instance->last_frame_pass != frame_number && !idata.instance->lightmap_target_sh.is_empty() && !idata.instance->lightmap_sh.is_empty()) {
+ InstanceGeometryData *geom = static_cast<InstanceGeometryData *>(idata.instance->base_data);
+ Color *sh = idata.instance->lightmap_sh.ptrw();
+ const Color *target_sh = idata.instance->lightmap_target_sh.ptr();
+ for (uint32_t j = 0; j < 9; j++) {
+ sh[j] = sh[j].lerp(target_sh[j], MIN(1.0, lightmap_probe_update_speed));
+ }
+ scene_render->geometry_instance_set_lightmap_capture(geom->geometry_instance, sh);
+ idata.instance->last_frame_pass = frame_number;
}
- scene_render->geometry_instance_set_lightmap_capture(geom->geometry_instance, sh);
- idata.instance->last_frame_pass = frame_number;
- }
- if (keep) {
- cull_result.geometry_instances.push_back(idata.instance_geometry);
+ if (keep) {
+ cull_result.geometry_instances.push_back(idata.instance_geometry);
+ }
}
}
- }
- for (uint32_t j = 0; j < cull_data.cull->shadow_count; j++) {
- for (uint32_t k = 0; k < cull_data.cull->shadows[j].cascade_count; k++) {
- if (cull_data.scenario->instance_aabbs[i].in_frustum(cull_data.cull->shadows[j].cascades[k].frustum)) {
- InstanceData &idata = cull_data.scenario->instance_data[i];
- uint32_t base_type = idata.flags & InstanceData::FLAG_BASE_TYPE_MASK;
+ for (uint32_t j = 0; j < cull_data.cull->shadow_count; j++) {
+ for (uint32_t k = 0; k < cull_data.cull->shadows[j].cascade_count; k++) {
+ if (IN_FRUSTUM(cull_data.cull->shadows[j].cascades[k].frustum) && VIS_CHECK) {
+ uint32_t base_type = idata.flags & InstanceData::FLAG_BASE_TYPE_MASK;
- if (((1 << base_type) & RS::INSTANCE_GEOMETRY_MASK) && idata.flags & InstanceData::FLAG_CAST_SHADOWS) {
- cull_result.directional_shadows[j].cascade_geometry_instances[k].push_back(idata.instance_geometry);
- mesh_visible = true;
+ if (((1 << base_type) & RS::INSTANCE_GEOMETRY_MASK) && idata.flags & InstanceData::FLAG_CAST_SHADOWS) {
+ cull_result.directional_shadows[j].cascade_geometry_instances[k].push_back(idata.instance_geometry);
+ mesh_visible = true;
+ }
}
}
}
}
+#undef HIDDEN_BY_VISIBILITY_CHECKS
+#undef LAYER_CHECK
+#undef IN_FRUSTUM
+#undef VIS_RANGE_CHECK
+#undef VIS_PARENT_CHECK
+#undef VIS_CHECK
+#undef OCCLUSION_CULLED
+
for (uint32_t j = 0; j < cull_data.cull->sdfgi.region_count; j++) {
if (cull_data.scenario->instance_aabbs[i].in_aabb(cull_data.cull->sdfgi.region_aabb[j])) {
- InstanceData &idata = cull_data.scenario->instance_data[i];
uint32_t base_type = idata.flags & InstanceData::FLAG_BASE_TYPE_MASK;
if (base_type == RS::INSTANCE_LIGHT) {
@@ -2544,11 +2769,7 @@ void RendererSceneCull::_frustum_cull(CullData &cull_data, FrustumCullResult &cu
}
}
-void RendererSceneCull::_render_scene(const Transform3D &p_cam_transform, const CameraMatrix &p_cam_projection, bool p_cam_orthogonal, bool p_cam_vaspect, RID p_render_buffers, RID p_environment, RID p_force_camera_effects, uint32_t p_visible_layers, RID p_scenario, RID p_viewport, RID p_shadow_atlas, RID p_reflection_probe, int p_reflection_probe_pass, float p_screen_lod_threshold, bool p_using_shadows) {
- // Note, in stereo rendering:
- // - p_cam_transform will be a transform in the middle of our two eyes
- // - p_cam_projection is a wider frustrum that encompasses both eyes
-
+void RendererSceneCull::_render_scene(const RendererSceneRender::CameraData *p_camera_data, RID p_render_buffers, RID p_environment, RID p_force_camera_effects, uint32_t p_visible_layers, RID p_scenario, RID p_viewport, RID p_shadow_atlas, RID p_reflection_probe, int p_reflection_probe_pass, float p_screen_lod_threshold, bool p_using_shadows) {
Instance *render_reflection_probe = instance_owner.getornull(p_reflection_probe); //if null, not rendering to it
Scenario *scenario = scenario_owner.getornull(p_scenario);
@@ -2559,16 +2780,44 @@ void RendererSceneCull::_render_scene(const Transform3D &p_cam_transform, const
if (p_render_buffers.is_valid()) {
//no rendering code here, this is only to set up what needs to be done, request regions, etc.
- scene_render->sdfgi_update(p_render_buffers, p_environment, p_cam_transform.origin); //update conditions for SDFGI (whether its used or not)
+ scene_render->sdfgi_update(p_render_buffers, p_environment, p_camera_data->main_transform.origin); //update conditions for SDFGI (whether its used or not)
+ }
+
+ RENDER_TIMESTAMP("Visibility Dependencies");
+
+ VisibilityCullData visibility_cull_data;
+ if (scenario->instance_visibility.get_bin_count() > 0) {
+ if (!scenario->viewport_visibility_masks.has(p_viewport)) {
+ scenario_add_viewport_visibility_mask(scenario->self, p_viewport);
+ }
+
+ visibility_cull_data.scenario = scenario;
+ visibility_cull_data.viewport_mask = scenario->viewport_visibility_masks[p_viewport];
+ visibility_cull_data.camera_position = p_camera_data->main_transform.origin;
+
+ for (int i = scenario->instance_visibility.get_bin_count() - 1; i > 0; i--) { // We skip bin 0
+ visibility_cull_data.cull_offset = scenario->instance_visibility.get_bin_start(i);
+ visibility_cull_data.cull_count = scenario->instance_visibility.get_bin_size(i);
+
+ if (visibility_cull_data.cull_count == 0) {
+ continue;
+ }
+
+ if (visibility_cull_data.cull_count > thread_cull_threshold) {
+ RendererThreadPool::singleton->thread_work_pool.do_work(RendererThreadPool::singleton->thread_work_pool.get_thread_count(), this, &RendererSceneCull::_visibility_cull_threaded, &visibility_cull_data);
+ } else {
+ _visibility_cull(visibility_cull_data, visibility_cull_data.cull_offset, visibility_cull_data.cull_offset + visibility_cull_data.cull_count);
+ }
+ }
}
- RENDER_TIMESTAMP("Frustum Culling");
+ RENDER_TIMESTAMP("Culling");
- //rasterizer->set_camera(camera->transform, camera_matrix,ortho);
+ //rasterizer->set_camera(p_camera_data->main_transform, p_camera_data.main_projection, p_camera_data.is_ortogonal);
- Vector<Plane> planes = p_cam_projection.get_projection_planes(p_cam_transform);
+ Vector<Plane> planes = p_camera_data->main_projection.get_projection_planes(p_camera_data->main_transform);
- Plane near_plane(p_cam_transform.origin, -p_cam_transform.basis.get_axis(2).normalized());
+ Plane near_plane(p_camera_data->main_transform.origin, -p_camera_data->main_transform.basis.get_axis(2).normalized());
/* STEP 2 - CULL */
@@ -2606,7 +2855,7 @@ void RendererSceneCull::_render_scene(const Transform3D &p_cam_transform, const
scene_render->set_directional_shadow_count(lights_with_shadow.size());
for (int i = 0; i < lights_with_shadow.size(); i++) {
- _light_instance_setup_directional_shadow(i, lights_with_shadow[i], p_cam_transform, p_cam_projection, p_cam_orthogonal, p_cam_vaspect);
+ _light_instance_setup_directional_shadow(i, lights_with_shadow[i], p_camera_data->main_transform, p_camera_data->main_projection, p_camera_data->is_ortogonal, p_camera_data->vaspect);
}
}
@@ -2635,7 +2884,7 @@ void RendererSceneCull::_render_scene(const Transform3D &p_cam_transform, const
}
}
- frustum_cull_result.clear();
+ scene_cull_result.clear();
{
uint64_t cull_from = 0;
@@ -2647,30 +2896,30 @@ void RendererSceneCull::_render_scene(const Transform3D &p_cam_transform, const
cull_data.cull = &cull;
cull_data.scenario = scenario;
cull_data.shadow_atlas = p_shadow_atlas;
- cull_data.cam_transform = p_cam_transform;
+ cull_data.cam_transform = p_camera_data->main_transform;
cull_data.visible_layers = p_visible_layers;
cull_data.render_reflection_probe = render_reflection_probe;
cull_data.occlusion_buffer = RendererSceneOcclusionCull::get_singleton()->buffer_get_ptr(p_viewport);
- cull_data.camera_matrix = &p_cam_projection;
+ cull_data.camera_matrix = &p_camera_data->main_projection;
//#define DEBUG_CULL_TIME
#ifdef DEBUG_CULL_TIME
uint64_t time_from = OS::get_singleton()->get_ticks_usec();
#endif
if (cull_to > thread_cull_threshold) {
//multiple threads
- for (uint32_t i = 0; i < frustum_cull_result_threads.size(); i++) {
- frustum_cull_result_threads[i].clear();
+ for (uint32_t i = 0; i < scene_cull_result_threads.size(); i++) {
+ scene_cull_result_threads[i].clear();
}
- RendererThreadPool::singleton->thread_work_pool.do_work(frustum_cull_result_threads.size(), this, &RendererSceneCull::_frustum_cull_threaded, &cull_data);
+ RendererThreadPool::singleton->thread_work_pool.do_work(scene_cull_result_threads.size(), this, &RendererSceneCull::_scene_cull_threaded, &cull_data);
- for (uint32_t i = 0; i < frustum_cull_result_threads.size(); i++) {
- frustum_cull_result.append_from(frustum_cull_result_threads[i]);
+ for (uint32_t i = 0; i < scene_cull_result_threads.size(); i++) {
+ scene_cull_result.append_from(scene_cull_result_threads[i]);
}
} else {
//single threaded
- _frustum_cull(cull_data, frustum_cull_result, cull_from, cull_to);
+ _scene_cull(cull_data, scene_cull_result, cull_from, cull_to);
}
#ifdef DEBUG_CULL_TIME
@@ -2681,9 +2930,9 @@ void RendererSceneCull::_render_scene(const Transform3D &p_cam_transform, const
print_line("time taken: " + rtos(time_avg / time_count));
#endif
- if (frustum_cull_result.mesh_instances.size()) {
- for (uint64_t i = 0; i < frustum_cull_result.mesh_instances.size(); i++) {
- RSG::storage->mesh_instance_check_for_update(frustum_cull_result.mesh_instances[i]);
+ if (scene_cull_result.mesh_instances.size()) {
+ for (uint64_t i = 0; i < scene_cull_result.mesh_instances.size(); i++) {
+ RSG::storage->mesh_instance_check_for_update(scene_cull_result.mesh_instances[i]);
}
RSG::storage->update_mesh_instances();
}
@@ -2707,14 +2956,14 @@ void RendererSceneCull::_render_scene(const Transform3D &p_cam_transform, const
}
render_shadow_data[max_shadows_used].light = cull.shadows[i].light_instance;
render_shadow_data[max_shadows_used].pass = j;
- render_shadow_data[max_shadows_used].instances.merge_unordered(frustum_cull_result.directional_shadows[i].cascade_geometry_instances[j]);
+ render_shadow_data[max_shadows_used].instances.merge_unordered(scene_cull_result.directional_shadows[i].cascade_geometry_instances[j]);
max_shadows_used++;
}
}
// Positional Shadowss
- for (uint32_t i = 0; i < (uint32_t)frustum_cull_result.lights.size(); i++) {
- Instance *ins = frustum_cull_result.lights[i];
+ for (uint32_t i = 0; i < (uint32_t)scene_cull_result.lights.size(); i++) {
+ Instance *ins = scene_cull_result.lights[i];
if (!p_shadow_atlas.is_valid() || !RSG::storage->light_has_shadow(ins->base)) {
continue;
@@ -2726,12 +2975,12 @@ void RendererSceneCull::_render_scene(const Transform3D &p_cam_transform, const
{ //compute coverage
- Transform3D cam_xf = p_cam_transform;
- float zn = p_cam_projection.get_z_near();
+ Transform3D cam_xf = p_camera_data->main_transform;
+ float zn = p_camera_data->main_projection.get_z_near();
Plane p(cam_xf.origin + cam_xf.basis.get_axis(2) * -zn, -cam_xf.basis.get_axis(2)); //camera near plane
// near plane half width and height
- Vector2 vp_half_extents = p_cam_projection.get_viewport_half_extents();
+ Vector2 vp_half_extents = p_camera_data->main_projection.get_viewport_half_extents();
switch (RSG::storage->light_get_type(ins->base)) {
case RS::LIGHT_OMNI: {
@@ -2743,7 +2992,7 @@ void RendererSceneCull::_render_scene(const Transform3D &p_cam_transform, const
ins->transform.origin + cam_xf.basis.get_axis(0) * radius
};
- if (!p_cam_orthogonal) {
+ if (!p_camera_data->is_ortogonal) {
//if using perspetive, map them to near plane
for (int j = 0; j < 2; j++) {
if (p.distance_to(points[j]) < 0) {
@@ -2771,7 +3020,7 @@ void RendererSceneCull::_render_scene(const Transform3D &p_cam_transform, const
base + cam_xf.basis.get_axis(0) * w
};
- if (!p_cam_orthogonal) {
+ if (!p_camera_data->is_ortogonal) {
//if using perspetive, map them to near plane
for (int j = 0; j < 2; j++) {
if (p.distance_to(points[j]) < 0) {
@@ -2802,7 +3051,7 @@ void RendererSceneCull::_render_scene(const Transform3D &p_cam_transform, const
if (redraw && max_shadows_used < MAX_UPDATE_SHADOWS) {
//must redraw!
RENDER_TIMESTAMP(">Rendering Light " + itos(i));
- light->shadow_dirty = _light_instance_update_shadow(ins, p_cam_transform, p_cam_projection, p_cam_orthogonal, p_cam_vaspect, p_shadow_atlas, scenario, p_screen_lod_threshold);
+ light->shadow_dirty = _light_instance_update_shadow(ins, p_camera_data->main_transform, p_camera_data->main_projection, p_camera_data->is_ortogonal, p_camera_data->vaspect, p_shadow_atlas, scenario, p_screen_lod_threshold);
RENDER_TIMESTAMP("<Rendering Light " + itos(i));
} else {
light->shadow_dirty = redraw;
@@ -2818,13 +3067,13 @@ void RendererSceneCull::_render_scene(const Transform3D &p_cam_transform, const
if (cull.sdfgi.region_count > 0) {
//update regions
for (uint32_t i = 0; i < cull.sdfgi.region_count; i++) {
- render_sdfgi_data[i].instances.merge_unordered(frustum_cull_result.sdfgi_region_geometry_instances[i]);
+ render_sdfgi_data[i].instances.merge_unordered(scene_cull_result.sdfgi_region_geometry_instances[i]);
render_sdfgi_data[i].region = i;
}
//check if static lights were culled
bool static_lights_culled = false;
for (uint32_t i = 0; i < cull.sdfgi.cascade_light_count; i++) {
- if (frustum_cull_result.sdfgi_cascade_lights[i].size()) {
+ if (scene_cull_result.sdfgi_cascade_lights[i].size()) {
static_lights_culled = true;
break;
}
@@ -2833,7 +3082,7 @@ void RendererSceneCull::_render_scene(const Transform3D &p_cam_transform, const
if (static_lights_culled) {
sdfgi_update_data.static_cascade_count = cull.sdfgi.cascade_light_count;
sdfgi_update_data.static_cascade_indices = cull.sdfgi.cascade_light_index;
- sdfgi_update_data.static_positional_lights = frustum_cull_result.sdfgi_cascade_lights;
+ sdfgi_update_data.static_positional_lights = scene_cull_result.sdfgi_cascade_lights;
sdfgi_update_data.update_static = true;
}
}
@@ -2847,7 +3096,7 @@ void RendererSceneCull::_render_scene(const Transform3D &p_cam_transform, const
//append the directional lights to the lights culled
for (int i = 0; i < directional_lights.size(); i++) {
- frustum_cull_result.light_instances.push_back(directional_lights[i]);
+ scene_cull_result.light_instances.push_back(directional_lights[i]);
}
RID camera_effects;
@@ -2864,7 +3113,7 @@ void RendererSceneCull::_render_scene(const Transform3D &p_cam_transform, const
}
RENDER_TIMESTAMP("Render Scene ");
- scene_render->render_scene(p_render_buffers, p_cam_transform, p_cam_projection, p_cam_orthogonal, frustum_cull_result.geometry_instances, frustum_cull_result.light_instances, frustum_cull_result.reflections, frustum_cull_result.voxel_gi_instances, frustum_cull_result.decals, frustum_cull_result.lightmaps, p_environment, camera_effects, p_shadow_atlas, occluders_tex, p_reflection_probe.is_valid() ? RID() : scenario->reflection_atlas, p_reflection_probe, p_reflection_probe_pass, p_screen_lod_threshold, render_shadow_data, max_shadows_used, render_sdfgi_data, cull.sdfgi.region_count, &sdfgi_update_data);
+ scene_render->render_scene(p_render_buffers, p_camera_data, scene_cull_result.geometry_instances, scene_cull_result.light_instances, scene_cull_result.reflections, scene_cull_result.voxel_gi_instances, scene_cull_result.decals, scene_cull_result.lightmaps, p_environment, camera_effects, p_shadow_atlas, occluders_tex, p_reflection_probe.is_valid() ? RID() : scenario->reflection_atlas, p_reflection_probe, p_reflection_probe_pass, p_screen_lod_threshold, render_shadow_data, max_shadows_used, render_sdfgi_data, cull.sdfgi.region_count, &sdfgi_update_data);
for (uint32_t i = 0; i < max_shadows_used; i++) {
render_shadow_data[i].instances.clear();
@@ -2911,7 +3160,11 @@ void RendererSceneCull::render_empty_scene(RID p_render_buffers, RID p_scenario,
environment = scenario->fallback_environment;
}
RENDER_TIMESTAMP("Render Empty Scene ");
- scene_render->render_scene(p_render_buffers, Transform3D(), CameraMatrix(), true, PagedArray<RendererSceneRender::GeometryInstance *>(), PagedArray<RID>(), PagedArray<RID>(), PagedArray<RID>(), PagedArray<RID>(), PagedArray<RID>(), RID(), RID(), p_shadow_atlas, RID(), scenario->reflection_atlas, RID(), 0, 0, nullptr, 0, nullptr, 0, nullptr);
+
+ RendererSceneRender::CameraData camera_data;
+ camera_data.set_camera(Transform3D(), CameraMatrix(), true, false);
+
+ scene_render->render_scene(p_render_buffers, &camera_data, PagedArray<RendererSceneRender::GeometryInstance *>(), PagedArray<RID>(), PagedArray<RID>(), PagedArray<RID>(), PagedArray<RID>(), PagedArray<RID>(), RID(), RID(), p_shadow_atlas, RID(), scenario->reflection_atlas, RID(), 0, 0, nullptr, 0, nullptr, 0, nullptr);
#endif
}
@@ -2981,7 +3234,10 @@ bool RendererSceneCull::_render_reflection_probe_step(Instance *p_instance, int
}
RENDER_TIMESTAMP("Render Reflection Probe, Step " + itos(p_step));
- _render_scene(xform, cm, false, false, RID(), environment, RID(), RSG::storage->reflection_probe_get_cull_mask(p_instance->base), p_instance->scenario->self, RID(), shadow_atlas, reflection_probe->instance, p_step, lod_threshold, use_shadows);
+ RendererSceneRender::CameraData camera_data;
+ camera_data.set_camera(xform, cm, false, false);
+
+ _render_scene(&camera_data, RID(), environment, RID(), RSG::storage->reflection_probe_get_cull_mask(p_instance->base), p_instance->scenario->self, RID(), shadow_atlas, reflection_probe->instance, p_step, lod_threshold, use_shadows);
} else {
//do roughness postprocess step until it believes it's done
@@ -3192,7 +3448,7 @@ void RendererSceneCull::render_probes() {
update_lights = true;
}
- frustum_cull_result.geometry_instances.clear();
+ scene_cull_result.geometry_instances.clear();
RID instance_pair_buffer[MAX_INSTANCE_PAIRS];
@@ -3219,10 +3475,10 @@ void RendererSceneCull::render_probes() {
ins->scenario->instance_data[ins->array_index].flags &= ~uint32_t(InstanceData::FLAG_GEOM_VOXEL_GI_DIRTY);
}
- frustum_cull_result.geometry_instances.push_back(geom->geometry_instance);
+ scene_cull_result.geometry_instances.push_back(geom->geometry_instance);
}
- scene_render->voxel_gi_update(probe->probe_instance, update_lights, probe->light_instances, frustum_cull_result.geometry_instances);
+ scene_render->voxel_gi_update(probe->probe_instance, update_lights, probe->light_instances, scene_cull_result.geometry_instances);
voxel_gi_update_list.remove(voxel_gi);
@@ -3237,7 +3493,7 @@ void RendererSceneCull::render_particle_colliders() {
if (hfpc->scenario && hfpc->base_type == RS::INSTANCE_PARTICLES_COLLISION && RSG::storage->particles_collision_is_heightfield(hfpc->base)) {
//update heightfield
instance_cull_result.clear();
- frustum_cull_result.geometry_instances.clear();
+ scene_cull_result.geometry_instances.clear();
struct CullAABB {
PagedArray<Instance *> *result;
@@ -3259,10 +3515,10 @@ void RendererSceneCull::render_particle_colliders() {
continue;
}
InstanceGeometryData *geom = static_cast<InstanceGeometryData *>(instance->base_data);
- frustum_cull_result.geometry_instances.push_back(geom->geometry_instance);
+ scene_cull_result.geometry_instances.push_back(geom->geometry_instance);
}
- scene_render->render_particle_collider_heightfield(hfpc->base, hfpc->transform, frustum_cull_result.geometry_instances);
+ scene_render->render_particle_collider_heightfield(hfpc->base, hfpc->transform, scene_cull_result.geometry_instances);
}
heightfield_particle_colliders_update_list.erase(heightfield_particle_colliders_update_list.front());
}
@@ -3551,6 +3807,7 @@ bool RendererSceneCull::free(RID p_rid) {
}
scenario->instance_aabbs.reset();
scenario->instance_data.reset();
+ scenario->instance_visibility.reset();
scene_render->free(scenario->reflection_probe_shadow_atlas);
scene_render->free(scenario->reflection_atlas);
@@ -3619,10 +3876,10 @@ RendererSceneCull::RendererSceneCull() {
render_sdfgi_data[i].instances.set_page_pool(&geometry_instance_cull_page_pool);
}
- frustum_cull_result.init(&rid_cull_page_pool, &geometry_instance_cull_page_pool, &instance_cull_page_pool);
- frustum_cull_result_threads.resize(RendererThreadPool::singleton->thread_work_pool.get_thread_count());
- for (uint32_t i = 0; i < frustum_cull_result_threads.size(); i++) {
- frustum_cull_result_threads[i].init(&rid_cull_page_pool, &geometry_instance_cull_page_pool, &instance_cull_page_pool);
+ scene_cull_result.init(&rid_cull_page_pool, &geometry_instance_cull_page_pool, &instance_cull_page_pool);
+ scene_cull_result_threads.resize(RendererThreadPool::singleton->thread_work_pool.get_thread_count());
+ for (uint32_t i = 0; i < scene_cull_result_threads.size(); i++) {
+ scene_cull_result_threads[i].init(&rid_cull_page_pool, &geometry_instance_cull_page_pool, &instance_cull_page_pool);
}
indexer_update_iterations = GLOBAL_GET("rendering/limits/spatial_indexer/update_iterations_per_frame");
@@ -3643,11 +3900,11 @@ RendererSceneCull::~RendererSceneCull() {
render_sdfgi_data[i].instances.reset();
}
- frustum_cull_result.reset();
- for (uint32_t i = 0; i < frustum_cull_result_threads.size(); i++) {
- frustum_cull_result_threads[i].reset();
+ scene_cull_result.reset();
+ for (uint32_t i = 0; i < scene_cull_result_threads.size(); i++) {
+ scene_cull_result_threads[i].reset();
}
- frustum_cull_result_threads.clear();
+ scene_cull_result_threads.clear();
if (dummy_occlusion_culling) {
memdelete(dummy_occlusion_culling);
diff --git a/servers/rendering/renderer_scene_cull.h b/servers/rendering/renderer_scene_cull.h
index f10eb67828..bdfbea95a2 100644
--- a/servers/rendering/renderer_scene_cull.h
+++ b/servers/rendering/renderer_scene_cull.h
@@ -31,6 +31,7 @@
#ifndef RENDERING_SERVER_SCENE_CULL_H
#define RENDERING_SERVER_SCENE_CULL_H
+#include "core/templates/bin_sorted_array.h"
#include "core/templates/pass_func.h"
#include "servers/rendering/renderer_compositor.h"
@@ -259,6 +260,9 @@ public:
FLAG_USES_MESH_INSTANCE = (1 << 17),
FLAG_REFLECTION_PROBE_DIRTY = (1 << 18),
FLAG_IGNORE_OCCLUSION_CULLING = (1 << 19),
+ FLAG_VISIBILITY_DEPENDENCY_NEEDS_CHECK = (3 << 20), // 2 bits, overlaps with the other vis. dependency flags
+ FLAG_VISIBILITY_DEPENDENCY_HIDDEN_CLOSE_RANGE = (1 << 20),
+ FLAG_VISIBILITY_DEPENDENCY_HIDDEN = (1 << 21),
};
uint32_t flags = 0;
@@ -269,10 +273,33 @@ public:
RendererSceneRender::GeometryInstance *instance_geometry;
};
Instance *instance = nullptr;
+ int32_t parent_array_index = -1;
+ int32_t visibility_index = -1;
+ };
+
+ struct InstanceVisibilityData {
+ uint64_t viewport_state = 0;
+ int32_t array_index = -1;
+ Vector3 position;
+ Instance *instance = nullptr;
+ float range_begin = 0.0f;
+ float range_end = 0.0f;
+ float range_begin_margin = 0.0f;
+ float range_end_margin = 0.0f;
+ };
+
+ class VisibilityArray : public BinSortedArray<InstanceVisibilityData> {
+ _FORCE_INLINE_ virtual void _update_idx(InstanceVisibilityData &r_element, uint64_t p_idx) {
+ r_element.instance->visibility_index = p_idx;
+ if (r_element.instance->scenario && r_element.instance->array_index != -1) {
+ r_element.instance->scenario->instance_data[r_element.instance->array_index].visibility_index = p_idx;
+ }
+ }
};
PagedArrayPool<InstanceBounds> instance_aabb_page_pool;
PagedArrayPool<InstanceData> instance_data_page_pool;
+ PagedArrayPool<InstanceVisibilityData> instance_visibility_data_page_pool;
struct Scenario {
enum IndexerType {
@@ -292,6 +319,8 @@ public:
RID camera_effects;
RID reflection_probe_shadow_atlas;
RID reflection_atlas;
+ uint64_t used_viewport_visibility_bits;
+ Map<RID, uint64_t> viewport_visibility_masks;
SelfList<Instance>::List instances;
@@ -299,11 +328,13 @@ public:
PagedArray<InstanceBounds> instance_aabbs;
PagedArray<InstanceData> instance_data;
+ VisibilityArray instance_visibility;
Scenario() {
indexers[INDEXER_GEOMETRY].set_index(INDEXER_GEOMETRY);
indexers[INDEXER_VOLUMES].set_index(INDEXER_VOLUMES);
debug = RS::SCENARIO_DEBUG_DISABLED;
+ used_viewport_visibility_bits = 0;
}
};
@@ -326,6 +357,8 @@ public:
virtual void scenario_set_reflection_atlas_size(RID p_scenario, int p_reflection_size, int p_reflection_count);
virtual bool is_scenario(RID p_scenario) const;
virtual RID scenario_get_environment(RID p_scenario);
+ virtual void scenario_add_viewport_visibility_mask(RID p_scenario, RID p_viewport);
+ virtual void scenario_remove_viewport_visibility_mask(RID p_scenario, RID p_viewport);
/* INSTANCING API */
@@ -399,6 +432,12 @@ public:
//scenario stuff
DynamicBVH::ID indexer_id;
int32_t array_index;
+ int32_t visibility_index = -1;
+ float visibility_range_begin;
+ float visibility_range_end;
+ float visibility_range_begin_margin;
+ float visibility_range_end_margin;
+ Instance *visibility_parent = nullptr;
Scenario *scenario;
SelfList<Instance> scenario_item;
@@ -412,12 +451,6 @@ public:
float extra_margin;
ObjectID object_id;
- float lod_begin;
- float lod_end;
- float lod_begin_hysteresis;
- float lod_end_hysteresis;
- RID lod_instance;
-
Vector<Color> lightmap_target_sh; //target is used for incrementally changing the SH over time, this avoids pops in some corner cases and when going interior <-> exterior
uint64_t last_frame_pass;
@@ -495,10 +528,10 @@ public:
visible = true;
- lod_begin = 0;
- lod_end = 0;
- lod_begin_hysteresis = 0;
- lod_end_hysteresis = 0;
+ visibility_range_begin = 0;
+ visibility_range_end = 0;
+ visibility_range_begin_margin = 0;
+ visibility_range_end_margin = 0;
last_frame_pass = 0;
version = 1;
@@ -537,6 +570,8 @@ public:
Set<Instance *> reflection_probes;
Set<Instance *> voxel_gi_instances;
Set<Instance *> lightmap_captures;
+ Set<Instance *> visibility_dependencies;
+ uint32_t visibility_dependencies_depth = 0;
InstanceGeometryData() {
can_cast_shadows = true;
@@ -717,7 +752,7 @@ public:
PagedArray<Instance *> instance_cull_result;
PagedArray<Instance *> instance_shadow_cull_result;
- struct FrustumCullResult {
+ struct InstanceCullResult {
PagedArray<RendererSceneRender::GeometryInstance *> geometry_instances;
PagedArray<Instance *> lights;
PagedArray<RID> light_instances;
@@ -782,7 +817,7 @@ public:
}
}
- void append_from(FrustumCullResult &p_cull_result) {
+ void append_from(InstanceCullResult &p_cull_result) {
geometry_instances.merge_unordered(p_cull_result.geometry_instances);
lights.merge_unordered(p_cull_result.lights);
light_instances.merge_unordered(p_cull_result.light_instances);
@@ -832,8 +867,8 @@ public:
}
};
- FrustumCullResult frustum_cull_result;
- LocalVector<FrustumCullResult> frustum_cull_result_threads;
+ InstanceCullResult scene_cull_result;
+ LocalVector<InstanceCullResult> scene_cull_result_threads;
RendererSceneRender::RenderShadowData render_shadow_data[MAX_UPDATE_SHADOWS];
uint32_t max_shadows_used = 0;
@@ -866,6 +901,11 @@ public:
virtual void instance_set_extra_visibility_margin(RID p_instance, real_t p_margin);
+ virtual void instance_set_visibility_parent(RID p_instance, RID p_parent_instance);
+
+ void _update_instance_visibility_depth(Instance *p_instance);
+ void _update_instance_visibility_dependencies(Instance *p_instance);
+
// don't use these in a game!
virtual Vector<ObjectID> instances_cull_aabb(const AABB &p_aabb, RID p_scenario = RID()) const;
virtual Vector<ObjectID> instances_cull_ray(const Vector3 &p_from, const Vector3 &p_to, RID p_scenario = RID()) const;
@@ -875,8 +915,8 @@ public:
virtual void instance_geometry_set_cast_shadows_setting(RID p_instance, RS::ShadowCastingSetting p_shadow_casting_setting);
virtual void instance_geometry_set_material_override(RID p_instance, RID p_material);
- virtual void instance_geometry_set_draw_range(RID p_instance, float p_min, float p_max, float p_min_margin, float p_max_margin);
- virtual void instance_geometry_set_as_instance_lod(RID p_instance, RID p_as_lod_of_instance);
+ virtual void instance_geometry_set_visibility_range(RID p_instance, float p_min, float p_max, float p_min_margin, float p_max_margin);
+
virtual void instance_geometry_set_lightmap(RID p_instance, RID p_lightmap, const Rect2 &p_lightmap_uv_scale, int p_slice_index);
virtual void instance_geometry_set_lod_bias(RID p_instance, float p_lod_bias);
@@ -937,6 +977,19 @@ public:
Frustum frustum;
} cull;
+ struct VisibilityCullData {
+ uint64_t viewport_mask;
+ Scenario *scenario;
+ Vector3 camera_position;
+ uint32_t cull_offset;
+ uint32_t cull_count;
+ };
+
+ void _visibility_cull_threaded(uint32_t p_thread, VisibilityCullData *cull_data);
+ void _visibility_cull(const VisibilityCullData &cull_data, uint64_t p_from, uint64_t p_to);
+ _FORCE_INLINE_ void _visibility_cull(const VisibilityCullData &cull_data, uint64_t p_idx);
+ _FORCE_INLINE_ int _visibility_range_check(InstanceVisibilityData &r_vis_data, const Vector3 &p_camera_pos, uint64_t p_viewport_mask);
+
struct CullData {
Cull *cull;
Scenario *scenario;
@@ -946,17 +999,17 @@ public:
Instance *render_reflection_probe;
const RendererSceneOcclusionCull::HZBuffer *occlusion_buffer;
const CameraMatrix *camera_matrix;
+ const VisibilityCullData *visibility_cull_data;
};
- void _frustum_cull_threaded(uint32_t p_thread, CullData *cull_data);
- void _frustum_cull(CullData &cull_data, FrustumCullResult &cull_result, uint64_t p_from, uint64_t p_to);
+ void _scene_cull_threaded(uint32_t p_thread, CullData *cull_data);
+ void _scene_cull(CullData &cull_data, InstanceCullResult &cull_result, uint64_t p_from, uint64_t p_to);
bool _render_reflection_probe_step(Instance *p_instance, int p_step);
- void _render_scene(const Transform3D &p_cam_transform, const CameraMatrix &p_cam_projection, bool p_cam_orthogonal, bool p_cam_vaspect, RID p_render_buffers, RID p_environment, RID p_force_camera_effects, uint32_t p_visible_layers, RID p_scenario, RID p_viewport, RID p_shadow_atlas, RID p_reflection_probe, int p_reflection_probe_pass, float p_screen_lod_threshold, bool p_using_shadows = true);
+ void _render_scene(const RendererSceneRender::CameraData *p_camera_data, RID p_render_buffers, RID p_environment, RID p_force_camera_effects, uint32_t p_visible_layers, RID p_scenario, RID p_viewport, RID p_shadow_atlas, RID p_reflection_probe, int p_reflection_probe_pass, float p_screen_lod_threshold, bool p_using_shadows = true);
void render_empty_scene(RID p_render_buffers, RID p_scenario, RID p_shadow_atlas);
- void render_camera(RID p_render_buffers, RID p_camera, RID p_scenario, RID p_viewport, Size2 p_viewport_size, float p_screen_lod_threshold, RID p_shadow_atlas);
- void render_camera(RID p_render_buffers, Ref<XRInterface> &p_interface, XRInterface::Eyes p_eye, RID p_camera, RID p_scenario, RID p_viewport, Size2 p_viewport_size, float p_screen_lod_threshold, RID p_shadow_atlas);
+ void render_camera(RID p_render_buffers, RID p_camera, RID p_scenario, RID p_viewport, Size2 p_viewport_size, float p_screen_lod_threshold, RID p_shadow_atlas, Ref<XRInterface> &p_xr_interface);
void update_dirty_instances();
void render_particle_colliders();
@@ -1054,7 +1107,7 @@ public:
/* Render Buffers */
PASS0R(RID, render_buffers_create)
- PASS7(render_buffers_configure, RID, RID, int, int, RS::ViewportMSAA, RS::ViewportScreenSpaceAA, bool)
+ PASS8(render_buffers_configure, RID, RID, int, int, RS::ViewportMSAA, RS::ViewportScreenSpaceAA, bool, uint32_t)
PASS1(gi_set_use_half_resolution, bool)
/* Shadow Atlas */
diff --git a/servers/rendering/renderer_scene_render.cpp b/servers/rendering/renderer_scene_render.cpp
index f27bdc6798..3aa97f4084 100644
--- a/servers/rendering/renderer_scene_render.cpp
+++ b/servers/rendering/renderer_scene_render.cpp
@@ -29,3 +29,153 @@
/*************************************************************************/
#include "renderer_scene_render.h"
+
+void RendererSceneRender::CameraData::set_camera(const Transform3D p_transform, const CameraMatrix p_projection, bool p_is_ortogonal, bool p_vaspect) {
+ view_count = 1;
+ is_ortogonal = p_is_ortogonal;
+ vaspect = p_vaspect;
+
+ main_transform = p_transform;
+ main_projection = p_projection;
+
+ view_offset[0] = Transform3D();
+ view_projection[0] = p_projection;
+}
+
+void RendererSceneRender::CameraData::set_multiview_camera(uint32_t p_view_count, const Transform3D *p_transforms, const CameraMatrix *p_projections, bool p_is_ortogonal, bool p_vaspect) {
+ ERR_FAIL_COND_MSG(p_view_count != 2, "Incorrect view count for stereoscopic view");
+
+ view_count = p_view_count;
+ is_ortogonal = p_is_ortogonal;
+ vaspect = p_vaspect;
+ Vector<Plane> planes[2];
+
+ /////////////////////////////////////////////////////////////////////////////
+ // Figure out our center transform
+
+ // 1. obtain our planes
+ for (uint32_t v = 0; v < view_count; v++) {
+ planes[v] = p_projections[v].get_projection_planes(p_transforms[v]);
+ }
+
+ // 2. average and normalize plane normals to obtain z vector, cross them to obtain y vector, and from there the x vector for combined camera basis.
+ Vector3 n0 = planes[0][CameraMatrix::PLANE_LEFT].normal;
+ Vector3 n1 = planes[1][CameraMatrix::PLANE_RIGHT].normal;
+ Vector3 z = (n0 + n1).normalized();
+ Vector3 y = n0.cross(n1).normalized();
+ Vector3 x = y.cross(z).normalized();
+ y = z.cross(x).normalized();
+ main_transform.basis.set(x, y, z);
+
+ // 3. create a horizon plane with one of the eyes and the up vector as normal.
+ Plane horizon(p_transforms[0].origin, y);
+
+ // 4. Intersect horizon, left and right to obtain the combined camera origin.
+ ERR_FAIL_COND_MSG(
+ !horizon.intersect_3(planes[0][CameraMatrix::PLANE_LEFT], planes[1][CameraMatrix::PLANE_RIGHT], &main_transform.origin), "Can't determine camera origin");
+
+ // handy to have the inverse of the transform we just build
+ Transform3D main_transform_inv = main_transform.inverse();
+
+ // 5. figure out far plane, this could use some improvement, we may have our far plane too close like this, not sure if this matters
+ Vector3 far_center = (planes[0][CameraMatrix::PLANE_FAR].center() + planes[1][CameraMatrix::PLANE_FAR].center()) * 0.5;
+ Plane far(far_center, -z);
+
+ /////////////////////////////////////////////////////////////////////////////
+ // Figure out our top/bottom planes
+
+ // 6. Intersect far and left planes with top planes from both eyes, save the point with highest y as top_left.
+ Vector3 top_left, other;
+ ERR_FAIL_COND_MSG(
+ !far.intersect_3(planes[0][CameraMatrix::PLANE_LEFT], planes[0][CameraMatrix::PLANE_TOP], &top_left), "Can't determine left camera far/left/top vector");
+ ERR_FAIL_COND_MSG(
+ !far.intersect_3(planes[1][CameraMatrix::PLANE_LEFT], planes[1][CameraMatrix::PLANE_TOP], &other), "Can't determine right camera far/left/top vector");
+ if (y.dot(top_left) < y.dot(other)) {
+ top_left = other;
+ }
+
+ // 7. Intersect far and left planes with bottom planes from both eyes, save the point with lowest y as bottom_left.
+ Vector3 bottom_left;
+ ERR_FAIL_COND_MSG(
+ !far.intersect_3(planes[0][CameraMatrix::PLANE_LEFT], planes[0][CameraMatrix::PLANE_BOTTOM], &bottom_left), "Can't determine left camera far/left/bottom vector");
+ ERR_FAIL_COND_MSG(
+ !far.intersect_3(planes[1][CameraMatrix::PLANE_LEFT], planes[1][CameraMatrix::PLANE_BOTTOM], &other), "Can't determine right camera far/left/bottom vector");
+ if (y.dot(other) < y.dot(bottom_left)) {
+ bottom_left = other;
+ }
+
+ // 8. Intersect far and right planes with top planes from both eyes, save the point with highest y as top_right.
+ Vector3 top_right;
+ ERR_FAIL_COND_MSG(
+ !far.intersect_3(planes[0][CameraMatrix::PLANE_RIGHT], planes[0][CameraMatrix::PLANE_TOP], &top_right), "Can't determine left camera far/right/top vector");
+ ERR_FAIL_COND_MSG(
+ !far.intersect_3(planes[1][CameraMatrix::PLANE_RIGHT], planes[1][CameraMatrix::PLANE_TOP], &other), "Can't determine right camera far/right/top vector");
+ if (y.dot(top_right) < y.dot(other)) {
+ top_right = other;
+ }
+
+ // 9. Intersect far and right planes with bottom planes from both eyes, save the point with lowest y as bottom_right.
+ Vector3 bottom_right;
+ ERR_FAIL_COND_MSG(
+ !far.intersect_3(planes[0][CameraMatrix::PLANE_RIGHT], planes[0][CameraMatrix::PLANE_BOTTOM], &bottom_right), "Can't determine left camera far/right/bottom vector");
+ ERR_FAIL_COND_MSG(
+ !far.intersect_3(planes[1][CameraMatrix::PLANE_RIGHT], planes[1][CameraMatrix::PLANE_BOTTOM], &other), "Can't determine right camera far/right/bottom vector");
+ if (y.dot(other) < y.dot(bottom_right)) {
+ bottom_right = other;
+ }
+
+ // 10. Create top plane with these points: camera origin, top_left, top_right
+ Plane top(main_transform.origin, top_left, top_right);
+
+ // 11. Create bottom plane with these points: camera origin, bottom_left, bottom_right
+ Plane bottom(main_transform.origin, bottom_left, bottom_right);
+
+ /////////////////////////////////////////////////////////////////////////////
+ // Figure out our near plane points
+
+ // 12. Create a near plane using -camera z and the eye further along in that axis.
+ Plane near;
+ Vector3 neg_z = -z;
+ if (neg_z.dot(p_transforms[1].origin) < neg_z.dot(p_transforms[0].origin)) {
+ near = Plane(p_transforms[0].origin, neg_z);
+ } else {
+ near = Plane(p_transforms[1].origin, neg_z);
+ }
+
+ // 13. Intersect near plane with bottm/left planes, to obtain min_vec then top/right to obtain max_vec
+ Vector3 min_vec;
+ ERR_FAIL_COND_MSG(
+ !near.intersect_3(bottom, planes[0][CameraMatrix::PLANE_LEFT], &min_vec), "Can't determine left camera near/left/bottom vector");
+ ERR_FAIL_COND_MSG(
+ !near.intersect_3(bottom, planes[1][CameraMatrix::PLANE_LEFT], &other), "Can't determine right camera near/left/bottom vector");
+ if (x.dot(other) < x.dot(min_vec)) {
+ min_vec = other;
+ }
+
+ Vector3 max_vec;
+ ERR_FAIL_COND_MSG(
+ !near.intersect_3(top, planes[0][CameraMatrix::PLANE_RIGHT], &max_vec), "Can't determine left camera near/right/top vector");
+ ERR_FAIL_COND_MSG(
+ !near.intersect_3(top, planes[1][CameraMatrix::PLANE_RIGHT], &other), "Can't determine right camera near/right/top vector");
+ if (x.dot(max_vec) < x.dot(other)) {
+ max_vec = other;
+ }
+
+ // 14. transform these points by the inverse camera to obtain local_min_vec and local_max_vec
+ Vector3 local_min_vec = main_transform_inv.xform(min_vec);
+ Vector3 local_max_vec = main_transform_inv.xform(max_vec);
+
+ // 15. get x and y from these to obtain left, top, right bottom for the frustum. Get the distance from near plane to camera origin to obtain near, and the distance from the far plane to the camer origin to obtain far.
+ float z_near = -near.distance_to(main_transform.origin);
+ float z_far = -far.distance_to(main_transform.origin);
+
+ // 16. Use this to build the combined camera matrix.
+ main_projection.set_frustum(local_min_vec.x, local_max_vec.x, local_min_vec.y, local_max_vec.y, z_near, z_far);
+
+ /////////////////////////////////////////////////////////////////////////////
+ // 3. Copy our view data
+ for (uint32_t v = 0; v < view_count; v++) {
+ view_offset[v] = p_transforms[v] * main_transform_inv;
+ view_projection[v] = p_projections[v] * CameraMatrix(view_offset[v]);
+ }
+}
diff --git a/servers/rendering/renderer_scene_render.h b/servers/rendering/renderer_scene_render.h
index 5f3e6df4e3..3682122dd3 100644
--- a/servers/rendering/renderer_scene_render.h
+++ b/servers/rendering/renderer_scene_render.h
@@ -39,7 +39,8 @@ class RendererSceneRender {
public:
enum {
MAX_DIRECTIONAL_LIGHTS = 8,
- MAX_DIRECTIONAL_LIGHT_CASCADES = 4
+ MAX_DIRECTIONAL_LIGHT_CASCADES = 4,
+ MAX_RENDER_VIEWS = 2
};
struct GeometryInstance {
@@ -216,7 +217,24 @@ public:
uint32_t positional_light_count;
};
- virtual void render_scene(RID p_render_buffers, const Transform3D &p_cam_transform, const CameraMatrix &p_cam_projection, bool p_cam_ortogonal, const PagedArray<GeometryInstance *> &p_instances, const PagedArray<RID> &p_lights, const PagedArray<RID> &p_reflection_probes, const PagedArray<RID> &p_voxel_gi_instances, const PagedArray<RID> &p_decals, const PagedArray<RID> &p_lightmaps, RID p_environment, RID p_camera_effects, RID p_shadow_atlas, RID p_occluder_debug_tex, RID p_reflection_atlas, RID p_reflection_probe, int p_reflection_probe_pass, float p_screen_lod_threshold, const RenderShadowData *p_render_shadows, int p_render_shadow_count, const RenderSDFGIData *p_render_sdfgi_regions, int p_render_sdfgi_region_count, const RenderSDFGIUpdateData *p_sdfgi_update_data = nullptr) = 0;
+ struct CameraData {
+ // flags
+ uint32_t view_count;
+ bool is_ortogonal;
+ bool vaspect;
+
+ // Main/center projection
+ Transform3D main_transform;
+ CameraMatrix main_projection;
+
+ Transform3D view_offset[RendererSceneRender::MAX_RENDER_VIEWS];
+ CameraMatrix view_projection[RendererSceneRender::MAX_RENDER_VIEWS];
+
+ void set_camera(const Transform3D p_transform, const CameraMatrix p_projection, bool p_is_ortogonal, bool p_vaspect);
+ void set_multiview_camera(uint32_t p_view_count, const Transform3D *p_transforms, const CameraMatrix *p_projections, bool p_is_ortogonal, bool p_vaspect);
+ };
+
+ virtual void render_scene(RID p_render_buffers, const CameraData *p_camera_data, const PagedArray<GeometryInstance *> &p_instances, const PagedArray<RID> &p_lights, const PagedArray<RID> &p_reflection_probes, const PagedArray<RID> &p_voxel_gi_instances, const PagedArray<RID> &p_decals, const PagedArray<RID> &p_lightmaps, RID p_environment, RID p_camera_effects, RID p_shadow_atlas, RID p_occluder_debug_tex, RID p_reflection_atlas, RID p_reflection_probe, int p_reflection_probe_pass, float p_screen_lod_threshold, const RenderShadowData *p_render_shadows, int p_render_shadow_count, const RenderSDFGIData *p_render_sdfgi_regions, int p_render_sdfgi_region_count, const RenderSDFGIUpdateData *p_sdfgi_update_data = nullptr) = 0;
virtual void render_material(const Transform3D &p_cam_transform, const CameraMatrix &p_cam_projection, bool p_cam_ortogonal, const PagedArray<GeometryInstance *> &p_instances, RID p_framebuffer, const Rect2i &p_region) = 0;
virtual void render_particle_collider_heightfield(RID p_collider, const Transform3D &p_transform, const PagedArray<GeometryInstance *> &p_instances) = 0;
@@ -226,7 +244,7 @@ public:
virtual void set_debug_draw_mode(RS::ViewportDebugDraw p_debug_draw) = 0;
virtual RID render_buffers_create() = 0;
- virtual void render_buffers_configure(RID p_render_buffers, RID p_render_target, int p_width, int p_height, RS::ViewportMSAA p_msaa, RS::ViewportScreenSpaceAA p_screen_space_aa, bool p_use_debanding) = 0;
+ virtual void render_buffers_configure(RID p_render_buffers, RID p_render_target, int p_width, int p_height, RS::ViewportMSAA p_msaa, RS::ViewportScreenSpaceAA p_screen_space_aa, bool p_use_debanding, uint32_t p_view_count) = 0;
virtual void gi_set_use_half_resolution(bool p_enable) = 0;
virtual void screen_space_roughness_limiter_set_active(bool p_enable, float p_amount, float p_limit) = 0;
diff --git a/servers/rendering/renderer_storage.h b/servers/rendering/renderer_storage.h
index 0b9b82cba0..e6b9ac15ff 100644
--- a/servers/rendering/renderer_storage.h
+++ b/servers/rendering/renderer_storage.h
@@ -590,7 +590,7 @@ public:
virtual RID render_target_create() = 0;
virtual void render_target_set_position(RID p_render_target, int p_x, int p_y) = 0;
- virtual void render_target_set_size(RID p_render_target, int p_width, int p_height) = 0;
+ virtual void render_target_set_size(RID p_render_target, int p_width, int p_height, uint32_t p_view_count) = 0;
virtual RID render_target_get_texture(RID p_render_target) = 0;
virtual void render_target_set_external_texture(RID p_render_target, unsigned int p_texture_id) = 0;
virtual void render_target_set_flag(RID p_render_target, RenderTargetFlags p_flag, bool p_value) = 0;
diff --git a/servers/rendering/renderer_viewport.cpp b/servers/rendering/renderer_viewport.cpp
index f97e24947d..34bdb15c62 100644
--- a/servers/rendering/renderer_viewport.cpp
+++ b/servers/rendering/renderer_viewport.cpp
@@ -71,11 +71,11 @@ static Transform2D _canvas_get_transform(RendererViewport::Viewport *p_viewport,
return xf;
}
-void RendererViewport::_draw_3d(Viewport *p_viewport, XRInterface::Eyes p_eye) {
+void RendererViewport::_draw_3d(Viewport *p_viewport) {
RENDER_TIMESTAMP(">Begin Rendering 3D Scene");
Ref<XRInterface> xr_interface;
- if (XRServer::get_singleton() != nullptr) {
+ if (p_viewport->use_xr && XRServer::get_singleton() != nullptr) {
xr_interface = XRServer::get_singleton()->get_primary_interface();
}
@@ -95,15 +95,12 @@ void RendererViewport::_draw_3d(Viewport *p_viewport, XRInterface::Eyes p_eye) {
}
float screen_lod_threshold = p_viewport->lod_threshold / float(p_viewport->size.width);
- if (p_viewport->use_xr && xr_interface.is_valid()) {
- RSG::scene->render_camera(p_viewport->render_buffers, xr_interface, p_eye, p_viewport->camera, p_viewport->scenario, p_viewport->self, p_viewport->size, screen_lod_threshold, p_viewport->shadow_atlas);
- } else {
- RSG::scene->render_camera(p_viewport->render_buffers, p_viewport->camera, p_viewport->scenario, p_viewport->self, p_viewport->size, screen_lod_threshold, p_viewport->shadow_atlas);
- }
+ RSG::scene->render_camera(p_viewport->render_buffers, p_viewport->camera, p_viewport->scenario, p_viewport->self, p_viewport->size, screen_lod_threshold, p_viewport->shadow_atlas, xr_interface);
+
RENDER_TIMESTAMP("<End Rendering 3D Scene");
}
-void RendererViewport::_draw_viewport(Viewport *p_viewport, XRInterface::Eyes p_eye) {
+void RendererViewport::_draw_viewport(Viewport *p_viewport, uint32_t p_view_count) {
if (p_viewport->measure_render_time) {
String rt_id = "vp_begin_" + itos(p_viewport->self.get_id());
RSG::storage->capture_timestamp(rt_id);
@@ -139,13 +136,13 @@ void RendererViewport::_draw_viewport(Viewport *p_viewport, XRInterface::Eyes p_
if ((scenario_draw_canvas_bg || can_draw_3d) && !p_viewport->render_buffers.is_valid()) {
//wants to draw 3D but there is no render buffer, create
p_viewport->render_buffers = RSG::scene->render_buffers_create();
- RSG::scene->render_buffers_configure(p_viewport->render_buffers, p_viewport->render_target, p_viewport->size.width, p_viewport->size.height, p_viewport->msaa, p_viewport->screen_space_aa, p_viewport->use_debanding);
+ RSG::scene->render_buffers_configure(p_viewport->render_buffers, p_viewport->render_target, p_viewport->size.width, p_viewport->size.height, p_viewport->msaa, p_viewport->screen_space_aa, p_viewport->use_debanding, p_view_count);
}
RSG::storage->render_target_request_clear(p_viewport->render_target, bgcolor);
if (!scenario_draw_canvas_bg && can_draw_3d) {
- _draw_3d(p_viewport, p_eye);
+ _draw_3d(p_viewport);
}
if (!p_viewport->hide_canvas) {
@@ -392,7 +389,7 @@ void RendererViewport::_draw_viewport(Viewport *p_viewport, XRInterface::Eyes p_
if (!can_draw_3d) {
RSG::scene->render_empty_scene(p_viewport->render_buffers, p_viewport->scenario, p_viewport->shadow_atlas);
} else {
- _draw_3d(p_viewport, p_eye);
+ _draw_3d(p_viewport);
}
scenario_draw_canvas_bg = false;
}
@@ -433,7 +430,7 @@ void RendererViewport::_draw_viewport(Viewport *p_viewport, XRInterface::Eyes p_
if (!can_draw_3d) {
RSG::scene->render_empty_scene(p_viewport->render_buffers, p_viewport->scenario, p_viewport->shadow_atlas);
} else {
- _draw_3d(p_viewport, p_eye);
+ _draw_3d(p_viewport);
}
scenario_draw_canvas_bg = false;
@@ -444,7 +441,7 @@ void RendererViewport::_draw_viewport(Viewport *p_viewport, XRInterface::Eyes p_
if (!can_draw_3d) {
RSG::scene->render_empty_scene(p_viewport->render_buffers, p_viewport->scenario, p_viewport->shadow_atlas);
} else {
- _draw_3d(p_viewport, p_eye);
+ _draw_3d(p_viewport);
}
}
}
@@ -481,7 +478,7 @@ void RendererViewport::draw_viewports() {
//sort viewports
active_viewports.sort_custom<ViewportSort>();
- Map<DisplayServer::WindowID, Vector<RendererCompositor::BlitToScreen>> blit_to_screen_list;
+ Map<DisplayServer::WindowID, Vector<BlitToScreen>> blit_to_screen_list;
//draw viewports
RENDER_TIMESTAMP(">Render Viewports");
@@ -535,52 +532,54 @@ void RendererViewport::draw_viewports() {
RENDER_TIMESTAMP(">Rendering Viewport " + itos(i));
RSG::storage->render_target_set_as_unused(vp->render_target);
-#if 0
- // TODO fix up this code after we change our commit_for_eye to accept our new render targets
-
if (vp->use_xr && xr_interface.is_valid()) {
- // override our size, make sure it matches our required size
+ // override our size, make sure it matches our required size and is created as a stereo target
vp->size = xr_interface->get_render_targetsize();
- RSG::storage->render_target_set_size(vp->render_target, vp->size.x, vp->size.y);
+ uint32_t view_count = xr_interface->get_view_count();
+ RSG::storage->render_target_set_size(vp->render_target, vp->size.x, vp->size.y, view_count);
- // render mono or left eye first
- XRInterface::Eyes leftOrMono = xr_interface->is_stereo() ? XRInterface::EYE_LEFT : XRInterface::EYE_MONO;
-
- // check for an external texture destination for our left eye/mono
- // TODO investigate how we're going to make external textures work
- RSG::storage->render_target_set_external_texture(vp->render_target, xr_interface->get_external_texture_for_eye(leftOrMono));
+ // check for an external texture destination (disabled for now, not yet supported)
+ // RSG::storage->render_target_set_external_texture(vp->render_target, xr_interface->get_external_texture_for_eye(leftOrMono));
+ RSG::storage->render_target_set_external_texture(vp->render_target, 0);
- // set our render target as current
- RSG::rasterizer->set_current_render_target(vp->render_target);
+ // render...
+ RSG::scene->set_debug_draw_mode(vp->debug_draw);
+ RSG::storage->render_info_begin_capture();
- // and draw left eye/mono
- _draw_viewport(vp, leftOrMono);
- xr_interface->commit_for_eye(leftOrMono, vp->render_target, vp->viewport_to_screen_rect);
+ // and draw viewport
+ _draw_viewport(vp, view_count);
- // render right eye
- if (leftOrMono == XRInterface::EYE_LEFT) {
- // check for an external texture destination for our right eye
- RSG::storage->render_target_set_external_texture(vp->render_target, xr_interface->get_external_texture_for_eye(XRInterface::EYE_RIGHT));
+ // measure
+ RSG::storage->render_info_end_capture();
+ vp->render_info[RS::VIEWPORT_RENDER_INFO_OBJECTS_IN_FRAME] = RSG::storage->get_captured_render_info(RS::INFO_OBJECTS_IN_FRAME);
+ vp->render_info[RS::VIEWPORT_RENDER_INFO_VERTICES_IN_FRAME] = RSG::storage->get_captured_render_info(RS::INFO_VERTICES_IN_FRAME);
+ vp->render_info[RS::VIEWPORT_RENDER_INFO_MATERIAL_CHANGES_IN_FRAME] = RSG::storage->get_captured_render_info(RS::INFO_MATERIAL_CHANGES_IN_FRAME);
+ vp->render_info[RS::VIEWPORT_RENDER_INFO_SHADER_CHANGES_IN_FRAME] = RSG::storage->get_captured_render_info(RS::INFO_SHADER_CHANGES_IN_FRAME);
+ vp->render_info[RS::VIEWPORT_RENDER_INFO_SURFACE_CHANGES_IN_FRAME] = RSG::storage->get_captured_render_info(RS::INFO_SURFACE_CHANGES_IN_FRAME);
+ vp->render_info[RS::VIEWPORT_RENDER_INFO_DRAW_CALLS_IN_FRAME] = RSG::storage->get_captured_render_info(RS::INFO_DRAW_CALLS_IN_FRAME);
- // commit for eye may have changed the render target
- RSG::rasterizer->set_current_render_target(vp->render_target);
+ // commit our eyes
+ Vector<BlitToScreen> blits = xr_interface->commit_views(vp->render_target, vp->viewport_to_screen_rect);
+ if (vp->viewport_to_screen != DisplayServer::INVALID_WINDOW_ID && blits.size() > 0) {
+ if (!blit_to_screen_list.has(vp->viewport_to_screen)) {
+ blit_to_screen_list[vp->viewport_to_screen] = Vector<BlitToScreen>();
+ }
- _draw_viewport(vp, XRInterface::EYE_RIGHT);
- xr_interface->commit_for_eye(XRInterface::EYE_RIGHT, vp->render_target, vp->viewport_to_screen_rect);
+ for (int b = 0; b < blits.size(); b++) {
+ blit_to_screen_list[vp->viewport_to_screen].push_back(blits[b]);
+ }
}
// and for our frame timing, mark when we've finished committing our eyes
XRServer::get_singleton()->_mark_commit();
} else {
-#endif
- {
RSG::storage->render_target_set_external_texture(vp->render_target, 0);
RSG::scene->set_debug_draw_mode(vp->debug_draw);
RSG::storage->render_info_begin_capture();
// render standard mono camera
- _draw_viewport(vp);
+ _draw_viewport(vp, 1);
RSG::storage->render_info_end_capture();
vp->render_info[RS::VIEWPORT_RENDER_INFO_OBJECTS_IN_FRAME] = RSG::storage->get_captured_render_info(RS::INFO_OBJECTS_IN_FRAME);
@@ -592,7 +591,7 @@ void RendererViewport::draw_viewports() {
if (vp->viewport_to_screen != DisplayServer::INVALID_WINDOW_ID && (!vp->viewport_render_direct_to_screen || !RSG::rasterizer->is_low_end())) {
//copy to screen if set as such
- RendererCompositor::BlitToScreen blit;
+ BlitToScreen blit;
blit.render_target = vp->render_target;
if (vp->viewport_to_screen_rect != Rect2()) {
blit.rect = vp->viewport_to_screen_rect;
@@ -602,7 +601,7 @@ void RendererViewport::draw_viewports() {
}
if (!blit_to_screen_list.has(vp->viewport_to_screen)) {
- blit_to_screen_list[vp->viewport_to_screen] = Vector<RendererCompositor::BlitToScreen>();
+ blit_to_screen_list[vp->viewport_to_screen] = Vector<BlitToScreen>();
}
blit_to_screen_list[vp->viewport_to_screen].push_back(blit);
@@ -621,7 +620,7 @@ void RendererViewport::draw_viewports() {
//this needs to be called to make screen swapping more efficient
RSG::rasterizer->prepare_for_blitting_render_targets();
- for (Map<int, Vector<RendererCompositor::BlitToScreen>>::Element *E = blit_to_screen_list.front(); E; E = E->next()) {
+ for (Map<int, Vector<BlitToScreen>>::Element *E = blit_to_screen_list.front(); E; E = E->next()) {
RSG::rasterizer->blit_render_targets_to_screen(E->key(), E->get().ptr(), E->get().size());
}
}
@@ -646,7 +645,29 @@ void RendererViewport::viewport_set_use_xr(RID p_viewport, bool p_use_xr) {
Viewport *viewport = viewport_owner.getornull(p_viewport);
ERR_FAIL_COND(!viewport);
+ if (viewport->use_xr == p_use_xr) {
+ return;
+ }
+
viewport->use_xr = p_use_xr;
+ if (viewport->render_buffers.is_valid()) {
+ RSG::scene->render_buffers_configure(viewport->render_buffers, viewport->render_target, viewport->size.width, viewport->size.height, viewport->msaa, viewport->screen_space_aa, viewport->use_debanding, viewport->get_view_count());
+ }
+}
+
+uint32_t RendererViewport::Viewport::get_view_count() {
+ uint32_t view_count = 1;
+
+ if (use_xr && XRServer::get_singleton() != nullptr) {
+ Ref<XRInterface> xr_interface;
+
+ xr_interface = XRServer::get_singleton()->get_primary_interface();
+ if (xr_interface.is_valid()) {
+ view_count = xr_interface->get_view_count();
+ }
+ }
+
+ return view_count;
}
void RendererViewport::viewport_set_size(RID p_viewport, int p_width, int p_height) {
@@ -656,13 +677,14 @@ void RendererViewport::viewport_set_size(RID p_viewport, int p_width, int p_heig
ERR_FAIL_COND(!viewport);
viewport->size = Size2(p_width, p_height);
- RSG::storage->render_target_set_size(viewport->render_target, p_width, p_height);
+ uint32_t view_count = viewport->get_view_count();
+ RSG::storage->render_target_set_size(viewport->render_target, p_width, p_height, view_count);
if (viewport->render_buffers.is_valid()) {
if (p_width == 0 || p_height == 0) {
RSG::scene->free(viewport->render_buffers);
viewport->render_buffers = RID();
} else {
- RSG::scene->render_buffers_configure(viewport->render_buffers, viewport->render_target, viewport->size.width, viewport->size.height, viewport->msaa, viewport->screen_space_aa, viewport->use_debanding);
+ RSG::scene->render_buffers_configure(viewport->render_buffers, viewport->render_target, viewport->size.width, viewport->size.height, viewport->msaa, viewport->screen_space_aa, viewport->use_debanding, view_count);
}
}
@@ -704,7 +726,7 @@ void RendererViewport::viewport_attach_to_screen(RID p_viewport, const Rect2 &p_
// If using GLES2 we can optimize this operation by rendering directly to system_fbo
// instead of rendering to fbo and copying to system_fbo after
if (RSG::rasterizer->is_low_end() && viewport->viewport_render_direct_to_screen) {
- RSG::storage->render_target_set_size(viewport->render_target, p_rect.size.x, p_rect.size.y);
+ RSG::storage->render_target_set_size(viewport->render_target, p_rect.size.x, p_rect.size.y, viewport->get_view_count());
RSG::storage->render_target_set_position(viewport->render_target, p_rect.position.x, p_rect.position.y);
}
@@ -714,7 +736,7 @@ void RendererViewport::viewport_attach_to_screen(RID p_viewport, const Rect2 &p_
// if render_direct_to_screen was used, reset size and position
if (RSG::rasterizer->is_low_end() && viewport->viewport_render_direct_to_screen) {
RSG::storage->render_target_set_position(viewport->render_target, 0, 0);
- RSG::storage->render_target_set_size(viewport->render_target, viewport->size.x, viewport->size.y);
+ RSG::storage->render_target_set_size(viewport->render_target, viewport->size.x, viewport->size.y, viewport->get_view_count());
}
viewport->viewport_to_screen_rect = Rect2();
@@ -733,7 +755,7 @@ void RendererViewport::viewport_set_render_direct_to_screen(RID p_viewport, bool
// if disabled, reset render_target size and position
if (!p_enable) {
RSG::storage->render_target_set_position(viewport->render_target, 0, 0);
- RSG::storage->render_target_set_size(viewport->render_target, viewport->size.x, viewport->size.y);
+ RSG::storage->render_target_set_size(viewport->render_target, viewport->size.x, viewport->size.y, viewport->get_view_count());
}
RSG::storage->render_target_set_flag(viewport->render_target, RendererStorage::RENDER_TARGET_DIRECT_TO_SCREEN, p_enable);
@@ -741,7 +763,7 @@ void RendererViewport::viewport_set_render_direct_to_screen(RID p_viewport, bool
// if attached to screen already, setup screen size and position, this needs to happen after setting flag to avoid an unnecessary buffer allocation
if (RSG::rasterizer->is_low_end() && viewport->viewport_to_screen_rect != Rect2() && p_enable) {
- RSG::storage->render_target_set_size(viewport->render_target, viewport->viewport_to_screen_rect.size.x, viewport->viewport_to_screen_rect.size.y);
+ RSG::storage->render_target_set_size(viewport->render_target, viewport->viewport_to_screen_rect.size.x, viewport->viewport_to_screen_rect.size.y, viewport->get_view_count());
RSG::storage->render_target_set_position(viewport->render_target, viewport->viewport_to_screen_rect.position.x, viewport->viewport_to_screen_rect.position.y);
}
}
@@ -802,6 +824,10 @@ void RendererViewport::viewport_set_scenario(RID p_viewport, RID p_scenario) {
Viewport *viewport = viewport_owner.getornull(p_viewport);
ERR_FAIL_COND(!viewport);
+ if (viewport->scenario.is_valid()) {
+ RSG::scene->scenario_remove_viewport_visibility_mask(viewport->scenario, p_viewport);
+ }
+
viewport->scenario = p_scenario;
if (viewport->use_occlusion_culling) {
RendererSceneOcclusionCull::get_singleton()->buffer_set_scenario(p_viewport, p_scenario);
@@ -892,7 +918,7 @@ void RendererViewport::viewport_set_msaa(RID p_viewport, RS::ViewportMSAA p_msaa
}
viewport->msaa = p_msaa;
if (viewport->render_buffers.is_valid()) {
- RSG::scene->render_buffers_configure(viewport->render_buffers, viewport->render_target, viewport->size.width, viewport->size.height, p_msaa, viewport->screen_space_aa, viewport->use_debanding);
+ RSG::scene->render_buffers_configure(viewport->render_buffers, viewport->render_target, viewport->size.width, viewport->size.height, p_msaa, viewport->screen_space_aa, viewport->use_debanding, viewport->get_view_count());
}
}
@@ -905,7 +931,7 @@ void RendererViewport::viewport_set_screen_space_aa(RID p_viewport, RS::Viewport
}
viewport->screen_space_aa = p_mode;
if (viewport->render_buffers.is_valid()) {
- RSG::scene->render_buffers_configure(viewport->render_buffers, viewport->render_target, viewport->size.width, viewport->size.height, viewport->msaa, p_mode, viewport->use_debanding);
+ RSG::scene->render_buffers_configure(viewport->render_buffers, viewport->render_target, viewport->size.width, viewport->size.height, viewport->msaa, p_mode, viewport->use_debanding, viewport->get_view_count());
}
}
@@ -918,7 +944,7 @@ void RendererViewport::viewport_set_use_debanding(RID p_viewport, bool p_use_deb
}
viewport->use_debanding = p_use_debanding;
if (viewport->render_buffers.is_valid()) {
- RSG::scene->render_buffers_configure(viewport->render_buffers, viewport->render_target, viewport->size.width, viewport->size.height, viewport->msaa, viewport->screen_space_aa, p_use_debanding);
+ RSG::scene->render_buffers_configure(viewport->render_buffers, viewport->render_target, viewport->size.width, viewport->size.height, viewport->msaa, viewport->screen_space_aa, p_use_debanding, viewport->get_view_count());
}
}
diff --git a/servers/rendering/renderer_viewport.h b/servers/rendering/renderer_viewport.h
index 5c372e8c9a..ffda9ad8f0 100644
--- a/servers/rendering/renderer_viewport.h
+++ b/servers/rendering/renderer_viewport.h
@@ -164,6 +164,8 @@ public:
time_gpu_begin = 0;
time_gpu_end = 0;
}
+
+ uint32_t get_view_count();
};
HashMap<String, RID> timestamp_vp_map;
@@ -187,8 +189,8 @@ public:
Vector<Viewport *> active_viewports;
private:
- void _draw_3d(Viewport *p_viewport, XRInterface::Eyes p_eye);
- void _draw_viewport(Viewport *p_viewport, XRInterface::Eyes p_eye = XRInterface::EYE_MONO);
+ void _draw_3d(Viewport *p_viewport);
+ void _draw_viewport(Viewport *p_viewport, uint32_t p_view_count = 1);
int occlusion_rays_per_thread = 512;
diff --git a/servers/rendering/rendering_device.h b/servers/rendering/rendering_device.h
index 4dcb9b963e..c13dc01dd7 100644
--- a/servers/rendering/rendering_device.h
+++ b/servers/rendering/rendering_device.h
@@ -516,11 +516,11 @@ public:
typedef int64_t FramebufferFormatID;
// This ID is warranted to be unique for the same formats, does not need to be freed
- virtual FramebufferFormatID framebuffer_format_create(const Vector<AttachmentFormat> &p_format) = 0;
+ virtual FramebufferFormatID framebuffer_format_create(const Vector<AttachmentFormat> &p_format, uint32_t p_view_count = 1) = 0;
virtual FramebufferFormatID framebuffer_format_create_empty(TextureSamples p_samples = TEXTURE_SAMPLES_1) = 0;
virtual TextureSamples framebuffer_format_get_texture_samples(FramebufferFormatID p_format) = 0;
- virtual RID framebuffer_create(const Vector<RID> &p_texture_attachments, FramebufferFormatID p_format_check = INVALID_ID) = 0;
+ virtual RID framebuffer_create(const Vector<RID> &p_texture_attachments, FramebufferFormatID p_format_check = INVALID_ID, uint32_t p_view_count = 1) = 0;
virtual RID framebuffer_create_empty(const Size2i &p_size, TextureSamples p_samples = TEXTURE_SAMPLES_1, FramebufferFormatID p_format_check = INVALID_ID) = 0;
virtual FramebufferFormatID framebuffer_get_format(RID p_framebuffer) = 0;
diff --git a/servers/rendering/rendering_device_binds.h b/servers/rendering/rendering_device_binds.h
index e43c3669b5..912674e309 100644
--- a/servers/rendering/rendering_device_binds.h
+++ b/servers/rendering/rendering_device_binds.h
@@ -51,8 +51,8 @@
ClassDB::bind_method(D_METHOD("get_" _MKSTR(m_sub) "_" _MKSTR(m_member)), &m_class::get_##m_sub##_##m_member); \
ADD_PROPERTY(PropertyInfo(m_variant_type, _MKSTR(m_sub) "_" _MKSTR(m_member)), "set_" _MKSTR(m_sub) "_" _MKSTR(m_member), "get_" _MKSTR(m_sub) "_" _MKSTR(m_member))
-class RDTextureFormat : public Reference {
- GDCLASS(RDTextureFormat, Reference)
+class RDTextureFormat : public RefCounted {
+ GDCLASS(RDTextureFormat, RefCounted)
friend class RenderingDevice;
RD::TextureFormat base;
@@ -87,8 +87,8 @@ protected:
}
};
-class RDTextureView : public Reference {
- GDCLASS(RDTextureView, Reference)
+class RDTextureView : public RefCounted {
+ GDCLASS(RDTextureView, RefCounted)
friend class RenderingDevice;
@@ -110,8 +110,8 @@ protected:
}
};
-class RDAttachmentFormat : public Reference {
- GDCLASS(RDAttachmentFormat, Reference)
+class RDAttachmentFormat : public RefCounted {
+ GDCLASS(RDAttachmentFormat, RefCounted)
friend class RenderingDevice;
RD::AttachmentFormat base;
@@ -128,8 +128,8 @@ protected:
}
};
-class RDSamplerState : public Reference {
- GDCLASS(RDSamplerState, Reference)
+class RDSamplerState : public RefCounted {
+ GDCLASS(RDSamplerState, RefCounted)
friend class RenderingDevice;
RD::SamplerState base;
@@ -171,8 +171,8 @@ protected:
}
};
-class RDVertexAttribute : public Reference {
- GDCLASS(RDVertexAttribute, Reference)
+class RDVertexAttribute : public RefCounted {
+ GDCLASS(RDVertexAttribute, RefCounted)
friend class RenderingDevice;
RD::VertexAttribute base;
@@ -192,8 +192,8 @@ protected:
RD_BIND(Variant::INT, RDVertexAttribute, frequency);
}
};
-class RDShaderSource : public Reference {
- GDCLASS(RDShaderSource, Reference)
+class RDShaderSource : public RefCounted {
+ GDCLASS(RDShaderSource, RefCounted)
String source[RD::SHADER_STAGE_MAX];
RD::ShaderLanguage language = RD::SHADER_LANGUAGE_GLSL;
@@ -386,8 +386,8 @@ protected:
}
};
-class RDUniform : public Reference {
- GDCLASS(RDUniform, Reference)
+class RDUniform : public RefCounted {
+ GDCLASS(RDUniform, RefCounted)
friend class RenderingDevice;
RD::Uniform base;
@@ -424,8 +424,8 @@ protected:
ADD_PROPERTY(PropertyInfo(Variant::ARRAY, "_ids", PROPERTY_HINT_NONE, "", PROPERTY_USAGE_DEFAULT | PROPERTY_USAGE_INTERNAL), "_set_ids", "get_ids");
}
};
-class RDPipelineRasterizationState : public Reference {
- GDCLASS(RDPipelineRasterizationState, Reference)
+class RDPipelineRasterizationState : public RefCounted {
+ GDCLASS(RDPipelineRasterizationState, RefCounted)
friend class RenderingDevice;
RD::PipelineRasterizationState base;
@@ -459,8 +459,8 @@ protected:
}
};
-class RDPipelineMultisampleState : public Reference {
- GDCLASS(RDPipelineMultisampleState, Reference)
+class RDPipelineMultisampleState : public RefCounted {
+ GDCLASS(RDPipelineMultisampleState, RefCounted)
friend class RenderingDevice;
RD::PipelineMultisampleState base;
@@ -490,8 +490,8 @@ protected:
}
};
-class RDPipelineDepthStencilState : public Reference {
- GDCLASS(RDPipelineDepthStencilState, Reference)
+class RDPipelineDepthStencilState : public RefCounted {
+ GDCLASS(RDPipelineDepthStencilState, RefCounted)
friend class RenderingDevice;
RD::PipelineDepthStencilState base;
@@ -549,8 +549,8 @@ protected:
}
};
-class RDPipelineColorBlendStateAttachment : public Reference {
- GDCLASS(RDPipelineColorBlendStateAttachment, Reference)
+class RDPipelineColorBlendStateAttachment : public RefCounted {
+ GDCLASS(RDPipelineColorBlendStateAttachment, RefCounted)
friend class RenderingDevice;
RD::PipelineColorBlendState::Attachment base;
@@ -594,8 +594,8 @@ protected:
}
};
-class RDPipelineColorBlendState : public Reference {
- GDCLASS(RDPipelineColorBlendState, Reference)
+class RDPipelineColorBlendState : public RefCounted {
+ GDCLASS(RDPipelineColorBlendState, RefCounted)
friend class RenderingDevice;
RD::PipelineColorBlendState base;
diff --git a/servers/rendering/rendering_server_default.h b/servers/rendering/rendering_server_default.h
index 6476d7c75d..e4d319ed6c 100644
--- a/servers/rendering/rendering_server_default.h
+++ b/servers/rendering/rendering_server_default.h
@@ -726,6 +726,7 @@ public:
FUNC2(instance_set_exterior, RID, bool)
FUNC2(instance_set_extra_visibility_margin, RID, real_t)
+ FUNC2(instance_set_visibility_parent, RID, RID)
// don't use these in a game!
FUNC2RC(Vector<ObjectID>, instances_cull_aabb, const AABB &, RID)
@@ -736,8 +737,7 @@ public:
FUNC2(instance_geometry_set_cast_shadows_setting, RID, ShadowCastingSetting)
FUNC2(instance_geometry_set_material_override, RID, RID)
- FUNC5(instance_geometry_set_draw_range, RID, float, float, float, float)
- FUNC2(instance_geometry_set_as_instance_lod, RID, RID)
+ FUNC5(instance_geometry_set_visibility_range, RID, float, float, float, float)
FUNC4(instance_geometry_set_lightmap, RID, RID, const Rect2 &, int)
FUNC2(instance_geometry_set_lod_bias, RID, float)
diff --git a/servers/rendering/shader_types.cpp b/servers/rendering/shader_types.cpp
index 35f1b05796..c4e7511374 100644
--- a/servers/rendering/shader_types.cpp
+++ b/servers/rendering/shader_types.cpp
@@ -92,6 +92,10 @@ ShaderTypes::ShaderTypes() {
shader_modes[RS::SHADER_SPATIAL].functions["vertex"].built_ins["VIEWPORT_SIZE"] = constt(ShaderLanguage::TYPE_VEC2);
shader_modes[RS::SHADER_SPATIAL].functions["vertex"].built_ins["OUTPUT_IS_SRGB"] = constt(ShaderLanguage::TYPE_BOOL);
+ shader_modes[RS::SHADER_SPATIAL].functions["vertex"].built_ins["VIEW_INDEX"] = constt(ShaderLanguage::TYPE_INT);
+ shader_modes[RS::SHADER_SPATIAL].functions["vertex"].built_ins["VIEW_MONO_LEFT"] = constt(ShaderLanguage::TYPE_INT);
+ shader_modes[RS::SHADER_SPATIAL].functions["vertex"].built_ins["VIEW_RIGHT"] = constt(ShaderLanguage::TYPE_INT);
+
shader_modes[RS::SHADER_SPATIAL].functions["fragment"].built_ins["VERTEX"] = constt(ShaderLanguage::TYPE_VEC3);
shader_modes[RS::SHADER_SPATIAL].functions["fragment"].built_ins["FRAGCOORD"] = constt(ShaderLanguage::TYPE_VEC4);
shader_modes[RS::SHADER_SPATIAL].functions["fragment"].built_ins["FRONT_FACING"] = constt(ShaderLanguage::TYPE_BOOL);
@@ -131,6 +135,10 @@ ShaderTypes::ShaderTypes() {
shader_modes[RS::SHADER_SPATIAL].functions["fragment"].built_ins["SCREEN_UV"] = constt(ShaderLanguage::TYPE_VEC2);
shader_modes[RS::SHADER_SPATIAL].functions["fragment"].built_ins["POINT_COORD"] = constt(ShaderLanguage::TYPE_VEC2);
+ shader_modes[RS::SHADER_SPATIAL].functions["fragment"].built_ins["VIEW_INDEX"] = constt(ShaderLanguage::TYPE_INT);
+ shader_modes[RS::SHADER_SPATIAL].functions["fragment"].built_ins["VIEW_MONO_LEFT"] = constt(ShaderLanguage::TYPE_INT);
+ shader_modes[RS::SHADER_SPATIAL].functions["fragment"].built_ins["VIEW_RIGHT"] = constt(ShaderLanguage::TYPE_INT);
+
shader_modes[RS::SHADER_SPATIAL].functions["fragment"].built_ins["OUTPUT_IS_SRGB"] = constt(ShaderLanguage::TYPE_BOOL);
shader_modes[RS::SHADER_SPATIAL].functions["fragment"].built_ins["WORLD_MATRIX"] = constt(ShaderLanguage::TYPE_MAT4);
diff --git a/servers/rendering_server.cpp b/servers/rendering_server.cpp
index 0471990ed7..f25f255321 100644
--- a/servers/rendering_server.cpp
+++ b/servers/rendering_server.cpp
@@ -422,7 +422,9 @@ Error RenderingServer::_surface_set_data(Array p_arrays, uint32_t p_format, uint
value |= CLAMP(int((src[i * 4 + 0] * 0.5 + 0.5) * 1023.0), 0, 1023);
value |= CLAMP(int((src[i * 4 + 1] * 0.5 + 0.5) * 1023.0), 0, 1023) << 10;
value |= CLAMP(int((src[i * 4 + 2] * 0.5 + 0.5) * 1023.0), 0, 1023) << 20;
- value |= CLAMP(int((src[i * 4 + 3] * 0.5 + 0.5) * 1023.0), 0, 1023) << 30;
+ if (src[i * 4 + 3] > 0) {
+ value |= 3 << 30;
+ }
memcpy(&vw[p_offsets[ai] + i * p_vertex_stride], &value, 4);
}
@@ -1723,11 +1725,11 @@ void RenderingServer::_bind_methods() {
ClassDB::bind_method(D_METHOD("instance_attach_skeleton", "instance", "skeleton"), &RenderingServer::instance_attach_skeleton);
ClassDB::bind_method(D_METHOD("instance_set_exterior", "instance", "enabled"), &RenderingServer::instance_set_exterior);
ClassDB::bind_method(D_METHOD("instance_set_extra_visibility_margin", "instance", "margin"), &RenderingServer::instance_set_extra_visibility_margin);
+ ClassDB::bind_method(D_METHOD("instance_set_visibility_parent", "instance", "parent"), &RenderingServer::instance_set_visibility_parent);
ClassDB::bind_method(D_METHOD("instance_geometry_set_flag", "instance", "flag", "enabled"), &RenderingServer::instance_geometry_set_flag);
ClassDB::bind_method(D_METHOD("instance_geometry_set_cast_shadows_setting", "instance", "shadow_casting_setting"), &RenderingServer::instance_geometry_set_cast_shadows_setting);
ClassDB::bind_method(D_METHOD("instance_geometry_set_material_override", "instance", "material"), &RenderingServer::instance_geometry_set_material_override);
- ClassDB::bind_method(D_METHOD("instance_geometry_set_draw_range", "instance", "min", "max", "min_margin", "max_margin"), &RenderingServer::instance_geometry_set_draw_range);
- ClassDB::bind_method(D_METHOD("instance_geometry_set_as_instance_lod", "instance", "as_lod_of_instance"), &RenderingServer::instance_geometry_set_as_instance_lod);
+ ClassDB::bind_method(D_METHOD("instance_geometry_set_visibility_range", "instance", "min", "max", "min_margin", "max_margin"), &RenderingServer::instance_geometry_set_visibility_range);
ClassDB::bind_method(D_METHOD("instances_cull_aabb", "aabb", "scenario"), &RenderingServer::_instances_cull_aabb_bind, DEFVAL(RID()));
ClassDB::bind_method(D_METHOD("instances_cull_ray", "from", "to", "scenario"), &RenderingServer::_instances_cull_ray_bind, DEFVAL(RID()));
@@ -2282,6 +2284,10 @@ RenderingServer::RenderingServer() {
GLOBAL_DEF_RST("rendering/textures/vram_compression/import_etc2", true);
GLOBAL_DEF_RST("rendering/textures/vram_compression/import_pvrtc", false);
+ GLOBAL_DEF("rendering/textures/lossless_compression/force_png", false);
+ GLOBAL_DEF("rendering/textures/lossless_compression/webp_compression_level", 2);
+ ProjectSettings::get_singleton()->set_custom_property_info("rendering/textures/lossless_compression/webp_compression_level", PropertyInfo(Variant::INT, "rendering/textures/lossless_compression/webp_compression_level", PROPERTY_HINT_RANGE, "0,9,1"));
+
GLOBAL_DEF("rendering/limits/time/time_rollover_secs", 3600);
ProjectSettings::get_singleton()->set_custom_property_info("rendering/limits/time/time_rollover_secs", PropertyInfo(Variant::FLOAT, "rendering/limits/time/time_rollover_secs", PROPERTY_HINT_RANGE, "0,10000,1,or_greater"));
@@ -2414,6 +2420,8 @@ RenderingServer::RenderingServer() {
GLOBAL_DEF("rendering/limits/cluster_builder/max_clustered_elements", 512);
ProjectSettings::get_singleton()->set_custom_property_info("rendering/limits/cluster_builder/max_clustered_elements", PropertyInfo(Variant::FLOAT, "rendering/limits/cluster_builder/max_clustered_elements", PROPERTY_HINT_RANGE, "32,8192,1"));
+
+ GLOBAL_DEF_RST("rendering/xr/enabled", false);
}
RenderingServer::~RenderingServer() {
diff --git a/servers/rendering_server.h b/servers/rendering_server.h
index 3247717e98..1806f1da18 100644
--- a/servers/rendering_server.h
+++ b/servers/rendering_server.h
@@ -1172,6 +1172,7 @@ public:
virtual void instance_set_exterior(RID p_instance, bool p_enabled) = 0;
virtual void instance_set_extra_visibility_margin(RID p_instance, real_t p_margin) = 0;
+ virtual void instance_set_visibility_parent(RID p_instance, RID p_parent_instance) = 0;
// don't use these in a game!
virtual Vector<ObjectID> instances_cull_aabb(const AABB &p_aabb, RID p_scenario = RID()) const = 0;
@@ -1201,8 +1202,7 @@ public:
virtual void instance_geometry_set_cast_shadows_setting(RID p_instance, ShadowCastingSetting p_shadow_casting_setting) = 0;
virtual void instance_geometry_set_material_override(RID p_instance, RID p_material) = 0;
- virtual void instance_geometry_set_draw_range(RID p_instance, float p_min, float p_max, float p_min_margin, float p_max_margin) = 0;
- virtual void instance_geometry_set_as_instance_lod(RID p_instance, RID p_as_lod_of_instance) = 0;
+ virtual void instance_geometry_set_visibility_range(RID p_instance, float p_min, float p_max, float p_min_margin, float p_max_margin) = 0;
virtual void instance_geometry_set_lightmap(RID p_instance, RID p_lightmap, const Rect2 &p_lightmap_uv_scale, int p_lightmap_slice) = 0;
virtual void instance_geometry_set_lod_bias(RID p_instance, float p_lod_bias) = 0;
diff --git a/servers/text_server.h b/servers/text_server.h
index 7fcfb91151..138ceb9356 100644
--- a/servers/text_server.h
+++ b/servers/text_server.h
@@ -31,7 +31,7 @@
#ifndef TEXT_SERVER_H
#define TEXT_SERVER_H
-#include "core/object/reference.h"
+#include "core/object/ref_counted.h"
#include "core/os/os.h"
#include "core/templates/rid.h"
#include "core/variant/variant.h"
diff --git a/servers/xr/xr_interface.cpp b/servers/xr/xr_interface.cpp
index 9148631899..09e8e12f8b 100644
--- a/servers/xr/xr_interface.cpp
+++ b/servers/xr/xr_interface.cpp
@@ -29,6 +29,7 @@
/*************************************************************************/
#include "xr_interface.h"
+#include "servers/rendering/renderer_compositor.h"
void XRInterface::_bind_methods() {
ClassDB::bind_method(D_METHOD("get_name"), &XRInterface::get_name);
@@ -45,7 +46,7 @@ void XRInterface::_bind_methods() {
ClassDB::bind_method(D_METHOD("get_tracking_status"), &XRInterface::get_tracking_status);
ClassDB::bind_method(D_METHOD("get_render_targetsize"), &XRInterface::get_render_targetsize);
- ClassDB::bind_method(D_METHOD("is_stereo"), &XRInterface::is_stereo);
+ ClassDB::bind_method(D_METHOD("get_view_count"), &XRInterface::get_view_count);
ADD_GROUP("Interface", "interface_");
ADD_PROPERTY(PropertyInfo(Variant::BOOL, "interface_is_primary"), "set_is_primary", "is_primary");
diff --git a/servers/xr/xr_interface.h b/servers/xr/xr_interface.h
index d1cf13f5e2..6031bd7003 100644
--- a/servers/xr/xr_interface.h
+++ b/servers/xr/xr_interface.h
@@ -35,6 +35,9 @@
#include "core/os/thread_safe.h"
#include "servers/xr_server.h"
+// forward declaration
+struct BlitToScreen;
+
/**
@author Bastiaan Olij <mux213@gmail.com>
@@ -47,8 +50,8 @@
Note that we may make this into a fully instantiable class for GDNative support.
*/
-class XRInterface : public Reference {
- GDCLASS(XRInterface, Reference);
+class XRInterface : public RefCounted {
+ GDCLASS(XRInterface, RefCounted);
public:
enum Capabilities { /* purely meta data, provides some info about what this interface supports */
@@ -105,17 +108,22 @@ public:
/** rendering and internal **/
virtual Size2 get_render_targetsize() = 0; /* returns the recommended render target size per eye for this device */
- virtual bool is_stereo() = 0; /* returns true if this interface requires stereo rendering (for VR HMDs) or mono rendering (for mobile AR) */
- virtual Transform3D get_transform_for_eye(XRInterface::Eyes p_eye, const Transform3D &p_cam_transform) = 0; /* get each eyes camera transform, also implement EYE_MONO */
- virtual CameraMatrix get_projection_for_eye(XRInterface::Eyes p_eye, real_t p_aspect, real_t p_z_near, real_t p_z_far) = 0; /* get each eyes projection matrix */
- virtual unsigned int get_external_texture_for_eye(XRInterface::Eyes p_eye); /* if applicable return external texture to render to */
- virtual void commit_for_eye(XRInterface::Eyes p_eye, RID p_render_target, const Rect2 &p_screen_rect) = 0; /* output the left or right eye */
+ virtual uint32_t get_view_count() = 0; /* returns the view count we need (1 is monoscopic, 2 is stereoscopic but can be more) */
+ virtual Transform3D get_camera_transform() = 0; /* returns the position of our camera for updating our camera node. For monoscopic this is equal to the views transform, for stereoscopic this should be an average */
+ virtual Transform3D get_transform_for_view(uint32_t p_view, const Transform3D &p_cam_transform) = 0; /* get each views transform */
+ virtual CameraMatrix get_projection_for_view(uint32_t p_view, real_t p_aspect, real_t p_z_near, real_t p_z_far) = 0; /* get each view projection matrix */
+
+ virtual Vector<BlitToScreen> commit_views(RID p_render_target, const Rect2 &p_screen_rect) = 0; /* commit rendered views to the XR interface */
virtual void process() = 0;
virtual void notification(int p_what) = 0;
XRInterface();
~XRInterface();
+
+ // deprecated
+ virtual unsigned int get_external_texture_for_eye(XRInterface::Eyes p_eye); /* if applicable return external texture to render to */
+ virtual void commit_for_eye(XRInterface::Eyes p_eye, RID p_render_target, const Rect2 &p_screen_rect) = 0; /* output the left or right eye */
};
VARIANT_ENUM_CAST(XRInterface::Capabilities);
diff --git a/servers/xr/xr_positional_tracker.h b/servers/xr/xr_positional_tracker.h
index dffa61f369..5577582929 100644
--- a/servers/xr/xr_positional_tracker.h
+++ b/servers/xr/xr_positional_tracker.h
@@ -43,8 +43,8 @@
This is where potentially additional AR/VR interfaces may be active as there are AR/VR SDKs that solely deal with positional tracking.
*/
-class XRPositionalTracker : public Reference {
- GDCLASS(XRPositionalTracker, Reference);
+class XRPositionalTracker : public RefCounted {
+ GDCLASS(XRPositionalTracker, RefCounted);
_THREAD_SAFE_CLASS_
public:
diff --git a/servers/xr_server.cpp b/servers/xr_server.cpp
index 3122ee685a..b12fff319d 100644
--- a/servers/xr_server.cpp
+++ b/servers/xr_server.cpp
@@ -119,7 +119,7 @@ void XRServer::center_on_hmd(RotationMode p_rotation_mode, bool p_keep_height) {
reference_frame = Transform3D();
// requesting our EYE_MONO transform should return our current HMD position
- Transform3D new_reference_frame = primary_interface->get_transform_for_eye(XRInterface::EYE_MONO, Transform3D());
+ Transform3D new_reference_frame = primary_interface->get_camera_transform();
// remove our tilt
if (p_rotation_mode == 1) {
@@ -148,7 +148,7 @@ void XRServer::center_on_hmd(RotationMode p_rotation_mode, bool p_keep_height) {
Transform3D XRServer::get_hmd_transform() {
Transform3D hmd_transform;
if (primary_interface != nullptr) {
- hmd_transform = primary_interface->get_transform_for_eye(XRInterface::EYE_MONO, hmd_transform);
+ hmd_transform = primary_interface->get_camera_transform();
};
return hmd_transform;
};
diff --git a/servers/xr_server.h b/servers/xr_server.h
index a2482b925a..25431844c2 100644
--- a/servers/xr_server.h
+++ b/servers/xr_server.h
@@ -31,7 +31,7 @@
#ifndef XR_SERVER_H
#define XR_SERVER_H
-#include "core/object/reference.h"
+#include "core/object/ref_counted.h"
#include "core/os/os.h"
#include "core/os/thread_safe.h"
#include "core/templates/rid.h"
diff --git a/tests/test_aabb.h b/tests/test_aabb.h
index 517c4dcefd..39e3c6e45b 100644
--- a/tests/test_aabb.h
+++ b/tests/test_aabb.h
@@ -50,8 +50,8 @@ TEST_CASE("[AABB] Constructor methods") {
TEST_CASE("[AABB] String conversion") {
CHECK_MESSAGE(
- String(AABB(Vector3(-1.5, 2, -2.5), Vector3(4, 5, 6))) == "-1.5, 2, -2.5 - 4, 5, 6",
- "The string representation shouild match the expected value.");
+ String(AABB(Vector3(-1.5, 2, -2.5), Vector3(4, 5, 6))) == "[P: (-1.5, 2, -2.5), S: (4, 5, 6)]",
+ "The string representation should match the expected value.");
}
TEST_CASE("[AABB] Basic getters") {
diff --git a/tests/test_class_db.h b/tests/test_class_db.h
index 17f9baab85..fe2ed696c5 100644
--- a/tests/test_class_db.h
+++ b/tests/test_class_db.h
@@ -97,7 +97,7 @@ struct ExposedClass {
bool is_singleton = false;
bool is_instantiable = false;
- bool is_reference = false;
+ bool is_ref_counted = false;
ClassDB::APIType api_type;
@@ -131,7 +131,7 @@ struct ExposedClass {
struct NamesCache {
StringName variant_type = StaticCString::create("Variant");
StringName object_class = StaticCString::create("Object");
- StringName reference_class = StaticCString::create("Reference");
+ StringName ref_counted_class = StaticCString::create("RefCounted");
StringName string_type = StaticCString::create("String");
StringName string_name_type = StaticCString::create("StringName");
StringName node_path_type = StaticCString::create("NodePath");
@@ -516,7 +516,7 @@ void add_exposed_classes(Context &r_context) {
exposed_class.api_type = api_type;
exposed_class.is_singleton = Engine::get_singleton()->has_singleton(class_name);
exposed_class.is_instantiable = class_info->creation_func && !exposed_class.is_singleton;
- exposed_class.is_reference = ClassDB::is_parent_class(class_name, "Reference");
+ exposed_class.is_ref_counted = ClassDB::is_parent_class(class_name, "RefCounted");
exposed_class.base = ClassDB::get_parent_class(class_name);
// Add properties
@@ -611,7 +611,7 @@ void add_exposed_classes(Context &r_context) {
method.return_type.name = return_info.class_name;
bool bad_reference_hint = !method.is_virtual && return_info.hint != PROPERTY_HINT_RESOURCE_TYPE &&
- ClassDB::is_parent_class(return_info.class_name, r_context.names_cache.reference_class);
+ ClassDB::is_parent_class(return_info.class_name, r_context.names_cache.ref_counted_class);
TEST_COND(bad_reference_hint, "Return type is reference but hint is not '" _STR(PROPERTY_HINT_RESOURCE_TYPE) "'.", " Are you returning a reference type by pointer? Method: '",
exposed_class.name, ".", method.name, "'.");
} else if (return_info.hint == PROPERTY_HINT_RESOURCE_TYPE) {
diff --git a/tests/test_color.h b/tests/test_color.h
index ad4a7cd3f2..bffa890ae2 100644
--- a/tests/test_color.h
+++ b/tests/test_color.h
@@ -140,7 +140,7 @@ TEST_CASE("[Color] Conversion methods") {
cyan.to_rgba64() == 0x0000'ffff'ffff'ffff,
"The returned 64-bit BGR number should match the expected value.");
CHECK_MESSAGE(
- String(cyan) == "0, 1, 1, 1",
+ String(cyan) == "(0, 1, 1, 1)",
"The string representation should match the expected value.");
}
diff --git a/tests/test_file_access.h b/tests/test_file_access.h
index 00a314644c..cb74e08a0d 100644
--- a/tests/test_file_access.h
+++ b/tests/test_file_access.h
@@ -31,7 +31,7 @@
#ifndef TEST_FILE_ACCESS_H
#define TEST_FILE_ACCESS_H
-#include "core/os/file_access.h"
+#include "core/io/file_access.h"
#include "test_utils.h"
namespace TestFileAccess {
diff --git a/tests/test_main.cpp b/tests/test_main.cpp
index 54327caf3d..d0466d1e2d 100644
--- a/tests/test_main.cpp
+++ b/tests/test_main.cpp
@@ -74,6 +74,7 @@
#include "test_shader_lang.h"
#include "test_string.h"
#include "test_text_server.h"
+#include "test_time.h"
#include "test_translation.h"
#include "test_validate_testing.h"
#include "test_variant.h"
diff --git a/tests/test_math.cpp b/tests/test_math.cpp
index 7f2097699a..67d9a52539 100644
--- a/tests/test_math.cpp
+++ b/tests/test_math.cpp
@@ -30,13 +30,13 @@
#include "test_math.h"
+#include "core/io/file_access.h"
#include "core/math/basis.h"
#include "core/math/camera_matrix.h"
#include "core/math/delaunay_3d.h"
#include "core/math/geometry_2d.h"
#include "core/math/math_funcs.h"
#include "core/math/transform_3d.h"
-#include "core/os/file_access.h"
#include "core/os/keyboard.h"
#include "core/os/os.h"
#include "core/string/print_string.h"
diff --git a/tests/test_object.h b/tests/test_object.h
index a12fad51e2..b7eedc2670 100644
--- a/tests/test_object.h
+++ b/tests/test_object.h
@@ -165,8 +165,8 @@ TEST_CASE("[Object] Construction") {
Object object;
CHECK_MESSAGE(
- !object.is_reference(),
- "Object is not a Reference.");
+ !object.is_ref_counted(),
+ "Object is not a RefCounted.");
Object *p_db = ObjectDB::get_instance(object.get_instance_id());
CHECK_MESSAGE(
diff --git a/tests/test_rect2.h b/tests/test_rect2.h
index 821aa69970..c5740167db 100644
--- a/tests/test_rect2.h
+++ b/tests/test_rect2.h
@@ -61,7 +61,7 @@ TEST_CASE("[Rect2] Constructor methods") {
TEST_CASE("[Rect2] String conversion") {
// Note: This also depends on the Vector2 string representation.
CHECK_MESSAGE(
- String(Rect2(0, 100, 1280, 720)) == "0, 100, 1280, 720",
+ String(Rect2(0, 100, 1280, 720)) == "[P: (0, 100), S: (1280, 720)]",
"The string representation should match the expected value.");
}
@@ -273,7 +273,7 @@ TEST_CASE("[Rect2i] Constructor methods") {
TEST_CASE("[Rect2i] String conversion") {
// Note: This also depends on the Vector2 string representation.
CHECK_MESSAGE(
- String(Rect2i(0, 100, 1280, 720)) == "0, 100, 1280, 720",
+ String(Rect2i(0, 100, 1280, 720)) == "[P: (0, 100), S: (1280, 720)]",
"The string representation should match the expected value.");
}
diff --git a/tests/test_shader_lang.cpp b/tests/test_shader_lang.cpp
index 2169350c02..ad763b344e 100644
--- a/tests/test_shader_lang.cpp
+++ b/tests/test_shader_lang.cpp
@@ -30,7 +30,7 @@
#include "test_shader_lang.h"
-#include "core/os/file_access.h"
+#include "core/io/file_access.h"
#include "core/os/main_loop.h"
#include "core/os/os.h"
diff --git a/tests/test_string.h b/tests/test_string.h
index 6e214574af..7f404a34e8 100644
--- a/tests/test_string.h
+++ b/tests/test_string.h
@@ -1130,7 +1130,7 @@ TEST_CASE("[String] Path functions") {
CHECK(String(path[i]).get_basename() == base_name[i]);
CHECK(String(path[i]).get_extension() == ext[i]);
CHECK(String(path[i]).get_file() == file[i]);
- CHECK(String(path[i]).is_abs_path() == abs[i]);
+ CHECK(String(path[i]).is_absolute_path() == abs[i]);
CHECK(String(path[i]).is_rel_path() != abs[i]);
CHECK(String(path[i]).simplify_path().get_base_dir().plus_file(file[i]) == String(path[i]).simplify_path());
}
diff --git a/tests/test_time.h b/tests/test_time.h
new file mode 100644
index 0000000000..28f1cb2f20
--- /dev/null
+++ b/tests/test_time.h
@@ -0,0 +1,145 @@
+/*************************************************************************/
+/* test_time.h */
+/*************************************************************************/
+/* This file is part of: */
+/* GODOT ENGINE */
+/* https://godotengine.org */
+/*************************************************************************/
+/* Copyright (c) 2007-2021 Juan Linietsky, Ariel Manzur. */
+/* Copyright (c) 2014-2021 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 TEST_TIME_H
+#define TEST_TIME_H
+
+#include "core/os/time.h"
+
+#include "thirdparty/doctest/doctest.h"
+
+#define YEAR_KEY "year"
+#define MONTH_KEY "month"
+#define DAY_KEY "day"
+#define WEEKDAY_KEY "weekday"
+#define HOUR_KEY "hour"
+#define MINUTE_KEY "minute"
+#define SECOND_KEY "second"
+#define DST_KEY "dst"
+
+namespace TestTime {
+
+TEST_CASE("[Time] Unix time conversion to/from datetime string") {
+ const Time *time = Time::get_singleton();
+
+ CHECK_MESSAGE(time->get_unix_time_from_datetime_string("1970-01-01T00:00:00") == 0, "Time get_unix_time_from_datetime_string: The timestamp for Unix epoch is zero.");
+ CHECK_MESSAGE(time->get_unix_time_from_datetime_string("1970-01-01 00:00:00") == 0, "Time get_unix_time_from_datetime_string: The timestamp for Unix epoch with space is zero.");
+ CHECK_MESSAGE(time->get_unix_time_from_datetime_string("1970-01-01") == 0, "Time get_unix_time_from_datetime_string: The timestamp for Unix epoch without time is zero.");
+ CHECK_MESSAGE(time->get_unix_time_from_datetime_string("00:00:00") == 0, "Time get_unix_time_from_datetime_string: The timestamp for zero time without date is zero.");
+ CHECK_MESSAGE(time->get_unix_time_from_datetime_string("1969-12-31T23:59:59") == -1, "Time get_unix_time_from_datetime_string: The timestamp for just before Unix epoch is negative one.");
+ CHECK_MESSAGE(time->get_unix_time_from_datetime_string("1234-05-06T07:08:09") == -23215049511, "Time get_unix_time_from_datetime_string: The timestamp for an arbitrary datetime is as expected.");
+ CHECK_MESSAGE(time->get_unix_time_from_datetime_string("1234-05-06 07:08:09") == -23215049511, "Time get_unix_time_from_datetime_string: The timestamp for an arbitrary datetime with space is as expected.");
+ CHECK_MESSAGE(time->get_unix_time_from_datetime_string("1234-05-06") == -23215075200, "Time get_unix_time_from_datetime_string: The timestamp for an arbitrary date without time is as expected.");
+ CHECK_MESSAGE(time->get_unix_time_from_datetime_string("07:08:09") == 25689, "Time get_unix_time_from_datetime_string: The timestamp for an arbitrary time without date is as expected.");
+ CHECK_MESSAGE(time->get_unix_time_from_datetime_string("2014-02-09T22:10:30") == 1391983830, "Time get_unix_time_from_datetime_string: The timestamp for GODOT IS OPEN SOURCE is as expected.");
+ CHECK_MESSAGE(time->get_unix_time_from_datetime_string("2014-02-09 22:10:30") == 1391983830, "Time get_unix_time_from_datetime_string: The timestamp for GODOT IS OPEN SOURCE with space is as expected.");
+ CHECK_MESSAGE(time->get_unix_time_from_datetime_string("2014-02-09") == 1391904000, "Time get_unix_time_from_datetime_string: The date for GODOT IS OPEN SOURCE without time is as expected.");
+ CHECK_MESSAGE(time->get_unix_time_from_datetime_string("22:10:30") == 79830, "Time get_unix_time_from_datetime_string: The time for GODOT IS OPEN SOURCE without date is as expected.");
+ CHECK_MESSAGE(time->get_unix_time_from_datetime_string("-1000000000-01-01T00:00:00") == -31557014167219200, "Time get_unix_time_from_datetime_string: In the year negative a billion, Japan might not have been here.");
+ CHECK_MESSAGE(time->get_unix_time_from_datetime_string("1000000-01-01T00:00:00") == 31494784780800, "Time get_unix_time_from_datetime_string: The timestamp for the year a million is as expected.");
+
+ CHECK_MESSAGE(time->get_datetime_string_from_unix_time(0) == "1970-01-01T00:00:00", "Time get_datetime_string_from_unix_time: The timestamp string for Unix epoch is zero.");
+ CHECK_MESSAGE(time->get_datetime_string_from_unix_time(0, true) == "1970-01-01 00:00:00", "Time get_datetime_string_from_unix_time: The timestamp string for Unix epoch with space is zero.");
+ CHECK_MESSAGE(time->get_date_string_from_unix_time(0) == "1970-01-01", "Time get_date_string_from_unix_time: The date string for zero is Unix epoch date.");
+ CHECK_MESSAGE(time->get_time_string_from_unix_time(0) == "00:00:00", "Time get_time_string_from_unix_time: The date for zero zero is Unix epoch date.");
+ CHECK_MESSAGE(time->get_datetime_string_from_unix_time(-1) == "1969-12-31T23:59:59", "Time get_time_string_from_unix_time: The timestamp string for just before Unix epoch is as expected.");
+ CHECK_MESSAGE(time->get_datetime_string_from_unix_time(-23215049511) == "1234-05-06T07:08:09", "Time get_datetime_string_from_unix_time: The timestamp for an arbitrary datetime is as expected.");
+ CHECK_MESSAGE(time->get_datetime_string_from_unix_time(-23215049511, true) == "1234-05-06 07:08:09", "Time get_datetime_string_from_unix_time: The timestamp for an arbitrary datetime with space is as expected.");
+ CHECK_MESSAGE(time->get_date_string_from_unix_time(-23215075200) == "1234-05-06", "Time get_date_string_from_unix_time: The timestamp for an arbitrary date without time is as expected.");
+ CHECK_MESSAGE(time->get_time_string_from_unix_time(25689) == "07:08:09", "Time get_time_string_from_unix_time: The timestamp for an arbitrary time without date is as expected.");
+ CHECK_MESSAGE(time->get_datetime_string_from_unix_time(1391983830) == "2014-02-09T22:10:30", "Time get_datetime_string_from_unix_time: The timestamp for GODOT IS OPEN SOURCE is as expected.");
+ CHECK_MESSAGE(time->get_datetime_string_from_unix_time(1391983830, true) == "2014-02-09 22:10:30", "Time get_datetime_string_from_unix_time: The timestamp for GODOT IS OPEN SOURCE with space is as expected.");
+ CHECK_MESSAGE(time->get_date_string_from_unix_time(1391904000) == "2014-02-09", "Time get_date_string_from_unix_time: The date for GODOT IS OPEN SOURCE without time is as expected.");
+ CHECK_MESSAGE(time->get_time_string_from_unix_time(79830) == "22:10:30", "Time get_time_string_from_unix_time: The time for GODOT IS OPEN SOURCE without date is as expected.");
+ CHECK_MESSAGE(time->get_datetime_string_from_unix_time(31494784780800) == "1000000-01-01T00:00:00", "Time get_datetime_string_from_unix_time: The timestamp for the year a million is as expected.");
+}
+
+TEST_CASE("[Time] Datetime dictionary conversion methods") {
+ const Time *time = Time::get_singleton();
+
+ Dictionary datetime;
+ datetime[YEAR_KEY] = 2014;
+ datetime[MONTH_KEY] = 2;
+ datetime[DAY_KEY] = 9;
+ datetime[WEEKDAY_KEY] = Time::Weekday::WEEKDAY_SUNDAY;
+ datetime[HOUR_KEY] = 22;
+ datetime[MINUTE_KEY] = 10;
+ datetime[SECOND_KEY] = 30;
+
+ Dictionary date_only;
+ date_only[YEAR_KEY] = 2014;
+ date_only[MONTH_KEY] = 2;
+ date_only[DAY_KEY] = 9;
+ date_only[WEEKDAY_KEY] = Time::Weekday::WEEKDAY_SUNDAY;
+
+ Dictionary time_only;
+ time_only[HOUR_KEY] = 22;
+ time_only[MINUTE_KEY] = 10;
+ time_only[SECOND_KEY] = 30;
+
+ CHECK_MESSAGE(time->get_unix_time_from_datetime_dict(datetime) == 1391983830, "Time get_unix_time_from_datetime_dict: The datetime dictionary for GODOT IS OPEN SOURCE is converted to a timestamp as expected.");
+ CHECK_MESSAGE(time->get_unix_time_from_datetime_dict(date_only) == 1391904000, "Time get_unix_time_from_datetime_dict: The date dictionary for GODOT IS OPEN SOURCE is converted to a timestamp as expected.");
+ CHECK_MESSAGE(time->get_unix_time_from_datetime_dict(time_only) == 79830, "Time get_unix_time_from_datetime_dict: The time dictionary for GODOT IS OPEN SOURCE is converted to a timestamp as expected.");
+
+ CHECK_MESSAGE(time->get_datetime_dict_from_unix_time(1391983830).hash() == datetime.hash(), "Time get_datetime_dict_from_unix_time: The datetime timestamp for GODOT IS OPEN SOURCE is converted to a dictionary as expected.");
+ CHECK_MESSAGE(time->get_date_dict_from_unix_time(1391904000).hash() == date_only.hash(), "Time get_date_dict_from_unix_time: The date timestamp for GODOT IS OPEN SOURCE is converted to a dictionary as expected.");
+ CHECK_MESSAGE(time->get_time_dict_from_unix_time(79830).hash() == time_only.hash(), "Time get_time_dict_from_unix_time: The time timestamp for GODOT IS OPEN SOURCE is converted to a dictionary as expected.");
+
+ CHECK_MESSAGE((Time::Weekday)(int)time->get_datetime_dict_from_unix_time(0)[WEEKDAY_KEY] == Time::Weekday::WEEKDAY_THURSDAY, "Time get_datetime_dict_from_unix_time: The weekday for the Unix epoch is a Thursday as expected.");
+ CHECK_MESSAGE((Time::Weekday)(int)time->get_datetime_dict_from_unix_time(1391983830)[WEEKDAY_KEY] == Time::Weekday::WEEKDAY_SUNDAY, "Time get_datetime_dict_from_unix_time: The weekday for GODOT IS OPEN SOURCE is a Sunday as expected.");
+
+ CHECK_MESSAGE(time->get_datetime_dict_from_string("2014-02-09T22:10:30").hash() == datetime.hash(), "Time get_datetime_dict_from_string: The dictionary from string for GODOT IS OPEN SOURCE works as expected.");
+ CHECK_MESSAGE(!time->get_datetime_dict_from_string("2014-02-09T22:10:30", false).has(WEEKDAY_KEY), "Time get_datetime_dict_from_string: The dictionary from string for GODOT IS OPEN SOURCE without weekday doesn't contain the weekday key as expected.");
+ CHECK_MESSAGE(time->get_datetime_string_from_dict(datetime) == "2014-02-09T22:10:30", "Time get_datetime_string_from_dict: The string from dictionary for GODOT IS OPEN SOURCE works as expected.");
+ CHECK_MESSAGE(time->get_datetime_string_from_dict(time->get_datetime_dict_from_string("2014-02-09T22:10:30")) == "2014-02-09T22:10:30", "Time get_datetime_string_from_dict: The round-trip string to dict to string GODOT IS OPEN SOURCE works as expected.");
+ CHECK_MESSAGE(time->get_datetime_string_from_dict(time->get_datetime_dict_from_string("2014-02-09 22:10:30"), true) == "2014-02-09 22:10:30", "Time get_datetime_string_from_dict: The round-trip string to dict to string GODOT IS OPEN SOURCE with spaces works as expected.");
+}
+
+TEST_CASE("[Time] System time methods") {
+ const Time *time = Time::get_singleton();
+
+ const uint64_t ticks_msec = time->get_ticks_msec();
+ const uint64_t ticks_usec = time->get_ticks_usec();
+
+ CHECK_MESSAGE(time->get_unix_time_from_system() > 1000000000, "Time get_unix_time_from_system: The timestamp from system time doesn't fail and is very positive.");
+ CHECK_MESSAGE(time->get_unix_time_from_datetime_dict(time->get_datetime_dict_from_system()) > 1000000000, "Time get_datetime_string_from_system: The timestamp from system time doesn't fail and is very positive.");
+ CHECK_MESSAGE(time->get_unix_time_from_datetime_dict(time->get_date_dict_from_system()) > 1000000000, "Time get_datetime_string_from_system: The date from system time doesn't fail and is very positive.");
+ CHECK_MESSAGE(time->get_unix_time_from_datetime_dict(time->get_time_dict_from_system()) < 86400, "Time get_datetime_string_from_system: The time from system time doesn't fail and is within the acceptable range.");
+ CHECK_MESSAGE(time->get_unix_time_from_datetime_string(time->get_datetime_string_from_system()) > 1000000000, "Time get_datetime_string_from_system: The timestamp from system time doesn't fail and is very positive.");
+ CHECK_MESSAGE(time->get_unix_time_from_datetime_string(time->get_date_string_from_system()) > 1000000000, "Time get_datetime_string_from_system: The date from system time doesn't fail and is very positive.");
+ CHECK_MESSAGE(time->get_unix_time_from_datetime_string(time->get_time_string_from_system()) < 86400, "Time get_datetime_string_from_system: The time from system time doesn't fail and is within the acceptable range.");
+
+ CHECK_MESSAGE(time->get_ticks_msec() >= ticks_msec, "Time get_ticks_msec: The value has not decreased.");
+ CHECK_MESSAGE(time->get_ticks_usec() > ticks_usec, "Time get_ticks_usec: The value has increased.");
+}
+
+} // namespace TestTime
+
+#endif // TEST_TIME_H