summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--.github/workflows/static_checks.yml8
-rw-r--r--COPYRIGHT.txt2
-rw-r--r--SConstruct2
-rw-r--r--core/config/project_settings.cpp12
-rw-r--r--core/input/input.cpp2
-rw-r--r--core/io/resource_format_binary.cpp12
-rw-r--r--core/io/resource_loader.cpp4
-rw-r--r--core/io/resource_loader.h2
-rw-r--r--core/io/resource_saver.cpp6
-rw-r--r--core/io/resource_saver.h2
-rw-r--r--core/math/dynamic_bvh.cpp68
-rw-r--r--core/math/dynamic_bvh.h28
-rw-r--r--core/math/quick_hull.cpp10
-rw-r--r--core/math/transform_2d.cpp8
-rw-r--r--core/object/worker_thread_pool.h4
-rw-r--r--core/string/node_path.cpp5
-rw-r--r--core/string/node_path.h1
-rw-r--r--core/variant/array.cpp2
-rw-r--r--doc/classes/@GlobalScope.xml8
-rw-r--r--doc/classes/AESContext.xml33
-rw-r--r--doc/classes/AStar3D.xml11
-rw-r--r--doc/classes/AnimationNodeStateMachine.xml5
-rw-r--r--doc/classes/AnimationNodeTransition.xml3
-rw-r--r--doc/classes/AnimationTree.xml7
-rw-r--r--doc/classes/Color.xml13
-rw-r--r--doc/classes/Control.xml53
-rw-r--r--doc/classes/Crypto.xml30
-rw-r--r--doc/classes/DTLSServer.xml67
-rw-r--r--doc/classes/Decal.xml6
-rw-r--r--doc/classes/Dictionary.xml4
-rw-r--r--doc/classes/DirAccess.xml4
-rw-r--r--doc/classes/EditorImportPlugin.xml40
-rw-r--r--doc/classes/EditorInspectorPlugin.xml6
-rw-r--r--doc/classes/EditorPlugin.xml35
-rw-r--r--doc/classes/EditorScenePostImport.xml7
-rw-r--r--doc/classes/EditorScript.xml3
-rw-r--r--doc/classes/EditorSettings.xml2
-rw-r--r--doc/classes/EditorTranslationParserPlugin.xml24
-rw-r--r--doc/classes/Expression.xml10
-rw-r--r--doc/classes/FileAccess.xml4
-rw-r--r--doc/classes/FogVolume.xml10
-rw-r--r--doc/classes/GPUParticlesAttractorBox3D.xml4
-rw-r--r--doc/classes/GPUParticlesAttractorVectorField3D.xml6
-rw-r--r--doc/classes/GPUParticlesCollisionBox3D.xml4
-rw-r--r--doc/classes/GPUParticlesCollisionHeightField3D.xml6
-rw-r--r--doc/classes/GPUParticlesCollisionSDF3D.xml8
-rw-r--r--doc/classes/Geometry2D.xml7
-rw-r--r--doc/classes/GraphEdit.xml5
-rw-r--r--doc/classes/HMACContext.xml19
-rw-r--r--doc/classes/HTTPClient.xml13
-rw-r--r--doc/classes/HTTPRequest.xml16
-rw-r--r--doc/classes/HashingContext.xml16
-rw-r--r--doc/classes/InputEventMIDI.xml20
-rw-r--r--doc/classes/MainLoop.xml15
-rw-r--r--doc/classes/MultiplayerAPIExtension.xml8
-rw-r--r--doc/classes/NavigationAgent2D.xml15
-rw-r--r--doc/classes/NavigationAgent3D.xml12
-rw-r--r--doc/classes/NavigationServer2D.xml5
-rw-r--r--doc/classes/OS.xml4
-rw-r--r--doc/classes/Object.xml20
-rw-r--r--doc/classes/PackedScene.xml2
-rw-r--r--doc/classes/PhysicsPointQueryParameters2D.xml1
-rw-r--r--doc/classes/ProjectSettings.xml16
-rw-r--r--doc/classes/ReflectionProbe.xml22
-rw-r--r--doc/classes/RenderingDevice.xml35
-rw-r--r--doc/classes/RenderingServer.xml84
-rw-r--r--doc/classes/ResourceFormatLoader.xml2
-rw-r--r--doc/classes/ResourceFormatSaver.xml2
-rw-r--r--doc/classes/RichTextEffect.xml2
-rw-r--r--doc/classes/SceneTree.xml4
-rw-r--r--doc/classes/SceneTreeTimer.xml4
-rw-r--r--doc/classes/Sprite2D.xml6
-rw-r--r--doc/classes/StreamPeer.xml2
-rw-r--r--doc/classes/SubViewport.xml1
-rw-r--r--doc/classes/SubViewportContainer.xml1
-rw-r--r--doc/classes/TileMap.xml2
-rw-r--r--doc/classes/Tree.xml5
-rw-r--r--doc/classes/Tween.xml8
-rw-r--r--doc/classes/UDPServer.xml54
-rw-r--r--doc/classes/UndoRedo.xml16
-rw-r--r--doc/classes/VisualShaderNodeCustom.xml6
-rw-r--r--doc/classes/VoxelGI.xml6
-rw-r--r--doc/classes/VoxelGIData.xml4
-rw-r--r--doc/classes/Window.xml6
-rw-r--r--doc/classes/XRInterfaceExtension.xml6
-rw-r--r--drivers/gles3/environment/fog.cpp2
-rw-r--r--drivers/gles3/environment/fog.h2
-rw-r--r--drivers/gles3/rasterizer_scene_gles3.cpp31
-rw-r--r--drivers/gles3/rasterizer_scene_gles3.h3
-rw-r--r--drivers/gles3/shaders/scene.glsl6
-rw-r--r--drivers/gles3/shaders/sky.glsl38
-rw-r--r--drivers/gles3/storage/light_storage.cpp4
-rw-r--r--drivers/gles3/storage/light_storage.h6
-rw-r--r--drivers/gles3/storage/material_storage.cpp1
-rw-r--r--drivers/gles3/storage/texture_storage.cpp6
-rw-r--r--drivers/gles3/storage/texture_storage.h2
-rw-r--r--editor/action_map_editor.cpp15
-rw-r--r--editor/action_map_editor.h3
-rw-r--r--editor/animation_track_editor.cpp1
-rw-r--r--editor/code_editor.cpp1
-rw-r--r--editor/connections_dialog.cpp12
-rw-r--r--editor/editor_file_dialog.cpp7
-rw-r--r--editor/editor_help.cpp4
-rw-r--r--editor/editor_help.h2
-rw-r--r--editor/editor_inspector.cpp2
-rw-r--r--editor/editor_inspector.h4
-rw-r--r--editor/editor_layouts_dialog.cpp27
-rw-r--r--editor/editor_layouts_dialog.h2
-rw-r--r--editor/editor_log.cpp5
-rw-r--r--editor/editor_log.h1
-rw-r--r--editor/editor_node.cpp8
-rw-r--r--editor/editor_node.h1
-rw-r--r--editor/editor_properties.cpp4
-rw-r--r--editor/editor_properties.h4
-rw-r--r--editor/export/project_export.cpp36
-rw-r--r--editor/export/project_export.h1
-rw-r--r--editor/filesystem_dock.cpp45
-rw-r--r--editor/filesystem_dock.h11
-rw-r--r--editor/icons/AnimatableBody2D.svg2
-rw-r--r--editor/icons/AnimatableBody3D.svg2
-rw-r--r--editor/icons/AnimationLibrary.svg2
-rw-r--r--editor/icons/CPUParticles2D.svg2
-rw-r--r--editor/icons/CollisionPolygon2D.svg2
-rw-r--r--editor/icons/CollisionShape2D.svg2
-rw-r--r--editor/icons/DampedSpringJoint2D.svg2
-rw-r--r--editor/icons/FontFile.svg2
-rw-r--r--editor/icons/FontVariation.svg2
-rw-r--r--editor/icons/GizmoDirectionalLight.svg2
-rw-r--r--editor/icons/GizmoLight.svg2
-rw-r--r--editor/icons/GradientTexture2D.svg2
-rw-r--r--editor/icons/GrooveJoint2D.svg2
-rw-r--r--editor/icons/GroupViewport.svg2
-rw-r--r--editor/icons/Keyboard.svg2
-rw-r--r--editor/icons/KeyboardError.svg2
-rw-r--r--editor/icons/KeyboardLabel.svg2
-rw-r--r--editor/icons/KeyboardPhysical.svg2
-rw-r--r--editor/icons/LabelSettings.svg2
-rw-r--r--editor/icons/LightOccluder2D.svg2
-rw-r--r--editor/icons/LockViewport.svg2
-rw-r--r--editor/icons/Marker2D.svg2
-rw-r--r--editor/icons/MultiplayerSpawner.svg2
-rw-r--r--editor/icons/MultiplayerSynchronizer.svg2
-rw-r--r--editor/icons/Navigation2D.svg2
-rw-r--r--editor/icons/NavigationAgent2D.svg2
-rw-r--r--editor/icons/NavigationObstacle2D.svg2
-rw-r--r--editor/icons/NavigationRegion2D.svg2
-rw-r--r--editor/icons/NewKey.svg2
-rw-r--r--editor/icons/OccluderPolygon2D.svg2
-rw-r--r--editor/icons/ParallaxLayer.svg2
-rw-r--r--editor/icons/Path2D.svg2
-rw-r--r--editor/icons/PathFollow2D.svg2
-rw-r--r--editor/icons/PinJoint2D.svg2
-rw-r--r--editor/icons/PingPongLoop.svg2
-rw-r--r--editor/icons/PlayRemote.svg2
-rw-r--r--editor/icons/PointLight2D.svg2
-rw-r--r--editor/icons/RemoteTransform2D.svg2
-rw-r--r--editor/icons/RigidBody2D.svg2
-rw-r--r--editor/icons/StaticBody2D.svg2
-rw-r--r--editor/icons/StyleBoxGridVisible.svg2
-rw-r--r--editor/icons/SystemFont.svg2
-rw-r--r--editor/icons/Texture3D.svg2
-rw-r--r--editor/icons/TileMap.svg2
-rw-r--r--editor/icons/ToolBoneSelect.svg2
-rw-r--r--editor/icons/TouchScreenButton.svg2
-rw-r--r--editor/icons/VisibleOnScreenEnabler2D.svg2
-rw-r--r--editor/icons/YSort.svg2
-rw-r--r--editor/icons/ZoomLess.svg2
-rw-r--r--editor/icons/ZoomMore.svg2
-rw-r--r--editor/icons/ZoomReset.svg2
-rw-r--r--editor/import/editor_import_plugin.cpp6
-rw-r--r--editor/import/editor_import_plugin.h2
-rw-r--r--editor/import/resource_importer_scene.cpp63
-rw-r--r--editor/import/resource_importer_scene.h2
-rw-r--r--editor/plugins/animation_blend_tree_editor_plugin.cpp2
-rw-r--r--editor/plugins/control_editor_plugin.cpp2
-rw-r--r--editor/plugins/control_editor_plugin.h2
-rw-r--r--editor/plugins/font_config_plugin.cpp6
-rw-r--r--editor/plugins/font_config_plugin.h6
-rw-r--r--editor/plugins/gpu_particles_collision_sdf_editor_plugin.cpp2
-rw-r--r--editor/plugins/node_3d_editor_gizmos.cpp157
-rw-r--r--editor/plugins/root_motion_editor_plugin.cpp2
-rw-r--r--editor/plugins/root_motion_editor_plugin.h2
-rw-r--r--editor/plugins/texture_region_editor_plugin.cpp2
-rw-r--r--editor/plugins/texture_region_editor_plugin.h2
-rw-r--r--editor/plugins/tiles/tile_set_atlas_source_editor.cpp2
-rw-r--r--editor/plugins/tiles/tile_set_atlas_source_editor.h2
-rw-r--r--editor/plugins/visual_shader_editor_plugin.cpp6
-rw-r--r--editor/plugins/visual_shader_editor_plugin.h2
-rw-r--r--editor/plugins/voxel_gi_editor_plugin.cpp10
-rw-r--r--editor/project_converter_3_to_4.cpp2
-rw-r--r--editor/project_manager.cpp5
-rw-r--r--editor/project_settings_editor.cpp14
-rw-r--r--editor/scene_tree_dock.cpp9
-rwxr-xr-xmisc/scripts/codespell.sh7
-rw-r--r--modules/gdscript/doc_classes/@GDScript.xml12
-rw-r--r--modules/gdscript/gdscript_analyzer.cpp8
-rw-r--r--modules/gdscript/gdscript_disassembler.cpp6
-rw-r--r--modules/gdscript/gdscript_parser.cpp7
-rw-r--r--modules/gdscript/gdscript_utility_functions.cpp23
-rw-r--r--modules/gltf/doc_classes/GLTFDocumentExtension.xml16
-rw-r--r--modules/gltf/doc_classes/GLTFState.xml6
-rw-r--r--modules/gltf/editor/editor_import_blend_runner.cpp314
-rw-r--r--modules/gltf/editor/editor_import_blend_runner.h69
-rw-r--r--modules/gltf/editor/editor_scene_importer_blend.cpp131
-rw-r--r--modules/gltf/editor/editor_scene_importer_gltf.cpp6
-rw-r--r--modules/gltf/extensions/gltf_document_extension.cpp32
-rw-r--r--modules/gltf/extensions/gltf_document_extension.h16
-rw-r--r--modules/gltf/gltf_document.cpp81
-rw-r--r--modules/gltf/gltf_state.cpp3
-rw-r--r--modules/gltf/gltf_state.h1
-rw-r--r--modules/gltf/register_types.cpp11
-rw-r--r--modules/mono/editor/Godot.NET.Sdk/Godot.SourceGenerators/GodotPluginsInitializerGenerator.cs2
-rw-r--r--modules/mono/glue/GodotSharp/GodotSharp/Core/Extensions/PackedSceneExtensions.cs4
-rw-r--r--modules/mono/glue/GodotSharp/GodotSharp/Core/Transform2D.cs18
-rw-r--r--modules/navigation/godot_navigation_server.cpp34
-rw-r--r--modules/navigation/godot_navigation_server.h4
-rw-r--r--modules/navigation/nav_agent.cpp (renamed from modules/navigation/rvo_agent.cpp)14
-rw-r--r--modules/navigation/nav_agent.h (renamed from modules/navigation/rvo_agent.h)10
-rw-r--r--modules/navigation/nav_map.cpp18
-rw-r--r--modules/navigation/nav_map.h20
-rw-r--r--modules/webrtc/webrtc_multiplayer_peer.cpp1
-rw-r--r--modules/websocket/websocket_multiplayer_peer.cpp1
-rw-r--r--platform/android/export/export_plugin.cpp50
-rw-r--r--platform/android/export/gradle_export_util.cpp30
-rw-r--r--platform/android/export/gradle_export_util.h2
-rw-r--r--platform/android/java/app/AndroidManifest.xml21
-rw-r--r--platform/android/java/lib/AndroidManifest.xml10
-rw-r--r--platform/android/java/lib/res/xml/godot_provider_paths.xml11
-rw-r--r--platform/android/java/lib/src/org/godotengine/godot/FullScreenGodotApp.java2
-rw-r--r--platform/android/java/lib/src/org/godotengine/godot/GodotIO.java38
-rw-r--r--platform/linuxbsd/x11/display_server_x11.cpp19
-rw-r--r--platform/macos/display_server_macos.mm18
-rw-r--r--platform/windows/display_server_windows.cpp19
-rw-r--r--scene/2d/camera_2d.cpp6
-rw-r--r--scene/2d/navigation_agent_2d.cpp164
-rw-r--r--scene/2d/navigation_agent_2d.h31
-rw-r--r--scene/3d/decal.cpp38
-rw-r--r--scene/3d/decal.h10
-rw-r--r--scene/3d/fog_volume.cpp44
-rw-r--r--scene/3d/fog_volume.h10
-rw-r--r--scene/3d/gpu_particles_collision_3d.cpp184
-rw-r--r--scene/3d/gpu_particles_collision_3d.h50
-rw-r--r--scene/3d/navigation_agent_3d.cpp182
-rw-r--r--scene/3d/navigation_agent_3d.h30
-rw-r--r--scene/3d/occluder_instance_3d.cpp5
-rw-r--r--scene/3d/physics_body_3d.cpp5
-rw-r--r--scene/3d/reflection_probe.cpp56
-rw-r--r--scene/3d/reflection_probe.h12
-rw-r--r--scene/3d/voxel_gi.cpp46
-rw-r--r--scene/3d/voxel_gi.h10
-rw-r--r--scene/animation/animation_blend_tree.cpp32
-rw-r--r--scene/animation/animation_blend_tree.h4
-rw-r--r--scene/animation/animation_node_state_machine.cpp15
-rw-r--r--scene/animation/animation_node_state_machine.h4
-rw-r--r--scene/animation/animation_tree.cpp16
-rw-r--r--scene/animation/animation_tree.h2
-rw-r--r--scene/gui/graph_edit.cpp8
-rw-r--r--scene/gui/line_edit.cpp2
-rw-r--r--scene/gui/popup_menu.cpp3
-rw-r--r--scene/gui/subviewport_container.cpp4
-rw-r--r--scene/gui/tree.cpp1
-rw-r--r--scene/main/canvas_item.cpp4
-rw-r--r--scene/main/multiplayer_api.cpp16
-rw-r--r--scene/main/multiplayer_api.h8
-rw-r--r--scene/main/multiplayer_peer.cpp2
-rw-r--r--scene/main/node.cpp6
-rw-r--r--scene/main/viewport.cpp57
-rw-r--r--scene/main/viewport.h10
-rw-r--r--scene/main/window.cpp10
-rw-r--r--scene/resources/bone_map.cpp1
-rw-r--r--scene/resources/fog_material.cpp2
-rw-r--r--scene/resources/importer_mesh.cpp2
-rw-r--r--scene/resources/packed_scene.cpp6
-rw-r--r--scene/resources/resource_format_text.cpp6
-rw-r--r--scene/resources/surface_tool.cpp3
-rw-r--r--scene/resources/surface_tool.h9
-rw-r--r--scene/resources/visual_shader.cpp14
-rw-r--r--scene/resources/visual_shader.h6
-rw-r--r--servers/navigation_server_2d.cpp36
-rw-r--r--servers/navigation_server_2d.h14
-rw-r--r--servers/navigation_server_3d.cpp98
-rw-r--r--servers/navigation_server_3d.h23
-rw-r--r--servers/physics_2d/godot_space_2d.cpp2
-rw-r--r--servers/rendering/dummy/environment/fog.h2
-rw-r--r--servers/rendering/dummy/storage/light_storage.h4
-rw-r--r--servers/rendering/dummy/storage/texture_storage.h2
-rw-r--r--servers/rendering/environment/renderer_fog.h2
-rw-r--r--servers/rendering/renderer_rd/cluster_builder_rd.h4
-rw-r--r--servers/rendering/renderer_rd/environment/fog.cpp22
-rw-r--r--servers/rendering/renderer_rd/environment/fog.h8
-rw-r--r--servers/rendering/renderer_rd/forward_clustered/render_forward_clustered.cpp20
-rw-r--r--servers/rendering/renderer_rd/forward_clustered/render_forward_clustered.h4
-rw-r--r--servers/rendering/renderer_rd/forward_clustered/scene_shader_forward_clustered.cpp15
-rw-r--r--servers/rendering/renderer_rd/forward_mobile/scene_shader_forward_mobile.cpp1
-rw-r--r--servers/rendering/renderer_rd/renderer_scene_render_rd.h4
-rw-r--r--servers/rendering/renderer_rd/shaders/environment/volumetric_fog.glsl21
-rw-r--r--servers/rendering/renderer_rd/shaders/forward_clustered/scene_forward_clustered.glsl6
-rw-r--r--servers/rendering/renderer_rd/shaders/forward_mobile/scene_forward_mobile.glsl6
-rw-r--r--servers/rendering/renderer_rd/storage_rd/light_storage.cpp16
-rw-r--r--servers/rendering/renderer_rd/storage_rd/light_storage.h6
-rw-r--r--servers/rendering/renderer_rd/storage_rd/material_storage.h10
-rw-r--r--servers/rendering/renderer_rd/storage_rd/mesh_storage.cpp5
-rw-r--r--servers/rendering/renderer_rd/storage_rd/texture_storage.cpp8
-rw-r--r--servers/rendering/renderer_rd/storage_rd/texture_storage.h8
-rw-r--r--servers/rendering/renderer_scene_cull.cpp8
-rw-r--r--servers/rendering/rendering_server_default.h6
-rw-r--r--servers/rendering/shader_language.cpp8
-rw-r--r--servers/rendering/shader_types.cpp4
-rw-r--r--servers/rendering/storage/light_storage.h4
-rw-r--r--servers/rendering/storage/texture_storage.h2
-rw-r--r--servers/rendering_server.cpp6
-rw-r--r--servers/rendering_server.h6
-rw-r--r--servers/xr/xr_interface_extension.cpp8
-rw-r--r--servers/xr/xr_interface_extension.h6
-rw-r--r--tests/scene/test_text_edit.h14
-rw-r--r--thirdparty/README.md2
-rw-r--r--thirdparty/meshoptimizer/LICENSE.md2
-rw-r--r--thirdparty/meshoptimizer/clusterizer.cpp152
-rw-r--r--thirdparty/meshoptimizer/indexgenerator.cpp6
-rw-r--r--thirdparty/meshoptimizer/meshoptimizer.h70
-rw-r--r--thirdparty/meshoptimizer/overdrawanalyzer.cpp2
-rw-r--r--thirdparty/meshoptimizer/overdrawoptimizer.cpp2
-rw-r--r--thirdparty/meshoptimizer/patches/attribute-aware-simplify-distance-only-metric.patch30
-rw-r--r--thirdparty/meshoptimizer/patches/attribute-aware-simplify.patch49
-rw-r--r--thirdparty/meshoptimizer/simplifier.cpp24
-rw-r--r--thirdparty/meshoptimizer/spatialorder.cpp4
-rw-r--r--thirdparty/meshoptimizer/vcacheoptimizer.cpp28
-rw-r--r--thirdparty/meshoptimizer/vertexcodec.cpp88
-rw-r--r--thirdparty/meshoptimizer/vertexfilter.cpp2
329 files changed, 3319 insertions, 1564 deletions
diff --git a/.github/workflows/static_checks.yml b/.github/workflows/static_checks.yml
index d10156c04e..eece270dd9 100644
--- a/.github/workflows/static_checks.yml
+++ b/.github/workflows/static_checks.yml
@@ -71,3 +71,11 @@ jobs:
- name: Style checks via dotnet format (dotnet_format.sh)
run: |
bash ./misc/scripts/dotnet_format.sh
+
+ - name: Spell checks via codespell
+ uses: codespell-project/actions-codespell@v1
+ with:
+ skip: ./.*,./**/.*,./bin,./thirdparty,*.desktop,*.gen.*,*.po,*.pot,*.rc,./AUTHORS.md,./COPYRIGHT.txt,./DONORS.md,./core/input/gamecontrollerdb.txt,./core/string/locales.h,./editor/project_converter_3_to_4.cpp,./misc/scripts/codespell.sh,./platform/android/java/lib/src/com,./platform/web/node_modules,./platform/web/package-lock.json
+ check_hidden: false
+ ignore_words_list: curvelinear,doubleclick,expct,findn,gird,hel,inout,lod,nd,numer,ot,te
+ only_warn: true
diff --git a/COPYRIGHT.txt b/COPYRIGHT.txt
index 8a966dcb05..a3e06c545f 100644
--- a/COPYRIGHT.txt
+++ b/COPYRIGHT.txt
@@ -288,7 +288,7 @@ License: Apache-2.0
Files: ./thirdparty/meshoptimizer/
Comment: meshoptimizer
-Copyright: 2016-2021, Arseny Kapoulkine
+Copyright: 2016-2022, Arseny Kapoulkine
License: Expat
Files: ./thirdparty/minimp3/
diff --git a/SConstruct b/SConstruct
index 1acbd83e63..845b9be4a6 100644
--- a/SConstruct
+++ b/SConstruct
@@ -172,7 +172,7 @@ opts.Add(
"optimize", "Optimization level", "speed_trace", ("none", "custom", "debug", "speed", "speed_trace", "size")
)
)
-opts.Add(BoolVariable("debug_symbols", "Build with debugging symbols", True))
+opts.Add(BoolVariable("debug_symbols", "Build with debugging symbols", False))
opts.Add(BoolVariable("separate_debug_symbols", "Extract debugging symbols to a separate file", False))
opts.Add(EnumVariable("lto", "Link-time optimization (production builds)", "none", ("none", "auto", "thin", "full")))
opts.Add(BoolVariable("production", "Set defaults to build Godot for use in production", False))
diff --git a/core/config/project_settings.cpp b/core/config/project_settings.cpp
index ba9c6e4c60..39f8ad68e4 100644
--- a/core/config/project_settings.cpp
+++ b/core/config/project_settings.cpp
@@ -221,7 +221,9 @@ String ProjectSettings::localize_path(const String &p_path) const {
void ProjectSettings::set_initial_value(const String &p_name, const Variant &p_value) {
ERR_FAIL_COND_MSG(!props.has(p_name), "Request for nonexistent project setting: " + p_name + ".");
- props[p_name].initial = p_value;
+
+ // Duplicate so that if value is array or dictionary, changing the setting will not change the stored initial value.
+ props[p_name].initial = p_value.duplicate();
}
void ProjectSettings::set_restart_if_changed(const String &p_name, bool p_restart) {
@@ -299,13 +301,13 @@ bool ProjectSettings::_set(const StringName &p_name, const Variant &p_value) {
for (int i = 1; i < s.size(); i++) {
String feature = s[i].strip_edges();
- Pair<StringName, StringName> fo(feature, p_name);
+ Pair<StringName, StringName> feature_override(feature, p_name);
if (!feature_overrides.has(s[0])) {
feature_overrides[s[0]] = LocalVector<Pair<StringName, StringName>>();
}
- feature_overrides[s[0]].push_back(fo);
+ feature_overrides[s[0]].push_back(feature_override);
}
}
}
@@ -1116,7 +1118,9 @@ bool ProjectSettings::_property_get_revert(const StringName &p_name, Variant &r_
return false;
}
- r_property = props[p_name].initial;
+ // Duplicate so that if value is array or dictionary, changing the setting will not change the stored initial value.
+ r_property = props[p_name].initial.duplicate();
+
return true;
}
diff --git a/core/input/input.cpp b/core/input/input.cpp
index aa89facdd7..2e886f9093 100644
--- a/core/input/input.cpp
+++ b/core/input/input.cpp
@@ -904,7 +904,7 @@ void Input::parse_input_event(const Ref<InputEvent> &p_event) {
// - If platform doesn't use buffering and event accumulation is disabled.
// - If platform doesn't use buffering and the event type is not accumulable.
// However, it wouldn't be reasonable to ask users to remember the full ruleset and be aware at all times
- // of the possibilites of the target platform, project settings and engine internals, which may change
+ // of the possibilities of the target platform, project settings and engine internals, which may change
// without prior notice.
// Therefore, the guideline is, "don't send the same event object more than once per frame".
WARN_PRINT_ONCE(
diff --git a/core/io/resource_format_binary.cpp b/core/io/resource_format_binary.cpp
index c0463de427..38f41d645c 100644
--- a/core/io/resource_format_binary.cpp
+++ b/core/io/resource_format_binary.cpp
@@ -832,6 +832,18 @@ Error ResourceLoaderBinary::load() {
}
}
+ if (value.get_type() == Variant::ARRAY) {
+ Array set_array = value;
+ bool is_get_valid = false;
+ Variant get_value = res->get(name, &is_get_valid);
+ if (is_get_valid && get_value.get_type() == Variant::ARRAY) {
+ Array get_array = get_value;
+ if (!set_array.is_same_typed(get_array)) {
+ value = Array(set_array, get_array.get_typed_builtin(), get_array.get_typed_class_name(), get_array.get_typed_script());
+ }
+ }
+ }
+
if (set_valid) {
res->set(name, value);
}
diff --git a/core/io/resource_loader.cpp b/core/io/resource_loader.cpp
index 7447119ab7..fc3547261b 100644
--- a/core/io/resource_loader.cpp
+++ b/core/io/resource_loader.cpp
@@ -176,9 +176,9 @@ Error ResourceFormatLoader::rename_dependencies(const String &p_path, const Hash
deps_dict[E.key] = E.value;
}
- int64_t err = OK;
+ Error err = OK;
GDVIRTUAL_CALL(_rename_dependencies, p_path, deps_dict, err);
- return (Error)err;
+ return err;
}
void ResourceFormatLoader::_bind_methods() {
diff --git a/core/io/resource_loader.h b/core/io/resource_loader.h
index eb8155e046..c47b6c950a 100644
--- a/core/io/resource_loader.h
+++ b/core/io/resource_loader.h
@@ -58,7 +58,7 @@ protected:
GDVIRTUAL1RC(ResourceUID::ID, _get_resource_uid, String)
GDVIRTUAL2RC(Vector<String>, _get_dependencies, String, bool)
GDVIRTUAL1RC(Vector<String>, _get_classes_used, String)
- GDVIRTUAL2RC(int64_t, _rename_dependencies, String, Dictionary)
+ GDVIRTUAL2RC(Error, _rename_dependencies, String, Dictionary)
GDVIRTUAL1RC(bool, _exists, String)
GDVIRTUAL4RC(Variant, _load, String, String, bool, int)
diff --git a/core/io/resource_saver.cpp b/core/io/resource_saver.cpp
index b8201cc6b9..6e377847a8 100644
--- a/core/io/resource_saver.cpp
+++ b/core/io/resource_saver.cpp
@@ -42,9 +42,9 @@ ResourceSavedCallback ResourceSaver::save_callback = nullptr;
ResourceSaverGetResourceIDForPath ResourceSaver::save_get_id_for_path = nullptr;
Error ResourceFormatSaver::save(const Ref<Resource> &p_resource, const String &p_path, uint32_t p_flags) {
- int64_t res = ERR_METHOD_NOT_FOUND;
- GDVIRTUAL_CALL(_save, p_resource, p_path, p_flags, res);
- return (Error)res;
+ Error err = ERR_METHOD_NOT_FOUND;
+ GDVIRTUAL_CALL(_save, p_resource, p_path, p_flags, err);
+ return err;
}
Error ResourceFormatSaver::set_uid(const String &p_path, ResourceUID::ID p_uid) {
diff --git a/core/io/resource_saver.h b/core/io/resource_saver.h
index 9e88b2086b..572742d129 100644
--- a/core/io/resource_saver.h
+++ b/core/io/resource_saver.h
@@ -41,7 +41,7 @@ class ResourceFormatSaver : public RefCounted {
protected:
static void _bind_methods();
- GDVIRTUAL3R(int64_t, _save, Ref<Resource>, String, uint32_t)
+ GDVIRTUAL3R(Error, _save, Ref<Resource>, String, uint32_t)
GDVIRTUAL2R(Error, _set_uid, String, ResourceUID::ID)
GDVIRTUAL1RC(bool, _recognize, Ref<Resource>)
GDVIRTUAL1RC(Vector<String>, _get_recognized_extensions, Ref<Resource>)
diff --git a/core/math/dynamic_bvh.cpp b/core/math/dynamic_bvh.cpp
index 4452445241..e1315d1c64 100644
--- a/core/math/dynamic_bvh.cpp
+++ b/core/math/dynamic_bvh.cpp
@@ -36,8 +36,8 @@ void DynamicBVH::_delete_node(Node *p_node) {
void DynamicBVH::_recurse_delete_node(Node *p_node) {
if (!p_node->is_leaf()) {
- _recurse_delete_node(p_node->childs[0]);
- _recurse_delete_node(p_node->childs[1]);
+ _recurse_delete_node(p_node->children[0]);
+ _recurse_delete_node(p_node->children[1]);
}
if (p_node == bvh_root) {
bvh_root = nullptr;
@@ -65,31 +65,31 @@ void DynamicBVH::_insert_leaf(Node *p_root, Node *p_leaf) {
} else {
if (!p_root->is_leaf()) {
do {
- p_root = p_root->childs[p_leaf->volume.select_by_proximity(
- p_root->childs[0]->volume,
- p_root->childs[1]->volume)];
+ p_root = p_root->children[p_leaf->volume.select_by_proximity(
+ p_root->children[0]->volume,
+ p_root->children[1]->volume)];
} while (!p_root->is_leaf());
}
Node *prev = p_root->parent;
Node *node = _create_node_with_volume(prev, p_leaf->volume.merge(p_root->volume), nullptr);
if (prev) {
- prev->childs[p_root->get_index_in_parent()] = node;
- node->childs[0] = p_root;
+ prev->children[p_root->get_index_in_parent()] = node;
+ node->children[0] = p_root;
p_root->parent = node;
- node->childs[1] = p_leaf;
+ node->children[1] = p_leaf;
p_leaf->parent = node;
do {
if (!prev->volume.contains(node->volume)) {
- prev->volume = prev->childs[0]->volume.merge(prev->childs[1]->volume);
+ prev->volume = prev->children[0]->volume.merge(prev->children[1]->volume);
} else {
break;
}
node = prev;
} while (nullptr != (prev = node->parent));
} else {
- node->childs[0] = p_root;
+ node->children[0] = p_root;
p_root->parent = node;
- node->childs[1] = p_leaf;
+ node->children[1] = p_leaf;
p_leaf->parent = node;
bvh_root = node;
}
@@ -103,14 +103,14 @@ DynamicBVH::Node *DynamicBVH::_remove_leaf(Node *leaf) {
} else {
Node *parent = leaf->parent;
Node *prev = parent->parent;
- Node *sibling = parent->childs[1 - leaf->get_index_in_parent()];
+ Node *sibling = parent->children[1 - leaf->get_index_in_parent()];
if (prev) {
- prev->childs[parent->get_index_in_parent()] = sibling;
+ prev->children[parent->get_index_in_parent()] = sibling;
sibling->parent = prev;
_delete_node(parent);
while (prev) {
const Volume pb = prev->volume;
- prev->volume = prev->childs[0]->volume.merge(prev->childs[1]->volume);
+ prev->volume = prev->children[0]->volume.merge(prev->children[1]->volume);
if (pb.is_not_equal_to(prev->volume)) {
prev = prev->parent;
} else {
@@ -129,8 +129,8 @@ DynamicBVH::Node *DynamicBVH::_remove_leaf(Node *leaf) {
void DynamicBVH::_fetch_leaves(Node *p_root, LocalVector<Node *> &r_leaves, int p_depth) {
if (p_root->is_internal() && p_depth) {
- _fetch_leaves(p_root->childs[0], r_leaves, p_depth - 1);
- _fetch_leaves(p_root->childs[1], r_leaves, p_depth - 1);
+ _fetch_leaves(p_root->children[0], r_leaves, p_depth - 1);
+ _fetch_leaves(p_root->children[1], r_leaves, p_depth - 1);
_delete_node(p_root);
} else {
r_leaves.push_back(p_root);
@@ -195,8 +195,8 @@ void DynamicBVH::_bottom_up(Node **leaves, int p_count) {
}
Node *n[] = { leaves[minidx[0]], leaves[minidx[1]] };
Node *p = _create_node_with_volume(nullptr, n[0]->volume.merge(n[1]->volume), nullptr);
- p->childs[0] = n[0];
- p->childs[1] = n[1];
+ p->children[0] = n[0];
+ p->children[1] = n[1];
n[0]->parent = p;
n[1]->parent = p;
leaves[minidx[0]] = p;
@@ -241,10 +241,10 @@ DynamicBVH::Node *DynamicBVH::_top_down(Node **leaves, int p_count, int p_bu_thr
}
Node *node = _create_node_with_volume(nullptr, vol, nullptr);
- node->childs[0] = _top_down(&leaves[0], partition, p_bu_threshold);
- node->childs[1] = _top_down(&leaves[partition], p_count - partition, p_bu_threshold);
- node->childs[0]->parent = node;
- node->childs[1]->parent = node;
+ node->children[0] = _top_down(&leaves[0], partition, p_bu_threshold);
+ node->children[1] = _top_down(&leaves[partition], p_count - partition, p_bu_threshold);
+ node->children[0]->parent = node;
+ node->children[1]->parent = node;
return (node);
} else {
_bottom_up(leaves, p_count);
@@ -260,23 +260,23 @@ DynamicBVH::Node *DynamicBVH::_node_sort(Node *n, Node *&r) {
if (p > n) {
const int i = n->get_index_in_parent();
const int j = 1 - i;
- Node *s = p->childs[j];
+ Node *s = p->children[j];
Node *q = p->parent;
- ERR_FAIL_COND_V(n != p->childs[i], nullptr);
+ ERR_FAIL_COND_V(n != p->children[i], nullptr);
if (q) {
- q->childs[p->get_index_in_parent()] = n;
+ q->children[p->get_index_in_parent()] = n;
} else {
r = n;
}
s->parent = n;
p->parent = n;
n->parent = q;
- p->childs[0] = n->childs[0];
- p->childs[1] = n->childs[1];
- n->childs[0]->parent = p;
- n->childs[1]->parent = p;
- n->childs[i] = p;
- n->childs[j] = s;
+ p->children[0] = n->children[0];
+ p->children[1] = n->children[1];
+ n->children[0]->parent = p;
+ n->children[1]->parent = p;
+ n->children[i] = p;
+ n->children[j] = s;
SWAP(p->volume, n->volume);
return (p);
}
@@ -320,7 +320,7 @@ void DynamicBVH::optimize_incremental(int passes) {
Node *node = bvh_root;
unsigned bit = 0;
while (node->is_internal()) {
- node = _node_sort(node, bvh_root)->childs[(opath >> bit) & 1];
+ node = _node_sort(node, bvh_root)->children[(opath >> bit) & 1];
bit = (bit + 1) & (sizeof(unsigned) * 8 - 1);
}
_update(node);
@@ -396,8 +396,8 @@ void DynamicBVH::remove(const ID &p_id) {
void DynamicBVH::_extract_leaves(Node *p_node, List<ID> *r_elements) {
if (p_node->is_internal()) {
- _extract_leaves(p_node->childs[0], r_elements);
- _extract_leaves(p_node->childs[1], r_elements);
+ _extract_leaves(p_node->children[0], r_elements);
+ _extract_leaves(p_node->children[1], r_elements);
} else {
ID id;
id.node = p_node;
diff --git a/core/math/dynamic_bvh.h b/core/math/dynamic_bvh.h
index 46bf56ae58..21b5340aaa 100644
--- a/core/math/dynamic_bvh.h
+++ b/core/math/dynamic_bvh.h
@@ -182,21 +182,21 @@ private:
Volume volume;
Node *parent = nullptr;
union {
- Node *childs[2];
+ Node *children[2];
void *data;
};
- _FORCE_INLINE_ bool is_leaf() const { return childs[1] == nullptr; }
+ _FORCE_INLINE_ bool is_leaf() const { return children[1] == nullptr; }
_FORCE_INLINE_ bool is_internal() const { return (!is_leaf()); }
_FORCE_INLINE_ int get_index_in_parent() const {
ERR_FAIL_COND_V(!parent, 0);
- return (parent->childs[1] == this) ? 1 : 0;
+ return (parent->children[1] == this) ? 1 : 0;
}
void get_max_depth(int depth, int &maxdepth) {
if (is_internal()) {
- childs[0]->get_max_depth(depth + 1, maxdepth);
- childs[1]->get_max_depth(depth + 1, maxdepth);
+ children[0]->get_max_depth(depth + 1, maxdepth);
+ children[1]->get_max_depth(depth + 1, maxdepth);
} else {
maxdepth = MAX(maxdepth, depth);
}
@@ -205,7 +205,7 @@ private:
//
int count_leaves() const {
if (is_internal()) {
- return childs[0]->count_leaves() + childs[1]->count_leaves();
+ return children[0]->count_leaves() + children[1]->count_leaves();
} else {
return (1);
}
@@ -216,8 +216,8 @@ private:
}
Node() {
- childs[0] = nullptr;
- childs[1] = nullptr;
+ children[0] = nullptr;
+ children[1] = nullptr;
}
};
@@ -350,8 +350,8 @@ void DynamicBVH::aabb_query(const AABB &p_box, QueryResult &r_result) {
stack = aux_stack.ptr();
threshold = aux_stack.size() - 2;
}
- stack[depth++] = n->childs[0];
- stack[depth++] = n->childs[1];
+ stack[depth++] = n->children[0];
+ stack[depth++] = n->children[1];
} else {
if (r_result(n->data)) {
return;
@@ -406,8 +406,8 @@ void DynamicBVH::convex_query(const Plane *p_planes, int p_plane_count, const Ve
stack = aux_stack.ptr();
threshold = aux_stack.size() - 2;
}
- stack[depth++] = n->childs[0];
- stack[depth++] = n->childs[1];
+ stack[depth++] = n->children[0];
+ stack[depth++] = n->children[1];
} else {
if (r_result(n->data)) {
return;
@@ -463,8 +463,8 @@ void DynamicBVH::ray_query(const Vector3 &p_from, const Vector3 &p_to, QueryResu
stack = aux_stack.ptr();
threshold = aux_stack.size() - 2;
}
- stack[depth++] = node->childs[0];
- stack[depth++] = node->childs[1];
+ stack[depth++] = node->children[0];
+ stack[depth++] = node->children[1];
} else {
if (r_result(node->data)) {
return;
diff --git a/core/math/quick_hull.cpp b/core/math/quick_hull.cpp
index 9488c6bcff..4483f61bc4 100644
--- a/core/math/quick_hull.cpp
+++ b/core/math/quick_hull.cpp
@@ -383,15 +383,15 @@ Error QuickHull::build(const Vector<Vector3> &p_points, Geometry3D::MeshData &r_
if (O->get().plane.is_equal_approx(f.plane)) {
//merge and delete edge and contiguous face, while repointing edges (uuugh!)
- int ois = O->get().indices.size();
+ int o_index_size = O->get().indices.size();
- for (int j = 0; j < ois; j++) {
+ for (int j = 0; j < o_index_size; j++) {
//search a
if (O->get().indices[j] == a) {
//append the rest
- for (int k = 0; k < ois; k++) {
- int idx = O->get().indices[(k + j) % ois];
- int idxn = O->get().indices[(k + j + 1) % ois];
+ for (int k = 0; k < o_index_size; k++) {
+ int idx = O->get().indices[(k + j) % o_index_size];
+ int idxn = O->get().indices[(k + j + 1) % o_index_size];
if (idx == b && idxn == a) { //already have b!
break;
}
diff --git a/core/math/transform_2d.cpp b/core/math/transform_2d.cpp
index 96010b4096..868665cb5c 100644
--- a/core/math/transform_2d.cpp
+++ b/core/math/transform_2d.cpp
@@ -151,7 +151,7 @@ void Transform2D::orthonormalize() {
Vector2 y = columns[1];
x.normalize();
- y = (y - x * (x.dot(y)));
+ y = y - x * x.dot(y);
y.normalize();
columns[0] = x;
@@ -159,9 +159,9 @@ void Transform2D::orthonormalize() {
}
Transform2D Transform2D::orthonormalized() const {
- Transform2D on = *this;
- on.orthonormalize();
- return on;
+ Transform2D ortho = *this;
+ ortho.orthonormalize();
+ return ortho;
}
bool Transform2D::is_equal_approx(const Transform2D &p_transform) const {
diff --git a/core/object/worker_thread_pool.h b/core/object/worker_thread_pool.h
index cf3f7f0885..c62e05fc28 100644
--- a/core/object/worker_thread_pool.h
+++ b/core/object/worker_thread_pool.h
@@ -173,8 +173,8 @@ public:
template <class C, class M, class U>
GroupID add_template_group_task(C *p_instance, M p_method, U p_userdata, int p_elements, int p_tasks = -1, bool p_high_priority = false, const String &p_description = String()) {
- typedef GroupUserData<C, M, U> GUD;
- GUD *ud = memnew(GUD);
+ typedef GroupUserData<C, M, U> GroupUD;
+ GroupUD *ud = memnew(GroupUD);
ud->instance = p_instance;
ud->method = p_method;
ud->userdata = p_userdata;
diff --git a/core/string/node_path.cpp b/core/string/node_path.cpp
index 9ce1c2d4bb..af7c18741d 100644
--- a/core/string/node_path.cpp
+++ b/core/string/node_path.cpp
@@ -339,7 +339,6 @@ NodePath::NodePath(const Vector<StringName> &p_path, bool p_absolute) {
data->refcount.init();
data->absolute = p_absolute;
data->path = p_path;
- data->has_slashes = true;
data->hash_cache_valid = false;
}
@@ -353,7 +352,6 @@ NodePath::NodePath(const Vector<StringName> &p_path, const Vector<StringName> &p
data->absolute = p_absolute;
data->path = p_path;
data->subpath = p_subpath;
- data->has_slashes = true;
data->hash_cache_valid = false;
}
@@ -373,7 +371,6 @@ NodePath::NodePath(const String &p_path) {
bool absolute = (path[0] == '/');
bool last_is_slash = true;
- bool has_slashes = false;
int slices = 0;
int subpath_pos = path.find(":");
@@ -402,7 +399,6 @@ NodePath::NodePath(const String &p_path) {
for (int i = (int)absolute; i < path.length(); i++) {
if (path[i] == '/') {
last_is_slash = true;
- has_slashes = true;
} else {
if (last_is_slash) {
slices++;
@@ -419,7 +415,6 @@ NodePath::NodePath(const String &p_path) {
data = memnew(Data);
data->refcount.init();
data->absolute = absolute;
- data->has_slashes = has_slashes;
data->subpath = subpath;
data->hash_cache_valid = false;
diff --git a/core/string/node_path.h b/core/string/node_path.h
index 7053798cb2..876d69924e 100644
--- a/core/string/node_path.h
+++ b/core/string/node_path.h
@@ -42,7 +42,6 @@ class NodePath {
StringName concatenated_path;
StringName concatenated_subpath;
bool absolute;
- bool has_slashes;
mutable bool hash_cache_valid;
mutable uint32_t hash_cache;
};
diff --git a/core/variant/array.cpp b/core/variant/array.cpp
index d3c5ca801f..2d7dff0b27 100644
--- a/core/variant/array.cpp
+++ b/core/variant/array.cpp
@@ -246,7 +246,7 @@ void Array::assign(const Array &p_array) {
ERR_FAIL_COND_MSG(ce.error, vformat(R"(Unable to convert array index %i from "%s" to "%s".)", i, Variant::get_type_name(value->get_type()), Variant::get_type_name(typed.type)));
}
} else if (Variant::can_convert_strict(source_typed.type, typed.type)) {
- // from primitives to different convertable primitives
+ // from primitives to different convertible primitives
for (int i = 0; i < size; i++) {
const Variant *value = source + i;
Callable::CallError ce;
diff --git a/doc/classes/@GlobalScope.xml b/doc/classes/@GlobalScope.xml
index 0d6524ccbe..3b2e260dcb 100644
--- a/doc/classes/@GlobalScope.xml
+++ b/doc/classes/@GlobalScope.xml
@@ -1271,7 +1271,13 @@
<method name="str" qualifiers="vararg">
<return type="String" />
<description>
- Converts one or more arguments of any [Variant] type to [String] in the best way possible.
+ Converts one or more arguments of any [Variant] type to a [String] in the best way possible.
+ [codeblock]
+ var a = [10, 20, 30]
+ var b = str(a)
+ print(len(a)) # Prints 3 (the number of elements in the array).
+ print(len(b)) # Prints 12 (the length of the string "[10, 20, 30]").
+ [/codeblock]
</description>
</method>
<method name="str_to_var">
diff --git a/doc/classes/AESContext.xml b/doc/classes/AESContext.xml
index 7f582e4be7..747968ea91 100644
--- a/doc/classes/AESContext.xml
+++ b/doc/classes/AESContext.xml
@@ -39,39 +39,38 @@
[/gdscript]
[csharp]
using Godot;
- using System;
using System.Diagnostics;
- public class Example : Node
+ public partial class MyNode : Node
{
- public AESContext Aes = new AESContext();
+ private AesContext _aes = new AesContext();
public override void _Ready()
{
string key = "My secret key!!!"; // Key must be either 16 or 32 bytes.
string data = "My secret text!!"; // Data size must be multiple of 16 bytes, apply padding if needed.
// Encrypt ECB
- Aes.Start(AESContext.Mode.EcbEncrypt, key.ToUTF8());
- byte[] encrypted = Aes.Update(data.ToUTF8());
- Aes.Finish();
+ _aes.Start(AesContext.Mode.EcbEncrypt, key.ToUtf8());
+ byte[] encrypted = _aes.Update(data.ToUtf8());
+ _aes.Finish();
// Decrypt ECB
- Aes.Start(AESContext.Mode.EcbDecrypt, key.ToUTF8());
- byte[] decrypted = Aes.Update(encrypted);
- Aes.Finish();
+ _aes.Start(AesContext.Mode.EcbDecrypt, key.ToUtf8());
+ byte[] decrypted = _aes.Update(encrypted);
+ _aes.Finish();
// Check ECB
- Debug.Assert(decrypted == data.ToUTF8());
+ Debug.Assert(decrypted == data.ToUtf8());
string iv = "My secret iv!!!!"; // IV must be of exactly 16 bytes.
// Encrypt CBC
- Aes.Start(AESContext.Mode.EcbEncrypt, key.ToUTF8(), iv.ToUTF8());
- encrypted = Aes.Update(data.ToUTF8());
- Aes.Finish();
+ _aes.Start(AesContext.Mode.EcbEncrypt, key.ToUtf8(), iv.ToUtf8());
+ encrypted = _aes.Update(data.ToUtf8());
+ _aes.Finish();
// Decrypt CBC
- Aes.Start(AESContext.Mode.EcbDecrypt, key.ToUTF8(), iv.ToUTF8());
- decrypted = Aes.Update(encrypted);
- Aes.Finish();
+ _aes.Start(AesContext.Mode.EcbDecrypt, key.ToUtf8(), iv.ToUtf8());
+ decrypted = _aes.Update(encrypted);
+ _aes.Finish();
// Check CBC
- Debug.Assert(decrypted == data.ToUTF8());
+ Debug.Assert(decrypted == data.ToUtf8());
}
}
[/csharp]
diff --git a/doc/classes/AStar3D.xml b/doc/classes/AStar3D.xml
index 4e8394195d..f0481c1745 100644
--- a/doc/classes/AStar3D.xml
+++ b/doc/classes/AStar3D.xml
@@ -19,15 +19,16 @@
return min(0, abs(u - v) - 1)
[/gdscript]
[csharp]
- public class MyAStar : AStar3D
+ public partial class MyAStar : AStar3D
{
- public override float _ComputeCost(int u, int v)
+ public override float _ComputeCost(long fromId, long toId)
{
- return Mathf.Abs(u - v);
+ return Mathf.Abs((int)(fromId - toId));
}
- public override float _EstimateCost(int u, int v)
+
+ public override float _EstimateCost(long fromId, long toId)
{
- return Mathf.Min(0, Mathf.Abs(u - v) - 1);
+ return Mathf.Min(0, Mathf.Abs((int)(fromId - toId)) - 1);
}
}
[/csharp]
diff --git a/doc/classes/AnimationNodeStateMachine.xml b/doc/classes/AnimationNodeStateMachine.xml
index 0fb789875f..95891a9061 100644
--- a/doc/classes/AnimationNodeStateMachine.xml
+++ b/doc/classes/AnimationNodeStateMachine.xml
@@ -161,4 +161,9 @@
</description>
</method>
</methods>
+ <members>
+ <member name="allow_transition_to_self" type="bool" setter="set_allow_transition_to_self" getter="is_allow_transition_to_self" default="false">
+ If [code]true[/code], allows teleport to the self state with [method AnimationNodeStateMachinePlayback.travel]. When the reset option is enabled in [method AnimationNodeStateMachinePlayback.travel], the animation is restarted. If [code]false[/code], nothing happens on the teleportation to the self state.
+ </member>
+ </members>
</class>
diff --git a/doc/classes/AnimationNodeTransition.xml b/doc/classes/AnimationNodeTransition.xml
index a067b0a9ba..bc3e5716dd 100644
--- a/doc/classes/AnimationNodeTransition.xml
+++ b/doc/classes/AnimationNodeTransition.xml
@@ -44,6 +44,9 @@
</method>
</methods>
<members>
+ <member name="allow_transition_to_self" type="bool" setter="set_allow_transition_to_self" getter="is_allow_transition_to_self" default="false">
+ If [code]true[/code], allows transition to the self state. When the reset option is enabled in input, the animation is restarted. If [code]false[/code], nothing happens on the transition to the self state.
+ </member>
<member name="input_count" type="int" setter="set_input_count" getter="get_input_count" default="0">
The number of enabled input ports for this node.
</member>
diff --git a/doc/classes/AnimationTree.xml b/doc/classes/AnimationTree.xml
index 86562c340d..98256f0a38 100644
--- a/doc/classes/AnimationTree.xml
+++ b/doc/classes/AnimationTree.xml
@@ -92,13 +92,6 @@
[/codeblocks]
</description>
</method>
- <method name="rename_parameter">
- <return type="void" />
- <param index="0" name="old_name" type="String" />
- <param index="1" name="new_name" type="String" />
- <description>
- </description>
- </method>
</methods>
<members>
<member name="active" type="bool" setter="set_active" getter="is_active" default="false">
diff --git a/doc/classes/Color.xml b/doc/classes/Color.xml
index 57278d9241..cee0e3ef7d 100644
--- a/doc/classes/Color.xml
+++ b/doc/classes/Color.xml
@@ -233,7 +233,6 @@
<description>
Returns a new color from [param rgba], an HTML hexadecimal color string. [param rgba] is not case-sensitive, and may be prefixed by a hash sign ([code]#[/code]).
[param rgba] must be a valid three-digit or six-digit hexadecimal color string, and may contain an alpha channel value. If [param rgba] does not contain an alpha channel value, an alpha channel value of 1.0 is applied. If [param rgba] is invalid, returns an empty color.
- [b]Note:[/b] In C#, this method is not implemented. The same functionality is provided by the Color constructor.
[codeblocks]
[gdscript]
var blue = Color.html("#0000ff") # blue is Color(0.0, 0.0, 1.0, 1.0)
@@ -264,13 +263,13 @@
Color.html_is_valid("#55aaFF5") # Returns false
[/gdscript]
[csharp]
- Color.IsHtmlValid("#55AAFF"); // Returns true
- Color.IsHtmlValid("#55AAFF20"); // Returns true
- Color.IsHtmlValid("55AAFF"); // Returns true
- Color.IsHtmlValid("#F2C"); // Returns true
+ Color.HtmlIsValid("#55AAFF"); // Returns true
+ Color.HtmlIsValid("#55AAFF20"); // Returns true
+ Color.HtmlIsValid("55AAFF"); // Returns true
+ Color.HtmlIsValid("#F2C"); // Returns true
- Color.IsHtmlValid("#AABBC"); // Returns false
- Color.IsHtmlValid("#55aaFF5"); // Returns false
+ Color.HtmlIsValid("#AABBC"); // Returns false
+ Color.HtmlIsValid("#55aaFF5"); // Returns false
[/csharp]
[/codeblocks]
</description>
diff --git a/doc/classes/Control.xml b/doc/classes/Control.xml
index 0d675112b8..d74ddba369 100644
--- a/doc/classes/Control.xml
+++ b/doc/classes/Control.xml
@@ -37,11 +37,11 @@
return typeof(data) == TYPE_DICTIONARY and data.has("expected")
[/gdscript]
[csharp]
- public override bool CanDropData(Vector2 position, object data)
+ public override bool _CanDropData(Vector2 atPosition, Variant 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");
+ return data.VariantType == Variant.Type.Dictionary &amp;&amp; data.AsGodotDictionary().Contains("expected");
}
[/csharp]
[/codeblocks]
@@ -57,17 +57,19 @@
[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)
+ public override bool _CanDropData(Vector2 atPosition, Variant data)
{
- return data is Godot.Collections.Dictionary &amp;&amp; (data as Godot.Collections.Dictionary).Contains("color");
+ return data.VariantType == Variant.Type.Dictionary &amp;&amp; dict.AsGodotDictionary().Contains("color");
}
- public override void DropData(Vector2 position, object data)
+
+ public override void _DropData(Vector2 atPosition, Variant data)
{
- Color color = (Color)(data as Godot.Collections.Dictionary)["color"];
+ Color color = data.AsGodotDictionary()["color"].AsColor();
}
[/csharp]
[/codeblocks]
@@ -87,11 +89,11 @@
return mydata
[/gdscript]
[csharp]
- public override object GetDragData(Vector2 position)
+ public override Variant _GetDragData(Vector2 atPosition)
{
- 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;
+ var 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]
@@ -121,10 +123,9 @@
[csharp]
public override void _GuiInput(InputEvent @event)
{
- if (@event is InputEventMouseButton)
+ if (@event is InputEventMouseButton mb)
{
- var mb = @event as InputEventMouseButton;
- if (mb.ButtonIndex == (int)ButtonList.Left &amp;&amp; mb.Pressed)
+ if (mb.ButtonIndex == MouseButton.Left &amp;&amp; mb.Pressed)
{
GD.Print("I've been clicked D:");
}
@@ -168,7 +169,7 @@
return label
[/gdscript]
[csharp]
- public override Godot.Control _MakeCustomTooltip(String forText)
+ public override Control _MakeCustomTooltip(string forText)
{
var label = new Label();
label.Text = forText;
@@ -185,7 +186,7 @@
return tooltip
[/gdscript]
[csharp]
- public override Godot.Control _MakeCustomTooltip(String forText)
+ public override Control _MakeCustomTooltip(string forText)
{
Node tooltip = ResourceLoader.Load&lt;PackedScene&gt;("res://some_tooltip_scene.tscn").Instantiate();
tooltip.GetNode&lt;Label&gt;("Label").Text = forText;
@@ -229,11 +230,11 @@
[/gdscript]
[csharp]
// Given the child Label node "MyLabel", override its font color with a custom value.
- GetNode&lt;Label&gt;("MyLabel").AddThemeColorOverride("font_color", new Color(1, 0.5f, 0))
+ GetNode&lt;Label&gt;("MyLabel").AddThemeColorOverride("font_color", new Color(1, 0.5f, 0));
// Reset the font color of the child label.
- GetNode&lt;Label&gt;("MyLabel").RemoveThemeColorOverride("font_color")
+ GetNode&lt;Label&gt;("MyLabel").RemoveThemeColorOverride("font_color");
// Alternatively it can be overridden with the default value from the Label type.
- GetNode&lt;Label&gt;("MyLabel").AddThemeColorOverride("font_color", GetThemeColor("font_color", "Label"))
+ GetNode&lt;Label&gt;("MyLabel").AddThemeColorOverride("font_color", GetThemeColor("font_color", "Label"));
[/csharp]
[/codeblocks]
</description>
@@ -542,12 +543,12 @@
[codeblocks]
[gdscript]
func _process(delta):
- grab_click_focus() #when clicking another Control node, this node will be clicked instead
+ grab_click_focus() # When clicking another Control node, this node will be clicked instead.
[/gdscript]
[csharp]
- public override void _Process(float delta)
+ public override void _Process(double delta)
{
- GrabClickFocus(); //when clicking another Control node, this node will be clicked instead
+ GrabClickFocus(); // When clicking another Control node, this node will be clicked instead.
}
[/csharp]
[/codeblocks]
@@ -812,16 +813,16 @@
[/gdscript]
[csharp]
[Export]
- public Color Color = new Color(1, 0, 0, 1);
+ private Color _color = new Color(1, 0, 0, 1);
- public override object GetDragData(Vector2 position)
+ public override Variant _GetDragData(Vector2 atPosition)
{
// Use a control that is not in the tree
var cpb = new ColorPickerButton();
- cpb.Color = Color;
- cpb.RectSize = new Vector2(50, 50);
+ cpb.Color = _color;
+ cpb.Size = new Vector2(50, 50);
SetDragPreview(cpb);
- return Color;
+ return _color;
}
[/csharp]
[/codeblocks]
diff --git a/doc/classes/Crypto.xml b/doc/classes/Crypto.xml
index ade63225dc..a7e7e756c6 100644
--- a/doc/classes/Crypto.xml
+++ b/doc/classes/Crypto.xml
@@ -9,9 +9,11 @@
[codeblocks]
[gdscript]
extends Node
+
var crypto = Crypto.new()
var key = CryptoKey.new()
var cert = X509Certificate.new()
+
func _ready():
# Generate new RSA key.
key = crypto.generate_rsa(4096)
@@ -35,35 +37,35 @@
[/gdscript]
[csharp]
using Godot;
- using System;
using System.Diagnostics;
- public class CryptoNode : Node
+ public partial class MyNode : Node
{
- public Crypto Crypto = new Crypto();
- public CryptoKey Key = new CryptoKey();
- public X509Certificate Cert = new X509Certificate();
+ private Crypto _crypto = new Crypto();
+ private CryptoKey _key = new CryptoKey();
+ private X509Certificate _cert = new X509Certificate();
+
public override void _Ready()
{
// Generate new RSA key.
- Key = Crypto.GenerateRsa(4096);
+ _key = _crypto.GenerateRsa(4096);
// Generate new self-signed certificate with the given key.
- Cert = Crypto.GenerateSelfSignedCertificate(Key, "CN=mydomain.com,O=My Game Company,C=IT");
+ _cert = _crypto.GenerateSelfSignedCertificate(_key, "CN=mydomain.com,O=My Game Company,C=IT");
// Save key and certificate in the user folder.
- Key.Save("user://generated.key");
- Cert.Save("user://generated.crt");
+ _key.Save("user://generated.key");
+ _cert.Save("user://generated.crt");
// Encryption
string data = "Some data";
- byte[] encrypted = Crypto.Encrypt(Key, data.ToUTF8());
+ byte[] encrypted = _crypto.Encrypt(_key, data.ToUtf8());
// Decryption
- byte[] decrypted = Crypto.Decrypt(Key, encrypted);
+ byte[] decrypted = _crypto.Decrypt(_key, encrypted);
// Signing
- byte[] signature = Crypto.Sign(HashingContext.HashType.Sha256, Data.SHA256Buffer(), Key);
+ byte[] signature = _crypto.Sign(HashingContext.HashType.Sha256, Data.Sha256Buffer(), _key);
// Verifying
- bool verified = Crypto.Verify(HashingContext.HashType.Sha256, Data.SHA256Buffer(), signature, Key);
+ bool verified = _crypto.Verify(HashingContext.HashType.Sha256, Data.Sha256Buffer(), signature, _key);
// Checks
Debug.Assert(verified);
- Debug.Assert(data.ToUTF8() == decrypted);
+ Debug.Assert(data.ToUtf8() == decrypted);
}
}
[/csharp]
diff --git a/doc/classes/DTLSServer.xml b/doc/classes/DTLSServer.xml
index a3a0b0456c..ae1ba10ec7 100644
--- a/doc/classes/DTLSServer.xml
+++ b/doc/classes/DTLSServer.xml
@@ -38,45 +38,46 @@
p.put_packet("Hello DTLS client".to_utf8())
[/gdscript]
[csharp]
- using Godot;
- using System;
// ServerNode.cs
- public class ServerNode : Node
+ using Godot;
+
+ public partial class ServerNode : Node
{
- public DTLSServer Dtls = new DTLSServer();
- public UDPServer Server = new UDPServer();
- public Godot.Collections.Array&lt;PacketPeerDTLS&gt; Peers = new Godot.Collections.Array&lt;PacketPeerDTLS&gt;();
+ private DtlsServer _dtls = new DtlsServer();
+ private UdpServer _server = new UdpServer();
+ private Godot.Collections.Array&lt;PacketPeerDTLS&gt; _peers = new Godot.Collections.Array&lt;PacketPeerDTLS&gt;();
+
public override void _Ready()
{
- Server.Listen(4242);
+ _server.Listen(4242);
var key = GD.Load&lt;CryptoKey&gt;("key.key"); // Your private key.
var cert = GD.Load&lt;X509Certificate&gt;("cert.crt"); // Your X509 certificate.
- Dtls.Setup(key, cert);
+ _dtls.Setup(key, cert);
}
- public override void _Process(float delta)
+ public override void _Process(double delta)
{
while (Server.IsConnectionAvailable())
{
- PacketPeerUDP peer = Server.TakeConnection();
- PacketPeerDTLS dtlsPeer = Dtls.TakeConnection(peer);
- if (dtlsPeer.GetStatus() != PacketPeerDTLS.Status.Handshaking)
+ PacketPeerUDP peer = _server.TakeConnection();
+ PacketPeerDTLS dtlsPeer = _dtls.TakeConnection(peer);
+ if (dtlsPeer.GetStatus() != PacketPeerDtls.Status.Handshaking)
{
continue; // It is normal that 50% of the connections fails due to cookie exchange.
}
GD.Print("Peer connected!");
- Peers.Add(dtlsPeer);
+ _peers.Add(dtlsPeer);
}
- foreach (var p in Peers)
+ foreach (var p in _peers)
{
p.Poll(); // Must poll to update the state.
- if (p.GetStatus() == PacketPeerDTLS.Status.Connected)
+ if (p.GetStatus() == PacketPeerDtls.Status.Connected)
{
while (p.GetAvailablePacketCount() &gt; 0)
{
- GD.Print("Received Message From Client: " + p.GetPacket().GetStringFromUTF8());
- p.PutPacket("Hello Dtls Client".ToUTF8());
+ GD.Print($"Received Message From Client: {p.GetPacket().GetStringFromUtf8()}");
+ p.PutPacket("Hello DTLS Client".ToUtf8());
}
}
}
@@ -108,34 +109,36 @@
connected = true
[/gdscript]
[csharp]
+ // ClientNode.cs
using Godot;
using System.Text;
- // ClientNode.cs
- public class ClientNode : Node
+
+ public partial class ClientNode : Node
{
- public PacketPeerDTLS Dtls = new PacketPeerDTLS();
- public PacketPeerUDP Udp = new PacketPeerUDP();
- public bool Connected = false;
+ private PacketPeerDtls _dtls = new PacketPeerDtls();
+ private PacketPeerUdp _udp = new PacketPeerUdp();
+ private bool _connected = false;
+
public override void _Ready()
{
- Udp.ConnectToHost("127.0.0.1", 4242);
- Dtls.ConnectToPeer(Udp, false); // Use true in production for certificate validation!
+ _udp.ConnectToHost("127.0.0.1", 4242);
+ _dtls.ConnectToPeer(_udp, validateCerts: false); // Use true in production for certificate validation!
}
- public override void _Process(float delta)
+ public override void _Process(double delta)
{
- Dtls.Poll();
- if (Dtls.GetStatus() == PacketPeerDTLS.Status.Connected)
+ _dtls.Poll();
+ if (_dtls.GetStatus() == PacketPeerDtls.Status.Connected)
{
- if (!Connected)
+ if (!_connected)
{
// Try to contact server
- Dtls.PutPacket("The Answer Is..42!".ToUTF8());
+ _dtls.PutPacket("The Answer Is..42!".ToUtf8());
}
- while (Dtls.GetAvailablePacketCount() &gt; 0)
+ while (_dtls.GetAvailablePacketCount() &gt; 0)
{
- GD.Print("Connected: " + Dtls.GetPacket().GetStringFromUTF8());
- Connected = true;
+ GD.Print($"Connected: {_dtls.GetPacket().GetStringFromUtf8()}");
+ _connected = true;
}
}
}
diff --git a/doc/classes/Decal.xml b/doc/classes/Decal.xml
index b9d3f1d81e..fb8bc18c1a 100644
--- a/doc/classes/Decal.xml
+++ b/doc/classes/Decal.xml
@@ -75,9 +75,6 @@
<member name="emission_energy" type="float" setter="set_emission_energy" getter="get_emission_energy" default="1.0">
Energy multiplier for the emission texture. This will make the decal emit light at a higher or lower intensity, independently of the albedo color. See also [member modulate].
</member>
- <member name="extents" type="Vector3" setter="set_extents" getter="get_extents" default="Vector3(1, 1, 1)">
- Sets the size of the [AABB] used by the decal. The AABB goes from [code]-extents[/code] to [code]extents[/code].
- </member>
<member name="lower_fade" type="float" setter="set_lower_fade" getter="get_lower_fade" default="0.3">
Sets the curve over which the decal will fade as the surface gets further from the center of the [AABB]. Only positive values are valid (negative values will be clamped to [code]0.0[/code]). See also [member upper_fade].
</member>
@@ -88,6 +85,9 @@
Fades the Decal if the angle between the Decal's [AABB] and the target surface becomes too large. A value of [code]0[/code] projects the Decal regardless of angle, a value of [code]1[/code] limits the Decal to surfaces that are nearly perpendicular.
[b]Note:[/b] Setting [member normal_fade] to a value greater than [code]0.0[/code] has a small performance cost due to the added normal angle computations.
</member>
+ <member name="size" type="Vector3" setter="set_size" getter="get_size" default="Vector3(2, 2, 2)">
+ Sets the size of the [AABB] used by the decal. The AABB goes from [code]-size/2[/code] to [code]size/2[/code].
+ </member>
<member name="texture_albedo" type="Texture2D" setter="set_texture" getter="get_texture">
[Texture2D] with the base [Color] of the Decal. Either this or the [member texture_emission] must be set for the Decal to be visible. Use the alpha channel like a mask to smoothly blend the edges of the decal with the underlying object.
[b]Note:[/b] Unlike [BaseMaterial3D] whose filter mode can be adjusted on a per-material basis, the filter mode for [Decal] textures is set globally with [member ProjectSettings.rendering/textures/decals/filter].
diff --git a/doc/classes/Dictionary.xml b/doc/classes/Dictionary.xml
index 1591aa59bf..a5a50b4c6a 100644
--- a/doc/classes/Dictionary.xml
+++ b/doc/classes/Dictionary.xml
@@ -51,7 +51,7 @@
[csharp]
[Export(PropertyHint.Enum, "White,Yellow,Orange")]
public string MyColor { get; set; }
- public Godot.Collections.Dictionary pointsDict = new Godot.Collections.Dictionary
+ private Godot.Collections.Dictionary _pointsDict = new Godot.Collections.Dictionary
{
{"White", 50},
{"Yellow", 75},
@@ -60,7 +60,7 @@
public override void _Ready()
{
- int points = (int)pointsDict[MyColor];
+ int points = (int)_pointsDict[MyColor];
}
[/csharp]
[/codeblocks]
diff --git a/doc/classes/DirAccess.xml b/doc/classes/DirAccess.xml
index 181d2eb485..27f2eb7f2f 100644
--- a/doc/classes/DirAccess.xml
+++ b/doc/classes/DirAccess.xml
@@ -44,11 +44,11 @@
{
if (dir.CurrentIsDir())
{
- GD.Print("Found directory: " + fileName);
+ GD.Print($"Found directory: {fileName}");
}
else
{
- GD.Print("Found file: " + fileName);
+ GD.Print($"Found file: {fileName}");
}
fileName = dir.GetNext();
}
diff --git a/doc/classes/EditorImportPlugin.xml b/doc/classes/EditorImportPlugin.xml
index ec9efcc9c4..6a976d218f 100644
--- a/doc/classes/EditorImportPlugin.xml
+++ b/doc/classes/EditorImportPlugin.xml
@@ -48,61 +48,67 @@
[/gdscript]
[csharp]
using Godot;
- using System;
- public class MySpecialPlugin : EditorImportPlugin
+ public partial class MySpecialPlugin : EditorImportPlugin
{
- public override String GetImporterName()
+ public override string _GetImporterName()
{
return "my.special.plugin";
}
- public override String GetVisibleName()
+ public override string _GetVisibleName()
{
return "Special Mesh";
}
- public override Godot.Collections.Array GetRecognizedExtensions()
+ public override string[] _GetRecognizedExtensions()
{
- return new Godot.Collections.Array{"special", "spec"};
+ return new string[] { "special", "spec" };
}
- public override String GetSaveExtension()
+ public override string _GetSaveExtension()
{
return "mesh";
}
- public override String GetResourceType()
+ public override string _GetResourceType()
{
return "Mesh";
}
- public override int GetPresetCount()
+ public override int _GetPresetCount()
{
return 1;
}
- public override String GetPresetName(int i)
+ public override string _GetPresetName(int presetIndex)
{
return "Default";
}
- public override Godot.Collections.Array GetImportOptions(int i)
+ public override Godot.Collections.Array&lt;Godot.Collections.Dictionary&gt; _GetImportOptions(string path, int presetIndex)
{
- return new Godot.Collections.Array{new Godot.Collections.Dictionary{{"name", "myOption"}, {"defaultValue", false}}};
+ return new Godot.Collections.Array&lt;Godot.Collections.Dictionary&gt;
+ {
+ new Godot.Collections.Dictionary
+ {
+ { "name", "myOption" },
+ { "defaultValue", false },
+ }
+ };
}
- public override int Import(String sourceFile, String savePath, Godot.Collections.Dictionary options, Godot.Collections.Array platformVariants, Godot.Collections.Array genFiles)
+ public override int _Import(string sourceFile, string savePath, Godot.Collections.Dictionary options, Godot.Collections.Array&lt;string&gt; platformVariants, Godot.Collections.Array&lt;string&gt; genFiles)
{
- var file = new File();
- if (file.Open(sourceFile, File.ModeFlags.Read) != Error.Ok)
+ using var file = FileAccess.Open(sourceFile, FileAccess.ModeFlags.Read);
+ if (file.GetError() != Error.Ok)
{
return (int)Error.Failed;
}
var mesh = new ArrayMesh();
// Fill the Mesh with data read in "file", left as an exercise to the reader.
- String filename = savePath + "." + GetSaveExtension();
+ string filename = $"{savePath}.{_GetSaveExtension()}";
return (int)ResourceSaver.Save(mesh, filename);
}
}
@@ -210,7 +216,7 @@
</description>
</method>
<method name="_import" qualifiers="virtual const">
- <return type="int" />
+ <return type="int" enum="Error" />
<param index="0" name="source_file" type="String" />
<param index="1" name="save_path" type="String" />
<param index="2" name="options" type="Dictionary" />
diff --git a/doc/classes/EditorInspectorPlugin.xml b/doc/classes/EditorInspectorPlugin.xml
index ba2f7b24bf..7ffd7f9426 100644
--- a/doc/classes/EditorInspectorPlugin.xml
+++ b/doc/classes/EditorInspectorPlugin.xml
@@ -56,11 +56,11 @@
<method name="_parse_property" qualifiers="virtual">
<return type="bool" />
<param index="0" name="object" type="Object" />
- <param index="1" name="type" type="int" />
+ <param index="1" name="type" type="int" enum="Variant.Type" />
<param index="2" name="name" type="String" />
- <param index="3" name="hint_type" type="int" />
+ <param index="3" name="hint_type" type="int" enum="PropertyHint" />
<param index="4" name="hint_string" type="String" />
- <param index="5" name="usage_flags" type="int" />
+ <param index="5" name="usage_flags" type="int" enum="PropertyUsageFlags" />
<param index="6" name="wide" type="bool" />
<description>
Called to allow adding property-specific editors to the property list for [param object]. The added editor control must extend [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.
diff --git a/doc/classes/EditorPlugin.xml b/doc/classes/EditorPlugin.xml
index c097c8f685..f4b912de9e 100644
--- a/doc/classes/EditorPlugin.xml
+++ b/doc/classes/EditorPlugin.xml
@@ -69,21 +69,22 @@
return EditorPlugin.AFTER_GUI_INPUT_PASS
[/gdscript]
[csharp]
- public override void _Forward3dDrawOverViewport(Godot.Control overlay)
+ public override void _Forward3DDrawOverViewport(Control viewportControl)
{
// Draw a circle at cursor position.
- overlay.DrawCircle(overlay.GetLocalMousePosition(), 64, Colors.White);
+ viewportControl.DrawCircle(viewportControl.GetLocalMousePosition(), 64, Colors.White);
}
- public override EditorPlugin.AfterGUIInput _Forward3dGuiInput(Godot.Camera3D camera, InputEvent @event)
+ public override EditorPlugin.AfterGuiInput _Forward3DGuiInput(Camera3D viewportCamera, InputEvent @event)
{
if (@event is InputEventMouseMotion)
{
// Redraw viewport when cursor is moved.
UpdateOverlays();
- return EditorPlugin.AFTER_GUI_INPUT_STOP;
+ return EditorPlugin.AfterGuiInput.Stop;
}
- return EditorPlugin.AFTER_GUI_INPUT_PASS;
+ return EditorPlugin.AfterGuiInput.Pass;
+ }
[/csharp]
[/codeblocks]
</description>
@@ -111,9 +112,9 @@
[/gdscript]
[csharp]
// Prevents the InputEvent from reaching other Editor classes.
- public override EditorPlugin.AfterGUIInput _Forward3dGuiInput(Camera3D camera, InputEvent @event)
+ public override EditorPlugin.AfterGuiInput _Forward3DGuiInput(Camera3D camera, InputEvent @event)
{
- return EditorPlugin.AFTER_GUI_INPUT_STOP;
+ return EditorPlugin.AfterGuiInput.Stop;
}
[/csharp]
[/codeblocks]
@@ -127,9 +128,9 @@
[/gdscript]
[csharp]
// Consumes InputEventMouseMotion and forwards other InputEvent types.
- public override EditorPlugin.AfterGUIInput _Forward3dGuiInput(Camera3D camera, InputEvent @event)
+ public override EditorPlugin.AfterGuiInput _Forward3DGuiInput(Camera3D camera, InputEvent @event)
{
- return @event is InputEventMouseMotion ? EditorPlugin.AFTER_GUI_INPUT_STOP : EditorPlugin.AFTER_GUI_INPUT_PASS;
+ return @event is InputEventMouseMotion ? EditorPlugin.AfterGuiInput.Stop : EditorPlugin.AfterGuiInput.Pass;
}
[/csharp]
[/codeblocks]
@@ -154,13 +155,13 @@
return false
[/gdscript]
[csharp]
- public override void ForwardCanvasDrawOverViewport(Godot.Control overlay)
+ public override void _ForwardCanvasDrawOverViewport(Control viewportControl)
{
// Draw a circle at cursor position.
- overlay.DrawCircle(overlay.GetLocalMousePosition(), 64, Colors.White);
+ viewportControl.DrawCircle(viewportControl.GetLocalMousePosition(), 64, Colors.White);
}
- public override bool ForwardCanvasGuiInput(InputEvent @event)
+ public override bool _ForwardCanvasGuiInput(InputEvent @event)
{
if (@event is InputEventMouseMotion)
{
@@ -169,6 +170,7 @@
return true;
}
return false;
+ }
[/csharp]
[/codeblocks]
</description>
@@ -213,12 +215,13 @@
[/gdscript]
[csharp]
// Consumes InputEventMouseMotion and forwards other InputEvent types.
- public override bool ForwardCanvasGuiInput(InputEvent @event)
+ public override bool _ForwardCanvasGuiInput(InputEvent @event)
{
- if (@event is InputEventMouseMotion) {
+ if (@event is InputEventMouseMotion)
+ {
return true;
}
- return false
+ return false;
}
[/csharp]
[/codeblocks]
@@ -245,7 +248,7 @@
return get_editor_interface().get_base_control().get_theme_icon("Node", "EditorIcons")
[/gdscript]
[csharp]
- public override Texture2D GetPluginIcon()
+ public override Texture2D _GetPluginIcon()
{
// You can use a custom icon:
return ResourceLoader.Load&lt;Texture2D&gt;("res://addons/my_plugin/my_plugin_icon.svg");
diff --git a/doc/classes/EditorScenePostImport.xml b/doc/classes/EditorScenePostImport.xml
index d2ad8d1bed..44bc72ea49 100644
--- a/doc/classes/EditorScenePostImport.xml
+++ b/doc/classes/EditorScenePostImport.xml
@@ -10,12 +10,14 @@
[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):
# Change all node names to "modified_[oldnodename]"
iterate(scene)
return scene # Remember to return the imported scene
+
func iterate(node):
if node != null:
node.name = "modified_" + node.name
@@ -30,17 +32,18 @@
[Tool]
public partial class NodeRenamer : EditorScenePostImport
{
- public override Object _PostImport(Node scene)
+ public override GodotObject _PostImport(Node scene)
{
// Change all node names to "modified_[oldnodename]"
Iterate(scene);
return scene; // Remember to return the imported scene
}
+
public void Iterate(Node node)
{
if (node != null)
{
- node.Name = "modified_" + node.Name;
+ node.Name = $"modified_{node.Name}";
foreach (Node child in node.GetChildren())
{
Iterate(child);
diff --git a/doc/classes/EditorScript.xml b/doc/classes/EditorScript.xml
index a02fd215d8..33d2f40d0b 100644
--- a/doc/classes/EditorScript.xml
+++ b/doc/classes/EditorScript.xml
@@ -17,10 +17,9 @@
[/gdscript]
[csharp]
using Godot;
- using System;
[Tool]
- public class HelloEditor : EditorScript
+ public partial class HelloEditor : EditorScript
{
public override void _Run()
{
diff --git a/doc/classes/EditorSettings.xml b/doc/classes/EditorSettings.xml
index 72843eb157..1bf8cbf175 100644
--- a/doc/classes/EditorSettings.xml
+++ b/doc/classes/EditorSettings.xml
@@ -22,7 +22,7 @@
settings.SetSetting("some/property", Value);
// `settings.get("some/property", value)` also works as this class overrides `_get()` internally.
settings.GetSetting("some/property");
- Godot.Collections.Array listOfSettings = settings.GetPropertyList();
+ Godot.Collections.Array&lt;Godot.Collections.Dictionary&gt; listOfSettings = settings.GetPropertyList();
[/csharp]
[/codeblocks]
[b]Note:[/b] This class shouldn't be instantiated directly. Instead, access the singleton using [method EditorInterface.get_editor_settings].
diff --git a/doc/classes/EditorTranslationParserPlugin.xml b/doc/classes/EditorTranslationParserPlugin.xml
index 89746363d8..40b469de0a 100644
--- a/doc/classes/EditorTranslationParserPlugin.xml
+++ b/doc/classes/EditorTranslationParserPlugin.xml
@@ -27,27 +27,25 @@
[/gdscript]
[csharp]
using Godot;
- using System;
[Tool]
- public class CustomParser : EditorTranslationParserPlugin
+ public partial class CustomParser : EditorTranslationParserPlugin
{
- public override void ParseFile(string path, Godot.Collections.Array msgids, Godot.Collections.Array msgidsContextPlural)
+ public override void _ParseFile(string path, Godot.Collections.Array&lt;string&gt; msgids, Godot.Collections.Array&lt;Godot.Collections.Array&gt; msgidsContextPlural)
{
- var file = new File();
- file.Open(path, File.ModeFlags.Read);
+ using var file = FileAccess.Open(path, FileAccess.ModeFlags.Read);
string text = file.GetAsText();
- string[] splitStrs = text.Split(",", false);
- foreach (var s in splitStrs)
+ string[] splitStrs = text.Split(",", allowEmpty: false);
+ foreach (string s in splitStrs)
{
msgids.Add(s);
- //GD.Print("Extracted string: " + s)
+ //GD.Print($"Extracted string: {s}");
}
}
- public override Godot.Collections.Array GetRecognizedExtensions()
+ public override string[] _GetRecognizedExtensions()
{
- return new Godot.Collections.Array{"csv"};
+ return new string[] { "csv" };
}
}
[/csharp]
@@ -84,16 +82,16 @@
return ["gd"]
[/gdscript]
[csharp]
- public override void ParseFile(string path, Godot.Collections.Array msgids, Godot.Collections.Array msgidsContextPlural)
+ public override void _ParseFile(string path, Godot.Collections.Array&lt;string&gt; msgids, Godot.Collections.Array&lt;Godot.Collections.Array&gt; msgidsContextPlural)
{
var res = ResourceLoader.Load&lt;Script&gt;(path, "Script");
string text = res.SourceCode;
// Parsing logic.
}
- public override Godot.Collections.Array GetRecognizedExtensions()
+ public override string[] _GetRecognizedExtensions()
{
- return new Godot.Collections.Array{"gd"};
+ return new string[] { "gd" };
}
[/csharp]
[/codeblocks]
diff --git a/doc/classes/Expression.xml b/doc/classes/Expression.xml
index 2c7d83a811..fd5a921836 100644
--- a/doc/classes/Expression.xml
+++ b/doc/classes/Expression.xml
@@ -24,7 +24,7 @@
$LineEdit.text = str(result)
[/gdscript]
[csharp]
- public Expression expression = new Expression();
+ private Expression _expression = new Expression();
public override void _Ready()
{
@@ -33,14 +33,14 @@
private void OnTextEntered(string command)
{
- Error error = expression.Parse(command);
+ Error error = _expression.Parse(command);
if (error != Error.Ok)
{
- GD.Print(expression.GetErrorText());
+ GD.Print(_expression.GetErrorText());
return;
}
- object result = expression.Execute();
- if (!expression.HasExecuteFailed())
+ Variant result = _expression.Execute();
+ if (!_expression.HasExecuteFailed())
{
GetNode&lt;LineEdit&gt;("LineEdit").Text = result.ToString();
}
diff --git a/doc/classes/FileAccess.xml b/doc/classes/FileAccess.xml
index be0c8fd6ca..687a64b8ff 100644
--- a/doc/classes/FileAccess.xml
+++ b/doc/classes/FileAccess.xml
@@ -348,8 +348,8 @@
f.Seek(0); // Go back to start to read the stored value.
ushort read1 = f.Get16(); // 65494
ushort read2 = f.Get16(); // 121
- short converted1 = BitConverter.ToInt16(BitConverter.GetBytes(read1), 0); // -42
- short converted2 = BitConverter.ToInt16(BitConverter.GetBytes(read2), 0); // 121
+ short converted1 = (short)read1; // -42
+ short converted2 = (short)read2; // 121
}
[/csharp]
[/codeblocks]
diff --git a/doc/classes/FogVolume.xml b/doc/classes/FogVolume.xml
index d9fa2e6ebb..e2f9038be5 100644
--- a/doc/classes/FogVolume.xml
+++ b/doc/classes/FogVolume.xml
@@ -11,16 +11,16 @@
<tutorials>
</tutorials>
<members>
- <member name="extents" type="Vector3" setter="set_extents" getter="get_extents" default="Vector3(1, 1, 1)">
- The size of the [FogVolume] when [member shape] is [constant RenderingServer.FOG_VOLUME_SHAPE_ELLIPSOID], [constant RenderingServer.FOG_VOLUME_SHAPE_CONE], [constant RenderingServer.FOG_VOLUME_SHAPE_CYLINDER] or [constant RenderingServer.FOG_VOLUME_SHAPE_BOX].
- [b]Note:[/b] Thin fog volumes may appear to flicker when the camera moves or rotates. This can be alleviated by increasing [member ProjectSettings.rendering/environment/volumetric_fog/volume_depth] (at a performance cost) or by decreasing [member Environment.volumetric_fog_length] (at no performance cost, but at the cost of lower fog range). Alternatively, the [FogVolume] can be made thicker and use a lower density in the [member material].
- [b]Note:[/b] If [member shape] is [constant RenderingServer.FOG_VOLUME_SHAPE_CONE] or [constant RenderingServer.FOG_VOLUME_SHAPE_CYLINDER], the cone/cylinder will be adjusted to fit within the extents. Non-uniform scaling of cone/cylinder shapes via the [member extents] property is not supported, but you can scale the [FogVolume] node instead.
- </member>
<member name="material" type="Material" setter="set_material" getter="get_material">
The [Material] used by the [FogVolume]. Can be either a built-in [FogMaterial] or a custom [ShaderMaterial].
</member>
<member name="shape" type="int" setter="set_shape" getter="get_shape" enum="RenderingServer.FogVolumeShape" default="3">
The shape of the [FogVolume]. This can be set to either [constant RenderingServer.FOG_VOLUME_SHAPE_ELLIPSOID], [constant RenderingServer.FOG_VOLUME_SHAPE_CONE], [constant RenderingServer.FOG_VOLUME_SHAPE_CYLINDER], [constant RenderingServer.FOG_VOLUME_SHAPE_BOX] or [constant RenderingServer.FOG_VOLUME_SHAPE_WORLD].
</member>
+ <member name="size" type="Vector3" setter="set_size" getter="get_size" default="Vector3(2, 2, 2)">
+ The size of the [FogVolume] when [member shape] is [constant RenderingServer.FOG_VOLUME_SHAPE_ELLIPSOID], [constant RenderingServer.FOG_VOLUME_SHAPE_CONE], [constant RenderingServer.FOG_VOLUME_SHAPE_CYLINDER] or [constant RenderingServer.FOG_VOLUME_SHAPE_BOX].
+ [b]Note:[/b] Thin fog volumes may appear to flicker when the camera moves or rotates. This can be alleviated by increasing [member ProjectSettings.rendering/environment/volumetric_fog/volume_depth] (at a performance cost) or by decreasing [member Environment.volumetric_fog_length] (at no performance cost, but at the cost of lower fog range). Alternatively, the [FogVolume] can be made thicker and use a lower density in the [member material].
+ [b]Note:[/b] If [member shape] is [constant RenderingServer.FOG_VOLUME_SHAPE_CONE] or [constant RenderingServer.FOG_VOLUME_SHAPE_CYLINDER], the cone/cylinder will be adjusted to fit within the size. Non-uniform scaling of cone/cylinder shapes via the [member size] property is not supported, but you can scale the [FogVolume] node instead.
+ </member>
</members>
</class>
diff --git a/doc/classes/GPUParticlesAttractorBox3D.xml b/doc/classes/GPUParticlesAttractorBox3D.xml
index 6595428cc2..65a4c6d4a5 100644
--- a/doc/classes/GPUParticlesAttractorBox3D.xml
+++ b/doc/classes/GPUParticlesAttractorBox3D.xml
@@ -10,8 +10,8 @@
<tutorials>
</tutorials>
<members>
- <member name="extents" type="Vector3" setter="set_extents" getter="get_extents" default="Vector3(1, 1, 1)">
- The attractor box's extents in 3D units.
+ <member name="size" type="Vector3" setter="set_size" getter="get_size" default="Vector3(2, 2, 2)">
+ The attractor box's size in 3D units.
</member>
</members>
</class>
diff --git a/doc/classes/GPUParticlesAttractorVectorField3D.xml b/doc/classes/GPUParticlesAttractorVectorField3D.xml
index aeadfaf4ab..12e6774471 100644
--- a/doc/classes/GPUParticlesAttractorVectorField3D.xml
+++ b/doc/classes/GPUParticlesAttractorVectorField3D.xml
@@ -11,12 +11,12 @@
<tutorials>
</tutorials>
<members>
- <member name="extents" type="Vector3" setter="set_extents" getter="get_extents" default="Vector3(1, 1, 1)">
- The extents of the vector field box in 3D units.
+ <member name="size" type="Vector3" setter="set_size" getter="get_size" default="Vector3(2, 2, 2)">
+ The size of the vector field box in 3D units.
</member>
<member name="texture" type="Texture3D" setter="set_texture" getter="get_texture">
The 3D texture to be used. Values are linearly interpolated between the texture's pixels.
- [b]Note:[/b] To get better performance, the 3D texture's resolution should reflect the [member extents] of the attractor. Since particle attraction is usually low-frequency data, the texture can be kept at a low resolution such as 64×64×64.
+ [b]Note:[/b] To get better performance, the 3D texture's resolution should reflect the [member size] of the attractor. Since particle attraction is usually low-frequency data, the texture can be kept at a low resolution such as 64×64×64.
</member>
</members>
</class>
diff --git a/doc/classes/GPUParticlesCollisionBox3D.xml b/doc/classes/GPUParticlesCollisionBox3D.xml
index 103be18bfd..737db0ba8a 100644
--- a/doc/classes/GPUParticlesCollisionBox3D.xml
+++ b/doc/classes/GPUParticlesCollisionBox3D.xml
@@ -11,8 +11,8 @@
<tutorials>
</tutorials>
<members>
- <member name="extents" type="Vector3" setter="set_extents" getter="get_extents" default="Vector3(1, 1, 1)">
- The collision box's extents in 3D units.
+ <member name="size" type="Vector3" setter="set_size" getter="get_size" default="Vector3(2, 2, 2)">
+ The collision box's size in 3D units.
</member>
</members>
</class>
diff --git a/doc/classes/GPUParticlesCollisionHeightField3D.xml b/doc/classes/GPUParticlesCollisionHeightField3D.xml
index 6e996d5fbd..c8ed78b85e 100644
--- a/doc/classes/GPUParticlesCollisionHeightField3D.xml
+++ b/doc/classes/GPUParticlesCollisionHeightField3D.xml
@@ -13,9 +13,6 @@
<tutorials>
</tutorials>
<members>
- <member name="extents" type="Vector3" setter="set_extents" getter="get_extents" default="Vector3(1, 1, 1)">
- The collision heightmap's extents in 3D units. To improve heightmap quality, [member extents] should be set as small as possible while covering the parts of the scene you need.
- </member>
<member name="follow_camera_enabled" type="bool" setter="set_follow_camera_enabled" getter="is_follow_camera_enabled" default="false">
If [code]true[/code], the [GPUParticlesCollisionHeightField3D] will follow the current camera in global space. The [GPUParticlesCollisionHeightField3D] does not need to be a child of the [Camera3D] node for this to work.
Following the camera has a performance cost, as it will force the heightmap to update whenever the camera moves. Consider lowering [member resolution] to improve performance if [member follow_camera_enabled] is [code]true[/code].
@@ -23,6 +20,9 @@
<member name="resolution" type="int" setter="set_resolution" getter="get_resolution" enum="GPUParticlesCollisionHeightField3D.Resolution" default="2">
Higher resolutions can represent small details more accurately in large scenes, at the cost of lower performance. If [member update_mode] is [constant UPDATE_MODE_ALWAYS], consider using the lowest resolution possible.
</member>
+ <member name="size" type="Vector3" setter="set_size" getter="get_size" default="Vector3(2, 2, 2)">
+ The collision heightmap's size in 3D units. To improve heightmap quality, [member size] should be set as small as possible while covering the parts of the scene you need.
+ </member>
<member name="update_mode" type="int" setter="set_update_mode" getter="get_update_mode" enum="GPUParticlesCollisionHeightField3D.UpdateMode" default="0">
The update policy to use for the generated heightmap.
</member>
diff --git a/doc/classes/GPUParticlesCollisionSDF3D.xml b/doc/classes/GPUParticlesCollisionSDF3D.xml
index 8467cfdda1..dc4a4a2027 100644
--- a/doc/classes/GPUParticlesCollisionSDF3D.xml
+++ b/doc/classes/GPUParticlesCollisionSDF3D.xml
@@ -6,7 +6,7 @@
<description>
Baked signed distance field 3D particle attractor affecting [GPUParticles3D] nodes.
Signed distance fields (SDF) allow for efficiently representing approximate collision shapes for convex and concave objects of any shape. This is more flexible than [GPUParticlesCollisionHeightField3D], but it requires a baking step.
- [b]Baking:[/b] The signed distance field texture can be baked by selecting the [GPUParticlesCollisionSDF3D] node in the editor, then clicking [b]Bake SDF[/b] at the top of the 3D viewport. Any [i]visible[/i] [MeshInstance3D]s touching the [member extents] will be taken into account for baking, regardless of their [member GeometryInstance3D.gi_mode].
+ [b]Baking:[/b] The signed distance field texture can be baked by selecting the [GPUParticlesCollisionSDF3D] node in the editor, then clicking [b]Bake SDF[/b] at the top of the 3D viewport. Any [i]visible[/i] [MeshInstance3D]s within the [member size] will be taken into account for baking, regardless of their [member GeometryInstance3D.gi_mode].
[b]Note:[/b] Baking a [GPUParticlesCollisionSDF3D]'s [member texture] is only possible within the editor, as there is no bake method exposed for use in exported projects. However, it's still possible to load pre-baked [Texture3D]s into its [member texture] property in an exported project.
[b]Note:[/b] [member ParticleProcessMaterial.collision_mode] must be [constant ParticleProcessMaterial.COLLISION_RIGID] or [constant ParticleProcessMaterial.COLLISION_HIDE_ON_CONTACT] on the [GPUParticles3D]'s process material for collision to work.
[b]Note:[/b] Particle collision only affects [GPUParticles3D], not [CPUParticles3D].
@@ -34,12 +34,12 @@
<member name="bake_mask" type="int" setter="set_bake_mask" getter="get_bake_mask" default="4294967295">
The visual layers to account for when baking the particle collision SDF. Only [MeshInstance3D]s whose [member VisualInstance3D.layers] match with this [member bake_mask] will be included in the generated particle collision SDF. By default, all objects are taken into account for the particle collision SDF baking.
</member>
- <member name="extents" type="Vector3" setter="set_extents" getter="get_extents" default="Vector3(1, 1, 1)">
- The collision SDF's extents in 3D units. To improve SDF quality, the [member extents] should be set as small as possible while covering the parts of the scene you need.
- </member>
<member name="resolution" type="int" setter="set_resolution" getter="get_resolution" enum="GPUParticlesCollisionSDF3D.Resolution" default="2">
The bake resolution to use for the signed distance field [member texture]. The texture must be baked again for changes to the [member resolution] property to be effective. Higher resolutions have a greater performance cost and take more time to bake. Higher resolutions also result in larger baked textures, leading to increased VRAM and storage space requirements. To improve performance and reduce bake times, use the lowest resolution possible for the object you're representing the collision of.
</member>
+ <member name="size" type="Vector3" setter="set_size" getter="get_size" default="Vector3(2, 2, 2)">
+ The collision SDF's size in 3D units. To improve SDF quality, the [member size] should be set as small as possible while covering the parts of the scene you need.
+ </member>
<member name="texture" type="Texture3D" setter="set_texture" getter="get_texture">
The 3D texture representing the signed distance field.
</member>
diff --git a/doc/classes/Geometry2D.xml b/doc/classes/Geometry2D.xml
index 0142018f1a..f015026bc1 100644
--- a/doc/classes/Geometry2D.xml
+++ b/doc/classes/Geometry2D.xml
@@ -160,14 +160,13 @@
var polygon = PackedVector2Array([Vector2(0, 0), Vector2(100, 0), Vector2(100, 100), Vector2(0, 100)])
var offset = Vector2(50, 50)
polygon = Transform2D(0, offset) * polygon
- print(polygon) # prints [Vector2(50, 50), Vector2(150, 50), Vector2(150, 150), Vector2(50, 150)]
+ print(polygon) # prints [(50, 50), (150, 50), (150, 150), (50, 150)]
[/gdscript]
[csharp]
var polygon = new Vector2[] { new Vector2(0, 0), new Vector2(100, 0), new Vector2(100, 100), new Vector2(0, 100) };
var offset = new Vector2(50, 50);
- // TODO: This code is not valid right now. Ping @aaronfranke about it before Godot 4.0 is out.
- //polygon = (Vector2[]) new Transform2D(0, offset).Xform(polygon);
- //GD.Print(polygon); // prints [Vector2(50, 50), Vector2(150, 50), Vector2(150, 150), Vector2(50, 150)]
+ polygon = new Transform2D(0, offset) * polygon;
+ GD.Print((Variant)polygon); // prints [(50, 50), (150, 50), (150, 150), (50, 150)]
[/csharp]
[/codeblocks]
</description>
diff --git a/doc/classes/GraphEdit.xml b/doc/classes/GraphEdit.xml
index ea4e4b53ba..490637374d 100644
--- a/doc/classes/GraphEdit.xml
+++ b/doc/classes/GraphEdit.xml
@@ -72,8 +72,9 @@
return from != to
[/gdscript]
[csharp]
- public override bool _IsNodeHoverValid(String from, int fromSlot, String to, int toSlot) {
- return from != to;
+ public override bool _IsNodeHoverValid(StringName fromNode, int fromPort, StringName toNode, int toPort)
+ {
+ return fromNode != toNode;
}
[/csharp]
[/codeblocks]
diff --git a/doc/classes/HMACContext.xml b/doc/classes/HMACContext.xml
index 706ee30963..fbdc6b5e64 100644
--- a/doc/classes/HMACContext.xml
+++ b/doc/classes/HMACContext.xml
@@ -26,25 +26,24 @@
[/gdscript]
[csharp]
using Godot;
- using System;
using System.Diagnostics;
- public class CryptoNode : Node
+ public partial class MyNode : Node
{
- private HMACContext ctx = new HMACContext();
+ private HmacContext _ctx = new HmacContext();
public override void _Ready()
{
- byte[] key = "supersecret".ToUTF8();
- Error err = ctx.Start(HashingContext.HashType.Sha256, key);
+ byte[] key = "supersecret".ToUtf8();
+ Error err = _ctx.Start(HashingContext.HashType.Sha256, key);
Debug.Assert(err == Error.Ok);
- byte[] msg1 = "this is ".ToUTF8();
- byte[] msg2 = "super duper secret".ToUTF8();
- err = ctx.Update(msg1);
+ byte[] msg1 = "this is ".ToUtf8();
+ byte[] msg2 = "super duper secret".ToUtf8();
+ err = _ctx.Update(msg1);
Debug.Assert(err == Error.Ok);
- err = ctx.Update(msg2);
+ err = _ctx.Update(msg2);
Debug.Assert(err == Error.Ok);
- byte[] hmac = ctx.Finish();
+ byte[] hmac = _ctx.Finish();
GD.Print(hmac.HexEncode());
}
}
diff --git a/doc/classes/HTTPClient.xml b/doc/classes/HTTPClient.xml
index b7a5cff694..4973f3fddf 100644
--- a/doc/classes/HTTPClient.xml
+++ b/doc/classes/HTTPClient.xml
@@ -105,7 +105,7 @@
[/gdscript]
[csharp]
var fields = new Godot.Collections.Dictionary { { "username", "user" }, { "password", "pass" } };
- string queryString = new HTTPClient().QueryStringFromDict(fields);
+ string queryString = httpClient.QueryStringFromDict(fields);
// Returns "username=user&amp;password=pass"
[/csharp]
[/codeblocks]
@@ -117,8 +117,13 @@
# Returns "single=123&amp;not_valued&amp;multiple=22&amp;multiple=33&amp;multiple=44"
[/gdscript]
[csharp]
- var fields = new Godot.Collections.Dictionary{{"single", 123}, {"notValued", null}, {"multiple", new Godot.Collections.Array{22, 33, 44}}};
- string queryString = new HTTPClient().QueryStringFromDict(fields);
+ var fields = new Godot.Collections.Dictionary
+ {
+ { "single", 123 },
+ { "notValued", default },
+ { "multiple", new Godot.Collections.Array { 22, 33, 44 } },
+ };
+ string queryString = httpClient.QueryStringFromDict(fields);
// Returns "single=123&amp;not_valued&amp;multiple=22&amp;multiple=33&amp;multiple=44"
[/csharp]
[/codeblocks]
@@ -151,7 +156,7 @@
[csharp]
var fields = new Godot.Collections.Dictionary { { "username", "user" }, { "password", "pass" } };
string queryString = new HTTPClient().QueryStringFromDict(fields);
- string[] headers = {"Content-Type: application/x-www-form-urlencoded", "Content-Length: " + queryString.Length};
+ string[] headers = { "Content-Type: application/x-www-form-urlencoded", $"Content-Length: {queryString.Length}" };
var result = new HTTPClient().Request(HTTPClient.Method.Post, "index.php", headers, queryString);
[/csharp]
[/codeblocks]
diff --git a/doc/classes/HTTPRequest.xml b/doc/classes/HTTPRequest.xml
index d403acf90c..5a0b12e198 100644
--- a/doc/classes/HTTPRequest.xml
+++ b/doc/classes/HTTPRequest.xml
@@ -57,7 +57,7 @@
// Perform a POST request. The URL below returns JSON as of writing.
// Note: Don't make simultaneous requests using a single HTTPRequest node.
// The snippet below is provided for reference only.
- string body = new JSON().Stringify(new Godot.Collections.Dictionary
+ string body = new Json().Stringify(new Godot.Collections.Dictionary
{
{ "name", "Godette" }
});
@@ -69,14 +69,14 @@
}
// Called when the HTTP request is completed.
- private void HttpRequestCompleted(int result, int responseCode, string[] headers, byte[] body)
+ private void HttpRequestCompleted(long result, long responseCode, string[] headers, byte[] body)
{
- var json = new JSON();
- json.Parse(body.GetStringFromUTF8());
- var response = json.GetData() as Godot.Collections.Dictionary;
+ var json = new Json();
+ json.Parse(body.GetStringFromUtf8());
+ var response = json.GetData().AsGodotDictionary();
// Will print the user agent string used by the HTTPRequest node (as recognized by httpbin.org).
- GD.Print((response["headers"] as Godot.Collections.Dictionary)["User-Agent"]);
+ GD.Print((response["headers"].AsGodotDictionary())["User-Agent"]);
}
[/csharp]
[/codeblocks]
@@ -128,9 +128,9 @@
}
// Called when the HTTP request is completed.
- private void HttpRequestCompleted(int result, int responseCode, string[] headers, byte[] body)
+ private void HttpRequestCompleted(long result, long responseCode, string[] headers, byte[] body)
{
- if (result != (int)HTTPRequest.Result.Success)
+ if (result != (long)HTTPRequest.Result.Success)
{
GD.PushError("Image couldn't be downloaded. Try a different image.");
}
diff --git a/doc/classes/HashingContext.xml b/doc/classes/HashingContext.xml
index 7c2be6f817..5223cbf52f 100644
--- a/doc/classes/HashingContext.xml
+++ b/doc/classes/HashingContext.xml
@@ -8,7 +8,7 @@
The [enum HashType] enum shows the supported hashing algorithms.
[codeblocks]
[gdscript]
- const CHUNK_SIZE = 102
+ const CHUNK_SIZE = 1024
func hash_file(path):
# Check that file exists.
@@ -32,17 +32,16 @@
public void HashFile(string path)
{
- var ctx = new HashingContext();
- var file = new File();
- // Start a SHA-256 context.
- ctx.Start(HashingContext.HashType.Sha256);
// Check that file exists.
- if (!file.FileExists(path))
+ if (!FileAccess.FileExists(path))
{
return;
}
+ // Start a SHA-256 context.
+ var ctx = new HashingContext();
+ ctx.Start(HashingContext.HashType.Sha256);
// Open the file to hash.
- file.Open(path, File.ModeFlags.Read);
+ using var file = FileAccess.Open(path, FileAccess.ModeFlags.Read);
// Update the context after reading each chunk.
while (!file.EofReached())
{
@@ -51,8 +50,7 @@
// Get the computed hash.
byte[] res = ctx.Finish();
// Print the result as hex string and array.
-
- GD.PrintT(res.HexEncode(), res);
+ GD.PrintT(res.HexEncode(), (Variant)res);
}
[/csharp]
[/codeblocks]
diff --git a/doc/classes/InputEventMIDI.xml b/doc/classes/InputEventMIDI.xml
index 67e7ced2e8..e4ba380741 100644
--- a/doc/classes/InputEventMIDI.xml
+++ b/doc/classes/InputEventMIDI.xml
@@ -35,9 +35,9 @@
GD.Print(OS.GetConnectedMidiInputs());
}
- public override void _Input(InputEvent inputEvent)
+ public override void _Input(InputEvent @event)
{
- if (inputEvent is InputEventMIDI midiEvent)
+ if (@event is InputEventMIDI midiEvent)
{
PrintMIDIInfo(midiEvent);
}
@@ -46,14 +46,14 @@
private void PrintMIDIInfo(InputEventMIDI midiEvent)
{
GD.Print(midiEvent);
- GD.Print("Channel " + midiEvent.Channel);
- GD.Print("Message " + midiEvent.Message);
- GD.Print("Pitch " + midiEvent.Pitch);
- GD.Print("Velocity " + midiEvent.Velocity);
- GD.Print("Instrument " + midiEvent.Instrument);
- GD.Print("Pressure " + midiEvent.Pressure);
- GD.Print("Controller number: " + midiEvent.ControllerNumber);
- GD.Print("Controller value: " + midiEvent.ControllerValue);
+ GD.Print($"Channel {midiEvent.Channel}");
+ GD.Print($"Message {midiEvent.Message}");
+ GD.Print($"Pitch {midiEvent.Pitch}");
+ GD.Print($"Velocity {midiEvent.Velocity}");
+ GD.Print($"Instrument {midiEvent.Instrument}");
+ GD.Print($"Pressure {midiEvent.Pressure}");
+ GD.Print($"Controller number: {midiEvent.ControllerNumber}");
+ GD.Print($"Controller value: {midiEvent.ControllerValue}");
}
[/csharp]
[/codeblocks]
diff --git a/doc/classes/MainLoop.xml b/doc/classes/MainLoop.xml
index 674adb1772..260efb0eab 100644
--- a/doc/classes/MainLoop.xml
+++ b/doc/classes/MainLoop.xml
@@ -29,29 +29,28 @@
[/gdscript]
[csharp]
using Godot;
- using System;
- public class CustomMainLoop : MainLoop
+ public partial class CustomMainLoop : MainLoop
{
- public float TimeElapsed = 0;
+ private double _timeElapsed = 0;
public override void _Initialize()
{
GD.Print("Initialized:");
- GD.Print($" Starting Time: {TimeElapsed}");
+ GD.Print($" Starting Time: {_timeElapsed}");
}
- public override bool _Process(float delta)
+ public override bool _Process(double delta)
{
- TimeElapsed += delta;
+ _timeElapsed += delta;
// Return true to end the main loop.
- return Input.GetMouseButtonMask() != 0 || Input.IsKeyPressed((int)KeyList.Escape);
+ return Input.GetMouseButtonMask() != 0 || Input.IsKeyPressed(Key.Escape);
}
private void _Finalize()
{
GD.Print("Finalized:");
- GD.Print($" End Time: {TimeElapsed}");
+ GD.Print($" End Time: {_timeElapsed}");
}
}
[/csharp]
diff --git a/doc/classes/MultiplayerAPIExtension.xml b/doc/classes/MultiplayerAPIExtension.xml
index c4012a920a..b853c32407 100644
--- a/doc/classes/MultiplayerAPIExtension.xml
+++ b/doc/classes/MultiplayerAPIExtension.xml
@@ -99,7 +99,7 @@
</description>
</method>
<method name="_object_configuration_add" qualifiers="virtual">
- <return type="int" />
+ <return type="int" enum="Error" />
<param index="0" name="object" type="Object" />
<param index="1" name="configuration" type="Variant" />
<description>
@@ -107,7 +107,7 @@
</description>
</method>
<method name="_object_configuration_remove" qualifiers="virtual">
- <return type="int" />
+ <return type="int" enum="Error" />
<param index="0" name="object" type="Object" />
<param index="1" name="configuration" type="Variant" />
<description>
@@ -115,13 +115,13 @@
</description>
</method>
<method name="_poll" qualifiers="virtual">
- <return type="int" />
+ <return type="int" enum="Error" />
<description>
Callback for [method MultiplayerAPI.poll].
</description>
</method>
<method name="_rpc" qualifiers="virtual">
- <return type="int" />
+ <return type="int" enum="Error" />
<param index="0" name="peer" type="int" />
<param index="1" name="object" type="Object" />
<param index="2" name="method" type="StringName" />
diff --git a/doc/classes/NavigationAgent2D.xml b/doc/classes/NavigationAgent2D.xml
index 6ae4dc4177..92fd8bcc6a 100644
--- a/doc/classes/NavigationAgent2D.xml
+++ b/doc/classes/NavigationAgent2D.xml
@@ -111,6 +111,21 @@
<member name="avoidance_enabled" type="bool" setter="set_avoidance_enabled" getter="get_avoidance_enabled" default="false">
If [code]true[/code] the agent is registered for an RVO avoidance callback on the [NavigationServer2D]. When [method NavigationAgent2D.set_velocity] is used and the processing is completed a [code]safe_velocity[/code] Vector2 is received with a signal connection to [signal velocity_computed]. Avoidance processing with many registered agents has a significant performance cost and should only be enabled on agents that currently require it.
</member>
+ <member name="debug_enabled" type="bool" setter="set_debug_enabled" getter="get_debug_enabled" default="false">
+ If [code]true[/code] shows debug visuals for this agent.
+ </member>
+ <member name="debug_path_custom_color" type="Color" setter="set_debug_path_custom_color" getter="get_debug_path_custom_color" default="Color(1, 1, 1, 1)">
+ If [member debug_use_custom] is [code]true[/code] uses this color for this agent instead of global color.
+ </member>
+ <member name="debug_path_custom_line_width" type="float" setter="set_debug_path_custom_line_width" getter="get_debug_path_custom_line_width" default="1.0">
+ If [member debug_use_custom] is [code]true[/code] uses this line width for rendering paths for this agent instead of global line width.
+ </member>
+ <member name="debug_path_custom_point_size" type="float" setter="set_debug_path_custom_point_size" getter="get_debug_path_custom_point_size" default="4.0">
+ If [member debug_use_custom] is [code]true[/code] uses this rasterized point size for rendering path points for this agent instead of global point size.
+ </member>
+ <member name="debug_use_custom" type="bool" setter="set_debug_use_custom" getter="get_debug_use_custom" default="false">
+ If [code]true[/code] uses the defined [member debug_path_custom_color] for this agent instead of global color.
+ </member>
<member name="max_neighbors" type="int" setter="set_max_neighbors" getter="get_max_neighbors" default="10">
The maximum number of neighbors for the agent to consider.
</member>
diff --git a/doc/classes/NavigationAgent3D.xml b/doc/classes/NavigationAgent3D.xml
index a22cd6dd46..0ed11bc477 100644
--- a/doc/classes/NavigationAgent3D.xml
+++ b/doc/classes/NavigationAgent3D.xml
@@ -114,6 +114,18 @@
<member name="avoidance_enabled" type="bool" setter="set_avoidance_enabled" getter="get_avoidance_enabled" default="false">
If [code]true[/code] the agent is registered for an RVO avoidance callback on the [NavigationServer3D]. When [method NavigationAgent3D.set_velocity] is used and the processing is completed a [code]safe_velocity[/code] Vector3 is received with a signal connection to [signal velocity_computed]. Avoidance processing with many registered agents has a significant performance cost and should only be enabled on agents that currently require it.
</member>
+ <member name="debug_enabled" type="bool" setter="set_debug_enabled" getter="get_debug_enabled" default="false">
+ If [code]true[/code] shows debug visuals for this agent.
+ </member>
+ <member name="debug_path_custom_color" type="Color" setter="set_debug_path_custom_color" getter="get_debug_path_custom_color" default="Color(1, 1, 1, 1)">
+ If [member debug_use_custom] is [code]true[/code] uses this color for this agent instead of global color.
+ </member>
+ <member name="debug_path_custom_point_size" type="float" setter="set_debug_path_custom_point_size" getter="get_debug_path_custom_point_size" default="4.0">
+ If [member debug_use_custom] is [code]true[/code] uses this rasterized point size for rendering path points for this agent instead of global point size.
+ </member>
+ <member name="debug_use_custom" type="bool" setter="set_debug_use_custom" getter="get_debug_use_custom" default="false">
+ If [code]true[/code] uses the defined [member debug_path_custom_color] for this agent instead of global color.
+ </member>
<member name="ignore_y" type="bool" setter="set_ignore_y" getter="get_ignore_y" default="true">
Ignores collisions on the Y axis. Must be true to move on a horizontal plane.
</member>
diff --git a/doc/classes/NavigationServer2D.xml b/doc/classes/NavigationServer2D.xml
index 16f6de5238..7270a19b4d 100644
--- a/doc/classes/NavigationServer2D.xml
+++ b/doc/classes/NavigationServer2D.xml
@@ -528,5 +528,10 @@
Emitted when a navigation map is updated, when a region moves or is modified.
</description>
</signal>
+ <signal name="navigation_debug_changed">
+ <description>
+ Emitted when navigation debug settings are changed. Only available in debug builds.
+ </description>
+ </signal>
</signals>
</class>
diff --git a/doc/classes/OS.xml b/doc/classes/OS.xml
index 04895c28a8..ca090d596e 100644
--- a/doc/classes/OS.xml
+++ b/doc/classes/OS.xml
@@ -553,11 +553,11 @@
[b]Note:[/b] If the user has disabled the recycle bin on their system, the file will be permanently deleted instead.
[codeblocks]
[gdscript]
- var file_to_remove = "user://slot1.sav"
+ var file_to_remove = "user://slot1.save"
OS.move_to_trash(ProjectSettings.globalize_path(file_to_remove))
[/gdscript]
[csharp]
- var fileToRemove = "user://slot1.sav";
+ var fileToRemove = "user://slot1.save";
OS.MoveToTrash(ProjectSettings.GlobalizePath(fileToRemove));
[/csharp]
[/codeblocks]
diff --git a/doc/classes/Object.xml b/doc/classes/Object.xml
index e4607456ca..e30ff6be19 100644
--- a/doc/classes/Object.xml
+++ b/doc/classes/Object.xml
@@ -110,7 +110,7 @@
[/gdscript]
[csharp]
[Tool]
- public class MyNode2D : Node2D
+ public partial class MyNode2D : Node2D
{
private bool _holdingHammer;
@@ -433,9 +433,9 @@
var button = new Button();
// Option 1: In C#, we can use signals as events and connect with this idiomatic syntax:
button.ButtonDown += OnButtonDown;
- // Option 2: Object.Connect() with a constructed Callable from a method group.
+ // Option 2: GodotObject.Connect() with a constructed Callable from a method group.
button.Connect(Button.SignalName.ButtonDown, Callable.From(OnButtonDown));
- // Option 3: Object.Connect() with a constructed Callable using a target object and method name.
+ // Option 3: GodotObject.Connect() with a constructed Callable using a target object and method name.
button.Connect(Button.SignalName.ButtonDown, new Callable(this, MethodName.OnButtonDown));
}
@@ -700,10 +700,10 @@
sprite2d.is_class("Node3D") # Returns false
[/gdscript]
[csharp]
- var sprite2d = new Sprite2D();
- sprite2d.IsClass("Sprite2D"); // Returns true
- sprite2d.IsClass("Node"); // Returns true
- sprite2d.IsClass("Node3D"); // Returns false
+ var sprite2D = new Sprite2D();
+ sprite2D.IsClass("Sprite2D"); // Returns true
+ sprite2D.IsClass("Node"); // Returns true
+ sprite2D.IsClass("Node3D"); // Returns false
[/csharp]
[/codeblocks]
[b]Note:[/b] This method ignores [code]class_name[/code] declarations in the object's script.
@@ -747,10 +747,10 @@
player.SetScript(GD.Load("res://player.gd"));
player.Notification(NotificationEnterTree);
- // The call order is Object -&gt; Node -&gt; Node2D -&gt; player.gd.
+ // The call order is GodotObject -&gt; Node -&gt; Node2D -&gt; player.gd.
- player.notification(NotificationEnterTree, true);
- // The call order is player.gd -&gt; Node2D -&gt; Node -&gt; Object.
+ player.Notification(NotificationEnterTree, true);
+ // The call order is player.gd -&gt; Node2D -&gt; Node -&gt; GodotObject.
[/csharp]
[/codeblocks]
</description>
diff --git a/doc/classes/PackedScene.xml b/doc/classes/PackedScene.xml
index 7ca1d5d60d..493fc9e2a8 100644
--- a/doc/classes/PackedScene.xml
+++ b/doc/classes/PackedScene.xml
@@ -104,7 +104,7 @@
</method>
</methods>
<members>
- <member name="_bundled" type="Dictionary" setter="_set_bundled_scene" getter="_get_bundled_scene" default="{ &quot;conn_count&quot;: 0, &quot;conns&quot;: PackedInt32Array(), &quot;editable_instances&quot;: [], &quot;names&quot;: PackedStringArray(), &quot;node_count&quot;: 0, &quot;node_paths&quot;: [], &quot;nodes&quot;: PackedInt32Array(), &quot;variants&quot;: [], &quot;version&quot;: 2 }">
+ <member name="_bundled" type="Dictionary" setter="_set_bundled_scene" getter="_get_bundled_scene" default="{ &quot;conn_count&quot;: 0, &quot;conns&quot;: PackedInt32Array(), &quot;editable_instances&quot;: [], &quot;names&quot;: PackedStringArray(), &quot;node_count&quot;: 0, &quot;node_paths&quot;: [], &quot;nodes&quot;: PackedInt32Array(), &quot;variants&quot;: [], &quot;version&quot;: 3 }">
A dictionary representation of the scene contents.
Available keys include "rnames" and "variants" for resources, "node_count", "nodes", "node_paths" for nodes, "editable_instances" for base scene children overrides, "conn_count" and "conns" for signal connections, and "version" for the format style of the PackedScene.
</member>
diff --git a/doc/classes/PhysicsPointQueryParameters2D.xml b/doc/classes/PhysicsPointQueryParameters2D.xml
index 76dc816dab..15102830f8 100644
--- a/doc/classes/PhysicsPointQueryParameters2D.xml
+++ b/doc/classes/PhysicsPointQueryParameters2D.xml
@@ -11,6 +11,7 @@
<members>
<member name="canvas_instance_id" type="int" setter="set_canvas_instance_id" getter="get_canvas_instance_id" default="0">
If different from [code]0[/code], restricts the query to a specific canvas layer specified by its instance ID. See [method Object.get_instance_id].
+ If [code]0[/code], restricts the query to the Viewport's default canvas layer.
</member>
<member name="collide_with_areas" type="bool" setter="set_collide_with_areas" getter="is_collide_with_areas_enabled" default="false">
If [code]true[/code], the query will take [Area2D]s into account.
diff --git a/doc/classes/ProjectSettings.xml b/doc/classes/ProjectSettings.xml
index 95bd060fc6..e429759e93 100644
--- a/doc/classes/ProjectSettings.xml
+++ b/doc/classes/ProjectSettings.xml
@@ -528,9 +528,21 @@
<member name="debug/shapes/collision/shape_color" type="Color" setter="" getter="" default="Color(0, 0.6, 0.7, 0.42)">
Color of the collision shapes, visible when "Visible Collision Shapes" is enabled in the Debug menu.
</member>
+ <member name="debug/shapes/navigation/agent_path_color" type="Color" setter="" getter="" default="Color(1, 0, 0, 1)">
+ Color to display enabled navigation agent paths when an agent has debug enabled.
+ </member>
+ <member name="debug/shapes/navigation/agent_path_point_size" type="float" setter="" getter="" default="4.0">
+ Rasterized size (pixel) used to render navigation agent path points when an agent has debug enabled.
+ </member>
<member name="debug/shapes/navigation/edge_connection_color" type="Color" setter="" getter="" default="Color(1, 0, 1, 1)">
Color to display edge connections between navigation regions, visible when "Visible Navigation" is enabled in the Debug menu.
</member>
+ <member name="debug/shapes/navigation/enable_agent_paths" type="bool" setter="" getter="" default="true">
+ If enabled, displays navigation agent paths when an agent has debug enabled.
+ </member>
+ <member name="debug/shapes/navigation/enable_agent_paths_xray" type="bool" setter="" getter="" default="true">
+ If enabled, displays navigation agent paths through geometry when an agent has debug enabled.
+ </member>
<member name="debug/shapes/navigation/enable_edge_connections" type="bool" setter="" getter="" default="true">
If enabled, displays edge connections between navigation regions when "Visible Navigation" is enabled in the Debug menu.
</member>
@@ -1743,7 +1755,7 @@
[/gdscript]
[csharp]
// Set the default gravity strength to 980.
- PhysicsServer2D.AreaSetParam(GetViewport().FindWorld2d().Space, PhysicsServer2D.AreaParameter.Gravity, 980);
+ PhysicsServer2D.AreaSetParam(GetViewport().FindWorld2D().Space, PhysicsServer2D.AreaParameter.Gravity, 980);
[/csharp]
[/codeblocks]
</member>
@@ -1757,7 +1769,7 @@
[/gdscript]
[csharp]
// Set the default gravity direction to `Vector2(0, 1)`.
- PhysicsServer2D.AreaSetParam(GetViewport().FindWorld2d().Space, PhysicsServer2D.AreaParameter.GravityVector, Vector2.Down)
+ PhysicsServer2D.AreaSetParam(GetViewport().FindWorld2D().Space, PhysicsServer2D.AreaParameter.GravityVector, Vector2.Down)
[/csharp]
[/codeblocks]
</member>
diff --git a/doc/classes/ReflectionProbe.xml b/doc/classes/ReflectionProbe.xml
index fee48dd246..fa0b1ab00b 100644
--- a/doc/classes/ReflectionProbe.xml
+++ b/doc/classes/ReflectionProbe.xml
@@ -13,13 +13,13 @@
</tutorials>
<members>
<member name="ambient_color" type="Color" setter="set_ambient_color" getter="get_ambient_color" default="Color(0, 0, 0, 1)">
- The custom ambient color to use within the [ReflectionProbe]'s [member extents]. Only effective if [member ambient_mode] is [constant AMBIENT_COLOR].
+ The custom ambient color to use within the [ReflectionProbe]'s [member size]. Only effective if [member ambient_mode] is [constant AMBIENT_COLOR].
</member>
<member name="ambient_color_energy" type="float" setter="set_ambient_color_energy" getter="get_ambient_color_energy" default="1.0">
- The custom ambient color energy to use within the [ReflectionProbe]'s [member extents]. Only effective if [member ambient_mode] is [constant AMBIENT_COLOR].
+ The custom ambient color energy to use within the [ReflectionProbe]'s [member size]. Only effective if [member ambient_mode] is [constant AMBIENT_COLOR].
</member>
<member name="ambient_mode" type="int" setter="set_ambient_mode" getter="get_ambient_mode" enum="ReflectionProbe.AmbientMode" default="1">
- The ambient color to use within the [ReflectionProbe]'s [member extents]. The ambient color will smoothly blend with other [ReflectionProbe]s and the rest of the scene (outside the [ReflectionProbe]'s [member extents]).
+ The ambient color to use within the [ReflectionProbe]'s [member size]. The ambient color will smoothly blend with other [ReflectionProbe]s and the rest of the scene (outside the [ReflectionProbe]'s [member size]).
</member>
<member name="box_projection" type="bool" setter="set_enable_box_projection" getter="is_box_projection_enabled" default="false">
If [code]true[/code], enables box projection. This makes reflections look more correct in rectangle-shaped rooms by offsetting the reflection center depending on the camera's location.
@@ -31,10 +31,6 @@
<member name="enable_shadows" type="bool" setter="set_enable_shadows" getter="are_shadows_enabled" default="false">
If [code]true[/code], computes shadows in the reflection probe. This makes the reflection probe slower to render; you may want to disable this if using the [constant UPDATE_ALWAYS] [member update_mode].
</member>
- <member name="extents" type="Vector3" setter="set_extents" getter="get_extents" default="Vector3(10, 10, 10)">
- The size of the reflection probe. The larger the extents, the more space covered by the probe, which will lower the perceived resolution. It is best to keep the extents only as large as you need them.
- [b]Note:[/b] To better fit areas that are not aligned to the grid, you can rotate the [ReflectionProbe] node.
- </member>
<member name="intensity" type="float" setter="set_intensity" getter="get_intensity" default="1.0">
Defines the reflection intensity. Intensity modulates the strength of the reflection.
</member>
@@ -43,7 +39,7 @@
</member>
<member name="max_distance" type="float" setter="set_max_distance" getter="get_max_distance" default="0.0">
The maximum distance away from the [ReflectionProbe] an object can be before it is culled. Decrease this to improve performance, especially when using the [constant UPDATE_ALWAYS] [member update_mode].
- [b]Note:[/b] The maximum reflection distance is always at least equal to the [member extents]. This means that decreasing [member max_distance] will not always cull objects from reflections, especially if the reflection probe's [member extents] are already large.
+ [b]Note:[/b] The maximum reflection distance is always at least equal to the probe's extents. This means that decreasing [member max_distance] will not always cull objects from reflections, especially if the reflection probe's [member size] is already large.
</member>
<member name="mesh_lod_threshold" type="float" setter="set_mesh_lod_threshold" getter="get_mesh_lod_threshold" default="1.0">
The automatic LOD bias to use for meshes rendered within the [ReflectionProbe] (this is analog to [member Viewport.mesh_lod_threshold]). Higher values will use less detailed versions of meshes that have LOD variations generated. If set to [code]0.0[/code], automatic LOD is disabled. Increase [member mesh_lod_threshold] to improve performance at the cost of geometry detail, especially when using the [constant UPDATE_ALWAYS] [member update_mode].
@@ -52,6 +48,10 @@
<member name="origin_offset" type="Vector3" setter="set_origin_offset" getter="get_origin_offset" default="Vector3(0, 0, 0)">
Sets the origin offset to be used when this [ReflectionProbe] is in [member box_projection] mode. This can be set to a non-zero value to ensure a reflection fits a rectangle-shaped room, while reducing the number of objects that "get in the way" of the reflection.
</member>
+ <member name="size" type="Vector3" setter="set_size" getter="get_size" default="Vector3(20, 20, 20)">
+ The size of the reflection probe. The larger the size, the more space covered by the probe, which will lower the perceived resolution. It is best to keep the size only as large as you need it.
+ [b]Note:[/b] To better fit areas that are not aligned to the grid, you can rotate the [ReflectionProbe] node.
+ </member>
<member name="update_mode" type="int" setter="set_update_mode" getter="get_update_mode" enum="ReflectionProbe.UpdateMode" default="0">
Sets how frequently the [ReflectionProbe] is updated. Can be [constant UPDATE_ONCE] or [constant UPDATE_ALWAYS].
</member>
@@ -64,13 +64,13 @@
Update the probe every frame. This provides better results for fast-moving dynamic objects (such as cars). However, it has a significant performance cost. Due to the cost, it's recommended to only use one ReflectionProbe with [constant UPDATE_ALWAYS] at most per scene. For all other use cases, use [constant UPDATE_ONCE].
</constant>
<constant name="AMBIENT_DISABLED" value="0" enum="AmbientMode">
- Do not apply any ambient lighting inside the [ReflectionProbe]'s [member extents].
+ Do not apply any ambient lighting inside the [ReflectionProbe]'s [member size].
</constant>
<constant name="AMBIENT_ENVIRONMENT" value="1" enum="AmbientMode">
- Apply automatically-sourced environment lighting inside the [ReflectionProbe]'s [member extents].
+ Apply automatically-sourced environment lighting inside the [ReflectionProbe]'s [member size].
</constant>
<constant name="AMBIENT_COLOR" value="2" enum="AmbientMode">
- Apply custom ambient lighting inside the [ReflectionProbe]'s [member extents]. See [member ambient_color] and [member ambient_color_energy].
+ Apply custom ambient lighting inside the [ReflectionProbe]'s [member size]. See [member ambient_color] and [member ambient_color_energy].
</constant>
</constants>
</class>
diff --git a/doc/classes/RenderingDevice.xml b/doc/classes/RenderingDevice.xml
index f318430611..82a2871949 100644
--- a/doc/classes/RenderingDevice.xml
+++ b/doc/classes/RenderingDevice.xml
@@ -1,8 +1,14 @@
<?xml version="1.0" encoding="UTF-8" ?>
<class name="RenderingDevice" inherits="Object" version="4.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../class.xsd">
<brief_description>
+ Abstraction for working with modern low-level graphics APIs.
</brief_description>
<description>
+ [RenderingDevice] is an abstraction for working with modern low-level graphics APIs such as Vulkan.
+ On startup, Godot creates a global [RenderingDevice] which can be retrieved using [method RenderingServer.get_rendering_device]. This global RenderingDevice performs drawing to the screen.
+ Internally, [RenderingDevice] is used in Godot to provide support for several modern low-level graphics APIs while reducing the amount of code duplication required.
+ [b]Local RenderingDevices:[/b] Using [method RenderingServer.create_local_rendering_device], you can create "secondary" rendering devices to perform drawing and GPU compute operations on separate threads.
+ [b]Note:[/b] [RenderingDevice] is not available when running in headless mode or when using the OpenGL renderer.
</description>
<tutorials>
</tutorials>
@@ -1162,20 +1168,28 @@
<constant name="BARRIER_MASK_NO_BARRIER" value="8" enum="BarrierMask" is_bitfield="true">
</constant>
<constant name="TEXTURE_TYPE_1D" value="0" enum="TextureType">
+ 1-dimensional texture.
</constant>
<constant name="TEXTURE_TYPE_2D" value="1" enum="TextureType">
+ 2-dimensional texture.
</constant>
<constant name="TEXTURE_TYPE_3D" value="2" enum="TextureType">
+ 3-dimensional texture.
</constant>
<constant name="TEXTURE_TYPE_CUBE" value="3" enum="TextureType">
+ [Cubemap] texture.
</constant>
<constant name="TEXTURE_TYPE_1D_ARRAY" value="4" enum="TextureType">
+ Array of 1-dimensional textures.
</constant>
<constant name="TEXTURE_TYPE_2D_ARRAY" value="5" enum="TextureType">
+ Array of 2-dimensional textures.
</constant>
<constant name="TEXTURE_TYPE_CUBE_ARRAY" value="6" enum="TextureType">
+ Array of [Cubemap] textures.
</constant>
<constant name="TEXTURE_TYPE_MAX" value="7" enum="TextureType">
+ Represents the size of the [enum TextureType] enum.
</constant>
<constant name="TEXTURE_SAMPLES_1" value="0" enum="TextureSamples">
</constant>
@@ -1192,6 +1206,7 @@
<constant name="TEXTURE_SAMPLES_64" value="6" enum="TextureSamples">
</constant>
<constant name="TEXTURE_SAMPLES_MAX" value="7" enum="TextureSamples">
+ Represents the size of the [enum TextureSamples] enum.
</constant>
<constant name="TEXTURE_USAGE_SAMPLING_BIT" value="1" enum="TextureUsageBits" is_bitfield="true">
</constant>
@@ -1236,8 +1251,10 @@
<constant name="TEXTURE_SLICE_3D" value="2" enum="TextureSliceType">
</constant>
<constant name="SAMPLER_FILTER_NEAREST" value="0" enum="SamplerFilter">
+ Nearest-neighbor sampler filtering. Sampling at higher resolutions than the source will result in a pixelated look.
</constant>
<constant name="SAMPLER_FILTER_LINEAR" value="1" enum="SamplerFilter">
+ Bilinear sampler filtering. Sampling at higher resolutions than the source will result in a blurry look.
</constant>
<constant name="SAMPLER_REPEAT_MODE_REPEAT" value="0" enum="SamplerRepeatMode">
</constant>
@@ -1298,8 +1315,10 @@
<constant name="UNIFORM_TYPE_MAX" value="10" enum="UniformType">
</constant>
<constant name="RENDER_PRIMITIVE_POINTS" value="0" enum="RenderPrimitive">
+ Point rendering primitive (with constant size, regardless of distance from camera).
</constant>
<constant name="RENDER_PRIMITIVE_LINES" value="1" enum="RenderPrimitive">
+ Line rendering primitive.
</constant>
<constant name="RENDER_PRIMITIVE_LINES_WITH_ADJACENCY" value="2" enum="RenderPrimitive">
</constant>
@@ -1380,6 +1399,7 @@
<constant name="LOGIC_OP_NO_OP" value="5" enum="LogicOperation">
</constant>
<constant name="LOGIC_OP_XOR" value="6" enum="LogicOperation">
+ Exclusive or (XOR) logic operation.
</constant>
<constant name="LOGIC_OP_OR" value="7" enum="LogicOperation">
</constant>
@@ -1442,16 +1462,22 @@
<constant name="BLEND_FACTOR_MAX" value="19" enum="BlendFactor">
</constant>
<constant name="BLEND_OP_ADD" value="0" enum="BlendOperation">
+ Additive blending operation ([code]source + destination[/code]).
</constant>
<constant name="BLEND_OP_SUBTRACT" value="1" enum="BlendOperation">
+ Subtractive blending operation ([code]source - destination[/code]).
</constant>
<constant name="BLEND_OP_REVERSE_SUBTRACT" value="2" enum="BlendOperation">
+ Reverse subtractive blending operation ([code]destination - source[/code]).
</constant>
<constant name="BLEND_OP_MINIMUM" value="3" enum="BlendOperation">
+ Minimum blending operation (keep the lowest value of the two).
</constant>
<constant name="BLEND_OP_MAXIMUM" value="4" enum="BlendOperation">
+ Maximum blending operation (keep the highest value of the two).
</constant>
<constant name="BLEND_OP_MAX" value="5" enum="BlendOperation">
+ Represents the size of the [enum BlendOperation] enum.
</constant>
<constant name="DYNAMIC_STATE_LINE_WIDTH" value="1" enum="PipelineDynamicStateFlags" is_bitfield="true">
</constant>
@@ -1544,12 +1570,16 @@
<constant name="LIMIT_MAX_TEXTURE_ARRAY_LAYERS" value="10" enum="Limit">
</constant>
<constant name="LIMIT_MAX_TEXTURE_SIZE_1D" value="11" enum="Limit">
+ Maximum supported 1-dimensional texture size (in pixels on a single axis).
</constant>
<constant name="LIMIT_MAX_TEXTURE_SIZE_2D" value="12" enum="Limit">
+ Maximum supported 2-dimensional texture size (in pixels on a single axis).
</constant>
<constant name="LIMIT_MAX_TEXTURE_SIZE_3D" value="13" enum="Limit">
+ Maximum supported 3-dimensional texture size (in pixels on a single axis).
</constant>
<constant name="LIMIT_MAX_TEXTURE_SIZE_CUBE" value="14" enum="Limit">
+ Maximum supported cubemap texture size (in pixels on a single axis of a single face).
</constant>
<constant name="LIMIT_MAX_TEXTURES_PER_SHADER_STAGE" value="15" enum="Limit">
</constant>
@@ -1596,14 +1626,19 @@
<constant name="LIMIT_MAX_VIEWPORT_DIMENSIONS_Y" value="36" enum="Limit">
</constant>
<constant name="MEMORY_TEXTURES" value="0" enum="MemoryType">
+ Memory taken by textures.
</constant>
<constant name="MEMORY_BUFFERS" value="1" enum="MemoryType">
+ Memory taken by buffers.
</constant>
<constant name="MEMORY_TOTAL" value="2" enum="MemoryType">
+ Total memory taken. This is greater than the sum of [constant MEMORY_TEXTURES] and [constant MEMORY_BUFFERS], as it also includes miscellaneous memory usage.
</constant>
<constant name="INVALID_ID" value="-1">
+ Returned by functions that return an ID if a value is invalid.
</constant>
<constant name="INVALID_FORMAT_ID" value="-1">
+ Returned by functions that return a format ID if a value is invalid.
</constant>
</constants>
</class>
diff --git a/doc/classes/RenderingServer.xml b/doc/classes/RenderingServer.xml
index 8bb3073000..4e3a1bc0ef 100644
--- a/doc/classes/RenderingServer.xml
+++ b/doc/classes/RenderingServer.xml
@@ -4,10 +4,10 @@
Server for anything visible.
</brief_description>
<description>
- Server for anything visible. The rendering server is the API backend for everything visible. The whole scene system mounts on it to display.
+ The rendering server is the API backend for everything visible. The whole scene system mounts on it to display.
The rendering server is completely opaque, the internals are entirely implementation specific and cannot be accessed.
- The rendering server can be used to bypass the scene system entirely.
- Resources are created using the [code]*_create[/code] functions.
+ The rendering server can be used to bypass the scene/[Node] system entirely.
+ Resources are created using the [code]*_create[/code] functions. These functions return [RID]s which are not references to the objects themselves, but opaque [i]pointers[/i] towards these objects.
All objects are drawn to a viewport. You can use the [Viewport] attached to the [SceneTree] or you can create one yourself with [method viewport_create]. When using a custom scenario or canvas, the scenario or canvas needs to be attached to the viewport using [method viewport_set_scenario] or [method viewport_attach_canvas].
In 3D, all visual objects must be associated with a scenario. The scenario is a visual representation of the world. If accessing the rendering server from a running game, the scenario can be accessed from the scene tree from any [Node3D] node with [method Node3D.get_world_3d]. Otherwise, a scenario can be created with [method scenario_create].
Similarly, in 2D, a canvas is needed to draw all canvas items.
@@ -25,6 +25,7 @@
<param index="1" name="material_overrides" type="RID[]" />
<param index="2" name="image_size" type="Vector2i" />
<description>
+ Bakes the material data of the Mesh passed in the [param base] parameter with optional [param material_overrides] to a set of [Image]s of size [param image_size]. Returns an array of [Image]s containing material properties as specified in [enum BakeChannels].
</description>
</method>
<method name="camera_attributes_create">
@@ -43,6 +44,7 @@
<param index="4" name="speed" type="float" />
<param index="5" name="scale" type="float" />
<description>
+ Sets the parameters to use with the auto-exposure effect. These parameters take on the same meaning as their counterparts in [CameraAttributes] and [CameraAttributesPractical].
</description>
</method>
<method name="camera_attributes_set_dof_blur">
@@ -56,12 +58,14 @@
<param index="6" name="near_transition" type="float" />
<param index="7" name="amount" type="float" />
<description>
+ Sets the parameters to use with the DOF blur effect. These parameters take on the same meaning as their counterparts in [CameraAttributesPractical].
</description>
</method>
<method name="camera_attributes_set_dof_blur_bokeh_shape">
<return type="void" />
<param index="0" name="shape" type="int" enum="RenderingServer.DOFBokehShape" />
<description>
+ Sets the shape of the DOF bokeh pattern. Different shapes may be used to achieve artistic effect, or to meet performance targets. For more detail on available options see [enum DOFBokehShape].
</description>
</method>
<method name="camera_attributes_set_dof_blur_quality">
@@ -69,6 +73,7 @@
<param index="0" name="quality" type="int" enum="RenderingServer.DOFBlurQuality" />
<param index="1" name="use_jitter" type="bool" />
<description>
+ Sets the quality level of the DOF blur effect to one of the options in [enum DOFBlurQuality]. [param use_jitter] can be used to jitter samples taken during the blur pass to hide artifacts at the cost of looking more fuzzy.
</description>
</method>
<method name="camera_attributes_set_exposure">
@@ -102,6 +107,7 @@
<param index="0" name="camera" type="RID" />
<param index="1" name="effects" type="RID" />
<description>
+ Sets the camera_attributes created with [method camera_attributes_create] to the given camera.
</description>
</method>
<method name="camera_set_cull_mask">
@@ -192,6 +198,7 @@
<param index="2" name="radius" type="float" />
<param index="3" name="color" type="Color" />
<description>
+ Draws a circle on the [CanvasItem] pointed to by the [param item] [RID]. See also [method CanvasItem.draw_circle].
</description>
</method>
<method name="canvas_item_add_clip_ignore">
@@ -199,6 +206,7 @@
<param index="0" name="item" type="RID" />
<param index="1" name="ignore" type="bool" />
<description>
+ If [param ignore] is [code]true[/code], ignore clipping on items drawn with this canvas item until this is called again with [param ignore] set to false.
</description>
</method>
<method name="canvas_item_add_lcd_texture_rect_region">
@@ -209,6 +217,7 @@
<param index="3" name="src_rect" type="Rect2" />
<param index="4" name="modulate" type="Color" />
<description>
+ See also [method CanvasItem.draw_lcd_texture_rect_region].
</description>
</method>
<method name="canvas_item_add_line">
@@ -220,6 +229,7 @@
<param index="4" name="width" type="float" default="-1.0" />
<param index="5" name="antialiased" type="bool" default="false" />
<description>
+ Draws a line on the [CanvasItem] pointed to by the [param item] [RID]. See also [method CanvasItem.draw_line].
</description>
</method>
<method name="canvas_item_add_mesh">
@@ -230,6 +240,7 @@
<param index="3" name="modulate" type="Color" default="Color(1, 1, 1, 1)" />
<param index="4" name="texture" type="RID" />
<description>
+ Draws a mesh created with [method mesh_create] with given [param transform], [param modulate] color, and [param texture]. This is used internally by [MeshInstance2D].
</description>
</method>
<method name="canvas_item_add_msdf_texture_rect_region">
@@ -243,6 +254,7 @@
<param index="6" name="px_range" type="float" default="1.0" />
<param index="7" name="scale" type="float" default="1.0" />
<description>
+ See also [method CanvasItem.draw_msdf_texture_rect_region].
</description>
</method>
<method name="canvas_item_add_multimesh">
@@ -251,6 +263,7 @@
<param index="1" name="mesh" type="RID" />
<param index="2" name="texture" type="RID" />
<description>
+ Draws a 2D [MultiMesh] on the [CanvasItem] pointed to by the [param item] [RID]. See also [method CanvasItem.draw_multimesh].
</description>
</method>
<method name="canvas_item_add_nine_patch">
@@ -266,6 +279,7 @@
<param index="8" name="draw_center" type="bool" default="true" />
<param index="9" name="modulate" type="Color" default="Color(1, 1, 1, 1)" />
<description>
+ Draws a nine-patch rectangle on the [CanvasItem] pointed to by the [param item] [RID].
</description>
</method>
<method name="canvas_item_add_particles">
@@ -274,6 +288,7 @@
<param index="1" name="particles" type="RID" />
<param index="2" name="texture" type="RID" />
<description>
+ Draws particles on the [CanvasItem] pointed to by the [param item] [RID].
</description>
</method>
<method name="canvas_item_add_polygon">
@@ -284,6 +299,7 @@
<param index="3" name="uvs" type="PackedVector2Array" default="PackedVector2Array()" />
<param index="4" name="texture" type="RID" />
<description>
+ Draws a 2D polygon on the [CanvasItem] pointed to by the [param item] [RID]. See also [method CanvasItem.draw_polygon].
</description>
</method>
<method name="canvas_item_add_polyline">
@@ -294,6 +310,7 @@
<param index="3" name="width" type="float" default="-1.0" />
<param index="4" name="antialiased" type="bool" default="false" />
<description>
+ Draws a 2D polyline on the [CanvasItem] pointed to by the [param item] [RID]. See also [method CanvasItem.draw_polyline].
</description>
</method>
<method name="canvas_item_add_primitive">
@@ -304,6 +321,7 @@
<param index="3" name="uvs" type="PackedVector2Array" />
<param index="4" name="texture" type="RID" />
<description>
+ Draws a 2D primitive on the [CanvasItem] pointed to by the [param item] [RID]. See also [method CanvasItem.draw_primitive].
</description>
</method>
<method name="canvas_item_add_rect">
@@ -312,6 +330,7 @@
<param index="1" name="rect" type="Rect2" />
<param index="2" name="color" type="Color" />
<description>
+ Draws a rectangle on the [CanvasItem] pointed to by the [param item] [RID]. See also [method CanvasItem.draw_rect].
</description>
</method>
<method name="canvas_item_add_set_transform">
@@ -319,6 +338,7 @@
<param index="0" name="item" type="RID" />
<param index="1" name="transform" type="Transform2D" />
<description>
+ Sets a [Transform2D] that will be used to transform subsequent canvas item commands.
</description>
</method>
<method name="canvas_item_add_texture_rect">
@@ -368,6 +388,7 @@
<method name="canvas_item_create">
<return type="RID" />
<description>
+ Creates a new [CanvasItem] instance and returns its [RID].
</description>
</method>
<method name="canvas_item_set_canvas_group_mode">
@@ -877,13 +898,6 @@
<description>
</description>
</method>
- <method name="decal_set_extents">
- <return type="void" />
- <param index="0" name="decal" type="RID" />
- <param index="1" name="extents" type="Vector3" />
- <description>
- </description>
- </method>
<method name="decal_set_fade">
<return type="void" />
<param index="0" name="decal" type="RID" />
@@ -906,6 +920,13 @@
<description>
</description>
</method>
+ <method name="decal_set_size">
+ <return type="void" />
+ <param index="0" name="decal" type="RID" />
+ <param index="1" name="size" type="Vector3" />
+ <description>
+ </description>
+ </method>
<method name="decal_set_texture">
<return type="void" />
<param index="0" name="decal" type="RID" />
@@ -1218,14 +1239,6 @@
Creates a new fog volume and allocates an RID.
</description>
</method>
- <method name="fog_volume_set_extents">
- <return type="void" />
- <param index="0" name="fog_volume" type="RID" />
- <param index="1" name="extents" type="Vector3" />
- <description>
- Sets the size of the fog volume when shape is [constant RenderingServer.FOG_VOLUME_SHAPE_ELLIPSOID], [constant RenderingServer.FOG_VOLUME_SHAPE_CONE], [constant RenderingServer.FOG_VOLUME_SHAPE_CYLINDER] or [constant RenderingServer.FOG_VOLUME_SHAPE_BOX].
- </description>
- </method>
<method name="fog_volume_set_material">
<return type="void" />
<param index="0" name="fog_volume" type="RID" />
@@ -1242,6 +1255,14 @@
Sets the shape of the fog volume to either [constant RenderingServer.FOG_VOLUME_SHAPE_ELLIPSOID], [constant RenderingServer.FOG_VOLUME_SHAPE_CONE], [constant RenderingServer.FOG_VOLUME_SHAPE_CYLINDER], [constant RenderingServer.FOG_VOLUME_SHAPE_BOX] or [constant RenderingServer.FOG_VOLUME_SHAPE_WORLD].
</description>
</method>
+ <method name="fog_volume_set_size">
+ <return type="void" />
+ <param index="0" name="fog_volume" type="RID" />
+ <param index="1" name="size" type="Vector3" />
+ <description>
+ Sets the size of the fog volume when shape is [constant RenderingServer.FOG_VOLUME_SHAPE_ELLIPSOID], [constant RenderingServer.FOG_VOLUME_SHAPE_CONE], [constant RenderingServer.FOG_VOLUME_SHAPE_CYLINDER] or [constant RenderingServer.FOG_VOLUME_SHAPE_BOX].
+ </description>
+ </method>
<method name="force_draw">
<return type="void" />
<param index="0" name="swap_buffers" type="bool" default="true" />
@@ -1792,6 +1813,7 @@
<method name="lightmap_create">
<return type="RID" />
<description>
+ Creates a new [LightmapGI] instance.
</description>
</method>
<method name="lightmap_get_probe_capture_bsp_tree" qualifiers="const">
@@ -2655,14 +2677,6 @@
If [code]true[/code], computes shadows in the reflection probe. This makes the reflection much slower to compute. Equivalent to [member ReflectionProbe.enable_shadows].
</description>
</method>
- <method name="reflection_probe_set_extents">
- <return type="void" />
- <param index="0" name="probe" type="RID" />
- <param index="1" name="extents" type="Vector3" />
- <description>
- Sets the size of the area that the reflection probe will capture. Equivalent to [member ReflectionProbe.extents].
- </description>
- </method>
<method name="reflection_probe_set_intensity">
<return type="void" />
<param index="0" name="probe" type="RID" />
@@ -2701,6 +2715,14 @@
<description>
</description>
</method>
+ <method name="reflection_probe_set_size">
+ <return type="void" />
+ <param index="0" name="probe" type="RID" />
+ <param index="1" name="size" type="Vector3" />
+ <description>
+ Sets the size of the area that the reflection probe will capture. Equivalent to [member ReflectionProbe.size].
+ </description>
+ </method>
<method name="reflection_probe_set_update_mode">
<return type="void" />
<param index="0" name="probe" type="RID" />
@@ -3250,7 +3272,7 @@
<param index="0" name="viewport" type="RID" />
<param index="1" name="mode" type="int" enum="RenderingServer.ViewportEnvironmentMode" />
<description>
- Sets the viewport's environment mode which allows enabling or disabling rendering of 3D environment over 2D canvas. When disabled, 2D will not be affected by the environment. When enabled, 2D will be affected by the environment if the environment background mode is [constant ENV_BG_CANVAS]. The default behaviour is to inherit the setting from the viewport's parent. If the topmost parent is also set to [constant VIEWPORT_ENVIRONMENT_INHERIT], then the behavior will be the same as if it was set to [constant VIEWPORT_ENVIRONMENT_ENABLED].
+ Sets the viewport's environment mode which allows enabling or disabling rendering of 3D environment over 2D canvas. When disabled, 2D will not be affected by the environment. When enabled, 2D will be affected by the environment if the environment background mode is [constant ENV_BG_CANVAS]. The default behavior is to inherit the setting from the viewport's parent. If the topmost parent is also set to [constant VIEWPORT_ENVIRONMENT_INHERIT], then the behavior will be the same as if it was set to [constant VIEWPORT_ENVIRONMENT_ENABLED].
</description>
</method>
<method name="viewport_set_fsr_sharpness">
@@ -4091,10 +4113,10 @@
[FogVolume] will be shaped like an ellipsoid (stretched sphere).
</constant>
<constant name="FOG_VOLUME_SHAPE_CONE" value="1" enum="FogVolumeShape">
- [FogVolume] will be shaped like a cone pointing upwards (in local coordinates). The cone's angle is set automatically to fill the extents. The cone will be adjusted to fit within the extents. Rotate the [FogVolume] node to reorient the cone. Non-uniform scaling via extents is not supported (scale the [FogVolume] node instead).
+ [FogVolume] will be shaped like a cone pointing upwards (in local coordinates). The cone's angle is set automatically to fill the size. The cone will be adjusted to fit within the size. Rotate the [FogVolume] node to reorient the cone. Non-uniform scaling via size is not supported (scale the [FogVolume] node instead).
</constant>
<constant name="FOG_VOLUME_SHAPE_CYLINDER" value="2" enum="FogVolumeShape">
- [FogVolume] will be shaped like an upright cylinder (in local coordinates). Rotate the [FogVolume] node to reorient the cylinder. The cylinder will be adjusted to fit within the extents. Non-uniform scaling via extents is not supported (scale the [FogVolume] node instead).
+ [FogVolume] will be shaped like an upright cylinder (in local coordinates). Rotate the [FogVolume] node to reorient the cylinder. The cylinder will be adjusted to fit within the size. Non-uniform scaling via size is not supported (scale the [FogVolume] node instead).
</constant>
<constant name="FOG_VOLUME_SHAPE_BOX" value="3" enum="FogVolumeShape">
[FogVolume] will be shaped like a box.
@@ -4565,12 +4587,16 @@
Fade-in the given instance's dependencies when reaching its visibility range limits.
</constant>
<constant name="BAKE_CHANNEL_ALBEDO_ALPHA" value="0" enum="BakeChannels">
+ Index of [Image] in array of [Image]s returned by [method bake_render_uv2]. Image uses [constant Image.FORMAT_RGBA8] and contains albedo color in the [code].rgb[/code] channels and alpha in the [code].a[/code] channel.
</constant>
<constant name="BAKE_CHANNEL_NORMAL" value="1" enum="BakeChannels">
+ Index of [Image] in array of [Image]s returned by [method bake_render_uv2]. Image uses [constant Image.FORMAT_RGBA8] and contains the per-pixel normal of the object in the [code].rgb[/code] channels and nothing in the [code].a[/code] channel. The per-pixel normal is encoded as [code]normal * 0.5 + 0.5[/code].
</constant>
<constant name="BAKE_CHANNEL_ORM" value="2" enum="BakeChannels">
+ Index of [Image] in array of [Image]s returned by [method bake_render_uv2]. Image uses [constant Image.FORMAT_RGBA8] and contains ambient occlusion (from material and decals only) in the [code].r[/code] channel, roughness in the [code].g[/code] channel, metallic in the [code].b[/code] channel and sub surface scattering amount in the [code].a[/code] channel.
</constant>
<constant name="BAKE_CHANNEL_EMISSION" value="3" enum="BakeChannels">
+ Index of [Image] in array of [Image]s returned by [method bake_render_uv2]. Image uses [constant Image.FORMAT_RGBAH] and contains emission color in the [code].rgb[/code] channels and nothing in the [code].a[/code] channel.
</constant>
<constant name="CANVAS_TEXTURE_CHANNEL_DIFFUSE" value="0" enum="CanvasTextureChannel">
</constant>
diff --git a/doc/classes/ResourceFormatLoader.xml b/doc/classes/ResourceFormatLoader.xml
index bb55123b37..1d509d2938 100644
--- a/doc/classes/ResourceFormatLoader.xml
+++ b/doc/classes/ResourceFormatLoader.xml
@@ -88,7 +88,7 @@
</description>
</method>
<method name="_rename_dependencies" qualifiers="virtual const">
- <return type="int" />
+ <return type="int" enum="Error" />
<param index="0" name="path" type="String" />
<param index="1" name="renames" type="Dictionary" />
<description>
diff --git a/doc/classes/ResourceFormatSaver.xml b/doc/classes/ResourceFormatSaver.xml
index b0c57bc7cb..7e8e2ec67d 100644
--- a/doc/classes/ResourceFormatSaver.xml
+++ b/doc/classes/ResourceFormatSaver.xml
@@ -34,7 +34,7 @@
</description>
</method>
<method name="_save" qualifiers="virtual">
- <return type="int" />
+ <return type="int" enum="Error" />
<param index="0" name="resource" type="Resource" />
<param index="1" name="path" type="String" />
<param index="2" name="flags" type="int" />
diff --git a/doc/classes/RichTextEffect.xml b/doc/classes/RichTextEffect.xml
index c01546524d..333d34d1b7 100644
--- a/doc/classes/RichTextEffect.xml
+++ b/doc/classes/RichTextEffect.xml
@@ -13,7 +13,7 @@
[/gdscript]
[csharp]
// The RichTextEffect will be usable like this: `[example]Some text[/example]`
- public string bbcode = "example";
+ string bbcode = "example";
[/csharp]
[/codeblocks]
[b]Note:[/b] As soon as a [RichTextLabel] contains at least one [RichTextEffect], it will continuously process the effect unless the project is paused. This may impact battery life negatively.
diff --git a/doc/classes/SceneTree.xml b/doc/classes/SceneTree.xml
index bf19ebc23a..6adb37a3f7 100644
--- a/doc/classes/SceneTree.xml
+++ b/doc/classes/SceneTree.xml
@@ -74,10 +74,10 @@
print("end")
[/gdscript]
[csharp]
- public async void SomeFunction()
+ public async Task SomeFunction()
{
GD.Print("start");
- await ToSignal(GetTree().CreateTimer(1.0f), "timeout");
+ await ToSignal(GetTree().CreateTimer(1.0f), SceneTreeTimer.SignalName.Timeout);
GD.Print("end");
}
[/csharp]
diff --git a/doc/classes/SceneTreeTimer.xml b/doc/classes/SceneTreeTimer.xml
index f28e65c5bf..42b070d7d9 100644
--- a/doc/classes/SceneTreeTimer.xml
+++ b/doc/classes/SceneTreeTimer.xml
@@ -14,10 +14,10 @@
print("Timer ended.")
[/gdscript]
[csharp]
- public async void SomeFunction()
+ public async Task SomeFunction()
{
GD.Print("Timer started.");
- await ToSignal(GetTree().CreateTimer(1.0f), "timeout");
+ await ToSignal(GetTree().CreateTimer(1.0f), SceneTreeTimer.SignalName.Timeout);
GD.Print("Timer ended.");
}
[/csharp]
diff --git a/doc/classes/Sprite2D.xml b/doc/classes/Sprite2D.xml
index 235fef0bdd..033dbf51f3 100644
--- a/doc/classes/Sprite2D.xml
+++ b/doc/classes/Sprite2D.xml
@@ -23,11 +23,11 @@
print("A click!")
[/gdscript]
[csharp]
- public override void _Input(InputEvent inputEvent)
+ public override void _Input(InputEvent @event)
{
- if (inputEvent is InputEventMouseButton inputEventMouse)
+ if (@event is InputEventMouseButton inputEventMouse)
{
- if (inputEventMouse.Pressed &amp;&amp; inputEventMouse.ButtonIndex == (int)ButtonList.Left)
+ if (inputEventMouse.Pressed &amp;&amp; inputEventMouse.ButtonIndex == MouseButton.Left)
{
if (GetRect().HasPoint(ToLocal(inputEventMouse.Position)))
{
diff --git a/doc/classes/StreamPeer.xml b/doc/classes/StreamPeer.xml
index f05b5f7dbf..969cbac57d 100644
--- a/doc/classes/StreamPeer.xml
+++ b/doc/classes/StreamPeer.xml
@@ -223,7 +223,7 @@
put_data("Hello world".to_utf8())
[/gdscript]
[csharp]
- PutData("Hello World".ToUTF8());
+ PutData("Hello World".ToUtf8());
[/csharp]
[/codeblocks]
</description>
diff --git a/doc/classes/SubViewport.xml b/doc/classes/SubViewport.xml
index 7020cae1de..bb76a82ef3 100644
--- a/doc/classes/SubViewport.xml
+++ b/doc/classes/SubViewport.xml
@@ -26,6 +26,7 @@
</member>
<member name="size" type="Vector2i" setter="set_size" getter="get_size" default="Vector2i(512, 512)">
The width and height of the sub-viewport. Must be set to a value greater than or equal to 2 pixels on both dimensions. Otherwise, nothing will be displayed.
+ [b]Note:[/b] If the parent node is a [SubViewportContainer] and its [member SubViewportContainer.stretch] is [code]true[/code], the viewport size cannot be changed manually.
</member>
<member name="size_2d_override" type="Vector2i" setter="set_size_2d_override" getter="get_size_2d_override" default="Vector2i(0, 0)">
The 2D size override of the sub-viewport. If either the width or height is [code]0[/code], the override is disabled.
diff --git a/doc/classes/SubViewportContainer.xml b/doc/classes/SubViewportContainer.xml
index 77aa7e3ff4..11137222a9 100644
--- a/doc/classes/SubViewportContainer.xml
+++ b/doc/classes/SubViewportContainer.xml
@@ -13,6 +13,7 @@
<members>
<member name="stretch" type="bool" setter="set_stretch" getter="is_stretch_enabled" default="false">
If [code]true[/code], the sub-viewport will be automatically resized to the control's size.
+ [b]Note:[/b] If [code]true[/code], this will prohibit changing [member SubViewport.size] of its children manually.
</member>
<member name="stretch_shrink" type="int" setter="set_stretch_shrink" getter="get_stretch_shrink" default="1">
Divides the sub-viewport's effective resolution by this value while preserving its scale. This can be used to speed up rendering.
diff --git a/doc/classes/TileMap.xml b/doc/classes/TileMap.xml
index c387bd435b..c116939bd8 100644
--- a/doc/classes/TileMap.xml
+++ b/doc/classes/TileMap.xml
@@ -205,7 +205,7 @@
<param index="2" name="atlas_coords" type="Vector2i" default="Vector2i(-1, -1)" />
<param index="3" name="alternative_tile" type="int" default="-1" />
<description>
- Returns a [Vector2i] array with the positions of all cells containing a tile in the given layer. Tiles may be filtered according to their source ([param source_id]), their atlas coordinates ([param atlas_coords]) or alternative id ([param source_id]).
+ Returns a [Vector2i] array with the positions of all cells containing a tile in the given layer. Tiles may be filtered according to their source ([param source_id]), their atlas coordinates ([param atlas_coords]) or alternative id ([param alternative_tile]).
If a parameter has it's value set to the default one, this parameter is not used to filter a cell. Thus, if all parameters have their respective default value, this method returns the same result as [method get_used_cells].
A cell is considered empty if its source identifier equals -1, its atlas coordinates identifiers is [code]Vector2(-1, -1)[/code] and its alternative identifier is -1.
</description>
diff --git a/doc/classes/Tree.xml b/doc/classes/Tree.xml
index cf28dafcc9..02a2789ea5 100644
--- a/doc/classes/Tree.xml
+++ b/doc/classes/Tree.xml
@@ -410,11 +410,6 @@
Emitted when an item is collapsed by a click on the folding arrow.
</description>
</signal>
- <signal name="item_custom_button_pressed">
- <description>
- Emitted when a custom button is pressed (i.e. in a [constant TreeItem.CELL_MODE_CUSTOM] mode cell).
- </description>
- </signal>
<signal name="item_edited">
<description>
Emitted when an item is edited.
diff --git a/doc/classes/Tween.xml b/doc/classes/Tween.xml
index 9bb92cf362..16e4ce3714 100644
--- a/doc/classes/Tween.xml
+++ b/doc/classes/Tween.xml
@@ -77,13 +77,13 @@
tween = create_tween()
[/gdscript]
[csharp]
- private Tween tween;
+ private Tween _tween;
public void Animate()
{
- if (tween != null)
- tween.Kill(); // Abort the previous animation
- tween = CreateTween();
+ if (_tween != null)
+ _tween.Kill(); // Abort the previous animation
+ _tween = CreateTween();
}
[/csharp]
[/codeblocks]
diff --git a/doc/classes/UDPServer.xml b/doc/classes/UDPServer.xml
index c3a3a49a80..8151ecb625 100644
--- a/doc/classes/UDPServer.xml
+++ b/doc/classes/UDPServer.xml
@@ -9,7 +9,8 @@
Below a small example of how it can be used:
[codeblocks]
[gdscript]
- class_name Server
+ # server_node.gd
+ class_name ServerNode
extends Node
var server := UDPServer.new()
@@ -34,35 +35,35 @@
pass # Do something with the connected peers.
[/gdscript]
[csharp]
+ // ServerNode.cs
using Godot;
- using System;
using System.Collections.Generic;
- public class Server : Node
+ public partial class ServerNode : Node
{
- public UDPServer Server = new UDPServer();
- public List&lt;PacketPeerUDP&gt; Peers = new List&lt;PacketPeerUDP&gt;();
+ private UdpServer _server = new UdpServer();
+ private List&lt;PacketPeerUdp&gt; _peers = new List&lt;PacketPeerUdp&gt;();
public override void _Ready()
{
- Server.Listen(4242);
+ _server.Listen(4242);
}
- public override void _Process(float delta)
+ public override void _Process(double delta)
{
- Server.Poll(); // Important!
- if (Server.IsConnectionAvailable())
+ _server.Poll(); // Important!
+ if (_server.IsConnectionAvailable())
{
- PacketPeerUDP peer = Server.TakeConnection();
+ PacketPeerUdp peer = _server.TakeConnection();
byte[] packet = peer.GetPacket();
- GD.Print($"Accepted Peer: {peer.GetPacketIp()}:{peer.GetPacketPort()}");
- GD.Print($"Received Data: {packet.GetStringFromUTF8()}");
+ GD.Print($"Accepted Peer: {peer.GetPacketIP()}:{peer.GetPacketPort()}");
+ GD.Print($"Received Data: {packet.GetStringFromUtf8()}");
// Reply so it knows we received the message.
peer.PutPacket(packet);
// Keep a reference so we can keep contacting the remote peer.
- Peers.Add(peer);
+ _peers.Add(peer);
}
- foreach (var peer in Peers)
+ foreach (var peer in _peers)
{
// Do something with the peers.
}
@@ -72,7 +73,8 @@
[/codeblocks]
[codeblocks]
[gdscript]
- class_name Client
+ # client_node.gd
+ class_name ClientNode
extends Node
var udp := PacketPeerUDP.new()
@@ -90,30 +92,30 @@
connected = true
[/gdscript]
[csharp]
+ // ClientNode.cs
using Godot;
- using System;
- public class Client : Node
+ public partial class ClientNode : Node
{
- public PacketPeerUDP Udp = new PacketPeerUDP();
- public bool Connected = false;
+ private PacketPeerUdp _udp = new PacketPeerUdp();
+ private bool _connected = false;
public override void _Ready()
{
- Udp.ConnectToHost("127.0.0.1", 4242);
+ _udp.ConnectToHost("127.0.0.1", 4242);
}
- public override void _Process(float delta)
+ public override void _Process(double delta)
{
- if (!Connected)
+ if (!_connected)
{
// Try to contact server
- Udp.PutPacket("The Answer Is..42!".ToUTF8());
+ _udp.PutPacket("The Answer Is..42!".ToUtf8());
}
- if (Udp.GetAvailablePacketCount() &gt; 0)
+ if (_udp.GetAvailablePacketCount() &gt; 0)
{
- GD.Print($"Connected: {Udp.GetPacket().GetStringFromUTF8()}");
- Connected = true;
+ GD.Print($"Connected: {_udp.GetPacket().GetStringFromUtf8()}");
+ _connected = true;
}
}
}
diff --git a/doc/classes/UndoRedo.xml b/doc/classes/UndoRedo.xml
index 6c151ef958..e43bceb941 100644
--- a/doc/classes/UndoRedo.xml
+++ b/doc/classes/UndoRedo.xml
@@ -27,11 +27,11 @@
undo_redo.commit_action()
[/gdscript]
[csharp]
- public UndoRedo UndoRedo;
+ private UndoRedo _undoRedo;
public override void _Ready()
{
- UndoRedo = GetUndoRedo(); // Method of EditorPlugin.
+ _undoRedo = GetUndoRedo(); // Method of EditorPlugin.
}
public void DoSomething()
@@ -47,12 +47,12 @@
private void OnMyButtonPressed()
{
var node = GetNode&lt;Node2D&gt;("MyNode2D");
- UndoRedo.CreateAction("Move the node");
- UndoRedo.AddDoMethod(this, MethodName.DoSomething);
- UndoRedo.AddUndoMethod(this, MethodName.UndoSomething);
- UndoRedo.AddDoProperty(node, Node2D.PropertyName.Position, new Vector2(100, 100));
- UndoRedo.AddUndoProperty(node, Node2D.PropertyName.Position, node.Position);
- UndoRedo.CommitAction();
+ _undoRedo.CreateAction("Move the node");
+ _undoRedo.AddDoMethod(new Callable(this, MethodName.DoSomething));
+ _undoRedo.AddUndoMethod(new Callable(this, MethodName.UndoSomething));
+ _undoRedo.AddDoProperty(node, "position", new Vector2(100, 100));
+ _undoRedo.AddUndoProperty(node, "position", node.Position);
+ _undoRedo.CommitAction();
}
[/csharp]
[/codeblocks]
diff --git a/doc/classes/VisualShaderNodeCustom.xml b/doc/classes/VisualShaderNodeCustom.xml
index d96969b383..279295a434 100644
--- a/doc/classes/VisualShaderNodeCustom.xml
+++ b/doc/classes/VisualShaderNodeCustom.xml
@@ -81,7 +81,7 @@
</description>
</method>
<method name="_get_input_port_type" qualifiers="virtual const">
- <return type="int" />
+ <return type="int" enum="VisualShaderNode.PortType" />
<param index="0" name="port" type="int" />
<description>
Override this method to define the returned type of each input port of the associated custom node (see [enum VisualShaderNode.PortType] for possible types).
@@ -111,7 +111,7 @@
</description>
</method>
<method name="_get_output_port_type" qualifiers="virtual const">
- <return type="int" />
+ <return type="int" enum="VisualShaderNode.PortType" />
<param index="0" name="port" type="int" />
<description>
Override this method to define the returned type of each output port of the associated custom node (see [enum VisualShaderNode.PortType] for possible types).
@@ -119,7 +119,7 @@
</description>
</method>
<method name="_get_return_icon_type" qualifiers="virtual const">
- <return type="int" />
+ <return type="int" enum="VisualShaderNode.PortType" />
<description>
Override this method to define the return icon of the associated custom node in the Visual Shader Editor's members dialog.
Defining this method is [b]optional[/b]. If not overridden, no return icon is shown.
diff --git a/doc/classes/VoxelGI.xml b/doc/classes/VoxelGI.xml
index 394611b78f..4347c5845f 100644
--- a/doc/classes/VoxelGI.xml
+++ b/doc/classes/VoxelGI.xml
@@ -38,9 +38,9 @@
<member name="data" type="VoxelGIData" setter="set_probe_data" getter="get_probe_data">
The [VoxelGIData] resource that holds the data for this [VoxelGI].
</member>
- <member name="extents" type="Vector3" setter="set_extents" getter="get_extents" default="Vector3(10, 10, 10)">
- The size of the area covered by the [VoxelGI]. If you make the extents larger without increasing the subdivisions with [member subdiv], the size of each cell will increase and result in lower detailed lighting.
- [b]Note:[/b] Extents are clamped to 1.0 unit or more on each axis.
+ <member name="size" type="Vector3" setter="set_size" getter="get_size" default="Vector3(20, 20, 20)">
+ The size of the area covered by the [VoxelGI]. If you make the size larger without increasing the subdivisions with [member subdiv], the size of each cell will increase and result in lower detailed lighting.
+ [b]Note:[/b] Size is clamped to 1.0 unit or more on each axis.
</member>
<member name="subdiv" type="int" setter="set_subdiv" getter="get_subdiv" enum="VoxelGI.Subdiv" default="1">
Number of times to subdivide the grid that the [VoxelGI] operates on. A higher number results in finer detail and thus higher visual quality, while lower numbers result in better performance.
diff --git a/doc/classes/VoxelGIData.xml b/doc/classes/VoxelGIData.xml
index bd9df18394..541a3bc4a6 100644
--- a/doc/classes/VoxelGIData.xml
+++ b/doc/classes/VoxelGIData.xml
@@ -26,8 +26,8 @@
<method name="get_bounds" qualifiers="const">
<return type="AABB" />
<description>
- Returns the bounds of the baked voxel data as an [AABB], which should match [member VoxelGI.extents] after being baked (which only contains the size as a [Vector3]).
- [b]Note:[/b] If the extents were modified without baking the VoxelGI data, then the value of [method get_bounds] and [member VoxelGI.extents] will not match.
+ Returns the bounds of the baked voxel data as an [AABB], which should match [member VoxelGI.size] after being baked (which only contains the size as a [Vector3]).
+ [b]Note:[/b] If the size was modified without baking the VoxelGI data, then the value of [method get_bounds] and [member VoxelGI.size] will not match.
</description>
</method>
<method name="get_data_cells" qualifiers="const">
diff --git a/doc/classes/Window.xml b/doc/classes/Window.xml
index c4ea11ab66..14e705a7e6 100644
--- a/doc/classes/Window.xml
+++ b/doc/classes/Window.xml
@@ -614,6 +614,12 @@
This signal can be used to handle window closing, e.g. by connecting it to [method hide].
</description>
</signal>
+ <signal name="dpi_changed">
+ <description>
+ Emitted when the [Window]'s DPI changes as a result of OS-level changes (e.g. moving the window from a Retina display to a lower resolution one).
+ [b]Note:[/b] Only implemented on macOS.
+ </description>
+ </signal>
<signal name="files_dropped">
<param index="0" name="files" type="PackedStringArray" />
<description>
diff --git a/doc/classes/XRInterfaceExtension.xml b/doc/classes/XRInterfaceExtension.xml
index 5ad67a7ea9..b74ac1e469 100644
--- a/doc/classes/XRInterfaceExtension.xml
+++ b/doc/classes/XRInterfaceExtension.xml
@@ -64,7 +64,7 @@
</description>
</method>
<method name="_get_play_area_mode" qualifiers="virtual const">
- <return type="int" />
+ <return type="int" enum="XRInterface.PlayAreaMode" />
<description>
Returns the [enum XRInterface.PlayAreaMode] that sets up our play area.
</description>
@@ -99,7 +99,7 @@
</description>
</method>
<method name="_get_tracking_status" qualifiers="virtual const">
- <return type="int" />
+ <return type="int" enum="XRInterface.TrackingStatus" />
<description>
Returns a [enum XRInterface.TrackingStatus] specifying the current status of our tracking.
</description>
@@ -177,7 +177,7 @@
</method>
<method name="_set_play_area_mode" qualifiers="virtual const">
<return type="bool" />
- <param index="0" name="mode" type="int" />
+ <param index="0" name="mode" type="int" enum="XRInterface.PlayAreaMode" />
<description>
Set the play area mode for this interface.
</description>
diff --git a/drivers/gles3/environment/fog.cpp b/drivers/gles3/environment/fog.cpp
index 87470b454b..6083c4da46 100644
--- a/drivers/gles3/environment/fog.cpp
+++ b/drivers/gles3/environment/fog.cpp
@@ -49,7 +49,7 @@ void Fog::fog_volume_free(RID p_rid) {
void Fog::fog_volume_set_shape(RID p_fog_volume, RS::FogVolumeShape p_shape) {
}
-void Fog::fog_volume_set_extents(RID p_fog_volume, const Vector3 &p_extents) {
+void Fog::fog_volume_set_size(RID p_fog_volume, const Vector3 &p_size) {
}
void Fog::fog_volume_set_material(RID p_fog_volume, RID p_material) {
diff --git a/drivers/gles3/environment/fog.h b/drivers/gles3/environment/fog.h
index 99f2e27c44..7dc0265917 100644
--- a/drivers/gles3/environment/fog.h
+++ b/drivers/gles3/environment/fog.h
@@ -49,7 +49,7 @@ public:
virtual void fog_volume_free(RID p_rid) override;
virtual void fog_volume_set_shape(RID p_fog_volume, RS::FogVolumeShape p_shape) override;
- virtual void fog_volume_set_extents(RID p_fog_volume, const Vector3 &p_extents) override;
+ virtual void fog_volume_set_size(RID p_fog_volume, const Vector3 &p_size) override;
virtual void fog_volume_set_material(RID p_fog_volume, RID p_material) override;
virtual AABB fog_volume_get_aabb(RID p_fog_volume) const override;
virtual RS::FogVolumeShape fog_volume_get_shape(RID p_fog_volume) const override;
diff --git a/drivers/gles3/rasterizer_scene_gles3.cpp b/drivers/gles3/rasterizer_scene_gles3.cpp
index 949f2953d3..1a18f35e64 100644
--- a/drivers/gles3/rasterizer_scene_gles3.cpp
+++ b/drivers/gles3/rasterizer_scene_gles3.cpp
@@ -731,6 +731,11 @@ void RasterizerSceneGLES3::_setup_sky(const RenderDataGLES3 *p_render_data, cons
}
}
+ if (p_render_data->view_count > 1) {
+ glBindBufferBase(GL_UNIFORM_BUFFER, SKY_MULTIVIEW_UNIFORM_LOCATION, scene_state.multiview_buffer);
+ glBindBuffer(GL_UNIFORM_BUFFER, 0);
+ }
+
if (!sky->radiance) {
_invalidate_sky(sky);
_update_dirty_skys();
@@ -738,7 +743,7 @@ void RasterizerSceneGLES3::_setup_sky(const RenderDataGLES3 *p_render_data, cons
}
}
-void RasterizerSceneGLES3::_draw_sky(RID p_env, const Projection &p_projection, const Transform3D &p_transform, float p_luminance_multiplier) {
+void RasterizerSceneGLES3::_draw_sky(RID p_env, const Projection &p_projection, const Transform3D &p_transform, float p_luminance_multiplier, bool p_use_multiview, bool p_flip_y) {
GLES3::MaterialStorage *material_storage = GLES3::MaterialStorage::get_singleton();
ERR_FAIL_COND(p_env.is_null());
@@ -748,6 +753,11 @@ void RasterizerSceneGLES3::_draw_sky(RID p_env, const Projection &p_projection,
GLES3::SkyMaterialData *material_data = nullptr;
RID sky_material;
+ uint64_t spec_constants = p_use_multiview ? SkyShaderGLES3::USE_MULTIVIEW : 0;
+ if (p_flip_y) {
+ spec_constants |= SkyShaderGLES3::USE_INVERTED_Y;
+ }
+
RS::EnvironmentBG background = environment_get_background(p_env);
if (sky) {
@@ -792,16 +802,21 @@ void RasterizerSceneGLES3::_draw_sky(RID p_env, const Projection &p_projection,
sky_transform.invert();
sky_transform = sky_transform * p_transform.basis;
- bool success = material_storage->shaders.sky_shader.version_bind_shader(shader_data->version, SkyShaderGLES3::MODE_BACKGROUND);
+ bool success = material_storage->shaders.sky_shader.version_bind_shader(shader_data->version, SkyShaderGLES3::MODE_BACKGROUND, spec_constants);
if (!success) {
return;
}
- material_storage->shaders.sky_shader.version_set_uniform(SkyShaderGLES3::ORIENTATION, sky_transform, shader_data->version, SkyShaderGLES3::MODE_BACKGROUND);
- material_storage->shaders.sky_shader.version_set_uniform(SkyShaderGLES3::PROJECTION, camera.columns[2][0], camera.columns[0][0], camera.columns[2][1], camera.columns[1][1], shader_data->version, SkyShaderGLES3::MODE_BACKGROUND);
- material_storage->shaders.sky_shader.version_set_uniform(SkyShaderGLES3::POSITION, p_transform.origin, shader_data->version, SkyShaderGLES3::MODE_BACKGROUND);
- material_storage->shaders.sky_shader.version_set_uniform(SkyShaderGLES3::TIME, time, shader_data->version, SkyShaderGLES3::MODE_BACKGROUND);
- material_storage->shaders.sky_shader.version_set_uniform(SkyShaderGLES3::LUMINANCE_MULTIPLIER, p_luminance_multiplier, shader_data->version, SkyShaderGLES3::MODE_BACKGROUND);
+ material_storage->shaders.sky_shader.version_set_uniform(SkyShaderGLES3::ORIENTATION, sky_transform, shader_data->version, SkyShaderGLES3::MODE_BACKGROUND, spec_constants);
+ material_storage->shaders.sky_shader.version_set_uniform(SkyShaderGLES3::PROJECTION, camera.columns[2][0], camera.columns[0][0], camera.columns[2][1], camera.columns[1][1], shader_data->version, SkyShaderGLES3::MODE_BACKGROUND, spec_constants);
+ material_storage->shaders.sky_shader.version_set_uniform(SkyShaderGLES3::POSITION, p_transform.origin, shader_data->version, SkyShaderGLES3::MODE_BACKGROUND, spec_constants);
+ material_storage->shaders.sky_shader.version_set_uniform(SkyShaderGLES3::TIME, time, shader_data->version, SkyShaderGLES3::MODE_BACKGROUND, spec_constants);
+ material_storage->shaders.sky_shader.version_set_uniform(SkyShaderGLES3::LUMINANCE_MULTIPLIER, p_luminance_multiplier, shader_data->version, SkyShaderGLES3::MODE_BACKGROUND, spec_constants);
+
+ if (p_use_multiview) {
+ glBindBufferBase(GL_UNIFORM_BUFFER, SKY_MULTIVIEW_UNIFORM_LOCATION, scene_state.multiview_buffer);
+ glBindBuffer(GL_UNIFORM_BUFFER, 0);
+ }
glBindVertexArray(sky_globals.screen_triangle_array);
glDrawArrays(GL_TRIANGLES, 0, 3);
@@ -1975,7 +1990,7 @@ void RasterizerSceneGLES3::render_scene(const Ref<RenderSceneBuffers> &p_render_
scene_state.current_depth_draw = GLES3::SceneShaderData::DEPTH_DRAW_DISABLED;
scene_state.cull_mode = GLES3::SceneShaderData::CULL_BACK;
- _draw_sky(render_data.environment, render_data.cam_projection, render_data.cam_transform, sky_energy_multiplier);
+ _draw_sky(render_data.environment, render_data.cam_projection, render_data.cam_transform, sky_energy_multiplier, p_camera_data->view_count > 1, flip_y);
}
RENDER_TIMESTAMP("Render 3D Transparent Pass");
diff --git a/drivers/gles3/rasterizer_scene_gles3.h b/drivers/gles3/rasterizer_scene_gles3.h
index 7977e562c0..ff043d67f6 100644
--- a/drivers/gles3/rasterizer_scene_gles3.h
+++ b/drivers/gles3/rasterizer_scene_gles3.h
@@ -83,6 +83,7 @@ enum SkyUniformLocation {
SKY_EMPTY, // Unused, put here to avoid conflicts with SCENE_DATA_UNIFORM_LOCATION.
SKY_MATERIAL_UNIFORM_LOCATION,
SKY_DIRECTIONAL_LIGHT_UNIFORM_LOCATION,
+ SKY_MULTIVIEW_UNIFORM_LOCATION,
};
struct RenderDataGLES3 {
@@ -570,7 +571,7 @@ protected:
void _update_dirty_skys();
void _update_sky_radiance(RID p_env, const Projection &p_projection, const Transform3D &p_transform, float p_luminance_multiplier);
void _filter_sky_radiance(Sky *p_sky, int p_base_layer);
- void _draw_sky(RID p_env, const Projection &p_projection, const Transform3D &p_transform, float p_luminance_multiplier);
+ void _draw_sky(RID p_env, const Projection &p_projection, const Transform3D &p_transform, float p_luminance_multiplier, bool p_use_multiview, bool p_flip_y);
void _free_sky_data(Sky *p_sky);
public:
diff --git a/drivers/gles3/shaders/scene.glsl b/drivers/gles3/shaders/scene.glsl
index f977c8ceaf..0b389b0478 100644
--- a/drivers/gles3/shaders/scene.glsl
+++ b/drivers/gles3/shaders/scene.glsl
@@ -268,9 +268,11 @@ void main() {
#ifdef USE_MULTIVIEW
mat4 projection_matrix = multiview_data.projection_matrix_view[ViewIndex];
mat4 inv_projection_matrix = multiview_data.inv_projection_matrix_view[ViewIndex];
+ vec3 eye_offset = multiview_data.eye_offset[ViewIndex].xyz;
#else
mat4 projection_matrix = scene_data.projection_matrix;
mat4 inv_projection_matrix = scene_data.inv_projection_matrix;
+ vec3 eye_offset = vec3(0.0, 0.0, 0.0);
#endif //USE_MULTIVIEW
#ifdef USE_INSTANCING
@@ -930,10 +932,12 @@ void main() {
//lay out everything, whatever is unused is optimized away anyway
vec3 vertex = vertex_interp;
#ifdef USE_MULTIVIEW
- vec3 view = -normalize(vertex_interp - multiview_data.eye_offset[ViewIndex].xyz);
+ vec3 eye_offset = multiview_data.eye_offset[ViewIndex].xyz;
+ vec3 view = -normalize(vertex_interp - eye_offset);
mat4 projection_matrix = multiview_data.projection_matrix_view[ViewIndex];
mat4 inv_projection_matrix = multiview_data.inv_projection_matrix_view[ViewIndex];
#else
+ vec3 eye_offset = vec3(0.0, 0.0, 0.0);
vec3 view = -normalize(vertex_interp);
mat4 projection_matrix = scene_data.projection_matrix;
mat4 inv_projection_matrix = scene_data.inv_projection_matrix;
diff --git a/drivers/gles3/shaders/sky.glsl b/drivers/gles3/shaders/sky.glsl
index 4c0fe47f6b..e59bca8b07 100644
--- a/drivers/gles3/shaders/sky.glsl
+++ b/drivers/gles3/shaders/sky.glsl
@@ -10,6 +10,9 @@ mode_cubemap_quarter_res = #define USE_CUBEMAP_PASS \n#define USE_QUARTER_RES_PA
#[specializations]
+USE_MULTIVIEW = false
+USE_INVERTED_Y = true
+
#[vertex]
layout(location = 0) in vec2 vertex_attrib;
@@ -19,7 +22,11 @@ out vec2 uv_interp;
void main() {
uv_interp = vertex_attrib;
+#ifdef USE_INVERTED_Y
gl_Position = vec4(uv_interp, 1.0, 1.0);
+#else
+ gl_Position = vec4(uv_interp.x, uv_interp.y * -1.0, 1.0, 1.0);
+#endif
}
/* clang-format off */
@@ -37,6 +44,9 @@ uniform samplerCube radiance; //texunit:-1
#ifdef USE_CUBEMAP_PASS
uniform samplerCube half_res; //texunit:-2
uniform samplerCube quarter_res; //texunit:-3
+#elif defined(USE_MULTIVIEW)
+uniform sampler2DArray half_res; //texunit:-2
+uniform sampler2DArray quarter_res; //texunit:-3
#else
uniform sampler2D half_res; //texunit:-2
uniform sampler2D quarter_res; //texunit:-3
@@ -102,6 +112,15 @@ uniform float fog_density;
uniform float z_far;
uniform uint directional_light_count;
+#ifdef USE_MULTIVIEW
+layout(std140) uniform MultiviewData { // ubo:5
+ highp mat4 projection_matrix_view[MAX_VIEWS];
+ highp mat4 inv_projection_matrix_view[MAX_VIEWS];
+ highp vec4 eye_offset[MAX_VIEWS];
+}
+multiview_data;
+#endif
+
layout(location = 0) out vec4 frag_color;
#ifdef USE_DEBANDING
@@ -115,9 +134,20 @@ vec3 interleaved_gradient_noise(vec2 pos) {
void main() {
vec3 cube_normal;
+#ifdef USE_MULTIVIEW
+ // In multiview our projection matrices will contain positional and rotational offsets that we need to properly unproject.
+ vec4 unproject = vec4(uv_interp.x, uv_interp.y, 1.0, 1.0);
+ vec4 unprojected = multiview_data.inv_projection_matrix_view[ViewIndex] * unproject;
+ cube_normal = unprojected.xyz / unprojected.w;
+ cube_normal += multiview_data.eye_offset[ViewIndex].xyz;
+#else
cube_normal.z = -1.0;
cube_normal.x = (uv_interp.x + projection.x) / projection.y;
cube_normal.y = (-uv_interp.y - projection.z) / projection.w;
+#endif
+#ifndef USE_INVERTED_Y
+ cube_normal.y *= -1.0;
+#endif
cube_normal = mat3(orientation) * cube_normal;
cube_normal = normalize(cube_normal);
@@ -146,12 +176,20 @@ void main() {
#endif
#else
#ifdef USES_HALF_RES_COLOR
+#ifdef USE_MULTIVIEW
+ half_res_color = textureLod(sampler2DArray(half_res, material_samplers[SAMPLER_LINEAR_CLAMP]), vec3(uv, ViewIndex), 0.0);
+#else
half_res_color = textureLod(sampler2D(half_res, material_samplers[SAMPLER_LINEAR_CLAMP]), uv, 0.0);
#endif
+#endif
#ifdef USES_QUARTER_RES_COLOR
+#ifdef USE_MULTIVIEW
+ quarter_res_color = textureLod(sampler2DArray(quarter_res, material_samplers[SAMPLER_LINEAR_CLAMP]), vec3(uv, ViewIndex), 0.0);
+#else
quarter_res_color = textureLod(sampler2D(quarter_res, material_samplers[SAMPLER_LINEAR_CLAMP]), uv, 0.0);
#endif
#endif
+#endif
{
diff --git a/drivers/gles3/storage/light_storage.cpp b/drivers/gles3/storage/light_storage.cpp
index a325f79d8c..138498220d 100644
--- a/drivers/gles3/storage/light_storage.cpp
+++ b/drivers/gles3/storage/light_storage.cpp
@@ -403,7 +403,7 @@ void LightStorage::reflection_probe_set_ambient_energy(RID p_probe, float p_ener
void LightStorage::reflection_probe_set_max_distance(RID p_probe, float p_distance) {
}
-void LightStorage::reflection_probe_set_extents(RID p_probe, const Vector3 &p_extents) {
+void LightStorage::reflection_probe_set_size(RID p_probe, const Vector3 &p_size) {
}
void LightStorage::reflection_probe_set_origin_offset(RID p_probe, const Vector3 &p_offset) {
@@ -436,7 +436,7 @@ uint32_t LightStorage::reflection_probe_get_cull_mask(RID p_probe) const {
return 0;
}
-Vector3 LightStorage::reflection_probe_get_extents(RID p_probe) const {
+Vector3 LightStorage::reflection_probe_get_size(RID p_probe) const {
return Vector3();
}
diff --git a/drivers/gles3/storage/light_storage.h b/drivers/gles3/storage/light_storage.h
index 8b2bdaf872..f6f7628a90 100644
--- a/drivers/gles3/storage/light_storage.h
+++ b/drivers/gles3/storage/light_storage.h
@@ -113,7 +113,7 @@ struct ReflectionProbe {
Color ambient_color;
float ambient_color_energy = 1.0;
float max_distance = 0;
- Vector3 extents = Vector3(10, 10, 10);
+ Vector3 size = Vector3(20, 20, 20);
Vector3 origin_offset;
bool interior = false;
bool box_projection = false;
@@ -332,7 +332,7 @@ public:
virtual void reflection_probe_set_ambient_color(RID p_probe, const Color &p_color) override;
virtual void reflection_probe_set_ambient_energy(RID p_probe, float p_energy) override;
virtual void reflection_probe_set_max_distance(RID p_probe, float p_distance) override;
- virtual void reflection_probe_set_extents(RID p_probe, const Vector3 &p_extents) override;
+ virtual void reflection_probe_set_size(RID p_probe, const Vector3 &p_size) override;
virtual void reflection_probe_set_origin_offset(RID p_probe, const Vector3 &p_offset) override;
virtual void reflection_probe_set_as_interior(RID p_probe, bool p_enable) override;
virtual void reflection_probe_set_enable_box_projection(RID p_probe, bool p_enable) override;
@@ -345,7 +345,7 @@ public:
virtual AABB reflection_probe_get_aabb(RID p_probe) const override;
virtual RS::ReflectionProbeUpdateMode reflection_probe_get_update_mode(RID p_probe) const override;
virtual uint32_t reflection_probe_get_cull_mask(RID p_probe) const override;
- virtual Vector3 reflection_probe_get_extents(RID p_probe) const override;
+ virtual Vector3 reflection_probe_get_size(RID p_probe) const override;
virtual Vector3 reflection_probe_get_origin_offset(RID p_probe) const override;
virtual float reflection_probe_get_origin_max_distance(RID p_probe) const override;
virtual bool reflection_probe_renders_shadows(RID p_probe) const override;
diff --git a/drivers/gles3/storage/material_storage.cpp b/drivers/gles3/storage/material_storage.cpp
index 4fb780b665..aa8df606cf 100644
--- a/drivers/gles3/storage/material_storage.cpp
+++ b/drivers/gles3/storage/material_storage.cpp
@@ -1639,6 +1639,7 @@ MaterialStorage::MaterialStorage() {
actions.renames["VIEW_INDEX"] = "ViewIndex";
actions.renames["VIEW_MONO_LEFT"] = "uint(0)";
actions.renames["VIEW_RIGHT"] = "uint(1)";
+ actions.renames["EYE_OFFSET"] = "eye_offset";
//for light
actions.renames["VIEW"] = "view";
diff --git a/drivers/gles3/storage/texture_storage.cpp b/drivers/gles3/storage/texture_storage.cpp
index 97698af0a0..9c9c39cc0e 100644
--- a/drivers/gles3/storage/texture_storage.cpp
+++ b/drivers/gles3/storage/texture_storage.cpp
@@ -1547,7 +1547,7 @@ RID TextureStorage::decal_allocate() {
void TextureStorage::decal_initialize(RID p_rid) {
}
-void TextureStorage::decal_set_extents(RID p_decal, const Vector3 &p_extents) {
+void TextureStorage::decal_set_size(RID p_decal, const Vector3 &p_size) {
}
void TextureStorage::decal_set_texture(RID p_decal, RS::DecalTexture p_type, RID p_texture) {
@@ -1822,6 +1822,10 @@ void TextureStorage::_clear_render_target(RenderTarget *rt) {
rt->overridden.color = RID();
} else if (rt->color) {
glDeleteTextures(1, &rt->color);
+ if (rt->texture.is_valid()) {
+ Texture *tex = get_texture(rt->texture);
+ tex->tex_id = 0;
+ }
}
rt->color = 0;
diff --git a/drivers/gles3/storage/texture_storage.h b/drivers/gles3/storage/texture_storage.h
index 522be64d35..017e74fc4d 100644
--- a/drivers/gles3/storage/texture_storage.h
+++ b/drivers/gles3/storage/texture_storage.h
@@ -574,7 +574,7 @@ public:
virtual void decal_initialize(RID p_rid) override;
virtual void decal_free(RID p_rid) override{};
- virtual void decal_set_extents(RID p_decal, const Vector3 &p_extents) override;
+ virtual void decal_set_size(RID p_decal, const Vector3 &p_size) override;
virtual void decal_set_texture(RID p_decal, RS::DecalTexture p_type, RID p_texture) override;
virtual void decal_set_emission_energy(RID p_decal, float p_energy) override;
virtual void decal_set_albedo_mix(RID p_decal, float p_mix) override;
diff --git a/editor/action_map_editor.cpp b/editor/action_map_editor.cpp
index ae54c20fe2..146b5a794c 100644
--- a/editor/action_map_editor.cpp
+++ b/editor/action_map_editor.cpp
@@ -198,6 +198,14 @@ void ActionMapEditor::_tree_button_pressed(Object *p_item, int p_column, int p_i
emit_signal(SNAME("action_edited"), action_name, action);
} break;
+ case ActionMapEditor::BUTTON_REVERT_ACTION: {
+ ERR_FAIL_COND_MSG(!item->has_meta("__action_initial"), "Tree Item for action which can be reverted is expected to have meta value with initial value of action.");
+
+ Dictionary action = item->get_meta("__action_initial").duplicate();
+ String action_name = item->get_meta("__name");
+
+ emit_signal(SNAME("action_edited"), action_name, action);
+ } break;
default:
break;
}
@@ -427,6 +435,13 @@ void ActionMapEditor::update_action_list(const Vector<ActionInfo> &p_action_info
action_item->set_range(1, deadzone);
// Third column - buttons
+ if (action_info.has_initial) {
+ bool deadzone_eq = action_info.action_initial["deadzone"] == action_info.action["deadzone"];
+ bool events_eq = Shortcut::is_event_array_equal(action_info.action_initial["events"], action_info.action["events"]);
+ bool action_eq = deadzone_eq && events_eq;
+ action_item->set_meta("__action_initial", action_info.action_initial);
+ action_item->add_button(2, action_tree->get_theme_icon(SNAME("ReloadSmall"), SNAME("EditorIcons")), BUTTON_REVERT_ACTION, action_eq, action_eq ? TTR("Cannot Revert - Action is same as initial") : TTR("Revert Action"));
+ }
action_item->add_button(2, action_tree->get_theme_icon(SNAME("Add"), SNAME("EditorIcons")), BUTTON_ADD_EVENT, false, TTR("Add Event"));
action_item->add_button(2, action_tree->get_theme_icon(SNAME("Remove"), SNAME("EditorIcons")), BUTTON_REMOVE_ACTION, !action_info.editable, action_info.editable ? TTR("Remove Action") : TTR("Cannot Remove Action"));
diff --git a/editor/action_map_editor.h b/editor/action_map_editor.h
index 433a72a807..2848d23e83 100644
--- a/editor/action_map_editor.h
+++ b/editor/action_map_editor.h
@@ -49,6 +49,8 @@ public:
struct ActionInfo {
String name;
Dictionary action;
+ bool has_initial = false;
+ Dictionary action_initial;
Ref<Texture2D> icon = Ref<Texture2D>();
bool editable = true;
@@ -60,6 +62,7 @@ private:
BUTTON_EDIT_EVENT,
BUTTON_REMOVE_ACTION,
BUTTON_REMOVE_EVENT,
+ BUTTON_REVERT_ACTION,
};
Vector<ActionInfo> actions_cache;
diff --git a/editor/animation_track_editor.cpp b/editor/animation_track_editor.cpp
index 8dd087451c..ee4163bc14 100644
--- a/editor/animation_track_editor.cpp
+++ b/editor/animation_track_editor.cpp
@@ -2986,7 +2986,6 @@ bool AnimationTrackEdit::can_drop_data(const Point2 &p_point, const Variant &p_d
}
const_cast<AnimationTrackEdit *>(this)->queue_redraw();
- const_cast<AnimationTrackEdit *>(this)->emit_signal(SNAME("drop_attempted"), track);
return true;
}
diff --git a/editor/code_editor.cpp b/editor/code_editor.cpp
index 28d687488c..b217cd57bf 100644
--- a/editor/code_editor.cpp
+++ b/editor/code_editor.cpp
@@ -670,7 +670,6 @@ void FindReplaceBar::set_text_edit(CodeTextEditor *p_text_editor) {
void FindReplaceBar::_bind_methods() {
ClassDB::bind_method("_search_current", &FindReplaceBar::search_current);
- ADD_SIGNAL(MethodInfo("search"));
ADD_SIGNAL(MethodInfo("error"));
}
diff --git a/editor/connections_dialog.cpp b/editor/connections_dialog.cpp
index aaa07e98c8..f4d293e9f4 100644
--- a/editor/connections_dialog.cpp
+++ b/editor/connections_dialog.cpp
@@ -591,14 +591,12 @@ void ConnectDialog::popup_dialog(const String p_for_signal) {
void ConnectDialog::_advanced_pressed() {
if (advanced->is_pressed()) {
- set_min_size(Size2(900, 500) * EDSCALE);
connect_to_label->set_text(TTR("Connect to Node:"));
tree->set_connect_to_script_mode(false);
vbc_right->show();
error_label->hide();
} else {
- set_min_size(Size2(600, 500) * EDSCALE);
reset_size();
connect_to_label->set_text(TTR("Connect to Script:"));
tree->set_connect_to_script_mode(true);
@@ -613,18 +611,15 @@ void ConnectDialog::_advanced_pressed() {
}
ConnectDialog::ConnectDialog() {
- set_min_size(Size2(600, 500) * EDSCALE);
-
- VBoxContainer *vbc = memnew(VBoxContainer);
- add_child(vbc);
+ set_min_size(Size2(0, 500) * EDSCALE);
HBoxContainer *main_hb = memnew(HBoxContainer);
- vbc->add_child(main_hb);
- main_hb->set_v_size_flags(Control::SIZE_EXPAND_FILL);
+ add_child(main_hb);
VBoxContainer *vbc_left = memnew(VBoxContainer);
main_hb->add_child(vbc_left);
vbc_left->set_h_size_flags(Control::SIZE_EXPAND_FILL);
+ vbc_left->set_custom_minimum_size(Vector2(400 * EDSCALE, 0));
from_signal = memnew(LineEdit);
vbc_left->add_margin_child(TTR("From Signal:"), from_signal);
@@ -685,6 +680,7 @@ ConnectDialog::ConnectDialog() {
vbc_right = memnew(VBoxContainer);
main_hb->add_child(vbc_right);
vbc_right->set_h_size_flags(Control::SIZE_EXPAND_FILL);
+ vbc_right->set_custom_minimum_size(Vector2(150 * EDSCALE, 0));
vbc_right->hide();
HBoxContainer *add_bind_hb = memnew(HBoxContainer);
diff --git a/editor/editor_file_dialog.cpp b/editor/editor_file_dialog.cpp
index bbd0a6bd70..4a1f0b4c09 100644
--- a/editor/editor_file_dialog.cpp
+++ b/editor/editor_file_dialog.cpp
@@ -620,12 +620,16 @@ void EditorFileDialog::_item_list_item_rmb_clicked(int p_item, const Vector2 &p_
if (allow_delete) {
item_menu->add_icon_item(theme_cache.action_delete, TTR("Delete"), ITEM_MENU_DELETE, Key::KEY_DELETE);
}
+
+#if !defined(ANDROID_ENABLED) && !defined(WEB_ENABLED)
+ // Opening the system file manager is not supported on the Android and web editors.
if (single_item_selected) {
item_menu->add_separator();
Dictionary item_meta = item_list->get_item_metadata(p_item);
String item_text = item_meta["dir"] ? TTR("Open in File Manager") : TTR("Show in File Manager");
item_menu->add_icon_item(theme_cache.filesystem, item_text, ITEM_MENU_SHOW_IN_EXPLORER);
}
+#endif
if (item_menu->get_item_count() > 0) {
item_menu->set_position(item_list->get_screen_position() + p_pos);
@@ -655,8 +659,11 @@ void EditorFileDialog::_item_list_empty_clicked(const Vector2 &p_pos, MouseButto
item_menu->add_icon_item(theme_cache.folder, TTR("New Folder..."), ITEM_MENU_NEW_FOLDER, KeyModifierMask::CMD_OR_CTRL | Key::N);
}
item_menu->add_icon_item(theme_cache.reload, TTR("Refresh"), ITEM_MENU_REFRESH, Key::F5);
+#if !defined(ANDROID_ENABLED) && !defined(WEB_ENABLED)
+ // Opening the system file manager is not supported on the Android and web editors.
item_menu->add_separator();
item_menu->add_icon_item(theme_cache.filesystem, TTR("Open in File Manager"), ITEM_MENU_SHOW_IN_EXPLORER);
+#endif
item_menu->set_position(item_list->get_screen_position() + p_pos);
item_menu->reset_size();
diff --git a/editor/editor_help.cpp b/editor/editor_help.cpp
index e11251596a..bb7098643a 100644
--- a/editor/editor_help.cpp
+++ b/editor/editor_help.cpp
@@ -2448,10 +2448,6 @@ void FindBar::_notification(int p_what) {
}
}
-void FindBar::_bind_methods() {
- ADD_SIGNAL(MethodInfo("search"));
-}
-
void FindBar::set_rich_text_label(RichTextLabel *p_rich_text_label) {
rich_text_label = p_rich_text_label;
}
diff --git a/editor/editor_help.h b/editor/editor_help.h
index 9be17143c7..81cd6d6674 100644
--- a/editor/editor_help.h
+++ b/editor/editor_help.h
@@ -72,8 +72,6 @@ protected:
bool _search(bool p_search_previous = false);
- static void _bind_methods();
-
public:
void set_rich_text_label(RichTextLabel *p_rich_text_label);
diff --git a/editor/editor_inspector.cpp b/editor/editor_inspector.cpp
index 0166d4c719..42d8f48ea0 100644
--- a/editor/editor_inspector.cpp
+++ b/editor/editor_inspector.cpp
@@ -1084,7 +1084,7 @@ void EditorInspectorPlugin::parse_group(Object *p_object, const String &p_group)
GDVIRTUAL_CALL(_parse_group, p_object, p_group);
}
-bool EditorInspectorPlugin::parse_property(Object *p_object, const Variant::Type p_type, const String &p_path, const PropertyHint p_hint, const String &p_hint_text, const uint32_t p_usage, const bool p_wide) {
+bool EditorInspectorPlugin::parse_property(Object *p_object, const Variant::Type p_type, const String &p_path, const PropertyHint p_hint, const String &p_hint_text, const BitField<PropertyUsageFlags> p_usage, const bool p_wide) {
bool ret = false;
GDVIRTUAL_CALL(_parse_property, p_object, p_type, p_path, p_hint, p_hint_text, p_usage, p_wide, ret);
return ret;
diff --git a/editor/editor_inspector.h b/editor/editor_inspector.h
index 6a1c77d376..eab495ef3d 100644
--- a/editor/editor_inspector.h
+++ b/editor/editor_inspector.h
@@ -227,7 +227,7 @@ protected:
GDVIRTUAL1(_parse_begin, Object *)
GDVIRTUAL2(_parse_category, Object *, String)
GDVIRTUAL2(_parse_group, Object *, String)
- GDVIRTUAL7R(bool, _parse_property, Object *, int, String, int, String, int, bool)
+ GDVIRTUAL7R(bool, _parse_property, Object *, Variant::Type, String, PropertyHint, String, BitField<PropertyUsageFlags>, bool)
GDVIRTUAL1(_parse_end, Object *)
public:
@@ -239,7 +239,7 @@ public:
virtual void parse_begin(Object *p_object);
virtual void parse_category(Object *p_object, const String &p_category);
virtual void parse_group(Object *p_object, const String &p_group);
- virtual bool parse_property(Object *p_object, const Variant::Type p_type, const String &p_path, const PropertyHint p_hint, const String &p_hint_text, const uint32_t p_usage, const bool p_wide = false);
+ virtual bool parse_property(Object *p_object, const Variant::Type p_type, const String &p_path, const PropertyHint p_hint, const String &p_hint_text, const BitField<PropertyUsageFlags> p_usage, const bool p_wide = false);
virtual void parse_end(Object *p_object);
};
diff --git a/editor/editor_layouts_dialog.cpp b/editor/editor_layouts_dialog.cpp
index 3f788627f4..57a0a88810 100644
--- a/editor/editor_layouts_dialog.cpp
+++ b/editor/editor_layouts_dialog.cpp
@@ -65,6 +65,20 @@ void EditorLayoutsDialog::_line_gui_input(const Ref<InputEvent> &p_event) {
}
}
+void EditorLayoutsDialog::_update_ok_disable_state() {
+ if (layout_names->is_anything_selected()) {
+ get_ok_button()->set_disabled(false);
+ } else {
+ get_ok_button()->set_disabled(!name->is_visible() || name->get_text().is_empty());
+ }
+}
+
+void EditorLayoutsDialog::_deselect_layout_names() {
+ // The deselect method does not emit any signal, therefore we need update the disable state as well.
+ layout_names->deselect_all();
+ _update_ok_disable_state();
+}
+
void EditorLayoutsDialog::_bind_methods() {
ADD_SIGNAL(MethodInfo("name_confirmed", PropertyInfo(Variant::STRING, "name")));
}
@@ -82,8 +96,8 @@ void EditorLayoutsDialog::ok_pressed() {
void EditorLayoutsDialog::_post_popup() {
ConfirmationDialog::_post_popup();
- name->clear();
layout_names->clear();
+ name->clear();
Ref<ConfigFile> config;
config.instantiate();
@@ -112,9 +126,9 @@ EditorLayoutsDialog::EditorLayoutsDialog() {
makevb->set_anchor_and_offset(SIDE_RIGHT, Control::ANCHOR_END, -5);
layout_names = memnew(ItemList);
- layout_names->set_auto_height(true);
makevb->add_margin_child(TTR("Select existing layout:"), layout_names);
- layout_names->set_custom_minimum_size(Size2(300 * EDSCALE, 1));
+ layout_names->set_auto_height(true);
+ layout_names->set_custom_minimum_size(Size2(300 * EDSCALE, 50 * EDSCALE));
layout_names->set_visible(true);
layout_names->set_offset(SIDE_TOP, 5);
layout_names->set_anchor_and_offset(SIDE_LEFT, Control::ANCHOR_BEGIN, 5);
@@ -122,16 +136,17 @@ EditorLayoutsDialog::EditorLayoutsDialog() {
layout_names->set_v_size_flags(Control::SIZE_EXPAND_FILL);
layout_names->set_select_mode(ItemList::SELECT_MULTI);
layout_names->set_allow_rmb_select(true);
+ layout_names->connect("multi_selected", callable_mp(this, &EditorLayoutsDialog::_update_ok_disable_state).unbind(2));
name = memnew(LineEdit);
- name->set_placeholder("Or enter new layout name");
makevb->add_child(name);
+ name->set_placeholder("Or enter new layout name");
name->set_offset(SIDE_TOP, 5);
- name->set_custom_minimum_size(Size2(300 * EDSCALE, 1));
name->set_anchor_and_offset(SIDE_LEFT, Control::ANCHOR_BEGIN, 5);
name->set_anchor_and_offset(SIDE_RIGHT, Control::ANCHOR_END, -5);
name->connect("gui_input", callable_mp(this, &EditorLayoutsDialog::_line_gui_input));
- name->connect("focus_entered", callable_mp(layout_names, &ItemList::deselect_all));
+ name->connect("focus_entered", callable_mp(this, &EditorLayoutsDialog::_deselect_layout_names));
+ name->connect("text_changed", callable_mp(this, &EditorLayoutsDialog::_update_ok_disable_state).unbind(1));
}
void EditorLayoutsDialog::set_name_line_enabled(bool p_enabled) {
diff --git a/editor/editor_layouts_dialog.h b/editor/editor_layouts_dialog.h
index 80a7ed0b53..e3557fbe71 100644
--- a/editor/editor_layouts_dialog.h
+++ b/editor/editor_layouts_dialog.h
@@ -44,6 +44,8 @@ class EditorLayoutsDialog : public ConfirmationDialog {
VBoxContainer *makevb = nullptr;
void _line_gui_input(const Ref<InputEvent> &p_event);
+ void _update_ok_disable_state();
+ void _deselect_layout_names();
protected:
static void _bind_methods();
diff --git a/editor/editor_log.cpp b/editor/editor_log.cpp
index 550c57121e..296181f79d 100644
--- a/editor/editor_log.cpp
+++ b/editor/editor_log.cpp
@@ -360,11 +360,6 @@ void EditorLog::_reset_message_counts() {
}
}
-void EditorLog::_bind_methods() {
- ADD_SIGNAL(MethodInfo("clear_request"));
- ADD_SIGNAL(MethodInfo("copy_request"));
-}
-
EditorLog::EditorLog() {
save_state_timer = memnew(Timer);
save_state_timer->set_wait_time(2);
diff --git a/editor/editor_log.h b/editor/editor_log.h
index 7a3c1c01b7..b875066afa 100644
--- a/editor/editor_log.h
+++ b/editor/editor_log.h
@@ -178,7 +178,6 @@ private:
void _update_theme();
protected:
- static void _bind_methods();
void _notification(int p_what);
public:
diff --git a/editor/editor_node.cpp b/editor/editor_node.cpp
index 0405749147..f317c23b83 100644
--- a/editor/editor_node.cpp
+++ b/editor/editor_node.cpp
@@ -2136,6 +2136,13 @@ void EditorNode::edit_item(Object *p_object, Object *p_editing_owner) {
}
}
+void EditorNode::push_node_item(Node *p_node) {
+ if (p_node || Object::cast_to<Node>(InspectorDock::get_inspector_singleton()->get_edited_object())) {
+ // Don't push null if the currently edited object is not a Node.
+ push_item(p_node);
+ }
+}
+
void EditorNode::push_item(Object *p_object, const String &p_property, bool p_inspector_only) {
if (!p_object) {
InspectorDock::get_inspector_singleton()->edit(nullptr);
@@ -6467,7 +6474,6 @@ void EditorNode::_bind_methods() {
ClassDB::bind_method(D_METHOD("get_gui_base"), &EditorNode::get_gui_base);
ADD_SIGNAL(MethodInfo("play_pressed"));
- ADD_SIGNAL(MethodInfo("pause_pressed"));
ADD_SIGNAL(MethodInfo("stop_pressed"));
ADD_SIGNAL(MethodInfo("request_help_search"));
ADD_SIGNAL(MethodInfo("script_add_function_request", PropertyInfo(Variant::OBJECT, "obj"), PropertyInfo(Variant::STRING, "function"), PropertyInfo(Variant::PACKED_STRING_ARRAY, "args")));
diff --git a/editor/editor_node.h b/editor/editor_node.h
index 3967f64c6b..914dab0254 100644
--- a/editor/editor_node.h
+++ b/editor/editor_node.h
@@ -798,6 +798,7 @@ public:
void push_item(Object *p_object, const String &p_property = "", bool p_inspector_only = false);
void edit_item(Object *p_object, Object *p_editing_owner);
+ void push_node_item(Node *p_node);
void hide_unused_editors(const Object *p_editing_owner = nullptr);
void select_editor_by_name(const String &p_name);
diff --git a/editor/editor_properties.cpp b/editor/editor_properties.cpp
index f022027e65..c9eae77b53 100644
--- a/editor/editor_properties.cpp
+++ b/editor/editor_properties.cpp
@@ -4154,7 +4154,7 @@ bool EditorInspectorDefaultPlugin::can_handle(Object *p_object) {
return true; // Can handle everything.
}
-bool EditorInspectorDefaultPlugin::parse_property(Object *p_object, const Variant::Type p_type, const String &p_path, const PropertyHint p_hint, const String &p_hint_text, const uint32_t p_usage, const bool p_wide) {
+bool EditorInspectorDefaultPlugin::parse_property(Object *p_object, const Variant::Type p_type, const String &p_path, const PropertyHint p_hint, const String &p_hint_text, const BitField<PropertyUsageFlags> p_usage, const bool p_wide) {
Control *editor = EditorInspectorDefaultPlugin::get_editor_for_property(p_object, p_type, p_path, p_hint, p_hint_text, p_usage, p_wide);
if (editor) {
add_property_editor(p_path, editor);
@@ -4228,7 +4228,7 @@ static EditorPropertyRangeHint _parse_range_hint(PropertyHint p_hint, const Stri
return hint;
}
-EditorProperty *EditorInspectorDefaultPlugin::get_editor_for_property(Object *p_object, const Variant::Type p_type, const String &p_path, const PropertyHint p_hint, const String &p_hint_text, const uint32_t p_usage, const bool p_wide) {
+EditorProperty *EditorInspectorDefaultPlugin::get_editor_for_property(Object *p_object, const Variant::Type p_type, const String &p_path, const PropertyHint p_hint, const String &p_hint_text, const BitField<PropertyUsageFlags> p_usage, const bool p_wide) {
double default_float_step = EDITOR_GET("interface/inspector/default_float_step");
switch (p_type) {
diff --git a/editor/editor_properties.h b/editor/editor_properties.h
index d29ec12f97..14a2699ad8 100644
--- a/editor/editor_properties.h
+++ b/editor/editor_properties.h
@@ -863,9 +863,9 @@ class EditorInspectorDefaultPlugin : public EditorInspectorPlugin {
public:
virtual bool can_handle(Object *p_object) override;
- virtual bool parse_property(Object *p_object, const Variant::Type p_type, const String &p_path, const PropertyHint p_hint, const String &p_hint_text, const uint32_t p_usage, const bool p_wide = false) override;
+ virtual bool parse_property(Object *p_object, const Variant::Type p_type, const String &p_path, const PropertyHint p_hint, const String &p_hint_text, const BitField<PropertyUsageFlags> p_usage, const bool p_wide = false) override;
- static EditorProperty *get_editor_for_property(Object *p_object, const Variant::Type p_type, const String &p_path, const PropertyHint p_hint, const String &p_hint_text, const uint32_t p_usage, const bool p_wide = false);
+ static EditorProperty *get_editor_for_property(Object *p_object, const Variant::Type p_type, const String &p_path, const PropertyHint p_hint, const String &p_hint_text, const BitField<PropertyUsageFlags> p_usage, const bool p_wide = false);
};
#endif // EDITOR_PROPERTIES_H
diff --git a/editor/export/project_export.cpp b/editor/export/project_export.cpp
index 52c192164f..e9ea0012be 100644
--- a/editor/export/project_export.cpp
+++ b/editor/export/project_export.cpp
@@ -754,22 +754,27 @@ void ProjectExportDialog::_fill_resource_tree() {
include_margin->show();
_fill_tree(EditorFileSystem::get_singleton()->get_filesystem(), root, current, f);
+
+ if (f == EditorExportPreset::EXPORT_CUSTOMIZED) {
+ _propagate_file_export_mode(include_files->get_root(), EditorExportPreset::MODE_FILE_NOT_CUSTOMIZED);
+ }
}
void ProjectExportDialog::_setup_item_for_file_mode(TreeItem *p_item, EditorExportPreset::FileExportMode p_mode) {
if (p_mode == EditorExportPreset::MODE_FILE_NOT_CUSTOMIZED) {
p_item->set_checked(0, false);
p_item->set_cell_mode(1, TreeItem::CELL_MODE_STRING);
- p_item->set_text(1, "");
p_item->set_editable(1, false);
p_item->set_selectable(1, false);
+ p_item->set_custom_color(1, get_theme_color(SNAME("disabled_font_color"), SNAME("Editor")));
} else {
p_item->set_checked(0, true);
p_item->set_cell_mode(1, TreeItem::CELL_MODE_CUSTOM);
- p_item->set_text(1, file_mode_popup->get_item_text(file_mode_popup->get_item_index(p_mode)));
p_item->set_editable(1, true);
p_item->set_selectable(1, true);
+ p_item->clear_custom_color(1);
}
+ p_item->set_metadata(1, p_mode);
}
bool ProjectExportDialog::_fill_tree(EditorFileSystemDirectory *p_dir, TreeItem *p_item, Ref<EditorExportPreset> &current, EditorExportPreset::ExportFilter p_export_filter) {
@@ -824,6 +829,23 @@ bool ProjectExportDialog::_fill_tree(EditorFileSystemDirectory *p_dir, TreeItem
return used;
}
+void ProjectExportDialog::_propagate_file_export_mode(TreeItem *p_item, EditorExportPreset::FileExportMode p_inherited_export_mode) {
+ EditorExportPreset::FileExportMode file_export_mode = (EditorExportPreset::FileExportMode)(int)p_item->get_metadata(1);
+ if (file_export_mode == EditorExportPreset::MODE_FILE_NOT_CUSTOMIZED) {
+ file_export_mode = p_inherited_export_mode;
+ }
+
+ if (file_export_mode == EditorExportPreset::MODE_FILE_NOT_CUSTOMIZED) {
+ p_item->set_text(1, "");
+ } else {
+ p_item->set_text(1, file_mode_popup->get_item_text(file_mode_popup->get_item_index(file_export_mode)));
+ }
+
+ for (int i = 0; i < p_item->get_child_count(); i++) {
+ _propagate_file_export_mode(p_item->get_child(i), file_export_mode);
+ }
+}
+
void ProjectExportDialog::_tree_changed() {
if (updating) {
return;
@@ -847,8 +869,9 @@ void ProjectExportDialog::_tree_changed() {
file_mode = current->get_file_export_mode(path, EditorExportPreset::MODE_FILE_STRIP);
}
- _setup_item_for_file_mode(item, file_mode);
current->set_file_export_mode(path, file_mode);
+ _setup_item_for_file_mode(item, file_mode);
+ _propagate_file_export_mode(include_files->get_root(), EditorExportPreset::MODE_FILE_NOT_CUSTOMIZED);
} else {
item->propagate_check(0);
}
@@ -890,9 +913,10 @@ void ProjectExportDialog::_set_file_export_mode(int p_id) {
TreeItem *item = include_files->get_edited();
String path = item->get_metadata(0);
- current->set_file_export_mode(path, (EditorExportPreset::FileExportMode)p_id);
-
- item->set_text(1, file_mode_popup->get_item_text(file_mode_popup->get_item_index(p_id)));
+ EditorExportPreset::FileExportMode file_export_mode = (EditorExportPreset::FileExportMode)p_id;
+ current->set_file_export_mode(path, file_export_mode);
+ item->set_metadata(1, file_export_mode);
+ _propagate_file_export_mode(include_files->get_root(), EditorExportPreset::MODE_FILE_NOT_CUSTOMIZED);
}
void ProjectExportDialog::_export_pck_zip() {
diff --git a/editor/export/project_export.h b/editor/export/project_export.h
index 63f8fc4a2e..e53e393432 100644
--- a/editor/export/project_export.h
+++ b/editor/export/project_export.h
@@ -118,6 +118,7 @@ private:
void _fill_resource_tree();
void _setup_item_for_file_mode(TreeItem *p_item, EditorExportPreset::FileExportMode p_mode);
bool _fill_tree(EditorFileSystemDirectory *p_dir, TreeItem *p_item, Ref<EditorExportPreset> &current, EditorExportPreset::ExportFilter p_export_filter);
+ void _propagate_file_export_mode(TreeItem *p_item, EditorExportPreset::FileExportMode p_inherited_export_mode);
void _tree_changed();
void _check_propagated_to_item(Object *p_obj, int column);
void _tree_popup_edited(bool p_arrow_clicked);
diff --git a/editor/filesystem_dock.cpp b/editor/filesystem_dock.cpp
index 378e06b4c9..e1924c7994 100644
--- a/editor/filesystem_dock.cpp
+++ b/editor/filesystem_dock.cpp
@@ -241,8 +241,8 @@ void FileSystemDock::_update_tree(const Vector<String> &p_uncollapsed_paths, boo
}
for (int i = 0; i < favorite_paths.size(); i++) {
- String fave = favorite_paths[i];
- if (!fave.begins_with("res://")) {
+ String favorite = favorite_paths[i];
+ if (!favorite.begins_with("res://")) {
continue;
}
@@ -252,18 +252,18 @@ void FileSystemDock::_update_tree(const Vector<String> &p_uncollapsed_paths, boo
String text;
Ref<Texture2D> icon;
Color color;
- if (fave == "res://") {
+ if (favorite == "res://") {
text = "/";
icon = folder_icon;
color = folder_color;
- } else if (fave.ends_with("/")) {
- text = fave.substr(0, fave.length() - 1).get_file();
+ } else if (favorite.ends_with("/")) {
+ text = favorite.substr(0, favorite.length() - 1).get_file();
icon = folder_icon;
color = folder_color;
} else {
- text = fave.get_file();
+ text = favorite.get_file();
int index;
- EditorFileSystemDirectory *dir = EditorFileSystem::get_singleton()->find_file(fave, &index);
+ EditorFileSystemDirectory *dir = EditorFileSystem::get_singleton()->find_file(favorite, &index);
if (dir) {
icon = _get_tree_item_icon(dir->get_file_import_is_valid(index), dir->get_file_type(index));
} else {
@@ -277,18 +277,18 @@ void FileSystemDock::_update_tree(const Vector<String> &p_uncollapsed_paths, boo
ti->set_text(0, text);
ti->set_icon(0, icon);
ti->set_icon_modulate(0, color);
- ti->set_tooltip_text(0, fave);
+ ti->set_tooltip_text(0, favorite);
ti->set_selectable(0, true);
- ti->set_metadata(0, fave);
- if (p_select_in_favorites && fave == path) {
+ ti->set_metadata(0, favorite);
+ if (p_select_in_favorites && favorite == path) {
ti->select(0);
ti->set_as_cursor(0);
}
- if (!fave.ends_with("/")) {
+ if (!favorite.ends_with("/")) {
Array udata;
udata.push_back(tree_update_id);
udata.push_back(ti);
- EditorResourcePreview::get_singleton()->queue_resource_preview(fave, this, "_tree_thumbnail_done", udata);
+ EditorResourcePreview::get_singleton()->queue_resource_preview(favorite, this, "_tree_thumbnail_done", udata);
}
}
}
@@ -2636,24 +2636,31 @@ void FileSystemDock::_file_and_folders_fill_popup(PopupMenu *p_popup, Vector<Str
new_menu->connect("id_pressed", callable_mp(this, &FileSystemDock::_tree_rmb_option));
p_popup->add_child(new_menu);
- p_popup->add_submenu_item(TTR("New"), "New");
+ p_popup->add_submenu_item(TTR("New"), "New", FILE_NEW);
new_menu->add_icon_item(get_theme_icon(SNAME("Folder"), SNAME("EditorIcons")), TTR("Folder..."), FILE_NEW_FOLDER);
new_menu->add_icon_item(get_theme_icon(SNAME("PackedScene"), SNAME("EditorIcons")), TTR("Scene..."), FILE_NEW_SCENE);
new_menu->add_icon_item(get_theme_icon(SNAME("Script"), SNAME("EditorIcons")), TTR("Script..."), FILE_NEW_SCRIPT);
new_menu->add_icon_item(get_theme_icon(SNAME("Object"), SNAME("EditorIcons")), TTR("Resource..."), FILE_NEW_RESOURCE);
new_menu->add_icon_item(get_theme_icon(SNAME("TextFile"), SNAME("EditorIcons")), TTR("TextFile..."), FILE_NEW_TEXTFILE);
+#if !defined(ANDROID_ENABLED) && !defined(WEB_ENABLED)
p_popup->add_separator();
+#endif
}
- String fpath = p_paths[0];
- bool is_directory = fpath.ends_with("/");
- String item_text = is_directory ? TTR("Open in File Manager") : TTR("Show in File Manager");
+ const String fpath = p_paths[0];
+
+#if !defined(ANDROID_ENABLED) && !defined(WEB_ENABLED)
+ // Opening the system file manager is not supported on the Android and web editors.
+ const bool is_directory = fpath.ends_with("/");
+ const String item_text = is_directory ? TTR("Open in File Manager") : TTR("Show in File Manager");
p_popup->add_icon_shortcut(get_theme_icon(SNAME("Filesystem"), SNAME("EditorIcons")), ED_GET_SHORTCUT("filesystem_dock/show_in_explorer"), FILE_SHOW_IN_EXPLORER);
p_popup->set_item_text(p_popup->get_item_index(FILE_SHOW_IN_EXPLORER), item_text);
if (!is_directory) {
p_popup->add_icon_shortcut(get_theme_icon(SNAME("ExternalLink"), SNAME("EditorIcons")), ED_GET_SHORTCUT("filesystem_dock/open_in_external_program"), FILE_OPEN_EXTERNAL);
}
+#endif
+
path = fpath;
}
}
@@ -2697,8 +2704,11 @@ void FileSystemDock::_tree_empty_click(const Vector2 &p_pos, MouseButton p_butto
tree_popup->add_icon_item(get_theme_icon(SNAME("Script"), SNAME("EditorIcons")), TTR("New Script..."), FILE_NEW_SCRIPT);
tree_popup->add_icon_item(get_theme_icon(SNAME("Object"), SNAME("EditorIcons")), TTR("New Resource..."), FILE_NEW_RESOURCE);
tree_popup->add_icon_item(get_theme_icon(SNAME("TextFile"), SNAME("EditorIcons")), TTR("New TextFile..."), FILE_NEW_TEXTFILE);
+#if !defined(ANDROID_ENABLED) && !defined(WEB_ENABLED)
+ // Opening the system file manager is not supported on the Android and web editors.
tree_popup->add_separator();
tree_popup->add_icon_shortcut(get_theme_icon(SNAME("Filesystem"), SNAME("EditorIcons")), ED_GET_SHORTCUT("filesystem_dock/show_in_explorer"), FILE_SHOW_IN_EXPLORER);
+#endif
tree_popup->set_position(tree->get_screen_position() + p_pos);
tree_popup->reset_size();
@@ -3120,8 +3130,11 @@ FileSystemDock::FileSystemDock() {
ED_SHORTCUT("filesystem_dock/delete", TTR("Delete"), Key::KEY_DELETE);
ED_SHORTCUT("filesystem_dock/rename", TTR("Rename..."), Key::F2);
ED_SHORTCUT_OVERRIDE("filesystem_dock/rename", "macos", Key::ENTER);
+#if !defined(ANDROID_ENABLED) && !defined(WEB_ENABLED)
+ // Opening the system file manager or opening in an external program is not supported on the Android and web editors.
ED_SHORTCUT("filesystem_dock/show_in_explorer", TTR("Open in File Manager"));
ED_SHORTCUT("filesystem_dock/open_in_external_program", TTR("Open in External Program"));
+#endif
VBoxContainer *top_vbc = memnew(VBoxContainer);
add_child(top_vbc);
diff --git a/editor/filesystem_dock.h b/editor/filesystem_dock.h
index ede6869eea..9060f5c0a4 100644
--- a/editor/filesystem_dock.h
+++ b/editor/filesystem_dock.h
@@ -90,17 +90,18 @@ private:
FILE_DUPLICATE,
FILE_REIMPORT,
FILE_INFO,
- FILE_NEW_FOLDER,
- FILE_NEW_SCRIPT,
- FILE_NEW_SCENE,
+ FILE_NEW,
FILE_SHOW_IN_EXPLORER,
FILE_OPEN_EXTERNAL,
FILE_COPY_PATH,
FILE_COPY_UID,
- FILE_NEW_RESOURCE,
- FILE_NEW_TEXTFILE,
FOLDER_EXPAND_ALL,
FOLDER_COLLAPSE_ALL,
+ FILE_NEW_RESOURCE,
+ FILE_NEW_TEXTFILE,
+ FILE_NEW_FOLDER,
+ FILE_NEW_SCRIPT,
+ FILE_NEW_SCENE,
};
FileSortOption file_sort = FILE_SORT_NAME;
diff --git a/editor/icons/AnimatableBody2D.svg b/editor/icons/AnimatableBody2D.svg
index f4fed813c9..e6057feeff 100644
--- a/editor/icons/AnimatableBody2D.svg
+++ b/editor/icons/AnimatableBody2D.svg
@@ -1 +1 @@
-<svg clip-rule="evenodd" fill-rule="evenodd" stroke-linecap="round" stroke-linejoin="round" stroke-miterlimit="1.5" viewBox="0 0 16 16" xmlns="http://www.w3.org/2000/svg"><g fill="#8da5f3" fill-opacity=".99" stroke-width="1.08904"><path d="m10.86822576 4.28299076h1.99947744v1.99947744h-1.99947744z"/><path d="m10.86822576 10.84273776h1.99947744v1.99947744h-1.99947744z"/><path d="m4.71256576 10.84273776h1.99947744v1.99947744h-1.99947744z"/></g><g fill="none" stroke="#8da5f3"><path d="m1.635 8.161v4.848c0 .713.579 1.293 1.292 1.293h9.857c.713 0 1.291-.58 1.291-1.293v-9.854c0-.714-.578-1.293-1.291-1.293h-5.526" stroke-width="1.07" transform="matrix(.939225 0 0 .938055 1.27996 1.07595)"/><path d="m1.339 1.364 2.539 2.539" stroke-width=".74" transform="matrix(2.04823 .655864 .655864 2.04823 -1.51683 -1.5267)"/><path d="m1.436 1.461 1.168 1.168" stroke-width="1.18" transform="matrix(1.69185 0 0 1.69185 4.50755 -.792876)"/><path d="m1.385 1.41 1.219 1.219" stroke-width="1.22" transform="matrix(1.63859 0 0 1.63859 -.688679 4.82985)"/></g></svg>
+<svg clip-rule="evenodd" fill-rule="evenodd" stroke-linecap="round" stroke-linejoin="round" stroke-miterlimit="1.5" viewBox="0 0 16 16" xmlns="http://www.w3.org/2000/svg"><g fill="#8da5f3" stroke-width="1.08904"><path d="m10.86822576 4.28299076h1.99947744v1.99947744h-1.99947744z"/><path d="m10.86822576 10.84273776h1.99947744v1.99947744h-1.99947744z"/><path d="m4.71256576 10.84273776h1.99947744v1.99947744h-1.99947744z"/></g><g fill="none" stroke="#8da5f3"><path d="m1.635 8.161v4.848c0 .713.579 1.293 1.292 1.293h9.857c.713 0 1.291-.58 1.291-1.293v-9.854c0-.714-.578-1.293-1.291-1.293h-5.526" stroke-width="1.07" transform="matrix(.939225 0 0 .938055 1.27996 1.07595)"/><path d="m1.339 1.364 2.539 2.539" stroke-width=".74" transform="matrix(2.04823 .655864 .655864 2.04823 -1.51683 -1.5267)"/><path d="m1.436 1.461 1.168 1.168" stroke-width="1.18" transform="matrix(1.69185 0 0 1.69185 4.50755 -.792876)"/><path d="m1.385 1.41 1.219 1.219" stroke-width="1.22" transform="matrix(1.63859 0 0 1.63859 -.688679 4.82985)"/></g></svg>
diff --git a/editor/icons/AnimatableBody3D.svg b/editor/icons/AnimatableBody3D.svg
index 2e472f0625..0724e2cbfa 100644
--- a/editor/icons/AnimatableBody3D.svg
+++ b/editor/icons/AnimatableBody3D.svg
@@ -1 +1 @@
-<svg clip-rule="evenodd" fill-rule="evenodd" stroke-linecap="round" stroke-linejoin="round" stroke-miterlimit="1.5" viewBox="0 0 16 16" xmlns="http://www.w3.org/2000/svg"><g fill="#fc7f7f" fill-opacity=".99" stroke-width="1.08904"><path d="m10.86822576 4.28299076h1.99947744v1.99947744h-1.99947744z"/><path d="m10.86822576 10.84273776h1.99947744v1.99947744h-1.99947744z"/><path d="m4.71256576 10.84273776h1.99947744v1.99947744h-1.99947744z"/></g><g fill="none" stroke="#fc7f7f"><path d="m1.635 8.161v4.848c0 .713.579 1.293 1.292 1.293h9.857c.713 0 1.291-.58 1.291-1.293v-9.854c0-.714-.578-1.293-1.291-1.293h-5.526" stroke-width="1.07" transform="matrix(.939225 0 0 .938055 1.27996 1.07595)"/><path d="m1.339 1.364 2.539 2.539" stroke-width=".74" transform="matrix(2.04823 .655864 .655864 2.04823 -1.51683 -1.5267)"/><path d="m1.436 1.461 1.168 1.168" stroke-width="1.18" transform="matrix(1.69185 0 0 1.69185 4.50755 -.792876)"/><path d="m1.385 1.41 1.219 1.219" stroke-width="1.22" transform="matrix(1.63859 0 0 1.63859 -.688679 4.82985)"/></g></svg>
+<svg clip-rule="evenodd" fill-rule="evenodd" stroke-linecap="round" stroke-linejoin="round" stroke-miterlimit="1.5" viewBox="0 0 16 16" xmlns="http://www.w3.org/2000/svg"><g fill="#fc7f7f" stroke-width="1.08904"><path d="m10.86822576 4.28299076h1.99947744v1.99947744h-1.99947744z"/><path d="m10.86822576 10.84273776h1.99947744v1.99947744h-1.99947744z"/><path d="m4.71256576 10.84273776h1.99947744v1.99947744h-1.99947744z"/></g><g fill="none" stroke="#fc7f7f"><path d="m1.635 8.161v4.848c0 .713.579 1.293 1.292 1.293h9.857c.713 0 1.291-.58 1.291-1.293v-9.854c0-.714-.578-1.293-1.291-1.293h-5.526" stroke-width="1.07" transform="matrix(.939225 0 0 .938055 1.27996 1.07595)"/><path d="m1.339 1.364 2.539 2.539" stroke-width=".74" transform="matrix(2.04823 .655864 .655864 2.04823 -1.51683 -1.5267)"/><path d="m1.436 1.461 1.168 1.168" stroke-width="1.18" transform="matrix(1.69185 0 0 1.69185 4.50755 -.792876)"/><path d="m1.385 1.41 1.219 1.219" stroke-width="1.22" transform="matrix(1.63859 0 0 1.63859 -.688679 4.82985)"/></g></svg>
diff --git a/editor/icons/AnimationLibrary.svg b/editor/icons/AnimationLibrary.svg
index 0bac67d302..097a53a41d 100644
--- a/editor/icons/AnimationLibrary.svg
+++ b/editor/icons/AnimationLibrary.svg
@@ -1 +1 @@
-<svg height="16" width="16" xmlns="http://www.w3.org/2000/svg"><path d="M14.519 2.006A6 6 0 0 0 8.599 8a6 6 0 0 0 5.92 5.994v-1.01a1 1 0 0 1-.92-.984 1 1 0 0 1 .92-.984V4.984a1 1 0 0 1-.92-.984 1 1 0 0 1 .92-.984Zm-3.432 2.996a1 1 0 0 1 .547.133 1 1 0 0 1 .367 1.365 1 1 0 0 1-1.367.365A1 1 0 0 1 10.27 5.5a1 1 0 0 1 .818-.498ZM11.111 9a1 1 0 0 1 .89.5 1 1 0 0 1-.367 1.365 1 1 0 0 1-1.365-.365 1 1 0 0 1 .365-1.365A1 1 0 0 1 11.111 9Z" style="fill:#e0e0e0;fill-opacity:1"/><path d="M11.094 2.104a6 6 0 0 0-5.92 5.994 6 6 0 0 0 5.92 5.994v-.023a5.795 6.506 0 0 1-2.89-3.104 1 1 0 0 1-1.36-.367 1 1 0 0 1 .365-1.365 1 1 0 0 1 .475-.135 5.795 6.506 0 0 1-.076-.984 5.795 6.506 0 0 1 .082-1.027 1 1 0 0 1-.48-.124 1 1 0 0 1-.366-1.365 1 1 0 0 1 .818-.498 1 1 0 0 1 .547.133 1 1 0 0 1 .004.002 5.795 6.506 0 0 1 2.881-3.076z" style="fill:#e0e0e0;fill-opacity:1"/><path d="M7.616 2.104a6 6 0 0 0-5.92 5.994 6 6 0 0 0 5.92 5.994v-.023a5.795 6.506 0 0 1-2.89-3.104 1 1 0 0 1-1.36-.367 1 1 0 0 1 .366-1.365 1 1 0 0 1 .474-.135 5.795 6.506 0 0 1-.076-.984 5.795 6.506 0 0 1 .082-1.027 1 1 0 0 1-.48-.124 1 1 0 0 1-.366-1.365 1 1 0 0 1 .819-.498 1 1 0 0 1 .547.133 1 1 0 0 1 .003.002 5.795 6.506 0 0 1 2.881-3.076z" style="fill:#e0e0e0;fill-opacity:1"/></svg>
+<svg height="16" width="16" xmlns="http://www.w3.org/2000/svg"><path d="M14.519 2.006A6 6 0 0 0 8.599 8a6 6 0 0 0 5.92 5.994v-1.01a1 1 0 0 1-.92-.984 1 1 0 0 1 .92-.984V4.984a1 1 0 0 1-.92-.984 1 1 0 0 1 .92-.984Zm-3.432 2.996a1 1 0 0 1 .547.133 1 1 0 0 1 .367 1.365 1 1 0 0 1-1.367.365A1 1 0 0 1 10.27 5.5a1 1 0 0 1 .818-.498ZM11.111 9a1 1 0 0 1 .89.5 1 1 0 0 1-.367 1.365 1 1 0 0 1-1.365-.365 1 1 0 0 1 .365-1.365A1 1 0 0 1 11.111 9Z" fill="#e0e0e0"/><path d="M11.094 2.104a6 6 0 0 0-5.92 5.994 6 6 0 0 0 5.92 5.994v-.023a5.795 6.506 0 0 1-2.89-3.104 1 1 0 0 1-1.36-.367 1 1 0 0 1 .365-1.365 1 1 0 0 1 .475-.135 5.795 6.506 0 0 1-.076-.984 5.795 6.506 0 0 1 .082-1.027 1 1 0 0 1-.48-.124 1 1 0 0 1-.366-1.365 1 1 0 0 1 .818-.498 1 1 0 0 1 .547.133 1 1 0 0 1 .004.002 5.795 6.506 0 0 1 2.881-3.076z" fill="#e0e0e0"/><path d="M7.616 2.104a6 6 0 0 0-5.92 5.994 6 6 0 0 0 5.92 5.994v-.023a5.795 6.506 0 0 1-2.89-3.104 1 1 0 0 1-1.36-.367 1 1 0 0 1 .366-1.365 1 1 0 0 1 .474-.135 5.795 6.506 0 0 1-.076-.984 5.795 6.506 0 0 1 .082-1.027 1 1 0 0 1-.48-.124 1 1 0 0 1-.366-1.365 1 1 0 0 1 .819-.498 1 1 0 0 1 .547.133 1 1 0 0 1 .003.002 5.795 6.506 0 0 1 2.881-3.076z" fill="#e0e0e0"/></svg>
diff --git a/editor/icons/CPUParticles2D.svg b/editor/icons/CPUParticles2D.svg
index 2a2c616954..a446039b81 100644
--- a/editor/icons/CPUParticles2D.svg
+++ b/editor/icons/CPUParticles2D.svg
@@ -1 +1 @@
-<svg height="16" viewBox="0 0 16 16" width="16" xmlns="http://www.w3.org/2000/svg"><path d="m4.5587261.60940813c-.4226244 0-.7617187.3410473-.7617187.76367177v.5078126c0 .1028478.020058.199689.056641.2890624h-1.1933597c-.4226245 0-.7617188.3390944-.7617188.7617188v.921875c-.040428-.00657-.0767989-.0234375-.1191406-.0234375h-.5078125c-.42262448 0-.76367188.3410475-.76367188.7636719v.3730468c0 .4226245.3410474.7617188.76367188.7617188h.5078125c.042396 0 .078663-.016851.1191406-.023437v4.4531248c-.040428-.0066-.076799-.02344-.1191406-.02344h-.5078125c-.42262448 0-.76367188.341047-.76367188.763672v.373047c0 .422625.3410474.761718.76367188.761718h.5078125c.042396 0 .078663-.01685.1191406-.02344v1.125c0 .422624.3390944.763672.7617188.763672h1.1367187v.457031c0 .422624.3390943.763672.7617187.763672h.3730469c.4226244 0 .7636719-.341048.7636719-.763672v-.457031h4.4062501v.457031c0 .422624.339094.763672.761719.763672h.373047c.422624 0 .763671-.341048.763671-.763672v-.457031h1.269532c.422625 0 .763672-.341048.763672-.763672v-1.111328c.01774.0012.03272.0098.05078.0098h.507812c.422624 0 .763672-.339093.763672-.761718v-.373047c0-.422624-.341048-.763672-.763672-.763672h-.507812c-.01803 0-.03307.0085-.05078.0098v-4.4258454c.01774.00122.03272.00977.05078.00977h.507812c.422624 0 .763672-.3390943.763672-.7617188v-.3730512c0-.4226244-.341048-.7636719-.763672-.7636719h-.507812c-.01803 0-.03307.00855-.05078.00977v-.9082075c0-.4226244-.341047-.7617187-.763672-.7617188h-1.328125c.03658-.089375.05859-.1862118.05859-.2890624v-.5078126c0-.42262437-.341047-.76367177-.763671-.76367177h-.373047c-.422625 0-.761719.3410474-.761719.76367177v.5078126c0 .1028478.02006.1996891.05664.2890624h-4.5214809c.036585-.0893749.0585938-.1862118.0585938-.2890624v-.5078126c0-.42262437-.3410475-.76367177-.7636719-.76367177zm3.2382813 2.35742177a3.279661 3.6440678 0 0 1 3.2128906 2.9394532 2.1864407 2.1864407 0 0 1 1.888672 2.1621094 2.1864407 2.1864407 0 0 1 -2.1875 2.1855475h-5.8300782a2.1864407 2.1864407 0 0 1 -2.1855469-2.1855475 2.1864407 2.1864407 0 0 1 1.8847656-2.1640626 3.279661 3.6440678 0 0 1 3.2167969-2.9375zm-2.9160156 8.0156251a.72881355.72881355 0 0 1 .7285156.728516.72881355.72881355 0 0 1 -.7285156.730469.72881355.72881355 0 0 1 -.7285157-.730469.72881355.72881355 0 0 1 .7285157-.728516zm5.8300782 0a.72881355.72881355 0 0 1 .730469.728516.72881355.72881355 0 0 1 -.730469.730469.72881355.72881355 0 0 1 -.7285157-.730469.72881355.72881355 0 0 1 .7285157-.728516zm-2.9140626.728516a.72881355.72881355 0 0 1 .7285156.730469.72881355.72881355 0 0 1 -.7285156.728515.72881355.72881355 0 0 1 -.7285156-.728515.72881355.72881355 0 0 1 .7285156-.730469z" fill="#8da5f3" fill-opacity=".992157"/></svg>
+<svg height="16" viewBox="0 0 16 16" width="16" xmlns="http://www.w3.org/2000/svg"><path d="m4.5587261.60940813c-.4226244 0-.7617187.3410473-.7617187.76367177v.5078126c0 .1028478.020058.199689.056641.2890624h-1.1933597c-.4226245 0-.7617188.3390944-.7617188.7617188v.921875c-.040428-.00657-.0767989-.0234375-.1191406-.0234375h-.5078125c-.42262448 0-.76367188.3410475-.76367188.7636719v.3730468c0 .4226245.3410474.7617188.76367188.7617188h.5078125c.042396 0 .078663-.016851.1191406-.023437v4.4531248c-.040428-.0066-.076799-.02344-.1191406-.02344h-.5078125c-.42262448 0-.76367188.341047-.76367188.763672v.373047c0 .422625.3410474.761718.76367188.761718h.5078125c.042396 0 .078663-.01685.1191406-.02344v1.125c0 .422624.3390944.763672.7617188.763672h1.1367187v.457031c0 .422624.3390943.763672.7617187.763672h.3730469c.4226244 0 .7636719-.341048.7636719-.763672v-.457031h4.4062501v.457031c0 .422624.339094.763672.761719.763672h.373047c.422624 0 .763671-.341048.763671-.763672v-.457031h1.269532c.422625 0 .763672-.341048.763672-.763672v-1.111328c.01774.0012.03272.0098.05078.0098h.507812c.422624 0 .763672-.339093.763672-.761718v-.373047c0-.422624-.341048-.763672-.763672-.763672h-.507812c-.01803 0-.03307.0085-.05078.0098v-4.4258454c.01774.00122.03272.00977.05078.00977h.507812c.422624 0 .763672-.3390943.763672-.7617188v-.3730512c0-.4226244-.341048-.7636719-.763672-.7636719h-.507812c-.01803 0-.03307.00855-.05078.00977v-.9082075c0-.4226244-.341047-.7617187-.763672-.7617188h-1.328125c.03658-.089375.05859-.1862118.05859-.2890624v-.5078126c0-.42262437-.341047-.76367177-.763671-.76367177h-.373047c-.422625 0-.761719.3410474-.761719.76367177v.5078126c0 .1028478.02006.1996891.05664.2890624h-4.5214809c.036585-.0893749.0585938-.1862118.0585938-.2890624v-.5078126c0-.42262437-.3410475-.76367177-.7636719-.76367177zm3.2382813 2.35742177a3.279661 3.6440678 0 0 1 3.2128906 2.9394532 2.1864407 2.1864407 0 0 1 1.888672 2.1621094 2.1864407 2.1864407 0 0 1 -2.1875 2.1855475h-5.8300782a2.1864407 2.1864407 0 0 1 -2.1855469-2.1855475 2.1864407 2.1864407 0 0 1 1.8847656-2.1640626 3.279661 3.6440678 0 0 1 3.2167969-2.9375zm-2.9160156 8.0156251a.72881355.72881355 0 0 1 .7285156.728516.72881355.72881355 0 0 1 -.7285156.730469.72881355.72881355 0 0 1 -.7285157-.730469.72881355.72881355 0 0 1 .7285157-.728516zm5.8300782 0a.72881355.72881355 0 0 1 .730469.728516.72881355.72881355 0 0 1 -.730469.730469.72881355.72881355 0 0 1 -.7285157-.730469.72881355.72881355 0 0 1 .7285157-.728516zm-2.9140626.728516a.72881355.72881355 0 0 1 .7285156.730469.72881355.72881355 0 0 1 -.7285156.728515.72881355.72881355 0 0 1 -.7285156-.728515.72881355.72881355 0 0 1 .7285156-.730469z" fill="#8da5f3"/></svg>
diff --git a/editor/icons/CollisionPolygon2D.svg b/editor/icons/CollisionPolygon2D.svg
index a882943847..215bcc0d08 100644
--- a/editor/icons/CollisionPolygon2D.svg
+++ b/editor/icons/CollisionPolygon2D.svg
@@ -1 +1 @@
-<svg height="16" viewBox="0 0 16 16" width="16" xmlns="http://www.w3.org/2000/svg"><path d="m14 1050.4h-12v-12h12l-6 6z" fill="none" stroke="#8da5f3" stroke-linejoin="round" stroke-opacity=".98824" stroke-width="2" transform="translate(0 -1036.4)"/></svg>
+<svg height="16" viewBox="0 0 16 16" width="16" xmlns="http://www.w3.org/2000/svg"><path d="m14 1050.4h-12v-12h12l-6 6z" fill="none" stroke="#8da5f3" stroke-linejoin="round" stroke-width="2" transform="translate(0 -1036.4)"/></svg>
diff --git a/editor/icons/CollisionShape2D.svg b/editor/icons/CollisionShape2D.svg
index 0acad74379..3f15d173b8 100644
--- a/editor/icons/CollisionShape2D.svg
+++ b/editor/icons/CollisionShape2D.svg
@@ -1 +1 @@
-<svg height="16" viewBox="0 0 16 16" width="16" xmlns="http://www.w3.org/2000/svg"><path d="m14 1050.4h-12v-12h12z" fill="none" stroke="#8da5f3" stroke-linejoin="round" stroke-opacity=".98824" stroke-width="2" transform="translate(0 -1036.4)"/></svg>
+<svg height="16" viewBox="0 0 16 16" width="16" xmlns="http://www.w3.org/2000/svg"><path d="m14 1050.4h-12v-12h12z" fill="none" stroke="#8da5f3" stroke-linejoin="round" stroke-width="2" transform="translate(0 -1036.4)"/></svg>
diff --git a/editor/icons/DampedSpringJoint2D.svg b/editor/icons/DampedSpringJoint2D.svg
index 99e1a1f1e1..cba54bbd99 100644
--- a/editor/icons/DampedSpringJoint2D.svg
+++ b/editor/icons/DampedSpringJoint2D.svg
@@ -1 +1 @@
-<svg height="16" viewBox="0 0 16 16" width="16" xmlns="http://www.w3.org/2000/svg"><g fill-opacity=".98824"><path d="m4 3v2l8 3v-2zm0 5v2l8 3v-2z" fill="#4b70ea"/><path d="m4 3v2l8-2v-2zm0 5v2l8-2v-2zm0 5v2l8-2v-2z" fill="#8da5f3"/></g></svg>
+<svg height="16" viewBox="0 0 16 16" width="16" xmlns="http://www.w3.org/2000/svg"><path d="m4 3v2l8 3v-2zm0 5v2l8 3v-2z" fill="#4b70ea"/><path d="m4 3v2l8-2v-2zm0 5v2l8-2v-2zm0 5v2l8-2v-2z" fill="#8da5f3"/></svg>
diff --git a/editor/icons/FontFile.svg b/editor/icons/FontFile.svg
index c014299783..6b98c269f8 100644
--- a/editor/icons/FontFile.svg
+++ b/editor/icons/FontFile.svg
@@ -1 +1 @@
-<svg height="16" width="16" xmlns="http://www.w3.org/2000/svg"><path d="M7.5 7.5h-1a.519.519 0 0 0-.281.084A.491.491 0 0 0 6 8v.5h-.5V9a1 1 0 0 1-1 1v1H8V9.854A1 1 0 0 1 7.5 9V7.5zM1.5 1v3h1a1 1 0 0 1 1-1h2v1.5h2V3h2a1 1 0 0 1 1 1h1V1h-10z" style="fill:#e0e0e0;fill-opacity:1"/><path d="M4.5 5v3h1a1 1 0 0 1 1-1h2v6a1 1 0 0 1-1 1v1h4v-1a1 1 0 0 1-1-1V7h2a1 1 0 0 1 1 1h1V5h-6z" fill="#ff5f5f"/></svg>
+<svg height="16" width="16" xmlns="http://www.w3.org/2000/svg"><path d="M7.5 7.5h-1a.519.519 0 0 0-.281.084A.491.491 0 0 0 6 8v.5h-.5V9a1 1 0 0 1-1 1v1H8V9.854A1 1 0 0 1 7.5 9V7.5zM1.5 1v3h1a1 1 0 0 1 1-1h2v1.5h2V3h2a1 1 0 0 1 1 1h1V1h-10z" fill="#e0e0e0"/><path d="M4.5 5v3h1a1 1 0 0 1 1-1h2v6a1 1 0 0 1-1 1v1h4v-1a1 1 0 0 1-1-1V7h2a1 1 0 0 1 1 1h1V5h-6z" fill="#ff5f5f"/></svg>
diff --git a/editor/icons/FontVariation.svg b/editor/icons/FontVariation.svg
index 39917bcba9..9488679af2 100644
--- a/editor/icons/FontVariation.svg
+++ b/editor/icons/FontVariation.svg
@@ -1 +1 @@
-<svg height="16" width="16" xml:space="preserve" xmlns="http://www.w3.org/2000/svg"><path d="M5.975 11 7.21 7.5H5.916a.478.478 0 0 0-.113.016.837.837 0 0 0-.127.043c-.044.018-.089.04-.133.066l-.043.027V9a1 1 0 0 1-1 1v1h1.475zM1.5 1v3h1a1 1 0 0 1 1-1h2v1.5h2V3h2a1 1 0 0 1 1 1h1V1h-10z" style="fill:#e0e0e0;fill-opacity:1"/><path d="m4.621 5-.705 2-.353 1h1a.84 1.192 49.998 0 1 1.353-1h2L5.8 13a.84 1.192 49.998 0 1-1.353 1l-.353 1h4l.353-1a.84 1.192 49.998 0 1-.647-1l2.116-6h2a.84 1.192 49.998 0 1 .647 1h1l.353-1 .705-2h-6z" fill="#ff5f5f"/></svg>
+<svg height="16" width="16" xml:space="preserve" xmlns="http://www.w3.org/2000/svg"><path d="M5.975 11 7.21 7.5H5.916a.478.478 0 0 0-.113.016.837.837 0 0 0-.127.043c-.044.018-.089.04-.133.066l-.043.027V9a1 1 0 0 1-1 1v1h1.475zM1.5 1v3h1a1 1 0 0 1 1-1h2v1.5h2V3h2a1 1 0 0 1 1 1h1V1h-10z" fill="#e0e0e0"/><path d="m4.621 5-.705 2-.353 1h1a.84 1.192 49.998 0 1 1.353-1h2L5.8 13a.84 1.192 49.998 0 1-1.353 1l-.353 1h4l.353-1a.84 1.192 49.998 0 1-.647-1l2.116-6h2a.84 1.192 49.998 0 1 .647 1h1l.353-1 .705-2h-6z" fill="#ff5f5f"/></svg>
diff --git a/editor/icons/GizmoDirectionalLight.svg b/editor/icons/GizmoDirectionalLight.svg
index d943be79f0..cb80b31f91 100644
--- a/editor/icons/GizmoDirectionalLight.svg
+++ b/editor/icons/GizmoDirectionalLight.svg
@@ -1 +1 @@
-<svg height="128" viewBox="0 0 128 128" width="128" xmlns="http://www.w3.org/2000/svg"><path d="m64 4c-4.432 0-8 3.568-8 8v16c0 4.432 3.568 8 8 8s8-3.568 8-8v-16c0-4.432-3.568-8-8-8zm-36.77 15.223c-2.045 0-4.0893.78461-5.6562 2.3516-3.1339 3.1339-3.1339 8.1786 0 11.312l11.312 11.314c3.1339 3.1339 8.1806 3.1339 11.314 0s3.1339-8.1806 0-11.314l-11.314-11.312c-1.5669-1.5669-3.6113-2.3516-5.6562-2.3516zm73.539 0c-2.045 0-4.0893.78461-5.6562 2.3516l-11.314 11.312c-3.1339 3.1339-3.1339 8.1806 0 11.314s8.1806 3.1339 11.314 0l11.312-11.314c3.1339-3.1339 3.1339-8.1786 0-11.312-1.567-1.5669-3.6113-2.3516-5.6562-2.3516zm-36.77 20.777a24 24 0 0 0 -24 24 24 24 0 0 0 24 24 24 24 0 0 0 24-24 24 24 0 0 0 -24-24zm-52 16c-4.432 0-8 3.568-8 8s3.568 8 8 8h16c4.432 0 8-3.568 8-8s-3.568-8-8-8zm88 0c-4.432 0-8 3.568-8 8s3.568 8 8 8h16c4.432 0 8-3.568 8-8s-3.568-8-8-8zm-61.455 25.449c-2.045 0-4.0913.78266-5.6582 2.3496l-11.312 11.314c-3.1339 3.1339-3.1339 8.1786 0 11.312 3.1339 3.1339 8.1786 3.1339 11.312 0l11.314-11.312c3.1339-3.1339 3.1339-8.1806 0-11.314-1.5669-1.5669-3.6113-2.3496-5.6562-2.3496zm50.91 0c-2.045 0-4.0893.78266-5.6562 2.3496-3.1339 3.1339-3.1339 8.1806 0 11.314l11.314 11.312c3.1339 3.1339 8.1786 3.1339 11.312 0s3.1339-8.1786 0-11.312l-11.312-11.314c-1.5669-1.5669-3.6132-2.3496-5.6582-2.3496zm-25.455 10.551c-4.432 0-8 3.568-8 8v16c0 4.432 3.568 8 8 8s8-3.568 8-8v-16c0-4.432-3.568-8-8-8z" fill-opacity=".29412" stroke-linecap="round" stroke-linejoin="round" stroke-opacity=".98824" stroke-width="2"/><path d="m64 8c-2.216 0-4 1.784-4 4v16c0 2.216 1.784 4 4 4s4-1.784 4-4v-16c0-2.216-1.784-4-4-4zm-36.77 15.227c-1.0225 0-2.0447.39231-2.8281 1.1758-1.5669 1.5669-1.5669 4.0893 0 5.6562l11.312 11.314c1.5669 1.5669 4.0913 1.5669 5.6582 0s1.5669-4.0913 0-5.6582l-11.314-11.312c-.78348-.78348-1.8056-1.1758-2.8281-1.1758zm73.539 0c-1.0225 0-2.0446.39231-2.8281 1.1758l-11.314 11.312c-1.5669 1.5669-1.5669 4.0913 0 5.6582s4.0913 1.5669 5.6582 0l11.313-11.314c1.5669-1.5669 1.5669-4.0893 0-5.6562-.78348-.78348-1.8056-1.1758-2.8281-1.1758zm-36.77 20.773c-11.046.00001-20 8.9543-20 20 .000007 11.046 8.9543 20 20 20s20-8.9543 20-20c-.000008-11.046-8.9543-20-20-20zm-52 16c-2.216 0-4 1.784-4 4s1.784 4 4 4h16c2.216 0 4-1.784 4-4s-1.784-4-4-4zm88 0c-2.216 0-4 1.784-4 4s1.784 4 4 4h16c2.216 0 4-1.784 4-4s-1.784-4-4-4zm-61.455 25.453c-1.0225 0-2.0466.39035-2.8301 1.1738l-11.312 11.314c-1.5669 1.5669-1.5669 4.0893 0 5.6563 1.5669 1.5669 4.0893 1.5669 5.6562 0l11.314-11.313c1.5669-1.5669 1.5669-4.0913 0-5.6582-.78347-.78347-1.8056-1.1738-2.8281-1.1738zm50.91 0c-1.0225 0-2.0447.39035-2.8281 1.1738-1.5669 1.5669-1.5669 4.0913 0 5.6582l11.314 11.313c1.5669 1.5669 4.0893 1.5669 5.6563 0 1.5669-1.567 1.5669-4.0893 0-5.6563l-11.313-11.314c-.78347-.78347-1.8076-1.1738-2.8301-1.1738zm-25.455 10.547c-2.216 0-4 1.784-4 4v16c0 2.216 1.784 4 4 4s4-1.784 4-4v-16c0-2.216-1.784-4-4-4z" fill="#ffffff"/></svg>
+<svg height="128" viewBox="0 0 128 128" width="128" xmlns="http://www.w3.org/2000/svg"><path d="m64 4c-4.432 0-8 3.568-8 8v16c0 4.432 3.568 8 8 8s8-3.568 8-8v-16c0-4.432-3.568-8-8-8zm-36.77 15.223c-2.045 0-4.0893.78461-5.6562 2.3516-3.1339 3.1339-3.1339 8.1786 0 11.312l11.312 11.314c3.1339 3.1339 8.1806 3.1339 11.314 0s3.1339-8.1806 0-11.314l-11.314-11.312c-1.5669-1.5669-3.6113-2.3516-5.6562-2.3516zm73.539 0c-2.045 0-4.0893.78461-5.6562 2.3516l-11.314 11.312c-3.1339 3.1339-3.1339 8.1806 0 11.314s8.1806 3.1339 11.314 0l11.312-11.314c3.1339-3.1339 3.1339-8.1786 0-11.312-1.567-1.5669-3.6113-2.3516-5.6562-2.3516zm-36.77 20.777a24 24 0 0 0 -24 24 24 24 0 0 0 24 24 24 24 0 0 0 24-24 24 24 0 0 0 -24-24zm-52 16c-4.432 0-8 3.568-8 8s3.568 8 8 8h16c4.432 0 8-3.568 8-8s-3.568-8-8-8zm88 0c-4.432 0-8 3.568-8 8s3.568 8 8 8h16c4.432 0 8-3.568 8-8s-3.568-8-8-8zm-61.455 25.449c-2.045 0-4.0913.78266-5.6582 2.3496l-11.312 11.314c-3.1339 3.1339-3.1339 8.1786 0 11.312 3.1339 3.1339 8.1786 3.1339 11.312 0l11.314-11.312c3.1339-3.1339 3.1339-8.1806 0-11.314-1.5669-1.5669-3.6113-2.3496-5.6562-2.3496zm50.91 0c-2.045 0-4.0893.78266-5.6562 2.3496-3.1339 3.1339-3.1339 8.1806 0 11.314l11.314 11.312c3.1339 3.1339 8.1786 3.1339 11.312 0s3.1339-8.1786 0-11.312l-11.312-11.314c-1.5669-1.5669-3.6132-2.3496-5.6582-2.3496zm-25.455 10.551c-4.432 0-8 3.568-8 8v16c0 4.432 3.568 8 8 8s8-3.568 8-8v-16c0-4.432-3.568-8-8-8z" fill-opacity=".29412" stroke-linecap="round" stroke-linejoin="round" stroke-width="2"/><path d="m64 8c-2.216 0-4 1.784-4 4v16c0 2.216 1.784 4 4 4s4-1.784 4-4v-16c0-2.216-1.784-4-4-4zm-36.77 15.227c-1.0225 0-2.0447.39231-2.8281 1.1758-1.5669 1.5669-1.5669 4.0893 0 5.6562l11.312 11.314c1.5669 1.5669 4.0913 1.5669 5.6582 0s1.5669-4.0913 0-5.6582l-11.314-11.312c-.78348-.78348-1.8056-1.1758-2.8281-1.1758zm73.539 0c-1.0225 0-2.0446.39231-2.8281 1.1758l-11.314 11.312c-1.5669 1.5669-1.5669 4.0913 0 5.6582s4.0913 1.5669 5.6582 0l11.313-11.314c1.5669-1.5669 1.5669-4.0893 0-5.6562-.78348-.78348-1.8056-1.1758-2.8281-1.1758zm-36.77 20.773c-11.046.00001-20 8.9543-20 20 .000007 11.046 8.9543 20 20 20s20-8.9543 20-20c-.000008-11.046-8.9543-20-20-20zm-52 16c-2.216 0-4 1.784-4 4s1.784 4 4 4h16c2.216 0 4-1.784 4-4s-1.784-4-4-4zm88 0c-2.216 0-4 1.784-4 4s1.784 4 4 4h16c2.216 0 4-1.784 4-4s-1.784-4-4-4zm-61.455 25.453c-1.0225 0-2.0466.39035-2.8301 1.1738l-11.312 11.314c-1.5669 1.5669-1.5669 4.0893 0 5.6563 1.5669 1.5669 4.0893 1.5669 5.6562 0l11.314-11.313c1.5669-1.5669 1.5669-4.0913 0-5.6582-.78347-.78347-1.8056-1.1738-2.8281-1.1738zm50.91 0c-1.0225 0-2.0447.39035-2.8281 1.1738-1.5669 1.5669-1.5669 4.0913 0 5.6582l11.314 11.313c1.5669 1.5669 4.0893 1.5669 5.6563 0 1.5669-1.567 1.5669-4.0893 0-5.6563l-11.313-11.314c-.78347-.78347-1.8076-1.1738-2.8301-1.1738zm-25.455 10.547c-2.216 0-4 1.784-4 4v16c0 2.216 1.784 4 4 4s4-1.784 4-4v-16c0-2.216-1.784-4-4-4z" fill="#ffffff"/></svg>
diff --git a/editor/icons/GizmoLight.svg b/editor/icons/GizmoLight.svg
index 0f74ebbd3d..ff224f32c9 100644
--- a/editor/icons/GizmoLight.svg
+++ b/editor/icons/GizmoLight.svg
@@ -1 +1 @@
-<svg height="128" viewBox="0 0 128 128" width="128" xmlns="http://www.w3.org/2000/svg"><path d="m64 2a44 44 0 0 0 -44 44 44 44 0 0 0 24 39.189v5.8105 5 3c0 5.0515 3.3756 9.2769 8 10.578v16.422h24v-16.422c4.6244-1.3012 8-5.5266 8-10.578v-3-5-5.8574a44 44 0 0 0 24-39.143 44 44 0 0 0 -44-44zm0 20a24 24 0 0 1 24 24 24 24 0 0 1 -24 24 24 24 0 0 1 -24-24 24 24 0 0 1 24-24z" fill-opacity=".29412" stroke-linecap="round" stroke-linejoin="round" stroke-opacity=".98824" stroke-width="2.2"/><path d="m64 6a40 40 0 0 0 -40 40 40 40 0 0 0 24 36.607v15.393a8 8 0 0 0 8 8h16a8 8 0 0 0 8-8v-15.363a40 40 0 0 0 24-36.637 40 40 0 0 0 -40-40zm0 12a28 28 0 0 1 28 28 28 28 0 0 1 -28 28 28 28 0 0 1 -28-28 28 28 0 0 1 28-28zm-8 96v8h16v-8z" fill="#ffffff"/></svg>
+<svg height="128" viewBox="0 0 128 128" width="128" xmlns="http://www.w3.org/2000/svg"><path d="m64 2a44 44 0 0 0 -44 44 44 44 0 0 0 24 39.189v5.8105 5 3c0 5.0515 3.3756 9.2769 8 10.578v16.422h24v-16.422c4.6244-1.3012 8-5.5266 8-10.578v-3-5-5.8574a44 44 0 0 0 24-39.143 44 44 0 0 0 -44-44zm0 20a24 24 0 0 1 24 24 24 24 0 0 1 -24 24 24 24 0 0 1 -24-24 24 24 0 0 1 24-24z" fill-opacity=".29412" stroke-linecap="round" stroke-linejoin="round" stroke-width="2.2"/><path d="m64 6a40 40 0 0 0 -40 40 40 40 0 0 0 24 36.607v15.393a8 8 0 0 0 8 8h16a8 8 0 0 0 8-8v-15.363a40 40 0 0 0 24-36.637 40 40 0 0 0 -40-40zm0 12a28 28 0 0 1 28 28 28 28 0 0 1 -28 28 28 28 0 0 1 -28-28 28 28 0 0 1 28-28zm-8 96v8h16v-8z" fill="#ffffff"/></svg>
diff --git a/editor/icons/GradientTexture2D.svg b/editor/icons/GradientTexture2D.svg
index ef40323b8c..77d38cc089 100644
--- a/editor/icons/GradientTexture2D.svg
+++ b/editor/icons/GradientTexture2D.svg
@@ -1 +1 @@
-<svg height="16" viewBox="0 0 16 16" width="16" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink"> <g fill="#e0e0e0"> <path d="M 2,1 C 1.447715,1 1,1.4477153 1,2 v 12.000001 c 0,0.552285 0.447715,1 1,1 h 11.999999 c 0.552285,0 1,-0.447715 1,-1 V 2 c 0,-0.5522847 -0.447715,-1 -1,-1 z m 1,2.0000001 h 9.999999 V 11.000001 H 3 Z" fill-opacity="0.99608"/> <path d="m 5.5,3.5 v 1 h 1 v -1 z m 1,1 v 1 h 1 v -1 z m 1,0 h 1 v 1 h -1 v 1 h 1 v 1 h 1 v 1 h 1 v -1 h 1 v 1 h 1 v -1 -1 -1 -1 -1 h -1 -1 -1 -1 -1 z m 4,4 h -1 v 1 h 1 z m 0,1 v 1 h 1 v -1 z m -1,0 h -1 v 1 h 1 z m -1,0 v -1 h -1 v 1 z m -1,-1 v -1 h -1 v 1 z m -1,0 h -1 v 1 h 1 z m 0,-1 v -1 h -1 v 1 z m -1,-1 v -1 h -1 v 1 z" /> </g> </svg>
+<svg height="16" viewBox="0 0 16 16" width="16" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink"><g fill="#e0e0e0"><path d="M 2,1 C 1.447715,1 1,1.4477153 1,2 v 12.000001 c 0,0.552285 0.447715,1 1,1 h 11.999999 c 0.552285,0 1,-0.447715 1,-1 V 2 c 0,-0.5522847 -0.447715,-1 -1,-1 z m 1,2.0000001 h 9.999999 V 11.000001 H 3 Z"/><path d="m 5.5,3.5 v 1 h 1 v -1 z m 1,1 v 1 h 1 v -1 z m 1,0 h 1 v 1 h -1 v 1 h 1 v 1 h 1 v 1 h 1 v -1 h 1 v 1 h 1 v -1 -1 -1 -1 -1 h -1 -1 -1 -1 -1 z m 4,4 h -1 v 1 h 1 z m 0,1 v 1 h 1 v -1 z m -1,0 h -1 v 1 h 1 z m -1,0 v -1 h -1 v 1 z m -1,-1 v -1 h -1 v 1 z m -1,0 h -1 v 1 h 1 z m 0,-1 v -1 h -1 v 1 z m -1,-1 v -1 h -1 v 1 z" /></g></svg>
diff --git a/editor/icons/GrooveJoint2D.svg b/editor/icons/GrooveJoint2D.svg
index 0f7b84096c..0305d27685 100644
--- a/editor/icons/GrooveJoint2D.svg
+++ b/editor/icons/GrooveJoint2D.svg
@@ -1 +1 @@
-<svg height="16" viewBox="0 0 16 16" width="16" xmlns="http://www.w3.org/2000/svg"><path d="m15 1037.4h-5v6h-5v2h5v6h5zm-7 0h-7v14h7v-4h-5v-6h5z" fill="#8da5f3" fill-opacity=".98824" transform="translate(0 -1036.4)"/></svg>
+<svg height="16" viewBox="0 0 16 16" width="16" xmlns="http://www.w3.org/2000/svg"><path d="m15 1037.4h-5v6h-5v2h5v6h5zm-7 0h-7v14h7v-4h-5v-6h5z" fill="#8da5f3" transform="translate(0 -1036.4)"/></svg>
diff --git a/editor/icons/GroupViewport.svg b/editor/icons/GroupViewport.svg
index 1c22046ba1..331890e1de 100644
--- a/editor/icons/GroupViewport.svg
+++ b/editor/icons/GroupViewport.svg
@@ -1 +1 @@
-<svg height="16" viewBox="0 0 16 16" width="16" xmlns="http://www.w3.org/2000/svg"><path d="m0 0v4h4v-4zm6 0v6h-6v10h10v-6h6v-10zm4 4h2v2h-2zm2 8v4h4v-4z" fill-opacity=".39216" stroke-linecap="round" stroke-linejoin="round" stroke-opacity=".98824" stroke-width=".5"/><path d="m7 1v6h-6v8h8v-6h6v-8zm2 2h4v4h-4z" fill="#e0e0e0"/><path d="m1 1v2c0 .0000234.446 0 1 0s1 .0000234 1 0v-2c0-.00002341-.446 0-1 0s-1-.00002341-1 0zm12 0v2c0 .0000234.446 0 1 0s1 .0000234 1 0v-2c0-.00002341-.446 0-1 0s-1-.00002341-1 0zm-12 12v2c0 .000023.446 0 1 0s1 .000023 1 0v-2c0-.000023-.446 0-1 0s-1-.000023-1 0zm12 0v2c0 .000023.446 0 1 0s1 .000023 1 0v-2c0-.000023-.446 0-1 0s-1-.000023-1 0z" fill="#fff"/></svg>
+<svg height="16" viewBox="0 0 16 16" width="16" xmlns="http://www.w3.org/2000/svg"><path d="m0 0v4h4v-4zm6 0v6h-6v10h10v-6h6v-10zm4 4h2v2h-2zm2 8v4h4v-4z" fill-opacity=".39216" stroke-linecap="round" stroke-linejoin="round" stroke-width=".5"/><path d="m7 1v6h-6v8h8v-6h6v-8zm2 2h4v4h-4z" fill="#e0e0e0"/><path d="m1 1v2c0 .0000234.446 0 1 0s1 .0000234 1 0v-2c0-.00002341-.446 0-1 0s-1-.00002341-1 0zm12 0v2c0 .0000234.446 0 1 0s1 .0000234 1 0v-2c0-.00002341-.446 0-1 0s-1-.00002341-1 0zm-12 12v2c0 .000023.446 0 1 0s1 .000023 1 0v-2c0-.000023-.446 0-1 0s-1-.000023-1 0zm12 0v2c0 .000023.446 0 1 0s1 .000023 1 0v-2c0-.000023-.446 0-1 0s-1-.000023-1 0z" fill="#fff"/></svg>
diff --git a/editor/icons/Keyboard.svg b/editor/icons/Keyboard.svg
index b6d963f9d7..b00ed5dd21 100644
--- a/editor/icons/Keyboard.svg
+++ b/editor/icons/Keyboard.svg
@@ -1 +1 @@
-<svg xmlns="http://www.w3.org/2000/svg" xml:space="preserve" width="16" height="16"><path d="M6.584 5.135 6.17 4.059l-.412 1.076h.826zm3.203 2.976a1.032 1.032 0 0 0-.287.041.953.953 0 0 0-.09.034c-.028.012-.057.024-.084.039a.912.912 0 0 0-.152.107.988.988 0 0 0-.23.305.937.937 0 0 0-.04.097 1.017 1.017 0 0 0-.068.323 1.553 1.553 0 0 0 0 .244 1.374 1.374 0 0 0 .068.328 1.03 1.03 0 0 0 .201.336c.023.022.045.044.069.064a.96.96 0 0 0 .152.104c.027.015.056.027.084.039.03.012.06.024.09.033a.965.965 0 0 0 .19.035 1.028 1.028 0 0 0 .197 0 .974.974 0 0 0 .36-.107.876.876 0 0 0 .077-.049.872.872 0 0 0 .074-.055.882.882 0 0 0 .13-.136.978.978 0 0 0 .177-.368 1.225 1.225 0 0 0 .035-.224 1.61 1.61 0 0 0 0-.244 1.361 1.361 0 0 0-.035-.223 1.092 1.092 0 0 0-.121-.285.87.87 0 0 0-.12-.15.862.862 0 0 0-.14-.124c-.025-.017-.05-.035-.078-.05-.027-.015-.056-.027-.086-.04a.892.892 0 0 0-.373-.074z" style="fill-opacity:.99607843;fill:#e0e0e0"/><path d="M4 2c-.616-.02-1.084.59-1 1.178.003 3-.007 6 .005 9 .057.577.672.889 1.203.822 2.631-.003 5.263.006 7.894-.005a.973.973 0 0 0 .898-1.09c-.003-3.002.007-6.005-.005-9.007-.042-.592-.643-.976-1.203-.898H4Zm1.475.646H6.89l1.865 4.27H7.268l-.286-.744H5.36l-.287.744H3.61l1.866-4.27Zm4.312 4.301c1.069-.042 2.164.679 2.363 1.766.232 1.01-.34 2.144-1.326 2.502.296.465.837-.109 1.06-.007l.544.642c-.64.756-1.883.677-2.605.084-.394-.448-.866-.673-1.409-.887-1.175-.66-1.391-2.456-.43-3.39.463-.486 1.141-.716 1.803-.71Z" style="fill:#e0e0e0;fill-opacity:.996078"/><path fill="#e0e0e0" d="M1 4v9a2 2 0 0 0 2 2h10a2 2 0 0 0 2-2V4h-1v9a1 1 0 0 1-1 1H3a1 1 0 0 1-1-1V4Z" style="fill-opacity:.996"/></svg>
+<svg xmlns="http://www.w3.org/2000/svg" xml:space="preserve" width="16" height="16"><path fill="#e0e0e0" d="M6.584 5.135 6.17 4.059l-.412 1.076h.826zm3.203 2.976a1.032 1.032 0 0 0-.287.041.953.953 0 0 0-.09.034c-.028.012-.057.024-.084.039a.912.912 0 0 0-.152.107.988.988 0 0 0-.23.305.937.937 0 0 0-.04.097 1.017 1.017 0 0 0-.068.323 1.553 1.553 0 0 0 0 .244 1.374 1.374 0 0 0 .068.328 1.03 1.03 0 0 0 .201.336c.023.022.045.044.069.064a.96.96 0 0 0 .152.104c.027.015.056.027.084.039.03.012.06.024.09.033a.965.965 0 0 0 .19.035 1.028 1.028 0 0 0 .197 0 .974.974 0 0 0 .36-.107.876.876 0 0 0 .077-.049.872.872 0 0 0 .074-.055.882.882 0 0 0 .13-.136.978.978 0 0 0 .177-.368 1.225 1.225 0 0 0 .035-.224 1.61 1.61 0 0 0 0-.244 1.361 1.361 0 0 0-.035-.223 1.092 1.092 0 0 0-.121-.285.87.87 0 0 0-.12-.15.862.862 0 0 0-.14-.124c-.025-.017-.05-.035-.078-.05-.027-.015-.056-.027-.086-.04a.892.892 0 0 0-.373-.074z"/><path fill="#e0e0e0" d="M4 2c-.616-.02-1.084.59-1 1.178.003 3-.007 6 .005 9 .057.577.672.889 1.203.822 2.631-.003 5.263.006 7.894-.005a.973.973 0 0 0 .898-1.09c-.003-3.002.007-6.005-.005-9.007-.042-.592-.643-.976-1.203-.898H4Zm1.475.646H6.89l1.865 4.27H7.268l-.286-.744H5.36l-.287.744H3.61l1.866-4.27Zm4.312 4.301c1.069-.042 2.164.679 2.363 1.766.232 1.01-.34 2.144-1.326 2.502.296.465.837-.109 1.06-.007l.544.642c-.64.756-1.883.677-2.605.084-.394-.448-.866-.673-1.409-.887-1.175-.66-1.391-2.456-.43-3.39.463-.486 1.141-.716 1.803-.71Z"/><path fill="#e0e0e0" d="M1 4v9a2 2 0 0 0 2 2h10a2 2 0 0 0 2-2V4h-1v9a1 1 0 0 1-1 1H3a1 1 0 0 1-1-1V4Z"/></svg>
diff --git a/editor/icons/KeyboardError.svg b/editor/icons/KeyboardError.svg
index e20d133155..5cd6de9de8 100644
--- a/editor/icons/KeyboardError.svg
+++ b/editor/icons/KeyboardError.svg
@@ -1 +1 @@
-<svg xmlns="http://www.w3.org/2000/svg" xml:space="preserve" width="16" height="16"><path d="M4 2c-.616-.02-1.084.59-1 1.178.003 3-.007 6 .005 9 .057.577.672.889 1.203.822 2.631-.003 5.263.006 7.894-.005a.973.973 0 0 0 .898-1.09c-.003-3.002.007-6.005-.005-9.007-.042-.592-.643-.976-1.203-.898H4Zm4.223 1.262c1.06.005 2.29.257 2.92 1.197.532.862.275 2.057-.484 2.703-.346.382-.862.629-1.075 1.117.055.345-.33.172-.537.213H7.148c-.037-.749.503-1.335 1.026-1.796.406-.253.744-1.002.129-1.22-.626-.25-1.374.117-1.645.715l-2.08-1.039c.599-1.147 1.868-1.818 3.136-1.872.17-.013.339-.018.509-.018Zm.127 5.697c.798-.057 1.616.616 1.54 1.45-.023.81-.841 1.413-1.623 1.328-.833.022-1.6-.771-1.443-1.613.097-.721.83-1.195 1.526-1.165z" style="fill:#ff5f5f;fill-opacity:1"/><path fill="#e0e0e0" d="M1 4v9a2 2 0 0 0 2 2h10a2 2 0 0 0 2-2V4h-1v9a1 1 0 0 1-1 1H3a1 1 0 0 1-1-1V4Z" style="fill-opacity:1;fill:#ff5f5f"/></svg>
+<svg xmlns="http://www.w3.org/2000/svg" xml:space="preserve" width="16" height="16"><path fill="#ff5f5f" d="M4 2c-.616-.02-1.084.59-1 1.178.003 3-.007 6 .005 9 .057.577.672.889 1.203.822 2.631-.003 5.263.006 7.894-.005a.973.973 0 0 0 .898-1.09c-.003-3.002.007-6.005-.005-9.007-.042-.592-.643-.976-1.203-.898H4Zm4.223 1.262c1.06.005 2.29.257 2.92 1.197.532.862.275 2.057-.484 2.703-.346.382-.862.629-1.075 1.117.055.345-.33.172-.537.213H7.148c-.037-.749.503-1.335 1.026-1.796.406-.253.744-1.002.129-1.22-.626-.25-1.374.117-1.645.715l-2.08-1.039c.599-1.147 1.868-1.818 3.136-1.872.17-.013.339-.018.509-.018Zm.127 5.697c.798-.057 1.616.616 1.54 1.45-.023.81-.841 1.413-1.623 1.328-.833.022-1.6-.771-1.443-1.613.097-.721.83-1.195 1.526-1.165z"/><path fill="#ff5f5f" d="M1 4v9a2 2 0 0 0 2 2h10a2 2 0 0 0 2-2V4h-1v9a1 1 0 0 1-1 1H3a1 1 0 0 1-1-1V4Z"/></svg>
diff --git a/editor/icons/KeyboardLabel.svg b/editor/icons/KeyboardLabel.svg
index 07a687f447..25e02fd653 100644
--- a/editor/icons/KeyboardLabel.svg
+++ b/editor/icons/KeyboardLabel.svg
@@ -1 +1 @@
-<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16"><path d="M11.814 1.977c-.078 0-.157.008-.232.023H4c-.7-.034-1.143.765-1 1.39.008 2.95-.017 5.9.014 8.848.13.705.965.847 1.562.76 2.542-.008 5.085.02 7.627-.014.734-.1.9-.952.797-1.564-.003-2.84.006-5.68-.006-8.522-.035-.594-.628-.927-1.18-.921zM9.797 4.016l.572.58-.572.578-.57-.578.57-.58zm-.606 1.05.594.606-.594.601-.591-.601.591-.606zm1.213 0 .596.606-.596.601-.593-.601.593-.606zm.717 1.436h1.06c.053.217.093.428.122.63.028.201.043.395.043.58a2.363 2.363 0 0 1-.133.724 1.425 1.425 0 0 1-.31.515c-.249.265-.598.399-1.05.399-.331 0-.594-.08-.785-.235a1.091 1.091 0 0 1-.236-.275c-.063.1-.14.19-.236.265-.206.163-.467.245-.787.245-.252 0-.457-.057-.614-.166a2.75 2.75 0 0 1-.095.42 1.936 1.936 0 0 1-.403.722c-.2.22-.452.383-.756.49-.303.11-.654.166-1.052.166-.466 0-.865-.089-1.2-.265a1.817 1.817 0 0 1-.765-.752c-.18-.327-.27-.715-.27-1.164 0-.256.027-.525.082-.809.055-.284.126-.545.21-.781h1.001c-.062.232-.112.46-.15.684a3.87 3.87 0 0 0-.053.613c0 .37.1.643.3.82.204.177.523.264.96.264.222 0 .425-.03.61-.092a.97.97 0 0 0 .439-.299.803.803 0 0 0 .166-.521 5.463 5.463 0 0 0-.051-.725 11.61 11.61 0 0 0-.068-.482 26.51 26.51 0 0 0-.096-.606h1.135l.043.276c.047.32.123.532.228.634.105.1.24.15.402.15.165 0 .284-.04.358-.124.076-.086.115-.224.115-.412v-.524h1.027v.524c0 .203.032.351.096.447.065.095.202.142.412.142a.637.637 0 0 0 .33-.078c.089-.052.133-.15.133-.297 0-.128-.019-.295-.054-.498l-.108-.605z" style="fill:#e0e0e0;fill-opacity:.996078"/><path fill="#e0e0e0" d="M1 4v9a2 2 0 0 0 2 2h10a2 2 0 0 0 2-2V4h-1v9a1 1 0 0 1-1 1H3a1 1 0 0 1-1-1V4Z" style="fill-opacity:.996"/></svg>
+<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16"><path fill="#e0e0e0" d="M11.814 1.977c-.078 0-.157.008-.232.023H4c-.7-.034-1.143.765-1 1.39.008 2.95-.017 5.9.014 8.848.13.705.965.847 1.562.76 2.542-.008 5.085.02 7.627-.014.734-.1.9-.952.797-1.564-.003-2.84.006-5.68-.006-8.522-.035-.594-.628-.927-1.18-.921zM9.797 4.016l.572.58-.572.578-.57-.578.57-.58zm-.606 1.05.594.606-.594.601-.591-.601.591-.606zm1.213 0 .596.606-.596.601-.593-.601.593-.606zm.717 1.436h1.06c.053.217.093.428.122.63.028.201.043.395.043.58a2.363 2.363 0 0 1-.133.724 1.425 1.425 0 0 1-.31.515c-.249.265-.598.399-1.05.399-.331 0-.594-.08-.785-.235a1.091 1.091 0 0 1-.236-.275c-.063.1-.14.19-.236.265-.206.163-.467.245-.787.245-.252 0-.457-.057-.614-.166a2.75 2.75 0 0 1-.095.42 1.936 1.936 0 0 1-.403.722c-.2.22-.452.383-.756.49-.303.11-.654.166-1.052.166-.466 0-.865-.089-1.2-.265a1.817 1.817 0 0 1-.765-.752c-.18-.327-.27-.715-.27-1.164 0-.256.027-.525.082-.809.055-.284.126-.545.21-.781h1.001c-.062.232-.112.46-.15.684a3.87 3.87 0 0 0-.053.613c0 .37.1.643.3.82.204.177.523.264.96.264.222 0 .425-.03.61-.092a.97.97 0 0 0 .439-.299.803.803 0 0 0 .166-.521 5.463 5.463 0 0 0-.051-.725 11.61 11.61 0 0 0-.068-.482 26.51 26.51 0 0 0-.096-.606h1.135l.043.276c.047.32.123.532.228.634.105.1.24.15.402.15.165 0 .284-.04.358-.124.076-.086.115-.224.115-.412v-.524h1.027v.524c0 .203.032.351.096.447.065.095.202.142.412.142a.637.637 0 0 0 .33-.078c.089-.052.133-.15.133-.297 0-.128-.019-.295-.054-.498l-.108-.605z"/><path fill="#e0e0e0" d="M1 4v9a2 2 0 0 0 2 2h10a2 2 0 0 0 2-2V4h-1v9a1 1 0 0 1-1 1H3a1 1 0 0 1-1-1V4Z"/></svg>
diff --git a/editor/icons/KeyboardPhysical.svg b/editor/icons/KeyboardPhysical.svg
index 7d4b7e2999..877b9b89b9 100644
--- a/editor/icons/KeyboardPhysical.svg
+++ b/editor/icons/KeyboardPhysical.svg
@@ -1 +1 @@
-<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16"><path fill="#e0e0e0" d="M4 2a1 1 0 0 0-1 1v9.084c0 .506.448.916 1 .916h8c.552 0 1-.41 1-.916V3a1 1 0 0 0-1-1Zm2.762 1.768h2.476l3.264 7.464H9.898l-.502-1.3H6.561l-.502 1.3H3.498Zm1.217 2.474L7.254 8.12h1.45z" style="fill-opacity:.996"/><path fill="#e0e0e0" d="M1 4v9a2 2 0 0 0 2 2h10a2 2 0 0 0 2-2V4h-1v9a1 1 0 0 1-1 1H3a1 1 0 0 1-1-1V4Z" style="fill-opacity:.996"/></svg>
+<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16"><path fill="#e0e0e0" d="M4 2a1 1 0 0 0-1 1v9.084c0 .506.448.916 1 .916h8c.552 0 1-.41 1-.916V3a1 1 0 0 0-1-1Zm2.762 1.768h2.476l3.264 7.464H9.898l-.502-1.3H6.561l-.502 1.3H3.498Zm1.217 2.474L7.254 8.12h1.45z"/><path fill="#e0e0e0" d="M1 4v9a2 2 0 0 0 2 2h10a2 2 0 0 0 2-2V4h-1v9a1 1 0 0 1-1 1H3a1 1 0 0 1-1-1V4Z"/></svg>
diff --git a/editor/icons/LabelSettings.svg b/editor/icons/LabelSettings.svg
index 4dc3b9e86e..f85165f805 100644
--- a/editor/icons/LabelSettings.svg
+++ b/editor/icons/LabelSettings.svg
@@ -1 +1 @@
-<svg height="16" width="16" xml:space="preserve" xmlns="http://www.w3.org/2000/svg"><path d="M6 3a1 1 0 0 0-.707.293l-4 4a1 1 0 0 0 0 1.414l4 4A1 1 0 0 0 6 13h2.076a3.766 3.766 0 0 1-.058-.496c-.003-.058-.006-.115-.006-.174a2.606 2.606 0 0 1 .05-.508 3.212 3.212 0 0 1 .133-.496 5.104 5.104 0 0 1 .451-.982 8.303 8.303 0 0 1 .422-.656 14.41 14.41 0 0 1 .489-.667c.172-.223.351-.45.535-.68.163-.203.327-.408.492-.618a27.639 27.639 0 0 0 .732-.977 16.04 16.04 0 0 0 .465-.697c.075-.12.147-.242.219-.365a12.399 12.399 0 0 0 .684 1.062 27.555 27.555 0 0 0 .73.977c.165.21.331.415.494.619a43.298 43.298 0 0 1 .787 1.013c.082.111.16.222.237.332L15 9.79V4a1 1 0 0 0-1-1H6zM5 7a1 1 0 0 1 1 1 1 1 0 0 1-1 1 1 1 0 0 1-1-1 1 1 0 0 1 1-1z" style="fill:#8eef97;fill-opacity:1"/><path d="M9.184 13A2.99 2.99 0 0 0 12 15a2.99 2.99 0 0 0 2.816-2z" fill="#ff4596"/><path d="M9.23 11c-.136.326-.23.656-.23 1 0 .352.072.686.184 1h5.632c.112-.314.184-.648.184-1 0-.344-.094-.674-.23-1H9.23z" fill="#8045ff"/><path d="M10.564 9c-.552.69-1.058 1.342-1.334 2h5.54c-.276-.658-.782-1.31-1.335-2Z" fill="#45d7ff"/><path d="M12 7c-.43.746-.945 1.387-1.435 2h2.87c-.49-.613-1.005-1.254-1.435-2Z" fill="#45ffa2"/></svg>
+<svg height="16" width="16" xml:space="preserve" xmlns="http://www.w3.org/2000/svg"><path d="M6 3a1 1 0 0 0-.707.293l-4 4a1 1 0 0 0 0 1.414l4 4A1 1 0 0 0 6 13h2.076a3.766 3.766 0 0 1-.058-.496c-.003-.058-.006-.115-.006-.174a2.606 2.606 0 0 1 .05-.508 3.212 3.212 0 0 1 .133-.496 5.104 5.104 0 0 1 .451-.982 8.303 8.303 0 0 1 .422-.656 14.41 14.41 0 0 1 .489-.667c.172-.223.351-.45.535-.68.163-.203.327-.408.492-.618a27.639 27.639 0 0 0 .732-.977 16.04 16.04 0 0 0 .465-.697c.075-.12.147-.242.219-.365a12.399 12.399 0 0 0 .684 1.062 27.555 27.555 0 0 0 .73.977c.165.21.331.415.494.619a43.298 43.298 0 0 1 .787 1.013c.082.111.16.222.237.332L15 9.79V4a1 1 0 0 0-1-1H6zM5 7a1 1 0 0 1 1 1 1 1 0 0 1-1 1 1 1 0 0 1-1-1 1 1 0 0 1 1-1z" fill="#8eef97"/><path d="M9.184 13A2.99 2.99 0 0 0 12 15a2.99 2.99 0 0 0 2.816-2z" fill="#ff4596"/><path d="M9.23 11c-.136.326-.23.656-.23 1 0 .352.072.686.184 1h5.632c.112-.314.184-.648.184-1 0-.344-.094-.674-.23-1H9.23z" fill="#8045ff"/><path d="M10.564 9c-.552.69-1.058 1.342-1.334 2h5.54c-.276-.658-.782-1.31-1.335-2Z" fill="#45d7ff"/><path d="M12 7c-.43.746-.945 1.387-1.435 2h2.87c-.49-.613-1.005-1.254-1.435-2Z" fill="#45ffa2"/></svg>
diff --git a/editor/icons/LightOccluder2D.svg b/editor/icons/LightOccluder2D.svg
index ff2c4d4561..7765aecbc3 100644
--- a/editor/icons/LightOccluder2D.svg
+++ b/editor/icons/LightOccluder2D.svg
@@ -1 +1 @@
-<svg height="16" viewBox="0 0 16 16" width="16" xmlns="http://www.w3.org/2000/svg"><path d="m8 1037.4c-2.7614 0-5 2.2386-5 5 .00253 1.9858 1.18 3.7819 3 4.5762v2.4238h4v-2.4199c1.8213-.7949 2.999-2.5929 3-4.5801 0-2.7614-2.2386-5-5-5zm0 2v6c-1.6569 0-3-1.3431-3-3s1.3431-3 3-3zm-1 11v1h2v-1z" fill="#8da5f3" fill-opacity=".98824" transform="translate(0 -1036.4)"/></svg>
+<svg height="16" viewBox="0 0 16 16" width="16" xmlns="http://www.w3.org/2000/svg"><path d="m8 1037.4c-2.7614 0-5 2.2386-5 5 .00253 1.9858 1.18 3.7819 3 4.5762v2.4238h4v-2.4199c1.8213-.7949 2.999-2.5929 3-4.5801 0-2.7614-2.2386-5-5-5zm0 2v6c-1.6569 0-3-1.3431-3-3s1.3431-3 3-3zm-1 11v1h2v-1z" fill="#8da5f3" transform="translate(0 -1036.4)"/></svg>
diff --git a/editor/icons/LockViewport.svg b/editor/icons/LockViewport.svg
index c8b8a57be6..e1d26bc4b0 100644
--- a/editor/icons/LockViewport.svg
+++ b/editor/icons/LockViewport.svg
@@ -1 +1 @@
-<svg height="16" viewBox="0 0 16 16" width="16" xmlns="http://www.w3.org/2000/svg"><path d="m8 0a6 6 0 0 0 -6 6v1h-1v9h14v-9h-1v-1a6 6 0 0 0 -6-6zm0 4c1.1046 0 2 .89543 2 2v1h-4v-1c0-1.1046.89543-2 2-2z" fill-opacity=".39216" stroke-linecap="round" stroke-linejoin="round" stroke-opacity=".98824" stroke-width="4"/><path d="m8 1a5 5 0 0 0 -5 5v2h-1v7h12v-7h-1v-2a5 5 0 0 0 -5-5zm0 2a3 3 0 0 1 3 3v2h-6v-2a3 3 0 0 1 3-3zm-1 7h2v3h-2z" fill="#e0e0e0"/></svg>
+<svg height="16" viewBox="0 0 16 16" width="16" xmlns="http://www.w3.org/2000/svg"><path d="m8 0a6 6 0 0 0 -6 6v1h-1v9h14v-9h-1v-1a6 6 0 0 0 -6-6zm0 4c1.1046 0 2 .89543 2 2v1h-4v-1c0-1.1046.89543-2 2-2z" fill-opacity=".39216" stroke-linecap="round" stroke-linejoin="round" stroke-width="4"/><path d="m8 1a5 5 0 0 0 -5 5v2h-1v7h12v-7h-1v-2a5 5 0 0 0 -5-5zm0 2a3 3 0 0 1 3 3v2h-6v-2a3 3 0 0 1 3-3zm-1 7h2v3h-2z" fill="#e0e0e0"/></svg>
diff --git a/editor/icons/Marker2D.svg b/editor/icons/Marker2D.svg
index 191f0b2a03..aa7836c3ef 100644
--- a/editor/icons/Marker2D.svg
+++ b/editor/icons/Marker2D.svg
@@ -1 +1 @@
-<svg height="16" viewBox="0 0 16 16" width="16" xmlns="http://www.w3.org/2000/svg"><path d="m7 1v4h2v-4zm-6 6v2h4v-2zm10 0v2h4v-2zm-4 4v4h2v-4z" fill="#8da5f3" fill-opacity=".98824"/></svg>
+<svg height="16" viewBox="0 0 16 16" width="16" xmlns="http://www.w3.org/2000/svg"><path d="m7 1v4h2v-4zm-6 6v2h4v-2zm10 0v2h4v-2zm-4 4v4h2v-4z" fill="#8da5f3"/></svg>
diff --git a/editor/icons/MultiplayerSpawner.svg b/editor/icons/MultiplayerSpawner.svg
index 68ffd3aab4..9e6d6a4a7c 100644
--- a/editor/icons/MultiplayerSpawner.svg
+++ b/editor/icons/MultiplayerSpawner.svg
@@ -1 +1 @@
-<svg height="16" width="16" xmlns="http://www.w3.org/2000/svg"><path style="fill:none;fill-opacity:.996078;stroke:#e0e0e0;stroke-width:2;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:16.5;stroke-opacity:1;paint-order:stroke markers fill" d="M4.936 7.429A4 4 0 0 1 8 6a4 4 0 0 1 3.064 1.429M1.872 4.858A8 8 0 0 1 8 2a8 8 0 0 1 6.128 2.858"/><path d="M7 9v2H5v2h2v2h2v-2h2v-2H9V9Z" fill="#5fff97"/></svg>
+<svg height="16" width="16" xmlns="http://www.w3.org/2000/svg"><path style="fill:none;stroke:#e0e0e0;stroke-width:2;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:16.5;paint-order:stroke markers fill" d="M4.936 7.429A4 4 0 0 1 8 6a4 4 0 0 1 3.064 1.429M1.872 4.858A8 8 0 0 1 8 2a8 8 0 0 1 6.128 2.858"/><path d="M7 9v2H5v2h2v2h2v-2h2v-2H9V9Z" fill="#5fff97"/></svg>
diff --git a/editor/icons/MultiplayerSynchronizer.svg b/editor/icons/MultiplayerSynchronizer.svg
index 1547ec5a2b..4137b9dba0 100644
--- a/editor/icons/MultiplayerSynchronizer.svg
+++ b/editor/icons/MultiplayerSynchronizer.svg
@@ -1 +1 @@
-<svg height="16" width="16" xmlns="http://www.w3.org/2000/svg"><path style="fill:#5fff97;fill-opacity:1;stroke:none;stroke-width:2;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1;paint-order:stroke fill markers" d="M5 10h3l-2 4-2-4Z"/><path style="fill:#ff5f5f;fill-opacity:1;stroke:none;stroke-width:2;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1;paint-order:stroke fill markers" d="M9 14h3l-2-4-2 4Z"/><path style="fill:none;fill-opacity:.996078;stroke:#e0e0e0;stroke-width:2;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:16.5;stroke-opacity:1;paint-order:stroke markers fill" d="M4.936 7.429A4 4 0 0 1 8 6a4 4 0 0 1 3.064 1.429M1.872 4.858A8 8 0 0 1 8 2a8 8 0 0 1 6.128 2.858"/></svg>
+<svg height="16" width="16" xmlns="http://www.w3.org/2000/svg"><path style="fill:#5fff97;stroke:none;stroke-width:2;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;paint-order:stroke fill markers" d="M5 10h3l-2 4-2-4Z"/><path style="fill:#ff5f5f;stroke:none;stroke-width:2;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;paint-order:stroke fill markers" d="M9 14h3l-2-4-2 4Z"/><path style="fill:none;stroke:#e0e0e0;stroke-width:2;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:16.5;paint-order:stroke markers fill" d="M4.936 7.429A4 4 0 0 1 8 6a4 4 0 0 1 3.064 1.429M1.872 4.858A8 8 0 0 1 8 2a8 8 0 0 1 6.128 2.858"/></svg>
diff --git a/editor/icons/Navigation2D.svg b/editor/icons/Navigation2D.svg
index aa3e258eae..286fcb8d4c 100644
--- a/editor/icons/Navigation2D.svg
+++ b/editor/icons/Navigation2D.svg
@@ -1 +1 @@
-<svg height="16" viewBox="0 0 16 16" width="16" xmlns="http://www.w3.org/2000/svg"><path d="m3 1050.4 5-2 5 2-5-12z" fill="#8da5f3" fill-opacity=".98824" fill-rule="evenodd" transform="translate(0 -1036.4)"/></svg>
+<svg height="16" viewBox="0 0 16 16" width="16" xmlns="http://www.w3.org/2000/svg"><path d="m3 1050.4 5-2 5 2-5-12z" fill="#8da5f3" fill-rule="evenodd" transform="translate(0 -1036.4)"/></svg>
diff --git a/editor/icons/NavigationAgent2D.svg b/editor/icons/NavigationAgent2D.svg
index 05aeb95e12..c5b543e638 100644
--- a/editor/icons/NavigationAgent2D.svg
+++ b/editor/icons/NavigationAgent2D.svg
@@ -1 +1 @@
-<svg clip-rule="evenodd" fill-rule="evenodd" stroke-linejoin="round" stroke-miterlimit="2" viewBox="0 0 16 16" xmlns="http://www.w3.org/2000/svg"><path d="m8 1v2.5c1.371 0 2.5 1.129 2.5 2.5s-1.129 2.5-2.5 2.5v6.5c2-3 5.007-6.03 5-9 0-3-2-5-5-5z" fill="#8da5f3" fill-opacity=".988235"/><path d="m8 1c-3 0-5 2-5 5s3 6 5 9v-6.5c-1.371 0-2.5-1.129-2.5-2.5s1.129-2.5 2.5-2.5z" fill="#e0e0e0"/></svg>
+<svg clip-rule="evenodd" fill-rule="evenodd" stroke-linejoin="round" stroke-miterlimit="2" viewBox="0 0 16 16" xmlns="http://www.w3.org/2000/svg"><path d="m8 1v2.5c1.371 0 2.5 1.129 2.5 2.5s-1.129 2.5-2.5 2.5v6.5c2-3 5.007-6.03 5-9 0-3-2-5-5-5z" fill="#8da5f3"/><path d="m8 1c-3 0-5 2-5 5s3 6 5 9v-6.5c-1.371 0-2.5-1.129-2.5-2.5s1.129-2.5 2.5-2.5z" fill="#e0e0e0"/></svg>
diff --git a/editor/icons/NavigationObstacle2D.svg b/editor/icons/NavigationObstacle2D.svg
index a5073898f4..af88325240 100644
--- a/editor/icons/NavigationObstacle2D.svg
+++ b/editor/icons/NavigationObstacle2D.svg
@@ -1 +1 @@
-<svg clip-rule="evenodd" fill-rule="evenodd" stroke-linejoin="round" stroke-miterlimit="2" viewBox="0 0 16 16" xmlns="http://www.w3.org/2000/svg"><path d="m8 .875c-.625 0-1.25.375-1.5 1.125l-3 10h4.5v-3h-2.5l1-4h1.5zm-6 12.125c-1 0-1 2 0 2h6v-2z" fill="#e0e0e0"/><path d="m8 .875v4.125h1.5l1 4h-2.5v3h4.5l-3-10c-.25-.75-.875-1.125-1.5-1.125zm0 12.125v2h6c1 0 1-2 0-2z" fill="#8da5f3" fill-opacity=".988235"/></svg>
+<svg clip-rule="evenodd" fill-rule="evenodd" stroke-linejoin="round" stroke-miterlimit="2" viewBox="0 0 16 16" xmlns="http://www.w3.org/2000/svg"><path d="m8 .875c-.625 0-1.25.375-1.5 1.125l-3 10h4.5v-3h-2.5l1-4h1.5zm-6 12.125c-1 0-1 2 0 2h6v-2z" fill="#e0e0e0"/><path d="m8 .875v4.125h1.5l1 4h-2.5v3h4.5l-3-10c-.25-.75-.875-1.125-1.5-1.125zm0 12.125v2h6c1 0 1-2 0-2z" fill="#8da5f3"/></svg>
diff --git a/editor/icons/NavigationRegion2D.svg b/editor/icons/NavigationRegion2D.svg
index 8efd836075..30e2138e82 100644
--- a/editor/icons/NavigationRegion2D.svg
+++ b/editor/icons/NavigationRegion2D.svg
@@ -1 +1 @@
-<svg height="16" viewBox="0 0 16 16" width="16" xmlns="http://www.w3.org/2000/svg"><path d="m2 1c-.1339223.0000569-.2535666.0306675-.3652344.0742188-.022275.0088111-.0410424.0209185-.0625.03125-.0889622.0424668-.1681009.0954994-.2382812.1601562-.0215322.0195204-.0427394.0372854-.0625.0585938-.0741112.0810923-.13722.1698052-.1816406.2695312-.0034324.0076504-.0084746.0137334-.0117188.0214844l-.0019531.0019531c-.0452252.1091882-.0629923.2268973-.0683594.3457031-.0005086.0130821-.0078112.023903-.0078125.0371094v12c.0000552.552262.4477381.999945 1 1h4.8847656a2.1184381 2.1184381 0 0 1 .1328125-.744141l2.9999999-7.9999996a2.1184381 2.1184381 0 0 1 2.007813-1.3730469 2.1184381 2.1184381 0 0 1 1.957031 1.3730469l1.017578 2.7128906v-6.96875c-.000001-.0132064-.007305-.0240273-.007812-.0371094-.005369-.1188058-.023135-.2365149-.06836-.3457031l-.001953-.0019531c-.003155-.0075626-.008384-.0139987-.011719-.0214844-.044421-.099726-.107529-.188439-.18164-.2695312-.019761-.0213083-.040968-.0390734-.0625-.0585938-.070181-.0646568-.149319-.1176895-.238282-.1601562-.021457-.0103315-.040225-.022439-.0625-.03125-.111667-.0435511-.231312-.0741619-.365234-.0742188zm10 6-3 8 3-2 3 2z" fill="#8da5f3" fill-opacity=".98824" fill-rule="evenodd"/></svg>
+<svg height="16" viewBox="0 0 16 16" width="16" xmlns="http://www.w3.org/2000/svg"><path d="m2 1c-.1339223.0000569-.2535666.0306675-.3652344.0742188-.022275.0088111-.0410424.0209185-.0625.03125-.0889622.0424668-.1681009.0954994-.2382812.1601562-.0215322.0195204-.0427394.0372854-.0625.0585938-.0741112.0810923-.13722.1698052-.1816406.2695312-.0034324.0076504-.0084746.0137334-.0117188.0214844l-.0019531.0019531c-.0452252.1091882-.0629923.2268973-.0683594.3457031-.0005086.0130821-.0078112.023903-.0078125.0371094v12c.0000552.552262.4477381.999945 1 1h4.8847656a2.1184381 2.1184381 0 0 1 .1328125-.744141l2.9999999-7.9999996a2.1184381 2.1184381 0 0 1 2.007813-1.3730469 2.1184381 2.1184381 0 0 1 1.957031 1.3730469l1.017578 2.7128906v-6.96875c-.000001-.0132064-.007305-.0240273-.007812-.0371094-.005369-.1188058-.023135-.2365149-.06836-.3457031l-.001953-.0019531c-.003155-.0075626-.008384-.0139987-.011719-.0214844-.044421-.099726-.107529-.188439-.18164-.2695312-.019761-.0213083-.040968-.0390734-.0625-.0585938-.070181-.0646568-.149319-.1176895-.238282-.1601562-.021457-.0103315-.040225-.022439-.0625-.03125-.111667-.0435511-.231312-.0741619-.365234-.0742188zm10 6-3 8 3-2 3 2z" fill="#8da5f3" fill-rule="evenodd"/></svg>
diff --git a/editor/icons/NewKey.svg b/editor/icons/NewKey.svg
index fc8507e6c4..266b763329 100644
--- a/editor/icons/NewKey.svg
+++ b/editor/icons/NewKey.svg
@@ -1 +1 @@
-<svg enable-background="new 0 0 16 16" height="16" viewBox="0 0 16 16" width="16" xmlns="http://www.w3.org/2000/svg"><g fill="#e0e0e0" fill-opacity=".9961"><path d="m13 9h-2v2h-2v2h2v2h2v-2h2v-2h-2z"/><path d="m10 9.723c-.596-.347-1-.985-1-1.723 0-1.104.896-2 2-2s2 .896 2 2h1v2h.445c.344-.591.555-1.268.555-2 0-2.209-1.791-4-4-4-1.822.002-3.414 1.235-3.869 3h-6.131v2h1v2h3v-2h2.133c.16.62.466 1.169.867 1.627v-.627h2z"/></g></svg>
+<svg enable-background="new 0 0 16 16" height="16" viewBox="0 0 16 16" width="16" xmlns="http://www.w3.org/2000/svg"><g fill="#e0e0e0"><path d="m13 9h-2v2h-2v2h2v2h2v-2h2v-2h-2z"/><path d="m10 9.723c-.596-.347-1-.985-1-1.723 0-1.104.896-2 2-2s2 .896 2 2h1v2h.445c.344-.591.555-1.268.555-2 0-2.209-1.791-4-4-4-1.822.002-3.414 1.235-3.869 3h-6.131v2h1v2h3v-2h2.133c.16.62.466 1.169.867 1.627v-.627h2z"/></g></svg>
diff --git a/editor/icons/OccluderPolygon2D.svg b/editor/icons/OccluderPolygon2D.svg
index 7ab4240d2f..b8e67b76dd 100644
--- a/editor/icons/OccluderPolygon2D.svg
+++ b/editor/icons/OccluderPolygon2D.svg
@@ -1 +1 @@
-<svg height="16" viewBox="0 0 16 16" width="16" xmlns="http://www.w3.org/2000/svg"><g fill-rule="evenodd" transform="translate(0 -1036.4)"><path d="m1 1045.4 6 6h8v-8l-6-6h-8z" fill="#4b70ea"/><path d="m1 1037.4h8l-3 4 3 4h-8z" fill="#8da5f3" fill-opacity=".98824"/></g></svg>
+<svg height="16" viewBox="0 0 16 16" width="16" xmlns="http://www.w3.org/2000/svg"><g fill-rule="evenodd" transform="translate(0 -1036.4)"><path d="m1 1045.4 6 6h8v-8l-6-6h-8z" fill="#4b70ea"/><path d="m1 1037.4h8l-3 4 3 4h-8z" fill="#8da5f3"/></g></svg>
diff --git a/editor/icons/ParallaxLayer.svg b/editor/icons/ParallaxLayer.svg
index 58968b77fb..6945798e9c 100644
--- a/editor/icons/ParallaxLayer.svg
+++ b/editor/icons/ParallaxLayer.svg
@@ -1 +1 @@
-<svg height="16" viewBox="0 0 16 16" width="16" xmlns="http://www.w3.org/2000/svg"><g transform="translate(0 -1036.4)"><path d="m3 1c-1.1046 0-2 .89543-2 2v10c0 1.1046.89543 2 2 2h10c1.1046 0 2-.89543 2-2v-10c0-1.1046-.89543-2-2-2zm0 1h10c.55228.0000096.99999.44772 1 1v10c-.00001.55228-.44772.99999-1 1h-10c-.55228-.00001-.99999-.44772-1-1v-10c.0000096-.55228.44772-.99999 1-1zm4 3-3 3 3 3zm2 0v6l3-3z" fill="#8da5f3" fill-opacity=".98824" fill-rule="evenodd" transform="translate(0 1036.4)"/></g></svg>
+<svg height="16" viewBox="0 0 16 16" width="16" xmlns="http://www.w3.org/2000/svg"><g transform="translate(0 -1036.4)"><path d="m3 1c-1.1046 0-2 .89543-2 2v10c0 1.1046.89543 2 2 2h10c1.1046 0 2-.89543 2-2v-10c0-1.1046-.89543-2-2-2zm0 1h10c.55228.0000096.99999.44772 1 1v10c-.00001.55228-.44772.99999-1 1h-10c-.55228-.00001-.99999-.44772-1-1v-10c.0000096-.55228.44772-.99999 1-1zm4 3-3 3 3 3zm2 0v6l3-3z" fill="#8da5f3" fill-rule="evenodd" transform="translate(0 1036.4)"/></g></svg>
diff --git a/editor/icons/Path2D.svg b/editor/icons/Path2D.svg
index 494ca344be..cce8206df6 100644
--- a/editor/icons/Path2D.svg
+++ b/editor/icons/Path2D.svg
@@ -1 +1 @@
-<svg height="16" viewBox="0 0 16 16" width="16" xmlns="http://www.w3.org/2000/svg"><path d="m13 1a2 2 0 0 0 -2 2 2 2 0 0 0 .84961 1.6328c-.19239.88508-.55317 1.3394-.98633 1.6426-.64426.451-1.7129.60547-2.9629.73047s-2.6814.22053-3.9121 1.082c-.89278.62493-1.5321 1.6522-1.8184 3.0957a2 2 0 0 0 -1.1699 1.8164 2 2 0 0 0 2 2 2 2 0 0 0 2-2 2 2 0 0 0 -.84961-1.6328c.19235-.88496.55306-1.3373.98633-1.6406.64426-.451 1.7129-.60547 2.9629-.73047s2.6814-.22053 3.9121-1.082c.8927-.62488 1.5321-1.6538 1.8184-3.0977a2 2 0 0 0 1.1699-1.8164 2 2 0 0 0 -2-2z" fill="#8da5f3" fill-opacity=".98824"/></svg>
+<svg height="16" viewBox="0 0 16 16" width="16" xmlns="http://www.w3.org/2000/svg"><path d="m13 1a2 2 0 0 0 -2 2 2 2 0 0 0 .84961 1.6328c-.19239.88508-.55317 1.3394-.98633 1.6426-.64426.451-1.7129.60547-2.9629.73047s-2.6814.22053-3.9121 1.082c-.89278.62493-1.5321 1.6522-1.8184 3.0957a2 2 0 0 0 -1.1699 1.8164 2 2 0 0 0 2 2 2 2 0 0 0 2-2 2 2 0 0 0 -.84961-1.6328c.19235-.88496.55306-1.3373.98633-1.6406.64426-.451 1.7129-.60547 2.9629-.73047s2.6814-.22053 3.9121-1.082c.8927-.62488 1.5321-1.6538 1.8184-3.0977a2 2 0 0 0 1.1699-1.8164 2 2 0 0 0 -2-2z" fill="#8da5f3"/></svg>
diff --git a/editor/icons/PathFollow2D.svg b/editor/icons/PathFollow2D.svg
index a1fb97cf34..0e0cad6930 100644
--- a/editor/icons/PathFollow2D.svg
+++ b/editor/icons/PathFollow2D.svg
@@ -1 +1 @@
-<svg height="16" viewBox="0 0 16 16" width="16" xmlns="http://www.w3.org/2000/svg"><path d="m13 0-3 4h1.9473c-.1385 1.3203-.5583 1.9074-1.084 2.2754-.64426.451-1.7129.60547-2.9629.73047s-2.6814.22053-3.9121 1.082c-.89278.62493-1.5321 1.6522-1.8184 3.0957a2 2 0 0 0 -1.1699 1.8164 2 2 0 0 0 2 2 2 2 0 0 0 2-2 2 2 0 0 0 -.84961-1.6328c.19235-.88496.55306-1.3373.98633-1.6406.64426-.451 1.7129-.60547 2.9629-.73047s2.6814-.22053 3.9121-1.082c1.0528-.73697 1.7552-2.032 1.9375-3.9141h2.0508l-3-4z" fill="#8da5f3" fill-opacity=".98824"/></svg>
+<svg height="16" viewBox="0 0 16 16" width="16" xmlns="http://www.w3.org/2000/svg"><path d="m13 0-3 4h1.9473c-.1385 1.3203-.5583 1.9074-1.084 2.2754-.64426.451-1.7129.60547-2.9629.73047s-2.6814.22053-3.9121 1.082c-.89278.62493-1.5321 1.6522-1.8184 3.0957a2 2 0 0 0 -1.1699 1.8164 2 2 0 0 0 2 2 2 2 0 0 0 2-2 2 2 0 0 0 -.84961-1.6328c.19235-.88496.55306-1.3373.98633-1.6406.64426-.451 1.7129-.60547 2.9629-.73047s2.6814-.22053 3.9121-1.082c1.0528-.73697 1.7552-2.032 1.9375-3.9141h2.0508l-3-4z" fill="#8da5f3"/></svg>
diff --git a/editor/icons/PinJoint2D.svg b/editor/icons/PinJoint2D.svg
index fc7329e4f3..021af9c8f3 100644
--- a/editor/icons/PinJoint2D.svg
+++ b/editor/icons/PinJoint2D.svg
@@ -1 +1 @@
-<svg height="16" viewBox="0 0 16 16" width="16" xmlns="http://www.w3.org/2000/svg"><path d="m9 1.2715-.70703.70703v1.4141l-2.1211 2.123 4.2422 4.2422 2.1211-2.1211h1.4141l.70703-.70703-5.6562-5.6582zm-3.5352 4.9512-3.5352.70703 7.0703 7.0703.70703-3.5352-4.2422-4.2422zm-1.4141 4.2422-1.4141 1.4141-.70703 2.1211 2.1211-.70703 1.4141-1.4141-1.4141-1.4141z" fill="#8da5f3" fill-opacity=".98824" fill-rule="evenodd"/></svg>
+<svg height="16" viewBox="0 0 16 16" width="16" xmlns="http://www.w3.org/2000/svg"><path d="m9 1.2715-.70703.70703v1.4141l-2.1211 2.123 4.2422 4.2422 2.1211-2.1211h1.4141l.70703-.70703-5.6562-5.6582zm-3.5352 4.9512-3.5352.70703 7.0703 7.0703.70703-3.5352-4.2422-4.2422zm-1.4141 4.2422-1.4141 1.4141-.70703 2.1211 2.1211-.70703 1.4141-1.4141-1.4141-1.4141z" fill="#8da5f3" fill-rule="evenodd"/></svg>
diff --git a/editor/icons/PingPongLoop.svg b/editor/icons/PingPongLoop.svg
index c44f889b49..61a701a81e 100644
--- a/editor/icons/PingPongLoop.svg
+++ b/editor/icons/PingPongLoop.svg
@@ -1 +1 @@
-<svg enable-background="new 0 0 16 16" height="16" viewBox="0 0 16 16" width="16" xmlns="http://www.w3.org/2000/svg"><g fill="#e0e0e0" fill-opacity=".9961"><path d="m10 7h-4v-2l-4 3 4 3v-2h4v2l4-3-4-3z"/><path d="m0 1v14h2v-7-7z"/><path d="m14 1v7 7h2v-14z"/></g></svg>
+<svg enable-background="new 0 0 16 16" height="16" viewBox="0 0 16 16" width="16" xmlns="http://www.w3.org/2000/svg"><g fill="#e0e0e0"><path d="m10 7h-4v-2l-4 3 4 3v-2h4v2l4-3-4-3z"/><path d="m0 1v14h2v-7-7z"/><path d="m14 1v7 7h2v-14z"/></g></svg>
diff --git a/editor/icons/PlayRemote.svg b/editor/icons/PlayRemote.svg
index ea2195294f..f69414e856 100644
--- a/editor/icons/PlayRemote.svg
+++ b/editor/icons/PlayRemote.svg
@@ -1 +1 @@
-<svg xmlns="http://www.w3.org/2000/svg" xml:space="preserve" width="16" height="16"><path d="m12.998 2.548-9.996.005a2.006 2.006 0 0 0-2.006 2v4.61c0 1.107.898 2.003 2.006 2.003h3.996v.9h-1.68v.381H3.001v2h2.315v.38h5.366v-.38H13v-2.004h-2.315v-.378H9.004v-.9h3.994a2.006 2.006 0 0 0 2.006-2.003v-4.61c0-1.106-.9-2.003-2.006-2.003zm-7.496 1.31 5 3-5 3z" style="fill:#e0e0e0;fill-opacity:1"/></svg>
+<svg xmlns="http://www.w3.org/2000/svg" xml:space="preserve" width="16" height="16"><path d="m12.998 2.548-9.996.005a2.006 2.006 0 0 0-2.006 2v4.61c0 1.107.898 2.003 2.006 2.003h3.996v.9h-1.68v.381H3.001v2h2.315v.38h5.366v-.38H13v-2.004h-2.315v-.378H9.004v-.9h3.994a2.006 2.006 0 0 0 2.006-2.003v-4.61c0-1.106-.9-2.003-2.006-2.003zm-7.496 1.31 5 3-5 3z" fill="#e0e0e0"/></svg>
diff --git a/editor/icons/PointLight2D.svg b/editor/icons/PointLight2D.svg
index 1a3222c79e..e4352ff6cd 100644
--- a/editor/icons/PointLight2D.svg
+++ b/editor/icons/PointLight2D.svg
@@ -1 +1 @@
-<svg height="16" viewBox="0 0 16 16" width="16" xmlns="http://www.w3.org/2000/svg"><path d="m8 1a5 5 0 0 0 -5 5 5 5 0 0 0 3 4.5762v2.4238h4v-2.4199a5 5 0 0 0 3-4.5801 5 5 0 0 0 -5-5zm0 2a3 3 0 0 1 3 3 3 3 0 0 1 -3 3 3 3 0 0 1 -3-3 3 3 0 0 1 3-3zm-1 11v1h2v-1z" fill="#8da5f3" fill-opacity=".98824"/></svg>
+<svg height="16" viewBox="0 0 16 16" width="16" xmlns="http://www.w3.org/2000/svg"><path d="m8 1a5 5 0 0 0 -5 5 5 5 0 0 0 3 4.5762v2.4238h4v-2.4199a5 5 0 0 0 3-4.5801 5 5 0 0 0 -5-5zm0 2a3 3 0 0 1 3 3 3 3 0 0 1 -3 3 3 3 0 0 1 -3-3 3 3 0 0 1 3-3zm-1 11v1h2v-1z" fill="#8da5f3"/></svg>
diff --git a/editor/icons/RemoteTransform2D.svg b/editor/icons/RemoteTransform2D.svg
index 9d03db5c3b..bbe4109cd2 100644
--- a/editor/icons/RemoteTransform2D.svg
+++ b/editor/icons/RemoteTransform2D.svg
@@ -1 +1 @@
-<svg height="16" viewBox="0 0 16 16" width="16" xmlns="http://www.w3.org/2000/svg"><path d="m8 1c-2.8565 0-5.4995 1.5262-6.9277 4a1 1 0 0 0 .36523 1.3672 1 1 0 0 0 1.3672-.36719c1.0726-1.8578 3.0501-3 5.1953-3s4.1227 1.1422 5.1953 3a1 1 0 0 0 1.3672.36719 1 1 0 0 0 .36523-1.3672c-1.4283-2.4738-4.0712-4-6.9277-4zm0 4c-1.8056 0-3.396 1.2207-3.8633 2.9648a1 1 0 0 0 .70703 1.2246 1 1 0 0 0 1.2246-.70703c.23553-.8791 1.0216-1.4824 1.9316-1.4824s1.6961.60332 1.9316 1.4824a1 1 0 0 0 1.2246.70703 1 1 0 0 0 .70703-1.2246c-.46732-1.7441-2.0577-2.9648-3.8633-2.9648zm0 4c-.554 0-1 .446-1 1v1h-3a4 4 0 0 0 2 3.4648 4 4 0 0 0 4 0 4 4 0 0 0 2-3.4648h-3v-1c0-.554-.446-1-1-1z" fill="#8da5f3" fill-opacity=".98824"/></svg>
+<svg height="16" viewBox="0 0 16 16" width="16" xmlns="http://www.w3.org/2000/svg"><path d="m8 1c-2.8565 0-5.4995 1.5262-6.9277 4a1 1 0 0 0 .36523 1.3672 1 1 0 0 0 1.3672-.36719c1.0726-1.8578 3.0501-3 5.1953-3s4.1227 1.1422 5.1953 3a1 1 0 0 0 1.3672.36719 1 1 0 0 0 .36523-1.3672c-1.4283-2.4738-4.0712-4-6.9277-4zm0 4c-1.8056 0-3.396 1.2207-3.8633 2.9648a1 1 0 0 0 .70703 1.2246 1 1 0 0 0 1.2246-.70703c.23553-.8791 1.0216-1.4824 1.9316-1.4824s1.6961.60332 1.9316 1.4824a1 1 0 0 0 1.2246.70703 1 1 0 0 0 .70703-1.2246c-.46732-1.7441-2.0577-2.9648-3.8633-2.9648zm0 4c-.554 0-1 .446-1 1v1h-3a4 4 0 0 0 2 3.4648 4 4 0 0 0 4 0 4 4 0 0 0 2-3.4648h-3v-1c0-.554-.446-1-1-1z" fill="#8da5f3"/></svg>
diff --git a/editor/icons/RigidBody2D.svg b/editor/icons/RigidBody2D.svg
index 5d08e991ae..ea317ce94c 100644
--- a/editor/icons/RigidBody2D.svg
+++ b/editor/icons/RigidBody2D.svg
@@ -1 +1 @@
-<svg height="16" viewBox="0 0 16 16" width="16" xmlns="http://www.w3.org/2000/svg"><path d="m8 1a7 7 0 0 0 -7 7 7 7 0 0 0 1.2227 3.9531 7 7 0 0 0 .30273.4082c.000785-.00256.0011667-.005252.0019532-.007812a7 7 0 0 0 5.4727 2.6465 7 7 0 0 0 3.2422-.80273c.001375.000393.002531.00156.003906.001953a7 7 0 0 0 .035156-.021485 7 7 0 0 0 .42578-.25 7 7 0 0 0 .16992-.10352 7 7 0 0 0 .36914-.26953 7 7 0 0 0 .20508-.15625 7 7 0 0 0 .3418-.30859 7 7 0 0 0 .16406-.1543 7 7 0 0 0 .33008-.36133 7 7 0 0 0 .14062-.16016 7 7 0 0 0 .27734-.37305 7 7 0 0 0 .13867-.19531 7 7 0 0 0 .21875-.36133 7 7 0 0 0 .14258-.25 7 7 0 0 0 .15625-.33398 7 7 0 0 0 .13867-.31055 7 7 0 0 0 .10742-.30859 7 7 0 0 0 .11914-.35352 7 7 0 0 0 .087891-.36914 7 7 0 0 0 .066406-.29297 7 7 0 0 0 .056641-.40039 7 7 0 0 0 .037109-.3125 7 7 0 0 0 .025391-.55273 7 7 0 0 0 -4.3926-6.4922 7 7 0 0 0 -.001953 0 7 7 0 0 0 -.66016-.22852 7 7 0 0 0 -.0058594-.0019531 7 7 0 0 0 -.55078-.13086 7 7 0 0 0 -.14062-.03125 7 7 0 0 0 -.55078-.072266 7 7 0 0 0 -.14258-.017578 7 7 0 0 0 -.55469-.025391zm1.9512 1.334a6 6 0 0 1 4.0488 5.666h-7a2 2 0 0 0 -.94922-1.6992c1.3464-2.0289 2.6038-3.2631 3.9004-3.9668zm-6.8281 2.1797c.14632.65093.35776 1.2833.68359 1.8848a2 2 0 0 0 -.80664 1.6016h-1a6 6 0 0 1 1.123-3.4863zm1.877 1.4863a2 2 0 0 0 -.10938.0039062 2 2 0 0 1 .10938-.0039062zm-.18945.011719a2 2 0 0 0 -.12109.013672 2 2 0 0 1 .12109-.013672zm-.44141.09375a2 2 0 0 0 -.056641.019531 2 2 0 0 1 .056641-.019531zm-1.3594 2.0605a2 2 0 0 0 .013672.11914 2 2 0 0 1 -.013672-.11914zm.027344.20898a2 2 0 0 0 .017578.080078 2 2 0 0 1 -.017578-.080078zm.73438 1.1992a2 2 0 0 0 1.2285.42578 2 2 0 0 0 1.0508-.30078c1.345 2.0268 2.6013 3.2645 3.8965 3.9688a6 6 0 0 1 -1.9473.33203 6 6 0 0 1 -5.0547-2.7695c.23771-.5785.50336-1.1403.82617-1.6563z" fill="#8da5f3" fill-opacity=".98824"/></svg>
+<svg height="16" viewBox="0 0 16 16" width="16" xmlns="http://www.w3.org/2000/svg"><path d="m8 1a7 7 0 0 0 -7 7 7 7 0 0 0 1.2227 3.9531 7 7 0 0 0 .30273.4082c.000785-.00256.0011667-.005252.0019532-.007812a7 7 0 0 0 5.4727 2.6465 7 7 0 0 0 3.2422-.80273c.001375.000393.002531.00156.003906.001953a7 7 0 0 0 .035156-.021485 7 7 0 0 0 .42578-.25 7 7 0 0 0 .16992-.10352 7 7 0 0 0 .36914-.26953 7 7 0 0 0 .20508-.15625 7 7 0 0 0 .3418-.30859 7 7 0 0 0 .16406-.1543 7 7 0 0 0 .33008-.36133 7 7 0 0 0 .14062-.16016 7 7 0 0 0 .27734-.37305 7 7 0 0 0 .13867-.19531 7 7 0 0 0 .21875-.36133 7 7 0 0 0 .14258-.25 7 7 0 0 0 .15625-.33398 7 7 0 0 0 .13867-.31055 7 7 0 0 0 .10742-.30859 7 7 0 0 0 .11914-.35352 7 7 0 0 0 .087891-.36914 7 7 0 0 0 .066406-.29297 7 7 0 0 0 .056641-.40039 7 7 0 0 0 .037109-.3125 7 7 0 0 0 .025391-.55273 7 7 0 0 0 -4.3926-6.4922 7 7 0 0 0 -.001953 0 7 7 0 0 0 -.66016-.22852 7 7 0 0 0 -.0058594-.0019531 7 7 0 0 0 -.55078-.13086 7 7 0 0 0 -.14062-.03125 7 7 0 0 0 -.55078-.072266 7 7 0 0 0 -.14258-.017578 7 7 0 0 0 -.55469-.025391zm1.9512 1.334a6 6 0 0 1 4.0488 5.666h-7a2 2 0 0 0 -.94922-1.6992c1.3464-2.0289 2.6038-3.2631 3.9004-3.9668zm-6.8281 2.1797c.14632.65093.35776 1.2833.68359 1.8848a2 2 0 0 0 -.80664 1.6016h-1a6 6 0 0 1 1.123-3.4863zm1.877 1.4863a2 2 0 0 0 -.10938.0039062 2 2 0 0 1 .10938-.0039062zm-.18945.011719a2 2 0 0 0 -.12109.013672 2 2 0 0 1 .12109-.013672zm-.44141.09375a2 2 0 0 0 -.056641.019531 2 2 0 0 1 .056641-.019531zm-1.3594 2.0605a2 2 0 0 0 .013672.11914 2 2 0 0 1 -.013672-.11914zm.027344.20898a2 2 0 0 0 .017578.080078 2 2 0 0 1 -.017578-.080078zm.73438 1.1992a2 2 0 0 0 1.2285.42578 2 2 0 0 0 1.0508-.30078c1.345 2.0268 2.6013 3.2645 3.8965 3.9688a6 6 0 0 1 -1.9473.33203 6 6 0 0 1 -5.0547-2.7695c.23771-.5785.50336-1.1403.82617-1.6563z" fill="#8da5f3"/></svg>
diff --git a/editor/icons/StaticBody2D.svg b/editor/icons/StaticBody2D.svg
index 359d4d858c..4d7c575dc0 100644
--- a/editor/icons/StaticBody2D.svg
+++ b/editor/icons/StaticBody2D.svg
@@ -1 +1 @@
-<svg height="16" viewBox="0 0 16 16" width="16" xmlns="http://www.w3.org/2000/svg"><g transform="translate(0 -1036.4)"><path d="m3 1a2 2 0 0 0 -1.4141.58594 2 2 0 0 0 -.58594 1.4141v10a2 2 0 0 0 .58594 1.4141 2 2 0 0 0 1.4141.58594h10a2 2 0 0 0 2-2v-10a2 2 0 0 0 -2-2h-10zm0 1h10a1 1 0 0 1 1 1v10a1 1 0 0 1 -1 1h-10a1 1 0 0 1 -1-1v-10a1 1 0 0 1 1-1zm0 1v2h2v-2zm8 0v2h2v-2zm-8 8v2h2v-2zm8 0v2h2v-2z" fill="#8da5f3" fill-opacity=".98824" transform="translate(0 1036.4)"/></g></svg>
+<svg height="16" viewBox="0 0 16 16" width="16" xmlns="http://www.w3.org/2000/svg"><g transform="translate(0 -1036.4)"><path d="m3 1a2 2 0 0 0 -1.4141.58594 2 2 0 0 0 -.58594 1.4141v10a2 2 0 0 0 .58594 1.4141 2 2 0 0 0 1.4141.58594h10a2 2 0 0 0 2-2v-10a2 2 0 0 0 -2-2h-10zm0 1h10a1 1 0 0 1 1 1v10a1 1 0 0 1 -1 1h-10a1 1 0 0 1 -1-1v-10a1 1 0 0 1 1-1zm0 1v2h2v-2zm8 0v2h2v-2zm-8 8v2h2v-2zm8 0v2h2v-2z" fill="#8da5f3" transform="translate(0 1036.4)"/></g></svg>
diff --git a/editor/icons/StyleBoxGridVisible.svg b/editor/icons/StyleBoxGridVisible.svg
index 64419f4938..b13ee1023a 100644
--- a/editor/icons/StyleBoxGridVisible.svg
+++ b/editor/icons/StyleBoxGridVisible.svg
@@ -1 +1 @@
-<svg height="16" width="16" xmlns="http://www.w3.org/2000/svg"><rect style="fill:#000;stroke-width:6.081;stroke-linejoin:round;stroke-miterlimit:5;fill-opacity:.75294119" width="16.131" height="16.131" x="-.008" y="-.006" rx="0" ry="1.188"/><path style="fill:#656565;fill-opacity:1;stroke-width:6.081;stroke-linejoin:round;stroke-miterlimit:5" d="M11.92 1.37v2.835h.549V1.37zm-5.7.017v2.818h.55V1.387zm8.776 3.18v1.595H11.92v3.57h.549V6.523h3.076V4.566ZM1.599 6.161v.361h2.717v-.36Zm4.621 0v3.57h.55V6.523h3.21v-.36Zm8.833 3.932v1.601H11.92v3.336h-1.39v.362h1.939v-3.335H15.6v-1.963ZM1.63 11.695v.362h2.685v-.362zm4.59 0v3.328H4.864v.362h1.904v-3.328H9.98v-.362z"/><path style="fill:#e0e0e0;fill-opacity:1;stroke-width:6.081;stroke-linejoin:round;stroke-miterlimit:5" d="M9.98 1.008v3.197H6.22v-3.18H4.316v3.18H1.051v1.957h3.265v3.57H1.082v1.963h3.234v3.328H6.22v-3.327h3.76v3.333h1.94v-3.334h3.133V9.733H11.92v-3.57h3.076V4.204H11.92V1.008zM6.22 6.162h3.76v3.57H6.22Z"/></svg>
+<svg height="16" width="16" xmlns="http://www.w3.org/2000/svg"><rect style="fill:#000;stroke-width:6.081;stroke-linejoin:round;stroke-miterlimit:5;fill-opacity:.75294119" width="16.131" height="16.131" x="-.008" y="-.006" rx="0" ry="1.188"/><path style="fill:#656565;stroke-width:6.081;stroke-linejoin:round;stroke-miterlimit:5" d="M11.92 1.37v2.835h.549V1.37zm-5.7.017v2.818h.55V1.387zm8.776 3.18v1.595H11.92v3.57h.549V6.523h3.076V4.566ZM1.599 6.161v.361h2.717v-.36Zm4.621 0v3.57h.55V6.523h3.21v-.36Zm8.833 3.932v1.601H11.92v3.336h-1.39v.362h1.939v-3.335H15.6v-1.963ZM1.63 11.695v.362h2.685v-.362zm4.59 0v3.328H4.864v.362h1.904v-3.328H9.98v-.362z"/><path style="fill:#e0e0e0;stroke-width:6.081;stroke-linejoin:round;stroke-miterlimit:5" d="M9.98 1.008v3.197H6.22v-3.18H4.316v3.18H1.051v1.957h3.265v3.57H1.082v1.963h3.234v3.328H6.22v-3.327h3.76v3.333h1.94v-3.334h3.133V9.733H11.92v-3.57h3.076V4.204H11.92V1.008zM6.22 6.162h3.76v3.57H6.22Z"/></svg>
diff --git a/editor/icons/SystemFont.svg b/editor/icons/SystemFont.svg
index a6f62d56d3..25415a2a76 100644
--- a/editor/icons/SystemFont.svg
+++ b/editor/icons/SystemFont.svg
@@ -1 +1 @@
-<svg height="16" width="16" xml:space="preserve" xmlns="http://www.w3.org/2000/svg"><path style="fill:#e0e0e0;fill-opacity:1;stroke-width:.714755" d="m5.787 1-.402 1.613c-.352.265-.71.122-1.012-.111l-.904-.541L2.46 2.973l.853 1.425c-.058.438-.412.586-.79.635-.343.065-.674.216-1.024.213V6.72c.367 0 .715.157 1.074.224.371.032.716.243.727.65l-.84 1.4 1.008 1.01c.443-.266.895-.53 1.33-.802.349-.044.675.139.674.506l.314 1.258c.459-.059 1.099.115 1.45-.082.117-.475.242-.954.35-1.428A.67.67 0 0 1 8 9.195V7.5H6.5a.519.519 0 0 0-.281.084A.491.491 0 0 0 6 8v.5H4v-4h5.75c-.005-.22.107-.434.254-.625l.543-.902L9.535 1.96l-1.426.853c-.437-.058-.588-.412-.636-.79L7.217 1h-1.43z"/><path d="M4.5 5v3h1a1 1 0 0 1 1-1h2v6a1 1 0 0 1-1 1v1h4v-1a1 1 0 0 1-1-1V7h2a1 1 0 0 1 1 1h1V5h-6z" fill="#ff5f5f"/></svg>
+<svg height="16" width="16" xml:space="preserve" xmlns="http://www.w3.org/2000/svg"><path style="fill:#e0e0e0;stroke-width:.714755" d="m5.787 1-.402 1.613c-.352.265-.71.122-1.012-.111l-.904-.541L2.46 2.973l.853 1.425c-.058.438-.412.586-.79.635-.343.065-.674.216-1.024.213V6.72c.367 0 .715.157 1.074.224.371.032.716.243.727.65l-.84 1.4 1.008 1.01c.443-.266.895-.53 1.33-.802.349-.044.675.139.674.506l.314 1.258c.459-.059 1.099.115 1.45-.082.117-.475.242-.954.35-1.428A.67.67 0 0 1 8 9.195V7.5H6.5a.519.519 0 0 0-.281.084A.491.491 0 0 0 6 8v.5H4v-4h5.75c-.005-.22.107-.434.254-.625l.543-.902L9.535 1.96l-1.426.853c-.437-.058-.588-.412-.636-.79L7.217 1h-1.43z"/><path d="M4.5 5v3h1a1 1 0 0 1 1-1h2v6a1 1 0 0 1-1 1v1h4v-1a1 1 0 0 1-1-1V7h2a1 1 0 0 1 1 1h1V5h-6z" fill="#ff5f5f"/></svg>
diff --git a/editor/icons/Texture3D.svg b/editor/icons/Texture3D.svg
index a313613b26..d121c02f2b 100644
--- a/editor/icons/Texture3D.svg
+++ b/editor/icons/Texture3D.svg
@@ -1 +1 @@
-<svg clip-rule="evenodd" fill-rule="evenodd" stroke-linejoin="round" stroke-miterlimit="2" viewBox="0 0 16 16" xmlns="http://www.w3.org/2000/svg"><g fill="#e0e0e0" fill-rule="nonzero"><path d="m2 1c-.552 0-1 .448-1 1v12c0 .552.448 1 1 1h12c.552 0 1-.448 1-1v-12c0-.552-.448-1-1-1zm1 2h10v8h-10z"/><g fill-opacity=".99"><path d="m4.973 10.075c-.134 0-.275-.012-.424-.036-.149-.018-.293-.044-.432-.08-.14-.035-.266-.074-.381-.115-.114-.041-.203-.08-.268-.115l.216-1.1c.129.065.293.136.492.213.204.071.455.106.753.106.342 0 .593-.076.752-.23s.239-.361.239-.621c0-.159-.03-.292-.09-.399-.054-.112-.131-.201-.231-.266-.099-.071-.218-.118-.357-.142-.134-.029-.279-.044-.432-.044h-.433v-1.064h.492c.109 0 .214-.012.313-.036.104-.023.196-.062.276-.115.079-.059.141-.136.186-.23.05-.101.075-.225.075-.373 0-.112-.02-.21-.06-.292-.04-.083-.092-.151-.157-.204-.059-.054-.131-.092-.216-.116-.079-.029-.161-.044-.246-.044-.213 0-.412.038-.596.115-.178.077-.342.172-.491.284l-.395-.966c.079-.06.171-.122.275-.187.11-.065.229-.124.358-.177s.266-.098.41-.133c.149-.035.305-.053.469-.053.303 0 .564.044.783.133.223.083.407.204.551.363.144.154.251.337.321.55.069.207.104.435.104.683 0 .242-.057.479-.172.709-.114.225-.268.396-.462.515.269.13.475.325.619.585.149.254.223.561.223.922 0 .284-.039.547-.119.789-.079.237-.203.443-.372.621-.169.171-.385.307-.649.408-.258.094-.566.142-.924.142z"/><path d="m9.268 8.815c.055.006.117.012.186.018h.261c.581 0 1.011-.174 1.289-.523.284-.349.425-.831.425-1.445 0-.645-.134-1.132-.402-1.463-.269-.331-.693-.497-1.274-.497-.08 0-.162.003-.246.009-.085 0-.164.006-.239.018zm3.361-1.95c0 .532-.07.996-.209 1.392s-.338.724-.596.984c-.253.26-.564.455-.931.585-.368.13-.78.195-1.237.195-.209 0-.452-.011-.731-.035-.278-.018-.551-.059-.819-.124v-5.986c.268-.059.546-.097.834-.115.293-.023.544-.035.753-.035.442 0 .842.059 1.2.177.362.118.673.305.931.559s.457.579.596.975.209.872.209 1.428z"/></g></g></svg>
+<svg clip-rule="evenodd" fill-rule="evenodd" stroke-linejoin="round" stroke-miterlimit="2" viewBox="0 0 16 16" xmlns="http://www.w3.org/2000/svg"><g fill="#e0e0e0" fill-rule="nonzero"><path d="m2 1c-.552 0-1 .448-1 1v12c0 .552.448 1 1 1h12c.552 0 1-.448 1-1v-12c0-.552-.448-1-1-1zm1 2h10v8h-10z"/><path d="m4.973 10.075c-.134 0-.275-.012-.424-.036-.149-.018-.293-.044-.432-.08-.14-.035-.266-.074-.381-.115-.114-.041-.203-.08-.268-.115l.216-1.1c.129.065.293.136.492.213.204.071.455.106.753.106.342 0 .593-.076.752-.23s.239-.361.239-.621c0-.159-.03-.292-.09-.399-.054-.112-.131-.201-.231-.266-.099-.071-.218-.118-.357-.142-.134-.029-.279-.044-.432-.044h-.433v-1.064h.492c.109 0 .214-.012.313-.036.104-.023.196-.062.276-.115.079-.059.141-.136.186-.23.05-.101.075-.225.075-.373 0-.112-.02-.21-.06-.292-.04-.083-.092-.151-.157-.204-.059-.054-.131-.092-.216-.116-.079-.029-.161-.044-.246-.044-.213 0-.412.038-.596.115-.178.077-.342.172-.491.284l-.395-.966c.079-.06.171-.122.275-.187.11-.065.229-.124.358-.177s.266-.098.41-.133c.149-.035.305-.053.469-.053.303 0 .564.044.783.133.223.083.407.204.551.363.144.154.251.337.321.55.069.207.104.435.104.683 0 .242-.057.479-.172.709-.114.225-.268.396-.462.515.269.13.475.325.619.585.149.254.223.561.223.922 0 .284-.039.547-.119.789-.079.237-.203.443-.372.621-.169.171-.385.307-.649.408-.258.094-.566.142-.924.142z"/><path d="m9.268 8.815c.055.006.117.012.186.018h.261c.581 0 1.011-.174 1.289-.523.284-.349.425-.831.425-1.445 0-.645-.134-1.132-.402-1.463-.269-.331-.693-.497-1.274-.497-.08 0-.162.003-.246.009-.085 0-.164.006-.239.018zm3.361-1.95c0 .532-.07.996-.209 1.392s-.338.724-.596.984c-.253.26-.564.455-.931.585-.368.13-.78.195-1.237.195-.209 0-.452-.011-.731-.035-.278-.018-.551-.059-.819-.124v-5.986c.268-.059.546-.097.834-.115.293-.023.544-.035.753-.035.442 0 .842.059 1.2.177.362.118.673.305.931.559s.457.579.596.975.209.872.209 1.428z"/></g></svg>
diff --git a/editor/icons/TileMap.svg b/editor/icons/TileMap.svg
index 291d02b858..d3432f41ac 100644
--- a/editor/icons/TileMap.svg
+++ b/editor/icons/TileMap.svg
@@ -1 +1 @@
-<svg height="16" viewBox="0 0 16 16" width="16" xmlns="http://www.w3.org/2000/svg"><path d="m1 1v2h2v-2zm3 0v2h2v-2zm3 0v2h2v-2zm3 0v2h2v-2zm3 0v2h2v-2zm-12 3v2h2v-2zm3 0v2h2v-2zm3 0v2h2v-2zm3 0v2h2v-2zm3 0v2h2v-2zm-12 3v2h2v-2zm3 0v2h2v-2zm3 0v2h2v-2zm3 0v2h2v-2zm3 0v2h2v-2zm-12 3v2h2v-2zm3 0v2h2v-2zm3 0v2h2v-2zm3 0v2h2v-2zm3 0v2h2v-2zm-12 3v2h2v-2zm3 0v2h2v-2zm3 0v2h2v-2zm3 0v2h2v-2zm3 0v2h2v-2z" fill="#8da5f3" fill-opacity=".98824"/></svg>
+<svg height="16" viewBox="0 0 16 16" width="16" xmlns="http://www.w3.org/2000/svg"><path d="m1 1v2h2v-2zm3 0v2h2v-2zm3 0v2h2v-2zm3 0v2h2v-2zm3 0v2h2v-2zm-12 3v2h2v-2zm3 0v2h2v-2zm3 0v2h2v-2zm3 0v2h2v-2zm3 0v2h2v-2zm-12 3v2h2v-2zm3 0v2h2v-2zm3 0v2h2v-2zm3 0v2h2v-2zm3 0v2h2v-2zm-12 3v2h2v-2zm3 0v2h2v-2zm3 0v2h2v-2zm3 0v2h2v-2zm3 0v2h2v-2zm-12 3v2h2v-2zm3 0v2h2v-2zm3 0v2h2v-2zm3 0v2h2v-2zm3 0v2h2v-2z" fill="#8da5f3"/></svg>
diff --git a/editor/icons/ToolBoneSelect.svg b/editor/icons/ToolBoneSelect.svg
index cc12b69a82..5e9178ee94 100644
--- a/editor/icons/ToolBoneSelect.svg
+++ b/editor/icons/ToolBoneSelect.svg
@@ -1 +1 @@
-<svg enable-background="new 0 0 16 16" height="16" viewBox="0 0 16 16" width="16" xmlns="http://www.w3.org/2000/svg"><g fill="#e0e0e0" fill-opacity=".9961"><path d="m16 11.46-6.142-2.527-1.572-.647.647 1.572 2.527 6.142.913-2.72 1.815 1.817.91-.909-1.818-1.815z"/><path d="m7.784 11.008-.886-2.152c-.23-.56-.102-1.203.327-1.631.287-.287.67-.439 1.061-.439.192 0 .386.037.57.113l2.151.885.17-.17c.977.645 2.271.516 3.1-.311.964-.963.964-2.524 0-3.488-.377-.377-.867-.622-1.396-.697-.074-.529-.318-1.019-.695-1.397-.455-.453-1.067-.711-1.707-.721-.667-.01-1.309.25-1.782.72-.828.829-.96 2.126-.314 3.105l-3.558 3.561c-.978-.646-2.274-.515-3.103.312-.963.962-.963 2.524 0 3.487.378.377.868.621 1.396.695.075.529.319 1.02.696 1.396.963.964 2.525.964 3.488 0 .828-.828.96-2.125.314-3.104z"/></g></svg>
+<svg enable-background="new 0 0 16 16" height="16" viewBox="0 0 16 16" width="16" xmlns="http://www.w3.org/2000/svg"><g fill="#e0e0e0"><path d="m16 11.46-6.142-2.527-1.572-.647.647 1.572 2.527 6.142.913-2.72 1.815 1.817.91-.909-1.818-1.815z"/><path d="m7.784 11.008-.886-2.152c-.23-.56-.102-1.203.327-1.631.287-.287.67-.439 1.061-.439.192 0 .386.037.57.113l2.151.885.17-.17c.977.645 2.271.516 3.1-.311.964-.963.964-2.524 0-3.488-.377-.377-.867-.622-1.396-.697-.074-.529-.318-1.019-.695-1.397-.455-.453-1.067-.711-1.707-.721-.667-.01-1.309.25-1.782.72-.828.829-.96 2.126-.314 3.105l-3.558 3.561c-.978-.646-2.274-.515-3.103.312-.963.962-.963 2.524 0 3.487.378.377.868.621 1.396.695.075.529.319 1.02.696 1.396.963.964 2.525.964 3.488 0 .828-.828.96-2.125.314-3.104z"/></g></svg>
diff --git a/editor/icons/TouchScreenButton.svg b/editor/icons/TouchScreenButton.svg
index 7e3e232867..731743694d 100644
--- a/editor/icons/TouchScreenButton.svg
+++ b/editor/icons/TouchScreenButton.svg
@@ -1 +1 @@
-<svg height="16" viewBox="0 0 16 16" width="16" xmlns="http://www.w3.org/2000/svg"><path d="m3 1a1 1 0 0 0 -1 1v2a1 1 0 0 0 1 1h2v-1h-1-1v-2h8v2h-2v1h2a1 1 0 0 0 1-1v-2a1 1 0 0 0 -1-1zm4 2a1 1 0 0 0 -1 1v7 .033203l-2.4746-1.8086c-.52015-.3803-1.1948-.4556-1.6504 0-.45566.4556-.45561 1.1948 0 1.6504l4.125 4.125h6c1.1046 0 2-.8954 2-2v-5h-6v-4a1 1 0 0 0 -1-1z" fill="#8da5f3" fill-opacity=".98824"/></svg>
+<svg height="16" viewBox="0 0 16 16" width="16" xmlns="http://www.w3.org/2000/svg"><path d="m3 1a1 1 0 0 0 -1 1v2a1 1 0 0 0 1 1h2v-1h-1-1v-2h8v2h-2v1h2a1 1 0 0 0 1-1v-2a1 1 0 0 0 -1-1zm4 2a1 1 0 0 0 -1 1v7 .033203l-2.4746-1.8086c-.52015-.3803-1.1948-.4556-1.6504 0-.45566.4556-.45561 1.1948 0 1.6504l4.125 4.125h6c1.1046 0 2-.8954 2-2v-5h-6v-4a1 1 0 0 0 -1-1z" fill="#8da5f3"/></svg>
diff --git a/editor/icons/VisibleOnScreenEnabler2D.svg b/editor/icons/VisibleOnScreenEnabler2D.svg
index 989675f44f..434083b7c6 100644
--- a/editor/icons/VisibleOnScreenEnabler2D.svg
+++ b/editor/icons/VisibleOnScreenEnabler2D.svg
@@ -1 +1 @@
-<svg height="16" viewBox="0 0 16 16" width="16" xmlns="http://www.w3.org/2000/svg"><path d="m1 1v3h1v-2h2v-1zm11 0v1h2v2h1v-3zm-4 1c-2.5567 0-5.7907 1.9477-6.9551 5.7051a1.0001 1.0001 0 0 0 -.0058594.57031c1.1244 3.9354 4.4609 5.7246 6.9609 5.7246s5.8365-1.7892 6.9609-5.7246a1.0001 1.0001 0 0 0 0-.55273c-1.1003-3.7876-4.4066-5.7227-6.9609-5.7227zm0 2a4 4 0 0 1 4 4 4 4 0 0 1 -4 4 4 4 0 0 1 -4-4 4 4 0 0 1 4-4zm0 2a2 2 0 0 0 -2 2 2 2 0 0 0 2 2 2 2 0 0 0 2-2 2 2 0 0 0 -2-2zm-7 6v3h3v-1h-2v-2zm13 0v2h-2v1h3v-3z" fill="#8da5f3" fill-opacity=".98824" fill-rule="evenodd"/></svg>
+<svg height="16" viewBox="0 0 16 16" width="16" xmlns="http://www.w3.org/2000/svg"><path d="m1 1v3h1v-2h2v-1zm11 0v1h2v2h1v-3zm-4 1c-2.5567 0-5.7907 1.9477-6.9551 5.7051a1.0001 1.0001 0 0 0 -.0058594.57031c1.1244 3.9354 4.4609 5.7246 6.9609 5.7246s5.8365-1.7892 6.9609-5.7246a1.0001 1.0001 0 0 0 0-.55273c-1.1003-3.7876-4.4066-5.7227-6.9609-5.7227zm0 2a4 4 0 0 1 4 4 4 4 0 0 1 -4 4 4 4 0 0 1 -4-4 4 4 0 0 1 4-4zm0 2a2 2 0 0 0 -2 2 2 2 0 0 0 2 2 2 2 0 0 0 2-2 2 2 0 0 0 -2-2zm-7 6v3h3v-1h-2v-2zm13 0v2h-2v1h3v-3z" fill="#8da5f3" fill-rule="evenodd"/></svg>
diff --git a/editor/icons/YSort.svg b/editor/icons/YSort.svg
index 31e5d9a67e..8394a3bb9b 100644
--- a/editor/icons/YSort.svg
+++ b/editor/icons/YSort.svg
@@ -1 +1 @@
-<svg height="16" viewBox="0 0 16 16" width="16" xmlns="http://www.w3.org/2000/svg"><path d="m4 1-3 3h2v8h-2l3 3 3-3h-2v-8h2zm5 1v2h6v-2zm0 5v2h4v-2zm0 5v2h2v-2z" fill="#8da5f3" fill-opacity=".98824"/></svg>
+<svg height="16" viewBox="0 0 16 16" width="16" xmlns="http://www.w3.org/2000/svg"><path d="m4 1-3 3h2v8h-2l3 3 3-3h-2v-8h2zm5 1v2h6v-2zm0 5v2h4v-2zm0 5v2h2v-2z" fill="#8da5f3"/></svg>
diff --git a/editor/icons/ZoomLess.svg b/editor/icons/ZoomLess.svg
index 18b052c32a..53298ed6ed 100644
--- a/editor/icons/ZoomLess.svg
+++ b/editor/icons/ZoomLess.svg
@@ -1 +1 @@
-<svg height="16" viewBox="0 0 16 16" width="16" xmlns="http://www.w3.org/2000/svg"><g stroke-linecap="round" stroke-linejoin="round" stroke-width="2" transform="translate(0 -1036.4)"><circle cx="8" cy="1044.4" fill-opacity=".39216" r="8" stroke-opacity=".98824"/><path d="m8 1a7 7 0 0 0 -7 7 7 7 0 0 0 7 7 7 7 0 0 0 7-7 7 7 0 0 0 -7-7zm-4 6h8v2h-8z" fill="#e0e0e0" transform="translate(0 1036.4)"/></g></svg>
+<svg height="16" viewBox="0 0 16 16" width="16" xmlns="http://www.w3.org/2000/svg"><g stroke-linecap="round" stroke-linejoin="round" stroke-width="2" transform="translate(0 -1036.4)"><circle cx="8" cy="1044.4" fill-opacity=".39216" r="8"/><path d="m8 1a7 7 0 0 0 -7 7 7 7 0 0 0 7 7 7 7 0 0 0 7-7 7 7 0 0 0 -7-7zm-4 6h8v2h-8z" fill="#e0e0e0" transform="translate(0 1036.4)"/></g></svg>
diff --git a/editor/icons/ZoomMore.svg b/editor/icons/ZoomMore.svg
index fdc80611da..2b84e822e6 100644
--- a/editor/icons/ZoomMore.svg
+++ b/editor/icons/ZoomMore.svg
@@ -1 +1 @@
-<svg height="16" viewBox="0 0 16 16" width="16" xmlns="http://www.w3.org/2000/svg"><g stroke-linecap="round" stroke-linejoin="round" stroke-width="2" transform="translate(0 -1036.4)"><circle cx="8" cy="1044.4" fill-opacity=".39216" r="8" stroke-opacity=".98824"/><path d="m8 1a7 7 0 0 0 -7 7 7 7 0 0 0 7 7 7 7 0 0 0 7-7 7 7 0 0 0 -7-7zm-1 3h2v3h3v2h-3v3h-2v-3h-3v-2h3z" fill="#e0e0e0" transform="translate(0 1036.4)"/></g></svg>
+<svg height="16" viewBox="0 0 16 16" width="16" xmlns="http://www.w3.org/2000/svg"><g stroke-linecap="round" stroke-linejoin="round" stroke-width="2" transform="translate(0 -1036.4)"><circle cx="8" cy="1044.4" fill-opacity=".39216" r="8"/><path d="m8 1a7 7 0 0 0 -7 7 7 7 0 0 0 7 7 7 7 0 0 0 7-7 7 7 0 0 0 -7-7zm-1 3h2v3h3v2h-3v3h-2v-3h-3v-2h3z" fill="#e0e0e0" transform="translate(0 1036.4)"/></g></svg>
diff --git a/editor/icons/ZoomReset.svg b/editor/icons/ZoomReset.svg
index f6793b6816..ffb0d42563 100644
--- a/editor/icons/ZoomReset.svg
+++ b/editor/icons/ZoomReset.svg
@@ -1 +1 @@
-<svg height="16" viewBox="0 0 16 16" width="16" xmlns="http://www.w3.org/2000/svg"><g stroke-linecap="round" stroke-linejoin="round" stroke-width="2" transform="translate(0 -1036.4)"><circle cx="8" cy="1044.4" fill-opacity=".39216" r="8" stroke-opacity=".98824"/><path d="m8 1a7 7 0 0 0 -7 7 7 7 0 0 0 7 7 7 7 0 0 0 7-7 7 7 0 0 0 -7-7zm-.029297 3.002a1.0001 1.0001 0 0 1 1.0293.99805v7h-2v-5.1309l-1.4453.96289-1.1094-1.6641 3-2a1.0001 1.0001 0 0 1 .52539-.16602z" fill="#e0e0e0" transform="translate(0 1036.4)"/></g></svg>
+<svg height="16" viewBox="0 0 16 16" width="16" xmlns="http://www.w3.org/2000/svg"><g stroke-linecap="round" stroke-linejoin="round" stroke-width="2" transform="translate(0 -1036.4)"><circle cx="8" cy="1044.4" fill-opacity=".39216" r="8"/><path d="m8 1a7 7 0 0 0 -7 7 7 7 0 0 0 7 7 7 7 0 0 0 7-7 7 7 0 0 0 -7-7zm-.029297 3.002a1.0001 1.0001 0 0 1 1.0293.99805v7h-2v-5.1309l-1.4453.96289-1.1094-1.6641 3-2a1.0001 1.0001 0 0 1 .52539-.16602z" fill="#e0e0e0" transform="translate(0 1036.4)"/></g></svg>
diff --git a/editor/import/editor_import_plugin.cpp b/editor/import/editor_import_plugin.cpp
index fb14dcf888..ef3d3d1276 100644
--- a/editor/import/editor_import_plugin.cpp
+++ b/editor/import/editor_import_plugin.cpp
@@ -172,17 +172,15 @@ Error EditorImportPlugin::import(const String &p_source_file, const String &p_sa
++E;
}
- int err = 0;
+ Error err = OK;
if (GDVIRTUAL_CALL(_import, p_source_file, p_save_path, options, platform_variants, gen_files, err)) {
- Error ret_err = Error(err);
-
for (int i = 0; i < platform_variants.size(); i++) {
r_platform_variants->push_back(platform_variants[i]);
}
for (int i = 0; i < gen_files.size(); i++) {
r_gen_files->push_back(gen_files[i]);
}
- return ret_err;
+ return err;
}
ERR_FAIL_V_MSG(ERR_METHOD_NOT_FOUND, "Unimplemented _import in add-on.");
}
diff --git a/editor/import/editor_import_plugin.h b/editor/import/editor_import_plugin.h
index 0f79ba4783..bf912058a2 100644
--- a/editor/import/editor_import_plugin.h
+++ b/editor/import/editor_import_plugin.h
@@ -51,7 +51,7 @@ protected:
GDVIRTUAL0RC(float, _get_priority)
GDVIRTUAL0RC(int, _get_import_order)
GDVIRTUAL3RC(bool, _get_option_visibility, String, StringName, Dictionary)
- GDVIRTUAL5RC(int, _import, String, String, Dictionary, TypedArray<String>, TypedArray<String>)
+ GDVIRTUAL5RC(Error, _import, String, String, Dictionary, TypedArray<String>, TypedArray<String>)
public:
EditorImportPlugin();
diff --git a/editor/import/resource_importer_scene.cpp b/editor/import/resource_importer_scene.cpp
index 6c6c89bcc0..d0f04cb46f 100644
--- a/editor/import/resource_importer_scene.cpp
+++ b/editor/import/resource_importer_scene.cpp
@@ -54,7 +54,7 @@
#include "scene/resources/world_boundary_shape_3d.h"
uint32_t EditorSceneFormatImporter::get_import_flags() const {
- int ret;
+ uint32_t ret;
if (GDVIRTUAL_CALL(_get_import_flags, ret)) {
return ret;
}
@@ -2289,7 +2289,14 @@ Node *ResourceImporterScene::pre_import(const String &p_source_file, const HashM
ERR_FAIL_COND_V(!importer.is_valid(), nullptr);
Error err = OK;
- Node *scene = importer->import_scene(p_source_file, EditorSceneFormatImporter::IMPORT_ANIMATION | EditorSceneFormatImporter::IMPORT_GENERATE_TANGENT_ARRAYS, p_options, nullptr, &err);
+ HashMap<StringName, Variant> options_dupe = p_options;
+
+ // By default, the GLTF importer will extract embedded images into files on disk
+ // However, we do not want the advanced settings dialog to be able to write files on disk.
+ // To avoid this and also avoid compressing to basis every time, we are using the uncompressed option.
+ options_dupe["gltf/embedded_image_handling"] = 3; // Embed as Uncompressed defined in GLTFState::GLTFHandleBinary::HANDLE_BINARY_EMBED_AS_UNCOMPRESSED
+
+ Node *scene = importer->import_scene(p_source_file, EditorSceneFormatImporter::IMPORT_ANIMATION | EditorSceneFormatImporter::IMPORT_GENERATE_TANGENT_ARRAYS, options_dupe, nullptr, &err);
if (!scene || err != OK) {
return nullptr;
}
@@ -2620,8 +2627,58 @@ Node *EditorSceneFormatImporterESCN::import_scene(const String &p_path, uint32_t
Error error;
Ref<PackedScene> ps = ResourceFormatLoaderText::singleton->load(p_path, p_path, &error);
ERR_FAIL_COND_V_MSG(!ps.is_valid(), nullptr, "Cannot load scene as text resource from path '" + p_path + "'.");
-
Node *scene = ps->instantiate();
+ TypedArray<Node> nodes = scene->find_children("*", "MeshInstance3D");
+ for (int32_t node_i = 0; node_i < nodes.size(); node_i++) {
+ MeshInstance3D *mesh_3d = cast_to<MeshInstance3D>(nodes[node_i]);
+ Ref<ImporterMesh> mesh;
+ mesh.instantiate();
+ // Ignore the aabb, it will be recomputed.
+ ImporterMeshInstance3D *importer_mesh_3d = memnew(ImporterMeshInstance3D);
+ importer_mesh_3d->set_name(mesh_3d->get_name());
+ importer_mesh_3d->set_transform(mesh_3d->get_relative_transform(mesh_3d->get_parent()));
+ importer_mesh_3d->set_skin(mesh_3d->get_skin());
+ importer_mesh_3d->set_skeleton_path(mesh_3d->get_skeleton_path());
+ Ref<ArrayMesh> array_mesh_3d_mesh = mesh_3d->get_mesh();
+ if (array_mesh_3d_mesh.is_valid()) {
+ // For the MeshInstance3D nodes, we need to convert the ArrayMesh to an ImporterMesh specially.
+ mesh->set_name(array_mesh_3d_mesh->get_name());
+ for (int32_t blend_i = 0; blend_i < array_mesh_3d_mesh->get_blend_shape_count(); blend_i++) {
+ mesh->add_blend_shape(array_mesh_3d_mesh->get_blend_shape_name(blend_i));
+ }
+ for (int32_t surface_i = 0; surface_i < array_mesh_3d_mesh->get_surface_count(); surface_i++) {
+ mesh->add_surface(array_mesh_3d_mesh->surface_get_primitive_type(surface_i),
+ array_mesh_3d_mesh->surface_get_arrays(surface_i),
+ array_mesh_3d_mesh->surface_get_blend_shape_arrays(surface_i),
+ array_mesh_3d_mesh->surface_get_lods(surface_i),
+ array_mesh_3d_mesh->surface_get_material(surface_i),
+ array_mesh_3d_mesh->surface_get_name(surface_i),
+ array_mesh_3d_mesh->surface_get_format(surface_i));
+ }
+ mesh->set_blend_shape_mode(array_mesh_3d_mesh->get_blend_shape_mode());
+ importer_mesh_3d->set_mesh(mesh);
+ mesh_3d->replace_by(importer_mesh_3d);
+ continue;
+ }
+ Ref<Mesh> mesh_3d_mesh = mesh_3d->get_mesh();
+ if (mesh_3d_mesh.is_valid()) {
+ // For the MeshInstance3D nodes, we need to convert the Mesh to an ImporterMesh specially.
+ mesh->set_name(mesh_3d_mesh->get_name());
+ for (int32_t surface_i = 0; surface_i < mesh_3d_mesh->get_surface_count(); surface_i++) {
+ mesh->add_surface(mesh_3d_mesh->surface_get_primitive_type(surface_i),
+ mesh_3d_mesh->surface_get_arrays(surface_i),
+ Array(),
+ mesh_3d_mesh->surface_get_lods(surface_i),
+ mesh_3d_mesh->surface_get_material(surface_i),
+ mesh_3d_mesh->surface_get_material(surface_i).is_valid() ? mesh_3d_mesh->surface_get_material(surface_i)->get_name() : String(),
+ mesh_3d_mesh->surface_get_format(surface_i));
+ }
+ importer_mesh_3d->set_mesh(mesh);
+ mesh_3d->replace_by(importer_mesh_3d);
+ continue;
+ }
+ }
+
ERR_FAIL_COND_V(!scene, nullptr);
return scene;
diff --git a/editor/import/resource_importer_scene.h b/editor/import/resource_importer_scene.h
index aa057d3404..d6d83a45d3 100644
--- a/editor/import/resource_importer_scene.h
+++ b/editor/import/resource_importer_scene.h
@@ -56,7 +56,7 @@ protected:
Node *import_scene_wrapper(const String &p_path, uint32_t p_flags, Dictionary p_options);
Ref<Animation> import_animation_wrapper(const String &p_path, uint32_t p_flags, Dictionary p_options);
- GDVIRTUAL0RC(int, _get_import_flags)
+ GDVIRTUAL0RC(uint32_t, _get_import_flags)
GDVIRTUAL0RC(Vector<String>, _get_extensions)
GDVIRTUAL3R(Object *, _import_scene, String, uint32_t, Dictionary)
GDVIRTUAL1(_get_import_options, String)
diff --git a/editor/plugins/animation_blend_tree_editor_plugin.cpp b/editor/plugins/animation_blend_tree_editor_plugin.cpp
index f5f9ec11b3..fd664e9d9f 100644
--- a/editor/plugins/animation_blend_tree_editor_plugin.cpp
+++ b/editor/plugins/animation_blend_tree_editor_plugin.cpp
@@ -985,8 +985,6 @@ void AnimationNodeBlendTreeEditor::_node_renamed(const String &p_text, Ref<Anima
undo_redo->create_action(TTR("Node Renamed"));
undo_redo->add_do_method(blend_tree.ptr(), "rename_node", prev_name, name);
undo_redo->add_undo_method(blend_tree.ptr(), "rename_node", name, prev_name);
- undo_redo->add_do_method(tree, "rename_parameter", base_path + prev_name, base_path + name);
- undo_redo->add_undo_method(tree, "rename_parameter", base_path + name, base_path + prev_name);
undo_redo->add_do_method(this, "update_graph");
undo_redo->add_undo_method(this, "update_graph");
undo_redo->commit_action();
diff --git a/editor/plugins/control_editor_plugin.cpp b/editor/plugins/control_editor_plugin.cpp
index 470b90aa7f..3bf2b95c26 100644
--- a/editor/plugins/control_editor_plugin.cpp
+++ b/editor/plugins/control_editor_plugin.cpp
@@ -423,7 +423,7 @@ void EditorInspectorPluginControl::parse_group(Object *p_object, const String &p
add_custom_control(pos_warning);
}
-bool EditorInspectorPluginControl::parse_property(Object *p_object, const Variant::Type p_type, const String &p_path, const PropertyHint p_hint, const String &p_hint_text, const uint32_t p_usage, const bool p_wide) {
+bool EditorInspectorPluginControl::parse_property(Object *p_object, const Variant::Type p_type, const String &p_path, const PropertyHint p_hint, const String &p_hint_text, const BitField<PropertyUsageFlags> p_usage, const bool p_wide) {
Control *control = Object::cast_to<Control>(p_object);
if (!control) {
return false;
diff --git a/editor/plugins/control_editor_plugin.h b/editor/plugins/control_editor_plugin.h
index 779637317d..19e004a390 100644
--- a/editor/plugins/control_editor_plugin.h
+++ b/editor/plugins/control_editor_plugin.h
@@ -129,7 +129,7 @@ class EditorInspectorPluginControl : public EditorInspectorPlugin {
public:
virtual bool can_handle(Object *p_object) override;
virtual void parse_group(Object *p_object, const String &p_group) override;
- virtual bool parse_property(Object *p_object, const Variant::Type p_type, const String &p_path, const PropertyHint p_hint, const String &p_hint_text, const uint32_t p_usage, const bool p_wide = false) override;
+ virtual bool parse_property(Object *p_object, const Variant::Type p_type, const String &p_path, const PropertyHint p_hint, const String &p_hint_text, const BitField<PropertyUsageFlags> p_usage, const bool p_wide = false) override;
};
// Toolbar controls.
diff --git a/editor/plugins/font_config_plugin.cpp b/editor/plugins/font_config_plugin.cpp
index db4a103624..d5f3b897c9 100644
--- a/editor/plugins/font_config_plugin.cpp
+++ b/editor/plugins/font_config_plugin.cpp
@@ -874,7 +874,7 @@ bool EditorInspectorPluginFontVariation::can_handle(Object *p_object) {
return (Object::cast_to<FontVariation>(p_object) != nullptr) || (Object::cast_to<DynamicFontImportSettingsData>(p_object) != nullptr);
}
-bool EditorInspectorPluginFontVariation::parse_property(Object *p_object, const Variant::Type p_type, const String &p_path, const PropertyHint p_hint, const String &p_hint_text, const uint32_t p_usage, const bool p_wide) {
+bool EditorInspectorPluginFontVariation::parse_property(Object *p_object, const Variant::Type p_type, const String &p_path, const PropertyHint p_hint, const String &p_hint_text, const BitField<PropertyUsageFlags> p_usage, const bool p_wide) {
if (p_path == "variation_opentype") {
add_property_editor(p_path, memnew(EditorPropertyOTVariation));
return true;
@@ -976,7 +976,7 @@ void EditorInspectorPluginFontPreview::parse_begin(Object *p_object) {
add_custom_control(editor);
}
-bool EditorInspectorPluginFontPreview::parse_property(Object *p_object, const Variant::Type p_type, const String &p_path, const PropertyHint p_hint, const String &p_hint_text, const uint32_t p_usage, const bool p_wide) {
+bool EditorInspectorPluginFontPreview::parse_property(Object *p_object, const Variant::Type p_type, const String &p_path, const PropertyHint p_hint, const String &p_hint_text, const BitField<PropertyUsageFlags> p_usage, const bool p_wide) {
return false;
}
@@ -1035,7 +1035,7 @@ bool EditorInspectorPluginSystemFont::can_handle(Object *p_object) {
return Object::cast_to<SystemFont>(p_object) != nullptr;
}
-bool EditorInspectorPluginSystemFont::parse_property(Object *p_object, const Variant::Type p_type, const String &p_path, const PropertyHint p_hint, const String &p_hint_text, const uint32_t p_usage, const bool p_wide) {
+bool EditorInspectorPluginSystemFont::parse_property(Object *p_object, const Variant::Type p_type, const String &p_path, const PropertyHint p_hint, const String &p_hint_text, const BitField<PropertyUsageFlags> p_usage, const bool p_wide) {
if (p_path == "font_names") {
EditorPropertyFontNamesArray *editor = memnew(EditorPropertyFontNamesArray);
editor->setup(p_type, p_hint_text);
diff --git a/editor/plugins/font_config_plugin.h b/editor/plugins/font_config_plugin.h
index 150e97f7e2..6cea5967b2 100644
--- a/editor/plugins/font_config_plugin.h
+++ b/editor/plugins/font_config_plugin.h
@@ -212,7 +212,7 @@ class EditorInspectorPluginFontVariation : public EditorInspectorPlugin {
public:
virtual bool can_handle(Object *p_object) override;
- virtual bool parse_property(Object *p_object, const Variant::Type p_type, const String &p_path, const PropertyHint p_hint, const String &p_hint_text, const uint32_t p_usage, const bool p_wide = false) override;
+ virtual bool parse_property(Object *p_object, const Variant::Type p_type, const String &p_path, const PropertyHint p_hint, const String &p_hint_text, const BitField<PropertyUsageFlags> p_usage, const bool p_wide = false) override;
};
/*************************************************************************/
@@ -242,7 +242,7 @@ class EditorInspectorPluginFontPreview : public EditorInspectorPlugin {
public:
virtual bool can_handle(Object *p_object) override;
virtual void parse_begin(Object *p_object) override;
- virtual bool parse_property(Object *p_object, const Variant::Type p_type, const String &p_path, const PropertyHint p_hint, const String &p_hint_text, const uint32_t p_usage, const bool p_wide = false) override;
+ virtual bool parse_property(Object *p_object, const Variant::Type p_type, const String &p_path, const PropertyHint p_hint, const String &p_hint_text, const BitField<PropertyUsageFlags> p_usage, const bool p_wide = false) override;
};
/*************************************************************************/
@@ -269,7 +269,7 @@ class EditorInspectorPluginSystemFont : public EditorInspectorPlugin {
public:
virtual bool can_handle(Object *p_object) override;
- virtual bool parse_property(Object *p_object, const Variant::Type p_type, const String &p_path, const PropertyHint p_hint, const String &p_hint_text, const uint32_t p_usage, const bool p_wide = false) override;
+ virtual bool parse_property(Object *p_object, const Variant::Type p_type, const String &p_path, const PropertyHint p_hint, const String &p_hint_text, const BitField<PropertyUsageFlags> p_usage, const bool p_wide = false) override;
};
/*************************************************************************/
diff --git a/editor/plugins/gpu_particles_collision_sdf_editor_plugin.cpp b/editor/plugins/gpu_particles_collision_sdf_editor_plugin.cpp
index 72c234c1d4..477a094d01 100644
--- a/editor/plugins/gpu_particles_collision_sdf_editor_plugin.cpp
+++ b/editor/plugins/gpu_particles_collision_sdf_editor_plugin.cpp
@@ -77,7 +77,7 @@ void GPUParticlesCollisionSDF3DEditorPlugin::_notification(int p_what) {
const Vector3i size = col_sdf->get_estimated_cell_size();
- const Vector3 extents = col_sdf->get_extents();
+ const Vector3 extents = col_sdf->get_size() / 2;
int data_size = 2;
const double size_mb = size.x * size.y * size.z * data_size / (1024.0 * 1024.0);
diff --git a/editor/plugins/node_3d_editor_gizmos.cpp b/editor/plugins/node_3d_editor_gizmos.cpp
index e11dc1c81d..e48a5bb95d 100644
--- a/editor/plugins/node_3d_editor_gizmos.cpp
+++ b/editor/plugins/node_3d_editor_gizmos.cpp
@@ -1805,7 +1805,7 @@ void Camera3DGizmoPlugin::set_handle(const EditorNode3DGizmo *p_gizmo, int p_id,
} else {
Vector3 ra, rb;
Geometry3D::get_closest_points_between_segments(Vector3(0, 0, -1), Vector3(4096, 0, -1), s[0], s[1], ra, rb);
- float d = ra.x * 2.0;
+ float d = ra.x * 2;
if (Node3DEditor::get_singleton()->is_snap_enabled()) {
d = Math::snapped(d, Node3DEditor::get_singleton()->get_translate_snap());
}
@@ -2099,7 +2099,7 @@ void OccluderInstance3DGizmoPlugin::set_handle(const EditorNode3DGizmo *p_gizmo,
Ref<BoxOccluder3D> bo = o;
Vector3 ra, rb;
Geometry3D::get_closest_points_between_segments(Vector3(), axis * 4096, sg[0], sg[1], ra, rb);
- float d = ra[p_id];
+ float d = ra[p_id] * 2;
if (snap_enabled) {
d = Math::snapped(d, snap);
}
@@ -2109,7 +2109,7 @@ void OccluderInstance3DGizmoPlugin::set_handle(const EditorNode3DGizmo *p_gizmo,
}
Vector3 he = bo->get_size();
- he[p_id] = d * 2;
+ he[p_id] = d;
bo->set_size(he);
}
@@ -3184,7 +3184,7 @@ String GPUParticlesCollision3DGizmoPlugin::get_handle_name(const EditorNode3DGiz
}
if (Object::cast_to<GPUParticlesCollisionBox3D>(cs) || Object::cast_to<GPUParticlesAttractorBox3D>(cs) || Object::cast_to<GPUParticlesAttractorVectorField3D>(cs) || Object::cast_to<GPUParticlesCollisionSDF3D>(cs) || Object::cast_to<GPUParticlesCollisionHeightField3D>(cs)) {
- return "Extents";
+ return "Size";
}
return "";
@@ -3198,7 +3198,7 @@ Variant GPUParticlesCollision3DGizmoPlugin::get_handle_value(const EditorNode3DG
}
if (Object::cast_to<GPUParticlesCollisionBox3D>(cs) || Object::cast_to<GPUParticlesAttractorBox3D>(cs) || Object::cast_to<GPUParticlesAttractorVectorField3D>(cs) || Object::cast_to<GPUParticlesCollisionSDF3D>(cs) || Object::cast_to<GPUParticlesCollisionHeightField3D>(cs)) {
- return Vector3(p_gizmo->get_node_3d()->call("get_extents"));
+ return Vector3(p_gizmo->get_node_3d()->call("get_size"));
}
return Variant();
@@ -3235,7 +3235,7 @@ void GPUParticlesCollision3DGizmoPlugin::set_handle(const EditorNode3DGizmo *p_g
axis[p_id] = 1.0;
Vector3 ra, rb;
Geometry3D::get_closest_points_between_segments(Vector3(), axis * 4096, sg[0], sg[1], ra, rb);
- float d = ra[p_id];
+ float d = ra[p_id] * 2;
if (Node3DEditor::get_singleton()->is_snap_enabled()) {
d = Math::snapped(d, Node3DEditor::get_singleton()->get_translate_snap());
}
@@ -3244,9 +3244,9 @@ void GPUParticlesCollision3DGizmoPlugin::set_handle(const EditorNode3DGizmo *p_g
d = 0.001;
}
- Vector3 he = sn->call("get_extents");
+ Vector3 he = sn->call("get_size");
he[p_id] = d;
- sn->call("set_extents", he);
+ sn->call("set_size", he);
}
}
@@ -3268,14 +3268,14 @@ void GPUParticlesCollision3DGizmoPlugin::commit_handle(const EditorNode3DGizmo *
if (Object::cast_to<GPUParticlesCollisionBox3D>(sn) || Object::cast_to<GPUParticlesAttractorBox3D>(sn) || Object::cast_to<GPUParticlesAttractorVectorField3D>(sn) || Object::cast_to<GPUParticlesCollisionSDF3D>(sn) || Object::cast_to<GPUParticlesCollisionHeightField3D>(sn)) {
if (p_cancel) {
- sn->call("set_extents", p_restore);
+ sn->call("set_size", p_restore);
return;
}
EditorUndoRedoManager *ur = EditorUndoRedoManager::get_singleton();
- ur->create_action(TTR("Change Box Shape Extents"));
- ur->add_do_method(sn, "set_extents", sn->call("get_extents"));
- ur->add_undo_method(sn, "set_extents", p_restore);
+ ur->create_action(TTR("Change Box Shape Size"));
+ ur->add_do_method(sn, "set_size", sn->call("get_size"));
+ ur->add_undo_method(sn, "set_size", p_restore);
ur->commit_action();
}
}
@@ -3342,8 +3342,8 @@ void GPUParticlesCollision3DGizmoPlugin::redraw(EditorNode3DGizmo *p_gizmo) {
if (Object::cast_to<GPUParticlesCollisionBox3D>(cs) || Object::cast_to<GPUParticlesAttractorBox3D>(cs) || Object::cast_to<GPUParticlesAttractorVectorField3D>(cs) || Object::cast_to<GPUParticlesCollisionSDF3D>(cs) || Object::cast_to<GPUParticlesCollisionHeightField3D>(cs)) {
Vector<Vector3> lines;
AABB aabb;
- aabb.position = -cs->call("get_extents").operator Vector3();
- aabb.size = aabb.position * -2;
+ aabb.size = cs->call("get_size").operator Vector3();
+ aabb.position = aabb.size / -2;
for (int i = 0; i < 12; i++) {
Vector3 a, b;
@@ -3356,7 +3356,7 @@ void GPUParticlesCollision3DGizmoPlugin::redraw(EditorNode3DGizmo *p_gizmo) {
for (int i = 0; i < 3; i++) {
Vector3 ax;
- ax[i] = cs->call("get_extents").operator Vector3()[i];
+ ax[i] = cs->call("get_size").operator Vector3()[i] / 2;
handles.push_back(ax);
}
@@ -3442,11 +3442,11 @@ int ReflectionProbeGizmoPlugin::get_priority() const {
String ReflectionProbeGizmoPlugin::get_handle_name(const EditorNode3DGizmo *p_gizmo, int p_id, bool p_secondary) const {
switch (p_id) {
case 0:
- return "Extents X";
+ return "Size X";
case 1:
- return "Extents Y";
+ return "Size Y";
case 2:
- return "Extents Z";
+ return "Size Z";
case 3:
return "Origin X";
case 4:
@@ -3460,7 +3460,7 @@ String ReflectionProbeGizmoPlugin::get_handle_name(const EditorNode3DGizmo *p_gi
Variant ReflectionProbeGizmoPlugin::get_handle_value(const EditorNode3DGizmo *p_gizmo, int p_id, bool p_secondary) const {
ReflectionProbe *probe = Object::cast_to<ReflectionProbe>(p_gizmo->get_node_3d());
- return AABB(probe->get_extents(), probe->get_origin_offset());
+ return AABB(probe->get_origin_offset(), probe->get_size());
}
void ReflectionProbeGizmoPlugin::set_handle(const EditorNode3DGizmo *p_gizmo, int p_id, bool p_secondary, Camera3D *p_camera, const Point2 &p_point) {
@@ -3470,7 +3470,7 @@ void ReflectionProbeGizmoPlugin::set_handle(const EditorNode3DGizmo *p_gizmo, in
Transform3D gi = gt.affine_inverse();
if (p_id < 3) {
- Vector3 extents = probe->get_extents();
+ Vector3 size = probe->get_size();
Vector3 ray_from = p_camera->project_ray_origin(p_point);
Vector3 ray_dir = p_camera->project_ray_normal(p_point);
@@ -3482,7 +3482,7 @@ void ReflectionProbeGizmoPlugin::set_handle(const EditorNode3DGizmo *p_gizmo, in
Vector3 ra, rb;
Geometry3D::get_closest_points_between_segments(Vector3(), axis * 16384, sg[0], sg[1], ra, rb);
- float d = ra[p_id];
+ float d = ra[p_id] * 2;
if (Node3DEditor::get_singleton()->is_snap_enabled()) {
d = Math::snapped(d, Node3DEditor::get_singleton()->get_translate_snap());
}
@@ -3491,8 +3491,8 @@ void ReflectionProbeGizmoPlugin::set_handle(const EditorNode3DGizmo *p_gizmo, in
d = 0.001;
}
- extents[p_id] = d;
- probe->set_extents(extents);
+ size[p_id] = d;
+ probe->set_size(size);
} else {
p_id -= 3;
@@ -3526,17 +3526,17 @@ void ReflectionProbeGizmoPlugin::commit_handle(const EditorNode3DGizmo *p_gizmo,
AABB restore = p_restore;
if (p_cancel) {
- probe->set_extents(restore.position);
- probe->set_origin_offset(restore.size);
+ probe->set_origin_offset(restore.position);
+ probe->set_size(restore.size);
return;
}
EditorUndoRedoManager *ur = EditorUndoRedoManager::get_singleton();
- ur->create_action(TTR("Change Probe Extents"));
- ur->add_do_method(probe, "set_extents", probe->get_extents());
+ ur->create_action(TTR("Change Probe Size"));
+ ur->add_do_method(probe, "set_size", probe->get_size());
ur->add_do_method(probe, "set_origin_offset", probe->get_origin_offset());
- ur->add_undo_method(probe, "set_extents", restore.position);
- ur->add_undo_method(probe, "set_origin_offset", restore.size);
+ ur->add_undo_method(probe, "set_size", restore.size);
+ ur->add_undo_method(probe, "set_origin_offset", restore.position);
ur->commit_action();
}
@@ -3547,11 +3547,11 @@ void ReflectionProbeGizmoPlugin::redraw(EditorNode3DGizmo *p_gizmo) {
Vector<Vector3> lines;
Vector<Vector3> internal_lines;
- Vector3 extents = probe->get_extents();
+ Vector3 size = probe->get_size();
AABB aabb;
- aabb.position = -extents;
- aabb.size = extents * 2;
+ aabb.position = -size / 2;
+ aabb.size = size;
for (int i = 0; i < 12; i++) {
Vector3 a, b;
@@ -3593,7 +3593,7 @@ void ReflectionProbeGizmoPlugin::redraw(EditorNode3DGizmo *p_gizmo) {
if (p_gizmo->is_selected()) {
Ref<Material> solid_material = get_material("reflection_probe_solid_material", p_gizmo);
- p_gizmo->add_solid_box(solid_material, probe->get_extents() * 2.0);
+ p_gizmo->add_solid_box(solid_material, probe->get_size());
}
p_gizmo->add_unscaled_billboard(icon, 0.05);
@@ -3627,11 +3627,11 @@ int DecalGizmoPlugin::get_priority() const {
String DecalGizmoPlugin::get_handle_name(const EditorNode3DGizmo *p_gizmo, int p_id, bool p_secondary) const {
switch (p_id) {
case 0:
- return "Extents X";
+ return "Size X";
case 1:
- return "Extents Y";
+ return "Size Y";
case 2:
- return "Extents Z";
+ return "Size Z";
}
return "";
@@ -3639,7 +3639,7 @@ String DecalGizmoPlugin::get_handle_name(const EditorNode3DGizmo *p_gizmo, int p
Variant DecalGizmoPlugin::get_handle_value(const EditorNode3DGizmo *p_gizmo, int p_id, bool p_secondary) const {
Decal *decal = Object::cast_to<Decal>(p_gizmo->get_node_3d());
- return decal->get_extents();
+ return decal->get_size();
}
void DecalGizmoPlugin::set_handle(const EditorNode3DGizmo *p_gizmo, int p_id, bool p_secondary, Camera3D *p_camera, const Point2 &p_point) {
@@ -3648,7 +3648,7 @@ void DecalGizmoPlugin::set_handle(const EditorNode3DGizmo *p_gizmo, int p_id, bo
Transform3D gi = gt.affine_inverse();
- Vector3 extents = decal->get_extents();
+ Vector3 size = decal->get_size();
Vector3 ray_from = p_camera->project_ray_origin(p_point);
Vector3 ray_dir = p_camera->project_ray_normal(p_point);
@@ -3660,7 +3660,7 @@ void DecalGizmoPlugin::set_handle(const EditorNode3DGizmo *p_gizmo, int p_id, bo
Vector3 ra, rb;
Geometry3D::get_closest_points_between_segments(Vector3(), axis * 16384, sg[0], sg[1], ra, rb);
- float d = ra[p_id];
+ float d = ra[p_id] * 2;
if (Node3DEditor::get_singleton()->is_snap_enabled()) {
d = Math::snapped(d, Node3DEditor::get_singleton()->get_translate_snap());
}
@@ -3669,8 +3669,8 @@ void DecalGizmoPlugin::set_handle(const EditorNode3DGizmo *p_gizmo, int p_id, bo
d = 0.001;
}
- extents[p_id] = d;
- decal->set_extents(extents);
+ size[p_id] = d;
+ decal->set_size(size);
}
void DecalGizmoPlugin::commit_handle(const EditorNode3DGizmo *p_gizmo, int p_id, bool p_secondary, const Variant &p_restore, bool p_cancel) {
@@ -3679,14 +3679,14 @@ void DecalGizmoPlugin::commit_handle(const EditorNode3DGizmo *p_gizmo, int p_id,
Vector3 restore = p_restore;
if (p_cancel) {
- decal->set_extents(restore);
+ decal->set_size(restore);
return;
}
EditorUndoRedoManager *ur = EditorUndoRedoManager::get_singleton();
- ur->create_action(TTR("Change Decal Extents"));
- ur->add_do_method(decal, "set_extents", decal->get_extents());
- ur->add_undo_method(decal, "set_extents", restore);
+ ur->create_action(TTR("Change Decal Size"));
+ ur->add_do_method(decal, "set_size", decal->get_size());
+ ur->add_undo_method(decal, "set_size", restore);
ur->commit_action();
}
@@ -3696,11 +3696,11 @@ void DecalGizmoPlugin::redraw(EditorNode3DGizmo *p_gizmo) {
p_gizmo->clear();
Vector<Vector3> lines;
- Vector3 extents = decal->get_extents();
+ Vector3 size = decal->get_size();
AABB aabb;
- aabb.position = -extents;
- aabb.size = extents * 2;
+ aabb.position = -size / 2;
+ aabb.size = size;
for (int i = 0; i < 12; i++) {
Vector3 a, b;
@@ -3718,8 +3718,9 @@ void DecalGizmoPlugin::redraw(EditorNode3DGizmo *p_gizmo) {
}
}
- lines.push_back(Vector3(0, extents.y, 0));
- lines.push_back(Vector3(0, extents.y * 1.2, 0));
+ float half_size_y = size.y / 2;
+ lines.push_back(Vector3(0, half_size_y, 0));
+ lines.push_back(Vector3(0, half_size_y * 1.2, 0));
Vector<Vector3> handles;
@@ -3767,11 +3768,11 @@ int VoxelGIGizmoPlugin::get_priority() const {
String VoxelGIGizmoPlugin::get_handle_name(const EditorNode3DGizmo *p_gizmo, int p_id, bool p_secondary) const {
switch (p_id) {
case 0:
- return "Extents X";
+ return "Size X";
case 1:
- return "Extents Y";
+ return "Size Y";
case 2:
- return "Extents Z";
+ return "Size Z";
}
return "";
@@ -3779,7 +3780,7 @@ String VoxelGIGizmoPlugin::get_handle_name(const EditorNode3DGizmo *p_gizmo, int
Variant VoxelGIGizmoPlugin::get_handle_value(const EditorNode3DGizmo *p_gizmo, int p_id, bool p_secondary) const {
VoxelGI *probe = Object::cast_to<VoxelGI>(p_gizmo->get_node_3d());
- return probe->get_extents();
+ return probe->get_size();
}
void VoxelGIGizmoPlugin::set_handle(const EditorNode3DGizmo *p_gizmo, int p_id, bool p_secondary, Camera3D *p_camera, const Point2 &p_point) {
@@ -3788,7 +3789,7 @@ void VoxelGIGizmoPlugin::set_handle(const EditorNode3DGizmo *p_gizmo, int p_id,
Transform3D gt = probe->get_global_transform();
Transform3D gi = gt.affine_inverse();
- Vector3 extents = probe->get_extents();
+ Vector3 size = probe->get_size();
Vector3 ray_from = p_camera->project_ray_origin(p_point);
Vector3 ray_dir = p_camera->project_ray_normal(p_point);
@@ -3800,7 +3801,7 @@ void VoxelGIGizmoPlugin::set_handle(const EditorNode3DGizmo *p_gizmo, int p_id,
Vector3 ra, rb;
Geometry3D::get_closest_points_between_segments(Vector3(), axis * 16384, sg[0], sg[1], ra, rb);
- float d = ra[p_id];
+ float d = ra[p_id] * 2;
if (Node3DEditor::get_singleton()->is_snap_enabled()) {
d = Math::snapped(d, Node3DEditor::get_singleton()->get_translate_snap());
}
@@ -3809,8 +3810,8 @@ void VoxelGIGizmoPlugin::set_handle(const EditorNode3DGizmo *p_gizmo, int p_id,
d = 0.001;
}
- extents[p_id] = d;
- probe->set_extents(extents);
+ size[p_id] = d;
+ probe->set_size(size);
}
void VoxelGIGizmoPlugin::commit_handle(const EditorNode3DGizmo *p_gizmo, int p_id, bool p_secondary, const Variant &p_restore, bool p_cancel) {
@@ -3819,14 +3820,14 @@ void VoxelGIGizmoPlugin::commit_handle(const EditorNode3DGizmo *p_gizmo, int p_i
Vector3 restore = p_restore;
if (p_cancel) {
- probe->set_extents(restore);
+ probe->set_size(restore);
return;
}
EditorUndoRedoManager *ur = EditorUndoRedoManager::get_singleton();
- ur->create_action(TTR("Change Probe Extents"));
- ur->add_do_method(probe, "set_extents", probe->get_extents());
- ur->add_undo_method(probe, "set_extents", restore);
+ ur->create_action(TTR("Change Probe Size"));
+ ur->add_do_method(probe, "set_size", probe->get_size());
+ ur->add_undo_method(probe, "set_size", restore);
ur->commit_action();
}
@@ -3840,11 +3841,11 @@ void VoxelGIGizmoPlugin::redraw(EditorNode3DGizmo *p_gizmo) {
p_gizmo->clear();
Vector<Vector3> lines;
- Vector3 extents = probe->get_extents();
+ Vector3 size = probe->get_size();
static const int subdivs[VoxelGI::SUBDIV_MAX] = { 64, 128, 256, 512 };
- AABB aabb = AABB(-extents, extents * 2);
+ AABB aabb = AABB(-size / 2, size);
int subdiv = subdivs[probe->get_subdiv()];
float cell_size = aabb.get_longest_axis_size() / subdiv;
@@ -4363,7 +4364,7 @@ void CollisionShape3DGizmoPlugin::set_handle(const EditorNode3DGizmo *p_gizmo, i
Ref<BoxShape3D> bs = s;
Vector3 ra, rb;
Geometry3D::get_closest_points_between_segments(Vector3(), axis * 4096, sg[0], sg[1], ra, rb);
- float d = ra[p_id];
+ float d = ra[p_id] * 2;
if (Node3DEditor::get_singleton()->is_snap_enabled()) {
d = Math::snapped(d, Node3DEditor::get_singleton()->get_translate_snap());
}
@@ -4373,7 +4374,7 @@ void CollisionShape3DGizmoPlugin::set_handle(const EditorNode3DGizmo *p_gizmo, i
}
Vector3 he = bs->get_size();
- he[p_id] = d * 2;
+ he[p_id] = d;
bs->set_size(he);
}
@@ -5902,11 +5903,11 @@ int FogVolumeGizmoPlugin::get_priority() const {
}
String FogVolumeGizmoPlugin::get_handle_name(const EditorNode3DGizmo *p_gizmo, int p_id, bool p_secondary) const {
- return "Extents";
+ return "Size";
}
Variant FogVolumeGizmoPlugin::get_handle_value(const EditorNode3DGizmo *p_gizmo, int p_id, bool p_secondary) const {
- return Vector3(p_gizmo->get_node_3d()->call("get_extents"));
+ return Vector3(p_gizmo->get_node_3d()->call("get_size"));
}
void FogVolumeGizmoPlugin::set_handle(const EditorNode3DGizmo *p_gizmo, int p_id, bool p_secondary, Camera3D *p_camera, const Point2 &p_point) {
@@ -5924,7 +5925,7 @@ void FogVolumeGizmoPlugin::set_handle(const EditorNode3DGizmo *p_gizmo, int p_id
axis[p_id] = 1.0;
Vector3 ra, rb;
Geometry3D::get_closest_points_between_segments(Vector3(), axis * 4096, sg[0], sg[1], ra, rb);
- float d = ra[p_id];
+ float d = ra[p_id] * 2;
if (Node3DEditor::get_singleton()->is_snap_enabled()) {
d = Math::snapped(d, Node3DEditor::get_singleton()->get_translate_snap());
}
@@ -5933,23 +5934,23 @@ void FogVolumeGizmoPlugin::set_handle(const EditorNode3DGizmo *p_gizmo, int p_id
d = 0.001;
}
- Vector3 he = sn->call("get_extents");
+ Vector3 he = sn->call("get_size");
he[p_id] = d;
- sn->call("set_extents", he);
+ sn->call("set_size", he);
}
void FogVolumeGizmoPlugin::commit_handle(const EditorNode3DGizmo *p_gizmo, int p_id, bool p_secondary, const Variant &p_restore, bool p_cancel) {
Node3D *sn = p_gizmo->get_node_3d();
if (p_cancel) {
- sn->call("set_extents", p_restore);
+ sn->call("set_size", p_restore);
return;
}
EditorUndoRedoManager *ur = EditorUndoRedoManager::get_singleton();
- ur->create_action(TTR("Change Fog Volume Extents"));
- ur->add_do_method(sn, "set_extents", sn->call("get_extents"));
- ur->add_undo_method(sn, "set_extents", p_restore);
+ ur->create_action(TTR("Change Fog Volume Size"));
+ ur->add_do_method(sn, "set_size", sn->call("get_size"));
+ ur->add_undo_method(sn, "set_size", p_restore);
ur->commit_action();
}
@@ -5968,8 +5969,8 @@ void FogVolumeGizmoPlugin::redraw(EditorNode3DGizmo *p_gizmo) {
Vector<Vector3> lines;
AABB aabb;
- aabb.position = -cs->call("get_extents").operator Vector3();
- aabb.size = aabb.position * -2;
+ aabb.size = cs->call("get_size").operator Vector3();
+ aabb.position = aabb.size / -2;
for (int i = 0; i < 12; i++) {
Vector3 a, b;
@@ -5982,7 +5983,7 @@ void FogVolumeGizmoPlugin::redraw(EditorNode3DGizmo *p_gizmo) {
for (int i = 0; i < 3; i++) {
Vector3 ax;
- ax[i] = cs->call("get_extents").operator Vector3()[i];
+ ax[i] = cs->call("get_size").operator Vector3()[i] / 2;
handles.push_back(ax);
}
diff --git a/editor/plugins/root_motion_editor_plugin.cpp b/editor/plugins/root_motion_editor_plugin.cpp
index d894ba4c4a..e8abecd115 100644
--- a/editor/plugins/root_motion_editor_plugin.cpp
+++ b/editor/plugins/root_motion_editor_plugin.cpp
@@ -229,7 +229,7 @@ bool EditorInspectorRootMotionPlugin::can_handle(Object *p_object) {
return true; // Can handle everything.
}
-bool EditorInspectorRootMotionPlugin::parse_property(Object *p_object, const Variant::Type p_type, const String &p_path, const PropertyHint p_hint, const String &p_hint_text, const uint32_t p_usage, const bool p_wide) {
+bool EditorInspectorRootMotionPlugin::parse_property(Object *p_object, const Variant::Type p_type, const String &p_path, const PropertyHint p_hint, const String &p_hint_text, const BitField<PropertyUsageFlags> p_usage, const bool p_wide) {
if (p_path == "root_motion_track" && p_object->is_class("AnimationTree") && p_type == Variant::NODE_PATH) {
EditorPropertyRootMotion *editor = memnew(EditorPropertyRootMotion);
add_property_editor(p_path, editor);
diff --git a/editor/plugins/root_motion_editor_plugin.h b/editor/plugins/root_motion_editor_plugin.h
index f9b1a9f478..d27f0d30cc 100644
--- a/editor/plugins/root_motion_editor_plugin.h
+++ b/editor/plugins/root_motion_editor_plugin.h
@@ -63,7 +63,7 @@ class EditorInspectorRootMotionPlugin : public EditorInspectorPlugin {
public:
virtual bool can_handle(Object *p_object) override;
- virtual bool parse_property(Object *p_object, const Variant::Type p_type, const String &p_path, const PropertyHint p_hint, const String &p_hint_text, const uint32_t p_usage, const bool p_wide = false) override;
+ virtual bool parse_property(Object *p_object, const Variant::Type p_type, const String &p_path, const PropertyHint p_hint, const String &p_hint_text, const BitField<PropertyUsageFlags> p_usage, const bool p_wide = false) override;
};
#endif // ROOT_MOTION_EDITOR_PLUGIN_H
diff --git a/editor/plugins/texture_region_editor_plugin.cpp b/editor/plugins/texture_region_editor_plugin.cpp
index c5aa60c816..7fa16e6cc6 100644
--- a/editor/plugins/texture_region_editor_plugin.cpp
+++ b/editor/plugins/texture_region_editor_plugin.cpp
@@ -1224,7 +1224,7 @@ void EditorInspectorPluginTextureRegion::_region_edit(Object *p_object) {
texture_region_editor->edit(p_object);
}
-bool EditorInspectorPluginTextureRegion::parse_property(Object *p_object, const Variant::Type p_type, const String &p_path, const PropertyHint p_hint, const String &p_hint_text, const uint32_t p_usage, const bool p_wide) {
+bool EditorInspectorPluginTextureRegion::parse_property(Object *p_object, const Variant::Type p_type, const String &p_path, const PropertyHint p_hint, const String &p_hint_text, const BitField<PropertyUsageFlags> p_usage, const bool p_wide) {
if ((p_type == Variant::RECT2 || p_type == Variant::RECT2I)) {
if (((Object::cast_to<Sprite2D>(p_object) || Object::cast_to<Sprite3D>(p_object) || Object::cast_to<NinePatchRect>(p_object) || Object::cast_to<StyleBoxTexture>(p_object)) && p_path == "region_rect") || (Object::cast_to<AtlasTexture>(p_object) && p_path == "region")) {
Button *button = EditorInspector::create_inspector_action_button(TTR("Edit Region"));
diff --git a/editor/plugins/texture_region_editor_plugin.h b/editor/plugins/texture_region_editor_plugin.h
index ba64a04084..c303cec3f5 100644
--- a/editor/plugins/texture_region_editor_plugin.h
+++ b/editor/plugins/texture_region_editor_plugin.h
@@ -156,7 +156,7 @@ class EditorInspectorPluginTextureRegion : public EditorInspectorPlugin {
public:
virtual bool can_handle(Object *p_object) override;
- virtual bool parse_property(Object *p_object, const Variant::Type p_type, const String &p_path, const PropertyHint p_hint, const String &p_hint_text, const uint32_t p_usage, const bool p_wide) override;
+ virtual bool parse_property(Object *p_object, const Variant::Type p_type, const String &p_path, const PropertyHint p_hint, const String &p_hint_text, const BitField<PropertyUsageFlags> p_usage, const bool p_wide) override;
EditorInspectorPluginTextureRegion();
};
diff --git a/editor/plugins/tiles/tile_set_atlas_source_editor.cpp b/editor/plugins/tiles/tile_set_atlas_source_editor.cpp
index 840a3911af..912fdb03a9 100644
--- a/editor/plugins/tiles/tile_set_atlas_source_editor.cpp
+++ b/editor/plugins/tiles/tile_set_atlas_source_editor.cpp
@@ -2773,7 +2773,7 @@ bool EditorInspectorPluginTileData::can_handle(Object *p_object) {
return Object::cast_to<TileSetAtlasSourceEditor::AtlasTileProxyObject>(p_object) != nullptr;
}
-bool EditorInspectorPluginTileData::parse_property(Object *p_object, const Variant::Type p_type, const String &p_path, const PropertyHint p_hint, const String &p_hint_text, const uint32_t p_usage, const bool p_wide) {
+bool EditorInspectorPluginTileData::parse_property(Object *p_object, const Variant::Type p_type, const String &p_path, const PropertyHint p_hint, const String &p_hint_text, const BitField<PropertyUsageFlags> p_usage, const bool p_wide) {
Vector<String> components = String(p_path).split("/", true, 2);
if (components.size() == 2 && components[0].begins_with("occlusion_layer_") && components[0].trim_prefix("occlusion_layer_").is_valid_int()) {
// Occlusion layers.
diff --git a/editor/plugins/tiles/tile_set_atlas_source_editor.h b/editor/plugins/tiles/tile_set_atlas_source_editor.h
index a4826bc56f..5141824f79 100644
--- a/editor/plugins/tiles/tile_set_atlas_source_editor.h
+++ b/editor/plugins/tiles/tile_set_atlas_source_editor.h
@@ -312,7 +312,7 @@ class EditorInspectorPluginTileData : public EditorInspectorPlugin {
public:
virtual bool can_handle(Object *p_object) override;
- virtual bool parse_property(Object *p_object, const Variant::Type p_type, const String &p_path, const PropertyHint p_hint, const String &p_hint_text, const uint32_t p_usage, const bool p_wide = false) override;
+ virtual bool parse_property(Object *p_object, const Variant::Type p_type, const String &p_path, const PropertyHint p_hint, const String &p_hint_text, const BitField<PropertyUsageFlags> p_usage, const bool p_wide = false) override;
};
#endif // TILE_SET_ATLAS_SOURCE_EDITOR_H
diff --git a/editor/plugins/visual_shader_editor_plugin.cpp b/editor/plugins/visual_shader_editor_plugin.cpp
index af70e64b6a..59b5795ae3 100644
--- a/editor/plugins/visual_shader_editor_plugin.cpp
+++ b/editor/plugins/visual_shader_editor_plugin.cpp
@@ -5536,6 +5536,7 @@ VisualShaderEditor::VisualShaderEditor() {
add_options.push_back(AddOption("ViewIndex", "Input/Vertex", "VisualShaderNodeInput", vformat(input_param_for_vertex_and_fragment_shader_modes, "view_index", "VIEW_INDEX"), { "view_index" }, VisualShaderNode::PORT_TYPE_SCALAR_INT, TYPE_FLAGS_VERTEX, Shader::MODE_SPATIAL));
add_options.push_back(AddOption("ViewMonoLeft", "Input/Vertex", "VisualShaderNodeInput", vformat(input_param_for_vertex_and_fragment_shader_modes, "view_mono_left", "VIEW_MONO_LEFT"), { "view_mono_left" }, VisualShaderNode::PORT_TYPE_SCALAR_INT, TYPE_FLAGS_VERTEX, Shader::MODE_SPATIAL));
add_options.push_back(AddOption("ViewRight", "Input/Vertex", "VisualShaderNodeInput", vformat(input_param_for_vertex_and_fragment_shader_modes, "view_right", "VIEW_RIGHT"), { "view_right" }, VisualShaderNode::PORT_TYPE_SCALAR_INT, TYPE_FLAGS_VERTEX, Shader::MODE_SPATIAL));
+ add_options.push_back(AddOption("EyeOffset", "Input/Vertex", "VisualShaderNodeInput", vformat(input_param_for_vertex_and_fragment_shader_modes, "eye_offset", "EYE_OFFSET"), { "eye_offset" }, VisualShaderNode::PORT_TYPE_VECTOR_3D, TYPE_FLAGS_VERTEX, Shader::MODE_SPATIAL));
add_options.push_back(AddOption("NodePositionWorld", "Input/Vertex", "VisualShaderNodeInput", vformat(input_param_for_vertex_and_fragment_shader_modes, "node_position_world", "NODE_POSITION_WORLD"), { "node_position_world" }, VisualShaderNode::PORT_TYPE_VECTOR_3D, TYPE_FLAGS_VERTEX, Shader::MODE_SPATIAL));
add_options.push_back(AddOption("CameraPositionWorld", "Input/Vertex", "VisualShaderNodeInput", vformat(input_param_for_vertex_and_fragment_shader_modes, "camera_position_world", "CAMERA_POSITION_WORLD"), { "camera_position_world" }, VisualShaderNode::PORT_TYPE_VECTOR_3D, TYPE_FLAGS_VERTEX, Shader::MODE_SPATIAL));
add_options.push_back(AddOption("CameraDirectionWorld", "Input/Vertex", "VisualShaderNodeInput", vformat(input_param_for_vertex_and_fragment_shader_modes, "camera_direction_world", "CAMERA_DIRECTION_WORLD"), { "camera_direction_world" }, VisualShaderNode::PORT_TYPE_VECTOR_3D, TYPE_FLAGS_VERTEX, Shader::MODE_SPATIAL));
@@ -5554,6 +5555,7 @@ VisualShaderEditor::VisualShaderEditor() {
add_options.push_back(AddOption("ViewIndex", "Input/Fragment", "VisualShaderNodeInput", vformat(input_param_for_vertex_and_fragment_shader_modes, "view_index", "VIEW_INDEX"), { "view_index" }, VisualShaderNode::PORT_TYPE_SCALAR_INT, TYPE_FLAGS_FRAGMENT, Shader::MODE_SPATIAL));
add_options.push_back(AddOption("ViewMonoLeft", "Input/Fragment", "VisualShaderNodeInput", vformat(input_param_for_vertex_and_fragment_shader_modes, "view_mono_left", "VIEW_MONO_LEFT"), { "view_mono_left" }, VisualShaderNode::PORT_TYPE_SCALAR_INT, TYPE_FLAGS_FRAGMENT, Shader::MODE_SPATIAL));
add_options.push_back(AddOption("ViewRight", "Input/Fragment", "VisualShaderNodeInput", vformat(input_param_for_vertex_and_fragment_shader_modes, "view_right", "VIEW_RIGHT"), { "view_right" }, VisualShaderNode::PORT_TYPE_SCALAR_INT, TYPE_FLAGS_FRAGMENT, Shader::MODE_SPATIAL));
+ add_options.push_back(AddOption("EyeOffset", "Input/Fragment", "VisualShaderNodeInput", vformat(input_param_for_vertex_and_fragment_shader_modes, "eye_offset", "EYE_OFFSET"), { "eye_offset" }, VisualShaderNode::PORT_TYPE_VECTOR_3D, TYPE_FLAGS_FRAGMENT, Shader::MODE_SPATIAL));
add_options.push_back(AddOption("NodePositionWorld", "Input/Fragment", "VisualShaderNodeInput", vformat(input_param_for_vertex_and_fragment_shader_modes, "node_position_world", "NODE_POSITION_WORLD"), { "node_position_world" }, VisualShaderNode::PORT_TYPE_VECTOR_3D, TYPE_FLAGS_FRAGMENT, Shader::MODE_SPATIAL));
add_options.push_back(AddOption("CameraPositionWorld", "Input/Fragment", "VisualShaderNodeInput", vformat(input_param_for_vertex_and_fragment_shader_modes, "camera_position_world", "CAMERA_POSITION_WORLD"), { "camera_position_world" }, VisualShaderNode::PORT_TYPE_VECTOR_3D, TYPE_FLAGS_FRAGMENT, Shader::MODE_SPATIAL));
add_options.push_back(AddOption("CameraDirectionWorld", "Input/Fragment", "VisualShaderNodeInput", vformat(input_param_for_vertex_and_fragment_shader_modes, "camera_direction_world", "CAMERA_DIRECTION_WORLD"), { "camera_direction_world" }, VisualShaderNode::PORT_TYPE_VECTOR_3D, TYPE_FLAGS_FRAGMENT, Shader::MODE_SPATIAL));
@@ -5647,7 +5649,7 @@ VisualShaderEditor::VisualShaderEditor() {
add_options.push_back(AddOption("WorldPosition", "Input/Fog", "VisualShaderNodeInput", vformat(input_param_for_fog_shader_mode, "world_position", "WORLD_POSITION"), { "world_position" }, VisualShaderNode::PORT_TYPE_VECTOR_3D, TYPE_FLAGS_FOG, Shader::MODE_FOG));
add_options.push_back(AddOption("ObjectPosition", "Input/Fog", "VisualShaderNodeInput", vformat(input_param_for_fog_shader_mode, "object_position", "OBJECT_POSITION"), { "object_position" }, VisualShaderNode::PORT_TYPE_VECTOR_3D, TYPE_FLAGS_FOG, Shader::MODE_FOG));
add_options.push_back(AddOption("UVW", "Input/Fog", "VisualShaderNodeInput", vformat(input_param_for_fog_shader_mode, "uvw", "UVW"), { "uvw" }, VisualShaderNode::PORT_TYPE_VECTOR_3D, TYPE_FLAGS_FOG, Shader::MODE_FOG));
- add_options.push_back(AddOption("Extents", "Input/Fog", "VisualShaderNodeInput", vformat(input_param_for_fog_shader_mode, "extents", "EXTENTS"), { "extents" }, VisualShaderNode::PORT_TYPE_VECTOR_3D, TYPE_FLAGS_FOG, Shader::MODE_FOG));
+ add_options.push_back(AddOption("Size", "Input/Fog", "VisualShaderNodeInput", vformat(input_param_for_fog_shader_mode, "size", "SIZE"), { "size" }, VisualShaderNode::PORT_TYPE_VECTOR_3D, TYPE_FLAGS_FOG, Shader::MODE_FOG));
add_options.push_back(AddOption("SDF", "Input/Fog", "VisualShaderNodeInput", vformat(input_param_for_fog_shader_mode, "sdf", "SDF"), { "sdf" }, VisualShaderNode::PORT_TYPE_SCALAR, TYPE_FLAGS_FOG, Shader::MODE_FOG));
add_options.push_back(AddOption("Time", "Input/Fog", "VisualShaderNodeInput", vformat(input_param_for_fog_shader_mode, "time", "TIME"), { "time" }, VisualShaderNode::PORT_TYPE_SCALAR, TYPE_FLAGS_FOG, Shader::MODE_FOG));
@@ -6568,7 +6570,7 @@ bool EditorInspectorVisualShaderModePlugin::can_handle(Object *p_object) {
return true; // Can handle everything.
}
-bool EditorInspectorVisualShaderModePlugin::parse_property(Object *p_object, const Variant::Type p_type, const String &p_path, const PropertyHint p_hint, const String &p_hint_text, const uint32_t p_usage, const bool p_wide) {
+bool EditorInspectorVisualShaderModePlugin::parse_property(Object *p_object, const Variant::Type p_type, const String &p_path, const PropertyHint p_hint, const String &p_hint_text, const BitField<PropertyUsageFlags> p_usage, const bool p_wide) {
if (p_path == "mode" && p_object->is_class("VisualShader") && p_type == Variant::INT) {
EditorPropertyVisualShaderMode *mode_editor = memnew(EditorPropertyVisualShaderMode);
Vector<String> options = p_hint_text.split(",");
diff --git a/editor/plugins/visual_shader_editor_plugin.h b/editor/plugins/visual_shader_editor_plugin.h
index 519a390ccc..142c8167a8 100644
--- a/editor/plugins/visual_shader_editor_plugin.h
+++ b/editor/plugins/visual_shader_editor_plugin.h
@@ -561,7 +561,7 @@ class EditorInspectorVisualShaderModePlugin : public EditorInspectorPlugin {
public:
virtual bool can_handle(Object *p_object) override;
- virtual bool parse_property(Object *p_object, const Variant::Type p_type, const String &p_path, const PropertyHint p_hint, const String &p_hint_text, const uint32_t p_usage, const bool p_wide = false) override;
+ virtual bool parse_property(Object *p_object, const Variant::Type p_type, const String &p_path, const PropertyHint p_hint, const String &p_hint_text, const BitField<PropertyUsageFlags> p_usage, const bool p_wide = false) override;
};
class VisualShaderNodePortPreview : public Control {
diff --git a/editor/plugins/voxel_gi_editor_plugin.cpp b/editor/plugins/voxel_gi_editor_plugin.cpp
index f9f72fee77..1087a50df6 100644
--- a/editor/plugins/voxel_gi_editor_plugin.cpp
+++ b/editor/plugins/voxel_gi_editor_plugin.cpp
@@ -101,12 +101,12 @@ void VoxelGIEditorPlugin::_notification(int p_what) {
// Set information tooltip on the Bake button. This information is useful
// to optimize performance (video RAM size) and reduce light leaking (individual cell size).
- const Vector3i size = voxel_gi->get_estimated_cell_size();
+ const Vector3i cell_size = voxel_gi->get_estimated_cell_size();
- const Vector3 extents = voxel_gi->get_extents();
+ const Vector3 half_size = voxel_gi->get_size() / 2;
const int data_size = 4;
- const double size_mb = size.x * size.y * size.z * data_size / (1024.0 * 1024.0);
+ const double size_mb = cell_size.x * cell_size.y * cell_size.z * data_size / (1024.0 * 1024.0);
// Add a qualitative measurement to help the user assess whether a VoxelGI node is using a lot of VRAM.
String size_quality;
if (size_mb < 16.0) {
@@ -118,8 +118,8 @@ void VoxelGIEditorPlugin::_notification(int p_what) {
}
String text;
- text += vformat(TTR("Subdivisions: %s"), vformat(String::utf8("%d × %d × %d"), size.x, size.y, size.z)) + "\n";
- text += vformat(TTR("Cell size: %s"), vformat(String::utf8("%.3f × %.3f × %.3f"), extents.x / size.x, extents.y / size.y, extents.z / size.z)) + "\n";
+ text += vformat(TTR("Subdivisions: %s"), vformat(String::utf8("%d × %d × %d"), cell_size.x, cell_size.y, cell_size.z)) + "\n";
+ text += vformat(TTR("Cell size: %s"), vformat(String::utf8("%.3f × %.3f × %.3f"), half_size.x / cell_size.x, half_size.y / cell_size.y, half_size.z / cell_size.z)) + "\n";
text += vformat(TTR("Video RAM size: %s MB (%s)"), String::num(size_mb, 2), size_quality);
// Only update the tooltip when needed to avoid constant redrawing.
diff --git a/editor/project_converter_3_to_4.cpp b/editor/project_converter_3_to_4.cpp
index d3e16211f7..26f872421e 100644
--- a/editor/project_converter_3_to_4.cpp
+++ b/editor/project_converter_3_to_4.cpp
@@ -2404,7 +2404,7 @@ Vector<String> ProjectConverter3To4::check_for_files() {
directories_to_check.append(current_dir.path_join(file_name) + "/");
} else {
bool proper_extension = false;
- if (file_name.ends_with(".gd") || file_name.ends_with(".shader") || file_name.ends_with(".tscn") || file_name.ends_with(".tres") || file_name.ends_with(".godot") || file_name.ends_with(".cs") || file_name.ends_with(".csproj"))
+ if (file_name.ends_with(".gd") || file_name.ends_with(".shader") || file_name.ends_with(".gdshader") || file_name.ends_with(".tscn") || file_name.ends_with(".tres") || file_name.ends_with(".godot") || file_name.ends_with(".cs") || file_name.ends_with(".csproj"))
proper_extension = true;
if (proper_extension) {
diff --git a/editor/project_manager.cpp b/editor/project_manager.cpp
index c4f5eb777e..105e3a5d47 100644
--- a/editor/project_manager.cpp
+++ b/editor/project_manager.cpp
@@ -1503,8 +1503,13 @@ void ProjectList::create_project_item_control(int p_index) {
path_hb->add_child(show);
if (!item.missing) {
+#if !defined(ANDROID_ENABLED) && !defined(WEB_ENABLED)
show->connect("pressed", callable_mp(this, &ProjectList::_show_project).bind(item.path));
show->set_tooltip_text(TTR("Show in File Manager"));
+#else
+ // Opening the system file manager is not supported on the Android and web editors.
+ show->hide();
+#endif
} else {
show->set_tooltip_text(TTR("Error: Project is missing on the filesystem."));
}
diff --git a/editor/project_settings_editor.cpp b/editor/project_settings_editor.cpp
index 560549d249..a43745b70f 100644
--- a/editor/project_settings_editor.cpp
+++ b/editor/project_settings_editor.cpp
@@ -370,17 +370,7 @@ void ProjectSettingsEditor::_action_edited(const String &p_name, const Dictionar
} else {
// Events changed
- int act_event_count = ((Array)p_action["events"]).size();
- int old_event_count = ((Array)old_val["events"]).size();
-
- if (act_event_count == old_event_count) {
- undo_redo->create_action(TTR("Edit Input Action Event"));
- } else if (act_event_count > old_event_count) {
- undo_redo->create_action(TTR("Add Input Action Event"));
- } else {
- undo_redo->create_action(TTR("Remove Input Action Event"));
- }
-
+ undo_redo->create_action(TTR("Change Input Action Event(s)"));
undo_redo->add_do_method(ProjectSettings::get_singleton(), "set", property_name, p_action);
undo_redo->add_undo_method(ProjectSettings::get_singleton(), "set", property_name, old_val);
}
@@ -527,6 +517,8 @@ void ProjectSettingsEditor::_update_action_map_editor() {
if (is_builtin_input) {
action_info.editable = false;
action_info.icon = builtin_icon;
+ action_info.has_initial = true;
+ action_info.action_initial = ProjectSettings::get_singleton()->property_get_revert(property_name);
}
actions.push_back(action_info);
diff --git a/editor/scene_tree_dock.cpp b/editor/scene_tree_dock.cpp
index 86e77fbbbe..d8f1d92e44 100644
--- a/editor/scene_tree_dock.cpp
+++ b/editor/scene_tree_dock.cpp
@@ -1427,7 +1427,14 @@ void SceneTreeDock::_script_open_request(const Ref<Script> &p_script) {
}
void SceneTreeDock::_push_item(Object *p_object) {
- EditorNode::get_singleton()->push_item(p_object);
+ Node *node = Object::cast_to<Node>(p_object);
+ if (node || !p_object) {
+ // Assume that null object is a Node.
+ EditorNode::get_singleton()->push_node_item(node);
+ } else {
+ EditorNode::get_singleton()->push_item(p_object);
+ }
+
if (p_object == nullptr) {
EditorNode::get_singleton()->hide_unused_editors(this);
}
diff --git a/misc/scripts/codespell.sh b/misc/scripts/codespell.sh
index 44084b3348..1268350180 100755
--- a/misc/scripts/codespell.sh
+++ b/misc/scripts/codespell.sh
@@ -1,5 +1,8 @@
#!/bin/sh
-SKIP_LIST="./.*,./bin,./editor/project_converter_3_to_4.cpp,./platform/web/node_modules,./platform/android/java/lib/src/com,./thirdparty,*.gen.*,*.po,*.pot,*.rc,package-lock.json,./core/string/locales.h,./AUTHORS.md,./COPYRIGHT.txt,./DONORS.md,./misc/dist/linux/org.godotengine.Godot.desktop,./misc/scripts/codespell.sh"
-IGNORE_LIST="alo,ba,childs,complies,curvelinear,doubleclick,expct,fave,findn,gird,gud,inout,lod,nd,numer,ois,readded,ro,sav,statics,te,varius,varn,wan"
+SKIP_LIST="./.*,./**/.*,./bin,./thirdparty,*.desktop,*.gen.*,*.po,*.pot,*.rc,./AUTHORS.md,./COPYRIGHT.txt,./DONORS.md,"
+SKIP_LIST+="./core/input/gamecontrollerdb.txt,./core/string/locales.h,./editor/project_converter_3_to_4.cpp,./misc/scripts/codespell.sh,"
+SKIP_LIST+="./platform/android/java/lib/src/com,./platform/web/node_modules,./platform/web/package-lock.json,"
+
+IGNORE_LIST="curvelinear,doubleclick,expct,findn,gird,hel,inout,lod,nd,numer,ot,te"
codespell -w -q 3 -S "${SKIP_LIST}" -L "${IGNORE_LIST}" --builtin "clear,rare,en-GB_to_en-US"
diff --git a/modules/gdscript/doc_classes/@GDScript.xml b/modules/gdscript/doc_classes/@GDScript.xml
index cd837b3a91..32acad76aa 100644
--- a/modules/gdscript/doc_classes/@GDScript.xml
+++ b/modules/gdscript/doc_classes/@GDScript.xml
@@ -227,18 +227,6 @@
[/codeblock]
</description>
</method>
- <method name="str" qualifiers="vararg">
- <return type="String" />
- <description>
- Converts one or more arguments to a [String] in the best way possible.
- [codeblock]
- var a = [10, 20, 30]
- var b = str(a);
- len(a) # Returns 3
- len(b) # Returns 12
- [/codeblock]
- </description>
- </method>
<method name="type_exists">
<return type="bool" />
<param index="0" name="type" type="StringName" />
diff --git a/modules/gdscript/gdscript_analyzer.cpp b/modules/gdscript/gdscript_analyzer.cpp
index 1c2b743909..cdb4f29854 100644
--- a/modules/gdscript/gdscript_analyzer.cpp
+++ b/modules/gdscript/gdscript_analyzer.cpp
@@ -4037,6 +4037,10 @@ void GDScriptAnalyzer::reduce_unary_op(GDScriptParser::UnaryOpNode *p_unary_op)
Variant GDScriptAnalyzer::make_expression_reduced_value(GDScriptParser::ExpressionNode *p_expression, bool &is_reduced) {
Variant value;
+ if (p_expression == nullptr) {
+ return value;
+ }
+
if (p_expression->is_constant) {
is_reduced = true;
value = p_expression->reduced_value;
@@ -4101,6 +4105,10 @@ Variant GDScriptAnalyzer::make_dictionary_reduced_value(GDScriptParser::Dictiona
}
Variant GDScriptAnalyzer::make_subscript_reduced_value(GDScriptParser::SubscriptNode *p_subscript, bool &is_reduced) {
+ if (p_subscript->base == nullptr || p_subscript->index == nullptr) {
+ return Variant();
+ }
+
bool is_base_value_reduced = false;
Variant base_value = make_expression_reduced_value(p_subscript->base, is_base_value_reduced);
if (!is_base_value_reduced) {
diff --git a/modules/gdscript/gdscript_disassembler.cpp b/modules/gdscript/gdscript_disassembler.cpp
index b5c8a6f478..d4f4358ac1 100644
--- a/modules/gdscript/gdscript_disassembler.cpp
+++ b/modules/gdscript/gdscript_disassembler.cpp
@@ -317,7 +317,7 @@ void GDScriptFunction::disassemble(const Vector<String> &p_code_lines) const {
text += " = ";
text += DADDR(2);
- incr += 3;
+ incr += 6;
} break;
case OPCODE_ASSIGN_TYPED_NATIVE: {
text += "assign typed native (";
@@ -434,7 +434,7 @@ void GDScriptFunction::disassemble(const Vector<String> &p_code_lines) const {
int instr_var_args = _code_ptr[++ip];
int argc = _code_ptr[ip + 1 + instr_var_args];
- Ref<Script> script_type = get_constant(_code_ptr[ip + argc + 2]);
+ Ref<Script> script_type = get_constant(_code_ptr[ip + argc + 2] & GDScriptFunction::ADDR_MASK);
Variant::Type builtin_type = (Variant::Type)_code_ptr[ip + argc + 4];
StringName native_type = get_global_name(_code_ptr[ip + argc + 5]);
@@ -463,7 +463,7 @@ void GDScriptFunction::disassemble(const Vector<String> &p_code_lines) const {
text += "]";
- incr += 3 + argc;
+ incr += 6 + argc;
} break;
case OPCODE_CONSTRUCT_DICTIONARY: {
int instr_var_args = _code_ptr[++ip];
diff --git a/modules/gdscript/gdscript_parser.cpp b/modules/gdscript/gdscript_parser.cpp
index 713ad3ed17..ed2dce471f 100644
--- a/modules/gdscript/gdscript_parser.cpp
+++ b/modules/gdscript/gdscript_parser.cpp
@@ -3602,6 +3602,7 @@ bool GDScriptParser::tool_annotation(const AnnotationNode *p_annotation, Node *p
bool GDScriptParser::icon_annotation(const AnnotationNode *p_annotation, Node *p_node) {
ERR_FAIL_COND_V_MSG(p_node->type != Node::CLASS, false, R"("@icon" annotation can only be applied to classes.)");
+ ERR_FAIL_COND_V(p_annotation->resolved_arguments.is_empty(), false);
ClassNode *p_class = static_cast<ClassNode *>(p_node);
p_class->icon_path = p_annotation->resolved_arguments[0];
return true;
@@ -3830,6 +3831,10 @@ template <PropertyUsageFlags t_usage>
bool GDScriptParser::export_group_annotations(const AnnotationNode *p_annotation, Node *p_node) {
AnnotationNode *annotation = const_cast<AnnotationNode *>(p_annotation);
+ if (annotation->resolved_arguments.is_empty()) {
+ return false;
+ }
+
annotation->export_info.name = annotation->resolved_arguments[0];
switch (t_usage) {
@@ -3887,7 +3892,7 @@ bool GDScriptParser::rpc_annotation(const AnnotationNode *p_annotation, Node *p_
Dictionary rpc_config;
rpc_config["rpc_mode"] = MultiplayerAPI::RPC_MODE_AUTHORITY;
- if (p_annotation->resolved_arguments.size()) {
+ if (!p_annotation->resolved_arguments.is_empty()) {
int last = p_annotation->resolved_arguments.size() - 1;
if (p_annotation->resolved_arguments[last].get_type() == Variant::INT) {
rpc_config["channel"] = p_annotation->resolved_arguments[last].operator int();
diff --git a/modules/gdscript/gdscript_utility_functions.cpp b/modules/gdscript/gdscript_utility_functions.cpp
index 10d83dcfe5..758b61bb31 100644
--- a/modules/gdscript/gdscript_utility_functions.cpp
+++ b/modules/gdscript/gdscript_utility_functions.cpp
@@ -112,28 +112,6 @@ struct GDScriptUtilityFunctionsDefinitions {
*r_ret = String(result);
}
- static inline void str(Variant *r_ret, const Variant **p_args, int p_arg_count, Callable::CallError &r_error) {
- if (p_arg_count < 1) {
- r_error.error = Callable::CallError::CALL_ERROR_TOO_FEW_ARGUMENTS;
- r_error.argument = 1;
- r_error.expected = 1;
- *r_ret = Variant();
- return;
- }
-
- String str;
- for (int i = 0; i < p_arg_count; i++) {
- String os = p_args[i]->operator String();
-
- if (i == 0) {
- str = os;
- } else {
- str += os;
- }
- }
- *r_ret = str;
- }
-
static inline void range(Variant *r_ret, const Variant **p_args, int p_arg_count, Callable::CallError &r_error) {
switch (p_arg_count) {
case 0: {
@@ -651,7 +629,6 @@ void GDScriptUtilityFunctions::register_functions() {
REGISTER_VARIANT_FUNC(convert, true, VARARG("what"), ARG("type", Variant::INT));
REGISTER_FUNC(type_exists, true, Variant::BOOL, ARG("type", Variant::STRING_NAME));
REGISTER_FUNC(_char, true, Variant::STRING, ARG("char", Variant::INT));
- REGISTER_VARARG_FUNC(str, true, Variant::STRING);
REGISTER_VARARG_FUNC(range, false, Variant::ARRAY);
REGISTER_CLASS_FUNC(load, false, "Resource", ARG("path", Variant::STRING));
REGISTER_FUNC(inst_to_dict, false, Variant::DICTIONARY, ARG("instance", Variant::OBJECT));
diff --git a/modules/gltf/doc_classes/GLTFDocumentExtension.xml b/modules/gltf/doc_classes/GLTFDocumentExtension.xml
index 6004de32f1..6e8340f618 100644
--- a/modules/gltf/doc_classes/GLTFDocumentExtension.xml
+++ b/modules/gltf/doc_classes/GLTFDocumentExtension.xml
@@ -22,7 +22,7 @@
</description>
</method>
<method name="_export_node" qualifiers="virtual">
- <return type="int" />
+ <return type="int" enum="Error" />
<param index="0" name="state" type="GLTFState" />
<param index="1" name="gltf_node" type="GLTFNode" />
<param index="2" name="json" type="Dictionary" />
@@ -33,7 +33,7 @@
</description>
</method>
<method name="_export_post" qualifiers="virtual">
- <return type="int" />
+ <return type="int" enum="Error" />
<param index="0" name="state" type="GLTFState" />
<description>
Part of the export process. This method is run last, after all other parts of the export process.
@@ -41,7 +41,7 @@
</description>
</method>
<method name="_export_preflight" qualifiers="virtual">
- <return type="int" />
+ <return type="int" enum="Error" />
<param index="0" name="state" type="GLTFState" />
<param index="1" name="root" type="Node" />
<description>
@@ -67,7 +67,7 @@
</description>
</method>
<method name="_import_node" qualifiers="virtual">
- <return type="int" />
+ <return type="int" enum="Error" />
<param index="0" name="state" type="GLTFState" />
<param index="1" name="gltf_node" type="GLTFNode" />
<param index="2" name="json" type="Dictionary" />
@@ -78,7 +78,7 @@
</description>
</method>
<method name="_import_post" qualifiers="virtual">
- <return type="int" />
+ <return type="int" enum="Error" />
<param index="0" name="state" type="GLTFState" />
<param index="1" name="root" type="Node" />
<description>
@@ -87,7 +87,7 @@
</description>
</method>
<method name="_import_post_parse" qualifiers="virtual">
- <return type="int" />
+ <return type="int" enum="Error" />
<param index="0" name="state" type="GLTFState" />
<description>
Part of the import process. This method is run after [method _generate_scene_node] and before [method _import_node].
@@ -95,7 +95,7 @@
</description>
</method>
<method name="_import_preflight" qualifiers="virtual">
- <return type="int" />
+ <return type="int" enum="Error" />
<param index="0" name="state" type="GLTFState" />
<param index="1" name="extensions" type="PackedStringArray" />
<description>
@@ -104,7 +104,7 @@
</description>
</method>
<method name="_parse_node_extensions" qualifiers="virtual">
- <return type="int" />
+ <return type="int" enum="Error" />
<param index="0" name="state" type="GLTFState" />
<param index="1" name="gltf_node" type="GLTFNode" />
<param index="2" name="extensions" type="Dictionary" />
diff --git a/modules/gltf/doc_classes/GLTFState.xml b/modules/gltf/doc_classes/GLTFState.xml
index b8943795a0..b322c07cec 100644
--- a/modules/gltf/doc_classes/GLTFState.xml
+++ b/modules/gltf/doc_classes/GLTFState.xml
@@ -264,10 +264,16 @@
</members>
<constants>
<constant name="HANDLE_BINARY_DISCARD_TEXTURES" value="0">
+ Discards all embedded textures and uses untextured materials.
</constant>
<constant name="HANDLE_BINARY_EXTRACT_TEXTURES" value="1">
+ Extracts embedded textures to be reimported and compressed. Editor only. Acts as uncompressed at runtime.
</constant>
<constant name="HANDLE_BINARY_EMBED_AS_BASISU" value="2">
+ Embeds textures VRAM compressed with Basis Universal into the generated scene.
+ </constant>
+ <constant name="HANDLE_BINARY_EMBED_AS_UNCOMPRESSED" value="3">
+ Embeds textures compressed losslessly into the generated scene, matching old behavior.
</constant>
</constants>
</class>
diff --git a/modules/gltf/editor/editor_import_blend_runner.cpp b/modules/gltf/editor/editor_import_blend_runner.cpp
new file mode 100644
index 0000000000..c203a91834
--- /dev/null
+++ b/modules/gltf/editor/editor_import_blend_runner.cpp
@@ -0,0 +1,314 @@
+/**************************************************************************/
+/* editor_import_blend_runner.cpp */
+/**************************************************************************/
+/* This file is part of: */
+/* GODOT ENGINE */
+/* https://godotengine.org */
+/**************************************************************************/
+/* Copyright (c) 2014-present Godot Engine contributors (see AUTHORS.md). */
+/* Copyright (c) 2007-2014 Juan Linietsky, Ariel Manzur. */
+/* */
+/* 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 "editor_import_blend_runner.h"
+
+#ifdef TOOLS_ENABLED
+
+#include "core/io/http_client.h"
+#include "editor/editor_file_system.h"
+#include "editor/editor_node.h"
+#include "editor/editor_settings.h"
+
+static constexpr char PYTHON_SCRIPT_RPC[] = R"(
+import bpy, sys, threading
+from xmlrpc.server import SimpleXMLRPCServer
+req = threading.Condition()
+res = threading.Condition()
+info = None
+def xmlrpc_server():
+ server = SimpleXMLRPCServer(('127.0.0.1', %d))
+ server.register_function(export_gltf)
+ server.serve_forever()
+def export_gltf(opts):
+ with req:
+ global info
+ info = ('export_gltf', opts)
+ req.notify()
+ with res:
+ res.wait()
+if bpy.app.version < (3, 0, 0):
+ print('Blender 3.0 or higher is required.', file=sys.stderr)
+threading.Thread(target=xmlrpc_server).start()
+while True:
+ with req:
+ while info is None:
+ req.wait()
+ method, opts = info
+ if method == 'export_gltf':
+ try:
+ bpy.ops.wm.open_mainfile(filepath=opts['path'])
+ if opts['unpack_all']:
+ bpy.ops.file.unpack_all(method='USE_LOCAL')
+ bpy.ops.export_scene.gltf(**opts['gltf_options'])
+ except:
+ pass
+ info = None
+ with res:
+ res.notify()
+)";
+
+static constexpr char PYTHON_SCRIPT_DIRECT[] = R"(
+import bpy, sys
+opts = %s
+if bpy.app.version < (3, 0, 0):
+ print('Blender 3.0 or higher is required.', file=sys.stderr)
+bpy.ops.wm.open_mainfile(filepath=opts['path'])
+if opts['unpack_all']:
+ bpy.ops.file.unpack_all(method='USE_LOCAL')
+bpy.ops.export_scene.gltf(**opts['gltf_options'])
+)";
+
+String dict_to_python(const Dictionary &p_dict) {
+ String entries;
+ Array dict_keys = p_dict.keys();
+ for (int i = 0; i < dict_keys.size(); i++) {
+ const String key = dict_keys[i];
+ String value;
+ Variant raw_value = p_dict[key];
+
+ switch (raw_value.get_type()) {
+ case Variant::Type::BOOL: {
+ value = raw_value ? "True" : "False";
+ break;
+ }
+ case Variant::Type::STRING:
+ case Variant::Type::STRING_NAME: {
+ value = raw_value;
+ value = vformat("'%s'", value.c_escape());
+ break;
+ }
+ case Variant::Type::DICTIONARY: {
+ value = dict_to_python(raw_value);
+ break;
+ }
+ default: {
+ ERR_FAIL_V_MSG("", vformat("Unhandled Variant type %s for python dictionary", Variant::get_type_name(raw_value.get_type())));
+ }
+ }
+
+ entries += vformat("'%s': %s,", key, value);
+ }
+ return vformat("{%s}", entries);
+}
+
+String dict_to_xmlrpc(const Dictionary &p_dict) {
+ String members;
+ Array dict_keys = p_dict.keys();
+ for (int i = 0; i < dict_keys.size(); i++) {
+ const String key = dict_keys[i];
+ String value;
+ Variant raw_value = p_dict[key];
+
+ switch (raw_value.get_type()) {
+ case Variant::Type::BOOL: {
+ value = vformat("<boolean>%d</boolean>", raw_value ? 1 : 0);
+ break;
+ }
+ case Variant::Type::STRING:
+ case Variant::Type::STRING_NAME: {
+ value = raw_value;
+ value = vformat("<string>%s</string>", value.xml_escape());
+ break;
+ }
+ case Variant::Type::DICTIONARY: {
+ value = dict_to_xmlrpc(raw_value);
+ break;
+ }
+ default: {
+ ERR_FAIL_V_MSG("", vformat("Unhandled Variant type %s for XMLRPC", Variant::get_type_name(raw_value.get_type())));
+ }
+ }
+
+ members += vformat("<member><name>%s</name><value>%s</value></member>", key, value);
+ }
+ return vformat("<struct>%s</struct>", members);
+}
+
+Error EditorImportBlendRunner::start_blender(const String &p_python_script, bool p_blocking) {
+ String blender_path = EDITOR_GET("filesystem/import/blender/blender3_path");
+
+#ifdef WINDOWS_ENABLED
+ blender_path = blender_path.path_join("blender.exe");
+#else
+ blender_path = blender_path.path_join("blender");
+#endif
+
+ List<String> args;
+ args.push_back("--background");
+ args.push_back("--python-expr");
+ args.push_back(p_python_script);
+
+ Error err;
+ if (p_blocking) {
+ int exitcode = 0;
+ err = OS::get_singleton()->execute(blender_path, args, nullptr, &exitcode);
+ if (exitcode != 0) {
+ return FAILED;
+ }
+ } else {
+ err = OS::get_singleton()->create_process(blender_path, args, &blender_pid);
+ }
+ return err;
+}
+
+Error EditorImportBlendRunner::do_import(const Dictionary &p_options) {
+ if (is_using_rpc()) {
+ return do_import_rpc(p_options);
+ } else {
+ return do_import_direct(p_options);
+ }
+}
+
+Error EditorImportBlendRunner::do_import_rpc(const Dictionary &p_options) {
+ kill_timer->stop();
+
+ // Start Blender if not already running.
+ if (!is_running()) {
+ // Start an XML RPC server on the given port.
+ String python = vformat(PYTHON_SCRIPT_RPC, rpc_port);
+ Error err = start_blender(python, false);
+ if (err != OK || blender_pid == 0) {
+ return FAILED;
+ }
+ }
+
+ // Convert options to XML body.
+ String xml_options = dict_to_xmlrpc(p_options);
+ String xml_body = vformat("<?xml version=\"1.0\"?><methodCall><methodName>export_gltf</methodName><params><param><value>%s</value></param></params></methodCall>", xml_options);
+
+ // Connect to RPC server.
+ Ref<HTTPClient> client = HTTPClient::create();
+ client->connect_to_host("127.0.0.1", rpc_port);
+
+ bool done = false;
+ while (!done) {
+ HTTPClient::Status status = client->get_status();
+ switch (status) {
+ case HTTPClient::STATUS_RESOLVING:
+ case HTTPClient::STATUS_CONNECTING: {
+ client->poll();
+ break;
+ }
+ case HTTPClient::STATUS_CONNECTED: {
+ done = true;
+ break;
+ }
+ default: {
+ ERR_FAIL_V_MSG(ERR_CONNECTION_ERROR, vformat("Unexpected status during RPC connection: %d", status));
+ }
+ }
+ }
+
+ // Send XML request.
+ PackedByteArray xml_buffer = xml_body.to_utf8_buffer();
+ Error err = client->request(HTTPClient::METHOD_POST, "/", Vector<String>(), xml_buffer.ptr(), xml_buffer.size());
+ if (err != OK) {
+ ERR_FAIL_V_MSG(err, vformat("Unable to send RPC request: %d", err));
+ }
+
+ // Wait for response.
+ done = false;
+ while (!done) {
+ HTTPClient::Status status = client->get_status();
+ switch (status) {
+ case HTTPClient::STATUS_REQUESTING: {
+ client->poll();
+ break;
+ }
+ case HTTPClient::STATUS_BODY: {
+ client->poll();
+ // Parse response here if needed. For now we can just ignore it.
+ done = true;
+ break;
+ }
+ default: {
+ ERR_FAIL_V_MSG(ERR_CONNECTION_ERROR, vformat("Unexpected status during RPC response: %d", status));
+ }
+ }
+ }
+
+ return OK;
+}
+
+Error EditorImportBlendRunner::do_import_direct(const Dictionary &p_options) {
+ // Export glTF directly.
+ String python = vformat(PYTHON_SCRIPT_DIRECT, dict_to_python(p_options));
+ Error err = start_blender(python, true);
+ if (err != OK) {
+ return err;
+ }
+
+ return OK;
+}
+
+void EditorImportBlendRunner::_resources_reimported(const PackedStringArray &p_files) {
+ if (is_running()) {
+ // After a batch of imports is done, wait a few seconds before trying to kill blender,
+ // in case of having multiple imports trigger in quick succession.
+ kill_timer->start();
+ }
+}
+
+void EditorImportBlendRunner::_kill_blender() {
+ kill_timer->stop();
+ if (is_running()) {
+ OS::get_singleton()->kill(blender_pid);
+ }
+ blender_pid = 0;
+}
+
+void EditorImportBlendRunner::_notification(int p_what) {
+ switch (p_what) {
+ case NOTIFICATION_PREDELETE: {
+ _kill_blender();
+ break;
+ }
+ }
+}
+
+EditorImportBlendRunner *EditorImportBlendRunner::singleton = nullptr;
+
+EditorImportBlendRunner::EditorImportBlendRunner() {
+ ERR_FAIL_COND_MSG(singleton != nullptr, "EditorImportBlendRunner already created.");
+ singleton = this;
+
+ rpc_port = EDITOR_GET("filesystem/import/blender/rpc_port");
+
+ kill_timer = memnew(Timer);
+ add_child(kill_timer);
+ kill_timer->set_one_shot(true);
+ kill_timer->set_wait_time(EDITOR_GET("filesystem/import/blender/rpc_server_uptime"));
+ kill_timer->connect("timeout", callable_mp(this, &EditorImportBlendRunner::_kill_blender));
+
+ EditorFileSystem::get_singleton()->connect("resources_reimported", callable_mp(this, &EditorImportBlendRunner::_resources_reimported));
+}
+
+#endif // TOOLS_ENABLED
diff --git a/modules/gltf/editor/editor_import_blend_runner.h b/modules/gltf/editor/editor_import_blend_runner.h
new file mode 100644
index 0000000000..b2b82394e1
--- /dev/null
+++ b/modules/gltf/editor/editor_import_blend_runner.h
@@ -0,0 +1,69 @@
+/**************************************************************************/
+/* editor_import_blend_runner.h */
+/**************************************************************************/
+/* This file is part of: */
+/* GODOT ENGINE */
+/* https://godotengine.org */
+/**************************************************************************/
+/* Copyright (c) 2014-present Godot Engine contributors (see AUTHORS.md). */
+/* Copyright (c) 2007-2014 Juan Linietsky, Ariel Manzur. */
+/* */
+/* 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 EDITOR_IMPORT_BLEND_RUNNER_H
+#define EDITOR_IMPORT_BLEND_RUNNER_H
+
+#ifdef TOOLS_ENABLED
+
+#include "core/os/os.h"
+#include "scene/main/node.h"
+#include "scene/main/timer.h"
+
+class EditorImportBlendRunner : public Node {
+ GDCLASS(EditorImportBlendRunner, Node);
+
+ static EditorImportBlendRunner *singleton;
+
+ Timer *kill_timer;
+ void _resources_reimported(const PackedStringArray &p_files);
+ void _kill_blender();
+ void _notification(int p_what);
+
+protected:
+ int rpc_port = 0;
+ OS::ProcessID blender_pid = 0;
+ Error start_blender(const String &p_python_script, bool p_blocking);
+ Error do_import_direct(const Dictionary &p_options);
+ Error do_import_rpc(const Dictionary &p_options);
+
+public:
+ static EditorImportBlendRunner *get_singleton() { return singleton; }
+
+ bool is_running() { return blender_pid != 0 && OS::get_singleton()->is_process_running(blender_pid); }
+ bool is_using_rpc() { return rpc_port != 0; }
+ Error do_import(const Dictionary &p_options);
+
+ EditorImportBlendRunner();
+};
+
+#endif // TOOLS_ENABLED
+
+#endif // EDITOR_IMPORT_BLEND_RUNNER_H
diff --git a/modules/gltf/editor/editor_scene_importer_blend.cpp b/modules/gltf/editor/editor_scene_importer_blend.cpp
index 5415c5818f..520f33261a 100644
--- a/modules/gltf/editor/editor_scene_importer_blend.cpp
+++ b/modules/gltf/editor/editor_scene_importer_blend.cpp
@@ -34,6 +34,7 @@
#include "../gltf_defines.h"
#include "../gltf_document.h"
+#include "editor_import_blend_runner.h"
#include "core/config/project_settings.h"
#include "editor/editor_file_dialog.h"
@@ -68,149 +69,129 @@ Node *EditorSceneFormatImporterBlend::import_scene(const String &p_path, uint32_
// Handle configuration options.
- String parameters_arg;
+ Dictionary request_options;
+ Dictionary parameters_map;
+
+ parameters_map["filepath"] = sink_global;
+ parameters_map["export_keep_originals"] = true;
+ parameters_map["export_format"] = "GLTF_SEPARATE";
+ parameters_map["export_yup"] = true;
if (p_options.has(SNAME("blender/nodes/custom_properties")) && p_options[SNAME("blender/nodes/custom_properties")]) {
- parameters_arg += "export_extras=True,";
+ parameters_map["export_extras"] = true;
} else {
- parameters_arg += "export_extras=False,";
+ parameters_map["export_extras"] = false;
}
if (p_options.has(SNAME("blender/meshes/skins"))) {
int32_t skins = p_options["blender/meshes/skins"];
if (skins == BLEND_BONE_INFLUENCES_NONE) {
- parameters_arg += "export_skins=False,";
+ parameters_map["export_skins"] = false;
} else if (skins == BLEND_BONE_INFLUENCES_COMPATIBLE) {
- parameters_arg += "export_all_influences=False,export_skins=True,";
+ parameters_map["export_skins"] = true;
+ parameters_map["export_all_influences"] = false;
} else if (skins == BLEND_BONE_INFLUENCES_ALL) {
- parameters_arg += "export_all_influences=True,export_skins=True,";
+ parameters_map["export_skins"] = true;
+ parameters_map["export_all_influences"] = true;
}
} else {
- parameters_arg += "export_skins=False,";
+ parameters_map["export_skins"] = false;
}
if (p_options.has(SNAME("blender/materials/export_materials"))) {
int32_t exports = p_options["blender/materials/export_materials"];
if (exports == BLEND_MATERIAL_EXPORT_PLACEHOLDER) {
- parameters_arg += "export_materials='PLACEHOLDER',";
+ parameters_map["export_materials"] = "PLACEHOLDER";
} else if (exports == BLEND_MATERIAL_EXPORT_EXPORT) {
- parameters_arg += "export_materials='EXPORT',";
+ parameters_map["export_materials"] = "EXPORT";
}
} else {
- parameters_arg += "export_materials='PLACEHOLDER',";
+ parameters_map["export_materials"] = "PLACEHOLDER";
}
if (p_options.has(SNAME("blender/nodes/cameras")) && p_options[SNAME("blender/nodes/cameras")]) {
- parameters_arg += "export_cameras=True,";
+ parameters_map["export_cameras"] = true;
} else {
- parameters_arg += "export_cameras=False,";
+ parameters_map["export_cameras"] = false;
}
if (p_options.has(SNAME("blender/nodes/punctual_lights")) && p_options[SNAME("blender/nodes/punctual_lights")]) {
- parameters_arg += "export_lights=True,";
+ parameters_map["export_lights"] = true;
} else {
- parameters_arg += "export_lights=False,";
+ parameters_map["export_lights"] = false;
}
if (p_options.has(SNAME("blender/meshes/colors")) && p_options[SNAME("blender/meshes/colors")]) {
- parameters_arg += "export_colors=True,";
+ parameters_map["export_colors"] = true;
} else {
- parameters_arg += "export_colors=False,";
+ parameters_map["export_colors"] = false;
}
if (p_options.has(SNAME("blender/nodes/visible"))) {
int32_t visible = p_options["blender/nodes/visible"];
if (visible == BLEND_VISIBLE_VISIBLE_ONLY) {
- parameters_arg += "use_visible=True,";
+ parameters_map["use_visible"] = true;
} else if (visible == BLEND_VISIBLE_RENDERABLE) {
- parameters_arg += "use_renderable=True,";
+ parameters_map["use_renderable"] = true;
} else if (visible == BLEND_VISIBLE_ALL) {
- parameters_arg += "use_visible=False,use_renderable=False,";
+ parameters_map["use_renderable"] = false;
+ parameters_map["use_visible"] = false;
}
} else {
- parameters_arg += "use_visible=False,use_renderable=False,";
+ parameters_map["use_renderable"] = false;
+ parameters_map["use_visible"] = false;
}
if (p_options.has(SNAME("blender/meshes/uvs")) && p_options[SNAME("blender/meshes/uvs")]) {
- parameters_arg += "export_texcoords=True,";
+ parameters_map["export_texcoords"] = true;
} else {
- parameters_arg += "export_texcoords=False,";
+ parameters_map["export_texcoords"] = false;
}
if (p_options.has(SNAME("blender/meshes/normals")) && p_options[SNAME("blender/meshes/normals")]) {
- parameters_arg += "export_normals=True,";
+ parameters_map["export_normals"] = true;
} else {
- parameters_arg += "export_normals=False,";
+ parameters_map["export_normals"] = false;
}
if (p_options.has(SNAME("blender/meshes/tangents")) && p_options[SNAME("blender/meshes/tangents")]) {
- parameters_arg += "export_tangents=True,";
+ parameters_map["export_tangents"] = true;
} else {
- parameters_arg += "export_tangents=False,";
+ parameters_map["export_tangents"] = false;
}
if (p_options.has(SNAME("blender/animation/group_tracks")) && p_options[SNAME("blender/animation/group_tracks")]) {
- parameters_arg += "export_nla_strips=True,";
+ parameters_map["export_nla_strips"] = true;
} else {
- parameters_arg += "export_nla_strips=False,";
+ parameters_map["export_nla_strips"] = false;
}
if (p_options.has(SNAME("blender/animation/limit_playback")) && p_options[SNAME("blender/animation/limit_playback")]) {
- parameters_arg += "export_frame_range=True,";
+ parameters_map["export_frame_range"] = true;
} else {
- parameters_arg += "export_frame_range=False,";
+ parameters_map["export_frame_range"] = false;
}
if (p_options.has(SNAME("blender/animation/always_sample")) && p_options[SNAME("blender/animation/always_sample")]) {
- parameters_arg += "export_force_sampling=True,";
+ parameters_map["export_force_sampling"] = true;
} else {
- parameters_arg += "export_force_sampling=False,";
+ parameters_map["export_force_sampling"] = false;
}
if (p_options.has(SNAME("blender/meshes/export_bones_deforming_mesh_only")) && p_options[SNAME("blender/meshes/export_bones_deforming_mesh_only")]) {
- parameters_arg += "export_def_bones=True,";
+ parameters_map["export_def_bones"] = true;
} else {
- parameters_arg += "export_def_bones=False,";
+ parameters_map["export_def_bones"] = false;
}
if (p_options.has(SNAME("blender/nodes/modifiers")) && p_options[SNAME("blender/nodes/modifiers")]) {
- parameters_arg += "export_apply=True";
+ parameters_map["export_apply"] = true;
} else {
- parameters_arg += "export_apply=False";
+ parameters_map["export_apply"] = false;
}
- String unpack_all;
if (p_options.has(SNAME("blender/materials/unpack_enabled")) && p_options[SNAME("blender/materials/unpack_enabled")]) {
- unpack_all = "bpy.ops.file.unpack_all(method='USE_LOCAL');";
+ request_options["unpack_all"] = true;
+ } else {
+ request_options["unpack_all"] = false;
}
- // Prepare Blender export script.
-
- String common_args = vformat("filepath='%s',", sink_global) +
- "export_format='GLTF_SEPARATE',"
- "export_yup=True," +
- parameters_arg;
- String export_script =
- String("import bpy, sys;") +
- "print('Blender 3.0 or higher is required.', file=sys.stderr) if bpy.app.version < (3, 0, 0) else None;" +
- vformat("bpy.ops.wm.open_mainfile(filepath='%s');", source_global) +
- unpack_all +
- vformat("bpy.ops.export_scene.gltf(export_keep_originals=True,%s);", common_args);
- print_verbose(export_script);
-
- // Run script with configured Blender binary.
+ request_options["path"] = source_global;
+ request_options["gltf_options"] = parameters_map;
- String blender_path = EDITOR_GET("filesystem/import/blender/blender3_path");
-
-#ifdef WINDOWS_ENABLED
- blender_path = blender_path.path_join("blender.exe");
-#else
- blender_path = blender_path.path_join("blender");
-#endif
-
- List<String> args;
- args.push_back("--background");
- args.push_back("--python-expr");
- args.push_back(export_script);
-
- String standard_out;
- int ret;
- OS::get_singleton()->execute(blender_path, args, &standard_out, &ret, true);
- print_verbose(blender_path);
- print_verbose(standard_out);
-
- if (ret != 0) {
+ // Run Blender and export glTF.
+ Error err = EditorImportBlendRunner::get_singleton()->do_import(request_options);
+ if (err != OK) {
if (r_err) {
*r_err = ERR_SCRIPT_FAILED;
}
- ERR_PRINT(vformat("Blend export to glTF failed with error: %d.", ret));
return nullptr;
}
@@ -226,7 +207,7 @@ Node *EditorSceneFormatImporterBlend::import_scene(const String &p_path, uint32_
if (p_options.has(SNAME("blender/materials/unpack_enabled")) && p_options[SNAME("blender/materials/unpack_enabled")]) {
base_dir = sink.get_base_dir();
}
- Error err = gltf->append_from_file(sink.get_basename() + ".gltf", state, p_flags, base_dir);
+ err = gltf->append_from_file(sink.get_basename() + ".gltf", state, p_flags, base_dir);
if (err != OK) {
if (r_err) {
*r_err = FAILED;
diff --git a/modules/gltf/editor/editor_scene_importer_gltf.cpp b/modules/gltf/editor/editor_scene_importer_gltf.cpp
index 67bbf8dd15..012a144d52 100644
--- a/modules/gltf/editor/editor_scene_importer_gltf.cpp
+++ b/modules/gltf/editor/editor_scene_importer_gltf.cpp
@@ -51,8 +51,8 @@ Node *EditorSceneFormatImporterGLTF::import_scene(const String &p_path, uint32_t
doc.instantiate();
Ref<GLTFState> state;
state.instantiate();
- if (p_options.has("meshes/handle_gltf_embedded_images")) {
- int32_t enum_option = p_options["meshes/handle_gltf_embedded_images"];
+ if (p_options.has("gltf/embedded_image_handling")) {
+ int32_t enum_option = p_options["gltf/embedded_image_handling"];
state->set_handle_binary_image(enum_option);
}
Error err = doc->append_from_file(p_path, state, p_flags);
@@ -87,7 +87,7 @@ Node *EditorSceneFormatImporterGLTF::import_scene(const String &p_path, uint32_t
void EditorSceneFormatImporterGLTF::get_import_options(const String &p_path,
List<ResourceImporter::ImportOption> *r_options) {
- r_options->push_back(ResourceImporterScene::ImportOption(PropertyInfo(Variant::INT, "meshes/handle_gltf_embedded_images", PROPERTY_HINT_ENUM, "Discard All Textures,Extract Textures,Embed As Basis Universal", PROPERTY_USAGE_DEFAULT | PROPERTY_USAGE_UPDATE_ALL_IF_MODIFIED), GLTFState::HANDLE_BINARY_EXTRACT_TEXTURES));
+ r_options->push_back(ResourceImporterScene::ImportOption(PropertyInfo(Variant::INT, "gltf/embedded_image_handling", PROPERTY_HINT_ENUM, "Discard All Textures,Extract Textures,Embed As Basis Universal,Embed as Uncompressed", PROPERTY_USAGE_DEFAULT | PROPERTY_USAGE_UPDATE_ALL_IF_MODIFIED), GLTFState::HANDLE_BINARY_EXTRACT_TEXTURES));
}
#endif // TOOLS_ENABLED
diff --git a/modules/gltf/extensions/gltf_document_extension.cpp b/modules/gltf/extensions/gltf_document_extension.cpp
index 496a8f6cb8..bedb42eb32 100644
--- a/modules/gltf/extensions/gltf_document_extension.cpp
+++ b/modules/gltf/extensions/gltf_document_extension.cpp
@@ -49,9 +49,9 @@ void GLTFDocumentExtension::_bind_methods() {
// Import process.
Error GLTFDocumentExtension::import_preflight(Ref<GLTFState> p_state, Vector<String> p_extensions) {
ERR_FAIL_NULL_V(p_state, ERR_INVALID_PARAMETER);
- int err = OK;
+ Error err = OK;
GDVIRTUAL_CALL(_import_preflight, p_state, p_extensions, err);
- return Error(err);
+ return err;
}
Vector<String> GLTFDocumentExtension::get_supported_extensions() {
@@ -63,9 +63,9 @@ Vector<String> GLTFDocumentExtension::get_supported_extensions() {
Error GLTFDocumentExtension::parse_node_extensions(Ref<GLTFState> p_state, Ref<GLTFNode> p_gltf_node, Dictionary &p_extensions) {
ERR_FAIL_NULL_V(p_state, ERR_INVALID_PARAMETER);
ERR_FAIL_NULL_V(p_gltf_node, ERR_INVALID_PARAMETER);
- int err = OK;
+ Error err = OK;
GDVIRTUAL_CALL(_parse_node_extensions, p_state, p_gltf_node, p_extensions, err);
- return Error(err);
+ return err;
}
Node3D *GLTFDocumentExtension::generate_scene_node(Ref<GLTFState> p_state, Ref<GLTFNode> p_gltf_node, Node *p_scene_parent) {
@@ -79,34 +79,34 @@ Node3D *GLTFDocumentExtension::generate_scene_node(Ref<GLTFState> p_state, Ref<G
Error GLTFDocumentExtension::import_post_parse(Ref<GLTFState> p_state) {
ERR_FAIL_NULL_V(p_state, ERR_INVALID_PARAMETER);
- int err = OK;
+ Error err = OK;
GDVIRTUAL_CALL(_import_post_parse, p_state, err);
- return Error(err);
+ return err;
}
Error GLTFDocumentExtension::import_node(Ref<GLTFState> p_state, Ref<GLTFNode> p_gltf_node, Dictionary &r_dict, Node *p_node) {
ERR_FAIL_NULL_V(p_state, ERR_INVALID_PARAMETER);
ERR_FAIL_NULL_V(p_gltf_node, ERR_INVALID_PARAMETER);
ERR_FAIL_NULL_V(p_node, ERR_INVALID_PARAMETER);
- int err = OK;
+ Error err = OK;
GDVIRTUAL_CALL(_import_node, p_state, p_gltf_node, r_dict, p_node, err);
- return Error(err);
+ return err;
}
Error GLTFDocumentExtension::import_post(Ref<GLTFState> p_state, Node *p_root) {
ERR_FAIL_NULL_V(p_root, ERR_INVALID_PARAMETER);
ERR_FAIL_NULL_V(p_state, ERR_INVALID_PARAMETER);
- int err = OK;
+ Error err = OK;
GDVIRTUAL_CALL(_import_post, p_state, p_root, err);
- return Error(err);
+ return err;
}
// Export process.
Error GLTFDocumentExtension::export_preflight(Ref<GLTFState> p_state, Node *p_root) {
ERR_FAIL_NULL_V(p_root, ERR_INVALID_PARAMETER);
- int err = OK;
+ Error err = OK;
GDVIRTUAL_CALL(_export_preflight, p_state, p_root, err);
- return Error(err);
+ return err;
}
void GLTFDocumentExtension::convert_scene_node(Ref<GLTFState> p_state, Ref<GLTFNode> p_gltf_node, Node *p_scene_node) {
@@ -120,14 +120,14 @@ Error GLTFDocumentExtension::export_node(Ref<GLTFState> p_state, Ref<GLTFNode> p
ERR_FAIL_NULL_V(p_state, ERR_INVALID_PARAMETER);
ERR_FAIL_NULL_V(p_gltf_node, ERR_INVALID_PARAMETER);
ERR_FAIL_NULL_V(p_node, ERR_INVALID_PARAMETER);
- int err = OK;
+ Error err = OK;
GDVIRTUAL_CALL(_export_node, p_state, p_gltf_node, r_dict, p_node, err);
- return Error(err);
+ return err;
}
Error GLTFDocumentExtension::export_post(Ref<GLTFState> p_state) {
ERR_FAIL_NULL_V(p_state, ERR_INVALID_PARAMETER);
- int err = OK;
+ Error err = OK;
GDVIRTUAL_CALL(_export_post, p_state, err);
- return Error(err);
+ return err;
}
diff --git a/modules/gltf/extensions/gltf_document_extension.h b/modules/gltf/extensions/gltf_document_extension.h
index 97f5045a1c..3531f81f6f 100644
--- a/modules/gltf/extensions/gltf_document_extension.h
+++ b/modules/gltf/extensions/gltf_document_extension.h
@@ -55,18 +55,18 @@ public:
virtual Error export_post(Ref<GLTFState> p_state);
// Import process.
- GDVIRTUAL2R(int, _import_preflight, Ref<GLTFState>, Vector<String>);
+ GDVIRTUAL2R(Error, _import_preflight, Ref<GLTFState>, Vector<String>);
GDVIRTUAL0R(Vector<String>, _get_supported_extensions);
- GDVIRTUAL3R(int, _parse_node_extensions, Ref<GLTFState>, Ref<GLTFNode>, Dictionary);
+ GDVIRTUAL3R(Error, _parse_node_extensions, Ref<GLTFState>, Ref<GLTFNode>, Dictionary);
GDVIRTUAL3R(Node3D *, _generate_scene_node, Ref<GLTFState>, Ref<GLTFNode>, Node *);
- GDVIRTUAL1R(int, _import_post_parse, Ref<GLTFState>);
- GDVIRTUAL4R(int, _import_node, Ref<GLTFState>, Ref<GLTFNode>, Dictionary, Node *);
- GDVIRTUAL2R(int, _import_post, Ref<GLTFState>, Node *);
+ GDVIRTUAL1R(Error, _import_post_parse, Ref<GLTFState>);
+ GDVIRTUAL4R(Error, _import_node, Ref<GLTFState>, Ref<GLTFNode>, Dictionary, Node *);
+ GDVIRTUAL2R(Error, _import_post, Ref<GLTFState>, Node *);
// Export process.
- GDVIRTUAL2R(int, _export_preflight, Ref<GLTFState>, Node *);
+ GDVIRTUAL2R(Error, _export_preflight, Ref<GLTFState>, Node *);
GDVIRTUAL3(_convert_scene_node, Ref<GLTFState>, Ref<GLTFNode>, Node *);
- GDVIRTUAL4R(int, _export_node, Ref<GLTFState>, Ref<GLTFNode>, Dictionary, Node *);
- GDVIRTUAL1R(int, _export_post, Ref<GLTFState>);
+ GDVIRTUAL4R(Error, _export_node, Ref<GLTFState>, Ref<GLTFNode>, Dictionary, Node *);
+ GDVIRTUAL1R(Error, _export_post, Ref<GLTFState>);
};
#endif // GLTF_DOCUMENT_EXTENSION_H
diff --git a/modules/gltf/gltf_document.cpp b/modules/gltf/gltf_document.cpp
index 5950ad33b5..1a09b5bdcc 100644
--- a/modules/gltf/gltf_document.cpp
+++ b/modules/gltf/gltf_document.cpp
@@ -32,6 +32,7 @@
#include "extensions/gltf_spec_gloss.h"
+#include "core/config/project_settings.h"
#include "core/crypto/crypto_core.h"
#include "core/io/config_file.h"
#include "core/io/dir_access.h"
@@ -3220,8 +3221,8 @@ Error GLTFDocument::_parse_images(Ref<GLTFState> p_state, const String &p_base_p
if (GLTFState::GLTFHandleBinary(p_state->handle_binary_image) == GLTFState::GLTFHandleBinary::HANDLE_BINARY_DISCARD_TEXTURES) {
p_state->images.push_back(Ref<Texture2D>());
p_state->source_images.push_back(Ref<Image>());
- continue;
- } else if (GLTFState::GLTFHandleBinary(p_state->handle_binary_image) == GLTFState::GLTFHandleBinary::HANDLE_BINARY_EXTRACT_TEXTURES) {
+#ifdef TOOLS_ENABLED
+ } else if (Engine::get_singleton()->is_editor_hint() && GLTFState::GLTFHandleBinary(p_state->handle_binary_image) == GLTFState::GLTFHandleBinary::HANDLE_BINARY_EXTRACT_TEXTURES) {
if (p_state->base_path.is_empty()) {
p_state->images.push_back(Ref<Texture2D>());
p_state->source_images.push_back(Ref<Image>());
@@ -3230,26 +3231,56 @@ Error GLTFDocument::_parse_images(Ref<GLTFState> p_state, const String &p_base_p
p_state->images.push_back(Ref<Texture2D>());
p_state->source_images.push_back(Ref<Image>());
} else {
+ Error err = OK;
+ bool must_import = false;
String file_path = p_state->get_base_path() + "/" + p_state->filename.get_basename() + "_" + img->get_name() + ".png";
- Ref<ConfigFile> config;
- config.instantiate();
- if (FileAccess::exists(file_path + ".import")) {
- config->load(file_path + ".import");
+ if (!FileAccess::exists(file_path + ".import")) {
+ Ref<ConfigFile> config;
+ config.instantiate();
+ config->set_value("remap", "importer", "texture");
+ config->set_value("remap", "type", "Texture2D");
+ // Currently, it will likely use project defaults of Detect 3D, so textures will be reimported again.
+ if (!config->has_section_key("params", "mipmaps/generate")) {
+ config->set_value("params", "mipmaps/generate", true);
+ }
+
+ if (ProjectSettings::get_singleton()->has_setting("importer_defaults/texture")) {
+ //use defaults if exist
+ Dictionary importer_defaults = GLOBAL_GET("importer_defaults/texture");
+ List<Variant> importer_def_keys;
+ importer_defaults.get_key_list(&importer_def_keys);
+ for (const Variant &key : importer_def_keys) {
+ if (!config->has_section_key("params", (String)key)) {
+ config->set_value("params", (String)key, importer_defaults[key]);
+ }
+ }
+ }
+ err = config->save(file_path + ".import");
+ ERR_FAIL_COND_V(err != OK, err);
+ must_import = true;
}
- config->set_value("remap", "importer", "texture");
- config->set_value("remap", "type", "Texture2D");
- if (!config->has_section_key("params", "compress/mode")) {
- config->set_value("remap", "compress/mode", 2); //user may want another compression, so leave it bes
+ Vector<uint8_t> png_buffer = img->save_png_to_buffer();
+ if (ResourceLoader::exists(file_path)) {
+ Ref<FileAccess> file = FileAccess::open(file_path, FileAccess::READ, &err);
+ if (err == OK && file.is_valid()) {
+ Vector<uint8_t> orig_png_buffer = file->get_buffer(file->get_length());
+ if (png_buffer != orig_png_buffer) {
+ must_import = true;
+ }
+ }
+ } else {
+ must_import = true;
}
- if (!config->has_section_key("params", "mipmaps/generate")) {
- config->set_value("params", "mipmaps/generate", true);
+ if (must_import) {
+ Ref<FileAccess> file = FileAccess::open(file_path, FileAccess::WRITE, &err);
+ ERR_FAIL_COND_V(err != OK, err);
+ ERR_FAIL_COND_V(file.is_null(), FAILED);
+ file->store_buffer(png_buffer);
+ file->flush();
+ file.unref();
+ // ResourceLoader::import will crash if not is_editor_hint(), so this case is protected above and will fall through to uncompressed.
+ ResourceLoader::import(file_path);
}
- Error err = OK;
- err = config->save(file_path + ".import");
- ERR_FAIL_COND_V(err != OK, err);
- img->save_png(file_path);
- ERR_FAIL_COND_V(err != OK, err);
- ResourceLoader::import(file_path);
Ref<Texture2D> saved_image = ResourceLoader::load(file_path, "Texture2D");
if (saved_image.is_valid()) {
p_state->images.push_back(saved_image);
@@ -3261,7 +3292,7 @@ Error GLTFDocument::_parse_images(Ref<GLTFState> p_state, const String &p_base_p
p_state->source_images.push_back(Ref<Image>());
}
}
- continue;
+#endif
} else if (GLTFState::GLTFHandleBinary(p_state->handle_binary_image) == GLTFState::GLTFHandleBinary::HANDLE_BINARY_EMBED_AS_BASISU) {
Ref<PortableCompressedTexture2D> tex;
tex.instantiate();
@@ -3271,11 +3302,15 @@ Error GLTFDocument::_parse_images(Ref<GLTFState> p_state, const String &p_base_p
tex->create_from_image(img, PortableCompressedTexture2D::COMPRESSION_MODE_BASIS_UNIVERSAL);
p_state->images.push_back(tex);
p_state->source_images.push_back(img);
- continue;
+ } else {
+ // This handles two cases: if editor hint and HANDLE_BINARY_EXTRACT_TEXTURES; or if HANDLE_BINARY_EMBED_AS_UNCOMPRESSED
+ Ref<ImageTexture> tex;
+ tex.instantiate();
+ tex->set_name(img->get_name());
+ tex->set_image(img);
+ p_state->images.push_back(tex);
+ p_state->source_images.push_back(img);
}
-
- p_state->images.push_back(Ref<Texture2D>());
- p_state->source_images.push_back(Ref<Image>());
}
print_verbose("glTF: Total images: " + itos(p_state->images.size()));
diff --git a/modules/gltf/gltf_state.cpp b/modules/gltf/gltf_state.cpp
index b67484fc8e..b7b7113a97 100644
--- a/modules/gltf/gltf_state.cpp
+++ b/modules/gltf/gltf_state.cpp
@@ -120,11 +120,12 @@ void GLTFState::_bind_methods() {
ADD_PROPERTY(PropertyInfo(Variant::DICTIONARY, "skeleton_to_node", PROPERTY_HINT_NONE, "", PROPERTY_USAGE_STORAGE | PROPERTY_USAGE_INTERNAL | PROPERTY_USAGE_EDITOR), "set_skeleton_to_node", "get_skeleton_to_node"); // RBMap<GLTFSkeletonIndex,
ADD_PROPERTY(PropertyInfo(Variant::BOOL, "create_animations"), "set_create_animations", "get_create_animations"); // bool
ADD_PROPERTY(PropertyInfo(Variant::ARRAY, "animations", PROPERTY_HINT_NONE, "", PROPERTY_USAGE_STORAGE | PROPERTY_USAGE_INTERNAL | PROPERTY_USAGE_EDITOR), "set_animations", "get_animations"); // Vector<Ref<GLTFAnimation>>
- ADD_PROPERTY(PropertyInfo(Variant::INT, "handle_binary_image", PROPERTY_HINT_ENUM, "Discard All Textures,Extract Textures,Embed As Basis Universal", PROPERTY_USAGE_STORAGE | PROPERTY_USAGE_INTERNAL | PROPERTY_USAGE_EDITOR), "set_handle_binary_image", "get_handle_binary_image"); // enum
+ ADD_PROPERTY(PropertyInfo(Variant::INT, "handle_binary_image", PROPERTY_HINT_ENUM, "Discard All Textures,Extract Textures,Embed As Basis Universal,Embed as Uncompressed", PROPERTY_USAGE_STORAGE | PROPERTY_USAGE_INTERNAL | PROPERTY_USAGE_EDITOR), "set_handle_binary_image", "get_handle_binary_image"); // enum
BIND_CONSTANT(HANDLE_BINARY_DISCARD_TEXTURES);
BIND_CONSTANT(HANDLE_BINARY_EXTRACT_TEXTURES);
BIND_CONSTANT(HANDLE_BINARY_EMBED_AS_BASISU);
+ BIND_CONSTANT(HANDLE_BINARY_EMBED_AS_UNCOMPRESSED);
}
void GLTFState::add_used_extension(const String &p_extension_name, bool p_required) {
diff --git a/modules/gltf/gltf_state.h b/modules/gltf/gltf_state.h
index 52d7949d03..b6979ca48e 100644
--- a/modules/gltf/gltf_state.h
+++ b/modules/gltf/gltf_state.h
@@ -108,6 +108,7 @@ public:
HANDLE_BINARY_DISCARD_TEXTURES = 0,
HANDLE_BINARY_EXTRACT_TEXTURES,
HANDLE_BINARY_EMBED_AS_BASISU,
+ HANDLE_BINARY_EMBED_AS_UNCOMPRESSED, // if this value changes from 3, ResourceImporterScene::pre_import must be changed as well.
};
int32_t get_handle_binary_image() {
return handle_binary_image;
diff --git a/modules/gltf/register_types.cpp b/modules/gltf/register_types.cpp
index f80e12bbae..78589090db 100644
--- a/modules/gltf/register_types.cpp
+++ b/modules/gltf/register_types.cpp
@@ -36,6 +36,7 @@
#ifdef TOOLS_ENABLED
#include "core/config/project_settings.h"
+#include "editor/editor_import_blend_runner.h"
#include "editor/editor_node.h"
#include "editor/editor_scene_exporter_gltf_plugin.h"
#include "editor/editor_scene_importer_blend.h"
@@ -52,6 +53,14 @@ static void _editor_init() {
bool blend_enabled = GLOBAL_GET("filesystem/import/blender/enabled");
// Defined here because EditorSettings doesn't exist in `register_gltf_types` yet.
+ EDITOR_DEF_RST("filesystem/import/blender/rpc_port", 6011);
+ EditorSettings::get_singleton()->add_property_hint(PropertyInfo(Variant::INT,
+ "filesystem/import/blender/rpc_port", PROPERTY_HINT_RANGE, "0,65535,1"));
+
+ EDITOR_DEF_RST("filesystem/import/blender/rpc_server_uptime", 5);
+ EditorSettings::get_singleton()->add_property_hint(PropertyInfo(Variant::FLOAT,
+ "filesystem/import/blender/rpc_server_uptime", PROPERTY_HINT_RANGE, "0,300,1,or_greater,suffix:s"));
+
String blender3_path = EDITOR_DEF_RST("filesystem/import/blender/blender3_path", "");
EditorSettings::get_singleton()->add_property_hint(PropertyInfo(Variant::STRING,
"filesystem/import/blender/blender3_path", PROPERTY_HINT_GLOBAL_DIR));
@@ -71,6 +80,8 @@ static void _editor_init() {
EditorFileSystem::get_singleton()->add_import_format_support_query(blend_import_query);
}
}
+ memnew(EditorImportBlendRunner);
+ EditorNode::get_singleton()->add_child(EditorImportBlendRunner::get_singleton());
// FBX to glTF importer.
diff --git a/modules/mono/editor/Godot.NET.Sdk/Godot.SourceGenerators/GodotPluginsInitializerGenerator.cs b/modules/mono/editor/Godot.NET.Sdk/Godot.SourceGenerators/GodotPluginsInitializerGenerator.cs
index 813bdf1e9f..47a4516948 100644
--- a/modules/mono/editor/Godot.NET.Sdk/Godot.SourceGenerators/GodotPluginsInitializerGenerator.cs
+++ b/modules/mono/editor/Godot.NET.Sdk/Godot.SourceGenerators/GodotPluginsInitializerGenerator.cs
@@ -48,7 +48,7 @@ namespace GodotPlugins.Game
}
catch (Exception e)
{
- Console.Error.WriteLine(e);
+ global::System.Console.Error.WriteLine(e);
return false.ToGodotBool();
}
}
diff --git a/modules/mono/glue/GodotSharp/GodotSharp/Core/Extensions/PackedSceneExtensions.cs b/modules/mono/glue/GodotSharp/GodotSharp/Core/Extensions/PackedSceneExtensions.cs
index 8463403096..4610761bdb 100644
--- a/modules/mono/glue/GodotSharp/GodotSharp/Core/Extensions/PackedSceneExtensions.cs
+++ b/modules/mono/glue/GodotSharp/GodotSharp/Core/Extensions/PackedSceneExtensions.cs
@@ -7,7 +7,7 @@ namespace Godot
/// <summary>
/// Instantiates the scene's node hierarchy, erroring on failure.
/// Triggers child scene instantiation(s). Triggers a
- /// <see cref="Node.NotificationInstanced"/> notification on the root node.
+ /// <see cref="Node.NotificationSceneInstantiated"/> notification on the root node.
/// </summary>
/// <seealso cref="InstantiateOrNull{T}(GenEditState)"/>
/// <exception cref="InvalidCastException">
@@ -23,7 +23,7 @@ namespace Godot
/// <summary>
/// Instantiates the scene's node hierarchy, returning <see langword="null"/> on failure.
/// Triggers child scene instantiation(s). Triggers a
- /// <see cref="Node.NotificationInstanced"/> notification on the root node.
+ /// <see cref="Node.NotificationSceneInstantiated"/> notification on the root node.
/// </summary>
/// <seealso cref="Instantiate{T}(GenEditState)"/>
/// <typeparam name="T">The type to cast to. Should be a descendant of <see cref="Node"/>.</typeparam>
diff --git a/modules/mono/glue/GodotSharp/GodotSharp/Core/Transform2D.cs b/modules/mono/glue/GodotSharp/GodotSharp/Core/Transform2D.cs
index 5283dc7ec6..d7392dbda8 100644
--- a/modules/mono/glue/GodotSharp/GodotSharp/Core/Transform2D.cs
+++ b/modules/mono/glue/GodotSharp/GodotSharp/Core/Transform2D.cs
@@ -247,19 +247,19 @@ namespace Godot
/// <returns>The orthonormalized transform.</returns>
public readonly Transform2D Orthonormalized()
{
- Transform2D on = this;
+ Transform2D ortho = this;
- Vector2 onX = on.X;
- Vector2 onY = on.Y;
+ Vector2 orthoX = ortho.X;
+ Vector2 orthoY = ortho.Y;
- onX.Normalize();
- onY = onY - (onX * onX.Dot(onY));
- onY.Normalize();
+ orthoX.Normalize();
+ orthoY = orthoY - orthoX * orthoX.Dot(orthoY);
+ orthoY.Normalize();
- on.X = onX;
- on.Y = onY;
+ ortho.X = orthoX;
+ ortho.Y = orthoY;
- return on;
+ return ortho;
}
/// <summary>
diff --git a/modules/navigation/godot_navigation_server.cpp b/modules/navigation/godot_navigation_server.cpp
index d546c5d3ba..c3cb1c5f13 100644
--- a/modules/navigation/godot_navigation_server.cpp
+++ b/modules/navigation/godot_navigation_server.cpp
@@ -262,7 +262,7 @@ TypedArray<RID> GodotNavigationServer::map_get_agents(RID p_map) const {
const NavMap *map = map_owner.get_or_null(p_map);
ERR_FAIL_COND_V(map == nullptr, agents_rids);
- const LocalVector<RvoAgent *> agents = map->get_agents();
+ const LocalVector<NavAgent *> agents = map->get_agents();
agents_rids.resize(agents.size());
for (uint32_t i = 0; i < agents.size(); i++) {
@@ -282,7 +282,7 @@ RID GodotNavigationServer::region_get_map(RID p_region) const {
}
RID GodotNavigationServer::agent_get_map(RID p_agent) const {
- RvoAgent *agent = agent_owner.get_or_null(p_agent);
+ NavAgent *agent = agent_owner.get_or_null(p_agent);
ERR_FAIL_COND_V(agent == nullptr, RID());
if (agent->get_map()) {
@@ -579,13 +579,13 @@ RID GodotNavigationServer::agent_create() {
MutexLock lock(operations_mutex);
RID rid = agent_owner.make_rid();
- RvoAgent *agent = agent_owner.get_or_null(rid);
+ NavAgent *agent = agent_owner.get_or_null(rid);
agent->set_self(rid);
return rid;
}
COMMAND_2(agent_set_map, RID, p_agent, RID, p_map) {
- RvoAgent *agent = agent_owner.get_or_null(p_agent);
+ NavAgent *agent = agent_owner.get_or_null(p_agent);
ERR_FAIL_COND(agent == nullptr);
if (agent->get_map()) {
@@ -612,77 +612,77 @@ COMMAND_2(agent_set_map, RID, p_agent, RID, p_map) {
}
COMMAND_2(agent_set_neighbor_distance, RID, p_agent, real_t, p_distance) {
- RvoAgent *agent = agent_owner.get_or_null(p_agent);
+ NavAgent *agent = agent_owner.get_or_null(p_agent);
ERR_FAIL_COND(agent == nullptr);
agent->get_agent()->neighborDist_ = p_distance;
}
COMMAND_2(agent_set_max_neighbors, RID, p_agent, int, p_count) {
- RvoAgent *agent = agent_owner.get_or_null(p_agent);
+ NavAgent *agent = agent_owner.get_or_null(p_agent);
ERR_FAIL_COND(agent == nullptr);
agent->get_agent()->maxNeighbors_ = p_count;
}
COMMAND_2(agent_set_time_horizon, RID, p_agent, real_t, p_time) {
- RvoAgent *agent = agent_owner.get_or_null(p_agent);
+ NavAgent *agent = agent_owner.get_or_null(p_agent);
ERR_FAIL_COND(agent == nullptr);
agent->get_agent()->timeHorizon_ = p_time;
}
COMMAND_2(agent_set_radius, RID, p_agent, real_t, p_radius) {
- RvoAgent *agent = agent_owner.get_or_null(p_agent);
+ NavAgent *agent = agent_owner.get_or_null(p_agent);
ERR_FAIL_COND(agent == nullptr);
agent->get_agent()->radius_ = p_radius;
}
COMMAND_2(agent_set_max_speed, RID, p_agent, real_t, p_max_speed) {
- RvoAgent *agent = agent_owner.get_or_null(p_agent);
+ NavAgent *agent = agent_owner.get_or_null(p_agent);
ERR_FAIL_COND(agent == nullptr);
agent->get_agent()->maxSpeed_ = p_max_speed;
}
COMMAND_2(agent_set_velocity, RID, p_agent, Vector3, p_velocity) {
- RvoAgent *agent = agent_owner.get_or_null(p_agent);
+ NavAgent *agent = agent_owner.get_or_null(p_agent);
ERR_FAIL_COND(agent == nullptr);
agent->get_agent()->velocity_ = RVO::Vector3(p_velocity.x, p_velocity.y, p_velocity.z);
}
COMMAND_2(agent_set_target_velocity, RID, p_agent, Vector3, p_velocity) {
- RvoAgent *agent = agent_owner.get_or_null(p_agent);
+ NavAgent *agent = agent_owner.get_or_null(p_agent);
ERR_FAIL_COND(agent == nullptr);
agent->get_agent()->prefVelocity_ = RVO::Vector3(p_velocity.x, p_velocity.y, p_velocity.z);
}
COMMAND_2(agent_set_position, RID, p_agent, Vector3, p_position) {
- RvoAgent *agent = agent_owner.get_or_null(p_agent);
+ NavAgent *agent = agent_owner.get_or_null(p_agent);
ERR_FAIL_COND(agent == nullptr);
agent->get_agent()->position_ = RVO::Vector3(p_position.x, p_position.y, p_position.z);
}
COMMAND_2(agent_set_ignore_y, RID, p_agent, bool, p_ignore) {
- RvoAgent *agent = agent_owner.get_or_null(p_agent);
+ NavAgent *agent = agent_owner.get_or_null(p_agent);
ERR_FAIL_COND(agent == nullptr);
agent->get_agent()->ignore_y_ = p_ignore;
}
bool GodotNavigationServer::agent_is_map_changed(RID p_agent) const {
- RvoAgent *agent = agent_owner.get_or_null(p_agent);
+ NavAgent *agent = agent_owner.get_or_null(p_agent);
ERR_FAIL_COND_V(agent == nullptr, false);
return agent->is_map_changed();
}
COMMAND_2(agent_set_callback, RID, p_agent, Callable, p_callback) {
- RvoAgent *agent = agent_owner.get_or_null(p_agent);
+ NavAgent *agent = agent_owner.get_or_null(p_agent);
ERR_FAIL_COND(agent == nullptr);
agent->set_callback(p_callback);
@@ -713,7 +713,7 @@ COMMAND_1(free, RID, p_object) {
}
// Remove any assigned agent
- for (RvoAgent *agent : map->get_agents()) {
+ for (NavAgent *agent : map->get_agents()) {
map->remove_agent(agent);
agent->set_map(nullptr);
}
@@ -746,7 +746,7 @@ COMMAND_1(free, RID, p_object) {
link_owner.free(p_object);
} else if (agent_owner.owns(p_object)) {
- RvoAgent *agent = agent_owner.get_or_null(p_object);
+ NavAgent *agent = agent_owner.get_or_null(p_object);
// Removes this agent from the map if assigned
if (agent->get_map() != nullptr) {
diff --git a/modules/navigation/godot_navigation_server.h b/modules/navigation/godot_navigation_server.h
index eea5713c40..0b113b77d4 100644
--- a/modules/navigation/godot_navigation_server.h
+++ b/modules/navigation/godot_navigation_server.h
@@ -36,10 +36,10 @@
#include "core/templates/rid_owner.h"
#include "servers/navigation_server_3d.h"
+#include "nav_agent.h"
#include "nav_link.h"
#include "nav_map.h"
#include "nav_region.h"
-#include "rvo_agent.h"
/// The commands are functions executed during the `sync` phase.
@@ -71,7 +71,7 @@ class GodotNavigationServer : public NavigationServer3D {
mutable RID_Owner<NavLink> link_owner;
mutable RID_Owner<NavMap> map_owner;
mutable RID_Owner<NavRegion> region_owner;
- mutable RID_Owner<RvoAgent> agent_owner;
+ mutable RID_Owner<NavAgent> agent_owner;
bool active = true;
LocalVector<NavMap *> active_maps;
diff --git a/modules/navigation/rvo_agent.cpp b/modules/navigation/nav_agent.cpp
index 40f1e925be..293544c0a5 100644
--- a/modules/navigation/rvo_agent.cpp
+++ b/modules/navigation/nav_agent.cpp
@@ -1,5 +1,5 @@
/**************************************************************************/
-/* rvo_agent.cpp */
+/* nav_agent.cpp */
/**************************************************************************/
/* This file is part of: */
/* GODOT ENGINE */
@@ -28,15 +28,15 @@
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
/**************************************************************************/
-#include "rvo_agent.h"
+#include "nav_agent.h"
#include "nav_map.h"
-void RvoAgent::set_map(NavMap *p_map) {
+void NavAgent::set_map(NavMap *p_map) {
map = p_map;
}
-bool RvoAgent::is_map_changed() {
+bool NavAgent::is_map_changed() {
if (map) {
bool is_changed = map->get_map_update_id() != map_update_id;
map_update_id = map->get_map_update_id();
@@ -46,15 +46,15 @@ bool RvoAgent::is_map_changed() {
}
}
-void RvoAgent::set_callback(Callable p_callback) {
+void NavAgent::set_callback(Callable p_callback) {
callback = p_callback;
}
-bool RvoAgent::has_callback() const {
+bool NavAgent::has_callback() const {
return callback.is_valid();
}
-void RvoAgent::dispatch_callback() {
+void NavAgent::dispatch_callback() {
if (!callback.is_valid()) {
return;
}
diff --git a/modules/navigation/rvo_agent.h b/modules/navigation/nav_agent.h
index 5f377b6079..f154ce14d9 100644
--- a/modules/navigation/rvo_agent.h
+++ b/modules/navigation/nav_agent.h
@@ -1,5 +1,5 @@
/**************************************************************************/
-/* rvo_agent.h */
+/* nav_agent.h */
/**************************************************************************/
/* This file is part of: */
/* GODOT ENGINE */
@@ -28,8 +28,8 @@
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
/**************************************************************************/
-#ifndef RVO_AGENT_H
-#define RVO_AGENT_H
+#ifndef NAV_AGENT_H
+#define NAV_AGENT_H
#include "core/object/class_db.h"
#include "nav_rid.h"
@@ -38,7 +38,7 @@
class NavMap;
-class RvoAgent : public NavRid {
+class NavAgent : public NavRid {
NavMap *map = nullptr;
RVO::Agent agent;
Callable callback = Callable();
@@ -62,4 +62,4 @@ public:
void dispatch_callback();
};
-#endif // RVO_AGENT_H
+#endif // NAV_AGENT_H
diff --git a/modules/navigation/nav_map.cpp b/modules/navigation/nav_map.cpp
index d763b1d3bc..b1674c8fc5 100644
--- a/modules/navigation/nav_map.cpp
+++ b/modules/navigation/nav_map.cpp
@@ -31,9 +31,9 @@
#include "nav_map.h"
#include "core/object/worker_thread_pool.h"
+#include "nav_agent.h"
#include "nav_link.h"
#include "nav_region.h"
-#include "rvo_agent.h"
#include <algorithm>
#define THREE_POINTS_CROSS_PRODUCT(m_a, m_b, m_c) (((m_c) - (m_a)).cross((m_b) - (m_a)))
@@ -568,18 +568,18 @@ void NavMap::remove_link(NavLink *p_link) {
}
}
-bool NavMap::has_agent(RvoAgent *agent) const {
+bool NavMap::has_agent(NavAgent *agent) const {
return (agents.find(agent) != -1);
}
-void NavMap::add_agent(RvoAgent *agent) {
+void NavMap::add_agent(NavAgent *agent) {
if (!has_agent(agent)) {
agents.push_back(agent);
agents_dirty = true;
}
}
-void NavMap::remove_agent(RvoAgent *agent) {
+void NavMap::remove_agent(NavAgent *agent) {
remove_agent_as_controlled(agent);
int64_t agent_index = agents.find(agent);
if (agent_index != -1) {
@@ -588,7 +588,7 @@ void NavMap::remove_agent(RvoAgent *agent) {
}
}
-void NavMap::set_agent_as_controlled(RvoAgent *agent) {
+void NavMap::set_agent_as_controlled(NavAgent *agent) {
const bool exist = (controlled_agents.find(agent) != -1);
if (!exist) {
ERR_FAIL_COND(!has_agent(agent));
@@ -596,7 +596,7 @@ void NavMap::set_agent_as_controlled(RvoAgent *agent) {
}
}
-void NavMap::remove_agent_as_controlled(RvoAgent *agent) {
+void NavMap::remove_agent_as_controlled(NavAgent *agent) {
int64_t active_avoidance_agent_index = controlled_agents.find(agent);
if (active_avoidance_agent_index != -1) {
controlled_agents.remove_at_unordered(active_avoidance_agent_index);
@@ -895,7 +895,7 @@ void NavMap::sync() {
// cannot use LocalVector here as RVO library expects std::vector to build KdTree
std::vector<RVO::Agent *> raw_agents;
raw_agents.reserve(agents.size());
- for (RvoAgent *agent : agents) {
+ for (NavAgent *agent : agents) {
raw_agents.push_back(agent->get_agent());
}
rvo.buildAgentTree(raw_agents);
@@ -916,7 +916,7 @@ void NavMap::sync() {
pm_edge_free_count = _new_pm_edge_free_count;
}
-void NavMap::compute_single_step(uint32_t index, RvoAgent **agent) {
+void NavMap::compute_single_step(uint32_t index, NavAgent **agent) {
(*(agent + index))->get_agent()->computeNeighbors(&rvo);
(*(agent + index))->get_agent()->computeNewVelocity(deltatime);
}
@@ -930,7 +930,7 @@ void NavMap::step(real_t p_deltatime) {
}
void NavMap::dispatch_callbacks() {
- for (RvoAgent *agent : controlled_agents) {
+ for (NavAgent *agent : controlled_agents) {
agent->dispatch_callback();
}
}
diff --git a/modules/navigation/nav_map.h b/modules/navigation/nav_map.h
index fce7aff3ba..ab6a48dd70 100644
--- a/modules/navigation/nav_map.h
+++ b/modules/navigation/nav_map.h
@@ -42,7 +42,7 @@
class NavLink;
class NavRegion;
-class RvoAgent;
+class NavAgent;
class NavMap : public NavRid {
/// Map Up
@@ -78,10 +78,10 @@ class NavMap : public NavRid {
bool agents_dirty = false;
/// All the Agents (even the controlled one)
- LocalVector<RvoAgent *> agents;
+ LocalVector<NavAgent *> agents;
/// Controlled agents
- LocalVector<RvoAgent *> controlled_agents;
+ LocalVector<NavAgent *> controlled_agents;
/// Physics delta time
real_t deltatime = 0.0;
@@ -144,15 +144,15 @@ public:
return links;
}
- bool has_agent(RvoAgent *agent) const;
- void add_agent(RvoAgent *agent);
- void remove_agent(RvoAgent *agent);
- const LocalVector<RvoAgent *> &get_agents() const {
+ bool has_agent(NavAgent *agent) const;
+ void add_agent(NavAgent *agent);
+ void remove_agent(NavAgent *agent);
+ const LocalVector<NavAgent *> &get_agents() const {
return agents;
}
- void set_agent_as_controlled(RvoAgent *agent);
- void remove_agent_as_controlled(RvoAgent *agent);
+ void set_agent_as_controlled(NavAgent *agent);
+ void remove_agent_as_controlled(NavAgent *agent);
uint32_t get_map_update_id() const {
return map_update_id;
@@ -173,7 +173,7 @@ public:
int get_pm_edge_free_count() const { return pm_edge_free_count; }
private:
- void compute_single_step(uint32_t index, RvoAgent **agent);
+ void compute_single_step(uint32_t index, NavAgent **agent);
void clip_path(const LocalVector<gd::NavigationPoly> &p_navigation_polys, Vector<Vector3> &path, const gd::NavigationPoly *from_poly, const Vector3 &p_to_point, const gd::NavigationPoly *p_to_poly, Vector<int32_t> *r_path_types, TypedArray<RID> *r_path_rids, Vector<int64_t> *r_path_owners) const;
};
diff --git a/modules/webrtc/webrtc_multiplayer_peer.cpp b/modules/webrtc/webrtc_multiplayer_peer.cpp
index 36d0b41889..9224760c5b 100644
--- a/modules/webrtc/webrtc_multiplayer_peer.cpp
+++ b/modules/webrtc/webrtc_multiplayer_peer.cpp
@@ -128,7 +128,6 @@ void WebRTCMultiplayerPeer::poll() {
// Server connected.
connection_status = CONNECTION_CONNECTED;
emit_signal(SNAME("peer_connected"), TARGET_PEER_SERVER);
- emit_signal(SNAME("connection_succeeded"));
} else {
emit_signal(SNAME("peer_connected"), E);
}
diff --git a/modules/websocket/websocket_multiplayer_peer.cpp b/modules/websocket/websocket_multiplayer_peer.cpp
index 389d8c56ad..c12fc5e834 100644
--- a/modules/websocket/websocket_multiplayer_peer.cpp
+++ b/modules/websocket/websocket_multiplayer_peer.cpp
@@ -237,7 +237,6 @@ void WebSocketMultiplayerPeer::_poll_client() {
}
connection_status = CONNECTION_CONNECTED;
emit_signal("peer_connected", 1);
- emit_signal("connection_succeeded");
} else {
return; // Still waiting for an ID.
}
diff --git a/platform/android/export/export_plugin.cpp b/platform/android/export/export_plugin.cpp
index 9ebb8aa102..c02acbee83 100644
--- a/platform/android/export/export_plugin.cpp
+++ b/platform/android/export/export_plugin.cpp
@@ -899,10 +899,6 @@ void EditorExportPlatformAndroid::_fix_manifest(const Ref<EditorExportPreset> &p
bool screen_support_large = p_preset->get("screen/support_large");
bool screen_support_xlarge = p_preset->get("screen/support_xlarge");
- int xr_mode_index = p_preset->get("xr_features/xr_mode");
- int hand_tracking_index = p_preset->get("xr_features/hand_tracking");
- int hand_tracking_frequency_index = p_preset->get("xr_features/hand_tracking_frequency");
-
bool backup_allowed = p_preset->get("user_data_backup/allow");
int app_category = p_preset->get("package/app_category");
bool retain_data_on_uninstall = p_preset->get("package/retain_data_on_uninstall");
@@ -1027,6 +1023,10 @@ void EditorExportPlatformAndroid::_fix_manifest(const Ref<EditorExportPreset> &p
encode_uint32(is_resizeable, &p_manifest.write[iofs + 16]);
}
+ if (tname == "provider" && attrname == "authorities") {
+ string_table.write[attr_value] = get_package_name(package_name) + String(".fileprovider");
+ }
+
if (tname == "supports-screens") {
if (attrname == "smallScreens") {
encode_uint32(screen_support_small ? 0xFFFFFFFF : 0, &p_manifest.write[iofs + 16]);
@@ -1042,25 +1042,6 @@ void EditorExportPlatformAndroid::_fix_manifest(const Ref<EditorExportPreset> &p
}
}
- // Hand tracking related configurations
- if (xr_mode_index == XR_MODE_OPENXR && hand_tracking_index > XR_HAND_TRACKING_NONE) {
- if (tname == "meta-data" && attrname == "name" && value == "xr_hand_tracking_metadata_name") {
- string_table.write[attr_value] = "com.oculus.handtracking.frequency";
- }
-
- if (tname == "meta-data" && attrname == "value" && value == "xr_hand_tracking_metadata_value") {
- string_table.write[attr_value] = (hand_tracking_frequency_index == XR_HAND_TRACKING_FREQUENCY_LOW ? "LOW" : "HIGH");
- }
-
- if (tname == "meta-data" && attrname == "name" && value == "xr_hand_tracking_version_name") {
- string_table.write[attr_value] = "com.oculus.handtracking.version";
- }
-
- if (tname == "meta-data" && attrname == "value" && value == "xr_hand_tracking_version_value") {
- string_table.write[attr_value] = "V2.0";
- }
- }
-
iofs += 20;
}
@@ -1075,23 +1056,6 @@ void EditorExportPlatformAndroid::_fix_manifest(const Ref<EditorExportPreset> &p
Vector<bool> feature_required_list;
Vector<int> feature_versions;
- if (xr_mode_index == XR_MODE_OPENXR) {
- // Check for hand tracking
- if (hand_tracking_index > XR_HAND_TRACKING_NONE) {
- feature_names.push_back("oculus.software.handtracking");
- feature_required_list.push_back(hand_tracking_index == XR_HAND_TRACKING_REQUIRED);
- feature_versions.push_back(-1); // no version attribute should be added.
- }
-
- // Check for passthrough
- int passthrough_mode = p_preset->get("xr_features/passthrough");
- if (passthrough_mode > XR_PASSTHROUGH_NONE) {
- feature_names.push_back("com.oculus.feature.PASSTHROUGH");
- feature_required_list.push_back(passthrough_mode == XR_PASSTHROUGH_REQUIRED);
- feature_versions.push_back(-1);
- }
- }
-
if (feature_names.size() > 0) {
ofs += 24; // skip over end tag
@@ -2330,6 +2294,12 @@ bool EditorExportPlatformAndroid::has_valid_project_configuration(const Ref<Edit
int xr_mode_index = p_preset->get("xr_features/xr_mode");
int hand_tracking = p_preset->get("xr_features/hand_tracking");
int passthrough_mode = p_preset->get("xr_features/passthrough");
+ if (xr_mode_index == XR_MODE_OPENXR && !custom_build_enabled) {
+ valid = false;
+ err += TTR("OpenXR requires \"Use Custom Build\" to be enabled");
+ err += "\n";
+ }
+
if (xr_mode_index != XR_MODE_OPENXR) {
if (hand_tracking > XR_HAND_TRACKING_NONE) {
valid = false;
diff --git a/platform/android/export/gradle_export_util.cpp b/platform/android/export/gradle_export_util.cpp
index 4fdcca68e9..5e71116c10 100644
--- a/platform/android/export/gradle_export_util.cpp
+++ b/platform/android/export/gradle_export_util.cpp
@@ -276,17 +276,39 @@ String _get_xr_features_tag(const Ref<EditorExportPreset> &p_preset) {
return manifest_xr_features;
}
-String _get_activity_tag(const Ref<EditorExportPreset> &p_preset) {
+String _get_activity_tag(const Ref<EditorExportPreset> &p_preset, bool p_uses_xr) {
String orientation = _get_android_orientation_label(DisplayServer::ScreenOrientation(int(GLOBAL_GET("display/window/handheld/orientation"))));
String manifest_activity_text = vformat(
" <activity android:name=\"com.godot.game.GodotApp\" "
"tools:replace=\"android:screenOrientation,android:excludeFromRecents,android:resizeableActivity\" "
+ "tools:node=\"mergeOnlyAttributes\" "
"android:excludeFromRecents=\"%s\" "
"android:screenOrientation=\"%s\" "
"android:resizeableActivity=\"%s\">\n",
bool_to_string(p_preset->get("package/exclude_from_recents")),
orientation,
bool_to_string(bool(GLOBAL_GET("display/window/size/resizable"))));
+
+ if (p_uses_xr) {
+ manifest_activity_text += " <intent-filter>\n"
+ " <action android:name=\"android.intent.action.MAIN\" />\n"
+ " <category android:name=\"android.intent.category.LAUNCHER\" />\n"
+ "\n"
+ " <!-- Enable access to OpenXR on Oculus mobile devices, no-op on other Android\n"
+ " platforms. -->\n"
+ " <category android:name=\"com.oculus.intent.category.VR\" />\n"
+ "\n"
+ " <!-- OpenXR category tag to indicate the activity starts in an immersive OpenXR mode. \n"
+ " See https://registry.khronos.org/OpenXR/specs/1.0/html/xrspec.html#android-runtime-category. -->\n"
+ " <category android:name=\"org.khronos.openxr.intent.category.IMMERSIVE_HMD\" />\n"
+ " </intent-filter>\n";
+ } else {
+ manifest_activity_text += " <intent-filter>\n"
+ " <action android:name=\"android.intent.action.MAIN\" />\n"
+ " <category android:name=\"android.intent.category.LAUNCHER\" />\n"
+ " </intent-filter>\n";
+ }
+
manifest_activity_text += " </activity>\n";
return manifest_activity_text;
}
@@ -307,9 +329,7 @@ String _get_application_tag(const Ref<EditorExportPreset> &p_preset, bool p_has_
" android:hasFragileUserData=\"%s\"\n"
" android:requestLegacyExternalStorage=\"%s\"\n"
" tools:replace=\"android:allowBackup,android:appCategory,android:isGame,android:hasFragileUserData,android:requestLegacyExternalStorage\"\n"
- " tools:ignore=\"GoogleAppIndexingWarning\">\n\n"
- " <meta-data tools:node=\"remove\" android:name=\"xr_hand_tracking_version_name\" />\n"
- " <meta-data tools:node=\"remove\" android:name=\"xr_hand_tracking_metadata_name\" />\n",
+ " tools:ignore=\"GoogleAppIndexingWarning\">\n\n",
bool_to_string(p_preset->get("user_data_backup/allow")),
_get_app_category_label(app_category_index),
bool_to_string(is_game),
@@ -327,7 +347,7 @@ String _get_application_tag(const Ref<EditorExportPreset> &p_preset, bool p_has_
manifest_application_text += " <meta-data tools:node=\"replace\" android:name=\"com.oculus.handtracking.version\" android:value=\"V2.0\" />\n";
}
}
- manifest_application_text += _get_activity_tag(p_preset);
+ manifest_application_text += _get_activity_tag(p_preset, uses_xr);
manifest_application_text += " </application>\n";
return manifest_application_text;
}
diff --git a/platform/android/export/gradle_export_util.h b/platform/android/export/gradle_export_util.h
index 0fa857cb75..fe5888e11c 100644
--- a/platform/android/export/gradle_export_util.h
+++ b/platform/android/export/gradle_export_util.h
@@ -118,7 +118,7 @@ String _get_screen_sizes_tag(const Ref<EditorExportPreset> &p_preset);
String _get_xr_features_tag(const Ref<EditorExportPreset> &p_preset);
-String _get_activity_tag(const Ref<EditorExportPreset> &p_preset);
+String _get_activity_tag(const Ref<EditorExportPreset> &p_preset, bool p_uses_xr);
String _get_application_tag(const Ref<EditorExportPreset> &p_preset, bool p_has_read_write_storage_permission);
diff --git a/platform/android/java/app/AndroidManifest.xml b/platform/android/java/app/AndroidManifest.xml
index 1969f9c814..ce4a2ecfe4 100644
--- a/platform/android/java/app/AndroidManifest.xml
+++ b/platform/android/java/app/AndroidManifest.xml
@@ -31,23 +31,6 @@
android:name="org.godotengine.editor.version"
android:value="${godotEditorVersion}" />
- <!-- The following metadata values are replaced when Godot exports, modifying them here has no effect. -->
- <!-- Do these changes in the export preset. Adding new ones is fine. -->
-
- <!-- XR hand tracking metadata -->
- <!-- This is modified by the exporter based on the selected xr mode. DO NOT CHANGE the values here. -->
- <!-- Removed at export time if the xr mode is not VR or hand tracking is disabled. -->
- <meta-data
- android:name="xr_hand_tracking_metadata_name"
- android:value="xr_hand_tracking_metadata_value"/>
-
- <!-- XR hand tracking version -->
- <!-- This is modified by the exporter based on the selected xr mode. DO NOT CHANGE the values here. -->
- <!-- Removed at export time if the xr mode is not VR or hand tracking is disabled. -->
- <meta-data
- android:name="xr_hand_tracking_version_name"
- android:value="xr_hand_tracking_version_value"/>
-
<activity
android:name=".GodotApp"
android:label="@string/godot_project_name_string"
@@ -63,10 +46,6 @@
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
-
- <!-- Enable access to OpenXR on Oculus mobile devices, no-op on other Android
- platforms. -->
- <category android:name="com.oculus.intent.category.VR" />
</intent-filter>
</activity>
diff --git a/platform/android/java/lib/AndroidManifest.xml b/platform/android/java/lib/AndroidManifest.xml
index 1f77e2fc34..f03a1dd47a 100644
--- a/platform/android/java/lib/AndroidManifest.xml
+++ b/platform/android/java/lib/AndroidManifest.xml
@@ -20,6 +20,16 @@
android:exported="false"
/>
+ <provider
+ android:name="androidx.core.content.FileProvider"
+ android:authorities="${applicationId}.fileprovider"
+ android:exported="false"
+ android:grantUriPermissions="true">
+ <meta-data
+ android:name="android.support.FILE_PROVIDER_PATHS"
+ android:resource="@xml/godot_provider_paths" />
+ </provider>
+
</application>
</manifest>
diff --git a/platform/android/java/lib/res/xml/godot_provider_paths.xml b/platform/android/java/lib/res/xml/godot_provider_paths.xml
new file mode 100644
index 0000000000..1255f576bf
--- /dev/null
+++ b/platform/android/java/lib/res/xml/godot_provider_paths.xml
@@ -0,0 +1,11 @@
+<?xml version="1.0" encoding="utf-8"?>
+<paths xmlns:android="http://schemas.android.com/apk/res/android">
+
+ <external-path
+ name="public"
+ path="." />
+
+ <external-files-path
+ name="app"
+ path="." />
+</paths>
diff --git a/platform/android/java/lib/src/org/godotengine/godot/FullScreenGodotApp.java b/platform/android/java/lib/src/org/godotengine/godot/FullScreenGodotApp.java
index 65032d6a68..677c9d8f13 100644
--- a/platform/android/java/lib/src/org/godotengine/godot/FullScreenGodotApp.java
+++ b/platform/android/java/lib/src/org/godotengine/godot/FullScreenGodotApp.java
@@ -99,7 +99,7 @@ public abstract class FullScreenGodotApp extends FragmentActivity implements God
// from scratch. Therefore, we need to kill the whole app process and relaunch it.
//
// Restarting only the activity, wouldn't be enough unless it did proper cleanup (including
- // releasing and reloading native libs or resetting their state somehow and clearing statics).
+ // releasing and reloading native libs or resetting their state somehow and clearing static data).
Log.v(TAG, "Restarting Godot instance...");
ProcessPhoenix.triggerRebirth(FullScreenGodotApp.this);
}
diff --git a/platform/android/java/lib/src/org/godotengine/godot/GodotIO.java b/platform/android/java/lib/src/org/godotengine/godot/GodotIO.java
index 41d06a6458..edcd9c4d1f 100644
--- a/platform/android/java/lib/src/org/godotengine/godot/GodotIO.java
+++ b/platform/android/java/lib/src/org/godotengine/godot/GodotIO.java
@@ -49,6 +49,9 @@ import android.view.Display;
import android.view.DisplayCutout;
import android.view.WindowInsets;
+import androidx.core.content.FileProvider;
+
+import java.io.File;
import java.util.List;
import java.util.Locale;
@@ -84,29 +87,42 @@ public class GodotIO {
// MISCELLANEOUS OS IO
/////////////////////////
- public int openURI(String p_uri) {
+ public int openURI(String uriString) {
try {
- String path = p_uri;
- String type = "";
- if (path.startsWith("/")) {
- //absolute path to filesystem, prepend file://
- path = "file://" + path;
- if (p_uri.endsWith(".png") || p_uri.endsWith(".jpg") || p_uri.endsWith(".gif") || p_uri.endsWith(".webp")) {
- type = "image/*";
+ Uri dataUri;
+ String dataType = "";
+ boolean grantReadUriPermission = false;
+
+ if (uriString.startsWith("/") || uriString.startsWith("file://")) {
+ String filePath = uriString;
+ // File uris needs to be provided via the FileProvider
+ grantReadUriPermission = true;
+ if (filePath.startsWith("file://")) {
+ filePath = filePath.replace("file://", "");
}
+
+ File targetFile = new File(filePath);
+ dataUri = FileProvider.getUriForFile(activity, activity.getPackageName() + ".fileprovider", targetFile);
+ dataType = activity.getContentResolver().getType(dataUri);
+ } else {
+ dataUri = Uri.parse(uriString);
}
Intent intent = new Intent();
intent.setAction(Intent.ACTION_VIEW);
- if (!type.equals("")) {
- intent.setDataAndType(Uri.parse(path), type);
+ if (TextUtils.isEmpty(dataType)) {
+ intent.setData(dataUri);
} else {
- intent.setData(Uri.parse(path));
+ intent.setDataAndType(dataUri, dataType);
+ }
+ if (grantReadUriPermission) {
+ intent.addFlags(Intent.FLAG_GRANT_READ_URI_PERMISSION);
}
activity.startActivity(intent);
return 0;
} catch (ActivityNotFoundException e) {
+ Log.e(TAG, "Unable to open uri " + uriString, e);
return 1;
}
}
diff --git a/platform/linuxbsd/x11/display_server_x11.cpp b/platform/linuxbsd/x11/display_server_x11.cpp
index c09da2f7b3..8377e81a53 100644
--- a/platform/linuxbsd/x11/display_server_x11.cpp
+++ b/platform/linuxbsd/x11/display_server_x11.cpp
@@ -3672,8 +3672,23 @@ Rect2i DisplayServerX11::window_get_popup_safe_rect(WindowID p_window) const {
void DisplayServerX11::popup_open(WindowID p_window) {
_THREAD_SAFE_METHOD_
+ bool has_popup_ancestor = false;
+ WindowID transient_root = p_window;
+ while (true) {
+ WindowID parent = windows[transient_root].transient_parent;
+ if (parent == INVALID_WINDOW_ID) {
+ break;
+ } else {
+ transient_root = parent;
+ if (windows[parent].is_popup) {
+ has_popup_ancestor = true;
+ break;
+ }
+ }
+ }
+
WindowData &wd = windows[p_window];
- if (wd.is_popup) {
+ if (wd.is_popup || has_popup_ancestor) {
// Find current popup parent, or root popup if new window is not transient.
List<WindowID>::Element *C = nullptr;
List<WindowID>::Element *E = popup_list.back();
@@ -4897,7 +4912,7 @@ DisplayServerX11::WindowID DisplayServerX11::_create_window(WindowMode p_mode, V
// handling decorations and placement.
// On the other hand, focus changes need to be handled manually when this is set.
// - save_under is a hint for the WM to keep the content of windows behind to avoid repaint.
- if (wd.is_popup || wd.no_focus) {
+ if (wd.no_focus) {
windowAttributes.override_redirect = True;
windowAttributes.save_under = True;
valuemask |= CWOverrideRedirect | CWSaveUnder;
diff --git a/platform/macos/display_server_macos.mm b/platform/macos/display_server_macos.mm
index 2832495693..65546392c1 100644
--- a/platform/macos/display_server_macos.mm
+++ b/platform/macos/display_server_macos.mm
@@ -3681,8 +3681,23 @@ Rect2i DisplayServerMacOS::window_get_popup_safe_rect(WindowID p_window) const {
void DisplayServerMacOS::popup_open(WindowID p_window) {
_THREAD_SAFE_METHOD_
+ bool has_popup_ancestor = false;
+ WindowID transient_root = p_window;
+ while (true) {
+ WindowID parent = windows[transient_root].transient_parent;
+ if (parent == INVALID_WINDOW_ID) {
+ break;
+ } else {
+ transient_root = parent;
+ if (windows[parent].is_popup) {
+ has_popup_ancestor = true;
+ break;
+ }
+ }
+ }
+
WindowData &wd = windows[p_window];
- if (wd.is_popup) {
+ if (wd.is_popup || has_popup_ancestor) {
bool was_empty = popup_list.is_empty();
// Find current popup parent, or root popup if new window is not transient.
List<WindowID>::Element *C = nullptr;
@@ -3905,6 +3920,7 @@ DisplayServerMacOS::DisplayServerMacOS(const String &p_rendering_driver, WindowM
}
}
show_window(MAIN_WINDOW_ID);
+ force_process_and_drop_events();
#if defined(GLES3_ENABLED)
if (rendering_driver == "opengl3") {
diff --git a/platform/windows/display_server_windows.cpp b/platform/windows/display_server_windows.cpp
index cc230575c8..777d05584c 100644
--- a/platform/windows/display_server_windows.cpp
+++ b/platform/windows/display_server_windows.cpp
@@ -2360,8 +2360,23 @@ Rect2i DisplayServerWindows::window_get_popup_safe_rect(WindowID p_window) const
void DisplayServerWindows::popup_open(WindowID p_window) {
_THREAD_SAFE_METHOD_
- const WindowData &wd = windows[p_window];
- if (wd.is_popup) {
+ bool has_popup_ancestor = false;
+ WindowID transient_root = p_window;
+ while (true) {
+ WindowID parent = windows[transient_root].transient_parent;
+ if (parent == INVALID_WINDOW_ID) {
+ break;
+ } else {
+ transient_root = parent;
+ if (windows[parent].is_popup) {
+ has_popup_ancestor = true;
+ break;
+ }
+ }
+ }
+
+ WindowData &wd = windows[p_window];
+ if (wd.is_popup || has_popup_ancestor) {
// Find current popup parent, or root popup if new window is not transient.
List<WindowID>::Element *C = nullptr;
List<WindowID>::Element *E = popup_list.back();
diff --git a/scene/2d/camera_2d.cpp b/scene/2d/camera_2d.cpp
index 49c5501e77..fe6bee0f1b 100644
--- a/scene/2d/camera_2d.cpp
+++ b/scene/2d/camera_2d.cpp
@@ -250,7 +250,7 @@ void Camera2D::_notification(int p_what) {
add_to_group(group_name);
add_to_group(canvas_group_name);
- if (enabled && !viewport->get_camera_2d()) {
+ if (!Engine::get_singleton()->is_editor_hint() && enabled && !viewport->get_camera_2d()) {
make_current();
}
@@ -260,11 +260,11 @@ void Camera2D::_notification(int p_what) {
} break;
case NOTIFICATION_EXIT_TREE: {
+ remove_from_group(group_name);
+ remove_from_group(canvas_group_name);
if (is_current()) {
clear_current();
}
- remove_from_group(group_name);
- remove_from_group(canvas_group_name);
viewport = nullptr;
} break;
diff --git a/scene/2d/navigation_agent_2d.cpp b/scene/2d/navigation_agent_2d.cpp
index e73b6e7e23..ed6f3b8020 100644
--- a/scene/2d/navigation_agent_2d.cpp
+++ b/scene/2d/navigation_agent_2d.cpp
@@ -108,6 +108,26 @@ void NavigationAgent2D::_bind_methods() {
ADD_PROPERTY(PropertyInfo(Variant::FLOAT, "time_horizon", PROPERTY_HINT_RANGE, "0.1,10,0.01,suffix:s"), "set_time_horizon", "get_time_horizon");
ADD_PROPERTY(PropertyInfo(Variant::FLOAT, "max_speed", PROPERTY_HINT_RANGE, "0.1,10000,0.01,suffix:px/s"), "set_max_speed", "get_max_speed");
+#ifdef DEBUG_ENABLED
+ ClassDB::bind_method(D_METHOD("set_debug_enabled", "enabled"), &NavigationAgent2D::set_debug_enabled);
+ ClassDB::bind_method(D_METHOD("get_debug_enabled"), &NavigationAgent2D::get_debug_enabled);
+ ClassDB::bind_method(D_METHOD("set_debug_use_custom", "enabled"), &NavigationAgent2D::set_debug_use_custom);
+ ClassDB::bind_method(D_METHOD("get_debug_use_custom"), &NavigationAgent2D::get_debug_use_custom);
+ ClassDB::bind_method(D_METHOD("set_debug_path_custom_color", "color"), &NavigationAgent2D::set_debug_path_custom_color);
+ ClassDB::bind_method(D_METHOD("get_debug_path_custom_color"), &NavigationAgent2D::get_debug_path_custom_color);
+ ClassDB::bind_method(D_METHOD("set_debug_path_custom_point_size", "point_size"), &NavigationAgent2D::set_debug_path_custom_point_size);
+ ClassDB::bind_method(D_METHOD("get_debug_path_custom_point_size"), &NavigationAgent2D::get_debug_path_custom_point_size);
+ ClassDB::bind_method(D_METHOD("set_debug_path_custom_line_width", "line_width"), &NavigationAgent2D::set_debug_path_custom_line_width);
+ ClassDB::bind_method(D_METHOD("get_debug_path_custom_line_width"), &NavigationAgent2D::get_debug_path_custom_line_width);
+
+ ADD_GROUP("Debug", "");
+ ADD_PROPERTY(PropertyInfo(Variant::BOOL, "debug_enabled"), "set_debug_enabled", "get_debug_enabled");
+ ADD_PROPERTY(PropertyInfo(Variant::BOOL, "debug_use_custom"), "set_debug_use_custom", "get_debug_use_custom");
+ ADD_PROPERTY(PropertyInfo(Variant::COLOR, "debug_path_custom_color"), "set_debug_path_custom_color", "get_debug_path_custom_color");
+ ADD_PROPERTY(PropertyInfo(Variant::FLOAT, "debug_path_custom_point_size", PROPERTY_HINT_RANGE, "1,50,1,suffix:px"), "set_debug_path_custom_point_size", "get_debug_path_custom_point_size");
+ ADD_PROPERTY(PropertyInfo(Variant::FLOAT, "debug_path_custom_line_width", PROPERTY_HINT_RANGE, "1,50,1,suffix:px"), "set_debug_path_custom_line_width", "get_debug_path_custom_line_width");
+#endif // DEBUG_ENABLED
+
ADD_SIGNAL(MethodInfo("path_changed"));
ADD_SIGNAL(MethodInfo("target_reached"));
ADD_SIGNAL(MethodInfo("waypoint_reached", PropertyInfo(Variant::DICTIONARY, "details")));
@@ -120,9 +140,15 @@ void NavigationAgent2D::_notification(int p_what) {
switch (p_what) {
case NOTIFICATION_POST_ENTER_TREE: {
// need to use POST_ENTER_TREE cause with normal ENTER_TREE not all required Nodes are ready.
- // cannot use READY as ready does not get called if Node is readded to SceneTree
+ // cannot use READY as ready does not get called if Node is re-added to SceneTree
set_agent_parent(get_parent());
set_physics_process_internal(true);
+
+#ifdef DEBUG_ENABLED
+ if (NavigationServer2D::get_singleton()->get_debug_enabled()) {
+ debug_path_dirty = true;
+ }
+#endif // DEBUG_ENABLED
} break;
case NOTIFICATION_PARENTED: {
@@ -165,6 +191,12 @@ void NavigationAgent2D::_notification(int p_what) {
case NOTIFICATION_EXIT_TREE: {
agent_parent = nullptr;
set_physics_process_internal(false);
+
+#ifdef DEBUG_ENABLED
+ if (debug_path_instance.is_valid()) {
+ RenderingServer::get_singleton()->canvas_item_set_visible(debug_path_instance, false);
+ }
+#endif // DEBUG_ENABLED
} break;
case NOTIFICATION_INTERNAL_PHYSICS_PROCESS: {
@@ -176,6 +208,12 @@ void NavigationAgent2D::_notification(int p_what) {
}
_check_distance_to_target();
}
+
+#ifdef DEBUG_ENABLED
+ if (debug_path_dirty) {
+ _update_debug_path();
+ }
+#endif // DEBUG_ENABLED
} break;
}
}
@@ -194,12 +232,25 @@ NavigationAgent2D::NavigationAgent2D() {
navigation_result = Ref<NavigationPathQueryResult2D>();
navigation_result.instantiate();
+
+#ifdef DEBUG_ENABLED
+ NavigationServer2D::get_singleton()->connect(SNAME("navigation_debug_changed"), callable_mp(this, &NavigationAgent2D::_navigation_debug_changed));
+#endif // DEBUG_ENABLED
}
NavigationAgent2D::~NavigationAgent2D() {
ERR_FAIL_NULL(NavigationServer2D::get_singleton());
NavigationServer2D::get_singleton()->free(agent);
agent = RID(); // Pointless
+
+#ifdef DEBUG_ENABLED
+ NavigationServer2D::get_singleton()->disconnect(SNAME("navigation_debug_changed"), callable_mp(this, &NavigationAgent2D::_navigation_debug_changed));
+
+ ERR_FAIL_NULL(RenderingServer::get_singleton());
+ if (debug_path_instance.is_valid()) {
+ RenderingServer::get_singleton()->free(debug_path_instance);
+ }
+#endif // DEBUG_ENABLED
}
void NavigationAgent2D::set_avoidance_enabled(bool p_enabled) {
@@ -463,6 +514,9 @@ void NavigationAgent2D::update_navigation() {
}
NavigationServer2D::get_singleton()->query_path(navigation_query, navigation_result);
+#ifdef DEBUG_ENABLED
+ debug_path_dirty = true;
+#endif // DEBUG_ENABLED
navigation_finished = false;
navigation_path_index = 0;
emit_signal(SNAME("path_changed"));
@@ -549,3 +603,111 @@ void NavigationAgent2D::_check_distance_to_target() {
}
}
}
+
+////////DEBUG////////////////////////////////////////////////////////////
+
+#ifdef DEBUG_ENABLED
+void NavigationAgent2D::set_debug_enabled(bool p_enabled) {
+ debug_enabled = p_enabled;
+ debug_path_dirty = true;
+}
+
+bool NavigationAgent2D::get_debug_enabled() const {
+ return debug_enabled;
+}
+
+void NavigationAgent2D::set_debug_use_custom(bool p_enabled) {
+ debug_use_custom = p_enabled;
+ debug_path_dirty = true;
+}
+
+bool NavigationAgent2D::get_debug_use_custom() const {
+ return debug_use_custom;
+}
+
+void NavigationAgent2D::set_debug_path_custom_color(Color p_color) {
+ debug_path_custom_color = p_color;
+ debug_path_dirty = true;
+}
+
+Color NavigationAgent2D::get_debug_path_custom_color() const {
+ return debug_path_custom_color;
+}
+
+void NavigationAgent2D::set_debug_path_custom_point_size(float p_point_size) {
+ debug_path_custom_point_size = MAX(0.1, p_point_size);
+ debug_path_dirty = true;
+}
+
+float NavigationAgent2D::get_debug_path_custom_point_size() const {
+ return debug_path_custom_point_size;
+}
+
+void NavigationAgent2D::set_debug_path_custom_line_width(float p_line_width) {
+ debug_path_custom_line_width = p_line_width;
+ debug_path_dirty = true;
+}
+
+float NavigationAgent2D::get_debug_path_custom_line_width() const {
+ return debug_path_custom_line_width;
+}
+
+void NavigationAgent2D::_navigation_debug_changed() {
+ debug_path_dirty = true;
+}
+
+void NavigationAgent2D::_update_debug_path() {
+ if (!debug_path_dirty) {
+ return;
+ }
+ debug_path_dirty = false;
+
+ if (!debug_path_instance.is_valid()) {
+ debug_path_instance = RenderingServer::get_singleton()->canvas_item_create();
+ }
+
+ RenderingServer::get_singleton()->canvas_item_clear(debug_path_instance);
+
+ if (!(debug_enabled && NavigationServer2D::get_singleton()->get_debug_navigation_enable_agent_paths())) {
+ return;
+ }
+
+ if (!(agent_parent && agent_parent->is_inside_tree())) {
+ return;
+ }
+
+ RenderingServer::get_singleton()->canvas_item_set_parent(debug_path_instance, agent_parent->get_canvas());
+ RenderingServer::get_singleton()->canvas_item_set_visible(debug_path_instance, agent_parent->is_visible_in_tree());
+
+ const Vector<Vector2> &navigation_path = navigation_result->get_path();
+
+ if (navigation_path.size() <= 1) {
+ return;
+ }
+
+ Color debug_path_color = NavigationServer2D::get_singleton()->get_debug_navigation_agent_path_color();
+ if (debug_use_custom) {
+ debug_path_color = debug_path_custom_color;
+ }
+
+ Vector<Color> debug_path_colors;
+ debug_path_colors.resize(navigation_path.size());
+ debug_path_colors.fill(debug_path_color);
+
+ RenderingServer::get_singleton()->canvas_item_add_polyline(debug_path_instance, navigation_path, debug_path_colors, debug_path_custom_line_width, false);
+
+ float point_size = NavigationServer2D::get_singleton()->get_debug_navigation_agent_path_point_size();
+ float half_point_size = point_size * 0.5;
+
+ if (debug_use_custom) {
+ point_size = debug_path_custom_point_size;
+ half_point_size = debug_path_custom_point_size * 0.5;
+ }
+
+ for (int i = 0; i < navigation_path.size(); i++) {
+ const Vector2 &vert = navigation_path[i];
+ Rect2 path_point_rect = Rect2(vert.x - half_point_size, vert.y - half_point_size, point_size, point_size);
+ RenderingServer::get_singleton()->canvas_item_add_rect(debug_path_instance, path_point_rect, debug_path_color);
+ }
+}
+#endif // DEBUG_ENABLED
diff --git a/scene/2d/navigation_agent_2d.h b/scene/2d/navigation_agent_2d.h
index 9787bb1bdb..8f4a373327 100644
--- a/scene/2d/navigation_agent_2d.h
+++ b/scene/2d/navigation_agent_2d.h
@@ -74,6 +74,20 @@ class NavigationAgent2D : public Node {
// No initialized on purpose
uint32_t update_frame_id = 0;
+#ifdef DEBUG_ENABLED
+ bool debug_enabled = false;
+ bool debug_path_dirty = true;
+ RID debug_path_instance;
+ float debug_path_custom_point_size = 4.0;
+ float debug_path_custom_line_width = 1.0;
+ bool debug_use_custom = false;
+ Color debug_path_custom_color = Color(1.0, 1.0, 1.0, 1.0);
+
+private:
+ void _navigation_debug_changed();
+ void _update_debug_path();
+#endif // DEBUG_ENABLED
+
protected:
static void _bind_methods();
void _notification(int p_what);
@@ -169,6 +183,23 @@ public:
PackedStringArray get_configuration_warnings() const override;
+#ifdef DEBUG_ENABLED
+ void set_debug_enabled(bool p_enabled);
+ bool get_debug_enabled() const;
+
+ void set_debug_use_custom(bool p_enabled);
+ bool get_debug_use_custom() const;
+
+ void set_debug_path_custom_color(Color p_color);
+ Color get_debug_path_custom_color() const;
+
+ void set_debug_path_custom_point_size(float p_point_size);
+ float get_debug_path_custom_point_size() const;
+
+ void set_debug_path_custom_line_width(float p_line_width);
+ float get_debug_path_custom_line_width() const;
+#endif // DEBUG_ENABLED
+
private:
void update_navigation();
void _request_repath();
diff --git a/scene/3d/decal.cpp b/scene/3d/decal.cpp
index fbcb1c8f2c..e122adcc8c 100644
--- a/scene/3d/decal.cpp
+++ b/scene/3d/decal.cpp
@@ -30,14 +30,14 @@
#include "decal.h"
-void Decal::set_extents(const Vector3 &p_extents) {
- extents = p_extents;
- RS::get_singleton()->decal_set_extents(decal, p_extents);
+void Decal::set_size(const Vector3 &p_size) {
+ size = p_size;
+ RS::get_singleton()->decal_set_size(decal, p_size);
update_gizmos();
}
-Vector3 Decal::get_extents() const {
- return extents;
+Vector3 Decal::get_size() const {
+ return size;
}
void Decal::set_texture(DecalTexture p_type, const Ref<Texture2D> &p_texture) {
@@ -147,8 +147,8 @@ uint32_t Decal::get_cull_mask() const {
AABB Decal::get_aabb() const {
AABB aabb;
- aabb.position = -extents;
- aabb.size = extents * 2.0;
+ aabb.position = -size / 2;
+ aabb.size = size;
return aabb;
}
@@ -181,8 +181,8 @@ PackedStringArray Decal::get_configuration_warnings() const {
}
void Decal::_bind_methods() {
- ClassDB::bind_method(D_METHOD("set_extents", "extents"), &Decal::set_extents);
- ClassDB::bind_method(D_METHOD("get_extents"), &Decal::get_extents);
+ ClassDB::bind_method(D_METHOD("set_size", "size"), &Decal::set_size);
+ ClassDB::bind_method(D_METHOD("get_size"), &Decal::get_size);
ClassDB::bind_method(D_METHOD("set_texture", "type", "texture"), &Decal::set_texture);
ClassDB::bind_method(D_METHOD("get_texture", "type"), &Decal::get_texture);
@@ -217,7 +217,7 @@ void Decal::_bind_methods() {
ClassDB::bind_method(D_METHOD("set_cull_mask", "mask"), &Decal::set_cull_mask);
ClassDB::bind_method(D_METHOD("get_cull_mask"), &Decal::get_cull_mask);
- ADD_PROPERTY(PropertyInfo(Variant::VECTOR3, "extents", PROPERTY_HINT_RANGE, "0,1024,0.001,or_greater,suffix:m"), "set_extents", "get_extents");
+ ADD_PROPERTY(PropertyInfo(Variant::VECTOR3, "size", PROPERTY_HINT_RANGE, "0,1024,0.001,or_greater,suffix:m"), "set_size", "get_size");
ADD_GROUP("Textures", "texture_");
ADD_PROPERTYI(PropertyInfo(Variant::OBJECT, "texture_albedo", PROPERTY_HINT_RESOURCE_TYPE, "Texture"), "set_texture", "get_texture", TEXTURE_ALBEDO);
@@ -252,6 +252,24 @@ void Decal::_bind_methods() {
BIND_ENUM_CONSTANT(TEXTURE_MAX);
}
+#ifndef DISABLE_DEPRECATED
+bool Decal::_set(const StringName &p_name, const Variant &p_value) {
+ if (p_name == "extents") { // Compatibility with Godot 3.x.
+ set_size((Vector3)p_value * 2);
+ return true;
+ }
+ return false;
+}
+
+bool Decal::_get(const StringName &p_name, Variant &r_property) const {
+ if (p_name == "extents") { // Compatibility with Godot 3.x.
+ r_property = size / 2;
+ return true;
+ }
+ return false;
+}
+#endif // DISABLE_DEPRECATED
+
Decal::Decal() {
decal = RenderingServer::get_singleton()->decal_create();
RS::get_singleton()->instance_set_base(get_instance(), decal);
diff --git a/scene/3d/decal.h b/scene/3d/decal.h
index 5797a2f645..171b52815a 100644
--- a/scene/3d/decal.h
+++ b/scene/3d/decal.h
@@ -47,7 +47,7 @@ public:
private:
RID decal;
- Vector3 extents = Vector3(1, 1, 1);
+ Vector3 size = Vector3(2, 2, 2);
Ref<Texture2D> textures[TEXTURE_MAX];
real_t emission_energy = 1.0;
real_t albedo_mix = 1.0;
@@ -63,12 +63,16 @@ private:
protected:
static void _bind_methods();
void _validate_property(PropertyInfo &p_property) const;
+#ifndef DISABLE_DEPRECATED
+ bool _set(const StringName &p_name, const Variant &p_value);
+ bool _get(const StringName &p_name, Variant &r_property) const;
+#endif // DISABLE_DEPRECATED
public:
virtual PackedStringArray get_configuration_warnings() const override;
- void set_extents(const Vector3 &p_extents);
- Vector3 get_extents() const;
+ void set_size(const Vector3 &p_size);
+ Vector3 get_size() const;
void set_texture(DecalTexture p_type, const Ref<Texture2D> &p_texture);
Ref<Texture2D> get_texture(DecalTexture p_type) const;
diff --git a/scene/3d/fog_volume.cpp b/scene/3d/fog_volume.cpp
index 30dfb45836..9b0a7bb302 100644
--- a/scene/3d/fog_volume.cpp
+++ b/scene/3d/fog_volume.cpp
@@ -34,36 +34,54 @@
///////////////////////////
void FogVolume::_bind_methods() {
- ClassDB::bind_method(D_METHOD("set_extents", "extents"), &FogVolume::set_extents);
- ClassDB::bind_method(D_METHOD("get_extents"), &FogVolume::get_extents);
+ ClassDB::bind_method(D_METHOD("set_size", "size"), &FogVolume::set_size);
+ ClassDB::bind_method(D_METHOD("get_size"), &FogVolume::get_size);
ClassDB::bind_method(D_METHOD("set_shape", "shape"), &FogVolume::set_shape);
ClassDB::bind_method(D_METHOD("get_shape"), &FogVolume::get_shape);
ClassDB::bind_method(D_METHOD("set_material", "material"), &FogVolume::set_material);
ClassDB::bind_method(D_METHOD("get_material"), &FogVolume::get_material);
- ADD_PROPERTY(PropertyInfo(Variant::VECTOR3, "extents", PROPERTY_HINT_RANGE, "0.01,1024,0.01,or_greater,suffix:m"), "set_extents", "get_extents");
+ ADD_PROPERTY(PropertyInfo(Variant::VECTOR3, "size", PROPERTY_HINT_RANGE, "0.01,1024,0.01,or_greater,suffix:m"), "set_size", "get_size");
ADD_PROPERTY(PropertyInfo(Variant::INT, "shape", PROPERTY_HINT_ENUM, "Ellipsoid (Local),Cone (Local),Cylinder (Local),Box (Local),World (Global)"), "set_shape", "get_shape");
ADD_PROPERTY(PropertyInfo(Variant::OBJECT, "material", PROPERTY_HINT_RESOURCE_TYPE, "FogMaterial,ShaderMaterial"), "set_material", "get_material");
}
void FogVolume::_validate_property(PropertyInfo &p_property) const {
- if (p_property.name == "extents" && shape == RS::FOG_VOLUME_SHAPE_WORLD) {
+ if (p_property.name == "size" && shape == RS::FOG_VOLUME_SHAPE_WORLD) {
p_property.usage = PROPERTY_USAGE_NONE;
return;
}
}
-void FogVolume::set_extents(const Vector3 &p_extents) {
- extents = p_extents;
- extents.x = MAX(0.0, extents.x);
- extents.y = MAX(0.0, extents.y);
- extents.z = MAX(0.0, extents.z);
- RS::get_singleton()->fog_volume_set_extents(_get_volume(), extents);
+#ifndef DISABLE_DEPRECATED
+bool FogVolume::_set(const StringName &p_name, const Variant &p_value) {
+ if (p_name == "extents") { // Compatibility with Godot 3.x.
+ set_size((Vector3)p_value * 2);
+ return true;
+ }
+ return false;
+}
+
+bool FogVolume::_get(const StringName &p_name, Variant &r_property) const {
+ if (p_name == "extents") { // Compatibility with Godot 3.x.
+ r_property = size / 2;
+ return true;
+ }
+ return false;
+}
+#endif // DISABLE_DEPRECATED
+
+void FogVolume::set_size(const Vector3 &p_size) {
+ size = p_size;
+ size.x = MAX(0.0, size.x);
+ size.y = MAX(0.0, size.y);
+ size.z = MAX(0.0, size.z);
+ RS::get_singleton()->fog_volume_set_size(_get_volume(), size);
update_gizmos();
}
-Vector3 FogVolume::get_extents() const {
- return extents;
+Vector3 FogVolume::get_size() const {
+ return size;
}
void FogVolume::set_shape(RS::FogVolumeShape p_type) {
@@ -94,7 +112,7 @@ Ref<Material> FogVolume::get_material() const {
AABB FogVolume::get_aabb() const {
if (shape != RS::FOG_VOLUME_SHAPE_WORLD) {
- return AABB(-extents, extents * 2);
+ return AABB(-size / 2, size);
}
return AABB();
}
diff --git a/scene/3d/fog_volume.h b/scene/3d/fog_volume.h
index fa02834762..f7e861e3d0 100644
--- a/scene/3d/fog_volume.h
+++ b/scene/3d/fog_volume.h
@@ -40,7 +40,7 @@
class FogVolume : public VisualInstance3D {
GDCLASS(FogVolume, VisualInstance3D);
- Vector3 extents = Vector3(1, 1, 1);
+ Vector3 size = Vector3(2, 2, 2);
Ref<Material> material;
RS::FogVolumeShape shape = RS::FOG_VOLUME_SHAPE_BOX;
@@ -50,10 +50,14 @@ protected:
_FORCE_INLINE_ RID _get_volume() { return volume; }
static void _bind_methods();
void _validate_property(PropertyInfo &p_property) const;
+#ifndef DISABLE_DEPRECATED
+ bool _set(const StringName &p_name, const Variant &p_value);
+ bool _get(const StringName &p_name, Variant &r_property) const;
+#endif // DISABLE_DEPRECATED
public:
- void set_extents(const Vector3 &p_extents);
- Vector3 get_extents() const;
+ void set_size(const Vector3 &p_size);
+ Vector3 get_size() const;
void set_shape(RS::FogVolumeShape p_type);
RS::FogVolumeShape get_shape() const;
diff --git a/scene/3d/gpu_particles_collision_3d.cpp b/scene/3d/gpu_particles_collision_3d.cpp
index d1f2dfb25f..137d578291 100644
--- a/scene/3d/gpu_particles_collision_3d.cpp
+++ b/scene/3d/gpu_particles_collision_3d.cpp
@@ -95,24 +95,42 @@ GPUParticlesCollisionSphere3D::~GPUParticlesCollisionSphere3D() {
///////////////////////////
void GPUParticlesCollisionBox3D::_bind_methods() {
- ClassDB::bind_method(D_METHOD("set_extents", "extents"), &GPUParticlesCollisionBox3D::set_extents);
- ClassDB::bind_method(D_METHOD("get_extents"), &GPUParticlesCollisionBox3D::get_extents);
+ ClassDB::bind_method(D_METHOD("set_size", "size"), &GPUParticlesCollisionBox3D::set_size);
+ ClassDB::bind_method(D_METHOD("get_size"), &GPUParticlesCollisionBox3D::get_size);
- ADD_PROPERTY(PropertyInfo(Variant::VECTOR3, "extents", PROPERTY_HINT_RANGE, "0.01,1024,0.01,or_greater,suffix:m"), "set_extents", "get_extents");
+ ADD_PROPERTY(PropertyInfo(Variant::VECTOR3, "size", PROPERTY_HINT_RANGE, "0.01,1024,0.01,or_greater,suffix:m"), "set_size", "get_size");
}
-void GPUParticlesCollisionBox3D::set_extents(const Vector3 &p_extents) {
- extents = p_extents;
- RS::get_singleton()->particles_collision_set_box_extents(_get_collision(), extents);
+#ifndef DISABLE_DEPRECATED
+bool GPUParticlesCollisionBox3D::_set(const StringName &p_name, const Variant &p_value) {
+ if (p_name == "extents") { // Compatibility with Godot 3.x.
+ set_size((Vector3)p_value * 2);
+ return true;
+ }
+ return false;
+}
+
+bool GPUParticlesCollisionBox3D::_get(const StringName &p_name, Variant &r_property) const {
+ if (p_name == "extents") { // Compatibility with Godot 3.x.
+ r_property = size / 2;
+ return true;
+ }
+ return false;
+}
+#endif // DISABLE_DEPRECATED
+
+void GPUParticlesCollisionBox3D::set_size(const Vector3 &p_size) {
+ size = p_size;
+ RS::get_singleton()->particles_collision_set_box_extents(_get_collision(), size / 2);
update_gizmos();
}
-Vector3 GPUParticlesCollisionBox3D::get_extents() const {
- return extents;
+Vector3 GPUParticlesCollisionBox3D::get_size() const {
+ return size;
}
AABB GPUParticlesCollisionBox3D::get_aabb() const {
- return AABB(-extents, extents * 2);
+ return AABB(-size / 2, size);
}
GPUParticlesCollisionBox3D::GPUParticlesCollisionBox3D() :
@@ -359,7 +377,7 @@ Vector3i GPUParticlesCollisionSDF3D::get_estimated_cell_size() const {
static const int subdivs[RESOLUTION_MAX] = { 16, 32, 64, 128, 256, 512 };
int subdiv = subdivs[get_resolution()];
- AABB aabb(-extents, extents * 2);
+ AABB aabb(-size / 2, size);
float cell_size = aabb.get_longest_axis_size() / float(subdiv);
@@ -374,7 +392,7 @@ Ref<Image> GPUParticlesCollisionSDF3D::bake() {
static const int subdivs[RESOLUTION_MAX] = { 16, 32, 64, 128, 256, 512 };
int subdiv = subdivs[get_resolution()];
- AABB aabb(-extents, extents * 2);
+ AABB aabb(-size / 2, size);
float cell_size = aabb.get_longest_axis_size() / float(subdiv);
@@ -515,8 +533,8 @@ PackedStringArray GPUParticlesCollisionSDF3D::get_configuration_warnings() const
}
void GPUParticlesCollisionSDF3D::_bind_methods() {
- ClassDB::bind_method(D_METHOD("set_extents", "extents"), &GPUParticlesCollisionSDF3D::set_extents);
- ClassDB::bind_method(D_METHOD("get_extents"), &GPUParticlesCollisionSDF3D::get_extents);
+ ClassDB::bind_method(D_METHOD("set_size", "size"), &GPUParticlesCollisionSDF3D::set_size);
+ ClassDB::bind_method(D_METHOD("get_size"), &GPUParticlesCollisionSDF3D::get_size);
ClassDB::bind_method(D_METHOD("set_resolution", "resolution"), &GPUParticlesCollisionSDF3D::set_resolution);
ClassDB::bind_method(D_METHOD("get_resolution"), &GPUParticlesCollisionSDF3D::get_resolution);
@@ -532,7 +550,7 @@ void GPUParticlesCollisionSDF3D::_bind_methods() {
ClassDB::bind_method(D_METHOD("set_bake_mask_value", "layer_number", "value"), &GPUParticlesCollisionSDF3D::set_bake_mask_value);
ClassDB::bind_method(D_METHOD("get_bake_mask_value", "layer_number"), &GPUParticlesCollisionSDF3D::get_bake_mask_value);
- ADD_PROPERTY(PropertyInfo(Variant::VECTOR3, "extents", PROPERTY_HINT_RANGE, "0.01,1024,0.01,or_greater,suffix:m"), "set_extents", "get_extents");
+ ADD_PROPERTY(PropertyInfo(Variant::VECTOR3, "size", PROPERTY_HINT_RANGE, "0.01,1024,0.01,or_greater,suffix:m"), "set_size", "get_size");
ADD_PROPERTY(PropertyInfo(Variant::INT, "resolution", PROPERTY_HINT_ENUM, "16,32,64,128,256,512"), "set_resolution", "get_resolution");
ADD_PROPERTY(PropertyInfo(Variant::FLOAT, "thickness", PROPERTY_HINT_RANGE, "0.0,2.0,0.01,suffix:m"), "set_thickness", "get_thickness");
ADD_PROPERTY(PropertyInfo(Variant::INT, "bake_mask", PROPERTY_HINT_LAYERS_3D_RENDER), "set_bake_mask", "get_bake_mask");
@@ -547,6 +565,24 @@ void GPUParticlesCollisionSDF3D::_bind_methods() {
BIND_ENUM_CONSTANT(RESOLUTION_MAX);
}
+#ifndef DISABLE_DEPRECATED
+bool GPUParticlesCollisionSDF3D::_set(const StringName &p_name, const Variant &p_value) {
+ if (p_name == "extents") { // Compatibility with Godot 3.x.
+ set_size((Vector3)p_value * 2);
+ return true;
+ }
+ return false;
+}
+
+bool GPUParticlesCollisionSDF3D::_get(const StringName &p_name, Variant &r_property) const {
+ if (p_name == "extents") { // Compatibility with Godot 3.x.
+ r_property = size / 2;
+ return true;
+ }
+ return false;
+}
+#endif // DISABLE_DEPRECATED
+
void GPUParticlesCollisionSDF3D::set_thickness(float p_thickness) {
thickness = p_thickness;
}
@@ -555,14 +591,14 @@ float GPUParticlesCollisionSDF3D::get_thickness() const {
return thickness;
}
-void GPUParticlesCollisionSDF3D::set_extents(const Vector3 &p_extents) {
- extents = p_extents;
- RS::get_singleton()->particles_collision_set_box_extents(_get_collision(), extents);
+void GPUParticlesCollisionSDF3D::set_size(const Vector3 &p_size) {
+ size = p_size;
+ RS::get_singleton()->particles_collision_set_box_extents(_get_collision(), size / 2);
update_gizmos();
}
-Vector3 GPUParticlesCollisionSDF3D::get_extents() const {
- return extents;
+Vector3 GPUParticlesCollisionSDF3D::get_size() const {
+ return size;
}
void GPUParticlesCollisionSDF3D::set_resolution(Resolution p_resolution) {
@@ -610,7 +646,7 @@ Ref<Texture3D> GPUParticlesCollisionSDF3D::get_texture() const {
}
AABB GPUParticlesCollisionSDF3D::get_aabb() const {
- return AABB(-extents, extents * 2);
+ return AABB(-size / 2, size);
}
GPUParticlesCollisionSDF3D::BakeBeginFunc GPUParticlesCollisionSDF3D::bake_begin_function = nullptr;
@@ -675,8 +711,8 @@ void GPUParticlesCollisionHeightField3D::_notification(int p_what) {
}
void GPUParticlesCollisionHeightField3D::_bind_methods() {
- ClassDB::bind_method(D_METHOD("set_extents", "extents"), &GPUParticlesCollisionHeightField3D::set_extents);
- ClassDB::bind_method(D_METHOD("get_extents"), &GPUParticlesCollisionHeightField3D::get_extents);
+ ClassDB::bind_method(D_METHOD("set_size", "size"), &GPUParticlesCollisionHeightField3D::set_size);
+ ClassDB::bind_method(D_METHOD("get_size"), &GPUParticlesCollisionHeightField3D::get_size);
ClassDB::bind_method(D_METHOD("set_resolution", "resolution"), &GPUParticlesCollisionHeightField3D::set_resolution);
ClassDB::bind_method(D_METHOD("get_resolution"), &GPUParticlesCollisionHeightField3D::get_resolution);
@@ -687,7 +723,7 @@ void GPUParticlesCollisionHeightField3D::_bind_methods() {
ClassDB::bind_method(D_METHOD("set_follow_camera_enabled", "enabled"), &GPUParticlesCollisionHeightField3D::set_follow_camera_enabled);
ClassDB::bind_method(D_METHOD("is_follow_camera_enabled"), &GPUParticlesCollisionHeightField3D::is_follow_camera_enabled);
- ADD_PROPERTY(PropertyInfo(Variant::VECTOR3, "extents", PROPERTY_HINT_RANGE, "0.01,1024,0.01,or_greater,suffix:m"), "set_extents", "get_extents");
+ ADD_PROPERTY(PropertyInfo(Variant::VECTOR3, "size", PROPERTY_HINT_RANGE, "0.01,1024,0.01,or_greater,suffix:m"), "set_size", "get_size");
ADD_PROPERTY(PropertyInfo(Variant::INT, "resolution", PROPERTY_HINT_ENUM, "256 (Fastest),512 (Fast),1024 (Average),2048 (Slow),4096 (Slower),8192 (Slowest)"), "set_resolution", "get_resolution");
ADD_PROPERTY(PropertyInfo(Variant::INT, "update_mode", PROPERTY_HINT_ENUM, "When Moved (Fast),Always (Slow)"), "set_update_mode", "get_update_mode");
ADD_PROPERTY(PropertyInfo(Variant::BOOL, "follow_camera_enabled"), "set_follow_camera_enabled", "is_follow_camera_enabled");
@@ -704,15 +740,33 @@ void GPUParticlesCollisionHeightField3D::_bind_methods() {
BIND_ENUM_CONSTANT(UPDATE_MODE_ALWAYS);
}
-void GPUParticlesCollisionHeightField3D::set_extents(const Vector3 &p_extents) {
- extents = p_extents;
- RS::get_singleton()->particles_collision_set_box_extents(_get_collision(), extents);
+#ifndef DISABLE_DEPRECATED
+bool GPUParticlesCollisionHeightField3D::_set(const StringName &p_name, const Variant &p_value) {
+ if (p_name == "extents") { // Compatibility with Godot 3.x.
+ set_size((Vector3)p_value * 2);
+ return true;
+ }
+ return false;
+}
+
+bool GPUParticlesCollisionHeightField3D::_get(const StringName &p_name, Variant &r_property) const {
+ if (p_name == "extents") { // Compatibility with Godot 3.x.
+ r_property = size / 2;
+ return true;
+ }
+ return false;
+}
+#endif // DISABLE_DEPRECATED
+
+void GPUParticlesCollisionHeightField3D::set_size(const Vector3 &p_size) {
+ size = p_size;
+ RS::get_singleton()->particles_collision_set_box_extents(_get_collision(), size / 2);
update_gizmos();
RS::get_singleton()->particles_collision_height_field_update(_get_collision());
}
-Vector3 GPUParticlesCollisionHeightField3D::get_extents() const {
- return extents;
+Vector3 GPUParticlesCollisionHeightField3D::get_size() const {
+ return size;
}
void GPUParticlesCollisionHeightField3D::set_resolution(Resolution p_resolution) {
@@ -745,7 +799,7 @@ bool GPUParticlesCollisionHeightField3D::is_follow_camera_enabled() const {
}
AABB GPUParticlesCollisionHeightField3D::get_aabb() const {
- return AABB(-extents, extents * 2);
+ return AABB(-size / 2, size);
}
GPUParticlesCollisionHeightField3D::GPUParticlesCollisionHeightField3D() :
@@ -857,24 +911,42 @@ GPUParticlesAttractorSphere3D::~GPUParticlesAttractorSphere3D() {
///////////////////////////
void GPUParticlesAttractorBox3D::_bind_methods() {
- ClassDB::bind_method(D_METHOD("set_extents", "extents"), &GPUParticlesAttractorBox3D::set_extents);
- ClassDB::bind_method(D_METHOD("get_extents"), &GPUParticlesAttractorBox3D::get_extents);
+ ClassDB::bind_method(D_METHOD("set_size", "size"), &GPUParticlesAttractorBox3D::set_size);
+ ClassDB::bind_method(D_METHOD("get_size"), &GPUParticlesAttractorBox3D::get_size);
+
+ ADD_PROPERTY(PropertyInfo(Variant::VECTOR3, "size", PROPERTY_HINT_RANGE, "0.01,1024,0.01,or_greater,suffix:m"), "set_size", "get_size");
+}
- ADD_PROPERTY(PropertyInfo(Variant::VECTOR3, "extents", PROPERTY_HINT_RANGE, "0.01,1024,0.01,or_greater,suffix:m"), "set_extents", "get_extents");
+#ifndef DISABLE_DEPRECATED
+bool GPUParticlesAttractorBox3D::_set(const StringName &p_name, const Variant &p_value) {
+ if (p_name == "extents") { // Compatibility with Godot 3.x.
+ set_size((Vector3)p_value * 2);
+ return true;
+ }
+ return false;
}
-void GPUParticlesAttractorBox3D::set_extents(const Vector3 &p_extents) {
- extents = p_extents;
- RS::get_singleton()->particles_collision_set_box_extents(_get_collision(), extents);
+bool GPUParticlesAttractorBox3D::_get(const StringName &p_name, Variant &r_property) const {
+ if (p_name == "extents") { // Compatibility with Godot 3.x.
+ r_property = size / 2;
+ return true;
+ }
+ return false;
+}
+#endif // DISABLE_DEPRECATED
+
+void GPUParticlesAttractorBox3D::set_size(const Vector3 &p_size) {
+ size = p_size;
+ RS::get_singleton()->particles_collision_set_box_extents(_get_collision(), size / 2);
update_gizmos();
}
-Vector3 GPUParticlesAttractorBox3D::get_extents() const {
- return extents;
+Vector3 GPUParticlesAttractorBox3D::get_size() const {
+ return size;
}
AABB GPUParticlesAttractorBox3D::get_aabb() const {
- return AABB(-extents, extents * 2);
+ return AABB(-size / 2, size);
}
GPUParticlesAttractorBox3D::GPUParticlesAttractorBox3D() :
@@ -887,24 +959,42 @@ GPUParticlesAttractorBox3D::~GPUParticlesAttractorBox3D() {
///////////////////////////
void GPUParticlesAttractorVectorField3D::_bind_methods() {
- ClassDB::bind_method(D_METHOD("set_extents", "extents"), &GPUParticlesAttractorVectorField3D::set_extents);
- ClassDB::bind_method(D_METHOD("get_extents"), &GPUParticlesAttractorVectorField3D::get_extents);
+ ClassDB::bind_method(D_METHOD("set_size", "size"), &GPUParticlesAttractorVectorField3D::set_size);
+ ClassDB::bind_method(D_METHOD("get_size"), &GPUParticlesAttractorVectorField3D::get_size);
ClassDB::bind_method(D_METHOD("set_texture", "texture"), &GPUParticlesAttractorVectorField3D::set_texture);
ClassDB::bind_method(D_METHOD("get_texture"), &GPUParticlesAttractorVectorField3D::get_texture);
- ADD_PROPERTY(PropertyInfo(Variant::VECTOR3, "extents", PROPERTY_HINT_RANGE, "0.01,1024,0.01,or_greater,suffix:m"), "set_extents", "get_extents");
+ ADD_PROPERTY(PropertyInfo(Variant::VECTOR3, "size", PROPERTY_HINT_RANGE, "0.01,1024,0.01,or_greater,suffix:m"), "set_size", "get_size");
ADD_PROPERTY(PropertyInfo(Variant::OBJECT, "texture", PROPERTY_HINT_RESOURCE_TYPE, "Texture3D"), "set_texture", "get_texture");
}
-void GPUParticlesAttractorVectorField3D::set_extents(const Vector3 &p_extents) {
- extents = p_extents;
- RS::get_singleton()->particles_collision_set_box_extents(_get_collision(), extents);
+#ifndef DISABLE_DEPRECATED
+bool GPUParticlesAttractorVectorField3D::_set(const StringName &p_name, const Variant &p_value) {
+ if (p_name == "extents") { // Compatibility with Godot 3.x.
+ set_size((Vector3)p_value * 2);
+ return true;
+ }
+ return false;
+}
+
+bool GPUParticlesAttractorVectorField3D::_get(const StringName &p_name, Variant &r_property) const {
+ if (p_name == "extents") { // Compatibility with Godot 3.x.
+ r_property = size / 2;
+ return true;
+ }
+ return false;
+}
+#endif // DISABLE_DEPRECATED
+
+void GPUParticlesAttractorVectorField3D::set_size(const Vector3 &p_size) {
+ size = p_size;
+ RS::get_singleton()->particles_collision_set_box_extents(_get_collision(), size / 2);
update_gizmos();
}
-Vector3 GPUParticlesAttractorVectorField3D::get_extents() const {
- return extents;
+Vector3 GPUParticlesAttractorVectorField3D::get_size() const {
+ return size;
}
void GPUParticlesAttractorVectorField3D::set_texture(const Ref<Texture3D> &p_texture) {
@@ -918,7 +1008,7 @@ Ref<Texture3D> GPUParticlesAttractorVectorField3D::get_texture() const {
}
AABB GPUParticlesAttractorVectorField3D::get_aabb() const {
- return AABB(-extents, extents * 2);
+ return AABB(-size / 2, size);
}
GPUParticlesAttractorVectorField3D::GPUParticlesAttractorVectorField3D() :
diff --git a/scene/3d/gpu_particles_collision_3d.h b/scene/3d/gpu_particles_collision_3d.h
index 3c569ac73d..1649320069 100644
--- a/scene/3d/gpu_particles_collision_3d.h
+++ b/scene/3d/gpu_particles_collision_3d.h
@@ -74,14 +74,18 @@ public:
class GPUParticlesCollisionBox3D : public GPUParticlesCollision3D {
GDCLASS(GPUParticlesCollisionBox3D, GPUParticlesCollision3D);
- Vector3 extents = Vector3(1, 1, 1);
+ Vector3 size = Vector3(2, 2, 2);
protected:
static void _bind_methods();
+#ifndef DISABLE_DEPRECATED
+ bool _set(const StringName &p_name, const Variant &p_value);
+ bool _get(const StringName &p_name, Variant &r_property) const;
+#endif // DISABLE_DEPRECATED
public:
- void set_extents(const Vector3 &p_extents);
- Vector3 get_extents() const;
+ void set_size(const Vector3 &p_size);
+ Vector3 get_size() const;
virtual AABB get_aabb() const override;
@@ -108,7 +112,7 @@ public:
typedef void (*BakeEndFunc)();
private:
- Vector3 extents = Vector3(1, 1, 1);
+ Vector3 size = Vector3(2, 2, 2);
Resolution resolution = RESOLUTION_64;
uint32_t bake_mask = 0xFFFFFFFF;
Ref<Texture3D> texture;
@@ -160,6 +164,10 @@ private:
protected:
static void _bind_methods();
+#ifndef DISABLE_DEPRECATED
+ bool _set(const StringName &p_name, const Variant &p_value);
+ bool _get(const StringName &p_name, Variant &r_property) const;
+#endif // DISABLE_DEPRECATED
public:
virtual PackedStringArray get_configuration_warnings() const override;
@@ -167,8 +175,8 @@ public:
void set_thickness(float p_thickness);
float get_thickness() const;
- void set_extents(const Vector3 &p_extents);
- Vector3 get_extents() const;
+ void set_size(const Vector3 &p_size);
+ Vector3 get_size() const;
void set_resolution(Resolution p_resolution);
Resolution get_resolution() const;
@@ -217,7 +225,7 @@ public:
};
private:
- Vector3 extents = Vector3(1, 1, 1);
+ Vector3 size = Vector3(2, 2, 2);
Resolution resolution = RESOLUTION_1024;
bool follow_camera_mode = false;
@@ -226,10 +234,14 @@ private:
protected:
void _notification(int p_what);
static void _bind_methods();
+#ifndef DISABLE_DEPRECATED
+ bool _set(const StringName &p_name, const Variant &p_value);
+ bool _get(const StringName &p_name, Variant &r_property) const;
+#endif // DISABLE_DEPRECATED
public:
- void set_extents(const Vector3 &p_extents);
- Vector3 get_extents() const;
+ void set_size(const Vector3 &p_size);
+ Vector3 get_size() const;
void set_resolution(Resolution p_resolution);
Resolution get_resolution() const;
@@ -301,14 +313,18 @@ public:
class GPUParticlesAttractorBox3D : public GPUParticlesAttractor3D {
GDCLASS(GPUParticlesAttractorBox3D, GPUParticlesAttractor3D);
- Vector3 extents = Vector3(1, 1, 1);
+ Vector3 size = Vector3(2, 2, 2);
protected:
static void _bind_methods();
+#ifndef DISABLE_DEPRECATED
+ bool _set(const StringName &p_name, const Variant &p_value);
+ bool _get(const StringName &p_name, Variant &r_property) const;
+#endif // DISABLE_DEPRECATED
public:
- void set_extents(const Vector3 &p_extents);
- Vector3 get_extents() const;
+ void set_size(const Vector3 &p_size);
+ Vector3 get_size() const;
virtual AABB get_aabb() const override;
@@ -319,15 +335,19 @@ public:
class GPUParticlesAttractorVectorField3D : public GPUParticlesAttractor3D {
GDCLASS(GPUParticlesAttractorVectorField3D, GPUParticlesAttractor3D);
- Vector3 extents = Vector3(1, 1, 1);
+ Vector3 size = Vector3(2, 2, 2);
Ref<Texture3D> texture;
protected:
static void _bind_methods();
+#ifndef DISABLE_DEPRECATED
+ bool _set(const StringName &p_name, const Variant &p_value);
+ bool _get(const StringName &p_name, Variant &r_property) const;
+#endif // DISABLE_DEPRECATED
public:
- void set_extents(const Vector3 &p_extents);
- Vector3 get_extents() const;
+ void set_size(const Vector3 &p_size);
+ Vector3 get_size() const;
void set_texture(const Ref<Texture3D> &p_texture);
Ref<Texture3D> get_texture() const;
diff --git a/scene/3d/navigation_agent_3d.cpp b/scene/3d/navigation_agent_3d.cpp
index 4aa6e61ec5..1ffabbb6da 100644
--- a/scene/3d/navigation_agent_3d.cpp
+++ b/scene/3d/navigation_agent_3d.cpp
@@ -120,15 +120,38 @@ void NavigationAgent3D::_bind_methods() {
ADD_SIGNAL(MethodInfo("link_reached", PropertyInfo(Variant::DICTIONARY, "details")));
ADD_SIGNAL(MethodInfo("navigation_finished"));
ADD_SIGNAL(MethodInfo("velocity_computed", PropertyInfo(Variant::VECTOR3, "safe_velocity")));
+
+#ifdef DEBUG_ENABLED
+ ClassDB::bind_method(D_METHOD("set_debug_enabled", "enabled"), &NavigationAgent3D::set_debug_enabled);
+ ClassDB::bind_method(D_METHOD("get_debug_enabled"), &NavigationAgent3D::get_debug_enabled);
+ ClassDB::bind_method(D_METHOD("set_debug_use_custom", "enabled"), &NavigationAgent3D::set_debug_use_custom);
+ ClassDB::bind_method(D_METHOD("get_debug_use_custom"), &NavigationAgent3D::get_debug_use_custom);
+ ClassDB::bind_method(D_METHOD("set_debug_path_custom_color", "color"), &NavigationAgent3D::set_debug_path_custom_color);
+ ClassDB::bind_method(D_METHOD("get_debug_path_custom_color"), &NavigationAgent3D::get_debug_path_custom_color);
+ ClassDB::bind_method(D_METHOD("set_debug_path_custom_point_size", "point_size"), &NavigationAgent3D::set_debug_path_custom_point_size);
+ ClassDB::bind_method(D_METHOD("get_debug_path_custom_point_size"), &NavigationAgent3D::get_debug_path_custom_point_size);
+
+ ADD_GROUP("Debug", "");
+ ADD_PROPERTY(PropertyInfo(Variant::BOOL, "debug_enabled"), "set_debug_enabled", "get_debug_enabled");
+ ADD_PROPERTY(PropertyInfo(Variant::BOOL, "debug_use_custom"), "set_debug_use_custom", "get_debug_use_custom");
+ ADD_PROPERTY(PropertyInfo(Variant::COLOR, "debug_path_custom_color"), "set_debug_path_custom_color", "get_debug_path_custom_color");
+ ADD_PROPERTY(PropertyInfo(Variant::FLOAT, "debug_path_custom_point_size", PROPERTY_HINT_RANGE, "1,50,1,suffix:px"), "set_debug_path_custom_point_size", "get_debug_path_custom_point_size");
+#endif // DEBUG_ENABLED
}
void NavigationAgent3D::_notification(int p_what) {
switch (p_what) {
case NOTIFICATION_POST_ENTER_TREE: {
// need to use POST_ENTER_TREE cause with normal ENTER_TREE not all required Nodes are ready.
- // cannot use READY as ready does not get called if Node is readded to SceneTree
+ // cannot use READY as ready does not get called if Node is re-added to SceneTree
set_agent_parent(get_parent());
set_physics_process_internal(true);
+
+#ifdef DEBUG_ENABLED
+ if (NavigationServer3D::get_singleton()->get_debug_enabled()) {
+ debug_path_dirty = true;
+ }
+#endif // DEBUG_ENABLED
} break;
case NOTIFICATION_PARENTED: {
@@ -151,6 +174,12 @@ void NavigationAgent3D::_notification(int p_what) {
case NOTIFICATION_EXIT_TREE: {
set_agent_parent(nullptr);
set_physics_process_internal(false);
+
+#ifdef DEBUG_ENABLED
+ if (debug_path_instance.is_valid()) {
+ RS::get_singleton()->instance_set_visible(debug_path_instance, false);
+ }
+#endif // DEBUG_ENABLED
} break;
case NOTIFICATION_PAUSED: {
@@ -182,6 +211,11 @@ void NavigationAgent3D::_notification(int p_what) {
}
_check_distance_to_target();
}
+#ifdef DEBUG_ENABLED
+ if (debug_path_dirty) {
+ _update_debug_path();
+ }
+#endif // DEBUG_ENABLED
} break;
}
}
@@ -201,12 +235,28 @@ NavigationAgent3D::NavigationAgent3D() {
navigation_result = Ref<NavigationPathQueryResult3D>();
navigation_result.instantiate();
+
+#ifdef DEBUG_ENABLED
+ NavigationServer3D::get_singleton()->connect(SNAME("navigation_debug_changed"), callable_mp(this, &NavigationAgent3D::_navigation_debug_changed));
+#endif // DEBUG_ENABLED
}
NavigationAgent3D::~NavigationAgent3D() {
ERR_FAIL_NULL(NavigationServer3D::get_singleton());
NavigationServer3D::get_singleton()->free(agent);
agent = RID(); // Pointless
+
+#ifdef DEBUG_ENABLED
+ NavigationServer3D::get_singleton()->disconnect(SNAME("navigation_debug_changed"), callable_mp(this, &NavigationAgent3D::_navigation_debug_changed));
+
+ ERR_FAIL_NULL(RenderingServer::get_singleton());
+ if (debug_path_instance.is_valid()) {
+ RenderingServer::get_singleton()->free(debug_path_instance);
+ }
+ if (debug_path_mesh.is_valid()) {
+ RenderingServer::get_singleton()->free(debug_path_mesh->get_rid());
+ }
+#endif // DEBUG_ENABLED
}
void NavigationAgent3D::set_avoidance_enabled(bool p_enabled) {
@@ -480,6 +530,9 @@ void NavigationAgent3D::update_navigation() {
}
NavigationServer3D::get_singleton()->query_path(navigation_query, navigation_result);
+#ifdef DEBUG_ENABLED
+ debug_path_dirty = true;
+#endif // DEBUG_ENABLED
navigation_finished = false;
navigation_path_index = 0;
emit_signal(SNAME("path_changed"));
@@ -566,3 +619,130 @@ void NavigationAgent3D::_check_distance_to_target() {
}
}
}
+
+////////DEBUG////////////////////////////////////////////////////////////
+
+#ifdef DEBUG_ENABLED
+void NavigationAgent3D::set_debug_enabled(bool p_enabled) {
+ debug_enabled = p_enabled;
+ debug_path_dirty = true;
+}
+
+bool NavigationAgent3D::get_debug_enabled() const {
+ return debug_enabled;
+}
+
+void NavigationAgent3D::set_debug_use_custom(bool p_enabled) {
+ debug_use_custom = p_enabled;
+ debug_path_dirty = true;
+}
+
+bool NavigationAgent3D::get_debug_use_custom() const {
+ return debug_use_custom;
+}
+
+void NavigationAgent3D::set_debug_path_custom_color(Color p_color) {
+ debug_path_custom_color = p_color;
+ debug_path_dirty = true;
+}
+
+Color NavigationAgent3D::get_debug_path_custom_color() const {
+ return debug_path_custom_color;
+}
+
+void NavigationAgent3D::set_debug_path_custom_point_size(float p_point_size) {
+ debug_path_custom_point_size = p_point_size;
+ debug_path_dirty = true;
+}
+
+float NavigationAgent3D::get_debug_path_custom_point_size() const {
+ return debug_path_custom_point_size;
+}
+
+void NavigationAgent3D::_navigation_debug_changed() {
+ debug_path_dirty = true;
+}
+
+void NavigationAgent3D::_update_debug_path() {
+ if (!debug_path_dirty) {
+ return;
+ }
+ debug_path_dirty = false;
+
+ if (!debug_path_instance.is_valid()) {
+ debug_path_instance = RenderingServer::get_singleton()->instance_create();
+ }
+
+ if (!debug_path_mesh.is_valid()) {
+ debug_path_mesh = Ref<ArrayMesh>(memnew(ArrayMesh));
+ }
+
+ debug_path_mesh->clear_surfaces();
+
+ if (!(debug_enabled && NavigationServer3D::get_singleton()->get_debug_navigation_enable_agent_paths())) {
+ return;
+ }
+
+ if (!(agent_parent && agent_parent->is_inside_tree())) {
+ return;
+ }
+
+ const Vector<Vector3> &navigation_path = navigation_result->get_path();
+
+ if (navigation_path.size() <= 1) {
+ return;
+ }
+
+ Vector<Vector3> debug_path_lines_vertex_array;
+
+ for (int i = 0; i < navigation_path.size() - 1; i++) {
+ debug_path_lines_vertex_array.push_back(navigation_path[i]);
+ debug_path_lines_vertex_array.push_back(navigation_path[i + 1]);
+ }
+
+ Array debug_path_lines_mesh_array;
+ debug_path_lines_mesh_array.resize(Mesh::ARRAY_MAX);
+ debug_path_lines_mesh_array[Mesh::ARRAY_VERTEX] = debug_path_lines_vertex_array;
+
+ debug_path_mesh->add_surface_from_arrays(Mesh::PRIMITIVE_LINES, debug_path_lines_mesh_array);
+
+ Ref<StandardMaterial3D> debug_agent_path_line_material = NavigationServer3D::get_singleton()->get_debug_navigation_agent_path_line_material();
+ if (debug_use_custom) {
+ if (!debug_agent_path_line_custom_material.is_valid()) {
+ debug_agent_path_line_custom_material = debug_agent_path_line_material->duplicate();
+ }
+ debug_agent_path_line_custom_material->set_albedo(debug_path_custom_color);
+ debug_path_mesh->surface_set_material(0, debug_agent_path_line_custom_material);
+ } else {
+ debug_path_mesh->surface_set_material(0, debug_agent_path_line_material);
+ }
+
+ Vector<Vector3> debug_path_points_vertex_array;
+
+ for (int i = 0; i < navigation_path.size(); i++) {
+ debug_path_points_vertex_array.push_back(navigation_path[i]);
+ }
+
+ Array debug_path_points_mesh_array;
+ debug_path_points_mesh_array.resize(Mesh::ARRAY_MAX);
+ debug_path_points_mesh_array[Mesh::ARRAY_VERTEX] = debug_path_lines_vertex_array;
+
+ debug_path_mesh->add_surface_from_arrays(Mesh::PRIMITIVE_POINTS, debug_path_points_mesh_array);
+
+ Ref<StandardMaterial3D> debug_agent_path_point_material = NavigationServer3D::get_singleton()->get_debug_navigation_agent_path_point_material();
+ if (debug_use_custom) {
+ if (!debug_agent_path_point_custom_material.is_valid()) {
+ debug_agent_path_point_custom_material = debug_agent_path_point_material->duplicate();
+ }
+ debug_agent_path_point_custom_material->set_albedo(debug_path_custom_color);
+ debug_agent_path_point_custom_material->set_point_size(debug_path_custom_point_size);
+ debug_path_mesh->surface_set_material(1, debug_agent_path_point_custom_material);
+ } else {
+ debug_path_mesh->surface_set_material(1, debug_agent_path_point_material);
+ }
+
+ RS::get_singleton()->instance_set_base(debug_path_instance, debug_path_mesh->get_rid());
+ RS::get_singleton()->instance_set_scenario(debug_path_instance, agent_parent->get_world_3d()->get_scenario());
+ RS::get_singleton()->instance_set_visible(debug_path_instance, agent_parent->is_visible_in_tree());
+}
+#endif // DEBUG_ENABLED
diff --git a/scene/3d/navigation_agent_3d.h b/scene/3d/navigation_agent_3d.h
index 12f83ce6a8..98bf395d7c 100644
--- a/scene/3d/navigation_agent_3d.h
+++ b/scene/3d/navigation_agent_3d.h
@@ -76,6 +76,22 @@ class NavigationAgent3D : public Node {
// No initialized on purpose
uint32_t update_frame_id = 0;
+#ifdef DEBUG_ENABLED
+ bool debug_enabled = false;
+ bool debug_path_dirty = true;
+ RID debug_path_instance;
+ Ref<ArrayMesh> debug_path_mesh;
+ float debug_path_custom_point_size = 4.0;
+ bool debug_use_custom = false;
+ Color debug_path_custom_color = Color(1.0, 1.0, 1.0, 1.0);
+ Ref<StandardMaterial3D> debug_agent_path_line_custom_material;
+ Ref<StandardMaterial3D> debug_agent_path_point_custom_material;
+
+private:
+ void _navigation_debug_changed();
+ void _update_debug_path();
+#endif // DEBUG_ENABLED
+
protected:
static void _bind_methods();
void _notification(int p_what);
@@ -181,6 +197,20 @@ public:
PackedStringArray get_configuration_warnings() const override;
+#ifdef DEBUG_ENABLED
+ void set_debug_enabled(bool p_enabled);
+ bool get_debug_enabled() const;
+
+ void set_debug_use_custom(bool p_enabled);
+ bool get_debug_use_custom() const;
+
+ void set_debug_path_custom_color(Color p_color);
+ Color get_debug_path_custom_color() const;
+
+ void set_debug_path_custom_point_size(float p_point_size);
+ float get_debug_path_custom_point_size() const;
+#endif // DEBUG_ENABLED
+
private:
void update_navigation();
void _request_repath();
diff --git a/scene/3d/occluder_instance_3d.cpp b/scene/3d/occluder_instance_3d.cpp
index 632b27953f..594580a205 100644
--- a/scene/3d/occluder_instance_3d.cpp
+++ b/scene/3d/occluder_instance_3d.cpp
@@ -542,13 +542,14 @@ void OccluderInstance3D::_bake_surface(const Transform3D &p_transform, Array p_s
float error = -1.0f;
int target_index_count = MIN(indices.size(), 36);
+ const int simplify_options = SurfaceTool::SIMPLIFY_LOCK_BORDER;
+
uint32_t index_count = SurfaceTool::simplify_func(
(unsigned int *)indices.ptrw(),
(unsigned int *)indices.ptr(),
indices.size(),
vertices_f32.ptr(), vertices.size(), sizeof(float) * 3,
- target_index_count, target_error, &error);
-
+ target_index_count, target_error, simplify_options, &error);
indices.resize(index_count);
}
diff --git a/scene/3d/physics_body_3d.cpp b/scene/3d/physics_body_3d.cpp
index f4ab09cd9b..c8cfcf7d7a 100644
--- a/scene/3d/physics_body_3d.cpp
+++ b/scene/3d/physics_body_3d.cpp
@@ -333,6 +333,11 @@ void AnimatableBody3D::_body_state_changed(PhysicsDirectBodyState3D *p_state) {
}
void AnimatableBody3D::_notification(int p_what) {
+#ifdef TOOLS_ENABLED
+ if (Engine::get_singleton()->is_editor_hint()) {
+ return;
+ }
+#endif
switch (p_what) {
case NOTIFICATION_ENTER_TREE: {
last_valid_transform = get_global_transform();
diff --git a/scene/3d/reflection_probe.cpp b/scene/3d/reflection_probe.cpp
index 606f6140cb..62202c0b1b 100644
--- a/scene/3d/reflection_probe.cpp
+++ b/scene/3d/reflection_probe.cpp
@@ -85,38 +85,40 @@ float ReflectionProbe::get_mesh_lod_threshold() const {
return mesh_lod_threshold;
}
-void ReflectionProbe::set_extents(const Vector3 &p_extents) {
- extents = p_extents;
+void ReflectionProbe::set_size(const Vector3 &p_size) {
+ size = p_size;
for (int i = 0; i < 3; i++) {
- if (extents[i] < 0.01) {
- extents[i] = 0.01;
+ float half_size = size[i] / 2;
+ if (half_size < 0.01) {
+ half_size = 0.01;
}
- if (extents[i] - 0.01 < ABS(origin_offset[i])) {
- origin_offset[i] = SIGN(origin_offset[i]) * (extents[i] - 0.01);
+ if (half_size - 0.01 < ABS(origin_offset[i])) {
+ origin_offset[i] = SIGN(origin_offset[i]) * (half_size - 0.01);
}
}
- RS::get_singleton()->reflection_probe_set_extents(probe, extents);
+ RS::get_singleton()->reflection_probe_set_size(probe, size);
RS::get_singleton()->reflection_probe_set_origin_offset(probe, origin_offset);
update_gizmos();
}
-Vector3 ReflectionProbe::get_extents() const {
- return extents;
+Vector3 ReflectionProbe::get_size() const {
+ return size;
}
-void ReflectionProbe::set_origin_offset(const Vector3 &p_extents) {
- origin_offset = p_extents;
+void ReflectionProbe::set_origin_offset(const Vector3 &p_offset) {
+ origin_offset = p_offset;
for (int i = 0; i < 3; i++) {
- if (extents[i] - 0.01 < ABS(origin_offset[i])) {
- origin_offset[i] = SIGN(origin_offset[i]) * (extents[i] - 0.01);
+ float half_size = size[i] / 2;
+ if (half_size - 0.01 < ABS(origin_offset[i])) {
+ origin_offset[i] = SIGN(origin_offset[i]) * (half_size - 0.01);
}
}
- RS::get_singleton()->reflection_probe_set_extents(probe, extents);
+ RS::get_singleton()->reflection_probe_set_size(probe, size);
RS::get_singleton()->reflection_probe_set_origin_offset(probe, origin_offset);
update_gizmos();
@@ -174,7 +176,7 @@ ReflectionProbe::UpdateMode ReflectionProbe::get_update_mode() const {
AABB ReflectionProbe::get_aabb() const {
AABB aabb;
aabb.position = -origin_offset;
- aabb.size = origin_offset + extents;
+ aabb.size = origin_offset + size / 2;
return aabb;
}
@@ -205,8 +207,8 @@ void ReflectionProbe::_bind_methods() {
ClassDB::bind_method(D_METHOD("set_mesh_lod_threshold", "ratio"), &ReflectionProbe::set_mesh_lod_threshold);
ClassDB::bind_method(D_METHOD("get_mesh_lod_threshold"), &ReflectionProbe::get_mesh_lod_threshold);
- ClassDB::bind_method(D_METHOD("set_extents", "extents"), &ReflectionProbe::set_extents);
- ClassDB::bind_method(D_METHOD("get_extents"), &ReflectionProbe::get_extents);
+ ClassDB::bind_method(D_METHOD("set_size", "size"), &ReflectionProbe::set_size);
+ ClassDB::bind_method(D_METHOD("get_size"), &ReflectionProbe::get_size);
ClassDB::bind_method(D_METHOD("set_origin_offset", "origin_offset"), &ReflectionProbe::set_origin_offset);
ClassDB::bind_method(D_METHOD("get_origin_offset"), &ReflectionProbe::get_origin_offset);
@@ -229,7 +231,7 @@ void ReflectionProbe::_bind_methods() {
ADD_PROPERTY(PropertyInfo(Variant::INT, "update_mode", PROPERTY_HINT_ENUM, "Once (Fast),Always (Slow)"), "set_update_mode", "get_update_mode");
ADD_PROPERTY(PropertyInfo(Variant::FLOAT, "intensity", PROPERTY_HINT_RANGE, "0,1,0.01"), "set_intensity", "get_intensity");
ADD_PROPERTY(PropertyInfo(Variant::FLOAT, "max_distance", PROPERTY_HINT_RANGE, "0,16384,0.1,or_greater,exp,suffix:m"), "set_max_distance", "get_max_distance");
- ADD_PROPERTY(PropertyInfo(Variant::VECTOR3, "extents", PROPERTY_HINT_NONE, "suffix:m"), "set_extents", "get_extents");
+ ADD_PROPERTY(PropertyInfo(Variant::VECTOR3, "size", PROPERTY_HINT_NONE, "suffix:m"), "set_size", "get_size");
ADD_PROPERTY(PropertyInfo(Variant::VECTOR3, "origin_offset", PROPERTY_HINT_NONE, "suffix:m"), "set_origin_offset", "get_origin_offset");
ADD_PROPERTY(PropertyInfo(Variant::BOOL, "box_projection"), "set_enable_box_projection", "is_box_projection_enabled");
ADD_PROPERTY(PropertyInfo(Variant::BOOL, "interior"), "set_as_interior", "is_set_as_interior");
@@ -250,6 +252,24 @@ void ReflectionProbe::_bind_methods() {
BIND_ENUM_CONSTANT(AMBIENT_COLOR);
}
+#ifndef DISABLE_DEPRECATED
+bool ReflectionProbe::_set(const StringName &p_name, const Variant &p_value) {
+ if (p_name == "extents") { // Compatibility with Godot 3.x.
+ set_size((Vector3)p_value * 2);
+ return true;
+ }
+ return false;
+}
+
+bool ReflectionProbe::_get(const StringName &p_name, Variant &r_property) const {
+ if (p_name == "extents") { // Compatibility with Godot 3.x.
+ r_property = size / 2;
+ return true;
+ }
+ return false;
+}
+#endif // DISABLE_DEPRECATED
+
ReflectionProbe::ReflectionProbe() {
probe = RenderingServer::get_singleton()->reflection_probe_create();
RS::get_singleton()->instance_set_base(get_instance(), probe);
diff --git a/scene/3d/reflection_probe.h b/scene/3d/reflection_probe.h
index cb417c3eea..738277ad39 100644
--- a/scene/3d/reflection_probe.h
+++ b/scene/3d/reflection_probe.h
@@ -52,7 +52,7 @@ private:
RID probe;
float intensity = 1.0;
float max_distance = 0.0;
- Vector3 extents = Vector3(10, 10, 10);
+ Vector3 size = Vector3(20, 20, 20);
Vector3 origin_offset = Vector3(0, 0, 0);
bool box_projection = false;
bool enable_shadows = false;
@@ -68,6 +68,10 @@ private:
protected:
static void _bind_methods();
void _validate_property(PropertyInfo &p_property) const;
+#ifndef DISABLE_DEPRECATED
+ bool _set(const StringName &p_name, const Variant &p_value);
+ bool _get(const StringName &p_name, Variant &r_property) const;
+#endif // DISABLE_DEPRECATED
public:
void set_intensity(float p_intensity);
@@ -91,10 +95,10 @@ public:
void set_mesh_lod_threshold(float p_pixels);
float get_mesh_lod_threshold() const;
- void set_extents(const Vector3 &p_extents);
- Vector3 get_extents() const;
+ void set_size(const Vector3 &p_size);
+ Vector3 get_size() const;
- void set_origin_offset(const Vector3 &p_extents);
+ void set_origin_offset(const Vector3 &p_offset);
Vector3 get_origin_offset() const;
void set_as_interior(bool p_enable);
diff --git a/scene/3d/voxel_gi.cpp b/scene/3d/voxel_gi.cpp
index 41dc27352f..36a877246e 100644
--- a/scene/3d/voxel_gi.cpp
+++ b/scene/3d/voxel_gi.cpp
@@ -237,6 +237,24 @@ void VoxelGIData::_bind_methods() {
ADD_PROPERTY(PropertyInfo(Variant::BOOL, "interior"), "set_interior", "is_interior");
}
+#ifndef DISABLE_DEPRECATED
+bool VoxelGI::_set(const StringName &p_name, const Variant &p_value) {
+ if (p_name == "extents") { // Compatibility with Godot 3.x.
+ set_size((Vector3)p_value * 2);
+ return true;
+ }
+ return false;
+}
+
+bool VoxelGI::_get(const StringName &p_name, Variant &r_property) const {
+ if (p_name == "extents") { // Compatibility with Godot 3.x.
+ r_property = size / 2;
+ return true;
+ }
+ return false;
+}
+#endif // DISABLE_DEPRECATED
+
VoxelGIData::VoxelGIData() {
probe = RS::get_singleton()->voxel_gi_create();
}
@@ -273,14 +291,14 @@ VoxelGI::Subdiv VoxelGI::get_subdiv() const {
return subdiv;
}
-void VoxelGI::set_extents(const Vector3 &p_extents) {
- // Prevent very small extents as these break baking if other extents are set very high.
- extents = Vector3(MAX(1.0, p_extents.x), MAX(1.0, p_extents.y), MAX(1.0, p_extents.z));
+void VoxelGI::set_size(const Vector3 &p_size) {
+ // Prevent very small size dimensions as these breaks baking if other size dimensions are set very high.
+ size = Vector3(MAX(1.0, p_size.x), MAX(1.0, p_size.y), MAX(1.0, p_size.z));
update_gizmos();
}
-Vector3 VoxelGI::get_extents() const {
- return extents;
+Vector3 VoxelGI::get_size() const {
+ return size;
}
void VoxelGI::set_camera_attributes(const Ref<CameraAttributes> &p_camera_attributes) {
@@ -300,7 +318,7 @@ void VoxelGI::_find_meshes(Node *p_at_node, List<PlotMesh> &plot_meshes) {
Transform3D xf = get_global_transform().affine_inverse() * mi->get_global_transform();
- if (AABB(-extents, extents * 2).intersects(xf.xform(aabb))) {
+ if (AABB(-size / 2, size).intersects(xf.xform(aabb))) {
PlotMesh pm;
pm.local_xform = xf;
pm.mesh = mesh;
@@ -328,7 +346,7 @@ void VoxelGI::_find_meshes(Node *p_at_node, List<PlotMesh> &plot_meshes) {
Transform3D xf = get_global_transform().affine_inverse() * (s->get_global_transform() * mxf);
- if (AABB(-extents, extents * 2).intersects(xf.xform(aabb))) {
+ if (AABB(-size / 2, size).intersects(xf.xform(aabb))) {
PlotMesh pm;
pm.local_xform = xf;
pm.mesh = mesh;
@@ -352,7 +370,7 @@ Vector3i VoxelGI::get_estimated_cell_size() const {
static const int subdiv_value[SUBDIV_MAX] = { 6, 7, 8, 9 };
int cell_subdiv = subdiv_value[subdiv];
int axis_cell_size[3];
- AABB bounds = AABB(-extents, extents * 2.0);
+ AABB bounds = AABB(-size / 2, size);
int longest_axis = bounds.get_longest_axis_index();
axis_cell_size[longest_axis] = 1 << cell_subdiv;
@@ -390,7 +408,7 @@ void VoxelGI::bake(Node *p_from_node, bool p_create_visual_debug) {
Voxelizer baker;
- baker.begin_bake(subdiv_value[subdiv], AABB(-extents, extents * 2.0), exposure_normalization);
+ baker.begin_bake(subdiv_value[subdiv], AABB(-size / 2, size), exposure_normalization);
List<PlotMesh> mesh_list;
@@ -448,7 +466,7 @@ void VoxelGI::bake(Node *p_from_node, bool p_create_visual_debug) {
RS::get_singleton()->voxel_gi_set_baked_exposure_normalization(probe_data_new->get_rid(), exposure_normalization);
- probe_data_new->allocate(baker.get_to_cell_space_xform(), AABB(-extents, extents * 2.0), baker.get_voxel_gi_octree_size(), baker.get_voxel_gi_octree_cells(), baker.get_voxel_gi_data_cells(), df, baker.get_voxel_gi_level_cell_count());
+ probe_data_new->allocate(baker.get_to_cell_space_xform(), AABB(-size / 2, size), baker.get_voxel_gi_octree_size(), baker.get_voxel_gi_octree_cells(), baker.get_voxel_gi_data_cells(), df, baker.get_voxel_gi_level_cell_count());
set_probe_data(probe_data_new);
#ifdef TOOLS_ENABLED
@@ -468,7 +486,7 @@ void VoxelGI::_debug_bake() {
}
AABB VoxelGI::get_aabb() const {
- return AABB(-extents, extents * 2);
+ return AABB(-size / 2, size);
}
PackedStringArray VoxelGI::get_configuration_warnings() const {
@@ -489,8 +507,8 @@ void VoxelGI::_bind_methods() {
ClassDB::bind_method(D_METHOD("set_subdiv", "subdiv"), &VoxelGI::set_subdiv);
ClassDB::bind_method(D_METHOD("get_subdiv"), &VoxelGI::get_subdiv);
- ClassDB::bind_method(D_METHOD("set_extents", "extents"), &VoxelGI::set_extents);
- ClassDB::bind_method(D_METHOD("get_extents"), &VoxelGI::get_extents);
+ ClassDB::bind_method(D_METHOD("set_size", "size"), &VoxelGI::set_size);
+ ClassDB::bind_method(D_METHOD("get_size"), &VoxelGI::get_size);
ClassDB::bind_method(D_METHOD("set_camera_attributes", "camera_attributes"), &VoxelGI::set_camera_attributes);
ClassDB::bind_method(D_METHOD("get_camera_attributes"), &VoxelGI::get_camera_attributes);
@@ -500,7 +518,7 @@ void VoxelGI::_bind_methods() {
ClassDB::set_method_flags(get_class_static(), _scs_create("debug_bake"), METHOD_FLAGS_DEFAULT | METHOD_FLAG_EDITOR);
ADD_PROPERTY(PropertyInfo(Variant::INT, "subdiv", PROPERTY_HINT_ENUM, "64,128,256,512"), "set_subdiv", "get_subdiv");
- ADD_PROPERTY(PropertyInfo(Variant::VECTOR3, "extents", PROPERTY_HINT_NONE, "suffix:m"), "set_extents", "get_extents");
+ ADD_PROPERTY(PropertyInfo(Variant::VECTOR3, "size", PROPERTY_HINT_NONE, "suffix:m"), "set_size", "get_size");
ADD_PROPERTY(PropertyInfo(Variant::OBJECT, "camera_attributes", PROPERTY_HINT_RESOURCE_TYPE, "CameraAttributesPractical,CameraAttributesPhysical"), "set_camera_attributes", "get_camera_attributes");
ADD_PROPERTY(PropertyInfo(Variant::OBJECT, "data", PROPERTY_HINT_RESOURCE_TYPE, "VoxelGIData", PROPERTY_USAGE_DEFAULT | PROPERTY_USAGE_ALWAYS_DUPLICATE), "set_probe_data", "get_probe_data");
diff --git a/scene/3d/voxel_gi.h b/scene/3d/voxel_gi.h
index ae348daf9e..d276186dd1 100644
--- a/scene/3d/voxel_gi.h
+++ b/scene/3d/voxel_gi.h
@@ -118,7 +118,7 @@ private:
RID voxel_gi;
Subdiv subdiv = SUBDIV_128;
- Vector3 extents = Vector3(10, 10, 10);
+ Vector3 size = Vector3(20, 20, 20);
Ref<CameraAttributes> camera_attributes;
struct PlotMesh {
@@ -133,6 +133,10 @@ private:
protected:
static void _bind_methods();
+#ifndef DISABLE_DEPRECATED
+ bool _set(const StringName &p_name, const Variant &p_value);
+ bool _get(const StringName &p_name, Variant &r_property) const;
+#endif // DISABLE_DEPRECATED
public:
static BakeBeginFunc bake_begin_function;
@@ -145,8 +149,8 @@ public:
void set_subdiv(Subdiv p_subdiv);
Subdiv get_subdiv() const;
- void set_extents(const Vector3 &p_extents);
- Vector3 get_extents() const;
+ void set_size(const Vector3 &p_size);
+ Vector3 get_size() const;
void set_camera_attributes(const Ref<CameraAttributes> &p_camera_attributes);
Ref<CameraAttributes> get_camera_attributes() const;
diff --git a/scene/animation/animation_blend_tree.cpp b/scene/animation/animation_blend_tree.cpp
index 45f4f690b9..797999625b 100644
--- a/scene/animation/animation_blend_tree.cpp
+++ b/scene/animation/animation_blend_tree.cpp
@@ -800,6 +800,14 @@ Ref<Curve> AnimationNodeTransition::get_xfade_curve() const {
return xfade_curve;
}
+void AnimationNodeTransition::set_allow_transition_to_self(bool p_enable) {
+ allow_transition_to_self = p_enable;
+}
+
+bool AnimationNodeTransition::is_allow_transition_to_self() const {
+ return allow_transition_to_self;
+}
+
double AnimationNodeTransition::process(double p_time, bool p_seek, bool p_is_external_seeking) {
String cur_transition_request = get_parameter(transition_request);
int cur_current_index = get_parameter(current_index);
@@ -815,20 +823,22 @@ double AnimationNodeTransition::process(double p_time, bool p_seek, bool p_is_ex
int new_idx = find_input(cur_transition_request);
if (new_idx >= 0) {
if (cur_current_index == new_idx) {
- // Transition to same state.
- restart = input_data[cur_current_index].reset;
- cur_prev_xfading = 0;
- set_parameter(prev_xfading, 0);
- cur_prev_index = -1;
- set_parameter(prev_index, -1);
+ if (allow_transition_to_self) {
+ // Transition to same state.
+ restart = input_data[cur_current_index].reset;
+ cur_prev_xfading = 0;
+ set_parameter(prev_xfading, 0);
+ cur_prev_index = -1;
+ set_parameter(prev_index, -1);
+ }
} else {
switched = true;
cur_prev_index = cur_current_index;
set_parameter(prev_index, cur_current_index);
+ cur_current_index = new_idx;
+ set_parameter(current_index, cur_current_index);
+ set_parameter(current_state, cur_transition_request);
}
- cur_current_index = new_idx;
- set_parameter(current_index, cur_current_index);
- set_parameter(current_state, cur_transition_request);
} else {
ERR_PRINT("No such input: '" + cur_transition_request + "'");
}
@@ -932,8 +942,12 @@ void AnimationNodeTransition::_bind_methods() {
ClassDB::bind_method(D_METHOD("set_xfade_curve", "curve"), &AnimationNodeTransition::set_xfade_curve);
ClassDB::bind_method(D_METHOD("get_xfade_curve"), &AnimationNodeTransition::get_xfade_curve);
+ ClassDB::bind_method(D_METHOD("set_allow_transition_to_self", "enable"), &AnimationNodeTransition::set_allow_transition_to_self);
+ ClassDB::bind_method(D_METHOD("is_allow_transition_to_self"), &AnimationNodeTransition::is_allow_transition_to_self);
+
ADD_PROPERTY(PropertyInfo(Variant::FLOAT, "xfade_time", PROPERTY_HINT_RANGE, "0,120,0.01,suffix:s"), "set_xfade_time", "get_xfade_time");
ADD_PROPERTY(PropertyInfo(Variant::OBJECT, "xfade_curve", PROPERTY_HINT_RESOURCE_TYPE, "Curve"), "set_xfade_curve", "get_xfade_curve");
+ ADD_PROPERTY(PropertyInfo(Variant::BOOL, "allow_transition_to_self"), "set_allow_transition_to_self", "is_allow_transition_to_self");
ADD_PROPERTY(PropertyInfo(Variant::INT, "input_count", PROPERTY_HINT_NONE, "", PROPERTY_USAGE_EDITOR | PROPERTY_USAGE_ARRAY | PROPERTY_USAGE_UPDATE_ALL_IF_MODIFIED, "Inputs,input_"), "set_input_count", "get_input_count");
}
diff --git a/scene/animation/animation_blend_tree.h b/scene/animation/animation_blend_tree.h
index 3c27edbf70..20f8e9b190 100644
--- a/scene/animation/animation_blend_tree.h
+++ b/scene/animation/animation_blend_tree.h
@@ -294,6 +294,7 @@ class AnimationNodeTransition : public AnimationNodeSync {
double xfade_time = 0.0;
Ref<Curve> xfade_curve;
+ bool allow_transition_to_self = false;
protected:
bool _get(const StringName &p_path, Variant &r_ret) const;
@@ -325,6 +326,9 @@ public:
void set_xfade_curve(const Ref<Curve> &p_curve);
Ref<Curve> get_xfade_curve() const;
+ void set_allow_transition_to_self(bool p_enable);
+ bool is_allow_transition_to_self() const;
+
double process(double p_time, bool p_seek, bool p_is_external_seeking) override;
AnimationNodeTransition();
diff --git a/scene/animation/animation_node_state_machine.cpp b/scene/animation/animation_node_state_machine.cpp
index 7fb831b3b2..ec28a5cca1 100644
--- a/scene/animation/animation_node_state_machine.cpp
+++ b/scene/animation/animation_node_state_machine.cpp
@@ -252,7 +252,7 @@ bool AnimationNodeStateMachinePlayback::_travel(AnimationNodeStateMachine *p_sta
path.clear(); //a new one will be needed
if (current == p_travel) {
- return false; // Will teleport oneself (restart).
+ return !p_state_machine->is_allow_transition_to_self();
}
Vector2 current_pos = p_state_machine->states[current].position;
@@ -813,6 +813,14 @@ void AnimationNodeStateMachine::replace_node(const StringName &p_name, Ref<Anima
p_node->connect("tree_changed", callable_mp(this, &AnimationNodeStateMachine::_tree_changed), CONNECT_REFERENCE_COUNTED);
}
+void AnimationNodeStateMachine::set_allow_transition_to_self(bool p_enable) {
+ allow_transition_to_self = p_enable;
+}
+
+bool AnimationNodeStateMachine::is_allow_transition_to_self() const {
+ return allow_transition_to_self;
+}
+
bool AnimationNodeStateMachine::can_edit_node(const StringName &p_name) const {
if (states.has(p_name)) {
return !(states[p_name].node->is_class("AnimationNodeStartState") || states[p_name].node->is_class("AnimationNodeEndState"));
@@ -1383,6 +1391,11 @@ void AnimationNodeStateMachine::_bind_methods() {
ClassDB::bind_method(D_METHOD("set_graph_offset", "offset"), &AnimationNodeStateMachine::set_graph_offset);
ClassDB::bind_method(D_METHOD("get_graph_offset"), &AnimationNodeStateMachine::get_graph_offset);
+
+ ClassDB::bind_method(D_METHOD("set_allow_transition_to_self", "enable"), &AnimationNodeStateMachine::set_allow_transition_to_self);
+ ClassDB::bind_method(D_METHOD("is_allow_transition_to_self"), &AnimationNodeStateMachine::is_allow_transition_to_self);
+
+ ADD_PROPERTY(PropertyInfo(Variant::BOOL, "allow_transition_to_self"), "set_allow_transition_to_self", "is_allow_transition_to_self");
}
AnimationNodeStateMachine::AnimationNodeStateMachine() {
diff --git a/scene/animation/animation_node_state_machine.h b/scene/animation/animation_node_state_machine.h
index cf4d850aa6..5c2a4d6264 100644
--- a/scene/animation/animation_node_state_machine.h
+++ b/scene/animation/animation_node_state_machine.h
@@ -188,6 +188,7 @@ private:
};
HashMap<StringName, State> states;
+ bool allow_transition_to_self = false;
struct Transition {
StringName from;
@@ -254,6 +255,9 @@ public:
void remove_transition_by_index(const int p_transition);
void remove_transition(const StringName &p_from, const StringName &p_to);
+ void set_allow_transition_to_self(bool p_enable);
+ bool is_allow_transition_to_self() const;
+
bool can_edit_node(const StringName &p_name) const;
AnimationNodeStateMachine *get_prev_state_machine() const;
diff --git a/scene/animation/animation_tree.cpp b/scene/animation/animation_tree.cpp
index fa72bbc593..dd5bf31c66 100644
--- a/scene/animation/animation_tree.cpp
+++ b/scene/animation/animation_tree.cpp
@@ -2084,20 +2084,6 @@ void AnimationTree::_get_property_list(List<PropertyInfo> *p_list) const {
}
}
-void AnimationTree::rename_parameter(const String &p_base, const String &p_new_base) {
- //rename values first
- for (const PropertyInfo &E : properties) {
- if (E.name.begins_with(p_base)) {
- String new_name = E.name.replace_first(p_base, p_new_base);
- property_map[new_name] = property_map[E.name];
- }
- }
-
- //update tree second
- properties_dirty = true;
- _update_properties();
-}
-
real_t AnimationTree::get_connection_activity(const StringName &p_path, int p_connection) const {
if (!input_activity_map_get.has(p_path)) {
return 0;
@@ -2143,8 +2129,6 @@ void AnimationTree::_bind_methods() {
ClassDB::bind_method(D_METHOD("_update_properties"), &AnimationTree::_update_properties);
- ClassDB::bind_method(D_METHOD("rename_parameter", "old_name", "new_name"), &AnimationTree::rename_parameter);
-
ClassDB::bind_method(D_METHOD("advance", "delta"), &AnimationTree::advance);
GDVIRTUAL_BIND(_post_process_key_value, "animation", "track", "value", "object", "object_idx");
diff --git a/scene/animation/animation_tree.h b/scene/animation/animation_tree.h
index a6fb4a8430..c5c2790fae 100644
--- a/scene/animation/animation_tree.h
+++ b/scene/animation/animation_tree.h
@@ -389,8 +389,6 @@ public:
real_t get_connection_activity(const StringName &p_path, int p_connection) const;
void advance(double p_time);
- void rename_parameter(const String &p_base, const String &p_new_base);
-
uint64_t get_last_process_pass() const;
AnimationTree();
~AnimationTree();
diff --git a/scene/gui/graph_edit.cpp b/scene/gui/graph_edit.cpp
index dc23bcb14a..fe2eed6755 100644
--- a/scene/gui/graph_edit.cpp
+++ b/scene/gui/graph_edit.cpp
@@ -264,10 +264,6 @@ void GraphEdit::_scroll_moved(double) {
top_layer->queue_redraw();
minimap->queue_redraw();
queue_redraw();
-
- if (!setting_scroll_ofs) { //in godot, signals on change value are avoided as a convention
- emit_signal(SNAME("scroll_offset_changed"), get_scroll_ofs());
- }
}
void GraphEdit::_update_scroll_offset() {
@@ -290,6 +286,10 @@ void GraphEdit::_update_scroll_offset() {
connections_layer->set_position(-Point2(h_scroll->get_value(), v_scroll->get_value()));
set_block_minimum_size_adjust(false);
awaiting_scroll_offset_update = false;
+
+ if (!setting_scroll_ofs) { //in godot, signals on change value are avoided as a convention
+ emit_signal(SNAME("scroll_offset_changed"), get_scroll_ofs());
+ }
}
void GraphEdit::_update_scroll() {
diff --git a/scene/gui/line_edit.cpp b/scene/gui/line_edit.cpp
index dba08e16cb..16a718722c 100644
--- a/scene/gui/line_edit.cpp
+++ b/scene/gui/line_edit.cpp
@@ -84,6 +84,7 @@ void LineEdit::_move_caret_left(bool p_select, bool p_move_by_word) {
}
shift_selection_check_post(p_select);
+ _reset_caret_blink_timer();
}
void LineEdit::_move_caret_right(bool p_select, bool p_move_by_word) {
@@ -116,6 +117,7 @@ void LineEdit::_move_caret_right(bool p_select, bool p_move_by_word) {
}
shift_selection_check_post(p_select);
+ _reset_caret_blink_timer();
}
void LineEdit::_move_caret_start(bool p_select) {
diff --git a/scene/gui/popup_menu.cpp b/scene/gui/popup_menu.cpp
index ddc11d97b9..0eeac2f285 100644
--- a/scene/gui/popup_menu.cpp
+++ b/scene/gui/popup_menu.cpp
@@ -840,6 +840,9 @@ void PopupMenu::_notification(int p_what) {
float pm_delay = pm->get_submenu_popup_delay();
set_submenu_popup_delay(pm_delay);
}
+ if (!is_embedded()) {
+ set_flag(FLAG_NO_FOCUS, true);
+ }
} break;
case NOTIFICATION_THEME_CHANGED:
diff --git a/scene/gui/subviewport_container.cpp b/scene/gui/subviewport_container.cpp
index 7c1d2f95a9..f10e1c2cd1 100644
--- a/scene/gui/subviewport_container.cpp
+++ b/scene/gui/subviewport_container.cpp
@@ -85,7 +85,7 @@ void SubViewportContainer::set_stretch_shrink(int p_shrink) {
continue;
}
- c->set_size(get_size() / shrink);
+ c->set_size_force(get_size() / shrink);
}
queue_redraw();
@@ -116,7 +116,7 @@ void SubViewportContainer::_notification(int p_what) {
continue;
}
- c->set_size(get_size() / shrink);
+ c->set_size_force(get_size() / shrink);
}
} break;
diff --git a/scene/gui/tree.cpp b/scene/gui/tree.cpp
index d9e6157489..0f39715851 100644
--- a/scene/gui/tree.cpp
+++ b/scene/gui/tree.cpp
@@ -5256,7 +5256,6 @@ void Tree::_bind_methods() {
ADD_SIGNAL(MethodInfo("empty_clicked", PropertyInfo(Variant::VECTOR2, "position"), PropertyInfo(Variant::INT, "mouse_button_index")));
ADD_SIGNAL(MethodInfo("item_edited"));
ADD_SIGNAL(MethodInfo("custom_item_clicked", PropertyInfo(Variant::INT, "mouse_button_index")));
- ADD_SIGNAL(MethodInfo("item_custom_button_pressed"));
ADD_SIGNAL(MethodInfo("item_icon_double_clicked"));
ADD_SIGNAL(MethodInfo("item_collapsed", PropertyInfo(Variant::OBJECT, "item", PROPERTY_HINT_RESOURCE_TYPE, "TreeItem")));
ADD_SIGNAL(MethodInfo("check_propagated_to_item", PropertyInfo(Variant::OBJECT, "item", PROPERTY_HINT_RESOURCE_TYPE, "TreeItem"), PropertyInfo(Variant::INT, "column")));
diff --git a/scene/main/canvas_item.cpp b/scene/main/canvas_item.cpp
index cde3503bdf..541c7a0587 100644
--- a/scene/main/canvas_item.cpp
+++ b/scene/main/canvas_item.cpp
@@ -408,8 +408,8 @@ void CanvasItem::set_as_top_level(bool p_top_level) {
void CanvasItem::_toplevel_changed() {
// Inform children that toplevel status has changed on a parent.
- int childs = get_child_count();
- for (int i = 0; i < childs; i++) {
+ int children = get_child_count();
+ for (int i = 0; i < children; i++) {
CanvasItem *child = Object::cast_to<CanvasItem>(get_child(i));
if (child) {
child->_toplevel_changed_on_parent();
diff --git a/scene/main/multiplayer_api.cpp b/scene/main/multiplayer_api.cpp
index c54e61580f..950eb2809c 100644
--- a/scene/main/multiplayer_api.cpp
+++ b/scene/main/multiplayer_api.cpp
@@ -329,9 +329,9 @@ void MultiplayerAPI::_bind_methods() {
/// MultiplayerAPIExtension
Error MultiplayerAPIExtension::poll() {
- int err = OK;
+ Error err = OK;
GDVIRTUAL_CALL(_poll, err);
- return (Error)err;
+ return err;
}
void MultiplayerAPIExtension::set_multiplayer_peer(const Ref<MultiplayerPeer> &p_peer) {
@@ -364,9 +364,9 @@ Error MultiplayerAPIExtension::rpcp(Object *p_obj, int p_peer_id, const StringNa
for (int i = 0; i < p_argcount; i++) {
args.push_back(*p_arg[i]);
}
- int ret = FAILED;
+ Error ret = FAILED;
GDVIRTUAL_CALL(_rpc, p_peer_id, p_obj, p_method, args, ret);
- return (Error)ret;
+ return ret;
}
int MultiplayerAPIExtension::get_remote_sender_id() {
@@ -376,15 +376,15 @@ int MultiplayerAPIExtension::get_remote_sender_id() {
}
Error MultiplayerAPIExtension::object_configuration_add(Object *p_object, Variant p_config) {
- int err = ERR_UNAVAILABLE;
+ Error err = ERR_UNAVAILABLE;
GDVIRTUAL_CALL(_object_configuration_add, p_object, p_config, err);
- return (Error)err;
+ return err;
}
Error MultiplayerAPIExtension::object_configuration_remove(Object *p_object, Variant p_config) {
- int err = ERR_UNAVAILABLE;
+ Error err = ERR_UNAVAILABLE;
GDVIRTUAL_CALL(_object_configuration_remove, p_object, p_config, err);
- return (Error)err;
+ return err;
}
void MultiplayerAPIExtension::_bind_methods() {
diff --git a/scene/main/multiplayer_api.h b/scene/main/multiplayer_api.h
index 0b107ee50b..a578e6f2f1 100644
--- a/scene/main/multiplayer_api.h
+++ b/scene/main/multiplayer_api.h
@@ -101,15 +101,15 @@ public:
virtual Error object_configuration_remove(Object *p_object, Variant p_config) override;
// Extensions
- GDVIRTUAL0R(int, _poll);
+ GDVIRTUAL0R(Error, _poll);
GDVIRTUAL1(_set_multiplayer_peer, Ref<MultiplayerPeer>);
GDVIRTUAL0R(Ref<MultiplayerPeer>, _get_multiplayer_peer);
GDVIRTUAL0RC(int, _get_unique_id);
GDVIRTUAL0RC(PackedInt32Array, _get_peer_ids);
- GDVIRTUAL4R(int, _rpc, int, Object *, StringName, Array);
+ GDVIRTUAL4R(Error, _rpc, int, Object *, StringName, Array);
GDVIRTUAL0RC(int, _get_remote_sender_id);
- GDVIRTUAL2R(int, _object_configuration_add, Object *, Variant);
- GDVIRTUAL2R(int, _object_configuration_remove, Object *, Variant);
+ GDVIRTUAL2R(Error, _object_configuration_add, Object *, Variant);
+ GDVIRTUAL2R(Error, _object_configuration_remove, Object *, Variant);
};
#endif // MULTIPLAYER_API_H
diff --git a/scene/main/multiplayer_peer.cpp b/scene/main/multiplayer_peer.cpp
index 83555966d7..f3e56a1455 100644
--- a/scene/main/multiplayer_peer.cpp
+++ b/scene/main/multiplayer_peer.cpp
@@ -163,7 +163,7 @@ Error MultiplayerPeerExtension::put_packet(const uint8_t *p_buffer, int p_buffer
if (!GDVIRTUAL_CALL(_put_packet_script, a, err)) {
return FAILED;
}
- return (Error)err;
+ return err;
}
WARN_PRINT_ONCE("MultiplayerPeerExtension::_put_packet_native is unimplemented!");
return FAILED;
diff --git a/scene/main/node.cpp b/scene/main/node.cpp
index ba75c92c85..52c1df8110 100644
--- a/scene/main/node.cpp
+++ b/scene/main/node.cpp
@@ -2135,13 +2135,13 @@ Node *Node::_duplicate(int p_flags, HashMap<const Node *, Node *> *r_duplimap) c
} else if ((p_flags & DUPLICATE_USE_INSTANTIATION) && !get_scene_file_path().is_empty()) {
Ref<PackedScene> res = ResourceLoader::load(get_scene_file_path());
ERR_FAIL_COND_V(res.is_null(), nullptr);
- PackedScene::GenEditState ges = PackedScene::GEN_EDIT_STATE_DISABLED;
+ PackedScene::GenEditState edit_state = PackedScene::GEN_EDIT_STATE_DISABLED;
#ifdef TOOLS_ENABLED
if (p_flags & DUPLICATE_FROM_EDITOR) {
- ges = PackedScene::GEN_EDIT_STATE_INSTANCE;
+ edit_state = PackedScene::GEN_EDIT_STATE_INSTANCE;
}
#endif
- node = res->instantiate(ges);
+ node = res->instantiate(edit_state);
ERR_FAIL_COND_V(!node, nullptr);
node->set_scene_instance_load_placeholder(get_scene_instance_load_placeholder());
diff --git a/scene/main/viewport.cpp b/scene/main/viewport.cpp
index b6bcbe04a3..b0898e2239 100644
--- a/scene/main/viewport.cpp
+++ b/scene/main/viewport.cpp
@@ -527,6 +527,11 @@ void Viewport::_process_picking() {
if (to_screen_rect != Rect2i() && Input::get_singleton()->get_mouse_mode() == Input::MOUSE_MODE_CAPTURED) {
return;
}
+ if (!gui.mouse_in_viewport) {
+ // Clear picking events if mouse has left viewport.
+ physics_picking_events.clear();
+ return;
+ }
_drop_physics_mouseover(true);
@@ -791,15 +796,21 @@ void Viewport::update_canvas_items() {
_update_canvas_items(this);
}
-void Viewport::_set_size(const Size2i &p_size, const Size2i &p_size_2d_override, const Rect2i &p_to_screen_rect, const Transform2D &p_stretch_transform, bool p_allocated) {
- if (size == p_size && size_allocated == p_allocated && stretch_transform == p_stretch_transform && p_size_2d_override == size_2d_override && to_screen_rect == p_to_screen_rect) {
+void Viewport::_set_size(const Size2i &p_size, const Size2i &p_size_2d_override, const Rect2i &p_to_screen_rect, bool p_allocated) {
+ Transform2D stretch_transform_new = Transform2D();
+ if (is_size_2d_override_stretch_enabled() && p_size_2d_override.width > 0 && p_size_2d_override.height > 0) {
+ Size2 scale = Size2(p_size) / Size2(p_size_2d_override);
+ stretch_transform_new.scale(scale);
+ }
+
+ if (size == p_size && size_allocated == p_allocated && stretch_transform == stretch_transform_new && p_size_2d_override == size_2d_override && to_screen_rect == p_to_screen_rect) {
return;
}
size = p_size;
size_allocated = p_allocated;
size_2d_override = p_size_2d_override;
- stretch_transform = p_stretch_transform;
+ stretch_transform = stretch_transform_new;
to_screen_rect = p_to_screen_rect;
#ifndef _3D_DISABLED
@@ -1050,10 +1061,10 @@ void Viewport::assign_next_enabled_camera_2d(const StringName &p_camera_group) {
get_tree()->get_nodes_in_group(p_camera_group, &camera_list);
Camera2D *new_camera = nullptr;
- for (const Node *E : camera_list) {
- const Camera2D *cam = Object::cast_to<Camera2D>(E);
+ for (Node *E : camera_list) {
+ Camera2D *cam = Object::cast_to<Camera2D>(E);
if (cam->is_enabled()) {
- new_camera = const_cast<Camera2D *>(cam);
+ new_camera = cam;
break;
}
}
@@ -4114,9 +4125,26 @@ Viewport::~Viewport() {
/////////////////////////////////
void SubViewport::set_size(const Size2i &p_size) {
- _set_size(p_size, _get_size_2d_override(), Rect2i(), _stretch_transform(), true);
+ _internal_set_size(p_size);
+}
+
+void SubViewport::set_size_force(const Size2i &p_size) {
+ // Use only for setting the size from the parent SubViewportContainer with enabled stretch mode.
+ // Don't expose function to scripting.
+ _internal_set_size(p_size, true);
+}
+void SubViewport::_internal_set_size(const Size2i &p_size, bool p_force) {
SubViewportContainer *c = Object::cast_to<SubViewportContainer>(get_parent());
+ if (!p_force && c && c->is_stretch_enabled()) {
+#ifdef DEBUG_ENABLED
+ WARN_PRINT("Can't change the size of a `SubViewport` with a `SubViewportContainer` parent that has `stretch` enabled. Set `SubViewportContainer.stretch` to `false` to allow changing the size manually.");
+#endif // DEBUG_ENABLED
+ return;
+ }
+
+ _set_size(p_size, _get_size_2d_override(), Rect2i(), true);
+
if (c) {
c->update_minimum_size();
}
@@ -4127,7 +4155,7 @@ Size2i SubViewport::get_size() const {
}
void SubViewport::set_size_2d_override(const Size2i &p_size) {
- _set_size(_get_size(), p_size, Rect2i(), _stretch_transform(), true);
+ _set_size(_get_size(), p_size, Rect2i(), true);
}
Size2i SubViewport::get_size_2d_override() const {
@@ -4140,7 +4168,7 @@ void SubViewport::set_size_2d_override_stretch(bool p_enable) {
}
size_2d_override_stretch = p_enable;
- _set_size(_get_size(), _get_size_2d_override(), Rect2i(), _stretch_transform(), true);
+ _set_size(_get_size(), _get_size_2d_override(), Rect2i(), true);
}
bool SubViewport::is_size_2d_override_stretch_enabled() const {
@@ -4169,17 +4197,6 @@ DisplayServer::WindowID SubViewport::get_window_id() const {
return DisplayServer::INVALID_WINDOW_ID;
}
-Transform2D SubViewport::_stretch_transform() {
- Transform2D transform;
- Size2i view_size_2d_override = _get_size_2d_override();
- if (size_2d_override_stretch && view_size_2d_override.width > 0 && view_size_2d_override.height > 0) {
- Size2 scale = Size2(_get_size()) / Size2(view_size_2d_override);
- transform.scale(scale);
- }
-
- return transform;
-}
-
Transform2D SubViewport::get_screen_transform() const {
Transform2D container_transform;
SubViewportContainer *c = Object::cast_to<SubViewportContainer>(get_parent());
diff --git a/scene/main/viewport.h b/scene/main/viewport.h
index e081013fde..7546838568 100644
--- a/scene/main/viewport.h
+++ b/scene/main/viewport.h
@@ -471,7 +471,7 @@ private:
uint64_t event_count = 0;
protected:
- void _set_size(const Size2i &p_size, const Size2i &p_size_2d_override, const Rect2i &p_to_screen_rect, const Transform2D &p_stretch_transform, bool p_allocated);
+ void _set_size(const Size2i &p_size, const Size2i &p_size_2d_override, const Rect2i &p_to_screen_rect, bool p_allocated);
Size2i _get_size() const;
Size2i _get_size_2d_override() const;
@@ -649,6 +649,8 @@ public:
void set_canvas_cull_mask_bit(uint32_t p_layer, bool p_enable);
bool get_canvas_cull_mask_bit(uint32_t p_layer) const;
+ virtual bool is_size_2d_override_stretch_enabled() const { return true; }
+
virtual Transform2D get_screen_transform() const;
virtual Transform2D get_popup_base_transform() const { return Transform2D(); }
@@ -754,21 +756,23 @@ private:
ClearMode clear_mode = CLEAR_MODE_ALWAYS;
bool size_2d_override_stretch = false;
+ void _internal_set_size(const Size2i &p_size, bool p_force = false);
+
protected:
static void _bind_methods();
virtual DisplayServer::WindowID get_window_id() const override;
- Transform2D _stretch_transform();
void _notification(int p_what);
public:
void set_size(const Size2i &p_size);
Size2i get_size() const;
+ void set_size_force(const Size2i &p_size);
void set_size_2d_override(const Size2i &p_size);
Size2i get_size_2d_override() const;
void set_size_2d_override_stretch(bool p_enable);
- bool is_size_2d_override_stretch_enabled() const;
+ bool is_size_2d_override_stretch_enabled() const override;
void set_update_mode(UpdateMode p_mode);
UpdateMode get_update_mode() const;
diff --git a/scene/main/window.cpp b/scene/main/window.cpp
index b1f2bc65dc..b6f1d3f54b 100644
--- a/scene/main/window.cpp
+++ b/scene/main/window.cpp
@@ -905,7 +905,6 @@ void Window::_update_viewport_size() {
Size2i final_size;
Size2i final_size_override;
Rect2i attach_to_screen_rect(Point2i(), size);
- Transform2D stretch_transform_new;
float font_oversampling = 1.0;
window_transform = Transform2D();
@@ -913,9 +912,6 @@ void Window::_update_viewport_size() {
font_oversampling = content_scale_factor;
final_size = size;
final_size_override = Size2(size) / content_scale_factor;
-
- stretch_transform_new = Transform2D();
- stretch_transform_new.scale(Size2(content_scale_factor, content_scale_factor));
} else {
//actual screen video mode
Size2 video_mode = size;
@@ -991,9 +987,6 @@ void Window::_update_viewport_size() {
attach_to_screen_rect = Rect2(margin, screen_size);
font_oversampling = (screen_size.x / viewport_size.x) * content_scale_factor;
- Size2 scale = Vector2(screen_size) / Vector2(final_size_override);
- stretch_transform_new.scale(scale);
-
window_transform.translate_local(margin);
} break;
case CONTENT_SCALE_MODE_VIEWPORT: {
@@ -1011,7 +1004,7 @@ void Window::_update_viewport_size() {
}
bool allocate = is_inside_tree() && visible && (window_id != DisplayServer::INVALID_WINDOW_ID || embedder != nullptr);
- _set_size(final_size, final_size_override, attach_to_screen_rect, stretch_transform_new, allocate);
+ _set_size(final_size, final_size_override, attach_to_screen_rect, allocate);
if (window_id != DisplayServer::INVALID_WINDOW_ID) {
RenderingServer::get_singleton()->viewport_attach_to_screen(get_viewport_rid(), attach_to_screen_rect, window_id);
@@ -2344,6 +2337,7 @@ void Window::_bind_methods() {
ADD_SIGNAL(MethodInfo("visibility_changed"));
ADD_SIGNAL(MethodInfo("about_to_popup"));
ADD_SIGNAL(MethodInfo("theme_changed"));
+ ADD_SIGNAL(MethodInfo("dpi_changed"));
ADD_SIGNAL(MethodInfo("titlebar_changed"));
BIND_CONSTANT(NOTIFICATION_VISIBILITY_CHANGED);
diff --git a/scene/resources/bone_map.cpp b/scene/resources/bone_map.cpp
index c73f8ca0b0..759d189bfa 100644
--- a/scene/resources/bone_map.cpp
+++ b/scene/resources/bone_map.cpp
@@ -152,7 +152,6 @@ void BoneMap::_validate_bone_map() {
} else {
bone_map.clear();
}
- emit_signal("retarget_option_updated");
}
void BoneMap::_bind_methods() {
diff --git a/scene/resources/fog_material.cpp b/scene/resources/fog_material.cpp
index 4e51bbaa73..aabaa54505 100644
--- a/scene/resources/fog_material.cpp
+++ b/scene/resources/fog_material.cpp
@@ -159,7 +159,7 @@ uniform sampler3D density_texture: hint_default_white;
void fog() {
DENSITY = density * clamp(exp2(-height_falloff * (WORLD_POSITION.y - OBJECT_POSITION.y)), 0.0, 1.0);
DENSITY *= texture(density_texture, UVW).r;
- DENSITY *= pow(clamp(-SDF / min(min(EXTENTS.x, EXTENTS.y), EXTENTS.z), 0.0, 1.0), edge_fade);
+ DENSITY *= pow(clamp(-2.0 * SDF / min(min(SIZE.x, SIZE.y), SIZE.z), 0.0, 1.0), edge_fade);
ALBEDO = albedo.rgb;
EMISSION = emission.rgb;
}
diff --git a/scene/resources/importer_mesh.cpp b/scene/resources/importer_mesh.cpp
index 742ac2bbd9..672581bbe2 100644
--- a/scene/resources/importer_mesh.cpp
+++ b/scene/resources/importer_mesh.cpp
@@ -452,6 +452,7 @@ void ImporterMesh::generate_lods(float p_normal_merge_angle, float p_normal_spli
new_indices.resize(index_count);
Vector<float> merged_normals_f32 = vector3_to_float32_array(merged_normals.ptr(), merged_normals.size());
+ const int simplify_options = SurfaceTool::SIMPLIFY_LOCK_BORDER;
size_t new_index_count = SurfaceTool::simplify_with_attrib_func(
(unsigned int *)new_indices.ptrw(),
@@ -460,6 +461,7 @@ void ImporterMesh::generate_lods(float p_normal_merge_angle, float p_normal_spli
sizeof(float) * 3, // Vertex stride
index_target,
max_mesh_error,
+ simplify_options,
&mesh_error,
merged_normals_f32.ptr(),
normal_weights.ptr(), 3);
diff --git a/scene/resources/packed_scene.cpp b/scene/resources/packed_scene.cpp
index 7984ec735e..1e9038139e 100644
--- a/scene/resources/packed_scene.cpp
+++ b/scene/resources/packed_scene.cpp
@@ -43,7 +43,7 @@
#include "scene/main/missing_node.h"
#include "scene/property_utils.h"
-#define PACKED_SCENE_VERSION 2
+#define PACKED_SCENE_VERSION 3
#define META_POINTER_PROPERTY_BASE "metadata/_editor_prop_ptr_"
bool SceneState::can_instantiate() const {
return nodes.size() > 0;
@@ -1294,6 +1294,9 @@ void SceneState::set_bundled_scene(const Dictionary &p_dictionary) {
for (int j = 0; j < cd.binds.size(); j++) {
cd.binds.write[j] = r[idx++];
}
+ if (version >= 3) {
+ cd.unbinds = r[idx++];
+ }
}
}
@@ -1380,6 +1383,7 @@ Dictionary SceneState::get_bundled_scene() const {
for (int j = 0; j < cd.binds.size(); j++) {
rconns.push_back(cd.binds[j]);
}
+ rconns.push_back(cd.unbinds);
}
d["conns"] = rconns;
diff --git a/scene/resources/resource_format_text.cpp b/scene/resources/resource_format_text.cpp
index 608d15019e..3006da5309 100644
--- a/scene/resources/resource_format_text.cpp
+++ b/scene/resources/resource_format_text.cpp
@@ -2379,15 +2379,15 @@ Error ResourceFormatSaverText::set_uid(const String &p_path, ResourceUID::ID p_u
String local_path = ProjectSettings::get_singleton()->localize_path(p_path);
Error err = OK;
{
- Ref<FileAccess> fo = FileAccess::open(p_path, FileAccess::READ);
- if (fo.is_null()) {
+ Ref<FileAccess> file = FileAccess::open(p_path, FileAccess::READ);
+ if (file.is_null()) {
ERR_FAIL_V(ERR_CANT_OPEN);
}
ResourceLoaderText loader;
loader.local_path = local_path;
loader.res_path = loader.local_path;
- err = loader.set_uid(fo, p_uid);
+ err = loader.set_uid(file, p_uid);
}
if (err == OK) {
diff --git a/scene/resources/surface_tool.cpp b/scene/resources/surface_tool.cpp
index 5a2b917b9a..16cc1c3370 100644
--- a/scene/resources/surface_tool.cpp
+++ b/scene/resources/surface_tool.cpp
@@ -1307,7 +1307,8 @@ Vector<int> SurfaceTool::generate_lod(float p_threshold, int p_target_index_coun
}
float error;
- uint32_t index_count = simplify_func((unsigned int *)lod.ptrw(), (unsigned int *)index_array.ptr(), index_array.size(), vertices.ptr(), vertex_array.size(), sizeof(float) * 3, p_target_index_count, p_threshold, &error);
+ const int simplify_options = SIMPLIFY_LOCK_BORDER;
+ uint32_t index_count = simplify_func((unsigned int *)lod.ptrw(), (unsigned int *)index_array.ptr(), index_array.size(), vertices.ptr(), vertex_array.size(), sizeof(float) * 3, p_target_index_count, p_threshold, simplify_options, &error);
ERR_FAIL_COND_V(index_count == 0, lod);
lod.resize(index_count);
diff --git a/scene/resources/surface_tool.h b/scene/resources/surface_tool.h
index 00438c4a53..77318bb061 100644
--- a/scene/resources/surface_tool.h
+++ b/scene/resources/surface_tool.h
@@ -74,11 +74,16 @@ public:
SKIN_8_WEIGHTS
};
+ enum {
+ /* Do not move vertices that are located on the topological border (vertices on triangle edges that don't have a paired triangle). Useful for simplifying portions of the larger mesh. */
+ SIMPLIFY_LOCK_BORDER = 1 << 0, // From meshopt_SimplifyLockBorder
+ };
+
typedef void (*OptimizeVertexCacheFunc)(unsigned int *destination, const unsigned int *indices, size_t index_count, size_t vertex_count);
static OptimizeVertexCacheFunc optimize_vertex_cache_func;
- typedef size_t (*SimplifyFunc)(unsigned int *destination, const unsigned int *indices, size_t index_count, const float *vertex_positions, size_t vertex_count, size_t vertex_positions_stride, size_t target_index_count, float target_error, float *r_error);
+ typedef size_t (*SimplifyFunc)(unsigned int *destination, const unsigned int *indices, size_t index_count, const float *vertex_positions, size_t vertex_count, size_t vertex_positions_stride, size_t target_index_count, float target_error, unsigned int options, float *r_error);
static SimplifyFunc simplify_func;
- typedef size_t (*SimplifyWithAttribFunc)(unsigned int *destination, const unsigned int *indices, size_t index_count, const float *vertex_data, size_t vertex_count, size_t vertex_stride, size_t target_index_count, float target_error, float *result_error, const float *attributes, const float *attribute_weights, size_t attribute_count);
+ typedef size_t (*SimplifyWithAttribFunc)(unsigned int *destination, const unsigned int *indices, size_t index_count, const float *vertex_data, size_t vertex_count, size_t vertex_stride, size_t target_index_count, float target_error, unsigned int options, float *result_error, const float *attributes, const float *attribute_weights, size_t attribute_count);
static SimplifyWithAttribFunc simplify_with_attrib_func;
typedef float (*SimplifyScaleFunc)(const float *vertex_positions, size_t vertex_count, size_t vertex_positions_stride);
static SimplifyScaleFunc simplify_scale_func;
diff --git a/scene/resources/visual_shader.cpp b/scene/resources/visual_shader.cpp
index bfcf5cb137..4132972cb3 100644
--- a/scene/resources/visual_shader.cpp
+++ b/scene/resources/visual_shader.cpp
@@ -427,7 +427,10 @@ void VisualShaderNodeCustom::update_ports() {
if (!GDVIRTUAL_CALL(_get_input_port_name, i, port.name)) {
port.name = "in" + itos(i);
}
- if (!GDVIRTUAL_CALL(_get_input_port_type, i, port.type)) {
+ PortType port_type;
+ if (GDVIRTUAL_CALL(_get_input_port_type, i, port_type)) {
+ port.type = (int)port_type;
+ } else {
port.type = (int)PortType::PORT_TYPE_SCALAR;
}
@@ -445,7 +448,10 @@ void VisualShaderNodeCustom::update_ports() {
if (!GDVIRTUAL_CALL(_get_output_port_name, i, port.name)) {
port.name = "out" + itos(i);
}
- if (!GDVIRTUAL_CALL(_get_output_port_type, i, port.type)) {
+ PortType port_type;
+ if (GDVIRTUAL_CALL(_get_output_port_type, i, port_type)) {
+ port.type = (int)port_type;
+ } else {
port.type = (int)PortType::PORT_TYPE_SCALAR;
}
@@ -2702,6 +2708,7 @@ const VisualShaderNodeInput::Port VisualShaderNodeInput::ports[] = {
{ Shader::MODE_SPATIAL, VisualShader::TYPE_VERTEX, VisualShaderNode::PORT_TYPE_SCALAR_INT, "view_index", "VIEW_INDEX" },
{ Shader::MODE_SPATIAL, VisualShader::TYPE_VERTEX, VisualShaderNode::PORT_TYPE_SCALAR_INT, "view_mono_left", "VIEW_MONO_LEFT" },
{ Shader::MODE_SPATIAL, VisualShader::TYPE_VERTEX, VisualShaderNode::PORT_TYPE_SCALAR_INT, "view_right", "VIEW_RIGHT" },
+ { Shader::MODE_SPATIAL, VisualShader::TYPE_VERTEX, VisualShaderNode::PORT_TYPE_VECTOR_3D, "eye_offset", "EYE_OFFSET" },
{ Shader::MODE_SPATIAL, VisualShader::TYPE_VERTEX, VisualShaderNode::PORT_TYPE_VECTOR_3D, "node_position_world", "NODE_POSITION_WORLD" },
{ Shader::MODE_SPATIAL, VisualShader::TYPE_VERTEX, VisualShaderNode::PORT_TYPE_VECTOR_3D, "camera_position_world", "CAMERA_POSITION_WORLD" },
{ Shader::MODE_SPATIAL, VisualShader::TYPE_VERTEX, VisualShaderNode::PORT_TYPE_VECTOR_3D, "camera_direction_world", "CAMERA_DIRECTION_WORLD" },
@@ -2736,6 +2743,7 @@ const VisualShaderNodeInput::Port VisualShaderNodeInput::ports[] = {
{ Shader::MODE_SPATIAL, VisualShader::TYPE_FRAGMENT, VisualShaderNode::PORT_TYPE_SCALAR_INT, "view_index", "VIEW_INDEX" },
{ Shader::MODE_SPATIAL, VisualShader::TYPE_FRAGMENT, VisualShaderNode::PORT_TYPE_SCALAR_INT, "view_mono_left", "VIEW_MONO_LEFT" },
{ Shader::MODE_SPATIAL, VisualShader::TYPE_FRAGMENT, VisualShaderNode::PORT_TYPE_SCALAR_INT, "view_right", "VIEW_RIGHT" },
+ { Shader::MODE_SPATIAL, VisualShader::TYPE_FRAGMENT, VisualShaderNode::PORT_TYPE_VECTOR_3D, "eye_offset", "EYE_OFFSET" },
{ Shader::MODE_SPATIAL, VisualShader::TYPE_FRAGMENT, VisualShaderNode::PORT_TYPE_VECTOR_3D, "node_position_world", "NODE_POSITION_WORLD" },
{ Shader::MODE_SPATIAL, VisualShader::TYPE_FRAGMENT, VisualShaderNode::PORT_TYPE_VECTOR_3D, "camera_position_world", "CAMERA_POSITION_WORLD" },
{ Shader::MODE_SPATIAL, VisualShader::TYPE_FRAGMENT, VisualShaderNode::PORT_TYPE_VECTOR_3D, "camera_direction_world", "CAMERA_DIRECTION_WORLD" },
@@ -2936,7 +2944,7 @@ const VisualShaderNodeInput::Port VisualShaderNodeInput::ports[] = {
{ Shader::MODE_FOG, VisualShader::TYPE_FOG, VisualShaderNode::PORT_TYPE_VECTOR_3D, "world_position", "WORLD_POSITION" },
{ Shader::MODE_FOG, VisualShader::TYPE_FOG, VisualShaderNode::PORT_TYPE_VECTOR_3D, "object_position", "OBJECT_POSITION" },
{ Shader::MODE_FOG, VisualShader::TYPE_FOG, VisualShaderNode::PORT_TYPE_VECTOR_3D, "uvw", "UVW" },
- { Shader::MODE_FOG, VisualShader::TYPE_FOG, VisualShaderNode::PORT_TYPE_VECTOR_3D, "extents", "EXTENTS" },
+ { Shader::MODE_FOG, VisualShader::TYPE_FOG, VisualShaderNode::PORT_TYPE_VECTOR_3D, "size", "SIZE" },
{ Shader::MODE_FOG, VisualShader::TYPE_FOG, VisualShaderNode::PORT_TYPE_SCALAR, "sdf", "SDF" },
{ Shader::MODE_FOG, VisualShader::TYPE_FOG, VisualShaderNode::PORT_TYPE_SCALAR, "time", "TIME" },
diff --git a/scene/resources/visual_shader.h b/scene/resources/visual_shader.h
index 0d53589fa5..fc5e48410b 100644
--- a/scene/resources/visual_shader.h
+++ b/scene/resources/visual_shader.h
@@ -369,12 +369,12 @@ protected:
GDVIRTUAL0RC(String, _get_name)
GDVIRTUAL0RC(String, _get_description)
GDVIRTUAL0RC(String, _get_category)
- GDVIRTUAL0RC(int, _get_return_icon_type)
+ GDVIRTUAL0RC(PortType, _get_return_icon_type)
GDVIRTUAL0RC(int, _get_input_port_count)
- GDVIRTUAL1RC(int, _get_input_port_type, int)
+ GDVIRTUAL1RC(PortType, _get_input_port_type, int)
GDVIRTUAL1RC(String, _get_input_port_name, int)
GDVIRTUAL0RC(int, _get_output_port_count)
- GDVIRTUAL1RC(int, _get_output_port_type, int)
+ GDVIRTUAL1RC(PortType, _get_output_port_type, int)
GDVIRTUAL1RC(String, _get_output_port_name, int)
GDVIRTUAL4RC(String, _get_code, TypedArray<String>, TypedArray<String>, Shader::Mode, VisualShader::Type)
GDVIRTUAL2RC(String, _get_func_code, Shader::Mode, VisualShader::Type)
diff --git a/servers/navigation_server_2d.cpp b/servers/navigation_server_2d.cpp
index 2e4087c1de..85ba8ed431 100644
--- a/servers/navigation_server_2d.cpp
+++ b/servers/navigation_server_2d.cpp
@@ -207,6 +207,30 @@ void NavigationServer2D::set_debug_navigation_enable_edge_connections(const bool
bool NavigationServer2D::get_debug_navigation_enable_edge_connections() const {
return NavigationServer3D::get_singleton()->get_debug_navigation_enable_edge_connections();
}
+
+void NavigationServer2D::set_debug_navigation_agent_path_color(const Color &p_color) {
+ NavigationServer3D::get_singleton()->set_debug_navigation_agent_path_color(p_color);
+}
+
+Color NavigationServer2D::get_debug_navigation_agent_path_color() const {
+ return NavigationServer3D::get_singleton()->get_debug_navigation_agent_path_color();
+}
+
+void NavigationServer2D::set_debug_navigation_enable_agent_paths(const bool p_value) {
+ NavigationServer3D::get_singleton()->set_debug_navigation_enable_agent_paths(p_value);
+}
+
+bool NavigationServer2D::get_debug_navigation_enable_agent_paths() const {
+ return NavigationServer3D::get_singleton()->get_debug_navigation_enable_agent_paths();
+}
+
+void NavigationServer2D::set_debug_navigation_agent_path_point_size(float p_point_size) {
+ NavigationServer3D::get_singleton()->set_debug_navigation_agent_path_point_size(p_point_size);
+}
+
+float NavigationServer2D::get_debug_navigation_agent_path_point_size() const {
+ return NavigationServer3D::get_singleton()->get_debug_navigation_agent_path_point_size();
+}
#endif // DEBUG_ENABLED
void NavigationServer2D::_bind_methods() {
@@ -286,14 +310,26 @@ void NavigationServer2D::_bind_methods() {
ClassDB::bind_method(D_METHOD("free_rid", "rid"), &NavigationServer2D::free);
ADD_SIGNAL(MethodInfo("map_changed", PropertyInfo(Variant::RID, "map")));
+
+ ADD_SIGNAL(MethodInfo("navigation_debug_changed"));
}
NavigationServer2D::NavigationServer2D() {
singleton = this;
ERR_FAIL_COND_MSG(!NavigationServer3D::get_singleton(), "The Navigation3D singleton should be initialized before the 2D one.");
NavigationServer3D::get_singleton()->connect("map_changed", callable_mp(this, &NavigationServer2D::_emit_map_changed));
+
+#ifdef DEBUG_ENABLED
+ NavigationServer3D::get_singleton()->connect(SNAME("navigation_debug_changed"), callable_mp(this, &NavigationServer2D::_emit_navigation_debug_changed_signal));
+#endif // DEBUG_ENABLED
}
+#ifdef DEBUG_ENABLED
+void NavigationServer2D::_emit_navigation_debug_changed_signal() {
+ emit_signal(SNAME("navigation_debug_changed"));
+}
+#endif // DEBUG_ENABLED
+
NavigationServer2D::~NavigationServer2D() {
singleton = nullptr;
}
diff --git a/servers/navigation_server_2d.h b/servers/navigation_server_2d.h
index cd18476182..746389404b 100644
--- a/servers/navigation_server_2d.h
+++ b/servers/navigation_server_2d.h
@@ -254,6 +254,20 @@ public:
void set_debug_navigation_enable_edge_connections(const bool p_value);
bool get_debug_navigation_enable_edge_connections() const;
+
+ void set_debug_navigation_agent_path_color(const Color &p_color);
+ Color get_debug_navigation_agent_path_color() const;
+
+ void set_debug_navigation_enable_agent_paths(const bool p_value);
+ bool get_debug_navigation_enable_agent_paths() const;
+
+ void set_debug_navigation_agent_path_point_size(float p_point_size);
+ float get_debug_navigation_agent_path_point_size() const;
+#endif // DEBUG_ENABLED
+
+#ifdef DEBUG_ENABLED
+private:
+ void _emit_navigation_debug_changed_signal();
#endif // DEBUG_ENABLED
};
diff --git a/servers/navigation_server_3d.cpp b/servers/navigation_server_3d.cpp
index 8f2cff0e04..70897ae75c 100644
--- a/servers/navigation_server_3d.cpp
+++ b/servers/navigation_server_3d.cpp
@@ -159,6 +159,7 @@ NavigationServer3D::NavigationServer3D() {
debug_navigation_geometry_face_disabled_color = GLOBAL_DEF("debug/shapes/navigation/geometry_face_disabled_color", Color(0.5, 0.5, 0.5, 0.4));
debug_navigation_link_connection_color = GLOBAL_DEF("debug/shapes/navigation/link_connection_color", Color(1.0, 0.5, 1.0, 1.0));
debug_navigation_link_connection_disabled_color = GLOBAL_DEF("debug/shapes/navigation/link_connection_disabled_color", Color(0.5, 0.5, 0.5, 1.0));
+ debug_navigation_agent_path_color = GLOBAL_DEF("debug/shapes/navigation/agent_path_color", Color(1.0, 0.0, 0.0, 1.0));
debug_navigation_enable_edge_connections = GLOBAL_DEF("debug/shapes/navigation/enable_edge_connections", true);
debug_navigation_enable_edge_connections_xray = GLOBAL_DEF("debug/shapes/navigation/enable_edge_connections_xray", true);
@@ -168,6 +169,11 @@ NavigationServer3D::NavigationServer3D() {
debug_navigation_enable_link_connections = GLOBAL_DEF("debug/shapes/navigation/enable_link_connections", true);
debug_navigation_enable_link_connections_xray = GLOBAL_DEF("debug/shapes/navigation/enable_link_connections_xray", true);
+ debug_navigation_enable_agent_paths = GLOBAL_DEF("debug/shapes/navigation/enable_agent_paths", true);
+ debug_navigation_enable_agent_paths_xray = GLOBAL_DEF("debug/shapes/navigation/enable_agent_paths_xray", true);
+
+ debug_navigation_agent_path_point_size = GLOBAL_DEF("debug/shapes/navigation/agent_path_point_size", 4.0);
+
if (Engine::get_singleton()->is_editor_hint()) {
// enable NavigationServer3D when in Editor or else navigation mesh edge connections are invisible
// on runtime tests SceneTree has "Visible Navigation" set and main iteration takes care of this
@@ -329,6 +335,42 @@ Ref<StandardMaterial3D> NavigationServer3D::get_debug_navigation_link_connection
return debug_navigation_link_connections_disabled_material;
}
+Ref<StandardMaterial3D> NavigationServer3D::get_debug_navigation_agent_path_line_material() {
+ if (debug_navigation_agent_path_line_material.is_valid()) {
+ return debug_navigation_agent_path_line_material;
+ }
+
+ Ref<StandardMaterial3D> material = Ref<StandardMaterial3D>(memnew(StandardMaterial3D));
+ material->set_shading_mode(StandardMaterial3D::SHADING_MODE_UNSHADED);
+ material->set_albedo(debug_navigation_agent_path_color);
+ if (debug_navigation_enable_agent_paths_xray) {
+ material->set_flag(StandardMaterial3D::FLAG_DISABLE_DEPTH_TEST, true);
+ }
+ material->set_render_priority(StandardMaterial3D::RENDER_PRIORITY_MAX - 2);
+
+ debug_navigation_agent_path_line_material = material;
+ return debug_navigation_agent_path_line_material;
+}
+
+Ref<StandardMaterial3D> NavigationServer3D::get_debug_navigation_agent_path_point_material() {
+ if (debug_navigation_agent_path_point_material.is_valid()) {
+ return debug_navigation_agent_path_point_material;
+ }
+
+ Ref<StandardMaterial3D> material = Ref<StandardMaterial3D>(memnew(StandardMaterial3D));
+ material->set_shading_mode(StandardMaterial3D::SHADING_MODE_UNSHADED);
+ material->set_albedo(debug_navigation_agent_path_color);
+ material->set_flag(StandardMaterial3D::FLAG_USE_POINT_SIZE, true);
+ material->set_point_size(debug_navigation_agent_path_point_size);
+ if (debug_navigation_enable_agent_paths_xray) {
+ material->set_flag(StandardMaterial3D::FLAG_DISABLE_DEPTH_TEST, true);
+ }
+ material->set_render_priority(StandardMaterial3D::RENDER_PRIORITY_MAX - 2);
+
+ debug_navigation_agent_path_point_material = material;
+ return debug_navigation_agent_path_point_material;
+}
+
void NavigationServer3D::set_debug_navigation_edge_connection_color(const Color &p_color) {
debug_navigation_edge_connection_color = p_color;
if (debug_navigation_edge_connections_material.is_valid()) {
@@ -406,6 +448,31 @@ Color NavigationServer3D::get_debug_navigation_link_connection_disabled_color()
return debug_navigation_link_connection_disabled_color;
}
+void NavigationServer3D::set_debug_navigation_agent_path_point_size(float p_point_size) {
+ debug_navigation_agent_path_point_size = MAX(0.1, p_point_size);
+ if (debug_navigation_agent_path_point_material.is_valid()) {
+ debug_navigation_agent_path_point_material->set_point_size(debug_navigation_agent_path_point_size);
+ }
+}
+
+float NavigationServer3D::get_debug_navigation_agent_path_point_size() const {
+ return debug_navigation_agent_path_point_size;
+}
+
+void NavigationServer3D::set_debug_navigation_agent_path_color(const Color &p_color) {
+ debug_navigation_agent_path_color = p_color;
+ if (debug_navigation_agent_path_line_material.is_valid()) {
+ debug_navigation_agent_path_line_material->set_albedo(debug_navigation_agent_path_color);
+ }
+ if (debug_navigation_agent_path_point_material.is_valid()) {
+ debug_navigation_agent_path_point_material->set_albedo(debug_navigation_agent_path_color);
+ }
+}
+
+Color NavigationServer3D::get_debug_navigation_agent_path_color() const {
+ return debug_navigation_agent_path_color;
+}
+
void NavigationServer3D::set_debug_navigation_enable_edge_connections(const bool p_value) {
debug_navigation_enable_edge_connections = p_value;
debug_dirty = true;
@@ -494,6 +561,37 @@ void NavigationServer3D::set_debug_enabled(bool p_enabled) {
bool NavigationServer3D::get_debug_enabled() const {
return debug_enabled;
}
+
+void NavigationServer3D::set_debug_navigation_enable_agent_paths(const bool p_value) {
+ if (debug_navigation_enable_agent_paths != p_value) {
+ debug_dirty = true;
+ }
+
+ debug_navigation_enable_agent_paths = p_value;
+
+ if (debug_dirty) {
+ call_deferred("_emit_navigation_debug_changed_signal");
+ }
+}
+
+bool NavigationServer3D::get_debug_navigation_enable_agent_paths() const {
+ return debug_navigation_enable_agent_paths;
+}
+
+void NavigationServer3D::set_debug_navigation_enable_agent_paths_xray(const bool p_value) {
+ debug_navigation_enable_agent_paths_xray = p_value;
+ if (debug_navigation_agent_path_line_material.is_valid()) {
+ debug_navigation_agent_path_line_material->set_flag(StandardMaterial3D::FLAG_DISABLE_DEPTH_TEST, debug_navigation_enable_agent_paths_xray);
+ }
+ if (debug_navigation_agent_path_point_material.is_valid()) {
+ debug_navigation_agent_path_point_material->set_flag(StandardMaterial3D::FLAG_DISABLE_DEPTH_TEST, debug_navigation_enable_agent_paths_xray);
+ }
+}
+
+bool NavigationServer3D::get_debug_navigation_enable_agent_paths_xray() const {
+ return debug_navigation_enable_agent_paths_xray;
+}
+
#endif // DEBUG_ENABLED
///////////////////////////////////////////////////////
diff --git a/servers/navigation_server_3d.h b/servers/navigation_server_3d.h
index 9c468d1b10..bc4bdf2a30 100644
--- a/servers/navigation_server_3d.h
+++ b/servers/navigation_server_3d.h
@@ -287,6 +287,9 @@ private:
Color debug_navigation_geometry_face_disabled_color = Color(0.5, 0.5, 0.5, 0.4);
Color debug_navigation_link_connection_color = Color(1.0, 0.5, 1.0, 1.0);
Color debug_navigation_link_connection_disabled_color = Color(0.5, 0.5, 0.5, 1.0);
+ Color debug_navigation_agent_path_color = Color(1.0, 0.0, 0.0, 1.0);
+
+ float debug_navigation_agent_path_point_size = 4.0;
bool debug_navigation_enable_edge_connections = true;
bool debug_navigation_enable_edge_connections_xray = true;
@@ -295,6 +298,8 @@ private:
bool debug_navigation_enable_geometry_face_random_color = true;
bool debug_navigation_enable_link_connections = true;
bool debug_navigation_enable_link_connections_xray = true;
+ bool debug_navigation_enable_agent_paths = true;
+ bool debug_navigation_enable_agent_paths_xray = true;
Ref<StandardMaterial3D> debug_navigation_geometry_edge_material;
Ref<StandardMaterial3D> debug_navigation_geometry_face_material;
@@ -304,6 +309,9 @@ private:
Ref<StandardMaterial3D> debug_navigation_link_connections_material;
Ref<StandardMaterial3D> debug_navigation_link_connections_disabled_material;
+ Ref<StandardMaterial3D> debug_navigation_agent_path_line_material;
+ Ref<StandardMaterial3D> debug_navigation_agent_path_point_material;
+
public:
void set_debug_enabled(bool p_enabled);
bool get_debug_enabled() const;
@@ -329,6 +337,9 @@ public:
void set_debug_navigation_link_connection_disabled_color(const Color &p_color);
Color get_debug_navigation_link_connection_disabled_color() const;
+ void set_debug_navigation_agent_path_color(const Color &p_color);
+ Color get_debug_navigation_agent_path_color() const;
+
void set_debug_navigation_enable_edge_connections(const bool p_value);
bool get_debug_navigation_enable_edge_connections() const;
@@ -350,6 +361,15 @@ public:
void set_debug_navigation_enable_link_connections_xray(const bool p_value);
bool get_debug_navigation_enable_link_connections_xray() const;
+ void set_debug_navigation_enable_agent_paths(const bool p_value);
+ bool get_debug_navigation_enable_agent_paths() const;
+
+ void set_debug_navigation_enable_agent_paths_xray(const bool p_value);
+ bool get_debug_navigation_enable_agent_paths_xray() const;
+
+ void set_debug_navigation_agent_path_point_size(float p_point_size);
+ float get_debug_navigation_agent_path_point_size() const;
+
Ref<StandardMaterial3D> get_debug_navigation_geometry_face_material();
Ref<StandardMaterial3D> get_debug_navigation_geometry_edge_material();
Ref<StandardMaterial3D> get_debug_navigation_geometry_face_disabled_material();
@@ -357,6 +377,9 @@ public:
Ref<StandardMaterial3D> get_debug_navigation_edge_connections_material();
Ref<StandardMaterial3D> get_debug_navigation_link_connections_material();
Ref<StandardMaterial3D> get_debug_navigation_link_connections_disabled_material();
+
+ Ref<StandardMaterial3D> get_debug_navigation_agent_path_line_material();
+ Ref<StandardMaterial3D> get_debug_navigation_agent_path_point_material();
#endif // DEBUG_ENABLED
};
diff --git a/servers/physics_2d/godot_space_2d.cpp b/servers/physics_2d/godot_space_2d.cpp
index 1d1f1ba054..1beb5336f7 100644
--- a/servers/physics_2d/godot_space_2d.cpp
+++ b/servers/physics_2d/godot_space_2d.cpp
@@ -83,7 +83,7 @@ int GodotPhysicsDirectSpaceState2D::intersect_point(const PointParameters &p_par
continue;
}
- if (p_parameters.canvas_instance_id.is_valid() && col_obj->get_canvas_instance_id() != p_parameters.canvas_instance_id) {
+ if (col_obj->get_canvas_instance_id() != p_parameters.canvas_instance_id) {
continue;
}
diff --git a/servers/rendering/dummy/environment/fog.h b/servers/rendering/dummy/environment/fog.h
index 5531e2a5d0..10aa242060 100644
--- a/servers/rendering/dummy/environment/fog.h
+++ b/servers/rendering/dummy/environment/fog.h
@@ -44,7 +44,7 @@ public:
virtual void fog_volume_free(RID p_rid) override {}
virtual void fog_volume_set_shape(RID p_fog_volume, RS::FogVolumeShape p_shape) override {}
- virtual void fog_volume_set_extents(RID p_fog_volume, const Vector3 &p_extents) override {}
+ virtual void fog_volume_set_size(RID p_fog_volume, const Vector3 &p_size) override {}
virtual void fog_volume_set_material(RID p_fog_volume, RID p_material) override {}
virtual AABB fog_volume_get_aabb(RID p_fog_volume) const override { return AABB(); }
virtual RS::FogVolumeShape fog_volume_get_shape(RID p_fog_volume) const override { return RS::FOG_VOLUME_SHAPE_BOX; }
diff --git a/servers/rendering/dummy/storage/light_storage.h b/servers/rendering/dummy/storage/light_storage.h
index 99329055a8..9a3918fd86 100644
--- a/servers/rendering/dummy/storage/light_storage.h
+++ b/servers/rendering/dummy/storage/light_storage.h
@@ -101,7 +101,7 @@ public:
virtual void reflection_probe_set_ambient_color(RID p_probe, const Color &p_color) override {}
virtual void reflection_probe_set_ambient_energy(RID p_probe, float p_energy) override {}
virtual void reflection_probe_set_max_distance(RID p_probe, float p_distance) override {}
- virtual void reflection_probe_set_extents(RID p_probe, const Vector3 &p_extents) override {}
+ virtual void reflection_probe_set_size(RID p_probe, const Vector3 &p_size) override {}
virtual void reflection_probe_set_origin_offset(RID p_probe, const Vector3 &p_offset) override {}
virtual void reflection_probe_set_as_interior(RID p_probe, bool p_enable) override {}
virtual void reflection_probe_set_enable_box_projection(RID p_probe, bool p_enable) override {}
@@ -114,7 +114,7 @@ public:
virtual AABB reflection_probe_get_aabb(RID p_probe) const override { return AABB(); }
virtual RS::ReflectionProbeUpdateMode reflection_probe_get_update_mode(RID p_probe) const override { return RenderingServer::REFLECTION_PROBE_UPDATE_ONCE; }
virtual uint32_t reflection_probe_get_cull_mask(RID p_probe) const override { return 0; }
- virtual Vector3 reflection_probe_get_extents(RID p_probe) const override { return Vector3(); }
+ virtual Vector3 reflection_probe_get_size(RID p_probe) const override { return Vector3(); }
virtual Vector3 reflection_probe_get_origin_offset(RID p_probe) const override { return Vector3(); }
virtual float reflection_probe_get_origin_max_distance(RID p_probe) const override { return 0.0; }
virtual bool reflection_probe_renders_shadows(RID p_probe) const override { return false; }
diff --git a/servers/rendering/dummy/storage/texture_storage.h b/servers/rendering/dummy/storage/texture_storage.h
index fd36e7ac10..41251b348c 100644
--- a/servers/rendering/dummy/storage/texture_storage.h
+++ b/servers/rendering/dummy/storage/texture_storage.h
@@ -134,7 +134,7 @@ public:
virtual void decal_initialize(RID p_rid) override {}
virtual void decal_free(RID p_rid) override{};
- virtual void decal_set_extents(RID p_decal, const Vector3 &p_extents) override {}
+ virtual void decal_set_size(RID p_decal, const Vector3 &p_size) override {}
virtual void decal_set_texture(RID p_decal, RS::DecalTexture p_type, RID p_texture) override {}
virtual void decal_set_emission_energy(RID p_decal, float p_energy) override {}
virtual void decal_set_albedo_mix(RID p_decal, float p_mix) override {}
diff --git a/servers/rendering/environment/renderer_fog.h b/servers/rendering/environment/renderer_fog.h
index ac56791711..f5c4134d14 100644
--- a/servers/rendering/environment/renderer_fog.h
+++ b/servers/rendering/environment/renderer_fog.h
@@ -44,7 +44,7 @@ public:
virtual void fog_volume_free(RID p_rid) = 0;
virtual void fog_volume_set_shape(RID p_fog_volume, RS::FogVolumeShape p_shape) = 0;
- virtual void fog_volume_set_extents(RID p_fog_volume, const Vector3 &p_extents) = 0;
+ virtual void fog_volume_set_size(RID p_fog_volume, const Vector3 &p_size) = 0;
virtual void fog_volume_set_material(RID p_fog_volume, RID p_material) = 0;
virtual AABB fog_volume_get_aabb(RID p_fog_volume) const = 0;
virtual RS::FogVolumeShape fog_volume_get_shape(RID p_fog_volume) const = 0;
diff --git a/servers/rendering/renderer_rd/cluster_builder_rd.h b/servers/rendering/renderer_rd/cluster_builder_rd.h
index a13e6c8172..3ca7af70ca 100644
--- a/servers/rendering/renderer_rd/cluster_builder_rd.h
+++ b/servers/rendering/renderer_rd/cluster_builder_rd.h
@@ -330,7 +330,7 @@ public:
render_element_count++;
}
- _FORCE_INLINE_ void add_box(BoxType p_box_type, const Transform3D &p_transform, const Vector3 &p_half_extents) {
+ _FORCE_INLINE_ void add_box(BoxType p_box_type, const Transform3D &p_transform, const Vector3 &p_half_size) {
if (p_box_type == BOX_TYPE_DECAL && cluster_count_by_type[ELEMENT_TYPE_DECAL] == max_elements_by_type) {
return; // Max number elements reached.
}
@@ -342,7 +342,7 @@ public:
Transform3D xform = view_xform * p_transform;
// Extract scale and scale the matrix by it, makes things simpler.
- Vector3 scale = p_half_extents;
+ Vector3 scale = p_half_size;
for (uint32_t i = 0; i < 3; i++) {
float s = xform.basis.rows[i].length();
scale[i] *= s;
diff --git a/servers/rendering/renderer_rd/environment/fog.cpp b/servers/rendering/renderer_rd/environment/fog.cpp
index 2787693aeb..4253ea8610 100644
--- a/servers/rendering/renderer_rd/environment/fog.cpp
+++ b/servers/rendering/renderer_rd/environment/fog.cpp
@@ -82,11 +82,11 @@ void Fog::fog_volume_set_shape(RID p_fog_volume, RS::FogVolumeShape p_shape) {
fog_volume->dependency.changed_notify(Dependency::DEPENDENCY_CHANGED_AABB);
}
-void Fog::fog_volume_set_extents(RID p_fog_volume, const Vector3 &p_extents) {
+void Fog::fog_volume_set_size(RID p_fog_volume, const Vector3 &p_size) {
FogVolume *fog_volume = fog_volume_owner.get_or_null(p_fog_volume);
ERR_FAIL_COND(!fog_volume);
- fog_volume->extents = p_extents;
+ fog_volume->size = p_size;
fog_volume->dependency.changed_notify(Dependency::DEPENDENCY_CHANGED_AABB);
}
@@ -120,8 +120,8 @@ AABB Fog::fog_volume_get_aabb(RID p_fog_volume) const {
case RS::FOG_VOLUME_SHAPE_CYLINDER:
case RS::FOG_VOLUME_SHAPE_BOX: {
AABB aabb;
- aabb.position = -fog_volume->extents;
- aabb.size = fog_volume->extents * 2;
+ aabb.position = -fog_volume->size / 2;
+ aabb.size = fog_volume->size;
return aabb;
}
default: {
@@ -131,10 +131,10 @@ AABB Fog::fog_volume_get_aabb(RID p_fog_volume) const {
}
}
-Vector3 Fog::fog_volume_get_extents(RID p_fog_volume) const {
+Vector3 Fog::fog_volume_get_size(RID p_fog_volume) const {
const FogVolume *fog_volume = fog_volume_owner.get_or_null(p_fog_volume);
ERR_FAIL_COND_V(!fog_volume, Vector3());
- return fog_volume->extents;
+ return fog_volume->size;
}
////////////////////////////////////////////////////////////////////////////////
@@ -210,7 +210,7 @@ void Fog::init_fog_shader(uint32_t p_max_directional_lights, int p_roughness_lay
actions.renames["WORLD_POSITION"] = "world.xyz";
actions.renames["OBJECT_POSITION"] = "params.position";
actions.renames["UVW"] = "uvw";
- actions.renames["EXTENTS"] = "params.extents";
+ actions.renames["SIZE"] = "params.size";
actions.renames["ALBEDO"] = "albedo";
actions.renames["DENSITY"] = "density";
actions.renames["EMISSION"] = "emission";
@@ -643,7 +643,7 @@ void Fog::volumetric_fog_update(const VolumetricFogSettings &p_settings, const P
Vector3 position = fog_volume_instance->transform.get_origin();
RS::FogVolumeShape volume_type = RendererRD::Fog::get_singleton()->fog_volume_get_shape(fog_volume);
- Vector3 extents = RendererRD::Fog::get_singleton()->fog_volume_get_extents(fog_volume);
+ Vector3 extents = RendererRD::Fog::get_singleton()->fog_volume_get_size(fog_volume) / 2;
if (volume_type != RS::FOG_VOLUME_SHAPE_WORLD) {
// Local fog volume.
@@ -683,9 +683,9 @@ void Fog::volumetric_fog_update(const VolumetricFogSettings &p_settings, const P
push_constant.position[0] = position.x;
push_constant.position[1] = position.y;
push_constant.position[2] = position.z;
- push_constant.extents[0] = extents.x;
- push_constant.extents[1] = extents.y;
- push_constant.extents[2] = extents.z;
+ push_constant.size[0] = extents.x * 2;
+ push_constant.size[1] = extents.y * 2;
+ push_constant.size[2] = extents.z * 2;
push_constant.corner[0] = min.x;
push_constant.corner[1] = min.y;
push_constant.corner[2] = min.z;
diff --git a/servers/rendering/renderer_rd/environment/fog.h b/servers/rendering/renderer_rd/environment/fog.h
index eb0a2fc7b5..0b6bcc29fb 100644
--- a/servers/rendering/renderer_rd/environment/fog.h
+++ b/servers/rendering/renderer_rd/environment/fog.h
@@ -53,7 +53,7 @@ private:
struct FogVolume {
RID material;
- Vector3 extents = Vector3(1, 1, 1);
+ Vector3 size = Vector3(2, 2, 2);
RS::FogVolumeShape shape = RS::FOG_VOLUME_SHAPE_BOX;
@@ -83,7 +83,7 @@ private:
float position[3];
float pad;
- float extents[3];
+ float size[3];
float pad2;
int32_t corner[3];
@@ -239,12 +239,12 @@ public:
Dependency *fog_volume_get_dependency(RID p_fog_volume) const;
virtual void fog_volume_set_shape(RID p_fog_volume, RS::FogVolumeShape p_shape) override;
- virtual void fog_volume_set_extents(RID p_fog_volume, const Vector3 &p_extents) override;
+ virtual void fog_volume_set_size(RID p_fog_volume, const Vector3 &p_size) override;
virtual void fog_volume_set_material(RID p_fog_volume, RID p_material) override;
virtual RS::FogVolumeShape fog_volume_get_shape(RID p_fog_volume) const override;
RID fog_volume_get_material(RID p_fog_volume) const;
virtual AABB fog_volume_get_aabb(RID p_fog_volume) const override;
- Vector3 fog_volume_get_extents(RID p_fog_volume) const;
+ Vector3 fog_volume_get_size(RID p_fog_volume) const;
/* FOG VOLUMES INSTANCE */
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 2e844269e3..59e1f559c7 100644
--- a/servers/rendering/renderer_rd/forward_clustered/render_forward_clustered.cpp
+++ b/servers/rendering/renderer_rd/forward_clustered/render_forward_clustered.cpp
@@ -1232,9 +1232,9 @@ void RenderForwardClustered::_update_volumetric_fog(Ref<RenderSceneBuffersRD> p_
/* Lighting */
-void RenderForwardClustered::setup_added_reflection_probe(const Transform3D &p_transform, const Vector3 &p_half_extents) {
+void RenderForwardClustered::setup_added_reflection_probe(const Transform3D &p_transform, const Vector3 &p_half_size) {
if (current_cluster_builder != nullptr) {
- current_cluster_builder->add_box(ClusterBuilderRD::BOX_TYPE_REFLECTION_PROBE, p_transform, p_half_extents);
+ current_cluster_builder->add_box(ClusterBuilderRD::BOX_TYPE_REFLECTION_PROBE, p_transform, p_half_size);
}
}
@@ -1244,9 +1244,9 @@ void RenderForwardClustered::setup_added_light(const RS::LightType p_type, const
}
}
-void RenderForwardClustered::setup_added_decal(const Transform3D &p_transform, const Vector3 &p_half_extents) {
+void RenderForwardClustered::setup_added_decal(const Transform3D &p_transform, const Vector3 &p_half_size) {
if (current_cluster_builder != nullptr) {
- current_cluster_builder->add_box(ClusterBuilderRD::BOX_TYPE_DECAL, p_transform, p_half_extents);
+ current_cluster_builder->add_box(ClusterBuilderRD::BOX_TYPE_DECAL, p_transform, p_half_size);
}
}
@@ -2615,8 +2615,8 @@ void RenderForwardClustered::_render_sdfgi(Ref<RenderSceneBuffersRD> p_render_bu
render_list[RENDER_LIST_SECONDARY].sort_by_key();
_fill_instance_data(RENDER_LIST_SECONDARY);
- Vector3 half_extents = p_bounds.size * 0.5;
- Vector3 center = p_bounds.position + half_extents;
+ Vector3 half_size = p_bounds.size * 0.5;
+ Vector3 center = p_bounds.position + half_size;
Vector<RID> sbs = {
p_albedo_texture,
@@ -2644,16 +2644,16 @@ void RenderForwardClustered::_render_sdfgi(Ref<RenderSceneBuffersRD> p_render_bu
fb_size.x = p_size[right_axis];
fb_size.y = p_size[up_axis];
- scene_data.cam_transform.origin = center + axis * half_extents;
+ scene_data.cam_transform.origin = center + axis * half_size;
scene_data.cam_transform.basis.set_column(0, right);
scene_data.cam_transform.basis.set_column(1, up);
scene_data.cam_transform.basis.set_column(2, axis);
//print_line("pass: " + itos(i) + " xform " + scene_data.cam_transform);
- float h_size = half_extents[right_axis];
- float v_size = half_extents[up_axis];
- float d_size = half_extents[i] * 2.0;
+ float h_size = half_size[right_axis];
+ float v_size = half_size[up_axis];
+ float d_size = half_size[i] * 2.0;
scene_data.cam_projection.set_orthogonal(-h_size, h_size, -v_size, v_size, 0, d_size);
//print_line("pass: " + itos(i) + " cam hsize: " + rtos(h_size) + " vsize: " + rtos(v_size) + " dsize " + rtos(d_size));
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 9245f1b13a..8eb17ba6f4 100644
--- a/servers/rendering/renderer_rd/forward_clustered/render_forward_clustered.h
+++ b/servers/rendering/renderer_rd/forward_clustered/render_forward_clustered.h
@@ -640,9 +640,9 @@ public:
RendererRD::SSEffects *get_ss_effects() { return ss_effects; }
/* callback from updating our lighting UBOs, used to populate cluster builder */
- virtual void setup_added_reflection_probe(const Transform3D &p_transform, const Vector3 &p_half_extents) override;
+ virtual void setup_added_reflection_probe(const Transform3D &p_transform, const Vector3 &p_half_size) override;
virtual void setup_added_light(const RS::LightType p_type, const Transform3D &p_transform, float p_radius, float p_spot_aperture) override;
- virtual void setup_added_decal(const Transform3D &p_transform, const Vector3 &p_half_extents) override;
+ virtual void setup_added_decal(const Transform3D &p_transform, const Vector3 &p_half_size) override;
virtual void base_uniforms_changed() override;
_FORCE_INLINE_ virtual void update_uniform_sets() override {
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 2aaea4288b..3b3979b198 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
@@ -353,6 +353,11 @@ void SceneShaderForwardClustered::ShaderData::set_code(const String &p_code) {
}
int variant = shader_version + shader_flags;
+
+ if (!static_cast<SceneShaderForwardClustered *>(singleton)->shader.is_variant_enabled(variant)) {
+ continue;
+ }
+
RID shader_variant = shader_singleton->shader.version_get_shader(version, variant);
color_pipelines[i][j][l].setup(shader_variant, primitive_rd, raster_state, multisample_state, depth_stencil, blend_state, 0, singleton->default_specialization_constants);
}
@@ -503,7 +508,14 @@ void SceneShaderForwardClustered::init(const String p_defines) {
shader.set_variant_enabled(SHADER_VERSION_DEPTH_PASS_MULTIVIEW, false);
shader.set_variant_enabled(SHADER_VERSION_DEPTH_PASS_WITH_NORMAL_AND_ROUGHNESS_MULTIVIEW, false);
shader.set_variant_enabled(SHADER_VERSION_DEPTH_PASS_WITH_NORMAL_AND_ROUGHNESS_AND_VOXEL_GI_MULTIVIEW, false);
- // TODO Add a way to enable/disable color pass flags
+
+ // Disable Color Passes
+ for (int i = 0; i < SHADER_COLOR_PASS_FLAG_COUNT; i++) {
+ // Selectively disable any shader pass that includes Multiview.
+ if ((i & SHADER_COLOR_PASS_FLAG_MULTIVIEW)) {
+ shader.set_variant_enabled(i + SHADER_VERSION_COLOR_PASS, false);
+ }
+ }
}
}
@@ -625,6 +637,7 @@ void SceneShaderForwardClustered::init(const String p_defines) {
actions.renames["VIEW_INDEX"] = "ViewIndex";
actions.renames["VIEW_MONO_LEFT"] = "0";
actions.renames["VIEW_RIGHT"] = "1";
+ actions.renames["EYE_OFFSET"] = "eye_offset";
//for light
actions.renames["VIEW"] = "view";
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 f9eecf4dc7..cc4a7dfa47 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
@@ -517,6 +517,7 @@ void SceneShaderForwardMobile::init(const String p_defines) {
actions.renames["VIEW_INDEX"] = "ViewIndex";
actions.renames["VIEW_MONO_LEFT"] = "0";
actions.renames["VIEW_RIGHT"] = "1";
+ actions.renames["EYE_OFFSET"] = "eye_offset";
//for light
actions.renames["VIEW"] = "view";
diff --git a/servers/rendering/renderer_rd/renderer_scene_render_rd.h b/servers/rendering/renderer_rd/renderer_scene_render_rd.h
index 6fa2f7a570..7c43021eb0 100644
--- a/servers/rendering/renderer_rd/renderer_scene_render_rd.h
+++ b/servers/rendering/renderer_rd/renderer_scene_render_rd.h
@@ -204,9 +204,9 @@ public:
/* LIGHTING */
- virtual void setup_added_reflection_probe(const Transform3D &p_transform, const Vector3 &p_half_extents){};
+ virtual void setup_added_reflection_probe(const Transform3D &p_transform, const Vector3 &p_half_size){};
virtual void setup_added_light(const RS::LightType p_type, const Transform3D &p_transform, float p_radius, float p_spot_aperture){};
- virtual void setup_added_decal(const Transform3D &p_transform, const Vector3 &p_half_extents){};
+ virtual void setup_added_decal(const Transform3D &p_transform, const Vector3 &p_half_size){};
/* GI */
diff --git a/servers/rendering/renderer_rd/shaders/environment/volumetric_fog.glsl b/servers/rendering/renderer_rd/shaders/environment/volumetric_fog.glsl
index 4658afd02d..8e4f5762fd 100644
--- a/servers/rendering/renderer_rd/shaders/environment/volumetric_fog.glsl
+++ b/servers/rendering/renderer_rd/shaders/environment/volumetric_fog.glsl
@@ -37,7 +37,7 @@ layout(push_constant, std430) uniform Params {
vec3 position;
float pad;
- vec3 extents;
+ vec3 size;
float pad2;
ivec3 corner;
@@ -184,36 +184,37 @@ void main() {
vec4 local_pos = params.transform * world;
local_pos.xyz /= local_pos.w;
+ vec3 half_size = params.size / 2.0;
float sdf = -1.0;
if (params.shape == 0) {
// Ellipsoid
// https://www.shadertoy.com/view/tdS3DG
- float k0 = length(local_pos.xyz / params.extents);
- float k1 = length(local_pos.xyz / (params.extents * params.extents));
+ float k0 = length(local_pos.xyz / half_size);
+ float k1 = length(local_pos.xyz / (half_size * half_size));
sdf = k0 * (k0 - 1.0) / k1;
} else if (params.shape == 1) {
// Cone
// https://iquilezles.org/www/articles/distfunctions/distfunctions.htm
- // Compute the cone angle automatically to fit within the volume's extents.
- float inv_height = 1.0 / max(0.001, params.extents.y);
- float radius = 1.0 / max(0.001, (min(params.extents.x, params.extents.z) * 0.5));
+ // Compute the cone angle automatically to fit within the volume's size.
+ float inv_height = 1.0 / max(0.001, half_size.y);
+ float radius = 1.0 / max(0.001, (min(half_size.x, half_size.z) * 0.5));
float hypotenuse = sqrt(radius * radius + inv_height * inv_height);
float rsin = radius / hypotenuse;
float rcos = inv_height / hypotenuse;
vec2 c = vec2(rsin, rcos);
float q = length(local_pos.xz);
- sdf = max(dot(c, vec2(q, local_pos.y - params.extents.y)), -params.extents.y - local_pos.y);
+ sdf = max(dot(c, vec2(q, local_pos.y - half_size.y)), -half_size.y - local_pos.y);
} else if (params.shape == 2) {
// Cylinder
// https://iquilezles.org/www/articles/distfunctions/distfunctions.htm
- vec2 d = abs(vec2(length(local_pos.xz), local_pos.y)) - vec2(min(params.extents.x, params.extents.z), params.extents.y);
+ vec2 d = abs(vec2(length(local_pos.xz), local_pos.y)) - vec2(min(half_size.x, half_size.z), half_size.y);
sdf = min(max(d.x, d.y), 0.0) + length(max(d, 0.0));
} else if (params.shape == 3) {
// Box
// https://iquilezles.org/www/articles/distfunctions/distfunctions.htm
- vec3 q = abs(local_pos.xyz) - params.extents;
+ vec3 q = abs(local_pos.xyz) - half_size;
sdf = length(max(q, 0.0)) + min(max(q.x, max(q.y, q.z)), 0.0);
}
@@ -222,7 +223,7 @@ void main() {
#ifndef SDF_USED
cull_mask = 1.0 - smoothstep(-0.1, 0.0, sdf);
#endif
- uvw = clamp((local_pos.xyz + params.extents) / (2.0 * params.extents), 0.0, 1.0);
+ uvw = clamp((local_pos.xyz + half_size) / params.size, 0.0, 1.0);
}
if (cull_mask > 0.0) {
diff --git a/servers/rendering/renderer_rd/shaders/forward_clustered/scene_forward_clustered.glsl b/servers/rendering/renderer_rd/shaders/forward_clustered/scene_forward_clustered.glsl
index c6a3c42e57..21fa7fa148 100644
--- a/servers/rendering/renderer_rd/shaders/forward_clustered/scene_forward_clustered.glsl
+++ b/servers/rendering/renderer_rd/shaders/forward_clustered/scene_forward_clustered.glsl
@@ -315,9 +315,11 @@ void vertex_shader(in uint instance_index, in bool is_multimesh, in uint multime
#ifdef USE_MULTIVIEW
mat4 projection_matrix = scene_data.projection_matrix_view[ViewIndex];
mat4 inv_projection_matrix = scene_data.inv_projection_matrix_view[ViewIndex];
+ vec3 eye_offset = scene_data.eye_offset[ViewIndex].xyz;
#else
mat4 projection_matrix = scene_data.projection_matrix;
mat4 inv_projection_matrix = scene_data.inv_projection_matrix;
+ vec3 eye_offset = vec3(0.0, 0.0, 0.0);
#endif //USE_MULTIVIEW
//using world coordinates
@@ -722,8 +724,10 @@ void fragment_shader(in SceneData scene_data) {
//lay out everything, whatever is unused is optimized away anyway
vec3 vertex = vertex_interp;
#ifdef USE_MULTIVIEW
- vec3 view = -normalize(vertex_interp - scene_data.eye_offset[ViewIndex].xyz);
+ vec3 eye_offset = scene_data.eye_offset[ViewIndex].xyz;
+ vec3 view = -normalize(vertex_interp - eye_offset);
#else
+ vec3 eye_offset = vec3(0.0, 0.0, 0.0);
vec3 view = -normalize(vertex_interp);
#endif
vec3 albedo = vec3(1.0);
diff --git a/servers/rendering/renderer_rd/shaders/forward_mobile/scene_forward_mobile.glsl b/servers/rendering/renderer_rd/shaders/forward_mobile/scene_forward_mobile.glsl
index 90e902ca33..a8b28bbd4f 100644
--- a/servers/rendering/renderer_rd/shaders/forward_mobile/scene_forward_mobile.glsl
+++ b/servers/rendering/renderer_rd/shaders/forward_mobile/scene_forward_mobile.glsl
@@ -314,9 +314,11 @@ void main() {
#ifdef USE_MULTIVIEW
mat4 projection_matrix = scene_data.projection_matrix_view[ViewIndex];
mat4 inv_projection_matrix = scene_data.inv_projection_matrix_view[ViewIndex];
+ vec3 eye_offset = scene_data.eye_offset[ViewIndex].xyz;
#else
mat4 projection_matrix = scene_data.projection_matrix;
mat4 inv_projection_matrix = scene_data.inv_projection_matrix;
+ vec3 eye_offset = vec3(0.0, 0.0, 0.0);
#endif //USE_MULTIVIEW
//using world coordinates
@@ -671,8 +673,10 @@ void main() {
//lay out everything, whatever is unused is optimized away anyway
vec3 vertex = vertex_interp;
#ifdef USE_MULTIVIEW
- vec3 view = -normalize(vertex_interp - scene_data.eye_offset[ViewIndex].xyz);
+ vec3 eye_offset = scene_data.eye_offset[ViewIndex].xyz;
+ vec3 view = -normalize(vertex_interp - eye_offset);
#else
+ vec3 eye_offset = vec3(0.0, 0.0, 0.0);
vec3 view = -normalize(vertex_interp);
#endif
vec3 albedo = vec3(1.0);
diff --git a/servers/rendering/renderer_rd/storage_rd/light_storage.cpp b/servers/rendering/renderer_rd/storage_rd/light_storage.cpp
index f56cee9e12..968f804593 100644
--- a/servers/rendering/renderer_rd/storage_rd/light_storage.cpp
+++ b/servers/rendering/renderer_rd/storage_rd/light_storage.cpp
@@ -1066,14 +1066,14 @@ void LightStorage::reflection_probe_set_max_distance(RID p_probe, float p_distan
reflection_probe->dependency.changed_notify(Dependency::DEPENDENCY_CHANGED_REFLECTION_PROBE);
}
-void LightStorage::reflection_probe_set_extents(RID p_probe, const Vector3 &p_extents) {
+void LightStorage::reflection_probe_set_size(RID p_probe, const Vector3 &p_size) {
ReflectionProbe *reflection_probe = reflection_probe_owner.get_or_null(p_probe);
ERR_FAIL_COND(!reflection_probe);
- if (reflection_probe->extents == p_extents) {
+ if (reflection_probe->size == p_size) {
return;
}
- reflection_probe->extents = p_extents;
+ reflection_probe->size = p_size;
reflection_probe->dependency.changed_notify(Dependency::DEPENDENCY_CHANGED_REFLECTION_PROBE);
}
@@ -1145,8 +1145,8 @@ AABB LightStorage::reflection_probe_get_aabb(RID p_probe) const {
ERR_FAIL_COND_V(!reflection_probe, AABB());
AABB aabb;
- aabb.position = -reflection_probe->extents;
- aabb.size = reflection_probe->extents * 2.0;
+ aabb.position = -reflection_probe->size / 2;
+ aabb.size = reflection_probe->size;
return aabb;
}
@@ -1165,11 +1165,11 @@ uint32_t LightStorage::reflection_probe_get_cull_mask(RID p_probe) const {
return reflection_probe->cull_mask;
}
-Vector3 LightStorage::reflection_probe_get_extents(RID p_probe) const {
+Vector3 LightStorage::reflection_probe_get_size(RID p_probe) const {
const ReflectionProbe *reflection_probe = reflection_probe_owner.get_or_null(p_probe);
ERR_FAIL_COND_V(!reflection_probe, Vector3());
- return reflection_probe->extents;
+ return reflection_probe->size;
}
Vector3 LightStorage::reflection_probe_get_origin_offset(RID p_probe) const {
@@ -1674,7 +1674,7 @@ void LightStorage::update_reflection_probe_buffer(RenderDataRD *p_render_data, c
ReflectionData &reflection_ubo = reflections[i];
- Vector3 extents = probe->extents;
+ Vector3 extents = probe->size / 2;
rpi->cull_mask = probe->cull_mask;
diff --git a/servers/rendering/renderer_rd/storage_rd/light_storage.h b/servers/rendering/renderer_rd/storage_rd/light_storage.h
index d359219128..68f439ddef 100644
--- a/servers/rendering/renderer_rd/storage_rd/light_storage.h
+++ b/servers/rendering/renderer_rd/storage_rd/light_storage.h
@@ -226,7 +226,7 @@ private:
Color ambient_color;
float ambient_color_energy = 1.0;
float max_distance = 0;
- Vector3 extents = Vector3(10, 10, 10);
+ Vector3 size = Vector3(20, 20, 20);
Vector3 origin_offset;
bool interior = false;
bool box_projection = false;
@@ -791,7 +791,7 @@ public:
virtual void reflection_probe_set_ambient_color(RID p_probe, const Color &p_color) override;
virtual void reflection_probe_set_ambient_energy(RID p_probe, float p_energy) override;
virtual void reflection_probe_set_max_distance(RID p_probe, float p_distance) override;
- virtual void reflection_probe_set_extents(RID p_probe, const Vector3 &p_extents) override;
+ virtual void reflection_probe_set_size(RID p_probe, const Vector3 &p_size) override;
virtual void reflection_probe_set_origin_offset(RID p_probe, const Vector3 &p_offset) override;
virtual void reflection_probe_set_as_interior(RID p_probe, bool p_enable) override;
virtual void reflection_probe_set_enable_box_projection(RID p_probe, bool p_enable) override;
@@ -805,7 +805,7 @@ public:
virtual AABB reflection_probe_get_aabb(RID p_probe) const override;
virtual RS::ReflectionProbeUpdateMode reflection_probe_get_update_mode(RID p_probe) const override;
virtual uint32_t reflection_probe_get_cull_mask(RID p_probe) const override;
- virtual Vector3 reflection_probe_get_extents(RID p_probe) const override;
+ virtual Vector3 reflection_probe_get_size(RID p_probe) const override;
virtual Vector3 reflection_probe_get_origin_offset(RID p_probe) const override;
virtual float reflection_probe_get_origin_max_distance(RID p_probe) const override;
virtual float reflection_probe_get_mesh_lod_threshold(RID p_probe) const override;
diff --git a/servers/rendering/renderer_rd/storage_rd/material_storage.h b/servers/rendering/renderer_rd/storage_rd/material_storage.h
index 0ac5557659..ac217d9a49 100644
--- a/servers/rendering/renderer_rd/storage_rd/material_storage.h
+++ b/servers/rendering/renderer_rd/storage_rd/material_storage.h
@@ -323,13 +323,13 @@ public:
// http://andrewthall.org/papers/df64_qf128.pdf
#ifdef REAL_T_IS_DOUBLE
- static _FORCE_INLINE_ void split_double(double a, float *ahi, float *alo) {
+ static _FORCE_INLINE_ void split_double(double a, float *a_hi, float *a_lo) {
const double SPLITTER = (1 << 29) + 1;
double t = a * SPLITTER;
- double thi = t - (t - a);
- double tlo = a - thi;
- *ahi = (float)thi;
- *alo = (float)tlo;
+ double t_hi = t - (t - a);
+ double t_lo = a - t_hi;
+ *a_hi = (float)t_hi;
+ *a_lo = (float)t_lo;
}
#endif
diff --git a/servers/rendering/renderer_rd/storage_rd/mesh_storage.cpp b/servers/rendering/renderer_rd/storage_rd/mesh_storage.cpp
index 9124886764..f65676185c 100644
--- a/servers/rendering/renderer_rd/storage_rd/mesh_storage.cpp
+++ b/servers/rendering/renderer_rd/storage_rd/mesh_storage.cpp
@@ -986,7 +986,10 @@ void MeshStorage::update_mesh_instances() {
push_constant.skin_stride = (mi->mesh->surfaces[i]->skin_buffer_size / mi->mesh->surfaces[i]->vertex_count) / 4;
push_constant.skin_weight_offset = (mi->mesh->surfaces[i]->format & RS::ARRAY_FLAG_USE_8_BONE_WEIGHTS) ? 4 : 2;
- Transform2D transform = mi->canvas_item_transform_2d.affine_inverse() * sk->base_transform_2d;
+ Transform2D transform = Transform2D();
+ if (sk && sk->use_2d) {
+ transform = mi->canvas_item_transform_2d.affine_inverse() * sk->base_transform_2d;
+ }
push_constant.skeleton_transform_x[0] = transform.columns[0][0];
push_constant.skeleton_transform_x[1] = transform.columns[0][1];
push_constant.skeleton_transform_y[0] = transform.columns[1][0];
diff --git a/servers/rendering/renderer_rd/storage_rd/texture_storage.cpp b/servers/rendering/renderer_rd/storage_rd/texture_storage.cpp
index 2eaa7824fb..5d845ce510 100644
--- a/servers/rendering/renderer_rd/storage_rd/texture_storage.cpp
+++ b/servers/rendering/renderer_rd/storage_rd/texture_storage.cpp
@@ -1853,10 +1853,10 @@ void TextureStorage::decal_free(RID p_rid) {
decal_owner.free(p_rid);
}
-void TextureStorage::decal_set_extents(RID p_decal, const Vector3 &p_extents) {
+void TextureStorage::decal_set_size(RID p_decal, const Vector3 &p_size) {
Decal *decal = decal_owner.get_or_null(p_decal);
ERR_FAIL_COND(!decal);
- decal->extents = p_extents;
+ decal->size = p_size;
decal->dependency.changed_notify(Dependency::DEPENDENCY_CHANGED_AABB);
}
@@ -1949,7 +1949,7 @@ AABB TextureStorage::decal_get_aabb(RID p_decal) const {
Decal *decal = decal_owner.get_or_null(p_decal);
ERR_FAIL_COND_V(!decal, AABB());
- return AABB(-decal->extents, decal->extents * 2.0);
+ return AABB(-decal->size / 2, decal->size);
}
Dependency *TextureStorage::decal_get_dependency(RID p_decal) {
@@ -2312,7 +2312,7 @@ void TextureStorage::update_decal_buffer(const PagedArray<RID> &p_decals, const
DecalData &dd = decals[i];
- Vector3 decal_extents = decal->extents;
+ Vector3 decal_extents = decal->size / 2;
Transform3D scale_xform;
scale_xform.basis.scale(decal_extents);
diff --git a/servers/rendering/renderer_rd/storage_rd/texture_storage.h b/servers/rendering/renderer_rd/storage_rd/texture_storage.h
index ea0df0b459..aeab3bf3cb 100644
--- a/servers/rendering/renderer_rd/storage_rd/texture_storage.h
+++ b/servers/rendering/renderer_rd/storage_rd/texture_storage.h
@@ -235,7 +235,7 @@ private:
} decal_atlas;
struct Decal {
- Vector3 extents = Vector3(1, 1, 1);
+ Vector3 size = Vector3(2, 2, 2);
RID textures[RS::DECAL_TEXTURE_MAX];
float emission_energy = 1.0;
float albedo_mix = 1.0;
@@ -561,7 +561,7 @@ public:
virtual void decal_initialize(RID p_decal) override;
virtual void decal_free(RID p_rid) override;
- virtual void decal_set_extents(RID p_decal, const Vector3 &p_extents) override;
+ virtual void decal_set_size(RID p_decal, const Vector3 &p_size) override;
virtual void decal_set_texture(RID p_decal, RS::DecalTexture p_type, RID p_texture) override;
virtual void decal_set_emission_energy(RID p_decal, float p_energy) override;
virtual void decal_set_albedo_mix(RID p_decal, float p_mix) override;
@@ -577,9 +577,9 @@ public:
virtual void texture_add_to_decal_atlas(RID p_texture, bool p_panorama_to_dp = false) override;
virtual void texture_remove_from_decal_atlas(RID p_texture, bool p_panorama_to_dp = false) override;
- _FORCE_INLINE_ Vector3 decal_get_extents(RID p_decal) {
+ _FORCE_INLINE_ Vector3 decal_get_size(RID p_decal) {
const Decal *decal = decal_owner.get_or_null(p_decal);
- return decal->extents;
+ return decal->size;
}
_FORCE_INLINE_ RID decal_get_texture(RID p_decal, RS::DecalTexture p_texture) {
diff --git a/servers/rendering/renderer_scene_cull.cpp b/servers/rendering/renderer_scene_cull.cpp
index 6f4bb115fc..d696955800 100644
--- a/servers/rendering/renderer_scene_cull.cpp
+++ b/servers/rendering/renderer_scene_cull.cpp
@@ -3396,13 +3396,13 @@ bool RendererSceneCull::_render_reflection_probe_step(Instance *p_instance, int
Vector3(0, -1, 0)
};
- Vector3 extents = RSG::light_storage->reflection_probe_get_extents(p_instance->base);
+ Vector3 probe_size = RSG::light_storage->reflection_probe_get_size(p_instance->base);
Vector3 origin_offset = RSG::light_storage->reflection_probe_get_origin_offset(p_instance->base);
float max_distance = RSG::light_storage->reflection_probe_get_origin_max_distance(p_instance->base);
- float size = RSG::light_storage->reflection_atlas_get_size(scenario->reflection_atlas);
- float mesh_lod_threshold = RSG::light_storage->reflection_probe_get_mesh_lod_threshold(p_instance->base) / size;
+ float atlas_size = RSG::light_storage->reflection_atlas_get_size(scenario->reflection_atlas);
+ float mesh_lod_threshold = RSG::light_storage->reflection_probe_get_mesh_lod_threshold(p_instance->base) / atlas_size;
- Vector3 edge = view_normals[p_step] * extents;
+ Vector3 edge = view_normals[p_step] * probe_size / 2;
float distance = ABS(view_normals[p_step].dot(edge) - view_normals[p_step].dot(origin_offset)); //distance from origin offset to actual view distance limit
max_distance = MAX(max_distance, distance);
diff --git a/servers/rendering/rendering_server_default.h b/servers/rendering/rendering_server_default.h
index bcaaba8d65..4f52a63b2f 100644
--- a/servers/rendering/rendering_server_default.h
+++ b/servers/rendering/rendering_server_default.h
@@ -387,7 +387,7 @@ public:
FUNC2(reflection_probe_set_ambient_energy, RID, float)
FUNC2(reflection_probe_set_ambient_mode, RID, ReflectionProbeAmbientMode)
FUNC2(reflection_probe_set_max_distance, RID, float)
- FUNC2(reflection_probe_set_extents, RID, const Vector3 &)
+ FUNC2(reflection_probe_set_size, RID, const Vector3 &)
FUNC2(reflection_probe_set_origin_offset, RID, const Vector3 &)
FUNC2(reflection_probe_set_as_interior, RID, bool)
FUNC2(reflection_probe_set_enable_box_projection, RID, bool)
@@ -428,7 +428,7 @@ public:
FUNCRIDSPLIT(decal)
- FUNC2(decal_set_extents, RID, const Vector3 &)
+ FUNC2(decal_set_size, RID, const Vector3 &)
FUNC3(decal_set_texture, RID, DecalTexture, RID)
FUNC2(decal_set_emission_energy, RID, float)
FUNC2(decal_set_albedo_mix, RID, float)
@@ -540,7 +540,7 @@ public:
FUNCRIDSPLIT(fog_volume)
FUNC2(fog_volume_set_shape, RID, FogVolumeShape)
- FUNC2(fog_volume_set_extents, RID, const Vector3 &)
+ FUNC2(fog_volume_set_size, RID, const Vector3 &)
FUNC2(fog_volume_set_material, RID, RID)
/* VISIBILITY_NOTIFIER */
diff --git a/servers/rendering/shader_language.cpp b/servers/rendering/shader_language.cpp
index 11a9303f11..44c4ad6e56 100644
--- a/servers/rendering/shader_language.cpp
+++ b/servers/rendering/shader_language.cpp
@@ -4530,14 +4530,14 @@ bool ShaderLanguage::_check_node_constness(const Node *p_node) const {
case Node::TYPE_CONSTANT:
break;
case Node::TYPE_VARIABLE: {
- const VariableNode *varn = static_cast<const VariableNode *>(p_node);
- if (!varn->is_const) {
+ const VariableNode *var_node = static_cast<const VariableNode *>(p_node);
+ if (!var_node->is_const) {
return false;
}
} break;
case Node::TYPE_ARRAY: {
- const ArrayNode *arrn = static_cast<const ArrayNode *>(p_node);
- if (!arrn->is_const) {
+ const ArrayNode *arr_node = static_cast<const ArrayNode *>(p_node);
+ if (!arr_node->is_const) {
return false;
}
} break;
diff --git a/servers/rendering/shader_types.cpp b/servers/rendering/shader_types.cpp
index ba39328b2e..56d00fa1bb 100644
--- a/servers/rendering/shader_types.cpp
+++ b/servers/rendering/shader_types.cpp
@@ -106,6 +106,7 @@ ShaderTypes::ShaderTypes() {
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["vertex"].built_ins["EYE_OFFSET"] = constt(ShaderLanguage::TYPE_VEC3);
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);
@@ -151,6 +152,7 @@ ShaderTypes::ShaderTypes() {
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["EYE_OFFSET"] = constt(ShaderLanguage::TYPE_VEC3);
shader_modes[RS::SHADER_SPATIAL].functions["fragment"].built_ins["OUTPUT_IS_SRGB"] = constt(ShaderLanguage::TYPE_BOOL);
@@ -464,7 +466,7 @@ ShaderTypes::ShaderTypes() {
shader_modes[RS::SHADER_FOG].functions["fog"].built_ins["WORLD_POSITION"] = constt(ShaderLanguage::TYPE_VEC3);
shader_modes[RS::SHADER_FOG].functions["fog"].built_ins["OBJECT_POSITION"] = constt(ShaderLanguage::TYPE_VEC3);
shader_modes[RS::SHADER_FOG].functions["fog"].built_ins["UVW"] = constt(ShaderLanguage::TYPE_VEC3);
- shader_modes[RS::SHADER_FOG].functions["fog"].built_ins["EXTENTS"] = constt(ShaderLanguage::TYPE_VEC3);
+ shader_modes[RS::SHADER_FOG].functions["fog"].built_ins["SIZE"] = constt(ShaderLanguage::TYPE_VEC3);
shader_modes[RS::SHADER_FOG].functions["fog"].built_ins["SDF"] = constt(ShaderLanguage::TYPE_FLOAT);
shader_modes[RS::SHADER_FOG].functions["fog"].built_ins["ALBEDO"] = ShaderLanguage::TYPE_VEC3;
shader_modes[RS::SHADER_FOG].functions["fog"].built_ins["DENSITY"] = ShaderLanguage::TYPE_FLOAT;
diff --git a/servers/rendering/storage/light_storage.h b/servers/rendering/storage/light_storage.h
index 413f06bc5b..9f3f5dd8e4 100644
--- a/servers/rendering/storage/light_storage.h
+++ b/servers/rendering/storage/light_storage.h
@@ -110,7 +110,7 @@ public:
virtual void reflection_probe_set_ambient_color(RID p_probe, const Color &p_color) = 0;
virtual void reflection_probe_set_ambient_energy(RID p_probe, float p_energy) = 0;
virtual void reflection_probe_set_max_distance(RID p_probe, float p_distance) = 0;
- virtual void reflection_probe_set_extents(RID p_probe, const Vector3 &p_extents) = 0;
+ virtual void reflection_probe_set_size(RID p_probe, const Vector3 &p_size) = 0;
virtual void reflection_probe_set_origin_offset(RID p_probe, const Vector3 &p_offset) = 0;
virtual void reflection_probe_set_as_interior(RID p_probe, bool p_enable) = 0;
virtual void reflection_probe_set_enable_box_projection(RID p_probe, bool p_enable) = 0;
@@ -121,7 +121,7 @@ public:
virtual AABB reflection_probe_get_aabb(RID p_probe) const = 0;
virtual RS::ReflectionProbeUpdateMode reflection_probe_get_update_mode(RID p_probe) const = 0;
virtual uint32_t reflection_probe_get_cull_mask(RID p_probe) const = 0;
- virtual Vector3 reflection_probe_get_extents(RID p_probe) const = 0;
+ virtual Vector3 reflection_probe_get_size(RID p_probe) const = 0;
virtual Vector3 reflection_probe_get_origin_offset(RID p_probe) const = 0;
virtual float reflection_probe_get_origin_max_distance(RID p_probe) const = 0;
virtual bool reflection_probe_renders_shadows(RID p_probe) const = 0;
diff --git a/servers/rendering/storage/texture_storage.h b/servers/rendering/storage/texture_storage.h
index 4c4a84d04e..3a9034ad0d 100644
--- a/servers/rendering/storage/texture_storage.h
+++ b/servers/rendering/storage/texture_storage.h
@@ -107,7 +107,7 @@ public:
virtual void decal_initialize(RID p_rid) = 0;
virtual void decal_free(RID p_rid) = 0;
- virtual void decal_set_extents(RID p_decal, const Vector3 &p_extents) = 0;
+ virtual void decal_set_size(RID p_decal, const Vector3 &p_size) = 0;
virtual void decal_set_texture(RID p_decal, RS::DecalTexture p_type, RID p_texture) = 0;
virtual void decal_set_emission_energy(RID p_decal, float p_energy) = 0;
virtual void decal_set_albedo_mix(RID p_decal, float p_mix) = 0;
diff --git a/servers/rendering_server.cpp b/servers/rendering_server.cpp
index cea7912574..1c19b9dcd0 100644
--- a/servers/rendering_server.cpp
+++ b/servers/rendering_server.cpp
@@ -1968,7 +1968,7 @@ void RenderingServer::_bind_methods() {
ClassDB::bind_method(D_METHOD("reflection_probe_set_ambient_color", "probe", "color"), &RenderingServer::reflection_probe_set_ambient_color);
ClassDB::bind_method(D_METHOD("reflection_probe_set_ambient_energy", "probe", "energy"), &RenderingServer::reflection_probe_set_ambient_energy);
ClassDB::bind_method(D_METHOD("reflection_probe_set_max_distance", "probe", "distance"), &RenderingServer::reflection_probe_set_max_distance);
- ClassDB::bind_method(D_METHOD("reflection_probe_set_extents", "probe", "extents"), &RenderingServer::reflection_probe_set_extents);
+ ClassDB::bind_method(D_METHOD("reflection_probe_set_size", "probe", "size"), &RenderingServer::reflection_probe_set_size);
ClassDB::bind_method(D_METHOD("reflection_probe_set_origin_offset", "probe", "offset"), &RenderingServer::reflection_probe_set_origin_offset);
ClassDB::bind_method(D_METHOD("reflection_probe_set_as_interior", "probe", "enable"), &RenderingServer::reflection_probe_set_as_interior);
ClassDB::bind_method(D_METHOD("reflection_probe_set_enable_box_projection", "probe", "enable"), &RenderingServer::reflection_probe_set_enable_box_projection);
@@ -1987,7 +1987,7 @@ void RenderingServer::_bind_methods() {
/* DECAL */
ClassDB::bind_method(D_METHOD("decal_create"), &RenderingServer::decal_create);
- ClassDB::bind_method(D_METHOD("decal_set_extents", "decal", "extents"), &RenderingServer::decal_set_extents);
+ ClassDB::bind_method(D_METHOD("decal_set_size", "decal", "size"), &RenderingServer::decal_set_size);
ClassDB::bind_method(D_METHOD("decal_set_texture", "decal", "type", "texture"), &RenderingServer::decal_set_texture);
ClassDB::bind_method(D_METHOD("decal_set_emission_energy", "decal", "energy"), &RenderingServer::decal_set_emission_energy);
ClassDB::bind_method(D_METHOD("decal_set_albedo_mix", "decal", "albedo_mix"), &RenderingServer::decal_set_albedo_mix);
@@ -2147,7 +2147,7 @@ void RenderingServer::_bind_methods() {
ClassDB::bind_method(D_METHOD("fog_volume_create"), &RenderingServer::fog_volume_create);
ClassDB::bind_method(D_METHOD("fog_volume_set_shape", "fog_volume", "shape"), &RenderingServer::fog_volume_set_shape);
- ClassDB::bind_method(D_METHOD("fog_volume_set_extents", "fog_volume", "extents"), &RenderingServer::fog_volume_set_extents);
+ ClassDB::bind_method(D_METHOD("fog_volume_set_size", "fog_volume", "size"), &RenderingServer::fog_volume_set_size);
ClassDB::bind_method(D_METHOD("fog_volume_set_material", "fog_volume", "material"), &RenderingServer::fog_volume_set_material);
BIND_ENUM_CONSTANT(FOG_VOLUME_SHAPE_ELLIPSOID);
diff --git a/servers/rendering_server.h b/servers/rendering_server.h
index b416ed30e2..1f9bff7c3f 100644
--- a/servers/rendering_server.h
+++ b/servers/rendering_server.h
@@ -541,7 +541,7 @@ public:
virtual void reflection_probe_set_ambient_color(RID p_probe, const Color &p_color) = 0;
virtual void reflection_probe_set_ambient_energy(RID p_probe, float p_energy) = 0;
virtual void reflection_probe_set_max_distance(RID p_probe, float p_distance) = 0;
- virtual void reflection_probe_set_extents(RID p_probe, const Vector3 &p_extents) = 0;
+ virtual void reflection_probe_set_size(RID p_probe, const Vector3 &p_size) = 0;
virtual void reflection_probe_set_origin_offset(RID p_probe, const Vector3 &p_offset) = 0;
virtual void reflection_probe_set_as_interior(RID p_probe, bool p_enable) = 0;
virtual void reflection_probe_set_enable_box_projection(RID p_probe, bool p_enable) = 0;
@@ -561,7 +561,7 @@ public:
};
virtual RID decal_create() = 0;
- virtual void decal_set_extents(RID p_decal, const Vector3 &p_extents) = 0;
+ virtual void decal_set_size(RID p_decal, const Vector3 &p_size) = 0;
virtual void decal_set_texture(RID p_decal, DecalTexture p_type, RID p_texture) = 0;
virtual void decal_set_emission_energy(RID p_decal, float p_energy) = 0;
virtual void decal_set_albedo_mix(RID p_decal, float p_mix) = 0;
@@ -750,7 +750,7 @@ public:
};
virtual void fog_volume_set_shape(RID p_fog_volume, FogVolumeShape p_shape) = 0;
- virtual void fog_volume_set_extents(RID p_fog_volume, const Vector3 &p_extents) = 0;
+ virtual void fog_volume_set_size(RID p_fog_volume, const Vector3 &p_size) = 0;
virtual void fog_volume_set_material(RID p_fog_volume, RID p_material) = 0;
/* VISIBILITY NOTIFIER API */
diff --git a/servers/xr/xr_interface_extension.cpp b/servers/xr/xr_interface_extension.cpp
index 63e862f605..0ff59d2a39 100644
--- a/servers/xr/xr_interface_extension.cpp
+++ b/servers/xr/xr_interface_extension.cpp
@@ -136,9 +136,9 @@ PackedStringArray XRInterfaceExtension::get_suggested_pose_names(const StringNam
}
XRInterface::TrackingStatus XRInterfaceExtension::get_tracking_status() const {
- uint32_t status = XR_UNKNOWN_TRACKING;
+ XRInterface::TrackingStatus status = XR_UNKNOWN_TRACKING;
GDVIRTUAL_CALL(_get_tracking_status, status);
- return TrackingStatus(status);
+ return status;
}
void XRInterfaceExtension::trigger_haptic_pulse(const String &p_action_name, const StringName &p_tracker_name, double p_frequency, double p_amplitude, double p_duration_sec, double p_delay_sec) {
@@ -152,9 +152,9 @@ bool XRInterfaceExtension::supports_play_area_mode(XRInterface::PlayAreaMode p_m
}
XRInterface::PlayAreaMode XRInterfaceExtension::get_play_area_mode() const {
- uint32_t mode = XR_PLAY_AREA_UNKNOWN;
+ XRInterface::PlayAreaMode mode = XR_PLAY_AREA_UNKNOWN;
GDVIRTUAL_CALL(_get_play_area_mode, mode);
- return XRInterface::PlayAreaMode(mode);
+ return mode;
}
bool XRInterfaceExtension::set_play_area_mode(XRInterface::PlayAreaMode p_mode) {
diff --git a/servers/xr/xr_interface_extension.h b/servers/xr/xr_interface_extension.h
index 39cd284e5c..454a50cb28 100644
--- a/servers/xr/xr_interface_extension.h
+++ b/servers/xr/xr_interface_extension.h
@@ -71,7 +71,7 @@ public:
GDVIRTUAL0RC(PackedStringArray, _get_suggested_tracker_names);
GDVIRTUAL1RC(PackedStringArray, _get_suggested_pose_names, const StringName &);
- GDVIRTUAL0RC(uint32_t, _get_tracking_status);
+ GDVIRTUAL0RC(XRInterface::TrackingStatus, _get_tracking_status);
GDVIRTUAL6(_trigger_haptic_pulse, const String &, const StringName &, double, double, double, double);
/** specific to VR **/
@@ -81,8 +81,8 @@ public:
virtual PackedVector3Array get_play_area() const override; /* if available, returns an array of vectors denoting the play area the player can move around in */
GDVIRTUAL1RC(bool, _supports_play_area_mode, XRInterface::PlayAreaMode);
- GDVIRTUAL0RC(uint32_t, _get_play_area_mode);
- GDVIRTUAL1RC(bool, _set_play_area_mode, uint32_t);
+ GDVIRTUAL0RC(XRInterface::PlayAreaMode, _get_play_area_mode);
+ GDVIRTUAL1RC(bool, _set_play_area_mode, XRInterface::PlayAreaMode);
GDVIRTUAL0RC(PackedVector3Array, _get_play_area);
/** specific to AR **/
diff --git a/tests/scene/test_text_edit.h b/tests/scene/test_text_edit.h
index f2663b037d..77312a8604 100644
--- a/tests/scene/test_text_edit.h
+++ b/tests/scene/test_text_edit.h
@@ -3086,7 +3086,7 @@ TEST_CASE("[SceneTree][TextEdit] context menu") {
text_edit->get_viewport()->set_embedding_subwindows(true); // Bypass display server for drop handling.
text_edit->set_size(Size2(800, 200));
- text_edit->set_line(0, "Lorem ipsum dolor sit amet, consectetur adipiscing elit. Donec varius mattis leo, sed porta ex lacinia bibendum. Nunc bibendum pellentesque.");
+ text_edit->set_line(0, "Lorem ipsum dolor sit amet, consectetur adipiscing elit. Donec vasius mattis leo, sed porta ex lacinia bibendum. Nunc bibendum pellentesque.");
MessageQueue::get_singleton()->flush();
text_edit->set_context_menu_enabled(false);
@@ -3227,7 +3227,7 @@ TEST_CASE("[SceneTree][TextEdit] mouse") {
SceneTree::get_singleton()->get_root()->add_child(text_edit);
text_edit->set_size(Size2(800, 200));
- text_edit->set_line(0, "Lorem ipsum dolor sit amet, consectetur adipiscing elit. Donec varius mattis leo, sed porta ex lacinia bibendum. Nunc bibendum pellentesque.");
+ text_edit->set_line(0, "Lorem ipsum dolor sit amet, consectetur adipiscing elit. Donec vasius mattis leo, sed porta ex lacinia bibendum. Nunc bibendum pellentesque.");
MessageQueue::get_singleton()->flush();
CHECK(text_edit->get_word_at_pos(text_edit->get_pos_at_line_column(0, 1)) == "Lorem");
@@ -3305,9 +3305,9 @@ TEST_CASE("[SceneTree][TextEdit] caret") {
SEND_GUI_ACTION(text_edit, "ui_text_caret_left");
CHECK(text_edit->get_caret_column() == 0);
- text_edit->set_line(0, "Lorem ipsum dolor sit amet, consectetur adipiscing elit. Donec varius mattis leo, sed porta ex lacinia bibendum. Nunc bibendum pellentesque.");
+ text_edit->set_line(0, "Lorem ipsum dolor sit amet, consectetur adipiscing elit. Donec vasius mattis leo, sed porta ex lacinia bibendum. Nunc bibendum pellentesque.");
for (int i = 0; i < 3; i++) {
- text_edit->insert_line_at(0, "Lorem ipsum dolor sit amet, consectetur adipiscing elit. Donec varius mattis leo, sed porta ex lacinia bibendum. Nunc bibendum pellentesque.");
+ text_edit->insert_line_at(0, "Lorem ipsum dolor sit amet, consectetur adipiscing elit. Donec vasius mattis leo, sed porta ex lacinia bibendum. Nunc bibendum pellentesque.");
}
MessageQueue::get_singleton()->flush();
@@ -3519,7 +3519,7 @@ TEST_CASE("[SceneTree][TextEdit] line wrapping") {
// Set size for boundary.
text_edit->set_size(Size2(800, 200));
- text_edit->set_line(0, "Lorem ipsum dolor sit amet, consectetur adipiscing elit. Donec varius mattis leo, sed porta ex lacinia bibendum. Nunc bibendum pellentesque.");
+ text_edit->set_line(0, "Lorem ipsum dolor sit amet, consectetur adipiscing elit. Donec vasius mattis leo, sed porta ex lacinia bibendum. Nunc bibendum pellentesque.");
CHECK_FALSE(text_edit->is_line_wrapped(0));
CHECK(text_edit->get_line_wrap_count(0) == 0);
CHECK(text_edit->get_line_wrap_index_at_column(0, 130) == 0);
@@ -3569,7 +3569,7 @@ TEST_CASE("[SceneTree][TextEdit] viewport") {
// No subcases here for performance.
text_edit->set_size(Size2(800, 600));
for (int i = 0; i < 50; i++) {
- text_edit->insert_line_at(0, "Lorem ipsum dolor sit amet, consectetur adipiscing elit. Donec varius mattis leo, sed porta ex lacinia bibendum. Nunc bibendum pellentesque.");
+ text_edit->insert_line_at(0, "Lorem ipsum dolor sit amet, consectetur adipiscing elit. Donec vasius mattis leo, sed porta ex lacinia bibendum. Nunc bibendum pellentesque.");
}
MessageQueue::get_singleton()->flush();
@@ -3897,7 +3897,7 @@ TEST_CASE("[SceneTree][TextEdit] viewport") {
CHECK(text_edit->get_h_scroll() == 0);
text_edit->set_h_scroll(10000000);
- CHECK(text_edit->get_h_scroll() == 313);
+ CHECK(text_edit->get_h_scroll() == 314);
text_edit->set_h_scroll(-100);
CHECK(text_edit->get_h_scroll() == 0);
diff --git a/thirdparty/README.md b/thirdparty/README.md
index 38001b8782..38ace2c2e3 100644
--- a/thirdparty/README.md
+++ b/thirdparty/README.md
@@ -376,7 +376,7 @@ File extracted from upstream release tarball:
## meshoptimizer
- Upstream: https://github.com/zeux/meshoptimizer
-- Version: git (ea4558d1c0f217f1d67ed7fe0b07896ece88ae18, 2022)
+- Version: git (4a287848fd664ae1c3fc8e5e008560534ceeb526, 2022)
- License: MIT
Files extracted from upstream repository:
diff --git a/thirdparty/meshoptimizer/LICENSE.md b/thirdparty/meshoptimizer/LICENSE.md
index 3c52415f62..b673c248b2 100644
--- a/thirdparty/meshoptimizer/LICENSE.md
+++ b/thirdparty/meshoptimizer/LICENSE.md
@@ -1,6 +1,6 @@
MIT License
-Copyright (c) 2016-2021 Arseny Kapoulkine
+Copyright (c) 2016-2022 Arseny Kapoulkine
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
diff --git a/thirdparty/meshoptimizer/clusterizer.cpp b/thirdparty/meshoptimizer/clusterizer.cpp
index b1f7b359c1..c4672ad606 100644
--- a/thirdparty/meshoptimizer/clusterizer.cpp
+++ b/thirdparty/meshoptimizer/clusterizer.cpp
@@ -283,6 +283,79 @@ static bool appendMeshlet(meshopt_Meshlet& meshlet, unsigned int a, unsigned int
return result;
}
+static unsigned int getNeighborTriangle(const meshopt_Meshlet& meshlet, const Cone* meshlet_cone, unsigned int* meshlet_vertices, const unsigned int* indices, const TriangleAdjacency2& adjacency, const Cone* triangles, const unsigned int* live_triangles, const unsigned char* used, float meshlet_expected_radius, float cone_weight, unsigned int* out_extra)
+{
+ unsigned int best_triangle = ~0u;
+ unsigned int best_extra = 5;
+ float best_score = FLT_MAX;
+
+ for (size_t i = 0; i < meshlet.vertex_count; ++i)
+ {
+ unsigned int index = meshlet_vertices[meshlet.vertex_offset + i];
+
+ unsigned int* neighbors = &adjacency.data[0] + adjacency.offsets[index];
+ size_t neighbors_size = adjacency.counts[index];
+
+ for (size_t j = 0; j < neighbors_size; ++j)
+ {
+ unsigned int triangle = neighbors[j];
+ unsigned int a = indices[triangle * 3 + 0], b = indices[triangle * 3 + 1], c = indices[triangle * 3 + 2];
+
+ unsigned int extra = (used[a] == 0xff) + (used[b] == 0xff) + (used[c] == 0xff);
+
+ // triangles that don't add new vertices to meshlets are max. priority
+ if (extra != 0)
+ {
+ // artificially increase the priority of dangling triangles as they're expensive to add to new meshlets
+ if (live_triangles[a] == 1 || live_triangles[b] == 1 || live_triangles[c] == 1)
+ extra = 0;
+
+ extra++;
+ }
+
+ // since topology-based priority is always more important than the score, we can skip scoring in some cases
+ if (extra > best_extra)
+ continue;
+
+ float score = 0;
+
+ // caller selects one of two scoring functions: geometrical (based on meshlet cone) or topological (based on remaining triangles)
+ if (meshlet_cone)
+ {
+ const Cone& tri_cone = triangles[triangle];
+
+ float distance2 =
+ (tri_cone.px - meshlet_cone->px) * (tri_cone.px - meshlet_cone->px) +
+ (tri_cone.py - meshlet_cone->py) * (tri_cone.py - meshlet_cone->py) +
+ (tri_cone.pz - meshlet_cone->pz) * (tri_cone.pz - meshlet_cone->pz);
+
+ float spread = tri_cone.nx * meshlet_cone->nx + tri_cone.ny * meshlet_cone->ny + tri_cone.nz * meshlet_cone->nz;
+
+ score = getMeshletScore(distance2, spread, cone_weight, meshlet_expected_radius);
+ }
+ else
+ {
+ // each live_triangles entry is >= 1 since it includes the current triangle we're processing
+ score = float(live_triangles[a] + live_triangles[b] + live_triangles[c] - 3);
+ }
+
+ // note that topology-based priority is always more important than the score
+ // this helps maintain reasonable effectiveness of meshlet data and reduces scoring cost
+ if (extra < best_extra || score < best_score)
+ {
+ best_triangle = triangle;
+ best_extra = extra;
+ best_score = score;
+ }
+ }
+ }
+
+ if (out_extra)
+ *out_extra = best_extra;
+
+ return best_triangle;
+}
+
struct KDNode
{
union
@@ -464,13 +537,15 @@ size_t meshopt_buildMeshlets(meshopt_Meshlet* meshlets, unsigned int* meshlet_ve
using namespace meshopt;
assert(index_count % 3 == 0);
- assert(vertex_positions_stride > 0 && vertex_positions_stride <= 256);
+ assert(vertex_positions_stride >= 12 && vertex_positions_stride <= 256);
assert(vertex_positions_stride % sizeof(float) == 0);
assert(max_vertices >= 3 && max_vertices <= kMeshletMaxVertices);
assert(max_triangles >= 1 && max_triangles <= kMeshletMaxTriangles);
assert(max_triangles % 4 == 0); // ensures the caller will compute output space properly as index data is 4b aligned
+ assert(cone_weight >= 0 && cone_weight <= 1);
+
meshopt_Allocator allocator;
TriangleAdjacency2 adjacency = {};
@@ -511,65 +586,18 @@ size_t meshopt_buildMeshlets(meshopt_Meshlet* meshlets, unsigned int* meshlet_ve
for (;;)
{
- unsigned int best_triangle = ~0u;
- unsigned int best_extra = 5;
- float best_score = FLT_MAX;
-
Cone meshlet_cone = getMeshletCone(meshlet_cone_acc, meshlet.triangle_count);
- for (size_t i = 0; i < meshlet.vertex_count; ++i)
- {
- unsigned int index = meshlet_vertices[meshlet.vertex_offset + i];
-
- unsigned int* neighbours = &adjacency.data[0] + adjacency.offsets[index];
- size_t neighbours_size = adjacency.counts[index];
-
- for (size_t j = 0; j < neighbours_size; ++j)
- {
- unsigned int triangle = neighbours[j];
- assert(!emitted_flags[triangle]);
-
- unsigned int a = indices[triangle * 3 + 0], b = indices[triangle * 3 + 1], c = indices[triangle * 3 + 2];
- assert(a < vertex_count && b < vertex_count && c < vertex_count);
-
- unsigned int extra = (used[a] == 0xff) + (used[b] == 0xff) + (used[c] == 0xff);
-
- // triangles that don't add new vertices to meshlets are max. priority
- if (extra != 0)
- {
- // artificially increase the priority of dangling triangles as they're expensive to add to new meshlets
- if (live_triangles[a] == 1 || live_triangles[b] == 1 || live_triangles[c] == 1)
- extra = 0;
-
- extra++;
- }
-
- // since topology-based priority is always more important than the score, we can skip scoring in some cases
- if (extra > best_extra)
- continue;
-
- const Cone& tri_cone = triangles[triangle];
-
- float distance2 =
- (tri_cone.px - meshlet_cone.px) * (tri_cone.px - meshlet_cone.px) +
- (tri_cone.py - meshlet_cone.py) * (tri_cone.py - meshlet_cone.py) +
- (tri_cone.pz - meshlet_cone.pz) * (tri_cone.pz - meshlet_cone.pz);
-
- float spread = tri_cone.nx * meshlet_cone.nx + tri_cone.ny * meshlet_cone.ny + tri_cone.nz * meshlet_cone.nz;
+ unsigned int best_extra = 0;
+ unsigned int best_triangle = getNeighborTriangle(meshlet, &meshlet_cone, meshlet_vertices, indices, adjacency, triangles, live_triangles, used, meshlet_expected_radius, cone_weight, &best_extra);
- float score = getMeshletScore(distance2, spread, cone_weight, meshlet_expected_radius);
-
- // note that topology-based priority is always more important than the score
- // this helps maintain reasonable effectiveness of meshlet data and reduces scoring cost
- if (extra < best_extra || score < best_score)
- {
- best_triangle = triangle;
- best_extra = extra;
- best_score = score;
- }
- }
+ // if the best triangle doesn't fit into current meshlet, the spatial scoring we've used is not very meaningful, so we re-select using topological scoring
+ if (best_triangle != ~0u && (meshlet.vertex_count + best_extra > max_vertices || meshlet.triangle_count >= max_triangles))
+ {
+ best_triangle = getNeighborTriangle(meshlet, NULL, meshlet_vertices, indices, adjacency, triangles, live_triangles, used, meshlet_expected_radius, 0.f, NULL);
}
+ // when we run out of neighboring triangles we need to switch to spatial search; we currently just pick the closest triangle irrespective of connectivity
if (best_triangle == ~0u)
{
float position[3] = {meshlet_cone.px, meshlet_cone.py, meshlet_cone.pz};
@@ -604,16 +632,16 @@ size_t meshopt_buildMeshlets(meshopt_Meshlet* meshlets, unsigned int* meshlet_ve
{
unsigned int index = indices[best_triangle * 3 + k];
- unsigned int* neighbours = &adjacency.data[0] + adjacency.offsets[index];
- size_t neighbours_size = adjacency.counts[index];
+ unsigned int* neighbors = &adjacency.data[0] + adjacency.offsets[index];
+ size_t neighbors_size = adjacency.counts[index];
- for (size_t i = 0; i < neighbours_size; ++i)
+ for (size_t i = 0; i < neighbors_size; ++i)
{
- unsigned int tri = neighbours[i];
+ unsigned int tri = neighbors[i];
if (tri == best_triangle)
{
- neighbours[i] = neighbours[neighbours_size - 1];
+ neighbors[i] = neighbors[neighbors_size - 1];
adjacency.counts[index]--;
break;
}
@@ -687,7 +715,7 @@ meshopt_Bounds meshopt_computeClusterBounds(const unsigned int* indices, size_t
assert(index_count % 3 == 0);
assert(index_count / 3 <= kMeshletMaxTriangles);
- assert(vertex_positions_stride > 0 && vertex_positions_stride <= 256);
+ assert(vertex_positions_stride >= 12 && vertex_positions_stride <= 256);
assert(vertex_positions_stride % sizeof(float) == 0);
(void)vertex_count;
@@ -839,7 +867,7 @@ meshopt_Bounds meshopt_computeMeshletBounds(const unsigned int* meshlet_vertices
using namespace meshopt;
assert(triangle_count <= kMeshletMaxTriangles);
- assert(vertex_positions_stride > 0 && vertex_positions_stride <= 256);
+ assert(vertex_positions_stride >= 12 && vertex_positions_stride <= 256);
assert(vertex_positions_stride % sizeof(float) == 0);
unsigned int indices[kMeshletMaxTriangles * 3];
diff --git a/thirdparty/meshoptimizer/indexgenerator.cpp b/thirdparty/meshoptimizer/indexgenerator.cpp
index f60db0dc4f..cad808a2b1 100644
--- a/thirdparty/meshoptimizer/indexgenerator.cpp
+++ b/thirdparty/meshoptimizer/indexgenerator.cpp
@@ -187,7 +187,7 @@ size_t meshopt_generateVertexRemap(unsigned int* destination, const unsigned int
using namespace meshopt;
assert(indices || index_count == vertex_count);
- assert(index_count % 3 == 0);
+ assert(!indices || index_count % 3 == 0);
assert(vertex_size > 0 && vertex_size <= 256);
meshopt_Allocator allocator;
@@ -412,7 +412,7 @@ void meshopt_generateAdjacencyIndexBuffer(unsigned int* destination, const unsig
using namespace meshopt;
assert(index_count % 3 == 0);
- assert(vertex_positions_stride > 0 && vertex_positions_stride <= 256);
+ assert(vertex_positions_stride >= 12 && vertex_positions_stride <= 256);
assert(vertex_positions_stride % sizeof(float) == 0);
meshopt_Allocator allocator;
@@ -483,7 +483,7 @@ void meshopt_generateTessellationIndexBuffer(unsigned int* destination, const un
using namespace meshopt;
assert(index_count % 3 == 0);
- assert(vertex_positions_stride > 0 && vertex_positions_stride <= 256);
+ assert(vertex_positions_stride >= 12 && vertex_positions_stride <= 256);
assert(vertex_positions_stride % sizeof(float) == 0);
meshopt_Allocator allocator;
diff --git a/thirdparty/meshoptimizer/meshoptimizer.h b/thirdparty/meshoptimizer/meshoptimizer.h
index 463fad29da..46d28d3ea3 100644
--- a/thirdparty/meshoptimizer/meshoptimizer.h
+++ b/thirdparty/meshoptimizer/meshoptimizer.h
@@ -1,7 +1,7 @@
/**
- * meshoptimizer - version 0.17
+ * meshoptimizer - version 0.18
*
- * Copyright (C) 2016-2021, by Arseny Kapoulkine (arseny.kapoulkine@gmail.com)
+ * Copyright (C) 2016-2022, by Arseny Kapoulkine (arseny.kapoulkine@gmail.com)
* Report bugs and download new versions at https://github.com/zeux/meshoptimizer
*
* This library is distributed under the MIT License. See notice at the end of this file.
@@ -12,7 +12,7 @@
#include <stddef.h>
/* Version macro; major * 1000 + minor * 10 + patch */
-#define MESHOPTIMIZER_VERSION 170 /* 0.17 */
+#define MESHOPTIMIZER_VERSION 180 /* 0.18 */
/* If no API is defined, assume default */
#ifndef MESHOPTIMIZER_API
@@ -37,8 +37,8 @@ extern "C" {
#endif
/**
- * Vertex attribute stream, similar to glVertexPointer
- * Each element takes size bytes, with stride controlling the spacing between successive elements.
+ * Vertex attribute stream
+ * Each element takes size bytes, beginning at data, with stride controlling the spacing between successive elements (stride >= size).
*/
struct meshopt_Stream
{
@@ -115,7 +115,7 @@ MESHOPTIMIZER_API void meshopt_generateShadowIndexBufferMulti(unsigned int* dest
* This can be used to implement algorithms like silhouette detection/expansion and other forms of GS-driven rendering.
*
* destination must contain enough space for the resulting index buffer (index_count*2 elements)
- * vertex_positions should have float3 position in the first 12 bytes of each vertex - similar to glVertexPointer
+ * vertex_positions should have float3 position in the first 12 bytes of each vertex
*/
MESHOPTIMIZER_API void meshopt_generateAdjacencyIndexBuffer(unsigned int* destination, const unsigned int* indices, size_t index_count, const float* vertex_positions, size_t vertex_count, size_t vertex_positions_stride);
@@ -131,7 +131,7 @@ MESHOPTIMIZER_API void meshopt_generateAdjacencyIndexBuffer(unsigned int* destin
* See "Tessellation on Any Budget" (John McDonald, GDC 2011) for implementation details.
*
* destination must contain enough space for the resulting index buffer (index_count*4 elements)
- * vertex_positions should have float3 position in the first 12 bytes of each vertex - similar to glVertexPointer
+ * vertex_positions should have float3 position in the first 12 bytes of each vertex
*/
MESHOPTIMIZER_API void meshopt_generateTessellationIndexBuffer(unsigned int* destination, const unsigned int* indices, size_t index_count, const float* vertex_positions, size_t vertex_count, size_t vertex_positions_stride);
@@ -171,7 +171,7 @@ MESHOPTIMIZER_API void meshopt_optimizeVertexCacheFifo(unsigned int* destination
*
* destination must contain enough space for the resulting index buffer (index_count elements)
* indices must contain index data that is the result of meshopt_optimizeVertexCache (*not* the original mesh indices!)
- * vertex_positions should have float3 position in the first 12 bytes of each vertex - similar to glVertexPointer
+ * vertex_positions should have float3 position in the first 12 bytes of each vertex
* threshold indicates how much the overdraw optimizer can degrade vertex cache efficiency (1.05 = up to 5%) to reduce overdraw more efficiently
*/
MESHOPTIMIZER_API void meshopt_optimizeOverdraw(unsigned int* destination, const unsigned int* indices, size_t index_count, const float* vertex_positions, size_t vertex_count, size_t vertex_positions_stride, float threshold);
@@ -313,7 +313,21 @@ MESHOPTIMIZER_EXPERIMENTAL void meshopt_encodeFilterQuat(void* destination, size
MESHOPTIMIZER_EXPERIMENTAL void meshopt_encodeFilterExp(void* destination, size_t count, size_t stride, int bits, const float* data);
/**
- * Experimental: Mesh simplifier
+ * Simplification options
+ */
+enum
+{
+ /* Do not move vertices that are located on the topological border (vertices on triangle edges that don't have a paired triangle). Useful for simplifying portions of the larger mesh. */
+ meshopt_SimplifyLockBorder = 1 << 0,
+};
+
+/**
+ * Experimental: Mesh simplifier with attribute metric; attributes follow xyz position data atm (vertex data must contain 3 + attribute_count floats per vertex)
+ */
+MESHOPTIMIZER_EXPERIMENTAL size_t meshopt_simplifyWithAttributes(unsigned int* destination, const unsigned int* indices, size_t index_count, const float* vertex_data, size_t vertex_count, size_t vertex_stride, size_t target_index_count, float target_error, unsigned int options, float* result_error, const float* attributes, const float* attribute_weights, size_t attribute_count);
+
+/**
+ * Mesh simplifier
* Reduces the number of triangles in the mesh, attempting to preserve mesh appearance as much as possible
* The algorithm tries to preserve mesh topology and can stop short of the target goal based on topology constraints or target error.
* If not all attributes from the input mesh are required, it's recommended to reindex the mesh using meshopt_generateShadowIndexBuffer prior to simplification.
@@ -322,16 +336,12 @@ MESHOPTIMIZER_EXPERIMENTAL void meshopt_encodeFilterExp(void* destination, size_
* If the original vertex data isn't required, creating a compact vertex buffer using meshopt_optimizeVertexFetch is recommended.
*
* destination must contain enough space for the target index buffer, worst case is index_count elements (*not* target_index_count)!
- * vertex_positions should have float3 position in the first 12 bytes of each vertex - similar to glVertexPointer
- * target_error represents the error relative to mesh extents that can be tolerated, e.g. 0.01 = 1% deformation
+ * vertex_positions should have float3 position in the first 12 bytes of each vertex
+ * target_error represents the error relative to mesh extents that can be tolerated, e.g. 0.01 = 1% deformation; value range [0..1]
+ * options must be a bitmask composed of meshopt_SimplifyX options; 0 is a safe default
* result_error can be NULL; when it's not NULL, it will contain the resulting (relative) error after simplification
*/
-MESHOPTIMIZER_EXPERIMENTAL size_t meshopt_simplify(unsigned int* destination, const unsigned int* indices, size_t index_count, const float* vertex_positions, size_t vertex_count, size_t vertex_positions_stride, size_t target_index_count, float target_error, float* result_error);
-
-/**
- * Experimental: Mesh simplifier with attribute metric; attributes follow xyz position data atm (vertex data must contain 3 + attribute_count floats per vertex)
- */
-MESHOPTIMIZER_EXPERIMENTAL size_t meshopt_simplifyWithAttributes(unsigned int* destination, const unsigned int* indices, size_t index_count, const float* vertex_data, size_t vertex_count, size_t vertex_stride, size_t target_index_count, float target_error, float* result_error, const float* attributes, const float* attribute_weights, size_t attribute_count);
+MESHOPTIMIZER_API size_t meshopt_simplify(unsigned int* destination, const unsigned int* indices, size_t index_count, const float* vertex_positions, size_t vertex_count, size_t vertex_positions_stride, size_t target_index_count, float target_error, unsigned int options, float* result_error);
/**
* Experimental: Mesh simplifier (sloppy)
@@ -342,8 +352,8 @@ MESHOPTIMIZER_EXPERIMENTAL size_t meshopt_simplifyWithAttributes(unsigned int* d
* If the original vertex data isn't required, creating a compact vertex buffer using meshopt_optimizeVertexFetch is recommended.
*
* destination must contain enough space for the target index buffer, worst case is index_count elements (*not* target_index_count)!
- * vertex_positions should have float3 position in the first 12 bytes of each vertex - similar to glVertexPointer
- * target_error represents the error relative to mesh extents that can be tolerated, e.g. 0.01 = 1% deformation
+ * vertex_positions should have float3 position in the first 12 bytes of each vertex
+ * target_error represents the error relative to mesh extents that can be tolerated, e.g. 0.01 = 1% deformation; value range [0..1]
* result_error can be NULL; when it's not NULL, it will contain the resulting (relative) error after simplification
*/
MESHOPTIMIZER_EXPERIMENTAL size_t meshopt_simplifySloppy(unsigned int* destination, const unsigned int* indices, size_t index_count, const float* vertex_positions, size_t vertex_count, size_t vertex_positions_stride, size_t target_index_count, float target_error, float* result_error);
@@ -356,17 +366,17 @@ MESHOPTIMIZER_EXPERIMENTAL size_t meshopt_simplifySloppy(unsigned int* destinati
* If the original vertex data isn't required, creating a compact vertex buffer using meshopt_optimizeVertexFetch is recommended.
*
* destination must contain enough space for the target index buffer (target_vertex_count elements)
- * vertex_positions should have float3 position in the first 12 bytes of each vertex - similar to glVertexPointer
+ * vertex_positions should have float3 position in the first 12 bytes of each vertex
*/
MESHOPTIMIZER_EXPERIMENTAL size_t meshopt_simplifyPoints(unsigned int* destination, const float* vertex_positions, size_t vertex_count, size_t vertex_positions_stride, size_t target_vertex_count);
/**
- * Experimental: Returns the error scaling factor used by the simplifier to convert between absolute and relative extents
+ * Returns the error scaling factor used by the simplifier to convert between absolute and relative extents
*
* Absolute error must be *divided* by the scaling factor before passing it to meshopt_simplify as target_error
* Relative error returned by meshopt_simplify via result_error must be *multiplied* by the scaling factor to get absolute error.
*/
-MESHOPTIMIZER_EXPERIMENTAL float meshopt_simplifyScale(const float* vertex_positions, size_t vertex_count, size_t vertex_positions_stride);
+MESHOPTIMIZER_API float meshopt_simplifyScale(const float* vertex_positions, size_t vertex_count, size_t vertex_positions_stride);
/**
* Mesh stripifier
@@ -418,7 +428,7 @@ struct meshopt_OverdrawStatistics
* Returns overdraw statistics using a software rasterizer
* Results may not match actual GPU performance
*
- * vertex_positions should have float3 position in the first 12 bytes of each vertex - similar to glVertexPointer
+ * vertex_positions should have float3 position in the first 12 bytes of each vertex
*/
MESHOPTIMIZER_API struct meshopt_OverdrawStatistics meshopt_analyzeOverdraw(const unsigned int* indices, size_t index_count, const float* vertex_positions, size_t vertex_count, size_t vertex_positions_stride);
@@ -456,7 +466,7 @@ struct meshopt_Meshlet
* meshlets must contain enough space for all meshlets, worst case size can be computed with meshopt_buildMeshletsBound
* meshlet_vertices must contain enough space for all meshlets, worst case size is equal to max_meshlets * max_vertices
* meshlet_triangles must contain enough space for all meshlets, worst case size is equal to max_meshlets * max_triangles * 3
- * vertex_positions should have float3 position in the first 12 bytes of each vertex - similar to glVertexPointer
+ * vertex_positions should have float3 position in the first 12 bytes of each vertex
* max_vertices and max_triangles must not exceed implementation limits (max_vertices <= 255 - not 256!, max_triangles <= 512)
* cone_weight should be set to 0 when cone culling is not used, and a value between 0 and 1 otherwise to balance between cluster size and cone culling efficiency
*/
@@ -498,7 +508,7 @@ struct meshopt_Bounds
* The formula that uses the apex is slightly more accurate but needs the apex; if you are already using bounding sphere
* to do frustum/occlusion culling, the formula that doesn't use the apex may be preferable.
*
- * vertex_positions should have float3 position in the first 12 bytes of each vertex - similar to glVertexPointer
+ * vertex_positions should have float3 position in the first 12 bytes of each vertex
* index_count/3 should be less than or equal to 512 (the function assumes clusters of limited size)
*/
MESHOPTIMIZER_API struct meshopt_Bounds meshopt_computeClusterBounds(const unsigned int* indices, size_t index_count, const float* vertex_positions, size_t vertex_count, size_t vertex_positions_stride);
@@ -518,7 +528,7 @@ MESHOPTIMIZER_EXPERIMENTAL void meshopt_spatialSortRemap(unsigned int* destinati
* Reorders triangles for spatial locality, and generates a new index buffer. The resulting index buffer can be used with other functions like optimizeVertexCache.
*
* destination must contain enough space for the resulting index buffer (index_count elements)
- * vertex_positions should have float3 position in the first 12 bytes of each vertex - similar to glVertexPointer
+ * vertex_positions should have float3 position in the first 12 bytes of each vertex
*/
MESHOPTIMIZER_EXPERIMENTAL void meshopt_spatialSortTriangles(unsigned int* destination, const unsigned int* indices, size_t index_count, const float* vertex_positions, size_t vertex_count, size_t vertex_positions_stride);
@@ -610,7 +620,7 @@ inline size_t meshopt_encodeIndexSequence(unsigned char* buffer, size_t buffer_s
template <typename T>
inline int meshopt_decodeIndexSequence(T* destination, size_t index_count, const unsigned char* buffer, size_t buffer_size);
template <typename T>
-inline size_t meshopt_simplify(T* destination, const T* indices, size_t index_count, const float* vertex_positions, size_t vertex_count, size_t vertex_positions_stride, size_t target_index_count, float target_error, float* result_error = 0);
+inline size_t meshopt_simplify(T* destination, const T* indices, size_t index_count, const float* vertex_positions, size_t vertex_count, size_t vertex_positions_stride, size_t target_index_count, float target_error, unsigned int options = 0, float* result_error = 0);
template <typename T>
inline size_t meshopt_simplifySloppy(T* destination, const T* indices, size_t index_count, const float* vertex_positions, size_t vertex_count, size_t vertex_positions_stride, size_t target_index_count, float target_error, float* result_error = 0);
template <typename T>
@@ -945,12 +955,12 @@ inline int meshopt_decodeIndexSequence(T* destination, size_t index_count, const
}
template <typename T>
-inline size_t meshopt_simplify(T* destination, const T* indices, size_t index_count, const float* vertex_positions, size_t vertex_count, size_t vertex_positions_stride, size_t target_index_count, float target_error, float* result_error)
+inline size_t meshopt_simplify(T* destination, const T* indices, size_t index_count, const float* vertex_positions, size_t vertex_count, size_t vertex_positions_stride, size_t target_index_count, float target_error, unsigned int options, float* result_error)
{
meshopt_IndexAdapter<T> in(0, indices, index_count);
meshopt_IndexAdapter<T> out(destination, 0, index_count);
- return meshopt_simplify(out.data, in.data, index_count, vertex_positions, vertex_count, vertex_positions_stride, target_index_count, target_error, result_error);
+ return meshopt_simplify(out.data, in.data, index_count, vertex_positions, vertex_count, vertex_positions_stride, target_index_count, target_error, options, result_error);
}
template <typename T>
@@ -1039,7 +1049,7 @@ inline void meshopt_spatialSortTriangles(T* destination, const T* indices, size_
#endif
/**
- * Copyright (c) 2016-2021 Arseny Kapoulkine
+ * Copyright (c) 2016-2022 Arseny Kapoulkine
*
* Permission is hereby granted, free of charge, to any person
* obtaining a copy of this software and associated documentation
diff --git a/thirdparty/meshoptimizer/overdrawanalyzer.cpp b/thirdparty/meshoptimizer/overdrawanalyzer.cpp
index 8d5859ba39..8b6f254134 100644
--- a/thirdparty/meshoptimizer/overdrawanalyzer.cpp
+++ b/thirdparty/meshoptimizer/overdrawanalyzer.cpp
@@ -147,7 +147,7 @@ meshopt_OverdrawStatistics meshopt_analyzeOverdraw(const unsigned int* indices,
using namespace meshopt;
assert(index_count % 3 == 0);
- assert(vertex_positions_stride > 0 && vertex_positions_stride <= 256);
+ assert(vertex_positions_stride >= 12 && vertex_positions_stride <= 256);
assert(vertex_positions_stride % sizeof(float) == 0);
meshopt_Allocator allocator;
diff --git a/thirdparty/meshoptimizer/overdrawoptimizer.cpp b/thirdparty/meshoptimizer/overdrawoptimizer.cpp
index 143656ed76..cc22dbcffc 100644
--- a/thirdparty/meshoptimizer/overdrawoptimizer.cpp
+++ b/thirdparty/meshoptimizer/overdrawoptimizer.cpp
@@ -272,7 +272,7 @@ void meshopt_optimizeOverdraw(unsigned int* destination, const unsigned int* ind
using namespace meshopt;
assert(index_count % 3 == 0);
- assert(vertex_positions_stride > 0 && vertex_positions_stride <= 256);
+ assert(vertex_positions_stride >= 12 && vertex_positions_stride <= 256);
assert(vertex_positions_stride % sizeof(float) == 0);
meshopt_Allocator allocator;
diff --git a/thirdparty/meshoptimizer/patches/attribute-aware-simplify-distance-only-metric.patch b/thirdparty/meshoptimizer/patches/attribute-aware-simplify-distance-only-metric.patch
index 21daac6eec..5cac985dc5 100644
--- a/thirdparty/meshoptimizer/patches/attribute-aware-simplify-distance-only-metric.patch
+++ b/thirdparty/meshoptimizer/patches/attribute-aware-simplify-distance-only-metric.patch
@@ -1,5 +1,5 @@
diff --git a/thirdparty/meshoptimizer/simplifier.cpp b/thirdparty/meshoptimizer/simplifier.cpp
-index 5e92e2dc73..e40c141e76 100644
+index d8d4a67391..3847afc736 100644
--- a/thirdparty/meshoptimizer/simplifier.cpp
+++ b/thirdparty/meshoptimizer/simplifier.cpp
@@ -20,7 +20,7 @@
@@ -11,7 +11,7 @@ index 5e92e2dc73..e40c141e76 100644
// This work is based on:
// Michael Garland and Paul S. Heckbert. Surface simplification using quadric error metrics. 1997
-@@ -453,6 +453,7 @@ struct Collapse
+@@ -458,6 +458,7 @@ struct Collapse
float error;
unsigned int errorui;
};
@@ -19,7 +19,7 @@ index 5e92e2dc73..e40c141e76 100644
};
static float normalize(Vector3& v)
-@@ -533,6 +534,34 @@ static float quadricError(const Quadric& Q, const Vector3& v)
+@@ -538,6 +539,34 @@ static float quadricError(const Quadric& Q, const Vector3& v)
return fabsf(r) * s;
}
@@ -54,7 +54,7 @@ index 5e92e2dc73..e40c141e76 100644
static void quadricFromPlane(Quadric& Q, float a, float b, float c, float d, float w)
{
float aw = a * w;
-@@ -688,7 +717,7 @@ static void quadricUpdateAttributes(Quadric& Q, const Vector3& p0, const Vector3
+@@ -693,7 +722,7 @@ static void quadricUpdateAttributes(Quadric& Q, const Vector3& p0, const Vector3
}
#endif
@@ -63,7 +63,7 @@ index 5e92e2dc73..e40c141e76 100644
{
for (size_t i = 0; i < index_count; i += 3)
{
-@@ -698,6 +727,9 @@ static void fillFaceQuadrics(Quadric* vertex_quadrics, const unsigned int* indic
+@@ -703,6 +732,9 @@ static void fillFaceQuadrics(Quadric* vertex_quadrics, const unsigned int* indic
Quadric Q;
quadricFromTriangle(Q, vertex_positions[i0], vertex_positions[i1], vertex_positions[i2], 1.f);
@@ -73,7 +73,7 @@ index 5e92e2dc73..e40c141e76 100644
#if ATTRIBUTES
quadricUpdateAttributes(Q, vertex_positions[i0], vertex_positions[i1], vertex_positions[i2], Q.w);
-@@ -708,7 +740,7 @@ static void fillFaceQuadrics(Quadric* vertex_quadrics, const unsigned int* indic
+@@ -713,7 +745,7 @@ static void fillFaceQuadrics(Quadric* vertex_quadrics, const unsigned int* indic
}
}
@@ -82,7 +82,7 @@ index 5e92e2dc73..e40c141e76 100644
{
for (size_t i = 0; i < index_count; i += 3)
{
-@@ -752,6 +784,9 @@ static void fillEdgeQuadrics(Quadric* vertex_quadrics, const unsigned int* indic
+@@ -757,6 +789,9 @@ static void fillEdgeQuadrics(Quadric* vertex_quadrics, const unsigned int* indic
quadricAdd(vertex_quadrics[remap[i0]], Q);
quadricAdd(vertex_quadrics[remap[i1]], Q);
@@ -92,7 +92,7 @@ index 5e92e2dc73..e40c141e76 100644
}
}
}
-@@ -856,7 +891,7 @@ static size_t pickEdgeCollapses(Collapse* collapses, const unsigned int* indices
+@@ -861,7 +896,7 @@ static size_t pickEdgeCollapses(Collapse* collapses, const unsigned int* indices
return collapse_count;
}
@@ -101,7 +101,7 @@ index 5e92e2dc73..e40c141e76 100644
{
for (size_t i = 0; i < collapse_count; ++i)
{
-@@ -876,10 +911,14 @@ static void rankEdgeCollapses(Collapse* collapses, size_t collapse_count, const
+@@ -881,10 +916,14 @@ static void rankEdgeCollapses(Collapse* collapses, size_t collapse_count, const
float ei = quadricError(qi, vertex_positions[i1]);
float ej = quadricError(qj, vertex_positions[j1]);
@@ -116,7 +116,7 @@ index 5e92e2dc73..e40c141e76 100644
}
}
-@@ -976,7 +1015,7 @@ static void sortEdgeCollapses(unsigned int* sort_order, const Collapse* collapse
+@@ -981,7 +1020,7 @@ static void sortEdgeCollapses(unsigned int* sort_order, const Collapse* collapse
}
}
@@ -125,7 +125,7 @@ index 5e92e2dc73..e40c141e76 100644
{
size_t edge_collapses = 0;
size_t triangle_collapses = 0;
-@@ -1038,6 +1077,7 @@ static size_t performEdgeCollapses(unsigned int* collapse_remap, unsigned char*
+@@ -1043,6 +1082,7 @@ static size_t performEdgeCollapses(unsigned int* collapse_remap, unsigned char*
assert(collapse_remap[r1] == r1);
quadricAdd(vertex_quadrics[r1], vertex_quadrics[r0]);
@@ -133,7 +133,7 @@ index 5e92e2dc73..e40c141e76 100644
if (vertex_kind[i0] == Kind_Complex)
{
-@@ -1075,7 +1115,7 @@ static size_t performEdgeCollapses(unsigned int* collapse_remap, unsigned char*
+@@ -1080,7 +1120,7 @@ static size_t performEdgeCollapses(unsigned int* collapse_remap, unsigned char*
triangle_collapses += (vertex_kind[i0] == Kind_Border) ? 1 : 2;
edge_collapses++;
@@ -142,7 +142,7 @@ index 5e92e2dc73..e40c141e76 100644
}
#if TRACE
-@@ -1463,9 +1503,11 @@ size_t meshopt_simplifyWithAttributes(unsigned int* destination, const unsigned
+@@ -1469,9 +1509,11 @@ size_t meshopt_simplifyWithAttributes(unsigned int* destination, const unsigned
Quadric* vertex_quadrics = allocator.allocate<Quadric>(vertex_count);
memset(vertex_quadrics, 0, vertex_count * sizeof(Quadric));
@@ -156,7 +156,7 @@ index 5e92e2dc73..e40c141e76 100644
if (result != indices)
memcpy(result, indices, index_count * sizeof(unsigned int));
-@@ -1496,7 +1538,7 @@ size_t meshopt_simplifyWithAttributes(unsigned int* destination, const unsigned
+@@ -1502,7 +1544,7 @@ size_t meshopt_simplifyWithAttributes(unsigned int* destination, const unsigned
if (edge_collapse_count == 0)
break;
@@ -165,7 +165,7 @@ index 5e92e2dc73..e40c141e76 100644
#if TRACE > 1
dumpEdgeCollapses(edge_collapses, edge_collapse_count, vertex_kind);
-@@ -1515,7 +1557,7 @@ size_t meshopt_simplifyWithAttributes(unsigned int* destination, const unsigned
+@@ -1521,7 +1563,7 @@ size_t meshopt_simplifyWithAttributes(unsigned int* destination, const unsigned
printf("pass %d: ", int(pass_count++));
#endif
diff --git a/thirdparty/meshoptimizer/patches/attribute-aware-simplify.patch b/thirdparty/meshoptimizer/patches/attribute-aware-simplify.patch
index 33a17fe9fa..c065026a7d 100644
--- a/thirdparty/meshoptimizer/patches/attribute-aware-simplify.patch
+++ b/thirdparty/meshoptimizer/patches/attribute-aware-simplify.patch
@@ -1,21 +1,21 @@
diff --git a/thirdparty/meshoptimizer/meshoptimizer.h b/thirdparty/meshoptimizer/meshoptimizer.h
-index be4b765d97..463fad29da 100644
+index d95725dd71..46d28d3ea3 100644
--- a/thirdparty/meshoptimizer/meshoptimizer.h
+++ b/thirdparty/meshoptimizer/meshoptimizer.h
-@@ -328,6 +328,11 @@ MESHOPTIMIZER_EXPERIMENTAL void meshopt_encodeFilterExp(void* destination, size_
- */
- MESHOPTIMIZER_EXPERIMENTAL size_t meshopt_simplify(unsigned int* destination, const unsigned int* indices, size_t index_count, const float* vertex_positions, size_t vertex_count, size_t vertex_positions_stride, size_t target_index_count, float target_error, float* result_error);
+@@ -321,6 +321,11 @@ enum
+ meshopt_SimplifyLockBorder = 1 << 0,
+ };
+/**
+ * Experimental: Mesh simplifier with attribute metric; attributes follow xyz position data atm (vertex data must contain 3 + attribute_count floats per vertex)
+ */
-+MESHOPTIMIZER_EXPERIMENTAL size_t meshopt_simplifyWithAttributes(unsigned int* destination, const unsigned int* indices, size_t index_count, const float* vertex_data, size_t vertex_count, size_t vertex_stride, size_t target_index_count, float target_error, float* result_error, const float* attributes, const float* attribute_weights, size_t attribute_count);
++MESHOPTIMIZER_EXPERIMENTAL size_t meshopt_simplifyWithAttributes(unsigned int* destination, const unsigned int* indices, size_t index_count, const float* vertex_data, size_t vertex_count, size_t vertex_stride, size_t target_index_count, float target_error, unsigned int options, float* result_error, const float* attributes, const float* attribute_weights, size_t attribute_count);
+
/**
- * Experimental: Mesh simplifier (sloppy)
- * Reduces the number of triangles in the mesh, sacrificing mesh appearance for simplification performance
+ * Mesh simplifier
+ * Reduces the number of triangles in the mesh, attempting to preserve mesh appearance as much as possible
diff --git a/thirdparty/meshoptimizer/simplifier.cpp b/thirdparty/meshoptimizer/simplifier.cpp
-index a74b08a97d..5e92e2dc73 100644
+index 5f0e9bac31..797329b010 100644
--- a/thirdparty/meshoptimizer/simplifier.cpp
+++ b/thirdparty/meshoptimizer/simplifier.cpp
@@ -20,6 +20,8 @@
@@ -27,7 +27,7 @@ index a74b08a97d..5e92e2dc73 100644
// This work is based on:
// Michael Garland and Paul S. Heckbert. Surface simplification using quadric error metrics. 1997
// Michael Garland. Quadric-based polygonal surface simplification. 1999
-@@ -371,6 +373,10 @@ static void classifyVertices(unsigned char* result, unsigned int* loop, unsigned
+@@ -376,6 +378,10 @@ static void classifyVertices(unsigned char* result, unsigned int* loop, unsigned
struct Vector3
{
float x, y, z;
@@ -38,7 +38,7 @@ index a74b08a97d..5e92e2dc73 100644
};
static float rescalePositions(Vector3* result, const float* vertex_positions_data, size_t vertex_count, size_t vertex_positions_stride)
-@@ -427,6 +433,13 @@ struct Quadric
+@@ -432,6 +438,13 @@ struct Quadric
float a10, a20, a21;
float b0, b1, b2, c;
float w;
@@ -52,7 +52,7 @@ index a74b08a97d..5e92e2dc73 100644
};
struct Collapse
-@@ -469,6 +482,16 @@ static void quadricAdd(Quadric& Q, const Quadric& R)
+@@ -474,6 +487,16 @@ static void quadricAdd(Quadric& Q, const Quadric& R)
Q.b2 += R.b2;
Q.c += R.c;
Q.w += R.w;
@@ -69,7 +69,7 @@ index a74b08a97d..5e92e2dc73 100644
}
static float quadricError(const Quadric& Q, const Vector3& v)
-@@ -494,6 +517,17 @@ static float quadricError(const Quadric& Q, const Vector3& v)
+@@ -499,6 +522,17 @@ static float quadricError(const Quadric& Q, const Vector3& v)
r += ry * v.y;
r += rz * v.z;
@@ -87,7 +87,7 @@ index a74b08a97d..5e92e2dc73 100644
float s = Q.w == 0.f ? 0.f : 1.f / Q.w;
return fabsf(r) * s;
-@@ -517,6 +551,13 @@ static void quadricFromPlane(Quadric& Q, float a, float b, float c, float d, flo
+@@ -522,6 +556,13 @@ static void quadricFromPlane(Quadric& Q, float a, float b, float c, float d, flo
Q.b2 = c * dw;
Q.c = d * dw;
Q.w = w;
@@ -101,7 +101,7 @@ index a74b08a97d..5e92e2dc73 100644
}
static void quadricFromPoint(Quadric& Q, float x, float y, float z, float w)
-@@ -569,6 +610,84 @@ static void quadricFromTriangleEdge(Quadric& Q, const Vector3& p0, const Vector3
+@@ -574,6 +615,84 @@ static void quadricFromTriangleEdge(Quadric& Q, const Vector3& p0, const Vector3
quadricFromPlane(Q, normal.x, normal.y, normal.z, -distance, length * weight);
}
@@ -186,7 +186,7 @@ index a74b08a97d..5e92e2dc73 100644
static void fillFaceQuadrics(Quadric* vertex_quadrics, const unsigned int* indices, size_t index_count, const Vector3* vertex_positions, const unsigned int* remap)
{
for (size_t i = 0; i < index_count; i += 3)
-@@ -580,6 +699,9 @@ static void fillFaceQuadrics(Quadric* vertex_quadrics, const unsigned int* indic
+@@ -585,6 +704,9 @@ static void fillFaceQuadrics(Quadric* vertex_quadrics, const unsigned int* indic
Quadric Q;
quadricFromTriangle(Q, vertex_positions[i0], vertex_positions[i1], vertex_positions[i2], 1.f);
@@ -196,29 +196,30 @@ index a74b08a97d..5e92e2dc73 100644
quadricAdd(vertex_quadrics[remap[i0]], Q);
quadricAdd(vertex_quadrics[remap[i1]], Q);
quadricAdd(vertex_quadrics[remap[i2]], Q);
-@@ -1273,13 +1395,19 @@ MESHOPTIMIZER_API unsigned int* meshopt_simplifyDebugLoopBack = 0;
+@@ -1278,14 +1400,20 @@ MESHOPTIMIZER_API unsigned int* meshopt_simplifyDebugLoopBack = 0;
#endif
- size_t meshopt_simplify(unsigned int* destination, const unsigned int* indices, size_t index_count, const float* vertex_positions_data, size_t vertex_count, size_t vertex_positions_stride, size_t target_index_count, float target_error, float* out_result_error)
+ size_t meshopt_simplify(unsigned int* destination, const unsigned int* indices, size_t index_count, const float* vertex_positions_data, size_t vertex_count, size_t vertex_positions_stride, size_t target_index_count, float target_error, unsigned int options, float* out_result_error)
+{
-+ return meshopt_simplifyWithAttributes(destination, indices, index_count, vertex_positions_data, vertex_count, vertex_positions_stride, target_index_count, target_error, out_result_error, 0, 0, 0);
++ return meshopt_simplifyWithAttributes(destination, indices, index_count, vertex_positions_data, vertex_count, vertex_positions_stride, target_index_count, target_error, options, out_result_error, 0, 0, 0);
+}
+
-+size_t meshopt_simplifyWithAttributes(unsigned int* destination, const unsigned int* indices, size_t index_count, const float* vertex_data, size_t vertex_count, size_t vertex_stride, size_t target_index_count, float target_error, float* out_result_error, const float* attributes, const float* attribute_weights, size_t attribute_count)
++size_t meshopt_simplifyWithAttributes(unsigned int* destination, const unsigned int* indices, size_t index_count, const float* vertex_data, size_t vertex_count, size_t vertex_stride, size_t target_index_count, float target_error, unsigned int options, float* out_result_error, const float* attributes, const float* attribute_weights, size_t attribute_count)
{
using namespace meshopt;
assert(index_count % 3 == 0);
-- assert(vertex_positions_stride > 0 && vertex_positions_stride <= 256);
+- assert(vertex_positions_stride >= 12 && vertex_positions_stride <= 256);
- assert(vertex_positions_stride % sizeof(float) == 0);
-+ assert(vertex_stride > 0 && vertex_stride <= 256);
++ assert(vertex_stride >= 12 && vertex_stride <= 256);
+ assert(vertex_stride % sizeof(float) == 0);
assert(target_index_count <= index_count);
+ assert((options & ~(meshopt_SimplifyLockBorder)) == 0);
+ assert(attribute_count <= ATTRIBUTES);
meshopt_Allocator allocator;
-@@ -1293,7 +1421,7 @@ size_t meshopt_simplify(unsigned int* destination, const unsigned int* indices,
+@@ -1299,7 +1427,7 @@ size_t meshopt_simplify(unsigned int* destination, const unsigned int* indices,
// build position remap that maps each vertex to the one with identical position
unsigned int* remap = allocator.allocate<unsigned int>(vertex_count);
unsigned int* wedge = allocator.allocate<unsigned int>(vertex_count);
@@ -227,7 +228,7 @@ index a74b08a97d..5e92e2dc73 100644
// classify vertices; vertex kind determines collapse rules, see kCanCollapse
unsigned char* vertex_kind = allocator.allocate<unsigned char>(vertex_count);
-@@ -1317,7 +1445,21 @@ size_t meshopt_simplify(unsigned int* destination, const unsigned int* indices,
+@@ -1323,7 +1451,21 @@ size_t meshopt_simplify(unsigned int* destination, const unsigned int* indices,
#endif
Vector3* vertex_positions = allocator.allocate<Vector3>(vertex_count);
@@ -250,7 +251,7 @@ index a74b08a97d..5e92e2dc73 100644
Quadric* vertex_quadrics = allocator.allocate<Quadric>(vertex_count);
memset(vertex_quadrics, 0, vertex_count * sizeof(Quadric));
-@@ -1409,7 +1551,9 @@ size_t meshopt_simplify(unsigned int* destination, const unsigned int* indices,
+@@ -1415,7 +1557,9 @@ size_t meshopt_simplify(unsigned int* destination, const unsigned int* indices,
// result_error is quadratic; we need to remap it back to linear
if (out_result_error)
diff --git a/thirdparty/meshoptimizer/simplifier.cpp b/thirdparty/meshoptimizer/simplifier.cpp
index e40c141e76..391a77861a 100644
--- a/thirdparty/meshoptimizer/simplifier.cpp
+++ b/thirdparty/meshoptimizer/simplifier.cpp
@@ -254,7 +254,7 @@ static bool hasEdge(const EdgeAdjacency& adjacency, unsigned int a, unsigned int
return false;
}
-static void classifyVertices(unsigned char* result, unsigned int* loop, unsigned int* loopback, size_t vertex_count, const EdgeAdjacency& adjacency, const unsigned int* remap, const unsigned int* wedge)
+static void classifyVertices(unsigned char* result, unsigned int* loop, unsigned int* loopback, size_t vertex_count, const EdgeAdjacency& adjacency, const unsigned int* remap, const unsigned int* wedge, unsigned int options)
{
memset(loop, -1, vertex_count * sizeof(unsigned int));
memset(loopback, -1, vertex_count * sizeof(unsigned int));
@@ -364,6 +364,11 @@ static void classifyVertices(unsigned char* result, unsigned int* loop, unsigned
}
}
+ if (options & meshopt_SimplifyLockBorder)
+ for (size_t i = 0; i < vertex_count; ++i)
+ if (result[i] == Kind_Border)
+ result[i] = Kind_Locked;
+
#if TRACE
printf("locked: many open edges %d, disconnected seam %d, many seam edges %d, many wedges %d\n",
int(stats[0]), int(stats[1]), int(stats[2]), int(stats[3]));
@@ -1434,19 +1439,20 @@ MESHOPTIMIZER_API unsigned int* meshopt_simplifyDebugLoop = 0;
MESHOPTIMIZER_API unsigned int* meshopt_simplifyDebugLoopBack = 0;
#endif
-size_t meshopt_simplify(unsigned int* destination, const unsigned int* indices, size_t index_count, const float* vertex_positions_data, size_t vertex_count, size_t vertex_positions_stride, size_t target_index_count, float target_error, float* out_result_error)
+size_t meshopt_simplify(unsigned int* destination, const unsigned int* indices, size_t index_count, const float* vertex_positions_data, size_t vertex_count, size_t vertex_positions_stride, size_t target_index_count, float target_error, unsigned int options, float* out_result_error)
{
- return meshopt_simplifyWithAttributes(destination, indices, index_count, vertex_positions_data, vertex_count, vertex_positions_stride, target_index_count, target_error, out_result_error, 0, 0, 0);
+ return meshopt_simplifyWithAttributes(destination, indices, index_count, vertex_positions_data, vertex_count, vertex_positions_stride, target_index_count, target_error, options, out_result_error, 0, 0, 0);
}
-size_t meshopt_simplifyWithAttributes(unsigned int* destination, const unsigned int* indices, size_t index_count, const float* vertex_data, size_t vertex_count, size_t vertex_stride, size_t target_index_count, float target_error, float* out_result_error, const float* attributes, const float* attribute_weights, size_t attribute_count)
+size_t meshopt_simplifyWithAttributes(unsigned int* destination, const unsigned int* indices, size_t index_count, const float* vertex_data, size_t vertex_count, size_t vertex_stride, size_t target_index_count, float target_error, unsigned int options, float* out_result_error, const float* attributes, const float* attribute_weights, size_t attribute_count)
{
using namespace meshopt;
assert(index_count % 3 == 0);
- assert(vertex_stride > 0 && vertex_stride <= 256);
+ assert(vertex_stride >= 12 && vertex_stride <= 256);
assert(vertex_stride % sizeof(float) == 0);
assert(target_index_count <= index_count);
+ assert((options & ~(meshopt_SimplifyLockBorder)) == 0);
assert(attribute_count <= ATTRIBUTES);
meshopt_Allocator allocator;
@@ -1467,7 +1473,7 @@ size_t meshopt_simplifyWithAttributes(unsigned int* destination, const unsigned
unsigned char* vertex_kind = allocator.allocate<unsigned char>(vertex_count);
unsigned int* loop = allocator.allocate<unsigned int>(vertex_count);
unsigned int* loopback = allocator.allocate<unsigned int>(vertex_count);
- classifyVertices(vertex_kind, loop, loopback, vertex_count, adjacency, remap, wedge);
+ classifyVertices(vertex_kind, loop, loopback, vertex_count, adjacency, remap, wedge, options);
#if TRACE
size_t unique_positions = 0;
@@ -1605,7 +1611,7 @@ size_t meshopt_simplifySloppy(unsigned int* destination, const unsigned int* ind
using namespace meshopt;
assert(index_count % 3 == 0);
- assert(vertex_positions_stride > 0 && vertex_positions_stride <= 256);
+ assert(vertex_positions_stride >= 12 && vertex_positions_stride <= 256);
assert(vertex_positions_stride % sizeof(float) == 0);
assert(target_index_count <= index_count);
@@ -1736,7 +1742,7 @@ size_t meshopt_simplifyPoints(unsigned int* destination, const float* vertex_pos
{
using namespace meshopt;
- assert(vertex_positions_stride > 0 && vertex_positions_stride <= 256);
+ assert(vertex_positions_stride >= 12 && vertex_positions_stride <= 256);
assert(vertex_positions_stride % sizeof(float) == 0);
assert(target_vertex_count <= vertex_count);
@@ -1848,7 +1854,7 @@ float meshopt_simplifyScale(const float* vertex_positions, size_t vertex_count,
{
using namespace meshopt;
- assert(vertex_positions_stride > 0 && vertex_positions_stride <= 256);
+ assert(vertex_positions_stride >= 12 && vertex_positions_stride <= 256);
assert(vertex_positions_stride % sizeof(float) == 0);
float extent = rescalePositions(NULL, vertex_positions, vertex_count, vertex_positions_stride);
diff --git a/thirdparty/meshoptimizer/spatialorder.cpp b/thirdparty/meshoptimizer/spatialorder.cpp
index b09f80ac6f..7b1a069450 100644
--- a/thirdparty/meshoptimizer/spatialorder.cpp
+++ b/thirdparty/meshoptimizer/spatialorder.cpp
@@ -113,7 +113,7 @@ void meshopt_spatialSortRemap(unsigned int* destination, const float* vertex_pos
{
using namespace meshopt;
- assert(vertex_positions_stride > 0 && vertex_positions_stride <= 256);
+ assert(vertex_positions_stride >= 12 && vertex_positions_stride <= 256);
assert(vertex_positions_stride % sizeof(float) == 0);
meshopt_Allocator allocator;
@@ -144,7 +144,7 @@ void meshopt_spatialSortTriangles(unsigned int* destination, const unsigned int*
using namespace meshopt;
assert(index_count % 3 == 0);
- assert(vertex_positions_stride > 0 && vertex_positions_stride <= 256);
+ assert(vertex_positions_stride >= 12 && vertex_positions_stride <= 256);
assert(vertex_positions_stride % sizeof(float) == 0);
(void)vertex_count;
diff --git a/thirdparty/meshoptimizer/vcacheoptimizer.cpp b/thirdparty/meshoptimizer/vcacheoptimizer.cpp
index fb8ade4b77..ce8fd3a887 100644
--- a/thirdparty/meshoptimizer/vcacheoptimizer.cpp
+++ b/thirdparty/meshoptimizer/vcacheoptimizer.cpp
@@ -110,7 +110,7 @@ static unsigned int getNextVertexDeadEnd(const unsigned int* dead_end, unsigned
return ~0u;
}
-static unsigned int getNextVertexNeighbour(const unsigned int* next_candidates_begin, const unsigned int* next_candidates_end, const unsigned int* live_triangles, const unsigned int* cache_timestamps, unsigned int timestamp, unsigned int cache_size)
+static unsigned int getNextVertexNeighbor(const unsigned int* next_candidates_begin, const unsigned int* next_candidates_end, const unsigned int* live_triangles, const unsigned int* cache_timestamps, unsigned int timestamp, unsigned int cache_size)
{
unsigned int best_candidate = ~0u;
int best_priority = -1;
@@ -281,16 +281,16 @@ void meshopt_optimizeVertexCacheTable(unsigned int* destination, const unsigned
{
unsigned int index = indices[current_triangle * 3 + k];
- unsigned int* neighbours = &adjacency.data[0] + adjacency.offsets[index];
- size_t neighbours_size = adjacency.counts[index];
+ unsigned int* neighbors = &adjacency.data[0] + adjacency.offsets[index];
+ size_t neighbors_size = adjacency.counts[index];
- for (size_t i = 0; i < neighbours_size; ++i)
+ for (size_t i = 0; i < neighbors_size; ++i)
{
- unsigned int tri = neighbours[i];
+ unsigned int tri = neighbors[i];
if (tri == current_triangle)
{
- neighbours[i] = neighbours[neighbours_size - 1];
+ neighbors[i] = neighbors[neighbors_size - 1];
adjacency.counts[index]--;
break;
}
@@ -314,10 +314,10 @@ void meshopt_optimizeVertexCacheTable(unsigned int* destination, const unsigned
vertex_scores[index] = score;
// update scores of vertex triangles
- const unsigned int* neighbours_begin = &adjacency.data[0] + adjacency.offsets[index];
- const unsigned int* neighbours_end = neighbours_begin + adjacency.counts[index];
+ const unsigned int* neighbors_begin = &adjacency.data[0] + adjacency.offsets[index];
+ const unsigned int* neighbors_end = neighbors_begin + adjacency.counts[index];
- for (const unsigned int* it = neighbours_begin; it != neighbours_end; ++it)
+ for (const unsigned int* it = neighbors_begin; it != neighbors_end; ++it)
{
unsigned int tri = *it;
assert(!emitted_flags[tri]);
@@ -412,11 +412,11 @@ void meshopt_optimizeVertexCacheFifo(unsigned int* destination, const unsigned i
{
const unsigned int* next_candidates_begin = &dead_end[0] + dead_end_top;
- // emit all vertex neighbours
- const unsigned int* neighbours_begin = &adjacency.data[0] + adjacency.offsets[current_vertex];
- const unsigned int* neighbours_end = neighbours_begin + adjacency.counts[current_vertex];
+ // emit all vertex neighbors
+ const unsigned int* neighbors_begin = &adjacency.data[0] + adjacency.offsets[current_vertex];
+ const unsigned int* neighbors_end = neighbors_begin + adjacency.counts[current_vertex];
- for (const unsigned int* it = neighbours_begin; it != neighbours_end; ++it)
+ for (const unsigned int* it = neighbors_begin; it != neighbors_end; ++it)
{
unsigned int triangle = *it;
@@ -461,7 +461,7 @@ void meshopt_optimizeVertexCacheFifo(unsigned int* destination, const unsigned i
const unsigned int* next_candidates_end = &dead_end[0] + dead_end_top;
// get next vertex
- current_vertex = getNextVertexNeighbour(next_candidates_begin, next_candidates_end, &live_triangles[0], &cache_timestamps[0], timestamp, cache_size);
+ current_vertex = getNextVertexNeighbor(next_candidates_begin, next_candidates_end, &live_triangles[0], &cache_timestamps[0], timestamp, cache_size);
if (current_vertex == ~0u)
{
diff --git a/thirdparty/meshoptimizer/vertexcodec.cpp b/thirdparty/meshoptimizer/vertexcodec.cpp
index 7925ea862c..4bd11121d2 100644
--- a/thirdparty/meshoptimizer/vertexcodec.cpp
+++ b/thirdparty/meshoptimizer/vertexcodec.cpp
@@ -50,6 +50,12 @@
#define SIMD_TARGET
#endif
+// When targeting AArch64/x64, optimize for latency to allow decoding of individual 16-byte groups to overlap
+// We don't do this for 32-bit systems because we need 64-bit math for this and this will hurt in-order CPUs
+#if defined(__x86_64__) || defined(_M_X64) || defined(__aarch64__) || defined(_M_ARM64)
+#define SIMD_LATENCYOPT
+#endif
+
#endif // !MESHOPTIMIZER_NO_SIMD
#ifdef SIMD_SSE
@@ -472,6 +478,18 @@ static const unsigned char* decodeBytesGroupSimd(const unsigned char* data, unsi
typedef int unaligned_int;
#endif
+#ifdef SIMD_LATENCYOPT
+ unsigned int data32;
+ memcpy(&data32, data, 4);
+ data32 &= data32 >> 1;
+
+ // arrange bits such that low bits of nibbles of data64 contain all 2-bit elements of data32
+ unsigned long long data64 = ((unsigned long long)data32 << 30) | (data32 & 0x3fffffff);
+
+ // adds all 1-bit nibbles together; the sum fits in 4 bits because datacnt=16 would have used mode 3
+ int datacnt = int(((data64 & 0x1111111111111111ull) * 0x1111111111111111ull) >> 60);
+#endif
+
__m128i sel2 = _mm_cvtsi32_si128(*reinterpret_cast<const unaligned_int*>(data));
__m128i rest = _mm_loadu_si128(reinterpret_cast<const __m128i*>(data + 4));
@@ -490,11 +508,25 @@ static const unsigned char* decodeBytesGroupSimd(const unsigned char* data, unsi
_mm_storeu_si128(reinterpret_cast<__m128i*>(buffer), result);
+#ifdef SIMD_LATENCYOPT
+ return data + 4 + datacnt;
+#else
return data + 4 + kDecodeBytesGroupCount[mask0] + kDecodeBytesGroupCount[mask1];
+#endif
}
case 2:
{
+#ifdef SIMD_LATENCYOPT
+ unsigned long long data64;
+ memcpy(&data64, data, 8);
+ data64 &= data64 >> 1;
+ data64 &= data64 >> 2;
+
+ // adds all 1-bit nibbles together; the sum fits in 4 bits because datacnt=16 would have used mode 3
+ int datacnt = int(((data64 & 0x1111111111111111ull) * 0x1111111111111111ull) >> 60);
+#endif
+
__m128i sel4 = _mm_loadl_epi64(reinterpret_cast<const __m128i*>(data));
__m128i rest = _mm_loadu_si128(reinterpret_cast<const __m128i*>(data + 8));
@@ -512,7 +544,11 @@ static const unsigned char* decodeBytesGroupSimd(const unsigned char* data, unsi
_mm_storeu_si128(reinterpret_cast<__m128i*>(buffer), result);
+#ifdef SIMD_LATENCYOPT
+ return data + 8 + datacnt;
+#else
return data + 8 + kDecodeBytesGroupCount[mask0] + kDecodeBytesGroupCount[mask1];
+#endif
}
case 3:
@@ -604,24 +640,13 @@ static uint8x16_t shuffleBytes(unsigned char mask0, unsigned char mask1, uint8x8
static void neonMoveMask(uint8x16_t mask, unsigned char& mask0, unsigned char& mask1)
{
- static const unsigned char byte_mask_data[16] = {1, 2, 4, 8, 16, 32, 64, 128, 1, 2, 4, 8, 16, 32, 64, 128};
-
- uint8x16_t byte_mask = vld1q_u8(byte_mask_data);
- uint8x16_t masked = vandq_u8(mask, byte_mask);
+ // magic constant found using z3 SMT assuming mask has 8 groups of 0xff or 0x00
+ const uint64_t magic = 0x000103070f1f3f80ull;
-#ifdef __aarch64__
- // aarch64 has horizontal sums; MSVC doesn't expose this via arm64_neon.h so this path is exclusive to clang/gcc
- mask0 = vaddv_u8(vget_low_u8(masked));
- mask1 = vaddv_u8(vget_high_u8(masked));
-#else
- // we need horizontal sums of each half of masked, which can be done in 3 steps (yielding sums of sizes 2, 4, 8)
- uint8x8_t sum1 = vpadd_u8(vget_low_u8(masked), vget_high_u8(masked));
- uint8x8_t sum2 = vpadd_u8(sum1, sum1);
- uint8x8_t sum3 = vpadd_u8(sum2, sum2);
+ uint64x2_t mask2 = vreinterpretq_u64_u8(mask);
- mask0 = vget_lane_u8(sum3, 0);
- mask1 = vget_lane_u8(sum3, 1);
-#endif
+ mask0 = uint8_t((vgetq_lane_u64(mask2, 0) * magic) >> 56);
+ mask1 = uint8_t((vgetq_lane_u64(mask2, 1) * magic) >> 56);
}
static const unsigned char* decodeBytesGroupSimd(const unsigned char* data, unsigned char* buffer, int bitslog2)
@@ -639,6 +664,18 @@ static const unsigned char* decodeBytesGroupSimd(const unsigned char* data, unsi
case 1:
{
+#ifdef SIMD_LATENCYOPT
+ unsigned int data32;
+ memcpy(&data32, data, 4);
+ data32 &= data32 >> 1;
+
+ // arrange bits such that low bits of nibbles of data64 contain all 2-bit elements of data32
+ unsigned long long data64 = ((unsigned long long)data32 << 30) | (data32 & 0x3fffffff);
+
+ // adds all 1-bit nibbles together; the sum fits in 4 bits because datacnt=16 would have used mode 3
+ int datacnt = int(((data64 & 0x1111111111111111ull) * 0x1111111111111111ull) >> 60);
+#endif
+
uint8x8_t sel2 = vld1_u8(data);
uint8x8_t sel22 = vzip_u8(vshr_n_u8(sel2, 4), sel2).val[0];
uint8x8x2_t sel2222 = vzip_u8(vshr_n_u8(sel22, 2), sel22);
@@ -655,11 +692,25 @@ static const unsigned char* decodeBytesGroupSimd(const unsigned char* data, unsi
vst1q_u8(buffer, result);
+#ifdef SIMD_LATENCYOPT
+ return data + 4 + datacnt;
+#else
return data + 4 + kDecodeBytesGroupCount[mask0] + kDecodeBytesGroupCount[mask1];
+#endif
}
case 2:
{
+#ifdef SIMD_LATENCYOPT
+ unsigned long long data64;
+ memcpy(&data64, data, 8);
+ data64 &= data64 >> 1;
+ data64 &= data64 >> 2;
+
+ // adds all 1-bit nibbles together; the sum fits in 4 bits because datacnt=16 would have used mode 3
+ int datacnt = int(((data64 & 0x1111111111111111ull) * 0x1111111111111111ull) >> 60);
+#endif
+
uint8x8_t sel4 = vld1_u8(data);
uint8x8x2_t sel44 = vzip_u8(vshr_n_u8(sel4, 4), vand_u8(sel4, vdup_n_u8(15)));
uint8x16_t sel = vcombine_u8(sel44.val[0], sel44.val[1]);
@@ -675,7 +726,11 @@ static const unsigned char* decodeBytesGroupSimd(const unsigned char* data, unsi
vst1q_u8(buffer, result);
+#ifdef SIMD_LATENCYOPT
+ return data + 8 + datacnt;
+#else
return data + 8 + kDecodeBytesGroupCount[mask0] + kDecodeBytesGroupCount[mask1];
+#endif
}
case 3:
@@ -715,7 +770,6 @@ static void wasmMoveMask(v128_t mask, unsigned char& mask0, unsigned char& mask1
// magic constant found using z3 SMT assuming mask has 8 groups of 0xff or 0x00
const uint64_t magic = 0x000103070f1f3f80ull;
- // TODO: This can use v8x16_bitmask in the future
mask0 = uint8_t((wasm_i64x2_extract_lane(mask, 0) * magic) >> 56);
mask1 = uint8_t((wasm_i64x2_extract_lane(mask, 1) * magic) >> 56);
}
diff --git a/thirdparty/meshoptimizer/vertexfilter.cpp b/thirdparty/meshoptimizer/vertexfilter.cpp
index 606a280aa9..14a73b1ddd 100644
--- a/thirdparty/meshoptimizer/vertexfilter.cpp
+++ b/thirdparty/meshoptimizer/vertexfilter.cpp
@@ -931,7 +931,7 @@ void meshopt_encodeFilterExp(void* destination_, size_t count, size_t stride, in
const float* v = &data[i * stride_float];
unsigned int* d = &destination[i * stride_float];
- // use maximum exponent to encode values; this guarantess that mantissa is [-1, 1]
+ // use maximum exponent to encode values; this guarantees that mantissa is [-1, 1]
int exp = -100;
for (size_t j = 0; j < stride_float; ++j)