summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--.github/actions/godot-build/action.yml17
-rw-r--r--.github/workflows/android_builds.yml8
-rw-r--r--.github/workflows/ios_builds.yml5
-rw-r--r--.github/workflows/linux_builds.yml42
-rw-r--r--.github/workflows/macos_builds.yml13
-rw-r--r--.github/workflows/static_checks.yml6
-rw-r--r--.github/workflows/web_builds.yml5
-rw-r--r--.github/workflows/windows_builds.yml13
-rw-r--r--SConstruct155
-rw-r--r--core/SCsub2
-rw-r--r--core/core_builders.py6
-rw-r--r--core/extension/gdnative_interface.cpp6
-rw-r--r--core/input/input_builders.py2
-rw-r--r--core/io/file_access.cpp2
-rw-r--r--core/io/image.cpp32
-rw-r--r--core/io/resource_format_binary.cpp8
-rw-r--r--core/io/resource_uid.cpp7
-rw-r--r--core/math/bvh_split.inc4
-rw-r--r--core/object/worker_thread_pool.cpp2
-rw-r--r--core/templates/local_vector.h10
-rw-r--r--core/templates/pooled_list.h2
-rw-r--r--core/variant/type_info.h8
-rw-r--r--doc/classes/AnimationLibrary.xml2
-rw-r--r--doc/classes/AnimationPlayer.xml4
-rw-r--r--doc/classes/Control.xml2
-rw-r--r--doc/classes/CubemapArray.xml2
-rw-r--r--doc/classes/DirAccess.xml2
-rw-r--r--doc/classes/EditorSettings.xml4
-rw-r--r--doc/classes/FileAccess.xml8
-rw-r--r--doc/classes/ImageFormatLoaderExtension.xml4
-rw-r--r--doc/classes/InputEventWithModifiers.xml2
-rw-r--r--doc/classes/MultiplayerAPIExtension.xml2
-rw-r--r--doc/classes/NavigationPathQueryParameters2D.xml2
-rw-r--r--doc/classes/NavigationPathQueryParameters3D.xml2
-rw-r--r--doc/classes/NavigationPathQueryResult2D.xml8
-rw-r--r--doc/classes/NavigationPathQueryResult3D.xml8
-rw-r--r--doc/classes/Node3D.xml2
-rw-r--r--doc/classes/OS.xml2
-rw-r--r--doc/classes/ProjectSettings.xml2
-rwxr-xr-xdoc/tools/make_rst.py29
-rw-r--r--doc/translations/extract.py2
-rw-r--r--drivers/gles3/rasterizer_scene_gles3.cpp15
-rw-r--r--drivers/gles3/storage/material_storage.cpp4
-rw-r--r--drivers/gles3/storage/texture_storage.cpp2
-rw-r--r--drivers/vulkan/rendering_device_vulkan.cpp4
-rw-r--r--editor/SCsub2
-rw-r--r--editor/editor_builders.py5
-rw-r--r--editor/editor_file_system.cpp2
-rw-r--r--editor/editor_inspector.cpp2
-rw-r--r--editor/editor_run.cpp2
-rw-r--r--editor/editor_run_native.cpp4
-rw-r--r--editor/editor_themes.cpp2
-rw-r--r--editor/export/editor_export_platform.cpp6
-rw-r--r--editor/export/editor_export_platform.h2
-rw-r--r--editor/plugins/animation_player_editor_plugin.cpp15
-rw-r--r--editor/plugins/animation_player_editor_plugin.h2
-rw-r--r--editor/plugins/bone_map_editor_plugin.cpp2
-rw-r--r--editor/plugins/debugger_editor_plugin.cpp14
-rw-r--r--editor/plugins/debugger_editor_plugin.h2
-rw-r--r--editor/plugins/script_text_editor.cpp42
-rw-r--r--editor/plugins/script_text_editor.h4
-rw-r--r--editor/plugins/shader_editor_plugin.cpp16
-rw-r--r--editor/plugins/shader_editor_plugin.h4
-rw-r--r--editor/plugins/text_editor.cpp16
-rw-r--r--editor/plugins/text_editor.h4
-rw-r--r--editor/plugins/tiles/tile_data_editors.cpp204
-rw-r--r--editor/plugins/visual_shader_editor_plugin.cpp3
-rw-r--r--editor/project_converter_3_to_4.cpp14
-rwxr-xr-xeditor/translations/extract.py7
-rw-r--r--gles3_builders.py10
-rw-r--r--glsl_builders.py14
-rw-r--r--main/main.cpp7
-rw-r--r--methods.py27
-rw-r--r--misc/dist/html/editor.html4
-rw-r--r--misc/dist/html/manifest.json2
-rwxr-xr-xmisc/scripts/codespell.sh2
-rw-r--r--misc/scripts/mypy.ini11
-rwxr-xr-xmisc/scripts/mypy_check.sh6
-rw-r--r--modules/basis_universal/SCsub4
-rw-r--r--modules/csg/SCsub2
-rw-r--r--modules/cvtt/config.py2
-rw-r--r--modules/denoise/config.py2
-rw-r--r--modules/etcpak/config.py2
-rw-r--r--modules/freetype/SCsub2
-rw-r--r--modules/gdscript/SCsub2
-rw-r--r--modules/gdscript/doc_classes/@GDScript.xml2
-rw-r--r--modules/gdscript/gdscript_parser.cpp4
-rw-r--r--modules/gltf/SCsub2
-rw-r--r--modules/gltf/editor/editor_scene_importer_blend.cpp2
-rw-r--r--modules/gltf/editor/editor_scene_importer_blend.h4
-rw-r--r--modules/gridmap/SCsub2
-rw-r--r--modules/gridmap/doc_classes/GridMap.xml2
-rw-r--r--modules/mono/SCsub2
-rwxr-xr-xmodules/mono/build_scripts/build_assemblies.py8
-rw-r--r--modules/mono/build_scripts/mono_configure.py9
-rw-r--r--modules/mono/config.py2
-rw-r--r--modules/mono/editor/Godot.NET.Sdk/Godot.SourceGenerators/ScriptSignalsGenerator.cs2
-rw-r--r--modules/mono/glue/GodotSharp/GodotSharp/Core/Callable.cs2
-rw-r--r--modules/mono/glue/GodotSharp/GodotSharp/Core/NativeInterop/Marshaling.cs3
-rw-r--r--modules/mono/glue/GodotSharp/GodotSharp/Core/NativeInterop/NativeFuncs.cs2
-rw-r--r--modules/mono/glue/runtime_interop.cpp5
-rw-r--r--modules/mono/managed_callable.cpp6
-rw-r--r--modules/mono/managed_callable.h3
-rw-r--r--modules/multiplayer/SCsub2
-rw-r--r--modules/multiplayer/doc_classes/MultiplayerSynchronizer.xml4
-rw-r--r--modules/multiplayer/multiplayer_spawner.cpp2
-rw-r--r--modules/multiplayer/scene_replication_interface.cpp5
-rw-r--r--modules/navigation/SCsub2
-rw-r--r--modules/openxr/SCsub2
-rw-r--r--modules/text_server_adv/SCsub7
-rw-r--r--modules/text_server_adv/gdextension_build/SConstruct2
-rw-r--r--modules/text_server_fb/gdextension_build/SConstruct2
-rw-r--r--modules/tinyexr/config.py2
-rw-r--r--modules/vorbis/audio_stream_ogg_vorbis.cpp2
-rw-r--r--modules/websocket/SCsub2
-rw-r--r--modules/xatlas_unwrap/config.py2
-rw-r--r--platform/android/SCsub10
-rw-r--r--platform/android/detect.py27
-rw-r--r--platform/ios/detect.py36
-rw-r--r--platform/linuxbsd/detect.py34
-rw-r--r--platform/linuxbsd/gl_manager_x11.cpp2
-rw-r--r--platform/macos/detect.py30
-rw-r--r--platform/uwp/detect.py11
-rw-r--r--platform/web/detect.py29
-rw-r--r--platform/web/emscripten_helpers.py14
-rw-r--r--platform/windows/detect.py72
-rw-r--r--scene/2d/navigation_agent_2d.cpp42
-rw-r--r--scene/2d/navigation_agent_2d.h9
-rw-r--r--scene/3d/lightmap_gi.cpp15
-rw-r--r--scene/3d/navigation_agent_3d.cpp42
-rw-r--r--scene/3d/navigation_agent_3d.h9
-rw-r--r--scene/3d/node_3d.cpp1
-rw-r--r--scene/3d/voxel_gi.cpp6
-rw-r--r--scene/resources/audio_stream_wav.cpp4
-rw-r--r--scene/resources/font.cpp18
-rw-r--r--scene/resources/tile_set.cpp1
-rw-r--r--scene/resources/visual_shader.cpp3
-rw-r--r--servers/audio/audio_rb_resampler.cpp8
-rw-r--r--servers/audio/effects/audio_effect_filter.cpp12
-rw-r--r--servers/audio/effects/audio_stream_generator.cpp2
-rw-r--r--servers/navigation/navigation_path_query_result_2d.cpp6
-rw-r--r--servers/navigation/navigation_path_query_result_2d.h2
-rw-r--r--servers/navigation/navigation_path_query_result_3d.cpp6
-rw-r--r--servers/navigation/navigation_path_query_result_3d.h2
-rw-r--r--servers/physics_2d/godot_collision_solver_2d_sat.cpp42
-rw-r--r--servers/physics_2d/godot_physics_server_2d.cpp33
-rw-r--r--servers/physics_3d/godot_physics_server_3d.cpp1
-rw-r--r--servers/rendering/renderer_rd/forward_clustered/render_forward_clustered.cpp17
-rw-r--r--servers/rendering/renderer_rd/forward_clustered/scene_shader_forward_clustered.cpp6
-rw-r--r--servers/rendering/renderer_rd/forward_mobile/render_forward_mobile.cpp13
-rw-r--r--servers/rendering/renderer_rd/forward_mobile/scene_shader_forward_mobile.cpp6
-rw-r--r--servers/rendering/renderer_rd/renderer_canvas_render_rd.cpp2
-rw-r--r--servers/rendering/renderer_rd/renderer_compositor_rd.cpp4
-rw-r--r--servers/rendering/renderer_rd/renderer_scene_render_rd.cpp1
-rw-r--r--servers/rendering/renderer_rd/shaders/canvas.glsl9
-rw-r--r--servers/rendering/renderer_rd/shaders/forward_clustered/scene_forward_clustered.glsl81
-rw-r--r--servers/rendering/renderer_rd/shaders/forward_mobile/scene_forward_mobile.glsl80
-rw-r--r--servers/rendering/renderer_rd/shaders/particles.glsl2
-rw-r--r--servers/rendering/renderer_rd/storage_rd/material_storage.cpp2
-rw-r--r--servers/rendering/renderer_rd/storage_rd/material_storage.h12
-rw-r--r--servers/rendering/renderer_rd/storage_rd/mesh_storage.cpp1
-rw-r--r--servers/rendering/renderer_rd/storage_rd/particles_storage.cpp2
-rw-r--r--servers/rendering/renderer_rd/storage_rd/render_scene_data_rd.cpp6
-rw-r--r--servers/rendering/renderer_rd/storage_rd/texture_storage.cpp2
-rw-r--r--servers/rendering/shader_types.cpp7
-rw-r--r--tests/core/input/test_input_event_key.h2
-rw-r--r--tests/core/math/test_quaternion.h2
-rw-r--r--tests/scene/test_bit_map.h6
168 files changed, 1087 insertions, 747 deletions
diff --git a/.github/actions/godot-build/action.yml b/.github/actions/godot-build/action.yml
index 75f3d9ab37..377480b123 100644
--- a/.github/actions/godot-build/action.yml
+++ b/.github/actions/godot-build/action.yml
@@ -2,16 +2,13 @@ name: Build Godot
description: Build Godot with the provided options.
inputs:
target:
- description: The scons target (debug/release_debug/release).
- default: "debug"
- tools:
- description: If tools are to be built.
- default: false
+ description: Build target (editor, template_release, template_debug).
+ default: "editor"
tests:
- description: If tests are to be built.
+ description: Unit tests.
default: false
platform:
- description: The Godot platform to build.
+ description: Target platform.
required: false
sconsflags:
default: ""
@@ -33,7 +30,7 @@ runs:
SCONS_CACHE: ${{ inputs.scons-cache }}
SCONS_CACHE_LIMIT: ${{ inputs.scons-cache-limit }}
run: |
- echo "Building with flags:" ${{ env.SCONSFLAGS }}
- if ! ${{ inputs.tools }}; then rm -rf editor; fi # Ensure we don't include editor code.
- scons p=${{ inputs.platform }} target=${{ inputs.target }} tools=${{ inputs.tools }} tests=${{ inputs.tests }} ${{ env.SCONSFLAGS }}
+ echo "Building with flags:" platform=${{ inputs.platform }} target=${{ inputs.target }} tests=${{ inputs.tests }} ${{ env.SCONSFLAGS }}
+ if [ "${{ inputs.target }}" != "editor" ]; then rm -rf editor; fi # Ensure we don't include editor code.
+ scons platform=${{ inputs.platform }} target=${{ inputs.target }} tests=${{ inputs.tests }} ${{ env.SCONSFLAGS }}
ls -l bin/
diff --git a/.github/workflows/android_builds.yml b/.github/workflows/android_builds.yml
index 4f54f6629e..ed4ef01012 100644
--- a/.github/workflows/android_builds.yml
+++ b/.github/workflows/android_builds.yml
@@ -14,7 +14,7 @@ concurrency:
jobs:
android-template:
runs-on: "ubuntu-20.04"
- name: Template (target=release, tools=no)
+ name: Template (target=template_release)
steps:
- uses: actions/checkout@v3
@@ -44,8 +44,7 @@ jobs:
with:
sconsflags: ${{ env.SCONSFLAGS }} arch=arm32
platform: android
- target: release
- tools: false
+ target: template_release
tests: false
- name: Compilation (arm64)
@@ -53,8 +52,7 @@ jobs:
with:
sconsflags: ${{ env.SCONSFLAGS }} arch=arm64
platform: android
- target: release
- tools: false
+ target: template_release
tests: false
- name: Generate Godot templates
diff --git a/.github/workflows/ios_builds.yml b/.github/workflows/ios_builds.yml
index bc00fad569..0ea7a4ccc3 100644
--- a/.github/workflows/ios_builds.yml
+++ b/.github/workflows/ios_builds.yml
@@ -14,7 +14,7 @@ concurrency:
jobs:
ios-template:
runs-on: "macos-latest"
- name: Template (target=release, tools=no)
+ name: Template (target=template_release)
steps:
- uses: actions/checkout@v3
@@ -31,8 +31,7 @@ jobs:
with:
sconsflags: ${{ env.SCONSFLAGS }}
platform: ios
- target: release
- tools: false
+ target: template_release
tests: false
- name: Upload artifact
diff --git a/.github/workflows/linux_builds.yml b/.github/workflows/linux_builds.yml
index 2e8bd101e5..b0ed71a7b5 100644
--- a/.github/workflows/linux_builds.yml
+++ b/.github/workflows/linux_builds.yml
@@ -7,7 +7,7 @@ env:
GODOT_BASE_BRANCH: master
SCONSFLAGS: verbose=yes warnings=extra werror=yes module_text_server_fb_enabled=yes
DOTNET_NOLOGO: true
- DOTNET_CLI_TELEMETRY_OPTOUT: false
+ DOTNET_CLI_TELEMETRY_OPTOUT: true
concurrency:
group: ci-${{github.actor}}-${{github.head_ref || github.run_number}}-${{github.ref}}-linux
@@ -21,57 +21,52 @@ jobs:
fail-fast: false
matrix:
include:
- - name: Editor w Mono (target=release_debug, tools=yes, tests=yes)
+ - name: Editor w/ Mono (target=editor)
cache-name: linux-editor-mono
- target: release_debug
- tools: true
+ target: editor
tests: false # Disabled due freeze caused by mix Mono build and CI
sconsflags: module_mono_enabled=yes
doc-test: true
- bin: "./bin/godot.linuxbsd.opt.tools.x86_64.mono"
+ bin: "./bin/godot.linuxbsd.editor.x86_64.mono"
build-mono: true
proj-conv: true
artifact: true
- - name: Editor with doubles and GCC sanitizers (target=debug, tools=yes, float=64, tests=yes, use_asan=yes, use_ubsan=yes, linker=gold)
+ - name: Editor with doubles and GCC sanitizers (target=editor, tests=yes, dev_build=yes, float=64, use_asan=yes, use_ubsan=yes, linker=gold)
cache-name: linux-editor-double-sanitizers
- target: debug
- tools: true
+ target: editor
tests: true
- sconsflags: float=64 use_asan=yes use_ubsan=yes linker=gold
+ sconsflags: dev_build=yes float=64 use_asan=yes use_ubsan=yes linker=gold
proj-test: true
# Can be turned off for PRs that intentionally break compat with godot-cpp,
# until both the upstream PR and the matching godot-cpp changes are merged.
godot-cpp-test: true
- bin: "./bin/godot.linuxbsd.double.tools.x86_64.san"
+ bin: "./bin/godot.linuxbsd.editor.dev.double.x86_64.san"
build-mono: false
# Skip 2GiB artifact speeding up action.
artifact: false
- - name: Editor with clang sanitizers (target=debug, tools=yes, use_asan=yes, use_ubsan=yes, use_llvm=yes, linker=lld)
+ - name: Editor with clang sanitizers (target=editor, tests=yes, dev_build=yes, use_asan=yes, use_ubsan=yes, use_llvm=yes, linker=lld)
cache-name: linux-editor-llvm-sanitizers
- target: debug
- tools: true
+ target: editor
tests: true
- sconsflags: use_asan=yes use_ubsan=yes use_llvm=yes linker=lld
- bin: "./bin/godot.linuxbsd.tools.x86_64.llvm.san"
+ sconsflags: dev_build=yes use_asan=yes use_ubsan=yes use_llvm=yes linker=lld
+ bin: "./bin/godot.linuxbsd.editor.dev.x86_64.llvm.san"
build-mono: false
# Skip 2GiB artifact speeding up action.
artifact: false
- - name: Template w/ Mono (target=release, tools=no)
+ - name: Template w/ Mono (target=template_release)
cache-name: linux-template-mono
- target: release
- tools: false
+ target: template_release
tests: false
- sconsflags: module_mono_enabled=yes debug_symbols=no
+ sconsflags: module_mono_enabled=yes
build-mono: false
artifact: true
- - name: Minimal Template (target=release, tools=no, everything disabled)
+ - name: Minimal template (target=template_release, everything disabled)
cache-name: linux-template-minimal
- target: release
- tools: false
+ target: template_release
tests: false
sconsflags: modules_enabled_by_default=no disable_3d=yes disable_advanced_gui=yes deprecated=no minizip=no
artifact: true
@@ -113,7 +108,6 @@ jobs:
sconsflags: ${{ env.SCONSFLAGS }} ${{ matrix.sconsflags }}
platform: linuxbsd
target: ${{ matrix.target }}
- tools: ${{ matrix.tools }}
tests: ${{ matrix.tests }}
- name: Generate C# glue
@@ -221,7 +215,7 @@ jobs:
if: ${{ matrix.godot-cpp-test }}
run: |
cd godot-cpp/test
- scons target=${{ matrix.target }}
+ scons target=debug
cd ../..
- name: Prepare artifact
diff --git a/.github/workflows/macos_builds.yml b/.github/workflows/macos_builds.yml
index be1fb8de85..dd3db3270b 100644
--- a/.github/workflows/macos_builds.yml
+++ b/.github/workflows/macos_builds.yml
@@ -19,17 +19,15 @@ jobs:
fail-fast: false
matrix:
include:
- - name: Editor (target=release_debug, tools=yes, tests=yes)
+ - name: Editor (target=editor, tests=yes)
cache-name: macos-editor
- target: release_debug
- tools: true
+ target: editor
tests: true
- bin: "./bin/godot.macos.opt.tools.x86_64"
+ bin: "./bin/godot.macos.editor.x86_64"
- - name: Template (target=release, tools=no)
+ - name: Template (target=template_release)
cache-name: macos-template
- target: release
- tools: false
+ target: template_release
tests: false
sconsflags: debug_symbols=no
@@ -55,7 +53,6 @@ jobs:
sconsflags: ${{ env.SCONSFLAGS }}
platform: macos
target: ${{ matrix.target }}
- tools: ${{ matrix.tools }}
tests: ${{ matrix.tests }}
# Execute unit tests for the editor
diff --git a/.github/workflows/static_checks.yml b/.github/workflows/static_checks.yml
index 5b4de06e9e..d8951ddb78 100644
--- a/.github/workflows/static_checks.yml
+++ b/.github/workflows/static_checks.yml
@@ -27,7 +27,7 @@ jobs:
sudo apt-get install -qq dos2unix recode clang-format-13 libxml2-utils python3-pip moreutils
sudo update-alternatives --remove-all clang-format || true
sudo update-alternatives --install /usr/bin/clang-format clang-format /usr/bin/clang-format-13 100
- sudo pip3 install black==22.3.0 pygments pytest
+ sudo pip3 install black==22.3.0 pygments pytest==7.1.2 mypy==0.971
- name: File formatting checks (file_format.sh)
run: |
@@ -41,6 +41,10 @@ jobs:
run: |
bash ./misc/scripts/black_format.sh
+ - name: Python scripts static analysis (mypy_check.sh)
+ run: |
+ bash ./misc/scripts/mypy_check.sh
+
- name: Python builders checks via pytest (pytest_builders.sh)
run: |
bash ./misc/scripts/pytest_builders.sh
diff --git a/.github/workflows/web_builds.yml b/.github/workflows/web_builds.yml
index deee91938d..f684b838e1 100644
--- a/.github/workflows/web_builds.yml
+++ b/.github/workflows/web_builds.yml
@@ -16,7 +16,7 @@ concurrency:
jobs:
web-template:
runs-on: "ubuntu-20.04"
- name: Template (target=release, tools=no)
+ name: Template (target=template_release)
steps:
- uses: actions/checkout@v3
@@ -43,8 +43,7 @@ jobs:
with:
sconsflags: ${{ env.SCONSFLAGS }}
platform: web
- target: release
- tools: false
+ target: template_release
tests: false
- name: Upload artifact
diff --git a/.github/workflows/windows_builds.yml b/.github/workflows/windows_builds.yml
index 9033e1ab1d..b35c811763 100644
--- a/.github/workflows/windows_builds.yml
+++ b/.github/workflows/windows_builds.yml
@@ -22,19 +22,17 @@ jobs:
fail-fast: false
matrix:
include:
- - name: Editor (target=release_debug, tools=yes, tests=yes)
+ - name: Editor (target=editor, tests=yes)
cache-name: windows-editor
- target: release_debug
- tools: true
+ target: editor
tests: true
# Skip debug symbols, they're way too big with MSVC.
sconsflags: debug_symbols=no
- bin: "./bin/godot.windows.opt.tools.x86_64.exe"
+ bin: "./bin/godot.windows.editor.x86_64.exe"
- - name: Template (target=release, tools=no)
+ - name: Template (target=template_release, tools=no)
cache-name: windows-template
- target: release
- tools: false
+ target: template_release
tests: false
sconsflags: debug_symbols=no
@@ -57,7 +55,6 @@ jobs:
sconsflags: ${{ env.SCONSFLAGS }} ${{ matrix.sconsflags }}
platform: windows
target: ${{ matrix.target }}
- tools: ${{ matrix.tools }}
tests: ${{ matrix.tests }}
# Execute unit tests for the editor
diff --git a/SConstruct b/SConstruct
index b64e0bddd8..c86422c4e4 100644
--- a/SConstruct
+++ b/SConstruct
@@ -57,7 +57,7 @@ import glsl_builders
import gles3_builders
from platform_methods import architectures, architecture_aliases
-if methods.get_cmdline_bool("tools", True):
+if ARGUMENTS.get("target", "editor") == "editor":
_helper_module("editor.editor_builders", "editor/editor_builders.py")
_helper_module("editor.template_builders", "editor/template_builders.py")
@@ -164,27 +164,33 @@ opts = Variables(customs, ARGUMENTS)
# Target build options
opts.Add("platform", "Target platform (%s)" % ("|".join(platform_list),), "")
opts.Add("p", "Platform (alias for 'platform')", "")
-opts.Add(BoolVariable("tools", "Build the tools (a.k.a. the Godot editor)", True))
-opts.Add(EnumVariable("target", "Compilation target", "debug", ("debug", "release_debug", "release")))
+opts.Add(EnumVariable("target", "Compilation target", "editor", ("editor", "template_release", "template_debug")))
opts.Add(EnumVariable("arch", "CPU architecture", "auto", ["auto"] + architectures, architecture_aliases))
-opts.Add(EnumVariable("float", "Floating-point precision", "32", ("32", "64")))
-opts.Add(EnumVariable("optimize", "Optimization type", "speed", ("speed", "size", "none")))
+opts.Add(BoolVariable("dev_build", "Developer build with dev-only debugging code (DEV_ENABLED)", False))
+opts.Add(
+ EnumVariable(
+ "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("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))
-opts.Add(EnumVariable("lto", "Link-time optimization (for production buids)", "none", ("none", "auto", "thin", "full")))
# Components
opts.Add(BoolVariable("deprecated", "Enable compatibility code for deprecated and removed features", True))
+opts.Add(EnumVariable("float", "Floating-point precision", "32", ("32", "64")))
opts.Add(BoolVariable("minizip", "Enable ZIP archive support using minizip", True))
opts.Add(BoolVariable("xaudio2", "Enable the XAudio2 audio driver", False))
opts.Add(BoolVariable("vulkan", "Enable the vulkan video driver", True))
opts.Add(BoolVariable("opengl3", "Enable the OpenGL/GLES3 video driver", True))
opts.Add(BoolVariable("openxr", "Enable the OpenXR driver", True))
+opts.Add(BoolVariable("use_volk", "Use the volk library to load the Vulkan loader dynamically", True))
opts.Add("custom_modules", "A list of comma-separated directory paths containing custom modules to build.", "")
opts.Add(BoolVariable("custom_modules_recursive", "Detect custom modules recursively for each specified path.", True))
-opts.Add(BoolVariable("use_volk", "Use the volk library to load the Vulkan loader dynamically", True))
# Advanced options
-opts.Add(BoolVariable("dev", "If yes, alias for verbose=yes warnings=extra werror=yes", False))
+opts.Add(BoolVariable("dev_mode", "Alias for dev options: verbose=yes warnings=extra werror=yes tests=yes", False))
opts.Add(BoolVariable("tests", "Build the unit tests", False))
opts.Add(BoolVariable("fast_unsafe", "Enable unsafe options for faster rebuilds", False))
opts.Add(BoolVariable("compiledb", "Generate compilation DB (`compile_commands.json`) for external tools", False))
@@ -376,13 +382,36 @@ env_base.Prepend(CPPPATH=["#"])
env_base.platform_exporters = platform_exporters
env_base.platform_apis = platform_apis
-# Build type defines - more platform-specific ones can be in detect.py.
-if env_base["target"] == "release_debug" or env_base["target"] == "debug":
+# Configuration of build targets:
+# - Editor or template
+# - Debug features (DEBUG_ENABLED code)
+# - Dev only code (DEV_ENABLED code)
+# - Optimization level
+# - Debug symbols for crash traces / debuggers
+
+env_base.editor_build = env_base["target"] == "editor"
+env_base.dev_build = env_base["dev_build"]
+env_base.debug_features = env_base["target"] in ["editor", "template_debug"]
+
+if env_base.dev_build:
+ opt_level = "none"
+elif env_base.debug_features:
+ opt_level = "speed_trace"
+else: # Release
+ opt_level = "speed"
+
+env_base["optimize"] = ARGUMENTS.get("optimize", opt_level)
+env_base["debug_symbols"] = methods.get_cmdline_bool("debug_symbols", env_base.dev_build)
+
+if env_base.editor_build:
+ env_base.Append(CPPDEFINES=["TOOLS_ENABLED"])
+
+if env_base.debug_features:
# DEBUG_ENABLED enables debugging *features* and debug-only code, which is intended
# to give *users* extra debugging information for their game development.
env_base.Append(CPPDEFINES=["DEBUG_ENABLED"])
-if env_base["target"] == "debug":
+if env_base.dev_build:
# DEV_ENABLED enables *engine developer* code which should only be compiled for those
# working on the engine itself.
env_base.Append(CPPDEFINES=["DEV_ENABLED"])
@@ -395,7 +424,7 @@ else:
# Unsafe as they reduce the certainty of rebuilding all changed files, so it's
# enabled by default for `debug` builds, and can be overridden from command line.
# Ref: https://github.com/SCons/scons/wiki/GoFastButton
-if methods.get_cmdline_bool("fast_unsafe", env_base["target"] == "debug"):
+if methods.get_cmdline_bool("fast_unsafe", env_base.dev_build):
# Renamed to `content-timestamp` in SCons >= 4.2, keeping MD5 for compat.
env_base.Decider("MD5-timestamp")
env_base.SetOption("implicit_cache", 1)
@@ -470,32 +499,64 @@ if selected_platform in platform_list:
if not (f[0] in ARGUMENTS) or ARGUMENTS[f[0]] == "auto": # Allow command line to override platform flags
env[f[0]] = f[1]
- # 'dev' and 'production' are aliases to set default options if they haven't been
+ # 'dev_mode' and 'production' are aliases to set default options if they haven't been
# set manually by the user.
# These need to be checked *after* platform specific flags so that different
# default values can be set (e.g. to keep LTO off for `production` on some platforms).
- if env["dev"]:
+ if env["dev_mode"]:
env["verbose"] = methods.get_cmdline_bool("verbose", True)
env["warnings"] = ARGUMENTS.get("warnings", "extra")
env["werror"] = methods.get_cmdline_bool("werror", True)
- if env["tools"]:
- env["tests"] = methods.get_cmdline_bool("tests", True)
+ env["tests"] = methods.get_cmdline_bool("tests", True)
if env["production"]:
env["use_static_cpp"] = methods.get_cmdline_bool("use_static_cpp", True)
env["debug_symbols"] = methods.get_cmdline_bool("debug_symbols", False)
# LTO "auto" means we handle the preferred option in each platform detect.py.
env["lto"] = ARGUMENTS.get("lto", "auto")
- if not env["tools"] and env["target"] == "debug":
- print(
- "WARNING: Requested `production` build with `tools=no target=debug`, "
- "this will give you a full debug template (use `target=release_debug` "
- "for an optimized template with debug features)."
- )
# Must happen after the flags' definition, as configure is when most flags
# are actually handled to change compile options, etc.
detect.configure(env)
+ print(f'Building for platform "{selected_platform}", architecture "{env["arch"]}", target "{env["target"]}.')
+ if env.dev_build:
+ print("NOTE: Developer build, with debug optimization level and debug symbols (unless overridden).")
+
+ # Set optimize and debug_symbols flags.
+ # "custom" means do nothing and let users set their own optimization flags.
+ # Needs to happen after configure to have `env.msvc` defined.
+ if env.msvc:
+ if env["debug_symbols"]:
+ env.Append(CCFLAGS=["/Zi", "/FS"])
+ env.Append(LINKFLAGS=["/DEBUG:FULL"])
+
+ if env["optimize"] == "speed" or env["optimize"] == "speed_trace":
+ env.Append(CCFLAGS=["/O2"])
+ env.Append(LINKFLAGS=["/OPT:REF"])
+ elif env["optimize"] == "size":
+ env.Append(CCFLAGS=["/O1"])
+ env.Append(LINKFLAGS=["/OPT:REF"])
+ elif env["optimize"] == "debug" or env["optimize"] == "none":
+ env.Append(CCFLAGS=["/Od"])
+ else:
+ if env["debug_symbols"]:
+ if env.dev_build:
+ env.Append(CCFLAGS=["-g3"])
+ else:
+ env.Append(CCFLAGS=["-g2"])
+
+ if env["optimize"] == "speed":
+ env.Append(CCFLAGS=["-O3"])
+ # `-O2` is friendlier to debuggers than `-O3`, leading to better crash backtraces.
+ elif env["optimize"] == "speed_trace":
+ env.Append(CCFLAGS=["-O2"])
+ elif env["optimize"] == "size":
+ env.Append(CCFLAGS=["-Os"])
+ elif env["optimize"] == "debug":
+ env.Append(CCFLAGS=["-Og"])
+ elif env["optimize"] == "none":
+ env.Append(CCFLAGS=["-O0"])
+
# Needs to happen after configure to handle "auto".
if env["lto"] != "none":
print("Using LTO: " + env["lto"])
@@ -514,11 +575,6 @@ if selected_platform in platform_list:
# We apply it to CCFLAGS (both C and C++ code) in case it impacts C features.
env.Prepend(CCFLAGS=["/std:c++17"])
- print(
- 'Building for platform "%s", architecture "%s", %s, target "%s".'
- % (selected_platform, env["arch"], "editor" if env["tools"] else "template", env["target"])
- )
-
# Enforce our minimal compiler version requirements
cc_version = methods.get_compiler_version(env) or {
"major": None,
@@ -663,32 +719,13 @@ if selected_platform in platform_list:
else:
suffix = "." + selected_platform
+ suffix += "." + env["target"]
+ if env.dev_build:
+ suffix += ".dev"
+
if env_base["float"] == "64":
suffix += ".double"
- if env["target"] == "release":
- if env["tools"]:
- print("ERROR: The editor can only be built with `target=debug` or `target=release_debug`.")
- print(" Use `tools=no target=release` to build a release export template.")
- Exit(255)
- suffix += ".opt"
- elif env["target"] == "release_debug":
- if env["tools"]:
- suffix += ".opt.tools"
- else:
- suffix += ".opt.debug"
- else:
- if env["tools"]:
- print(
- "Note: Building a debug binary (which will run slowly). Use `target=release_debug` to build an optimized release binary."
- )
- suffix += ".tools"
- else:
- print(
- "Note: Building a debug binary (which will run slowly). Use `target=release` to build an optimized release binary."
- )
- suffix += ".debug"
-
suffix += "." + env["arch"]
suffix += env.extra_suffix
@@ -753,9 +790,6 @@ if selected_platform in platform_list:
env["LIBSUFFIX"] = suffix + env["LIBSUFFIX"]
env["SHLIBSUFFIX"] = suffix + env["SHLIBSUFFIX"]
- if env["tools"]:
- env.Append(CPPDEFINES=["TOOLS_ENABLED"])
-
disabled_classes = []
if env["build_feature_profile"] != "":
@@ -777,19 +811,16 @@ if selected_platform in platform_list:
methods.write_disabled_classes(disabled_classes)
if env["disable_3d"]:
- if env["tools"]:
- print(
- "Build option 'disable_3d=yes' cannot be used with 'tools=yes' (editor), "
- "only with 'tools=no' (export template)."
- )
+ if env.editor_build:
+ print("Build option 'disable_3d=yes' cannot be used for editor builds, but only for export templates.")
Exit(255)
else:
env.Append(CPPDEFINES=["_3D_DISABLED"])
if env["disable_advanced_gui"]:
- if env["tools"]:
+ if env.editor_build:
print(
- "Build option 'disable_advanced_gui=yes' cannot be used with 'tools=yes' (editor), "
- "only with 'tools=no' (export template)."
+ "Build option 'disable_advanced_gui=yes' cannot be used for editor builds, "
+ "but only for export templates."
)
Exit(255)
else:
@@ -847,7 +878,7 @@ if selected_platform in platform_list:
SConscript("core/SCsub")
SConscript("servers/SCsub")
SConscript("scene/SCsub")
- if env["tools"]:
+ if env.editor_build:
SConscript("editor/SCsub")
SConscript("drivers/SCsub")
diff --git a/core/SCsub b/core/SCsub
index d4462fa546..43deff3ad5 100644
--- a/core/SCsub
+++ b/core/SCsub
@@ -85,7 +85,7 @@ if env["builtin_zlib"]:
env_thirdparty.Prepend(CPPPATH=[thirdparty_zlib_dir])
# Needs to be available in main env too
env.Prepend(CPPPATH=[thirdparty_zlib_dir])
- if env["target"] == "debug":
+ if env.dev_build:
env_thirdparty.Append(CPPDEFINES=["ZLIB_DEBUG"])
env_thirdparty.add_source_files(thirdparty_obj, thirdparty_zlib_sources)
diff --git a/core/core_builders.py b/core/core_builders.py
index b07daa80ae..b0a3b85d58 100644
--- a/core/core_builders.py
+++ b/core/core_builders.py
@@ -2,6 +2,7 @@
All such functions are invoked in a subprocess on Windows to prevent build flakiness.
"""
+import zlib
from platform_methods import subprocess_main
@@ -33,7 +34,6 @@ def make_certs_header(target, source, env):
g = open(dst, "w", encoding="utf-8")
buf = f.read()
decomp_size = len(buf)
- import zlib
# Use maximum zlib compression level to further reduce file size
# (at the cost of initial build times).
@@ -208,7 +208,7 @@ def make_license_header(target, source, env):
from collections import OrderedDict
- projects = OrderedDict()
+ projects: dict = OrderedDict()
license_list = []
with open(src_copyright, "r", encoding="utf-8") as copyright_file:
@@ -230,7 +230,7 @@ def make_license_header(target, source, env):
part = {}
reader.next_line()
- data_list = []
+ data_list: list = []
for project in iter(projects.values()):
for part in project:
part["file_index"] = len(data_list)
diff --git a/core/extension/gdnative_interface.cpp b/core/extension/gdnative_interface.cpp
index 67dc55bdb7..193fcb8916 100644
--- a/core/extension/gdnative_interface.cpp
+++ b/core/extension/gdnative_interface.cpp
@@ -559,7 +559,7 @@ static void gdnative_string_new_with_utf32_chars(GDNativeStringPtr r_dest, const
static void gdnative_string_new_with_wide_chars(GDNativeStringPtr r_dest, const wchar_t *p_contents) {
String *dest = (String *)r_dest;
- if (sizeof(wchar_t) == 2) {
+ if constexpr (sizeof(wchar_t) == 2) {
// wchar_t is 16 bit, parse.
memnew_placement(dest, String);
dest->parse_utf16((const char16_t *)p_contents);
@@ -596,7 +596,7 @@ static void gdnative_string_new_with_utf32_chars_and_len(GDNativeStringPtr r_des
static void gdnative_string_new_with_wide_chars_and_len(GDNativeStringPtr r_dest, const wchar_t *p_contents, const GDNativeInt p_size) {
String *dest = (String *)r_dest;
- if (sizeof(wchar_t) == 2) {
+ if constexpr (sizeof(wchar_t) == 2) {
// wchar_t is 16 bit, parse.
memnew_placement(dest, String);
dest->parse_utf16((const char16_t *)p_contents, p_size);
@@ -655,7 +655,7 @@ static GDNativeInt gdnative_string_to_utf32_chars(const GDNativeStringPtr p_self
return len;
}
static GDNativeInt gdnative_string_to_wide_chars(const GDNativeStringPtr p_self, wchar_t *r_text, GDNativeInt p_max_write_length) {
- if (sizeof(wchar_t) == 4) {
+ if constexpr (sizeof(wchar_t) == 4) {
return gdnative_string_to_utf32_chars(p_self, (char32_t *)r_text, p_max_write_length);
} else {
return gdnative_string_to_utf16_chars(p_self, (char16_t *)r_text, p_max_write_length);
diff --git a/core/input/input_builders.py b/core/input/input_builders.py
index 16f125ff38..a7729c9af2 100644
--- a/core/input/input_builders.py
+++ b/core/input/input_builders.py
@@ -16,7 +16,7 @@ def make_default_controller_mappings(target, source, env):
g.write('#include "core/input/default_controller_mappings.h"\n')
# ensure mappings have a consistent order
- platform_mappings = OrderedDict()
+ platform_mappings: dict = OrderedDict()
for src_path in source:
with open(src_path, "r") as f:
# read mapping file and skip header
diff --git a/core/io/file_access.cpp b/core/io/file_access.cpp
index 499f083f51..cb25564342 100644
--- a/core/io/file_access.cpp
+++ b/core/io/file_access.cpp
@@ -548,7 +548,7 @@ void FileAccess::store_64(uint64_t p_dest) {
}
void FileAccess::store_real(real_t p_real) {
- if (sizeof(real_t) == 4) {
+ if constexpr (sizeof(real_t) == 4) {
store_float(p_real);
} else {
store_double(p_real);
diff --git a/core/io/image.cpp b/core/io/image.cpp
index 812bfa8263..56c05bf042 100644
--- a/core/io/image.cpp
+++ b/core/io/image.cpp
@@ -444,7 +444,7 @@ static void _convert(int p_width, int p_height, const uint8_t *p_src, uint8_t *p
uint8_t rgba[4] = { 0, 0, 0, 255 };
- if (read_gray) {
+ if constexpr (read_gray) {
rgba[0] = rofs[0];
rgba[1] = rofs[0];
rgba[2] = rofs[0];
@@ -454,11 +454,11 @@ static void _convert(int p_width, int p_height, const uint8_t *p_src, uint8_t *p
}
}
- if (read_alpha || write_alpha) {
+ if constexpr (read_alpha || write_alpha) {
rgba[3] = read_alpha ? rofs[read_bytes] : 255;
}
- if (write_gray) {
+ if constexpr (write_gray) {
//TODO: not correct grayscale, should use fixed point version of actual weights
wofs[0] = uint8_t((uint16_t(rgba[0]) + uint16_t(rgba[1]) + uint16_t(rgba[2])) / 3);
} else {
@@ -467,7 +467,7 @@ static void _convert(int p_width, int p_height, const uint8_t *p_src, uint8_t *p
}
}
- if (write_alpha) {
+ if constexpr (write_alpha) {
wofs[write_bytes] = rgba[3];
}
}
@@ -640,7 +640,7 @@ static void _scale_cubic(const uint8_t *__restrict p_src, uint8_t *__restrict p_
double xfac = (double)width / p_dst_width;
double yfac = (double)height / p_dst_height;
// coordinates of source points and coefficients
- double ox, oy, dx, dy, k1, k2;
+ double ox, oy, dx, dy;
int ox1, oy1, ox2, oy2;
// destination pixel values
// width and height decreased by 1
@@ -671,7 +671,7 @@ static void _scale_cubic(const uint8_t *__restrict p_src, uint8_t *__restrict p_
for (int n = -1; n < 3; n++) {
// get Y coefficient
- k1 = _bicubic_interp_kernel(dy - (double)n);
+ [[maybe_unused]] double k1 = _bicubic_interp_kernel(dy - (double)n);
oy2 = oy1 + n;
if (oy2 < 0) {
@@ -683,7 +683,7 @@ static void _scale_cubic(const uint8_t *__restrict p_src, uint8_t *__restrict p_
for (int m = -1; m < 3; m++) {
// get X coefficient
- k2 = k1 * _bicubic_interp_kernel((double)m - dx);
+ [[maybe_unused]] double k2 = k1 * _bicubic_interp_kernel((double)m - dx);
ox2 = ox1 + m;
if (ox2 < 0) {
@@ -697,7 +697,7 @@ static void _scale_cubic(const uint8_t *__restrict p_src, uint8_t *__restrict p_
const T *__restrict p = ((T *)p_src) + (oy2 * p_src_width + ox2) * CC;
for (int i = 0; i < CC; i++) {
- if (sizeof(T) == 2) { //half float
+ if constexpr (sizeof(T) == 2) { //half float
color[i] = Math::half_to_float(p[i]);
} else {
color[i] += p[i] * k2;
@@ -707,9 +707,9 @@ static void _scale_cubic(const uint8_t *__restrict p_src, uint8_t *__restrict p_
}
for (int i = 0; i < CC; i++) {
- if (sizeof(T) == 1) { //byte
+ if constexpr (sizeof(T) == 1) { //byte
dst[i] = CLAMP(Math::fast_ftoi(color[i]), 0, 255);
- } else if (sizeof(T) == 2) { //half float
+ } else if constexpr (sizeof(T) == 2) { //half float
dst[i] = Math::make_half_float(color[i]);
} else {
dst[i] = color[i];
@@ -758,7 +758,7 @@ static void _scale_bilinear(const uint8_t *__restrict p_src, uint8_t *__restrict
src_xofs_right *= CC;
for (uint32_t l = 0; l < CC; l++) {
- if (sizeof(T) == 1) { //uint8
+ if constexpr (sizeof(T) == 1) { //uint8
uint32_t p00 = p_src[y_ofs_up + src_xofs_left + l] << FRAC_BITS;
uint32_t p10 = p_src[y_ofs_up + src_xofs_right + l] << FRAC_BITS;
uint32_t p01 = p_src[y_ofs_down + src_xofs_left + l] << FRAC_BITS;
@@ -769,7 +769,7 @@ static void _scale_bilinear(const uint8_t *__restrict p_src, uint8_t *__restrict
uint32_t interp = interp_up + (((interp_down - interp_up) * src_yofs_frac) >> FRAC_BITS);
interp >>= FRAC_BITS;
p_dst[i * p_dst_width * CC + j * CC + l] = uint8_t(interp);
- } else if (sizeof(T) == 2) { //half float
+ } else if constexpr (sizeof(T) == 2) { //half float
float xofs_frac = float(src_xofs_frac) / (1 << FRAC_BITS);
float yofs_frac = float(src_yofs_frac) / (1 << FRAC_BITS);
@@ -786,7 +786,7 @@ static void _scale_bilinear(const uint8_t *__restrict p_src, uint8_t *__restrict
float interp = interp_up + ((interp_down - interp_up) * yofs_frac);
dst[i * p_dst_width * CC + j * CC + l] = Math::make_half_float(interp);
- } else if (sizeof(T) == 4) { //float
+ } else if constexpr (sizeof(T) == 4) { //float
float xofs_frac = float(src_xofs_frac) / (1 << FRAC_BITS);
float yofs_frac = float(src_yofs_frac) / (1 << FRAC_BITS);
@@ -877,7 +877,7 @@ static void _scale_lanczos(const uint8_t *__restrict p_src, uint8_t *__restrict
const T *__restrict src_data = ((const T *)p_src) + (buffer_y * src_width + target_x) * CC;
for (uint32_t i = 0; i < CC; i++) {
- if (sizeof(T) == 2) { //half float
+ if constexpr (sizeof(T) == 2) { //half float
pixel[i] += Math::half_to_float(src_data[i]) * lanczos_val;
} else {
pixel[i] += src_data[i] * lanczos_val;
@@ -934,9 +934,9 @@ static void _scale_lanczos(const uint8_t *__restrict p_src, uint8_t *__restrict
for (uint32_t i = 0; i < CC; i++) {
pixel[i] /= weight;
- if (sizeof(T) == 1) { //byte
+ if constexpr (sizeof(T) == 1) { //byte
dst_data[i] = CLAMP(Math::fast_ftoi(pixel[i]), 0, 255);
- } else if (sizeof(T) == 2) { //half float
+ } else if constexpr (sizeof(T) == 2) { //half float
dst_data[i] = Math::make_half_float(pixel[i]);
} else { // float
dst_data[i] = pixel[i];
diff --git a/core/io/resource_format_binary.cpp b/core/io/resource_format_binary.cpp
index 06649aba5b..36fa77626e 100644
--- a/core/io/resource_format_binary.cpp
+++ b/core/io/resource_format_binary.cpp
@@ -107,7 +107,7 @@ void ResourceLoaderBinary::_advance_padding(uint32_t p_len) {
static Error read_reals(real_t *dst, Ref<FileAccess> &f, size_t count) {
if (f->real_is_double) {
- if (sizeof(real_t) == 8) {
+ if constexpr (sizeof(real_t) == 8) {
// Ideal case with double-precision
f->get_buffer((uint8_t *)dst, count * sizeof(double));
#ifdef BIG_ENDIAN_ENABLED
@@ -118,7 +118,7 @@ static Error read_reals(real_t *dst, Ref<FileAccess> &f, size_t count) {
}
}
#endif
- } else if (sizeof(real_t) == 4) {
+ } else if constexpr (sizeof(real_t) == 4) {
// May be slower, but this is for compatibility. Eventually the data should be converted.
for (size_t i = 0; i < count; ++i) {
dst[i] = f->get_double();
@@ -127,7 +127,7 @@ static Error read_reals(real_t *dst, Ref<FileAccess> &f, size_t count) {
ERR_FAIL_V_MSG(ERR_UNAVAILABLE, "real_t size is neither 4 nor 8!");
}
} else {
- if (sizeof(real_t) == 4) {
+ if constexpr (sizeof(real_t) == 4) {
// Ideal case with float-precision
f->get_buffer((uint8_t *)dst, count * sizeof(float));
#ifdef BIG_ENDIAN_ENABLED
@@ -138,7 +138,7 @@ static Error read_reals(real_t *dst, Ref<FileAccess> &f, size_t count) {
}
}
#endif
- } else if (sizeof(real_t) == 8) {
+ } else if constexpr (sizeof(real_t) == 8) {
for (size_t i = 0; i < count; ++i) {
dst[i] = f->get_float();
}
diff --git a/core/io/resource_uid.cpp b/core/io/resource_uid.cpp
index 5324c5dd84..ed5ce3b911 100644
--- a/core/io/resource_uid.cpp
+++ b/core/io/resource_uid.cpp
@@ -113,7 +113,12 @@ void ResourceUID::set_id(ID p_id, const String &p_path) {
MutexLock l(mutex);
ERR_FAIL_COND(!unique_ids.has(p_id));
CharString cs = p_path.utf8();
- if (strcmp(cs.ptr(), unique_ids[p_id].cs.ptr()) != 0) {
+ const char *update_ptr = cs.ptr();
+ const char *cached_ptr = unique_ids[p_id].cs.ptr();
+ if (update_ptr == nullptr && cached_ptr == nullptr) {
+ return; // Both are empty strings.
+ }
+ if ((update_ptr == nullptr) != (cached_ptr == nullptr) || strcmp(update_ptr, cached_ptr) != 0) {
unique_ids[p_id].cs = cs;
unique_ids[p_id].saved_to_cache = false; //changed
changed = true;
diff --git a/core/math/bvh_split.inc b/core/math/bvh_split.inc
index ff07166d4a..180bbfb511 100644
--- a/core/math/bvh_split.inc
+++ b/core/math/bvh_split.inc
@@ -13,7 +13,7 @@ void _split_inform_references(uint32_t p_node_id) {
void _split_leaf_sort_groups_simple(int &num_a, int &num_b, uint16_t *group_a, uint16_t *group_b, const BVHABB_CLASS *temp_bounds, const BVHABB_CLASS full_bound) {
// special case for low leaf sizes .. should static compile out
- if (MAX_ITEMS < 4) {
+ if constexpr (MAX_ITEMS < 4) {
uint32_t ind = group_a[0];
// add to b
@@ -34,7 +34,7 @@ void _split_leaf_sort_groups_simple(int &num_a, int &num_b, uint16_t *group_a, u
order[POINT::AXIS_COUNT - 1] = size.max_axis_index();
static_assert(POINT::AXIS_COUNT <= 3, "BVH POINT::AXIS_COUNT has unexpected size");
- if (POINT::AXIS_COUNT == 3) {
+ if constexpr (POINT::AXIS_COUNT == 3) {
order[1] = 3 - (order[0] + order[2]);
}
diff --git a/core/object/worker_thread_pool.cpp b/core/object/worker_thread_pool.cpp
index c770515b9e..9b3dc6833e 100644
--- a/core/object/worker_thread_pool.cpp
+++ b/core/object/worker_thread_pool.cpp
@@ -395,7 +395,7 @@ void WorkerThreadPool::wait_for_group_task_completion(GroupID p_group) {
uint32_t finished_users = group->finished.increment(); // fetch happens before inc, so increment later.
if (finished_users == max_users) {
- // All tasks using this group are gone (finished before the group), so clear the gorup too.
+ // All tasks using this group are gone (finished before the group), so clear the group too.
task_mutex.lock();
group_allocator.free(group);
task_mutex.unlock();
diff --git a/core/templates/local_vector.h b/core/templates/local_vector.h
index 49690f2373..dc93acc8ab 100644
--- a/core/templates/local_vector.h
+++ b/core/templates/local_vector.h
@@ -68,7 +68,7 @@ public:
CRASH_COND_MSG(!data, "Out of memory");
}
- if (!std::is_trivially_constructible<T>::value && !force_trivial) {
+ if constexpr (!std::is_trivially_constructible<T>::value && !force_trivial) {
memnew_placement(&data[count++], T(p_elem));
} else {
data[count++] = p_elem;
@@ -81,7 +81,7 @@ public:
for (U i = p_index; i < count; i++) {
data[i] = data[i + 1];
}
- if (!std::is_trivially_destructible<T>::value && !force_trivial) {
+ if constexpr (!std::is_trivially_destructible<T>::value && !force_trivial) {
data[count].~T();
}
}
@@ -94,7 +94,7 @@ public:
if (count > p_index) {
data[p_index] = data[count];
}
- if (!std::is_trivially_destructible<T>::value && !force_trivial) {
+ if constexpr (!std::is_trivially_destructible<T>::value && !force_trivial) {
data[count].~T();
}
}
@@ -135,7 +135,7 @@ public:
_FORCE_INLINE_ U size() const { return count; }
void resize(U p_size) {
if (p_size < count) {
- if (!std::is_trivially_destructible<T>::value && !force_trivial) {
+ if constexpr (!std::is_trivially_destructible<T>::value && !force_trivial) {
for (U i = p_size; i < count; i++) {
data[i].~T();
}
@@ -152,7 +152,7 @@ public:
data = (T *)memrealloc(data, capacity * sizeof(T));
CRASH_COND_MSG(!data, "Out of memory");
}
- if (!std::is_trivially_constructible<T>::value && !force_trivial) {
+ if constexpr (!std::is_trivially_constructible<T>::value && !force_trivial) {
for (U i = count; i < p_size; i++) {
memnew_placement(&data[i], T);
}
diff --git a/core/templates/pooled_list.h b/core/templates/pooled_list.h
index 08f53572e7..2b67da87ba 100644
--- a/core/templates/pooled_list.h
+++ b/core/templates/pooled_list.h
@@ -112,7 +112,7 @@ public:
list.resize(r_id + 1);
static_assert((!zero_on_first_request) || (__is_pod(T)), "zero_on_first_request requires trivial type");
- if (zero_on_first_request && __is_pod(T)) {
+ if constexpr (zero_on_first_request && __is_pod(T)) {
list[r_id] = {};
}
diff --git a/core/variant/type_info.h b/core/variant/type_info.h
index 7372c60754..e355053296 100644
--- a/core/variant/type_info.h
+++ b/core/variant/type_info.h
@@ -276,7 +276,7 @@ inline String enum_qualified_name_to_class_info_name(const String &p_qualified_n
template <typename T>
inline StringName __constant_get_enum_name(T param, const String &p_constant) {
- if (GetTypeInfo<T>::VARIANT_TYPE == Variant::NIL) {
+ if constexpr (GetTypeInfo<T>::VARIANT_TYPE == Variant::NIL) {
ERR_PRINT("Missing VARIANT_ENUM_CAST for constant's enum: " + p_constant);
}
return GetTypeInfo<T>::get_class_info().class_name;
@@ -284,14 +284,14 @@ inline StringName __constant_get_enum_name(T param, const String &p_constant) {
template <class T>
class BitField {
- uint32_t value = 0;
+ int64_t value = 0;
public:
_FORCE_INLINE_ void set_flag(T p_flag) { value |= p_flag; }
_FORCE_INLINE_ bool has_flag(T p_flag) const { return value & p_flag; }
_FORCE_INLINE_ void clear_flag(T p_flag) { return value &= ~p_flag; }
- _FORCE_INLINE_ BitField(uint32_t p_value) { value = p_value; }
- _FORCE_INLINE_ operator uint32_t() const { return value; }
+ _FORCE_INLINE_ BitField(int64_t p_value) { value = p_value; }
+ _FORCE_INLINE_ operator int64_t() const { return value; }
_FORCE_INLINE_ operator Variant() const { return value; }
};
diff --git a/doc/classes/AnimationLibrary.xml b/doc/classes/AnimationLibrary.xml
index 75fe393dbb..769b338063 100644
--- a/doc/classes/AnimationLibrary.xml
+++ b/doc/classes/AnimationLibrary.xml
@@ -15,7 +15,7 @@
<param index="0" name="name" type="StringName" />
<param index="1" name="animation" type="Animation" />
<description>
- Adds the [param animation] to the library, accesible by the key [param name].
+ Adds the [param animation] to the library, accessible by the key [param name].
</description>
</method>
<method name="get_animation" qualifiers="const">
diff --git a/doc/classes/AnimationPlayer.xml b/doc/classes/AnimationPlayer.xml
index d24703203b..b7ac1ff7f8 100644
--- a/doc/classes/AnimationPlayer.xml
+++ b/doc/classes/AnimationPlayer.xml
@@ -5,7 +5,7 @@
</brief_description>
<description>
An animation player is used for general-purpose playback of [Animation] resources. It contains a dictionary of [AnimationLibrary] resources and custom blend times between animation transitions.
- Some methods and properties use a single key to refence an animation directly. These keys are formatted as the key for the library, followed by a forward slash, then the key for the animation whithin the library, for example [code]"movement/run"[/code]. If the library's key is an empty string (known as the default library), the forward slash is omitted, being the same key used by the library.
+ Some methods and properties use a single key to reference an animation directly. These keys are formatted as the key for the library, followed by a forward slash, then the key for the animation within the library, for example [code]"movement/run"[/code]. If the library's key is an empty string (known as the default library), the forward slash is omitted, being the same key used by the library.
[AnimationPlayer] is more suited than [Tween] for animations where you know the final values in advance. For example, fading a screen in and out is more easily done with an [AnimationPlayer] node thanks to the animation tools provided by the editor. That particular example can also be implemented with a [Tween], but it requires doing everything by code.
Updating the target properties of animations occurs at process time.
</description>
@@ -170,7 +170,7 @@
<return type="void" />
<param index="0" name="name" type="StringName" />
<description>
- Removes the [AnimationLibrary] assosiated with the key [param name].
+ Removes the [AnimationLibrary] associated with the key [param name].
</description>
</method>
<method name="rename_animation_library">
diff --git a/doc/classes/Control.xml b/doc/classes/Control.xml
index 7b9bf0fa37..bf449ade77 100644
--- a/doc/classes/Control.xml
+++ b/doc/classes/Control.xml
@@ -528,7 +528,7 @@
<param index="0" name="at_position" type="Vector2" default="Vector2(0, 0)" />
<description>
Returns the tooltip text [param at_position] in local coordinates, which will typically appear when the cursor is resting over this control. By default, it returns [member tooltip_text].
- [b]Note:[/b] This method can be overriden to customise its behaviour. If this method returns an empty [String], no tooltip is displayed.
+ [b]Note:[/b] This method can be overridden to customise its behaviour. If this method returns an empty [String], no tooltip is displayed.
</description>
</method>
<method name="grab_click_focus">
diff --git a/doc/classes/CubemapArray.xml b/doc/classes/CubemapArray.xml
index 7f001155e4..07e401a13d 100644
--- a/doc/classes/CubemapArray.xml
+++ b/doc/classes/CubemapArray.xml
@@ -5,7 +5,7 @@
</brief_description>
<description>
[CubemapArray]s are made of an array of [Cubemap]s. Accordingly, like [Cubemap]s they are made of multiple textures the amount of which must be divisible by 6 (one image for each face of the cube). The primary benefit of [CubemapArray]s is that they can be accessed in shader code using a single texture reference. In other words, you can pass multiple [Cubemap]s into a shader using a single [CubemapArray].
- Generally, [CubemapArray]s provide a more efficent way for storing multiple [Cubemap]s, than storing multiple [Cubemap]s themselves in an array.
+ Generally, [CubemapArray]s provide a more efficient way for storing multiple [Cubemap]s, than storing multiple [Cubemap]s themselves in an array.
Internally Godot, uses [CubemapArray]s for many effects including the [Sky], if you set [member ProjectSettings.rendering/reflections/sky_reflections/texture_array_reflections] to [code]true[/code].
[b]Note:[/b] [CubemapArray] is not supported in the OpenGL 3 rendering backend.
</description>
diff --git a/doc/classes/DirAccess.xml b/doc/classes/DirAccess.xml
index af498a6519..554ef9e2da 100644
--- a/doc/classes/DirAccess.xml
+++ b/doc/classes/DirAccess.xml
@@ -251,7 +251,7 @@
<param index="0" name="path" type="String" />
<description>
Creates a new [DirAccess] object and opens an existing directory of the filesystem. The [param path] argument can be within the project tree ([code]res://folder[/code]), the user directory ([code]user://folder[/code]) or an absolute path of the user filesystem (e.g. [code]/tmp/folder[/code] or [code]C:\tmp\folder[/code]).
- Returns [code]null[/code] if opening the directory failed. You can use [method get_open_error] to check the error that ocurred.
+ Returns [code]null[/code] if opening the directory failed. You can use [method get_open_error] to check the error that occurred.
</description>
</method>
<method name="remove">
diff --git a/doc/classes/EditorSettings.xml b/doc/classes/EditorSettings.xml
index 6007128965..7f3ffce9b7 100644
--- a/doc/classes/EditorSettings.xml
+++ b/doc/classes/EditorSettings.xml
@@ -314,8 +314,8 @@
<member name="editors/3d/navigation/navigation_scheme" type="int" setter="" getter="">
The navigation scheme to use in the 3D editor. Changing this setting will affect the mouse buttons that must be held down to perform certain operations in the 3D editor viewport.
- [b]Godot[/b] Middle mouse button to orbit, [kbd]Shift + Middle mouse button[/kbd] to pan. [kbd]Mouse wheel[/kbd] to zoom.
- - [b]Maya:[/b] [kbd]Alt + Left mouse buttton[/kbd] to orbit. [kbd]Middle mouse button[/kbd] to pan, [kbd]Shift + Middle mouse button[/kbd] to pan 10 times faster. [kbd]Mouse wheel[/kbd] to zoom.
- - [b]Modo:[/b] [kbd]Alt + Left mouse buttton[/kbd] to orbit. [kbd]Alt + Shift + Left mouse button[/kbd] to pan. [kbd]Ctrl + Alt + Left mouse button[/kbd] to zoom.
+ - [b]Maya:[/b] [kbd]Alt + Left mouse button[/kbd] to orbit. [kbd]Middle mouse button[/kbd] to pan, [kbd]Shift + Middle mouse button[/kbd] to pan 10 times faster. [kbd]Mouse wheel[/kbd] to zoom.
+ - [b]Modo:[/b] [kbd]Alt + Left mouse button[/kbd] to orbit. [kbd]Alt + Shift + Left mouse button[/kbd] to pan. [kbd]Ctrl + Alt + Left mouse button[/kbd] to zoom.
See also [member editors/3d/freelook/freelook_navigation_scheme].
[b]Note:[/b] On certain window managers on Linux, the [kbd]Alt[/kbd] key will be intercepted by the window manager when clicking a mouse button at the same time. This means Godot will not see the modifier key as being pressed.
</member>
diff --git a/doc/classes/FileAccess.xml b/doc/classes/FileAccess.xml
index adc0f4c3dd..f4ae70cf22 100644
--- a/doc/classes/FileAccess.xml
+++ b/doc/classes/FileAccess.xml
@@ -250,7 +250,7 @@
<param index="1" name="flags" type="int" enum="FileAccess.ModeFlags" />
<description>
Creates a new [FileAccess] object and opens the file for writing or reading, depending on the flags.
- Returns [code]null[/code] if opening the file failed. You can use [method get_open_error] to check the error that ocurred.
+ Returns [code]null[/code] if opening the file failed. You can use [method get_open_error] to check the error that occurred.
</description>
</method>
<method name="open_compressed" qualifiers="static">
@@ -261,7 +261,7 @@
<description>
Creates a new [FileAccess] object and opens a compressed file for reading or writing.
[b]Note:[/b] [method open_compressed] can only read files that were saved by Godot, not third-party compression formats. See [url=https://github.com/godotengine/godot/issues/28999]GitHub issue #28999[/url] for a workaround.
- Returns [code]null[/code] if opening the file failed. You can use [method get_open_error] to check the error that ocurred.
+ Returns [code]null[/code] if opening the file failed. You can use [method get_open_error] to check the error that occurred.
</description>
</method>
<method name="open_encrypted" qualifiers="static">
@@ -272,7 +272,7 @@
<description>
Creates a new [FileAccess] object and opens an encrypted file in write or read mode. You need to pass a binary key to encrypt/decrypt it.
[b]Note:[/b] The provided key must be 32 bytes long.
- Returns [code]null[/code] if opening the file failed. You can use [method get_open_error] to check the error that ocurred.
+ Returns [code]null[/code] if opening the file failed. You can use [method get_open_error] to check the error that occurred.
</description>
</method>
<method name="open_encrypted_with_pass" qualifiers="static">
@@ -282,7 +282,7 @@
<param index="2" name="pass" type="String" />
<description>
Creates a new [FileAccess] object and opens an encrypted file in write or read mode. You need to pass a password to encrypt/decrypt it.
- Returns [code]null[/code] if opening the file failed. You can use [method get_open_error] to check the error that ocurred.
+ Returns [code]null[/code] if opening the file failed. You can use [method get_open_error] to check the error that occurred.
</description>
</method>
<method name="seek">
diff --git a/doc/classes/ImageFormatLoaderExtension.xml b/doc/classes/ImageFormatLoaderExtension.xml
index b2a7ebc60f..9d18ee8b84 100644
--- a/doc/classes/ImageFormatLoaderExtension.xml
+++ b/doc/classes/ImageFormatLoaderExtension.xml
@@ -5,7 +5,7 @@
</brief_description>
<description>
The engine supports multiple image formats out of the box (PNG, SVG, JPEG, WebP to name a few), but you can choose to implement support for additional image formats by extending this class.
- Be sure to respect the documented return types and values. You should create an instance of it, and call [method add_format_loader] to register that loader during the initializaiton phase.
+ Be sure to respect the documented return types and values. You should create an instance of it, and call [method add_format_loader] to register that loader during the initialization phase.
</description>
<tutorials>
</tutorials>
@@ -13,7 +13,7 @@
<method name="_get_recognized_extensions" qualifiers="virtual const">
<return type="PackedStringArray" />
<description>
- Returns the list of file extensions for this image format. Files with the given extentions will be treated as image file and loaded using this class.
+ Returns the list of file extensions for this image format. Files with the given extensions will be treated as image file and loaded using this class.
</description>
</method>
<method name="_load_image" qualifiers="virtual">
diff --git a/doc/classes/InputEventWithModifiers.xml b/doc/classes/InputEventWithModifiers.xml
index d0453156d5..c6311d780c 100644
--- a/doc/classes/InputEventWithModifiers.xml
+++ b/doc/classes/InputEventWithModifiers.xml
@@ -23,7 +23,7 @@
State of the [kbd]Alt[/kbd] modifier.
</member>
<member name="command_or_control_autoremap" type="bool" setter="set_command_or_control_autoremap" getter="is_command_or_control_autoremap" default="false">
- Automaticaly use [kbd]Meta[/kbd] ([kbd]Command[/kbd]) on macOS and [kbd]Ctrl[/kbd] on other platforms. If [code]true[/code], [member ctrl_pressed] and [member meta_pressed] cannot be set.
+ Automatically use [kbd]Meta[/kbd] ([kbd]Command[/kbd]) on macOS and [kbd]Ctrl[/kbd] on other platforms. If [code]true[/code], [member ctrl_pressed] and [member meta_pressed] cannot be set.
</member>
<member name="ctrl_pressed" type="bool" setter="set_ctrl_pressed" getter="is_ctrl_pressed" default="false">
State of the [kbd]Ctrl[/kbd] modifier.
diff --git a/doc/classes/MultiplayerAPIExtension.xml b/doc/classes/MultiplayerAPIExtension.xml
index e67970cc89..c4012a920a 100644
--- a/doc/classes/MultiplayerAPIExtension.xml
+++ b/doc/classes/MultiplayerAPIExtension.xml
@@ -5,7 +5,7 @@
</brief_description>
<description>
This class can be used to augment or replace the default [MultiplayerAPI] implementation via script or extensions.
- The following example augment the default implemenation ([SceneMultiplayer]) by logging every RPC being made, and every object being configured for replication.
+ The following example augment the default implementation ([SceneMultiplayer]) by logging every RPC being made, and every object being configured for replication.
[codeblocks]
[gdscript]
extends MultiplayerAPIExtension
diff --git a/doc/classes/NavigationPathQueryParameters2D.xml b/doc/classes/NavigationPathQueryParameters2D.xml
index 364f495a72..397ca8b713 100644
--- a/doc/classes/NavigationPathQueryParameters2D.xml
+++ b/doc/classes/NavigationPathQueryParameters2D.xml
@@ -33,7 +33,7 @@
The path query uses the default A* pathfinding algorithm.
</constant>
<constant name="PATH_POSTPROCESSING_CORRIDORFUNNEL" value="0" enum="PathPostProcessing">
- Applies a funnel algorithm to the raw path corridor found by the pathfinding algorithm. This will result in the shortest path possible inside the path corridor. This postprocessing very much depends on the navmesh polygon layout and the created corridor. Especially tile- or gridbased layouts can face artifical corners with diagonal movement due to a jagged path corridor imposed by the cell shapes.
+ Applies a funnel algorithm to the raw path corridor found by the pathfinding algorithm. This will result in the shortest path possible inside the path corridor. This postprocessing very much depends on the navmesh polygon layout and the created corridor. Especially tile- or gridbased layouts can face artificial corners with diagonal movement due to a jagged path corridor imposed by the cell shapes.
</constant>
<constant name="PATH_POSTPROCESSING_EDGECENTERED" value="1" enum="PathPostProcessing">
Centers every path position in the middle of the traveled navmesh polygon edge. This creates better paths for tile- or gridbased layouts that restrict the movement to the cells center.
diff --git a/doc/classes/NavigationPathQueryParameters3D.xml b/doc/classes/NavigationPathQueryParameters3D.xml
index 59c907c5b5..29faa5561b 100644
--- a/doc/classes/NavigationPathQueryParameters3D.xml
+++ b/doc/classes/NavigationPathQueryParameters3D.xml
@@ -33,7 +33,7 @@
The path query uses the default A* pathfinding algorithm.
</constant>
<constant name="PATH_POSTPROCESSING_CORRIDORFUNNEL" value="0" enum="PathPostProcessing">
- Applies a funnel algorithm to the raw path corridor found by the pathfinding algorithm. This will result in the shortest path possible inside the path corridor. This postprocessing very much depends on the navmesh polygon layout and the created corridor. Especially tile- or gridbased layouts can face artifical corners with diagonal movement due to a jagged path corridor imposed by the cell shapes.
+ Applies a funnel algorithm to the raw path corridor found by the pathfinding algorithm. This will result in the shortest path possible inside the path corridor. This postprocessing very much depends on the navmesh polygon layout and the created corridor. Especially tile- or gridbased layouts can face artificial corners with diagonal movement due to a jagged path corridor imposed by the cell shapes.
</constant>
<constant name="PATH_POSTPROCESSING_EDGECENTERED" value="1" enum="PathPostProcessing">
Centers every path position in the middle of the traveled navmesh polygon edge. This creates better paths for tile- or gridbased layouts that restrict the movement to the cells center.
diff --git a/doc/classes/NavigationPathQueryResult2D.xml b/doc/classes/NavigationPathQueryResult2D.xml
index a9b12d3b94..95b90e9383 100644
--- a/doc/classes/NavigationPathQueryResult2D.xml
+++ b/doc/classes/NavigationPathQueryResult2D.xml
@@ -8,6 +8,14 @@
</description>
<tutorials>
</tutorials>
+ <methods>
+ <method name="reset">
+ <return type="void" />
+ <description>
+ Reset the result object to its initial state. This is useful to reuse the object across multiple queries.
+ </description>
+ </method>
+ </methods>
<members>
<member name="path" type="PackedVector2Array" setter="set_path" getter="get_path" default="PackedVector2Array()">
The resulting path array from the navigation query. All path array positions are in global coordinates. Without customized query parameters this is the same path as returned by [method NavigationServer2D.map_get_path].
diff --git a/doc/classes/NavigationPathQueryResult3D.xml b/doc/classes/NavigationPathQueryResult3D.xml
index d8336111fc..b4ca8288db 100644
--- a/doc/classes/NavigationPathQueryResult3D.xml
+++ b/doc/classes/NavigationPathQueryResult3D.xml
@@ -8,6 +8,14 @@
</description>
<tutorials>
</tutorials>
+ <methods>
+ <method name="reset">
+ <return type="void" />
+ <description>
+ Reset the result object to its initial state. This is useful to reuse the object across multiple queries.
+ </description>
+ </method>
+ </methods>
<members>
<member name="path" type="PackedVector3Array" setter="set_path" getter="get_path" default="PackedVector3Array()">
The resulting path array from the navigation query. All path array positions are in global coordinates. Without customized query parameters this is the same path as returned by [method NavigationServer3D.map_get_path].
diff --git a/doc/classes/Node3D.xml b/doc/classes/Node3D.xml
index 96ce10745d..3df7ec931f 100644
--- a/doc/classes/Node3D.xml
+++ b/doc/classes/Node3D.xml
@@ -116,7 +116,7 @@
Rotates the node so that the local forward axis (-Z) points toward the [param target] position.
The local up axis (+Y) points as close to the [param up] vector as possible while staying perpendicular to the local forward axis. The resulting transform is orthogonal, and the scale is preserved. Non-uniform scaling may not work correctly.
The [param target] position cannot be the same as the node's position, the [param up] vector cannot be zero, and the direction from the node's position to the [param target] vector cannot be parallel to the [param up] vector.
- Operations take place in global space.
+ Operations take place in global space, which means that the node must be in the scene tree.
</description>
</method>
<method name="look_at_from_position">
diff --git a/doc/classes/OS.xml b/doc/classes/OS.xml
index be7bacd994..313f3ab6db 100644
--- a/doc/classes/OS.xml
+++ b/doc/classes/OS.xml
@@ -523,7 +523,7 @@
<param index="0" name="path" type="String" />
<description>
Moves the file or directory to the system's recycle bin. See also [method DirAccess.remove].
- The method takes only global paths, so you may need to use [method ProjectSettings.globalize_path]. Do not use it for files in [code]res://[/code] as it will not work in exported project.
+ The method takes only global paths, so you may need to use [method ProjectSettings.globalize_path]. Do not use it for files in [code]res://[/code] as it will not work in exported projects.
[b]Note:[/b] If the user has disabled the recycle bin on their system, the file will be permanently deleted instead.
[codeblocks]
[gdscript]
diff --git a/doc/classes/ProjectSettings.xml b/doc/classes/ProjectSettings.xml
index 498283b2f3..6b8e077fad 100644
--- a/doc/classes/ProjectSettings.xml
+++ b/doc/classes/ProjectSettings.xml
@@ -1986,7 +1986,7 @@
[b]Mobile[/b]: Modern renderer designed for mobile devices. Has a lower base overhead than Clustered, but does not scale as well to large scenes with many elements.
[b]Compatibility[/b]: Low-end renderer designed for older devices. Based on the limitations of the OpenGL 3.3/ OpenGL ES 3.0 / WebGL 2 APIs.
</member>
- <member name="rendering/renderer/rendering_method.mobile" type="String" setter="" getter="" default="&quot;forward_plus&quot;">
+ <member name="rendering/renderer/rendering_method.mobile" type="String" setter="" getter="" default="&quot;mobile&quot;">
Override for [member rendering/renderer/rendering_method] on mobile devices.
</member>
<member name="rendering/renderer/rendering_method.web" type="String" setter="" getter="" default="&quot;gl_compatibility&quot;">
diff --git a/doc/tools/make_rst.py b/doc/tools/make_rst.py
index a8569413ec..492a438d9b 100755
--- a/doc/tools/make_rst.py
+++ b/doc/tools/make_rst.py
@@ -526,7 +526,7 @@ def main() -> None:
)
if os.path.exists(lang_file):
try:
- import polib
+ import polib # type: ignore
except ImportError:
print("Base template strings localization requires `polib`.")
exit(1)
@@ -739,9 +739,10 @@ def make_rst_class(class_def: ClassDef, state: State, dry_run: bool, output_dir:
f.write(f"- {make_link(url, title)}\n\n")
# Properties overview
+ ml: List[Tuple[Optional[str], ...]] = []
if len(class_def.properties) > 0:
f.write(make_heading("Properties", "-"))
- ml: List[Tuple[Optional[str], ...]] = []
+ ml = []
for property_def in class_def.properties.values():
type_rst = property_def.type_name.to_rst(state)
default = property_def.default_value
@@ -757,7 +758,7 @@ def make_rst_class(class_def: ClassDef, state: State, dry_run: bool, output_dir:
# Constructors, Methods, Operators overview
if len(class_def.constructors) > 0:
f.write(make_heading("Constructors", "-"))
- ml: List[Tuple[Optional[str], ...]] = []
+ ml = []
for method_list in class_def.constructors.values():
for m in method_list:
ml.append(make_method_signature(class_def, m, "constructor", state))
@@ -765,7 +766,7 @@ def make_rst_class(class_def: ClassDef, state: State, dry_run: bool, output_dir:
if len(class_def.methods) > 0:
f.write(make_heading("Methods", "-"))
- ml: List[Tuple[Optional[str], ...]] = []
+ ml = []
for method_list in class_def.methods.values():
for m in method_list:
ml.append(make_method_signature(class_def, m, "method", state))
@@ -773,7 +774,7 @@ def make_rst_class(class_def: ClassDef, state: State, dry_run: bool, output_dir:
if len(class_def.operators) > 0:
f.write(make_heading("Operators", "-"))
- ml: List[Tuple[Optional[str], ...]] = []
+ ml = []
for method_list in class_def.operators.values():
for m in method_list:
ml.append(make_method_signature(class_def, m, "operator", state))
@@ -858,7 +859,7 @@ def make_rst_class(class_def: ClassDef, state: State, dry_run: bool, output_dir:
f.write(make_heading("Annotations", "-"))
index = 0
- for method_list in class_def.annotations.values():
+ for method_list in class_def.annotations.values(): # type: ignore
for i, m in enumerate(method_list):
if index != 0:
f.write("----\n\n")
@@ -1039,17 +1040,15 @@ def make_method_signature(
) -> Tuple[str, str]:
ret_type = ""
- is_method_def = isinstance(definition, MethodDef)
- if is_method_def:
+ if isinstance(definition, MethodDef):
ret_type = definition.return_type.to_rst(state)
qualifiers = None
- if is_method_def or isinstance(definition, AnnotationDef):
+ if isinstance(definition, (MethodDef, AnnotationDef)):
qualifiers = definition.qualifiers
out = ""
-
- if is_method_def and ref_type != "":
+ if isinstance(definition, MethodDef) and ref_type != "":
if ref_type == "operator":
op_name = definition.name.replace("<", "\\<") # So operator "<" gets correctly displayed.
out += f":ref:`{op_name}<class_{class_def.name}_{ref_type}_{sanitize_operator_name(definition.name, state)}_{definition.return_type.type_name}>` "
@@ -1456,18 +1455,14 @@ def format_text_block(
escape_post = True
elif cmd.startswith("param"):
- valid_context = (
- isinstance(context, MethodDef)
- or isinstance(context, SignalDef)
- or isinstance(context, AnnotationDef)
- )
+ valid_context = isinstance(context, (MethodDef, SignalDef, AnnotationDef))
if not valid_context:
print_error(
f'{state.current_class}.xml: Argument reference "{link_target}" used outside of method, signal, or annotation context in {context_name}.',
state,
)
else:
- context_params: List[ParameterDef] = context.parameters
+ context_params: List[ParameterDef] = context.parameters # type: ignore
found = False
for param_def in context_params:
if param_def.name == link_target:
diff --git a/doc/translations/extract.py b/doc/translations/extract.py
index 5708e0072d..ce645436d9 100644
--- a/doc/translations/extract.py
+++ b/doc/translations/extract.py
@@ -60,7 +60,7 @@ BASE_STRINGS = [
## <xml-line-number-hack from="https://stackoverflow.com/a/36430270/10846399">
import sys
-sys.modules["_elementtree"] = None
+sys.modules["_elementtree"] = None # type: ignore
import xml.etree.ElementTree as ET
## override the parser to get the line number
diff --git a/drivers/gles3/rasterizer_scene_gles3.cpp b/drivers/gles3/rasterizer_scene_gles3.cpp
index 85b35639ec..d106bb31c7 100644
--- a/drivers/gles3/rasterizer_scene_gles3.cpp
+++ b/drivers/gles3/rasterizer_scene_gles3.cpp
@@ -737,7 +737,6 @@ void RasterizerSceneGLES3::_draw_sky(RID p_env, const Projection &p_projection,
RS::EnvironmentBG background = environment_get_background(p_env);
if (sky) {
- ERR_FAIL_COND(!sky);
sky_material = sky->material;
if (sky_material.is_valid()) {
@@ -2043,7 +2042,7 @@ void RasterizerSceneGLES3::_render_list_template(RenderListParameters *p_params,
} break;
}
- if (p_pass_mode == PASS_MODE_COLOR || p_pass_mode == PASS_MODE_COLOR_TRANSPARENT) {
+ if constexpr (p_pass_mode == PASS_MODE_COLOR || p_pass_mode == PASS_MODE_COLOR_TRANSPARENT) {
glActiveTexture(GL_TEXTURE0 + config->max_texture_image_units - 2);
GLuint texture_to_bind = texture_storage->get_texture(texture_storage->texture_gl_get_default(GLES3::DEFAULT_GL_TEXTURE_CUBEMAP_BLACK))->tex_id;
if (p_render_data->environment.is_valid()) {
@@ -2074,7 +2073,7 @@ void RasterizerSceneGLES3::_render_list_template(RenderListParameters *p_params,
GLES3::SceneMaterialData *material_data;
void *mesh_surface;
- if (p_pass_mode == PASS_MODE_SHADOW) {
+ if constexpr (p_pass_mode == PASS_MODE_SHADOW) {
shader = surf->shader_shadow;
material_data = surf->material_shadow;
mesh_surface = surf->surface_shadow;
@@ -2088,7 +2087,7 @@ void RasterizerSceneGLES3::_render_list_template(RenderListParameters *p_params,
continue;
}
- if (p_pass_mode == PASS_MODE_COLOR_TRANSPARENT) {
+ if constexpr (p_pass_mode == PASS_MODE_COLOR_TRANSPARENT) {
if (scene_state.current_depth_test != shader->depth_test) {
if (shader->depth_test == GLES3::SceneShaderData::DEPTH_TEST_DISABLED) {
glDisable(GL_DEPTH_TEST);
@@ -2115,9 +2114,9 @@ void RasterizerSceneGLES3::_render_list_template(RenderListParameters *p_params,
scene_state.current_depth_draw = shader->depth_draw;
}
- if (p_pass_mode == PASS_MODE_COLOR_TRANSPARENT || p_pass_mode == PASS_MODE_COLOR_ADDITIVE) {
+ if constexpr (p_pass_mode == PASS_MODE_COLOR_TRANSPARENT || p_pass_mode == PASS_MODE_COLOR_ADDITIVE) {
GLES3::SceneShaderData::BlendMode desired_blend_mode;
- if (p_pass_mode == PASS_MODE_COLOR_ADDITIVE) {
+ if constexpr (p_pass_mode == PASS_MODE_COLOR_ADDITIVE) {
desired_blend_mode = GLES3::SceneShaderData::BLEND_MODE_ADD;
} else {
desired_blend_mode = shader->blend_mode;
@@ -2241,9 +2240,9 @@ void RasterizerSceneGLES3::_render_list_template(RenderListParameters *p_params,
if (prev_shader != shader || prev_variant != instance_variant) {
material_storage->shaders.scene_shader.version_bind_shader(shader->version, instance_variant);
float opaque_prepass_threshold = 0.0;
- if (p_pass_mode == PASS_MODE_DEPTH) {
+ if constexpr (p_pass_mode == PASS_MODE_DEPTH) {
opaque_prepass_threshold = 0.99;
- } else if (p_pass_mode == PASS_MODE_SHADOW) {
+ } else if constexpr (p_pass_mode == PASS_MODE_SHADOW) {
opaque_prepass_threshold = 0.1;
}
diff --git a/drivers/gles3/storage/material_storage.cpp b/drivers/gles3/storage/material_storage.cpp
index 687e98ba58..d9a797778c 100644
--- a/drivers/gles3/storage/material_storage.cpp
+++ b/drivers/gles3/storage/material_storage.cpp
@@ -1406,6 +1406,8 @@ MaterialStorage::MaterialStorage() {
actions.renames["VERTEX_ID"] = "gl_VertexIndex";
actions.renames["LIGHT_POSITION"] = "light_position";
+ actions.renames["LIGHT_DIRECTION"] = "light_direction";
+ actions.renames["LIGHT_IS_DIRECTIONAL"] = "is_directional";
actions.renames["LIGHT_COLOR"] = "light_color";
actions.renames["LIGHT_ENERGY"] = "light_energy";
actions.renames["LIGHT"] = "light";
@@ -1654,7 +1656,7 @@ ShaderCompiler::DefaultIdentifierActions actions;
actions.render_mode_defines["disable_force"] = "#define DISABLE_FORCE\n";
actions.render_mode_defines["disable_velocity"] = "#define DISABLE_VELOCITY\n";
actions.render_mode_defines["keep_data"] = "#define ENABLE_KEEP_DATA\n";
- actions.render_mode_defines["collision_use_scale"] = "#define USE_COLLISON_SCALE\n";
+ actions.render_mode_defines["collision_use_scale"] = "#define USE_COLLISION_SCALE\n";
actions.sampler_array_name = "material_samplers";
actions.base_texture_binding_index = 1;
diff --git a/drivers/gles3/storage/texture_storage.cpp b/drivers/gles3/storage/texture_storage.cpp
index a801b3285a..e18c0ec649 100644
--- a/drivers/gles3/storage/texture_storage.cpp
+++ b/drivers/gles3/storage/texture_storage.cpp
@@ -666,6 +666,8 @@ void TextureStorage::texture_free(RID p_texture) {
}
void TextureStorage::texture_2d_initialize(RID p_texture, const Ref<Image> &p_image) {
+ ERR_FAIL_COND(p_image.is_null());
+
Texture texture;
texture.width = p_image->get_width();
texture.height = p_image->get_height();
diff --git a/drivers/vulkan/rendering_device_vulkan.cpp b/drivers/vulkan/rendering_device_vulkan.cpp
index bfe34399ec..f0f70b62e0 100644
--- a/drivers/vulkan/rendering_device_vulkan.cpp
+++ b/drivers/vulkan/rendering_device_vulkan.cpp
@@ -4152,8 +4152,8 @@ RID RenderingDeviceVulkan::framebuffer_create_multipass(const Vector<RID> &p_tex
size.height = texture->height;
size_set = true;
} else if (texture->usage_flags & TEXTURE_USAGE_VRS_ATTACHMENT_BIT) {
- // If this is not the first attachement we assume this is used as the VRS attachment.
- // In this case this texture will be 1/16th the size of the color attachement.
+ // If this is not the first attachment we assume this is used as the VRS attachment.
+ // In this case this texture will be 1/16th the size of the color attachment.
// So we skip the size check.
} else {
ERR_FAIL_COND_V_MSG((uint32_t)size.width != texture->width || (uint32_t)size.height != texture->height, RID(),
diff --git a/editor/SCsub b/editor/SCsub
index c217f162b4..32ad88add5 100644
--- a/editor/SCsub
+++ b/editor/SCsub
@@ -24,7 +24,7 @@ def _make_doc_data_class_path(to_path):
g.close()
-if env["tools"]:
+if env.editor_build:
# Register exporters
reg_exporters_inc = '#include "register_exporters.h"\n'
reg_exporters = "void register_exporters() {\n"
diff --git a/editor/editor_builders.py b/editor/editor_builders.py
index e73fbc6107..696e3b64ec 100644
--- a/editor/editor_builders.py
+++ b/editor/editor_builders.py
@@ -9,6 +9,7 @@ import shutil
import subprocess
import tempfile
import uuid
+import zlib
from platform_methods import subprocess_main
@@ -28,7 +29,6 @@ def make_doc_header(target, source, env):
buf = (docbegin + buf + docend).encode("utf-8")
decomp_size = len(buf)
- import zlib
# Use maximum zlib compression level to further reduce file size
# (at the cost of initial build times).
@@ -88,9 +88,6 @@ def make_translations_header(target, source, env, category):
g.write("#ifndef _{}_TRANSLATIONS_H\n".format(category.upper()))
g.write("#define _{}_TRANSLATIONS_H\n".format(category.upper()))
- import zlib
- import os.path
-
sorted_paths = sorted(source, key=lambda path: os.path.splitext(os.path.basename(path))[0])
msgfmt_available = shutil.which("msgfmt") is not None
diff --git a/editor/editor_file_system.cpp b/editor/editor_file_system.cpp
index b89bd23859..9153640115 100644
--- a/editor/editor_file_system.cpp
+++ b/editor/editor_file_system.cpp
@@ -2085,7 +2085,7 @@ void EditorFileSystem::reimport_files(const Vector<String> &p_files) {
if (group_file_cache.has(file)) {
//maybe the file itself is a group!
groups_to_reimport.insert(file);
- //groups do not belong to grups
+ //groups do not belong to groups
group_file = String();
} else if (!group_file.is_empty()) {
//it's a group file, add group to import and skip this file
diff --git a/editor/editor_inspector.cpp b/editor/editor_inspector.cpp
index 5de205153d..270f4560b7 100644
--- a/editor/editor_inspector.cpp
+++ b/editor/editor_inspector.cpp
@@ -3463,7 +3463,7 @@ void EditorInspector::expand_revertable() {
}
}
- // Climb up the hierachy doing double buffering with the sets.
+ // Climb up the hierarchy doing double buffering with the sets.
int a = 0;
int b = 1;
while (sections_to_unfold[a].size()) {
diff --git a/editor/editor_run.cpp b/editor/editor_run.cpp
index 26dac8a675..99c8481d33 100644
--- a/editor/editor_run.cpp
+++ b/editor/editor_run.cpp
@@ -63,7 +63,7 @@ Error EditorRun::run(const String &p_scene, const String &p_write_movie) {
args.push_back("--editor-pid");
args.push_back(itos(OS::get_singleton()->get_process_id()));
- bool debug_collisions = EditorSettings::get_singleton()->get_project_metadata("debug_options", "run_debug_collisons", false);
+ bool debug_collisions = EditorSettings::get_singleton()->get_project_metadata("debug_options", "run_debug_collisions", false);
bool debug_paths = EditorSettings::get_singleton()->get_project_metadata("debug_options", "run_debug_paths", false);
bool debug_navigation = EditorSettings::get_singleton()->get_project_metadata("debug_options", "run_debug_navigation", false);
if (debug_collisions) {
diff --git a/editor/editor_run_native.cpp b/editor/editor_run_native.cpp
index 3e8f17085d..47a9661bcb 100644
--- a/editor/editor_run_native.cpp
+++ b/editor/editor_run_native.cpp
@@ -134,7 +134,7 @@ Error EditorRunNative::run_native(int p_idx, int p_platform) {
bool deploy_debug_remote = is_deploy_debug_remote_enabled();
bool deploy_dumb = EditorSettings::get_singleton()->get_project_metadata("debug_options", "run_file_server", false);
- bool debug_collisions = EditorSettings::get_singleton()->get_project_metadata("debug_options", "run_debug_collisons", false);
+ bool debug_collisions = EditorSettings::get_singleton()->get_project_metadata("debug_options", "run_debug_collisions", false);
bool debug_navigation = EditorSettings::get_singleton()->get_project_metadata("debug_options", "run_debug_navigation", false);
if (deploy_debug_remote) {
@@ -144,7 +144,7 @@ Error EditorRunNative::run_native(int p_idx, int p_platform) {
flags |= EditorExportPlatform::DEBUG_FLAG_DUMB_CLIENT;
}
if (debug_collisions) {
- flags |= EditorExportPlatform::DEBUG_FLAG_VIEW_COLLISONS;
+ flags |= EditorExportPlatform::DEBUG_FLAG_VIEW_COLLISIONS;
}
if (debug_navigation) {
flags |= EditorExportPlatform::DEBUG_FLAG_VIEW_NAVIGATION;
diff --git a/editor/editor_themes.cpp b/editor/editor_themes.cpp
index 486a1f5a84..f4c1f308cc 100644
--- a/editor/editor_themes.cpp
+++ b/editor/editor_themes.cpp
@@ -286,7 +286,7 @@ void editor_register_and_generate_icons(Ref<Theme> p_theme, bool p_dark_theme, f
saturation_exceptions.insert("Logo");
// Accent color conversion map.
- // It is used on soem icons (checkbox, radio, toggle, etc.), regardless of the dark
+ // It is used on some icons (checkbox, radio, toggle, etc.), regardless of the dark
// or light mode.
HashMap<Color, Color> accent_color_map;
HashSet<StringName> accent_color_icons;
diff --git a/editor/export/editor_export_platform.cpp b/editor/export/editor_export_platform.cpp
index 13ab5cebf6..c86114a140 100644
--- a/editor/export/editor_export_platform.cpp
+++ b/editor/export/editor_export_platform.cpp
@@ -77,7 +77,7 @@ bool EditorExportPlatform::fill_log_messages(RichTextLabel *p_log, Error p_err)
} else {
p_log->add_image(EditorNode::get_singleton()->get_gui_base()->get_theme_icon(SNAME("StatusSuccess"), SNAME("EditorIcons")), 16 * EDSCALE, 16 * EDSCALE, Color(1.0, 1.0, 1.0), INLINE_ALIGNMENT_CENTER);
p_log->add_text(" ");
- p_log->add_text(TTR("Completed sucessfully."));
+ p_log->add_text(TTR("Completed successfully."));
if (msg_count > 0) {
has_messages = true;
}
@@ -176,7 +176,7 @@ void EditorExportPlatform::gen_debug_flags(Vector<String> &r_flags, int p_flags)
}
}
- if (p_flags & DEBUG_FLAG_VIEW_COLLISONS) {
+ if (p_flags & DEBUG_FLAG_VIEW_COLLISIONS) {
r_flags.push_back("--debug-collisions");
}
@@ -1609,7 +1609,7 @@ void EditorExportPlatform::gen_export_flags(Vector<String> &r_flags, int p_flags
}
}
- if (p_flags & DEBUG_FLAG_VIEW_COLLISONS) {
+ if (p_flags & DEBUG_FLAG_VIEW_COLLISIONS) {
r_flags.push_back("--debug-collisions");
}
diff --git a/editor/export/editor_export_platform.h b/editor/export/editor_export_platform.h
index 93bc54284f..88dc7bd5cd 100644
--- a/editor/export/editor_export_platform.h
+++ b/editor/export/editor_export_platform.h
@@ -210,7 +210,7 @@ public:
DEBUG_FLAG_DUMB_CLIENT = 1,
DEBUG_FLAG_REMOTE_DEBUG = 2,
DEBUG_FLAG_REMOTE_DEBUG_LOCALHOST = 4,
- DEBUG_FLAG_VIEW_COLLISONS = 8,
+ DEBUG_FLAG_VIEW_COLLISIONS = 8,
DEBUG_FLAG_VIEW_NAVIGATION = 16,
};
diff --git a/editor/plugins/animation_player_editor_plugin.cpp b/editor/plugins/animation_player_editor_plugin.cpp
index 5406aada09..e8caac565c 100644
--- a/editor/plugins/animation_player_editor_plugin.cpp
+++ b/editor/plugins/animation_player_editor_plugin.cpp
@@ -874,6 +874,11 @@ void AnimationPlayerEditor::_update_player() {
onion_toggle->set_disabled(no_anims_found);
onion_skinning->set_disabled(no_anims_found);
+ if (hack_disable_onion_skinning) {
+ onion_toggle->set_disabled(true);
+ onion_skinning->set_disabled(true);
+ }
+
_update_animation_list_icons();
updating = false;
@@ -1678,6 +1683,16 @@ AnimationPlayerEditor::AnimationPlayerEditor(AnimationPlayerEditorPlugin *p_plug
onion_skinning->get_popup()->add_check_item(TTR("Include Gizmos (3D)"), ONION_SKINNING_INCLUDE_GIZMOS);
hb->add_child(onion_skinning);
+ // FIXME: Onion skinning disabled for now as it's broken and triggers fast
+ // flickering red/blue modulation (GH-53870).
+ if (hack_disable_onion_skinning) {
+ onion_toggle->set_disabled(true);
+ onion_toggle->set_tooltip_text(TTR("Onion Skinning temporarily disabled due to rendering bug."));
+
+ onion_skinning->set_disabled(true);
+ onion_skinning->set_tooltip_text(TTR("Onion Skinning temporarily disabled due to rendering bug."));
+ }
+
hb->add_child(memnew(VSeparator));
pin = memnew(Button);
diff --git a/editor/plugins/animation_player_editor_plugin.h b/editor/plugins/animation_player_editor_plugin.h
index a37a9debef..06fd9455df 100644
--- a/editor/plugins/animation_player_editor_plugin.h
+++ b/editor/plugins/animation_player_editor_plugin.h
@@ -131,6 +131,8 @@ class AnimationPlayerEditor : public VBoxContainer {
AnimationTrackEditor *track_editor = nullptr;
static AnimationPlayerEditor *singleton;
+ bool hack_disable_onion_skinning = true; // Temporary hack for GH-53870.
+
// Onion skinning.
struct {
// Settings.
diff --git a/editor/plugins/bone_map_editor_plugin.cpp b/editor/plugins/bone_map_editor_plugin.cpp
index 46e2fe41af..60e8f5b44b 100644
--- a/editor/plugins/bone_map_editor_plugin.cpp
+++ b/editor/plugins/bone_map_editor_plugin.cpp
@@ -1309,7 +1309,7 @@ void BoneMapEditor::create_editors() {
void BoneMapEditor::fetch_objects() {
skeleton = nullptr;
- // Hackey... but it may be the easist way to get a selected object from "ImporterScene".
+ // Hackey... but it may be the easiest way to get a selected object from "ImporterScene".
SceneImportSettings *si = SceneImportSettings::get_singleton();
if (!si) {
return;
diff --git a/editor/plugins/debugger_editor_plugin.cpp b/editor/plugins/debugger_editor_plugin.cpp
index 40e7dfead2..dd6187c264 100644
--- a/editor/plugins/debugger_editor_plugin.cpp
+++ b/editor/plugins/debugger_editor_plugin.cpp
@@ -69,7 +69,7 @@ DebuggerEditorPlugin::DebuggerEditorPlugin(PopupMenu *p_debug_menu) {
debug_menu->set_item_tooltip(-1,
TTR("When this option is enabled, using one-click deploy for Android will only export an executable without the project data.\nThe filesystem will be provided from the project by the editor over the network.\nOn Android, deploying will use the USB cable for faster performance. This option speeds up testing for projects with large assets."));
debug_menu->add_separator();
- debug_menu->add_check_shortcut(ED_SHORTCUT("editor/visible_collision_shapes", TTR("Visible Collision Shapes")), RUN_DEBUG_COLLISONS);
+ debug_menu->add_check_shortcut(ED_SHORTCUT("editor/visible_collision_shapes", TTR("Visible Collision Shapes")), RUN_DEBUG_COLLISIONS);
debug_menu->set_item_tooltip(-1,
TTR("When this option is enabled, collision shapes and raycast nodes (for 2D and 3D) will be visible in the running project."));
debug_menu->add_check_shortcut(ED_SHORTCUT("editor/visible_paths", TTR("Visible Paths")), RUN_DEBUG_PATHS);
@@ -150,10 +150,10 @@ void DebuggerEditorPlugin::_menu_option(int p_option) {
EditorSettings::get_singleton()->set_project_metadata("debug_options", "run_deploy_remote_debug", !ischecked);
} break;
- case RUN_DEBUG_COLLISONS: {
- bool ischecked = debug_menu->is_item_checked(debug_menu->get_item_index(RUN_DEBUG_COLLISONS));
- debug_menu->set_item_checked(debug_menu->get_item_index(RUN_DEBUG_COLLISONS), !ischecked);
- EditorSettings::get_singleton()->set_project_metadata("debug_options", "run_debug_collisons", !ischecked);
+ case RUN_DEBUG_COLLISIONS: {
+ bool ischecked = debug_menu->is_item_checked(debug_menu->get_item_index(RUN_DEBUG_COLLISIONS));
+ debug_menu->set_item_checked(debug_menu->get_item_index(RUN_DEBUG_COLLISIONS), !ischecked);
+ EditorSettings::get_singleton()->set_project_metadata("debug_options", "run_debug_collisions", !ischecked);
} break;
case RUN_DEBUG_PATHS: {
@@ -190,7 +190,7 @@ void DebuggerEditorPlugin::_notification(int p_what) {
void DebuggerEditorPlugin::_update_debug_options() {
bool check_deploy_remote = EditorSettings::get_singleton()->get_project_metadata("debug_options", "run_deploy_remote_debug", false);
bool check_file_server = EditorSettings::get_singleton()->get_project_metadata("debug_options", "run_file_server", false);
- bool check_debug_collisions = EditorSettings::get_singleton()->get_project_metadata("debug_options", "run_debug_collisons", false);
+ bool check_debug_collisions = EditorSettings::get_singleton()->get_project_metadata("debug_options", "run_debug_collisions", false);
bool check_debug_paths = EditorSettings::get_singleton()->get_project_metadata("debug_options", "run_debug_paths", false);
bool check_debug_navigation = EditorSettings::get_singleton()->get_project_metadata("debug_options", "run_debug_navigation", false);
bool check_live_debug = EditorSettings::get_singleton()->get_project_metadata("debug_options", "run_live_debug", true);
@@ -204,7 +204,7 @@ void DebuggerEditorPlugin::_update_debug_options() {
_menu_option(RUN_FILE_SERVER);
}
if (check_debug_collisions) {
- _menu_option(RUN_DEBUG_COLLISONS);
+ _menu_option(RUN_DEBUG_COLLISIONS);
}
if (check_debug_paths) {
_menu_option(RUN_DEBUG_PATHS);
diff --git a/editor/plugins/debugger_editor_plugin.h b/editor/plugins/debugger_editor_plugin.h
index d8871128c3..c706acdb5c 100644
--- a/editor/plugins/debugger_editor_plugin.h
+++ b/editor/plugins/debugger_editor_plugin.h
@@ -48,7 +48,7 @@ private:
enum MenuOptions {
RUN_FILE_SERVER,
RUN_LIVE_DEBUG,
- RUN_DEBUG_COLLISONS,
+ RUN_DEBUG_COLLISIONS,
RUN_DEBUG_PATHS,
RUN_DEBUG_NAVIGATION,
RUN_DEPLOY_REMOTE_DEBUG,
diff --git a/editor/plugins/script_text_editor.cpp b/editor/plugins/script_text_editor.cpp
index aef84919d2..c21b4356f8 100644
--- a/editor/plugins/script_text_editor.cpp
+++ b/editor/plugins/script_text_editor.cpp
@@ -1056,14 +1056,22 @@ void ScriptTextEditor::_update_connected_methods() {
inherited_script = inherited_script->get_base_script();
}
- if (found_base_class.is_empty() && base_class) {
- List<MethodInfo> methods;
- ClassDB::get_method_list(base_class, &methods);
- for (int j = 0; j < methods.size(); j++) {
- if (methods[j].name == name) {
- found_base_class = "builtin:" + base_class;
+ if (found_base_class.is_empty()) {
+ while (base_class) {
+ List<MethodInfo> methods;
+ ClassDB::get_method_list(base_class, &methods, true);
+ for (int j = 0; j < methods.size(); j++) {
+ if (methods[j].name == name) {
+ found_base_class = "builtin:" + base_class;
+ break;
+ }
+ }
+
+ ClassDB::ClassInfo *base_class_ptr = ClassDB::classes.getptr(base_class)->inherits_ptr;
+ if (base_class_ptr == nullptr) {
break;
}
+ base_class = base_class_ptr->name;
}
}
@@ -1177,21 +1185,19 @@ void ScriptTextEditor::_edit_option(int p_op) {
case EDIT_MOVE_LINE_DOWN: {
code_editor->move_lines_down();
} break;
- case EDIT_INDENT_LEFT: {
+ case EDIT_INDENT: {
Ref<Script> scr = script;
if (scr.is_null()) {
return;
}
-
- tx->unindent_lines();
+ tx->indent_lines();
} break;
- case EDIT_INDENT_RIGHT: {
+ case EDIT_UNINDENT: {
Ref<Script> scr = script;
if (scr.is_null()) {
return;
}
-
- tx->indent_lines();
+ tx->unindent_lines();
} break;
case EDIT_DELETE_LINE: {
code_editor->delete_lines();
@@ -1867,8 +1873,8 @@ void ScriptTextEditor::_make_context_menu(bool p_selection, bool p_color, bool p
context_menu->add_shortcut(ED_GET_SHORTCUT("ui_text_select_all"), EDIT_SELECT_ALL);
context_menu->add_separator();
- context_menu->add_shortcut(ED_GET_SHORTCUT("script_text_editor/indent_left"), EDIT_INDENT_LEFT);
- context_menu->add_shortcut(ED_GET_SHORTCUT("script_text_editor/indent_right"), EDIT_INDENT_RIGHT);
+ context_menu->add_shortcut(ED_GET_SHORTCUT("script_text_editor/indent"), EDIT_INDENT);
+ context_menu->add_shortcut(ED_GET_SHORTCUT("script_text_editor/unindent"), EDIT_UNINDENT);
context_menu->add_shortcut(ED_GET_SHORTCUT("script_text_editor/toggle_comment"), EDIT_TOGGLE_COMMENT);
context_menu->add_shortcut(ED_GET_SHORTCUT("script_text_editor/toggle_bookmark"), BOOKMARK_TOGGLE);
@@ -1983,8 +1989,8 @@ void ScriptTextEditor::_enable_code_editor() {
edit_menu->get_popup()->add_separator();
edit_menu->get_popup()->add_shortcut(ED_GET_SHORTCUT("script_text_editor/move_up"), EDIT_MOVE_LINE_UP);
edit_menu->get_popup()->add_shortcut(ED_GET_SHORTCUT("script_text_editor/move_down"), EDIT_MOVE_LINE_DOWN);
- edit_menu->get_popup()->add_shortcut(ED_GET_SHORTCUT("script_text_editor/indent_left"), EDIT_INDENT_LEFT);
- edit_menu->get_popup()->add_shortcut(ED_GET_SHORTCUT("script_text_editor/indent_right"), EDIT_INDENT_RIGHT);
+ edit_menu->get_popup()->add_shortcut(ED_GET_SHORTCUT("script_text_editor/indent"), EDIT_INDENT);
+ edit_menu->get_popup()->add_shortcut(ED_GET_SHORTCUT("script_text_editor/unindent"), EDIT_UNINDENT);
edit_menu->get_popup()->add_shortcut(ED_GET_SHORTCUT("script_text_editor/delete_line"), EDIT_DELETE_LINE);
edit_menu->get_popup()->add_shortcut(ED_GET_SHORTCUT("script_text_editor/toggle_comment"), EDIT_TOGGLE_COMMENT);
edit_menu->get_popup()->add_shortcut(ED_GET_SHORTCUT("script_text_editor/toggle_fold_line"), EDIT_TOGGLE_FOLD_LINE);
@@ -2158,8 +2164,8 @@ void ScriptTextEditor::register_editor() {
// Leave these at zero, same can be accomplished with tab/shift-tab, including selection.
// The next/previous in history shortcut in this case makes a lot more sense.
- ED_SHORTCUT("script_text_editor/indent_left", TTR("Indent Left"), Key::NONE);
- ED_SHORTCUT("script_text_editor/indent_right", TTR("Indent Right"), Key::NONE);
+ ED_SHORTCUT("script_text_editor/indent", TTR("Indent"), Key::NONE);
+ ED_SHORTCUT("script_text_editor/unindent", TTR("Unindent"), KeyModifierMask::SHIFT | Key::TAB);
ED_SHORTCUT("script_text_editor/toggle_comment", TTR("Toggle Comment"), KeyModifierMask::CMD_OR_CTRL | Key::K);
ED_SHORTCUT("script_text_editor/toggle_fold_line", TTR("Fold/Unfold Line"), KeyModifierMask::ALT | Key::F);
ED_SHORTCUT("script_text_editor/fold_all_lines", TTR("Fold All Lines"), Key::NONE);
diff --git a/editor/plugins/script_text_editor.h b/editor/plugins/script_text_editor.h
index 8d2fb98721..99fafb2192 100644
--- a/editor/plugins/script_text_editor.h
+++ b/editor/plugins/script_text_editor.h
@@ -117,8 +117,8 @@ class ScriptTextEditor : public ScriptEditorBase {
EDIT_TOGGLE_COMMENT,
EDIT_MOVE_LINE_UP,
EDIT_MOVE_LINE_DOWN,
- EDIT_INDENT_RIGHT,
- EDIT_INDENT_LEFT,
+ EDIT_INDENT,
+ EDIT_UNINDENT,
EDIT_DELETE_LINE,
EDIT_DUPLICATE_SELECTION,
EDIT_PICK_COLOR,
diff --git a/editor/plugins/shader_editor_plugin.cpp b/editor/plugins/shader_editor_plugin.cpp
index 13aba0a884..2eafa4fc91 100644
--- a/editor/plugins/shader_editor_plugin.cpp
+++ b/editor/plugins/shader_editor_plugin.cpp
@@ -649,17 +649,17 @@ void ShaderEditor::_menu_option(int p_option) {
case EDIT_MOVE_LINE_DOWN: {
shader_editor->move_lines_down();
} break;
- case EDIT_INDENT_LEFT: {
+ case EDIT_INDENT: {
if (shader.is_null()) {
return;
}
- shader_editor->get_text_editor()->unindent_lines();
+ shader_editor->get_text_editor()->indent_lines();
} break;
- case EDIT_INDENT_RIGHT: {
+ case EDIT_UNINDENT: {
if (shader.is_null()) {
return;
}
- shader_editor->get_text_editor()->indent_lines();
+ shader_editor->get_text_editor()->unindent_lines();
} break;
case EDIT_DELETE_LINE: {
shader_editor->delete_lines();
@@ -1039,8 +1039,8 @@ void ShaderEditor::_make_context_menu(bool p_selection, Vector2 p_position) {
context_menu->add_shortcut(ED_GET_SHORTCUT("ui_redo"), EDIT_REDO);
context_menu->add_separator();
- context_menu->add_shortcut(ED_GET_SHORTCUT("script_text_editor/indent_left"), EDIT_INDENT_LEFT);
- context_menu->add_shortcut(ED_GET_SHORTCUT("script_text_editor/indent_right"), EDIT_INDENT_RIGHT);
+ context_menu->add_shortcut(ED_GET_SHORTCUT("script_text_editor/indent"), EDIT_INDENT);
+ context_menu->add_shortcut(ED_GET_SHORTCUT("script_text_editor/unindent"), EDIT_UNINDENT);
context_menu->add_shortcut(ED_GET_SHORTCUT("script_text_editor/toggle_comment"), EDIT_TOGGLE_COMMENT);
context_menu->add_shortcut(ED_GET_SHORTCUT("script_text_editor/toggle_bookmark"), BOOKMARK_TOGGLE);
@@ -1101,8 +1101,8 @@ ShaderEditor::ShaderEditor() {
edit_menu->get_popup()->add_separator();
edit_menu->get_popup()->add_shortcut(ED_GET_SHORTCUT("script_text_editor/move_up"), EDIT_MOVE_LINE_UP);
edit_menu->get_popup()->add_shortcut(ED_GET_SHORTCUT("script_text_editor/move_down"), EDIT_MOVE_LINE_DOWN);
- edit_menu->get_popup()->add_shortcut(ED_GET_SHORTCUT("script_text_editor/indent_left"), EDIT_INDENT_LEFT);
- edit_menu->get_popup()->add_shortcut(ED_GET_SHORTCUT("script_text_editor/indent_right"), EDIT_INDENT_RIGHT);
+ edit_menu->get_popup()->add_shortcut(ED_GET_SHORTCUT("script_text_editor/indent"), EDIT_INDENT);
+ edit_menu->get_popup()->add_shortcut(ED_GET_SHORTCUT("script_text_editor/unindent"), EDIT_UNINDENT);
edit_menu->get_popup()->add_shortcut(ED_GET_SHORTCUT("script_text_editor/delete_line"), EDIT_DELETE_LINE);
edit_menu->get_popup()->add_shortcut(ED_GET_SHORTCUT("script_text_editor/toggle_comment"), EDIT_TOGGLE_COMMENT);
edit_menu->get_popup()->add_shortcut(ED_GET_SHORTCUT("script_text_editor/duplicate_selection"), EDIT_DUPLICATE_SELECTION);
diff --git a/editor/plugins/shader_editor_plugin.h b/editor/plugins/shader_editor_plugin.h
index f48b2fc70e..5188639bfc 100644
--- a/editor/plugins/shader_editor_plugin.h
+++ b/editor/plugins/shader_editor_plugin.h
@@ -127,8 +127,8 @@ class ShaderEditor : public MarginContainer {
EDIT_SELECT_ALL,
EDIT_MOVE_LINE_UP,
EDIT_MOVE_LINE_DOWN,
- EDIT_INDENT_LEFT,
- EDIT_INDENT_RIGHT,
+ EDIT_INDENT,
+ EDIT_UNINDENT,
EDIT_DELETE_LINE,
EDIT_DUPLICATE_SELECTION,
EDIT_TOGGLE_COMMENT,
diff --git a/editor/plugins/text_editor.cpp b/editor/plugins/text_editor.cpp
index 76332b2d10..20809763d0 100644
--- a/editor/plugins/text_editor.cpp
+++ b/editor/plugins/text_editor.cpp
@@ -325,12 +325,12 @@ void TextEditor::_edit_option(int p_op) {
case EDIT_MOVE_LINE_DOWN: {
code_editor->move_lines_down();
} break;
- case EDIT_INDENT_LEFT: {
- tx->unindent_lines();
- } break;
- case EDIT_INDENT_RIGHT: {
+ case EDIT_INDENT: {
tx->indent_lines();
} break;
+ case EDIT_UNINDENT: {
+ tx->unindent_lines();
+ } break;
case EDIT_DELETE_LINE: {
code_editor->delete_lines();
} break;
@@ -493,8 +493,8 @@ void TextEditor::_make_context_menu(bool p_selection, bool p_can_fold, bool p_is
context_menu->add_shortcut(ED_GET_SHORTCUT("ui_undo"), EDIT_UNDO);
context_menu->add_shortcut(ED_GET_SHORTCUT("ui_redo"), EDIT_REDO);
context_menu->add_separator();
- context_menu->add_shortcut(ED_GET_SHORTCUT("script_text_editor/indent_left"), EDIT_INDENT_LEFT);
- context_menu->add_shortcut(ED_GET_SHORTCUT("script_text_editor/indent_right"), EDIT_INDENT_RIGHT);
+ context_menu->add_shortcut(ED_GET_SHORTCUT("script_text_editor/indent"), EDIT_INDENT);
+ context_menu->add_shortcut(ED_GET_SHORTCUT("script_text_editor/unindent"), EDIT_UNINDENT);
context_menu->add_shortcut(ED_GET_SHORTCUT("script_text_editor/toggle_bookmark"), BOOKMARK_TOGGLE);
if (p_selection) {
@@ -574,8 +574,8 @@ TextEditor::TextEditor() {
edit_menu->get_popup()->add_separator();
edit_menu->get_popup()->add_shortcut(ED_GET_SHORTCUT("script_text_editor/move_up"), EDIT_MOVE_LINE_UP);
edit_menu->get_popup()->add_shortcut(ED_GET_SHORTCUT("script_text_editor/move_down"), EDIT_MOVE_LINE_DOWN);
- edit_menu->get_popup()->add_shortcut(ED_GET_SHORTCUT("script_text_editor/indent_left"), EDIT_INDENT_LEFT);
- edit_menu->get_popup()->add_shortcut(ED_GET_SHORTCUT("script_text_editor/indent_right"), EDIT_INDENT_RIGHT);
+ edit_menu->get_popup()->add_shortcut(ED_GET_SHORTCUT("script_text_editor/indent"), EDIT_INDENT);
+ edit_menu->get_popup()->add_shortcut(ED_GET_SHORTCUT("script_text_editor/unindent"), EDIT_UNINDENT);
edit_menu->get_popup()->add_shortcut(ED_GET_SHORTCUT("script_text_editor/delete_line"), EDIT_DELETE_LINE);
edit_menu->get_popup()->add_shortcut(ED_GET_SHORTCUT("script_text_editor/toggle_fold_line"), EDIT_TOGGLE_FOLD_LINE);
edit_menu->get_popup()->add_shortcut(ED_GET_SHORTCUT("script_text_editor/fold_all_lines"), EDIT_FOLD_ALL_LINES);
diff --git a/editor/plugins/text_editor.h b/editor/plugins/text_editor.h
index 15f7c45653..9ee6a39b2e 100644
--- a/editor/plugins/text_editor.h
+++ b/editor/plugins/text_editor.h
@@ -63,8 +63,8 @@ private:
EDIT_CONVERT_INDENT_TO_TABS,
EDIT_MOVE_LINE_UP,
EDIT_MOVE_LINE_DOWN,
- EDIT_INDENT_RIGHT,
- EDIT_INDENT_LEFT,
+ EDIT_INDENT,
+ EDIT_UNINDENT,
EDIT_DELETE_LINE,
EDIT_DUPLICATE_SELECTION,
EDIT_TO_UPPERCASE,
diff --git a/editor/plugins/tiles/tile_data_editors.cpp b/editor/plugins/tiles/tile_data_editors.cpp
index 4d54001b94..d0f8e1f32d 100644
--- a/editor/plugins/tiles/tile_data_editors.cpp
+++ b/editor/plugins/tiles/tile_data_editors.cpp
@@ -1977,6 +1977,7 @@ void TileDataTerrainsEditor::forward_painting_atlas_gui_input(TileAtlasView *p_t
}
}
drag_last_pos = mm->get_position();
+ accept_event();
} else if (drag_type == DRAG_TYPE_PAINT_TERRAIN_BITS) {
int terrain_set = Dictionary(drag_painted_value)["terrain_set"];
int terrain = Dictionary(drag_painted_value)["terrain"];
@@ -2026,14 +2027,15 @@ void TileDataTerrainsEditor::forward_painting_atlas_gui_input(TileAtlasView *p_t
}
}
drag_last_pos = mm->get_position();
+ accept_event();
}
}
Ref<InputEventMouseButton> mb = p_event;
if (mb.is_valid()) {
- if (mb->get_button_index() == MouseButton::LEFT) {
+ if (mb->get_button_index() == MouseButton::LEFT || mb->get_button_index() == MouseButton::RIGHT) {
if (mb->is_pressed()) {
- if (picker_button->is_pressed()) {
+ if (mb->get_button_index() == MouseButton::LEFT && picker_button->is_pressed()) {
Vector2i coords = p_tile_atlas_view->get_atlas_tile_coords_at_pos(mb->get_position());
coords = p_tile_set_atlas_source->get_tile_at_coords(coords);
if (coords != TileSetSource::INVALID_ATLAS_COORDS) {
@@ -2060,6 +2062,7 @@ void TileDataTerrainsEditor::forward_painting_atlas_gui_input(TileAtlasView *p_t
terrain_set_property_editor->update_property();
_update_terrain_selector();
picker_button->set_pressed(false);
+ accept_event();
}
} else {
Vector2i coords = p_tile_atlas_view->get_atlas_tile_coords_at_pos(mb->get_position());
@@ -2071,6 +2074,10 @@ void TileDataTerrainsEditor::forward_painting_atlas_gui_input(TileAtlasView *p_t
int terrain_set = int(dummy_object->get("terrain_set"));
int terrain = int(dummy_object->get("terrain"));
if (terrain_set == -1 || !tile_data || tile_data->get_terrain_set() != terrain_set) {
+ // Paint terrain sets.
+ if (mb->get_button_index() == MouseButton::RIGHT) {
+ terrain_set = -1;
+ }
if (mb->is_ctrl_pressed()) {
// Paint terrain set with rect.
drag_type = DRAG_TYPE_PAINT_TERRAIN_SET_RECT;
@@ -2106,9 +2113,14 @@ void TileDataTerrainsEditor::forward_painting_atlas_gui_input(TileAtlasView *p_t
}
drag_last_pos = mb->get_position();
}
+ accept_event();
} else if (tile_data->get_terrain_set() == terrain_set) {
+ // Paint terrain bits.
+ if (mb->get_button_index() == MouseButton::RIGHT) {
+ terrain = -1;
+ }
if (mb->is_ctrl_pressed()) {
- // Paint terrain set with rect.
+ // Paint terrain bits with rect.
drag_type = DRAG_TYPE_PAINT_TERRAIN_BITS_RECT;
drag_modified.clear();
Dictionary painted_dict;
@@ -2163,6 +2175,7 @@ void TileDataTerrainsEditor::forward_painting_atlas_gui_input(TileAtlasView *p_t
}
drag_last_pos = mb->get_position();
}
+ accept_event();
}
}
} else {
@@ -2190,18 +2203,21 @@ void TileDataTerrainsEditor::forward_painting_atlas_gui_input(TileAtlasView *p_t
for (const TileMapCell &E : edited) {
Vector2i coords = E.get_atlas_coords();
TileData *tile_data = p_tile_set_atlas_source->get_tile_data(coords, 0);
- undo_redo->add_undo_property(p_tile_set_atlas_source, vformat("%d:%d/%d/terrain_set", coords.x, coords.y, E.alternative_tile), tile_data->get_terrain_set());
undo_redo->add_do_property(p_tile_set_atlas_source, vformat("%d:%d/%d/terrain_set", coords.x, coords.y, E.alternative_tile), drag_painted_value);
- undo_redo->add_undo_property(p_tile_set_atlas_source, vformat("%d:%d/%d/terrain", coords.x, coords.y, E.alternative_tile), tile_data->get_terrain());
- for (int i = 0; i < TileSet::CELL_NEIGHBOR_MAX; i++) {
- TileSet::CellNeighbor bit = TileSet::CellNeighbor(i);
- if (tile_data->is_valid_terrain_peering_bit(bit)) {
- undo_redo->add_undo_property(p_tile_set_atlas_source, vformat("%d:%d/%d/terrains_peering_bit/" + String(TileSet::CELL_NEIGHBOR_ENUM_TO_TEXT[i]), coords.x, coords.y, E.alternative_tile), tile_data->get_terrain_peering_bit(bit));
+ undo_redo->add_undo_property(p_tile_set_atlas_source, vformat("%d:%d/%d/terrain_set", coords.x, coords.y, E.alternative_tile), tile_data->get_terrain_set());
+ if (tile_data->get_terrain_set() >= 0) {
+ undo_redo->add_undo_property(p_tile_set_atlas_source, vformat("%d:%d/%d/terrain", coords.x, coords.y, E.alternative_tile), tile_data->get_terrain());
+ for (int i = 0; i < TileSet::CELL_NEIGHBOR_MAX; i++) {
+ TileSet::CellNeighbor bit = TileSet::CellNeighbor(i);
+ if (tile_data->is_valid_terrain_peering_bit(bit)) {
+ undo_redo->add_undo_property(p_tile_set_atlas_source, vformat("%d:%d/%d/terrains_peering_bit/" + String(TileSet::CELL_NEIGHBOR_ENUM_TO_TEXT[i]), coords.x, coords.y, E.alternative_tile), tile_data->get_terrain_peering_bit(bit));
+ }
}
}
}
undo_redo->commit_action(true);
drag_type = DRAG_TYPE_NONE;
+ accept_event();
} else if (drag_type == DRAG_TYPE_PAINT_TERRAIN_SET) {
undo_redo->create_action(TTR("Painting Terrain Set"));
for (KeyValue<TileMapCell, Variant> &E : drag_modified) {
@@ -2209,17 +2225,20 @@ void TileDataTerrainsEditor::forward_painting_atlas_gui_input(TileAtlasView *p_t
Vector2i coords = E.key.get_atlas_coords();
undo_redo->add_do_property(p_tile_set_atlas_source, vformat("%d:%d/%d/terrain_set", coords.x, coords.y, E.key.alternative_tile), drag_painted_value);
undo_redo->add_undo_property(p_tile_set_atlas_source, vformat("%d:%d/%d/terrain_set", coords.x, coords.y, E.key.alternative_tile), dict["terrain_set"]);
- undo_redo->add_undo_property(p_tile_set_atlas_source, vformat("%d:%d/%d/terrain", coords.x, coords.y, E.key.alternative_tile), dict["terrain"]);
- Array array = dict["terrain_peering_bits"];
- for (int i = 0; i < array.size(); i++) {
- TileSet::CellNeighbor bit = TileSet::CellNeighbor(i);
- if (tile_set->is_valid_terrain_peering_bit(dict["terrain_set"], bit)) {
- undo_redo->add_undo_property(p_tile_set_atlas_source, vformat("%d:%d/%d/terrains_peering_bit/" + String(TileSet::CELL_NEIGHBOR_ENUM_TO_TEXT[i]), coords.x, coords.y, E.key.alternative_tile), array[i]);
+ if (int(dict["terrain_set"]) >= 0) {
+ undo_redo->add_undo_property(p_tile_set_atlas_source, vformat("%d:%d/%d/terrain", coords.x, coords.y, E.key.alternative_tile), dict["terrain"]);
+ Array array = dict["terrain_peering_bits"];
+ for (int i = 0; i < array.size(); i++) {
+ TileSet::CellNeighbor bit = TileSet::CellNeighbor(i);
+ if (tile_set->is_valid_terrain_peering_bit(dict["terrain_set"], bit)) {
+ undo_redo->add_undo_property(p_tile_set_atlas_source, vformat("%d:%d/%d/terrains_peering_bit/" + String(TileSet::CELL_NEIGHBOR_ENUM_TO_TEXT[i]), coords.x, coords.y, E.key.alternative_tile), array[i]);
+ }
}
}
}
undo_redo->commit_action(false);
drag_type = DRAG_TYPE_NONE;
+ accept_event();
} else if (drag_type == DRAG_TYPE_PAINT_TERRAIN_BITS) {
Dictionary painted = Dictionary(drag_painted_value);
int terrain_set = int(painted["terrain_set"]);
@@ -2243,6 +2262,7 @@ void TileDataTerrainsEditor::forward_painting_atlas_gui_input(TileAtlasView *p_t
}
undo_redo->commit_action(false);
drag_type = DRAG_TYPE_NONE;
+ accept_event();
} else if (drag_type == DRAG_TYPE_PAINT_TERRAIN_BITS_RECT) {
Dictionary painted = Dictionary(drag_painted_value);
int terrain_set = int(painted["terrain_set"]);
@@ -2312,6 +2332,7 @@ void TileDataTerrainsEditor::forward_painting_atlas_gui_input(TileAtlasView *p_t
}
undo_redo->commit_action(true);
drag_type = DRAG_TYPE_NONE;
+ accept_event();
}
}
}
@@ -2348,6 +2369,7 @@ void TileDataTerrainsEditor::forward_painting_alternatives_gui_input(TileAtlasVi
}
drag_last_pos = mm->get_position();
+ accept_event();
} else if (drag_type == DRAG_TYPE_PAINT_TERRAIN_BITS) {
Dictionary painted = Dictionary(drag_painted_value);
int terrain_set = int(painted["terrain_set"]);
@@ -2400,14 +2422,15 @@ void TileDataTerrainsEditor::forward_painting_alternatives_gui_input(TileAtlasVi
}
}
drag_last_pos = mm->get_position();
+ accept_event();
}
}
Ref<InputEventMouseButton> mb = p_event;
if (mb.is_valid()) {
- if (mb->get_button_index() == MouseButton::LEFT) {
+ if (mb->get_button_index() == MouseButton::LEFT || mb->get_button_index() == MouseButton::RIGHT) {
if (mb->is_pressed()) {
- if (picker_button->is_pressed()) {
+ if (mb->get_button_index() == MouseButton::LEFT && picker_button->is_pressed()) {
Vector3i tile = p_tile_atlas_view->get_alternative_tile_at_pos(mb->get_position());
Vector2i coords = Vector2i(tile.x, tile.y);
int alternative_tile = tile.z;
@@ -2437,6 +2460,7 @@ void TileDataTerrainsEditor::forward_painting_alternatives_gui_input(TileAtlasVi
terrain_set_property_editor->update_property();
_update_terrain_selector();
picker_button->set_pressed(false);
+ accept_event();
}
} else {
int terrain_set = int(dummy_object->get("terrain_set"));
@@ -2446,75 +2470,87 @@ void TileDataTerrainsEditor::forward_painting_alternatives_gui_input(TileAtlasVi
Vector2i coords = Vector2i(tile.x, tile.y);
int alternative_tile = tile.z;
- TileData *tile_data = p_tile_set_atlas_source->get_tile_data(coords, alternative_tile);
+ if (coords != TileSetSource::INVALID_ATLAS_COORDS) {
+ TileData *tile_data = p_tile_set_atlas_source->get_tile_data(coords, alternative_tile);
- if (terrain_set == -1 || !tile_data || tile_data->get_terrain_set() != terrain_set) {
- drag_type = DRAG_TYPE_PAINT_TERRAIN_SET;
- drag_modified.clear();
- drag_painted_value = int(dummy_object->get("terrain_set"));
- if (coords != TileSetSource::INVALID_ATLAS_COORDS) {
- TileMapCell cell;
- cell.source_id = 0;
- cell.set_atlas_coords(coords);
- cell.alternative_tile = alternative_tile;
- Dictionary dict;
- dict["terrain_set"] = tile_data->get_terrain_set();
- Array array;
- for (int i = 0; i < TileSet::CELL_NEIGHBOR_MAX; i++) {
- TileSet::CellNeighbor bit = TileSet::CellNeighbor(i);
- array.push_back(tile_data->is_valid_terrain_peering_bit(bit) ? tile_data->get_terrain_peering_bit(bit) : -1);
+ if (terrain_set == -1 || !tile_data || tile_data->get_terrain_set() != terrain_set) {
+ // Paint terrain sets.
+ if (mb->get_button_index() == MouseButton::RIGHT) {
+ terrain_set = -1;
}
- dict["terrain_peering_bits"] = array;
- drag_modified[cell] = dict;
- tile_data->set_terrain_set(drag_painted_value);
- }
- drag_last_pos = mb->get_position();
- } else if (tile_data->get_terrain_set() == terrain_set) {
- // Paint terrain bits.
- drag_type = DRAG_TYPE_PAINT_TERRAIN_BITS;
- drag_modified.clear();
- Dictionary painted_dict;
- painted_dict["terrain_set"] = terrain_set;
- painted_dict["terrain"] = terrain;
- drag_painted_value = painted_dict;
-
- if (coords != TileSetSource::INVALID_ATLAS_COORDS) {
- TileMapCell cell;
- cell.source_id = 0;
- cell.set_atlas_coords(coords);
- cell.alternative_tile = alternative_tile;
-
- // Save the old terrain_set and terrains bits.
- Dictionary dict;
- dict["terrain_set"] = tile_data->get_terrain_set();
- dict["terrain"] = tile_data->get_terrain();
- Array array;
- for (int i = 0; i < TileSet::CELL_NEIGHBOR_MAX; i++) {
- TileSet::CellNeighbor bit = TileSet::CellNeighbor(i);
- array.push_back(tile_data->is_valid_terrain_peering_bit(bit) ? tile_data->get_terrain_peering_bit(bit) : -1);
+ drag_type = DRAG_TYPE_PAINT_TERRAIN_SET;
+ drag_modified.clear();
+ drag_painted_value = int(dummy_object->get("terrain_set"));
+ if (coords != TileSetSource::INVALID_ATLAS_COORDS) {
+ TileMapCell cell;
+ cell.source_id = 0;
+ cell.set_atlas_coords(coords);
+ cell.alternative_tile = alternative_tile;
+ Dictionary dict;
+ dict["terrain_set"] = tile_data->get_terrain_set();
+ Array array;
+ for (int i = 0; i < TileSet::CELL_NEIGHBOR_MAX; i++) {
+ TileSet::CellNeighbor bit = TileSet::CellNeighbor(i);
+ array.push_back(tile_data->is_valid_terrain_peering_bit(bit) ? tile_data->get_terrain_peering_bit(bit) : -1);
+ }
+ dict["terrain_peering_bits"] = array;
+ drag_modified[cell] = dict;
+ tile_data->set_terrain_set(drag_painted_value);
}
- dict["terrain_peering_bits"] = array;
- drag_modified[cell] = dict;
+ drag_last_pos = mb->get_position();
+ accept_event();
+ } else if (tile_data->get_terrain_set() == terrain_set) {
+ // Paint terrain bits.
+ if (mb->get_button_index() == MouseButton::RIGHT) {
+ terrain = -1;
+ }
+ // Paint terrain bits.
+ drag_type = DRAG_TYPE_PAINT_TERRAIN_BITS;
+ drag_modified.clear();
+ Dictionary painted_dict;
+ painted_dict["terrain_set"] = terrain_set;
+ painted_dict["terrain"] = terrain;
+ drag_painted_value = painted_dict;
- // Set the terrain bit.
- Rect2i texture_region = p_tile_atlas_view->get_alternative_tile_rect(coords, alternative_tile);
- Vector2i position = texture_region.get_center() + p_tile_set_atlas_source->get_tile_effective_texture_offset(coords, alternative_tile);
+ if (coords != TileSetSource::INVALID_ATLAS_COORDS) {
+ TileMapCell cell;
+ cell.source_id = 0;
+ cell.set_atlas_coords(coords);
+ cell.alternative_tile = alternative_tile;
- Vector<Vector2> polygon = tile_set->get_terrain_polygon(terrain_set);
- if (Geometry2D::is_point_in_polygon(mb->get_position() - position, polygon)) {
- tile_data->set_terrain(terrain);
- }
- for (int i = 0; i < TileSet::CELL_NEIGHBOR_MAX; i++) {
- TileSet::CellNeighbor bit = TileSet::CellNeighbor(i);
- if (tile_set->is_valid_terrain_peering_bit(terrain_set, bit)) {
- polygon = tile_set->get_terrain_peering_bit_polygon(terrain_set, bit);
- if (Geometry2D::is_point_in_polygon(mb->get_position() - position, polygon)) {
- tile_data->set_terrain_peering_bit(bit, terrain);
+ // Save the old terrain_set and terrains bits.
+ Dictionary dict;
+ dict["terrain_set"] = tile_data->get_terrain_set();
+ dict["terrain"] = tile_data->get_terrain();
+ Array array;
+ for (int i = 0; i < TileSet::CELL_NEIGHBOR_MAX; i++) {
+ TileSet::CellNeighbor bit = TileSet::CellNeighbor(i);
+ array.push_back(tile_data->is_valid_terrain_peering_bit(bit) ? tile_data->get_terrain_peering_bit(bit) : -1);
+ }
+ dict["terrain_peering_bits"] = array;
+ drag_modified[cell] = dict;
+
+ // Set the terrain bit.
+ Rect2i texture_region = p_tile_atlas_view->get_alternative_tile_rect(coords, alternative_tile);
+ Vector2i position = texture_region.get_center() + p_tile_set_atlas_source->get_tile_effective_texture_offset(coords, alternative_tile);
+
+ Vector<Vector2> polygon = tile_set->get_terrain_polygon(terrain_set);
+ if (Geometry2D::is_point_in_polygon(mb->get_position() - position, polygon)) {
+ tile_data->set_terrain(terrain);
+ }
+ for (int i = 0; i < TileSet::CELL_NEIGHBOR_MAX; i++) {
+ TileSet::CellNeighbor bit = TileSet::CellNeighbor(i);
+ if (tile_set->is_valid_terrain_peering_bit(terrain_set, bit)) {
+ polygon = tile_set->get_terrain_peering_bit_polygon(terrain_set, bit);
+ if (Geometry2D::is_point_in_polygon(mb->get_position() - position, polygon)) {
+ tile_data->set_terrain_peering_bit(bit, terrain);
+ }
}
}
}
+ drag_last_pos = mb->get_position();
+ accept_event();
}
- drag_last_pos = mb->get_position();
}
}
} else {
@@ -2523,16 +2559,19 @@ void TileDataTerrainsEditor::forward_painting_alternatives_gui_input(TileAtlasVi
for (KeyValue<TileMapCell, Variant> &E : drag_modified) {
Dictionary dict = E.value;
Vector2i coords = E.key.get_atlas_coords();
- undo_redo->add_undo_property(p_tile_set_atlas_source, vformat("%d:%d/%d/terrain_set", coords.x, coords.y, E.key.alternative_tile), dict["terrain_set"]);
undo_redo->add_do_property(p_tile_set_atlas_source, vformat("%d:%d/%d/terrain_set", coords.x, coords.y, E.key.alternative_tile), drag_painted_value);
- undo_redo->add_undo_property(p_tile_set_atlas_source, vformat("%d:%d/%d/terrain", coords.x, coords.y, E.key.alternative_tile), dict["terrain"]);
- Array array = dict["terrain_peering_bits"];
- for (int i = 0; i < array.size(); i++) {
- undo_redo->add_undo_property(p_tile_set_atlas_source, vformat("%d:%d/%d/terrains_peering_bit/" + String(TileSet::CELL_NEIGHBOR_ENUM_TO_TEXT[i]), coords.x, coords.y, E.key.alternative_tile), array[i]);
+ undo_redo->add_undo_property(p_tile_set_atlas_source, vformat("%d:%d/%d/terrain_set", coords.x, coords.y, E.key.alternative_tile), dict["terrain_set"]);
+ if (int(dict["terrain_set"]) >= 0) {
+ undo_redo->add_undo_property(p_tile_set_atlas_source, vformat("%d:%d/%d/terrain", coords.x, coords.y, E.key.alternative_tile), dict["terrain"]);
+ Array array = dict["terrain_peering_bits"];
+ for (int i = 0; i < array.size(); i++) {
+ undo_redo->add_undo_property(p_tile_set_atlas_source, vformat("%d:%d/%d/terrains_peering_bit/" + String(TileSet::CELL_NEIGHBOR_ENUM_TO_TEXT[i]), coords.x, coords.y, E.key.alternative_tile), array[i]);
+ }
}
}
undo_redo->commit_action(false);
drag_type = DRAG_TYPE_NONE;
+ accept_event();
} else if (drag_type == DRAG_TYPE_PAINT_TERRAIN_BITS) {
Dictionary painted = Dictionary(drag_painted_value);
int terrain_set = int(painted["terrain_set"]);
@@ -2556,6 +2595,7 @@ void TileDataTerrainsEditor::forward_painting_alternatives_gui_input(TileAtlasVi
}
undo_redo->commit_action(false);
drag_type = DRAG_TYPE_NONE;
+ accept_event();
}
}
}
diff --git a/editor/plugins/visual_shader_editor_plugin.cpp b/editor/plugins/visual_shader_editor_plugin.cpp
index 7c4326cde1..40993ea168 100644
--- a/editor/plugins/visual_shader_editor_plugin.cpp
+++ b/editor/plugins/visual_shader_editor_plugin.cpp
@@ -5246,6 +5246,9 @@ VisualShaderEditor::VisualShaderEditor() {
add_options.push_back(AddOption("Light", "Input/Light", "VisualShaderNodeInput", vformat(input_param_for_light_shader_mode, "light", "LIGHT"), { "light" }, VisualShaderNode::PORT_TYPE_VECTOR_4D, TYPE_FLAGS_LIGHT, Shader::MODE_CANVAS_ITEM));
add_options.push_back(AddOption("LightColor", "Input/Light", "VisualShaderNodeInput", vformat(input_param_for_light_shader_mode, "light_color", "LIGHT_COLOR"), { "light_color" }, VisualShaderNode::PORT_TYPE_VECTOR_4D, TYPE_FLAGS_LIGHT, Shader::MODE_CANVAS_ITEM));
add_options.push_back(AddOption("LightPosition", "Input/Light", "VisualShaderNodeInput", vformat(input_param_for_light_shader_mode, "light_position", "LIGHT_POSITION"), { "light_position" }, VisualShaderNode::PORT_TYPE_VECTOR_3D, TYPE_FLAGS_LIGHT, Shader::MODE_CANVAS_ITEM));
+ add_options.push_back(AddOption("LightDirection", "Input/Light", "VisualShaderNodeInput", vformat(input_param_for_light_shader_mode, "light_direction", "LIGHT_DIRECTION"), { "light_direction" }, VisualShaderNode::PORT_TYPE_VECTOR_3D, TYPE_FLAGS_LIGHT, Shader::MODE_CANVAS_ITEM));
+ add_options.push_back(AddOption("LightIsDirectional", "Input/Light", "VisualShaderNodeInput", vformat(input_param_for_light_shader_mode, "light_is_directional", "LIGHT_IS_DIRECTIONAL"), { "light_is_directional" }, VisualShaderNode::PORT_TYPE_BOOLEAN, TYPE_FLAGS_LIGHT, Shader::MODE_CANVAS_ITEM));
+ add_options.push_back(AddOption("LightEnergy", "Input/Light", "VisualShaderNodeInput", vformat(input_param_for_light_shader_mode, "light_energy", "LIGHT_ENERGY"), { "light_energy" }, VisualShaderNode::PORT_TYPE_SCALAR, TYPE_FLAGS_LIGHT, Shader::MODE_CANVAS_ITEM));
add_options.push_back(AddOption("LightVertex", "Input/Light", "VisualShaderNodeInput", vformat(input_param_for_fragment_and_light_shader_modes, "light_vertex", "LIGHT_VERTEX"), { "light_vertex" }, VisualShaderNode::PORT_TYPE_VECTOR_3D, TYPE_FLAGS_LIGHT, Shader::MODE_CANVAS_ITEM));
add_options.push_back(AddOption("Normal", "Input/Light", "VisualShaderNodeInput", vformat(input_param_for_light_shader_mode, "normal", "NORMAL"), { "normal" }, VisualShaderNode::PORT_TYPE_VECTOR_3D, TYPE_FLAGS_LIGHT, Shader::MODE_CANVAS_ITEM));
add_options.push_back(AddOption("PointCoord", "Input/Light", "VisualShaderNodeInput", vformat(input_param_for_fragment_and_light_shader_modes, "point_coord", "POINT_COORD"), { "point_coord" }, VisualShaderNode::PORT_TYPE_VECTOR_2D, TYPE_FLAGS_LIGHT, Shader::MODE_CANVAS_ITEM));
diff --git a/editor/project_converter_3_to_4.cpp b/editor/project_converter_3_to_4.cpp
index cb76147a56..0c0151d1a5 100644
--- a/editor/project_converter_3_to_4.cpp
+++ b/editor/project_converter_3_to_4.cpp
@@ -283,7 +283,7 @@ static const char *gdscript_function_renames[][2] = {
{ "get_applied_torque", "get_constant_torque" }, //RigidBody2D
{ "get_audio_bus", "get_audio_bus_name" }, // Area3D
{ "get_bound_child_nodes_to_bone", "get_bone_children" }, // Skeleton3D
- { "get_camera", "get_camera_3d" }, // Viewport -> this is also convertable to get_camera_2d, broke GLTFNode
+ { "get_camera", "get_camera_3d" }, // Viewport -> this is also convertible to get_camera_2d, broke GLTFNode
{ "get_cancel", "get_cancel_button" }, // ConfirmationDialog
{ "get_caption", "_get_caption" }, // AnimationNode
{ "get_cast_to", "get_target_position" }, // RayCast2D, RayCast3D
@@ -716,7 +716,7 @@ static const char *csharp_function_renames[][2] = {
{ "GetAppliedTorque", "GetConstantTorque" }, //RigidBody2D
{ "GetAudioBus", "GetAudioBusName" }, // Area3D
{ "GetBoundChildNodesToBone", "GetBoneChildren" }, // Skeleton3D
- { "GetCamera", "GetCamera3d" }, // Viewport -> this is also convertable to getCamera2d, broke GLTFNode
+ { "GetCamera", "GetCamera3d" }, // Viewport -> this is also convertible to getCamera2d, broke GLTFNode
{ "GetCancel", "GetCancelButton" }, // ConfirmationDialog
{ "GetCaption", "_GetCaption" }, // AnimationNode
{ "GetCastTo", "GetTargetPosition" }, // RayCast2D, RayCast3D
@@ -1728,6 +1728,7 @@ public:
RegEx reg_json_to = RegEx("\\bto_json\\b");
RegEx reg_json_parse = RegEx("([\t ]{0,})([^\n]+)parse_json\\(([^\n]+)");
RegEx reg_json_non_new = RegEx("([\t ]{0,})([^\n]+)JSON\\.parse\\(([^\n]+)");
+ RegEx reg_json_print = RegEx("\\bJSON\\b\\.print\\(");
RegEx reg_export = RegEx("export\\(([a-zA-Z0-9_]+)\\)[ ]+var[ ]+([a-zA-Z0-9_]+)");
RegEx reg_export_advanced = RegEx("export\\(([^)^\n]+)\\)[ ]+var[ ]+([a-zA-Z0-9_]+)([^\n]+)");
RegEx reg_setget_setget = RegEx("var[ ]+([a-zA-Z0-9_]+)([^\n]+)setget[ \t]+([a-zA-Z0-9_]+)[ \t]*,[ \t]*([a-zA-Z0-9_]+)");
@@ -3060,7 +3061,7 @@ void ProjectConverter3To4::process_gdscript_line(String &line, const RegExContai
// -- \t.func() -> \tsuper.func() Object
if (line.contains("(") && line.contains(".")) {
- line = reg_container.reg_super.sub(line, "$1super.$2", true); // TODO, not sure if possible, but for now this broke String text e.g. "Choosen .gitignore" -> "Choosen super.gitignore"
+ line = reg_container.reg_super.sub(line, "$1super.$2", true); // TODO, not sure if possible, but for now this broke String text e.g. "Chosen .gitignore" -> "Chosen super.gitignore"
}
// -- JSON.parse(a) -> JSON.new().parse(a) etc. JSON
@@ -3076,6 +3077,10 @@ void ProjectConverter3To4::process_gdscript_line(String &line, const RegExContai
if (line.contains("parse_json")) {
line = reg_container.reg_json_parse.sub(line, "$1var test_json_conv = JSON.new()\n$1test_json_conv.parse($3\n$1$2test_json_conv.get_data()", true);
}
+ // -- JSON.print( -> JSON.stringify(
+ if (line.contains("JSON.print(")) {
+ line = reg_container.reg_json_print.sub(line, "JSON.stringify(", true);
+ }
// -- get_node(@ -> get_node( Node
if (line.contains("get_node")) {
@@ -3607,6 +3612,9 @@ void ProjectConverter3To4::process_gdscript_line(String &line, const RegExContai
if (line.contains("OS.get_unix_time")) {
line = line.replace("OS.get_unix_time", "Time.get_unix_time_from_system");
}
+ if (line.contains("OS.get_datetime")) {
+ line = line.replace("OS.get_datetime", "Time.get_datetime_dict_from_system");
+ }
}
void ProjectConverter3To4::process_csharp_line(String &line, const RegExContainer &reg_container) {
diff --git a/editor/translations/extract.py b/editor/translations/extract.py
index 07026baee2..cecdb3939d 100755
--- a/editor/translations/extract.py
+++ b/editor/translations/extract.py
@@ -8,6 +8,7 @@ import re
import shutil
import subprocess
import sys
+from typing import Dict, Tuple
class Message:
@@ -42,7 +43,7 @@ class Message:
return "\n".join(lines)
-messages_map = {} # (id, context) -> Message.
+messages_map: Dict[Tuple[str, str], Message] = {} # (id, context) -> Message.
line_nb = False
@@ -51,11 +52,11 @@ for arg in sys.argv[1:]:
print("Enabling line numbers in the context locations.")
line_nb = True
else:
- os.sys.exit("Non supported argument '" + arg + "'. Aborting.")
+ sys.exit("Non supported argument '" + arg + "'. Aborting.")
if not os.path.exists("editor"):
- os.sys.exit("ERROR: This script should be started from the root of the git repo.")
+ sys.exit("ERROR: This script should be started from the root of the git repo.")
matches = []
diff --git a/gles3_builders.py b/gles3_builders.py
index eafe503dd5..84f11532e0 100644
--- a/gles3_builders.py
+++ b/gles3_builders.py
@@ -3,6 +3,10 @@
All such functions are invoked in a subprocess on Windows to prevent build flakiness.
"""
+import os.path
+
+from typing import Optional
+
from platform_methods import subprocess_main
@@ -30,7 +34,7 @@ class GLES3HeaderStruct:
self.specialization_values = []
-def include_file_in_gles3_header(filename, header_data, depth):
+def include_file_in_gles3_header(filename: str, header_data: GLES3HeaderStruct, depth: int):
fs = open(filename, "r")
line = fs.readline()
@@ -91,8 +95,6 @@ def include_file_in_gles3_header(filename, header_data, depth):
while line.find("#include ") != -1:
includeline = line.replace("#include ", "").strip()[1:-1]
- import os.path
-
included_file = os.path.relpath(os.path.dirname(filename) + "/" + includeline)
if not included_file in header_data.vertex_included_files and header_data.reading == "vertex":
header_data.vertex_included_files += [included_file]
@@ -182,7 +184,7 @@ def include_file_in_gles3_header(filename, header_data, depth):
return header_data
-def build_gles3_header(filename, include, class_suffix, header_data=None):
+def build_gles3_header(filename: str, include: str, class_suffix: str, header_data: Optional[GLES3HeaderStruct] = None):
header_data = header_data or GLES3HeaderStruct()
include_file_in_gles3_header(filename, header_data, 0)
diff --git a/glsl_builders.py b/glsl_builders.py
index 8cb5807f21..888f541cf4 100644
--- a/glsl_builders.py
+++ b/glsl_builders.py
@@ -4,13 +4,15 @@ All such functions are invoked in a subprocess on Windows to prevent build flaki
"""
import os.path
+from typing import Optional, Iterable
+
from platform_methods import subprocess_main
-def generate_inline_code(input_lines, insert_newline=True):
+def generate_inline_code(input_lines: Iterable[str], insert_newline: bool = True):
"""Take header data and generate inline code
- :param: list input_lines: values for shared inline code
+ :param: input_lines: values for shared inline code
:return: str - generated inline value
"""
output = []
@@ -40,7 +42,7 @@ class RDHeaderStruct:
self.compute_offset = 0
-def include_file_in_rd_header(filename, header_data, depth):
+def include_file_in_rd_header(filename: str, header_data: RDHeaderStruct, depth: int) -> RDHeaderStruct:
fs = open(filename, "r")
line = fs.readline()
@@ -112,7 +114,7 @@ def include_file_in_rd_header(filename, header_data, depth):
return header_data
-def build_rd_header(filename, header_data=None):
+def build_rd_header(filename: str, header_data: Optional[RDHeaderStruct] = None) -> None:
header_data = header_data or RDHeaderStruct()
include_file_in_rd_header(filename, header_data, 0)
@@ -171,7 +173,7 @@ class RAWHeaderStruct:
self.code = ""
-def include_file_in_raw_header(filename, header_data, depth):
+def include_file_in_raw_header(filename: str, header_data: RAWHeaderStruct, depth: int) -> None:
fs = open(filename, "r")
line = fs.readline()
@@ -191,7 +193,7 @@ def include_file_in_raw_header(filename, header_data, depth):
fs.close()
-def build_raw_header(filename, header_data=None):
+def build_raw_header(filename: str, header_data: Optional[RAWHeaderStruct] = None):
header_data = header_data or RAWHeaderStruct()
include_file_in_raw_header(filename, header_data, 0)
diff --git a/main/main.cpp b/main/main.cpp
index aac77c1625..28a73ce585 100644
--- a/main/main.cpp
+++ b/main/main.cpp
@@ -710,6 +710,7 @@ Error Main::setup(const char *execpath, int argc, char *argv[], bool p_second_ph
bool force_res = false;
String default_renderer = "";
+ String default_renderer_mobile = "";
String renderer_hints = "";
packed_data = PackedData::get_singleton();
@@ -1517,6 +1518,7 @@ Error Main::setup(const char *execpath, int argc, char *argv[], bool p_second_ph
// Start with RenderingDevice-based backends. Should be included if any RD driver present.
#ifdef VULKAN_ENABLED
renderer_hints = "forward_plus,mobile";
+ default_renderer_mobile = "mobile";
#endif
// And Compatibility next, or first if Vulkan is disabled.
@@ -1525,6 +1527,9 @@ Error Main::setup(const char *execpath, int argc, char *argv[], bool p_second_ph
renderer_hints += ",";
}
renderer_hints += "gl_compatibility";
+ if (default_renderer_mobile.is_empty()) {
+ default_renderer_mobile = "gl_compatibility";
+ }
#endif
if (renderer_hints.is_empty()) {
ERR_PRINT("No renderers available.");
@@ -1616,7 +1621,7 @@ Error Main::setup(const char *execpath, int argc, char *argv[], bool p_second_ph
default_renderer = renderer_hints.get_slice(",", 0);
GLOBAL_DEF_RST_BASIC("rendering/renderer/rendering_method", default_renderer);
- GLOBAL_DEF_RST_BASIC("rendering/renderer/rendering_method.mobile", default_renderer);
+ GLOBAL_DEF_RST_BASIC("rendering/renderer/rendering_method.mobile", default_renderer_mobile);
GLOBAL_DEF_RST_BASIC("rendering/renderer/rendering_method.web", "gl_compatibility"); // This is a bit of a hack until we have WebGPU support.
ProjectSettings::get_singleton()->set_custom_property_info("rendering/renderer/rendering_method",
diff --git a/methods.py b/methods.py
index 43aa3cf46c..dadac37cb5 100644
--- a/methods.py
+++ b/methods.py
@@ -1,6 +1,5 @@
import os
import re
-import sys
import glob
import subprocess
from collections import OrderedDict
@@ -59,7 +58,7 @@ def disable_warnings(self):
def force_optimization_on_debug(self):
# 'self' is the environment
- if self["target"] != "debug":
+ if self["target"] != "template-release":
return
if self.msvc:
@@ -663,7 +662,6 @@ def detect_visual_c_compiler_version(tools_env):
if vc_x86_amd64_compiler_detection_index > -1 and (
vc_chosen_compiler_index == -1 or vc_chosen_compiler_index > vc_x86_amd64_compiler_detection_index
):
- vc_chosen_compiler_index = vc_x86_amd64_compiler_detection_index
vc_chosen_compiler_str = "x86_amd64"
return vc_chosen_compiler_str
@@ -737,20 +735,19 @@ def generate_vs_project(env, num_jobs):
if batch_file:
class ModuleConfigs(Mapping):
- # This version information (Win32, x64, Debug, Release, Release_Debug seems to be
+ # This version information (Win32, x64, Debug, Release) seems to be
# required for Visual Studio to understand that it needs to generate an NMAKE
# project. Do not modify without knowing what you are doing.
PLATFORMS = ["Win32", "x64"]
PLATFORM_IDS = ["x86_32", "x86_64"]
- CONFIGURATIONS = ["debug", "release", "release_debug"]
- CONFIGURATION_IDS = ["tools", "opt", "opt.tools"]
+ CONFIGURATIONS = ["editor", "template_release", "template_debug"]
+ DEV_SUFFIX = ["", ".dev"]
@staticmethod
def for_every_variant(value):
return [value for _ in range(len(ModuleConfigs.CONFIGURATIONS) * len(ModuleConfigs.PLATFORMS))]
def __init__(self):
-
shared_targets_array = []
self.names = []
self.arg_dict = {
@@ -779,16 +776,16 @@ def generate_vs_project(env, num_jobs):
for platform in ModuleConfigs.PLATFORMS
]
self.arg_dict["runfile"] += [
- f'bin\\godot.windows.{config_id}.{plat_id}{f".{name}" if name else ""}.exe'
- for config_id in ModuleConfigs.CONFIGURATION_IDS
+ f'bin\\godot.windows.{config}{dev}.{plat_id}{f".{name}" if name else ""}.exe'
+ for config in ModuleConfigs.CONFIGURATIONS
for plat_id in ModuleConfigs.PLATFORM_IDS
+ for dev in ModuleConfigs.DEV_SUFFIX
]
self.arg_dict["cpppaths"] += ModuleConfigs.for_every_variant(env["CPPPATH"] + [includes])
self.arg_dict["cppdefines"] += ModuleConfigs.for_every_variant(env["CPPDEFINES"] + defines)
self.arg_dict["cmdargs"] += ModuleConfigs.for_every_variant(cli_args)
def build_commandline(self, commands):
-
configuration_getter = (
"$(Configuration"
+ "".join([f'.Replace("{name}", "")' for name in self.names[1:]])
@@ -799,8 +796,6 @@ def generate_vs_project(env, num_jobs):
common_build_prefix = [
'cmd /V /C set "plat=$(PlatformTarget)"',
'(if "$(PlatformTarget)"=="x64" (set "plat=x86_amd64"))',
- 'set "tools=%s"' % env["tools"],
- f'(if "{configuration_getter}"=="release" (set "tools=no"))',
'call "' + batch_file + '" !plat!',
]
@@ -813,10 +808,12 @@ def generate_vs_project(env, num_jobs):
"platform=windows",
f"target={configuration_getter}",
"progress=no",
- "tools=!tools!",
"-j%s" % num_jobs,
]
+ if env["dev_build"]:
+ common_build_postfix.append("dev_build=yes")
+
if env["tests"]:
common_build_postfix.append("tests=yes")
@@ -846,7 +843,7 @@ def generate_vs_project(env, num_jobs):
add_to_vs_project(env, env.servers_sources)
if env["tests"]:
add_to_vs_project(env, env.tests_sources)
- if env["tools"]:
+ if env.editor_build:
add_to_vs_project(env, env.editor_sources)
for header in glob_recursive("**/*.h"):
@@ -855,7 +852,7 @@ def generate_vs_project(env, num_jobs):
module_configs = ModuleConfigs()
if env.get("module_mono_enabled"):
- mono_defines = [("GD_MONO_HOT_RELOAD",)] if env["tools"] else []
+ mono_defines = [("GD_MONO_HOT_RELOAD",)] if env.editor_build else []
module_configs.add_mode(
"mono",
cli_args="module_mono_enabled=yes",
diff --git a/misc/dist/html/editor.html b/misc/dist/html/editor.html
index ac00270d50..c9f3c2cc0d 100644
--- a/misc/dist/html/editor.html
+++ b/misc/dist/html/editor.html
@@ -411,7 +411,7 @@
}
}
//]]></script>
- <script src="godot.tools.js"></script>
+ <script src="godot.editor.js"></script>
<script>//<![CDATA[
var editor = null;
@@ -706,7 +706,7 @@
displayFailureNotice('WebGL not available');
} else {
setStatusMode('indeterminate');
- editor.init('godot.tools').then(function() {
+ editor.init('godot.editor').then(function() {
if (zip) {
editor.copyToFS("/tmp/preload.zip", zip);
}
diff --git a/misc/dist/html/manifest.json b/misc/dist/html/manifest.json
index ccfb793b20..75af81cda1 100644
--- a/misc/dist/html/manifest.json
+++ b/misc/dist/html/manifest.json
@@ -3,7 +3,7 @@
"short_name": "Godot",
"description": "Multi-platform 2D and 3D game engine with a feature-rich editor (Web edition)",
"lang": "en",
- "start_url": "./godot.tools.html",
+ "start_url": "./godot.editor.html",
"display": "standalone",
"theme_color": "#202531",
"icons": [
diff --git a/misc/scripts/codespell.sh b/misc/scripts/codespell.sh
index f99c5d22b2..4cc01ec637 100755
--- a/misc/scripts/codespell.sh
+++ b/misc/scripts/codespell.sh
@@ -1,5 +1,5 @@
#!/bin/sh
SKIP_LIST="./thirdparty,*.gen.*,*.po,*.pot,package-lock.json,./core/string/locales.h,./DONORS.md,./misc/dist/linux/org.godotengine.Godot.desktop,./misc/scripts/codespell.sh"
-IGNORE_LIST="ba,childs,complies,curvelinear,expct,fave,findn,gird,inout,lod,nd,numer,ois,ro,statics,te,varius,varn"
+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"
codespell -w -q 3 -S "${SKIP_LIST}" -L "${IGNORE_LIST}"
diff --git a/misc/scripts/mypy.ini b/misc/scripts/mypy.ini
new file mode 100644
index 0000000000..c1ea695ca5
--- /dev/null
+++ b/misc/scripts/mypy.ini
@@ -0,0 +1,11 @@
+[mypy]
+ignore_missing_imports = true
+disallow_any_generics = True
+pretty = True
+show_column_numbers = True
+warn_redundant_casts = True
+warn_return_any = True
+warn_unreachable = True
+
+namespace_packages = True
+explicit_package_bases = True
diff --git a/misc/scripts/mypy_check.sh b/misc/scripts/mypy_check.sh
new file mode 100755
index 0000000000..2a06486d67
--- /dev/null
+++ b/misc/scripts/mypy_check.sh
@@ -0,0 +1,6 @@
+#!/usr/bin/env bash
+
+set -uo pipefail
+
+echo -e "Python: mypy static analysis..."
+mypy --config-file=./misc/scripts/mypy.ini .
diff --git a/modules/basis_universal/SCsub b/modules/basis_universal/SCsub
index a44a7f0db3..161b0f3814 100644
--- a/modules/basis_universal/SCsub
+++ b/modules/basis_universal/SCsub
@@ -40,12 +40,12 @@ if not env.msvc:
else:
env_basisu.Prepend(CPPPATH=[thirdparty_dir])
-if env["target"] == "debug":
+if env.dev_build:
env_basisu.Append(CPPDEFINES=[("BASISU_DEVEL_MESSAGES", 1), ("BASISD_ENABLE_DEBUG_FLAGS", 1)])
env_thirdparty = env_basisu.Clone()
env_thirdparty.disable_warnings()
-if env["tools"]:
+if env.editor_build:
env_thirdparty.Append(CPPDEFINES=["BASISU_NO_IMG_LOADERS"])
env_thirdparty.add_source_files(thirdparty_obj, encoder_sources)
env_thirdparty.add_source_files(thirdparty_obj, transcoder_sources)
diff --git a/modules/csg/SCsub b/modules/csg/SCsub
index 55f859db11..1cf9974fc1 100644
--- a/modules/csg/SCsub
+++ b/modules/csg/SCsub
@@ -7,5 +7,5 @@ env_csg = env_modules.Clone()
# Godot source files
env_csg.add_source_files(env.modules_sources, "*.cpp")
-if env["tools"]:
+if env.editor_build:
env_csg.add_source_files(env.modules_sources, "editor/*.cpp")
diff --git a/modules/cvtt/config.py b/modules/cvtt/config.py
index 53b8f2f2e3..eb565b85b9 100644
--- a/modules/cvtt/config.py
+++ b/modules/cvtt/config.py
@@ -1,5 +1,5 @@
def can_build(env, platform):
- return env["tools"]
+ return env.editor_build
def configure(env):
diff --git a/modules/denoise/config.py b/modules/denoise/config.py
index 20a5e1da2f..27d2ffbf86 100644
--- a/modules/denoise/config.py
+++ b/modules/denoise/config.py
@@ -5,7 +5,7 @@ def can_build(env, platform):
# as doing lightmap generation and denoising on Android or Web
# would be a bit far-fetched.
desktop_platforms = ["linuxbsd", "macos", "windows"]
- return env["tools"] and platform in desktop_platforms and env["arch"] == "x86_64"
+ return env.editor_build and platform in desktop_platforms and env["arch"] == "x86_64"
def configure(env):
diff --git a/modules/etcpak/config.py b/modules/etcpak/config.py
index 53b8f2f2e3..eb565b85b9 100644
--- a/modules/etcpak/config.py
+++ b/modules/etcpak/config.py
@@ -1,5 +1,5 @@
def can_build(env, platform):
- return env["tools"]
+ return env.editor_build
def configure(env):
diff --git a/modules/freetype/SCsub b/modules/freetype/SCsub
index 2680479acc..0b86bc569f 100644
--- a/modules/freetype/SCsub
+++ b/modules/freetype/SCsub
@@ -90,7 +90,7 @@ if env["builtin_freetype"]:
env.Prepend(CPPPATH=[thirdparty_dir + "/include"])
env_freetype.Append(CPPDEFINES=["FT2_BUILD_LIBRARY", "FT_CONFIG_OPTION_USE_PNG", "FT_CONFIG_OPTION_SYSTEM_ZLIB"])
- if env["target"] == "debug":
+ if env.dev_build:
env_freetype.Append(CPPDEFINES=["ZLIB_DEBUG"])
# Also requires libpng headers
diff --git a/modules/gdscript/SCsub b/modules/gdscript/SCsub
index 2f507db548..1dc4768186 100644
--- a/modules/gdscript/SCsub
+++ b/modules/gdscript/SCsub
@@ -7,7 +7,7 @@ env_gdscript = env_modules.Clone()
env_gdscript.add_source_files(env.modules_sources, "*.cpp")
-if env["tools"]:
+if env.editor_build:
env_gdscript.add_source_files(env.modules_sources, "./editor/*.cpp")
SConscript("editor/script_templates/SCsub")
diff --git a/modules/gdscript/doc_classes/@GDScript.xml b/modules/gdscript/doc_classes/@GDScript.xml
index a0855b75f4..d0b4632ebe 100644
--- a/modules/gdscript/doc_classes/@GDScript.xml
+++ b/modules/gdscript/doc_classes/@GDScript.xml
@@ -450,7 +450,7 @@
<param index="1" name="prefix" type="String" default="&quot;&quot;" />
<description>
Define a new group for the following exported properties. This helps to organize properties in the Inspector dock. Groups can be added with an optional [param prefix], which would make group to only consider properties that have this prefix. The grouping will break on the first property that doesn't have a prefix. The prefix is also removed from the property's name in the Inspector dock.
- If no [param prefix] is provided, the every following property is added to the group. The group ends when then next group or category is defined. You can also force end a group by using this annotation with empty strings for paramters, [code]@export_group("", "")[/code].
+ If no [param prefix] is provided, the every following property is added to the group. The group ends when then next group or category is defined. You can also force end a group by using this annotation with empty strings for parameters, [code]@export_group("", "")[/code].
Groups cannot be nested, use [annotation @export_subgroup] to add subgroups to your groups.
See also [constant PROPERTY_USAGE_GROUP].
[codeblock]
diff --git a/modules/gdscript/gdscript_parser.cpp b/modules/gdscript/gdscript_parser.cpp
index b4da94e448..f1c841e9dc 100644
--- a/modules/gdscript/gdscript_parser.cpp
+++ b/modules/gdscript/gdscript_parser.cpp
@@ -2937,6 +2937,10 @@ GDScriptParser::ExpressionNode *GDScriptParser::parse_call(ExpressionNode *p_pre
push_error(R"(Expected expression as the function argument.)");
} else {
call->arguments.push_back(argument);
+
+ if (argument->type == Node::IDENTIFIER && current.cursor_place == GDScriptTokenizer::CURSOR_BEGINNING) {
+ completion_context.type = COMPLETION_IDENTIFIER;
+ }
}
ct = COMPLETION_CALL_ARGUMENTS;
} while (match(GDScriptTokenizer::Token::COMMA));
diff --git a/modules/gltf/SCsub b/modules/gltf/SCsub
index 5f111165fd..d1f337715f 100644
--- a/modules/gltf/SCsub
+++ b/modules/gltf/SCsub
@@ -9,5 +9,5 @@ env_gltf = env_modules.Clone()
env_gltf.add_source_files(env.modules_sources, "*.cpp")
env_gltf.add_source_files(env.modules_sources, "structures/*.cpp")
SConscript("extensions/SCsub")
-if env["tools"]:
+if env.editor_build:
env_gltf.add_source_files(env.modules_sources, "editor/*.cpp")
diff --git a/modules/gltf/editor/editor_scene_importer_blend.cpp b/modules/gltf/editor/editor_scene_importer_blend.cpp
index ab52761e17..f79731dd22 100644
--- a/modules/gltf/editor/editor_scene_importer_blend.cpp
+++ b/modules/gltf/editor/editor_scene_importer_blend.cpp
@@ -261,7 +261,7 @@ void EditorSceneFormatImporterBlend::get_import_options(const String &p_path, Li
#define ADD_OPTION_ENUM(PATH, ENUM_HINT, VALUE) \
r_options->push_back(ResourceImporter::ImportOption(PropertyInfo(Variant::INT, SNAME(PATH), PROPERTY_HINT_ENUM, ENUM_HINT), VALUE));
- ADD_OPTION_ENUM("blender/nodes/visible", "Visible Only,Renderable,All", BLEND_VISIBLE_ALL);
+ ADD_OPTION_ENUM("blender/nodes/visible", "All,Visible Only,Renderable", BLEND_VISIBLE_ALL);
ADD_OPTION_BOOL("blender/nodes/punctual_lights", true);
ADD_OPTION_BOOL("blender/nodes/cameras", true);
ADD_OPTION_BOOL("blender/nodes/custom_properties", true);
diff --git a/modules/gltf/editor/editor_scene_importer_blend.h b/modules/gltf/editor/editor_scene_importer_blend.h
index dd1c1b9889..a1485ff82e 100644
--- a/modules/gltf/editor/editor_scene_importer_blend.h
+++ b/modules/gltf/editor/editor_scene_importer_blend.h
@@ -45,9 +45,9 @@ class EditorSceneFormatImporterBlend : public EditorSceneFormatImporter {
public:
enum {
+ BLEND_VISIBLE_ALL,
BLEND_VISIBLE_VISIBLE_ONLY,
- BLEND_VISIBLE_RENDERABLE,
- BLEND_VISIBLE_ALL
+ BLEND_VISIBLE_RENDERABLE
};
enum {
BLEND_BONE_INFLUENCES_NONE,
diff --git a/modules/gridmap/SCsub b/modules/gridmap/SCsub
index da3f7d4dd9..282d772592 100644
--- a/modules/gridmap/SCsub
+++ b/modules/gridmap/SCsub
@@ -7,5 +7,5 @@ env_gridmap = env_modules.Clone()
# Godot source files
env_gridmap.add_source_files(env.modules_sources, "*.cpp")
-if env["tools"]:
+if env.editor_build:
env_gridmap.add_source_files(env.modules_sources, "editor/*.cpp")
diff --git a/modules/gridmap/doc_classes/GridMap.xml b/modules/gridmap/doc_classes/GridMap.xml
index ed6cb8656a..0f3662c3cf 100644
--- a/modules/gridmap/doc_classes/GridMap.xml
+++ b/modules/gridmap/doc_classes/GridMap.xml
@@ -57,7 +57,7 @@
<return type="Basis" />
<param index="0" name="position" type="Vector3i" />
<description>
- Returns the basis that gives the specificed cell its orientation.
+ Returns the basis that gives the specified cell its orientation.
</description>
</method>
<method name="get_cell_item_orientation" qualifiers="const">
diff --git a/modules/mono/SCsub b/modules/mono/SCsub
index 7764ba0b45..a4667f784d 100644
--- a/modules/mono/SCsub
+++ b/modules/mono/SCsub
@@ -26,6 +26,6 @@ if env["platform"] in ["macos", "ios"]:
elif env["platform"] == "android":
env_mono.add_source_files(env.modules_sources, "mono_gd/android_mono_config.gen.cpp")
-if env["tools"]:
+if env.editor_build:
env_mono.add_source_files(env.modules_sources, "editor/*.cpp")
SConscript("editor/script_templates/SCsub")
diff --git a/modules/mono/build_scripts/build_assemblies.py b/modules/mono/build_scripts/build_assemblies.py
index d78a9c7db8..d28c3a0c3a 100755
--- a/modules/mono/build_scripts/build_assemblies.py
+++ b/modules/mono/build_scripts/build_assemblies.py
@@ -5,6 +5,7 @@ import os.path
import shlex
import subprocess
from dataclasses import dataclass
+from typing import Optional, List
def find_dotnet_cli():
@@ -150,10 +151,7 @@ def find_any_msbuild_tool(mono_prefix):
return None
-def run_msbuild(tools: ToolsLocation, sln: str, msbuild_args: [str] = None):
- if msbuild_args is None:
- msbuild_args = []
-
+def run_msbuild(tools: ToolsLocation, sln: str, msbuild_args: Optional[List[str]] = None):
using_msbuild_mono = False
# Preference order: dotnet CLI > Standalone MSBuild > Mono's MSBuild
@@ -169,7 +167,7 @@ def run_msbuild(tools: ToolsLocation, sln: str, msbuild_args: [str] = None):
args += [sln]
- if len(msbuild_args) > 0:
+ if msbuild_args:
args += msbuild_args
print("Running MSBuild: ", " ".join(shlex.quote(arg) for arg in args), flush=True)
diff --git a/modules/mono/build_scripts/mono_configure.py b/modules/mono/build_scripts/mono_configure.py
index 5d63773096..5cec8f41f5 100644
--- a/modules/mono/build_scripts/mono_configure.py
+++ b/modules/mono/build_scripts/mono_configure.py
@@ -20,10 +20,7 @@ def configure(env, env_mono):
# is_ios = env["platform"] == "ios"
# is_ios_sim = is_ios and env["arch"] in ["x86_32", "x86_64"]
- tools_enabled = env["tools"]
-
- if tools_enabled and not module_supports_tools_on(env["platform"]):
- raise RuntimeError("This module does not currently support building for this platform with tools enabled")
-
- if env["tools"]:
+ if env.editor_build:
+ if not module_supports_tools_on(env["platform"]):
+ raise RuntimeError("This module does not currently support building for this platform for editor builds.")
env_mono.Append(CPPDEFINES=["GD_MONO_HOT_RELOAD"])
diff --git a/modules/mono/config.py b/modules/mono/config.py
index 15fe79ef8c..a36083b64b 100644
--- a/modules/mono/config.py
+++ b/modules/mono/config.py
@@ -7,7 +7,7 @@ def can_build(env, platform):
if env["arch"].startswith("rv"):
return False
- if env["tools"]:
+ if env.editor_build:
env.module_add_dependencies("mono", ["regex"])
return True
diff --git a/modules/mono/editor/Godot.NET.Sdk/Godot.SourceGenerators/ScriptSignalsGenerator.cs b/modules/mono/editor/Godot.NET.Sdk/Godot.SourceGenerators/ScriptSignalsGenerator.cs
index eeda1042ca..ea7cc3fe38 100644
--- a/modules/mono/editor/Godot.NET.Sdk/Godot.SourceGenerators/ScriptSignalsGenerator.cs
+++ b/modules/mono/editor/Godot.NET.Sdk/Godot.SourceGenerators/ScriptSignalsGenerator.cs
@@ -7,7 +7,7 @@ using Microsoft.CodeAnalysis.Text;
// TODO:
// Determine a proper way to emit the signal.
-// 'Emit(nameof(TheEvent))' creates a StringName everytime and has the overhead of string marshaling.
+// 'Emit(nameof(TheEvent))' creates a StringName every time and has the overhead of string marshaling.
// I haven't decided on the best option yet. Some possibilities:
// - Expose the generated StringName fields to the user, for use with 'Emit(...)'.
// - Generate a 'EmitSignalName' method for each event signal.
diff --git a/modules/mono/glue/GodotSharp/GodotSharp/Core/Callable.cs b/modules/mono/glue/GodotSharp/GodotSharp/Core/Callable.cs
index 1b7f5158fd..bdedd2e87a 100644
--- a/modules/mono/glue/GodotSharp/GodotSharp/Core/Callable.cs
+++ b/modules/mono/glue/GodotSharp/GodotSharp/Core/Callable.cs
@@ -72,7 +72,7 @@ namespace Godot
/// <param name="delegate">Delegate method that will be called.</param>
public Callable(Delegate @delegate)
{
- _target = null;
+ _target = @delegate?.Target as Object;
_method = null;
_delegate = @delegate;
}
diff --git a/modules/mono/glue/GodotSharp/GodotSharp/Core/NativeInterop/Marshaling.cs b/modules/mono/glue/GodotSharp/GodotSharp/Core/NativeInterop/Marshaling.cs
index 140fc167ba..76b186cd15 100644
--- a/modules/mono/glue/GodotSharp/GodotSharp/Core/NativeInterop/Marshaling.cs
+++ b/modules/mono/glue/GodotSharp/GodotSharp/Core/NativeInterop/Marshaling.cs
@@ -721,8 +721,9 @@ namespace Godot.NativeInterop
if (p_managed_callable.Delegate != null)
{
var gcHandle = CustomGCHandle.AllocStrong(p_managed_callable.Delegate);
+ IntPtr objectPtr = p_managed_callable.Target != null ? Object.GetPtr(p_managed_callable.Target) : IntPtr.Zero;
NativeFuncs.godotsharp_callable_new_with_delegate(
- GCHandle.ToIntPtr(gcHandle), out godot_callable callable);
+ GCHandle.ToIntPtr(gcHandle), objectPtr, out godot_callable callable);
return callable;
}
else
diff --git a/modules/mono/glue/GodotSharp/GodotSharp/Core/NativeInterop/NativeFuncs.cs b/modules/mono/glue/GodotSharp/GodotSharp/Core/NativeInterop/NativeFuncs.cs
index bd00611383..20ede9f0dd 100644
--- a/modules/mono/glue/GodotSharp/GodotSharp/Core/NativeInterop/NativeFuncs.cs
+++ b/modules/mono/glue/GodotSharp/GodotSharp/Core/NativeInterop/NativeFuncs.cs
@@ -141,7 +141,7 @@ namespace Godot.NativeInterop
public static partial void godotsharp_packed_string_array_add(ref godot_packed_string_array r_dest,
in godot_string p_element);
- public static partial void godotsharp_callable_new_with_delegate(IntPtr p_delegate_handle,
+ public static partial void godotsharp_callable_new_with_delegate(IntPtr p_delegate_handle, IntPtr p_object,
out godot_callable r_callable);
internal static partial godot_bool godotsharp_callable_get_data_for_marshalling(in godot_callable p_callable,
diff --git a/modules/mono/glue/runtime_interop.cpp b/modules/mono/glue/runtime_interop.cpp
index 276701cdaa..2717b945f6 100644
--- a/modules/mono/glue/runtime_interop.cpp
+++ b/modules/mono/glue/runtime_interop.cpp
@@ -447,9 +447,10 @@ void godotsharp_packed_string_array_add(PackedStringArray *r_dest, const String
r_dest->append(*p_element);
}
-void godotsharp_callable_new_with_delegate(GCHandleIntPtr p_delegate_handle, Callable *r_callable) {
+void godotsharp_callable_new_with_delegate(GCHandleIntPtr p_delegate_handle, const Object *p_object, Callable *r_callable) {
// TODO: Use pooling for ManagedCallable instances.
- CallableCustom *managed_callable = memnew(ManagedCallable(p_delegate_handle));
+ ObjectID objid = p_object ? p_object->get_instance_id() : ObjectID();
+ CallableCustom *managed_callable = memnew(ManagedCallable(p_delegate_handle, objid));
memnew_placement(r_callable, Callable(managed_callable));
}
diff --git a/modules/mono/managed_callable.cpp b/modules/mono/managed_callable.cpp
index 9305dc645a..0c2c533090 100644
--- a/modules/mono/managed_callable.cpp
+++ b/modules/mono/managed_callable.cpp
@@ -79,7 +79,9 @@ CallableCustom::CompareLessFunc ManagedCallable::get_compare_less_func() const {
}
ObjectID ManagedCallable::get_object() const {
- // TODO: If the delegate target extends Godot.Object, use that instead!
+ if (object_id != ObjectID()) {
+ return object_id;
+ }
return CSharpLanguage::get_singleton()->get_managed_callable_middleman()->get_instance_id();
}
@@ -104,7 +106,7 @@ void ManagedCallable::release_delegate_handle() {
// Why you do this clang-format...
/* clang-format off */
-ManagedCallable::ManagedCallable(GCHandleIntPtr p_delegate_handle) : delegate_handle(p_delegate_handle) {
+ManagedCallable::ManagedCallable(GCHandleIntPtr p_delegate_handle, ObjectID p_object_id) : delegate_handle(p_delegate_handle), object_id(p_object_id) {
#ifdef GD_MONO_HOT_RELOAD
{
MutexLock lock(instances_mutex);
diff --git a/modules/mono/managed_callable.h b/modules/mono/managed_callable.h
index aa3344f4d5..26cd164fb6 100644
--- a/modules/mono/managed_callable.h
+++ b/modules/mono/managed_callable.h
@@ -40,6 +40,7 @@
class ManagedCallable : public CallableCustom {
friend class CSharpLanguage;
GCHandleIntPtr delegate_handle;
+ ObjectID object_id;
#ifdef GD_MONO_HOT_RELOAD
SelfList<ManagedCallable> self_instance = this;
@@ -66,7 +67,7 @@ public:
void release_delegate_handle();
- ManagedCallable(GCHandleIntPtr p_delegate_handle);
+ ManagedCallable(GCHandleIntPtr p_delegate_handle, ObjectID p_object_id);
~ManagedCallable();
};
diff --git a/modules/multiplayer/SCsub b/modules/multiplayer/SCsub
index ff33655537..e89038c3e0 100644
--- a/modules/multiplayer/SCsub
+++ b/modules/multiplayer/SCsub
@@ -8,7 +8,7 @@ env_mp = env_modules.Clone()
module_obj = []
env_mp.add_source_files(module_obj, "*.cpp")
-if env["tools"]:
+if env.editor_build:
env_mp.add_source_files(module_obj, "editor/*.cpp")
env.modules_sources += module_obj
diff --git a/modules/multiplayer/doc_classes/MultiplayerSynchronizer.xml b/modules/multiplayer/doc_classes/MultiplayerSynchronizer.xml
index 9a4d755d64..42c190f504 100644
--- a/modules/multiplayer/doc_classes/MultiplayerSynchronizer.xml
+++ b/modules/multiplayer/doc_classes/MultiplayerSynchronizer.xml
@@ -5,7 +5,7 @@
</brief_description>
<description>
By default, [MultiplayerSynchronizer] synchronizes configured properties to all peers.
- Visiblity can be handled directly with [method set_visibility_for] or as-needed with [method add_visibility_filter] and [method update_visibility].
+ Visibility can be handled directly with [method set_visibility_for] or as-needed with [method add_visibility_filter] and [method update_visibility].
[MultiplayerSpawner]s will handle nodes according to visibility of synchronizers as long as the node at [member root_path] was spawned by one.
@@ -34,7 +34,7 @@
<return type="void" />
<param index="0" name="filter" type="Callable" />
<description>
- Removes a peer visiblity filter from this synchronizer.
+ Removes a peer visibility filter from this synchronizer.
</description>
</method>
<method name="set_visibility_for">
diff --git a/modules/multiplayer/multiplayer_spawner.cpp b/modules/multiplayer/multiplayer_spawner.cpp
index 9d28feef09..620e4f2f6c 100644
--- a/modules/multiplayer/multiplayer_spawner.cpp
+++ b/modules/multiplayer/multiplayer_spawner.cpp
@@ -94,7 +94,7 @@ PackedStringArray MultiplayerSpawner::get_configuration_warnings() const {
warnings.push_back(RTR("A valid NodePath must be set in the \"Spawn Path\" property in order for MultiplayerSpawner to be able to spawn Nodes."));
}
bool has_scenes = get_spawnable_scene_count() > 0;
- // Can't check if method is overriden in placeholder scripts.
+ // Can't check if method is overridden in placeholder scripts.
bool has_placeholder_script = get_script_instance() && get_script_instance()->is_placeholder();
if (!has_scenes && !GDVIRTUAL_IS_OVERRIDDEN(_spawn_custom) && !has_placeholder_script) {
warnings.push_back(RTR("A list of PackedScenes must be set in the \"Auto Spawn List\" property in order for MultiplayerSpawner to automatically spawn them remotely when added as child of \"spawn_path\"."));
diff --git a/modules/multiplayer/scene_replication_interface.cpp b/modules/multiplayer/scene_replication_interface.cpp
index 6e3dbfab47..53d8e82dfc 100644
--- a/modules/multiplayer/scene_replication_interface.cpp
+++ b/modules/multiplayer/scene_replication_interface.cpp
@@ -125,9 +125,12 @@ Error SceneReplicationInterface::on_replication_start(Object *p_obj, Variant p_c
MultiplayerSynchronizer *sync = Object::cast_to<MultiplayerSynchronizer>(p_config.get_validated_object());
ERR_FAIL_COND_V(!sync, ERR_INVALID_PARAMETER);
+ const ObjectID oid = node->get_instance_id();
+ MultiplayerSpawner *spawner = rep_state->get_spawner(oid);
+ ERR_FAIL_COND_V_MSG(spawner && spawner->get_multiplayer_authority() != sync->get_multiplayer_authority(), ERR_INVALID_PARAMETER, "The authority of the MultiplayerSynchronizer \"" + String(sync->get_path()) + "\" differs from the authority of its \"root_node\" spawner and will not sync. Change the \"root_node\" of the MultiplayerSynchronizer to be a child of the scene root instead.");
+
// Add to synchronizer list and setup visibility.
rep_state->config_add_sync(node, sync);
- const ObjectID oid = node->get_instance_id();
sync->connect("visibility_changed", callable_mp(this, &SceneReplicationInterface::_visibility_changed).bind(oid));
if (multiplayer->has_multiplayer_peer() && sync->is_multiplayer_authority()) {
_update_sync_visibility(0, oid);
diff --git a/modules/navigation/SCsub b/modules/navigation/SCsub
index 24a6b12639..0b0822db2d 100644
--- a/modules/navigation/SCsub
+++ b/modules/navigation/SCsub
@@ -57,7 +57,7 @@ env.modules_sources += thirdparty_obj
module_obj = []
env_navigation.add_source_files(module_obj, "*.cpp")
-if env["tools"]:
+if env.editor_build:
env_navigation.add_source_files(module_obj, "editor/*.cpp")
env.modules_sources += module_obj
diff --git a/modules/openxr/SCsub b/modules/openxr/SCsub
index c8e9b9a11e..d4469b110b 100644
--- a/modules/openxr/SCsub
+++ b/modules/openxr/SCsub
@@ -98,7 +98,7 @@ env_openxr.add_source_files(module_obj, "extensions/openxr_fb_passthrough_extens
env.modules_sources += module_obj
-if env["tools"]:
+if env.editor_build:
SConscript("editor/SCsub")
# Needed to force rebuilding the module files when the thirdparty library is updated.
diff --git a/modules/text_server_adv/SCsub b/modules/text_server_adv/SCsub
index 8d0245f0f6..2261342467 100644
--- a/modules/text_server_adv/SCsub
+++ b/modules/text_server_adv/SCsub
@@ -215,6 +215,9 @@ if env["builtin_graphite"] and freetype_enabled and env["graphite"]:
]
)
+ if env.msvc: # Not our business to fix.
+ env_graphite.Append(CCFLAGS=["-D_SILENCE_ALL_CXX17_DEPRECATION_WARNINGS"])
+
lib = env_graphite.add_library("graphite_builtin", thirdparty_sources)
thirdparty_obj += lib
@@ -445,7 +448,7 @@ if env["builtin_icu"]:
icu_data_name = "icudt71l.dat"
- if env_icu["tools"]:
+ if env.editor_build:
env_icu.Depends("#thirdparty/icu4c/icudata.gen.h", "#thirdparty/icu4c/" + icu_data_name)
env_icu.Command("#thirdparty/icu4c/icudata.gen.h", "#thirdparty/icu4c/" + icu_data_name, make_icu_data)
env_text_server_adv.Prepend(CPPPATH=["#thirdparty/icu4c/"])
@@ -479,7 +482,7 @@ if env["builtin_icu"]:
"-DICU_DATA_NAME=" + icu_data_name,
]
)
- if env_text_server_adv["tools"]:
+ if env.editor_build:
env_text_server_adv.Append(CXXFLAGS=["-DICU_STATIC_DATA"])
env_text_server_adv.Prepend(CPPPATH=["#thirdparty/icu4c/common/", "#thirdparty/icu4c/i18n/"])
diff --git a/modules/text_server_adv/gdextension_build/SConstruct b/modules/text_server_adv/gdextension_build/SConstruct
index 488d1f641b..7ca8859ee6 100644
--- a/modules/text_server_adv/gdextension_build/SConstruct
+++ b/modules/text_server_adv/gdextension_build/SConstruct
@@ -193,7 +193,7 @@ if env["freetype_enabled"]:
"FT_CONFIG_OPTION_SYSTEM_ZLIB",
]
)
- if env["target"] == "debug":
+ if env.dev_build:
env_freetype.Append(CPPDEFINES=["ZLIB_DEBUG"])
env.Append(CPPDEFINES=["MODULE_FREETYPE_ENABLED"])
diff --git a/modules/text_server_fb/gdextension_build/SConstruct b/modules/text_server_fb/gdextension_build/SConstruct
index 488f9ca24e..eae8e031bf 100644
--- a/modules/text_server_fb/gdextension_build/SConstruct
+++ b/modules/text_server_fb/gdextension_build/SConstruct
@@ -188,7 +188,7 @@ if env["freetype_enabled"]:
"FT_CONFIG_OPTION_SYSTEM_ZLIB",
]
)
- if env["target"] == "debug":
+ if env.dev_build:
env_freetype.Append(CPPDEFINES=["ZLIB_DEBUG"])
env.Append(CPPDEFINES=["MODULE_FREETYPE_ENABLED"])
diff --git a/modules/tinyexr/config.py b/modules/tinyexr/config.py
index 53b8f2f2e3..eb565b85b9 100644
--- a/modules/tinyexr/config.py
+++ b/modules/tinyexr/config.py
@@ -1,5 +1,5 @@
def can_build(env, platform):
- return env["tools"]
+ return env.editor_build
def configure(env):
diff --git a/modules/vorbis/audio_stream_ogg_vorbis.cpp b/modules/vorbis/audio_stream_ogg_vorbis.cpp
index 9cb61a83f2..792103cd31 100644
--- a/modules/vorbis/audio_stream_ogg_vorbis.cpp
+++ b/modules/vorbis/audio_stream_ogg_vorbis.cpp
@@ -74,7 +74,7 @@ int AudioStreamPlaybackOggVorbis::_mix_internal(AudioFrame *p_buffer, int p_fram
if (beat_length_frames >= 0) {
/**
* Length determined by beat length
- * This code is commented out because, in practice, it is prefered that the fade
+ * This code is commented out because, in practice, it is preferred that the fade
* is done by the transitioner and this stream just goes on until it ends while fading out.
*
* End fade implementation is left here for reference in case at some point this feature
diff --git a/modules/websocket/SCsub b/modules/websocket/SCsub
index 890fb71592..3f834471e5 100644
--- a/modules/websocket/SCsub
+++ b/modules/websocket/SCsub
@@ -41,7 +41,7 @@ elif env["builtin_wslay"]:
module_obj = []
env_ws.add_source_files(module_obj, "*.cpp")
-if env["tools"]:
+if env.editor_build:
env_ws.add_source_files(module_obj, "editor/*.cpp")
env.modules_sources += module_obj
diff --git a/modules/xatlas_unwrap/config.py b/modules/xatlas_unwrap/config.py
index 2e73c51626..ecc61c2d7e 100644
--- a/modules/xatlas_unwrap/config.py
+++ b/modules/xatlas_unwrap/config.py
@@ -1,5 +1,5 @@
def can_build(env, platform):
- return env["tools"] and platform not in ["android", "ios"]
+ return env.editor_build and platform not in ["android", "ios"]
def configure(env):
diff --git a/platform/android/SCsub b/platform/android/SCsub
index 344ca036de..9f5b8d8387 100644
--- a/platform/android/SCsub
+++ b/platform/android/SCsub
@@ -53,14 +53,14 @@ else:
print("WARN: Architecture not suitable for embedding into APK; keeping .so at \\bin")
if lib_arch_dir != "":
- if env["target"] == "release":
- lib_type_dir = "release"
- elif env["target"] == "release_debug":
+ if env.debug_features:
lib_type_dir = "debug"
- else: # debug
+ elif env.dev_build:
lib_type_dir = "dev"
+ else: # Release
+ lib_type_dir = "release"
- if env["tools"]:
+ if env.editor_build:
lib_tools_dir = "tools/"
else:
lib_tools_dir = ""
diff --git a/platform/android/detect.py b/platform/android/detect.py
index 2ff9cd3dc5..e541aa0373 100644
--- a/platform/android/detect.py
+++ b/platform/android/detect.py
@@ -3,6 +3,11 @@ import sys
import platform
import subprocess
+from typing import TYPE_CHECKING
+
+if TYPE_CHECKING:
+ from SCons import Environment
+
def is_active():
return True
@@ -17,8 +22,6 @@ def can_build():
def get_opts():
- from SCons.Variables import BoolVariable, EnumVariable
-
return [
("ANDROID_SDK_ROOT", "Path to the Android SDK", get_env_android_sdk_root()),
("ndk_platform", 'Target platform (android-<api>, e.g. "android-24")', "android-24"),
@@ -46,7 +49,7 @@ def get_ndk_version():
def get_flags():
return [
("arch", "arm64"), # Default for convenience.
- ("tools", False),
+ ("target", "template_debug"),
]
@@ -74,7 +77,7 @@ def install_ndk_if_needed(env):
env["ANDROID_NDK_ROOT"] = get_android_ndk_root(env)
-def configure(env):
+def configure(env: "Environment"):
# Validate arch.
supported_arches = ["x86_32", "x86_64", "arm32", "arm64"]
if env["arch"] not in supported_arches:
@@ -114,20 +117,6 @@ def configure(env):
env.Append(CCFLAGS=target_option)
env.Append(LINKFLAGS=target_option)
- # Build type
-
- if env["target"].startswith("release"):
- if env["optimize"] == "speed": # optimize for speed (default)
- # `-O2` is more friendly to debuggers than `-O3`, leading to better crash backtraces
- # when using `target=release_debug`.
- opt = "-O3" if env["target"] == "release" else "-O2"
- env.Append(CCFLAGS=[opt])
- elif env["optimize"] == "size": # optimize for size
- env.Append(CCFLAGS=["-Oz"])
- elif env["target"] == "debug":
- env.Append(LINKFLAGS=["-O0"])
- env.Append(CCFLAGS=["-O0", "-g"])
-
# LTO
if env["lto"] == "auto": # LTO benefits for Android (size, performance) haven't been clearly established yet.
@@ -168,7 +157,7 @@ def configure(env):
env["AS"] = compiler_path + "/clang"
# Disable exceptions and rtti on non-tools (template) builds
- if env["tools"]:
+ if env.editor_build:
env.Append(CXXFLAGS=["-frtti"])
elif env["builtin_icu"]:
env.Append(CXXFLAGS=["-frtti", "-fno-exceptions"])
diff --git a/platform/ios/detect.py b/platform/ios/detect.py
index 0f277d6b3a..38e62134b5 100644
--- a/platform/ios/detect.py
+++ b/platform/ios/detect.py
@@ -2,6 +2,11 @@ import os
import sys
from methods import detect_darwin_sdk_path
+from typing import TYPE_CHECKING
+
+if TYPE_CHECKING:
+ from SCons import Environment
+
def is_active():
return True
@@ -37,12 +42,12 @@ def get_opts():
def get_flags():
return [
("arch", "arm64"), # Default for convenience.
- ("tools", False),
+ ("target", "template_debug"),
("use_volk", False),
]
-def configure(env):
+def configure(env: "Environment"):
# Validate arch.
supported_arches = ["x86_64", "arm64"]
if env["arch"] not in supported_arches:
@@ -52,23 +57,6 @@ def configure(env):
)
sys.exit()
- ## Build type
-
- if env["target"].startswith("release"):
- env.Append(CPPDEFINES=[("NS_BLOCK_ASSERTIONS", 1)])
- if env["optimize"] == "speed": # optimize for speed (default)
- # `-O2` is more friendly to debuggers than `-O3`, leading to better crash backtraces
- # when using `target=release_debug`.
- opt = "-O3" if env["target"] == "release" else "-O2"
- env.Append(CCFLAGS=[opt])
- env.Append(LINKFLAGS=[opt])
- elif env["optimize"] == "size": # optimize for size
- env.Append(CCFLAGS=["-Os"])
- env.Append(LINKFLAGS=["-Os"])
-
- elif env["target"] == "debug":
- env.Append(CCFLAGS=["-g", "-O0"])
-
## LTO
if env["lto"] == "auto": # Disable by default as it makes linking in Xcode very slow.
@@ -145,12 +133,10 @@ def configure(env):
env.Append(ASFLAGS=["-arch", "arm64"])
env.Append(CPPDEFINES=["NEED_LONG_INT"])
- # Disable exceptions on non-tools (template) builds
- if not env["tools"]:
- if env["ios_exceptions"]:
- env.Append(CCFLAGS=["-fexceptions"])
- else:
- env.Append(CCFLAGS=["-fno-exceptions"])
+ if env["ios_exceptions"]:
+ env.Append(CCFLAGS=["-fexceptions"])
+ else:
+ env.Append(CCFLAGS=["-fno-exceptions"])
# Temp fix for ABS/MAX/MIN macros in iOS SDK blocking compilation
env.Append(CCFLAGS=["-Wno-ambiguous-macro"])
diff --git a/platform/linuxbsd/detect.py b/platform/linuxbsd/detect.py
index 12d2432eea..dfde0d249c 100644
--- a/platform/linuxbsd/detect.py
+++ b/platform/linuxbsd/detect.py
@@ -4,6 +4,11 @@ import sys
from methods import get_compiler_version, using_gcc
from platform_methods import detect_arch
+from typing import TYPE_CHECKING
+
+if TYPE_CHECKING:
+ from SCons import Environment
+
def is_active():
return True
@@ -44,8 +49,6 @@ def get_opts():
BoolVariable("fontconfig", "Detect and use fontconfig for system fonts support", True),
BoolVariable("udev", "Use udev for gamepad connection callbacks", True),
BoolVariable("x11", "Enable X11 display", True),
- BoolVariable("debug_symbols", "Add debugging symbols to release/release_debug builds", True),
- BoolVariable("separate_debug_symbols", "Create a separate file containing debugging symbols", False),
BoolVariable("touch", "Enable touch events", True),
BoolVariable("execinfo", "Use libexecinfo on systems where glibc is not available", False),
]
@@ -57,7 +60,7 @@ def get_flags():
]
-def configure(env):
+def configure(env: "Environment"):
# Validate arch.
supported_arches = ["x86_32", "x86_64", "arm32", "arm64", "rv64", "ppc32", "ppc64"]
if env["arch"] not in supported_arches:
@@ -69,26 +72,9 @@ def configure(env):
## Build type
- if env["target"] == "release":
- if env["optimize"] == "speed": # optimize for speed (default)
- env.Prepend(CCFLAGS=["-O3"])
- elif env["optimize"] == "size": # optimize for size
- env.Prepend(CCFLAGS=["-Os"])
-
- if env["debug_symbols"]:
- env.Prepend(CCFLAGS=["-g2"])
-
- elif env["target"] == "release_debug":
- if env["optimize"] == "speed": # optimize for speed (default)
- env.Prepend(CCFLAGS=["-O2"])
- elif env["optimize"] == "size": # optimize for size
- env.Prepend(CCFLAGS=["-Os"])
-
- if env["debug_symbols"]:
- env.Prepend(CCFLAGS=["-g2"])
-
- elif env["target"] == "debug":
- env.Prepend(CCFLAGS=["-g3"])
+ if env.dev_build:
+ # This is needed for our crash handler to work properly.
+ # gdb works fine without it though, so maybe our crash handler could too.
env.Append(LINKFLAGS=["-rdynamic"])
# CPU architecture flags.
@@ -383,7 +369,7 @@ def configure(env):
if env["execinfo"]:
env.Append(LIBS=["execinfo"])
- if not env["tools"]:
+ if not env.editor_build:
import subprocess
import re
diff --git a/platform/linuxbsd/gl_manager_x11.cpp b/platform/linuxbsd/gl_manager_x11.cpp
index 838be2c042..f586c57dda 100644
--- a/platform/linuxbsd/gl_manager_x11.cpp
+++ b/platform/linuxbsd/gl_manager_x11.cpp
@@ -310,7 +310,7 @@ void GLManager_X11::swap_buffers() {
return;
}
- // On X11, when enabled, transparancy is always active, so clear alpha manually.
+ // On X11, when enabled, transparency is always active, so clear alpha manually.
if (OS::get_singleton()->is_layered_allowed()) {
if (!DisplayServer::get_singleton()->window_get_flag(DisplayServer::WINDOW_FLAG_TRANSPARENT, _current_window->window_id)) {
glColorMask(false, false, false, true);
diff --git a/platform/macos/detect.py b/platform/macos/detect.py
index 58d9c0e99f..511286d52b 100644
--- a/platform/macos/detect.py
+++ b/platform/macos/detect.py
@@ -3,6 +3,11 @@ import sys
from methods import detect_darwin_sdk_path
from platform_methods import detect_arch
+from typing import TYPE_CHECKING
+
+if TYPE_CHECKING:
+ from SCons import Environment
+
def is_active():
return True
@@ -27,8 +32,6 @@ def get_opts():
("MACOS_SDK_PATH", "Path to the macOS SDK", ""),
("vulkan_sdk_path", "Path to the Vulkan SDK", ""),
EnumVariable("macports_clang", "Build using Clang from MacPorts", "no", ("no", "5.0", "devel")),
- BoolVariable("debug_symbols", "Add debugging symbols to release/release_debug builds", True),
- BoolVariable("separate_debug_symbols", "Create a separate file containing debugging symbols", False),
BoolVariable("use_ubsan", "Use LLVM/GCC compiler undefined behavior sanitizer (UBSAN)", False),
BoolVariable("use_asan", "Use LLVM/GCC compiler address sanitizer (ASAN)", False),
BoolVariable("use_tsan", "Use LLVM/GCC compiler thread sanitizer (TSAN)", False),
@@ -74,7 +77,7 @@ def get_mvk_sdk_path():
return os.path.join(os.path.join(dirname, ver_file), "MoltenVK/MoltenVK.xcframework/macos-arm64_x86_64/")
-def configure(env):
+def configure(env: "Environment"):
# Validate arch.
supported_arches = ["x86_64", "arm64"]
if env["arch"] not in supported_arches:
@@ -86,27 +89,10 @@ def configure(env):
## Build type
- if env["target"] == "release":
- if env["optimize"] == "speed": # optimize for speed (default)
- env.Prepend(CCFLAGS=["-O3"])
- elif env["optimize"] == "size": # optimize for size
- env.Prepend(CCFLAGS=["-Os"])
+ if env["target"] == "template_release":
if env["arch"] != "arm64":
env.Prepend(CCFLAGS=["-msse2"])
-
- if env["debug_symbols"]:
- env.Prepend(CCFLAGS=["-g2"])
-
- elif env["target"] == "release_debug":
- if env["optimize"] == "speed": # optimize for speed (default)
- env.Prepend(CCFLAGS=["-O2"])
- elif env["optimize"] == "size": # optimize for size
- env.Prepend(CCFLAGS=["-Os"])
- if env["debug_symbols"]:
- env.Prepend(CCFLAGS=["-g2"])
-
- elif env["target"] == "debug":
- env.Prepend(CCFLAGS=["-g3"])
+ elif env.dev_build:
env.Prepend(LINKFLAGS=["-Xlinker", "-no_deduplicate"])
## Compiler configuration
diff --git a/platform/uwp/detect.py b/platform/uwp/detect.py
index 2c5746cb06..64fe5bc4a2 100644
--- a/platform/uwp/detect.py
+++ b/platform/uwp/detect.py
@@ -3,6 +3,11 @@ import os
import sys
from platform_methods import detect_arch
+from typing import TYPE_CHECKING
+
+if TYPE_CHECKING:
+ from SCons import Environment
+
def is_active():
return True
@@ -39,7 +44,7 @@ def get_flags():
]
-def configure(env):
+def configure(env: "Environment"):
# Validate arch.
supported_arches = ["x86_32", "x86_64", "arm32"]
if env["arch"] not in supported_arches:
@@ -83,7 +88,7 @@ def configure(env):
env.AppendUnique(CCFLAGS=["/utf-8"])
# ANGLE
- angle_root = os.getenv("ANGLE_SRC_PATH")
+ angle_root = os.environ["ANGLE_SRC_PATH"]
env.Prepend(CPPPATH=[angle_root + "/include"])
jobs = str(env.GetOption("num_jobs"))
angle_build_cmd = (
@@ -94,7 +99,7 @@ def configure(env):
+ " /p:Configuration=Release /p:Platform="
)
- if os.path.isfile(str(os.getenv("ANGLE_SRC_PATH")) + "/winrt/10/src/angle.sln"):
+ if os.path.isfile(f"{angle_root}/winrt/10/src/angle.sln"):
env["build_angle"] = True
## Architecture
diff --git a/platform/web/detect.py b/platform/web/detect.py
index 9cce73efc4..08c1ff7b4a 100644
--- a/platform/web/detect.py
+++ b/platform/web/detect.py
@@ -11,6 +11,10 @@ from emscripten_helpers import (
)
from methods import get_compiler_version
from SCons.Util import WhereIs
+from typing import TYPE_CHECKING
+
+if TYPE_CHECKING:
+ from SCons import Environment
def is_active():
@@ -47,7 +51,7 @@ def get_opts():
def get_flags():
return [
("arch", "wasm32"),
- ("tools", False),
+ ("target", "template_debug"),
("builtin_pcre2_with_jit", False),
("vulkan", False),
# Use -Os to prioritize optimizing for reduced file size. This is
@@ -60,7 +64,7 @@ def get_flags():
]
-def configure(env):
+def configure(env: "Environment"):
# Validate arch.
supported_arches = ["wasm32"]
if env["arch"] not in supported_arches:
@@ -77,26 +81,17 @@ def configure(env):
sys.exit(255)
## Build type
- if env["target"].startswith("release"):
- if env["optimize"] == "size":
- env.Append(CCFLAGS=["-Os"])
- env.Append(LINKFLAGS=["-Os"])
- elif env["optimize"] == "speed":
- env.Append(CCFLAGS=["-O3"])
- env.Append(LINKFLAGS=["-O3"])
-
- if env["target"] == "release_debug":
- # Retain function names for backtraces at the cost of file size.
- env.Append(LINKFLAGS=["--profiling-funcs"])
- else: # "debug"
- env.Append(CCFLAGS=["-O1", "-g"])
- env.Append(LINKFLAGS=["-O1", "-g"])
+
+ if env.debug_features:
+ # Retain function names for backtraces at the cost of file size.
+ env.Append(LINKFLAGS=["--profiling-funcs"])
+ else:
env["use_assertions"] = True
if env["use_assertions"]:
env.Append(LINKFLAGS=["-s", "ASSERTIONS=1"])
- if env["tools"]:
+ if env.editor_build:
if env["initial_memory"] < 64:
print('Note: Forcing "initial_memory=64" as it is required for the web editor.')
env["initial_memory"] = 64
diff --git a/platform/web/emscripten_helpers.py b/platform/web/emscripten_helpers.py
index 6045bc6fbd..ec33397842 100644
--- a/platform/web/emscripten_helpers.py
+++ b/platform/web/emscripten_helpers.py
@@ -38,7 +38,7 @@ def create_engine_file(env, target, source, externs):
def create_template_zip(env, js, wasm, worker, side):
- binary_name = "godot.tools" if env["tools"] else "godot"
+ binary_name = "godot.editor" if env.editor_build else "godot"
zip_dir = env.Dir("#bin/.web_zip")
in_files = [
js,
@@ -58,19 +58,19 @@ def create_template_zip(env, js, wasm, worker, side):
out_files.append(zip_dir.File(binary_name + ".side.wasm"))
service_worker = "#misc/dist/html/service-worker.js"
- if env["tools"]:
+ if env.editor_build:
# HTML
html = "#misc/dist/html/editor.html"
cache = [
- "godot.tools.html",
+ "godot.editor.html",
"offline.html",
- "godot.tools.js",
- "godot.tools.worker.js",
- "godot.tools.audio.worklet.js",
+ "godot.editor.js",
+ "godot.editor.worker.js",
+ "godot.editor.audio.worklet.js",
"logo.svg",
"favicon.png",
]
- opt_cache = ["godot.tools.wasm"]
+ opt_cache = ["godot.editor.wasm"]
subst_dict = {
"@GODOT_VERSION@": get_build_version(),
"@GODOT_NAME@": "GodotEngine",
diff --git a/platform/windows/detect.py b/platform/windows/detect.py
index 095d688213..a5d8d0344b 100644
--- a/platform/windows/detect.py
+++ b/platform/windows/detect.py
@@ -4,6 +4,11 @@ import subprocess
import sys
from platform_methods import detect_arch
+from typing import TYPE_CHECKING
+
+if TYPE_CHECKING:
+ from SCons import Environment
+
# To match other platforms
STACK_SIZE = 8388608
@@ -173,17 +178,7 @@ def get_opts():
"Targeted Windows version, >= 0x0601 (Windows 7)",
"0x0601",
),
- BoolVariable(
- "debug_symbols",
- "Add debugging symbols to release/release_debug builds",
- True,
- ),
EnumVariable("windows_subsystem", "Windows subsystem", "gui", ("gui", "console")),
- BoolVariable(
- "separate_debug_symbols",
- "Create a separate file containing debugging symbols",
- False,
- ),
(
"msvc_version",
"MSVC version to use. Ignored if VCINSTALLDIR is set in shell env.",
@@ -330,31 +325,11 @@ def setup_mingw(env):
def configure_msvc(env, vcvars_msvc_config):
"""Configure env to work with MSVC"""
- # Build type
- if env["target"] == "release":
- if env["optimize"] == "speed": # optimize for speed (default)
- env.Append(CCFLAGS=["/O2"])
- env.Append(LINKFLAGS=["/OPT:REF"])
- elif env["optimize"] == "size": # optimize for size
- env.Append(CCFLAGS=["/O1"])
- env.Append(LINKFLAGS=["/OPT:REF"])
- env.Append(LINKFLAGS=["/ENTRY:mainCRTStartup"])
-
- elif env["target"] == "release_debug":
- if env["optimize"] == "speed": # optimize for speed (default)
- env.Append(CCFLAGS=["/O2"])
- env.Append(LINKFLAGS=["/OPT:REF"])
- elif env["optimize"] == "size": # optimize for size
- env.Append(CCFLAGS=["/O1"])
- env.Append(LINKFLAGS=["/OPT:REF"])
-
- elif env["target"] == "debug":
- env.AppendUnique(CCFLAGS=["/Zi", "/FS", "/Od", "/EHsc"])
- env.Append(LINKFLAGS=["/DEBUG"])
+ ## Build type
- if env["debug_symbols"]:
- env.AppendUnique(CCFLAGS=["/Zi", "/FS"])
- env.AppendUnique(LINKFLAGS=["/DEBUG"])
+ # TODO: Re-evaluate the need for this / streamline with common config.
+ if env["target"] == "template_release":
+ env.Append(LINKFLAGS=["/ENTRY:mainCRTStartup"])
if env["windows_subsystem"] == "gui":
env.Append(LINKFLAGS=["/SUBSYSTEM:WINDOWS"])
@@ -491,31 +466,10 @@ def configure_mingw(env):
if env["use_llvm"] and not try_cmd("clang --version", env["mingw_prefix"], env["arch"]):
env["use_llvm"] = False
- if env["target"] == "release":
+ # TODO: Re-evaluate the need for this / streamline with common config.
+ if env["target"] == "template_release":
env.Append(CCFLAGS=["-msse2"])
-
- if env["optimize"] == "speed": # optimize for speed (default)
- if env["arch"] == "x86_32":
- env.Append(CCFLAGS=["-O2"])
- else:
- env.Append(CCFLAGS=["-O3"])
- else: # optimize for size
- env.Prepend(CCFLAGS=["-Os"])
-
- if env["debug_symbols"]:
- env.Prepend(CCFLAGS=["-g2"])
-
- elif env["target"] == "release_debug":
- env.Append(CCFLAGS=["-O2"])
- if env["debug_symbols"]:
- env.Prepend(CCFLAGS=["-g2"])
- if env["optimize"] == "speed": # optimize for speed (default)
- env.Append(CCFLAGS=["-O2"])
- else: # optimize for size
- env.Prepend(CCFLAGS=["-Os"])
-
- elif env["target"] == "debug":
- env.Append(CCFLAGS=["-g3"])
+ elif env.dev_build:
# Allow big objects. It's supposed not to have drawbacks but seems to break
# GCC LTO, so enabling for debug builds only (which are not built with LTO
# and are the only ones with too big objects).
@@ -639,7 +593,7 @@ def configure_mingw(env):
env.Append(BUILDERS={"RES": env.Builder(action=build_res_file, suffix=".o", src_suffix=".rc")})
-def configure(env):
+def configure(env: "Environment"):
# Validate arch.
supported_arches = ["x86_32", "x86_64", "arm32", "arm64"]
if env["arch"] not in supported_arches:
diff --git a/scene/2d/navigation_agent_2d.cpp b/scene/2d/navigation_agent_2d.cpp
index 55cebdaadc..f077f7f5e6 100644
--- a/scene/2d/navigation_agent_2d.cpp
+++ b/scene/2d/navigation_agent_2d.cpp
@@ -178,6 +178,13 @@ NavigationAgent2D::NavigationAgent2D() {
set_time_horizon(20.0);
set_radius(10.0);
set_max_speed(200.0);
+
+ // Preallocate query and result objects to improve performance.
+ navigation_query = Ref<NavigationPathQueryParameters2D>();
+ navigation_query.instantiate();
+
+ navigation_result = Ref<NavigationPathQueryResult2D>();
+ navigation_result.instantiate();
}
NavigationAgent2D::~NavigationAgent2D() {
@@ -314,6 +321,8 @@ Vector2 NavigationAgent2D::get_target_location() const {
Vector2 NavigationAgent2D::get_next_location() {
update_navigation();
+
+ const Vector<Vector2> &navigation_path = navigation_result->get_path();
if (navigation_path.size() == 0) {
ERR_FAIL_COND_V_MSG(agent_parent == nullptr, Vector2(), "The agent has no parent.");
return agent_parent->get_global_position();
@@ -322,6 +331,10 @@ Vector2 NavigationAgent2D::get_next_location() {
}
}
+const Vector<Vector2> &NavigationAgent2D::get_nav_path() const {
+ return navigation_result->get_path();
+}
+
real_t NavigationAgent2D::distance_to_target() const {
ERR_FAIL_COND_V_MSG(agent_parent == nullptr, 0.0, "The agent has no parent.");
return agent_parent->get_global_position().distance_to(target_location);
@@ -342,6 +355,8 @@ bool NavigationAgent2D::is_navigation_finished() {
Vector2 NavigationAgent2D::get_final_location() {
update_navigation();
+
+ const Vector<Vector2> &navigation_path = navigation_result->get_path();
if (navigation_path.size() == 0) {
return Vector2();
}
@@ -391,22 +406,24 @@ void NavigationAgent2D::update_navigation() {
update_frame_id = Engine::get_singleton()->get_physics_frames();
- Vector2 o = agent_parent->get_global_position();
+ Vector2 origin = agent_parent->get_global_position();
bool reload_path = false;
if (NavigationServer2D::get_singleton()->agent_is_map_changed(agent)) {
reload_path = true;
- } else if (navigation_path.size() == 0) {
+ } else if (navigation_result->get_path().size() == 0) {
reload_path = true;
} else {
// Check if too far from the navigation path
if (nav_path_index > 0) {
+ const Vector<Vector2> &navigation_path = navigation_result->get_path();
+
Vector2 segment[2];
segment[0] = navigation_path[nav_path_index - 1];
segment[1] = navigation_path[nav_path_index];
- Vector2 p = Geometry2D::get_closest_point_to_segment(o, segment);
- if (o.distance_to(p) >= path_max_distance) {
+ Vector2 p = Geometry2D::get_closest_point_to_segment(origin, segment);
+ if (origin.distance_to(p) >= path_max_distance) {
// To faraway, reload path
reload_path = true;
}
@@ -414,24 +431,31 @@ void NavigationAgent2D::update_navigation() {
}
if (reload_path) {
+ navigation_query->set_start_position(origin);
+ navigation_query->set_target_position(target_location);
+ navigation_query->set_navigation_layers(navigation_layers);
+
if (map_override.is_valid()) {
- navigation_path = NavigationServer2D::get_singleton()->map_get_path(map_override, o, target_location, true, navigation_layers);
+ navigation_query->set_map(map_override);
} else {
- navigation_path = NavigationServer2D::get_singleton()->map_get_path(agent_parent->get_world_2d()->get_navigation_map(), o, target_location, true, navigation_layers);
+ navigation_query->set_map(agent_parent->get_world_2d()->get_navigation_map());
}
+
+ NavigationServer2D::get_singleton()->query_path(navigation_query, navigation_result);
navigation_finished = false;
nav_path_index = 0;
emit_signal(SNAME("path_changed"));
}
- if (navigation_path.size() == 0) {
+ if (navigation_result->get_path().size() == 0) {
return;
}
// Check if we can advance the navigation path
if (navigation_finished == false) {
// Advances to the next far away location.
- while (o.distance_to(navigation_path[nav_path_index]) < path_desired_distance) {
+ const Vector<Vector2> &navigation_path = navigation_result->get_path();
+ while (origin.distance_to(navigation_path[nav_path_index]) < path_desired_distance) {
nav_path_index += 1;
if (nav_path_index == navigation_path.size()) {
_check_distance_to_target();
@@ -445,7 +469,7 @@ void NavigationAgent2D::update_navigation() {
}
void NavigationAgent2D::_request_repath() {
- navigation_path.clear();
+ navigation_result->reset();
target_reached = false;
navigation_finished = false;
update_frame_id = 0;
diff --git a/scene/2d/navigation_agent_2d.h b/scene/2d/navigation_agent_2d.h
index 2fbacc4c76..5abd3c0317 100644
--- a/scene/2d/navigation_agent_2d.h
+++ b/scene/2d/navigation_agent_2d.h
@@ -34,6 +34,8 @@
#include "scene/main/node.h"
class Node2D;
+class NavigationPathQueryParameters2D;
+class NavigationPathQueryResult2D;
class NavigationAgent2D : public Node {
GDCLASS(NavigationAgent2D, Node);
@@ -58,7 +60,8 @@ class NavigationAgent2D : public Node {
real_t path_max_distance = 3.0;
Vector2 target_location;
- Vector<Vector2> navigation_path;
+ Ref<NavigationPathQueryParameters2D> navigation_query;
+ Ref<NavigationPathQueryResult2D> navigation_result;
int nav_path_index = 0;
bool velocity_submitted = false;
Vector2 prev_safe_velocity;
@@ -138,9 +141,7 @@ public:
Vector2 get_next_location();
- Vector<Vector2> get_nav_path() const {
- return navigation_path;
- }
+ const Vector<Vector2> &get_nav_path() const;
int get_nav_path_index() const {
return nav_path_index;
diff --git a/scene/3d/lightmap_gi.cpp b/scene/3d/lightmap_gi.cpp
index 555884f445..cbcbac7b83 100644
--- a/scene/3d/lightmap_gi.cpp
+++ b/scene/3d/lightmap_gi.cpp
@@ -1001,10 +1001,16 @@ LightmapGI::BakeError LightmapGI::bake(Node *p_from_node, String p_image_data_pa
lightmapper->add_directional_light(light->get_bake_mode() == Light3D::BAKE_STATIC, -xf.basis.get_column(Vector3::AXIS_Z).normalized(), linear_color, energy, l->get_param(Light3D::PARAM_SIZE), l->get_param(Light3D::PARAM_SHADOW_BLUR));
} else if (Object::cast_to<OmniLight3D>(light)) {
OmniLight3D *l = Object::cast_to<OmniLight3D>(light);
- lightmapper->add_omni_light(light->get_bake_mode() == Light3D::BAKE_STATIC, xf.origin, linear_color, energy * (1.0 / (Math_PI * 4.0)), l->get_param(Light3D::PARAM_RANGE), l->get_param(Light3D::PARAM_ATTENUATION), l->get_param(Light3D::PARAM_SIZE), l->get_param(Light3D::PARAM_SHADOW_BLUR));
+ if (GLOBAL_GET("rendering/lights_and_shadows/use_physical_light_units")) {
+ energy *= (1.0 / (Math_PI * 4.0));
+ }
+ lightmapper->add_omni_light(light->get_bake_mode() == Light3D::BAKE_STATIC, xf.origin, linear_color, energy, l->get_param(Light3D::PARAM_RANGE), l->get_param(Light3D::PARAM_ATTENUATION), l->get_param(Light3D::PARAM_SIZE), l->get_param(Light3D::PARAM_SHADOW_BLUR));
} else if (Object::cast_to<SpotLight3D>(light)) {
SpotLight3D *l = Object::cast_to<SpotLight3D>(light);
- lightmapper->add_spot_light(light->get_bake_mode() == Light3D::BAKE_STATIC, xf.origin, -xf.basis.get_column(Vector3::AXIS_Z).normalized(), linear_color, energy * (1.0 / Math_PI), l->get_param(Light3D::PARAM_RANGE), l->get_param(Light3D::PARAM_ATTENUATION), l->get_param(Light3D::PARAM_SPOT_ANGLE), l->get_param(Light3D::PARAM_SPOT_ATTENUATION), l->get_param(Light3D::PARAM_SIZE), l->get_param(Light3D::PARAM_SHADOW_BLUR));
+ if (GLOBAL_GET("rendering/lights_and_shadows/use_physical_light_units")) {
+ energy *= (1.0 / Math_PI);
+ }
+ lightmapper->add_spot_light(light->get_bake_mode() == Light3D::BAKE_STATIC, xf.origin, -xf.basis.get_column(Vector3::AXIS_Z).normalized(), linear_color, energy, l->get_param(Light3D::PARAM_RANGE), l->get_param(Light3D::PARAM_ATTENUATION), l->get_param(Light3D::PARAM_SPOT_ANGLE), l->get_param(Light3D::PARAM_SPOT_ATTENUATION), l->get_param(Light3D::PARAM_SIZE), l->get_param(Light3D::PARAM_SHADOW_BLUR));
}
}
for (int i = 0; i < probes_found.size(); i++) {
@@ -1061,7 +1067,10 @@ LightmapGI::BakeError LightmapGI::bake(Node *p_from_node, String p_image_data_pa
float exposure_normalization = 1.0;
if (camera_attributes.is_valid()) {
- exposure_normalization = camera_attributes->calculate_exposure_normalization() * camera_attributes->get_exposure_multiplier();
+ exposure_normalization = camera_attributes->get_exposure_multiplier();
+ if (GLOBAL_GET("rendering/lights_and_shadows/use_physical_light_units")) {
+ exposure_normalization = camera_attributes->calculate_exposure_normalization();
+ }
}
Lightmapper::BakeError bake_err = lightmapper->bake(Lightmapper::BakeQuality(bake_quality), use_denoiser, bounces, bias, max_texture_size, directional, Lightmapper::GenerateProbes(gen_probes), environment_image, environment_transform, _lightmap_bake_step_function, &bsud, exposure_normalization);
diff --git a/scene/3d/navigation_agent_3d.cpp b/scene/3d/navigation_agent_3d.cpp
index 3476ced6ee..39068fe83c 100644
--- a/scene/3d/navigation_agent_3d.cpp
+++ b/scene/3d/navigation_agent_3d.cpp
@@ -185,6 +185,13 @@ NavigationAgent3D::NavigationAgent3D() {
set_radius(1.0);
set_max_speed(10.0);
set_ignore_y(true);
+
+ // Preallocate query and result objects to improve performance.
+ navigation_query = Ref<NavigationPathQueryParameters3D>();
+ navigation_query.instantiate();
+
+ navigation_result = Ref<NavigationPathQueryResult3D>();
+ navigation_result.instantiate();
}
NavigationAgent3D::~NavigationAgent3D() {
@@ -330,6 +337,8 @@ Vector3 NavigationAgent3D::get_target_location() const {
Vector3 NavigationAgent3D::get_next_location() {
update_navigation();
+
+ const Vector<Vector3> &navigation_path = navigation_result->get_path();
if (navigation_path.size() == 0) {
ERR_FAIL_COND_V_MSG(agent_parent == nullptr, Vector3(), "The agent has no parent.");
return agent_parent->get_global_transform().origin;
@@ -338,6 +347,10 @@ Vector3 NavigationAgent3D::get_next_location() {
}
}
+const Vector<Vector3> &NavigationAgent3D::get_nav_path() const {
+ return navigation_result->get_path();
+}
+
real_t NavigationAgent3D::distance_to_target() const {
ERR_FAIL_COND_V_MSG(agent_parent == nullptr, 0.0, "The agent has no parent.");
return agent_parent->get_global_transform().origin.distance_to(target_location);
@@ -358,6 +371,8 @@ bool NavigationAgent3D::is_navigation_finished() {
Vector3 NavigationAgent3D::get_final_location() {
update_navigation();
+
+ const Vector<Vector3> &navigation_path = navigation_result->get_path();
if (navigation_path.size() == 0) {
return Vector3();
}
@@ -406,24 +421,26 @@ void NavigationAgent3D::update_navigation() {
update_frame_id = Engine::get_singleton()->get_physics_frames();
- Vector3 o = agent_parent->get_global_transform().origin;
+ Vector3 origin = agent_parent->get_global_transform().origin;
bool reload_path = false;
if (NavigationServer3D::get_singleton()->agent_is_map_changed(agent)) {
reload_path = true;
- } else if (navigation_path.size() == 0) {
+ } else if (navigation_result->get_path().size() == 0) {
reload_path = true;
} else {
// Check if too far from the navigation path
if (nav_path_index > 0) {
+ const Vector<Vector3> &navigation_path = navigation_result->get_path();
+
Vector3 segment[2];
segment[0] = navigation_path[nav_path_index - 1];
segment[1] = navigation_path[nav_path_index];
segment[0].y -= navigation_height_offset;
segment[1].y -= navigation_height_offset;
- Vector3 p = Geometry3D::get_closest_point_to_segment(o, segment);
- if (o.distance_to(p) >= path_max_distance) {
+ Vector3 p = Geometry3D::get_closest_point_to_segment(origin, segment);
+ if (origin.distance_to(p) >= path_max_distance) {
// To faraway, reload path
reload_path = true;
}
@@ -431,24 +448,31 @@ void NavigationAgent3D::update_navigation() {
}
if (reload_path) {
+ navigation_query->set_start_position(origin);
+ navigation_query->set_target_position(target_location);
+ navigation_query->set_navigation_layers(navigation_layers);
+
if (map_override.is_valid()) {
- navigation_path = NavigationServer3D::get_singleton()->map_get_path(map_override, o, target_location, true, navigation_layers);
+ navigation_query->set_map(map_override);
} else {
- navigation_path = NavigationServer3D::get_singleton()->map_get_path(agent_parent->get_world_3d()->get_navigation_map(), o, target_location, true, navigation_layers);
+ navigation_query->set_map(agent_parent->get_world_3d()->get_navigation_map());
}
+
+ NavigationServer3D::get_singleton()->query_path(navigation_query, navigation_result);
navigation_finished = false;
nav_path_index = 0;
emit_signal(SNAME("path_changed"));
}
- if (navigation_path.size() == 0) {
+ if (navigation_result->get_path().size() == 0) {
return;
}
// Check if we can advance the navigation path
if (navigation_finished == false) {
// Advances to the next far away location.
- while (o.distance_to(navigation_path[nav_path_index] - Vector3(0, navigation_height_offset, 0)) < path_desired_distance) {
+ const Vector<Vector3> &navigation_path = navigation_result->get_path();
+ while (origin.distance_to(navigation_path[nav_path_index] - Vector3(0, navigation_height_offset, 0)) < path_desired_distance) {
nav_path_index += 1;
if (nav_path_index == navigation_path.size()) {
_check_distance_to_target();
@@ -462,7 +486,7 @@ void NavigationAgent3D::update_navigation() {
}
void NavigationAgent3D::_request_repath() {
- navigation_path.clear();
+ navigation_result->reset();
target_reached = false;
navigation_finished = false;
update_frame_id = 0;
diff --git a/scene/3d/navigation_agent_3d.h b/scene/3d/navigation_agent_3d.h
index eed6457f4a..90ceab0242 100644
--- a/scene/3d/navigation_agent_3d.h
+++ b/scene/3d/navigation_agent_3d.h
@@ -34,6 +34,8 @@
#include "scene/main/node.h"
class Node3D;
+class NavigationPathQueryParameters3D;
+class NavigationPathQueryResult3D;
class NavigationAgent3D : public Node {
GDCLASS(NavigationAgent3D, Node);
@@ -60,7 +62,8 @@ class NavigationAgent3D : public Node {
real_t path_max_distance = 3.0;
Vector3 target_location;
- Vector<Vector3> navigation_path;
+ Ref<NavigationPathQueryParameters3D> navigation_query;
+ Ref<NavigationPathQueryResult3D> navigation_result;
int nav_path_index = 0;
bool velocity_submitted = false;
Vector3 prev_safe_velocity;
@@ -150,9 +153,7 @@ public:
Vector3 get_next_location();
- Vector<Vector3> get_nav_path() const {
- return navigation_path;
- }
+ const Vector<Vector3> &get_nav_path() const;
int get_nav_path_index() const {
return nav_path_index;
diff --git a/scene/3d/node_3d.cpp b/scene/3d/node_3d.cpp
index ebf26996dd..12d2e66b41 100644
--- a/scene/3d/node_3d.cpp
+++ b/scene/3d/node_3d.cpp
@@ -786,6 +786,7 @@ void Node3D::set_identity() {
}
void Node3D::look_at(const Vector3 &p_target, const Vector3 &p_up) {
+ ERR_FAIL_COND_MSG(!is_inside_tree(), "Node not inside tree. Use look_at_from_position() instead.");
Vector3 origin = get_global_transform().origin;
look_at_from_position(origin, p_target, p_up);
}
diff --git a/scene/3d/voxel_gi.cpp b/scene/3d/voxel_gi.cpp
index 1b1ac32207..c2728960ee 100644
--- a/scene/3d/voxel_gi.cpp
+++ b/scene/3d/voxel_gi.cpp
@@ -30,6 +30,7 @@
#include "voxel_gi.h"
+#include "core/config/project_settings.h"
#include "core/core_string_names.h"
#include "mesh_instance_3d.h"
#include "multimesh_instance_3d.h"
@@ -382,7 +383,10 @@ void VoxelGI::bake(Node *p_from_node, bool p_create_visual_debug) {
float exposure_normalization = 1.0;
if (camera_attributes.is_valid()) {
- exposure_normalization = camera_attributes->calculate_exposure_normalization() * camera_attributes->get_exposure_multiplier();
+ exposure_normalization = camera_attributes->get_exposure_multiplier();
+ if (GLOBAL_GET("rendering/lights_and_shadows/use_physical_light_units")) {
+ exposure_normalization = camera_attributes->calculate_exposure_normalization();
+ }
}
Voxelizer baker;
diff --git a/scene/resources/audio_stream_wav.cpp b/scene/resources/audio_stream_wav.cpp
index 9bd1e84524..26204583ef 100644
--- a/scene/resources/audio_stream_wav.cpp
+++ b/scene/resources/audio_stream_wav.cpp
@@ -180,7 +180,7 @@ void AudioStreamPlaybackWAV::do_resample(const Depth *p_src, AudioFrame *p_dst,
final_r = p_src[pos + 1];
}
- if (sizeof(Depth) == 1) { /* conditions will not exist anymore when compiled! */
+ if constexpr (sizeof(Depth) == 1) { /* conditions will not exist anymore when compiled! */
final <<= 8;
if (is_stereo) {
final_r <<= 8;
@@ -194,7 +194,7 @@ void AudioStreamPlaybackWAV::do_resample(const Depth *p_src, AudioFrame *p_dst,
next = p_src[pos + 1];
}
- if (sizeof(Depth) == 1) {
+ if constexpr (sizeof(Depth) == 1) {
next <<= 8;
if (is_stereo) {
next_r <<= 8;
diff --git a/scene/resources/font.cpp b/scene/resources/font.cpp
index 410bbdbb40..6a278f1f39 100644
--- a/scene/resources/font.cpp
+++ b/scene/resources/font.cpp
@@ -264,7 +264,7 @@ Size2 Font::get_string_size(const String &p_text, HorizontalAlignment p_alignmen
hash = hash_djb2_one_64(p_font_size, hash);
if (p_alignment == HORIZONTAL_ALIGNMENT_FILL) {
hash = hash_djb2_one_64(hash_murmur3_one_float(p_width), hash);
- hash = hash_djb2_one_64(p_jst_flags.operator uint32_t(), hash);
+ hash = hash_djb2_one_64(p_jst_flags.operator int64_t(), hash);
}
hash = hash_djb2_one_64(p_direction, hash);
hash = hash_djb2_one_64(p_orientation, hash);
@@ -293,8 +293,8 @@ Size2 Font::get_multiline_string_size(const String &p_text, HorizontalAlignment
uint64_t hash = p_text.hash64();
hash = hash_djb2_one_64(p_font_size, hash);
hash = hash_djb2_one_64(hash_murmur3_one_float(p_width), hash);
- hash = hash_djb2_one_64(p_brk_flags.operator uint32_t(), hash);
- hash = hash_djb2_one_64(p_jst_flags.operator uint32_t(), hash);
+ hash = hash_djb2_one_64(p_brk_flags.operator int64_t(), hash);
+ hash = hash_djb2_one_64(p_jst_flags.operator int64_t(), hash);
hash = hash_djb2_one_64(p_direction, hash);
hash = hash_djb2_one_64(p_orientation, hash);
@@ -323,7 +323,7 @@ void Font::draw_string(RID p_canvas_item, const Point2 &p_pos, const String &p_t
hash = hash_djb2_one_64(p_font_size, hash);
if (p_alignment == HORIZONTAL_ALIGNMENT_FILL) {
hash = hash_djb2_one_64(hash_murmur3_one_float(p_width), hash);
- hash = hash_djb2_one_64(p_jst_flags.operator uint32_t(), hash);
+ hash = hash_djb2_one_64(p_jst_flags.operator int64_t(), hash);
}
hash = hash_djb2_one_64(p_direction, hash);
hash = hash_djb2_one_64(p_orientation, hash);
@@ -359,8 +359,8 @@ void Font::draw_multiline_string(RID p_canvas_item, const Point2 &p_pos, const S
uint64_t hash = p_text.hash64();
hash = hash_djb2_one_64(p_font_size, hash);
hash = hash_djb2_one_64(hash_murmur3_one_float(p_width), hash);
- hash = hash_djb2_one_64(p_brk_flags.operator uint32_t(), hash);
- hash = hash_djb2_one_64(p_jst_flags.operator uint32_t(), hash);
+ hash = hash_djb2_one_64(p_brk_flags.operator int64_t(), hash);
+ hash = hash_djb2_one_64(p_jst_flags.operator int64_t(), hash);
hash = hash_djb2_one_64(p_direction, hash);
hash = hash_djb2_one_64(p_orientation, hash);
@@ -396,7 +396,7 @@ void Font::draw_string_outline(RID p_canvas_item, const Point2 &p_pos, const Str
hash = hash_djb2_one_64(p_font_size, hash);
if (p_alignment == HORIZONTAL_ALIGNMENT_FILL) {
hash = hash_djb2_one_64(hash_murmur3_one_float(p_width), hash);
- hash = hash_djb2_one_64(p_jst_flags.operator uint32_t(), hash);
+ hash = hash_djb2_one_64(p_jst_flags.operator int64_t(), hash);
}
hash = hash_djb2_one_64(p_direction, hash);
hash = hash_djb2_one_64(p_orientation, hash);
@@ -432,8 +432,8 @@ void Font::draw_multiline_string_outline(RID p_canvas_item, const Point2 &p_pos,
uint64_t hash = p_text.hash64();
hash = hash_djb2_one_64(p_font_size, hash);
hash = hash_djb2_one_64(hash_murmur3_one_float(p_width), hash);
- hash = hash_djb2_one_64(p_brk_flags.operator uint32_t(), hash);
- hash = hash_djb2_one_64(p_jst_flags.operator uint32_t(), hash);
+ hash = hash_djb2_one_64(p_brk_flags.operator int64_t(), hash);
+ hash = hash_djb2_one_64(p_jst_flags.operator int64_t(), hash);
hash = hash_djb2_one_64(p_direction, hash);
hash = hash_djb2_one_64(p_orientation, hash);
diff --git a/scene/resources/tile_set.cpp b/scene/resources/tile_set.cpp
index ae83e2136f..65f3767449 100644
--- a/scene/resources/tile_set.cpp
+++ b/scene/resources/tile_set.cpp
@@ -5275,6 +5275,7 @@ void TileData::set_terrain_set(int p_terrain_set) {
}
if (tile_set) {
ERR_FAIL_COND(p_terrain_set >= tile_set->get_terrain_sets_count());
+ terrain = -1;
for (int i = 0; i < 16; i++) {
terrain_peering_bits[i] = -1;
}
diff --git a/scene/resources/visual_shader.cpp b/scene/resources/visual_shader.cpp
index 262dbe28ed..320889679d 100644
--- a/scene/resources/visual_shader.cpp
+++ b/scene/resources/visual_shader.cpp
@@ -2763,6 +2763,9 @@ const VisualShaderNodeInput::Port VisualShaderNodeInput::ports[] = {
{ Shader::MODE_CANVAS_ITEM, VisualShader::TYPE_LIGHT, VisualShaderNode::PORT_TYPE_VECTOR_4D, "light", "LIGHT" },
{ Shader::MODE_CANVAS_ITEM, VisualShader::TYPE_LIGHT, VisualShaderNode::PORT_TYPE_VECTOR_4D, "light_color", "LIGHT_COLOR" },
{ Shader::MODE_CANVAS_ITEM, VisualShader::TYPE_LIGHT, VisualShaderNode::PORT_TYPE_VECTOR_3D, "light_position", "LIGHT_POSITION" },
+ { Shader::MODE_CANVAS_ITEM, VisualShader::TYPE_LIGHT, VisualShaderNode::PORT_TYPE_VECTOR_3D, "light_direction", "LIGHT_DIRECTION" },
+ { Shader::MODE_CANVAS_ITEM, VisualShader::TYPE_LIGHT, VisualShaderNode::PORT_TYPE_BOOLEAN, "light_is_directional", "LIGHT_IS_DIRECTIONAL" },
+ { Shader::MODE_CANVAS_ITEM, VisualShader::TYPE_LIGHT, VisualShaderNode::PORT_TYPE_SCALAR, "light_energy", "LIGHT_ENERGY" },
{ Shader::MODE_CANVAS_ITEM, VisualShader::TYPE_LIGHT, VisualShaderNode::PORT_TYPE_VECTOR_3D, "light_vertex", "LIGHT_VERTEX" },
{ Shader::MODE_CANVAS_ITEM, VisualShader::TYPE_LIGHT, VisualShaderNode::PORT_TYPE_VECTOR_4D, "shadow", "SHADOW_MODULATE" },
{ Shader::MODE_CANVAS_ITEM, VisualShader::TYPE_LIGHT, VisualShaderNode::PORT_TYPE_VECTOR_2D, "screen_uv", "SCREEN_UV" },
diff --git a/servers/audio/audio_rb_resampler.cpp b/servers/audio/audio_rb_resampler.cpp
index 0cfba17563..adb0dc32ea 100644
--- a/servers/audio/audio_rb_resampler.cpp
+++ b/servers/audio/audio_rb_resampler.cpp
@@ -57,14 +57,14 @@ uint32_t AudioRBResampler::_resample(AudioFrame *p_dest, int p_todo, int32_t p_i
uint32_t pos_next = (pos + 1) & rb_mask;
// since this is a template with a known compile time value (C), conditionals go away when compiling.
- if (C == 1) {
+ if constexpr (C == 1) {
float v0 = rb[pos];
float v0n = rb[pos_next];
v0 += (v0n - v0) * frac;
p_dest[i] = AudioFrame(v0, v0);
}
- if (C == 2) {
+ if constexpr (C == 2) {
float v0 = rb[(pos << 1) + 0];
float v1 = rb[(pos << 1) + 1];
float v0n = rb[(pos_next << 1) + 0];
@@ -76,7 +76,7 @@ uint32_t AudioRBResampler::_resample(AudioFrame *p_dest, int p_todo, int32_t p_i
}
// This will probably never be used, but added anyway
- if (C == 4) {
+ if constexpr (C == 4) {
float v0 = rb[(pos << 2) + 0];
float v1 = rb[(pos << 2) + 1];
float v0n = rb[(pos_next << 2) + 0];
@@ -86,7 +86,7 @@ uint32_t AudioRBResampler::_resample(AudioFrame *p_dest, int p_todo, int32_t p_i
p_dest[i] = AudioFrame(v0, v1);
}
- if (C == 6) {
+ if constexpr (C == 6) {
float v0 = rb[(pos * 6) + 0];
float v1 = rb[(pos * 6) + 1];
float v0n = rb[(pos_next * 6) + 0];
diff --git a/servers/audio/effects/audio_effect_filter.cpp b/servers/audio/effects/audio_effect_filter.cpp
index a9409076cd..68f8e334df 100644
--- a/servers/audio/effects/audio_effect_filter.cpp
+++ b/servers/audio/effects/audio_effect_filter.cpp
@@ -36,13 +36,13 @@ void AudioEffectFilterInstance::_process_filter(const AudioFrame *p_src_frames,
for (int i = 0; i < p_frame_count; i++) {
float f = p_src_frames[i].l;
filter_process[0][0].process_one(f);
- if (S > 1) {
+ if constexpr (S > 1) {
filter_process[0][1].process_one(f);
}
- if (S > 2) {
+ if constexpr (S > 2) {
filter_process[0][2].process_one(f);
}
- if (S > 3) {
+ if constexpr (S > 3) {
filter_process[0][3].process_one(f);
}
@@ -52,13 +52,13 @@ void AudioEffectFilterInstance::_process_filter(const AudioFrame *p_src_frames,
for (int i = 0; i < p_frame_count; i++) {
float f = p_src_frames[i].r;
filter_process[1][0].process_one(f);
- if (S > 1) {
+ if constexpr (S > 1) {
filter_process[1][1].process_one(f);
}
- if (S > 2) {
+ if constexpr (S > 2) {
filter_process[1][2].process_one(f);
}
- if (S > 3) {
+ if constexpr (S > 3) {
filter_process[1][3].process_one(f);
}
diff --git a/servers/audio/effects/audio_stream_generator.cpp b/servers/audio/effects/audio_stream_generator.cpp
index b5f772408d..547b60a317 100644
--- a/servers/audio/effects/audio_stream_generator.cpp
+++ b/servers/audio/effects/audio_stream_generator.cpp
@@ -108,7 +108,7 @@ bool AudioStreamGeneratorPlayback::push_buffer(const PackedVector2Array &p_frame
}
const Vector2 *r = p_frames.ptr();
- if (sizeof(real_t) == 4) {
+ if constexpr (sizeof(real_t) == 4) {
//write directly
buffer.write((const AudioFrame *)r, to_write);
} else {
diff --git a/servers/navigation/navigation_path_query_result_2d.cpp b/servers/navigation/navigation_path_query_result_2d.cpp
index 23f001057b..8a55451e40 100644
--- a/servers/navigation/navigation_path_query_result_2d.cpp
+++ b/servers/navigation/navigation_path_query_result_2d.cpp
@@ -38,9 +38,15 @@ const Vector<Vector2> &NavigationPathQueryResult2D::get_path() const {
return path;
}
+void NavigationPathQueryResult2D::reset() {
+ path.clear();
+}
+
void NavigationPathQueryResult2D::_bind_methods() {
ClassDB::bind_method(D_METHOD("set_path", "path"), &NavigationPathQueryResult2D::set_path);
ClassDB::bind_method(D_METHOD("get_path"), &NavigationPathQueryResult2D::get_path);
+ ClassDB::bind_method(D_METHOD("reset"), &NavigationPathQueryResult2D::reset);
+
ADD_PROPERTY(PropertyInfo(Variant::PACKED_VECTOR2_ARRAY, "path"), "set_path", "get_path");
}
diff --git a/servers/navigation/navigation_path_query_result_2d.h b/servers/navigation/navigation_path_query_result_2d.h
index c98462016e..da251ef32d 100644
--- a/servers/navigation/navigation_path_query_result_2d.h
+++ b/servers/navigation/navigation_path_query_result_2d.h
@@ -45,6 +45,8 @@ protected:
public:
void set_path(const Vector<Vector2> &p_path);
const Vector<Vector2> &get_path() const;
+
+ void reset();
};
#endif // NAVIGATION_PATH_QUERY_RESULT_2D_H
diff --git a/servers/navigation/navigation_path_query_result_3d.cpp b/servers/navigation/navigation_path_query_result_3d.cpp
index 8335d70c4b..1e28352995 100644
--- a/servers/navigation/navigation_path_query_result_3d.cpp
+++ b/servers/navigation/navigation_path_query_result_3d.cpp
@@ -38,9 +38,15 @@ const Vector<Vector3> &NavigationPathQueryResult3D::get_path() const {
return path;
}
+void NavigationPathQueryResult3D::reset() {
+ path.clear();
+}
+
void NavigationPathQueryResult3D::_bind_methods() {
ClassDB::bind_method(D_METHOD("set_path", "path"), &NavigationPathQueryResult3D::set_path);
ClassDB::bind_method(D_METHOD("get_path"), &NavigationPathQueryResult3D::get_path);
+ ClassDB::bind_method(D_METHOD("reset"), &NavigationPathQueryResult3D::reset);
+
ADD_PROPERTY(PropertyInfo(Variant::PACKED_VECTOR3_ARRAY, "path"), "set_path", "get_path");
}
diff --git a/servers/navigation/navigation_path_query_result_3d.h b/servers/navigation/navigation_path_query_result_3d.h
index ff698c285f..fc143ac389 100644
--- a/servers/navigation/navigation_path_query_result_3d.h
+++ b/servers/navigation/navigation_path_query_result_3d.h
@@ -45,6 +45,8 @@ protected:
public:
void set_path(const Vector<Vector3> &p_path);
const Vector<Vector3> &get_path() const;
+
+ void reset();
};
#endif // NAVIGATION_PATH_QUERY_RESULT_3D_H
diff --git a/servers/physics_2d/godot_collision_solver_2d_sat.cpp b/servers/physics_2d/godot_collision_solver_2d_sat.cpp
index 77186d3810..8aa30ad6a4 100644
--- a/servers/physics_2d/godot_collision_solver_2d_sat.cpp
+++ b/servers/physics_2d/godot_collision_solver_2d_sat.cpp
@@ -498,7 +498,7 @@ static void _collision_segment_rectangle(const GodotShape2D *p_a, const Transfor
return;
}
- if (castA) {
+ if constexpr (castA) {
if (!separator.test_axis(rectangle_B->get_circle_axis(p_transform_b, inv, a + p_motion_a))) {
return;
}
@@ -507,7 +507,7 @@ static void _collision_segment_rectangle(const GodotShape2D *p_a, const Transfor
}
}
- if (castB) {
+ if constexpr (castB) {
if (!separator.test_axis(rectangle_B->get_circle_axis(p_transform_b, inv, a - p_motion_b))) {
return;
}
@@ -516,7 +516,7 @@ static void _collision_segment_rectangle(const GodotShape2D *p_a, const Transfor
}
}
- if (castA && castB) {
+ if constexpr (castA && castB) {
if (!separator.test_axis(rectangle_B->get_circle_axis(p_transform_b, inv, a - p_motion_b + p_motion_a))) {
return;
}
@@ -665,21 +665,21 @@ static void _collision_circle_rectangle(const GodotShape2D *p_a, const Transform
}
}
- if (castA) {
+ if constexpr (castA) {
Vector2 sphereofs = sphere + p_motion_a;
if (!separator.test_axis(rectangle_B->get_circle_axis(p_transform_b, binv, sphereofs))) {
return;
}
}
- if (castB) {
+ if constexpr (castB) {
Vector2 sphereofs = sphere - p_motion_b;
if (!separator.test_axis(rectangle_B->get_circle_axis(p_transform_b, binv, sphereofs))) {
return;
}
}
- if (castA && castB) {
+ if constexpr (castA && castB) {
Vector2 sphereofs = sphere - p_motion_b + p_motion_a;
if (!separator.test_axis(rectangle_B->get_circle_axis(p_transform_b, binv, sphereofs))) {
return;
@@ -786,7 +786,7 @@ static void _collision_rectangle_rectangle(const GodotShape2D *p_a, const Transf
return;
}
- if (withMargin) {
+ if constexpr (withMargin) {
Transform2D invA = p_transform_a.affine_inverse();
Transform2D invB = p_transform_b.affine_inverse();
@@ -794,29 +794,29 @@ static void _collision_rectangle_rectangle(const GodotShape2D *p_a, const Transf
return;
}
- if (castA || castB) {
+ if constexpr (castA || castB) {
Transform2D aofs = p_transform_a;
aofs.columns[2] += p_motion_a;
Transform2D bofs = p_transform_b;
bofs.columns[2] += p_motion_b;
- Transform2D aofsinv = aofs.affine_inverse();
- Transform2D bofsinv = bofs.affine_inverse();
+ [[maybe_unused]] Transform2D aofsinv = aofs.affine_inverse();
+ [[maybe_unused]] Transform2D bofsinv = bofs.affine_inverse();
- if (castA) {
+ if constexpr (castA) {
if (!separator.test_axis(rectangle_A->get_box_axis(aofs, aofsinv, rectangle_B, p_transform_b, invB))) {
return;
}
}
- if (castB) {
+ if constexpr (castB) {
if (!separator.test_axis(rectangle_A->get_box_axis(p_transform_a, invA, rectangle_B, bofs, bofsinv))) {
return;
}
}
- if (castA && castB) {
+ if constexpr (castA && castB) {
if (!separator.test_axis(rectangle_A->get_box_axis(aofs, aofsinv, rectangle_B, bofs, bofsinv))) {
return;
}
@@ -871,7 +871,7 @@ static void _collision_rectangle_capsule(const GodotShape2D *p_a, const Transfor
}
}
- if (castA) {
+ if constexpr (castA) {
Vector2 capsule_endpoint = p_transform_b.get_origin() + p_transform_b.columns[1] * capsule_dir;
capsule_endpoint -= p_motion_a;
@@ -880,7 +880,7 @@ static void _collision_rectangle_capsule(const GodotShape2D *p_a, const Transfor
}
}
- if (castB) {
+ if constexpr (castB) {
Vector2 capsule_endpoint = p_transform_b.get_origin() + p_transform_b.columns[1] * capsule_dir;
capsule_endpoint += p_motion_b;
@@ -889,7 +889,7 @@ static void _collision_rectangle_capsule(const GodotShape2D *p_a, const Transfor
}
}
- if (castA && castB) {
+ if constexpr (castA && castB) {
Vector2 capsule_endpoint = p_transform_b.get_origin() + p_transform_b.columns[1] * capsule_dir;
capsule_endpoint -= p_motion_a;
capsule_endpoint += p_motion_b;
@@ -931,7 +931,7 @@ static void _collision_rectangle_convex_polygon(const GodotShape2D *p_a, const T
//convex faces
Transform2D boxinv;
- if (withMargin) {
+ if constexpr (withMargin) {
boxinv = p_transform_a.affine_inverse();
}
for (int i = 0; i < convex_B->get_point_count(); i++) {
@@ -939,22 +939,22 @@ static void _collision_rectangle_convex_polygon(const GodotShape2D *p_a, const T
return;
}
- if (withMargin) {
+ if constexpr (withMargin) {
//all points vs all points need to be tested if margin exist
if (!separator.test_axis(rectangle_A->get_circle_axis(p_transform_a, boxinv, p_transform_b.xform(convex_B->get_point(i))))) {
return;
}
- if (castA) {
+ if constexpr (castA) {
if (!separator.test_axis(rectangle_A->get_circle_axis(p_transform_a, boxinv, p_transform_b.xform(convex_B->get_point(i)) - p_motion_a))) {
return;
}
}
- if (castB) {
+ if constexpr (castB) {
if (!separator.test_axis(rectangle_A->get_circle_axis(p_transform_a, boxinv, p_transform_b.xform(convex_B->get_point(i)) + p_motion_b))) {
return;
}
}
- if (castA && castB) {
+ if constexpr (castA && castB) {
if (!separator.test_axis(rectangle_A->get_circle_axis(p_transform_a, boxinv, p_transform_b.xform(convex_B->get_point(i)) + p_motion_b - p_motion_a))) {
return;
}
diff --git a/servers/physics_2d/godot_physics_server_2d.cpp b/servers/physics_2d/godot_physics_server_2d.cpp
index 6ce8175e6c..f1551df2e3 100644
--- a/servers/physics_2d/godot_physics_server_2d.cpp
+++ b/servers/physics_2d/godot_physics_server_2d.cpp
@@ -1032,6 +1032,7 @@ RID GodotPhysicsServer2D::joint_create() {
void GodotPhysicsServer2D::joint_clear(RID p_joint) {
GodotJoint2D *joint = joint_owner.get_or_null(p_joint);
+ ERR_FAIL_NULL(joint);
if (joint->get_type() != JOINT_TYPE_MAX) {
GodotJoint2D *empty_joint = memnew(GodotJoint2D);
empty_joint->copy_settings_from(joint);
@@ -1158,38 +1159,38 @@ void GodotPhysicsServer2D::joint_make_damped_spring(RID p_joint, const Vector2 &
}
void GodotPhysicsServer2D::pin_joint_set_param(RID p_joint, PinJointParam p_param, real_t p_value) {
- GodotJoint2D *j = joint_owner.get_or_null(p_joint);
- ERR_FAIL_COND(!j);
- ERR_FAIL_COND(j->get_type() != JOINT_TYPE_PIN);
+ GodotJoint2D *joint = joint_owner.get_or_null(p_joint);
+ ERR_FAIL_NULL(joint);
+ ERR_FAIL_COND(joint->get_type() != JOINT_TYPE_PIN);
- GodotPinJoint2D *pin_joint = static_cast<GodotPinJoint2D *>(j);
+ GodotPinJoint2D *pin_joint = static_cast<GodotPinJoint2D *>(joint);
pin_joint->set_param(p_param, p_value);
}
real_t GodotPhysicsServer2D::pin_joint_get_param(RID p_joint, PinJointParam p_param) const {
- GodotJoint2D *j = joint_owner.get_or_null(p_joint);
- ERR_FAIL_COND_V(!j, 0);
- ERR_FAIL_COND_V(j->get_type() != JOINT_TYPE_PIN, 0);
+ GodotJoint2D *joint = joint_owner.get_or_null(p_joint);
+ ERR_FAIL_NULL_V(joint, 0);
+ ERR_FAIL_COND_V(joint->get_type() != JOINT_TYPE_PIN, 0);
- GodotPinJoint2D *pin_joint = static_cast<GodotPinJoint2D *>(j);
+ GodotPinJoint2D *pin_joint = static_cast<GodotPinJoint2D *>(joint);
return pin_joint->get_param(p_param);
}
void GodotPhysicsServer2D::damped_spring_joint_set_param(RID p_joint, DampedSpringParam p_param, real_t p_value) {
- GodotJoint2D *j = joint_owner.get_or_null(p_joint);
- ERR_FAIL_COND(!j);
- ERR_FAIL_COND(j->get_type() != JOINT_TYPE_DAMPED_SPRING);
+ GodotJoint2D *joint = joint_owner.get_or_null(p_joint);
+ ERR_FAIL_NULL(joint);
+ ERR_FAIL_COND(joint->get_type() != JOINT_TYPE_DAMPED_SPRING);
- GodotDampedSpringJoint2D *dsj = static_cast<GodotDampedSpringJoint2D *>(j);
+ GodotDampedSpringJoint2D *dsj = static_cast<GodotDampedSpringJoint2D *>(joint);
dsj->set_param(p_param, p_value);
}
real_t GodotPhysicsServer2D::damped_spring_joint_get_param(RID p_joint, DampedSpringParam p_param) const {
- GodotJoint2D *j = joint_owner.get_or_null(p_joint);
- ERR_FAIL_COND_V(!j, 0);
- ERR_FAIL_COND_V(j->get_type() != JOINT_TYPE_DAMPED_SPRING, 0);
+ GodotJoint2D *joint = joint_owner.get_or_null(p_joint);
+ ERR_FAIL_NULL_V(joint, 0);
+ ERR_FAIL_COND_V(joint->get_type() != JOINT_TYPE_DAMPED_SPRING, 0);
- GodotDampedSpringJoint2D *dsj = static_cast<GodotDampedSpringJoint2D *>(j);
+ GodotDampedSpringJoint2D *dsj = static_cast<GodotDampedSpringJoint2D *>(joint);
return dsj->get_param(p_param);
}
diff --git a/servers/physics_3d/godot_physics_server_3d.cpp b/servers/physics_3d/godot_physics_server_3d.cpp
index f3a589d469..68db5df144 100644
--- a/servers/physics_3d/godot_physics_server_3d.cpp
+++ b/servers/physics_3d/godot_physics_server_3d.cpp
@@ -1210,6 +1210,7 @@ RID GodotPhysicsServer3D::joint_create() {
void GodotPhysicsServer3D::joint_clear(RID p_joint) {
GodotJoint3D *joint = joint_owner.get_or_null(p_joint);
+ ERR_FAIL_NULL(joint);
if (joint->get_type() != JOINT_TYPE_MAX) {
GodotJoint3D *empty_joint = memnew(GodotJoint3D);
empty_joint->copy_settings_from(joint);
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 35953a7120..3a9c695653 100644
--- a/servers/rendering/renderer_rd/forward_clustered/render_forward_clustered.cpp
+++ b/servers/rendering/renderer_rd/forward_clustered/render_forward_clustered.cpp
@@ -276,7 +276,7 @@ void RenderForwardClustered::_render_list_template(RenderingDevice::DrawListID p
SceneState::PushConstant push_constant;
- if (p_pass_mode == PASS_MODE_DEPTH_MATERIAL) {
+ if constexpr (p_pass_mode == PASS_MODE_DEPTH_MATERIAL) {
push_constant.uv_offset = Math::make_half_float(p_params->uv_offset.y) << 16;
push_constant.uv_offset |= Math::make_half_float(p_params->uv_offset.x);
} else {
@@ -355,7 +355,7 @@ void RenderForwardClustered::_render_list_template(RenderingDevice::DrawListID p
uint32_t pipeline_color_pass_flags = 0;
uint32_t pipeline_specialization = 0;
- if (p_pass_mode == PASS_MODE_COLOR) {
+ if constexpr (p_pass_mode == PASS_MODE_COLOR) {
if (element_info.uses_softshadow) {
pipeline_specialization |= SceneShaderForwardClustered::SHADER_SPECIALIZATION_SOFT_SHADOWS;
}
@@ -714,6 +714,14 @@ void RenderForwardClustered::_fill_instance_data(RenderListType p_render_list, i
instance_data.lightmap_uv_scale[2] = inst->lightmap_uv_scale.size.x;
instance_data.lightmap_uv_scale[3] = inst->lightmap_uv_scale.size.y;
+#ifdef REAL_T_IS_DOUBLE
+ // Split the origin into two components, the float approximation and the missing precision
+ // In the shader we will combine these back together to restore the lost precision.
+ RendererRD::MaterialStorage::split_double(inst->transform.origin.x, &instance_data.transform[12], &instance_data.transform[3]);
+ RendererRD::MaterialStorage::split_double(inst->transform.origin.y, &instance_data.transform[13], &instance_data.transform[7]);
+ RendererRD::MaterialStorage::split_double(inst->transform.origin.z, &instance_data.transform[14], &instance_data.transform[11]);
+#endif
+
bool cant_repeat = instance_data.flags & INSTANCE_DATA_FLAG_MULTIMESH || inst->mesh_instance.is_valid();
if (prev_surface != nullptr && !cant_repeat && prev_surface->sort.sort_key1 == surface->sort.sort_key1 && prev_surface->sort.sort_key2 == surface->sort.sort_key2 && repeats < RenderElementInfo::MAX_REPEATS) {
@@ -3039,6 +3047,11 @@ RenderForwardClustered::RenderForwardClustered() {
{
defines += "\n#define MATERIAL_UNIFORM_SET " + itos(MATERIAL_UNIFORM_SET) + "\n";
}
+#ifdef REAL_T_IS_DOUBLE
+ {
+ defines += "\n#define USE_DOUBLE_PRECISION \n";
+ }
+#endif
scene_shader.init(defines);
}
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 75ccf1add5..1987577464 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
@@ -621,10 +621,10 @@ void SceneShaderForwardClustered::init(const String p_defines) {
//shader compiler
ShaderCompiler::DefaultIdentifierActions actions;
- actions.renames["MODEL_MATRIX"] = "model_matrix";
+ actions.renames["MODEL_MATRIX"] = "read_model_matrix";
actions.renames["MODEL_NORMAL_MATRIX"] = "model_normal_matrix";
actions.renames["VIEW_MATRIX"] = "scene_data.view_matrix";
- actions.renames["INV_VIEW_MATRIX"] = "scene_data.inv_view_matrix";
+ actions.renames["INV_VIEW_MATRIX"] = "inv_view_matrix";
actions.renames["PROJECTION_MATRIX"] = "projection_matrix";
actions.renames["INV_PROJECTION_MATRIX"] = "inv_projection_matrix";
actions.renames["MODELVIEW_MATRIX"] = "modelview";
@@ -757,6 +757,8 @@ void SceneShaderForwardClustered::init(const String p_defines) {
actions.usage_defines["RADIANCE"] = "#define CUSTOM_RADIANCE_USED\n";
actions.usage_defines["IRRADIANCE"] = "#define CUSTOM_IRRADIANCE_USED\n";
+ actions.usage_defines["MODEL_MATRIX"] = "#define MODEL_MATRIX_USED\n";
+
actions.render_mode_defines["skip_vertex_transform"] = "#define SKIP_TRANSFORM_USED\n";
actions.render_mode_defines["world_vertex_coords"] = "#define VERTEX_WORLD_COORDS_USED\n";
actions.render_mode_defines["ensure_correct_normals"] = "#define ENSURE_CORRECT_NORMALS\n";
diff --git a/servers/rendering/renderer_rd/forward_mobile/render_forward_mobile.cpp b/servers/rendering/renderer_rd/forward_mobile/render_forward_mobile.cpp
index 6c1b69148c..f458063aea 100644
--- a/servers/rendering/renderer_rd/forward_mobile/render_forward_mobile.cpp
+++ b/servers/rendering/renderer_rd/forward_mobile/render_forward_mobile.cpp
@@ -1757,6 +1757,14 @@ void RenderForwardMobile::_render_list_template(RenderingDevice::DrawListID p_dr
RendererRD::MaterialStorage::store_transform(Transform3D(), push_constant.transform);
}
+#ifdef REAL_T_IS_DOUBLE
+ // Split the origin into two components, the float approximation and the missing precision
+ // In the shader we will combine these back together to restore the lost precision.
+ RendererRD::MaterialStorage::split_double(inst->transform.origin.x, &push_constant.transform[12], &push_constant.transform[3]);
+ RendererRD::MaterialStorage::split_double(inst->transform.origin.y, &push_constant.transform[13], &push_constant.transform[7]);
+ RendererRD::MaterialStorage::split_double(inst->transform.origin.z, &push_constant.transform[14], &push_constant.transform[11]);
+#endif
+
push_constant.flags = inst->flags_cache;
push_constant.gi_offset = inst->gi_offset_cache;
push_constant.layer_mask = inst->layer_mask;
@@ -2472,6 +2480,11 @@ RenderForwardMobile::RenderForwardMobile() {
{
defines += "\n#define MATERIAL_UNIFORM_SET " + itos(MATERIAL_UNIFORM_SET) + "\n";
}
+#ifdef REAL_T_IS_DOUBLE
+ {
+ defines += "\n#define USE_DOUBLE_PRECISION \n";
+ }
+#endif
scene_shader.init(defines);
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 383ed9247d..691d431b82 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
@@ -521,10 +521,10 @@ void SceneShaderForwardMobile::init(const String p_defines) {
//shader compiler
ShaderCompiler::DefaultIdentifierActions actions;
- actions.renames["MODEL_MATRIX"] = "model_matrix";
+ actions.renames["MODEL_MATRIX"] = "read_model_matrix";
actions.renames["MODEL_NORMAL_MATRIX"] = "model_normal_matrix";
actions.renames["VIEW_MATRIX"] = "scene_data.view_matrix";
- actions.renames["INV_VIEW_MATRIX"] = "scene_data.inv_view_matrix";
+ actions.renames["INV_VIEW_MATRIX"] = "inv_view_matrix";
actions.renames["PROJECTION_MATRIX"] = "projection_matrix";
actions.renames["INV_PROJECTION_MATRIX"] = "inv_projection_matrix";
actions.renames["MODELVIEW_MATRIX"] = "modelview";
@@ -657,6 +657,8 @@ void SceneShaderForwardMobile::init(const String p_defines) {
actions.usage_defines["RADIANCE"] = "#define CUSTOM_RADIANCE_USED\n";
actions.usage_defines["IRRADIANCE"] = "#define CUSTOM_IRRADIANCE_USED\n";
+ actions.usage_defines["MODEL_MATRIX"] = "#define MODEL_MATRIX_USED\n";
+
actions.render_mode_defines["skip_vertex_transform"] = "#define SKIP_TRANSFORM_USED\n";
actions.render_mode_defines["world_vertex_coords"] = "#define VERTEX_WORLD_COORDS_USED\n";
actions.render_mode_defines["ensure_correct_normals"] = "#define ENSURE_CORRECT_NORMALS\n";
diff --git a/servers/rendering/renderer_rd/renderer_canvas_render_rd.cpp b/servers/rendering/renderer_rd/renderer_canvas_render_rd.cpp
index 0210151420..bbb53f7b97 100644
--- a/servers/rendering/renderer_rd/renderer_canvas_render_rd.cpp
+++ b/servers/rendering/renderer_rd/renderer_canvas_render_rd.cpp
@@ -2512,6 +2512,8 @@ RendererCanvasRenderRD::RendererCanvasRenderRD() {
actions.renames["VERTEX_ID"] = "gl_VertexIndex";
actions.renames["LIGHT_POSITION"] = "light_position";
+ actions.renames["LIGHT_DIRECTION"] = "light_direction";
+ actions.renames["LIGHT_IS_DIRECTIONAL"] = "is_directional";
actions.renames["LIGHT_COLOR"] = "light_color";
actions.renames["LIGHT_ENERGY"] = "light_energy";
actions.renames["LIGHT"] = "light";
diff --git a/servers/rendering/renderer_rd/renderer_compositor_rd.cpp b/servers/rendering/renderer_rd/renderer_compositor_rd.cpp
index f169692ea0..a50742f91a 100644
--- a/servers/rendering/renderer_rd/renderer_compositor_rd.cpp
+++ b/servers/rendering/renderer_rd/renderer_compositor_rd.cpp
@@ -170,6 +170,10 @@ void RendererCompositorRD::finalize() {
}
void RendererCompositorRD::set_boot_image(const Ref<Image> &p_image, const Color &p_color, bool p_scale, bool p_use_filter) {
+ if (p_image.is_null() || p_image->is_empty()) {
+ return;
+ }
+
RD::get_singleton()->prepare_screen_for_drawing();
RID texture = texture_storage->texture_allocate();
diff --git a/servers/rendering/renderer_rd/renderer_scene_render_rd.cpp b/servers/rendering/renderer_rd/renderer_scene_render_rd.cpp
index 667d910a69..74b8f0890f 100644
--- a/servers/rendering/renderer_rd/renderer_scene_render_rd.cpp
+++ b/servers/rendering/renderer_rd/renderer_scene_render_rd.cpp
@@ -3621,6 +3621,7 @@ TypedArray<Image> RendererSceneRenderRD::bake_render_uv2(RID p_base, const Typed
//RID sampled_light;
RenderGeometryInstance *gi = geometry_instance_create(p_base);
+ ERR_FAIL_NULL_V(gi, TypedArray<Image>());
uint32_t sc = RSG::mesh_storage->mesh_get_surface_count(p_base);
Vector<RID> materials;
diff --git a/servers/rendering/renderer_rd/shaders/canvas.glsl b/servers/rendering/renderer_rd/shaders/canvas.glsl
index f24d90a032..45dc63aa17 100644
--- a/servers/rendering/renderer_rd/shaders/canvas.glsl
+++ b/servers/rendering/renderer_rd/shaders/canvas.glsl
@@ -313,6 +313,14 @@ vec4 light_compute(
vec2 uv,
vec4 color, bool is_directional) {
vec4 light = vec4(0.0);
+ vec3 light_direction = vec3(0.0);
+
+ if (is_directional) {
+ light_direction = normalize(mix(vec3(light_position.xy, 0.0), vec3(0, 0, 1), light_position.z));
+ light_position = vec3(0.0);
+ } else {
+ light_direction = normalize(light_position - light_vertex);
+ }
#CODE : LIGHT
@@ -686,7 +694,6 @@ void main() {
vec3 light_pos = vec3(light_array.data[light_base].position, light_array.data[light_base].height);
vec3 pos = light_vertex;
vec3 light_vec = normalize(light_pos - pos);
- float cNdotL = max(0.0, dot(normal, light_vec));
light_color.rgb = light_normal_compute(light_vec, normal, base_color, light_color.rgb, specular_shininess, specular_shininess_used);
}
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 d41474118d..1a8a1f3aa3 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
@@ -129,12 +129,52 @@ invariant gl_Position;
#GLOBALS
+#ifdef USE_DOUBLE_PRECISION
+// Helper functions for emulating double precision when adding floats.
+vec3 quick_two_sum(vec3 a, vec3 b, out vec3 out_p) {
+ vec3 s = a + b;
+ out_p = b - (s - a);
+ return s;
+}
+
+vec3 two_sum(vec3 a, vec3 b, out vec3 out_p) {
+ vec3 s = a + b;
+ vec3 v = s - a;
+ out_p = (a - (s - v)) + (b - v);
+ return s;
+}
+
+vec3 double_add_vec3(vec3 base_a, vec3 prec_a, vec3 base_b, vec3 prec_b, out vec3 out_precision) {
+ vec3 s, t, se, te;
+ s = two_sum(base_a, base_b, se);
+ t = two_sum(prec_a, prec_b, te);
+ se += t;
+ s = quick_two_sum(s, se, se);
+ se += te;
+ s = quick_two_sum(s, se, out_precision);
+ return s;
+}
+#endif
+
void vertex_shader(in uint instance_index, in bool is_multimesh, in uint multimesh_offset, in SceneData scene_data, in mat4 model_matrix, out vec4 screen_pos) {
vec4 instance_custom = vec4(0.0);
#if defined(COLOR_USED)
color_interp = color_attrib;
#endif
+ mat4 inv_view_matrix = scene_data.inv_view_matrix;
+
+#ifdef USE_DOUBLE_PRECISION
+ vec3 model_precision = vec3(model_matrix[0][3], model_matrix[1][3], model_matrix[2][3]);
+ model_matrix[0][3] = 0.0;
+ model_matrix[1][3] = 0.0;
+ model_matrix[2][3] = 0.0;
+ vec3 view_precision = vec3(inv_view_matrix[0][3], inv_view_matrix[1][3], inv_view_matrix[2][3]);
+ inv_view_matrix[0][3] = 0.0;
+ inv_view_matrix[1][3] = 0.0;
+ inv_view_matrix[2][3] = 0.0;
+#endif
+
mat3 model_normal_matrix;
if (bool(instances.data[instance_index].flags & INSTANCE_FLAGS_NON_UNIFORM_SCALE)) {
model_normal_matrix = transpose(inverse(mat3(model_matrix)));
@@ -142,11 +182,12 @@ void vertex_shader(in uint instance_index, in bool is_multimesh, in uint multime
model_normal_matrix = mat3(model_matrix);
}
+ mat4 matrix;
+ mat4 read_model_matrix = model_matrix;
+
if (is_multimesh) {
//multimesh, instances are for it
- mat4 matrix;
-
#ifdef USE_PARTICLE_TRAILS
uint trail_size = (instances.data[instance_index].flags >> INSTANCE_FLAGS_PARTICLE_TRAIL_SHIFT) & INSTANCE_FLAGS_PARTICLE_TRAIL_MASK;
uint stride = 3 + 1 + 1; //particles always uses this format
@@ -232,7 +273,14 @@ void vertex_shader(in uint instance_index, in bool is_multimesh, in uint multime
#endif
//transpose
matrix = transpose(matrix);
- model_matrix = model_matrix * matrix;
+#if !defined(USE_DOUBLE_PRECISION) || defined(SKIP_TRANSFORM_USED) || defined(VERTEX_WORLD_COORDS_USED) || defined(MODEL_MATRIX_USED)
+ // Normally we can bake the multimesh transform into the model matrix, but when using double precision
+ // we avoid baking it in so we can emulate high precision.
+ read_model_matrix = model_matrix * matrix;
+#if !defined(USE_DOUBLE_PRECISION) || defined(SKIP_TRANSFORM_USED) || defined(VERTEX_WORLD_COORDS_USED)
+ model_matrix = read_model_matrix;
+#endif // !defined(USE_DOUBLE_PRECISION) || defined(SKIP_TRANSFORM_USED) || defined(VERTEX_WORLD_COORDS_USED)
+#endif // !defined(USE_DOUBLE_PRECISION) || defined(SKIP_TRANSFORM_USED) || defined(VERTEX_WORLD_COORDS_USED) || defined(MODEL_MATRIX_USED)
model_normal_matrix = model_normal_matrix * mat3(matrix);
}
@@ -297,7 +345,22 @@ void vertex_shader(in uint instance_index, in bool is_multimesh, in uint multime
// using local coordinates (default)
#if !defined(SKIP_TRANSFORM_USED) && !defined(VERTEX_WORLD_COORDS_USED)
+#ifdef USE_DOUBLE_PRECISION
+ // We separate the basis from the origin because the basis is fine with single point precision.
+ // Then we combine the translations from the model matrix and the view matrix using emulated doubles.
+ // We add the result to the vertex and ignore the final lost precision.
+ vec3 model_origin = model_matrix[3].xyz;
+ if (is_multimesh) {
+ vertex = mat3(matrix) * vertex;
+ model_origin = double_add_vec3(model_origin, model_precision, matrix[3].xyz, vec3(0.0), model_precision);
+ }
+ vertex = mat3(model_matrix) * vertex;
+ vec3 temp_precision; // Will be ignored.
+ vertex += double_add_vec3(model_origin, model_precision, scene_data.inv_view_matrix[3].xyz, view_precision, temp_precision);
+ vertex = mat3(scene_data.view_matrix) * vertex;
+#else
vertex = (modelview * vec4(vertex, 1.0)).xyz;
+#endif
#ifdef NORMAL_USED
normal = modelview_normal * normal;
#endif
@@ -490,7 +553,6 @@ layout(location = 10) in flat uint instance_index_interp;
//defines to keep compatibility with vertex
-#define model_matrix instances.data[draw_call.instance_index].transform
#ifdef USE_MULTIVIEW
#define projection_matrix scene_data.projection_matrix_view[ViewIndex]
#define inv_projection_matrix scene_data.inv_projection_matrix_view[ViewIndex]
@@ -737,6 +799,17 @@ void fragment_shader(in SceneData scene_data) {
vec2 alpha_texture_coordinate = vec2(0.0, 0.0);
#endif // ALPHA_ANTIALIASING_EDGE_USED
+ mat4 inv_view_matrix = scene_data.inv_view_matrix;
+ mat4 read_model_matrix = instances.data[instance_index].transform;
+#ifdef USE_DOUBLE_PRECISION
+ read_model_matrix[0][3] = 0.0;
+ read_model_matrix[1][3] = 0.0;
+ read_model_matrix[2][3] = 0.0;
+ inv_view_matrix[0][3] = 0.0;
+ inv_view_matrix[1][3] = 0.0;
+ inv_view_matrix[2][3] = 0.0;
+#endif
+
{
#CODE : FRAGMENT
}
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 a109fd4d75..33fd4c35b1 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
@@ -123,6 +123,33 @@ invariant gl_Position;
#define scene_data scene_data_block.data
+#ifdef USE_DOUBLE_PRECISION
+// Helper functions for emulating double precision when adding floats.
+vec3 quick_two_sum(vec3 a, vec3 b, out vec3 out_p) {
+ vec3 s = a + b;
+ out_p = b - (s - a);
+ return s;
+}
+
+vec3 two_sum(vec3 a, vec3 b, out vec3 out_p) {
+ vec3 s = a + b;
+ vec3 v = s - a;
+ out_p = (a - (s - v)) + (b - v);
+ return s;
+}
+
+vec3 double_add_vec3(vec3 base_a, vec3 prec_a, vec3 base_b, vec3 prec_b, out vec3 out_precision) {
+ vec3 s, t, se, te;
+ s = two_sum(base_a, base_b, se);
+ t = two_sum(prec_a, prec_b, te);
+ se += t;
+ s = quick_two_sum(s, se, se);
+ se += te;
+ s = quick_two_sum(s, se, out_precision);
+ return s;
+}
+#endif
+
void main() {
vec4 instance_custom = vec4(0.0);
#if defined(COLOR_USED)
@@ -132,6 +159,17 @@ void main() {
bool is_multimesh = bool(draw_call.flags & INSTANCE_FLAGS_MULTIMESH);
mat4 model_matrix = draw_call.transform;
+ mat4 inv_view_matrix = scene_data.inv_view_matrix;
+#ifdef USE_DOUBLE_PRECISION
+ vec3 model_precision = vec3(model_matrix[0][3], model_matrix[1][3], model_matrix[2][3]);
+ model_matrix[0][3] = 0.0;
+ model_matrix[1][3] = 0.0;
+ model_matrix[2][3] = 0.0;
+ vec3 view_precision = vec3(inv_view_matrix[0][3], inv_view_matrix[1][3], inv_view_matrix[2][3]);
+ inv_view_matrix[0][3] = 0.0;
+ inv_view_matrix[1][3] = 0.0;
+ inv_view_matrix[2][3] = 0.0;
+#endif
mat3 model_normal_matrix;
if (bool(draw_call.flags & INSTANCE_FLAGS_NON_UNIFORM_SCALE)) {
@@ -140,11 +178,12 @@ void main() {
model_normal_matrix = mat3(model_matrix);
}
+ mat4 matrix;
+ mat4 read_model_matrix = model_matrix;
+
if (is_multimesh) {
//multimesh, instances are for it
- mat4 matrix;
-
#ifdef USE_PARTICLE_TRAILS
uint trail_size = (draw_call.flags >> INSTANCE_FLAGS_PARTICLE_TRAIL_SHIFT) & INSTANCE_FLAGS_PARTICLE_TRAIL_MASK;
uint stride = 3 + 1 + 1; //particles always uses this format
@@ -230,7 +269,15 @@ void main() {
#endif
//transpose
matrix = transpose(matrix);
- model_matrix = model_matrix * matrix;
+
+#if !defined(USE_DOUBLE_PRECISION) || defined(SKIP_TRANSFORM_USED) || defined(VERTEX_WORLD_COORDS_USED) || defined(MODEL_MATRIX_USED)
+ // Normally we can bake the multimesh transform into the model matrix, but when using double precision
+ // we avoid baking it in so we can emulate high precision.
+ read_model_matrix = model_matrix * matrix;
+#if !defined(USE_DOUBLE_PRECISION) || defined(SKIP_TRANSFORM_USED) || defined(VERTEX_WORLD_COORDS_USED)
+ model_matrix = read_model_matrix;
+#endif // !defined(USE_DOUBLE_PRECISION) || defined(SKIP_TRANSFORM_USED) || defined(VERTEX_WORLD_COORDS_USED)
+#endif // !defined(USE_DOUBLE_PRECISION) || defined(SKIP_TRANSFORM_USED) || defined(VERTEX_WORLD_COORDS_USED) || defined(MODEL_MATRIX_USED)
model_normal_matrix = model_normal_matrix * mat3(matrix);
}
@@ -297,7 +344,22 @@ void main() {
// using local coordinates (default)
#if !defined(SKIP_TRANSFORM_USED) && !defined(VERTEX_WORLD_COORDS_USED)
+#ifdef USE_DOUBLE_PRECISION
+ // We separate the basis from the origin because the basis is fine with single point precision.
+ // Then we combine the translations from the model matrix and the view matrix using emulated doubles.
+ // We add the result to the vertex and ignore the final lost precision.
+ vec3 model_origin = model_matrix[3].xyz;
+ if (is_multimesh) {
+ vertex = mat3(matrix) * vertex;
+ model_origin = double_add_vec3(model_origin, model_precision, matrix[3].xyz, vec3(0.0), model_precision);
+ }
+ vertex = mat3(model_matrix) * vertex;
+ vec3 temp_precision;
+ vertex += double_add_vec3(model_origin, model_precision, scene_data.inv_view_matrix[3].xyz, view_precision, temp_precision);
+ vertex = mat3(scene_data.view_matrix) * vertex;
+#else
vertex = (modelview * vec4(vertex, 1.0)).xyz;
+#endif
#ifdef NORMAL_USED
normal = modelview_normal * normal;
#endif
@@ -468,7 +530,6 @@ layout(location = 9) highp in float dp_clip;
//defines to keep compatibility with vertex
-#define model_matrix draw_call.transform
#ifdef USE_MULTIVIEW
#define projection_matrix scene_data.projection_matrix_view[ViewIndex]
#define inv_projection_matrix scene_data.inv_projection_matrix_view[ViewIndex]
@@ -685,6 +746,17 @@ void main() {
vec2 alpha_texture_coordinate = vec2(0.0, 0.0);
#endif // ALPHA_ANTIALIASING_EDGE_USED
+ mat4 inv_view_matrix = scene_data.inv_view_matrix;
+ mat4 read_model_matrix = draw_call.transform;
+#ifdef USE_DOUBLE_PRECISION
+ read_model_matrix[0][3] = 0.0;
+ read_model_matrix[1][3] = 0.0;
+ read_model_matrix[2][3] = 0.0;
+ inv_view_matrix[0][3] = 0.0;
+ inv_view_matrix[1][3] = 0.0;
+ inv_view_matrix[2][3] = 0.0;
+#endif
+
{
#CODE : FRAGMENT
}
diff --git a/servers/rendering/renderer_rd/shaders/particles.glsl b/servers/rendering/renderer_rd/shaders/particles.glsl
index fb5759bc17..3a6dd579b9 100644
--- a/servers/rendering/renderer_rd/shaders/particles.glsl
+++ b/servers/rendering/renderer_rd/shaders/particles.glsl
@@ -475,7 +475,7 @@ void main() {
float particle_size = FRAME.particle_size;
-#ifdef USE_COLLISON_SCALE
+#ifdef USE_COLLISION_SCALE
particle_size *= dot(vec3(length(PARTICLE.xform[0].xyz), length(PARTICLE.xform[1].xyz), length(PARTICLE.xform[2].xyz)), vec3(0.33333333333));
diff --git a/servers/rendering/renderer_rd/storage_rd/material_storage.cpp b/servers/rendering/renderer_rd/storage_rd/material_storage.cpp
index b36a028f04..70243a9275 100644
--- a/servers/rendering/renderer_rd/storage_rd/material_storage.cpp
+++ b/servers/rendering/renderer_rd/storage_rd/material_storage.cpp
@@ -2526,7 +2526,7 @@ void MaterialStorage::_update_queued_materials() {
material_update_list.remove(&material->update_element);
if (uniforms_changed) {
- //some implementations such as 3D renderer cache the matreial uniform set, so update is required
+ //some implementations such as 3D renderer cache the material uniform set, so update is required
material->dependency.changed_notify(Dependency::DEPENDENCY_CHANGED_MATERIAL);
}
}
diff --git a/servers/rendering/renderer_rd/storage_rd/material_storage.h b/servers/rendering/renderer_rd/storage_rd/material_storage.h
index db2e4cfa2a..2ce6550cc1 100644
--- a/servers/rendering/renderer_rd/storage_rd/material_storage.h
+++ b/servers/rendering/renderer_rd/storage_rd/material_storage.h
@@ -311,6 +311,18 @@ 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) {
+ 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;
+ }
+#endif
+
/* Samplers */
_FORCE_INLINE_ RID sampler_rd_get_default(RS::CanvasItemTextureFilter p_filter, RS::CanvasItemTextureRepeat p_repeat) {
diff --git a/servers/rendering/renderer_rd/storage_rd/mesh_storage.cpp b/servers/rendering/renderer_rd/storage_rd/mesh_storage.cpp
index 1827b73507..b089b96101 100644
--- a/servers/rendering/renderer_rd/storage_rd/mesh_storage.cpp
+++ b/servers/rendering/renderer_rd/storage_rd/mesh_storage.cpp
@@ -2021,6 +2021,7 @@ Transform2D MeshStorage::skeleton_bone_get_transform_2d(RID p_skeleton, int p_bo
void MeshStorage::skeleton_set_base_transform_2d(RID p_skeleton, const Transform2D &p_base_transform) {
Skeleton *skeleton = skeleton_owner.get_or_null(p_skeleton);
+ ERR_FAIL_NULL(skeleton);
ERR_FAIL_COND(!skeleton->use_2d);
skeleton->base_transform_2d = p_base_transform;
diff --git a/servers/rendering/renderer_rd/storage_rd/particles_storage.cpp b/servers/rendering/renderer_rd/storage_rd/particles_storage.cpp
index 07d682bcc1..4dca2233fe 100644
--- a/servers/rendering/renderer_rd/storage_rd/particles_storage.cpp
+++ b/servers/rendering/renderer_rd/storage_rd/particles_storage.cpp
@@ -102,7 +102,7 @@ ParticlesStorage::ParticlesStorage() {
actions.render_mode_defines["disable_force"] = "#define DISABLE_FORCE\n";
actions.render_mode_defines["disable_velocity"] = "#define DISABLE_VELOCITY\n";
actions.render_mode_defines["keep_data"] = "#define ENABLE_KEEP_DATA\n";
- actions.render_mode_defines["collision_use_scale"] = "#define USE_COLLISON_SCALE\n";
+ actions.render_mode_defines["collision_use_scale"] = "#define USE_COLLISION_SCALE\n";
actions.sampler_array_name = "material_samplers";
actions.base_texture_binding_index = 1;
diff --git a/servers/rendering/renderer_rd/storage_rd/render_scene_data_rd.cpp b/servers/rendering/renderer_rd/storage_rd/render_scene_data_rd.cpp
index f925f87cbe..7dd790d1da 100644
--- a/servers/rendering/renderer_rd/storage_rd/render_scene_data_rd.cpp
+++ b/servers/rendering/renderer_rd/storage_rd/render_scene_data_rd.cpp
@@ -59,6 +59,12 @@ void RenderSceneDataRD::update_ubo(RID p_uniform_buffer, RS::ViewportDebugDraw p
RendererRD::MaterialStorage::store_transform(cam_transform, ubo.inv_view_matrix);
RendererRD::MaterialStorage::store_transform(cam_transform.affine_inverse(), ubo.view_matrix);
+#ifdef REAL_T_IS_DOUBLE
+ RendererRD::MaterialStorage::split_double(-cam_transform.origin.x, &ubo.inv_view_matrix[12], &ubo.inv_view_matrix[3]);
+ RendererRD::MaterialStorage::split_double(-cam_transform.origin.y, &ubo.inv_view_matrix[13], &ubo.inv_view_matrix[7]);
+ RendererRD::MaterialStorage::split_double(-cam_transform.origin.z, &ubo.inv_view_matrix[14], &ubo.inv_view_matrix[11]);
+#endif
+
for (uint32_t v = 0; v < view_count; v++) {
projection = correction * view_projection[v];
RendererRD::MaterialStorage::store_camera(projection, ubo.projection_matrix_view[v]);
diff --git a/servers/rendering/renderer_rd/storage_rd/texture_storage.cpp b/servers/rendering/renderer_rd/storage_rd/texture_storage.cpp
index 800a742cb6..21811068cd 100644
--- a/servers/rendering/renderer_rd/storage_rd/texture_storage.cpp
+++ b/servers/rendering/renderer_rd/storage_rd/texture_storage.cpp
@@ -673,6 +673,8 @@ void TextureStorage::texture_free(RID p_texture) {
}
void TextureStorage::texture_2d_initialize(RID p_texture, const Ref<Image> &p_image) {
+ ERR_FAIL_COND(p_image.is_null());
+
TextureToRDFormat ret_format;
Ref<Image> image = _validate_texture_format(p_image, ret_format);
diff --git a/servers/rendering/shader_types.cpp b/servers/rendering/shader_types.cpp
index cd063f91ac..5e1da7c15d 100644
--- a/servers/rendering/shader_types.cpp
+++ b/servers/rendering/shader_types.cpp
@@ -86,8 +86,8 @@ ShaderTypes::ShaderTypes() {
shader_modes[RS::SHADER_SPATIAL].functions["vertex"].main_function = true;
//builtins
- shader_modes[RS::SHADER_SPATIAL].functions["vertex"].built_ins["MODEL_MATRIX"] = ShaderLanguage::TYPE_MAT4;
- shader_modes[RS::SHADER_SPATIAL].functions["vertex"].built_ins["MODEL_NORMAL_MATRIX"] = ShaderLanguage::TYPE_MAT3;
+ shader_modes[RS::SHADER_SPATIAL].functions["vertex"].built_ins["MODEL_MATRIX"] = constt(ShaderLanguage::TYPE_MAT4);
+ shader_modes[RS::SHADER_SPATIAL].functions["vertex"].built_ins["MODEL_NORMAL_MATRIX"] = constt(ShaderLanguage::TYPE_MAT3);
shader_modes[RS::SHADER_SPATIAL].functions["vertex"].built_ins["VIEW_MATRIX"] = constt(ShaderLanguage::TYPE_MAT4);
shader_modes[RS::SHADER_SPATIAL].functions["vertex"].built_ins["INV_VIEW_MATRIX"] = constt(ShaderLanguage::TYPE_MAT4);
shader_modes[RS::SHADER_SPATIAL].functions["vertex"].built_ins["PROJECTION_MATRIX"] = ShaderLanguage::TYPE_MAT4;
@@ -297,6 +297,9 @@ ShaderTypes::ShaderTypes() {
shader_modes[RS::SHADER_CANVAS_ITEM].functions["light"].built_ins["SPECULAR_SHININESS"] = constt(ShaderLanguage::TYPE_VEC4);
shader_modes[RS::SHADER_CANVAS_ITEM].functions["light"].built_ins["LIGHT_COLOR"] = constt(ShaderLanguage::TYPE_VEC4);
shader_modes[RS::SHADER_CANVAS_ITEM].functions["light"].built_ins["LIGHT_POSITION"] = constt(ShaderLanguage::TYPE_VEC3);
+ shader_modes[RS::SHADER_CANVAS_ITEM].functions["light"].built_ins["LIGHT_DIRECTION"] = constt(ShaderLanguage::TYPE_VEC3);
+ shader_modes[RS::SHADER_CANVAS_ITEM].functions["light"].built_ins["LIGHT_ENERGY"] = constt(ShaderLanguage::TYPE_FLOAT);
+ shader_modes[RS::SHADER_CANVAS_ITEM].functions["light"].built_ins["LIGHT_IS_DIRECTIONAL"] = constt(ShaderLanguage::TYPE_BOOL);
shader_modes[RS::SHADER_CANVAS_ITEM].functions["light"].built_ins["LIGHT_VERTEX"] = constt(ShaderLanguage::TYPE_VEC3);
shader_modes[RS::SHADER_CANVAS_ITEM].functions["light"].built_ins["LIGHT"] = ShaderLanguage::TYPE_VEC4;
shader_modes[RS::SHADER_CANVAS_ITEM].functions["light"].built_ins["SHADOW_MODULATE"] = ShaderLanguage::TYPE_VEC4;
diff --git a/tests/core/input/test_input_event_key.h b/tests/core/input/test_input_event_key.h
index 4c9cd2002c..ef0a656b18 100644
--- a/tests/core/input/test_input_event_key.h
+++ b/tests/core/input/test_input_event_key.h
@@ -118,7 +118,7 @@ TEST_CASE("[InputEventKey] Key correctly converts itself to text") {
InputEventKey none_key2;
- // Key is None without modifers with a physical key.
+ // Key is None without modifiers with a physical key.
none_key2.set_keycode(Key::NONE);
none_key2.set_physical_keycode(Key::ENTER);
diff --git a/tests/core/math/test_quaternion.h b/tests/core/math/test_quaternion.h
index 1b80ffba0b..63d30759bb 100644
--- a/tests/core/math/test_quaternion.h
+++ b/tests/core/math/test_quaternion.h
@@ -160,7 +160,7 @@ TEST_CASE("[Quaternion] Construct Euler YXZ dynamic axes") {
double pitch = Math::deg_to_rad(30.0);
double roll = Math::deg_to_rad(10.0);
- // Generate YXZ comparision data (Z-then-X-then-Y) using single-axis Euler
+ // Generate YXZ comparison data (Z-then-X-then-Y) using single-axis Euler
// constructor and quaternion product, both tested separately.
Vector3 euler_y(0.0, yaw, 0.0);
Quaternion q_y(euler_y);
diff --git a/tests/scene/test_bit_map.h b/tests/scene/test_bit_map.h
index 53afdc38f7..635449181e 100644
--- a/tests/scene/test_bit_map.h
+++ b/tests/scene/test_bit_map.h
@@ -183,7 +183,7 @@ TEST_CASE("[BitMap] Get true bit count") {
CHECK(bit_map.get_true_bit_count() == 0);
bit_map.create(dim);
- CHECK_MESSAGE(bit_map.get_true_bit_count() == 0, "Unitialized bit map should have no true bits");
+ CHECK_MESSAGE(bit_map.get_true_bit_count() == 0, "Uninitialized bit map should have no true bits");
bit_map.set_bit_rect(Rect2i{ 0, 0, 256, 256 }, true);
CHECK(bit_map.get_true_bit_count() == 65536);
bit_map.set_bitv(Point2i{ 0, 0 }, false);
@@ -196,7 +196,7 @@ TEST_CASE("[BitMap] Get size") {
const Size2i dim{ 256, 256 };
BitMap bit_map{};
- CHECK_MESSAGE(bit_map.get_size() == Size2i(0, 0), "Unitialized bit map should have a size of 0x0");
+ CHECK_MESSAGE(bit_map.get_size() == Size2i(0, 0), "Uninitialized bit map should have a size of 0x0");
bit_map.create(dim);
CHECK(bit_map.get_size() == Size2i(256, 256));
@@ -390,7 +390,7 @@ TEST_CASE("[BitMap] Convert to image") {
bit_map.create(dim);
img = bit_map.convert_to_image();
CHECK_MESSAGE(img->get_size() == dim, "Image should have the same dimensions as the BitMap");
- CHECK_MESSAGE(img->get_pixel(0, 0).is_equal_approx(Color(0, 0, 0)), "BitMap is intialized to all 0's, so Image should be all black");
+ CHECK_MESSAGE(img->get_pixel(0, 0).is_equal_approx(Color(0, 0, 0)), "BitMap is initialized to all 0's, so Image should be all black");
reset_bit_map(bit_map);
bit_map.set_bit_rect(Rect2i(0, 0, 128, 128), true);