diff --git a/engine/.clang-format b/engine/.clang-format index 59d01583..22966e2d 100644 --- a/engine/.clang-format +++ b/engine/.clang-format @@ -1,6 +1,3 @@ -# If you change this file, please format all files of the codebase as part of your PR: -# pre-commit run clang-format --all - # Commented out parameters are those with the same value as base LLVM style. # We can uncomment them if we want to change their value, or enforce the # chosen value in case the base style changes (last sync: Clang 18.1.8). @@ -41,7 +38,7 @@ AlignAfterOpenBracket: DontAlign # AcrossEmptyLines: false # AcrossComments: false # AlignCaseColons: false -AlignEscapedNewlines: DontAlign # Aligning leads to long diffs +# AlignEscapedNewlines: Right AlignOperands: DontAlign AlignTrailingComments: Kind: Never @@ -117,25 +114,14 @@ Cpp11BracedListStyle: false # - BOOST_FOREACH # IfMacros: # - KJ_IF_MAYBE -IncludeBlocks: Regroup +# IncludeBlocks: Preserve IncludeCategories: - - Regex: ^"(core|drivers|editor|main|scene|servers|tests)/.*"$ - Priority: 20 - - Regex: ^"(modules|platform)/.*"$ - Priority: 30 - - Regex: ^$ - Priority: 40 - - Regex: ^<(windows|Jolt/Jolt|platform_gl)\.h>$ - Priority: 50 - - Regex: ^<.*\.(h|hpp)>$ - Priority: 60 - - Regex: ^<.*>$ - Priority: 70 - - Regex: ^".*\.compat\.inc"$ - Priority: 0 - SortPriority: 1 - Regex: ^".*"$ - Priority: 10 + Priority: 1 + - Regex: ^<.*\.h>$ + Priority: 2 + - Regex: ^<.*>$ + Priority: 3 # IncludeIsMainRegex: (Test)?$ # IncludeIsMainSourceRegex: "" # IndentAccessModifiers: false diff --git a/engine/.clang-tidy b/engine/.clang-tidy index 19965f3e..05b2f61a 100644 --- a/engine/.clang-tidy +++ b/engine/.clang-tidy @@ -1,26 +1,21 @@ -# If you change this file, please format all files of the codebase as part of your PR: -# pre-commit run --hook-stage manual clang-tidy --all - Checks: - -* - - performance-move-const-arg - - bugprone-use-after-move + - cppcoreguidelines-pro-type-member-init - modernize-deprecated-headers - modernize-redundant-void-arg - modernize-use-bool-literals -# - modernize-use-default-member-init # TODO Re-activate + - modernize-use-default-member-init - modernize-use-nullptr - readability-braces-around-statements - readability-redundant-member-init - - readability-operators-representation HeaderFileExtensions: ["", h, hh, hpp, hxx, inc, glsl] ImplementationFileExtensions: [c, cc, cpp, cxx, m, mm, java] HeaderFilterRegex: (core|doc|drivers|editor|main|modules|platform|scene|servers|tests)/ FormatStyle: file CheckOptions: + cppcoreguidelines-pro-type-member-init.IgnoreArrays: true + cppcoreguidelines-pro-type-member-init.UseAssignment: true modernize-deprecated-headers.CheckHeaderFile: true modernize-use-bool-literals.IgnoreMacros: false modernize-use-default-member-init.IgnoreMacros: false modernize-use-default-member-init.UseAssignment: true - readability-operators-representation.BinaryOperators: "&&;&=;&;|;~;!;!=;||;|=;^;^=" - readability-operators-representation.OverloadedOperators: "&&;&=;&;|;~;!;!=;||;|=;^;^=" diff --git a/engine/.clangd b/engine/.clangd index ebe084f8..3c9792ea 100644 --- a/engine/.clangd +++ b/engine/.clangd @@ -1,21 +1,12 @@ # https://clangd.llvm.org/config - --- - # Default conditions, apply everywhere. -CompileFlags: - Add: - # Some thirdparty includes seem to require a high -ferror-limit to pass checks. - - -ferror-limit=100 - Diagnostics: Includes: IgnoreHeader: - \.compat\.inc - --- - # Header-specific conditions. If: @@ -29,19 +20,11 @@ CompileFlags: - -Wno-unused-const-variable - -Wno-unused-function - -Wno-unused-variable - --- - -# Suppress warnings for third-party or partial code. +# Suppress all third-party warnings. If: - PathMatch: - - bin/build_deps/.* - - misc/dist/apple_embedded_xcode/.* - - tests/compatibility_test/.* - - thirdparty/.* - - .*/thirdparty/.* - - .*-so_wrap.[ch] + PathMatch: thirdparty/.* Diagnostics: Suppress: "*" diff --git a/engine/.git-blame-ignore-revs b/engine/.git-blame-ignore-revs index 35c68147..3203caf8 100644 --- a/engine/.git-blame-ignore-revs +++ b/engine/.git-blame-ignore-revs @@ -72,18 +72,3 @@ e06d83860d798b6766b23d6eae48557387a7db85 # Style: Replace header guards with `#pragma once` 324512e11c1b7663c3cf47bec6ddbe65c6b8db2b - -# Style: Don't right-align escaped newlines -c5df0cb82bc539eff7dcfb2add99d60771fc50c5 - -# Style: Convert `*.gen.inc` to `*.gen.h` -7dae5da1982f4a55ba91557814905faef9ce461b - -# Move RenderingServer enums to a dedicated RenderingServerEnums (`RSE`) namespace -f5a290ac462765afca34e64dd39f883511510147 - -# Style: Add `class_db.h` includes explicitly -e380a417526c11f15a9ddb3997292409b10da2af - -# Move DisplayServer enums and typedefs to DisplayServerEnums -a447ac95ec170ee117c2eae55f1bfff0d0cf0dce diff --git a/engine/.github/PULL_REQUEST_TEMPLATE.md b/engine/.github/PULL_REQUEST_TEMPLATE.md index cccaf8ac..fbc45b89 100644 --- a/engine/.github/PULL_REQUEST_TEMPLATE.md +++ b/engine/.github/PULL_REQUEST_TEMPLATE.md @@ -1,6 +1,8 @@ diff --git a/engine/.github/actions/clangd-tidy/action.yml b/engine/.github/actions/clangd-tidy/action.yml deleted file mode 100644 index 06f2a945..00000000 --- a/engine/.github/actions/clangd-tidy/action.yml +++ /dev/null @@ -1,30 +0,0 @@ -name: clangd-tidy -description: Setup and run clangd-tidy on relevant files - -inputs: - changed-files: - description: A pre-filtered list of changed files. - required: true - type: string - -runs: - using: composite - steps: - - name: Setup clangd-tidy - shell: sh - run: | - echo "::group::Prerequisite checks" - if [ ! -f "compile_commands.json" ]; then - echo "::error::clangd-tidy checker requires a compilation database to function" - exit 1 - fi - echo "::endgroup::" - - echo "::group::Installing clangd-tidy" - # Don't know which python we're using, so just access the global scope. - python -m pip install clangd clangd-tidy clang-tidy==22.1.0 - echo "::endgroup::" - - echo "::group::Running clangd-tidy" - clangd-tidy ${{ inputs.changed-files }} - echo "::endgroup::" diff --git a/engine/.github/actions/godot-compat-test/action.yml b/engine/.github/actions/godot-compat-test/action.yml deleted file mode 100644 index 09e10519..00000000 --- a/engine/.github/actions/godot-compat-test/action.yml +++ /dev/null @@ -1,33 +0,0 @@ -name: Godot hash compatibility test -description: Check if methods with given hashes used by the older GDExtensions still can be loaded with given Godot version. - -inputs: - bin: - description: Path to the Godot binary. - required: true - type: string - reftags: - description: Reference tags of Godot versions to check (comma separated). - required: true - type: string - -runs: - using: composite - steps: - - name: Extract GDExtension interface - shell: sh - run: | - ${{ inputs.bin }} --headless --dump-gdextension-interface - mkdir tests/compatibility_test/src/deps/ - mv gdextension_interface.h tests/compatibility_test/src/deps/ - - - name: Build minimal GDExtension - shell: sh - run: scons --directory=./tests/compatibility_test - - - name: Download reference GDExtension API JSON and try to load it - shell: sh - env: - GODOT4_BIN: ${{ inputs.bin }} - REFTAGS: ${{ inputs.reftags }} - run: ./tests/compatibility_test/run_compatibility_test.py diff --git a/engine/.github/actions/godot-project-export/action.yml b/engine/.github/actions/godot-project-export/action.yml deleted file mode 100644 index 76212234..00000000 --- a/engine/.github/actions/godot-project-export/action.yml +++ /dev/null @@ -1,55 +0,0 @@ -name: Export Godot project -description: Export a test Godot project. - -inputs: - bin: - description: The path to the Godot executable - required: true - -runs: - using: composite - steps: - - name: Import resources and export project - shell: sh - run: | - git clone --depth=1 https://github.com/godotengine/godot-tests.git /tmp/godot-tests - - echo "Exporting project for Linux (PCK)" - ${{ inputs.bin }} --headless --path /tmp/godot-tests/tests/test_project/ --export-pack "Linux" /tmp/test_project.pck 2>&1 | tee log.txt || true - GODOT_CHECK_CI_LOG_ALL_ERRORS=1 misc/scripts/check_ci_log.py log.txt - - echo "Exporting project for Linux (ZIP)" - ${{ inputs.bin }} --headless --path /tmp/godot-tests/tests/test_project/ --export-pack "Linux" /tmp/test_project.zip 2>&1 | tee log.txt || true - GODOT_CHECK_CI_LOG_ALL_ERRORS=1 misc/scripts/check_ci_log.py log.txt - - echo "Exporting project for Linux as dedicated server (PCK)" - ${{ inputs.bin }} --headless --path /tmp/godot-tests/tests/test_project/ --export-pack "Linux Server" /tmp/test_project_server.pck 2>&1 | tee log.txt || true - GODOT_CHECK_CI_LOG_ALL_ERRORS=1 misc/scripts/check_ci_log.py log.txt - - - name: Run project files from folder - shell: sh - run: | - xvfb-run ${{ inputs.bin }} --path /tmp/godot-tests/tests/test_project/ --language fr --resolution 64x64 --write-movie /tmp/test_project_folder.png --quit 2>&1 | tee log.txt || true - GODOT_CHECK_CI_LOG_ALL_ERRORS=1 misc/scripts/check_ci_log.py log.txt - - ${{ inputs.bin }} --headless --path /tmp/godot-tests/tests/test_project/ --quit 2>&1 | tee log.txt || true - GODOT_CHECK_CI_LOG_ALL_ERRORS=1 misc/scripts/check_ci_log.py log.txt - - - name: Run exported project PCK/ZIP - shell: sh - run: | - xvfb-run ${{ inputs.bin }} --main-pack /tmp/test_project.pck --language fr --resolution 64x64 --write-movie /tmp/test_project_pck.png --quit 2>&1 | tee log.txt || true - GODOT_CHECK_CI_LOG_ALL_ERRORS=1 misc/scripts/check_ci_log.py log.txt - - xvfb-run ${{ inputs.bin }} --main-pack /tmp/test_project.zip --language fr --resolution 64x64 --write-movie /tmp/test_project_zip.png --quit 2>&1 | tee log.txt || true - GODOT_CHECK_CI_LOG_ALL_ERRORS=1 misc/scripts/check_ci_log.py log.txt - - # Headless mode is implied for dedicated server PCKs. - ${{ inputs.bin }} --main-pack /tmp/test_project_server.pck --quit 2>&1 | tee log.txt || true - GODOT_CHECK_CI_LOG_ALL_ERRORS=1 misc/scripts/check_ci_log.py log.txt - - echo "Checking whether video output from project folder and exported project match..." - md5sum /tmp/test_project*.png | md5sum --check - - echo "Checking whether audio output from project folder and exported project match..." - md5sum /tmp/test_project*.wav | md5sum --check diff --git a/engine/.github/changed_files.yml b/engine/.github/changed_files.yml deleted file mode 100644 index 892ac77f..00000000 --- a/engine/.github/changed_files.yml +++ /dev/null @@ -1,29 +0,0 @@ -# We lack a convenient means of gathering *all* the changes when specializations are passed, so -# a catch-all variable is the easiest workaround. -everything: - - "**" - -# Determines if build actions should occur after static checks are ran. Broadly speaking, these -# files changing would result in SCons rebuilding the engine, or are otherwise pertinent to the -# buildsystem itself. -sources: - - .github/{actions/*,workflows}/*.yml - - "**/{SConstruct,SCsub,*.py}" - - "**/*.{h,hpp,hh,hxx,c,cpp,cc,cxx,m,mm,inc,glsl}" - - modules/mono/**/*.{cs,csproj,sln,props,targets} - - platform/android/java/{gradle*,**/*.{jar,java,kt,gradle}} - - platform/web/{package{,-lock}.json,js/**/*.js} - - tests/** - -# Determines which files are appropriate for running clangd-tidy checks on. This is a subset out -# of necessity, as we're only evaluating a Linux runner. -clangd: - - "**/*.{h,hpp,hxx,hh,c,cpp,cxx,cc}" - - "!**/thirdparty/**" - - "!**/*-so_wrap.{h,c}" - - "!drivers/{apple*,core*,d3d12,metal,wasapi,windows,winmidi,xaudio2}/**" - - "!editor/shader/shader_baker/shader_baker_export_plugin_platform_{d3d12,metal}.{h,cpp}" - - "!modules/camera/camera_{android,macos,win}.{h,cpp}" - - "!modules/openxr/extensions/platform/openxr_{android,metal}_extension.{h,cpp}" - - "!platform/{android,ios,macos,visionos,web,windows}/**" - - "platform/{android,ios,macos,visionos,web,windows}/{api,export}/*.{h,hpp,hxx,hh,c,cpp,cxx,cc}" diff --git a/engine/.github/workflows/android_builds.yml b/engine/.github/workflows/android_builds.yml index c4b0f910..346aaf71 100644 --- a/engine/.github/workflows/android_builds.yml +++ b/engine/.github/workflows/android_builds.yml @@ -1,10 +1,6 @@ name: šŸ¤– Android Builds on: workflow_call: - secrets: - SERVICE_ACCOUNT_KEY: - required: true - workflow_dispatch: # Global Settings @@ -12,6 +8,7 @@ env: SCONS_FLAGS: >- dev_mode=yes module_text_server_fb_enabled=yes + tests=no swappy=yes jobs: @@ -26,7 +23,6 @@ jobs: - name: Editor (target=editor) cache-name: android-editor target: editor - instrumented_tests: true scons-flags: >- arch=arm64 production=yes @@ -34,23 +30,21 @@ jobs: - name: Template arm32 (target=template_debug, arch=arm32) cache-name: android-template-arm32 target: template_debug - instrumented_tests: false scons-flags: arch=arm32 - name: Template arm64 (target=template_debug, arch=arm64) cache-name: android-template-arm64 target: template_debug - instrumented_tests: true scons-flags: arch=arm64 steps: - name: Checkout - uses: actions/checkout@v6 + uses: actions/checkout@v4 with: submodules: recursive - name: Set up Java 17 - uses: actions/setup-java@v5 + uses: actions/setup-java@v4 with: distribution: temurin java-version: 17 @@ -122,54 +116,3 @@ jobs: with: name: ${{ matrix.cache-name }}-picoos path: picoos - - - name: Generate Instrumented test APKs - if: matrix.instrumented_tests && github.repository == 'godotengine/godot' && github.event_name == 'push' && github.ref_name == github.event.repository.default_branch - run: | - cd platform/android/java - if [ "${{ matrix.target }}" = "editor" ]; then - ./gradlew :editor:assembleAndroidAndroidTest :editor:assembleAndroidDebug -Pperform_signing=true - else - ./gradlew :app:assembleAndroidTest :app:assembleInstrumentedDebug -Pperform_signing=true - fi - cd ../../.. - - - name: Create credentials file - if: matrix.instrumented_tests && github.repository == 'godotengine/godot' && github.event_name == 'push' && github.ref_name == github.event.repository.default_branch - uses: google-github-actions/auth@v3 - with: - credentials_json: ${{ secrets.SERVICE_ACCOUNT_KEY }} - - - name: Set up gcloud CLI - if: matrix.instrumented_tests && github.repository == 'godotengine/godot' && github.event_name == 'push' && github.ref_name == github.event.repository.default_branch - uses: google-github-actions/setup-gcloud@v3 - - - name: Run tests on Firebase Test Lab - if: matrix.instrumented_tests && github.repository == 'godotengine/godot' && github.event_name == 'push' && github.ref_name == github.event.repository.default_branch - run: | - set +e - - if [ "${{ matrix.target }}" = "editor" ]; then - APP_APK="platform/android/java/editor/build/outputs/apk/android/debug/android_editor-android-debug.apk" - TEST_APK="platform/android/java/editor/build/outputs/apk/androidTest/android/debug/android_editor-android-debug-androidTest.apk" - else - APP_APK="platform/android/java/app/build/outputs/apk/instrumented/debug/android_debug.apk" - TEST_APK="platform/android/java/app/build/outputs/apk/androidTest/instrumented/debug/app-instrumented-debug-androidTest.apk" - fi - - output=$(gcloud firebase test android run \ - --type instrumentation \ - --app "$APP_APK" \ - --test "$TEST_APK" \ - --device model=pa3q,version=35,orientation=landscape \ - --device model=java,version=30,orientation=landscape \ - --device model=MediumPhone.arm,version=26,orientation=landscape \ - --use-orchestrator \ - --timeout 2m 2>&1) - exit_code=$? - echo "$output" - if [[ $exit_code -eq 1 && "$output" == *"TEST_QUOTA_EXCEEDED"* ]]; then - echo "::warning title=Firebase Test Lab::Test quota exceeded." - exit_code=0 - fi - exit "$exit_code" diff --git a/engine/.github/workflows/ios_builds.yml b/engine/.github/workflows/ios_builds.yml index 6ba63caa..831ed640 100644 --- a/engine/.github/workflows/ios_builds.yml +++ b/engine/.github/workflows/ios_builds.yml @@ -8,21 +8,26 @@ env: SCONS_FLAGS: >- dev_mode=yes module_text_server_fb_enabled=yes + tests=no debug_symbols=no jobs: ios-template: # From https://docs.github.com/en/actions/how-tos/write-workflows/choose-where-workflows-run/choose-the-runner-for-a-job#choosing-github-hosted-runners - runs-on: macos-26 + runs-on: macos-latest name: Template (target=template_release) timeout-minutes: 60 steps: - name: Checkout - uses: actions/checkout@v6 + uses: actions/checkout@v4 with: submodules: recursive + # From https://github.com/actions/runner-images/blob/main/images/macos + - name: Select Xcode 26 + run: sudo xcode-select -s /Applications/Xcode_26.0.1.app + - name: Restore Godot build cache uses: ./.github/actions/godot-cache-restore continue-on-error: true diff --git a/engine/.github/workflows/linux_builds.yml b/engine/.github/workflows/linux_builds.yml index abababa6..388ce528 100644 --- a/engine/.github/workflows/linux_builds.yml +++ b/engine/.github/workflows/linux_builds.yml @@ -1,11 +1,6 @@ name: 🐧 Linux Builds on: workflow_call: - inputs: - changed-files: - description: A list of changed files, pre-filtered for parsing by clangd-tidy. - required: true - type: string workflow_dispatch: # Global Settings @@ -13,6 +8,7 @@ env: SCONS_FLAGS: >- dev_mode=yes module_text_server_fb_enabled=yes + "accesskit_sdk_path=${{ github.workspace }}/accesskit-c-0.21.2/" GODOT_CPP_BRANCH: 4.5 DOTNET_NOLOGO: true DOTNET_CLI_TELEMETRY_OPTOUT: true @@ -34,17 +30,15 @@ jobs: - name: Editor w/ Mono (target=editor) cache-name: linux-editor-mono target: editor - scons-flags: module_mono_enabled=yes compiledb=yes + scons-flags: module_mono_enabled=yes bin: ./bin/godot.linuxbsd.editor.x86_64.mono build-mono: true doc-test: true proj-conv: true - proj-export: true api-compat: true artifact: true # Validate godot-cpp compatibility on one arbitrary editor build. godot-cpp: true - clangd-tidy: true - name: Editor with doubles and GCC sanitizers (target=editor, dev_build=yes, scu_build=yes, precision=double, use_asan=yes, use_ubsan=yes, linker=mold) cache-name: linux-editor-double-sanitizers @@ -116,7 +110,7 @@ jobs: steps: - name: Checkout - uses: actions/checkout@v6 + uses: actions/checkout@v4 with: submodules: recursive @@ -124,7 +118,7 @@ jobs: run: | sudo apt-get update sudo apt-get install libwayland-bin # TODO: Figure out somehow how to embed this one. - if [ "${{ matrix.proj-test }}" == "true" -o "${{ matrix.proj-export }}" == "true" ]; then + if [ "${{ matrix.proj-test }}" == "true" ]; then sudo apt-get install mesa-vulkan-drivers fi @@ -149,7 +143,7 @@ jobs: uses: ./.github/actions/godot-deps with: # Sync with Ensure*Version in SConstruct. - python-version: 3.9 + python-version: 3.8 scons-version: 4.0 - name: Force remove preinstalled .NET SDKs @@ -165,15 +159,15 @@ jobs: dotnet-version: 8.0.100 - name: Download pre-built AccessKit - shell: sh - id: accesskit-sdk - run: | - if python ./misc/scripts/install_accesskit.py; then - echo "ACCESSKIT_ENABLED=yes" >> "$GITHUB_OUTPUT" - else - echo "::warning::AccessKit SDK installation failed, building without AccessKit support." - echo "ACCESSKIT_ENABLED=no" >> "$GITHUB_OUTPUT" - fi + uses: dsaltares/fetch-gh-release-asset@1.1.2 + with: + repo: godotengine/godot-accesskit-c-static + version: tags/0.21.2 + file: accesskit-c-0.21.2.zip + target: accesskit-c-0.21.2/accesskit_c.zip + + - name: Extract pre-built AccessKit + run: unzip -o accesskit-c-0.21.2/accesskit_c.zip - name: Install mold linker if: matrix.proj-test @@ -182,16 +176,10 @@ jobs: - name: Compilation uses: ./.github/actions/godot-build with: - scons-flags: ${{ env.SCONS_FLAGS }} ${{ matrix.scons-flags }} accesskit=${{ steps.accesskit-sdk.outputs.ACCESSKIT_ENABLED }} + scons-flags: ${{ env.SCONS_FLAGS }} ${{ matrix.scons-flags }} platform: linuxbsd target: ${{ matrix.target }} - - name: Style checks via clangd-tidy - if: matrix.clangd-tidy - uses: ./.github/actions/clangd-tidy - with: - changed-files: ${{ inputs.changed-files }} - - name: Compilation (godot-cpp) uses: ./.github/actions/godot-cpp-build if: matrix.godot-cpp @@ -220,7 +208,6 @@ jobs: - name: Prepare artifact if: matrix.artifact run: | - rm -rf ./bin/build_deps strip bin/godot.* chmod +x bin/godot.* @@ -251,18 +238,11 @@ jobs: git diff --color --exit-code && ! git ls-files --others --exclude-standard | sed -e 's/^/New doc file missing in PR: /' | grep 'xml$' # Check API backwards compatibility - - name: Check for GDExtension compatibility – JSON check + - name: Check for GDExtension compatibility if: matrix.api-compat run: | ./misc/scripts/validate_extension_api.sh "${{ matrix.bin }}" - - name: Test GDExtension compatibility – load methods - uses: ./.github/actions/godot-compat-test - if: matrix.api-compat - with: - bin: ${{ matrix.bin }} - reftags: "4.5-stable,4.4-stable" - # Download and run the test project - name: Test Godot project uses: ./.github/actions/godot-project-test @@ -270,13 +250,6 @@ jobs: with: bin: ${{ matrix.bin }} - # Test project export - - name: Test project export - uses: ./.github/actions/godot-project-export - if: matrix.proj-export - with: - bin: ${{ matrix.bin }} - # Test the project converter - name: Test project converter uses: ./.github/actions/godot-converter-test diff --git a/engine/.github/workflows/macos_builds.yml b/engine/.github/workflows/macos_builds.yml index 5e7d3553..82478fb6 100644 --- a/engine/.github/workflows/macos_builds.yml +++ b/engine/.github/workflows/macos_builds.yml @@ -8,11 +8,12 @@ env: SCONS_FLAGS: >- dev_mode=yes module_text_server_fb_enabled=yes + "accesskit_sdk_path=${{ github.workspace }}/accesskit-c-0.21.2/" jobs: build-macos: # From https://docs.github.com/en/actions/how-tos/write-workflows/choose-where-workflows-run/choose-the-runner-for-a-job#choosing-github-hosted-runners - runs-on: macos-26 + runs-on: macos-latest name: ${{ matrix.name }} timeout-minutes: 120 strategy: @@ -32,10 +33,14 @@ jobs: steps: - name: Checkout - uses: actions/checkout@v6 + uses: actions/checkout@v4 with: submodules: recursive + # From https://github.com/actions/runner-images/blob/main/images/macos + - name: Select Xcode 26 + run: sudo xcode-select -s /Applications/Xcode_26.0.1.app + - name: Restore Godot build cache uses: ./.github/actions/godot-cache-restore with: @@ -45,27 +50,16 @@ jobs: - name: Setup Python and SCons uses: ./.github/actions/godot-deps - - name: Download pre-built ANGLE - shell: sh - id: angle-sdk - run: | - if python ./misc/scripts/install_angle.py; then - echo "ANGLE_ENABLED=yes" >> "$GITHUB_OUTPUT" - else - echo "::warning::ANGLE SDK installation failed, building without ANGLE support." - echo "ANGLE_ENABLED=no" >> "$GITHUB_OUTPUT" - fi - - name: Download pre-built AccessKit - shell: sh - id: accesskit-sdk - run: | - if python3 ./misc/scripts/install_accesskit.py; then - echo "ACCESSKIT_ENABLED=yes" >> "$GITHUB_OUTPUT" - else - echo "::warning::AccessKit SDK installation failed, building without AccessKit support." - echo "ACCESSKIT_ENABLED=no" >> "$GITHUB_OUTPUT" - fi + uses: dsaltares/fetch-gh-release-asset@1.1.2 + with: + repo: godotengine/godot-accesskit-c-static + version: tags/0.21.2 + file: accesskit-c-0.21.2.zip + target: accesskit-c-0.21.2/accesskit_c.zip + + - name: Extract pre-built AccessKit + run: unzip -o accesskit-c-0.21.2/accesskit_c.zip - name: Setup Vulkan SDK id: vulkan-sdk @@ -81,14 +75,14 @@ jobs: - name: Compilation (x86_64) uses: ./.github/actions/godot-build with: - scons-flags: ${{ env.SCONS_FLAGS }} ${{ matrix.scons-flags }} arch=x86_64 vulkan=${{ steps.vulkan-sdk.outputs.VULKAN_ENABLED }} accesskit=${{ steps.accesskit-sdk.outputs.ACCESSKIT_ENABLED }} angle=${{ steps.angle-sdk.outputs.ANGLE_ENABLED }} + scons-flags: ${{ env.SCONS_FLAGS }} ${{ matrix.scons-flags }} arch=x86_64 vulkan=${{ steps.vulkan-sdk.outputs.VULKAN_ENABLED }} platform: macos target: ${{ matrix.target }} - name: Compilation (arm64) uses: ./.github/actions/godot-build with: - scons-flags: ${{ env.SCONS_FLAGS }} ${{ matrix.scons-flags }} arch=arm64 vulkan=${{ steps.vulkan-sdk.outputs.VULKAN_ENABLED }} accesskit=${{ steps.accesskit-sdk.outputs.ACCESSKIT_ENABLED }} angle=${{ steps.angle-sdk.outputs.ANGLE_ENABLED }} + scons-flags: ${{ env.SCONS_FLAGS }} ${{ matrix.scons-flags }} arch=arm64 vulkan=${{ steps.vulkan-sdk.outputs.VULKAN_ENABLED }} platform: macos target: ${{ matrix.target }} @@ -102,7 +96,6 @@ jobs: run: | lipo -create ./bin/godot.macos.${{ matrix.target }}.x86_64 ./bin/godot.macos.${{ matrix.target }}.arm64 -output ./bin/godot.macos.${{ matrix.target }}.universal rm ./bin/godot.macos.${{ matrix.target }}.x86_64 ./bin/godot.macos.${{ matrix.target }}.arm64 - rm -rf ./bin/build_deps strip bin/godot.* chmod +x bin/godot.* diff --git a/engine/.github/workflows/runner.yml b/engine/.github/workflows/runner.yml index 4a12bd5c..cbe3d576 100644 --- a/engine/.github/workflows/runner.yml +++ b/engine/.github/workflows/runner.yml @@ -18,39 +18,29 @@ jobs: android-build: name: šŸ¤– Android needs: static-checks - if: needs.static-checks.outputs.sources-changed == 'true' || github.event_name != 'pull_request' uses: ./.github/workflows/android_builds.yml - secrets: - SERVICE_ACCOUNT_KEY: ${{ secrets.SERVICE_ACCOUNT_KEY }} ios-build: name: šŸ iOS needs: static-checks - if: needs.static-checks.outputs.sources-changed == 'true' || github.event_name != 'pull_request' uses: ./.github/workflows/ios_builds.yml linux-build: name: 🐧 Linux needs: static-checks - if: needs.static-checks.outputs.sources-changed == 'true' || github.event_name != 'pull_request' uses: ./.github/workflows/linux_builds.yml - with: - changed-files: ${{ needs.static-checks.outputs.changed-files }} macos-build: name: šŸŽ macOS needs: static-checks - if: needs.static-checks.outputs.sources-changed == 'true' || github.event_name != 'pull_request' uses: ./.github/workflows/macos_builds.yml windows-build: name: šŸ Windows needs: static-checks - if: needs.static-checks.outputs.sources-changed == 'true' || github.event_name != 'pull_request' uses: ./.github/workflows/windows_builds.yml web-build: name: 🌐 Web needs: static-checks - if: needs.static-checks.outputs.sources-changed == 'true' || github.event_name != 'pull_request' uses: ./.github/workflows/web_builds.yml diff --git a/engine/.github/workflows/static_checks.yml b/engine/.github/workflows/static_checks.yml index 4585155e..7ab79b86 100644 --- a/engine/.github/workflows/static_checks.yml +++ b/engine/.github/workflows/static_checks.yml @@ -1,13 +1,6 @@ name: šŸ“Š Static Checks on: workflow_call: - outputs: - changed-files: - description: A list of changed files, pre-filtered for parsing by clangd-tidy. - value: ${{ jobs.static-checks.outputs.changed-files }} - sources-changed: - description: Determines if any source files were changed. - value: ${{ jobs.static-checks.outputs.sources-changed }} workflow_dispatch: jobs: @@ -15,15 +8,11 @@ jobs: name: Code style, file formatting, and docs runs-on: ubuntu-24.04 timeout-minutes: 30 - outputs: - changed-files: '"${{ steps.changed-files.outputs.clangd_all_changed_files }}"' # Wrap with quotes to bookend internal quote separators. - sources-changed: ${{ steps.changed-files.outputs.sources_any_changed }} steps: - name: Checkout - uses: actions/checkout@v6 + uses: actions/checkout@v4 with: - fetch-depth: 0 # Treeless clone. Slightly less performant than a shallow clone, but makes finding diffs instantaneous. - filter: tree:0 # See: https://github.blog/open-source/git/get-up-to-speed-with-partial-clone-and-shallow-clone/ + fetch-depth: 2 # This needs to happen before Python and npm execution; it must happen before any extra files are written. - name: .gitignore checks (gitignore_check.sh) @@ -31,17 +20,18 @@ jobs: bash ./misc/scripts/gitignore_check.sh - name: Get changed files - id: changed-files - uses: tj-actions/changed-files@v47 - with: - safe_output: false # Output passed to environment variable to avoid command injection. - separator: '" "' # To account for paths with spaces, ensure our items are split by quotes internally. - skip_initial_fetch: true - files_yaml_from_source_file: .github/changed_files.yml + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + run: | + if [ "${{ github.event_name }}" == "pull_request" ]; then + files=$(git diff-tree --no-commit-id --name-only -r HEAD^1..HEAD 2> /dev/null || true) + elif [ "${{ github.event_name }}" == "push" -a "${{ github.event.forced }}" == "false" -a "${{ github.event.created }}" == "false" ]; then + files=$(git diff-tree --no-commit-id --name-only -r ${{ github.event.before }}..${{ github.event.after }} 2> /dev/null || true) + fi + files=$(echo "$files" | xargs -I {} sh -c 'echo "\"./{}\""' | tr '\n' ' ') + echo "CHANGED_FILES=$files" >> $GITHUB_ENV - name: Style checks via pre-commit uses: pre-commit/action@v3.0.1 - env: - CHANGED_FILES: '"${{ steps.changed-files.outputs.everything_all_changed_files }}"' # Wrap with quotes to bookend internal quote separators. with: extra_args: --files ${{ env.CHANGED_FILES }} diff --git a/engine/.github/workflows/web_builds.yml b/engine/.github/workflows/web_builds.yml index dba7896b..04d60ab5 100644 --- a/engine/.github/workflows/web_builds.yml +++ b/engine/.github/workflows/web_builds.yml @@ -7,6 +7,7 @@ on: env: SCONS_FLAGS: >- dev_mode=yes + tests=no debug_symbols=no use_closure_compiler=yes EM_VERSION: 4.0.11 @@ -20,21 +21,21 @@ jobs: fail-fast: false matrix: include: - - name: Template w/ threads, 64-bit (target=template_release, threads=yes, arch=wasm64) + - name: Template w/ threads (target=template_release, threads=yes) cache-name: web-template target: template_release - scons-flags: threads=yes arch=wasm64 + scons-flags: threads=yes artifact: true - - name: Template w/o threads, 32-bit (target=template_release, threads=no, arch=wasm32) + - name: Template w/o threads (target=template_release, threads=no) cache-name: web-nothreads-template target: template_release - scons-flags: threads=no arch=wasm32 + scons-flags: threads=no artifact: true steps: - name: Checkout - uses: actions/checkout@v6 + uses: actions/checkout@v4 with: submodules: recursive diff --git a/engine/.github/workflows/windows_builds.yml b/engine/.github/workflows/windows_builds.yml index f8776b4c..b57637c0 100644 --- a/engine/.github/workflows/windows_builds.yml +++ b/engine/.github/workflows/windows_builds.yml @@ -9,6 +9,8 @@ env: dev_mode=yes module_text_server_fb_enabled=yes debug_symbols=no + "angle_libs=${{ github.workspace }}/" + "accesskit_sdk_path=${{ github.workspace }}/accesskit-c-0.21.2/" SCONS_CACHE_MSVC_CONFIG: true PYTHONIOENCODING: utf8 @@ -57,7 +59,7 @@ jobs: steps: - name: Checkout - uses: actions/checkout@v6 + uses: actions/checkout@v4 with: submodules: recursive @@ -82,37 +84,32 @@ jobs: fi continue-on-error: true - - name: Download pre-built ANGLE - shell: sh - id: angle-sdk - run: | - if python ./misc/scripts/install_angle.py; then - echo "ANGLE_ENABLED=yes" >> "$GITHUB_OUTPUT" - else - echo "::warning::ANGLE SDK installation failed, building without ANGLE support." - echo "ANGLE_ENABLED=no" >> "$GITHUB_OUTPUT" - fi + - name: Download pre-built ANGLE static libraries + uses: dsaltares/fetch-gh-release-asset@1.1.2 + with: + repo: godotengine/godot-angle-static + version: tags/chromium/6601.2 + file: godot-angle-static-x86_64-${{ matrix.compiler == 'gcc' && 'gcc' || 'msvc' }}-release.zip + target: angle/angle.zip - - name: Download WinRT components - shell: sh - run: python ./misc/scripts/install_winrt.py - continue-on-error: true + - name: Extract pre-built ANGLE static libraries + run: Expand-Archive -Force angle/angle.zip ${{ github.workspace }}/ - name: Download pre-built AccessKit - shell: sh - id: accesskit-sdk - run: | - if python ./misc/scripts/install_accesskit.py; then - echo "ACCESSKIT_ENABLED=yes" >> "$GITHUB_OUTPUT" - else - echo "::warning::AccessKit SDK installation failed, building without AccessKit support." - echo "ACCESSKIT_ENABLED=no" >> "$GITHUB_OUTPUT" - fi + uses: dsaltares/fetch-gh-release-asset@1.1.2 + with: + repo: godotengine/godot-accesskit-c-static + version: tags/0.21.2 + file: accesskit-c-0.21.2.zip + target: accesskit-c-0.21.2/accesskit_c.zip + + - name: Extract pre-built AccessKit + run: unzip -o accesskit-c-0.21.2/accesskit_c.zip - name: Compilation uses: ./.github/actions/godot-build with: - scons-flags: ${{ env.SCONS_FLAGS }} ${{ matrix.scons-flags }} d3d12=${{ steps.d3d12-sdk.outputs.D3D12_ENABLED }} accesskit=${{ steps.accesskit-sdk.outputs.ACCESSKIT_ENABLED }} angle=${{ steps.angle-sdk.outputs.ANGLE_ENABLED }} + scons-flags: ${{ env.SCONS_FLAGS }} ${{ matrix.scons-flags }} d3d12=${{ steps.d3d12-sdk.outputs.D3D12_ENABLED }} platform: windows target: ${{ matrix.target }} diff --git a/engine/.pre-commit-config.yaml b/engine/.pre-commit-config.yaml index 1825d34f..15119dc3 100644 --- a/engine/.pre-commit-config.yaml +++ b/engine/.pre-commit-config.yaml @@ -29,36 +29,30 @@ repos: types_or: [text] args: [-style=file:misc/utility/clang_format_glsl.yml] - # Not automatically triggered (because it requires compile_commands.json to be up-to-date). - # Invoke it manually via `pre-commit run --hook-stage manual clang-tidy` - repo: https://github.com/pocc/pre-commit-hooks rev: v1.3.5 hooks: - id: clang-tidy - # TODO .inc ignored for now because they don't include their parent header. - # TODO Platform-specific subfolders currently fail, we should try to include them - files: ^(core|main|scene)/.*\.(c|h|cpp|hpp|cc|hh|cxx|hxx|m|mm|java)$ - # No unknown warning suppression used for easier compatibility with gcc - args: [--fix, --quiet, --use-color, -p=compile_commands.json, -extra-arg=-Wno-unknown-warning-option] + files: \.(c|h|cpp|hpp|cc|hh|cxx|hxx|m|mm|inc|java|glsl)$ + args: [--fix, --quiet, --use-color] types_or: [text] additional_dependencies: [clang-tidy==21.1.6] - require_serial: false - stages: [manual] + require_serial: true + stages: [manual] # Not automatically triggered, invoked via `pre-commit run --hook-stage manual clang-tidy` - repo: https://github.com/astral-sh/ruff-pre-commit - rev: v0.15.8 + rev: v0.14.7 hooks: - id: ruff-check - args: [--color=always] + args: [--fix] files: (\.py|SConstruct|SCsub)$ types_or: [text] - id: ruff-format - args: [--color=always] files: (\.py|SConstruct|SCsub)$ types_or: [text] - repo: https://github.com/pre-commit/mirrors-mypy - rev: v1.19.1 + rev: v1.14.1 # Latest version that supports Python 3.8 hooks: - id: mypy files: \.py$ @@ -109,18 +103,6 @@ repos: files: ^(doc/classes|.*/doc_classes)/.*\.xml$ additional_dependencies: [xmlschema] - - id: validate-codeowners - name: validate-codeowners - language: python - entry: python misc/scripts/validate_codeowners.py - args: [--unowned] - - - id: validate-includes - name: validate-includes - language: python - entry: python misc/scripts/validate_includes.py - files: \.(c|h|cpp|hpp|cc|hh|cxx|hxx|m|mm|inc)$ - - id: eslint name: eslint language: node diff --git a/engine/CHANGELOG.md b/engine/CHANGELOG.md index 72394127..08e753e0 100644 --- a/engine/CHANGELOG.md +++ b/engine/CHANGELOG.md @@ -7,6 +7,289 @@ previous feature release. It is equivalent to the listings on our Changelogs for earlier feature releases are available in their respective Git branches, and linked at the [end of this file](#Past-releases). +## 4.6.2 - 2026-04-01 + +- [Release announcement](https://godotengine.org/article/maintenance-release-godot-4-6-2) +- [Interactive changelog](https://godotengine.github.io/godot-interactive-changelog/#4.6.2) + +#### 3D + +- Fix `GridMap` editor pasting when orbiting using the "Alt" key ([GH-116778](https://github.com/godotengine/godot/pull/116778)). +- Fix 3D editor camera not updating correctly ([GH-106219](https://github.com/godotengine/godot/pull/106219)). +- Fix 3D focus selection for subgizmos ([GH-116972](https://github.com/godotengine/godot/pull/116972)). +- Fix collision repositioning for child nodes ([GH-115353](https://github.com/godotengine/godot/pull/115353)). +- Fix DirectionalLight3D property list ([GH-117189](https://github.com/godotengine/godot/pull/117189)). +- Fix some UI issues with the `GridMap` editor ([GH-116555](https://github.com/godotengine/godot/pull/116555)). +- Remove unneeded checks for undo-redo history from Skeleton3DEditor ([GH-115784](https://github.com/godotengine/godot/pull/115784)). + +#### Animation + +- Account for the current section when processing AnimationTracks ([GH-116046](https://github.com/godotengine/godot/pull/116046)). +- Check `playback_queue` existence after emit `animation_finished` signal ([GH-116676](https://github.com/godotengine/godot/pull/116676)). +- Clear fade-out on request firing in AnimationNodeOneShot ([GH-115125](https://github.com/godotengine/godot/pull/115125)). +- Deselect bezier keyframes when switching animations ([GH-116953](https://github.com/godotengine/godot/pull/116953)). +- Fix animation player crash when setting current animation to stop ([GH-116264](https://github.com/godotengine/godot/pull/116264)). +- Fix icon size in AnimationPlayer tracks ([GH-115576](https://github.com/godotengine/godot/pull/115576)). +- Fix visual shift of animation editor keys during selection ([GH-117290](https://github.com/godotengine/godot/pull/117290)). +- Fix timeline cursor following mouse during marker selection ([GH-117634](https://github.com/godotengine/godot/pull/117634)). + +#### Assetlib + +- Fix TLS handshake fail preventing AssetLib use with `builtin_certs=no` ([GH-115450](https://github.com/godotengine/godot/pull/115450)). + +#### Audio + +- AudioStreamWAV: Check for `eof_reached` when reading LIST INFO tags ([GH-116719](https://github.com/godotengine/godot/pull/116719)). +- Fix `AudioStreamPlaybackMicrophone` shutdown crash ([GH-116299](https://github.com/godotengine/godot/pull/116299)). + +#### Buildsystem + +- Add UTF-8 encoding to svg file open in `platform_builders.py` ([GH-117454](https://github.com/godotengine/godot/pull/117454)). +- CI: Bump JavaScript actions to Node 24 ([GH-117428](https://github.com/godotengine/godot/pull/117428)). +- CI: Restore godot-cpp caching ([GH-116586](https://github.com/godotengine/godot/pull/116586)). +- Fix Metal driver build with Xcode 26.4 ([GH-117989](https://github.com/godotengine/godot/pull/117989)). +- ScrollBar: Fix compilation with `precision=double` ([GH-117224](https://github.com/godotengine/godot/pull/117224)). +- Update CODEOWNERS ([GH-117674](https://github.com/godotengine/godot/pull/117674)). + +#### C# + +- Revert "[.NET] Remove EFS update on reloading assemblies" but with deferred call ([GH-117617](https://github.com/godotengine/godot/pull/117617)). + +#### Core + +- Fix `String::split_` crash on empty string ([GH-117353](https://github.com/godotengine/godot/pull/117353)). +- Fix editable children state when duplicating instantiated nodes ([GH-117041](https://github.com/godotengine/godot/pull/117041)). +- Make sure `ScriptLanguage` is initialized even after `init_languages` call ([GH-114131](https://github.com/godotengine/godot/pull/114131)). +- RingBuffer: Fix `T read()` method reading empty buffer ([GH-117388](https://github.com/godotengine/godot/pull/117388)). +- RingBuffer: Fix overreading on methods that take an offset as an argument ([GH-117151](https://github.com/godotengine/godot/pull/117151)). + +#### Documentation + +- Editor Settings: Prevent crash when viewing `filesystem/import/blender/blender_path` ([GH-115895](https://github.com/godotengine/godot/pull/115895)). +- Fix UPNP code sample using `OK` constant incorrectly ([GH-115549](https://github.com/godotengine/godot/pull/115549)). + +#### Editor + +- Add support for `--ignore-error-breaks` to `LocalDebugger` ([GH-116823](https://github.com/godotengine/godot/pull/116823)). +- Check if a resource from a snapshot exists before loading it ([GH-115194](https://github.com/godotengine/godot/pull/115194)). +- Create EditorHelpHighlighter in Project Manager ([GH-116014](https://github.com/godotengine/godot/pull/116014)). +- Don't tint the preview camera icon ([GH-116525](https://github.com/godotengine/godot/pull/116525)). +- Ensure debug features get cleared after use ([GH-115116](https://github.com/godotengine/godot/pull/115116)). +- Fix build profile generator always enabling 2D navigation ([GH-115412](https://github.com/godotengine/godot/pull/115412)). +- Fix build profile generator creating bogus profiles ([GH-115410](https://github.com/godotengine/godot/pull/115410)). +- Fix Change version link in web editor shell ([GH-117763](https://github.com/godotengine/godot/pull/117763)). +- Fix code completion popup colors not being updated properly ([GH-115315](https://github.com/godotengine/godot/pull/115315)). +- Fix detection of some features in Engine Compilation Configuration Editor ([GH-115230](https://github.com/godotengine/godot/pull/115230)). +- Fix editor not handling unsaved changes on restart from settings ([GH-116218](https://github.com/godotengine/godot/pull/116218)). +- Fix EditorSettings error due to `android_sdk_path` when exporting a project ([GH-116515](https://github.com/godotengine/godot/pull/116515)). +- Fix extend script button styling in scene tree dock ([GH-115045](https://github.com/godotengine/godot/pull/115045)). +- Fix hidden `Import` tab height ([GH-115172](https://github.com/godotengine/godot/pull/115172)). +- Fix mute button after pausing and stopping ([GH-116537](https://github.com/godotengine/godot/pull/116537)). +- Fix theme item inspector tooltips for Window subclasses ([GH-115245](https://github.com/godotengine/godot/pull/115245)). +- Hide property groups from the "Members" section in Debugger ([GH-116790](https://github.com/godotengine/godot/pull/116790)). +- macOS: Set apple menu node name to non empty value ([GH-115726](https://github.com/godotengine/godot/pull/115726)). +- Properly update region editor window when undoing changes to `region_rect` ([GH-108875](https://github.com/godotengine/godot/pull/108875)). +- Scene tree dock: Don't log error if there is no selection upon handling `item_icon_double_clicked` signal ([GH-115347](https://github.com/godotengine/godot/pull/115347)). +- Set accessibility name on Tree inline cell editor when editing ([GH-117135](https://github.com/godotengine/godot/pull/117135)). +- Stop autocomplete from eating words by default ([GH-117464](https://github.com/godotengine/godot/pull/117464)). + +#### Export + +- Android Editor: Copy keystore to temp file during export ([GH-116161](https://github.com/godotengine/godot/pull/116161)). +- Linux: Handle debug symbols with renamed executable ([GH-114947](https://github.com/godotengine/godot/pull/114947)). + +#### GDExtension + +- Add missing `GDVIRTUAL_BIND(_get_supported_extensions)` on `MovieWriter` ([GH-117479](https://github.com/godotengine/godot/pull/117479)). + +#### GDScript + +- Stop `RemoteDebugger` from improperly flushing messages during break ([GH-115532](https://github.com/godotengine/godot/pull/115532)). + +#### GUI + +- Fix "Custom" anchor preset being ignored if the parent isn't a `Control` ([GH-117488](https://github.com/godotengine/godot/pull/117488)). +- Fix `SplitContainerDragger` dragging with enabled screen reader, allow resizing with keyboard shortcuts ([GH-116628](https://github.com/godotengine/godot/pull/116628)). +- Fix `TabContainer` accessibility sub-element cleanup ([GH-116617](https://github.com/godotengine/godot/pull/116617)). +- Fix camera focus triggered by double-clicking Tree buttons ([GH-114519](https://github.com/godotengine/godot/pull/114519)). +- Fix crash on removing Windows PopupMenu submenu ([GH-115373](https://github.com/godotengine/godot/pull/115373)). +- Fix drag-resizing `Control` with non-zero `pivot_offset_ratio` ([GH-116057](https://github.com/godotengine/godot/pull/116057)). +- Fix error after setting native PopupMenu item ID ([GH-115378](https://github.com/godotengine/godot/pull/115378)). +- Fix LCD batching flag for StyleBoxTexture ([GH-116647](https://github.com/godotengine/godot/pull/116647)). +- Fix RichTextLabel drag selection not working after double-click ([GH-117201](https://github.com/godotengine/godot/pull/117201)). +- Fix soft hyphen not working with small (or zero) line breaking width ([GH-116196](https://github.com/godotengine/godot/pull/116196)). +- Fix SplitContainer accessibility errors ([GH-116601](https://github.com/godotengine/godot/pull/116601)). +- Fix wrong normal icon color in FileDialog ([GH-115917](https://github.com/godotengine/godot/pull/115917)). +- PopupMenu: Use parent `GraphEdit` scale for popups inside `GraphElement` instead of completely disabling it ([GH-115620](https://github.com/godotengine/godot/pull/115620)). +- RTL: Fix `%` handling in `[img=WxH]` tags ([GH-116928](https://github.com/godotengine/godot/pull/116928)). +- Stop exposing external theme item properties ([GH-115392](https://github.com/godotengine/godot/pull/115392)). +- TextEdit: Fix clipping of last character due to right margin rounding ([GH-116850](https://github.com/godotengine/godot/pull/116850)). +- TextServer: Fix numeric keycap emoji sequence rendering ([GH-115687](https://github.com/godotengine/godot/pull/115687)). +- TextServer: Ignore language of embedded object replacement spans when updating line breaks ([GH-116197](https://github.com/godotengine/godot/pull/116197)). + +#### Import + +- Blender attempts should be incremented to avoid endless loop ([GH-116589](https://github.com/godotengine/godot/pull/116589)). + +#### Input + +- Fix issues with `InputMap::load_from_project_settings()` when called in tool script ([GH-105045](https://github.com/godotengine/godot/pull/105045)). +- macOS: Hide input accessory popups when no text control selected ([GH-115619](https://github.com/godotengine/godot/pull/115619)). +- Sync controller mappings DB with SDL community repo ([GH-115752](https://github.com/godotengine/godot/pull/115752)). + +#### Physics + +- Jolt Physics: Make MoveKinematic more accurate when rotating a body by a very small angle ([GH-115327](https://github.com/godotengine/godot/pull/115327)). +- Jolt Physics: Rework how gravity is applied to dynamic bodies to prevent energy increase on elastic collisions ([GH-115305](https://github.com/godotengine/godot/pull/115305)). +- Jolt Physics: Swapping vertices of triangle if it is scaled inside out ([GH-115089](https://github.com/godotengine/godot/pull/115089)). + +#### Platforms + +- Android: Enable native file picker support on all devices ([GH-115257](https://github.com/godotengine/godot/pull/115257)). +- Android: Fix FileAccess crash when using treeUri in Gradle-built apps ([GH-117131](https://github.com/godotengine/godot/pull/117131)). +- Android: Fix JavaClassWrapper test crashes on API 26 and lower ([GH-115800](https://github.com/godotengine/godot/pull/115800)). +- Android: Remove version check for `FEATURE_NATIVE_DIALOG_FILE` support ([GH-116584](https://github.com/godotengine/godot/pull/116584)). +- Apple Embedded: Fix static .a/.xcframework library loading in `open_dynamic_library` ([GH-117469](https://github.com/godotengine/godot/pull/117469)). +- Fix macOS Steam time tracking lost when opening a project ([GH-117335](https://github.com/godotengine/godot/pull/117335)). +- Fix startup errors/warnings on X11 when the Prefer Wayland editor setting is enabled ([GH-116366](https://github.com/godotengine/godot/pull/116366)). +- iOS: Add UIScene lifecycle events ([GH-116395](https://github.com/godotengine/godot/pull/116395)). +- iOS: Propagate VC UI preferences to SwiftUI hosting controller ([GH-116633](https://github.com/godotengine/godot/pull/116633)). +- LinuxBSD: Fix UI freeze when opening file manager ([GH-114521](https://github.com/godotengine/godot/pull/114521)). +- macOS: Add `nullptr` checks of `script_debugger` in `LayerHost::gui_input` ([GH-116724](https://github.com/godotengine/godot/pull/116724)). +- macOS: Add null check to `get_framework_executable` ([GH-116354](https://github.com/godotengine/godot/pull/116354)). +- macOS: Enable wake for events if `Magnet` is running ([GH-116524](https://github.com/godotengine/godot/pull/116524)). +- macOS: Fix confined mouse movement getting out of sync ([GH-116242](https://github.com/godotengine/godot/pull/116242)). +- Wayland: Improve mapping robustness and synchronization ([GH-117385](https://github.com/godotengine/godot/pull/117385)). +- Wayland: Only handle the current output mode ([GH-116236](https://github.com/godotengine/godot/pull/116236)). +- Wayland: Skip resize request when the size is the same ([GH-116376](https://github.com/godotengine/godot/pull/116376)). +- Windows: Set current driver when ANGLE init fails ([GH-117253](https://github.com/godotengine/godot/pull/117253)). +- Windows: Use executable icon as default for the window ([GH-115294](https://github.com/godotengine/godot/pull/115294)). + +#### Plugin + +- Android: Fix java.util.HashMap handling ([GH-114941](https://github.com/godotengine/godot/pull/114941)). +- Fix EditorDock not reopening ([GH-117340](https://github.com/godotengine/godot/pull/117340)). + +#### Rendering + +- Add compatibility fallback to `textureLod` when reading from `RADIANCE` ([GH-116155](https://github.com/godotengine/godot/pull/116155)). +- Apply fixed size properly for mono/stereo rendering ([GH-115147](https://github.com/godotengine/godot/pull/115147)). +- Fix accidental write-combined memory reads in canvas renderer ([GH-115757](https://github.com/godotengine/godot/pull/115757)). +- Fix shader compilation error when writing to `FOG` when `render_mode fog_disabled` ([GH-115026](https://github.com/godotengine/godot/pull/115026)). +- Fix Tangent decoding detection when computing vertex skinning ([GH-117401](https://github.com/godotengine/godot/pull/117401)). +- Fix viewport debanding not working with spatial scalers ([GH-114890](https://github.com/godotengine/godot/pull/114890)). +- Handle nearest filtering modes in D3D12 driver when anisotropy is enabled ([GH-115504](https://github.com/godotengine/godot/pull/115504)). +- macOS: Force ANGLE (GL over Metal) when running in VM ([GH-117371](https://github.com/godotengine/godot/pull/117371)). +- Restore default sky roughness levels to 8 ([GH-116154](https://github.com/godotengine/godot/pull/116154)). + +#### Shaders + +- Fix UTF-8 handling in GLES3 shaders ([GH-116756](https://github.com/godotengine/godot/pull/116756)). +- Fixes for completion of shader preprocessor defines ([GH-116413](https://github.com/godotengine/godot/pull/116413)). +- VisualShader: Fix nodes not attaching to new Frame on duplication ([GH-115193](https://github.com/godotengine/godot/pull/115193)). + +#### Tests + +- Android: Fail instrumented tests when test function doesn't complete ([GH-115713](https://github.com/godotengine/godot/pull/115713)). +- Fix file access tests failing on older Android devices ([GH-115718](https://github.com/godotengine/godot/pull/115718)). + +#### Thirdparty + +- Accessibility: Handle adapter activation/deactivation ([GH-115565](https://github.com/godotengine/godot/pull/115565)). +- Add missing patch files to `thirdparty/jolt_physics` ([GH-115884](https://github.com/godotengine/godot/pull/115884)). +- libpng: Update to 1.6.55 ([GH-117564](https://github.com/godotengine/godot/pull/117564)). +- Update access-kit to 0.21.2 ([GH-117433](https://github.com/godotengine/godot/pull/117433)). + +## 4.6.1 - 2026-02-16 + +- [Release announcement](https://godotengine.org/article/maintenance-release-godot-4-6-1) +- [Interactive changelog](https://godotengine.github.io/godot-interactive-changelog/#4.6.1) + +#### 3D + +- Change orbit snap shortcut with navigation scheme ([GH-115298](https://github.com/godotengine/godot/pull/115298)). +- Fix `Skeleton3D` Edit Mode bone buttons have priority over transform gizmo ([GH-115608](https://github.com/godotengine/godot/pull/115608)). +- Fix viewport orbit snap defaulting to always snapping when shortcut(s) are set to none ([GH-115002](https://github.com/godotengine/godot/pull/115002)). +- Increase float precision in the editor inspector for Quaternions ([GH-106352](https://github.com/godotengine/godot/pull/106352)). +- Register zoom shortcuts to match preset `Godot` navigation scheme ([GH-115290](https://github.com/godotengine/godot/pull/115290)). + +#### Animation + +- Fix double memdelete of `dummy_player` ([GH-115968](https://github.com/godotengine/godot/pull/115968)). +- Fix LookAtModifier3D / AimModifier3D forward vector ([GH-115689](https://github.com/godotengine/godot/pull/115689)). +- Fix use-after-free in Animation Blend Tree ([GH-115919](https://github.com/godotengine/godot/pull/115919)). +- Fix use-after-free in AnimationTree (AHashMap realloc) ([GH-115931](https://github.com/godotengine/godot/pull/115931)). + +#### Buildsystem + +- Fix missing lib with `builtin_glslang=false` ([GH-93478](https://github.com/godotengine/godot/pull/93478)). + +#### C# + +- Revert "Improve performance of `CSharpLanguage::reload_assemblies`" ([GH-115759](https://github.com/godotengine/godot/pull/115759)). + +#### Core + +- Fix ClassDB class list sorting regression ([GH-115923](https://github.com/godotengine/godot/pull/115923)). +- Fix the `NodePath` hash function to not yield the same value for similar paths ([GH-115473](https://github.com/godotengine/godot/pull/115473)). + +#### Editor + +- Fix `NodePath` `EditorProperty` using the wrong scene root ([GH-115422](https://github.com/godotengine/godot/pull/115422)). +- Fix create dialog recents ([GH-115314](https://github.com/godotengine/godot/pull/115314)). +- Fix Rename option for instance roots ([GH-115575](https://github.com/godotengine/godot/pull/115575)). +- Fix Unique Resources from Inherited Scenes ([GH-115862](https://github.com/godotengine/godot/pull/115862)). +- Fix wrong base type when creating script ([GH-115778](https://github.com/godotengine/godot/pull/115778)). + +#### Export + +- Load translation files to check locale for ICU data export ([GH-115827](https://github.com/godotengine/godot/pull/115827)). + +#### GDScript + +- LSP: Add `godot` to known language ids ([GH-115671](https://github.com/godotengine/godot/pull/115671)). +- LSP: Handle clients that do not support `CompletionContext` ([GH-115672](https://github.com/godotengine/godot/pull/115672)). + +#### GUI + +- Fix current line highlight not extending into gutter ([GH-115729](https://github.com/godotengine/godot/pull/115729)). + +#### Input + +- Update editor shortcuts when changing 3D navigation scheme ([GH-115289](https://github.com/godotengine/godot/pull/115289)). + +#### Particles + +- Revert "Change curve range for particle multipliers" ([GH-116140](https://github.com/godotengine/godot/pull/116140)). + +#### Physics + +- Fix transform updates sometimes being discarded when using Jolt ([GH-115364](https://github.com/godotengine/godot/pull/115364)). + +#### Platforms + +- Android: Fix `Bad file descriptor` in SAF/MediaStore in long term access ([GH-115751](https://github.com/godotengine/godot/pull/115751)). +- Fix crash in `StorageScope.kt` on Android ([GH-115515](https://github.com/godotengine/godot/pull/115515)). +- Wayland Embedder: Fix FD leak with inert objects ([GH-115823](https://github.com/godotengine/godot/pull/115823)). +- Windows: Disable MSVC control flow check on IAT hooks ([GH-115430](https://github.com/godotengine/godot/pull/115430)). + +#### Plugin + +- Android: Fix plugin type mismatch regression ([GH-115685](https://github.com/godotengine/godot/pull/115685)). + +#### Rendering + +- Avoid reading from sky pointer when rendering background without sky ([GH-115874](https://github.com/godotengine/godot/pull/115874)). +- Ensure that uv border size is passed in to sky rendering functions ([GH-115606](https://github.com/godotengine/godot/pull/115606)). +- Pick the sample closer to the camera when resolving 2x MSAA ([GH-115124](https://github.com/godotengine/godot/pull/115124)). +- Update re-spirv with more derivative operations ([GH-115921](https://github.com/godotengine/godot/pull/115921)). +- Use sky's corrected camera projection for `combined_reprojection` ([GH-115292](https://github.com/godotengine/godot/pull/115292)). +- Use transmittance instead of opacity in the early-out branch when calculating volumetric fog ([GH-116107](https://github.com/godotengine/godot/pull/116107)). + +#### Thirdparty + +- libpng: Update to 1.6.54 ([GH-115714](https://github.com/godotengine/godot/pull/115714)). + ## 4.6 - 2026-01-26 - [Release announcement](https://godotengine.org/releases/4.6/) diff --git a/engine/CONTRIBUTING.md b/engine/CONTRIBUTING.md index 613aa7ac..02829178 100644 --- a/engine/CONTRIBUTING.md +++ b/engine/CONTRIBUTING.md @@ -65,7 +65,7 @@ for an introduction to developing on Godot. The [Contributing docs](https://contributing.godotengine.org/en/latest/organization/how_to_contribute.html) also have important information on the [PR workflow](https://contributing.godotengine.org/en/latest/organization/pull_requests/creating_pull_requests.html) -(with a helpful guide for Git usage), and our [Code style guidelines](https://contributing.godotengine.org/en/latest/engine/guidelines/cpp_usage_guidelines.html) +(with a helpful guide for Git usage), and our [Code style guidelines](https://contributing.godotengine.org/en/latest/engine/guidelines/code_style.html) which all contributions need to follow. ### Be mindful of your commits diff --git a/engine/COPYRIGHT.txt b/engine/COPYRIGHT.txt index 2d65970b..ce3cdd2c 100644 --- a/engine/COPYRIGHT.txt +++ b/engine/COPYRIGHT.txt @@ -310,11 +310,6 @@ Comment: The FreeType Project Copyright: 1996-2025, David Turner, Robert Wilhelm, and Werner Lemberg. License: FTL -Files: thirdparty/gamepadmotionhelpers/* -Comment: GamepadMotionHelpers -Copyright: 2020-2023, Julian "Jibb" Smart -License: Expat - Files: thirdparty/glad/* Comment: glad Copyright: 2013-2022, David Herberth @@ -432,11 +427,6 @@ Comment: meshoptimizer Copyright: 2016-2024, Arseny Kapoulkine License: Expat -Files: thirdparty/metal-cpp/* -Comment: metal-cpp -Copyright: 2024, Apple Inc. -License: Apache-2.0 - Files: thirdparty/mingw-std-threads/* Comment: mingw-std-threads Copyright: 2016, Mega Limited @@ -584,11 +574,6 @@ Comment: SPIRV-Cross Copyright: 2015-2021, Arm Limited License: Apache-2.0 or Expat -Files: thirdparty/spirv-headers/* -Comment: SPIRV-Headers -Copyright: 2015-2024, The Khronos Group Inc. -License: Expat - Files: thirdparty/spirv-reflect/* Comment: SPIRV-Reflect Copyright: 2017-2022, Google Inc. @@ -601,7 +586,7 @@ License: Apache-2.0 Files: thirdparty/thorvg/* Comment: ThorVG -Copyright: 2020-2026, The ThorVG Project +Copyright: 2020-2024, The ThorVG Project License: Expat Files: thirdparty/tinyexr/* @@ -623,19 +608,19 @@ License: BSD-3-clause Files: thirdparty/volk/* Comment: volk -Copyright: 2018-2025, Arseny Kapoulkine +Copyright: 2018-2024, Arseny Kapoulkine License: Expat Files: thirdparty/vulkan/* Comment: Vulkan Headers -Copyright: 2015-2025, The Khronos Group Inc. - 2015-2025, Valve Corporation - 2015-2025, LunarG, Inc. +Copyright: 2014-2024, The Khronos Group Inc. + 2014-2024, Valve Corporation + 2014-2024, LunarG, Inc. License: Apache-2.0 Files: thirdparty/vulkan/vk_mem_alloc.h Comment: Vulkan Memory Allocator -Copyright: 2017-2025, Advanced Micro Devices, Inc. +Copyright: 2017-2024, Advanced Micro Devices, Inc. License: Expat Files: thirdparty/wayland/* diff --git a/engine/SConstruct b/engine/SConstruct index b45d6b11..52e37b9b 100644 --- a/engine/SConstruct +++ b/engine/SConstruct @@ -2,7 +2,7 @@ from misc.utility.scons_hints import * EnsureSConsVersion(4, 0) -EnsurePythonVersion(3, 9) +EnsurePythonVersion(3, 8) # System import glob @@ -199,8 +199,8 @@ opts.Add(BoolVariable("opengl3", "Enable the OpenGL/GLES3 rendering driver", Tru opts.Add(BoolVariable("d3d12", "Enable the Direct3D 12 rendering driver on supported platforms", False)) opts.Add(BoolVariable("metal", "Enable the Metal rendering driver on supported platforms (Apple arm64 only)", False)) opts.Add(BoolVariable("use_volk", "Use the volk library to load the Vulkan loader dynamically", True)) -opts.Add(BoolVariable("accesskit", "Enable the AccessKit driver for screen reader support", True)) -opts.Add(BoolVariable("angle", "Enable the ANGLE rendering driver for OpenGL ES 3.0 on supported platforms", True)) +opts.Add(BoolVariable("accesskit", "Use AccessKit C SDK", True)) +opts.Add(("accesskit_sdk_path", "Path to the AccessKit C SDK", "")) opts.Add(BoolVariable("sdl", "Enable the SDL3 input driver", True)) opts.Add( EnumVariable( @@ -222,13 +222,6 @@ opts.Add( False, ) ) -opts.Add( - BoolVariable( - "profiler_record_on_demand", - "Record only when the profiler is connected, if the profiler supports it. In Tracy, this configures TRACY_ON_DEMAND, which has a performance impact if enabled.", - True, - ) -) # Advanced options @@ -243,7 +236,6 @@ opts.Add(BoolVariable("ninja", "Use the ninja backend for faster rebuilds", Fals opts.Add(BoolVariable("ninja_auto_run", "Run ninja automatically after generating the ninja file", True)) opts.Add("ninja_file", "Path to the generated ninja file", "build.ninja") opts.Add(BoolVariable("compiledb", "Generate compilation DB (`compile_commands.json`) for external tools", False)) -opts.Add(BoolVariable("compiledb_gen_only", "Exit after building the compilation database", False)) opts.Add( "num_jobs", "Use up to N jobs when compiling (equivalent to `-j N`). Defaults to max jobs - 1. Ignored if -j is used.", @@ -656,11 +648,8 @@ if env["build_profile"] != "": dbo = ft["disabled_build_options"] for c in dbo: env[c] = dbo[c] - except json.JSONDecodeError as err: - print_error(f'Failed to open feature build profile due to JSON decoding error: "{env["build_profile"]}"\n{err}') - Exit(255) - except FileNotFoundError: - print_error(f'Feature build profile not found at: "{env["build_profile"]}"') + except json.JSONDecodeError: + print_error(f'Failed to open feature build profile: "{env["build_profile"]}"') Exit(255) # 'dev_mode' and 'production' are aliases to set default options if they haven't been @@ -1180,6 +1169,7 @@ env.Append(BUILDERS=GLSL_BUILDERS) if env["compiledb"]: env.Tool("compilation_db") + env.Alias("compiledb", env.CompilationDatabase()) env.NoCache(env.CompilationDatabase()) if not env["verbose"]: env["COMPILATIONDB_COMSTR"] = "$GENCOMSTR" @@ -1239,12 +1229,6 @@ if env["vsproj"]: # Miscellaneous & post-build methods. if not env.GetOption("clean") and not env.GetOption("help"): - if env["compiledb"] and env["compiledb_gen_only"]: - from SCons.Tool.compilation_db import write_compilation_db - - write_compilation_db([env.File("compile_commands.json")], [], env) - env.Exit() - methods.dump(env) methods.show_progress(env) methods.prepare_purge(env) diff --git a/engine/core/config/engine.cpp b/engine/core/config/engine.cpp index 9a2c9318..154fed8f 100644 --- a/engine/core/config/engine.cpp +++ b/engine/core/config/engine.cpp @@ -34,7 +34,6 @@ #include "core/config/project_settings.h" #include "core/donors.gen.h" #include "core/license.gen.h" -#include "core/object/ref_counted.h" #include "core/variant/typed_array.h" #include "core/version.h" #include "servers/rendering/rendering_device.h" diff --git a/engine/core/config/project_settings.cpp b/engine/core/config/project_settings.cpp index 5992b462..8f293a30 100644 --- a/engine/core/config/project_settings.cpp +++ b/engine/core/config/project_settings.cpp @@ -30,28 +30,23 @@ #include "project_settings.h" +#include "core/core_bind.h" // For Compression enum. #include "core/input/input_map.h" -#include "core/io/compression.h" #include "core/io/config_file.h" #include "core/io/dir_access.h" #include "core/io/file_access.h" #include "core/io/file_access_pack.h" #include "core/io/marshalls.h" #include "core/io/resource_uid.h" -#include "core/object/callable_mp.h" -#include "core/object/class_db.h" -#include "core/object/message_queue.h" #include "core/object/script_language.h" -#include "core/os/os.h" #include "core/templates/rb_set.h" #include "core/variant/typed_array.h" #include "core/variant/variant_parser.h" #include "core/version.h" +#include "servers/rendering/rendering_server.h" #ifdef TOOLS_ENABLED -#include "core/config/engine.h" - -#include "modules/modules_enabled.gen.h" // IWYU pragma: keep. For mono. +#include "modules/modules_enabled.gen.h" // For mono. #endif // TOOLS_ENABLED ProjectSettings *ProjectSettings::get_singleton() { @@ -640,8 +635,7 @@ void ProjectSettings::_convert_to_last_version(int p_from_version) { } else if (p_from_version <= 6) { // Check if we still have legacy boot splash (removed in 4.6), map it to new project setting, then remove legacy setting. if (has_setting("application/boot_splash/fullsize")) { - // See RenderingServerEnums::SplashStretchMode. - set_setting("application/boot_splash/stretch_mode", get_setting("application/boot_splash/fullsize") ? 1 : 0); + set_setting("application/boot_splash/stretch_mode", RenderingServer::map_scaling_option_to_stretch_mode(get_setting("application/boot_splash/fullsize"))); set_setting("application/boot_splash/fullsize", Variant()); } } @@ -1063,7 +1057,6 @@ bool ProjectSettings::is_builtin_setting(const String &p_name) const { void ProjectSettings::clear(const String &p_name) { ERR_FAIL_COND_MSG(!props.has(p_name), vformat("Request for nonexistent project setting: '%s'.", p_name)); props.erase(p_name); - _queue_changed(p_name); } Error ProjectSettings::save() { @@ -1647,7 +1640,7 @@ void ProjectSettings::_bind_methods() { void ProjectSettings::_add_builtin_input_map() { if (InputMap::get_singleton()) { - HashMap>> builtins(InputMap::get_singleton()->get_builtins()); + HashMap>> builtins = InputMap::get_singleton()->get_builtins(); for (KeyValue>> &E : builtins) { Array events; @@ -1710,7 +1703,6 @@ ProjectSettings::ProjectSettings() { GLOBAL_DEF_BASIC(PropertyInfo(Variant::INT, "accessibility/general/accessibility_support", PROPERTY_HINT_ENUM, "Auto (When Screen Reader is Running),Always Active,Disabled"), 0); GLOBAL_DEF_BASIC(PropertyInfo(Variant::INT, "accessibility/general/updates_per_second", PROPERTY_HINT_RANGE, "1,100,1"), 60); - GLOBAL_DEF(PropertyInfo(Variant::STRING, "accessibility/general/accessibility_driver", PROPERTY_HINT_ENUM, "accesskit,dummy"), "accesskit"); // The default window size is tuned to: // - Have a 16:9 aspect ratio, @@ -1740,10 +1732,7 @@ ProjectSettings::ProjectSettings() { GLOBAL_DEF(PropertyInfo(Variant::INT, "display/window/size/window_width_override", PROPERTY_HINT_RANGE, "0,7680,1,or_greater"), 0); // 8K resolution GLOBAL_DEF(PropertyInfo(Variant::INT, "display/window/size/window_height_override", PROPERTY_HINT_RANGE, "0,4320,1,or_greater"), 0); // 8K resolution - GLOBAL_DEF("display/window/hdr/request_hdr_output", false); - GLOBAL_DEF("display/window/energy_saving/keep_screen_on", true); - GLOBAL_DEF("animation/warnings/check_invalid_skeleton_modifier_node_paths", true); GLOBAL_DEF("animation/warnings/check_invalid_track_paths", true); GLOBAL_DEF("animation/warnings/check_angle_interpolation_type_conflicting", true); #ifndef DISABLE_DEPRECATED @@ -1762,10 +1751,10 @@ ProjectSettings::ProjectSettings() { _add_builtin_input_map(); - // Keep the enum values in sync with the `DisplayServerEnums::ScreenOrientation` enum. + // Keep the enum values in sync with the `DisplayServer::ScreenOrientation` enum. custom_prop_info["display/window/handheld/orientation"] = PropertyInfo(Variant::INT, "display/window/handheld/orientation", PROPERTY_HINT_ENUM, "Landscape,Portrait,Reverse Landscape,Reverse Portrait,Sensor Landscape,Sensor Portrait,Sensor"); GLOBAL_DEF("display/window/subwindows/embed_subwindows", true); - // Keep the enum values in sync with the `DisplayServerEnums::VSyncMode` enum. + // Keep the enum values in sync with the `DisplayServer::VSyncMode` enum. custom_prop_info["display/window/vsync/vsync_mode"] = PropertyInfo(Variant::INT, "display/window/vsync/vsync_mode", PROPERTY_HINT_ENUM, "Disabled,Enabled,Adaptive,Mailbox"); GLOBAL_DEF("display/window/frame_pacing/android/enable_frame_pacing", true); @@ -1817,7 +1806,7 @@ ProjectSettings::ProjectSettings() { GLOBAL_DEF("gui/common/drag_threshold", 10); GLOBAL_DEF_BASIC("gui/common/snap_controls_to_pixels", true); - GLOBAL_DEF(PropertyInfo(Variant::INT, "gui/common/show_focus_state_on_pointer_event", PROPERTY_HINT_ENUM, "Never,Text Input Controls,Always"), 1); + GLOBAL_DEF(PropertyInfo(Variant::INT, "gui/common/show_focus_state_on_pointer_event", PROPERTY_HINT_ENUM, "Never,Control Supports Keyboard Input,Always"), 1); GLOBAL_DEF_BASIC("gui/fonts/dynamic_fonts/use_oversampling", true); GLOBAL_DEF_RST(PropertyInfo(Variant::INT, "rendering/rendering_device/vsync/frame_queue_size", PROPERTY_HINT_RANGE, "2,3,1"), 2); diff --git a/engine/core/config/project_settings.h b/engine/core/config/project_settings.h index e197a8d9..a861f49f 100644 --- a/engine/core/config/project_settings.h +++ b/engine/core/config/project_settings.h @@ -31,7 +31,6 @@ #pragma once #include "core/object/object.h" -#include "core/os/thread_safe.h" #include "core/templates/rb_map.h" template @@ -205,7 +204,7 @@ public: const HashMap &get_custom_property_info() const; uint64_t get_last_saved_time() { return last_save_time; } - List get_input_presets() const { return List(input_presets); } + List get_input_presets() const { return input_presets; } Variant get_setting_with_override(const StringName &p_name) const; Variant get_setting_with_override_and_custom_features(const StringName &p_name, const Vector &p_features) const; diff --git a/engine/core/core_bind.compat.inc b/engine/core/core_bind.compat.inc index 26086522..8bfa66e4 100644 --- a/engine/core/core_bind.compat.inc +++ b/engine/core/core_bind.compat.inc @@ -30,10 +30,6 @@ #ifndef DISABLE_DEPRECATED -#include "core_bind.h" - -#include "core/object/class_db.h" - namespace CoreBind { // Semaphore diff --git a/engine/core/core_bind.cpp b/engine/core/core_bind.cpp index e78b5a56..2fd854f4 100644 --- a/engine/core/core_bind.cpp +++ b/engine/core/core_bind.cpp @@ -31,7 +31,6 @@ #include "core_bind.h" #include "core_bind.compat.inc" -#include "core/config/engine.h" #include "core/config/project_settings.h" #include "core/crypto/crypto_core.h" #include "core/debugger/engine_debugger.h" @@ -40,11 +39,8 @@ #include "core/io/marshalls.h" #include "core/math/geometry_2d.h" #include "core/math/geometry_3d.h" -#include "core/object/class_db.h" #include "core/os/keyboard.h" #include "core/os/main_loop.h" -#include "core/os/os.h" -#include "core/os/process_id.h" #include "core/os/thread_safe.h" #include "core/variant/typed_array.h" @@ -429,7 +425,7 @@ int OS::create_instance(const Vector &p_arguments) { for (const String &arg : p_arguments) { args.push_back(arg); } - ProcessID pid = 0; + ::OS::ProcessID pid = 0; Error err = ::OS::get_singleton()->create_instance(args, &pid); if (err != OK) { return -1; @@ -450,7 +446,7 @@ int OS::create_process(const String &p_path, const Vector &p_arguments, for (const String &arg : p_arguments) { args.push_back(arg); } - ProcessID pid = 0; + ::OS::ProcessID pid = 0; Error err = ::OS::get_singleton()->create_process(p_path, args, &pid, p_open_console); if (err != OK) { return -1; diff --git a/engine/core/core_bind.h b/engine/core/core_bind.h index 547c1f0b..9848393e 100644 --- a/engine/core/core_bind.h +++ b/engine/core/core_bind.h @@ -31,10 +31,8 @@ #pragma once #include "core/debugger/engine_profiler.h" -#include "core/io/logger.h" #include "core/io/resource_loader.h" #include "core/io/resource_saver.h" -#include "core/object/class_db.h" #include "core/object/script_backtrace.h" #include "core/os/semaphore.h" #include "core/os/thread.h" diff --git a/engine/core/core_builders.py b/engine/core/core_builders.py index c9d76eb0..d6b1a2b7 100644 --- a/engine/core/core_builders.py +++ b/engine/core/core_builders.py @@ -41,7 +41,7 @@ def version_hash_builder(target, source, env): #include "core/version.h" const char *const GODOT_VERSION_HASH = "{git_hash}"; -const unsigned long long GODOT_VERSION_TIMESTAMP = {git_timestamp}; +const uint64_t GODOT_VERSION_TIMESTAMP = {git_timestamp}; """.format(**source[0].read()) ) @@ -63,7 +63,7 @@ def encryption_key_builder(target, source, env): with methods.generated_wrapper(str(target[0])) as file: file.write( f"""\ -#include +#include "core/config/project_settings.h" uint8_t script_encryption_key[32] = {{ {methods.format_buffer(buffer, 1)} diff --git a/engine/core/core_constants.cpp b/engine/core/core_constants.cpp index 3a43ea01..b3251295 100644 --- a/engine/core/core_constants.cpp +++ b/engine/core/core_constants.cpp @@ -30,12 +30,10 @@ #include "core_constants.h" -#include "core/input/input_enums.h" -#include "core/object/method_bind_common.h" // IWYU pragma: keep. For `VARIANT_BITFIELD_CAST(MethodFlags)`. +#include "core/input/input_event.h" +#include "core/object/class_db.h" #include "core/os/keyboard.h" -#include "core/variant/type_info.h" #include "core/variant/variant.h" -#include "core/variant/variant_caster.h" struct _CoreConstant { #ifdef DEBUG_ENABLED @@ -71,183 +69,183 @@ static HashMap> _global_enums; #ifdef DEBUG_ENABLED -#define BIND_CORE_CONSTANT(m_constant) \ +#define BIND_CORE_CONSTANT(m_constant) \ _global_constants.push_back(_CoreConstant(StringName(), #m_constant, m_constant)); \ _global_constants_map[#m_constant] = _global_constants.size() - 1; -#define BIND_CORE_ENUM_CONSTANT(m_constant) \ - { \ - StringName enum_name = __constant_get_enum_name(m_constant); \ - _global_constants.push_back(_CoreConstant(enum_name, #m_constant, m_constant)); \ - _global_constants_map[#m_constant] = _global_constants.size() - 1; \ +#define BIND_CORE_ENUM_CONSTANT(m_constant) \ + { \ + StringName enum_name = __constant_get_enum_name(m_constant); \ + _global_constants.push_back(_CoreConstant(enum_name, #m_constant, m_constant)); \ + _global_constants_map[#m_constant] = _global_constants.size() - 1; \ _global_enums[enum_name].push_back((_global_constants.ptr())[_global_constants.size() - 1]); \ } -#define BIND_CORE_BITFIELD_FLAG(m_constant) \ - { \ - StringName enum_name = __constant_get_bitfield_name(m_constant); \ +#define BIND_CORE_BITFIELD_FLAG(m_constant) \ + { \ + StringName enum_name = __constant_get_bitfield_name(m_constant); \ _global_constants.push_back(_CoreConstant(enum_name, #m_constant, m_constant, false, true)); \ - _global_constants_map[#m_constant] = _global_constants.size() - 1; \ + _global_constants_map[#m_constant] = _global_constants.size() - 1; \ _global_enums[enum_name].push_back((_global_constants.ptr())[_global_constants.size() - 1]); \ } // This just binds enum classes as if they were regular enum constants. -#define BIND_CORE_ENUM_CLASS_CONSTANT(m_enum, m_prefix, m_member) \ - { \ - StringName enum_name = __constant_get_enum_name(m_enum::m_member); \ +#define BIND_CORE_ENUM_CLASS_CONSTANT(m_enum, m_prefix, m_member) \ + { \ + StringName enum_name = __constant_get_enum_name(m_enum::m_member); \ _global_constants.push_back(_CoreConstant(enum_name, #m_prefix "_" #m_member, (int64_t)m_enum::m_member)); \ - _global_constants_map[#m_prefix "_" #m_member] = _global_constants.size() - 1; \ - _global_enums[enum_name].push_back((_global_constants.ptr())[_global_constants.size() - 1]); \ + _global_constants_map[#m_prefix "_" #m_member] = _global_constants.size() - 1; \ + _global_enums[enum_name].push_back((_global_constants.ptr())[_global_constants.size() - 1]); \ } -#define BIND_CORE_BITFIELD_CLASS_FLAG(m_enum, m_prefix, m_member) \ - { \ - StringName enum_name = __constant_get_bitfield_name(m_enum::m_member); \ +#define BIND_CORE_BITFIELD_CLASS_FLAG(m_enum, m_prefix, m_member) \ + { \ + StringName enum_name = __constant_get_bitfield_name(m_enum::m_member); \ _global_constants.push_back(_CoreConstant(enum_name, #m_prefix "_" #m_member, (int64_t)m_enum::m_member, false, true)); \ - _global_constants_map[#m_prefix "_" #m_member] = _global_constants.size() - 1; \ + _global_constants_map[#m_prefix "_" #m_member] = _global_constants.size() - 1; \ + _global_enums[enum_name].push_back((_global_constants.ptr())[_global_constants.size() - 1]); \ + } + +#define BIND_CORE_ENUM_CLASS_CONSTANT_CUSTOM(m_enum, m_name, m_member) \ + { \ + StringName enum_name = __constant_get_enum_name(m_enum::m_member); \ + _global_constants.push_back(_CoreConstant(enum_name, #m_name, (int64_t)m_enum::m_member)); \ + _global_constants_map[#m_name] = _global_constants.size() - 1; \ _global_enums[enum_name].push_back((_global_constants.ptr())[_global_constants.size() - 1]); \ } -#define BIND_CORE_ENUM_CLASS_CONSTANT_CUSTOM(m_enum, m_name, m_member) \ - { \ - StringName enum_name = __constant_get_enum_name(m_enum::m_member); \ - _global_constants.push_back(_CoreConstant(enum_name, #m_name, (int64_t)m_enum::m_member)); \ - _global_constants_map[#m_name] = _global_constants.size() - 1; \ - _global_enums[enum_name].push_back((_global_constants.ptr())[_global_constants.size() - 1]); \ - } - -#define BIND_CORE_BITFIELD_CLASS_FLAG_CUSTOM(m_enum, m_name, m_member) \ - { \ - StringName enum_name = __constant_get_bitfield_name(m_enum::m_member); \ +#define BIND_CORE_BITFIELD_CLASS_FLAG_CUSTOM(m_enum, m_name, m_member) \ + { \ + StringName enum_name = __constant_get_bitfield_name(m_enum::m_member); \ _global_constants.push_back(_CoreConstant(enum_name, #m_name, (int64_t)m_enum::m_member, false, true)); \ - _global_constants_map[#m_name] = _global_constants.size() - 1; \ - _global_enums[enum_name].push_back((_global_constants.ptr())[_global_constants.size() - 1]); \ + _global_constants_map[#m_name] = _global_constants.size() - 1; \ + _global_enums[enum_name].push_back((_global_constants.ptr())[_global_constants.size() - 1]); \ } -#define BIND_CORE_ENUM_CLASS_CONSTANT_NO_VAL(m_enum, m_prefix, m_member) \ - { \ - StringName enum_name = __constant_get_enum_name(m_enum::m_member); \ +#define BIND_CORE_ENUM_CLASS_CONSTANT_NO_VAL(m_enum, m_prefix, m_member) \ + { \ + StringName enum_name = __constant_get_enum_name(m_enum::m_member); \ _global_constants.push_back(_CoreConstant(enum_name, #m_prefix "_" #m_member, (int64_t)m_enum::m_member, true)); \ - _global_constants_map[#m_prefix "_" #m_member] = _global_constants.size() - 1; \ + _global_constants_map[#m_prefix "_" #m_member] = _global_constants.size() - 1; \ + _global_enums[enum_name].push_back((_global_constants.ptr())[_global_constants.size() - 1]); \ + } + +#define BIND_CORE_ENUM_CONSTANT_CUSTOM(m_custom_name, m_constant) \ + { \ + StringName enum_name = __constant_get_enum_name(m_constant); \ + _global_constants.push_back(_CoreConstant(enum_name, m_custom_name, m_constant)); \ + _global_constants_map[m_custom_name] = _global_constants.size() - 1; \ _global_enums[enum_name].push_back((_global_constants.ptr())[_global_constants.size() - 1]); \ } -#define BIND_CORE_ENUM_CONSTANT_CUSTOM(m_custom_name, m_constant) \ - { \ - StringName enum_name = __constant_get_enum_name(m_constant); \ - _global_constants.push_back(_CoreConstant(enum_name, m_custom_name, m_constant)); \ - _global_constants_map[m_custom_name] = _global_constants.size() - 1; \ - _global_enums[enum_name].push_back((_global_constants.ptr())[_global_constants.size() - 1]); \ - } - -#define BIND_CORE_CONSTANT_NO_VAL(m_constant) \ +#define BIND_CORE_CONSTANT_NO_VAL(m_constant) \ _global_constants.push_back(_CoreConstant(StringName(), #m_constant, m_constant, true)); \ _global_constants_map[#m_constant] = _global_constants.size() - 1; -#define BIND_CORE_ENUM_CONSTANT_NO_VAL(m_constant) \ - { \ - StringName enum_name = __constant_get_enum_name(m_constant); \ - _global_constants.push_back(_CoreConstant(enum_name, #m_constant, m_constant, true)); \ - _global_constants_map[#m_constant] = _global_constants.size() - 1; \ +#define BIND_CORE_ENUM_CONSTANT_NO_VAL(m_constant) \ + { \ + StringName enum_name = __constant_get_enum_name(m_constant); \ + _global_constants.push_back(_CoreConstant(enum_name, #m_constant, m_constant, true)); \ + _global_constants_map[#m_constant] = _global_constants.size() - 1; \ _global_enums[enum_name].push_back((_global_constants.ptr())[_global_constants.size() - 1]); \ } -#define BIND_CORE_ENUM_CONSTANT_CUSTOM_NO_VAL(m_custom_name, m_constant) \ - { \ - StringName enum_name = __constant_get_enum_name(m_constant); \ - _global_constants.push_back(_CoreConstant(enum_name, m_custom_name, m_constant, true)); \ - _global_constants_map[m_custom_name] = _global_constants.size() - 1; \ +#define BIND_CORE_ENUM_CONSTANT_CUSTOM_NO_VAL(m_custom_name, m_constant) \ + { \ + StringName enum_name = __constant_get_enum_name(m_constant); \ + _global_constants.push_back(_CoreConstant(enum_name, m_custom_name, m_constant, true)); \ + _global_constants_map[m_custom_name] = _global_constants.size() - 1; \ _global_enums[enum_name].push_back((_global_constants.ptr())[_global_constants.size() - 1]); \ } #else -#define BIND_CORE_CONSTANT(m_constant) \ +#define BIND_CORE_CONSTANT(m_constant) \ _global_constants.push_back(_CoreConstant(StringName(), #m_constant, m_constant)); \ _global_constants_map[#m_constant] = _global_constants.size() - 1; -#define BIND_CORE_ENUM_CONSTANT(m_constant) \ - { \ - StringName enum_name = __constant_get_enum_name(m_constant); \ - _global_constants.push_back(_CoreConstant(enum_name, #m_constant, m_constant)); \ - _global_constants_map[#m_constant] = _global_constants.size() - 1; \ +#define BIND_CORE_ENUM_CONSTANT(m_constant) \ + { \ + StringName enum_name = __constant_get_enum_name(m_constant); \ + _global_constants.push_back(_CoreConstant(enum_name, #m_constant, m_constant)); \ + _global_constants_map[#m_constant] = _global_constants.size() - 1; \ _global_enums[enum_name].push_back((_global_constants.ptr())[_global_constants.size() - 1]); \ } -#define BIND_CORE_BITFIELD_FLAG(m_constant) \ - { \ - StringName enum_name = __constant_get_bitfield_name(m_constant); \ - _global_constants.push_back(_CoreConstant(enum_name, #m_constant, m_constant)); \ - _global_constants_map[#m_constant] = _global_constants.size() - 1; \ +#define BIND_CORE_BITFIELD_FLAG(m_constant) \ + { \ + StringName enum_name = __constant_get_bitfield_name(m_constant); \ + _global_constants.push_back(_CoreConstant(enum_name, #m_constant, m_constant)); \ + _global_constants_map[#m_constant] = _global_constants.size() - 1; \ _global_enums[enum_name].push_back((_global_constants.ptr())[_global_constants.size() - 1]); \ } // This just binds enum classes as if they were regular enum constants. -#define BIND_CORE_ENUM_CLASS_CONSTANT(m_enum, m_prefix, m_member) \ - { \ - StringName enum_name = __constant_get_enum_name(m_enum::m_member); \ +#define BIND_CORE_ENUM_CLASS_CONSTANT(m_enum, m_prefix, m_member) \ + { \ + StringName enum_name = __constant_get_enum_name(m_enum::m_member); \ _global_constants.push_back(_CoreConstant(enum_name, #m_prefix "_" #m_member, (int64_t)m_enum::m_member)); \ - _global_constants_map[#m_prefix "_" #m_member] = _global_constants.size() - 1; \ - _global_enums[enum_name].push_back((_global_constants.ptr())[_global_constants.size() - 1]); \ + _global_constants_map[#m_prefix "_" #m_member] = _global_constants.size() - 1; \ + _global_enums[enum_name].push_back((_global_constants.ptr())[_global_constants.size() - 1]); \ } -#define BIND_CORE_BITFIELD_CLASS_FLAG(m_enum, m_prefix, m_member) \ - { \ - StringName enum_name = __constant_get_bitfield_name(m_enum::m_member); \ +#define BIND_CORE_BITFIELD_CLASS_FLAG(m_enum, m_prefix, m_member) \ + { \ + StringName enum_name = __constant_get_bitfield_name(m_enum::m_member); \ _global_constants.push_back(_CoreConstant(enum_name, #m_prefix "_" #m_member, (int64_t)m_enum::m_member)); \ - _global_constants_map[#m_prefix "_" #m_member] = _global_constants.size() - 1; \ + _global_constants_map[#m_prefix "_" #m_member] = _global_constants.size() - 1; \ + _global_enums[enum_name].push_back((_global_constants.ptr())[_global_constants.size() - 1]); \ + } + +#define BIND_CORE_ENUM_CLASS_CONSTANT_CUSTOM(m_enum, m_name, m_member) \ + { \ + StringName enum_name = __constant_get_enum_name(m_enum::m_member); \ + _global_constants.push_back(_CoreConstant(enum_name, #m_name, (int64_t)m_enum::m_member)); \ + _global_constants_map[#m_name] = _global_constants.size() - 1; \ _global_enums[enum_name].push_back((_global_constants.ptr())[_global_constants.size() - 1]); \ } -#define BIND_CORE_ENUM_CLASS_CONSTANT_CUSTOM(m_enum, m_name, m_member) \ - { \ - StringName enum_name = __constant_get_enum_name(m_enum::m_member); \ - _global_constants.push_back(_CoreConstant(enum_name, #m_name, (int64_t)m_enum::m_member)); \ - _global_constants_map[#m_name] = _global_constants.size() - 1; \ +#define BIND_CORE_BITFIELD_CLASS_FLAG_CUSTOM(m_enum, m_name, m_member) \ + { \ + StringName enum_name = __constant_get_bitfield_name(m_enum::m_member); \ + _global_constants.push_back(_CoreConstant(enum_name, #m_name, (int64_t)m_enum::m_member)); \ + _global_constants_map[#m_name] = _global_constants.size() - 1; \ _global_enums[enum_name].push_back((_global_constants.ptr())[_global_constants.size() - 1]); \ } -#define BIND_CORE_BITFIELD_CLASS_FLAG_CUSTOM(m_enum, m_name, m_member) \ - { \ - StringName enum_name = __constant_get_bitfield_name(m_enum::m_member); \ - _global_constants.push_back(_CoreConstant(enum_name, #m_name, (int64_t)m_enum::m_member)); \ - _global_constants_map[#m_name] = _global_constants.size() - 1; \ - _global_enums[enum_name].push_back((_global_constants.ptr())[_global_constants.size() - 1]); \ - } - -#define BIND_CORE_ENUM_CLASS_CONSTANT_NO_VAL(m_enum, m_prefix, m_member) \ - { \ - StringName enum_name = __constant_get_enum_name(m_enum::m_member); \ +#define BIND_CORE_ENUM_CLASS_CONSTANT_NO_VAL(m_enum, m_prefix, m_member) \ + { \ + StringName enum_name = __constant_get_enum_name(m_enum::m_member); \ _global_constants.push_back(_CoreConstant(enum_name, #m_prefix "_" #m_member, (int64_t)m_enum::m_member)); \ - _global_constants_map[#m_prefix "_" #m_member] = _global_constants.size() - 1; \ + _global_constants_map[#m_prefix "_" #m_member] = _global_constants.size() - 1; \ + _global_enums[enum_name].push_back((_global_constants.ptr())[_global_constants.size() - 1]); \ + } + +#define BIND_CORE_ENUM_CONSTANT_CUSTOM(m_custom_name, m_constant) \ + { \ + StringName enum_name = __constant_get_enum_name(m_constant); \ + _global_constants.push_back(_CoreConstant(enum_name, m_custom_name, m_constant)); \ + _global_constants_map[m_custom_name] = _global_constants.size() - 1; \ _global_enums[enum_name].push_back((_global_constants.ptr())[_global_constants.size() - 1]); \ } -#define BIND_CORE_ENUM_CONSTANT_CUSTOM(m_custom_name, m_constant) \ - { \ - StringName enum_name = __constant_get_enum_name(m_constant); \ - _global_constants.push_back(_CoreConstant(enum_name, m_custom_name, m_constant)); \ - _global_constants_map[m_custom_name] = _global_constants.size() - 1; \ - _global_enums[enum_name].push_back((_global_constants.ptr())[_global_constants.size() - 1]); \ - } - -#define BIND_CORE_CONSTANT_NO_VAL(m_constant) \ +#define BIND_CORE_CONSTANT_NO_VAL(m_constant) \ _global_constants.push_back(_CoreConstant(StringName(), #m_constant, m_constant)); \ _global_constants_map[#m_constant] = _global_constants.size() - 1; -#define BIND_CORE_ENUM_CONSTANT_NO_VAL(m_constant) \ - { \ - StringName enum_name = __constant_get_enum_name(m_constant); \ - _global_constants.push_back(_CoreConstant(enum_name, #m_constant, m_constant)); \ - _global_constants_map[#m_constant] = _global_constants.size() - 1; \ +#define BIND_CORE_ENUM_CONSTANT_NO_VAL(m_constant) \ + { \ + StringName enum_name = __constant_get_enum_name(m_constant); \ + _global_constants.push_back(_CoreConstant(enum_name, #m_constant, m_constant)); \ + _global_constants_map[#m_constant] = _global_constants.size() - 1; \ _global_enums[enum_name].push_back((_global_constants.ptr())[_global_constants.size() - 1]); \ } -#define BIND_CORE_ENUM_CONSTANT_CUSTOM_NO_VAL(m_custom_name, m_constant) \ - { \ - StringName enum_name = __constant_get_enum_name(m_constant); \ - _global_constants.push_back(_CoreConstant(enum_name, m_custom_name, m_constant)); \ - _global_constants_map[m_custom_name] = _global_constants.size() - 1; \ +#define BIND_CORE_ENUM_CONSTANT_CUSTOM_NO_VAL(m_custom_name, m_constant) \ + { \ + StringName enum_name = __constant_get_enum_name(m_constant); \ + _global_constants.push_back(_CoreConstant(enum_name, m_custom_name, m_constant)); \ + _global_constants_map[m_custom_name] = _global_constants.size() - 1; \ _global_enums[enum_name].push_back((_global_constants.ptr())[_global_constants.size() - 1]); \ } @@ -551,11 +549,6 @@ void register_global_constants() { BIND_CORE_ENUM_CLASS_CONSTANT(JoyButton, JOY_BUTTON, PADDLE3); BIND_CORE_ENUM_CLASS_CONSTANT(JoyButton, JOY_BUTTON, PADDLE4); BIND_CORE_ENUM_CLASS_CONSTANT(JoyButton, JOY_BUTTON, TOUCHPAD); - BIND_CORE_ENUM_CLASS_CONSTANT(JoyButton, JOY_BUTTON, MISC2); - BIND_CORE_ENUM_CLASS_CONSTANT(JoyButton, JOY_BUTTON, MISC3); - BIND_CORE_ENUM_CLASS_CONSTANT(JoyButton, JOY_BUTTON, MISC4); - BIND_CORE_ENUM_CLASS_CONSTANT(JoyButton, JOY_BUTTON, MISC5); - BIND_CORE_ENUM_CLASS_CONSTANT(JoyButton, JOY_BUTTON, MISC6); BIND_CORE_ENUM_CLASS_CONSTANT(JoyButton, JOY_BUTTON, SDL_MAX); BIND_CORE_ENUM_CLASS_CONSTANT(JoyButton, JOY_BUTTON, MAX); @@ -736,18 +729,6 @@ void register_global_constants() { BIND_CORE_BITFIELD_FLAG(METHOD_FLAG_VIRTUAL_REQUIRED); BIND_CORE_BITFIELD_FLAG(METHOD_FLAGS_DEFAULT); - BIND_CORE_CONSTANT(UINT8_MAX); - BIND_CORE_CONSTANT(UINT16_MAX); - BIND_CORE_CONSTANT(UINT32_MAX); - BIND_CORE_CONSTANT(INT8_MIN); - BIND_CORE_CONSTANT(INT8_MAX); - BIND_CORE_CONSTANT(INT16_MIN); - BIND_CORE_CONSTANT(INT16_MAX); - BIND_CORE_CONSTANT(INT32_MIN); - BIND_CORE_CONSTANT(INT32_MAX); - BIND_CORE_CONSTANT(INT64_MIN); - BIND_CORE_CONSTANT(INT64_MAX); - BIND_CORE_ENUM_CONSTANT_CUSTOM("TYPE_NIL", Variant::NIL); BIND_CORE_ENUM_CONSTANT_CUSTOM("TYPE_BOOL", Variant::BOOL); BIND_CORE_ENUM_CONSTANT_CUSTOM("TYPE_INT", Variant::INT); diff --git a/engine/core/core_globals.h b/engine/core/core_globals.h index fa095daf..a5aae961 100644 --- a/engine/core/core_globals.h +++ b/engine/core/core_globals.h @@ -38,5 +38,4 @@ public: static inline bool leak_reporting_enabled = true; static inline bool print_line_enabled = true; static inline bool print_error_enabled = true; - static inline bool print_ready = false; }; diff --git a/engine/core/crypto/aes_context.cpp b/engine/core/crypto/aes_context.cpp index a1fa4397..53ca6502 100644 --- a/engine/core/crypto/aes_context.cpp +++ b/engine/core/crypto/aes_context.cpp @@ -28,9 +28,7 @@ /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /**************************************************************************/ -#include "aes_context.h" - -#include "core/object/class_db.h" +#include "core/crypto/aes_context.h" Error AESContext::start(Mode p_mode, const PackedByteArray &p_key, const PackedByteArray &p_iv) { ERR_FAIL_COND_V_MSG(mode != MODE_MAX, ERR_ALREADY_IN_USE, "AESContext already started. Call 'finish' before starting a new one."); diff --git a/engine/core/crypto/aes_context.h b/engine/core/crypto/aes_context.h index 51d5d4cd..bc13485e 100644 --- a/engine/core/crypto/aes_context.h +++ b/engine/core/crypto/aes_context.h @@ -32,7 +32,6 @@ #include "core/crypto/crypto_core.h" #include "core/object/ref_counted.h" -#include "core/variant/type_info.h" class AESContext : public RefCounted { GDCLASS(AESContext, RefCounted); diff --git a/engine/core/crypto/crypto.cpp b/engine/core/crypto/crypto.cpp index edbfae32..2f0c5476 100644 --- a/engine/core/crypto/crypto.cpp +++ b/engine/core/crypto/crypto.cpp @@ -30,8 +30,6 @@ #include "crypto.h" -#include "core/object/class_db.h" - /// Resources CryptoKey *(*CryptoKey::_create)(bool p_notify_postinitialize) = nullptr; @@ -179,3 +177,82 @@ void Crypto::_bind_methods() { ClassDB::bind_method(D_METHOD("hmac_digest", "hash_type", "key", "msg"), &Crypto::hmac_digest); ClassDB::bind_method(D_METHOD("constant_time_compare", "trusted", "received"), &Crypto::constant_time_compare); } + +/// Resource loader/saver + +Ref ResourceFormatLoaderCrypto::load(const String &p_path, const String &p_original_path, Error *r_error, bool p_use_sub_threads, float *r_progress, CacheMode p_cache_mode) { + String el = p_path.get_extension().to_lower(); + if (el == "crt") { + X509Certificate *cert = X509Certificate::create(); + if (cert) { + cert->load(p_path); + } + return cert; + } else if (el == "key") { + CryptoKey *key = CryptoKey::create(); + if (key) { + key->load(p_path, false); + } + return key; + } else if (el == "pub") { + CryptoKey *key = CryptoKey::create(); + if (key) { + key->load(p_path, true); + } + return key; + } + return nullptr; +} + +void ResourceFormatLoaderCrypto::get_recognized_extensions(List *p_extensions) const { + p_extensions->push_back("crt"); + p_extensions->push_back("key"); + p_extensions->push_back("pub"); +} + +bool ResourceFormatLoaderCrypto::handles_type(const String &p_type) const { + return p_type == "X509Certificate" || p_type == "CryptoKey"; +} + +String ResourceFormatLoaderCrypto::get_resource_type(const String &p_path) const { + String el = p_path.get_extension().to_lower(); + if (el == "crt") { + return "X509Certificate"; + } else if (el == "key" || el == "pub") { + return "CryptoKey"; + } + return ""; +} + +Error ResourceFormatSaverCrypto::save(const Ref &p_resource, const String &p_path, uint32_t p_flags) { + Error err; + Ref cert = p_resource; + Ref key = p_resource; + if (cert.is_valid()) { + err = cert->save(p_path); + } else if (key.is_valid()) { + err = key->save(p_path, p_path.has_extension("pub")); + } else { + ERR_FAIL_V(ERR_INVALID_PARAMETER); + } + ERR_FAIL_COND_V_MSG(err != OK, err, vformat("Cannot save Crypto resource to file '%s'.", p_path)); + return OK; +} + +void ResourceFormatSaverCrypto::get_recognized_extensions(const Ref &p_resource, List *p_extensions) const { + const X509Certificate *cert = Object::cast_to(*p_resource); + const CryptoKey *key = Object::cast_to(*p_resource); + if (cert) { + p_extensions->push_back("crt"); + } + if (key) { + if (!key->is_public_only()) { + p_extensions->push_back("key"); + } + p_extensions->push_back("pub"); + } +} + +bool ResourceFormatSaverCrypto::recognize(const Ref &p_resource) const { + return Object::cast_to(*p_resource) || Object::cast_to(*p_resource); +} diff --git a/engine/core/crypto/crypto.h b/engine/core/crypto/crypto.h index 53393219..48bf589a 100644 --- a/engine/core/crypto/crypto.h +++ b/engine/core/crypto/crypto.h @@ -32,6 +32,8 @@ #include "core/crypto/hashing_context.h" #include "core/io/resource.h" +#include "core/io/resource_loader.h" +#include "core/io/resource_saver.h" #include "core/object/ref_counted.h" class CryptoKey : public Resource { @@ -142,3 +144,26 @@ public: // @see: https://paragonie.com/blog/2015/11/preventing-timing-attacks-on-string-comparison-with-double-hmac-strategy bool constant_time_compare(const PackedByteArray &p_trusted, const PackedByteArray &p_received); }; + +class ResourceFormatLoaderCrypto : public ResourceFormatLoader { + GDSOFTCLASS(ResourceFormatLoaderCrypto, ResourceFormatLoader); + +public: + virtual Ref load(const String &p_path, const String &p_original_path = "", Error *r_error = nullptr, bool p_use_sub_threads = false, float *r_progress = nullptr, CacheMode p_cache_mode = CACHE_MODE_REUSE) override; + virtual void get_recognized_extensions(List *p_extensions) const override; + virtual bool handles_type(const String &p_type) const override; + virtual String get_resource_type(const String &p_path) const override; + + // Treat certificates as text files, do not generate a `*.{crt,key,pub}.uid` file. + virtual ResourceUID::ID get_resource_uid(const String &p_path) const override { return ResourceUID::INVALID_ID; } + virtual bool has_custom_uid_support() const override { return true; } +}; + +class ResourceFormatSaverCrypto : public ResourceFormatSaver { + GDSOFTCLASS(ResourceFormatSaverCrypto, ResourceFormatSaver); + +public: + virtual Error save(const Ref &p_resource, const String &p_path, uint32_t p_flags = 0) override; + virtual void get_recognized_extensions(const Ref &p_resource, List *p_extensions) const override; + virtual bool recognize(const Ref &p_resource) const override; +}; diff --git a/engine/core/crypto/crypto_core.cpp b/engine/core/crypto/crypto_core.cpp index 1c7d5d07..9d2c346e 100644 --- a/engine/core/crypto/crypto_core.cpp +++ b/engine/core/crypto/crypto_core.cpp @@ -31,7 +31,6 @@ #include "crypto_core.h" #include "core/os/os.h" -#include "core/string/ustring.h" #include #include diff --git a/engine/core/crypto/crypto_core.h b/engine/core/crypto/crypto_core.h index a061a743..8ef50fbc 100644 --- a/engine/core/crypto/crypto_core.h +++ b/engine/core/crypto/crypto_core.h @@ -30,12 +30,7 @@ #pragma once -#include "core/error/error_list.h" - -#include -#include - -class String; +#include "core/object/ref_counted.h" class CryptoCore { public: diff --git a/engine/core/crypto/crypto_resource_format.cpp b/engine/core/crypto/crypto_resource_format.cpp deleted file mode 100644 index 09fc2bed..00000000 --- a/engine/core/crypto/crypto_resource_format.cpp +++ /dev/null @@ -1,110 +0,0 @@ -/**************************************************************************/ -/* crypto_resource_format.cpp */ -/**************************************************************************/ -/* This file is part of: */ -/* GODOT ENGINE */ -/* https://godotengine.org */ -/**************************************************************************/ -/* Copyright (c) 2014-present Godot Engine contributors (see AUTHORS.md). */ -/* Copyright (c) 2007-2014 Juan Linietsky, Ariel Manzur. */ -/* */ -/* Permission is hereby granted, free of charge, to any person obtaining */ -/* a copy of this software and associated documentation files (the */ -/* "Software"), to deal in the Software without restriction, including */ -/* without limitation the rights to use, copy, modify, merge, publish, */ -/* distribute, sublicense, and/or sell copies of the Software, and to */ -/* permit persons to whom the Software is furnished to do so, subject to */ -/* the following conditions: */ -/* */ -/* The above copyright notice and this permission notice shall be */ -/* included in all copies or substantial portions of the Software. */ -/* */ -/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */ -/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */ -/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. */ -/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */ -/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */ -/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */ -/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ -/**************************************************************************/ - -#include "crypto_resource_format.h" - -#include "core/crypto/crypto.h" - -Ref ResourceFormatLoaderCrypto::load(const String &p_path, const String &p_original_path, Error *r_error, bool p_use_sub_threads, float *r_progress, CacheMode p_cache_mode) { - String el = p_path.get_extension().to_lower(); - if (el == "crt") { - X509Certificate *cert = X509Certificate::create(); - if (cert) { - cert->load(p_path); - } - return cert; - } else if (el == "key") { - CryptoKey *key = CryptoKey::create(); - if (key) { - key->load(p_path, false); - } - return key; - } else if (el == "pub") { - CryptoKey *key = CryptoKey::create(); - if (key) { - key->load(p_path, true); - } - return key; - } - return nullptr; -} - -void ResourceFormatLoaderCrypto::get_recognized_extensions(List *p_extensions) const { - p_extensions->push_back("crt"); - p_extensions->push_back("key"); - p_extensions->push_back("pub"); -} - -bool ResourceFormatLoaderCrypto::handles_type(const String &p_type) const { - return p_type == "X509Certificate" || p_type == "CryptoKey"; -} - -String ResourceFormatLoaderCrypto::get_resource_type(const String &p_path) const { - String el = p_path.get_extension().to_lower(); - if (el == "crt") { - return "X509Certificate"; - } else if (el == "key" || el == "pub") { - return "CryptoKey"; - } - return ""; -} - -Error ResourceFormatSaverCrypto::save(const Ref &p_resource, const String &p_path, uint32_t p_flags) { - Error err; - Ref cert = p_resource; - Ref key = p_resource; - if (cert.is_valid()) { - err = cert->save(p_path); - } else if (key.is_valid()) { - err = key->save(p_path, p_path.has_extension("pub")); - } else { - ERR_FAIL_V(ERR_INVALID_PARAMETER); - } - ERR_FAIL_COND_V_MSG(err != OK, err, vformat("Cannot save Crypto resource to file '%s'.", p_path)); - return OK; -} - -void ResourceFormatSaverCrypto::get_recognized_extensions(const Ref &p_resource, List *p_extensions) const { - const X509Certificate *cert = Object::cast_to(*p_resource); - const CryptoKey *key = Object::cast_to(*p_resource); - if (cert) { - p_extensions->push_back("crt"); - } - if (key) { - if (!key->is_public_only()) { - p_extensions->push_back("key"); - } - p_extensions->push_back("pub"); - } -} - -bool ResourceFormatSaverCrypto::recognize(const Ref &p_resource) const { - return Object::cast_to(*p_resource) || Object::cast_to(*p_resource); -} diff --git a/engine/core/crypto/crypto_resource_format.h b/engine/core/crypto/crypto_resource_format.h deleted file mode 100644 index 128e9751..00000000 --- a/engine/core/crypto/crypto_resource_format.h +++ /dev/null @@ -1,58 +0,0 @@ -/**************************************************************************/ -/* crypto_resource_format.h */ -/**************************************************************************/ -/* This file is part of: */ -/* GODOT ENGINE */ -/* https://godotengine.org */ -/**************************************************************************/ -/* Copyright (c) 2014-present Godot Engine contributors (see AUTHORS.md). */ -/* Copyright (c) 2007-2014 Juan Linietsky, Ariel Manzur. */ -/* */ -/* Permission is hereby granted, free of charge, to any person obtaining */ -/* a copy of this software and associated documentation files (the */ -/* "Software"), to deal in the Software without restriction, including */ -/* without limitation the rights to use, copy, modify, merge, publish, */ -/* distribute, sublicense, and/or sell copies of the Software, and to */ -/* permit persons to whom the Software is furnished to do so, subject to */ -/* the following conditions: */ -/* */ -/* The above copyright notice and this permission notice shall be */ -/* included in all copies or substantial portions of the Software. */ -/* */ -/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */ -/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */ -/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. */ -/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */ -/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */ -/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */ -/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ -/**************************************************************************/ - -#pragma once - -#include "core/io/resource_loader.h" -#include "core/io/resource_saver.h" -#include "core/io/resource_uid.h" - -class ResourceFormatLoaderCrypto : public ResourceFormatLoader { - GDSOFTCLASS(ResourceFormatLoaderCrypto, ResourceFormatLoader); - -public: - virtual Ref load(const String &p_path, const String &p_original_path = "", Error *r_error = nullptr, bool p_use_sub_threads = false, float *r_progress = nullptr, CacheMode p_cache_mode = CACHE_MODE_REUSE) override; - virtual void get_recognized_extensions(List *p_extensions) const override; - virtual bool handles_type(const String &p_type) const override; - virtual String get_resource_type(const String &p_path) const override; - - // Treat certificates as text files, do not generate a `*.{crt,key,pub}.uid` file. - virtual ResourceUID::ID get_resource_uid(const String &p_path) const override { return ResourceUID::INVALID_ID; } - virtual bool has_custom_uid_support() const override { return true; } -}; - -class ResourceFormatSaverCrypto : public ResourceFormatSaver { - GDSOFTCLASS(ResourceFormatSaverCrypto, ResourceFormatSaver); - -public: - virtual Error save(const Ref &p_resource, const String &p_path, uint32_t p_flags = 0) override; - virtual void get_recognized_extensions(const Ref &p_resource, List *p_extensions) const override; - virtual bool recognize(const Ref &p_resource) const override; -}; diff --git a/engine/core/crypto/hashing_context.cpp b/engine/core/crypto/hashing_context.cpp index d852b474..01acbdbc 100644 --- a/engine/core/crypto/hashing_context.cpp +++ b/engine/core/crypto/hashing_context.cpp @@ -31,7 +31,6 @@ #include "hashing_context.h" #include "core/crypto/crypto_core.h" -#include "core/object/class_db.h" Error HashingContext::start(HashType p_type) { ERR_FAIL_COND_V(ctx != nullptr, ERR_ALREADY_IN_USE); diff --git a/engine/core/crypto/hashing_context.h b/engine/core/crypto/hashing_context.h index a6318c99..c441da50 100644 --- a/engine/core/crypto/hashing_context.h +++ b/engine/core/crypto/hashing_context.h @@ -31,7 +31,6 @@ #pragma once #include "core/object/ref_counted.h" -#include "core/variant/type_info.h" class HashingContext : public RefCounted { GDCLASS(HashingContext, RefCounted); diff --git a/engine/core/debugger/debugger_marshalls.cpp b/engine/core/debugger/debugger_marshalls.cpp index d66f92b2..55b61f1c 100644 --- a/engine/core/debugger/debugger_marshalls.cpp +++ b/engine/core/debugger/debugger_marshalls.cpp @@ -81,20 +81,16 @@ Array DebuggerMarshalls::ScriptStackVariable::serialize(int max_size) { } else { arr.push_back(var); } - - arr.push_back(type_hint); - return arr; } bool DebuggerMarshalls::ScriptStackVariable::deserialize(const Array &p_arr) { - CHECK_SIZE(p_arr, 5, "ScriptStackVariable"); + CHECK_SIZE(p_arr, 4, "ScriptStackVariable"); name = p_arr[0]; type = p_arr[1]; var_type = p_arr[2]; value = p_arr[3]; - type_hint = p_arr[4]; - CHECK_END(p_arr, 5, "ScriptStackVariable"); + CHECK_END(p_arr, 4, "ScriptStackVariable"); return true; } @@ -181,27 +177,3 @@ Ref DebuggerMarshalls::deserialize_key_shortcut(const Array &p_keys) { shortcut->set_events(key_events); return shortcut; } - -String DebuggerMarshalls::parse_type_from_variant(const Variant &p_variant) { - String name; - - if (p_variant.get_type() == Variant::OBJECT) { - const Object *obj = p_variant.get_validated_object(); - if (obj) { - const ScriptInstance *script_instance = obj->get_script_instance(); - - if (script_instance) { - Ref diff --git a/engine/misc/dist/macos_tools.app/Contents/Info.plist b/engine/misc/dist/macos_tools.app/Contents/Info.plist index 0c7faac6..1627b1cb 100644 --- a/engine/misc/dist/macos_tools.app/Contents/Info.plist +++ b/engine/misc/dist/macos_tools.app/Contents/Info.plist @@ -19,11 +19,11 @@ CFBundlePackageType APPL CFBundleShortVersionString - 4.7 + 4.6.3 CFBundleSignature GODO CFBundleVersion - 4.7 + 4.6.3 NSMicrophoneUsageDescription Microphone access is required to capture audio. NSCameraUsageDescription diff --git a/engine/misc/dist/windows/godot.iss b/engine/misc/dist/windows/godot.iss index 3aad2bd7..1ca94645 100644 --- a/engine/misc/dist/windows/godot.iss +++ b/engine/misc/dist/windows/godot.iss @@ -1,5 +1,5 @@ #define MyAppName "Godot Engine" -#define MyAppVersion "4.7" +#define MyAppVersion "4.6.3" #define MyAppPublisher "Godot Engine contributors" #define MyAppURL "https://godotengine.org/" #define MyAppExeName "godot.exe" diff --git a/engine/misc/error_suppressions/tsan.txt b/engine/misc/error_suppressions/tsan.txt index 00cfb3f1..83be638b 100644 --- a/engine/misc/error_suppressions/tsan.txt +++ b/engine/misc/error_suppressions/tsan.txt @@ -3,7 +3,7 @@ deadlock:modules/text_server_adv/text_server_adv.cpp deadlock:modules/text_server_fb/text_server_fb.cpp -deadlock:tests/core/templates/test_command_queue.cpp +deadlock:tests/core/templates/test_command_queue.h race:modules/navigation_2d/nav_map_2d.cpp race:modules/navigation_3d/nav_map_3d.cpp race:thirdparty/thorvg/src/loaders/external_jpg/tvgJpgLoader.cpp diff --git a/engine/misc/extension_api_validation/4.1-stable_4.2-stable/GH-80954.txt b/engine/misc/extension_api_validation/4.1-stable_4.2-stable/GH-80954.txt index 3d807244..a18b428c 100644 --- a/engine/misc/extension_api_validation/4.1-stable_4.2-stable/GH-80954.txt +++ b/engine/misc/extension_api_validation/4.1-stable_4.2-stable/GH-80954.txt @@ -1,5 +1,5 @@ GH-80954 -------- -Validate extension JSON: Error: Field 'classes/Font/methods/find_variation/arguments': size changed value in new API, from 4 to 11. +Validate extension JSON: Error: Field 'classes/Font/methods/find_variation/arguments': size changed value in new API, from 4 to 9. Added optional arguments. Compatibility method registered. diff --git a/engine/misc/extension_api_validation/4.2-stable_4.3-stable/GH-87668.txt b/engine/misc/extension_api_validation/4.2-stable_4.3-stable/GH-87668.txt index aea01b14..282a83be 100644 --- a/engine/misc/extension_api_validation/4.2-stable_4.3-stable/GH-87668.txt +++ b/engine/misc/extension_api_validation/4.2-stable_4.3-stable/GH-87668.txt @@ -1,5 +1,5 @@ GH-87668 -------- -Validate extension JSON: Error: Field 'classes/Font/methods/find_variation/arguments': size changed value in new API, from 8 to 11. +Validate extension JSON: Error: Field 'classes/Font/methods/find_variation/arguments': size changed value in new API, from 8 to 9. Added optional "baseline_offset" argument. Compatibility method registered. diff --git a/engine/misc/extension_api_validation/4.5-stable_4.6-stable/GH-107167.txt b/engine/misc/extension_api_validation/4.5-stable/GH-107167.txt similarity index 100% rename from engine/misc/extension_api_validation/4.5-stable_4.6-stable/GH-107167.txt rename to engine/misc/extension_api_validation/4.5-stable/GH-107167.txt diff --git a/engine/misc/extension_api_validation/4.5-stable_4.6-stable/GH-107954.txt b/engine/misc/extension_api_validation/4.5-stable/GH-107954.txt similarity index 100% rename from engine/misc/extension_api_validation/4.5-stable_4.6-stable/GH-107954.txt rename to engine/misc/extension_api_validation/4.5-stable/GH-107954.txt diff --git a/engine/misc/extension_api_validation/4.5-stable_4.6-stable/GH-109302.txt b/engine/misc/extension_api_validation/4.5-stable/GH-109302.txt similarity index 100% rename from engine/misc/extension_api_validation/4.5-stable_4.6-stable/GH-109302.txt rename to engine/misc/extension_api_validation/4.5-stable/GH-109302.txt diff --git a/engine/misc/extension_api_validation/4.5-stable_4.6-stable/GH-110120.txt b/engine/misc/extension_api_validation/4.5-stable/GH-110120.txt similarity index 100% rename from engine/misc/extension_api_validation/4.5-stable_4.6-stable/GH-110120.txt rename to engine/misc/extension_api_validation/4.5-stable/GH-110120.txt diff --git a/engine/misc/extension_api_validation/4.5-stable_4.6-stable/GH-110250.txt b/engine/misc/extension_api_validation/4.5-stable/GH-110250.txt similarity index 100% rename from engine/misc/extension_api_validation/4.5-stable_4.6-stable/GH-110250.txt rename to engine/misc/extension_api_validation/4.5-stable/GH-110250.txt diff --git a/engine/misc/extension_api_validation/4.5-stable_4.6-stable/GH-110433.txt b/engine/misc/extension_api_validation/4.5-stable/GH-110433.txt similarity index 100% rename from engine/misc/extension_api_validation/4.5-stable_4.6-stable/GH-110433.txt rename to engine/misc/extension_api_validation/4.5-stable/GH-110433.txt diff --git a/engine/misc/extension_api_validation/4.5-stable_4.6-stable/GH-110767.txt b/engine/misc/extension_api_validation/4.5-stable/GH-110767.txt similarity index 100% rename from engine/misc/extension_api_validation/4.5-stable_4.6-stable/GH-110767.txt rename to engine/misc/extension_api_validation/4.5-stable/GH-110767.txt diff --git a/engine/misc/extension_api_validation/4.5-stable_4.6-stable/GH-110867.txt b/engine/misc/extension_api_validation/4.5-stable/GH-110867.txt similarity index 100% rename from engine/misc/extension_api_validation/4.5-stable_4.6-stable/GH-110867.txt rename to engine/misc/extension_api_validation/4.5-stable/GH-110867.txt diff --git a/engine/misc/extension_api_validation/4.5-stable_4.6-stable/GH-111117.txt b/engine/misc/extension_api_validation/4.5-stable/GH-111117.txt similarity index 100% rename from engine/misc/extension_api_validation/4.5-stable_4.6-stable/GH-111117.txt rename to engine/misc/extension_api_validation/4.5-stable/GH-111117.txt diff --git a/engine/misc/extension_api_validation/4.5-stable_4.6-stable/GH-111212.txt b/engine/misc/extension_api_validation/4.5-stable/GH-111212.txt similarity index 100% rename from engine/misc/extension_api_validation/4.5-stable_4.6-stable/GH-111212.txt rename to engine/misc/extension_api_validation/4.5-stable/GH-111212.txt diff --git a/engine/misc/extension_api_validation/4.5-stable_4.6-stable/GH-111439.txt b/engine/misc/extension_api_validation/4.5-stable/GH-111439.txt similarity index 100% rename from engine/misc/extension_api_validation/4.5-stable_4.6-stable/GH-111439.txt rename to engine/misc/extension_api_validation/4.5-stable/GH-111439.txt diff --git a/engine/misc/extension_api_validation/4.5-stable_4.6-stable/GH-112290.txt b/engine/misc/extension_api_validation/4.5-stable/GH-112290.txt similarity index 100% rename from engine/misc/extension_api_validation/4.5-stable_4.6-stable/GH-112290.txt rename to engine/misc/extension_api_validation/4.5-stable/GH-112290.txt diff --git a/engine/misc/extension_api_validation/4.5-stable_4.6-stable/GH-112379.txt b/engine/misc/extension_api_validation/4.5-stable/GH-112379.txt similarity index 100% rename from engine/misc/extension_api_validation/4.5-stable_4.6-stable/GH-112379.txt rename to engine/misc/extension_api_validation/4.5-stable/GH-112379.txt diff --git a/engine/misc/extension_api_validation/4.5-stable_4.6-stable/GH-112539.txt b/engine/misc/extension_api_validation/4.5-stable/GH-112539.txt similarity index 100% rename from engine/misc/extension_api_validation/4.5-stable_4.6-stable/GH-112539.txt rename to engine/misc/extension_api_validation/4.5-stable/GH-112539.txt diff --git a/engine/misc/extension_api_validation/4.5-stable_4.6-stable/GH-113172.txt b/engine/misc/extension_api_validation/4.5-stable/GH-113172.txt similarity index 100% rename from engine/misc/extension_api_validation/4.5-stable_4.6-stable/GH-113172.txt rename to engine/misc/extension_api_validation/4.5-stable/GH-113172.txt diff --git a/engine/misc/extension_api_validation/4.5-stable_4.6-stable/GH-113459.txt b/engine/misc/extension_api_validation/4.5-stable/GH-113459.txt similarity index 100% rename from engine/misc/extension_api_validation/4.5-stable_4.6-stable/GH-113459.txt rename to engine/misc/extension_api_validation/4.5-stable/GH-113459.txt diff --git a/engine/misc/extension_api_validation/4.5-stable_4.6-stable/GH-114053.txt b/engine/misc/extension_api_validation/4.5-stable/GH-114053.txt similarity index 100% rename from engine/misc/extension_api_validation/4.5-stable_4.6-stable/GH-114053.txt rename to engine/misc/extension_api_validation/4.5-stable/GH-114053.txt diff --git a/engine/misc/extension_api_validation/4.5-stable_4.6-stable/GH-90411.txt b/engine/misc/extension_api_validation/4.5-stable/GH-90411.txt similarity index 100% rename from engine/misc/extension_api_validation/4.5-stable_4.6-stable/GH-90411.txt rename to engine/misc/extension_api_validation/4.5-stable/GH-90411.txt diff --git a/engine/misc/extension_api_validation/4.6-stable/GH-104736.txt b/engine/misc/extension_api_validation/4.6-stable/GH-104736.txt deleted file mode 100644 index 655436d4..00000000 --- a/engine/misc/extension_api_validation/4.6-stable/GH-104736.txt +++ /dev/null @@ -1,6 +0,0 @@ -GH-104736 ---------- -Validate extension JSON: Error: Field 'classes/PhysicsServer2D/methods/body_set_shape_as_one_way_collision/arguments': size changed value in new API, from 4 to 5. -Validate extension JSON: Error: Field 'classes/PhysicsServer2DExtension/methods/_body_set_shape_as_one_way_collision/arguments': size changed value in new API, from 4 to 5. - -Argument added. Compatibility methods registered. diff --git a/engine/misc/extension_api_validation/4.6-stable/GH-109004.txt b/engine/misc/extension_api_validation/4.6-stable/GH-109004.txt deleted file mode 100644 index ef6853d0..00000000 --- a/engine/misc/extension_api_validation/4.6-stable/GH-109004.txt +++ /dev/null @@ -1,6 +0,0 @@ -GH-109004 ---------- -Validate extension JSON: API was removed: classes/ImageTexture/methods/get_format -Validate extension JSON: API was removed: classes/PortableCompressedTexture2D/methods/get_format - -The above are now members of the base class Texture2D. diff --git a/engine/misc/extension_api_validation/4.6-stable/GH-109142.txt b/engine/misc/extension_api_validation/4.6-stable/GH-109142.txt deleted file mode 100644 index 1bff8456..00000000 --- a/engine/misc/extension_api_validation/4.6-stable/GH-109142.txt +++ /dev/null @@ -1,10 +0,0 @@ -GH-109142 ---------- - -Validate extension JSON: Error: Field 'classes/CPUParticles3D/methods/request_particles_process/arguments': size changed value in new API, from 1 to 2. -Validate extension JSON: Error: Field 'classes/CPUParticles2D/methods/request_particles_process/arguments': size changed value in new API, from 1 to 2. -Validate extension JSON: Error: Field 'classes/GPUParticles2D/methods/request_particles_process/arguments': size changed value in new API, from 1 to 2. -Validate extension JSON: Error: Field 'classes/GPUParticles3D/methods/request_particles_process/arguments': size changed value in new API, from 1 to 2. -Validate extension JSON: Error: Field 'classes/RenderingServer/methods/particles_request_process_time/arguments': size changed value in new API, from 2 to 3. - -Optional argument added. Compatibility methods registered. diff --git a/engine/misc/extension_api_validation/4.6-stable/GH-109892.txt b/engine/misc/extension_api_validation/4.6-stable/GH-109892.txt deleted file mode 100644 index df16cc19..00000000 --- a/engine/misc/extension_api_validation/4.6-stable/GH-109892.txt +++ /dev/null @@ -1,6 +0,0 @@ -GH-109892 ---------- - -Validate extension JSON: Error: Field 'classes/Object/enums/ConnectFlags': is_bitfield changed value in new API, from false to true. - -The enum above is now corrected to be a bitfield. diff --git a/engine/misc/extension_api_validation/4.6-stable/GH-110369.txt b/engine/misc/extension_api_validation/4.6-stable/GH-110369.txt deleted file mode 100644 index 090b0d7e..00000000 --- a/engine/misc/extension_api_validation/4.6-stable/GH-110369.txt +++ /dev/null @@ -1,6 +0,0 @@ -GH-110369 --------------- -Validate extension JSON: Error: Field 'classes/AnimationNodeBlendSpace2D/methods/add_blend_point/arguments': size changed value in new API, from 3 to 4. -Validate extension JSON: Error: Field 'classes/AnimationNodeBlendSpace1D/methods/add_blend_point/arguments': size changed value in new API, from 3 to 4. - -Added "name" parameter, to functionally replace index reference for points. Compatibility methods registered. diff --git a/engine/misc/extension_api_validation/4.6-stable/GH-114355.txt b/engine/misc/extension_api_validation/4.6-stable/GH-114355.txt deleted file mode 100644 index 6ee0a84f..00000000 --- a/engine/misc/extension_api_validation/4.6-stable/GH-114355.txt +++ /dev/null @@ -1,8 +0,0 @@ -GH-114355 ---------- -Validate extension JSON: API was removed: classes/AudioEffectSpectrumAnalyzer/methods/set_tap_back_pos -Validate extension JSON: API was removed: classes/AudioEffectSpectrumAnalyzer/methods/get_tap_back_pos -Validate extension JSON: API was removed: classes/AudioEffectSpectrumAnalyzer/properties/tap_back_pos - -Removed this property because it caused buggy behavior for no discernible benefit. -Compatibility methods registered. diff --git a/engine/misc/extension_api_validation/4.6-stable/GH-115799.txt b/engine/misc/extension_api_validation/4.6-stable/GH-115799.txt deleted file mode 100644 index 124bfa4c..00000000 --- a/engine/misc/extension_api_validation/4.6-stable/GH-115799.txt +++ /dev/null @@ -1,9 +0,0 @@ -GH-115799 ---------- -Validate extension JSON: Error: Field 'classes/RenderingServer/methods/viewport_set_size/arguments': size changed value in new API, from 3 to 4. - -Optional argument added. Compatibility method registered. - -Validate extension JSON: Error: Field 'classes/Viewport/methods/is_using_xr': is_const changed value in new API, from false to true. - -Changed to const. Compatibility method registered. diff --git a/engine/misc/extension_api_validation/4.6-stable/GH-115946.txt b/engine/misc/extension_api_validation/4.6-stable/GH-115946.txt deleted file mode 100644 index 5285cc95..00000000 --- a/engine/misc/extension_api_validation/4.6-stable/GH-115946.txt +++ /dev/null @@ -1,5 +0,0 @@ -GH-115946 ---------- -Validate extension JSON: Error: Field 'classes/ZIPPacker/methods/start_file/arguments': size changed value in new API, from 1 to 3. - -Optional argument added. Compatibility method registered. diff --git a/engine/misc/extension_api_validation/4.6-stable/GH-116394.txt b/engine/misc/extension_api_validation/4.6-stable/GH-116394.txt deleted file mode 100644 index 1e36d5c2..00000000 --- a/engine/misc/extension_api_validation/4.6-stable/GH-116394.txt +++ /dev/null @@ -1,6 +0,0 @@ -GH-116394 ---------- -Validate extension JSON: Error: Field 'classes/Animation/methods/get_length/return_value': meta changed value in new API, from "float" to "double". -Validate extension JSON: Error: Field 'classes/Animation/methods/set_length/arguments/0': meta changed value in new API, from "float" to "double". - -Return type and parameter changed from real_t to double to match internals. No compatibility methods registered because GDExtension FFI already uses double. diff --git a/engine/misc/extension_api_validation/4.6-stable/GH-116839.txt b/engine/misc/extension_api_validation/4.6-stable/GH-116839.txt deleted file mode 100644 index 8457d18b..00000000 --- a/engine/misc/extension_api_validation/4.6-stable/GH-116839.txt +++ /dev/null @@ -1,6 +0,0 @@ -GH-116839 ---------- -Validate extension JSON: Error: Field 'classes/Control/methods/get_accessibility_live/return_value': type changed value in new API, from "enum::DisplayServer.AccessibilityLiveMode" to "enum::AccessibilityServer.AccessibilityLiveMode". -Validate extension JSON: Error: Field 'classes/Control/methods/set_accessibility_live/arguments/0': type changed value in new API, from "enum::DisplayServer.AccessibilityLiveMode" to "enum::AccessibilityServer.AccessibilityLiveMode". - -Enum moved to AccessibilityServer. Compatibility methods registered. diff --git a/engine/misc/extension_api_validation/4.6-stable/GH-117149.txt b/engine/misc/extension_api_validation/4.6-stable/GH-117149.txt deleted file mode 100644 index 54b67b0a..00000000 --- a/engine/misc/extension_api_validation/4.6-stable/GH-117149.txt +++ /dev/null @@ -1,5 +0,0 @@ -GH-117149 ---------- -Validate extension JSON: Error: Field 'classes/Font/methods/find_variation/arguments': size changed value in new API, from 9 to 11. - -Optional "palette_index" and "custom_colors" arguments added. Compatibility method registered. diff --git a/engine/misc/extension_api_validation/4.6-stable/GH-117800.txt b/engine/misc/extension_api_validation/4.6-stable/GH-117800.txt deleted file mode 100644 index 3b92354e..00000000 --- a/engine/misc/extension_api_validation/4.6-stable/GH-117800.txt +++ /dev/null @@ -1,7 +0,0 @@ -GH-117800 --------------- - -Validate extension JSON: Error: Field 'classes/Image/methods/save_exr/arguments': size changed value in new API, from 2 to 4. -Validate extension JSON: Error: Field 'classes/Image/methods/save_exr_to_buffer/arguments': size changed value in new API, from 1 to 3. - -Added color_image and max_linear_value parameters to Image.save_exr functions for saving HDR screenshots. Use default values for existing behavior. diff --git a/engine/misc/extension_api_validation/4.6-stable/GH-117968.txt b/engine/misc/extension_api_validation/4.6-stable/GH-117968.txt deleted file mode 100644 index df65c21e..00000000 --- a/engine/misc/extension_api_validation/4.6-stable/GH-117968.txt +++ /dev/null @@ -1,5 +0,0 @@ -GH-117968 ---------- -Validate extension JSON: Error: Field 'classes/EditorVCSInterface/methods/_commit/arguments': size changed value in new API, from 1 to 2. - -Added "amend" parameter. Compatibility method registered. diff --git a/engine/misc/extension_api_validation/4.6-stable/GH-XXXXXX.txt b/engine/misc/extension_api_validation/4.6-stable/GH-XXXXXX.txt deleted file mode 100644 index 179085d9..00000000 --- a/engine/misc/extension_api_validation/4.6-stable/GH-XXXXXX.txt +++ /dev/null @@ -1,11 +0,0 @@ -# This file should contain expected output of --validate-extension-api when run against the extension_api.json of the 4.6-stable tag. -# Only lines that start with "Validate extension JSON:" matter, everything else is considered a comment and ignored. -# They should instead be used to justify these changes and describe how users should work around these changes. - -GH-{PR_NUMBER} --------------- - -Validate extension .... -Validate extension .... - -Description of changes. diff --git a/engine/misc/scripts/char_range_fetch.py b/engine/misc/scripts/char_range_fetch.py index 336d31b6..0f135b2b 100755 --- a/engine/misc/scripts/char_range_fetch.py +++ b/engine/misc/scripts/char_range_fetch.py @@ -1,7 +1,7 @@ #!/usr/bin/env python3 # Script used to dump char ranges for specific properties from -# the Unicode Character Database to the `char_range.cpp` file. +# the Unicode Character Database to the `char_range.inc` file. # NOTE: This script is deliberately not integrated into the build system; # you should run it manually whenever you want to update the data. from __future__ import annotations @@ -16,7 +16,7 @@ if __name__ == "__main__": from methods import generate_copyright_header -URL: Final[str] = "https://www.unicode.org/Public/17.0.0/ucd/DerivedCoreProperties.txt" +URL: Final[str] = "https://www.unicode.org/Public/16.0.0/ucd/DerivedCoreProperties.txt" xid_start: list[tuple[int, int]] = [] @@ -89,8 +89,7 @@ def parse_unicode_data() -> None: def make_array(array_name: str, range_list: list[tuple[int, int]]) -> str: - result: str = f"\n\nconst int {array_name}_size = {len(range_list)};\n" - result += f"const CharRange {array_name}[{array_name}_size] = {{\n" + result: str = f"\n\nconstexpr inline CharRange {array_name}[] = {{\n" for start, end in range_list: result += f"\t{{ 0x{start:x}, 0x{end:x} }},\n" @@ -103,16 +102,22 @@ def make_array(array_name: str, range_list: list[tuple[int, int]]) -> str: def generate_char_range_inc() -> None: parse_unicode_data() - source: str = generate_copyright_header("char_range.cpp") + source: str = generate_copyright_header("char_range.inc") source += f""" // This file was generated using the `misc/scripts/char_range_fetch.py` script. -#include "core/string/char_utils.h" +#pragma once + +#include "core/typedefs.h" // Unicode Derived Core Properties -// Source: {URL}\ -""" +// Source: {URL} + +struct CharRange {{ +\tchar32_t start; +\tchar32_t end; +}};""" source += make_array("xid_start", xid_start) source += make_array("xid_continue", xid_continue) @@ -122,11 +127,11 @@ def generate_char_range_inc() -> None: source += "\n" - char_range_path: str = os.path.join(os.path.dirname(__file__), "../../core/string/char_range.cpp") + char_range_path: str = os.path.join(os.path.dirname(__file__), "../../core/string/char_range.inc") with open(char_range_path, "w", newline="\n") as f: f.write(source) - print("`char_range.cpp` generated successfully.") + print("`char_range.inc` generated successfully.") if __name__ == "__main__": diff --git a/engine/misc/scripts/check_ci_log.py b/engine/misc/scripts/check_ci_log.py index 171783e7..fb8f4a58 100755 --- a/engine/misc/scripts/check_ci_log.py +++ b/engine/misc/scripts/check_ci_log.py @@ -1,6 +1,5 @@ #!/usr/bin/env python3 -import os import sys if len(sys.argv) < 2: @@ -46,10 +45,7 @@ if file_contents.find("ERROR: LeakSanitizer:") != -1: # this possibility should also be handled as a potential error, even if # LeakSanitizer doesn't report anything -if ( - file_contents.find("ObjectDB instance was leaked at exit") != -1 - or file_contents.find("ObjectDB instances were leaked at exit") != -1 -): +if file_contents.find("ObjectDB instances leaked at exit") != -1: print("ERROR: Memory leak was found") sys.exit(54) @@ -61,12 +57,6 @@ if file_contents.find("Assertion failed") != -1: print("ERROR: Assertion failed in project, check execution log for more info") sys.exit(55) -if os.environ.get("GODOT_CHECK_CI_LOG_ALL_ERRORS"): - # If any occurrence of "ERROR:" is found in the log, we consider it a failure. - if file_contents.find("ERROR:") != -1: - print("ERROR: 'ERROR:' found in log and GODOT_CHECK_CI_LOG_ALL_ERRORS is set.") - sys.exit(56) - # For now Godot leaks a lot of rendering stuff so for now we just show info # about it and this needs to be re-enabled after fixing this memory leaks. diff --git a/engine/misc/scripts/install_accesskit.py b/engine/misc/scripts/install_accesskit.py deleted file mode 100755 index 2d2789b7..00000000 --- a/engine/misc/scripts/install_accesskit.py +++ /dev/null @@ -1,49 +0,0 @@ -#!/usr/bin/env python3 - -if __name__ != "__main__": - raise SystemExit(f'Utility script "{__file__}" should not be used as a module!') - -import os -import shutil -import sys -import urllib.request - -sys.path.insert(0, os.path.join(os.path.dirname(os.path.abspath(__file__)), "../../")) - - -# Base Godot dependencies path -# If cross-compiling (no LOCALAPPDATA), we install in `bin` -deps_folder = os.getenv("LOCALAPPDATA") -if deps_folder: - deps_folder = os.path.join(deps_folder, "Godot", "build_deps") -else: - deps_folder = os.path.join("bin", "build_deps") - -# AccessKit -ac_version = "0.21.2" - -# Create dependencies folder -if not os.path.exists(deps_folder): - os.makedirs(deps_folder) - -ac_filename = "accesskit-c-" + ac_version + ".zip" -ac_archive = os.path.join(deps_folder, "accesskit.zip") -ac_folder = os.path.join(deps_folder, "accesskit") - -if os.path.isfile(ac_archive): - os.remove(ac_archive) - -print(f"Downloading AccessKit {ac_filename} ...") -urllib.request.urlretrieve( - f"https://github.com/godotengine/godot-accesskit-c-static/releases/download/{ac_version}/{ac_filename}", - ac_archive, -) -if os.path.exists(ac_folder): - print(f"Removing existing local AccessKit installation in {ac_folder} ...") - shutil.rmtree(ac_folder) -print(f"Extracting AccessKit {ac_filename} to {ac_folder} ...") -shutil.unpack_archive(ac_archive, deps_folder) -os.remove(ac_archive) -os.rename(os.path.join(deps_folder, "accesskit-c-" + ac_version), ac_folder) - -print("AccessKit installed successfully.\n") diff --git a/engine/misc/scripts/install_angle.py b/engine/misc/scripts/install_angle.py deleted file mode 100755 index abfafcec..00000000 --- a/engine/misc/scripts/install_angle.py +++ /dev/null @@ -1,73 +0,0 @@ -#!/usr/bin/env python3 - -import os -import platform -import shutil -import sys -import urllib.request - -sys.path.insert(0, os.path.join(os.path.dirname(os.path.abspath(__file__)), "../../")) - -from misc.utility.color import Ansi, color_print - -# Base Godot dependencies path -# If cross-compiling (no LOCALAPPDATA), we install in `bin` -deps_folder = os.getenv("LOCALAPPDATA") -if deps_folder: - deps_folder = os.path.join(deps_folder, "Godot", "build_deps") -else: - deps_folder = os.path.join("bin", "build_deps") - -# ANGLE -# Check for latest version: https://github.com/godotengine/godot-angle-static/releases/latest -angle_version = "chromium/7219" -angle_folder = os.path.join(deps_folder, "angle") - -# Create dependencies folder -if not os.path.exists(deps_folder): - os.makedirs(deps_folder) - -# Mesa NIR -print(f"Downloading ANGLE {angle_version} ...") -archs = [ - "arm64-llvm", - "x86_32-gcc", - "x86_32-llvm", - "x86_64-gcc", - "x86_64-llvm", -] -if platform.system() == "Windows": - # Only download MSVC libraries if we can build using it. - archs.append("arm64-msvc") - archs.append("x86_32-msvc") - archs.append("x86_64-msvc") -elif platform.system() == "Darwin": - # Only download macOS/iOS libraries if we can build for these platforms. - archs.append("arm64-ios") - archs.append("arm64-ios-sim") - archs.append("arm64-macos") - archs.append("x86_64-macos") - -for arch in archs: - angle_filename = f"godot-angle-static-{arch}-release.zip" - angle_archive = os.path.join(deps_folder, angle_filename) - angle_folder = os.path.join(deps_folder, f"angle-{arch}") - - if os.path.isfile(angle_archive): - os.remove(angle_archive) - print(f"Downloading ANGLE {angle_filename} ...") - urllib.request.urlretrieve( - f"https://github.com/godotengine/godot-angle-static/releases/download/{angle_version}/{angle_filename}", - angle_archive, - ) - if os.path.exists(angle_folder): - print(f"Removing existing local ANGLE installation in {angle_folder} ...") - shutil.rmtree(angle_folder) - print(f"Extracting ANGLE {angle_filename} to {angle_folder} ...") - shutil.unpack_archive(angle_archive, angle_folder) - os.remove(angle_archive) -print("ANGLE installed successfully.\n") - -# Complete message -color_print(f'{Ansi.GREEN}All ANGLE components were installed to "{deps_folder}" successfully!') -color_print(f'{Ansi.GREEN}You can now build Godot with statically linked ANGLE by running "scons angle=yes".') diff --git a/engine/misc/scripts/install_winrt.py b/engine/misc/scripts/install_winrt.py deleted file mode 100755 index ce69929c..00000000 --- a/engine/misc/scripts/install_winrt.py +++ /dev/null @@ -1,48 +0,0 @@ -#!/usr/bin/env python3 - -if __name__ != "__main__": - raise SystemExit(f'Utility script "{__file__}" should not be used as a module!') - -import os -import shutil -import sys -import urllib.request - -sys.path.insert(0, os.path.join(os.path.dirname(os.path.abspath(__file__)), "../../")) - - -# Base Godot dependencies path -# If cross-compiling (no LOCALAPPDATA), we install in `bin` -deps_folder = os.getenv("LOCALAPPDATA") -if deps_folder: - deps_folder = os.path.join(deps_folder, "Godot", "build_deps") -else: - deps_folder = os.path.join("bin", "build_deps") - -# WinRT -winrt_version = "72" - -# Create dependencies folder -if not os.path.exists(deps_folder): - os.makedirs(deps_folder) - -winrt_filename = "winrt-headers.zip" -winrt_archive = os.path.join(deps_folder, winrt_filename) -winrt_folder = os.path.join(deps_folder, "winrt_mingw") - -if os.path.isfile(winrt_archive): - os.remove(winrt_archive) - -print(f"Downloading WinRT {winrt_filename} ...") -urllib.request.urlretrieve( - f"https://github.com/bruvzg/winrt_mingw/releases/download/{winrt_version}/{winrt_filename}", - winrt_archive, -) -if os.path.exists(winrt_folder): - print(f"Removing existing local WinRT installation in {winrt_folder} ...") - shutil.rmtree(winrt_folder) -print(f"Extracting WinRT {winrt_filename} to {winrt_folder} ...") -shutil.unpack_archive(winrt_archive, winrt_folder) -os.remove(winrt_archive) - -print("WinRT installed successfully.\n") diff --git a/engine/misc/scripts/ucaps_fetch.py b/engine/misc/scripts/ucaps_fetch.py index d173dfa1..84d33abd 100755 --- a/engine/misc/scripts/ucaps_fetch.py +++ b/engine/misc/scripts/ucaps_fetch.py @@ -16,7 +16,7 @@ if __name__ == "__main__": from methods import generate_copyright_header -URL: Final[str] = "https://www.unicode.org/Public/17.0.0/ucd/UnicodeData.txt" +URL: Final[str] = "https://www.unicode.org/Public/16.0.0/ucd/UnicodeData.txt" lower_to_upper: list[tuple[str, str]] = [] diff --git a/engine/misc/scripts/unicode_ranges_fetch.py b/engine/misc/scripts/unicode_ranges_fetch.py index e84ca754..40c7b874 100755 --- a/engine/misc/scripts/unicode_ranges_fetch.py +++ b/engine/misc/scripts/unicode_ranges_fetch.py @@ -1,7 +1,7 @@ #!/usr/bin/env python3 # Script used to dump char ranges from -# the Unicode Character Database to the `unicode_ranges.inc` file. +# the Unicode Character Database to the `char_range.inc` file. # NOTE: This script is deliberately not integrated into the build system; # you should run it manually whenever you want to update the data. from __future__ import annotations @@ -16,7 +16,7 @@ if __name__ == "__main__": from methods import generate_copyright_header -URL: Final[str] = "https://www.unicode.org/Public/17.0.0/ucd/Blocks.txt" +URL: Final[str] = "https://www.unicode.org/Public/16.0.0/ucd/Blocks.txt" ranges: list[tuple[str, str, str]] = [] diff --git a/engine/misc/scripts/validate_codeowners.py b/engine/misc/scripts/validate_codeowners.py deleted file mode 100755 index 8b74e177..00000000 --- a/engine/misc/scripts/validate_codeowners.py +++ /dev/null @@ -1,148 +0,0 @@ -#!/usr/bin/env python3 - -if __name__ != "__main__": - raise SystemExit(f'Utility script "{__file__}" should not be used as a module!') - -import argparse -import re -import subprocess -import sys - -sys.path.insert(0, "./") - -try: - from methods import print_error, print_info -except ImportError: - raise SystemExit(f"Utility script {__file__} must be run from repository root!") - - -def glob_to_regex(glob: str) -> re.Pattern[str]: - """Convert a CODEOWNERS glob to a RegEx pattern.""" - - # Heavily inspired by: https://github.com/hmarr/codeowners/blob/main/match.go - - # Handle specific edgecases first. - if "***" in glob: - raise SyntaxError("Pattern cannot contain three consecutive asterisks") - if glob == "/": - raise SyntaxError('Standalone "/" will not match anything') - if not glob: - raise ValueError("Empty pattern") - - segments = glob.split("/") - if not segments[0]: - # Leading slash; relative to root. - segments = segments[1:] - else: - # Check for single-segment pattern, which matches relative to any descendent path. - # This is equivalent to a leading `**/`. - if len(segments) == 1 or (len(segments) == 2 and not segments[1]): - if segments[0] != "**": - segments.insert(0, "**") - - if len(segments) > 1 and not segments[-1]: - # A trailing slash is equivalent to `/**`. - segments[-1] = "**" - - last_index = len(segments) - 1 - need_slash = False - pattern = r"\A" - - for index, segment in enumerate(segments): - if segment == "**": - if index == 0 and index == last_index: - pattern += r".+" # Pattern is just `**`; match everything. - elif index == 0: - pattern += r"(?:.+/)?" # Pattern starts with `**`; match any leading path segment. - need_slash = False - elif index == last_index: - pattern += r"/.*" # Pattern ends with `**`; match any trailing path segment. - else: - pattern += r"(?:/.+)?" # Pattern contains `**`; match zero or more path segments. - need_slash = True - - elif segment == "*": - if need_slash: - pattern += "/" - # Regular wildcard; match any non-separator characters. - pattern += r"[^/]+" - need_slash = True - - else: - if need_slash: - pattern += "/" - - escape = False - for char in segment: - if escape: - escape = False - pattern += re.escape(char) - continue - elif char == "\\": - escape = True - elif char == "*": - # Multi-character wildcard. - pattern += r"[^/]*" - elif char == "?": - # Single-character wildcard. - pattern += r"[^/]" - else: - # Regular character - pattern += re.escape(char) - - if index == last_index: - pattern += r"(?:/.*)?" # No trailing slash; match descendent paths. - need_slash = True - - pattern += r"\Z" - return re.compile(pattern) - - -RE_CODEOWNERS = re.compile(r"^(?P[^#](?:\\ |[^\s])+) +(?P(?:[^#][^\s]+ ?)+)") - - -def parse_codeowners() -> list[tuple[re.Pattern[str], list[str]]]: - codeowners = [] - with open(".github/CODEOWNERS", encoding="utf-8", newline="\n") as file: - for line in reversed(file.readlines()): # Lower items have higher precedence. - if match := RE_CODEOWNERS.match(line): - codeowners.append((glob_to_regex(match["code"]), match["owners"].split())) - return codeowners - - -def main() -> int: - parser = argparse.ArgumentParser(description="Utility script for validating CODEOWNERS assignment.") - parser.add_argument("files", nargs="*", help="A list of files to validate. If excluded, checks all owned files.") - parser.add_argument("-u", "--unowned", action="store_true", help="Only output files without an owner.") - args = parser.parse_args() - - files: list[str] = args.files - if not files: - files = subprocess.run(["git", "ls-files"], text=True, capture_output=True).stdout.splitlines() - - ret = 0 - codeowners = parse_codeowners() - - for file in files: - matched = False - for code, owners in codeowners: - if code.match(file): - matched = True - if not args.unowned: - print_info(f"{file}: {owners}") - break - if not matched: - print_error(f"{file}: ") - ret += 1 - - return ret - - -try: - raise SystemExit(main()) -except KeyboardInterrupt: - import os - import signal - - signal.signal(signal.SIGINT, signal.SIG_DFL) - os.kill(os.getpid(), signal.SIGINT) diff --git a/engine/misc/scripts/validate_extension_api.sh b/engine/misc/scripts/validate_extension_api.sh index b17f1edc..ffcbd053 100755 --- a/engine/misc/scripts/validate_extension_api.sh +++ b/engine/misc/scripts/validate_extension_api.sh @@ -69,7 +69,7 @@ while read -r dir; do get_expected_output "$dir" # Download the reference extension_api.json - wget -nv --retry-on-http-error=503 --tries=5 --timeout=60 -cO "$reference_file" "https://raw.githubusercontent.com/godotengine/godot-headers/godot-$reference_tag/extension_api.json" || has_problems=1 + wget -nv --retry-on-http-error=503 --tries=5 --timeout=60 -cO "$reference_file" "https://raw.githubusercontent.com/godotengine/godot-cpp/godot-$reference_tag/gdextension/extension_api.json" || has_problems=1 # Validate the current API against the reference "$1" --headless --validate-extension-api "$reference_file" 2>&1 | tee "$validate" | awk '!/^Validate extension JSON:/' - || true # Collect the expected and actual validation errors diff --git a/engine/misc/scripts/validate_includes.py b/engine/misc/scripts/validate_includes.py deleted file mode 100755 index dcedd330..00000000 --- a/engine/misc/scripts/validate_includes.py +++ /dev/null @@ -1,111 +0,0 @@ -#!/usr/bin/env python3 - -if __name__ != "__main__": - raise ImportError(f'Utility script "{__file__}" should not be used as a module!') - -import os -from pathlib import Path - -if Path(os.getcwd()).as_posix() != (ROOT := Path(__file__).parent.parent.parent).as_posix(): - raise RuntimeError(f'Utility script "{__file__}" must be run from the repository root!') - -import argparse -import re -from dataclasses import dataclass - -BASE_FOLDER = Path(__file__).resolve().parent.parent.parent -RE_INCLUDES = re.compile( - r"^#(?Pinclude|import) " # Both `include` and `import` keywords valid. - r'(?P[<"])' # Handle both styles of char wrappers. Does NOT handle macro expansion. - r'(?P.+?)[>"]', # Resolve path of include itself. Can safely assume the sequence matches. - re.RegexFlag.MULTILINE, -) - - -@dataclass -class IncludeData: - path: str - is_angle: bool - is_import: bool - - @staticmethod - def from_match(match: re.Match[str]): - items = match.groupdict() - return IncludeData( - items["path"], - items["sequence"] == "<", - items["keyword"] == "import", - ) - - def copy(self): - return IncludeData(self.path, self.is_angle, self.is_import) - - def __str__(self): - return "#{keyword} {rbracket}{path}{lbracket}".format( - keyword="import" if self.is_import else "include", - rbracket="<" if self.is_angle else '"', - path=self.path, - lbracket=">" if self.is_angle else '"', - ) - - -def validate_includes(path: Path) -> int: - ret = 0 - content = path.read_text(encoding="utf-8") - - for data in map(IncludeData.from_match, RE_INCLUDES.finditer(content)): - original_data = data.copy() - - if "\\" in data.path: - data.path = data.path.replace("\\", "/") - - if data.path.startswith("thirdparty/"): - data.is_angle = True - - if (relative_path := path.parent / data.path).exists(): - # Relative includes are only permitted under certain circumstances. - - if relative_path.name.split(".")[0] == path.name.split(".")[0]: - # Identical leading names permitted - pass - - elif ("modules" in relative_path.parts and "modules" in path.parts) or ( - "platform" in relative_path.parts and "platform" in path.parts - ): - # Modules and platforms can use relative includes if constrained to the module/platform itself. - pass - - else: - data.path = relative_path.resolve().relative_to(BASE_FOLDER).as_posix() - - if original_data != data: - content = content.replace(f"{original_data}", f"{data}") - ret += 1 - - if ret: - with open(path, "w", encoding="utf-8", newline="\n") as file: - file.write(content) - - return ret - - -def main() -> int: - parser = argparse.ArgumentParser(description="Validate C/C++ includes, correcting if necessary") - parser.add_argument("files", nargs="+", help="A list of files to validate") - args = parser.parse_args() - - ret = 0 - - for file in map(Path, args.files): - ret += validate_includes(file) - - return ret - - -try: - raise SystemExit(main()) -except KeyboardInterrupt: - import signal - - signal.signal(signal.SIGINT, signal.SIG_DFL) - os.kill(os.getpid(), signal.SIGINT) diff --git a/engine/modules/SCsub b/engine/modules/SCsub index 69dfadfa..e987dde0 100644 --- a/engine/modules/SCsub +++ b/engine/modules/SCsub @@ -52,6 +52,7 @@ for name, path in env.module_list.items(): # Generate header to be included in `tests/test_main.cpp` to run module-specific tests. if env["tests"]: + env.Append(CPPDEFINES=["TESTS_ENABLED"]) env.CommandNoCache("modules_tests.gen.h", test_headers, env.Run(modules_builders.modules_tests_builder)) # libmodules.a with only register_module_types. diff --git a/engine/modules/bcdec/image_decompress_bcdec.cpp b/engine/modules/bcdec/image_decompress_bcdec.cpp index dfc805d9..272db0e2 100644 --- a/engine/modules/bcdec/image_decompress_bcdec.cpp +++ b/engine/modules/bcdec/image_decompress_bcdec.cpp @@ -34,7 +34,7 @@ #include "core/string/print_string.h" #define BCDEC_IMPLEMENTATION -#include +#include "thirdparty/misc/bcdec.h" inline void bcdec_bc6h_half_s(const void *compressedBlock, void *decompressedBlock, int destinationPitch) { bcdec_bc6h_half(compressedBlock, decompressedBlock, destinationPitch, true); diff --git a/engine/modules/betsy/image_compress_betsy.cpp b/engine/modules/betsy/image_compress_betsy.cpp index 7a620c4e..e689d7dd 100644 --- a/engine/modules/betsy/image_compress_betsy.cpp +++ b/engine/modules/betsy/image_compress_betsy.cpp @@ -30,28 +30,16 @@ #include "image_compress_betsy.h" +#include "core/config/project_settings.h" + +#include "betsy_bc1.h" + #include "alpha_stitch.glsl.gen.h" #include "bc1.glsl.gen.h" #include "bc4.glsl.gen.h" #include "bc6h.glsl.gen.h" -#include "betsy_bc1.h" #include "rgb_to_rgba.glsl.gen.h" - -#include "core/config/project_settings.h" -#include "core/object/callable_mp.h" -#include "core/os/os.h" #include "servers/display/display_server.h" -#include "servers/rendering/rendering_context_driver.h" -#include "servers/rendering/rendering_device.h" -#include "servers/rendering/rendering_device_binds.h" -#include "servers/rendering/rendering_server.h" - -#if defined(VULKAN_ENABLED) -#include "drivers/vulkan/rendering_context_driver_vulkan.h" -#endif -#if defined(METAL_ENABLED) -#include "drivers/metal/rendering_context_driver_metal.h" -#endif static Mutex betsy_mutex; static BetsyCompressor *betsy = nullptr; diff --git a/engine/modules/betsy/image_compress_betsy.h b/engine/modules/betsy/image_compress_betsy.h index 1eae8086..15b58894 100644 --- a/engine/modules/betsy/image_compress_betsy.h +++ b/engine/modules/betsy/image_compress_betsy.h @@ -32,11 +32,18 @@ #include "core/io/image.h" #include "core/object/worker_thread_pool.h" +#include "core/os/thread.h" #include "core/templates/command_queue_mt.h" -class RDShaderFile; -class RenderingDevice; -class RenderingContextDriver; +#include "servers/rendering/rendering_device_binds.h" +#include "servers/rendering/rendering_server_default.h" + +#if defined(VULKAN_ENABLED) +#include "drivers/vulkan/rendering_context_driver_vulkan.h" +#endif +#if defined(METAL_ENABLED) +#include "drivers/metal/rendering_context_driver_metal.h" +#endif enum BetsyFormat { BETSY_FORMAT_BC1, diff --git a/engine/modules/camera/SCsub b/engine/modules/camera/SCsub index 22555f29..750dc7c3 100644 --- a/engine/modules/camera/SCsub +++ b/engine/modules/camera/SCsub @@ -6,25 +6,19 @@ Import("env_modules") env_camera = env_modules.Clone() -if env["platform"] in ["windows", "macos", "linuxbsd", "android", "ios", "visionos"]: +if env["platform"] in ["windows", "macos", "linuxbsd", "android"]: env_camera.add_source_files(env.modules_sources, "register_types.cpp") if env["platform"] == "windows": env_camera.add_source_files(env.modules_sources, "camera_win.cpp") elif env["platform"] == "macos": - env_camera.add_source_files(env.modules_sources, "camera_apple.mm") + env_camera.add_source_files(env.modules_sources, "camera_macos.mm") elif env["platform"] == "android": env_camera.add_source_files(env.modules_sources, "camera_android.cpp") env.Append(LIBS=["camera2ndk", "mediandk"]) -elif env["platform"] in ["ios", "visionos"]: - ext_module_source = ["camera_apple.mm"] - ext_camera_lib = env_camera.add_library("#bin/libgodot_camera", ext_module_source) - env.Append(LIBS_EXTERNAL=[ext_camera_lib]) - env.Append(MODULES_EXTERNAL=["_camera"]) - elif env["platform"] == "linuxbsd": env_camera.add_source_files(env.modules_sources, "camera_linux.cpp") env_camera.add_source_files(env.modules_sources, "camera_feed_linux.cpp") diff --git a/engine/modules/camera/camera_android.cpp b/engine/modules/camera/camera_android.cpp index f1ef9941..5fbeda0e 100644 --- a/engine/modules/camera/camera_android.cpp +++ b/engine/modules/camera/camera_android.cpp @@ -31,7 +31,6 @@ #include "camera_android.h" #include "core/os/os.h" - #include "platform/android/display_server_android.h" #include "platform/android/java_godot_io_wrapper.h" #include "platform/android/os_android.h" @@ -73,7 +72,7 @@ public: #ifndef IF_EQUAL_RETURN #define MAKE_FORMAT_CONST(suffix) AIMAGE_FORMAT_##suffix -#define IF_EQUAL_RETURN(param, val) \ +#define IF_EQUAL_RETURN(param, val) \ if (MAKE_FORMAT_CONST(val) == param) \ return #val #endif @@ -90,7 +89,8 @@ String GetFormatName(const int32_t &format) { // CameraFeedAndroid - Subclass for our camera feed on Android CameraFeedAndroid::CameraFeedAndroid(ACameraManager *manager, ACameraMetadata *metadata, const char *id, - CameraFeed::FeedPosition position, int32_t orientation) { + CameraFeed::FeedPosition position, int32_t orientation) : + CameraFeed() { this->manager = manager; this->metadata = metadata; this->orientation = orientation; diff --git a/engine/modules/camera/camera_android.h b/engine/modules/camera/camera_android.h index ebd392a6..7cdc1248 100644 --- a/engine/modules/camera/camera_android.h +++ b/engine/modules/camera/camera_android.h @@ -40,7 +40,6 @@ #include #include #include - #include enum class CameraFacing { diff --git a/engine/modules/camera/camera_feed_linux.cpp b/engine/modules/camera/camera_feed_linux.cpp index 70490a01..8c3f717f 100644 --- a/engine/modules/camera/camera_feed_linux.cpp +++ b/engine/modules/camera/camera_feed_linux.cpp @@ -350,7 +350,8 @@ bool CameraFeedLinux::set_format(int p_index, const Dictionary &p_parameters) { return true; } -CameraFeedLinux::CameraFeedLinux(const String &p_device_name) { +CameraFeedLinux::CameraFeedLinux(const String &p_device_name) : + CameraFeed() { device_name = p_device_name; _query_device(device_name); } diff --git a/engine/modules/camera/camera_linux.h b/engine/modules/camera/camera_linux.h index f1920b72..ca1eeb0a 100644 --- a/engine/modules/camera/camera_linux.h +++ b/engine/modules/camera/camera_linux.h @@ -32,7 +32,6 @@ #include "core/os/mutex.h" #include "core/os/thread.h" -#include "core/templates/safe_refcount.h" #include "servers/camera/camera_server.h" class CameraLinux : public CameraServer { diff --git a/engine/modules/camera/camera_apple.h b/engine/modules/camera/camera_macos.h similarity index 93% rename from engine/modules/camera/camera_apple.h rename to engine/modules/camera/camera_macos.h index 82b5e7de..9713b66d 100644 --- a/engine/modules/camera/camera_apple.h +++ b/engine/modules/camera/camera_macos.h @@ -1,5 +1,5 @@ /**************************************************************************/ -/* camera_apple.h */ +/* camera_macos.h */ /**************************************************************************/ /* This file is part of: */ /* GODOT ENGINE */ @@ -35,11 +35,11 @@ #include "servers/camera/camera_server.h" -class CameraApple : public CameraServer { - GDSOFTCLASS(CameraApple, CameraServer); +class CameraMacOS : public CameraServer { + GDSOFTCLASS(CameraMacOS, CameraServer); public: - CameraApple() = default; + CameraMacOS() = default; void update_feeds(); void set_monitoring_feeds(bool p_monitoring_feeds) override; diff --git a/engine/modules/camera/camera_apple.mm b/engine/modules/camera/camera_macos.mm similarity index 77% rename from engine/modules/camera/camera_apple.mm rename to engine/modules/camera/camera_macos.mm index 5943bbd6..7e3b78e2 100644 --- a/engine/modules/camera/camera_apple.mm +++ b/engine/modules/camera/camera_macos.mm @@ -1,5 +1,5 @@ /**************************************************************************/ -/* camera_apple.mm */ +/* camera_macos.mm */ /**************************************************************************/ /* This file is part of: */ /* GODOT ENGINE */ @@ -31,14 +31,11 @@ ///@TODO this is a near duplicate of CameraIOS, we should find a way to combine those to minimize code duplication!!!! // If you fix something here, make sure you fix it there as well! -#import "camera_apple.h" +#import "camera_macos.h" #include "servers/camera/camera_feed.h" #import -#ifdef IOS_ENABLED -#import -#endif ////////////////////////////////////////////////////////////////////////// // MyCaptureSession - This is a little helper class so we can capture our frames @@ -66,30 +63,23 @@ width[1] = 0; height[1] = 0; -#ifdef IOS_ENABLED - if ([p_device lockForConfiguration:&error]) { - if ([p_device isFocusModeSupported:AVCaptureFocusModeContinuousAutoFocus]) { - [p_device setFocusMode:AVCaptureFocusModeContinuousAutoFocus]; - } - if ([p_device isExposureModeSupported:AVCaptureExposureModeContinuousAutoExposure]) { - [p_device setExposureMode:AVCaptureExposureModeContinuousAutoExposure]; - } - if ([p_device isWhiteBalanceModeSupported:AVCaptureWhiteBalanceModeContinuousAutoWhiteBalance]) { - [p_device setWhiteBalanceMode:AVCaptureWhiteBalanceModeContinuousAutoWhiteBalance]; - } +#ifdef APPLE_EMBEDDED_ENABLED + [p_device lockForConfiguration:&error]; - [p_device unlockForConfiguration]; - } -#endif // IOS_ENABLED + [p_device setFocusMode:AVCaptureFocusModeLocked]; + [p_device setExposureMode:AVCaptureExposureModeLocked]; + [p_device setWhiteBalanceMode:AVCaptureWhiteBalanceModeLocked]; + + [p_device unlockForConfiguration]; +#endif // APPLE_EMBEDDED_ENABLED [self beginConfiguration]; -#ifdef IOS_ENABLED +#ifdef APPLE_EMBEDDED_ENABLED self.sessionPreset = AVCaptureSessionPreset1280x720; -#endif // IOS_ENABLED - - input = [[AVCaptureDeviceInput alloc] initWithDevice:p_device error:&error]; +#endif // APPLE_EMBEDDED_ENABLED + input = [AVCaptureDeviceInput deviceInputWithDevice:p_device error:&error]; if (!input) { print_line("Couldn't get input device for camera"); [self commitConfiguration]; @@ -229,28 +219,6 @@ // set our texture... feed->set_ycbcr_images(img[0], img[1]); -#ifdef IOS_ENABLED - UIInterfaceOrientation orientation = [UIApplication sharedApplication].delegate.window.windowScene.interfaceOrientation; - - Transform2D display_transform; - switch (orientation) { - case UIInterfaceOrientationPortrait: { - display_transform = Transform2D(0.0, -1.0, -1.0, 0.0, 1.0, 1.0); - } break; - case UIInterfaceOrientationLandscapeRight: { - display_transform = Transform2D(1.0, 0.0, 0.0, -1.0, 0.0, 1.0); - } break; - case UIInterfaceOrientationLandscapeLeft: { - display_transform = Transform2D(-1.0, 0.0, 0.0, 1.0, 1.0, 0.0); - } break; - default: { - display_transform = Transform2D(0.0, 1.0, 1.0, 0.0, 0.0, 0.0); - } break; - } - - feed->set_transform(display_transform); -#endif // IOS_ENABLED - // and unlock CVPixelBufferUnlockBaseAddress(pixelBuffer, kCVPixelBufferLock_ReadOnly); } @@ -258,10 +226,10 @@ @end ////////////////////////////////////////////////////////////////////////// -// CameraFeedApple - Subclass for camera feeds in macOS +// CameraFeedMacOS - Subclass for camera feeds in macOS -class CameraFeedApple : public CameraFeed { - GDSOFTCLASS(CameraFeedApple, CameraFeed); +class CameraFeedMacOS : public CameraFeed { + GDSOFTCLASS(CameraFeedMacOS, CameraFeed); private: AVCaptureDevice *device; @@ -270,8 +238,8 @@ private: public: AVCaptureDevice *get_device() const; - CameraFeedApple(); - ~CameraFeedApple(); + CameraFeedMacOS(); + ~CameraFeedMacOS(); void set_device(AVCaptureDevice *p_device); @@ -279,23 +247,22 @@ public: void deactivate_feed() override; }; -AVCaptureDevice *CameraFeedApple::get_device() const { +AVCaptureDevice *CameraFeedMacOS::get_device() const { return device; } -CameraFeedApple::CameraFeedApple() { +CameraFeedMacOS::CameraFeedMacOS() { device = nullptr; capture_session = nullptr; - transform = Transform2D(1.0, 0.0, 0.0, 1.0, 0.0, 0.0); /* should re-orientate this based on device orientation */ } -CameraFeedApple::~CameraFeedApple() { +CameraFeedMacOS::~CameraFeedMacOS() { if (is_active()) { deactivate_feed(); } } -void CameraFeedApple::set_device(AVCaptureDevice *p_device) { +void CameraFeedMacOS::set_device(AVCaptureDevice *p_device) { device = p_device; // get some info @@ -309,14 +276,14 @@ void CameraFeedApple::set_device(AVCaptureDevice *p_device) { }; } -bool CameraFeedApple::activate_feed() { +bool CameraFeedMacOS::activate_feed() { if (capture_session) { // Already recording. return true; } // Start camera capture, check permission. - if (@available(macOS 10.14, iOS 14.0, visionOS 1.0, *)) { + if (@available(macOS 10.14, *)) { AVAuthorizationStatus status = [AVCaptureDevice authorizationStatusForMediaType:AVMediaTypeVideo]; if (status == AVAuthorizationStatusAuthorized) { capture_session = [[MyCaptureSession alloc] initForFeed:this andDevice:device]; @@ -344,7 +311,7 @@ bool CameraFeedApple::activate_feed() { } } -void CameraFeedApple::deactivate_feed() { +void CameraFeedMacOS::deactivate_feed() { // end camera capture if we have one if (capture_session) { [capture_session cleanup]; @@ -357,7 +324,7 @@ void CameraFeedApple::deactivate_feed() { // when devices are connected/disconnected @interface MyDeviceNotifications : NSObject { - CameraApple *camera_server; + CameraMacOS *camera_server; } @end @@ -368,7 +335,7 @@ void CameraFeedApple::deactivate_feed() { camera_server->update_feeds(); } -- (id)initForServer:(CameraApple *)p_server { +- (id)initForServer:(CameraMacOS *)p_server { if (self = [super init]) { camera_server = p_server; @@ -389,31 +356,13 @@ void CameraFeedApple::deactivate_feed() { MyDeviceNotifications *device_notifications = nil; ////////////////////////////////////////////////////////////////////////// -// CameraApple - Subclass for our camera server on macOS +// CameraMacOS - Subclass for our camera server on macOS -void CameraApple::update_feeds() { +void CameraMacOS::update_feeds() { NSArray *devices = nullptr; -#ifdef APPLE_EMBEDDED_ENABLED - { - NSMutableArray *deviceTypes = [NSMutableArray array]; - if (@available(iOS 14.0, visionOS 2.1, *)) { - [deviceTypes addObject:AVCaptureDeviceTypeBuiltInWideAngleCamera]; - } -#ifdef IOS_ENABLED - [deviceTypes addObject:AVCaptureDeviceTypeBuiltInTelephotoCamera]; - [deviceTypes addObject:AVCaptureDeviceTypeBuiltInDualCamera]; - [deviceTypes addObject:AVCaptureDeviceTypeBuiltInTrueDepthCamera]; - [deviceTypes addObject:AVCaptureDeviceTypeBuiltInUltraWideCamera]; - [deviceTypes addObject:AVCaptureDeviceTypeBuiltInDualWideCamera]; - [deviceTypes addObject:AVCaptureDeviceTypeBuiltInTripleCamera]; -#endif // IOS_ENABLED - AVCaptureDeviceDiscoverySession *session = [AVCaptureDeviceDiscoverySession discoverySessionWithDeviceTypes:deviceTypes mediaType:AVMediaTypeVideo position:AVCaptureDevicePositionUnspecified]; - devices = session.devices; - } -#else // APPLE_EMBEDDED_ENABLED #if defined(__x86_64__) if (@available(macOS 10.15, *)) { -#endif // __x86_64__ +#endif AVCaptureDeviceDiscoverySession *session; if (@available(macOS 14.0, *)) { session = [AVCaptureDeviceDiscoverySession discoverySessionWithDeviceTypes:[NSArray arrayWithObjects:AVCaptureDeviceTypeExternal, AVCaptureDeviceTypeBuiltInWideAngleCamera, AVCaptureDeviceTypeContinuityCamera, nil] mediaType:AVMediaTypeVideo position:AVCaptureDevicePositionUnspecified]; @@ -425,12 +374,11 @@ void CameraApple::update_feeds() { } else { devices = [AVCaptureDevice devicesWithMediaType:AVMediaTypeVideo]; } -#endif // __x86_64__ -#endif // APPLE_EMBEDDED_ENABLED +#endif // Deactivate feeds that are gone before removing them. for (int i = feeds.size() - 1; i >= 0; i--) { - Ref feed = (Ref)feeds[i]; + Ref feed = (Ref)feeds[i]; if (feed.is_null()) { continue; } @@ -446,7 +394,7 @@ void CameraApple::update_feeds() { for (AVCaptureDevice *device in devices) { bool found = false; for (int i = 0; i < feeds.size() && !found; i++) { - Ref feed = (Ref)feeds[i]; + Ref feed = (Ref)feeds[i]; if (feed.is_null()) { continue; } @@ -456,7 +404,7 @@ void CameraApple::update_feeds() { }; if (!found) { - Ref newfeed; + Ref newfeed; newfeed.instantiate(); newfeed->set_device(device); @@ -466,7 +414,7 @@ void CameraApple::update_feeds() { emit_signal(SNAME(CameraServer::feeds_updated_signal_name)); } -void CameraApple::set_monitoring_feeds(bool p_monitoring_feeds) { +void CameraMacOS::set_monitoring_feeds(bool p_monitoring_feeds) { if (p_monitoring_feeds == monitoring_feeds) { return; } @@ -483,14 +431,3 @@ void CameraApple::set_monitoring_feeds(bool p_monitoring_feeds) { device_notifications = nil; } } - -#ifdef APPLE_EMBEDDED_ENABLED - -void register_camera_external_module() { - CameraServer::make_default(); -} - -void unregister_camera_external_module() { -} - -#endif // APPLE_EMBEDDED_ENABLED diff --git a/engine/modules/camera/camera_win.cpp b/engine/modules/camera/camera_win.cpp index 5cff8702..7871595d 100644 --- a/engine/modules/camera/camera_win.cpp +++ b/engine/modules/camera/camera_win.cpp @@ -30,8 +30,6 @@ #include "camera_win.h" -#include "servers/camera/camera_feed.h" - ///@TODO sorry guys, I got about 80% through implementing this using DirectShow only // to find out Microsoft deprecated half the API and its replacement is as confusing // as they could make it. Joey suggested looking into libuvc which offers a more direct diff --git a/engine/modules/camera/camera_win.h b/engine/modules/camera/camera_win.h index 9d98766a..60b4858a 100644 --- a/engine/modules/camera/camera_win.h +++ b/engine/modules/camera/camera_win.h @@ -30,6 +30,7 @@ #pragma once +#include "servers/camera/camera_feed.h" #include "servers/camera/camera_server.h" class CameraWindows : public CameraServer { diff --git a/engine/modules/camera/config.py b/engine/modules/camera/config.py index 7bcf7655..d699d4e4 100644 --- a/engine/modules/camera/config.py +++ b/engine/modules/camera/config.py @@ -3,14 +3,7 @@ def can_build(env, platform): if sys.platform.startswith("freebsd") or sys.platform.startswith("openbsd"): return False - return ( - platform == "macos" - or platform == "windows" - or platform == "linuxbsd" - or platform == "android" - or platform == "ios" - or platform == "visionos" - ) + return platform == "macos" or platform == "windows" or platform == "linuxbsd" or platform == "android" def configure(env): diff --git a/engine/modules/camera/register_types.cpp b/engine/modules/camera/register_types.cpp index 5f4969de..c56ddfe8 100644 --- a/engine/modules/camera/register_types.cpp +++ b/engine/modules/camera/register_types.cpp @@ -37,7 +37,7 @@ #include "camera_win.h" #endif #if defined(MACOS_ENABLED) -#include "camera_apple.h" +#include "camera_macos.h" #endif #if defined(ANDROID_ENABLED) #include "camera_android.h" @@ -55,7 +55,7 @@ void initialize_camera_module(ModuleInitializationLevel p_level) { CameraServer::make_default(); #endif #if defined(MACOS_ENABLED) - CameraServer::make_default(); + CameraServer::make_default(); #endif #if defined(ANDROID_ENABLED) CameraServer::make_default(); diff --git a/engine/modules/csg/csg_shape.cpp b/engine/modules/csg/csg_shape.cpp index 914937ab..13226a83 100644 --- a/engine/modules/csg/csg_shape.cpp +++ b/engine/modules/csg/csg_shape.cpp @@ -30,27 +30,18 @@ #include "csg_shape.h" -#include "core/config/engine.h" -#include "core/math/geometry_2d.h" -#include "core/object/callable_mp.h" -#include "core/object/class_db.h" -#include "scene/main/scene_tree.h" -#include "scene/resources/3d/navigation_mesh_source_geometry_data_3d.h" -#include "scene/resources/navigation_mesh.h" -#include "servers/rendering/rendering_server.h" - #ifdef DEV_ENABLED #include "core/io/json.h" #endif // DEV_ENABLED - +#include "core/math/geometry_2d.h" +#include "scene/resources/3d/navigation_mesh_source_geometry_data_3d.h" +#include "scene/resources/navigation_mesh.h" #ifndef NAVIGATION_3D_DISABLED #include "servers/navigation_3d/navigation_server_3d.h" #endif // NAVIGATION_3D_DISABLED #include -#include // FLT_EPSILON - #ifndef NAVIGATION_3D_DISABLED Callable CSGShape3D::_navmesh_source_geometry_parsing_callback; RID CSGShape3D::_navmesh_source_geometry_parser; @@ -204,26 +195,6 @@ void CSGShape3D::set_collision_priority(real_t p_priority) { real_t CSGShape3D::get_collision_priority() const { return collision_priority; } - -void CSGShape3D::set_autosmooth(bool p_smooth) { - autosmooth = p_smooth; - _make_dirty(); - notify_property_list_changed(); -} - -bool CSGShape3D::is_autosmooth() const { - return autosmooth; -} - -void CSGShape3D::set_smoothing_angle(const float p_angle) { - smoothing_angle = p_angle; - _make_dirty(); -} - -float CSGShape3D::get_smoothing_angle() const { - return smoothing_angle; -} - #endif // PHYSICS_3D_DISABLED bool CSGShape3D::is_root_shape() const { @@ -605,14 +576,10 @@ void CSGShape3D::update_shape() { CSGBrush *n = _get_brush(); ERR_FAIL_NULL_MSG(n, "Cannot get CSGBrush."); + AHashMap vec_map; + Vector face_count; face_count.resize(n->materials.size() + 1); - - Vector smooth_faces; - LocalVector smooth_vertex; - smooth_faces.resize(n->faces.size()); - smooth_vertex.resize(n->faces.size() * 3); - for (int i = 0; i < face_count.size(); i++) { face_count.write[i] = 0; } @@ -622,72 +589,23 @@ void CSGShape3D::update_shape() { ERR_CONTINUE(mat < -1 || mat >= face_count.size()); int idx = mat == -1 ? face_count.size() - 1 : mat; - Plane p(n->faces[i].vertices[0], n->faces[i].vertices[1], n->faces[i].vertices[2]); + if (n->faces[i].smooth) { + Plane p(n->faces[i].vertices[0], n->faces[i].vertices[1], n->faces[i].vertices[2]); + + for (int j = 0; j < 3; j++) { + Vector3 v = n->faces[i].vertices[j]; + Vector3 *vec = vec_map.getptr(v); + if (vec) { + *vec += p.normal; + } else { + vec_map.insert(v, p.normal); + } + } + } - smooth_faces.write[i] = p.normal; - // Not sure if resize populates the LocalVector. - smooth_vertex[i * 3 + 0] = Vector3(p.normal); - smooth_vertex[i * 3 + 1] = Vector3(p.normal); - smooth_vertex[i * 3 + 2] = Vector3(p.normal); - // We could use a AHashMap Vector3, int to store the number of connections of each vertex position and end the loop earlier. But I'm not sure if the performance gains outweigh the cost. face_count.write[idx]++; } - if (autosmooth) { - // We could add a `use_groups` property later to only apply autosmooth on smooth faces or respect smoothing groups in some way. - if (smoothing_angle > 0.1) { - float smooth_angle_rad = Math::cos(Math::deg_to_rad(smoothing_angle)); - for (int i = 0; i < smooth_faces.size(); i++) { - for (int k = 0; k < 3; k++) { - int curr_vert = i * 3 + k; - Vector3 vert_a = n->faces[i].vertices[k]; - for (int j = i + 1; j < smooth_faces.size(); j++) { - // Compare the angles of faces instead of vertices. - if (smooth_faces[i].dot(smooth_faces[j]) > smooth_angle_rad) { - for (int h = 0; h < 3; h++) { - Vector3 vert_b = n->faces[j].vertices[h]; - if (vert_a == vert_b) { - int curr_j = j * 3 + h; - smooth_vertex[curr_vert] += smooth_faces[j]; - smooth_vertex[curr_j] += smooth_faces[i]; - break; - } - } - } - } - smooth_vertex[curr_vert].normalize(); - } - } - } - } else { - for (int i = 0; i < smooth_faces.size(); i++) { - bool face_is_smooth = n->faces[i].smooth; - if (face_is_smooth) { - for (int k = 0; k < 3; k++) { - Vector3 vert_a = n->faces[i].vertices[k]; - int curr_vert = i * 3 + k; - // Skip the other vertices of the face as they will never occupy the same position. - for (int j = i + 1; j < smooth_faces.size(); j++) { - // Preparing for when and if we replace Vector of bool for Vector of int smoothing groups. for now, face_is_smooth is always true. - if (face_is_smooth == n->faces[j].smooth) { - for (int h = 0; h < 3; h++) { - Vector3 vert_b = n->faces[j].vertices[h]; - if (vert_a == vert_b) { - int curr_j = j * 3 + h; - smooth_vertex[curr_vert] += smooth_faces[j]; - smooth_vertex[curr_j] += smooth_faces[i]; - // Skip the other 2 vertices as only one vertex of each face can connect with one vertex of other face. - break; - } - } - } - } - smooth_vertex[curr_vert].normalize(); - } - } - } - } - Vector surfaces; surfaces.resize(face_count.size()); @@ -729,12 +647,19 @@ void CSGShape3D::update_shape() { int last = surfaces[idx].last_added; - int face_pos_i = i * 3; + Plane p(n->faces[i].vertices[0], n->faces[i].vertices[1], n->faces[i].vertices[2]); for (int j = 0; j < 3; j++) { Vector3 v = n->faces[i].vertices[j]; - Vector3 normal = smooth_vertex[face_pos_i + j]; + Vector3 normal = p.normal; + + if (n->faces[i].smooth) { + Vector3 *ptr = vec_map.getptr(v); + if (ptr) { + normal = ptr->normalized(); + } + } if (n->faces[i].invert) { normal = -normal; @@ -803,8 +728,6 @@ void CSGShape3D::update_shape() { set_base(root_mesh->get_rid()); - update_gizmos(); - #ifndef PHYSICS_3D_DISABLED _update_collision_faces(); #endif // PHYSICS_3D_DISABLED @@ -1030,19 +953,6 @@ void CSGShape3D::_validate_property(PropertyInfo &p_property) const { if (!Engine::get_singleton()->is_editor_hint()) { return; } - - if (p_property.name == "smoothing_angle") { - if (!autosmooth || (is_inside_tree() && !is_root_shape())) { - p_property.usage = PROPERTY_USAGE_NO_EDITOR; - } - } - - if (p_property.name == "autosmooth") { - if (is_inside_tree() && !is_root_shape()) { - p_property.usage = PROPERTY_USAGE_NO_EDITOR; - } - } - bool is_collision_prefixed = p_property.name.begins_with("collision_"); if ((is_collision_prefixed || p_property.name.begins_with("use_collision")) && is_inside_tree() && !is_root_shape()) { //hide collision if not root @@ -1127,15 +1037,6 @@ void CSGShape3D::_bind_methods() { ClassDB::bind_method(D_METHOD("bake_static_mesh"), &CSGShape3D::bake_static_mesh); - ClassDB::bind_method(D_METHOD("set_autosmooth", "autosmooth"), &CSGShape3D::set_autosmooth); - ClassDB::bind_method(D_METHOD("is_autosmooth"), &CSGShape3D::is_autosmooth); - - ClassDB::bind_method(D_METHOD("set_smoothing_angle", "smoothing_angle"), &CSGShape3D::set_smoothing_angle); - ClassDB::bind_method(D_METHOD("get_smoothing_angle"), &CSGShape3D::get_smoothing_angle); - - ADD_PROPERTY(PropertyInfo(Variant::BOOL, "autosmooth"), "set_autosmooth", "is_autosmooth"); - ADD_PROPERTY(PropertyInfo(Variant::FLOAT, "smoothing_angle", PROPERTY_HINT_RANGE, "0,180,0.1,degrees"), "set_smoothing_angle", "get_smoothing_angle"); - ADD_PROPERTY(PropertyInfo(Variant::INT, "operation", PROPERTY_HINT_ENUM, "Union,Intersection,Subtraction"), "set_operation", "get_operation"); #ifndef DISABLE_DEPRECATED ADD_PROPERTY(PropertyInfo(Variant::FLOAT, "snap", PROPERTY_HINT_RANGE, "0.000001,1,0.000001,suffix:m", PROPERTY_USAGE_NONE), "set_snap", "get_snap"); diff --git a/engine/modules/csg/csg_shape.h b/engine/modules/csg/csg_shape.h index 247c58f0..da3ee688 100644 --- a/engine/modules/csg/csg_shape.h +++ b/engine/modules/csg/csg_shape.h @@ -39,9 +39,8 @@ #include "scene/resources/3d/concave_polygon_shape_3d.h" #endif // PHYSICS_3D_DISABLED -#include +#include "thirdparty/misc/mikktspace.h" -class Mesh; class NavigationMesh; class NavigationMeshSourceGeometryData3D; @@ -68,9 +67,6 @@ private: bool last_visible = false; float snap = 0.001; - bool autosmooth = false; - float smoothing_angle = 50.0; - #ifndef PHYSICS_3D_DISABLED bool use_collision = false; uint32_t collision_layer = 1; @@ -162,12 +158,6 @@ public: void set_collision_priority(real_t p_priority); real_t get_collision_priority() const; - void set_autosmooth(bool p_smooth); - bool is_autosmooth() const; - - void set_smoothing_angle(const float p_angle); - float get_smoothing_angle() const; - #ifndef DISABLE_DEPRECATED void set_snap(float p_snap); float get_snap() const; diff --git a/engine/modules/csg/doc_classes/CSGBox3D.xml b/engine/modules/csg/doc_classes/CSGBox3D.xml index b152177d..f56cb355 100644 --- a/engine/modules/csg/doc_classes/CSGBox3D.xml +++ b/engine/modules/csg/doc_classes/CSGBox3D.xml @@ -1,5 +1,5 @@ - + A CSG Box shape. diff --git a/engine/modules/csg/doc_classes/CSGCombiner3D.xml b/engine/modules/csg/doc_classes/CSGCombiner3D.xml index 58896587..d785b2f8 100644 --- a/engine/modules/csg/doc_classes/CSGCombiner3D.xml +++ b/engine/modules/csg/doc_classes/CSGCombiner3D.xml @@ -1,5 +1,5 @@ - + A CSG node that allows you to combine other CSG modifiers. diff --git a/engine/modules/csg/doc_classes/CSGCylinder3D.xml b/engine/modules/csg/doc_classes/CSGCylinder3D.xml index 848df1bf..f722b569 100644 --- a/engine/modules/csg/doc_classes/CSGCylinder3D.xml +++ b/engine/modules/csg/doc_classes/CSGCylinder3D.xml @@ -1,5 +1,5 @@ - + A CSG Cylinder shape. diff --git a/engine/modules/csg/doc_classes/CSGMesh3D.xml b/engine/modules/csg/doc_classes/CSGMesh3D.xml index 1dae96b7..3dad3ef7 100644 --- a/engine/modules/csg/doc_classes/CSGMesh3D.xml +++ b/engine/modules/csg/doc_classes/CSGMesh3D.xml @@ -1,5 +1,5 @@ - + A CSG Mesh shape that uses a mesh resource. diff --git a/engine/modules/csg/doc_classes/CSGPolygon3D.xml b/engine/modules/csg/doc_classes/CSGPolygon3D.xml index e2ba329a..2f26f13a 100644 --- a/engine/modules/csg/doc_classes/CSGPolygon3D.xml +++ b/engine/modules/csg/doc_classes/CSGPolygon3D.xml @@ -1,5 +1,5 @@ - + Extrudes a 2D polygon shape to create a 3D mesh. diff --git a/engine/modules/csg/doc_classes/CSGPrimitive3D.xml b/engine/modules/csg/doc_classes/CSGPrimitive3D.xml index 5602cbfb..6afbf4a3 100644 --- a/engine/modules/csg/doc_classes/CSGPrimitive3D.xml +++ b/engine/modules/csg/doc_classes/CSGPrimitive3D.xml @@ -1,5 +1,5 @@ - + Base class for CSG primitives. diff --git a/engine/modules/csg/doc_classes/CSGShape3D.xml b/engine/modules/csg/doc_classes/CSGShape3D.xml index 49ab3c7e..848c7b72 100644 --- a/engine/modules/csg/doc_classes/CSGShape3D.xml +++ b/engine/modules/csg/doc_classes/CSGShape3D.xml @@ -1,5 +1,5 @@ - + The CSG base class. @@ -74,10 +74,6 @@ - - Enables automatic smoothing. This overrides any smoothing on the CSG node and instead uses [member smoothing_angle] to calculate normals based on the angle between faces. - Children of a [CSGCombiner3D] node will be treated as a single mesh. - Calculate tangents for the CSG shape which allows the use of normal and height maps. This is only applied on the root shape, this setting is ignored on any child. Setting this to [code]false[/code] can speed up shape generation slightly. @@ -95,10 +91,6 @@ The operation that is performed on this shape. This is ignored for the first CSG child node as the operation is between this node and the previous child of this nodes parent. - - When autosmooth is enabled, faces with an angle between them greater than this will be smoothed, while faces with a smaller angle will remain sharp. - Note: An angle lower than 0.1 will cause all smoothing to be disabled, this can be used to increase performance. - This property does nothing. diff --git a/engine/modules/csg/doc_classes/CSGSphere3D.xml b/engine/modules/csg/doc_classes/CSGSphere3D.xml index 644e0223..a1197944 100644 --- a/engine/modules/csg/doc_classes/CSGSphere3D.xml +++ b/engine/modules/csg/doc_classes/CSGSphere3D.xml @@ -1,5 +1,5 @@ - + A CSG Sphere shape. diff --git a/engine/modules/csg/doc_classes/CSGTorus3D.xml b/engine/modules/csg/doc_classes/CSGTorus3D.xml index 73280568..9bef522b 100644 --- a/engine/modules/csg/doc_classes/CSGTorus3D.xml +++ b/engine/modules/csg/doc_classes/CSGTorus3D.xml @@ -1,5 +1,5 @@ - + A CSG Torus shape. diff --git a/engine/modules/csg/editor/csg_gizmos.cpp b/engine/modules/csg/editor/csg_gizmos.cpp index 945e4513..d26e0ad0 100644 --- a/engine/modules/csg/editor/csg_gizmos.cpp +++ b/engine/modules/csg/editor/csg_gizmos.cpp @@ -30,8 +30,6 @@ #include "csg_gizmos.h" -#include "core/math/geometry_3d.h" -#include "core/object/callable_mp.h" #include "editor/editor_node.h" #include "editor/editor_undo_redo_manager.h" #include "editor/scene/3d/gizmos/gizmo_3d_helper.h" @@ -42,7 +40,6 @@ #include "scene/3d/physics/collision_shape_3d.h" #include "scene/gui/dialogs.h" #include "scene/gui/menu_button.h" -#include "scene/main/scene_tree.h" void CSGShapeEditor::_node_removed(Node *p_node) { if (p_node == node) { @@ -419,14 +416,17 @@ void CSGShape3DGizmoPlugin::redraw(EditorNode3DGizmo *p_gizmo) { Ref handles_material = get_material("handles"); p_gizmo->add_lines(lines, material); + p_gizmo->add_collision_segments(lines); - Ref collision_mesh; - collision_mesh.instantiate(); - Array collision_array; - collision_array.resize(Mesh::ARRAY_MAX); - collision_array[Mesh::ARRAY_VERTEX] = faces; - collision_mesh->add_surface_from_arrays(Mesh::PRIMITIVE_TRIANGLES, collision_array); - p_gizmo->add_collision_triangles(collision_mesh->generate_triangle_mesh()); + if (cs->is_root_shape()) { + Array csg_meshes = cs->get_meshes(); + if (csg_meshes.size() == 2) { + Ref csg_mesh = csg_meshes[1]; + if (csg_mesh.is_valid()) { + p_gizmo->add_collision_triangles(csg_mesh->generate_triangle_mesh()); + } + } + } if (p_gizmo->is_selected()) { // Draw a translucent representation of the CSG node diff --git a/engine/modules/csg/register_types.cpp b/engine/modules/csg/register_types.cpp index 57347ef9..b157e329 100644 --- a/engine/modules/csg/register_types.cpp +++ b/engine/modules/csg/register_types.cpp @@ -32,8 +32,6 @@ #include "csg_shape.h" -#include "core/object/class_db.h" - #ifdef TOOLS_ENABLED #include "editor/csg_gizmos.h" #endif diff --git a/engine/modules/csg/tests/test_csg.h b/engine/modules/csg/tests/test_csg.h index 4476947e..73860051 100644 --- a/engine/modules/csg/tests/test_csg.h +++ b/engine/modules/csg/tests/test_csg.h @@ -30,10 +30,9 @@ #pragma once +#include "../csg.h" #include "../csg_shape.h" -#include "scene/main/scene_tree.h" -#include "scene/main/window.h" #include "tests/test_macros.h" namespace TestCSG { diff --git a/engine/modules/dds/dds_enums.h b/engine/modules/dds/dds_enums.h index 176c6c5c..aa5fcf9d 100644 --- a/engine/modules/dds/dds_enums.h +++ b/engine/modules/dds/dds_enums.h @@ -164,8 +164,6 @@ enum DDSFormat { DDS_LUMINANCE, DDS_LUMINANCE_ALPHA, DDS_LUMINANCE_ALPHA_4, - DDS_RG8, - DDS_R8, DDS_MAX }; @@ -225,6 +223,4 @@ static const DDSFormatInfo dds_format_info[DDS_MAX] = { { "GRAYSCALE", false, 1, 1, Image::FORMAT_L8 }, { "GRAYSCALE_ALPHA", false, 1, 2, Image::FORMAT_LA8 }, { "GRAYSCALE_ALPHA_4", false, 1, 1, Image::FORMAT_LA8 }, - { "RG8", false, 1, 2, Image::FORMAT_RG8 }, - { "R8", false, 1, 1, Image::FORMAT_R8 }, }; diff --git a/engine/modules/dds/register_types.cpp b/engine/modules/dds/register_types.cpp index ec60d8e3..fc831b9f 100644 --- a/engine/modules/dds/register_types.cpp +++ b/engine/modules/dds/register_types.cpp @@ -33,8 +33,6 @@ #include "image_saver_dds.h" #include "texture_loader_dds.h" -#include "core/io/resource_loader.h" -#include "core/object/class_db.h" #include "scene/resources/texture.h" static Ref resource_loader_dds; diff --git a/engine/modules/dds/tests/test_dds.h b/engine/modules/dds/tests/test_dds.h index 90507590..3029bc9c 100644 --- a/engine/modules/dds/tests/test_dds.h +++ b/engine/modules/dds/tests/test_dds.h @@ -34,8 +34,8 @@ #include "core/config/project_settings.h" #include "core/io/dir_access.h" -#include "core/io/file_access.h" #include "core/io/image.h" +#include "tests/core/config/test_project_settings.h" #include "tests/test_macros.h" #include "tests/test_utils.h" diff --git a/engine/modules/dds/texture_loader_dds.cpp b/engine/modules/dds/texture_loader_dds.cpp index 8db4f6a9..8cc3f54a 100644 --- a/engine/modules/dds/texture_loader_dds.cpp +++ b/engine/modules/dds/texture_loader_dds.cpp @@ -34,7 +34,6 @@ #include "core/io/file_access.h" #include "core/io/file_access_memory.h" -#include "core/object/class_db.h" #include "scene/resources/image_texture.h" DDSFormat _dxgi_to_dds_format(uint32_t p_dxgi_format) { @@ -76,9 +75,7 @@ DDSFormat _dxgi_to_dds_format(uint32_t p_dxgi_format) { case DXGI_R32_FLOAT: { return DDS_R32F; } - case DXGI_R8_UNORM: { - return DDS_R8; - } + case DXGI_R8_UNORM: case DXGI_A8_UNORM: { return DDS_LUMINANCE; } @@ -92,7 +89,7 @@ DDSFormat _dxgi_to_dds_format(uint32_t p_dxgi_format) { return DDS_R16I; } case DXGI_R8G8_UNORM: { - return DDS_RG8; + return DDS_LUMINANCE_ALPHA; } case DXGI_R9G9B9E5: { return DDS_RGB9E5; @@ -651,10 +648,6 @@ static Vector> _dds_load_images_from_buffer(Ref p_f, DDSF r_dds_format = DDS_BGRX8; } else if (format_rgb_bits == 32 && format_red_mask == 0xff && format_green_mask == 0xff00 && format_blue_mask == 0xff0000) { r_dds_format = DDS_RGBX8; - } else if (format_rgb_bits == 8 && format_red_mask == 0xff && format_green_mask == 0 && format_blue_mask == 0) { - r_dds_format = DDS_R8; - } else if (format_rgb_bits == 16 && format_red_mask == 0xff && format_green_mask == 0xff00 && format_blue_mask == 0) { - r_dds_format = DDS_RG8; } } diff --git a/engine/modules/enet/doc_classes/ENetConnection.xml b/engine/modules/enet/doc_classes/ENetConnection.xml index f21f4cfa..940d3be7 100644 --- a/engine/modules/enet/doc_classes/ENetConnection.xml +++ b/engine/modules/enet/doc_classes/ENetConnection.xml @@ -1,5 +1,5 @@ - + A wrapper class for an [url=http://enet.bespin.org/group__host.html]ENetHost[/url]. diff --git a/engine/modules/enet/doc_classes/ENetMultiplayerPeer.xml b/engine/modules/enet/doc_classes/ENetMultiplayerPeer.xml index 4f4d5ff5..c49d16eb 100644 --- a/engine/modules/enet/doc_classes/ENetMultiplayerPeer.xml +++ b/engine/modules/enet/doc_classes/ENetMultiplayerPeer.xml @@ -1,5 +1,5 @@ - + A MultiplayerPeer implementation using the [url=http://enet.bespin.org/index.html]ENet[/url] library. diff --git a/engine/modules/enet/doc_classes/ENetPacketPeer.xml b/engine/modules/enet/doc_classes/ENetPacketPeer.xml index f5858ff1..266ce8d9 100644 --- a/engine/modules/enet/doc_classes/ENetPacketPeer.xml +++ b/engine/modules/enet/doc_classes/ENetPacketPeer.xml @@ -1,5 +1,5 @@ - + A wrapper class for an [url=http://enet.bespin.org/group__peer.html]ENetPeer[/url]. diff --git a/engine/modules/enet/enet_connection.cpp b/engine/modules/enet/enet_connection.cpp index a88ed5c4..9b764b1a 100644 --- a/engine/modules/enet/enet_connection.cpp +++ b/engine/modules/enet/enet_connection.cpp @@ -34,7 +34,6 @@ #include "core/io/compression.h" #include "core/io/ip.h" -#include "core/object/class_db.h" #include "core/variant/typed_array.h" void ENetConnection::broadcast(enet_uint8 p_channel, ENetPacket *p_packet) { diff --git a/engine/modules/enet/enet_multiplayer_peer.cpp b/engine/modules/enet/enet_multiplayer_peer.cpp index 837a2cdb..da41378b 100644 --- a/engine/modules/enet/enet_multiplayer_peer.cpp +++ b/engine/modules/enet/enet_multiplayer_peer.cpp @@ -30,8 +30,6 @@ #include "enet_multiplayer_peer.h" -#include "core/object/class_db.h" - void ENetMultiplayerPeer::set_target_peer(int p_peer) { target_peer = p_peer; } @@ -479,7 +477,7 @@ void ENetMultiplayerPeer::_bind_methods() { ClassDB::bind_method(D_METHOD("get_host"), &ENetMultiplayerPeer::get_host); ClassDB::bind_method(D_METHOD("get_peer", "id"), &ENetMultiplayerPeer::get_peer); - ADD_PROPERTY(PropertyInfo(Variant::OBJECT, "host", PROPERTY_HINT_RESOURCE_TYPE, ENetConnection::get_class_static(), PROPERTY_USAGE_NONE), "", "get_host"); + ADD_PROPERTY(PropertyInfo(Variant::OBJECT, "host", PROPERTY_HINT_RESOURCE_TYPE, "ENetConnection", PROPERTY_USAGE_NONE), "", "get_host"); } ENetMultiplayerPeer::ENetMultiplayerPeer() { diff --git a/engine/modules/enet/enet_multiplayer_peer.h b/engine/modules/enet/enet_multiplayer_peer.h index a6d882f1..e56df733 100644 --- a/engine/modules/enet/enet_multiplayer_peer.h +++ b/engine/modules/enet/enet_multiplayer_peer.h @@ -32,6 +32,7 @@ #include "enet_connection.h" +#include "core/crypto/crypto.h" #include "scene/main/multiplayer_peer.h" #include diff --git a/engine/modules/enet/enet_packet_peer.cpp b/engine/modules/enet/enet_packet_peer.cpp index 36a00d51..9ec68465 100644 --- a/engine/modules/enet/enet_packet_peer.cpp +++ b/engine/modules/enet/enet_packet_peer.cpp @@ -30,8 +30,6 @@ #include "enet_packet_peer.h" -#include "core/object/class_db.h" - void ENetPacketPeer::peer_disconnect(int p_data) { ERR_FAIL_NULL(peer); enet_peer_disconnect(peer, p_data); @@ -184,9 +182,6 @@ int ENetPacketPeer::get_packet_flags() const { void ENetPacketPeer::_on_disconnect() { if (peer) { -#ifdef GODOT_ENET - enet_peer_socket_destroy(peer); -#endif peer->data = nullptr; } peer = nullptr; @@ -261,9 +256,6 @@ void ENetPacketPeer::_bind_methods() { ENetPacketPeer::ENetPacketPeer(ENetPeer *p_peer) { peer = p_peer; peer->data = this; -#ifdef GODOT_ENET - enet_peer_socket_bind(peer); -#endif } ENetPacketPeer::~ENetPacketPeer() { diff --git a/engine/modules/enet/register_types.cpp b/engine/modules/enet/register_types.cpp index 6c87de79..5787f9c2 100644 --- a/engine/modules/enet/register_types.cpp +++ b/engine/modules/enet/register_types.cpp @@ -35,7 +35,6 @@ #include "enet_packet_peer.h" #include "core/error/error_macros.h" -#include "core/object/class_db.h" static bool enet_ok = false; diff --git a/engine/modules/fbx/doc_classes/EditorSceneFormatImporterFBX2GLTF.xml b/engine/modules/fbx/doc_classes/EditorSceneFormatImporterFBX2GLTF.xml index 6f2778ca..3bf4e7dd 100644 --- a/engine/modules/fbx/doc_classes/EditorSceneFormatImporterFBX2GLTF.xml +++ b/engine/modules/fbx/doc_classes/EditorSceneFormatImporterFBX2GLTF.xml @@ -1,5 +1,5 @@ - + Importer for the [code].fbx[/code] scene file format. diff --git a/engine/modules/fbx/doc_classes/EditorSceneFormatImporterUFBX.xml b/engine/modules/fbx/doc_classes/EditorSceneFormatImporterUFBX.xml index 0a9b603a..cab58b64 100644 --- a/engine/modules/fbx/doc_classes/EditorSceneFormatImporterUFBX.xml +++ b/engine/modules/fbx/doc_classes/EditorSceneFormatImporterUFBX.xml @@ -1,5 +1,5 @@ - + Import FBX files using the ufbx library. diff --git a/engine/modules/fbx/doc_classes/FBXDocument.xml b/engine/modules/fbx/doc_classes/FBXDocument.xml index 810aec33..db1d77c0 100644 --- a/engine/modules/fbx/doc_classes/FBXDocument.xml +++ b/engine/modules/fbx/doc_classes/FBXDocument.xml @@ -1,5 +1,5 @@ - + Handles FBX documents. diff --git a/engine/modules/fbx/doc_classes/FBXState.xml b/engine/modules/fbx/doc_classes/FBXState.xml index 91fcb2a3..88c23181 100644 --- a/engine/modules/fbx/doc_classes/FBXState.xml +++ b/engine/modules/fbx/doc_classes/FBXState.xml @@ -1,5 +1,5 @@ - + diff --git a/engine/modules/fbx/editor/editor_scene_importer_fbx2gltf.cpp b/engine/modules/fbx/editor/editor_scene_importer_fbx2gltf.cpp index a58556a3..db2b4f97 100644 --- a/engine/modules/fbx/editor/editor_scene_importer_fbx2gltf.cpp +++ b/engine/modules/fbx/editor/editor_scene_importer_fbx2gltf.cpp @@ -30,12 +30,9 @@ #include "editor_scene_importer_fbx2gltf.h" -#include "editor_scene_importer_ufbx.h" - #include "core/config/project_settings.h" -#include "core/io/resource_importer.h" -#include "core/os/os.h" #include "editor/settings/editor_settings.h" +#include "editor_scene_importer_ufbx.h" #include "modules/gltf/gltf_document.h" diff --git a/engine/modules/fbx/editor/editor_scene_importer_ufbx.cpp b/engine/modules/fbx/editor/editor_scene_importer_ufbx.cpp index 091621be..a0d1bd93 100644 --- a/engine/modules/fbx/editor/editor_scene_importer_ufbx.cpp +++ b/engine/modules/fbx/editor/editor_scene_importer_ufbx.cpp @@ -34,7 +34,6 @@ #include "editor_scene_importer_fbx2gltf.h" #include "core/config/project_settings.h" -#include "core/io/resource_importer.h" void EditorSceneFormatImporterUFBX::get_extensions(List *r_extensions) const { r_extensions->push_back("fbx"); diff --git a/engine/modules/fbx/fbx_document.cpp b/engine/modules/fbx/fbx_document.cpp index da57edaf..7ad89d1c 100644 --- a/engine/modules/fbx/fbx_document.cpp +++ b/engine/modules/fbx/fbx_document.cpp @@ -30,14 +30,12 @@ #include "fbx_document.h" -#include "core/config/engine.h" #include "core/config/project_settings.h" #include "core/crypto/crypto_core.h" #include "core/io/config_file.h" #include "core/io/file_access.h" #include "core/io/file_access_memory.h" #include "core/io/image.h" -#include "core/io/resource_loader.h" #include "core/math/color.h" #include "scene/3d/bone_attachment_3d.h" #include "scene/3d/camera_3d.h" diff --git a/engine/modules/fbx/fbx_state.cpp b/engine/modules/fbx/fbx_state.cpp index 37e2b23e..0b42a865 100644 --- a/engine/modules/fbx/fbx_state.cpp +++ b/engine/modules/fbx/fbx_state.cpp @@ -30,8 +30,6 @@ #include "fbx_state.h" -#include "core/object/class_db.h" - void FBXState::_bind_methods() { ClassDB::bind_method(D_METHOD("get_allow_geometry_helper_nodes"), &FBXState::get_allow_geometry_helper_nodes); ClassDB::bind_method(D_METHOD("set_allow_geometry_helper_nodes", "allow"), &FBXState::set_allow_geometry_helper_nodes); diff --git a/engine/modules/fbx/fbx_state.h b/engine/modules/fbx/fbx_state.h index 94e93fac..dff450c7 100644 --- a/engine/modules/fbx/fbx_state.h +++ b/engine/modules/fbx/fbx_state.h @@ -32,7 +32,9 @@ #include "modules/gltf/gltf_defines.h" #include "modules/gltf/gltf_state.h" +#include "modules/gltf/structures/gltf_skeleton.h" #include "modules/gltf/structures/gltf_skin.h" +#include "modules/gltf/structures/gltf_texture.h" #include diff --git a/engine/modules/fbx/register_types.cpp b/engine/modules/fbx/register_types.cpp index 4bb19752..c1a2bd5b 100644 --- a/engine/modules/fbx/register_types.cpp +++ b/engine/modules/fbx/register_types.cpp @@ -30,17 +30,13 @@ #include "register_types.h" +#include "../gltf/extensions/gltf_document_extension_convert_importer_mesh.h" #include "fbx_document.h" -#include "core/config/engine.h" -#include "core/object/class_db.h" - -#include "modules/gltf/extensions/gltf_document_extension_convert_importer_mesh.h" - #ifdef TOOLS_ENABLED #include "editor/editor_scene_importer_fbx2gltf.h" #include "editor/editor_scene_importer_ufbx.h" -// + #include "core/config/project_settings.h" #include "editor/editor_node.h" @@ -59,8 +55,8 @@ static void _editor_init() { #endif // TOOLS_ENABLED #define FBX_REGISTER_DOCUMENT_EXTENSION(m_doc_ext_class) \ - Ref extension_##m_doc_ext_class; \ - extension_##m_doc_ext_class.instantiate(); \ + Ref extension_##m_doc_ext_class; \ + extension_##m_doc_ext_class.instantiate(); \ FBXDocument::register_gltf_document_extension(extension_##m_doc_ext_class); void initialize_fbx_module(ModuleInitializationLevel p_level) { diff --git a/engine/modules/gdscript/SCsub b/engine/modules/gdscript/SCsub index f39b1a0f..8f50bf95 100644 --- a/engine/modules/gdscript/SCsub +++ b/engine/modules/gdscript/SCsub @@ -25,6 +25,5 @@ if env.editor_build: if env["tests"]: - # TODO: Handle test creation magic without needing to pass macro. env_gdscript.Append(CPPDEFINES=["TESTS_ENABLED"]) env_gdscript.add_source_files(env.modules_sources, "./tests/*.cpp") diff --git a/engine/modules/gdscript/config.py b/engine/modules/gdscript/config.py index 25278db6..ecd33a5d 100644 --- a/engine/modules/gdscript/config.py +++ b/engine/modules/gdscript/config.py @@ -11,10 +11,7 @@ def get_doc_classes(): return [ "@GDScript", "GDScript", - "GDScriptLanguageProtocol", "GDScriptSyntaxHighlighter", - "GDScriptTextDocument", - "GDScriptWorkspace", ] diff --git a/engine/modules/gdscript/doc_classes/@GDScript.xml b/engine/modules/gdscript/doc_classes/@GDScript.xml index 635560a7..28b0ca55 100644 --- a/engine/modules/gdscript/doc_classes/@GDScript.xml +++ b/engine/modules/gdscript/doc_classes/@GDScript.xml @@ -133,7 +133,7 @@ - A constant from the [enum Variant.Type] enumeration, for example [constant TYPE_INT]. - An [Object]-derived class which exists in [ClassDB], for example [Node]. - A [Script] (you can use any class, including inner one). - Unlike the right operand of the [code]is[/code] operator, [param type] can be a non-constant value. The [code]is[/code] operator supports more features (such as typed arrays and dictionaries). Use the operator instead of this method if you do not need to check the type dynamically. + Unlike the right operand of the [code]is[/code] operator, [param type] can be a non-constant value. The [code]is[/code] operator supports more features (such as typed arrays). Use the operator instead of this method if you do not need to check the type dynamically. [b]Examples:[/b] [codeblock] print(is_instance_of(a, TYPE_INT)) @@ -142,7 +142,7 @@ print(is_instance_of(a, MyClass.InnerClass)) [/codeblock] [b]Note:[/b] If [param value] and/or [param type] are freed objects (see [method @GlobalScope.is_instance_valid]), or [param type] is not one of the above options, this method will raise a runtime error. - See also [method @GlobalScope.typeof], [method Object.is_class], [method Object.get_script], [method Array.is_same_typed] (and other [Array] methods), [method Dictionary.is_same_typed] (and other [Dictionary] methods). + See also [method @GlobalScope.typeof], [method type_exists], [method Array.is_same_typed] (and other [Array] methods). @@ -266,7 +266,7 @@ [/codeblock] - + diff --git a/engine/modules/gdscript/doc_classes/GDScript.xml b/engine/modules/gdscript/doc_classes/GDScript.xml index 636c7975..c3fa59dc 100644 --- a/engine/modules/gdscript/doc_classes/GDScript.xml +++ b/engine/modules/gdscript/doc_classes/GDScript.xml @@ -1,5 +1,5 @@ - + A script implemented in the GDScript programming language. diff --git a/engine/modules/gdscript/doc_classes/GDScriptLanguageProtocol.xml b/engine/modules/gdscript/doc_classes/GDScriptLanguageProtocol.xml deleted file mode 100644 index 400154ef..00000000 --- a/engine/modules/gdscript/doc_classes/GDScriptLanguageProtocol.xml +++ /dev/null @@ -1,69 +0,0 @@ - - - - GDScript language server. - - - Provides access to certain features that are implemented in the language server. - [b]Note:[/b] This class is not a language server client that can be used to access LSP functionality. It only provides access to a limited set of features that is implemented using the same technical foundation as the language server. - - - - - - - - Returns the language server's [GDScriptTextDocument] instance. - - - - - - Returns the language server's [GDScriptWorkspace] instance. - - - - - - - - - - - - - - - - - - Returns [code]true[/code] if the language server was initialized by a language server client, [code]false[/code] otherwise. - - - - - - Returns [code]true[/code] if the language server is providing the smart resolve feature, [code]false[/code] otherwise. The feature can be configured through the editor settings. - - - - - - - - - - - - - - - - - - - - - - - diff --git a/engine/modules/gdscript/doc_classes/GDScriptSyntaxHighlighter.xml b/engine/modules/gdscript/doc_classes/GDScriptSyntaxHighlighter.xml index 099bb2d1..63a92229 100644 --- a/engine/modules/gdscript/doc_classes/GDScriptSyntaxHighlighter.xml +++ b/engine/modules/gdscript/doc_classes/GDScriptSyntaxHighlighter.xml @@ -1,5 +1,5 @@ - + A GDScript syntax highlighter that can be used with [TextEdit] and [CodeEdit] nodes. diff --git a/engine/modules/gdscript/doc_classes/GDScriptTextDocument.xml b/engine/modules/gdscript/doc_classes/GDScriptTextDocument.xml deleted file mode 100644 index 9a6eb185..00000000 --- a/engine/modules/gdscript/doc_classes/GDScriptTextDocument.xml +++ /dev/null @@ -1,139 +0,0 @@ - - - - Document related language server functionality. - - - Provides language server functionality related to documents. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/engine/modules/gdscript/doc_classes/GDScriptWorkspace.xml b/engine/modules/gdscript/doc_classes/GDScriptWorkspace.xml deleted file mode 100644 index e49f4031..00000000 --- a/engine/modules/gdscript/doc_classes/GDScriptWorkspace.xml +++ /dev/null @@ -1,67 +0,0 @@ - - - - Workspace related language server functionality. - - - Provides language server functionality related to the workspace. - - - - - - - - - - - - - - - - - - - - - - - Returns the interface of the script in a machine-readable format. - - - - - - - Converts a URI to a file path. - - - - - - - Converts a file path to a URI. - - - - - - - - - - - - - - - - - - - - - - - diff --git a/engine/modules/gdscript/editor/gdscript_docgen.cpp b/engine/modules/gdscript/editor/gdscript_docgen.cpp index 8357887b..3d57db7f 100644 --- a/engine/modules/gdscript/editor/gdscript_docgen.cpp +++ b/engine/modules/gdscript/editor/gdscript_docgen.cpp @@ -33,7 +33,6 @@ #include "../gdscript.h" #include "core/config/project_settings.h" -#include "core/doc_data.h" HashMap GDScriptDocGen::singletons; @@ -316,11 +315,6 @@ String GDScriptDocGen::docvalue_from_expression(const GDP::ExpressionNode *p_exp const GDP::IdentifierNode *id = static_cast(p_expression); return id->name; } break; - case GDP::Node::LAMBDA: { - const GDP::LambdaNode *lambda = static_cast(p_expression); - const GDP::IdentifierNode *id = lambda->function->identifier; - return id != nullptr ? id->name : ""; - } break; default: { // Nothing to do. } break; @@ -439,9 +433,10 @@ void GDScriptDocGen::_generate_docs(GDScript *p_script, const GDP::ClassNode *p_ method_doc.qualifiers += "static"; } - if (func_name == "_init" || func_name == "_static_init") { + if (func_name == "_init") { method_doc.return_type = "void"; - } else if (!m_func->get_datatype().is_variant()) { + } else if (m_func->return_type) { + // `m_func->return_type->get_datatype()` is a metatype. _doctype_from_gdtype(m_func->get_datatype(), method_doc.return_type, method_doc.return_enum, true); } else if (!m_func->body->has_return) { // If no `return` statement, then return type is `void`, not `Variant`. diff --git a/engine/modules/gdscript/editor/gdscript_docgen.h b/engine/modules/gdscript/editor/gdscript_docgen.h index 5975c4b7..360906fe 100644 --- a/engine/modules/gdscript/editor/gdscript_docgen.h +++ b/engine/modules/gdscript/editor/gdscript_docgen.h @@ -32,6 +32,8 @@ #include "../gdscript_parser.h" +#include "core/doc_data.h" + class GDScriptDocGen { using GDP = GDScriptParser; using GDType = GDP::DataType; diff --git a/engine/modules/gdscript/editor/gdscript_highlighter.cpp b/engine/modules/gdscript/editor/gdscript_highlighter.cpp index 45435f53..a6f03409 100644 --- a/engine/modules/gdscript/editor/gdscript_highlighter.cpp +++ b/engine/modules/gdscript/editor/gdscript_highlighter.cpp @@ -35,8 +35,8 @@ #include "core/config/project_settings.h" #include "core/core_constants.h" -#include "core/object/class_db.h" #include "editor/settings/editor_settings.h" +#include "editor/themes/editor_theme_manager.h" #include "scene/gui/text_edit.h" Dictionary GDScriptSyntaxHighlighter::_get_line_syntax_highlighting_impl(int p_line) { diff --git a/engine/modules/gdscript/editor/gdscript_highlighter.h b/engine/modules/gdscript/editor/gdscript_highlighter.h index 0cec1a52..e6116d74 100644 --- a/engine/modules/gdscript/editor/gdscript_highlighter.h +++ b/engine/modules/gdscript/editor/gdscript_highlighter.h @@ -30,7 +30,7 @@ #pragma once -#include "editor/script/syntax_highlighters.h" +#include "editor/script/script_editor_plugin.h" class GDScriptSyntaxHighlighter : public EditorSyntaxHighlighter { GDCLASS(GDScriptSyntaxHighlighter, EditorSyntaxHighlighter) diff --git a/engine/modules/gdscript/editor/gdscript_translation_parser_plugin.cpp b/engine/modules/gdscript/editor/gdscript_translation_parser_plugin.cpp index 9e7a54cc..7026797c 100644 --- a/engine/modules/gdscript/editor/gdscript_translation_parser_plugin.cpp +++ b/engine/modules/gdscript/editor/gdscript_translation_parser_plugin.cpp @@ -450,7 +450,6 @@ GDScriptEditorTranslationParserPlugin::GDScriptEditorTranslationParserPlugin() { first_arg_patterns.insert("add_radio_check_item"); first_arg_patterns.insert("add_separator"); first_arg_patterns.insert("add_submenu_item"); - first_arg_patterns.insert("add_submenu_node_item"); second_arg_patterns.insert("set_tab_title"); second_arg_patterns.insert("add_icon_check_item"); diff --git a/engine/modules/gdscript/gdscript.cpp b/engine/modules/gdscript/gdscript.cpp index d286f797..8b133961 100644 --- a/engine/modules/gdscript/gdscript.cpp +++ b/engine/modules/gdscript/gdscript.cpp @@ -38,10 +38,6 @@ #include "gdscript_tokenizer_buffer.h" #include "gdscript_warning.h" -#include "core/io/resource_loader.h" -#include "core/object/callable_mp.h" -#include "core/object/class_db.h" - #ifdef TOOLS_ENABLED #include "editor/gdscript_docgen.h" #endif @@ -54,6 +50,7 @@ #include "core/config/project_settings.h" #include "core/core_constants.h" #include "core/io/file_access.h" + #include "scene/resources/packed_scene.h" #include "scene/scene_string_names.h" @@ -227,17 +224,16 @@ Variant GDScript::_new(const Variant **p_args, int p_argcount, Callable::CallErr ERR_FAIL_COND_V(_baseptr->native.is_null(), Variant()); if (_baseptr->native.ptr()) { owner = _baseptr->native->instantiate(); - - RefCounted *r = Object::cast_to(owner); - if (r) { - ref = Ref(r); - } } else { - ref = memnew(RefCounted); // By default, no base means use reference. - owner = ref.ptr(); + owner = memnew(RefCounted); //by default, no base means use reference } ERR_FAIL_NULL_V_MSG(owner, Variant(), "Can't inherit from a virtual class."); + RefCounted *r = Object::cast_to(owner); + if (r) { + ref = Ref(r); + } + GDScriptInstance *instance = _create_instance(p_args, p_argcount, owner, r_error); if (!instance) { if (ref.is_null()) { @@ -648,7 +644,7 @@ void GDScript::_update_exports_down(bool p_base_exports_changed) { return; } - HashSet copy(inheriters_cache); //might get modified + HashSet copy = inheriters_cache; //might get modified for (const ObjectID &E : copy) { Object *id = ObjectDB::get_instance(E); @@ -824,10 +820,10 @@ Error GDScript::reload(bool p_keep_state) { } if (err) { if (EngineDebugger::is_active()) { - GDScriptLanguage::get_singleton()->debug_break_parse(_get_debug_path(), parser.get_errors().front()->get().start_line, "Parser Error: " + parser.get_errors().front()->get().message); + GDScriptLanguage::get_singleton()->debug_break_parse(_get_debug_path(), parser.get_errors().front()->get().line, "Parser Error: " + parser.get_errors().front()->get().message); } // TODO: Show all error messages. - _err_print_error("GDScript::reload", path.is_empty() ? "built-in" : (const char *)path.utf8().get_data(), parser.get_errors().front()->get().start_line, ("Parse Error: " + parser.get_errors().front()->get().message).utf8().get_data(), false, ERR_HANDLER_SCRIPT); + _err_print_error("GDScript::reload", path.is_empty() ? "built-in" : (const char *)path.utf8().get_data(), parser.get_errors().front()->get().line, ("Parse Error: " + parser.get_errors().front()->get().message).utf8().get_data(), false, ERR_HANDLER_SCRIPT); reloading = false; return ERR_PARSE_ERROR; } @@ -837,12 +833,12 @@ Error GDScript::reload(bool p_keep_state) { if (err) { if (EngineDebugger::is_active()) { - GDScriptLanguage::get_singleton()->debug_break_parse(_get_debug_path(), parser.get_errors().front()->get().start_line, "Parser Error: " + parser.get_errors().front()->get().message); + GDScriptLanguage::get_singleton()->debug_break_parse(_get_debug_path(), parser.get_errors().front()->get().line, "Parser Error: " + parser.get_errors().front()->get().message); } const List::Element *e = parser.get_errors().front(); while (e != nullptr) { - _err_print_error("GDScript::reload", path.is_empty() ? "built-in" : (const char *)path.utf8().get_data(), e->get().start_line, ("Parse Error: " + e->get().message).utf8().get_data(), false, ERR_HANDLER_SCRIPT); + _err_print_error("GDScript::reload", path.is_empty() ? "built-in" : (const char *)path.utf8().get_data(), e->get().line, ("Parse Error: " + e->get().message).utf8().get_data(), false, ERR_HANDLER_SCRIPT); e = e->next(); } reloading = false; @@ -931,6 +927,10 @@ const Variant GDScript::get_rpc_config() const { return rpc_config; } +void GDScript::unload_static() const { + GDScriptCache::remove_script(fully_qualified_name); +} + Variant GDScript::callp(const StringName &p_method, const Variant **p_args, int p_argcount, Callable::CallError &r_error) { GDScript *top = this; while (top) { @@ -945,19 +945,9 @@ Variant GDScript::callp(const StringName &p_method, const Variant **p_args, int top = top->base.ptr(); } - { - Variant ret = Script::callp(p_method, p_args, p_argcount, r_error); - if (r_error.error != Callable::CallError::CALL_ERROR_INVALID_METHOD) { - return ret; - } - } + //none found, regular - if (native.is_valid()) { - return native->callp(p_method, p_args, p_argcount, r_error); - } - - r_error.error = Callable::CallError::CALL_ERROR_INVALID_METHOD; - return Variant(); + return Script::callp(p_method, p_args, p_argcount, r_error); } bool GDScript::_get(const StringName &p_name, Variant &r_ret) const { @@ -1105,15 +1095,7 @@ void GDScript::set_path(const String &p_path, bool p_take_over) { String old_path = path; path = p_path; path_valid = true; - - String old_base = GDScript::canonicalize_path(old_path); - if (!old_base.is_empty() && fully_qualified_name.begins_with(old_base)) { - fully_qualified_name = GDScript::canonicalize_path(p_path) + fully_qualified_name.substr(old_base.length()); - } - - if (is_root_script()) { - GDScriptCache::move_script(old_path, p_path); - } + GDScriptCache::move_script(old_path, p_path); for (KeyValue> &kv : subclasses) { kv.value->set_path(p_path, p_take_over); @@ -2892,3 +2874,170 @@ Ref GDScriptLanguage::get_orphan_subclass(const String &p_qualified_na } return Ref(Object::cast_to(obj)); } + +Ref GDScriptLanguage::get_script_by_fully_qualified_name(const String &p_name) { + { + MutexLock lock(mutex); + + SelfList *elem = script_list.first(); + while (elem) { + GDScript *scr = elem->self(); + if (scr->fully_qualified_name == p_name) { + return scr; + } + elem = elem->next(); + } + } + + Ref scr; + scr.instantiate(); + scr->fully_qualified_name = p_name; + return scr; +} + +/*************** RESOURCE ***************/ + +Ref ResourceFormatLoaderGDScript::load(const String &p_path, const String &p_original_path, Error *r_error, bool p_use_sub_threads, float *r_progress, CacheMode p_cache_mode) { + Error err; + bool ignoring = p_cache_mode == CACHE_MODE_IGNORE || p_cache_mode == CACHE_MODE_IGNORE_DEEP; + Ref scr = GDScriptCache::get_full_script(p_original_path, err, "", ignoring); + + if (err && scr.is_valid()) { + // If !scr.is_valid(), the error was likely from scr->load_source_code(), which already generates an error. + ERR_PRINT_ED(vformat(R"(Failed to load script "%s" with error "%s".)", p_original_path, error_names[err])); + } + + if (r_error) { + // Don't fail loading because of parsing error. + *r_error = scr.is_valid() ? OK : err; + } + + return scr; +} + +void ResourceFormatLoaderGDScript::get_recognized_extensions(List *p_extensions) const { + p_extensions->push_back("gd"); + p_extensions->push_back("gdc"); +} + +bool ResourceFormatLoaderGDScript::handles_type(const String &p_type) const { + return (p_type == "Script" || p_type == "GDScript"); +} + +String ResourceFormatLoaderGDScript::get_resource_type(const String &p_path) const { + String el = p_path.get_extension().to_lower(); + if (el == "gd" || el == "gdc") { + return "GDScript"; + } + return ""; +} + +void ResourceFormatLoaderGDScript::get_dependencies(const String &p_path, List *p_dependencies, bool p_add_types) { + Ref file = FileAccess::open(p_path, FileAccess::READ); + ERR_FAIL_COND_MSG(file.is_null(), "Cannot open file '" + p_path + "'."); + + String source = file->get_as_utf8_string(); + if (source.is_empty()) { + return; + } + + GDScriptParser parser; + if (OK != parser.parse(source, p_path, false)) { + return; + } + + for (const String &E : parser.get_dependencies()) { + p_dependencies->push_back(E); + } +} + +void ResourceFormatLoaderGDScript::get_classes_used(const String &p_path, HashSet *r_classes) { + Ref scr = ResourceLoader::load(p_path); + if (scr.is_null()) { + return; + } + + const String source = scr->get_source_code(); + GDScriptTokenizerText tokenizer; + tokenizer.set_source_code(source); + GDScriptTokenizer::Token current = tokenizer.scan(); + while (current.type != GDScriptTokenizer::Token::TK_EOF) { + if (!current.is_identifier()) { + current = tokenizer.scan(); + continue; + } + + int insert_idx = 0; + for (int i = 0; i < current.start_line - 1; i++) { + insert_idx = source.find("\n", insert_idx) + 1; + } + // Insert the "cursor" character, needed for the lookup to work. + const String source_with_cursor = source.insert(insert_idx + current.start_column, String::chr(0xFFFF)); + + ScriptLanguage::LookupResult result; + if (scr->get_language()->lookup_code(source_with_cursor, current.get_identifier(), p_path, nullptr, result) == OK) { + if (!result.class_name.is_empty() && ClassDB::class_exists(result.class_name)) { + r_classes->insert(result.class_name); + } + + if (result.type == ScriptLanguage::LOOKUP_RESULT_CLASS_PROPERTY) { + PropertyInfo prop; + if (ClassDB::get_property_info(result.class_name, result.class_member, &prop)) { + if (!prop.class_name.is_empty() && ClassDB::class_exists(prop.class_name)) { + r_classes->insert(prop.class_name); + } + if (!prop.hint_string.is_empty() && ClassDB::class_exists(prop.hint_string)) { + r_classes->insert(prop.hint_string); + } + } + } else if (result.type == ScriptLanguage::LOOKUP_RESULT_CLASS_METHOD) { + MethodInfo met; + if (ClassDB::get_method_info(result.class_name, result.class_member, &met)) { + if (!met.return_val.class_name.is_empty() && ClassDB::class_exists(met.return_val.class_name)) { + r_classes->insert(met.return_val.class_name); + } + if (!met.return_val.hint_string.is_empty() && ClassDB::class_exists(met.return_val.hint_string)) { + r_classes->insert(met.return_val.hint_string); + } + } + } + } + + current = tokenizer.scan(); + } +} + +Error ResourceFormatSaverGDScript::save(const Ref &p_resource, const String &p_path, uint32_t p_flags) { + Ref sqscr = p_resource; + ERR_FAIL_COND_V(sqscr.is_null(), ERR_INVALID_PARAMETER); + + String source = sqscr->get_source_code(); + + { + Error err; + Ref file = FileAccess::open(p_path, FileAccess::WRITE, &err); + + ERR_FAIL_COND_V_MSG(err, err, "Cannot save GDScript file '" + p_path + "'."); + + file->store_string(source); + if (file->get_error() != OK && file->get_error() != ERR_FILE_EOF) { + return ERR_CANT_CREATE; + } + } + + if (ScriptServer::is_reload_scripts_on_save_enabled()) { + GDScriptLanguage::get_singleton()->reload_tool_script(p_resource, true); + } + + return OK; +} + +void ResourceFormatSaverGDScript::get_recognized_extensions(const Ref &p_resource, List *p_extensions) const { + if (Object::cast_to(*p_resource)) { + p_extensions->push_back("gd"); + } +} + +bool ResourceFormatSaverGDScript::recognize(const Ref &p_resource) const { + return Object::cast_to(*p_resource) != nullptr; +} diff --git a/engine/modules/gdscript/gdscript.h b/engine/modules/gdscript/gdscript.h index ed6eabd6..a0be2552 100644 --- a/engine/modules/gdscript/gdscript.h +++ b/engine/modules/gdscript/gdscript.h @@ -35,6 +35,8 @@ #include "core/debugger/engine_debugger.h" #include "core/debugger/script_debugger.h" #include "core/doc_data.h" +#include "core/io/resource_loader.h" +#include "core/io/resource_saver.h" #include "core/object/script_language.h" #include "core/templates/rb_set.h" @@ -337,6 +339,8 @@ public: virtual const Variant get_rpc_config() const override; + void unload_static() const; + #ifdef TOOLS_ENABLED virtual bool is_placeholder_fallback_enabled() const override { return placeholder_fallback_enabled; } #endif @@ -596,6 +600,7 @@ public: virtual Ref