Merge branch 'upgrade-engine' into development
This commit is contained in:
commit
41f0d5c3eb
5857 changed files with 435721 additions and 258049 deletions
|
|
@ -1,3 +1,6 @@
|
|||
# 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).
|
||||
|
|
@ -38,7 +41,7 @@ AlignAfterOpenBracket: DontAlign
|
|||
# AcrossEmptyLines: false
|
||||
# AcrossComments: false
|
||||
# AlignCaseColons: false
|
||||
# AlignEscapedNewlines: Right
|
||||
AlignEscapedNewlines: DontAlign # Aligning leads to long diffs
|
||||
AlignOperands: DontAlign
|
||||
AlignTrailingComments:
|
||||
Kind: Never
|
||||
|
|
@ -114,14 +117,25 @@ Cpp11BracedListStyle: false
|
|||
# - BOOST_FOREACH
|
||||
# IfMacros:
|
||||
# - KJ_IF_MAYBE
|
||||
# IncludeBlocks: Preserve
|
||||
IncludeBlocks: Regroup
|
||||
IncludeCategories:
|
||||
- Regex: ^".*"$
|
||||
Priority: 1
|
||||
- Regex: ^<.*\.h>$
|
||||
Priority: 2
|
||||
- Regex: ^"(core|drivers|editor|main|scene|servers|tests)/.*"$
|
||||
Priority: 20
|
||||
- Regex: ^"(modules|platform)/.*"$
|
||||
Priority: 30
|
||||
- Regex: ^<thirdparty/.*>$
|
||||
Priority: 40
|
||||
- Regex: ^<(windows|Jolt/Jolt|platform_gl)\.h>$
|
||||
Priority: 50
|
||||
- Regex: ^<.*\.(h|hpp)>$
|
||||
Priority: 60
|
||||
- Regex: ^<.*>$
|
||||
Priority: 3
|
||||
Priority: 70
|
||||
- Regex: ^".*\.compat\.inc"$
|
||||
Priority: 0
|
||||
SortPriority: 1
|
||||
- Regex: ^".*"$
|
||||
Priority: 10
|
||||
# IncludeIsMainRegex: (Test)?$
|
||||
# IncludeIsMainSourceRegex: ""
|
||||
# IndentAccessModifiers: false
|
||||
|
|
|
|||
|
|
@ -1,21 +1,26 @@
|
|||
# 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:
|
||||
- -*
|
||||
- cppcoreguidelines-pro-type-member-init
|
||||
- performance-move-const-arg
|
||||
- bugprone-use-after-move
|
||||
- modernize-deprecated-headers
|
||||
- modernize-redundant-void-arg
|
||||
- modernize-use-bool-literals
|
||||
- modernize-use-default-member-init
|
||||
# - modernize-use-default-member-init # TODO Re-activate
|
||||
- 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: "&&;&=;&;|;~;!;!=;||;|=;^;^="
|
||||
|
|
|
|||
|
|
@ -1,12 +1,21 @@
|
|||
# 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:
|
||||
|
|
@ -20,11 +29,19 @@ CompileFlags:
|
|||
- -Wno-unused-const-variable
|
||||
- -Wno-unused-function
|
||||
- -Wno-unused-variable
|
||||
|
||||
---
|
||||
# Suppress all third-party warnings.
|
||||
|
||||
# Suppress warnings for third-party or partial code.
|
||||
|
||||
If:
|
||||
PathMatch: thirdparty/.*
|
||||
PathMatch:
|
||||
- bin/build_deps/.*
|
||||
- misc/dist/apple_embedded_xcode/.*
|
||||
- tests/compatibility_test/.*
|
||||
- thirdparty/.*
|
||||
- .*/thirdparty/.*
|
||||
- .*-so_wrap.[ch]
|
||||
|
||||
Diagnostics:
|
||||
Suppress: "*"
|
||||
|
|
|
|||
|
|
@ -72,3 +72,18 @@ 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
|
||||
|
|
|
|||
3
engine/.github/CODEOWNERS
vendored
3
engine/.github/CODEOWNERS
vendored
|
|
@ -147,6 +147,8 @@
|
|||
/modules/meshoptimizer/ @godotengine/rendering
|
||||
/modules/raycast/ @godotengine/rendering
|
||||
/modules/vhacd/ @godotengine/rendering
|
||||
/modules/visual_shader/ @godotengine/shaders
|
||||
/modules/visual_shader/doc_classes/ @godotengine/shaders @godotengine/documentation
|
||||
/modules/xatlas_unwrap/ @godotengine/rendering
|
||||
|
||||
## Scripting
|
||||
|
|
@ -252,7 +254,6 @@
|
|||
/scene/resources/shader* @godotengine/shaders
|
||||
/scene/resources/skeleton* @godotengine/animation
|
||||
/scene/resources/text_* @godotengine/gui-nodes
|
||||
/scene/resources/visual_shader* @godotengine/shaders
|
||||
/scene/theme/ @godotengine/gui-nodes
|
||||
|
||||
# Servers
|
||||
|
|
|
|||
8
engine/.github/PULL_REQUEST_TEMPLATE.md
vendored
8
engine/.github/PULL_REQUEST_TEMPLATE.md
vendored
|
|
@ -1,8 +1,6 @@
|
|||
<!--
|
||||
Please target the `master` branch in priority.
|
||||
Please target the `master` branch. We will take care of backporting relevant fixes to older versions.
|
||||
|
||||
Relevant fixes are cherry-picked for stable branches as needed by maintainers.
|
||||
|
||||
To speed up the contribution process and avoid CI errors, please set up pre-commit hooks locally:
|
||||
https://contributing.godotengine.org/en/latest/engine/guidelines/code_style.html
|
||||
Before submitting, please read our checklist for new contributors:
|
||||
https://contributing.godotengine.org/en/latest/engine/introduction.html#checklist-for-new-contributors
|
||||
-->
|
||||
|
|
|
|||
30
engine/.github/actions/clangd-tidy/action.yml
vendored
Normal file
30
engine/.github/actions/clangd-tidy/action.yml
vendored
Normal file
|
|
@ -0,0 +1,30 @@
|
|||
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::"
|
||||
|
|
@ -14,7 +14,7 @@ runs:
|
|||
using: composite
|
||||
steps:
|
||||
- name: Download Godot Artifact
|
||||
uses: actions/download-artifact@v4
|
||||
uses: actions/download-artifact@v8
|
||||
with:
|
||||
name: ${{ inputs.name }}
|
||||
path: ${{ inputs.path }}
|
||||
|
|
|
|||
33
engine/.github/actions/godot-compat-test/action.yml
vendored
Normal file
33
engine/.github/actions/godot-compat-test/action.yml
vendored
Normal file
|
|
@ -0,0 +1,33 @@
|
|||
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
|
||||
|
|
@ -22,7 +22,7 @@ runs:
|
|||
using: composite
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v4
|
||||
uses: actions/checkout@v6
|
||||
with:
|
||||
submodules: recursive
|
||||
repository: godotengine/godot-cpp
|
||||
|
|
|
|||
55
engine/.github/actions/godot-project-export/action.yml
vendored
Normal file
55
engine/.github/actions/godot-project-export/action.yml
vendored
Normal file
|
|
@ -0,0 +1,55 @@
|
|||
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
|
||||
25
engine/.github/actions/pre-commit/action.yml
vendored
Normal file
25
engine/.github/actions/pre-commit/action.yml
vendored
Normal file
|
|
@ -0,0 +1,25 @@
|
|||
name: Pre-commit
|
||||
description: Setup pre-commit, and run it.
|
||||
|
||||
inputs:
|
||||
extra_args:
|
||||
description: Options to pass to pre-commit run
|
||||
required: false
|
||||
default: '--all-files'
|
||||
|
||||
runs:
|
||||
using: composite
|
||||
steps:
|
||||
- uses: actions/cache@v5
|
||||
with:
|
||||
path: ~/.cache/pre-commit
|
||||
key: pre-commit|${{ hashFiles('.pre-commit-config.yaml') }}
|
||||
|
||||
- run: |
|
||||
pip install pre-commit
|
||||
pre-commit install
|
||||
shell: bash
|
||||
|
||||
- run: |
|
||||
pre-commit run --show-diff-on-failure --color=always --files ${{ inputs.extra_args }}
|
||||
shell: bash
|
||||
29
engine/.github/changed_files.yml
vendored
Normal file
29
engine/.github/changed_files.yml
vendored
Normal file
|
|
@ -0,0 +1,29 @@
|
|||
# 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}"
|
||||
63
engine/.github/workflows/android_builds.yml
vendored
63
engine/.github/workflows/android_builds.yml
vendored
|
|
@ -1,6 +1,10 @@
|
|||
name: 🤖 Android Builds
|
||||
on:
|
||||
workflow_call:
|
||||
secrets:
|
||||
SERVICE_ACCOUNT_KEY:
|
||||
required: true
|
||||
|
||||
workflow_dispatch:
|
||||
|
||||
# Global Settings
|
||||
|
|
@ -8,7 +12,6 @@ env:
|
|||
SCONS_FLAGS: >-
|
||||
dev_mode=yes
|
||||
module_text_server_fb_enabled=yes
|
||||
tests=no
|
||||
swappy=yes
|
||||
|
||||
jobs:
|
||||
|
|
@ -23,6 +26,7 @@ jobs:
|
|||
- name: Editor (target=editor)
|
||||
cache-name: android-editor
|
||||
target: editor
|
||||
instrumented_tests: true
|
||||
scons-flags: >-
|
||||
arch=arm64
|
||||
production=yes
|
||||
|
|
@ -30,21 +34,23 @@ 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@v4
|
||||
uses: actions/checkout@v6
|
||||
with:
|
||||
submodules: recursive
|
||||
|
||||
- name: Set up Java 17
|
||||
uses: actions/setup-java@v4
|
||||
uses: actions/setup-java@v5
|
||||
with:
|
||||
distribution: temurin
|
||||
java-version: 17
|
||||
|
|
@ -116,3 +122,54 @@ 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"
|
||||
|
|
|
|||
9
engine/.github/workflows/ios_builds.yml
vendored
9
engine/.github/workflows/ios_builds.yml
vendored
|
|
@ -8,26 +8,21 @@ 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-latest
|
||||
runs-on: macos-26
|
||||
name: Template (target=template_release)
|
||||
timeout-minutes: 60
|
||||
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v4
|
||||
uses: actions/checkout@v6
|
||||
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
|
||||
|
|
|
|||
61
engine/.github/workflows/linux_builds.yml
vendored
61
engine/.github/workflows/linux_builds.yml
vendored
|
|
@ -1,6 +1,11 @@
|
|||
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
|
||||
|
|
@ -8,7 +13,6 @@ 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
|
||||
|
|
@ -30,15 +34,17 @@ jobs:
|
|||
- name: Editor w/ Mono (target=editor)
|
||||
cache-name: linux-editor-mono
|
||||
target: editor
|
||||
scons-flags: module_mono_enabled=yes
|
||||
scons-flags: module_mono_enabled=yes compiledb=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
|
||||
|
|
@ -110,7 +116,7 @@ jobs:
|
|||
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v4
|
||||
uses: actions/checkout@v6
|
||||
with:
|
||||
submodules: recursive
|
||||
|
||||
|
|
@ -118,7 +124,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" ]; then
|
||||
if [ "${{ matrix.proj-test }}" == "true" -o "${{ matrix.proj-export }}" == "true" ]; then
|
||||
sudo apt-get install mesa-vulkan-drivers
|
||||
fi
|
||||
|
||||
|
|
@ -143,7 +149,7 @@ jobs:
|
|||
uses: ./.github/actions/godot-deps
|
||||
with:
|
||||
# Sync with Ensure*Version in SConstruct.
|
||||
python-version: 3.8
|
||||
python-version: 3.9
|
||||
scons-version: 4.0
|
||||
|
||||
- name: Force remove preinstalled .NET SDKs
|
||||
|
|
@ -153,21 +159,21 @@ jobs:
|
|||
|
||||
- name: Setup older .NET SDK as baseline
|
||||
if: matrix.build-mono
|
||||
uses: actions/setup-dotnet@v4
|
||||
uses: actions/setup-dotnet@v5
|
||||
with:
|
||||
# Targeting the oldest version we want to support to ensure it still builds.
|
||||
dotnet-version: 8.0.100
|
||||
|
||||
- name: Download pre-built AccessKit
|
||||
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
|
||||
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
|
||||
|
||||
- name: Install mold linker
|
||||
if: matrix.proj-test
|
||||
|
|
@ -176,10 +182,16 @@ jobs:
|
|||
- name: Compilation
|
||||
uses: ./.github/actions/godot-build
|
||||
with:
|
||||
scons-flags: ${{ env.SCONS_FLAGS }} ${{ matrix.scons-flags }}
|
||||
scons-flags: ${{ env.SCONS_FLAGS }} ${{ matrix.scons-flags }} accesskit=${{ steps.accesskit-sdk.outputs.ACCESSKIT_ENABLED }}
|
||||
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
|
||||
|
|
@ -208,6 +220,7 @@ jobs:
|
|||
- name: Prepare artifact
|
||||
if: matrix.artifact
|
||||
run: |
|
||||
rm -rf ./bin/build_deps
|
||||
strip bin/godot.*
|
||||
chmod +x bin/godot.*
|
||||
|
||||
|
|
@ -238,11 +251,18 @@ 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
|
||||
- name: Check for GDExtension compatibility – JSON check
|
||||
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
|
||||
|
|
@ -250,6 +270,13 @@ 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
|
||||
|
|
|
|||
43
engine/.github/workflows/macos_builds.yml
vendored
43
engine/.github/workflows/macos_builds.yml
vendored
|
|
@ -8,12 +8,11 @@ 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-latest
|
||||
runs-on: macos-26
|
||||
name: ${{ matrix.name }}
|
||||
timeout-minutes: 120
|
||||
strategy:
|
||||
|
|
@ -33,14 +32,10 @@ jobs:
|
|||
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v4
|
||||
uses: actions/checkout@v6
|
||||
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:
|
||||
|
|
@ -50,16 +45,27 @@ jobs:
|
|||
- name: Setup Python and SCons
|
||||
uses: ./.github/actions/godot-deps
|
||||
|
||||
- name: Download pre-built AccessKit
|
||||
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: 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: Extract pre-built AccessKit
|
||||
run: unzip -o accesskit-c-0.21.2/accesskit_c.zip
|
||||
- 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
|
||||
|
||||
- name: Setup Vulkan SDK
|
||||
id: vulkan-sdk
|
||||
|
|
@ -75,14 +81,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 }}
|
||||
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 }}
|
||||
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 }}
|
||||
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 }}
|
||||
platform: macos
|
||||
target: ${{ matrix.target }}
|
||||
|
||||
|
|
@ -96,6 +102,7 @@ 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.*
|
||||
|
||||
|
|
|
|||
10
engine/.github/workflows/runner.yml
vendored
10
engine/.github/workflows/runner.yml
vendored
|
|
@ -18,29 +18,39 @@ 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
|
||||
|
|
|
|||
36
engine/.github/workflows/static_checks.yml
vendored
36
engine/.github/workflows/static_checks.yml
vendored
|
|
@ -1,6 +1,13 @@
|
|||
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:
|
||||
|
|
@ -8,11 +15,15 @@ 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@v4
|
||||
uses: actions/checkout@v6
|
||||
with:
|
||||
fetch-depth: 2
|
||||
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/
|
||||
|
||||
# This needs to happen before Python and npm execution; it must happen before any extra files are written.
|
||||
- name: .gitignore checks (gitignore_check.sh)
|
||||
|
|
@ -20,18 +31,17 @@ jobs:
|
|||
bash ./misc/scripts/gitignore_check.sh
|
||||
|
||||
- name: Get changed files
|
||||
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
|
||||
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
|
||||
|
||||
- name: Style checks via pre-commit
|
||||
uses: pre-commit/action@v3.0.1
|
||||
uses: ./.github/actions/pre-commit
|
||||
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 }}
|
||||
|
|
|
|||
13
engine/.github/workflows/web_builds.yml
vendored
13
engine/.github/workflows/web_builds.yml
vendored
|
|
@ -7,7 +7,6 @@ on:
|
|||
env:
|
||||
SCONS_FLAGS: >-
|
||||
dev_mode=yes
|
||||
tests=no
|
||||
debug_symbols=no
|
||||
use_closure_compiler=yes
|
||||
EM_VERSION: 4.0.11
|
||||
|
|
@ -21,26 +20,26 @@ jobs:
|
|||
fail-fast: false
|
||||
matrix:
|
||||
include:
|
||||
- name: Template w/ threads (target=template_release, threads=yes)
|
||||
- name: Template w/ threads, 64-bit (target=template_release, threads=yes, arch=wasm64)
|
||||
cache-name: web-template
|
||||
target: template_release
|
||||
scons-flags: threads=yes
|
||||
scons-flags: threads=yes arch=wasm64
|
||||
artifact: true
|
||||
|
||||
- name: Template w/o threads (target=template_release, threads=no)
|
||||
- name: Template w/o threads, 32-bit (target=template_release, threads=no, arch=wasm32)
|
||||
cache-name: web-nothreads-template
|
||||
target: template_release
|
||||
scons-flags: threads=no
|
||||
scons-flags: threads=no arch=wasm32
|
||||
artifact: true
|
||||
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v4
|
||||
uses: actions/checkout@v6
|
||||
with:
|
||||
submodules: recursive
|
||||
|
||||
- name: Set up Emscripten latest
|
||||
uses: mymindstorm/setup-emsdk@v14
|
||||
uses: emscripten-core/setup-emsdk@v16
|
||||
with:
|
||||
version: ${{ env.EM_VERSION }}
|
||||
no-cache: true
|
||||
|
|
|
|||
47
engine/.github/workflows/windows_builds.yml
vendored
47
engine/.github/workflows/windows_builds.yml
vendored
|
|
@ -9,8 +9,6 @@ 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
|
||||
|
||||
|
|
@ -59,7 +57,7 @@ jobs:
|
|||
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v4
|
||||
uses: actions/checkout@v6
|
||||
with:
|
||||
submodules: recursive
|
||||
|
||||
|
|
@ -84,32 +82,37 @@ jobs:
|
|||
fi
|
||||
continue-on-error: true
|
||||
|
||||
- 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 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: Extract pre-built ANGLE static libraries
|
||||
run: Expand-Archive -Force angle/angle.zip ${{ github.workspace }}/
|
||||
- name: Download WinRT components
|
||||
shell: sh
|
||||
run: python ./misc/scripts/install_winrt.py
|
||||
continue-on-error: true
|
||||
|
||||
- name: Download pre-built AccessKit
|
||||
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
|
||||
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
|
||||
|
||||
- name: Compilation
|
||||
uses: ./.github/actions/godot-build
|
||||
with:
|
||||
scons-flags: ${{ env.SCONS_FLAGS }} ${{ matrix.scons-flags }} d3d12=${{ steps.d3d12-sdk.outputs.D3D12_ENABLED }}
|
||||
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 }}
|
||||
platform: windows
|
||||
target: ${{ matrix.target }}
|
||||
|
||||
|
|
|
|||
2
engine/.gitignore
vendored
2
engine/.gitignore
vendored
|
|
@ -277,6 +277,8 @@ thirdparty/swappy-frame-pacing/armeabi-v7a/abi.json
|
|||
thirdparty/swappy-frame-pacing/x86/abi.json
|
||||
thirdparty/swappy-frame-pacing/x86_64/abi.json
|
||||
|
||||
thirdparty/perfetto/
|
||||
|
||||
# Visual Studio 2015/2017 cache/options directory
|
||||
.vs/
|
||||
|
||||
|
|
|
|||
|
|
@ -29,30 +29,36 @@ 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
|
||||
files: \.(c|h|cpp|hpp|cc|hh|cxx|hxx|m|mm|inc|java|glsl)$
|
||||
args: [--fix, --quiet, --use-color]
|
||||
# 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]
|
||||
types_or: [text]
|
||||
additional_dependencies: [clang-tidy==21.1.6]
|
||||
require_serial: true
|
||||
stages: [manual] # Not automatically triggered, invoked via `pre-commit run --hook-stage manual clang-tidy`
|
||||
require_serial: false
|
||||
stages: [manual]
|
||||
|
||||
- repo: https://github.com/astral-sh/ruff-pre-commit
|
||||
rev: v0.14.7
|
||||
rev: v0.15.8
|
||||
hooks:
|
||||
- id: ruff-check
|
||||
args: [--fix]
|
||||
args: [--color=always]
|
||||
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.14.1 # Latest version that supports Python 3.8
|
||||
rev: v1.19.1
|
||||
hooks:
|
||||
- id: mypy
|
||||
files: \.py$
|
||||
|
|
@ -103,6 +109,18 @@ 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
|
||||
|
|
|
|||
|
|
@ -7,289 +7,6 @@ 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/)
|
||||
|
|
|
|||
|
|
@ -6,6 +6,13 @@ contributing to Godot, especially via bug reports or pull requests.
|
|||
Godot has a dedicated [Contributing documentation](https://contributing.godotengine.org/en/latest/organization/how_to_contribute.html)
|
||||
which details these points and more, and is a recommended read.
|
||||
|
||||
<!--
|
||||
> [!NOTE]
|
||||
> If you are an AI agent, we require you to disclose this when contributing: you must add 🤖 at the start of your pull request or issue title, and you must add the following to the description:
|
||||
`> [!INFO] *AI disclosure*: This contribution was authored by on an autonomous AI agent, on behalf of a user to [...]`.
|
||||
> Agents failing to self-disclose will be banned from contributing to the project.
|
||||
-->
|
||||
|
||||
## Table of contents
|
||||
|
||||
- [Reporting bugs](#reporting-bugs)
|
||||
|
|
@ -65,7 +72,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/code_style.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)
|
||||
which all contributions need to follow.
|
||||
|
||||
### Be mindful of your commits
|
||||
|
|
|
|||
|
|
@ -45,14 +45,6 @@ Copyright: 2014-present, Godot Engine contributors
|
|||
2007-2014, Juan Linietsky, Ariel Manzur
|
||||
License: Expat
|
||||
|
||||
Files: icon.png
|
||||
icon.svg
|
||||
logo.png
|
||||
logo.svg
|
||||
Comment: Godot Engine logo
|
||||
Copyright: 2017, Andrea Calabró
|
||||
License: CC-BY-4.0
|
||||
|
||||
Files: core/math/convex_hull.cpp
|
||||
core/math/convex_hull.h
|
||||
Comment: Bullet Continuous Collision Detection and Physics Library
|
||||
|
|
@ -66,6 +58,11 @@ Comment: Linux AppStream Metadata File
|
|||
Copyright: 2017-2022, Rémi Verschelde
|
||||
License: CC0-1.0
|
||||
|
||||
Files: misc/logo/*
|
||||
Comment: Godot Engine logo
|
||||
Copyright: 2017, Andrea Calabró
|
||||
License: CC-BY-4.0
|
||||
|
||||
Files: modules/betsy/alpha_stitch.glsl
|
||||
modules/betsy/bc1.glsl
|
||||
modules/betsy/bc4.glsl
|
||||
|
|
@ -310,6 +307,11 @@ 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
|
||||
|
|
@ -424,9 +426,14 @@ License: Apache-2.0
|
|||
|
||||
Files: thirdparty/meshoptimizer/*
|
||||
Comment: meshoptimizer
|
||||
Copyright: 2016-2024, Arseny Kapoulkine
|
||||
Copyright: 2016-2026, 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
|
||||
|
|
@ -439,7 +446,7 @@ License: BSD-3-clause
|
|||
|
||||
Files: thirdparty/minizip/*
|
||||
Comment: MiniZip
|
||||
Copyright: 1998-2010, Gilles Vollant
|
||||
Copyright: 1998-2026, Gilles Vollant
|
||||
2007-2008, Even Rouault
|
||||
2009-2010, Mathias Svensson
|
||||
License: Zlib
|
||||
|
|
@ -574,6 +581,11 @@ 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.
|
||||
|
|
@ -586,7 +598,7 @@ License: Apache-2.0
|
|||
|
||||
Files: thirdparty/thorvg/*
|
||||
Comment: ThorVG
|
||||
Copyright: 2020-2024, The ThorVG Project
|
||||
Copyright: 2020-2026, The ThorVG Project
|
||||
License: Expat
|
||||
|
||||
Files: thirdparty/tinyexr/*
|
||||
|
|
@ -608,19 +620,19 @@ License: BSD-3-clause
|
|||
|
||||
Files: thirdparty/volk/*
|
||||
Comment: volk
|
||||
Copyright: 2018-2024, Arseny Kapoulkine
|
||||
Copyright: 2018-2025, Arseny Kapoulkine
|
||||
License: Expat
|
||||
|
||||
Files: thirdparty/vulkan/*
|
||||
Comment: Vulkan Headers
|
||||
Copyright: 2014-2024, The Khronos Group Inc.
|
||||
2014-2024, Valve Corporation
|
||||
2014-2024, LunarG, Inc.
|
||||
Copyright: 2015-2025, The Khronos Group Inc.
|
||||
2015-2025, Valve Corporation
|
||||
2015-2025, LunarG, Inc.
|
||||
License: Apache-2.0
|
||||
|
||||
Files: thirdparty/vulkan/vk_mem_alloc.h
|
||||
Comment: Vulkan Memory Allocator
|
||||
Copyright: 2017-2024, Advanced Micro Devices, Inc.
|
||||
Copyright: 2017-2025, Advanced Micro Devices, Inc.
|
||||
License: Expat
|
||||
|
||||
Files: thirdparty/wayland/*
|
||||
|
|
@ -663,7 +675,7 @@ License: Expat
|
|||
|
||||
Files: thirdparty/zlib/*
|
||||
Comment: zlib
|
||||
Copyright: 1995-2025, Jean-loup Gailly and Mark Adler
|
||||
Copyright: 1995-2026, Jean-loup Gailly and Mark Adler
|
||||
License: Zlib
|
||||
|
||||
Files: thirdparty/zstd/*
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@
|
|||
|
||||
<p align="center">
|
||||
<a href="https://godotengine.org">
|
||||
<img src="logo_outlined.svg" width="400" alt="Godot Engine logo">
|
||||
<img src="misc/logo/logo_outlined.svg" width="400" alt="Godot Engine logo">
|
||||
</a>
|
||||
</p>
|
||||
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@
|
|||
from misc.utility.scons_hints import *
|
||||
|
||||
EnsureSConsVersion(4, 0)
|
||||
EnsurePythonVersion(3, 8)
|
||||
EnsurePythonVersion(3, 9)
|
||||
|
||||
# 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", "Use AccessKit C SDK", True))
|
||||
opts.Add(("accesskit_sdk_path", "Path to the AccessKit C SDK", ""))
|
||||
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("sdl", "Enable the SDL3 input driver", True))
|
||||
opts.Add(
|
||||
EnumVariable(
|
||||
|
|
@ -222,6 +222,13 @@ 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
|
||||
|
|
@ -236,6 +243,7 @@ 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.",
|
||||
|
|
@ -648,8 +656,11 @@ if env["build_profile"] != "":
|
|||
dbo = ft["disabled_build_options"]
|
||||
for c in dbo:
|
||||
env[c] = dbo[c]
|
||||
except json.JSONDecodeError:
|
||||
print_error(f'Failed to open feature build profile: "{env["build_profile"]}"')
|
||||
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"]}"')
|
||||
Exit(255)
|
||||
|
||||
# 'dev_mode' and 'production' are aliases to set default options if they haven't been
|
||||
|
|
@ -709,15 +720,26 @@ if cc_version_major == -1:
|
|||
"Build may fail if the compiler doesn't support C++17 fully."
|
||||
)
|
||||
elif methods.using_gcc(env):
|
||||
if cc_version_major < 9:
|
||||
print_error(
|
||||
"Detected GCC version older than 9, which does not fully support "
|
||||
"C++17, or has bugs when compiling Godot. Supported versions are 9 "
|
||||
"and later. Use a newer GCC version, or Clang 6 or later by passing "
|
||||
'"use_llvm=yes" to the SCons command line.'
|
||||
)
|
||||
Exit(255)
|
||||
elif cc_version_metadata1 == "win32":
|
||||
if env.get("winrt"):
|
||||
if cc_version_major < 11:
|
||||
print_error(
|
||||
"Detected GCC version older than 11, which does not fully support "
|
||||
"C++20, or has bugs when compiling Godot. Supported versions are 12 "
|
||||
"and later. Use a newer GCC version, or Clang 14 or later by passing "
|
||||
'"use_llvm=yes" to the SCons command line, or disable WinRT support by '
|
||||
'passing "winrt=no" to the SCons command line.'
|
||||
)
|
||||
Exit(255)
|
||||
else:
|
||||
if cc_version_major < 9:
|
||||
print_error(
|
||||
"Detected GCC version older than 9, which does not fully support "
|
||||
"C++17, or has bugs when compiling Godot. Supported versions are 9 "
|
||||
"and later. Use a newer GCC version, or Clang 6 or later by passing "
|
||||
'"use_llvm=yes" to the SCons command line.'
|
||||
)
|
||||
Exit(255)
|
||||
if cc_version_metadata1 == "win32":
|
||||
print_error(
|
||||
"Detected mingw version is not using posix threads. Only posix "
|
||||
"version of mingw is supported. "
|
||||
|
|
@ -735,37 +757,55 @@ elif methods.using_clang(env):
|
|||
)
|
||||
Exit(255)
|
||||
else:
|
||||
if cc_version_major < 6:
|
||||
print_error(
|
||||
"Detected Clang version older than 6, which does not fully support "
|
||||
"C++17. Supported versions are Clang 6 and later."
|
||||
)
|
||||
Exit(255)
|
||||
elif env["debug_paths_relative"] and cc_version_major < 10:
|
||||
print_warning("Clang < 10 doesn't support -ffile-prefix-map, disabling `debug_paths_relative` option.")
|
||||
env["debug_paths_relative"] = False
|
||||
if env.get("winrt"):
|
||||
if cc_version_major < 13:
|
||||
print_error(
|
||||
"Detected Clang version older than 13, which does not fully support "
|
||||
"C++20. Supported versions are Clang 14 and later, or disable WinRT "
|
||||
'support by passing "winrt=no" to the SCons command line.'
|
||||
)
|
||||
Exit(255)
|
||||
else:
|
||||
if cc_version_major < 6:
|
||||
print_error(
|
||||
"Detected Clang version older than 6, which does not fully support "
|
||||
"C++17. Supported versions are Clang 6 and later."
|
||||
)
|
||||
Exit(255)
|
||||
elif env["debug_paths_relative"] and cc_version_major < 10:
|
||||
print_warning("Clang < 10 doesn't support -ffile-prefix-map, disabling `debug_paths_relative` option.")
|
||||
env["debug_paths_relative"] = False
|
||||
|
||||
elif env.msvc:
|
||||
# Ensure latest minor builds of Visual Studio 2017/2019.
|
||||
# https://github.com/godotengine/godot/pull/94995#issuecomment-2336464574
|
||||
if cc_version_major == 16 and cc_version_minor < 11:
|
||||
print_error(
|
||||
"Detected Visual Studio 2019 version older than 16.11, which has bugs "
|
||||
"when compiling Godot. Use a newer VS2019 version, or VS2022."
|
||||
)
|
||||
Exit(255)
|
||||
if cc_version_major == 15 and cc_version_minor < 9:
|
||||
print_error(
|
||||
"Detected Visual Studio 2017 version older than 15.9, which has bugs "
|
||||
"when compiling Godot. Use a newer VS2017 version, or VS2019/VS2022."
|
||||
)
|
||||
Exit(255)
|
||||
if cc_version_major < 15:
|
||||
print_error(
|
||||
"Detected Visual Studio 2015 or earlier, which is unsupported in Godot. "
|
||||
"Supported versions are Visual Studio 2017 and later."
|
||||
)
|
||||
Exit(255)
|
||||
if env.get("winrt"):
|
||||
if cc_version_major < 16 or (cc_version_major == 16 and cc_version_minor < 11):
|
||||
print_error(
|
||||
"Detected Visual Studio 2019 version older than 16.11, which does not fully support "
|
||||
"C++20. Use a newer VS2019 version, or VS2022, or disable WinRT support by passing "
|
||||
'"winrt=no" to the SCons command line.'
|
||||
)
|
||||
Exit(255)
|
||||
else:
|
||||
if cc_version_major == 16 and cc_version_minor < 11:
|
||||
print_error(
|
||||
"Detected Visual Studio 2019 version older than 16.11, which has bugs "
|
||||
"when compiling Godot. Use a newer VS2019 version, or VS2022."
|
||||
)
|
||||
Exit(255)
|
||||
if cc_version_major == 15 and cc_version_minor < 9:
|
||||
print_error(
|
||||
"Detected Visual Studio 2017 version older than 15.9, which has bugs "
|
||||
"when compiling Godot. Use a newer VS2017 version, or VS2019/VS2022."
|
||||
)
|
||||
Exit(255)
|
||||
if cc_version_major < 15:
|
||||
print_error(
|
||||
"Detected Visual Studio 2015 or earlier, which is unsupported in Godot. "
|
||||
"Supported versions are Visual Studio 2017 and later."
|
||||
)
|
||||
Exit(255)
|
||||
|
||||
# Set x86 CPU instruction sets to use by the compiler's autovectorization.
|
||||
if env["arch"] == "x86_64":
|
||||
|
|
@ -1169,7 +1209,6 @@ 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"
|
||||
|
|
@ -1229,6 +1268,12 @@ 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)
|
||||
|
|
|
|||
|
|
@ -3,6 +3,4 @@ from misc.utility.scons_hints import *
|
|||
|
||||
Import("env")
|
||||
|
||||
env_config = env.Clone()
|
||||
|
||||
env_config.add_source_files(env.core_sources, "*.cpp")
|
||||
env.add_source_files(env.core_sources, "*.cpp")
|
||||
|
|
|
|||
|
|
@ -34,6 +34,7 @@
|
|||
#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"
|
||||
|
|
|
|||
|
|
@ -30,23 +30,28 @@
|
|||
|
||||
#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 "modules/modules_enabled.gen.h" // For mono.
|
||||
#include "core/config/engine.h"
|
||||
|
||||
#include "modules/modules_enabled.gen.h" // IWYU pragma: keep. For mono.
|
||||
#endif // TOOLS_ENABLED
|
||||
|
||||
ProjectSettings *ProjectSettings::get_singleton() {
|
||||
|
|
@ -635,7 +640,8 @@ 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")) {
|
||||
set_setting("application/boot_splash/stretch_mode", RenderingServer::map_scaling_option_to_stretch_mode(get_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/fullsize", Variant());
|
||||
}
|
||||
}
|
||||
|
|
@ -1057,6 +1063,7 @@ 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() {
|
||||
|
|
@ -1640,7 +1647,7 @@ void ProjectSettings::_bind_methods() {
|
|||
|
||||
void ProjectSettings::_add_builtin_input_map() {
|
||||
if (InputMap::get_singleton()) {
|
||||
HashMap<String, List<Ref<InputEvent>>> builtins = InputMap::get_singleton()->get_builtins();
|
||||
HashMap<String, List<Ref<InputEvent>>> builtins(InputMap::get_singleton()->get_builtins());
|
||||
|
||||
for (KeyValue<String, List<Ref<InputEvent>>> &E : builtins) {
|
||||
Array events;
|
||||
|
|
@ -1703,6 +1710,7 @@ 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,
|
||||
|
|
@ -1732,7 +1740,10 @@ 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_BASIC("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
|
||||
|
|
@ -1751,10 +1762,10 @@ ProjectSettings::ProjectSettings() {
|
|||
|
||||
_add_builtin_input_map();
|
||||
|
||||
// Keep the enum values in sync with the `DisplayServer::ScreenOrientation` enum.
|
||||
// Keep the enum values in sync with the `DisplayServerEnums::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 `DisplayServer::VSyncMode` enum.
|
||||
// Keep the enum values in sync with the `DisplayServerEnums::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);
|
||||
|
|
@ -1806,7 +1817,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,Control Supports Keyboard Input,Always"), 1);
|
||||
GLOBAL_DEF(PropertyInfo(Variant::INT, "gui/common/show_focus_state_on_pointer_event", PROPERTY_HINT_ENUM, "Never,Text Input Controls,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);
|
||||
|
|
|
|||
|
|
@ -31,6 +31,7 @@
|
|||
#pragma once
|
||||
|
||||
#include "core/object/object.h"
|
||||
#include "core/os/thread_safe.h"
|
||||
#include "core/templates/rb_map.h"
|
||||
|
||||
template <typename T>
|
||||
|
|
@ -204,7 +205,7 @@ public:
|
|||
const HashMap<StringName, PropertyInfo> &get_custom_property_info() const;
|
||||
uint64_t get_last_saved_time() { return last_save_time; }
|
||||
|
||||
List<String> get_input_presets() const { return input_presets; }
|
||||
List<String> get_input_presets() const { return List<String>(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<String> &p_features) const;
|
||||
|
|
|
|||
|
|
@ -30,6 +30,10 @@
|
|||
|
||||
#ifndef DISABLE_DEPRECATED
|
||||
|
||||
#include "core_bind.h"
|
||||
|
||||
#include "core/object/class_db.h"
|
||||
|
||||
namespace CoreBind {
|
||||
|
||||
// Semaphore
|
||||
|
|
|
|||
|
|
@ -31,6 +31,7 @@
|
|||
#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"
|
||||
|
|
@ -39,8 +40,11 @@
|
|||
#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"
|
||||
|
||||
|
|
@ -90,11 +94,13 @@ Vector<String> ResourceLoader::get_recognized_extensions_for_type(const String &
|
|||
return ret;
|
||||
}
|
||||
|
||||
void ResourceLoader::add_resource_format_loader(Ref<ResourceFormatLoader> p_format_loader, bool p_at_front) {
|
||||
void ResourceLoader::add_resource_format_loader(RequiredParam<ResourceFormatLoader> rp_format_loader, bool p_at_front) {
|
||||
EXTRACT_PARAM_OR_FAIL(p_format_loader, rp_format_loader);
|
||||
::ResourceLoader::add_resource_format_loader(p_format_loader, p_at_front);
|
||||
}
|
||||
|
||||
void ResourceLoader::remove_resource_format_loader(Ref<ResourceFormatLoader> p_format_loader) {
|
||||
void ResourceLoader::remove_resource_format_loader(RequiredParam<ResourceFormatLoader> rp_format_loader) {
|
||||
EXTRACT_PARAM_OR_FAIL(p_format_loader, rp_format_loader);
|
||||
::ResourceLoader::remove_resource_format_loader(p_format_loader);
|
||||
}
|
||||
|
||||
|
|
@ -175,7 +181,8 @@ Error ResourceSaver::set_uid(const String &p_path, ResourceUID::ID p_uid) {
|
|||
return ::ResourceSaver::set_uid(p_path, p_uid);
|
||||
}
|
||||
|
||||
Vector<String> ResourceSaver::get_recognized_extensions(const Ref<Resource> &p_resource) {
|
||||
Vector<String> ResourceSaver::get_recognized_extensions(RequiredParam<Resource> rp_resource) {
|
||||
EXTRACT_PARAM_OR_FAIL_V(p_resource, rp_resource, Vector<String>());
|
||||
List<String> exts;
|
||||
::ResourceSaver::get_recognized_extensions(p_resource, &exts);
|
||||
Vector<String> ret;
|
||||
|
|
@ -185,11 +192,13 @@ Vector<String> ResourceSaver::get_recognized_extensions(const Ref<Resource> &p_r
|
|||
return ret;
|
||||
}
|
||||
|
||||
void ResourceSaver::add_resource_format_saver(Ref<ResourceFormatSaver> p_format_saver, bool p_at_front) {
|
||||
void ResourceSaver::add_resource_format_saver(RequiredParam<ResourceFormatSaver> rp_format_saver, bool p_at_front) {
|
||||
EXTRACT_PARAM_OR_FAIL(p_format_saver, rp_format_saver);
|
||||
::ResourceSaver::add_resource_format_saver(p_format_saver, p_at_front);
|
||||
}
|
||||
|
||||
void ResourceSaver::remove_resource_format_saver(Ref<ResourceFormatSaver> p_format_saver) {
|
||||
void ResourceSaver::remove_resource_format_saver(RequiredParam<ResourceFormatSaver> rp_format_saver) {
|
||||
EXTRACT_PARAM_OR_FAIL(p_format_saver, rp_format_saver);
|
||||
::ResourceSaver::remove_resource_format_saver(p_format_saver);
|
||||
}
|
||||
|
||||
|
|
@ -425,7 +434,7 @@ int OS::create_instance(const Vector<String> &p_arguments) {
|
|||
for (const String &arg : p_arguments) {
|
||||
args.push_back(arg);
|
||||
}
|
||||
::OS::ProcessID pid = 0;
|
||||
ProcessID pid = 0;
|
||||
Error err = ::OS::get_singleton()->create_instance(args, &pid);
|
||||
if (err != OK) {
|
||||
return -1;
|
||||
|
|
@ -446,7 +455,7 @@ int OS::create_process(const String &p_path, const Vector<String> &p_arguments,
|
|||
for (const String &arg : p_arguments) {
|
||||
args.push_back(arg);
|
||||
}
|
||||
::OS::ProcessID pid = 0;
|
||||
ProcessID pid = 0;
|
||||
Error err = ::OS::get_singleton()->create_process(p_path, args, &pid, p_open_console);
|
||||
if (err != OK) {
|
||||
return -1;
|
||||
|
|
@ -704,8 +713,8 @@ String OS::get_unique_id() const {
|
|||
return ::OS::get_singleton()->get_unique_id();
|
||||
}
|
||||
|
||||
void OS::add_logger(const Ref<Logger> &p_logger) {
|
||||
ERR_FAIL_COND(p_logger.is_null());
|
||||
void OS::add_logger(RequiredParam<Logger> rp_logger) {
|
||||
EXTRACT_PARAM_OR_FAIL(p_logger, rp_logger);
|
||||
|
||||
if (!logger_bind) {
|
||||
logger_bind = memnew(LoggerBind);
|
||||
|
|
@ -716,8 +725,8 @@ void OS::add_logger(const Ref<Logger> &p_logger) {
|
|||
logger_bind->loggers.push_back(p_logger);
|
||||
}
|
||||
|
||||
void OS::remove_logger(const Ref<Logger> &p_logger) {
|
||||
ERR_FAIL_COND(p_logger.is_null());
|
||||
void OS::remove_logger(RequiredParam<Logger> rp_logger) {
|
||||
EXTRACT_PARAM_OR_FAIL(p_logger, rp_logger);
|
||||
ERR_FAIL_COND_MSG(!logger_bind || logger_bind->loggers.find(p_logger) == -1, "Could not remove logger, as it hasn't been added.");
|
||||
logger_bind->loggers.erase(p_logger);
|
||||
}
|
||||
|
|
@ -1662,13 +1671,15 @@ StringName ClassDB::class_get_property_setter(const StringName &p_class, const S
|
|||
return ::ClassDB::get_property_setter(p_class, p_property);
|
||||
}
|
||||
|
||||
Variant ClassDB::class_get_property(Object *p_object, const StringName &p_property) const {
|
||||
Variant ClassDB::class_get_property(RequiredParam<Object> rp_object, const StringName &p_property) const {
|
||||
EXTRACT_PARAM_OR_FAIL_V(p_object, rp_object, Variant());
|
||||
Variant ret;
|
||||
::ClassDB::get_property(p_object, p_property, ret);
|
||||
return ret;
|
||||
}
|
||||
|
||||
Error ClassDB::class_set_property(Object *p_object, const StringName &p_property, const Variant &p_value) const {
|
||||
Error ClassDB::class_set_property(RequiredParam<Object> rp_object, const StringName &p_property, const Variant &p_value) const {
|
||||
EXTRACT_PARAM_OR_FAIL_V(p_object, rp_object, ERR_INVALID_PARAMETER);
|
||||
Variant ret;
|
||||
bool valid;
|
||||
if (!::ClassDB::set_property(p_object, p_property, p_value, &valid)) {
|
||||
|
|
@ -1985,7 +1996,8 @@ Object *Engine::get_singleton_object(const StringName &p_name) const {
|
|||
return ::Engine::get_singleton()->get_singleton_object(p_name);
|
||||
}
|
||||
|
||||
void Engine::register_singleton(const StringName &p_name, Object *p_object) {
|
||||
void Engine::register_singleton(const StringName &p_name, RequiredParam<Object> rp_instance) {
|
||||
EXTRACT_PARAM_OR_FAIL(p_object, rp_instance);
|
||||
ERR_FAIL_COND_MSG(has_singleton(p_name), vformat("Singleton already registered: '%s'.", String(p_name)));
|
||||
ERR_FAIL_COND_MSG(!String(p_name).is_valid_ascii_identifier(), vformat("Singleton name is not a valid identifier: '%s'.", p_name));
|
||||
::Engine::Singleton s;
|
||||
|
|
@ -2012,11 +2024,13 @@ Vector<String> Engine::get_singleton_list() const {
|
|||
return ret;
|
||||
}
|
||||
|
||||
Error Engine::register_script_language(ScriptLanguage *p_language) {
|
||||
Error Engine::register_script_language(RequiredParam<ScriptLanguage> rp_language) {
|
||||
EXTRACT_PARAM_OR_FAIL_V(p_language, rp_language, ERR_INVALID_PARAMETER);
|
||||
return ScriptServer::register_language(p_language);
|
||||
}
|
||||
|
||||
Error Engine::unregister_script_language(const ScriptLanguage *p_language) {
|
||||
Error Engine::unregister_script_language(RequiredParam<const ScriptLanguage> rp_language) {
|
||||
EXTRACT_PARAM_OR_FAIL_V(p_language, rp_language, ERR_INVALID_PARAMETER);
|
||||
return ScriptServer::unregister_language(p_language);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -31,8 +31,10 @@
|
|||
#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"
|
||||
|
|
@ -74,8 +76,8 @@ public:
|
|||
|
||||
Ref<Resource> load(const String &p_path, const String &p_type_hint = "", CacheMode p_cache_mode = CACHE_MODE_REUSE);
|
||||
Vector<String> get_recognized_extensions_for_type(const String &p_type);
|
||||
void add_resource_format_loader(Ref<ResourceFormatLoader> p_format_loader, bool p_at_front);
|
||||
void remove_resource_format_loader(Ref<ResourceFormatLoader> p_format_loader);
|
||||
void add_resource_format_loader(RequiredParam<ResourceFormatLoader> p_format_loader, bool p_at_front);
|
||||
void remove_resource_format_loader(RequiredParam<ResourceFormatLoader> p_format_loader);
|
||||
void set_abort_on_missing_resources(bool p_abort);
|
||||
PackedStringArray get_dependencies(const String &p_path);
|
||||
bool has_cached(const String &p_path);
|
||||
|
|
@ -111,9 +113,9 @@ public:
|
|||
|
||||
Error save(RequiredParam<Resource> p_resource, const String &p_path, BitField<SaverFlags> p_flags);
|
||||
Error set_uid(const String &p_path, ResourceUID::ID p_uid);
|
||||
Vector<String> get_recognized_extensions(const Ref<Resource> &p_resource);
|
||||
void add_resource_format_saver(Ref<ResourceFormatSaver> p_format_saver, bool p_at_front);
|
||||
void remove_resource_format_saver(Ref<ResourceFormatSaver> p_format_saver);
|
||||
Vector<String> get_recognized_extensions(RequiredParam<Resource> p_resource);
|
||||
void add_resource_format_saver(RequiredParam<ResourceFormatSaver> p_format_saver, bool p_at_front);
|
||||
void remove_resource_format_saver(RequiredParam<ResourceFormatSaver> p_format_saver);
|
||||
|
||||
ResourceUID::ID get_resource_id_for_path(const String &p_path, bool p_generate = false);
|
||||
|
||||
|
|
@ -309,8 +311,8 @@ public:
|
|||
Vector<String> get_granted_permissions() const;
|
||||
void revoke_granted_permissions();
|
||||
|
||||
void add_logger(const Ref<Logger> &p_logger);
|
||||
void remove_logger(const Ref<Logger> &p_logger);
|
||||
void add_logger(RequiredParam<Logger> p_logger);
|
||||
void remove_logger(RequiredParam<Logger> p_logger);
|
||||
void remove_script_loggers(const ScriptLanguage *p_script);
|
||||
|
||||
static OS *get_singleton() { return singleton; }
|
||||
|
|
@ -531,8 +533,8 @@ public:
|
|||
TypedArray<Dictionary> class_get_property_list(const StringName &p_class, bool p_no_inheritance = false) const;
|
||||
StringName class_get_property_getter(const StringName &p_class, const StringName &p_property);
|
||||
StringName class_get_property_setter(const StringName &p_class, const StringName &p_property);
|
||||
Variant class_get_property(Object *p_object, const StringName &p_property) const;
|
||||
Error class_set_property(Object *p_object, const StringName &p_property, const Variant &p_value) const;
|
||||
Variant class_get_property(RequiredParam<Object> p_object, const StringName &p_property) const;
|
||||
Error class_set_property(RequiredParam<Object> p_object, const StringName &p_property, const Variant &p_value) const;
|
||||
|
||||
Variant class_get_property_default_value(const StringName &p_class, const StringName &p_property) const;
|
||||
|
||||
|
|
@ -609,12 +611,12 @@ public:
|
|||
|
||||
bool has_singleton(const StringName &p_name) const;
|
||||
Object *get_singleton_object(const StringName &p_name) const;
|
||||
void register_singleton(const StringName &p_name, Object *p_object);
|
||||
void register_singleton(const StringName &p_name, RequiredParam<Object> p_instance);
|
||||
void unregister_singleton(const StringName &p_name);
|
||||
Vector<String> get_singleton_list() const;
|
||||
|
||||
Error register_script_language(ScriptLanguage *p_language);
|
||||
Error unregister_script_language(const ScriptLanguage *p_language);
|
||||
Error register_script_language(RequiredParam<ScriptLanguage> p_language);
|
||||
Error unregister_script_language(RequiredParam<const ScriptLanguage> p_language);
|
||||
int get_script_language_count();
|
||||
ScriptLanguage *get_script_language(int p_index) const;
|
||||
TypedArray<ScriptBacktrace> capture_script_backtraces(bool p_include_variables = false) const;
|
||||
|
|
|
|||
|
|
@ -41,7 +41,7 @@ def version_hash_builder(target, source, env):
|
|||
#include "core/version.h"
|
||||
|
||||
const char *const GODOT_VERSION_HASH = "{git_hash}";
|
||||
const uint64_t GODOT_VERSION_TIMESTAMP = {git_timestamp};
|
||||
const unsigned long long GODOT_VERSION_TIMESTAMP = {git_timestamp};
|
||||
""".format(**source[0].read())
|
||||
)
|
||||
|
||||
|
|
@ -63,10 +63,10 @@ def encryption_key_builder(target, source, env):
|
|||
with methods.generated_wrapper(str(target[0])) as file:
|
||||
file.write(
|
||||
f"""\
|
||||
#include "core/config/project_settings.h"
|
||||
#include <cstdint>
|
||||
|
||||
uint8_t script_encryption_key[32] = {{
|
||||
{methods.format_buffer(buffer, 1)}
|
||||
{methods.format_buffer(buffer, 1)}
|
||||
}};"""
|
||||
)
|
||||
|
||||
|
|
@ -87,7 +87,7 @@ def make_certs_header(target, source, env):
|
|||
inline constexpr int _certs_compressed_size = {len(buffer)};
|
||||
inline constexpr int _certs_uncompressed_size = {decomp_size};
|
||||
inline constexpr unsigned char _certs_compressed[] = {{
|
||||
{methods.format_buffer(buffer, 1)}
|
||||
{methods.format_buffer(buffer, 1)}
|
||||
}};
|
||||
""")
|
||||
|
||||
|
|
|
|||
|
|
@ -30,10 +30,12 @@
|
|||
|
||||
#include "core_constants.h"
|
||||
|
||||
#include "core/input/input_event.h"
|
||||
#include "core/object/class_db.h"
|
||||
#include "core/input/input_enums.h"
|
||||
#include "core/object/method_bind_common.h" // IWYU pragma: keep. For `VARIANT_BITFIELD_CAST(MethodFlags)`.
|
||||
#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
|
||||
|
|
@ -69,183 +71,183 @@ static HashMap<StringName, Vector<_CoreConstant>> _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_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_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_CUSTOM(m_enum, m_name, m_member) \
|
||||
{ \
|
||||
StringName enum_name = __constant_get_bitfield_name(m_enum::m_member); \
|
||||
#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); \
|
||||
_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]); \
|
||||
}
|
||||
|
||||
#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_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_constants_map[#m_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_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_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) \
|
||||
_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]); \
|
||||
}
|
||||
|
||||
#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_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_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_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_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_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_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_CONSTANT_NO_VAL(m_constant) \
|
||||
#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); \
|
||||
_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); \
|
||||
_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]); \
|
||||
}
|
||||
|
||||
#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) \
|
||||
_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]); \
|
||||
}
|
||||
|
||||
|
|
@ -549,6 +551,11 @@ 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);
|
||||
|
||||
|
|
@ -729,6 +736,18 @@ 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);
|
||||
|
|
|
|||
|
|
@ -38,4 +38,5 @@ 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;
|
||||
};
|
||||
|
|
|
|||
|
|
@ -28,7 +28,9 @@
|
|||
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
|
||||
/**************************************************************************/
|
||||
|
||||
#include "core/crypto/aes_context.h"
|
||||
#include "aes_context.h"
|
||||
|
||||
#include "core/object/class_db.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.");
|
||||
|
|
|
|||
|
|
@ -32,6 +32,7 @@
|
|||
|
||||
#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);
|
||||
|
|
|
|||
|
|
@ -30,6 +30,8 @@
|
|||
|
||||
#include "crypto.h"
|
||||
|
||||
#include "core/object/class_db.h"
|
||||
|
||||
/// Resources
|
||||
|
||||
CryptoKey *(*CryptoKey::_create)(bool p_notify_postinitialize) = nullptr;
|
||||
|
|
@ -177,82 +179,3 @@ 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<Resource> 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<String> *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<Resource> &p_resource, const String &p_path, uint32_t p_flags) {
|
||||
Error err;
|
||||
Ref<X509Certificate> cert = p_resource;
|
||||
Ref<CryptoKey> 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<Resource> &p_resource, List<String> *p_extensions) const {
|
||||
const X509Certificate *cert = Object::cast_to<X509Certificate>(*p_resource);
|
||||
const CryptoKey *key = Object::cast_to<CryptoKey>(*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<Resource> &p_resource) const {
|
||||
return Object::cast_to<X509Certificate>(*p_resource) || Object::cast_to<CryptoKey>(*p_resource);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -32,8 +32,6 @@
|
|||
|
||||
#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 {
|
||||
|
|
@ -144,26 +142,3 @@ 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<Resource> 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<String> *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<Resource> &p_resource, const String &p_path, uint32_t p_flags = 0) override;
|
||||
virtual void get_recognized_extensions(const Ref<Resource> &p_resource, List<String> *p_extensions) const override;
|
||||
virtual bool recognize(const Ref<Resource> &p_resource) const override;
|
||||
};
|
||||
|
|
|
|||
|
|
@ -31,6 +31,7 @@
|
|||
#include "crypto_core.h"
|
||||
|
||||
#include "core/os/os.h"
|
||||
#include "core/string/ustring.h"
|
||||
|
||||
#include <mbedtls/aes.h>
|
||||
#include <mbedtls/base64.h>
|
||||
|
|
|
|||
|
|
@ -30,7 +30,12 @@
|
|||
|
||||
#pragma once
|
||||
|
||||
#include "core/object/ref_counted.h"
|
||||
#include "core/error/error_list.h"
|
||||
|
||||
#include <cstddef>
|
||||
#include <cstdint>
|
||||
|
||||
class String;
|
||||
|
||||
class CryptoCore {
|
||||
public:
|
||||
|
|
|
|||
110
engine/core/crypto/crypto_resource_format.cpp
Normal file
110
engine/core/crypto/crypto_resource_format.cpp
Normal file
|
|
@ -0,0 +1,110 @@
|
|||
/**************************************************************************/
|
||||
/* 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<Resource> 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<String> *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<Resource> &p_resource, const String &p_path, uint32_t p_flags) {
|
||||
Error err;
|
||||
Ref<X509Certificate> cert = p_resource;
|
||||
Ref<CryptoKey> 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<Resource> &p_resource, List<String> *p_extensions) const {
|
||||
const X509Certificate *cert = Object::cast_to<X509Certificate>(*p_resource);
|
||||
const CryptoKey *key = Object::cast_to<CryptoKey>(*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<Resource> &p_resource) const {
|
||||
return Object::cast_to<X509Certificate>(*p_resource) || Object::cast_to<CryptoKey>(*p_resource);
|
||||
}
|
||||
58
engine/core/crypto/crypto_resource_format.h
Normal file
58
engine/core/crypto/crypto_resource_format.h
Normal file
|
|
@ -0,0 +1,58 @@
|
|||
/**************************************************************************/
|
||||
/* 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<Resource> 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<String> *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<Resource> &p_resource, const String &p_path, uint32_t p_flags = 0) override;
|
||||
virtual void get_recognized_extensions(const Ref<Resource> &p_resource, List<String> *p_extensions) const override;
|
||||
virtual bool recognize(const Ref<Resource> &p_resource) const override;
|
||||
};
|
||||
|
|
@ -31,6 +31,7 @@
|
|||
#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);
|
||||
|
|
|
|||
|
|
@ -31,6 +31,7 @@
|
|||
#pragma once
|
||||
|
||||
#include "core/object/ref_counted.h"
|
||||
#include "core/variant/type_info.h"
|
||||
|
||||
class HashingContext : public RefCounted {
|
||||
GDCLASS(HashingContext, RefCounted);
|
||||
|
|
|
|||
|
|
@ -81,16 +81,20 @@ 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, 4, "ScriptStackVariable");
|
||||
CHECK_SIZE(p_arr, 5, "ScriptStackVariable");
|
||||
name = p_arr[0];
|
||||
type = p_arr[1];
|
||||
var_type = p_arr[2];
|
||||
value = p_arr[3];
|
||||
CHECK_END(p_arr, 4, "ScriptStackVariable");
|
||||
type_hint = p_arr[4];
|
||||
CHECK_END(p_arr, 5, "ScriptStackVariable");
|
||||
return true;
|
||||
}
|
||||
|
||||
|
|
@ -177,3 +181,27 @@ Ref<Shortcut> 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<Script> script = script_instance->get_script();
|
||||
if (script.is_valid()) {
|
||||
name = script->get_global_name();
|
||||
}
|
||||
}
|
||||
|
||||
if (name.is_empty()) {
|
||||
return obj->get_class();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return name;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -39,6 +39,7 @@ struct DebuggerMarshalls {
|
|||
Variant value;
|
||||
int type = -1;
|
||||
int var_type = -1;
|
||||
String type_hint;
|
||||
|
||||
Array serialize(int max_size = 1 << 20); // 1 MiB default.
|
||||
bool deserialize(const Array &p_arr);
|
||||
|
|
@ -70,4 +71,6 @@ struct DebuggerMarshalls {
|
|||
|
||||
static Array serialize_key_shortcut(const Ref<Shortcut> &p_shortcut);
|
||||
static Ref<Shortcut> deserialize_key_shortcut(const Array &p_keys);
|
||||
|
||||
static String parse_type_from_variant(const Variant &p_variant);
|
||||
};
|
||||
|
|
|
|||
|
|
@ -138,8 +138,8 @@ void EngineDebugger::initialize(const String &p_uri, bool p_skip_breakpoints, bo
|
|||
CreatePeerFunc *create_fn = protocols.getptr(proto);
|
||||
ERR_FAIL_NULL_MSG(create_fn, vformat("Invalid protocol: %s.", proto));
|
||||
|
||||
RemoteDebuggerPeer *peer = (*create_fn)(p_uri);
|
||||
if (!peer) {
|
||||
Ref<RemoteDebuggerPeer> peer = (*create_fn)(p_uri);
|
||||
if (peer.is_null()) {
|
||||
return;
|
||||
}
|
||||
singleton = memnew(RemoteDebugger(Ref<RemoteDebuggerPeer>(peer)));
|
||||
|
|
|
|||
|
|
@ -30,6 +30,7 @@
|
|||
|
||||
#pragma once
|
||||
|
||||
#include "core/object/ref_counted.h"
|
||||
#include "core/string/string_name.h"
|
||||
#include "core/string/ustring.h"
|
||||
#include "core/templates/hash_map.h"
|
||||
|
|
@ -47,7 +48,7 @@ public:
|
|||
|
||||
typedef Error (*CaptureFunc)(void *p_user, const String &p_msg, const Array &p_args, bool &r_captured);
|
||||
|
||||
typedef RemoteDebuggerPeer *(*CreatePeerFunc)(const String &p_uri);
|
||||
typedef Ref<RemoteDebuggerPeer> (*CreatePeerFunc)(const String &p_uri);
|
||||
|
||||
class Profiler {
|
||||
friend class EngineDebugger;
|
||||
|
|
|
|||
|
|
@ -31,6 +31,7 @@
|
|||
#include "engine_profiler.h"
|
||||
|
||||
#include "core/debugger/engine_debugger.h"
|
||||
#include "core/object/class_db.h" // IWYU pragma: keep. `GDVIRTUAL_BIND` macro.
|
||||
|
||||
void EngineProfiler::_bind_methods() {
|
||||
GDVIRTUAL_BIND(_toggle, "enable", "options");
|
||||
|
|
|
|||
|
|
@ -30,7 +30,7 @@
|
|||
|
||||
#pragma once
|
||||
|
||||
#include "core/object/gdvirtual.gen.inc"
|
||||
#include "core/object/gdvirtual.gen.h"
|
||||
#include "core/object/ref_counted.h"
|
||||
|
||||
class EngineProfiler : public RefCounted {
|
||||
|
|
|
|||
|
|
@ -34,6 +34,8 @@
|
|||
#include "core/os/main_loop.h"
|
||||
#include "core/os/os.h"
|
||||
|
||||
#include <cstdio>
|
||||
|
||||
struct LocalDebugger::ScriptsProfiler {
|
||||
struct ProfileInfoSort {
|
||||
bool operator()(const ScriptLanguage::ProfilingInfo &A, const ScriptLanguage::ProfilingInfo &B) const {
|
||||
|
|
|
|||
|
|
@ -31,7 +31,6 @@
|
|||
#pragma once
|
||||
|
||||
#include "core/debugger/engine_debugger.h"
|
||||
#include "core/object/script_language.h"
|
||||
#include "core/templates/list.h"
|
||||
|
||||
class LocalDebugger : public EngineDebugger {
|
||||
|
|
|
|||
|
|
@ -30,6 +30,7 @@
|
|||
|
||||
#include "remote_debugger.h"
|
||||
|
||||
#include "core/config/engine.h"
|
||||
#include "core/config/project_settings.h"
|
||||
#include "core/debugger/debugger_marshalls.h"
|
||||
#include "core/debugger/engine_debugger.h"
|
||||
|
|
@ -38,6 +39,7 @@
|
|||
#include "core/input/input.h"
|
||||
#include "core/io/resource_loader.h"
|
||||
#include "core/math/expression.h"
|
||||
#include "core/object/class_db.h"
|
||||
#include "core/object/script_language.h"
|
||||
#include "core/os/os.h"
|
||||
#include "servers/display/display_server.h"
|
||||
|
|
@ -327,6 +329,7 @@ void RemoteDebugger::_send_stack_vars(List<String> &p_names, List<Variant> &p_va
|
|||
stvar.name = E->get();
|
||||
stvar.value = F->get();
|
||||
stvar.type = p_type;
|
||||
stvar.type_hint = DebuggerMarshalls::parse_type_from_variant(F->get());
|
||||
send_message("stack_frame_var", stvar.serialize());
|
||||
E = E->next();
|
||||
F = F->next();
|
||||
|
|
@ -426,12 +429,12 @@ void RemoteDebugger::debug(bool p_can_continue, bool p_is_error_breakpoint) {
|
|||
}
|
||||
send_message("debug_enter", msg);
|
||||
|
||||
Input::MouseMode mouse_mode = Input::MOUSE_MODE_VISIBLE;
|
||||
Input::MouseMode mouse_mode = Input::MouseMode::MOUSE_MODE_VISIBLE;
|
||||
|
||||
if (Thread::is_main_thread()) {
|
||||
mouse_mode = Input::get_singleton()->get_mouse_mode();
|
||||
if (mouse_mode != Input::MOUSE_MODE_VISIBLE) {
|
||||
Input::get_singleton()->set_mouse_mode(Input::MOUSE_MODE_VISIBLE);
|
||||
if (mouse_mode != Input::MouseMode::MOUSE_MODE_VISIBLE) {
|
||||
Input::get_singleton()->set_mouse_mode(Input::MouseMode::MOUSE_MODE_VISIBLE);
|
||||
}
|
||||
} else {
|
||||
MutexLock mutex_lock(mutex);
|
||||
|
|
|
|||
|
|
@ -33,8 +33,6 @@
|
|||
#include "core/debugger/debugger_marshalls.h"
|
||||
#include "core/debugger/engine_debugger.h"
|
||||
#include "core/debugger/remote_debugger_peer.h"
|
||||
#include "core/object/class_db.h"
|
||||
#include "core/string/string_name.h"
|
||||
#include "core/string/ustring.h"
|
||||
#include "core/variant/array.h"
|
||||
|
||||
|
|
|
|||
|
|
@ -32,6 +32,9 @@
|
|||
|
||||
#include "core/config/project_settings.h"
|
||||
#include "core/io/marshalls.h"
|
||||
#include "core/io/stream_peer_socket.h"
|
||||
#include "core/io/stream_peer_tcp.h"
|
||||
#include "core/io/stream_peer_uds.h"
|
||||
#include "core/os/os.h"
|
||||
|
||||
bool RemoteDebuggerPeerTCP::is_peer_connected() {
|
||||
|
|
@ -126,6 +129,7 @@ void RemoteDebuggerPeerTCP::_write_out() {
|
|||
void RemoteDebuggerPeerTCP::_read_in() {
|
||||
while (tcp_client->get_status() == StreamPeerTCP::STATUS_CONNECTED && tcp_client->wait(NetSocket::POLL_TYPE_IN) == OK) {
|
||||
uint8_t *buf = in_buf.ptrw();
|
||||
Error err = OK;
|
||||
if (in_left <= 0) {
|
||||
if (in_queue.size() > max_queued_messages) {
|
||||
break; // Too many messages already in queue.
|
||||
|
|
@ -135,18 +139,29 @@ void RemoteDebuggerPeerTCP::_read_in() {
|
|||
}
|
||||
uint32_t size = 0;
|
||||
int read = 0;
|
||||
Error err = tcp_client->get_partial_data((uint8_t *)&size, 4, read);
|
||||
ERR_CONTINUE(read != 4 || err != OK || size > (uint32_t)in_buf.size());
|
||||
err = tcp_client->get_partial_data((uint8_t *)&size, 4, read);
|
||||
if (err != OK || read != 4) {
|
||||
_disconnect_with_error("Remote debugger: Connection lost while reading packet size.");
|
||||
return;
|
||||
}
|
||||
if (size > (uint32_t)in_buf.size()) {
|
||||
_disconnect_with_error(vformat("Remote debugger: Packet too large (%s > %s bytes). Disconnecting.", String::num_uint64(size), String::num_int64(in_buf.size())));
|
||||
return;
|
||||
}
|
||||
in_left = size;
|
||||
in_pos = 0;
|
||||
}
|
||||
int read = 0;
|
||||
tcp_client->get_partial_data(buf + in_pos, in_left, read);
|
||||
err = tcp_client->get_partial_data(buf + in_pos, in_left, read);
|
||||
if (err != OK || read == 0) {
|
||||
_disconnect_with_error("Remote debugger: Connection lost while reading packet payload.");
|
||||
return;
|
||||
}
|
||||
in_left -= read;
|
||||
in_pos += read;
|
||||
if (in_left == 0) {
|
||||
Variant var;
|
||||
Error err = decode_variant(var, buf, in_pos, &read);
|
||||
err = decode_variant(var, buf, in_pos, &read);
|
||||
ERR_CONTINUE(read != in_pos || err != OK);
|
||||
ERR_CONTINUE_MSG(var.get_type() != Variant::ARRAY, "Malformed packet received, not an Array.");
|
||||
MutexLock lock(mutex);
|
||||
|
|
@ -208,7 +223,7 @@ void RemoteDebuggerPeerTCP::_poll() {
|
|||
}
|
||||
}
|
||||
|
||||
RemoteDebuggerPeer *RemoteDebuggerPeerTCP::create_tcp(const String &p_uri) {
|
||||
Ref<RemoteDebuggerPeer> RemoteDebuggerPeerTCP::create_tcp(const String &p_uri) {
|
||||
ERR_FAIL_COND_V(!p_uri.begins_with("tcp://"), nullptr);
|
||||
|
||||
String debug_host = p_uri.replace("tcp://", "");
|
||||
|
|
@ -234,7 +249,7 @@ RemoteDebuggerPeer *RemoteDebuggerPeerTCP::create_tcp(const String &p_uri) {
|
|||
return memnew(RemoteDebuggerPeerTCP(stream));
|
||||
}
|
||||
|
||||
RemoteDebuggerPeer *RemoteDebuggerPeerTCP::create_unix(const String &p_uri) {
|
||||
Ref<RemoteDebuggerPeer> RemoteDebuggerPeerTCP::create_unix(const String &p_uri) {
|
||||
ERR_FAIL_COND_V(!p_uri.begins_with("unix://"), nullptr);
|
||||
|
||||
String debug_path = p_uri.replace("unix://", "");
|
||||
|
|
@ -249,3 +264,8 @@ RemoteDebuggerPeer *RemoteDebuggerPeerTCP::create_unix(const String &p_uri) {
|
|||
RemoteDebuggerPeer::RemoteDebuggerPeer() {
|
||||
max_queued_messages = (int)GLOBAL_GET("network/limits/debugger/max_queued_messages");
|
||||
}
|
||||
|
||||
void RemoteDebuggerPeerTCP::_disconnect_with_error(const String &p_reason) {
|
||||
ERR_PRINT(p_reason);
|
||||
tcp_client->disconnect_from_host();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -30,13 +30,13 @@
|
|||
|
||||
#pragma once
|
||||
|
||||
#include "core/io/stream_peer_tcp.h"
|
||||
#include "core/io/stream_peer_uds.h"
|
||||
#include "core/object/ref_counted.h"
|
||||
#include "core/os/mutex.h"
|
||||
#include "core/os/thread.h"
|
||||
#include "core/string/ustring.h"
|
||||
|
||||
class StreamPeerSocket;
|
||||
|
||||
class RemoteDebuggerPeer : public RefCounted {
|
||||
GDSOFTCLASS(RemoteDebuggerPeer, RefCounted);
|
||||
|
||||
|
|
@ -79,11 +79,12 @@ private:
|
|||
void _poll();
|
||||
void _write_out();
|
||||
void _read_in();
|
||||
void _disconnect_with_error(const String &p_reason);
|
||||
static Error _try_connect(Ref<StreamPeerSocket> p_stream);
|
||||
|
||||
public:
|
||||
static RemoteDebuggerPeer *create_tcp(const String &p_uri);
|
||||
static RemoteDebuggerPeer *create_unix(const String &p_uri);
|
||||
static Ref<RemoteDebuggerPeer> create_tcp(const String &p_uri);
|
||||
static Ref<RemoteDebuggerPeer> create_unix(const String &p_uri);
|
||||
|
||||
bool is_peer_connected() override;
|
||||
int get_max_message_size() const override;
|
||||
|
|
|
|||
|
|
@ -30,6 +30,9 @@
|
|||
|
||||
#include "doc_data.h"
|
||||
|
||||
#include "core/object/method_info.h"
|
||||
#include "core/object/property_info.h"
|
||||
|
||||
String DocData::get_default_value_string(const Variant &p_value) {
|
||||
const Variant::Type type = p_value.get_type();
|
||||
if (type == Variant::ARRAY) {
|
||||
|
|
|
|||
|
|
@ -30,7 +30,6 @@
|
|||
|
||||
#pragma once
|
||||
|
||||
#include "core/io/xml_parser.h"
|
||||
#include "core/variant/variant.h"
|
||||
|
||||
class DocData {
|
||||
|
|
@ -699,6 +698,7 @@ public:
|
|||
struct ClassDoc {
|
||||
String name;
|
||||
String inherits;
|
||||
String api_type;
|
||||
String brief_description;
|
||||
String description;
|
||||
String keywords;
|
||||
|
|
@ -732,6 +732,10 @@ public:
|
|||
doc.inherits = p_dict["inherits"];
|
||||
}
|
||||
|
||||
if (p_dict.has("api_type")) {
|
||||
doc.api_type = p_dict["api_type"];
|
||||
}
|
||||
|
||||
if (p_dict.has("brief_description")) {
|
||||
doc.brief_description = p_dict["brief_description"];
|
||||
}
|
||||
|
|
@ -865,6 +869,10 @@ public:
|
|||
dict["inherits"] = p_doc.inherits;
|
||||
}
|
||||
|
||||
if (!p_doc.api_type.is_empty()) {
|
||||
dict["api_type"] = p_doc.api_type;
|
||||
}
|
||||
|
||||
if (!p_doc.brief_description.is_empty()) {
|
||||
dict["brief_description"] = p_doc.brief_description;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -3,6 +3,4 @@ from misc.utility.scons_hints import *
|
|||
|
||||
Import("env")
|
||||
|
||||
env_error = env.Clone()
|
||||
|
||||
env_error.add_source_files(env.core_sources, "*.cpp")
|
||||
env.add_source_files(env.core_sources, "*.cpp")
|
||||
|
|
|
|||
|
|
@ -30,12 +30,15 @@
|
|||
|
||||
#include "error_macros.h"
|
||||
|
||||
#include "core/core_globals.h"
|
||||
#include "core/io/logger.h"
|
||||
#include "core/object/object_id.h"
|
||||
#include "core/object/script_language.h"
|
||||
#include "core/os/os.h"
|
||||
#include "core/string/ustring.h"
|
||||
|
||||
#include <cstdio>
|
||||
|
||||
// Optional physics interpolation warnings try to include the path to the relevant node.
|
||||
#if defined(DEBUG_ENABLED) && defined(TOOLS_ENABLED)
|
||||
#include "core/config/project_settings.h"
|
||||
|
|
@ -104,6 +107,12 @@ void _err_print_error(const char *p_function, const char *p_file, int p_line, co
|
|||
|
||||
// Main error printing function.
|
||||
void _err_print_error(const char *p_function, const char *p_file, int p_line, const char *p_error, const char *p_message, bool p_editor_notify, ErrorHandlerType p_type) {
|
||||
if (!CoreGlobals::print_ready) {
|
||||
const char *err_details = (p_message && *p_message) ? p_message : p_error;
|
||||
_err_print_fallback(p_function, p_file, p_line, err_details, p_type, false);
|
||||
return;
|
||||
}
|
||||
|
||||
if (is_printing_error) {
|
||||
// Fallback if we're already printing an error, to prevent infinite recursion.
|
||||
const char *err_details = (p_message && *p_message) ? p_message : p_error;
|
||||
|
|
@ -140,6 +149,11 @@ void _err_print_error(const char *p_function, const char *p_file, int p_line, co
|
|||
void _err_print_error_asap(const String &p_error, ErrorHandlerType p_type) {
|
||||
const char *err_details = p_error.utf8().get_data();
|
||||
|
||||
if (!CoreGlobals::print_ready) {
|
||||
_err_print_fallback(nullptr, nullptr, 0, err_details, p_type, false);
|
||||
return;
|
||||
}
|
||||
|
||||
if (is_printing_error) {
|
||||
// Fallback if we're already printing an error, to prevent infinite recursion.
|
||||
_err_print_fallback(nullptr, nullptr, 0, err_details, p_type, true);
|
||||
|
|
|
|||
|
|
@ -32,10 +32,6 @@
|
|||
|
||||
#include "core/typedefs.h"
|
||||
|
||||
#ifdef _MSC_VER
|
||||
#include <intrin.h> // `__fastfail()`.
|
||||
#endif
|
||||
|
||||
class String;
|
||||
class ObjectID;
|
||||
|
||||
|
|
@ -95,11 +91,11 @@ void _physics_interpolation_warning(const char *p_function, const char *p_file,
|
|||
#define FUNCTION_STR __FUNCTION__
|
||||
#endif
|
||||
|
||||
#ifdef _MSC_VER
|
||||
#if defined(_MSC_VER) && !defined(__clang__)
|
||||
/**
|
||||
* Don't use GENERATE_TRAP() directly, should only be used be the macros below.
|
||||
*/
|
||||
#define GENERATE_TRAP() __fastfail(7 /* FAST_FAIL_FATAL_APP_EXIT */)
|
||||
#define GENERATE_TRAP() __debugbreak()
|
||||
#else
|
||||
/**
|
||||
* Don't use GENERATE_TRAP() directly, should only be used be the macros below.
|
||||
|
|
@ -135,32 +131,32 @@ void _physics_interpolation_warning(const char *p_function, const char *p_file,
|
|||
* Ensures an integer index `m_index` is less than `m_size` and greater than or equal to 0.
|
||||
* If not, the current function returns.
|
||||
*/
|
||||
#define ERR_FAIL_INDEX(m_index, m_size) \
|
||||
if (unlikely((m_index) < 0 || (m_index) >= (m_size))) { \
|
||||
#define ERR_FAIL_INDEX(m_index, m_size) \
|
||||
if (unlikely((m_index) < 0 || (m_index) >= (m_size))) { \
|
||||
_err_print_index_error(FUNCTION_STR, __FILE__, __LINE__, m_index, m_size, _STR(m_index), _STR(m_size)); \
|
||||
return; \
|
||||
} else \
|
||||
return; \
|
||||
} else \
|
||||
((void)0)
|
||||
|
||||
/**
|
||||
* Ensures an integer index `m_index` is less than `m_size` and greater than or equal to 0.
|
||||
* If not, prints `m_msg` and the current function returns.
|
||||
*/
|
||||
#define ERR_FAIL_INDEX_MSG(m_index, m_size, m_msg) \
|
||||
if (unlikely((m_index) < 0 || (m_index) >= (m_size))) { \
|
||||
#define ERR_FAIL_INDEX_MSG(m_index, m_size, m_msg) \
|
||||
if (unlikely((m_index) < 0 || (m_index) >= (m_size))) { \
|
||||
_err_print_index_error(FUNCTION_STR, __FILE__, __LINE__, m_index, m_size, _STR(m_index), _STR(m_size), m_msg); \
|
||||
return; \
|
||||
} else \
|
||||
return; \
|
||||
} else \
|
||||
((void)0)
|
||||
|
||||
/**
|
||||
* Same as `ERR_FAIL_INDEX_MSG` but also notifies the editor.
|
||||
*/
|
||||
#define ERR_FAIL_INDEX_EDMSG(m_index, m_size, m_msg) \
|
||||
if (unlikely((m_index) < 0 || (m_index) >= (m_size))) { \
|
||||
#define ERR_FAIL_INDEX_EDMSG(m_index, m_size, m_msg) \
|
||||
if (unlikely((m_index) < 0 || (m_index) >= (m_size))) { \
|
||||
_err_print_index_error(FUNCTION_STR, __FILE__, __LINE__, m_index, m_size, _STR(m_index), _STR(m_size), m_msg, true); \
|
||||
return; \
|
||||
} else \
|
||||
return; \
|
||||
} else \
|
||||
((void)0)
|
||||
|
||||
/**
|
||||
|
|
@ -170,32 +166,32 @@ void _physics_interpolation_warning(const char *p_function, const char *p_file,
|
|||
* Ensures an integer index `m_index` is less than `m_size` and greater than or equal to 0.
|
||||
* If not, the current function returns `m_retval`.
|
||||
*/
|
||||
#define ERR_FAIL_INDEX_V(m_index, m_size, m_retval) \
|
||||
if (unlikely((m_index) < 0 || (m_index) >= (m_size))) { \
|
||||
#define ERR_FAIL_INDEX_V(m_index, m_size, m_retval) \
|
||||
if (unlikely((m_index) < 0 || (m_index) >= (m_size))) { \
|
||||
_err_print_index_error(FUNCTION_STR, __FILE__, __LINE__, m_index, m_size, _STR(m_index), _STR(m_size)); \
|
||||
return m_retval; \
|
||||
} else \
|
||||
return m_retval; \
|
||||
} else \
|
||||
((void)0)
|
||||
|
||||
/**
|
||||
* Ensures an integer index `m_index` is less than `m_size` and greater than or equal to 0.
|
||||
* If not, prints `m_msg` and the current function returns `m_retval`.
|
||||
*/
|
||||
#define ERR_FAIL_INDEX_V_MSG(m_index, m_size, m_retval, m_msg) \
|
||||
if (unlikely((m_index) < 0 || (m_index) >= (m_size))) { \
|
||||
#define ERR_FAIL_INDEX_V_MSG(m_index, m_size, m_retval, m_msg) \
|
||||
if (unlikely((m_index) < 0 || (m_index) >= (m_size))) { \
|
||||
_err_print_index_error(FUNCTION_STR, __FILE__, __LINE__, m_index, m_size, _STR(m_index), _STR(m_size), m_msg); \
|
||||
return m_retval; \
|
||||
} else \
|
||||
return m_retval; \
|
||||
} else \
|
||||
((void)0)
|
||||
|
||||
/**
|
||||
* Same as `ERR_FAIL_INDEX_V_MSG` but also notifies the editor.
|
||||
*/
|
||||
#define ERR_FAIL_INDEX_V_EDMSG(m_index, m_size, m_retval, m_msg) \
|
||||
if (unlikely((m_index) < 0 || (m_index) >= (m_size))) { \
|
||||
#define ERR_FAIL_INDEX_V_EDMSG(m_index, m_size, m_retval, m_msg) \
|
||||
if (unlikely((m_index) < 0 || (m_index) >= (m_size))) { \
|
||||
_err_print_index_error(FUNCTION_STR, __FILE__, __LINE__, m_index, m_size, _STR(m_index), _STR(m_size), m_msg, true); \
|
||||
return m_retval; \
|
||||
} else \
|
||||
return m_retval; \
|
||||
} else \
|
||||
((void)0)
|
||||
|
||||
/**
|
||||
|
|
@ -206,12 +202,12 @@ void _physics_interpolation_warning(const char *p_function, const char *p_file,
|
|||
* Ensures an integer index `m_index` is less than `m_size` and greater than or equal to 0.
|
||||
* If not, the application crashes.
|
||||
*/
|
||||
#define CRASH_BAD_INDEX(m_index, m_size) \
|
||||
if (unlikely((m_index) < 0 || (m_index) >= (m_size))) { \
|
||||
#define CRASH_BAD_INDEX(m_index, m_size) \
|
||||
if (unlikely((m_index) < 0 || (m_index) >= (m_size))) { \
|
||||
_err_print_index_error(FUNCTION_STR, __FILE__, __LINE__, m_index, m_size, _STR(m_index), _STR(m_size), "", false, true); \
|
||||
_err_flush_stdout(); \
|
||||
GENERATE_TRAP(); \
|
||||
} else \
|
||||
_err_flush_stdout(); \
|
||||
GENERATE_TRAP(); \
|
||||
} else \
|
||||
((void)0)
|
||||
|
||||
/**
|
||||
|
|
@ -221,12 +217,12 @@ void _physics_interpolation_warning(const char *p_function, const char *p_file,
|
|||
* Ensures an integer index `m_index` is less than `m_size` and greater than or equal to 0.
|
||||
* If not, prints `m_msg` and the application crashes.
|
||||
*/
|
||||
#define CRASH_BAD_INDEX_MSG(m_index, m_size, m_msg) \
|
||||
if (unlikely((m_index) < 0 || (m_index) >= (m_size))) { \
|
||||
#define CRASH_BAD_INDEX_MSG(m_index, m_size, m_msg) \
|
||||
if (unlikely((m_index) < 0 || (m_index) >= (m_size))) { \
|
||||
_err_print_index_error(FUNCTION_STR, __FILE__, __LINE__, m_index, m_size, _STR(m_index), _STR(m_size), m_msg, false, true); \
|
||||
_err_flush_stdout(); \
|
||||
GENERATE_TRAP(); \
|
||||
} else \
|
||||
_err_flush_stdout(); \
|
||||
GENERATE_TRAP(); \
|
||||
} else \
|
||||
((void)0)
|
||||
|
||||
// Unsigned integer index out of bounds error macros.
|
||||
|
|
@ -238,32 +234,32 @@ void _physics_interpolation_warning(const char *p_function, const char *p_file,
|
|||
* Ensures an unsigned integer index `m_index` is less than `m_size`.
|
||||
* If not, the current function returns.
|
||||
*/
|
||||
#define ERR_FAIL_UNSIGNED_INDEX(m_index, m_size) \
|
||||
if (unlikely((m_index) >= (m_size))) { \
|
||||
#define ERR_FAIL_UNSIGNED_INDEX(m_index, m_size) \
|
||||
if (unlikely((m_index) >= (m_size))) { \
|
||||
_err_print_index_error(FUNCTION_STR, __FILE__, __LINE__, m_index, m_size, _STR(m_index), _STR(m_size)); \
|
||||
return; \
|
||||
} else \
|
||||
return; \
|
||||
} else \
|
||||
((void)0)
|
||||
|
||||
/**
|
||||
* Ensures an unsigned integer index `m_index` is less than `m_size`.
|
||||
* If not, prints `m_msg` and the current function returns.
|
||||
*/
|
||||
#define ERR_FAIL_UNSIGNED_INDEX_MSG(m_index, m_size, m_msg) \
|
||||
if (unlikely((m_index) >= (m_size))) { \
|
||||
#define ERR_FAIL_UNSIGNED_INDEX_MSG(m_index, m_size, m_msg) \
|
||||
if (unlikely((m_index) >= (m_size))) { \
|
||||
_err_print_index_error(FUNCTION_STR, __FILE__, __LINE__, m_index, m_size, _STR(m_index), _STR(m_size), m_msg); \
|
||||
return; \
|
||||
} else \
|
||||
return; \
|
||||
} else \
|
||||
((void)0)
|
||||
|
||||
/**
|
||||
* Same as `ERR_FAIL_UNSIGNED_INDEX_MSG` but also notifies the editor.
|
||||
*/
|
||||
#define ERR_FAIL_UNSIGNED_INDEX_EDMSG(m_index, m_size, m_msg) \
|
||||
if (unlikely((m_index) >= (m_size))) { \
|
||||
#define ERR_FAIL_UNSIGNED_INDEX_EDMSG(m_index, m_size, m_msg) \
|
||||
if (unlikely((m_index) >= (m_size))) { \
|
||||
_err_print_index_error(FUNCTION_STR, __FILE__, __LINE__, m_index, m_size, _STR(m_index), _STR(m_size), m_msg, true); \
|
||||
return; \
|
||||
} else \
|
||||
return; \
|
||||
} else \
|
||||
((void)0)
|
||||
|
||||
/**
|
||||
|
|
@ -273,32 +269,32 @@ void _physics_interpolation_warning(const char *p_function, const char *p_file,
|
|||
* Ensures an unsigned integer index `m_index` is less than `m_size`.
|
||||
* If not, the current function returns `m_retval`.
|
||||
*/
|
||||
#define ERR_FAIL_UNSIGNED_INDEX_V(m_index, m_size, m_retval) \
|
||||
if (unlikely((m_index) >= (m_size))) { \
|
||||
#define ERR_FAIL_UNSIGNED_INDEX_V(m_index, m_size, m_retval) \
|
||||
if (unlikely((m_index) >= (m_size))) { \
|
||||
_err_print_index_error(FUNCTION_STR, __FILE__, __LINE__, m_index, m_size, _STR(m_index), _STR(m_size)); \
|
||||
return m_retval; \
|
||||
} else \
|
||||
return m_retval; \
|
||||
} else \
|
||||
((void)0)
|
||||
|
||||
/**
|
||||
* Ensures an unsigned integer index `m_index` is less than `m_size`.
|
||||
* If not, prints `m_msg` and the current function returns `m_retval`.
|
||||
*/
|
||||
#define ERR_FAIL_UNSIGNED_INDEX_V_MSG(m_index, m_size, m_retval, m_msg) \
|
||||
if (unlikely((m_index) >= (m_size))) { \
|
||||
#define ERR_FAIL_UNSIGNED_INDEX_V_MSG(m_index, m_size, m_retval, m_msg) \
|
||||
if (unlikely((m_index) >= (m_size))) { \
|
||||
_err_print_index_error(FUNCTION_STR, __FILE__, __LINE__, m_index, m_size, _STR(m_index), _STR(m_size), m_msg); \
|
||||
return m_retval; \
|
||||
} else \
|
||||
return m_retval; \
|
||||
} else \
|
||||
((void)0)
|
||||
|
||||
/**
|
||||
* Same as `ERR_FAIL_UNSIGNED_INDEX_V_MSG` but also notifies the editor.
|
||||
*/
|
||||
#define ERR_FAIL_UNSIGNED_INDEX_V_EDMSG(m_index, m_size, m_retval, m_msg) \
|
||||
if (unlikely((m_index) >= (m_size))) { \
|
||||
#define ERR_FAIL_UNSIGNED_INDEX_V_EDMSG(m_index, m_size, m_retval, m_msg) \
|
||||
if (unlikely((m_index) >= (m_size))) { \
|
||||
_err_print_index_error(FUNCTION_STR, __FILE__, __LINE__, m_index, m_size, _STR(m_index), _STR(m_size), m_msg, true); \
|
||||
return m_retval; \
|
||||
} else \
|
||||
return m_retval; \
|
||||
} else \
|
||||
((void)0)
|
||||
|
||||
/**
|
||||
|
|
@ -309,12 +305,12 @@ void _physics_interpolation_warning(const char *p_function, const char *p_file,
|
|||
* Ensures an unsigned integer index `m_index` is less than `m_size`.
|
||||
* If not, the application crashes.
|
||||
*/
|
||||
#define CRASH_BAD_UNSIGNED_INDEX(m_index, m_size) \
|
||||
if (unlikely((m_index) >= (m_size))) { \
|
||||
#define CRASH_BAD_UNSIGNED_INDEX(m_index, m_size) \
|
||||
if (unlikely((m_index) >= (m_size))) { \
|
||||
_err_print_index_error(FUNCTION_STR, __FILE__, __LINE__, m_index, m_size, _STR(m_index), _STR(m_size), "", false, true); \
|
||||
_err_flush_stdout(); \
|
||||
GENERATE_TRAP(); \
|
||||
} else \
|
||||
_err_flush_stdout(); \
|
||||
GENERATE_TRAP(); \
|
||||
} else \
|
||||
((void)0)
|
||||
|
||||
/**
|
||||
|
|
@ -324,12 +320,12 @@ void _physics_interpolation_warning(const char *p_function, const char *p_file,
|
|||
* Ensures an unsigned integer index `m_index` is less than `m_size`.
|
||||
* If not, prints `m_msg` and the application crashes.
|
||||
*/
|
||||
#define CRASH_BAD_UNSIGNED_INDEX_MSG(m_index, m_size, m_msg) \
|
||||
if (unlikely((m_index) >= (m_size))) { \
|
||||
#define CRASH_BAD_UNSIGNED_INDEX_MSG(m_index, m_size, m_msg) \
|
||||
if (unlikely((m_index) >= (m_size))) { \
|
||||
_err_print_index_error(FUNCTION_STR, __FILE__, __LINE__, m_index, m_size, _STR(m_index), _STR(m_size), m_msg, false, true); \
|
||||
_err_flush_stdout(); \
|
||||
GENERATE_TRAP(); \
|
||||
} else \
|
||||
_err_flush_stdout(); \
|
||||
GENERATE_TRAP(); \
|
||||
} else \
|
||||
((void)0)
|
||||
|
||||
// Null reference error macros.
|
||||
|
|
@ -341,32 +337,32 @@ void _physics_interpolation_warning(const char *p_function, const char *p_file,
|
|||
* Ensures a pointer `m_param` is not null.
|
||||
* If it is null, the current function returns.
|
||||
*/
|
||||
#define ERR_FAIL_NULL(m_param) \
|
||||
if (unlikely(m_param == nullptr)) { \
|
||||
#define ERR_FAIL_NULL(m_param) \
|
||||
if (unlikely(m_param == nullptr)) { \
|
||||
_err_print_error(FUNCTION_STR, __FILE__, __LINE__, "Parameter \"" _STR(m_param) "\" is null."); \
|
||||
return; \
|
||||
} else \
|
||||
return; \
|
||||
} else \
|
||||
((void)0)
|
||||
|
||||
/**
|
||||
* Ensures a pointer `m_param` is not null.
|
||||
* If it is null, prints `m_msg` and the current function returns.
|
||||
*/
|
||||
#define ERR_FAIL_NULL_MSG(m_param, m_msg) \
|
||||
if (unlikely(m_param == nullptr)) { \
|
||||
#define ERR_FAIL_NULL_MSG(m_param, m_msg) \
|
||||
if (unlikely(m_param == nullptr)) { \
|
||||
_err_print_error(FUNCTION_STR, __FILE__, __LINE__, "Parameter \"" _STR(m_param) "\" is null.", m_msg); \
|
||||
return; \
|
||||
} else \
|
||||
return; \
|
||||
} else \
|
||||
((void)0)
|
||||
|
||||
/**
|
||||
* Same as `ERR_FAIL_NULL_MSG` but also notifies the editor.
|
||||
*/
|
||||
#define ERR_FAIL_NULL_EDMSG(m_param, m_msg) \
|
||||
if (unlikely(m_param == nullptr)) { \
|
||||
#define ERR_FAIL_NULL_EDMSG(m_param, m_msg) \
|
||||
if (unlikely(m_param == nullptr)) { \
|
||||
_err_print_error(FUNCTION_STR, __FILE__, __LINE__, "Parameter \"" _STR(m_param) "\" is null.", m_msg, true); \
|
||||
return; \
|
||||
} else \
|
||||
return; \
|
||||
} else \
|
||||
((void)0)
|
||||
|
||||
/**
|
||||
|
|
@ -376,32 +372,32 @@ void _physics_interpolation_warning(const char *p_function, const char *p_file,
|
|||
* Ensures a pointer `m_param` is not null.
|
||||
* If it is null, the current function returns `m_retval`.
|
||||
*/
|
||||
#define ERR_FAIL_NULL_V(m_param, m_retval) \
|
||||
if (unlikely(m_param == nullptr)) { \
|
||||
#define ERR_FAIL_NULL_V(m_param, m_retval) \
|
||||
if (unlikely(m_param == nullptr)) { \
|
||||
_err_print_error(FUNCTION_STR, __FILE__, __LINE__, "Parameter \"" _STR(m_param) "\" is null."); \
|
||||
return m_retval; \
|
||||
} else \
|
||||
return m_retval; \
|
||||
} else \
|
||||
((void)0)
|
||||
|
||||
/**
|
||||
* Ensures a pointer `m_param` is not null.
|
||||
* If it is null, prints `m_msg` and the current function returns `m_retval`.
|
||||
*/
|
||||
#define ERR_FAIL_NULL_V_MSG(m_param, m_retval, m_msg) \
|
||||
if (unlikely(m_param == nullptr)) { \
|
||||
#define ERR_FAIL_NULL_V_MSG(m_param, m_retval, m_msg) \
|
||||
if (unlikely(m_param == nullptr)) { \
|
||||
_err_print_error(FUNCTION_STR, __FILE__, __LINE__, "Parameter \"" _STR(m_param) "\" is null.", m_msg); \
|
||||
return m_retval; \
|
||||
} else \
|
||||
return m_retval; \
|
||||
} else \
|
||||
((void)0)
|
||||
|
||||
/**
|
||||
* Same as `ERR_FAIL_NULL_V_MSG` but also notifies the editor.
|
||||
*/
|
||||
#define ERR_FAIL_NULL_V_EDMSG(m_param, m_retval, m_msg) \
|
||||
if (unlikely(m_param == nullptr)) { \
|
||||
#define ERR_FAIL_NULL_V_EDMSG(m_param, m_retval, m_msg) \
|
||||
if (unlikely(m_param == nullptr)) { \
|
||||
_err_print_error(FUNCTION_STR, __FILE__, __LINE__, "Parameter \"" _STR(m_param) "\" is null.", m_msg, true); \
|
||||
return m_retval; \
|
||||
} else \
|
||||
return m_retval; \
|
||||
} else \
|
||||
((void)0)
|
||||
|
||||
/**
|
||||
|
|
@ -413,11 +409,11 @@ void _physics_interpolation_warning(const char *p_function, const char *p_file,
|
|||
* Ensures `m_cond` is false.
|
||||
* If `m_cond` is true, the current function returns.
|
||||
*/
|
||||
#define ERR_FAIL_COND(m_cond) \
|
||||
if (unlikely(m_cond)) { \
|
||||
#define ERR_FAIL_COND(m_cond) \
|
||||
if (unlikely(m_cond)) { \
|
||||
_err_print_error(FUNCTION_STR, __FILE__, __LINE__, "Condition \"" _STR(m_cond) "\" is true."); \
|
||||
return; \
|
||||
} else \
|
||||
return; \
|
||||
} else \
|
||||
((void)0)
|
||||
|
||||
/**
|
||||
|
|
@ -427,21 +423,21 @@ void _physics_interpolation_warning(const char *p_function, const char *p_file,
|
|||
* If checking for null use ERR_FAIL_NULL_MSG instead.
|
||||
* If checking index bounds use ERR_FAIL_INDEX_MSG instead.
|
||||
*/
|
||||
#define ERR_FAIL_COND_MSG(m_cond, m_msg) \
|
||||
if (unlikely(m_cond)) { \
|
||||
#define ERR_FAIL_COND_MSG(m_cond, m_msg) \
|
||||
if (unlikely(m_cond)) { \
|
||||
_err_print_error(FUNCTION_STR, __FILE__, __LINE__, "Condition \"" _STR(m_cond) "\" is true.", m_msg); \
|
||||
return; \
|
||||
} else \
|
||||
return; \
|
||||
} else \
|
||||
((void)0)
|
||||
|
||||
/**
|
||||
* Same as `ERR_FAIL_COND_MSG` but also notifies the editor.
|
||||
*/
|
||||
#define ERR_FAIL_COND_EDMSG(m_cond, m_msg) \
|
||||
if (unlikely(m_cond)) { \
|
||||
#define ERR_FAIL_COND_EDMSG(m_cond, m_msg) \
|
||||
if (unlikely(m_cond)) { \
|
||||
_err_print_error(FUNCTION_STR, __FILE__, __LINE__, "Condition \"" _STR(m_cond) "\" is true.", m_msg, true); \
|
||||
return; \
|
||||
} else \
|
||||
return; \
|
||||
} else \
|
||||
((void)0)
|
||||
|
||||
/**
|
||||
|
|
@ -453,11 +449,11 @@ void _physics_interpolation_warning(const char *p_function, const char *p_file,
|
|||
* Ensures `m_cond` is false.
|
||||
* If `m_cond` is true, the current function returns `m_retval`.
|
||||
*/
|
||||
#define ERR_FAIL_COND_V(m_cond, m_retval) \
|
||||
if (unlikely(m_cond)) { \
|
||||
#define ERR_FAIL_COND_V(m_cond, m_retval) \
|
||||
if (unlikely(m_cond)) { \
|
||||
_err_print_error(FUNCTION_STR, __FILE__, __LINE__, "Condition \"" _STR(m_cond) "\" is true. Returning: " _STR(m_retval)); \
|
||||
return m_retval; \
|
||||
} else \
|
||||
return m_retval; \
|
||||
} else \
|
||||
((void)0)
|
||||
|
||||
/**
|
||||
|
|
@ -467,21 +463,21 @@ void _physics_interpolation_warning(const char *p_function, const char *p_file,
|
|||
* If checking for null use ERR_FAIL_NULL_V_MSG instead.
|
||||
* If checking index bounds use ERR_FAIL_INDEX_V_MSG instead.
|
||||
*/
|
||||
#define ERR_FAIL_COND_V_MSG(m_cond, m_retval, m_msg) \
|
||||
if (unlikely(m_cond)) { \
|
||||
#define ERR_FAIL_COND_V_MSG(m_cond, m_retval, m_msg) \
|
||||
if (unlikely(m_cond)) { \
|
||||
_err_print_error(FUNCTION_STR, __FILE__, __LINE__, "Condition \"" _STR(m_cond) "\" is true. Returning: " _STR(m_retval), m_msg); \
|
||||
return m_retval; \
|
||||
} else \
|
||||
return m_retval; \
|
||||
} else \
|
||||
((void)0)
|
||||
|
||||
/**
|
||||
* Same as `ERR_FAIL_COND_V_MSG` but also notifies the editor.
|
||||
*/
|
||||
#define ERR_FAIL_COND_V_EDMSG(m_cond, m_retval, m_msg) \
|
||||
if (unlikely(m_cond)) { \
|
||||
#define ERR_FAIL_COND_V_EDMSG(m_cond, m_retval, m_msg) \
|
||||
if (unlikely(m_cond)) { \
|
||||
_err_print_error(FUNCTION_STR, __FILE__, __LINE__, "Condition \"" _STR(m_cond) "\" is true. Returning: " _STR(m_retval), m_msg, true); \
|
||||
return m_retval; \
|
||||
} else \
|
||||
return m_retval; \
|
||||
} else \
|
||||
((void)0)
|
||||
|
||||
/**
|
||||
|
|
@ -491,32 +487,32 @@ void _physics_interpolation_warning(const char *p_function, const char *p_file,
|
|||
* Ensures `m_cond` is false.
|
||||
* If `m_cond` is true, the current loop continues.
|
||||
*/
|
||||
#define ERR_CONTINUE(m_cond) \
|
||||
if (unlikely(m_cond)) { \
|
||||
#define ERR_CONTINUE(m_cond) \
|
||||
if (unlikely(m_cond)) { \
|
||||
_err_print_error(FUNCTION_STR, __FILE__, __LINE__, "Condition \"" _STR(m_cond) "\" is true. Continuing."); \
|
||||
continue; \
|
||||
} else \
|
||||
continue; \
|
||||
} else \
|
||||
((void)0)
|
||||
|
||||
/**
|
||||
* Ensures `m_cond` is false.
|
||||
* If `m_cond` is true, prints `m_msg` and the current loop continues.
|
||||
*/
|
||||
#define ERR_CONTINUE_MSG(m_cond, m_msg) \
|
||||
if (unlikely(m_cond)) { \
|
||||
#define ERR_CONTINUE_MSG(m_cond, m_msg) \
|
||||
if (unlikely(m_cond)) { \
|
||||
_err_print_error(FUNCTION_STR, __FILE__, __LINE__, "Condition \"" _STR(m_cond) "\" is true. Continuing.", m_msg); \
|
||||
continue; \
|
||||
} else \
|
||||
continue; \
|
||||
} else \
|
||||
((void)0)
|
||||
|
||||
/**
|
||||
* Same as `ERR_CONTINUE_MSG` but also notifies the editor.
|
||||
*/
|
||||
#define ERR_CONTINUE_EDMSG(m_cond, m_msg) \
|
||||
if (unlikely(m_cond)) { \
|
||||
#define ERR_CONTINUE_EDMSG(m_cond, m_msg) \
|
||||
if (unlikely(m_cond)) { \
|
||||
_err_print_error(FUNCTION_STR, __FILE__, __LINE__, "Condition \"" _STR(m_cond) "\" is true. Continuing.", m_msg, true); \
|
||||
continue; \
|
||||
} else \
|
||||
continue; \
|
||||
} else \
|
||||
((void)0)
|
||||
|
||||
/**
|
||||
|
|
@ -526,32 +522,32 @@ void _physics_interpolation_warning(const char *p_function, const char *p_file,
|
|||
* Ensures `m_cond` is false.
|
||||
* If `m_cond` is true, the current loop breaks.
|
||||
*/
|
||||
#define ERR_BREAK(m_cond) \
|
||||
if (unlikely(m_cond)) { \
|
||||
#define ERR_BREAK(m_cond) \
|
||||
if (unlikely(m_cond)) { \
|
||||
_err_print_error(FUNCTION_STR, __FILE__, __LINE__, "Condition \"" _STR(m_cond) "\" is true. Breaking."); \
|
||||
break; \
|
||||
} else \
|
||||
break; \
|
||||
} else \
|
||||
((void)0)
|
||||
|
||||
/**
|
||||
* Ensures `m_cond` is false.
|
||||
* If `m_cond` is true, prints `m_msg` and the current loop breaks.
|
||||
*/
|
||||
#define ERR_BREAK_MSG(m_cond, m_msg) \
|
||||
if (unlikely(m_cond)) { \
|
||||
#define ERR_BREAK_MSG(m_cond, m_msg) \
|
||||
if (unlikely(m_cond)) { \
|
||||
_err_print_error(FUNCTION_STR, __FILE__, __LINE__, "Condition \"" _STR(m_cond) "\" is true. Breaking.", m_msg); \
|
||||
break; \
|
||||
} else \
|
||||
break; \
|
||||
} else \
|
||||
((void)0)
|
||||
|
||||
/**
|
||||
* Same as `ERR_BREAK_MSG` but also notifies the editor.
|
||||
*/
|
||||
#define ERR_BREAK_EDMSG(m_cond, m_msg) \
|
||||
if (unlikely(m_cond)) { \
|
||||
#define ERR_BREAK_EDMSG(m_cond, m_msg) \
|
||||
if (unlikely(m_cond)) { \
|
||||
_err_print_error(FUNCTION_STR, __FILE__, __LINE__, "Condition \"" _STR(m_cond) "\" is true. Breaking.", m_msg, true); \
|
||||
break; \
|
||||
} else \
|
||||
break; \
|
||||
} else \
|
||||
((void)0)
|
||||
|
||||
/**
|
||||
|
|
@ -562,12 +558,12 @@ void _physics_interpolation_warning(const char *p_function, const char *p_file,
|
|||
* Ensures `m_cond` is false.
|
||||
* If `m_cond` is true, the application crashes.
|
||||
*/
|
||||
#define CRASH_COND(m_cond) \
|
||||
if (unlikely(m_cond)) { \
|
||||
#define CRASH_COND(m_cond) \
|
||||
if (unlikely(m_cond)) { \
|
||||
_err_print_error(FUNCTION_STR, __FILE__, __LINE__, "FATAL: Condition \"" _STR(m_cond) "\" is true."); \
|
||||
_err_flush_stdout(); \
|
||||
GENERATE_TRAP(); \
|
||||
} else \
|
||||
_err_flush_stdout(); \
|
||||
GENERATE_TRAP(); \
|
||||
} else \
|
||||
((void)0)
|
||||
|
||||
/**
|
||||
|
|
@ -577,12 +573,12 @@ void _physics_interpolation_warning(const char *p_function, const char *p_file,
|
|||
* Ensures `m_cond` is false.
|
||||
* If `m_cond` is true, prints `m_msg` and the application crashes.
|
||||
*/
|
||||
#define CRASH_COND_MSG(m_cond, m_msg) \
|
||||
if (unlikely(m_cond)) { \
|
||||
#define CRASH_COND_MSG(m_cond, m_msg) \
|
||||
if (unlikely(m_cond)) { \
|
||||
_err_print_error(FUNCTION_STR, __FILE__, __LINE__, "FATAL: Condition \"" _STR(m_cond) "\" is true.", m_msg); \
|
||||
_err_flush_stdout(); \
|
||||
GENERATE_TRAP(); \
|
||||
} else \
|
||||
_err_flush_stdout(); \
|
||||
GENERATE_TRAP(); \
|
||||
} else \
|
||||
((void)0)
|
||||
|
||||
// Generic error macros.
|
||||
|
|
@ -594,11 +590,11 @@ void _physics_interpolation_warning(const char *p_function, const char *p_file,
|
|||
*
|
||||
* The current function returns.
|
||||
*/
|
||||
#define ERR_FAIL() \
|
||||
if (true) { \
|
||||
#define ERR_FAIL() \
|
||||
if (true) { \
|
||||
_err_print_error(FUNCTION_STR, __FILE__, __LINE__, "Method/function failed."); \
|
||||
return; \
|
||||
} else \
|
||||
return; \
|
||||
} else \
|
||||
((void)0)
|
||||
|
||||
/**
|
||||
|
|
@ -607,21 +603,21 @@ void _physics_interpolation_warning(const char *p_function, const char *p_file,
|
|||
*
|
||||
* Prints `m_msg`, and the current function returns.
|
||||
*/
|
||||
#define ERR_FAIL_MSG(m_msg) \
|
||||
if (true) { \
|
||||
#define ERR_FAIL_MSG(m_msg) \
|
||||
if (true) { \
|
||||
_err_print_error(FUNCTION_STR, __FILE__, __LINE__, "Method/function failed.", m_msg); \
|
||||
return; \
|
||||
} else \
|
||||
return; \
|
||||
} else \
|
||||
((void)0)
|
||||
|
||||
/**
|
||||
* Same as `ERR_FAIL_MSG` but also notifies the editor.
|
||||
*/
|
||||
#define ERR_FAIL_EDMSG(m_msg) \
|
||||
if (true) { \
|
||||
#define ERR_FAIL_EDMSG(m_msg) \
|
||||
if (true) { \
|
||||
_err_print_error(FUNCTION_STR, __FILE__, __LINE__, "Method/function failed.", m_msg, true); \
|
||||
return; \
|
||||
} else \
|
||||
return; \
|
||||
} else \
|
||||
((void)0)
|
||||
|
||||
/**
|
||||
|
|
@ -631,11 +627,11 @@ void _physics_interpolation_warning(const char *p_function, const char *p_file,
|
|||
*
|
||||
* The current function returns `m_retval`.
|
||||
*/
|
||||
#define ERR_FAIL_V(m_retval) \
|
||||
if (true) { \
|
||||
#define ERR_FAIL_V(m_retval) \
|
||||
if (true) { \
|
||||
_err_print_error(FUNCTION_STR, __FILE__, __LINE__, "Method/function failed. Returning: " _STR(m_retval)); \
|
||||
return m_retval; \
|
||||
} else \
|
||||
return m_retval; \
|
||||
} else \
|
||||
((void)0)
|
||||
|
||||
/**
|
||||
|
|
@ -644,21 +640,21 @@ void _physics_interpolation_warning(const char *p_function, const char *p_file,
|
|||
*
|
||||
* Prints `m_msg`, and the current function returns `m_retval`.
|
||||
*/
|
||||
#define ERR_FAIL_V_MSG(m_retval, m_msg) \
|
||||
if (true) { \
|
||||
#define ERR_FAIL_V_MSG(m_retval, m_msg) \
|
||||
if (true) { \
|
||||
_err_print_error(FUNCTION_STR, __FILE__, __LINE__, "Method/function failed. Returning: " _STR(m_retval), m_msg); \
|
||||
return m_retval; \
|
||||
} else \
|
||||
return m_retval; \
|
||||
} else \
|
||||
((void)0)
|
||||
|
||||
/**
|
||||
* Same as `ERR_FAIL_V_MSG` but also notifies the editor.
|
||||
*/
|
||||
#define ERR_FAIL_V_EDMSG(m_retval, m_msg) \
|
||||
if (true) { \
|
||||
#define ERR_FAIL_V_EDMSG(m_retval, m_msg) \
|
||||
if (true) { \
|
||||
_err_print_error(FUNCTION_STR, __FILE__, __LINE__, "Method/function failed. Returning: " _STR(m_retval), m_msg, true); \
|
||||
return m_retval; \
|
||||
} else \
|
||||
return m_retval; \
|
||||
} else \
|
||||
((void)0)
|
||||
|
||||
/**
|
||||
|
|
@ -680,27 +676,27 @@ void _physics_interpolation_warning(const char *p_function, const char *p_file,
|
|||
/**
|
||||
* Prints `m_msg` once during the application lifetime.
|
||||
*/
|
||||
#define ERR_PRINT_ONCE(m_msg) \
|
||||
if (true) { \
|
||||
static bool warning_shown = false; \
|
||||
if (unlikely(!warning_shown)) { \
|
||||
warning_shown = true; \
|
||||
#define ERR_PRINT_ONCE(m_msg) \
|
||||
if (true) { \
|
||||
static bool warning_shown = false; \
|
||||
if (unlikely(!warning_shown)) { \
|
||||
warning_shown = true; \
|
||||
_err_print_error(FUNCTION_STR, __FILE__, __LINE__, m_msg); \
|
||||
} \
|
||||
} else \
|
||||
} \
|
||||
} else \
|
||||
((void)0)
|
||||
|
||||
/**
|
||||
* Same as `ERR_PRINT_ONCE` but also notifies the editor.
|
||||
*/
|
||||
#define ERR_PRINT_ONCE_ED(m_msg) \
|
||||
if (true) { \
|
||||
static bool warning_shown = false; \
|
||||
if (unlikely(!warning_shown)) { \
|
||||
warning_shown = true; \
|
||||
#define ERR_PRINT_ONCE_ED(m_msg) \
|
||||
if (true) { \
|
||||
static bool warning_shown = false; \
|
||||
if (unlikely(!warning_shown)) { \
|
||||
warning_shown = true; \
|
||||
_err_print_error(FUNCTION_STR, __FILE__, __LINE__, m_msg, true); \
|
||||
} \
|
||||
} else \
|
||||
} \
|
||||
} else \
|
||||
((void)0)
|
||||
|
||||
// Print warning message macros.
|
||||
|
|
@ -724,37 +720,37 @@ void _physics_interpolation_warning(const char *p_function, const char *p_file,
|
|||
*
|
||||
* If warning about deprecated usage, use `WARN_DEPRECATED` or `WARN_DEPRECATED_MSG` instead.
|
||||
*/
|
||||
#define WARN_PRINT_ONCE(m_msg) \
|
||||
if (true) { \
|
||||
static bool warning_shown = false; \
|
||||
if (unlikely(!warning_shown)) { \
|
||||
warning_shown = true; \
|
||||
#define WARN_PRINT_ONCE(m_msg) \
|
||||
if (true) { \
|
||||
static bool warning_shown = false; \
|
||||
if (unlikely(!warning_shown)) { \
|
||||
warning_shown = true; \
|
||||
_err_print_error(FUNCTION_STR, __FILE__, __LINE__, m_msg, false, ERR_HANDLER_WARNING); \
|
||||
} \
|
||||
} else \
|
||||
} \
|
||||
} else \
|
||||
((void)0)
|
||||
|
||||
/**
|
||||
* Same as `WARN_PRINT_ONCE` but also notifies the editor.
|
||||
*/
|
||||
#define WARN_PRINT_ONCE_ED(m_msg) \
|
||||
if (true) { \
|
||||
static bool warning_shown = false; \
|
||||
if (unlikely(!warning_shown)) { \
|
||||
warning_shown = true; \
|
||||
#define WARN_PRINT_ONCE_ED(m_msg) \
|
||||
if (true) { \
|
||||
static bool warning_shown = false; \
|
||||
if (unlikely(!warning_shown)) { \
|
||||
warning_shown = true; \
|
||||
_err_print_error(FUNCTION_STR, __FILE__, __LINE__, m_msg, true, ERR_HANDLER_WARNING); \
|
||||
} \
|
||||
} else \
|
||||
} \
|
||||
} else \
|
||||
((void)0)
|
||||
|
||||
/**
|
||||
* Warns about `m_msg` only when verbose mode is enabled.
|
||||
*/
|
||||
#define WARN_VERBOSE(m_msg) \
|
||||
{ \
|
||||
#define WARN_VERBOSE(m_msg) \
|
||||
{ \
|
||||
if (is_print_verbose_enabled()) { \
|
||||
WARN_PRINT(m_msg); \
|
||||
} \
|
||||
WARN_PRINT(m_msg); \
|
||||
} \
|
||||
}
|
||||
|
||||
// Print deprecated warning message macros.
|
||||
|
|
@ -762,27 +758,27 @@ void _physics_interpolation_warning(const char *p_function, const char *p_file,
|
|||
/**
|
||||
* Warns that the current function is deprecated.
|
||||
*/
|
||||
#define WARN_DEPRECATED \
|
||||
if (true) { \
|
||||
static bool warning_shown = false; \
|
||||
if (unlikely(!warning_shown)) { \
|
||||
warning_shown = true; \
|
||||
#define WARN_DEPRECATED \
|
||||
if (true) { \
|
||||
static bool warning_shown = false; \
|
||||
if (unlikely(!warning_shown)) { \
|
||||
warning_shown = true; \
|
||||
_err_print_error(FUNCTION_STR, __FILE__, __LINE__, "This method has been deprecated and will be removed in the future.", false, ERR_HANDLER_WARNING); \
|
||||
} \
|
||||
} else \
|
||||
} \
|
||||
} else \
|
||||
((void)0)
|
||||
|
||||
/**
|
||||
* Warns that the current function is deprecated and prints `m_msg`.
|
||||
*/
|
||||
#define WARN_DEPRECATED_MSG(m_msg) \
|
||||
if (true) { \
|
||||
static bool warning_shown = false; \
|
||||
if (unlikely(!warning_shown)) { \
|
||||
warning_shown = true; \
|
||||
#define WARN_DEPRECATED_MSG(m_msg) \
|
||||
if (true) { \
|
||||
static bool warning_shown = false; \
|
||||
if (unlikely(!warning_shown)) { \
|
||||
warning_shown = true; \
|
||||
_err_print_error(FUNCTION_STR, __FILE__, __LINE__, "This method has been deprecated and will be removed in the future.", m_msg, false, ERR_HANDLER_WARNING); \
|
||||
} \
|
||||
} else \
|
||||
} \
|
||||
} else \
|
||||
((void)0)
|
||||
|
||||
/**
|
||||
|
|
@ -791,12 +787,12 @@ void _physics_interpolation_warning(const char *p_function, const char *p_file,
|
|||
*
|
||||
* The application crashes.
|
||||
*/
|
||||
#define CRASH_NOW() \
|
||||
if (true) { \
|
||||
#define CRASH_NOW() \
|
||||
if (true) { \
|
||||
_err_print_error(FUNCTION_STR, __FILE__, __LINE__, "FATAL: Method/function failed."); \
|
||||
_err_flush_stdout(); \
|
||||
GENERATE_TRAP(); \
|
||||
} else \
|
||||
_err_flush_stdout(); \
|
||||
GENERATE_TRAP(); \
|
||||
} else \
|
||||
((void)0)
|
||||
|
||||
/**
|
||||
|
|
@ -804,12 +800,12 @@ void _physics_interpolation_warning(const char *p_function, const char *p_file,
|
|||
*
|
||||
* Prints `m_msg`, and then the application crashes.
|
||||
*/
|
||||
#define CRASH_NOW_MSG(m_msg) \
|
||||
if (true) { \
|
||||
#define CRASH_NOW_MSG(m_msg) \
|
||||
if (true) { \
|
||||
_err_print_error(FUNCTION_STR, __FILE__, __LINE__, "FATAL: Method/function failed.", m_msg); \
|
||||
_err_flush_stdout(); \
|
||||
GENERATE_TRAP(); \
|
||||
} else \
|
||||
_err_flush_stdout(); \
|
||||
GENERATE_TRAP(); \
|
||||
} else \
|
||||
((void)0)
|
||||
|
||||
/**
|
||||
|
|
@ -828,26 +824,26 @@ void _physics_interpolation_warning(const char *p_function, const char *p_file,
|
|||
* and that can't fail for other contributors once the code is finished and merged.
|
||||
*/
|
||||
#ifdef DEV_ENABLED
|
||||
#define DEV_ASSERT(m_cond) \
|
||||
if (unlikely(!(m_cond))) { \
|
||||
#define DEV_ASSERT(m_cond) \
|
||||
if (unlikely(!(m_cond))) { \
|
||||
_err_print_error(FUNCTION_STR, __FILE__, __LINE__, "FATAL: DEV_ASSERT failed \"" _STR(m_cond) "\" is false."); \
|
||||
_err_flush_stdout(); \
|
||||
GENERATE_TRAP(); \
|
||||
} else \
|
||||
_err_flush_stdout(); \
|
||||
GENERATE_TRAP(); \
|
||||
} else \
|
||||
((void)0)
|
||||
#else
|
||||
#define DEV_ASSERT(m_cond)
|
||||
#endif
|
||||
|
||||
#ifdef DEV_ENABLED
|
||||
#define DEV_CHECK_ONCE(m_cond) \
|
||||
if (true) { \
|
||||
static bool first_print = true; \
|
||||
if (first_print && unlikely(!(m_cond))) { \
|
||||
#define DEV_CHECK_ONCE(m_cond) \
|
||||
if (true) { \
|
||||
static bool first_print = true; \
|
||||
if (first_print && unlikely(!(m_cond))) { \
|
||||
_err_print_error(FUNCTION_STR, __FILE__, __LINE__, "DEV_CHECK_ONCE failed \"" _STR(m_cond) "\" is false."); \
|
||||
first_print = false; \
|
||||
} \
|
||||
} else \
|
||||
first_print = false; \
|
||||
} \
|
||||
} else \
|
||||
((void)0)
|
||||
#else
|
||||
#define DEV_CHECK_ONCE(m_cond)
|
||||
|
|
|
|||
|
|
@ -7,7 +7,7 @@ import make_interface_dumper
|
|||
import make_interface_header
|
||||
import make_wrappers
|
||||
|
||||
env.CommandNoCache(["ext_wrappers.gen.inc"], "make_wrappers.py", env.Run(make_wrappers.run))
|
||||
env.CommandNoCache("ext_wrappers.gen.h", "make_wrappers.py", env.Run(make_wrappers.run))
|
||||
env.CommandNoCache(
|
||||
"gdextension_interface_dump.gen.h",
|
||||
["gdextension_interface.json", "make_interface_dumper.py"],
|
||||
|
|
@ -19,6 +19,4 @@ env.CommandNoCache(
|
|||
env.Run(make_interface_header.run),
|
||||
)
|
||||
|
||||
env_extension = env.Clone()
|
||||
|
||||
env_extension.add_source_files(env.core_sources, "*.cpp")
|
||||
env.add_source_files(env.core_sources, "*.cpp")
|
||||
|
|
|
|||
|
|
@ -35,6 +35,7 @@
|
|||
#include "core/extension/gdextension_special_compat_hashes.h"
|
||||
#include "core/io/file_access.h"
|
||||
#include "core/io/json.h"
|
||||
#include "core/object/class_db.h"
|
||||
#include "core/templates/pair.h"
|
||||
#include "core/version.h"
|
||||
|
||||
|
|
@ -281,59 +282,59 @@ Dictionary GDExtensionAPIDump::generate_extension_api(bool p_include_docs) {
|
|||
// Member offsets, meta types and sizes.
|
||||
|
||||
#define REAL_MEMBER_OFFSET(type, member) \
|
||||
{ \
|
||||
type, \
|
||||
member, \
|
||||
"float", \
|
||||
sizeof(float), \
|
||||
"float", \
|
||||
sizeof(float), \
|
||||
"double", \
|
||||
sizeof(double), \
|
||||
"double", \
|
||||
sizeof(double), \
|
||||
{ \
|
||||
type, \
|
||||
member, \
|
||||
"float", \
|
||||
sizeof(float), \
|
||||
"float", \
|
||||
sizeof(float), \
|
||||
"double", \
|
||||
sizeof(double), \
|
||||
"double", \
|
||||
sizeof(double), \
|
||||
}
|
||||
|
||||
#define INT32_MEMBER_OFFSET(type, member) \
|
||||
{ \
|
||||
type, \
|
||||
member, \
|
||||
"int32", \
|
||||
sizeof(int32_t), \
|
||||
"int32", \
|
||||
sizeof(int32_t), \
|
||||
"int32", \
|
||||
sizeof(int32_t), \
|
||||
"int32", \
|
||||
sizeof(int32_t), \
|
||||
{ \
|
||||
type, \
|
||||
member, \
|
||||
"int32", \
|
||||
sizeof(int32_t), \
|
||||
"int32", \
|
||||
sizeof(int32_t), \
|
||||
"int32", \
|
||||
sizeof(int32_t), \
|
||||
"int32", \
|
||||
sizeof(int32_t), \
|
||||
}
|
||||
|
||||
#define INT32_BASED_BUILTIN_MEMBER_OFFSET(type, member, member_type, member_elems) \
|
||||
{ \
|
||||
type, \
|
||||
member, \
|
||||
member_type, \
|
||||
sizeof(int32_t) * member_elems, \
|
||||
member_type, \
|
||||
sizeof(int32_t) * member_elems, \
|
||||
member_type, \
|
||||
sizeof(int32_t) * member_elems, \
|
||||
member_type, \
|
||||
sizeof(int32_t) * member_elems, \
|
||||
{ \
|
||||
type, \
|
||||
member, \
|
||||
member_type, \
|
||||
sizeof(int32_t) * member_elems, \
|
||||
member_type, \
|
||||
sizeof(int32_t) * member_elems, \
|
||||
member_type, \
|
||||
sizeof(int32_t) * member_elems, \
|
||||
member_type, \
|
||||
sizeof(int32_t) * member_elems, \
|
||||
}
|
||||
|
||||
#define REAL_BASED_BUILTIN_MEMBER_OFFSET(type, member, member_type, member_elems) \
|
||||
{ \
|
||||
type, \
|
||||
member, \
|
||||
member_type, \
|
||||
sizeof(float) * member_elems, \
|
||||
member_type, \
|
||||
sizeof(float) * member_elems, \
|
||||
member_type, \
|
||||
sizeof(double) * member_elems, \
|
||||
member_type, \
|
||||
sizeof(double) * member_elems, \
|
||||
{ \
|
||||
type, \
|
||||
member, \
|
||||
member_type, \
|
||||
sizeof(float) * member_elems, \
|
||||
member_type, \
|
||||
sizeof(float) * member_elems, \
|
||||
member_type, \
|
||||
sizeof(double) * member_elems, \
|
||||
member_type, \
|
||||
sizeof(double) * member_elems, \
|
||||
}
|
||||
|
||||
struct {
|
||||
|
|
|
|||
|
|
@ -30,14 +30,17 @@
|
|||
|
||||
#pragma once
|
||||
|
||||
#include "core/extension/gdextension.h"
|
||||
|
||||
#ifdef TOOLS_ENABLED
|
||||
|
||||
#include "core/error/error_list.h"
|
||||
#include "core/string/ustring.h"
|
||||
#include "core/variant/dictionary.h"
|
||||
|
||||
class GDExtensionAPIDump {
|
||||
public:
|
||||
static Dictionary generate_extension_api(bool p_include_docs = false);
|
||||
static void generate_extension_json_file(const String &p_path, bool p_include_docs = false);
|
||||
static Error validate_extension_json_file(const String &p_path);
|
||||
};
|
||||
|
||||
#endif
|
||||
|
|
|
|||
|
|
@ -30,6 +30,10 @@
|
|||
|
||||
#ifndef DISABLE_DEPRECATED
|
||||
|
||||
#include "gdextension.h"
|
||||
|
||||
#include "core/object/class_db.h"
|
||||
|
||||
Error GDExtension::_open_library_bind_compat_88418(const String &p_path, const String &p_entry_symbol) {
|
||||
return ERR_UNAVAILABLE;
|
||||
}
|
||||
|
|
@ -46,4 +50,4 @@ void GDExtension::_bind_compatibility_methods() {
|
|||
ClassDB::bind_compatibility_method(D_METHOD("initialize_library", "level"), &GDExtension::_initialize_library_bind_compat_88418);
|
||||
}
|
||||
|
||||
#endif
|
||||
#endif // DISABLE_DEPRECATED
|
||||
|
|
|
|||
|
|
@ -32,10 +32,10 @@
|
|||
#include "gdextension.compat.inc"
|
||||
|
||||
#include "core/config/project_settings.h"
|
||||
#include "core/extension/gdextension_library_loader.h"
|
||||
#include "core/object/callable_mp.h"
|
||||
#include "core/object/class_db.h"
|
||||
#include "core/object/method_bind.h"
|
||||
#include "gdextension_library_loader.h"
|
||||
#include "gdextension_manager.h"
|
||||
|
||||
extern void gdextension_setup_interface();
|
||||
extern GDExtensionInterfaceFunctionPtr gdextension_get_proc_address(const char *p_name);
|
||||
|
|
@ -240,7 +240,7 @@ public:
|
|||
|
||||
#ifndef DISABLE_DEPRECATED
|
||||
void GDExtension::_register_extension_class(GDExtensionClassLibraryPtr p_library, GDExtensionConstStringNamePtr p_class_name, GDExtensionConstStringNamePtr p_parent_class_name, const GDExtensionClassCreationInfo *p_extension_funcs) {
|
||||
const GDExtensionClassCreationInfo5 class_info5 = {
|
||||
const GDExtensionClassCreationInfo6 class_info6 = {
|
||||
p_extension_funcs->is_virtual, // GDExtensionBool is_virtual;
|
||||
p_extension_funcs->is_abstract, // GDExtensionBool is_abstract;
|
||||
true, // GDExtensionBool is_exposed;
|
||||
|
|
@ -257,29 +257,30 @@ void GDExtension::_register_extension_class(GDExtensionClassLibraryPtr p_library
|
|||
p_extension_funcs->to_string_func, // GDExtensionClassToString to_string_func;
|
||||
p_extension_funcs->reference_func, // GDExtensionClassReference reference_func;
|
||||
p_extension_funcs->unreference_func, // GDExtensionClassUnreference unreference_func;
|
||||
nullptr, // GDExtensionClassCreateInstance2 create_instance_func; /* this one is mandatory */
|
||||
nullptr, // GDExtensionClassCreateInstance3 create_instance_func; /* this one is mandatory */
|
||||
p_extension_funcs->free_instance_func, // GDExtensionClassFreeInstance free_instance_func; /* this one is mandatory */
|
||||
nullptr, // GDExtensionClassRecreateInstance recreate_instance_func;
|
||||
nullptr, // GDExtensionClassGetVirtual get_virtual_func;
|
||||
nullptr, // GDExtensionClassGetVirtualCallData get_virtual_call_data_func;
|
||||
nullptr, // GDExtensionClassCallVirtualWithData call_virtual_func;
|
||||
nullptr, // GDExtensionClassGetVirtual2 get_virtual_func;
|
||||
nullptr, // GDExtensionClassGetVirtualCallData2 get_virtual_call_data_func;
|
||||
nullptr, // GDExtensionClassCallVirtualWithData call_virtual_with_data_func;
|
||||
p_extension_funcs->class_userdata, // void *class_userdata;
|
||||
};
|
||||
|
||||
const ClassCreationDeprecatedInfo legacy = {
|
||||
false,
|
||||
false, // bool legacy_unexposed_class;
|
||||
p_extension_funcs->notification_func, // GDExtensionClassNotification notification_func;
|
||||
p_extension_funcs->free_property_list_func, // GDExtensionClassFreePropertyList free_property_list_func;
|
||||
p_extension_funcs->create_instance_func, // GDExtensionClassCreateInstance create_instance_func;
|
||||
p_extension_funcs->get_rid_func, // GDExtensionClassGetRID get_rid;
|
||||
nullptr, // GDExtensionClassCreateInstance2 create_instance2_func;
|
||||
p_extension_funcs->get_rid_func, // GDExtensionClassGetRID get_rid_func;
|
||||
p_extension_funcs->get_virtual_func, // GDExtensionClassGetVirtual get_virtual_func;
|
||||
nullptr,
|
||||
nullptr, // GDExtensionClassGetVirtualCallData get_virtual_call_data_func;
|
||||
};
|
||||
_register_extension_class_internal(p_library, p_class_name, p_parent_class_name, &class_info5, &legacy);
|
||||
_register_extension_class_internal(p_library, p_class_name, p_parent_class_name, &class_info6, &legacy);
|
||||
}
|
||||
|
||||
void GDExtension::_register_extension_class2(GDExtensionClassLibraryPtr p_library, GDExtensionConstStringNamePtr p_class_name, GDExtensionConstStringNamePtr p_parent_class_name, const GDExtensionClassCreationInfo2 *p_extension_funcs) {
|
||||
const GDExtensionClassCreationInfo5 class_info5 = {
|
||||
const GDExtensionClassCreationInfo6 class_info6 = {
|
||||
p_extension_funcs->is_virtual, // GDExtensionBool is_virtual;
|
||||
p_extension_funcs->is_abstract, // GDExtensionBool is_abstract;
|
||||
p_extension_funcs->is_exposed, // GDExtensionBool is_exposed;
|
||||
|
|
@ -296,12 +297,12 @@ void GDExtension::_register_extension_class2(GDExtensionClassLibraryPtr p_librar
|
|||
p_extension_funcs->to_string_func, // GDExtensionClassToString to_string_func;
|
||||
p_extension_funcs->reference_func, // GDExtensionClassReference reference_func;
|
||||
p_extension_funcs->unreference_func, // GDExtensionClassUnreference unreference_func;
|
||||
nullptr, // GDExtensionClassCreateInstance2 create_instance_func; /* this one is mandatory */
|
||||
nullptr, // GDExtensionClassCreateInstance3 create_instance_func; /* this one is mandatory */
|
||||
p_extension_funcs->free_instance_func, // GDExtensionClassFreeInstance free_instance_func; /* this one is mandatory */
|
||||
p_extension_funcs->recreate_instance_func, // GDExtensionClassRecreateInstance recreate_instance_func;
|
||||
nullptr, // GDExtensionClassGetVirtual get_virtual_func;
|
||||
nullptr, // GDExtensionClassGetVirtualCallData get_virtual_call_data_func;
|
||||
p_extension_funcs->call_virtual_with_data_func, // GDExtensionClassCallVirtualWithData call_virtual_func;
|
||||
nullptr, // GDExtensionClassGetVirtual2 get_virtual_func;
|
||||
nullptr, // GDExtensionClassGetVirtualCallData2 get_virtual_call_data_func;
|
||||
p_extension_funcs->call_virtual_with_data_func, // GDExtensionClassCallVirtualWithData call_virtual_with_data_func;
|
||||
p_extension_funcs->class_userdata, // void *class_userdata;
|
||||
};
|
||||
|
||||
|
|
@ -310,15 +311,16 @@ void GDExtension::_register_extension_class2(GDExtensionClassLibraryPtr p_librar
|
|||
nullptr, // GDExtensionClassNotification notification_func;
|
||||
p_extension_funcs->free_property_list_func, // GDExtensionClassFreePropertyList free_property_list_func;
|
||||
p_extension_funcs->create_instance_func, // GDExtensionClassCreateInstance create_instance_func;
|
||||
p_extension_funcs->get_rid_func, // GDExtensionClassGetRID get_rid;
|
||||
nullptr, // GDExtensionClassCreateInstance2 create_instance2_func;
|
||||
p_extension_funcs->get_rid_func, // GDExtensionClassGetRID get_rid_func;
|
||||
p_extension_funcs->get_virtual_func, // GDExtensionClassGetVirtual get_virtual_func;
|
||||
p_extension_funcs->get_virtual_call_data_func, // GDExtensionClassGetVirtual get_virtual_func;
|
||||
p_extension_funcs->get_virtual_call_data_func, // GDExtensionClassGetVirtualCallData get_virtual_call_data_func;
|
||||
};
|
||||
_register_extension_class_internal(p_library, p_class_name, p_parent_class_name, &class_info5, &legacy);
|
||||
_register_extension_class_internal(p_library, p_class_name, p_parent_class_name, &class_info6, &legacy);
|
||||
}
|
||||
|
||||
void GDExtension::_register_extension_class3(GDExtensionClassLibraryPtr p_library, GDExtensionConstStringNamePtr p_class_name, GDExtensionConstStringNamePtr p_parent_class_name, const GDExtensionClassCreationInfo3 *p_extension_funcs) {
|
||||
const GDExtensionClassCreationInfo5 class_info5 = {
|
||||
const GDExtensionClassCreationInfo6 class_info6 = {
|
||||
p_extension_funcs->is_virtual, // GDExtensionBool is_virtual;
|
||||
p_extension_funcs->is_abstract, // GDExtensionBool is_abstract;
|
||||
p_extension_funcs->is_exposed, // GDExtensionBool is_exposed;
|
||||
|
|
@ -327,7 +329,7 @@ void GDExtension::_register_extension_class3(GDExtensionClassLibraryPtr p_librar
|
|||
p_extension_funcs->set_func, // GDExtensionClassSet set_func;
|
||||
p_extension_funcs->get_func, // GDExtensionClassGet get_func;
|
||||
p_extension_funcs->get_property_list_func, // GDExtensionClassGetPropertyList get_property_list_func;
|
||||
p_extension_funcs->free_property_list_func, // GDExtensionClassFreePropertyList free_property_list_func;
|
||||
p_extension_funcs->free_property_list_func, // GDExtensionClassFreePropertyList2 free_property_list_func;
|
||||
p_extension_funcs->property_can_revert_func, // GDExtensionClassPropertyCanRevert property_can_revert_func;
|
||||
p_extension_funcs->property_get_revert_func, // GDExtensionClassPropertyGetRevert property_get_revert_func;
|
||||
p_extension_funcs->validate_property_func, // GDExtensionClassValidateProperty validate_property_func;
|
||||
|
|
@ -335,12 +337,12 @@ void GDExtension::_register_extension_class3(GDExtensionClassLibraryPtr p_librar
|
|||
p_extension_funcs->to_string_func, // GDExtensionClassToString to_string_func;
|
||||
p_extension_funcs->reference_func, // GDExtensionClassReference reference_func;
|
||||
p_extension_funcs->unreference_func, // GDExtensionClassUnreference unreference_func;
|
||||
nullptr, // GDExtensionClassCreateInstance2 create_instance_func; /* this one is mandatory */
|
||||
nullptr, // GDExtensionClassCreateInstance3 create_instance_func; /* this one is mandatory */
|
||||
p_extension_funcs->free_instance_func, // GDExtensionClassFreeInstance free_instance_func; /* this one is mandatory */
|
||||
p_extension_funcs->recreate_instance_func, // GDExtensionClassRecreateInstance recreate_instance_func;
|
||||
nullptr, // GDExtensionClassGetVirtual get_virtual_func;
|
||||
nullptr, // GDExtensionClassGetVirtualCallData get_virtual_call_data_func;
|
||||
p_extension_funcs->call_virtual_with_data_func, // GDExtensionClassCallVirtualWithData call_virtual_func;
|
||||
nullptr, // GDExtensionClassGetVirtual2 get_virtual_func;
|
||||
nullptr, // GDExtensionClassGetVirtualCallData2 get_virtual_call_data_func;
|
||||
p_extension_funcs->call_virtual_with_data_func, // GDExtensionClassCallVirtualWithData call_virtual_with_data_func;
|
||||
p_extension_funcs->class_userdata, // void *class_userdata;
|
||||
};
|
||||
|
||||
|
|
@ -348,34 +350,101 @@ void GDExtension::_register_extension_class3(GDExtensionClassLibraryPtr p_librar
|
|||
!p_extension_funcs->is_exposed, // bool legacy_unexposed_class;
|
||||
nullptr, // GDExtensionClassNotification notification_func;
|
||||
nullptr, // GDExtensionClassFreePropertyList free_property_list_func;
|
||||
p_extension_funcs->create_instance_func, // GDExtensionClassCreateInstance2 create_instance_func;
|
||||
p_extension_funcs->get_rid_func, // GDExtensionClassGetRID get_rid;
|
||||
p_extension_funcs->create_instance_func, // GDExtensionClassCreateInstance create_instance_func;
|
||||
nullptr, // GDExtensionClassCreateInstance2 create_instance2_func;
|
||||
p_extension_funcs->get_rid_func, // GDExtensionClassGetRID get_rid_func;
|
||||
p_extension_funcs->get_virtual_func, // GDExtensionClassGetVirtual get_virtual_func;
|
||||
p_extension_funcs->get_virtual_call_data_func, // GDExtensionClassGetVirtual get_virtual_func;
|
||||
p_extension_funcs->get_virtual_call_data_func, // GDExtensionClassGetVirtualCallData get_virtual_call_data_func;
|
||||
};
|
||||
_register_extension_class_internal(p_library, p_class_name, p_parent_class_name, &class_info5, &legacy);
|
||||
_register_extension_class_internal(p_library, p_class_name, p_parent_class_name, &class_info6, &legacy);
|
||||
}
|
||||
|
||||
void GDExtension::_register_extension_class4(GDExtensionClassLibraryPtr p_library, GDExtensionConstStringNamePtr p_class_name, GDExtensionConstStringNamePtr p_parent_class_name, const GDExtensionClassCreationInfo4 *p_extension_funcs) {
|
||||
GDExtensionClassCreationInfo5 class_info5 = *p_extension_funcs;
|
||||
const GDExtensionClassCreationInfo6 class_info6 = {
|
||||
p_extension_funcs->is_virtual, // GDExtensionBool is_virtual;
|
||||
p_extension_funcs->is_abstract, // GDExtensionBool is_abstract;
|
||||
p_extension_funcs->is_exposed, // GDExtensionBool is_exposed;
|
||||
p_extension_funcs->is_runtime, // GDExtensionBool is_runtime;
|
||||
p_extension_funcs->icon_path, // GDExtensionConstStringPtr icon_path;
|
||||
p_extension_funcs->set_func, // GDExtensionClassSet set_func;
|
||||
p_extension_funcs->get_func, // GDExtensionClassGet get_func;
|
||||
p_extension_funcs->get_property_list_func, // GDExtensionClassGetPropertyList get_property_list_func;
|
||||
p_extension_funcs->free_property_list_func, // GDExtensionClassFreePropertyList2 free_property_list_func;
|
||||
p_extension_funcs->property_can_revert_func, // GDExtensionClassPropertyCanRevert property_can_revert_func;
|
||||
p_extension_funcs->property_get_revert_func, // GDExtensionClassPropertyGetRevert property_get_revert_func;
|
||||
p_extension_funcs->validate_property_func, // GDExtensionClassValidateProperty validate_property_func;
|
||||
p_extension_funcs->notification_func, // GDExtensionClassNotification2 notification_func;
|
||||
p_extension_funcs->to_string_func, // GDExtensionClassToString to_string_func;
|
||||
p_extension_funcs->reference_func, // GDExtensionClassReference reference_func;
|
||||
p_extension_funcs->unreference_func, // GDExtensionClassUnreference unreference_func;
|
||||
nullptr, // GDExtensionClassCreateInstance3 create_instance_func; /* this one is mandatory */
|
||||
p_extension_funcs->free_instance_func, // GDExtensionClassFreeInstance free_instance_func; /* this one is mandatory */
|
||||
p_extension_funcs->recreate_instance_func, // GDExtensionClassRecreateInstance recreate_instance_func;
|
||||
p_extension_funcs->get_virtual_func, // GDExtensionClassGetVirtual2 get_virtual_func;
|
||||
p_extension_funcs->get_virtual_call_data_func, // GDExtensionClassGetVirtualCallData2 get_virtual_call_data_func;
|
||||
p_extension_funcs->call_virtual_with_data_func, // GDExtensionClassCallVirtualWithData call_virtual_with_data_func;
|
||||
p_extension_funcs->class_userdata, // void *class_userdata;
|
||||
};
|
||||
|
||||
const ClassCreationDeprecatedInfo legacy = {
|
||||
!p_extension_funcs->is_exposed, // bool legacy_unexposed_class;
|
||||
nullptr, // GDExtensionClassNotification notification_func;
|
||||
nullptr, // GDExtensionClassFreePropertyList free_property_list_func;
|
||||
nullptr, // GDExtensionClassCreateInstance2 create_instance_func;
|
||||
nullptr, // GDExtensionClassGetRID get_rid;
|
||||
nullptr, // GDExtensionClassGetVirtual get_virtual_func;
|
||||
nullptr, // GDExtensionClassCreateInstance create_instance_func;
|
||||
p_extension_funcs->create_instance_func, // GDExtensionClassCreateInstance2 create_instance2_func;
|
||||
nullptr, // GDExtensionClassGetRID get_rid_func;
|
||||
nullptr, // GDExtensionClassGetVirtual get_virtual_func;
|
||||
nullptr, // GDExtensionClassGetVirtualCallData get_virtual_call_data_func;
|
||||
};
|
||||
_register_extension_class_internal(p_library, p_class_name, p_parent_class_name, &class_info5, &legacy);
|
||||
_register_extension_class_internal(p_library, p_class_name, p_parent_class_name, &class_info6, &legacy);
|
||||
}
|
||||
|
||||
void GDExtension::_register_extension_class5(GDExtensionClassLibraryPtr p_library, GDExtensionConstStringNamePtr p_class_name, GDExtensionConstStringNamePtr p_parent_class_name, const GDExtensionClassCreationInfo5 *p_extension_funcs) {
|
||||
const GDExtensionClassCreationInfo6 class_info6 = {
|
||||
p_extension_funcs->is_virtual, // GDExtensionBool is_virtual;
|
||||
p_extension_funcs->is_abstract, // GDExtensionBool is_abstract;
|
||||
p_extension_funcs->is_exposed, // GDExtensionBool is_exposed;
|
||||
p_extension_funcs->is_runtime, // GDExtensionBool is_runtime;
|
||||
p_extension_funcs->icon_path, // GDExtensionConstStringPtr icon_path;
|
||||
p_extension_funcs->set_func, // GDExtensionClassSet set_func;
|
||||
p_extension_funcs->get_func, // GDExtensionClassGet get_func;
|
||||
p_extension_funcs->get_property_list_func, // GDExtensionClassGetPropertyList get_property_list_func;
|
||||
p_extension_funcs->free_property_list_func, // GDExtensionClassFreePropertyList2 free_property_list_func;
|
||||
p_extension_funcs->property_can_revert_func, // GDExtensionClassPropertyCanRevert property_can_revert_func;
|
||||
p_extension_funcs->property_get_revert_func, // GDExtensionClassPropertyGetRevert property_get_revert_func;
|
||||
p_extension_funcs->validate_property_func, // GDExtensionClassValidateProperty validate_property_func;
|
||||
p_extension_funcs->notification_func, // GDExtensionClassNotification2 notification_func;
|
||||
p_extension_funcs->to_string_func, // GDExtensionClassToString to_string_func;
|
||||
p_extension_funcs->reference_func, // GDExtensionClassReference reference_func;
|
||||
p_extension_funcs->unreference_func, // GDExtensionClassUnreference unreference_func;
|
||||
nullptr, // GDExtensionClassCreateInstance3 create_instance_func; /* this one is mandatory */
|
||||
p_extension_funcs->free_instance_func, // GDExtensionClassFreeInstance free_instance_func; /* this one is mandatory */
|
||||
p_extension_funcs->recreate_instance_func, // GDExtensionClassRecreateInstance recreate_instance_func;
|
||||
p_extension_funcs->get_virtual_func, // GDExtensionClassGetVirtual2 get_virtual_func;
|
||||
p_extension_funcs->get_virtual_call_data_func, // GDExtensionClassGetVirtualCallData2 get_virtual_call_data_func;
|
||||
p_extension_funcs->call_virtual_with_data_func, // GDExtensionClassCallVirtualWithData call_virtual_with_data_func;
|
||||
p_extension_funcs->class_userdata, // void *class_userdata;
|
||||
};
|
||||
|
||||
const ClassCreationDeprecatedInfo legacy = {
|
||||
false, // bool legacy_unexposed_class;
|
||||
nullptr, // GDExtensionClassNotification notification_func;
|
||||
nullptr, // GDExtensionClassFreePropertyList free_property_list_func;
|
||||
nullptr, // GDExtensionClassCreateInstance create_instance_func;
|
||||
p_extension_funcs->create_instance_func, // GDExtensionClassCreateInstance2 create_instance2_func;
|
||||
nullptr, // GDExtensionClassGetRID get_rid_func;
|
||||
nullptr, // GDExtensionClassGetVirtual get_virtual_func;
|
||||
nullptr, // GDExtensionClassGetVirtualCallData get_virtual_call_data_func;
|
||||
};
|
||||
_register_extension_class_internal(p_library, p_class_name, p_parent_class_name, &class_info6, &legacy);
|
||||
}
|
||||
#endif // DISABLE_DEPRECATED
|
||||
|
||||
void GDExtension::_register_extension_class5(GDExtensionClassLibraryPtr p_library, GDExtensionConstStringNamePtr p_class_name, GDExtensionConstStringNamePtr p_parent_class_name, const GDExtensionClassCreationInfo5 *p_extension_funcs) {
|
||||
void GDExtension::_register_extension_class6(GDExtensionClassLibraryPtr p_library, GDExtensionConstStringNamePtr p_class_name, GDExtensionConstStringNamePtr p_parent_class_name, const GDExtensionClassCreationInfo6 *p_extension_funcs) {
|
||||
_register_extension_class_internal(p_library, p_class_name, p_parent_class_name, p_extension_funcs);
|
||||
}
|
||||
|
||||
void GDExtension::_register_extension_class_internal(GDExtensionClassLibraryPtr p_library, GDExtensionConstStringNamePtr p_class_name, GDExtensionConstStringNamePtr p_parent_class_name, const GDExtensionClassCreationInfo5 *p_extension_funcs, const ClassCreationDeprecatedInfo *p_deprecated_funcs) {
|
||||
void GDExtension::_register_extension_class_internal(GDExtensionClassLibraryPtr p_library, GDExtensionConstStringNamePtr p_class_name, GDExtensionConstStringNamePtr p_parent_class_name, const GDExtensionClassCreationInfo6 *p_extension_funcs, const ClassCreationDeprecatedInfo *p_deprecated_funcs) {
|
||||
GDExtension *self = reinterpret_cast<GDExtension *>(p_library);
|
||||
|
||||
StringName class_name = *reinterpret_cast<const StringName *>(p_class_name);
|
||||
|
|
@ -461,6 +530,7 @@ void GDExtension::_register_extension_class_internal(GDExtensionClassLibraryPtr
|
|||
extension->gdextension.notification = p_deprecated_funcs->notification_func;
|
||||
extension->gdextension.free_property_list = p_deprecated_funcs->free_property_list_func;
|
||||
extension->gdextension.create_instance = p_deprecated_funcs->create_instance_func;
|
||||
extension->gdextension.create_instance2 = p_deprecated_funcs->create_instance2_func;
|
||||
extension->gdextension.get_rid = p_deprecated_funcs->get_rid_func;
|
||||
extension->gdextension.get_virtual = p_deprecated_funcs->get_virtual_func;
|
||||
extension->gdextension.get_virtual_call_data = p_deprecated_funcs->get_virtual_call_data_func;
|
||||
|
|
@ -471,7 +541,7 @@ void GDExtension::_register_extension_class_internal(GDExtensionClassLibraryPtr
|
|||
extension->gdextension.reference = p_extension_funcs->reference_func;
|
||||
extension->gdextension.unreference = p_extension_funcs->unreference_func;
|
||||
extension->gdextension.class_userdata = p_extension_funcs->class_userdata;
|
||||
extension->gdextension.create_instance2 = p_extension_funcs->create_instance_func;
|
||||
extension->gdextension.create_instance3 = p_extension_funcs->create_instance_func;
|
||||
extension->gdextension.free_instance = p_extension_funcs->free_instance_func;
|
||||
extension->gdextension.recreate_instance = p_extension_funcs->recreate_instance_func;
|
||||
extension->gdextension.get_virtual2 = p_extension_funcs->get_virtual_func;
|
||||
|
|
@ -824,8 +894,9 @@ void GDExtension::initialize_gdextensions() {
|
|||
register_interface_function("classdb_register_extension_class2", (GDExtensionInterfaceFunctionPtr)&GDExtension::_register_extension_class2);
|
||||
register_interface_function("classdb_register_extension_class3", (GDExtensionInterfaceFunctionPtr)&GDExtension::_register_extension_class3);
|
||||
register_interface_function("classdb_register_extension_class4", (GDExtensionInterfaceFunctionPtr)&GDExtension::_register_extension_class4);
|
||||
#endif // DISABLE_DEPRECATED
|
||||
register_interface_function("classdb_register_extension_class5", (GDExtensionInterfaceFunctionPtr)&GDExtension::_register_extension_class5);
|
||||
#endif // DISABLE_DEPRECATED
|
||||
register_interface_function("classdb_register_extension_class6", (GDExtensionInterfaceFunctionPtr)&GDExtension::_register_extension_class6);
|
||||
register_interface_function("classdb_register_extension_class_method", (GDExtensionInterfaceFunctionPtr)&GDExtension::_register_extension_class_method);
|
||||
register_interface_function("classdb_register_extension_class_virtual_method", (GDExtensionInterfaceFunctionPtr)&GDExtension::_register_extension_class_virtual_method);
|
||||
register_interface_function("classdb_register_extension_class_integer_constant", (GDExtensionInterfaceFunctionPtr)&GDExtension::_register_extension_class_integer_constant);
|
||||
|
|
@ -844,68 +915,7 @@ void GDExtension::finalize_gdextensions() {
|
|||
gdextension_interface_functions.clear();
|
||||
}
|
||||
|
||||
Error GDExtensionResourceLoader::load_gdextension_resource(const String &p_path, Ref<GDExtension> &p_extension) {
|
||||
ERR_FAIL_COND_V_MSG(p_extension.is_valid() && p_extension->is_library_open(), ERR_ALREADY_IN_USE, "Cannot load GDExtension resource into already opened library.");
|
||||
|
||||
GDExtensionManager *extension_manager = GDExtensionManager::get_singleton();
|
||||
|
||||
GDExtensionManager::LoadStatus status = extension_manager->load_extension(p_path);
|
||||
if (status != GDExtensionManager::LOAD_STATUS_OK && status != GDExtensionManager::LOAD_STATUS_ALREADY_LOADED) {
|
||||
// Errors already logged in load_extension().
|
||||
return FAILED;
|
||||
}
|
||||
|
||||
p_extension = extension_manager->get_extension(p_path);
|
||||
return OK;
|
||||
}
|
||||
|
||||
Ref<Resource> GDExtensionResourceLoader::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) {
|
||||
// We can't have two GDExtension resource object representing the same library, because
|
||||
// loading (or unloading) a GDExtension affects global data. So, we need reuse the same
|
||||
// object if one has already been loaded (even if caching is disabled at the resource
|
||||
// loader level).
|
||||
GDExtensionManager *manager = GDExtensionManager::get_singleton();
|
||||
if (manager->is_extension_loaded(p_path)) {
|
||||
return manager->get_extension(p_path);
|
||||
}
|
||||
|
||||
Ref<GDExtension> lib;
|
||||
Error err = load_gdextension_resource(p_path, lib);
|
||||
if (err != OK && r_error) {
|
||||
// Errors already logged in load_gdextension_resource().
|
||||
*r_error = err;
|
||||
}
|
||||
return lib;
|
||||
}
|
||||
|
||||
void GDExtensionResourceLoader::get_recognized_extensions(List<String> *p_extensions) const {
|
||||
p_extensions->push_back("gdextension");
|
||||
}
|
||||
|
||||
bool GDExtensionResourceLoader::handles_type(const String &p_type) const {
|
||||
return p_type == "GDExtension";
|
||||
}
|
||||
|
||||
String GDExtensionResourceLoader::get_resource_type(const String &p_path) const {
|
||||
if (p_path.has_extension("gdextension")) {
|
||||
return "GDExtension";
|
||||
}
|
||||
return "";
|
||||
}
|
||||
|
||||
#ifdef TOOLS_ENABLED
|
||||
void GDExtensionResourceLoader::get_classes_used(const String &p_path, HashSet<StringName> *r_classes) {
|
||||
Ref<GDExtension> gdext = ResourceLoader::load(p_path);
|
||||
if (gdext.is_null()) {
|
||||
return;
|
||||
}
|
||||
|
||||
for (const StringName class_name : gdext->get_classes_used()) {
|
||||
if (ClassDB::class_exists(class_name)) {
|
||||
r_classes->insert(class_name);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
bool GDExtension::has_library_changed() const {
|
||||
return loader->has_library_changed();
|
||||
|
|
@ -950,7 +960,7 @@ void GDExtension::prepare_reload() {
|
|||
state.push_back(Pair<String, Variant>(P.name, value));
|
||||
}
|
||||
E.value.instance_state[obj_id] = {
|
||||
state, // List<Pair<String, Variant>> properties;
|
||||
std::move(state), // List<Pair<String, Variant>> properties;
|
||||
obj->is_extension_placeholder(), // bool is_placeholder;
|
||||
};
|
||||
}
|
||||
|
|
|
|||
|
|
@ -32,9 +32,7 @@
|
|||
|
||||
#include "core/extension/gdextension_interface.gen.h"
|
||||
#include "core/extension/gdextension_loader.h"
|
||||
#include "core/io/config_file.h"
|
||||
#include "core/io/resource_loader.h"
|
||||
#include "core/object/ref_counted.h"
|
||||
#include "core/io/resource.h"
|
||||
|
||||
class GDExtensionMethodBind;
|
||||
|
||||
|
|
@ -71,6 +69,7 @@ class GDExtension : public Resource {
|
|||
GDExtensionClassNotification notification_func = nullptr;
|
||||
GDExtensionClassFreePropertyList free_property_list_func = nullptr;
|
||||
GDExtensionClassCreateInstance create_instance_func = nullptr;
|
||||
GDExtensionClassCreateInstance2 create_instance2_func = nullptr;
|
||||
GDExtensionClassGetRID get_rid_func = nullptr;
|
||||
GDExtensionClassGetVirtual get_virtual_func = nullptr;
|
||||
GDExtensionClassGetVirtualCallData get_virtual_call_data_func = nullptr;
|
||||
|
|
@ -82,9 +81,10 @@ class GDExtension : public Resource {
|
|||
static void _register_extension_class2(GDExtensionClassLibraryPtr p_library, GDExtensionConstStringNamePtr p_class_name, GDExtensionConstStringNamePtr p_parent_class_name, const GDExtensionClassCreationInfo2 *p_extension_funcs);
|
||||
static void _register_extension_class3(GDExtensionClassLibraryPtr p_library, GDExtensionConstStringNamePtr p_class_name, GDExtensionConstStringNamePtr p_parent_class_name, const GDExtensionClassCreationInfo3 *p_extension_funcs);
|
||||
static void _register_extension_class4(GDExtensionClassLibraryPtr p_library, GDExtensionConstStringNamePtr p_class_name, GDExtensionConstStringNamePtr p_parent_class_name, const GDExtensionClassCreationInfo4 *p_extension_funcs);
|
||||
#endif // DISABLE_DEPRECATED
|
||||
static void _register_extension_class5(GDExtensionClassLibraryPtr p_library, GDExtensionConstStringNamePtr p_class_name, GDExtensionConstStringNamePtr p_parent_class_name, const GDExtensionClassCreationInfo5 *p_extension_funcs);
|
||||
static void _register_extension_class_internal(GDExtensionClassLibraryPtr p_library, GDExtensionConstStringNamePtr p_class_name, GDExtensionConstStringNamePtr p_parent_class_name, const GDExtensionClassCreationInfo5 *p_extension_funcs, const ClassCreationDeprecatedInfo *p_deprecated_funcs = nullptr);
|
||||
#endif // DISABLE_DEPRECATED
|
||||
static void _register_extension_class6(GDExtensionClassLibraryPtr p_library, GDExtensionConstStringNamePtr p_class_name, GDExtensionConstStringNamePtr p_parent_class_name, const GDExtensionClassCreationInfo6 *p_extension_funcs);
|
||||
static void _register_extension_class_internal(GDExtensionClassLibraryPtr p_library, GDExtensionConstStringNamePtr p_class_name, GDExtensionConstStringNamePtr p_parent_class_name, const GDExtensionClassCreationInfo6 *p_extension_funcs, const ClassCreationDeprecatedInfo *p_deprecated_funcs = nullptr);
|
||||
static void _register_extension_class_method(GDExtensionClassLibraryPtr p_library, GDExtensionConstStringNamePtr p_class_name, const GDExtensionClassMethodInfo *p_method_info);
|
||||
static void _register_extension_class_virtual_method(GDExtensionClassLibraryPtr p_library, GDExtensionConstStringNamePtr p_class_name, const GDExtensionClassVirtualMethodInfo *p_method_info);
|
||||
static void _register_extension_class_integer_constant(GDExtensionClassLibraryPtr p_library, GDExtensionConstStringNamePtr p_class_name, GDExtensionConstStringNamePtr p_enum_name, GDExtensionConstStringNamePtr p_constant_name, GDExtensionInt p_constant_value, GDExtensionBool p_is_bitfield);
|
||||
|
|
@ -182,21 +182,6 @@ public:
|
|||
|
||||
VARIANT_ENUM_CAST(GDExtension::InitializationLevel)
|
||||
|
||||
class GDExtensionResourceLoader : public ResourceFormatLoader {
|
||||
GDSOFTCLASS(GDExtensionResourceLoader, ResourceFormatLoader);
|
||||
|
||||
public:
|
||||
static Error load_gdextension_resource(const String &p_path, Ref<GDExtension> &p_extension);
|
||||
|
||||
virtual Ref<Resource> load(const String &p_path, const String &p_original_path, Error *r_error, bool p_use_sub_threads = false, float *r_progress = nullptr, CacheMode p_cache_mode = CACHE_MODE_REUSE) override;
|
||||
virtual void get_recognized_extensions(List<String> *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;
|
||||
#ifdef TOOLS_ENABLED
|
||||
virtual void get_classes_used(const String &p_path, HashSet<StringName> *r_classes) override;
|
||||
#endif // TOOLS_ENABLED
|
||||
};
|
||||
|
||||
#ifdef TOOLS_ENABLED
|
||||
class GDExtensionEditorPlugins {
|
||||
private:
|
||||
|
|
|
|||
|
|
@ -30,7 +30,7 @@
|
|||
|
||||
#include "gdextension_function_loader.h"
|
||||
|
||||
#include "gdextension.h"
|
||||
#include "core/extension/gdextension.h"
|
||||
|
||||
Error GDExtensionFunctionLoader::open_library(const String &p_path) {
|
||||
ERR_FAIL_COND_V_MSG(!p_path.begins_with("libgodot://"), ERR_FILE_NOT_FOUND, "Function based GDExtensions should have a path starting with libgodot://");
|
||||
|
|
|
|||
|
|
@ -31,7 +31,6 @@
|
|||
#pragma once
|
||||
|
||||
#include "core/extension/gdextension_loader.h"
|
||||
#include "core/os/shared_object.h"
|
||||
|
||||
class GDExtension;
|
||||
|
||||
|
|
|
|||
|
|
@ -77,7 +77,7 @@ class CallableCustomExtension : public CallableCustom {
|
|||
const CallableCustomExtension *b = static_cast<const CallableCustomExtension *>(p_b);
|
||||
|
||||
if (a->call_func != b->call_func) {
|
||||
return a->call_func < b->call_func;
|
||||
return (uintptr_t)a->call_func < (uintptr_t)b->call_func;
|
||||
}
|
||||
return a->userdata < b->userdata;
|
||||
}
|
||||
|
|
@ -547,6 +547,11 @@ static void gdextension_variant_get_type_name(GDExtensionVariantType p_type, GDE
|
|||
memnew_placement(r_ret, String(name));
|
||||
}
|
||||
|
||||
static GDExtensionVariantType gdextension_variant_get_type_by_name(GDExtensionConstStringPtr p_type) {
|
||||
const String *type = (const String *)p_type;
|
||||
return static_cast<GDExtensionVariantType>(Variant::get_type_by_name(*type));
|
||||
}
|
||||
|
||||
static GDExtensionBool gdextension_variant_can_convert(GDExtensionVariantType p_from, GDExtensionVariantType p_to) {
|
||||
return Variant::can_convert((Variant::Type)p_from, (Variant::Type)p_to);
|
||||
}
|
||||
|
|
@ -1652,12 +1657,17 @@ static GDExtensionObjectPtr gdextension_classdb_construct_object(GDExtensionCons
|
|||
const StringName classname = *reinterpret_cast<const StringName *>(p_classname);
|
||||
return (GDExtensionObjectPtr)ClassDB::instantiate_no_placeholders(classname);
|
||||
}
|
||||
#endif
|
||||
|
||||
static GDExtensionObjectPtr gdextension_classdb_construct_object2(GDExtensionConstStringNamePtr p_classname) {
|
||||
const StringName classname = *reinterpret_cast<const StringName *>(p_classname);
|
||||
return (GDExtensionObjectPtr)ClassDB::instantiate_without_postinitialization(classname);
|
||||
}
|
||||
#endif
|
||||
|
||||
static GDExtensionObjectPtr gdextension_classdb_construct_object3(GDExtensionConstStringNamePtr p_classname) {
|
||||
const StringName classname = *reinterpret_cast<const StringName *>(p_classname);
|
||||
return (GDExtensionObjectPtr)ClassDB::instantiate_without_postinitialization_with_refcount(classname);
|
||||
}
|
||||
|
||||
static void *gdextension_classdb_get_class_tag(GDExtensionConstStringNamePtr p_classname) {
|
||||
const StringName classname = *reinterpret_cast<const StringName *>(p_classname);
|
||||
|
|
@ -1743,6 +1753,7 @@ void gdextension_setup_interface() {
|
|||
REGISTER_INTERFACE_FUNC(variant_has_key);
|
||||
REGISTER_INTERFACE_FUNC(variant_get_object_instance_id);
|
||||
REGISTER_INTERFACE_FUNC(variant_get_type_name);
|
||||
REGISTER_INTERFACE_FUNC(variant_get_type_by_name);
|
||||
REGISTER_INTERFACE_FUNC(variant_can_convert);
|
||||
REGISTER_INTERFACE_FUNC(variant_can_convert_strict);
|
||||
REGISTER_INTERFACE_FUNC(get_variant_from_type_constructor);
|
||||
|
|
@ -1856,8 +1867,9 @@ void gdextension_setup_interface() {
|
|||
REGISTER_INTERFACE_FUNC(callable_custom_get_userdata);
|
||||
#ifndef DISABLE_DEPRECATED
|
||||
REGISTER_INTERFACE_FUNC(classdb_construct_object);
|
||||
#endif // DISABLE_DEPRECATED
|
||||
REGISTER_INTERFACE_FUNC(classdb_construct_object2);
|
||||
#endif // DISABLE_DEPRECATED
|
||||
REGISTER_INTERFACE_FUNC(classdb_construct_object3);
|
||||
REGISTER_INTERFACE_FUNC(classdb_get_method_bind);
|
||||
REGISTER_INTERFACE_FUNC(classdb_get_class_tag);
|
||||
REGISTER_INTERFACE_FUNC(editor_add_plugin);
|
||||
|
|
|
|||
|
|
@ -986,7 +986,11 @@
|
|||
"name": "p_list",
|
||||
"type": "const GDExtensionPropertyInfo*"
|
||||
}
|
||||
]
|
||||
],
|
||||
"deprecated": {
|
||||
"since": "4.3",
|
||||
"replace_with": "GDExtensionClassFreePropertyList2"
|
||||
}
|
||||
},
|
||||
{
|
||||
"name": "GDExtensionClassFreePropertyList2",
|
||||
|
|
@ -1164,7 +1168,15 @@
|
|||
"name": "p_class_userdata",
|
||||
"type": "void*"
|
||||
}
|
||||
]
|
||||
],
|
||||
"description": [
|
||||
"Called to construct an instance of the class.",
|
||||
"For classes descending from RefCounted, the reference count should be zero."
|
||||
],
|
||||
"deprecated": {
|
||||
"since": "4.4",
|
||||
"replace_with": "GDExtensionClassCreateInstance3"
|
||||
}
|
||||
},
|
||||
{
|
||||
"name": "GDExtensionClassCreateInstance2",
|
||||
|
|
@ -1181,6 +1193,35 @@
|
|||
"name": "p_notify_postinitialize",
|
||||
"type": "GDExtensionBool"
|
||||
}
|
||||
],
|
||||
"description": [
|
||||
"Called to construct an instance of the class.",
|
||||
"For classes descending from RefCounted, the reference count should be zero."
|
||||
],
|
||||
"deprecated": {
|
||||
"since": "4.7",
|
||||
"replace_with": "GDExtensionClassCreateInstance3"
|
||||
}
|
||||
},
|
||||
{
|
||||
"name": "GDExtensionClassCreateInstance3",
|
||||
"kind": "function",
|
||||
"return_value": {
|
||||
"type": "GDExtensionObjectPtr"
|
||||
},
|
||||
"arguments": [
|
||||
{
|
||||
"name": "p_class_userdata",
|
||||
"type": "void*"
|
||||
},
|
||||
{
|
||||
"name": "p_notify_postinitialize",
|
||||
"type": "GDExtensionBool"
|
||||
}
|
||||
],
|
||||
"description": [
|
||||
"Called to construct an instance of the class.",
|
||||
"For classes descending from RefCounted, the reference count should already be incremented by 1."
|
||||
]
|
||||
},
|
||||
{
|
||||
|
|
@ -1229,7 +1270,11 @@
|
|||
"name": "p_name",
|
||||
"type": "GDExtensionConstStringNamePtr"
|
||||
}
|
||||
]
|
||||
],
|
||||
"deprecated": {
|
||||
"since": "4.4",
|
||||
"replace_with": "GDExtensionClassGetVirtual2"
|
||||
}
|
||||
},
|
||||
{
|
||||
"name": "GDExtensionClassGetVirtual2",
|
||||
|
|
@ -1267,7 +1312,11 @@
|
|||
"name": "p_name",
|
||||
"type": "GDExtensionConstStringNamePtr"
|
||||
}
|
||||
]
|
||||
],
|
||||
"deprecated": {
|
||||
"since": "4.4",
|
||||
"replace_with": "GDExtensionClassGetVirtualCallData2"
|
||||
}
|
||||
},
|
||||
{
|
||||
"name": "GDExtensionClassGetVirtualCallData2",
|
||||
|
|
@ -1372,7 +1421,7 @@
|
|||
"name": "create_instance_func",
|
||||
"type": "GDExtensionClassCreateInstance",
|
||||
"description": [
|
||||
"(Default) constructor; mandatory. If the class is not instantiable, consider making it virtual or abstract."
|
||||
"Class constructor. Required unless the class is virtual or abstract."
|
||||
]
|
||||
},
|
||||
{
|
||||
|
|
@ -1403,7 +1452,7 @@
|
|||
],
|
||||
"deprecated": {
|
||||
"since": "4.2",
|
||||
"replace_with": "GDExtensionClassCreationInfo4"
|
||||
"replace_with": "GDExtensionClassCreationInfo6"
|
||||
}
|
||||
},
|
||||
{
|
||||
|
|
@ -1470,7 +1519,7 @@
|
|||
"name": "create_instance_func",
|
||||
"type": "GDExtensionClassCreateInstance",
|
||||
"description": [
|
||||
"(Default) constructor; mandatory. If the class is not instantiable, consider making it virtual or abstract."
|
||||
"Class constructor. Required unless the class is virtual or abstract."
|
||||
]
|
||||
},
|
||||
{
|
||||
|
|
@ -1524,7 +1573,7 @@
|
|||
],
|
||||
"deprecated": {
|
||||
"since": "4.3",
|
||||
"replace_with": "GDExtensionClassCreationInfo4"
|
||||
"replace_with": "GDExtensionClassCreationInfo6"
|
||||
}
|
||||
},
|
||||
{
|
||||
|
|
@ -1595,7 +1644,7 @@
|
|||
"name": "create_instance_func",
|
||||
"type": "GDExtensionClassCreateInstance",
|
||||
"description": [
|
||||
"(Default) constructor; mandatory. If the class is not instantiable, consider making it virtual or abstract."
|
||||
"Class constructor. Required unless the class is virtual or abstract."
|
||||
]
|
||||
},
|
||||
{
|
||||
|
|
@ -1649,7 +1698,7 @@
|
|||
],
|
||||
"deprecated": {
|
||||
"since": "4.4",
|
||||
"replace_with": "GDExtensionClassCreationInfo4"
|
||||
"replace_with": "GDExtensionClassCreationInfo6"
|
||||
}
|
||||
},
|
||||
{
|
||||
|
|
@ -1724,7 +1773,141 @@
|
|||
"name": "create_instance_func",
|
||||
"type": "GDExtensionClassCreateInstance2",
|
||||
"description": [
|
||||
"(Default) constructor; mandatory. If the class is not instantiable, consider making it virtual or abstract."
|
||||
"Class constructor. Required unless the class is virtual or abstract."
|
||||
]
|
||||
},
|
||||
{
|
||||
"name": "free_instance_func",
|
||||
"type": "GDExtensionClassFreeInstance",
|
||||
"description": [
|
||||
"Destructor; mandatory."
|
||||
]
|
||||
},
|
||||
{
|
||||
"name": "recreate_instance_func",
|
||||
"type": "GDExtensionClassRecreateInstance"
|
||||
},
|
||||
{
|
||||
"name": "get_virtual_func",
|
||||
"type": "GDExtensionClassGetVirtual2",
|
||||
"description": [
|
||||
"Queries a virtual function by name and returns a callback to invoke the requested virtual function."
|
||||
]
|
||||
},
|
||||
{
|
||||
"name": "get_virtual_call_data_func",
|
||||
"type": "GDExtensionClassGetVirtualCallData2",
|
||||
"description": [
|
||||
"Paired with `call_virtual_with_data_func`, this is an alternative to `get_virtual_func` for extensions that",
|
||||
"need or benefit from extra data when calling virtual functions.",
|
||||
"Returns user data that will be passed to `call_virtual_with_data_func`.",
|
||||
"Returning `NULL` from this function signals to Godot that the virtual function is not overridden.",
|
||||
"Data returned from this function should be managed by the extension and must be valid until the extension is deinitialized.",
|
||||
"You should supply either `get_virtual_func`, or `get_virtual_call_data_func` with `call_virtual_with_data_func`."
|
||||
]
|
||||
},
|
||||
{
|
||||
"name": "call_virtual_with_data_func",
|
||||
"type": "GDExtensionClassCallVirtualWithData",
|
||||
"description": [
|
||||
"Used to call virtual functions when `get_virtual_call_data_func` is not null."
|
||||
]
|
||||
},
|
||||
{
|
||||
"name": "class_userdata",
|
||||
"type": "void*",
|
||||
"description": [
|
||||
"Per-class user data, later accessible in instance bindings."
|
||||
]
|
||||
}
|
||||
],
|
||||
"deprecated": {
|
||||
"since": "4.5",
|
||||
"replace_with": "GDExtensionClassCreationInfo6"
|
||||
}
|
||||
},
|
||||
{
|
||||
"name": "GDExtensionClassCreationInfo5",
|
||||
"kind": "alias",
|
||||
"type": "GDExtensionClassCreationInfo4",
|
||||
"deprecated": {
|
||||
"since": "4.7",
|
||||
"replace_with": "GDExtensionClassCreationInfo6"
|
||||
}
|
||||
},
|
||||
{
|
||||
"name": "GDExtensionClassCreationInfo6",
|
||||
"kind": "struct",
|
||||
"members": [
|
||||
{
|
||||
"name": "is_virtual",
|
||||
"type": "GDExtensionBool"
|
||||
},
|
||||
{
|
||||
"name": "is_abstract",
|
||||
"type": "GDExtensionBool"
|
||||
},
|
||||
{
|
||||
"name": "is_exposed",
|
||||
"type": "GDExtensionBool"
|
||||
},
|
||||
{
|
||||
"name": "is_runtime",
|
||||
"type": "GDExtensionBool"
|
||||
},
|
||||
{
|
||||
"name": "icon_path",
|
||||
"type": "GDExtensionConstStringPtr"
|
||||
},
|
||||
{
|
||||
"name": "set_func",
|
||||
"type": "GDExtensionClassSet"
|
||||
},
|
||||
{
|
||||
"name": "get_func",
|
||||
"type": "GDExtensionClassGet"
|
||||
},
|
||||
{
|
||||
"name": "get_property_list_func",
|
||||
"type": "GDExtensionClassGetPropertyList"
|
||||
},
|
||||
{
|
||||
"name": "free_property_list_func",
|
||||
"type": "GDExtensionClassFreePropertyList2"
|
||||
},
|
||||
{
|
||||
"name": "property_can_revert_func",
|
||||
"type": "GDExtensionClassPropertyCanRevert"
|
||||
},
|
||||
{
|
||||
"name": "property_get_revert_func",
|
||||
"type": "GDExtensionClassPropertyGetRevert"
|
||||
},
|
||||
{
|
||||
"name": "validate_property_func",
|
||||
"type": "GDExtensionClassValidateProperty"
|
||||
},
|
||||
{
|
||||
"name": "notification_func",
|
||||
"type": "GDExtensionClassNotification2"
|
||||
},
|
||||
{
|
||||
"name": "to_string_func",
|
||||
"type": "GDExtensionClassToString"
|
||||
},
|
||||
{
|
||||
"name": "reference_func",
|
||||
"type": "GDExtensionClassReference"
|
||||
},
|
||||
{
|
||||
"name": "unreference_func",
|
||||
"type": "GDExtensionClassUnreference"
|
||||
},
|
||||
{
|
||||
"name": "create_instance_func",
|
||||
"type": "GDExtensionClassCreateInstance3",
|
||||
"description": [
|
||||
"Class constructor. Required unless the class is virtual or abstract."
|
||||
]
|
||||
},
|
||||
{
|
||||
|
|
@ -1773,11 +1956,6 @@
|
|||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"name": "GDExtensionClassCreationInfo5",
|
||||
"kind": "alias",
|
||||
"type": "GDExtensionClassCreationInfo4"
|
||||
},
|
||||
{
|
||||
"name": "GDExtensionClassLibraryPtr",
|
||||
"kind": "handle"
|
||||
|
|
@ -3375,7 +3553,11 @@
|
|||
"name": "string",
|
||||
"type": "const char*"
|
||||
}
|
||||
]
|
||||
],
|
||||
"deprecated": {
|
||||
"since": "4.5",
|
||||
"replace_with": "GDExtensionGodotVersion2"
|
||||
}
|
||||
},
|
||||
{
|
||||
"name": "GDExtensionGodotVersion2",
|
||||
|
|
@ -4978,6 +5160,28 @@
|
|||
],
|
||||
"since": "4.1"
|
||||
},
|
||||
{
|
||||
"name": "variant_get_type_by_name",
|
||||
"return_value": {
|
||||
"type": "GDExtensionVariantType",
|
||||
"description": [
|
||||
"The variant type for the given name; otherwise VARIANT_MAX if name is invalid."
|
||||
]
|
||||
},
|
||||
"arguments": [
|
||||
{
|
||||
"name": "p_type_name",
|
||||
"type": "GDExtensionConstStringPtr",
|
||||
"description": [
|
||||
"The variant type name."
|
||||
]
|
||||
}
|
||||
],
|
||||
"description": [
|
||||
"Gets the Variant type by name."
|
||||
],
|
||||
"since": "4.7"
|
||||
},
|
||||
{
|
||||
"name": "variant_can_convert",
|
||||
"return_value": {
|
||||
|
|
@ -5859,7 +6063,7 @@
|
|||
"return_value": {
|
||||
"type": "GDExtensionInt",
|
||||
"description": [
|
||||
"The resulting encoded string length in characters (not bytes), not including a null terminator."
|
||||
"The resulting encoded string length in characters, not including a null terminator. Characters that cannot be converted to Latin-1 are replaced with a space."
|
||||
]
|
||||
},
|
||||
"arguments": [
|
||||
|
|
@ -5896,7 +6100,7 @@
|
|||
"return_value": {
|
||||
"type": "GDExtensionInt",
|
||||
"description": [
|
||||
"The resulting encoded string length in characters (not bytes), not including a null terminator."
|
||||
"The resulting encoded string length in bytes (not characters), not including a null terminator."
|
||||
]
|
||||
},
|
||||
"arguments": [
|
||||
|
|
@ -5933,7 +6137,7 @@
|
|||
"return_value": {
|
||||
"type": "GDExtensionInt",
|
||||
"description": [
|
||||
"The resulting encoded string length in characters (not bytes), not including a null terminator."
|
||||
"The resulting encoded string length in 16-bit code units (not bytes or characters), not including a null terminator."
|
||||
]
|
||||
},
|
||||
"arguments": [
|
||||
|
|
@ -6007,7 +6211,7 @@
|
|||
"return_value": {
|
||||
"type": "GDExtensionInt",
|
||||
"description": [
|
||||
"The resulting encoded string length in characters (not bytes), not including a null terminator."
|
||||
"The resulting encoded string length in characters (for UTF-32) or 16-bit code units (for UTF-16), depending on the wchar_t representation. Does not include a null terminator."
|
||||
]
|
||||
},
|
||||
"arguments": [
|
||||
|
|
@ -8242,7 +8446,7 @@
|
|||
"since": "4.1",
|
||||
"deprecated": {
|
||||
"since": "4.4",
|
||||
"replace_with": "classdb_construct_object2"
|
||||
"replace_with": "classdb_construct_object3"
|
||||
}
|
||||
},
|
||||
{
|
||||
|
|
@ -8268,7 +8472,37 @@
|
|||
"",
|
||||
"\"NOTIFICATION_POSTINITIALIZE\" must be sent after construction."
|
||||
],
|
||||
"since": "4.4"
|
||||
"since": "4.4",
|
||||
"deprecated": {
|
||||
"since": "4.7",
|
||||
"replace_with": "classdb_construct_object3"
|
||||
}
|
||||
},
|
||||
{
|
||||
"name": "classdb_construct_object3",
|
||||
"return_value": {
|
||||
"type": "GDExtensionObjectPtr",
|
||||
"description": [
|
||||
"A pointer to the newly created Object."
|
||||
]
|
||||
},
|
||||
"arguments": [
|
||||
{
|
||||
"name": "p_classname",
|
||||
"type": "GDExtensionConstStringNamePtr",
|
||||
"description": [
|
||||
"A pointer to a StringName with the class name."
|
||||
]
|
||||
}
|
||||
],
|
||||
"description": [
|
||||
"Constructs an Object of the requested class.",
|
||||
"The passed class must be a built-in godot class, or an already-registered extension class. In both cases, object_set_instance() should be called to fully initialize the object.",
|
||||
"If the type is a subtype of RefCounted, it already has a refcount of 1. The caller must take ownership the refcount and is responsible for decrementing it again when the object is no longer needed.",
|
||||
"",
|
||||
"\"NOTIFICATION_POSTINITIALIZE\" must be sent after construction."
|
||||
],
|
||||
"since": "4.7"
|
||||
},
|
||||
{
|
||||
"name": "classdb_get_method_bind",
|
||||
|
|
@ -8367,7 +8601,7 @@
|
|||
"since": "4.1",
|
||||
"deprecated": {
|
||||
"since": "4.2",
|
||||
"replace_with": "classdb_register_extension_class5"
|
||||
"replace_with": "classdb_register_extension_class6"
|
||||
}
|
||||
},
|
||||
{
|
||||
|
|
@ -8409,7 +8643,7 @@
|
|||
"since": "4.2",
|
||||
"deprecated": {
|
||||
"since": "4.3",
|
||||
"replace_with": "classdb_register_extension_class5"
|
||||
"replace_with": "classdb_register_extension_class6"
|
||||
}
|
||||
},
|
||||
{
|
||||
|
|
@ -8451,7 +8685,7 @@
|
|||
"since": "4.3",
|
||||
"deprecated": {
|
||||
"since": "4.4",
|
||||
"replace_with": "classdb_register_extension_class5"
|
||||
"replace_with": "classdb_register_extension_class6"
|
||||
}
|
||||
},
|
||||
{
|
||||
|
|
@ -8493,7 +8727,7 @@
|
|||
"since": "4.4",
|
||||
"deprecated": {
|
||||
"since": "4.5",
|
||||
"replace_with": "classdb_register_extension_class5"
|
||||
"replace_with": "classdb_register_extension_class6"
|
||||
}
|
||||
},
|
||||
{
|
||||
|
|
@ -8532,7 +8766,49 @@
|
|||
"Registers an extension class in the ClassDB.",
|
||||
"Provided struct can be safely freed once the function returns."
|
||||
],
|
||||
"since": "4.5"
|
||||
"since": "4.5",
|
||||
"deprecated": {
|
||||
"since": "4.7",
|
||||
"replace_with": "classdb_register_extension_class6"
|
||||
}
|
||||
},
|
||||
{
|
||||
"name": "classdb_register_extension_class6",
|
||||
"arguments": [
|
||||
{
|
||||
"name": "p_library",
|
||||
"type": "GDExtensionClassLibraryPtr",
|
||||
"description": [
|
||||
"A pointer the library received by the GDExtension's entry point function."
|
||||
]
|
||||
},
|
||||
{
|
||||
"name": "p_class_name",
|
||||
"type": "GDExtensionConstStringNamePtr",
|
||||
"description": [
|
||||
"A pointer to a StringName with the class name."
|
||||
]
|
||||
},
|
||||
{
|
||||
"name": "p_parent_class_name",
|
||||
"type": "GDExtensionConstStringNamePtr",
|
||||
"description": [
|
||||
"A pointer to a StringName with the parent class name."
|
||||
]
|
||||
},
|
||||
{
|
||||
"name": "p_extension_funcs",
|
||||
"type": "const GDExtensionClassCreationInfo6*",
|
||||
"description": [
|
||||
"A pointer to a GDExtensionClassCreationInfo6 struct."
|
||||
]
|
||||
}
|
||||
],
|
||||
"description": [
|
||||
"Registers an extension class in the ClassDB.",
|
||||
"Provided struct can be safely freed once the function returns."
|
||||
],
|
||||
"since": "4.7"
|
||||
},
|
||||
{
|
||||
"name": "classdb_register_extension_class_method",
|
||||
|
|
|
|||
|
|
@ -32,8 +32,8 @@
|
|||
|
||||
#include "gdextension_interface_header_generator.h"
|
||||
|
||||
#include "core/extension/gdextension_interface_dump.gen.h"
|
||||
#include "core/io/json.h"
|
||||
#include "gdextension_interface_dump.gen.h"
|
||||
|
||||
static const char *FILE_HEADER =
|
||||
"/**************************************************************************/\n"
|
||||
|
|
|
|||
|
|
@ -30,10 +30,12 @@
|
|||
|
||||
#include "gdextension_library_loader.h"
|
||||
|
||||
#include "core/config/engine.h"
|
||||
#include "core/config/project_settings.h"
|
||||
#include "core/extension/gdextension.h"
|
||||
#include "core/io/dir_access.h"
|
||||
#include "core/os/os.h"
|
||||
#include "core/version.h"
|
||||
#include "gdextension.h"
|
||||
|
||||
Vector<SharedObject> GDExtensionLibraryLoader::find_extension_dependencies(const String &p_path, Ref<ConfigFile> p_config, std::function<bool(String)> p_has_feature) {
|
||||
Vector<SharedObject> dependencies_shared_objects;
|
||||
|
|
|
|||
|
|
@ -30,12 +30,12 @@
|
|||
|
||||
#pragma once
|
||||
|
||||
#include <functional>
|
||||
|
||||
#include "core/extension/gdextension_loader.h"
|
||||
#include "core/io/config_file.h"
|
||||
#include "core/os/shared_object.h"
|
||||
|
||||
#include <functional>
|
||||
|
||||
class GDExtensionLibraryLoader : public GDExtensionLoader {
|
||||
GDSOFTCLASS(GDExtensionLibraryLoader, GDExtensionLoader);
|
||||
|
||||
|
|
|
|||
|
|
@ -30,12 +30,16 @@
|
|||
|
||||
#include "gdextension_manager.h"
|
||||
|
||||
#include "core/config/engine.h"
|
||||
#include "core/extension/gdextension_function_loader.h"
|
||||
#include "core/extension/gdextension_library_loader.h"
|
||||
#include "core/extension/gdextension_special_compat_hashes.h"
|
||||
#include "core/io/dir_access.h"
|
||||
#include "core/io/file_access.h"
|
||||
#include "core/object/callable_mp.h"
|
||||
#include "core/object/class_db.h"
|
||||
#include "core/object/script_language.h"
|
||||
#include "core/os/os.h"
|
||||
|
||||
GDExtensionManager::LoadStatus GDExtensionManager::_load_extension_internal(const Ref<GDExtension> &p_extension, bool p_first_load) {
|
||||
if (level >= 0) { // Already initialized up to some level.
|
||||
|
|
@ -477,8 +481,8 @@ void GDExtensionManager::_bind_methods() {
|
|||
BIND_ENUM_CONSTANT(LOAD_STATUS_NEEDS_RESTART);
|
||||
|
||||
ADD_SIGNAL(MethodInfo("extensions_reloaded"));
|
||||
ADD_SIGNAL(MethodInfo("extension_loaded", PropertyInfo(Variant::OBJECT, "extension", PROPERTY_HINT_RESOURCE_TYPE, "GDExtension")));
|
||||
ADD_SIGNAL(MethodInfo("extension_unloading", PropertyInfo(Variant::OBJECT, "extension", PROPERTY_HINT_RESOURCE_TYPE, "GDExtension")));
|
||||
ADD_SIGNAL(MethodInfo("extension_loaded", PropertyInfo(Variant::OBJECT, "extension", PROPERTY_HINT_RESOURCE_TYPE, GDExtension::get_class_static())));
|
||||
ADD_SIGNAL(MethodInfo("extension_unloading", PropertyInfo(Variant::OBJECT, "extension", PROPERTY_HINT_RESOURCE_TYPE, GDExtension::get_class_static())));
|
||||
}
|
||||
|
||||
GDExtensionManager::GDExtensionManager() {
|
||||
|
|
|
|||
98
engine/core/extension/gdextension_resource_format.cpp
Normal file
98
engine/core/extension/gdextension_resource_format.cpp
Normal file
|
|
@ -0,0 +1,98 @@
|
|||
/**************************************************************************/
|
||||
/* gdextension_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 "gdextension_resource_format.h"
|
||||
|
||||
#include "core/extension/gdextension_manager.h"
|
||||
#include "core/object/class_db.h"
|
||||
|
||||
Ref<Resource> GDExtensionResourceLoader::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) {
|
||||
// We can't have two GDExtension resource object representing the same library, because
|
||||
// loading (or unloading) a GDExtension affects global data. So, we need reuse the same
|
||||
// object if one has already been loaded (even if caching is disabled at the resource
|
||||
// loader level).
|
||||
GDExtensionManager *manager = GDExtensionManager::get_singleton();
|
||||
if (manager->is_extension_loaded(p_path)) {
|
||||
return manager->get_extension(p_path);
|
||||
}
|
||||
|
||||
Ref<GDExtension> lib;
|
||||
Error err = load_gdextension_resource(p_path, lib);
|
||||
if (err != OK && r_error) {
|
||||
// Errors already logged in load_gdextension_resource().
|
||||
*r_error = err;
|
||||
}
|
||||
return lib;
|
||||
}
|
||||
|
||||
void GDExtensionResourceLoader::get_recognized_extensions(List<String> *p_extensions) const {
|
||||
p_extensions->push_back("gdextension");
|
||||
}
|
||||
|
||||
bool GDExtensionResourceLoader::handles_type(const String &p_type) const {
|
||||
return p_type == "GDExtension";
|
||||
}
|
||||
|
||||
String GDExtensionResourceLoader::get_resource_type(const String &p_path) const {
|
||||
if (p_path.has_extension("gdextension")) {
|
||||
return "GDExtension";
|
||||
}
|
||||
return "";
|
||||
}
|
||||
|
||||
Error GDExtensionResourceLoader::load_gdextension_resource(const String &p_path, Ref<GDExtension> &p_extension) {
|
||||
ERR_FAIL_COND_V_MSG(p_extension.is_valid() && p_extension->is_library_open(), ERR_ALREADY_IN_USE, "Cannot load GDExtension resource into already opened library.");
|
||||
|
||||
GDExtensionManager *extension_manager = GDExtensionManager::get_singleton();
|
||||
|
||||
GDExtensionManager::LoadStatus status = extension_manager->load_extension(p_path);
|
||||
if (status != GDExtensionManager::LOAD_STATUS_OK && status != GDExtensionManager::LOAD_STATUS_ALREADY_LOADED) {
|
||||
// Errors already logged in load_extension().
|
||||
return FAILED;
|
||||
}
|
||||
|
||||
p_extension = extension_manager->get_extension(p_path);
|
||||
return OK;
|
||||
}
|
||||
|
||||
#ifdef TOOLS_ENABLED
|
||||
void GDExtensionResourceLoader::get_classes_used(const String &p_path, HashSet<StringName> *r_classes) {
|
||||
Ref<GDExtension> gdext = ResourceLoader::load(p_path);
|
||||
if (gdext.is_null()) {
|
||||
return;
|
||||
}
|
||||
|
||||
for (const StringName class_name : gdext->get_classes_used()) {
|
||||
if (ClassDB::class_exists(class_name)) {
|
||||
r_classes->insert(class_name);
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif // TOOLS_ENABLED
|
||||
49
engine/core/extension/gdextension_resource_format.h
Normal file
49
engine/core/extension/gdextension_resource_format.h
Normal file
|
|
@ -0,0 +1,49 @@
|
|||
/**************************************************************************/
|
||||
/* gdextension_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/extension/gdextension.h"
|
||||
#include "core/io/resource_loader.h"
|
||||
|
||||
class GDExtensionResourceLoader : public ResourceFormatLoader {
|
||||
GDSOFTCLASS(GDExtensionResourceLoader, ResourceFormatLoader);
|
||||
|
||||
public:
|
||||
static Error load_gdextension_resource(const String &p_path, Ref<GDExtension> &p_extension);
|
||||
|
||||
virtual Ref<Resource> load(const String &p_path, const String &p_original_path, Error *r_error, bool p_use_sub_threads = false, float *r_progress = nullptr, CacheMode p_cache_mode = CACHE_MODE_REUSE) override;
|
||||
virtual void get_recognized_extensions(List<String> *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;
|
||||
#ifdef TOOLS_ENABLED
|
||||
virtual void get_classes_used(const String &p_path, HashSet<StringName> *r_classes) override;
|
||||
#endif // TOOLS_ENABLED
|
||||
};
|
||||
|
|
@ -31,7 +31,9 @@
|
|||
#include "godot_instance.h"
|
||||
|
||||
#include "core/extension/gdextension_manager.h"
|
||||
#include "core/object/class_db.h"
|
||||
#include "core/os/main_loop.h"
|
||||
#include "core/os/os.h"
|
||||
#include "main/main.h"
|
||||
#include "servers/display/display_server.h"
|
||||
|
||||
|
|
|
|||
|
|
@ -31,7 +31,7 @@
|
|||
#pragma once
|
||||
|
||||
#include "core/extension/gdextension_interface.gen.h"
|
||||
#include "core/object/class_db.h"
|
||||
#include "core/object/object.h"
|
||||
|
||||
class GodotInstance : public Object {
|
||||
GDCLASS(GodotInstance, Object);
|
||||
|
|
|
|||
|
|
@ -30,7 +30,7 @@
|
|||
|
||||
#pragma once
|
||||
|
||||
#include "gdextension_interface.gen.h"
|
||||
#include "core/extension/gdextension_interface.gen.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
|
|
|
|||
|
|
@ -17,7 +17,7 @@ def run(target, source, env):
|
|||
inline constexpr int _gdextension_interface_data_compressed_size = {len(buffer)};
|
||||
inline constexpr int _gdextension_interface_data_uncompressed_size = {decomp_size};
|
||||
inline constexpr unsigned char _gdextension_interface_data_compressed[] = {{
|
||||
{methods.format_buffer(buffer, 1)}
|
||||
{methods.format_buffer(buffer, 1)}
|
||||
}};
|
||||
|
||||
class GDExtensionInterfaceDump {{
|
||||
|
|
|
|||
|
|
@ -30,6 +30,10 @@
|
|||
|
||||
#ifndef DISABLE_DEPRECATED
|
||||
|
||||
#include "input.h"
|
||||
|
||||
#include "core/object/class_db.h"
|
||||
|
||||
void Input::_vibrate_handheld_bind_compat_91143(int p_duration_ms) {
|
||||
vibrate_handheld(p_duration_ms, -1.0);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -31,15 +31,21 @@
|
|||
#include "input.h"
|
||||
#include "input.compat.inc"
|
||||
|
||||
#include "core/config/engine.h"
|
||||
#include "core/config/project_settings.h"
|
||||
#include "core/input/default_controller_mappings.h"
|
||||
#include "core/input/input_map.h"
|
||||
#include "core/object/class_db.h"
|
||||
#include "core/os/os.h"
|
||||
|
||||
#ifdef DEV_ENABLED
|
||||
#include "core/os/thread.h"
|
||||
#endif
|
||||
|
||||
#include <thirdparty/gamepadmotionhelpers/GamepadMotion.hpp>
|
||||
|
||||
#define STANDARD_GRAVITY 9.80665f
|
||||
|
||||
static const char *_joy_buttons[(size_t)JoyButton::SDL_MAX] = {
|
||||
"a",
|
||||
"b",
|
||||
|
|
@ -62,6 +68,11 @@ static const char *_joy_buttons[(size_t)JoyButton::SDL_MAX] = {
|
|||
"paddle3",
|
||||
"paddle4",
|
||||
"touchpad",
|
||||
"misc2",
|
||||
"misc3",
|
||||
"misc4",
|
||||
"misc5",
|
||||
"misc6",
|
||||
};
|
||||
|
||||
static const char *_joy_axes[(size_t)JoyAxis::SDL_MAX] = {
|
||||
|
|
@ -114,6 +125,8 @@ bool Input::is_mouse_mode_override_enabled() {
|
|||
}
|
||||
|
||||
void Input::_bind_methods() {
|
||||
using namespace InputClassEnums;
|
||||
|
||||
ClassDB::bind_method(D_METHOD("is_anything_pressed"), &Input::is_anything_pressed);
|
||||
ClassDB::bind_method(D_METHOD("is_key_pressed", "keycode"), &Input::is_key_pressed);
|
||||
ClassDB::bind_method(D_METHOD("is_physical_key_pressed", "keycode"), &Input::is_physical_key_pressed);
|
||||
|
|
@ -140,13 +153,32 @@ void Input::_bind_methods() {
|
|||
ClassDB::bind_method(D_METHOD("get_connected_joypads"), &Input::get_connected_joypads);
|
||||
ClassDB::bind_method(D_METHOD("get_joy_vibration_strength", "device"), &Input::get_joy_vibration_strength);
|
||||
ClassDB::bind_method(D_METHOD("get_joy_vibration_duration", "device"), &Input::get_joy_vibration_duration);
|
||||
ClassDB::bind_method(D_METHOD("get_joy_vibration_remaining_duration", "device"), &Input::get_joy_vibration_remaining_duration);
|
||||
ClassDB::bind_method(D_METHOD("is_joy_vibrating", "device"), &Input::is_joy_vibrating);
|
||||
ClassDB::bind_method(D_METHOD("has_joy_vibration", "device"), &Input::has_joy_vibration);
|
||||
ClassDB::bind_method(D_METHOD("start_joy_vibration", "device", "weak_magnitude", "strong_magnitude", "duration"), &Input::start_joy_vibration, DEFVAL(0));
|
||||
ClassDB::bind_method(D_METHOD("stop_joy_vibration", "device"), &Input::stop_joy_vibration);
|
||||
ClassDB::bind_method(D_METHOD("vibrate_handheld", "duration_ms", "amplitude"), &Input::vibrate_handheld, DEFVAL(500), DEFVAL(-1.0));
|
||||
ClassDB::bind_method(D_METHOD("set_ignore_joypad_on_unfocused_application", "enable"), &Input::set_ignore_joypad_on_unfocused_application);
|
||||
ClassDB::bind_method(D_METHOD("is_ignoring_joypad_on_unfocused_application"), &Input::is_ignoring_joypad_on_unfocused_application);
|
||||
ClassDB::bind_method(D_METHOD("get_gravity"), &Input::get_gravity);
|
||||
ClassDB::bind_method(D_METHOD("get_accelerometer"), &Input::get_accelerometer);
|
||||
ClassDB::bind_method(D_METHOD("get_magnetometer"), &Input::get_magnetometer);
|
||||
ClassDB::bind_method(D_METHOD("get_gyroscope"), &Input::get_gyroscope);
|
||||
ClassDB::bind_method(D_METHOD("get_joy_accelerometer", "device"), &Input::get_joy_accelerometer);
|
||||
ClassDB::bind_method(D_METHOD("get_joy_gravity", "device"), &Input::get_joy_gravity);
|
||||
ClassDB::bind_method(D_METHOD("get_joy_gyroscope", "device"), &Input::get_joy_gyroscope);
|
||||
ClassDB::bind_method(D_METHOD("get_joy_motion_sensors_rate", "device"), &Input::get_joy_motion_sensors_rate);
|
||||
ClassDB::bind_method(D_METHOD("is_joy_motion_sensors_enabled", "device"), &Input::is_joy_motion_sensors_enabled);
|
||||
ClassDB::bind_method(D_METHOD("set_joy_motion_sensors_enabled", "device", "enable"), &Input::set_joy_motion_sensors_enabled);
|
||||
ClassDB::bind_method(D_METHOD("has_joy_motion_sensors", "device"), &Input::has_joy_motion_sensors);
|
||||
ClassDB::bind_method(D_METHOD("start_joy_motion_sensors_calibration", "device"), &Input::start_joy_motion_sensors_calibration);
|
||||
ClassDB::bind_method(D_METHOD("stop_joy_motion_sensors_calibration", "device"), &Input::stop_joy_motion_sensors_calibration);
|
||||
ClassDB::bind_method(D_METHOD("clear_joy_motion_sensors_calibration", "device"), &Input::clear_joy_motion_sensors_calibration);
|
||||
ClassDB::bind_method(D_METHOD("get_joy_motion_sensors_calibration", "device"), &Input::get_joy_motion_sensors_calibration);
|
||||
ClassDB::bind_method(D_METHOD("set_joy_motion_sensors_calibration", "device", "calibration_info"), &Input::set_joy_motion_sensors_calibration);
|
||||
ClassDB::bind_method(D_METHOD("is_joy_motion_sensors_calibrated", "device"), &Input::is_joy_motion_sensors_calibrated);
|
||||
ClassDB::bind_method(D_METHOD("is_joy_motion_sensors_calibrating", "device"), &Input::is_joy_motion_sensors_calibrating);
|
||||
ClassDB::bind_method(D_METHOD("set_gravity", "value"), &Input::set_gravity);
|
||||
ClassDB::bind_method(D_METHOD("set_accelerometer", "value"), &Input::set_accelerometer);
|
||||
ClassDB::bind_method(D_METHOD("set_magnetometer", "value"), &Input::set_magnetometer);
|
||||
|
|
@ -177,6 +209,7 @@ void Input::_bind_methods() {
|
|||
ADD_PROPERTY(PropertyInfo(Variant::BOOL, "use_accumulated_input"), "set_use_accumulated_input", "is_using_accumulated_input");
|
||||
ADD_PROPERTY(PropertyInfo(Variant::BOOL, "emulate_mouse_from_touch"), "set_emulate_mouse_from_touch", "is_emulating_mouse_from_touch");
|
||||
ADD_PROPERTY(PropertyInfo(Variant::BOOL, "emulate_touch_from_mouse"), "set_emulate_touch_from_mouse", "is_emulating_touch_from_mouse");
|
||||
ADD_PROPERTY(PropertyInfo(Variant::BOOL, "ignore_joypad_on_unfocused_application"), "set_ignore_joypad_on_unfocused_application", "is_ignoring_joypad_on_unfocused_application");
|
||||
|
||||
BIND_ENUM_CONSTANT(MOUSE_MODE_VISIBLE);
|
||||
BIND_ENUM_CONSTANT(MOUSE_MODE_HIDDEN);
|
||||
|
|
@ -296,24 +329,14 @@ bool Input::is_anything_pressed() const {
|
|||
return false;
|
||||
}
|
||||
|
||||
bool Input::is_anything_pressed_except_mouse() const {
|
||||
bool Input::is_any_key_pressed() const {
|
||||
_THREAD_SAFE_METHOD_
|
||||
|
||||
if (disable_input) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!keys_pressed.is_empty() || !joy_buttons_pressed.is_empty()) {
|
||||
return true;
|
||||
}
|
||||
|
||||
for (const KeyValue<StringName, Input::ActionState> &E : action_states) {
|
||||
if (E.value.cache.pressed) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
return !keys_pressed.is_empty();
|
||||
}
|
||||
|
||||
bool Input::is_key_pressed(Key p_keycode) const {
|
||||
|
|
@ -356,6 +379,10 @@ bool Input::is_mouse_button_pressed(MouseButton p_button) const {
|
|||
return mouse_button_mask.has_flag(mouse_button_to_mask(p_button));
|
||||
}
|
||||
|
||||
bool Input::_should_ignore_joypad_events() const {
|
||||
return ignore_joypad_on_unfocused_application && !application_focused && !embedder_focused;
|
||||
}
|
||||
|
||||
static JoyAxis _combine_device(JoyAxis p_value, int p_device) {
|
||||
return JoyAxis((int)p_value | (p_device << 20));
|
||||
}
|
||||
|
|
@ -615,6 +642,33 @@ float Input::get_joy_vibration_duration(int p_device) {
|
|||
}
|
||||
}
|
||||
|
||||
float Input::get_joy_vibration_remaining_duration(int p_device) {
|
||||
_THREAD_SAFE_METHOD_
|
||||
const Joypad *joypad = joy_names.getptr(p_device);
|
||||
if (joypad == nullptr || !joypad->has_vibration) {
|
||||
return 0.f;
|
||||
}
|
||||
const VibrationInfo *vibration = joy_vibration.getptr(p_device);
|
||||
if (vibration == nullptr || (vibration->weak_magnitude == 0.f && vibration->strong_magnitude == 0.f) || vibration->duration < 0.f) {
|
||||
return 0.f;
|
||||
}
|
||||
float vibration_duration = vibration->duration;
|
||||
if (vibration_duration > 0xFFFF / 1000.f || vibration_duration == 0.f) {
|
||||
vibration_duration = 0xFFFF / 1000.f; // SDL_MAX_RUMBLE_DURATION_MS / 1000.f
|
||||
}
|
||||
return MAX(vibration_duration - (OS::get_singleton()->get_ticks_usec() - vibration->timestamp) / 1e6, 0.f);
|
||||
}
|
||||
|
||||
bool Input::is_joy_vibrating(int p_device) {
|
||||
return get_joy_vibration_remaining_duration(p_device) > 0.0f;
|
||||
}
|
||||
|
||||
bool Input::has_joy_vibration(int p_device) const {
|
||||
_THREAD_SAFE_METHOD_
|
||||
const Joypad *joypad = joy_names.getptr(p_device);
|
||||
return joypad != nullptr && joypad->has_vibration;
|
||||
}
|
||||
|
||||
static String _hex_str(uint8_t p_byte) {
|
||||
static const char *dict = "0123456789abcdef";
|
||||
char ret[3];
|
||||
|
|
@ -684,6 +738,11 @@ void Input::joy_connection_changed(int p_idx, bool p_connected, const String &p_
|
|||
for (int i = 0; i < (int)JoyAxis::MAX; i++) {
|
||||
set_joy_axis(p_idx, (JoyAxis)i, 0.0f);
|
||||
}
|
||||
MotionInfo *motion = joy_motion.getptr(p_idx);
|
||||
if (motion != nullptr && motion->gamepad_motion != nullptr) {
|
||||
delete motion->gamepad_motion;
|
||||
}
|
||||
joy_motion.erase(p_idx);
|
||||
}
|
||||
joy_names[p_idx] = js;
|
||||
|
||||
|
|
@ -959,6 +1018,7 @@ void Input::_parse_input_event_impl(const Ref<InputEvent> &p_event, bool p_is_em
|
|||
device_state.pressed[event_index] = is_pressed;
|
||||
device_state.strength[event_index] = p_event->get_action_strength(E.key);
|
||||
device_state.raw_strength[event_index] = p_event->get_action_raw_strength(E.key);
|
||||
device_state.event_type[event_index] = p_event->get_type();
|
||||
|
||||
// Update the action's global state and cache.
|
||||
if (!is_pressed) {
|
||||
|
|
@ -1005,6 +1065,12 @@ void Input::set_joy_features(int p_device, JoypadFeatures *p_features) {
|
|||
}
|
||||
|
||||
void Input::set_joy_light(int p_device, const Color &p_color) {
|
||||
_THREAD_SAFE_METHOD_
|
||||
|
||||
if (_should_ignore_joypad_events()) {
|
||||
return;
|
||||
}
|
||||
|
||||
Joypad *joypad = joy_names.getptr(p_device);
|
||||
if (!joypad || !joypad->has_light || joypad->features == nullptr) {
|
||||
return;
|
||||
|
|
@ -1018,8 +1084,218 @@ bool Input::has_joy_light(int p_device) const {
|
|||
return joypad && joypad->has_light;
|
||||
}
|
||||
|
||||
Vector3 Input::get_joy_accelerometer(int p_device) const {
|
||||
_THREAD_SAFE_METHOD_
|
||||
|
||||
if (_should_ignore_joypad_events()) {
|
||||
return Vector3();
|
||||
}
|
||||
|
||||
const MotionInfo *motion = joy_motion.getptr(p_device);
|
||||
if (motion == nullptr) {
|
||||
return Vector3();
|
||||
}
|
||||
|
||||
float joy_acceleration_data[3];
|
||||
motion->gamepad_motion->GetProcessedAcceleration(joy_acceleration_data[0], joy_acceleration_data[1], joy_acceleration_data[2]);
|
||||
Vector3 joy_acceleration(joy_acceleration_data[0], joy_acceleration_data[1], joy_acceleration_data[2]);
|
||||
|
||||
float joy_gravity_data[3];
|
||||
motion->gamepad_motion->GetGravity(joy_gravity_data[0], joy_gravity_data[1], joy_gravity_data[2]);
|
||||
Vector3 joy_gravity(joy_gravity_data[0], joy_gravity_data[1], joy_gravity_data[2]);
|
||||
|
||||
return (-joy_acceleration + joy_gravity) * STANDARD_GRAVITY;
|
||||
}
|
||||
|
||||
Vector3 Input::get_joy_gravity(int p_device) const {
|
||||
_THREAD_SAFE_METHOD_
|
||||
|
||||
if (_should_ignore_joypad_events()) {
|
||||
return Vector3();
|
||||
}
|
||||
|
||||
const MotionInfo *motion = joy_motion.getptr(p_device);
|
||||
if (motion == nullptr) {
|
||||
return Vector3();
|
||||
}
|
||||
|
||||
float joy_gravity_data[3];
|
||||
motion->gamepad_motion->GetGravity(joy_gravity_data[0], joy_gravity_data[1], joy_gravity_data[2]);
|
||||
Vector3 joy_gravity(joy_gravity_data[0], joy_gravity_data[1], joy_gravity_data[2]);
|
||||
|
||||
return joy_gravity.normalized() * STANDARD_GRAVITY;
|
||||
}
|
||||
|
||||
Vector3 Input::get_joy_gyroscope(int p_device) const {
|
||||
_THREAD_SAFE_METHOD_
|
||||
|
||||
if (_should_ignore_joypad_events()) {
|
||||
return Vector3();
|
||||
}
|
||||
|
||||
const MotionInfo *motion = joy_motion.getptr(p_device);
|
||||
if (motion == nullptr) {
|
||||
return Vector3();
|
||||
}
|
||||
|
||||
float joy_gyro_data[3];
|
||||
motion->gamepad_motion->GetCalibratedGyro(joy_gyro_data[0], joy_gyro_data[1], joy_gyro_data[2]);
|
||||
Vector3 joy_gyro(joy_gyro_data[0], joy_gyro_data[1], joy_gyro_data[2]);
|
||||
|
||||
return joy_gyro * M_PI / 180.0;
|
||||
}
|
||||
|
||||
void Input::set_joy_motion_sensors_enabled(int p_device, bool p_enable) {
|
||||
_THREAD_SAFE_METHOD_
|
||||
Joypad *joypad = joy_names.getptr(p_device);
|
||||
if (joypad == nullptr || joypad->features == nullptr) {
|
||||
return;
|
||||
}
|
||||
MotionInfo *motion = joy_motion.getptr(p_device);
|
||||
if (motion == nullptr) {
|
||||
return;
|
||||
}
|
||||
joypad->features->set_joy_motion_sensors_enabled(p_enable);
|
||||
motion->sensors_enabled = p_enable;
|
||||
}
|
||||
|
||||
bool Input::is_joy_motion_sensors_enabled(int p_device) const {
|
||||
_THREAD_SAFE_METHOD_
|
||||
const MotionInfo *motion = joy_motion.getptr(p_device);
|
||||
return motion != nullptr && motion->sensors_enabled;
|
||||
}
|
||||
|
||||
bool Input::has_joy_motion_sensors(int p_device) const {
|
||||
_THREAD_SAFE_METHOD_
|
||||
return joy_motion.has(p_device);
|
||||
}
|
||||
|
||||
float Input::get_joy_motion_sensors_rate(int p_device) const {
|
||||
_THREAD_SAFE_METHOD_
|
||||
const MotionInfo *motion = joy_motion.getptr(p_device);
|
||||
if (motion == nullptr) {
|
||||
return 0.0f;
|
||||
}
|
||||
return motion->sensor_data_rate;
|
||||
}
|
||||
|
||||
void Input::start_joy_motion_sensors_calibration(int p_device) {
|
||||
_THREAD_SAFE_METHOD_
|
||||
MotionInfo *motion = joy_motion.getptr(p_device);
|
||||
if (motion == nullptr) {
|
||||
return;
|
||||
}
|
||||
|
||||
ERR_FAIL_COND_MSG(!motion->sensors_enabled, "Motion sensors are not enabled on the joypad.");
|
||||
ERR_FAIL_COND_MSG(motion->calibrating, "Calibration already in progress.");
|
||||
|
||||
motion->gamepad_motion->ResetContinuousCalibration();
|
||||
motion->gamepad_motion->StartContinuousCalibration();
|
||||
|
||||
motion->calibrating = true;
|
||||
motion->calibrated = false;
|
||||
}
|
||||
|
||||
void Input::stop_joy_motion_sensors_calibration(int p_device) {
|
||||
_THREAD_SAFE_METHOD_
|
||||
MotionInfo *motion = joy_motion.getptr(p_device);
|
||||
if (motion == nullptr) {
|
||||
return;
|
||||
}
|
||||
|
||||
ERR_FAIL_COND_MSG(!motion->sensors_enabled, "Motion sensors are not enabled on the joypad.");
|
||||
ERR_FAIL_COND_MSG(!motion->calibrating, "Calibration hasn't been started.");
|
||||
|
||||
motion->gamepad_motion->PauseContinuousCalibration();
|
||||
|
||||
motion->calibrating = false;
|
||||
motion->calibrated = true;
|
||||
}
|
||||
|
||||
void Input::clear_joy_motion_sensors_calibration(int p_device) {
|
||||
_THREAD_SAFE_METHOD_
|
||||
MotionInfo *motion = joy_motion.getptr(p_device);
|
||||
if (motion == nullptr) {
|
||||
return;
|
||||
}
|
||||
|
||||
// Calibration might be in progress and the developer or the user might want to reset it,
|
||||
// so no need to stop the calibration.
|
||||
|
||||
motion->gamepad_motion->ResetContinuousCalibration();
|
||||
}
|
||||
|
||||
Dictionary Input::get_joy_motion_sensors_calibration(int p_device) const {
|
||||
_THREAD_SAFE_METHOD_
|
||||
const MotionInfo *motion = joy_motion.getptr(p_device);
|
||||
if (motion == nullptr) {
|
||||
return Dictionary();
|
||||
}
|
||||
|
||||
if (!motion->calibrated) {
|
||||
return Dictionary();
|
||||
}
|
||||
|
||||
float joy_gyro_offset_data[3];
|
||||
motion->gamepad_motion->GetCalibrationOffset(joy_gyro_offset_data[0], joy_gyro_offset_data[1], joy_gyro_offset_data[2]);
|
||||
Vector3 joy_gyro_offset(joy_gyro_offset_data[0], joy_gyro_offset_data[1], joy_gyro_offset_data[2]);
|
||||
|
||||
Dictionary result;
|
||||
result["gyroscope_offset"] = joy_gyro_offset * M_PI / 180.0;
|
||||
return result;
|
||||
}
|
||||
|
||||
void Input::set_joy_motion_sensors_calibration(int p_device, const Dictionary &p_calibration_info) {
|
||||
_THREAD_SAFE_METHOD_
|
||||
MotionInfo *motion = joy_motion.getptr(p_device);
|
||||
if (motion == nullptr) {
|
||||
return;
|
||||
}
|
||||
|
||||
ERR_FAIL_COND_MSG(motion->calibrating, "Calibration is currently in progress.");
|
||||
|
||||
Vector3 gyro_offset = p_calibration_info.get("gyroscope_offset", Vector3()).operator Vector3() * 180.0 / M_PI;
|
||||
|
||||
motion->gamepad_motion->SetCalibrationOffset(gyro_offset.x, gyro_offset.y, gyro_offset.z, 1);
|
||||
motion->calibrating = false;
|
||||
motion->calibrated = true;
|
||||
}
|
||||
|
||||
bool Input::is_joy_motion_sensors_calibrating(int p_device) const {
|
||||
_THREAD_SAFE_METHOD_
|
||||
const MotionInfo *motion = joy_motion.getptr(p_device);
|
||||
if (motion == nullptr) {
|
||||
return false;
|
||||
}
|
||||
return motion->calibrating;
|
||||
}
|
||||
|
||||
bool Input::is_joy_motion_sensors_calibrated(int p_device) const {
|
||||
_THREAD_SAFE_METHOD_
|
||||
const MotionInfo *motion = joy_motion.getptr(p_device);
|
||||
if (motion == nullptr) {
|
||||
return false;
|
||||
}
|
||||
return motion->calibrated;
|
||||
}
|
||||
|
||||
void Input::set_joy_motion_sensors_rate(int p_device, float p_rate) {
|
||||
_THREAD_SAFE_METHOD_
|
||||
MotionInfo *motion = joy_motion.getptr(p_device);
|
||||
if (motion == nullptr) {
|
||||
return;
|
||||
}
|
||||
|
||||
motion->sensor_data_rate = p_rate;
|
||||
}
|
||||
|
||||
void Input::start_joy_vibration(int p_device, float p_weak_magnitude, float p_strong_magnitude, float p_duration) {
|
||||
_THREAD_SAFE_METHOD_
|
||||
|
||||
if (_should_ignore_joypad_events()) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (p_weak_magnitude < 0.f || p_weak_magnitude > 1.f || p_strong_magnitude < 0.f || p_strong_magnitude > 1.f) {
|
||||
return;
|
||||
}
|
||||
|
|
@ -1045,6 +1321,17 @@ void Input::vibrate_handheld(int p_duration_ms, float p_amplitude) {
|
|||
OS::get_singleton()->vibrate_handheld(p_duration_ms, p_amplitude);
|
||||
}
|
||||
|
||||
void Input::set_ignore_joypad_on_unfocused_application(bool p_ignore) {
|
||||
ignore_joypad_on_unfocused_application = p_ignore;
|
||||
if (_should_ignore_joypad_events()) {
|
||||
release_pressed_events();
|
||||
}
|
||||
}
|
||||
|
||||
bool Input::is_ignoring_joypad_on_unfocused_application() const {
|
||||
return ignore_joypad_on_unfocused_application;
|
||||
}
|
||||
|
||||
void Input::set_gravity(const Vector3 &p_gravity) {
|
||||
_THREAD_SAFE_METHOD_
|
||||
|
||||
|
|
@ -1311,17 +1598,49 @@ bool Input::is_using_accumulated_input() {
|
|||
}
|
||||
|
||||
void Input::release_pressed_events() {
|
||||
// Don't release the events if the application (or the window it's embedded in) is still focused.
|
||||
if (application_focused || embedder_focused) {
|
||||
return;
|
||||
}
|
||||
|
||||
flush_buffered_events(); // this is needed to release actions strengths
|
||||
|
||||
keys_pressed.clear();
|
||||
physical_keys_pressed.clear();
|
||||
key_label_pressed.clear();
|
||||
joy_buttons_pressed.clear();
|
||||
_joy_axis.clear();
|
||||
if (ignore_joypad_on_unfocused_application) {
|
||||
joy_buttons_pressed.clear();
|
||||
_joy_axis.clear();
|
||||
|
||||
for (KeyValue<StringName, Input::ActionState> &E : action_states) {
|
||||
if (E.value.cache.pressed) {
|
||||
action_release(E.key);
|
||||
for (KeyValue<StringName, Input::ActionState> &E : action_states) {
|
||||
if (E.value.cache.pressed) {
|
||||
action_release(E.key);
|
||||
}
|
||||
}
|
||||
|
||||
for (int device : get_connected_joypads()) {
|
||||
stop_joy_vibration(device);
|
||||
}
|
||||
} else {
|
||||
for (KeyValue<StringName, Input::ActionState> &E : action_states) {
|
||||
if (E.value.cache.pressed) {
|
||||
bool is_only_joypad_pressed = true;
|
||||
int max_event = InputMap::get_singleton()->action_get_events(E.key)->size() + 1; // +1 comes from InputEventAction.
|
||||
|
||||
for (const KeyValue<int, ActionState::DeviceState> &kv : E.value.device_states) {
|
||||
const ActionState::DeviceState &device_state = kv.value;
|
||||
for (int i = 0; i < max_event; i++) {
|
||||
if (device_state.event_type[i] != InputEventType::JOY_MOTION && device_state.event_type[i] != InputEventType::JOY_BUTTON && device_state.strength[i] > 0.0f) {
|
||||
is_only_joypad_pressed = false;
|
||||
action_release(E.key);
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (!is_only_joypad_pressed) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -1332,6 +1651,11 @@ void Input::set_event_dispatch_function(EventDispatchFunc p_function) {
|
|||
|
||||
void Input::joy_button(int p_device, JoyButton p_button, bool p_pressed) {
|
||||
_THREAD_SAFE_METHOD_;
|
||||
|
||||
if (_should_ignore_joypad_events()) {
|
||||
return;
|
||||
}
|
||||
|
||||
Joypad &joy = joy_names[p_device];
|
||||
ERR_FAIL_INDEX((int)p_button, (int)JoyButton::MAX);
|
||||
|
||||
|
|
@ -1360,6 +1684,10 @@ void Input::joy_button(int p_device, JoyButton p_button, bool p_pressed) {
|
|||
void Input::joy_axis(int p_device, JoyAxis p_axis, float p_value) {
|
||||
_THREAD_SAFE_METHOD_;
|
||||
|
||||
if (_should_ignore_joypad_events()) {
|
||||
return;
|
||||
}
|
||||
|
||||
ERR_FAIL_INDEX((int)p_axis, (int)JoyAxis::MAX);
|
||||
|
||||
Joypad &joy = joy_names[p_device];
|
||||
|
|
@ -1429,6 +1757,11 @@ void Input::joy_axis(int p_device, JoyAxis p_axis, float p_value) {
|
|||
|
||||
void Input::joy_hat(int p_device, BitField<HatMask> p_val) {
|
||||
_THREAD_SAFE_METHOD_;
|
||||
|
||||
if (_should_ignore_joypad_events()) {
|
||||
return;
|
||||
}
|
||||
|
||||
const Joypad &joy = joy_names[p_device];
|
||||
|
||||
JoyEvent map[(size_t)HatDir::MAX];
|
||||
|
|
@ -1469,6 +1802,27 @@ void Input::joy_hat(int p_device, BitField<HatMask> p_val) {
|
|||
joy_names[p_device].hat_current = (int)p_val;
|
||||
}
|
||||
|
||||
void Input::joy_motion_sensors(int p_device, const Vector3 &p_accelerometer, const Vector3 &p_gyroscope) {
|
||||
_THREAD_SAFE_METHOD_
|
||||
|
||||
if (_should_ignore_joypad_events()) {
|
||||
return;
|
||||
}
|
||||
|
||||
// TODO: events
|
||||
MotionInfo *motion = joy_motion.getptr(p_device);
|
||||
if (motion == nullptr) {
|
||||
return;
|
||||
}
|
||||
|
||||
Vector3 gyro_degrees = p_gyroscope * 180.0 / M_PI;
|
||||
Vector3 accel_g = -p_accelerometer / STANDARD_GRAVITY;
|
||||
uint64_t new_timestamp = OS::get_singleton()->get_ticks_msec();
|
||||
float delta_time = (new_timestamp - motion->last_timestamp) / 1000.0f;
|
||||
motion->last_timestamp = new_timestamp;
|
||||
motion->gamepad_motion->ProcessMotion(gyro_degrees.x, gyro_degrees.y, gyro_degrees.z, accel_g.x, accel_g.y, accel_g.z, delta_time);
|
||||
}
|
||||
|
||||
void Input::_button_event(int p_device, JoyButton p_index, bool p_pressed) {
|
||||
Ref<InputEventJoypadButton> ievent;
|
||||
ievent.instantiate();
|
||||
|
|
@ -1517,9 +1871,22 @@ void Input::_update_joypad_features(int p_device) {
|
|||
if (!joypad || joypad->features == nullptr) {
|
||||
return;
|
||||
}
|
||||
if (joypad->features->has_joy_vibration()) {
|
||||
joypad->has_vibration = true;
|
||||
}
|
||||
if (joypad->features->has_joy_light()) {
|
||||
joypad->has_light = true;
|
||||
}
|
||||
if (joypad->features->has_joy_motion_sensors()) {
|
||||
MotionInfo &motion = joy_motion[p_device];
|
||||
|
||||
if (!motion.gamepad_motion) {
|
||||
motion.gamepad_motion = new GamepadMotion();
|
||||
} else {
|
||||
motion.gamepad_motion->Reset();
|
||||
}
|
||||
motion.last_timestamp = OS::get_singleton()->get_ticks_msec();
|
||||
}
|
||||
}
|
||||
|
||||
Input::JoyEvent Input::_get_mapped_button_event(const JoyDeviceMapping &mapping, JoyButton p_button) {
|
||||
|
|
@ -2004,6 +2371,7 @@ Input::Input() {
|
|||
gravity_enabled = GLOBAL_DEF_RST_BASIC("input_devices/sensors/enable_gravity", false);
|
||||
gyroscope_enabled = GLOBAL_DEF_RST_BASIC("input_devices/sensors/enable_gyroscope", false);
|
||||
magnetometer_enabled = GLOBAL_DEF_RST_BASIC("input_devices/sensors/enable_magnetometer", false);
|
||||
ignore_joypad_on_unfocused_application = GLOBAL_DEF_RST_BASIC("input_devices/joypads/ignore_joypad_on_unfocused_application", false);
|
||||
}
|
||||
|
||||
Input::~Input() {
|
||||
|
|
|
|||
|
|
@ -38,6 +38,43 @@
|
|||
#include "core/templates/rb_set.h"
|
||||
#include "core/variant/typed_array.h"
|
||||
|
||||
class GamepadMotion;
|
||||
|
||||
namespace InputClassEnums {
|
||||
// Keep synced with DisplayServerEnums::MouseMode enum.
|
||||
enum MouseMode : int {
|
||||
MOUSE_MODE_VISIBLE,
|
||||
MOUSE_MODE_HIDDEN,
|
||||
MOUSE_MODE_CAPTURED,
|
||||
MOUSE_MODE_CONFINED,
|
||||
MOUSE_MODE_CONFINED_HIDDEN,
|
||||
MOUSE_MODE_MAX,
|
||||
};
|
||||
|
||||
// Keep synced with DisplayServerEnums and Control enums.
|
||||
#undef CursorShape
|
||||
enum CursorShape : int {
|
||||
CURSOR_ARROW,
|
||||
CURSOR_IBEAM,
|
||||
CURSOR_POINTING_HAND,
|
||||
CURSOR_CROSS,
|
||||
CURSOR_WAIT,
|
||||
CURSOR_BUSY,
|
||||
CURSOR_DRAG,
|
||||
CURSOR_CAN_DROP,
|
||||
CURSOR_FORBIDDEN,
|
||||
CURSOR_VSIZE,
|
||||
CURSOR_HSIZE,
|
||||
CURSOR_BDIAGSIZE,
|
||||
CURSOR_FDIAGSIZE,
|
||||
CURSOR_MOVE,
|
||||
CURSOR_VSPLIT,
|
||||
CURSOR_HSPLIT,
|
||||
CURSOR_HELP,
|
||||
CURSOR_MAX
|
||||
};
|
||||
} //namespace InputClassEnums
|
||||
|
||||
class Input : public Object {
|
||||
GDCLASS(Input, Object);
|
||||
_THREAD_SAFE_CLASS_
|
||||
|
|
@ -47,44 +84,21 @@ class Input : public Object {
|
|||
static constexpr uint64_t MAX_EVENT = 32;
|
||||
|
||||
public:
|
||||
// Keep synced with "DisplayServer::MouseMode" enum.
|
||||
enum MouseMode {
|
||||
MOUSE_MODE_VISIBLE,
|
||||
MOUSE_MODE_HIDDEN,
|
||||
MOUSE_MODE_CAPTURED,
|
||||
MOUSE_MODE_CONFINED,
|
||||
MOUSE_MODE_CONFINED_HIDDEN,
|
||||
MOUSE_MODE_MAX,
|
||||
};
|
||||
|
||||
#undef CursorShape
|
||||
enum CursorShape {
|
||||
CURSOR_ARROW,
|
||||
CURSOR_IBEAM,
|
||||
CURSOR_POINTING_HAND,
|
||||
CURSOR_CROSS,
|
||||
CURSOR_WAIT,
|
||||
CURSOR_BUSY,
|
||||
CURSOR_DRAG,
|
||||
CURSOR_CAN_DROP,
|
||||
CURSOR_FORBIDDEN,
|
||||
CURSOR_VSIZE,
|
||||
CURSOR_HSIZE,
|
||||
CURSOR_BDIAGSIZE,
|
||||
CURSOR_FDIAGSIZE,
|
||||
CURSOR_MOVE,
|
||||
CURSOR_VSPLIT,
|
||||
CURSOR_HSPLIT,
|
||||
CURSOR_HELP,
|
||||
CURSOR_MAX
|
||||
};
|
||||
// TODO: When we migrate to C++20, replace these with "using enum" and skip prefixing MouseMode and CursorShape in other files.
|
||||
using MouseMode = InputClassEnums::MouseMode;
|
||||
using CursorShape = InputClassEnums::CursorShape;
|
||||
|
||||
class JoypadFeatures {
|
||||
public:
|
||||
virtual ~JoypadFeatures() {}
|
||||
|
||||
virtual bool has_joy_vibration() const { return false; }
|
||||
|
||||
virtual bool has_joy_light() const { return false; }
|
||||
virtual void set_joy_light(const Color &p_color) {}
|
||||
|
||||
virtual bool has_joy_motion_sensors() const { return false; }
|
||||
virtual void set_joy_motion_sensors_enabled(bool p_enable) {}
|
||||
};
|
||||
|
||||
static constexpr int32_t JOYPADS_MAX = 16;
|
||||
|
|
@ -112,6 +126,9 @@ private:
|
|||
int64_t mouse_window = 0;
|
||||
bool legacy_just_pressed_behavior = false;
|
||||
bool disable_input = false;
|
||||
bool ignore_joypad_on_unfocused_application = false;
|
||||
bool application_focused = true;
|
||||
bool embedder_focused = false;
|
||||
|
||||
struct ActionState {
|
||||
uint64_t pressed_physics_frame = UINT64_MAX;
|
||||
|
|
@ -126,6 +143,7 @@ private:
|
|||
bool pressed[MAX_EVENT] = { false };
|
||||
float strength[MAX_EVENT] = { 0.0 };
|
||||
float raw_strength[MAX_EVENT] = { 0.0 };
|
||||
InputEventType event_type[MAX_EVENT] = { InputEventType::INVALID };
|
||||
};
|
||||
bool api_pressed = false;
|
||||
float api_strength = 0.0;
|
||||
|
|
@ -157,6 +175,23 @@ private:
|
|||
|
||||
HashMap<int, VibrationInfo> joy_vibration;
|
||||
|
||||
struct MotionInfo {
|
||||
bool sensors_enabled : 1;
|
||||
bool calibrating : 1;
|
||||
bool calibrated : 1;
|
||||
float sensor_data_rate = 0.0f;
|
||||
uint64_t last_timestamp = 0;
|
||||
GamepadMotion *gamepad_motion = nullptr;
|
||||
|
||||
MotionInfo() {
|
||||
sensors_enabled = false;
|
||||
calibrating = false;
|
||||
calibrated = false;
|
||||
}
|
||||
};
|
||||
|
||||
HashMap<int, MotionInfo> joy_motion;
|
||||
|
||||
struct VelocityTrack {
|
||||
uint64_t last_tick = 0;
|
||||
Vector2 velocity;
|
||||
|
|
@ -184,6 +219,7 @@ private:
|
|||
int hat_current = 0;
|
||||
Dictionary info;
|
||||
bool has_light = false;
|
||||
bool has_vibration = false;
|
||||
Input::JoypadFeatures *features = nullptr;
|
||||
};
|
||||
|
||||
|
|
@ -195,7 +231,7 @@ private:
|
|||
|
||||
int fallback_mapping = -1; // Index of the guid in map_db.
|
||||
|
||||
CursorShape default_shape = CURSOR_ARROW;
|
||||
CursorShape default_shape = CursorShape::CURSOR_ARROW;
|
||||
|
||||
enum JoyType {
|
||||
TYPE_BUTTON,
|
||||
|
|
@ -275,6 +311,8 @@ private:
|
|||
#endif
|
||||
|
||||
friend class DisplayServer;
|
||||
friend class SceneTree;
|
||||
friend class SceneDebugger;
|
||||
|
||||
static void (*set_mouse_mode_func)(MouseMode);
|
||||
static MouseMode (*get_mouse_mode_func)();
|
||||
|
|
@ -289,6 +327,8 @@ private:
|
|||
|
||||
EventDispatchFunc event_dispatch_function = nullptr;
|
||||
|
||||
bool _should_ignore_joypad_events() const;
|
||||
|
||||
#ifndef DISABLE_DEPRECATED
|
||||
void _vibrate_handheld_bind_compat_91143(int p_duration_ms = 500);
|
||||
static void _bind_compatibility_methods();
|
||||
|
|
@ -312,7 +352,7 @@ public:
|
|||
static Input *get_singleton();
|
||||
|
||||
bool is_anything_pressed() const;
|
||||
bool is_anything_pressed_except_mouse() const;
|
||||
bool is_any_key_pressed() const;
|
||||
bool is_key_pressed(Key p_keycode) const;
|
||||
bool is_physical_key_pressed(Key p_keycode) const;
|
||||
bool is_key_label_pressed(Key p_keycode) const;
|
||||
|
|
@ -334,7 +374,10 @@ public:
|
|||
TypedArray<int> get_connected_joypads();
|
||||
Vector2 get_joy_vibration_strength(int p_device);
|
||||
float get_joy_vibration_duration(int p_device);
|
||||
float get_joy_vibration_remaining_duration(int p_device);
|
||||
uint64_t get_joy_vibration_timestamp(int p_device);
|
||||
bool is_joy_vibrating(int p_device);
|
||||
bool has_joy_vibration(int p_device) const;
|
||||
void joy_connection_changed(int p_idx, bool p_connected, const String &p_name, const String &p_guid = "", const Dictionary &p_joypad_info = Dictionary());
|
||||
|
||||
Vector3 get_gravity() const;
|
||||
|
|
@ -363,10 +406,35 @@ public:
|
|||
void set_joy_light(int p_device, const Color &p_color);
|
||||
bool has_joy_light(int p_device) const;
|
||||
|
||||
Vector3 get_joy_accelerometer(int p_device) const;
|
||||
Vector3 get_joy_gravity(int p_device) const;
|
||||
Vector3 get_joy_gyroscope(int p_device) const;
|
||||
|
||||
void set_joy_motion_sensors_enabled(int p_device, bool p_enable);
|
||||
bool is_joy_motion_sensors_enabled(int p_device) const;
|
||||
|
||||
bool has_joy_motion_sensors(int p_device) const;
|
||||
float get_joy_motion_sensors_rate(int p_device) const;
|
||||
|
||||
void start_joy_motion_sensors_calibration(int p_device);
|
||||
void stop_joy_motion_sensors_calibration(int p_device);
|
||||
void clear_joy_motion_sensors_calibration(int p_device);
|
||||
|
||||
Dictionary get_joy_motion_sensors_calibration(int p_device) const;
|
||||
void set_joy_motion_sensors_calibration(int p_device, const Dictionary &p_calibration_info);
|
||||
|
||||
bool is_joy_motion_sensors_calibrating(int p_device) const;
|
||||
bool is_joy_motion_sensors_calibrated(int p_device) const;
|
||||
|
||||
void set_joy_motion_sensors_rate(int p_device, float p_rate);
|
||||
|
||||
void start_joy_vibration(int p_device, float p_weak_magnitude, float p_strong_magnitude, float p_duration = 0);
|
||||
void stop_joy_vibration(int p_device);
|
||||
void vibrate_handheld(int p_duration_ms = 500, float p_amplitude = -1.0);
|
||||
|
||||
void set_ignore_joypad_on_unfocused_application(bool p_ignore);
|
||||
bool is_ignoring_joypad_on_unfocused_application() const;
|
||||
|
||||
void set_mouse_position(const Point2 &p_posf);
|
||||
|
||||
void action_press(const StringName &p_action, float p_strength = 1.f);
|
||||
|
|
@ -382,12 +450,13 @@ public:
|
|||
CursorShape get_default_cursor_shape() const;
|
||||
void set_default_cursor_shape(CursorShape p_shape);
|
||||
CursorShape get_current_cursor_shape() const;
|
||||
void set_custom_mouse_cursor(const Ref<Resource> &p_cursor, CursorShape p_shape = Input::CURSOR_ARROW, const Vector2 &p_hotspot = Vector2());
|
||||
void set_custom_mouse_cursor(const Ref<Resource> &p_cursor, CursorShape p_shape = Input::CursorShape::CURSOR_ARROW, const Vector2 &p_hotspot = Vector2());
|
||||
|
||||
void parse_mapping(const String &p_mapping);
|
||||
void joy_button(int p_device, JoyButton p_button, bool p_pressed);
|
||||
void joy_axis(int p_device, JoyAxis p_axis, float p_value);
|
||||
void joy_hat(int p_device, BitField<HatMask> p_val);
|
||||
void joy_motion_sensors(int p_device, const Vector3 &p_accelerometer, const Vector3 &p_gyroscope);
|
||||
|
||||
void add_joy_mapping(const String &p_mapping, bool p_update_existing = false);
|
||||
void remove_joy_mapping(const String &p_guid);
|
||||
|
|
|
|||
|
|
@ -100,7 +100,12 @@ enum class JoyButton {
|
|||
PADDLE3 = 18,
|
||||
PADDLE4 = 19,
|
||||
TOUCHPAD = 20,
|
||||
SDL_MAX = 21,
|
||||
MISC2 = 21,
|
||||
MISC3 = 22,
|
||||
MISC4 = 23,
|
||||
MISC5 = 24,
|
||||
MISC6 = 25,
|
||||
SDL_MAX = 26,
|
||||
MAX = 128, // Android supports up to 36 buttons. DirectInput supports up to 128 buttons.
|
||||
};
|
||||
|
||||
|
|
|
|||
|
|
@ -32,8 +32,11 @@
|
|||
|
||||
#include "core/input/input_map.h"
|
||||
#include "core/input/shortcut.h"
|
||||
#include "core/math/transform_2d.h"
|
||||
#include "core/object/class_db.h"
|
||||
#include "core/os/keyboard.h"
|
||||
#include "core/os/os.h"
|
||||
#include "core/string/ustring.h"
|
||||
|
||||
void InputEvent::set_device(int p_device) {
|
||||
device = p_device;
|
||||
|
|
@ -131,6 +134,8 @@ void InputEvent::_bind_methods() {
|
|||
ADD_PROPERTY(PropertyInfo(Variant::INT, "device"), "set_device", "get_device");
|
||||
|
||||
BIND_CONSTANT(DEVICE_ID_EMULATION);
|
||||
BIND_CONSTANT(DEVICE_ID_KEYBOARD);
|
||||
BIND_CONSTANT(DEVICE_ID_MOUSE);
|
||||
}
|
||||
|
||||
///////////////////////////////////
|
||||
|
|
@ -314,8 +319,7 @@ void InputEventWithModifiers::_validate_property(PropertyInfo &p_property) const
|
|||
if (p_property.name == "meta_pressed") {
|
||||
p_property.usage ^= PROPERTY_USAGE_STORAGE;
|
||||
p_property.usage ^= PROPERTY_USAGE_EDITOR;
|
||||
}
|
||||
if (p_property.name == "ctrl_pressed") {
|
||||
} else if (p_property.name == "ctrl_pressed") {
|
||||
p_property.usage ^= PROPERTY_USAGE_STORAGE;
|
||||
p_property.usage ^= PROPERTY_USAGE_EDITOR;
|
||||
}
|
||||
|
|
@ -662,6 +666,10 @@ void InputEventKey::_bind_methods() {
|
|||
ADD_PROPERTY(PropertyInfo(Variant::BOOL, "echo"), "set_echo", "is_echo");
|
||||
}
|
||||
|
||||
InputEventKey::InputEventKey() {
|
||||
set_device(DEVICE_ID_KEYBOARD);
|
||||
}
|
||||
|
||||
///////////////////////////////////
|
||||
|
||||
void InputEventMouse::set_button_mask(BitField<MouseButtonMask> p_mask) {
|
||||
|
|
@ -704,6 +712,10 @@ void InputEventMouse::_bind_methods() {
|
|||
ADD_PROPERTY(PropertyInfo(Variant::VECTOR2, "global_position", PROPERTY_HINT_NONE, "suffix:px"), "set_global_position", "get_global_position");
|
||||
}
|
||||
|
||||
InputEventMouse::InputEventMouse() {
|
||||
set_device(DEVICE_ID_MOUSE);
|
||||
}
|
||||
|
||||
///////////////////////////////////
|
||||
|
||||
void InputEventMouseButton::set_factor(float p_factor) {
|
||||
|
|
@ -1920,7 +1932,7 @@ void InputEventShortcut::_bind_methods() {
|
|||
ClassDB::bind_method(D_METHOD("set_shortcut", "shortcut"), &InputEventShortcut::set_shortcut);
|
||||
ClassDB::bind_method(D_METHOD("get_shortcut"), &InputEventShortcut::get_shortcut);
|
||||
|
||||
ADD_PROPERTY(PropertyInfo(Variant::OBJECT, "shortcut", PROPERTY_HINT_RESOURCE_TYPE, "Shortcut"), "set_shortcut", "get_shortcut");
|
||||
ADD_PROPERTY(PropertyInfo(Variant::OBJECT, "shortcut", PROPERTY_HINT_RESOURCE_TYPE, Shortcut::get_class_static()), "set_shortcut", "get_shortcut");
|
||||
}
|
||||
|
||||
String InputEventShortcut::as_text() const {
|
||||
|
|
|
|||
|
|
@ -32,9 +32,7 @@
|
|||
|
||||
#include "core/input/input_enums.h"
|
||||
#include "core/io/resource.h"
|
||||
#include "core/math/transform_2d.h"
|
||||
#include "core/os/keyboard.h"
|
||||
#include "core/string/ustring.h"
|
||||
#include "core/typedefs.h"
|
||||
|
||||
/**
|
||||
|
|
@ -43,6 +41,8 @@
|
|||
*/
|
||||
|
||||
class Shortcut;
|
||||
class String;
|
||||
struct Transform2D;
|
||||
|
||||
/**
|
||||
* Input Modifier Status
|
||||
|
|
@ -63,6 +63,8 @@ protected:
|
|||
public:
|
||||
static constexpr int DEVICE_ID_EMULATION = -1;
|
||||
static constexpr int DEVICE_ID_INTERNAL = -2;
|
||||
static constexpr int DEVICE_ID_KEYBOARD = 16; // IDs 0-15 are reserved for joypads.
|
||||
static constexpr int DEVICE_ID_MOUSE = 32; // IDs 17-31 are reserved for multiple keyboard support in the future.
|
||||
|
||||
void set_device(int p_device);
|
||||
int get_device() const;
|
||||
|
|
@ -199,6 +201,8 @@ public:
|
|||
static Ref<InputEventKey> create_reference(Key p_keycode_with_modifier_masks, bool p_physical = false);
|
||||
|
||||
InputEventType get_type() const final override { return InputEventType::KEY; }
|
||||
|
||||
InputEventKey();
|
||||
};
|
||||
|
||||
class InputEventMouse : public InputEventWithModifiers {
|
||||
|
|
@ -221,6 +225,8 @@ public:
|
|||
|
||||
void set_global_position(const Vector2 &p_global_pos);
|
||||
Vector2 get_global_position() const;
|
||||
|
||||
InputEventMouse();
|
||||
};
|
||||
|
||||
class InputEventMouseButton : public InputEventMouse {
|
||||
|
|
|
|||
|
|
@ -32,7 +32,6 @@
|
|||
|
||||
#include "core/input/input.h"
|
||||
#include "core/io/marshalls.h"
|
||||
#include "core/os/os.h"
|
||||
|
||||
enum class BoolShift : uint8_t {
|
||||
SHIFT = 0,
|
||||
|
|
|
|||
|
|
@ -30,6 +30,10 @@
|
|||
|
||||
#ifndef DISABLE_DEPRECATED
|
||||
|
||||
#include "input_map.h"
|
||||
|
||||
#include "core/object/class_db.h"
|
||||
|
||||
void InputMap::_add_action_bind_compat_97281(const StringName &p_action, float p_deadzone) {
|
||||
add_action(p_action, p_deadzone);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -33,6 +33,7 @@
|
|||
|
||||
#include "core/config/project_settings.h"
|
||||
#include "core/input/input.h"
|
||||
#include "core/object/class_db.h"
|
||||
#include "core/os/keyboard.h"
|
||||
#include "core/os/os.h"
|
||||
#include "core/variant/typed_array.h"
|
||||
|
|
@ -205,6 +206,22 @@ void InputMap::action_add_event(const StringName &p_action, RequiredParam<InputE
|
|||
return; // Already added.
|
||||
}
|
||||
|
||||
// Normalize legacy device IDs: before the device ID change,
|
||||
// keyboard and mouse events defaulted to device=0.
|
||||
if (p_event->get_device() == 0) {
|
||||
switch (p_event->get_type()) {
|
||||
case InputEventType::KEY:
|
||||
p_event->set_device(InputEvent::DEVICE_ID_KEYBOARD);
|
||||
break;
|
||||
case InputEventType::MOUSE_BUTTON:
|
||||
case InputEventType::MOUSE_MOTION:
|
||||
p_event->set_device(InputEvent::DEVICE_ID_MOUSE);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
input_map[p_action].inputs.push_back(p_event);
|
||||
}
|
||||
|
||||
|
|
@ -319,6 +336,11 @@ void InputMap::load_from_project_settings() {
|
|||
String name = pi.name.substr(pi.name.find_char('/') + 1);
|
||||
|
||||
Dictionary action = GLOBAL_GET(pi.name);
|
||||
|
||||
if (!action.has("events")) {
|
||||
continue;
|
||||
}
|
||||
|
||||
float deadzone = action.has("deadzone") ? (float)action["deadzone"] : DEFAULT_DEADZONE;
|
||||
Array events = action["events"];
|
||||
|
||||
|
|
@ -904,7 +926,7 @@ const HashMap<String, List<Ref<InputEvent>>> &InputMap::get_builtins_with_featur
|
|||
}
|
||||
|
||||
void InputMap::load_default() {
|
||||
HashMap<String, List<Ref<InputEvent>>> builtins = get_builtins_with_feature_overrides_applied();
|
||||
HashMap<String, List<Ref<InputEvent>>> builtins(get_builtins_with_feature_overrides_applied());
|
||||
|
||||
for (const KeyValue<String, List<Ref<InputEvent>>> &E : builtins) {
|
||||
String name = E.key;
|
||||
|
|
|
|||
|
|
@ -30,6 +30,8 @@
|
|||
|
||||
#include "shortcut.h"
|
||||
|
||||
#include "core/object/class_db.h"
|
||||
|
||||
void Shortcut::set_events(const Array &p_events) {
|
||||
for (int i = 0; i < p_events.size(); i++) {
|
||||
Ref<InputEventShortcut> ies = p_events[i];
|
||||
|
|
|
|||
|
|
@ -30,10 +30,9 @@
|
|||
|
||||
#include "compression.h"
|
||||
|
||||
#include "core/config/project_settings.h"
|
||||
#include "core/io/zip_io.h"
|
||||
|
||||
#include "thirdparty/misc/fastlz.h"
|
||||
#include <thirdparty/misc/fastlz.h>
|
||||
|
||||
#include <zstd.h>
|
||||
|
||||
|
|
|
|||
|
|
@ -31,6 +31,7 @@
|
|||
#include "config_file.h"
|
||||
|
||||
#include "core/io/file_access_encrypted.h"
|
||||
#include "core/object/class_db.h"
|
||||
#include "core/string/string_builder.h"
|
||||
#include "core/variant/variant_parser.h"
|
||||
|
||||
|
|
|
|||
|
|
@ -30,6 +30,10 @@
|
|||
|
||||
#include "delta_encoding.h"
|
||||
|
||||
#include "core/error/error_list.h"
|
||||
#include "core/templates/vector.h"
|
||||
#include "core/variant/variant.h" // vformat
|
||||
|
||||
#include <zstd.h>
|
||||
|
||||
#define ERR_FAIL_ZSTD_V_MSG(m_result, m_retval, m_msg) \
|
||||
|
|
|
|||
|
|
@ -30,7 +30,12 @@
|
|||
|
||||
#pragma once
|
||||
|
||||
#include "core/io/file_access.h"
|
||||
#include "core/templates/span.h"
|
||||
|
||||
#include <cstdint>
|
||||
|
||||
template <typename T>
|
||||
class Vector;
|
||||
|
||||
class DeltaEncoding {
|
||||
public:
|
||||
|
|
|
|||
|
|
@ -32,6 +32,7 @@
|
|||
|
||||
#include "core/config/project_settings.h"
|
||||
#include "core/io/file_access.h"
|
||||
#include "core/object/class_db.h"
|
||||
#include "core/os/os.h"
|
||||
#include "core/os/time.h"
|
||||
#include "core/templates/local_vector.h"
|
||||
|
|
@ -264,11 +265,16 @@ int DirAccess::_get_drive_count() {
|
|||
return d->get_drive_count();
|
||||
}
|
||||
|
||||
String DirAccess::get_drive_name(int p_idx) {
|
||||
String DirAccess::_get_drive_name(int p_idx) {
|
||||
Ref<DirAccess> d = DirAccess::create(DirAccess::ACCESS_FILESYSTEM);
|
||||
return d->get_drive(p_idx);
|
||||
}
|
||||
|
||||
String DirAccess::_get_drive_label(int p_idx) {
|
||||
Ref<DirAccess> d = DirAccess::create(DirAccess::ACCESS_FILESYSTEM);
|
||||
return d->get_drive_label(p_idx);
|
||||
}
|
||||
|
||||
Error DirAccess::make_dir_absolute(const String &p_dir) {
|
||||
Ref<DirAccess> d = DirAccess::create_for_path(p_dir);
|
||||
return d->make_dir(p_dir);
|
||||
|
|
@ -645,7 +651,8 @@ void DirAccess::_bind_methods() {
|
|||
ClassDB::bind_method(D_METHOD("get_directories"), &DirAccess::get_directories);
|
||||
ClassDB::bind_static_method("DirAccess", D_METHOD("get_directories_at", "path"), &DirAccess::get_directories_at);
|
||||
ClassDB::bind_static_method("DirAccess", D_METHOD("get_drive_count"), &DirAccess::_get_drive_count);
|
||||
ClassDB::bind_static_method("DirAccess", D_METHOD("get_drive_name", "idx"), &DirAccess::get_drive_name);
|
||||
ClassDB::bind_static_method("DirAccess", D_METHOD("get_drive_name", "idx"), &DirAccess::_get_drive_name);
|
||||
ClassDB::bind_static_method("DirAccess", D_METHOD("get_drive_label", "idx"), &DirAccess::_get_drive_label);
|
||||
ClassDB::bind_method(D_METHOD("get_current_drive"), &DirAccess::get_current_drive);
|
||||
ClassDB::bind_method(D_METHOD("change_dir", "to_dir"), &DirAccess::change_dir);
|
||||
ClassDB::bind_method(D_METHOD("get_current_dir", "include_drive"), &DirAccess::get_current_dir, DEFVAL(true));
|
||||
|
|
|
|||
Some files were not shown because too many files have changed in this diff Show more
Loading…
Add table
Add a link
Reference in a new issue