diff options
38 files changed, 4981 insertions, 466 deletions
diff --git a/.github/actions/godot-cache-restore/action.yml b/.github/actions/godot-cache-restore/action.yml index 5df5776..f10222b 100644 --- a/.github/actions/godot-cache-restore/action.yml +++ b/.github/actions/godot-cache-restore/action.yml @@ -3,19 +3,22 @@ description: Restore Godot build cache. inputs: cache-name: description: The cache base name (job name by default). - default: "${{github.job}}" + default: ${{ github.job }} scons-cache: - description: The scons cache path. - default: "${{github.workspace}}/.scons-cache/" + description: The SCons cache path. + default: ${{ github.workspace }}/.scons-cache/ + runs: - using: "composite" + using: composite steps: - - name: Restore .scons_cache directory - uses: actions/cache/restore@v3 + - name: Restore SCons cache directory + uses: actions/cache/restore@v4 with: - path: ${{inputs.scons-cache}} - key: ${{inputs.cache-name}}-${{env.GODOT_BASE_BRANCH}}-${{github.ref}}-${{github.sha}} + path: ${{ inputs.scons-cache }} + key: ${{ inputs.cache-name }}-${{ env.GODOT_BASE_BRANCH }}-${{ github.ref }}-${{ github.sha }} + restore-keys: | - ${{inputs.cache-name}}-${{env.GODOT_BASE_BRANCH}}-${{github.ref}}-${{github.sha}} - ${{inputs.cache-name}}-${{env.GODOT_BASE_BRANCH}}-${{github.ref}} - ${{inputs.cache-name}}-${{env.GODOT_BASE_BRANCH}} + ${{ inputs.cache-name }}-${{ env.GODOT_BASE_BRANCH }}-${{ github.ref }}-${{ github.sha }} + ${{ inputs.cache-name }}-${{ env.GODOT_BASE_BRANCH }}-${{ github.ref }} + ${{ inputs.cache-name }}-${{ env.GODOT_BASE_BRANCH }}-refs/heads/${{ env.GODOT_BASE_BRANCH }} + ${{ inputs.cache-name }}-${{ env.GODOT_BASE_BRANCH }} diff --git a/.github/actions/godot-cache-save/action.yml b/.github/actions/godot-cache-save/action.yml index b7cbf91..df877ce 100644 --- a/.github/actions/godot-cache-save/action.yml +++ b/.github/actions/godot-cache-save/action.yml @@ -3,15 +3,16 @@ description: Save Godot build cache. inputs: cache-name: description: The cache base name (job name by default). - default: "${{github.job}}" + default: ${{ github.job }} scons-cache: description: The SCons cache path. - default: "${{github.workspace}}/.scons-cache/" + default: ${{ github.workspace }}/.scons-cache/ + runs: - using: "composite" + using: composite steps: - name: Save SCons cache directory uses: actions/cache/save@v4 with: - path: ${{inputs.scons-cache}} - key: ${{inputs.cache-name}}-${{env.GODOT_BASE_BRANCH}}-${{github.ref}}-${{github.sha}} + path: ${{ inputs.scons-cache }} + key: ${{ inputs.cache-name }}-${{ env.GODOT_BASE_BRANCH }}-${{ github.ref }}-${{ github.sha }} diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 76abdd5..c9f5db7 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -1,14 +1,18 @@ name: Continuous integration -on: [push, pull_request] +on: + workflow_call: env: # Only used for the cache key. Increment version to force clean build. GODOT_BASE_BRANCH: master # Used to select the version of Godot to run the tests with. GODOT_TEST_VERSION: master + # Use UTF-8 on Linux. + LANG: en_US.UTF-8 + LC_ALL: en_US.UTF-8 concurrency: - group: ci-${{github.actor}}-${{github.head_ref || github.run_number}}-${{github.ref}} + group: ci-${{ github.actor }}-${{ github.head_ref || github.run_number }}-${{ github.ref }} cancel-in-progress: true jobs: @@ -20,7 +24,7 @@ jobs: matrix: include: - name: 🐧 Linux (GCC) - os: ubuntu-20.04 + os: ubuntu-22.04 platform: linux artifact-name: godot-cpp-linux-glibc2.27-x86_64-release artifact-path: bin/libgodot-cpp.linux.template_release.x86_64.a @@ -28,7 +32,7 @@ jobs: cache-name: linux-x86_64 - name: 🐧 Linux (GCC, Double Precision) - os: ubuntu-20.04 + os: ubuntu-22.04 platform: linux artifact-name: godot-cpp-linux-glibc2.27-x86_64-double-release artifact-path: bin/libgodot-cpp.linux.template_release.double.x86_64.a @@ -63,7 +67,7 @@ jobs: cache-name: macos-universal - name: 🤖 Android (arm64) - os: ubuntu-20.04 + os: ubuntu-22.04 platform: android artifact-name: godot-cpp-android-arm64-release artifact-path: bin/libgodot-cpp.android.template_release.arm64.a @@ -81,7 +85,7 @@ jobs: cache-name: ios-arm64 - name: 🌐 Web (wasm32) - os: ubuntu-20.04 + os: ubuntu-22.04 platform: web artifact-name: godot-cpp-web-wasm32-release artifact-path: bin/libgodot-cpp.web.template_release.wasm32.a @@ -91,7 +95,7 @@ jobs: env: SCONS_CACHE: ${{ github.workspace }}/.scons-cache/ EM_VERSION: 3.1.39 - EM_CACHE_FOLDER: "emsdk-cache" + EM_CACHE_FOLDER: emsdk-cache steps: - name: Checkout @@ -108,24 +112,24 @@ jobs: - name: Set up Python (for SCons) uses: actions/setup-python@v5 with: - python-version: '3.x' + python-version: 3.x - name: Android dependencies - if: ${{ matrix.platform == 'android' }} + if: matrix.platform == 'android' uses: nttld/setup-ndk@v1 with: ndk-version: r23c link-to-sdk: true - name: Web dependencies - if: ${{ matrix.platform == 'web' }} + if: matrix.platform == 'web' uses: mymindstorm/setup-emsdk@v14 with: - version: ${{env.EM_VERSION}} - actions-cache-folder: ${{env.EM_CACHE_FOLDER}} + version: ${{ env.EM_VERSION }} + actions-cache-folder: ${{ env.EM_CACHE_FOLDER }} - name: Setup MinGW for Windows/MinGW build - if: ${{ matrix.platform == 'windows' && matrix.flags == 'use_mingw=yes' }} + if: matrix.platform == 'windows' && matrix.flags == 'use_mingw=yes' uses: egor-tensin/setup-mingw@v2 with: version: 12.2.0 @@ -161,7 +165,7 @@ jobs: - name: Download latest Godot artifacts uses: dsnopek/action-download-artifact@1322f74e2dac9feed2ee76a32d9ae1ca3b4cf4e9 - if: ${{ matrix.run-tests && env.GODOT_TEST_VERSION == 'master' }} + if: matrix.run-tests && env.GODOT_TEST_VERSION == 'master' with: repo: godotengine/godot branch: master @@ -175,13 +179,13 @@ jobs: path: godot-artifacts - name: Prepare Godot artifacts for testing - if: ${{ matrix.run-tests && env.GODOT_TEST_VERSION == 'master' }} + if: matrix.run-tests && env.GODOT_TEST_VERSION == 'master' run: | chmod +x ./godot-artifacts/godot.linuxbsd.editor.x86_64.mono echo "GODOT=$(pwd)/godot-artifacts/godot.linuxbsd.editor.x86_64.mono" >> $GITHUB_ENV - name: Download requested Godot version for testing - if: ${{ matrix.run-tests && env.GODOT_TEST_VERSION != 'master' }} + if: matrix.run-tests && env.GODOT_TEST_VERSION != 'master' run: | wget "https://github.com/godotengine/godot-builds/releases/download/${GODOT_TEST_VERSION}/Godot_v${GODOT_TEST_VERSION}_linux.x86_64.zip" -O Godot.zip unzip -a Godot.zip @@ -189,7 +193,7 @@ jobs: echo "GODOT=$(pwd)/Godot_v${GODOT_TEST_VERSION}_linux.x86_64" >> $GITHUB_ENV - name: Run tests - if: ${{ matrix.run-tests }} + if: matrix.run-tests run: | $GODOT --headless --version cd test @@ -206,7 +210,7 @@ jobs: linux-cmake: name: 🐧 Build (Linux, GCC, CMake) - runs-on: ubuntu-20.04 + runs-on: ubuntu-22.04 steps: - name: Checkout uses: actions/checkout@v4 @@ -230,7 +234,7 @@ jobs: linux-cmake-ninja: name: 🐧 Build (Linux, GCC, CMake Ninja) - runs-on: ubuntu-20.04 + runs-on: ubuntu-22.04 steps: - name: Checkout uses: actions/checkout@v4 @@ -264,9 +268,9 @@ jobs: - name: Build godot-cpp run: | cmake -DCMAKE_BUILD_TYPE=Release -G"Visual Studio 16 2019" . - cmake --build . --verbose + cmake --build . --verbose --config Release - name: Build test GDExtension library run: | cd test && cmake -DCMAKE_BUILD_TYPE=Release -DGODOT_HEADERS_PATH="../godot-headers" -DCPP_BINDINGS_PATH=".." -G"Visual Studio 16 2019" . - cmake --build . --verbose + cmake --build . --verbose --config Release diff --git a/.github/workflows/runner.yml b/.github/workflows/runner.yml new file mode 100644 index 0000000..a2e4f91 --- /dev/null +++ b/.github/workflows/runner.yml @@ -0,0 +1,21 @@ +name: 🔗 GHA +on: [push, pull_request, merge_group] + +concurrency: + group: ci-${{ github.actor }}-${{ github.head_ref || github.run_number }}-${{ github.ref }}-runner + cancel-in-progress: true + +jobs: + # First stage: Only static checks, fast and prevent expensive builds from running. + + static-checks: + if: '!vars.DISABLE_GODOT_CI' + name: 📊 Static Checks + uses: ./.github/workflows/static_checks.yml + + # Second stage: Run all the builds and some of the tests. + + ci: + name: 🛠️ Continuous Integration + needs: static-checks + uses: ./.github/workflows/ci.yml diff --git a/.github/workflows/static_checks.yml b/.github/workflows/static_checks.yml index 6899248..c8d2713 100644 --- a/.github/workflows/static_checks.yml +++ b/.github/workflows/static_checks.yml @@ -1,8 +1,9 @@ name: 📊 Static Checks -on: [push, pull_request] +on: + workflow_call: concurrency: - group: ci-${{github.actor}}-${{github.head_ref || github.run_number}}-${{github.ref}}-static + group: ci-${{ github.actor }}-${{ github.head_ref || github.run_number }}-${{ github.ref }}-static cancel-in-progress: true jobs: @@ -195,3 +195,7 @@ compile_commands.json # Python development .venv venv + +# Clion Configuration +.idea/ +cmake-build-* diff --git a/CMakeLists.txt b/CMakeLists.txt index 9609061..ff77368 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,228 +1,24 @@ -# cmake arguments -# CMAKE_BUILD_TYPE: Compilation target (Debug or Release defaults to Debug) -# -# godot-cpp cmake arguments -# GODOT_GDEXTENSION_DIR: Path to the directory containing GDExtension interface header and API JSON file -# GODOT_CPP_SYSTEM_HEADERS Mark the header files as SYSTEM. This may be useful to suppress warnings in projects including this one. -# GODOT_CPP_WARNING_AS_ERROR Treat any warnings as errors -# GODOT_ENABLE_HOT_RELOAD Build with hot reload support. Defaults to YES for Debug-builds and NO for Release-builds. -# GODOT_CUSTOM_API_FILE: Path to a custom GDExtension API JSON file (takes precedence over `gdextension_dir`) -# FLOAT_PRECISION: Floating-point precision level ("single", "double") -# -# Android cmake arguments -# CMAKE_TOOLCHAIN_FILE: The path to the android cmake toolchain ($ANDROID_NDK/build/cmake/android.toolchain.cmake) -# ANDROID_NDK: The path to the android ndk root folder -# ANDROID_TOOLCHAIN_NAME: The android toolchain (arm-linux-androideabi-4.9 or aarch64-linux-android-4.9 or x86-4.9 or x86_64-4.9) -# ANDROID_PLATFORM: The android platform version (android-23) -# More info here: https://godot.readthedocs.io/en/latest/development/compiling/compiling_for_android.html -# -# Examples -# -# Builds a debug version: -# cmake . -# cmake --build . -# -# Builds a release version with clang -# CC=/usr/bin/clang CXX=/usr/bin/clang++ cmake -DCMAKE_BUILD_TYPE=Release -G "Unix Makefiles" . -# cmake --build . -# -# Builds an android armeabi-v7a debug version: -# cmake -DCMAKE_TOOLCHAIN_FILE=$ANDROID_NDK/build/cmake/android.toolchain.cmake -DANDROID_NDK=$ANDROID_NDK \ -# -DANDROID_TOOLCHAIN_NAME=arm-linux-androideabi-4.9 -DANDROID_PLATFORM=android-23 -DCMAKE_BUILD_TYPE=Debug . -# cmake --build . -# -# Protip -# Generate the buildfiles in a sub directory to not clutter the root directory with build files: -# mkdir build && cd build && cmake -G "Unix Makefiles" .. && cmake --build . -# -# Todo -# Test build for Windows, Mac and mingw. - cmake_minimum_required(VERSION 3.13) project(godot-cpp LANGUAGES CXX) -option(GENERATE_TEMPLATE_GET_NODE "Generate a template version of the Node class's get_node." ON) -option(GODOT_CPP_SYSTEM_HEADERS "Expose headers as SYSTEM." ON) -option(GODOT_CPP_WARNING_AS_ERROR "Treat warnings as errors" OFF) - -# Add path to modules -list( APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/cmake/" ) - -# Set some helper variables for readability -set( compiler_is_clang "$<OR:$<CXX_COMPILER_ID:AppleClang>,$<CXX_COMPILER_ID:Clang>>" ) -set( compiler_is_gnu "$<CXX_COMPILER_ID:GNU>" ) -set( compiler_is_msvc "$<CXX_COMPILER_ID:MSVC>" ) - -# Default build type is Debug in the SConstruct -if("${CMAKE_BUILD_TYPE}" STREQUAL "") - set(CMAKE_BUILD_TYPE Debug) -endif() - -# Hot reload is enabled by default in Debug-builds -if("${CMAKE_BUILD_TYPE}" STREQUAL "Debug") - option(GODOT_ENABLE_HOT_RELOAD "Build with hot reload support" ON) -else() - option(GODOT_ENABLE_HOT_RELOAD "Build with hot reload support" OFF) -endif() - -if(NOT DEFINED BITS) - set(BITS 32) - if(CMAKE_SIZEOF_VOID_P EQUAL 8) - set(BITS 64) - endif(CMAKE_SIZEOF_VOID_P EQUAL 8) -endif() - -# Input from user for GDExtension interface header and the API JSON file -set(GODOT_GDEXTENSION_DIR "gdextension" CACHE STRING "") -set(GODOT_CUSTOM_API_FILE "" CACHE STRING "") - -set(GODOT_GDEXTENSION_API_FILE "${GODOT_GDEXTENSION_DIR}/extension_api.json") -if (NOT "${GODOT_CUSTOM_API_FILE}" STREQUAL "") # User-defined override. - set(GODOT_GDEXTENSION_API_FILE "${GODOT_CUSTOM_API_FILE}") -endif() - -set(FLOAT_PRECISION "single" CACHE STRING "") -if ("${FLOAT_PRECISION}" STREQUAL "double") - add_definitions(-DREAL_T_IS_DOUBLE) -endif() - -set(GODOT_COMPILE_FLAGS ) - -if ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "MSVC") - # using Visual Studio C++ - set(GODOT_COMPILE_FLAGS "/utf-8") # /GF /MP - - if(CMAKE_BUILD_TYPE MATCHES Debug) - set(GODOT_COMPILE_FLAGS "${GODOT_COMPILE_FLAGS} /MDd") # /Od /RTC1 /Zi - else() - set(GODOT_COMPILE_FLAGS "${GODOT_COMPILE_FLAGS} /MD /O2") # /Oy /GL /Gy - STRING(REGEX REPLACE "/RTC(su|[1su])" "" CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS}") - string(REPLACE "/RTC1" "" CMAKE_CXX_FLAGS_DEBUG ${CMAKE_CXX_FLAGS_DEBUG}) - endif(CMAKE_BUILD_TYPE MATCHES Debug) - - add_definitions(-DNOMINMAX) -else() # GCC/Clang - if(CMAKE_BUILD_TYPE MATCHES Debug) - set(GODOT_COMPILE_FLAGS "${GODOT_COMPILE_FLAGS} -fno-omit-frame-pointer -O0 -g") - else() - set(GODOT_COMPILE_FLAGS "${GODOT_COMPILE_FLAGS} -O3") - endif(CMAKE_BUILD_TYPE MATCHES Debug) -endif() - -# Disable exception handling. Godot doesn't use exceptions anywhere, and this -# saves around 20% of binary size and very significant build time (GH-80513). -option(GODOT_DISABLE_EXCEPTIONS ON "Force disabling exception handling code") -if (GODOT_DISABLE_EXCEPTIONS) - if ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "MSVC") - set(GODOT_COMPILE_FLAGS "${GODOT_COMPILE_FLAGS} -D_HAS_EXCEPTIONS=0") - else() - set(GODOT_COMPILE_FLAGS "${GODOT_COMPILE_FLAGS} -fno-exceptions") - endif() -else() - if ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "MSVC") - set(GODOT_COMPILE_FLAGS "${GODOT_COMPILE_FLAGS} /EHsc") - endif() -endif() - -if (GODOT_ENABLE_HOT_RELOAD) - set(GODOT_COMPILE_FLAGS "${GODOT_COMPILE_FLAGS} -D HOT_RELOAD_ENABLED") -endif() - -# Generate source from the bindings file -find_package(Python3 3.4 REQUIRED) # pathlib should be present -if(GENERATE_TEMPLATE_GET_NODE) - set(GENERATE_BINDING_PARAMETERS "True") -else() - set(GENERATE_BINDING_PARAMETERS "False") -endif() - -execute_process(COMMAND "${Python3_EXECUTABLE}" "-c" "import binding_generator; binding_generator.print_file_list(\"${GODOT_GDEXTENSION_API_FILE}\", \"${CMAKE_CURRENT_BINARY_DIR}\", headers=True, sources=True)" - WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} - OUTPUT_VARIABLE GENERATED_FILES_LIST - OUTPUT_STRIP_TRAILING_WHITESPACE -) - -add_custom_command(OUTPUT ${GENERATED_FILES_LIST} - COMMAND "${Python3_EXECUTABLE}" "-c" "import binding_generator; binding_generator.generate_bindings(\"${GODOT_GDEXTENSION_API_FILE}\", \"${GENERATE_BINDING_PARAMETERS}\", \"${BITS}\", \"${FLOAT_PRECISION}\", \"${CMAKE_CURRENT_BINARY_DIR}\")" - VERBATIM - WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} - MAIN_DEPENDENCY ${GODOT_GDEXTENSION_API_FILE} - DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/binding_generator.py - COMMENT "Generating bindings" -) - -# Get Sources -file(GLOB_RECURSE SOURCES CONFIGURE_DEPENDS src/*.c**) -file(GLOB_RECURSE HEADERS CONFIGURE_DEPENDS include/*.h**) - -# Define our godot-cpp library -add_library(${PROJECT_NAME} STATIC - ${SOURCES} - ${HEADERS} - ${GENERATED_FILES_LIST} -) -add_library(godot::cpp ALIAS ${PROJECT_NAME}) - -include(GodotCompilerWarnings) - -target_compile_features(${PROJECT_NAME} - PRIVATE - cxx_std_17 -) - -target_compile_definitions(${PROJECT_NAME} PUBLIC - $<$<CONFIG:Debug>: - DEBUG_ENABLED - DEBUG_METHODS_ENABLED - > - $<${compiler_is_msvc}: - TYPED_METHOD_BIND - > -) - -target_link_options(${PROJECT_NAME} PRIVATE - $<$<NOT:${compiler_is_msvc}>: - -static-libgcc - -static-libstdc++ - -Wl,-R,'$$ORIGIN' - > -) - -# Optionally mark headers as SYSTEM -set(GODOT_CPP_SYSTEM_HEADERS_ATTRIBUTE "") -if (GODOT_CPP_SYSTEM_HEADERS) - set(GODOT_CPP_SYSTEM_HEADERS_ATTRIBUTE SYSTEM) +# Configure CMake +# https://discourse.cmake.org/t/how-do-i-remove-compile-options-from-target/5965 +# https://stackoverflow.com/questions/74426638/how-to-remove-rtc1-from-specific-target-or-file-in-cmake +if(${CMAKE_CXX_COMPILER_ID} STREQUAL MSVC) + if(NOT CMAKE_BUILD_TYPE MATCHES Debug) + STRING(REGEX REPLACE "/RTC(su|[1su])" "" CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS}") + string(REPLACE "/RTC1" "" CMAKE_CXX_FLAGS_DEBUG ${CMAKE_CXX_FLAGS_DEBUG}) + endif () endif () -target_include_directories(${PROJECT_NAME} ${GODOT_CPP_SYSTEM_HEADERS_ATTRIBUTE} PUBLIC - include - ${CMAKE_CURRENT_BINARY_DIR}/gen/include - ${GODOT_GDEXTENSION_DIR} -) - -# Add the compile flags -set_property(TARGET ${PROJECT_NAME} APPEND_STRING PROPERTY COMPILE_FLAGS ${GODOT_COMPILE_FLAGS}) +include( ${PROJECT_SOURCE_DIR}/cmake/godotcpp.cmake ) -# Create the correct name (godot.os.build_type.system_bits) -string(TOLOWER "${CMAKE_SYSTEM_NAME}" SYSTEM_NAME) -string(TOLOWER "${CMAKE_BUILD_TYPE}" BUILD_TYPE) +# I know this doesn't look like a typical CMakeLists.txt, but as we are +# attempting mostly feature parity with SCons, and easy maintenance, the closer +# the two build systems look the easier they will be to keep in lockstep. -if(ANDROID) - # Added the android abi after system name - set(SYSTEM_NAME ${SYSTEM_NAME}.${ANDROID_ABI}) +# The typical target definitions are in ${PROJECT_SOURCE_DIR}/cmake/godotcpp.cmake - # Android does not have the bits at the end if you look at the main godot repo build - set(OUTPUT_NAME "godot-cpp.${SYSTEM_NAME}.${BUILD_TYPE}") -else() - set(OUTPUT_NAME "godot-cpp.${SYSTEM_NAME}.${BUILD_TYPE}.${BITS}") -endif() +godotcpp_options() -set_target_properties(${PROJECT_NAME} - PROPERTIES - CXX_EXTENSIONS OFF - POSITION_INDEPENDENT_CODE ON - ARCHIVE_OUTPUT_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/bin" - LIBRARY_OUTPUT_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/bin" - RUNTIME_OUTPUT_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/bin" - OUTPUT_NAME "${OUTPUT_NAME}" -) +godotcpp_generate() diff --git a/binding_generator.py b/binding_generator.py index 71afe04..b8b76ba 100644 --- a/binding_generator.py +++ b/binding_generator.py @@ -672,6 +672,8 @@ def generate_builtin_class_header(builtin_api, size, used_classes, fully_used_cl for include in fully_used_classes: if include == "TypedArray": includes.append("godot_cpp/variant/typed_array.hpp") + elif include == "TypedDictionary": + includes.append("godot_cpp/variant/typed_dictionary.hpp") else: includes.append(f"godot_cpp/{get_include_path(include)}") @@ -1022,6 +1024,9 @@ def generate_builtin_class_header(builtin_api, size, used_classes, fully_used_cl if class_name == "Dictionary": result.append("\tconst Variant &operator[](const Variant &p_key) const;") result.append("\tVariant &operator[](const Variant &p_key);") + result.append( + "\tvoid set_typed(uint32_t p_key_type, const StringName &p_key_class_name, const Variant &p_key_script, uint32_t p_value_type, const StringName &p_value_class_name, const Variant &p_value_script);" + ) result.append("};") @@ -1438,6 +1443,32 @@ def generate_engine_classes_bindings(api, output_dir, use_template_get_node): fully_used_classes.add(array_type_name) else: used_classes.add(array_type_name) + elif type_name.startswith("typeddictionary::"): + fully_used_classes.add("TypedDictionary") + dict_type_name = type_name.replace("typeddictionary::", "") + if dict_type_name.startswith("const "): + dict_type_name = dict_type_name[6:] + dict_type_names = dict_type_name.split(";") + dict_type_name = dict_type_names[0] + if dict_type_name.endswith("*"): + dict_type_name = dict_type_name[:-1] + if is_included(dict_type_name, class_name): + if is_enum(dict_type_name): + fully_used_classes.add(get_enum_class(dict_type_name)) + elif "default_value" in argument: + fully_used_classes.add(dict_type_name) + else: + used_classes.add(dict_type_name) + dict_type_name = dict_type_names[2] + if dict_type_name.endswith("*"): + dict_type_name = dict_type_name[:-1] + if is_included(dict_type_name, class_name): + if is_enum(dict_type_name): + fully_used_classes.add(get_enum_class(dict_type_name)) + elif "default_value" in argument: + fully_used_classes.add(dict_type_name) + else: + used_classes.add(dict_type_name) elif is_enum(type_name): fully_used_classes.add(get_enum_class(type_name)) elif "default_value" in argument: @@ -1467,6 +1498,32 @@ def generate_engine_classes_bindings(api, output_dir, use_template_get_node): fully_used_classes.add(array_type_name) else: used_classes.add(array_type_name) + elif type_name.startswith("typeddictionary::"): + fully_used_classes.add("TypedDictionary") + dict_type_name = type_name.replace("typeddictionary::", "") + if dict_type_name.startswith("const "): + dict_type_name = dict_type_name[6:] + dict_type_names = dict_type_name.split(";") + dict_type_name = dict_type_names[0] + if dict_type_name.endswith("*"): + dict_type_name = dict_type_name[:-1] + if is_included(dict_type_name, class_name): + if is_enum(dict_type_name): + fully_used_classes.add(get_enum_class(dict_type_name)) + elif is_variant(dict_type_name): + fully_used_classes.add(dict_type_name) + else: + used_classes.add(dict_type_name) + dict_type_name = dict_type_names[2] + if dict_type_name.endswith("*"): + dict_type_name = dict_type_name[:-1] + if is_included(dict_type_name, class_name): + if is_enum(dict_type_name): + fully_used_classes.add(get_enum_class(dict_type_name)) + elif is_variant(dict_type_name): + fully_used_classes.add(dict_type_name) + else: + used_classes.add(dict_type_name) elif is_enum(type_name): fully_used_classes.add(get_enum_class(type_name)) elif is_variant(type_name): @@ -1600,6 +1657,8 @@ def generate_engine_class_header(class_api, used_classes, fully_used_classes, us for included in fully_used_classes: if included == "TypedArray": includes.append("godot_cpp/variant/typed_array.hpp") + elif included == "TypedDictionary": + includes.append("godot_cpp/variant/typed_dictionary.hpp") else: includes.append(f"godot_cpp/{get_include_path(included)}") @@ -2688,6 +2747,7 @@ def is_variant(type_name): or type_name in builtin_classes or type_name == "Nil" or type_name.startswith("typedarray::") + or type_name.startswith("typeddictionary::") ) @@ -2727,6 +2787,8 @@ def is_included(type_name, current_type): """ if type_name.startswith("typedarray::"): return True + if type_name.startswith("typeddictionary::"): + return True to_include = get_enum_class(type_name) if is_enum(type_name) else type_name if to_include == current_type or is_pod_type(to_include): return False @@ -2765,6 +2827,12 @@ def correct_typed_array(type_name): return type_name +def correct_typed_dictionary(type_name): + if type_name.startswith("typeddictionary::"): + return type_name.replace("typeddictionary::", "TypedDictionary<").replace(";", ", ") + ">" + return type_name + + def correct_type(type_name, meta=None, use_alias=True): type_conversion = {"float": "double", "int": "int64_t", "Nil": "Variant"} if meta is not None: @@ -2778,6 +2846,8 @@ def correct_type(type_name, meta=None, use_alias=True): return type_conversion[type_name] if type_name.startswith("typedarray::"): return type_name.replace("typedarray::", "TypedArray<") + ">" + if type_name.startswith("typeddictionary::"): + return type_name.replace("typeddictionary::", "TypedDictionary<").replace(";", ", ") + ">" if is_enum(type_name): if is_bitfield(type_name): base_class = get_enum_class(type_name) @@ -2924,6 +2994,8 @@ def get_default_value_for_type(type_name): return "false" if type_name.startswith("typedarray::"): return f"{correct_type(type_name)}()" + if type_name.startswith("typeddictionary::"): + return f"{correct_type(type_name)}()" if is_enum(type_name): return f"{correct_type(type_name)}(0)" if is_variant(type_name): diff --git a/cmake/GodotCompilerWarnings.cmake b/cmake/common_compiler_flags.cmake index 423e636..9455641 100644 --- a/cmake/GodotCompilerWarnings.cmake +++ b/cmake/common_compiler_flags.cmake @@ -89,6 +89,6 @@ function( set_warning_as_error ) endif() endfunction() -if ( GODOT_CPP_WARNING_AS_ERROR ) +if ( GODOT_WARNING_AS_ERROR ) set_warning_as_error() endif() diff --git a/cmake/godotcpp.cmake b/cmake/godotcpp.cmake new file mode 100644 index 0000000..a5c6677 --- /dev/null +++ b/cmake/godotcpp.cmake @@ -0,0 +1,240 @@ +function( godotcpp_options ) + + #TODO platform + #TODO target + + # Input from user for GDExtension interface header and the API JSON file + set(GODOT_GDEXTENSION_DIR "gdextension" CACHE PATH + "Path to a custom directory containing GDExtension interface header and API JSON file ( /path/to/gdextension_dir )" ) + set(GODOT_CUSTOM_API_FILE "" CACHE FILEPATH + "Path to a custom GDExtension API JSON file (takes precedence over `gdextension_dir`) ( /path/to/custom_api_file )") + + #TODO generate_bindings + + option(GODOT_GENERATE_TEMPLATE_GET_NODE + "Generate a template version of the Node class's get_node. (ON|OFF)" ON) + + #TODO build_library + + set(GODOT_PRECISION "single" CACHE STRING + "Set the floating-point precision level (single|double)") + + #TODO arch + #TODO threads + #TODO compiledb + #TODO compiledb_file + #TODO build_profile aka cmake preset + + set(GODOT_USE_HOT_RELOAD "" CACHE BOOL + "Enable the extra accounting required to support hot reload. (ON|OFF)") + + option(GODOT_DISABLE_EXCEPTIONS "Force disabling exception handling code (ON|OFF)" ON ) + + set( GODOT_SYMBOL_VISIBILITY "hidden" CACHE STRING + "Symbols visibility on GNU platforms. Use 'auto' to apply the default value. (auto|visible|hidden)") + set_property( CACHE GODOT_SYMBOL_VISIBILITY PROPERTY STRINGS "auto;visible;hidden" ) + + #TODO optimize + #TODO debug_symbols + #TODO dev_build + + # FIXME These options are not present in SCons, and perhaps should be added there. + option(GODOT_SYSTEM_HEADERS "Expose headers as SYSTEM." ON) + option(GODOT_WARNING_AS_ERROR "Treat warnings as errors" OFF) + + # Run options commands on the following to populate cache for all platforms. + # This type of thing is typically done conditionally + # But as scons shows all options so shall we. + #TODO ios_options() + #TODO linux_options() + #TODO macos_options() + #TODO web_options() + #TODO windows_options() +endfunction() + + +function( godotcpp_generate ) + # Set some helper variables for readability + set( compiler_is_clang "$<OR:$<CXX_COMPILER_ID:AppleClang>,$<CXX_COMPILER_ID:Clang>>" ) + set( compiler_is_gnu "$<CXX_COMPILER_ID:GNU>" ) + set( compiler_is_msvc "$<CXX_COMPILER_ID:MSVC>" ) + + # CXX_VISIBILITY_PRESET supported values are: default, hidden, protected, and internal + # which is inline with the gcc -fvisibility= + # https://gcc.gnu.org/onlinedocs/gcc/Code-Gen-Options.html + # To match the scons options we need to change the text to match the -fvisibility flag + # it is probably worth another PR which changes both to use the flag options + if( ${GODOT_SYMBOL_VISIBILITY} STREQUAL "auto" OR ${GODOT_SYMBOL_VISIBILITY} STREQUAL "visible" ) + set( GODOT_SYMBOL_VISIBILITY "default" ) + endif () + + # Default build type is Debug in the SConstruct + if("${CMAKE_BUILD_TYPE}" STREQUAL "") + set(CMAKE_BUILD_TYPE Debug) + endif() + + # Hot reload is enabled by default in Debug-builds + if( GODOT_USE_HOT_RELOAD STREQUAL "" AND NOT CMAKE_BUILD_TYPE STREQUAL "Release") + set(GODOT_USE_HOT_RELOAD ON) + endif() + + if(NOT DEFINED BITS) + set(BITS 32) + if(CMAKE_SIZEOF_VOID_P EQUAL 8) + set(BITS 64) + endif(CMAKE_SIZEOF_VOID_P EQUAL 8) + endif() + + + set(GODOT_GDEXTENSION_API_FILE "${GODOT_GDEXTENSION_DIR}/extension_api.json") + if (NOT "${GODOT_CUSTOM_API_FILE}" STREQUAL "") # User-defined override. + set(GODOT_GDEXTENSION_API_FILE "${GODOT_CUSTOM_API_FILE}") + endif() + + if ("${GODOT_PRECISION}" STREQUAL "double") + add_definitions(-DREAL_T_IS_DOUBLE) + endif() + + set( GODOT_COMPILE_FLAGS ) + + if ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "MSVC") + # using Visual Studio C++ + set(GODOT_COMPILE_FLAGS "/utf-8") # /GF /MP + + if(CMAKE_BUILD_TYPE MATCHES Debug) + set(GODOT_COMPILE_FLAGS "${GODOT_COMPILE_FLAGS} /MDd") # /Od /RTC1 /Zi + else() + set(GODOT_COMPILE_FLAGS "${GODOT_COMPILE_FLAGS} /MD /O2") # /Oy /GL /Gy + endif(CMAKE_BUILD_TYPE MATCHES Debug) + + add_definitions(-DNOMINMAX) + else() # GCC/Clang + if(CMAKE_BUILD_TYPE MATCHES Debug) + set(GODOT_COMPILE_FLAGS "${GODOT_COMPILE_FLAGS} -fno-omit-frame-pointer -O0 -g") + else() + set(GODOT_COMPILE_FLAGS "${GODOT_COMPILE_FLAGS} -O3") + endif(CMAKE_BUILD_TYPE MATCHES Debug) + endif() + + # Disable exception handling. Godot doesn't use exceptions anywhere, and this + # saves around 20% of binary size and very significant build time (GH-80513). + if (GODOT_DISABLE_EXCEPTIONS) + if ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "MSVC") + set(GODOT_COMPILE_FLAGS "${GODOT_COMPILE_FLAGS} -D_HAS_EXCEPTIONS=0") + else() + set(GODOT_COMPILE_FLAGS "${GODOT_COMPILE_FLAGS} -fno-exceptions") + endif() + else() + if ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "MSVC") + set(GODOT_COMPILE_FLAGS "${GODOT_COMPILE_FLAGS} /EHsc") + endif() + endif() + + # Generate source from the bindings file + find_package(Python3 3.4 REQUIRED) # pathlib should be present + if(GODOT_GENERATE_TEMPLATE_GET_NODE) + set(GENERATE_BINDING_PARAMETERS "True") + else() + set(GENERATE_BINDING_PARAMETERS "False") + endif() + + execute_process(COMMAND "${Python3_EXECUTABLE}" "-c" "import binding_generator; binding_generator.print_file_list(\"${GODOT_GDEXTENSION_API_FILE}\", \"${CMAKE_CURRENT_BINARY_DIR}\", headers=True, sources=True)" + WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} + OUTPUT_VARIABLE GENERATED_FILES_LIST + OUTPUT_STRIP_TRAILING_WHITESPACE + ) + + add_custom_command(OUTPUT ${GENERATED_FILES_LIST} + COMMAND "${Python3_EXECUTABLE}" "-c" "import binding_generator; binding_generator.generate_bindings(\"${GODOT_GDEXTENSION_API_FILE}\", \"${GENERATE_BINDING_PARAMETERS}\", \"${BITS}\", \"${GODOT_PRECISION}\", \"${CMAKE_CURRENT_BINARY_DIR}\")" + VERBATIM + WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} + MAIN_DEPENDENCY ${GODOT_GDEXTENSION_API_FILE} + DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/binding_generator.py + COMMENT "Generating bindings" + ) + + # Get Sources + # As this cmake file was added using 'include(godotcpp)' from the root CMakeLists.txt, + # the ${CMAKE_CURRENT_SOURCE_DIR} is still the root dir. + file(GLOB_RECURSE SOURCES CONFIGURE_DEPENDS src/*.c**) + file(GLOB_RECURSE HEADERS CONFIGURE_DEPENDS include/*.h**) + + # Define our godot-cpp library + add_library(${PROJECT_NAME} STATIC + ${SOURCES} + ${HEADERS} + ${GENERATED_FILES_LIST} + ) + add_library(godot::cpp ALIAS ${PROJECT_NAME}) + + include(${PROJECT_SOURCE_DIR}/cmake/common_compiler_flags.cmake) + + target_compile_features(${PROJECT_NAME} + PRIVATE + cxx_std_17 + ) + + if(GODOT_USE_HOT_RELOAD) + target_compile_definitions(${PROJECT_NAME} PUBLIC HOT_RELOAD_ENABLED) + target_compile_options(${PROJECT_NAME} PUBLIC $<${compiler_is_gnu}:-fno-gnu-unique>) + endif() + + target_compile_definitions(${PROJECT_NAME} PUBLIC + $<$<CONFIG:Debug>: + DEBUG_ENABLED + DEBUG_METHODS_ENABLED + > + $<${compiler_is_msvc}: + TYPED_METHOD_BIND + > + ) + + target_link_options(${PROJECT_NAME} PRIVATE + $<$<NOT:${compiler_is_msvc}>: + -static-libgcc + -static-libstdc++ + -Wl,-R,'$$ORIGIN' + > + ) + + # Optionally mark headers as SYSTEM + set(GODOT_SYSTEM_HEADERS_ATTRIBUTE "") + if (GODOT_SYSTEM_HEADERS) + set(GODOT_SYSTEM_HEADERS_ATTRIBUTE SYSTEM) + endif () + + target_include_directories(${PROJECT_NAME} ${GODOT_SYSTEM_HEADERS_ATTRIBUTE} PUBLIC + include + ${CMAKE_CURRENT_BINARY_DIR}/gen/include + ${GODOT_GDEXTENSION_DIR} + ) + + # Add the compile flags + set_property(TARGET ${PROJECT_NAME} APPEND_STRING PROPERTY COMPILE_FLAGS ${GODOT_COMPILE_FLAGS}) + + # Create the correct name (godot.os.build_type.system_bits) + string(TOLOWER "${CMAKE_SYSTEM_NAME}" SYSTEM_NAME) + string(TOLOWER "${CMAKE_BUILD_TYPE}" BUILD_TYPE) + + if(ANDROID) + # Added the android abi after system name + set(SYSTEM_NAME ${SYSTEM_NAME}.${ANDROID_ABI}) + + # Android does not have the bits at the end if you look at the main godot repo build + set(OUTPUT_NAME "godot-cpp.${SYSTEM_NAME}.${BUILD_TYPE}") + else() + set(OUTPUT_NAME "godot-cpp.${SYSTEM_NAME}.${BUILD_TYPE}.${BITS}") + endif() + + set_target_properties(${PROJECT_NAME} + PROPERTIES + CXX_EXTENSIONS OFF + POSITION_INDEPENDENT_CODE ON + CXX_VISIBILITY_PRESET ${GODOT_SYMBOL_VISIBILITY} + ARCHIVE_OUTPUT_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/bin" + LIBRARY_OUTPUT_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/bin" + RUNTIME_OUTPUT_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/bin" + OUTPUT_NAME "${OUTPUT_NAME}" + ) + +endfunction() diff --git a/doc/cmake.md b/doc/cmake.md new file mode 100644 index 0000000..3dd77f5 --- /dev/null +++ b/doc/cmake.md @@ -0,0 +1,57 @@ +## CMake + +### cmake arguments + +`CMAKE_BUILD_TYPE`: Compilation target (Debug or Release defaults to Debug) + +### godot-cpp cmake arguments +- `GODOT_GDEXTENSION_DIR`: Path to the directory containing GDExtension interface header and API JSON file +- `GODOT_SYSTEM_HEADERS`: Mark the header files as SYSTEM. This may be useful to suppress warnings in projects including this one. +- `GODOT_WARNING_AS_ERROR`: Treat any warnings as errors +- `GODOT_USE_HOT_RELOAD`: Build with hot reload support. Defaults to YES for Debug-builds and NO for Release-builds. +- `GODOT_CUSTOM_API_FILE`: Path to a custom GDExtension API JSON file (takes precedence over `gdextension_dir`) +- `GODOT_PRECISION`: Floating-point precision level ("single", "double") + +### Android cmake arguments +- `CMAKE_TOOLCHAIN_FILE`: The path to the android cmake toolchain ($ANDROID_NDK/build/cmake/android.toolchain.cmake) +- `ANDROID_NDK`: The path to the android ndk root folder +- `ANDROID_TOOLCHAIN_NAME`: The android toolchain (arm-linux-androideabi-4.9 or aarch64-linux-android-4.9 or x86-4.9 or x86_64-4.9) +- `ANDROID_PLATFORM`: The android platform version (android-23) + +- More info [here](https://godot.readthedocs.io/en/latest/development/compiling/compiling_for_android.html) + +## Examples +```shell +Builds a debug version: +cmake . +cmake --build . +``` +Builds a release version with clang + +```shell +CC=/usr/bin/clang CXX=/usr/bin/clang++ cmake -DCMAKE_BUILD_TYPE=Release -G "Unix Makefiles" . +cmake --build . +``` +Builds an android armeabi-v7a debug version: + +``` shell +cmake -DCMAKE_TOOLCHAIN_FILE=$ANDROID_NDK/build/cmake/android.toolchain.cmake -DANDROID_NDK=$ANDROID_NDK \ + -DANDROID_TOOLCHAIN_NAME=arm-linux-androideabi-4.9 -DANDROID_PLATFORM=android-23 -DCMAKE_BUILD_TYPE=Debug . +cmake --build . +``` + +## Protip +Generate the buildfiles in a sub directory to not clutter the root directory with build files: + +```shell +mkdir build && cd build && cmake -G "Unix Makefiles" .. && cmake --build . +``` + +Ensure that you avoid exposing godot-cpp symbols - this might lead to hard to debug errors if you ever load multiple +plugins using difference godot-cpp versions. Use visibility hidden whenever possible: +```cmake +set_target_properties(<all-my-plugin-related-targets> PROPERTIES CXX_VISIBILITY_PRESET hidden) +``` + +## Todo +Test build for Windows, Mac and mingw. diff --git a/gdextension/extension_api.json b/gdextension/extension_api.json index 10c2f34..d85608a 100644 --- a/gdextension/extension_api.json +++ b/gdextension/extension_api.json @@ -1,11 +1,11 @@ { "header": { "version_major": 4, - "version_minor": 3, + "version_minor": 4, "version_patch": 0, - "version_status": "stable", + "version_status": "dev2", "version_build": "official", - "version_full_name": "Godot Engine v4.3.stable.official" + "version_full_name": "Godot Engine v4.4.dev2.official" }, "builtin_class_sizes": [ { @@ -3612,6 +3612,10 @@ "value": 31 }, { + "name": "PROPERTY_HINT_DICTIONARY_TYPE", + "value": 38 + }, + { "name": "PROPERTY_HINT_LOCALE_ID", "value": 32 }, @@ -3633,7 +3637,7 @@ }, { "name": "PROPERTY_HINT_MAX", - "value": 38 + "value": 39 } ] }, @@ -8499,6 +8503,22 @@ "hash": 3942272618 }, { + "name": "is_valid_ascii_identifier", + "return_type": "bool", + "is_vararg": false, + "is_const": true, + "is_static": false, + "hash": 3918633141 + }, + { + "name": "is_valid_unicode_identifier", + "return_type": "bool", + "is_vararg": false, + "is_const": true, + "is_static": false, + "hash": 3918633141 + }, + { "name": "is_valid_identifier", "return_type": "bool", "is_vararg": false, @@ -10400,6 +10420,20 @@ ] }, { + "name": "get_support", + "return_type": "Vector2", + "is_vararg": false, + "is_const": true, + "is_static": false, + "hash": 2026743667, + "arguments": [ + { + "name": "direction", + "type": "Vector2" + } + ] + }, + { "name": "grow", "return_type": "Rect2", "is_vararg": false, @@ -14774,7 +14808,7 @@ "hash": 2923479887, "arguments": [ { - "name": "dir", + "name": "direction", "type": "Vector3" } ] @@ -18884,6 +18918,22 @@ "hash": 3942272618 }, { + "name": "is_valid_ascii_identifier", + "return_type": "bool", + "is_vararg": false, + "is_const": true, + "is_static": false, + "hash": 3918633141 + }, + { + "name": "is_valid_unicode_identifier", + "return_type": "bool", + "is_vararg": false, + "is_const": true, + "is_static": false, + "hash": 3918633141 + }, + { "name": "is_valid_identifier", "return_type": "bool", "is_vararg": false, @@ -19903,6 +19953,19 @@ "hash": 3218959716 }, { + "name": "assign", + "is_vararg": false, + "is_const": false, + "is_static": false, + "hash": 3642266950, + "arguments": [ + { + "name": "dictionary", + "type": "Dictionary" + } + ] + }, + { "name": "merge", "is_vararg": false, "is_const": false, @@ -20073,6 +20136,120 @@ ] }, { + "name": "is_typed", + "return_type": "bool", + "is_vararg": false, + "is_const": true, + "is_static": false, + "hash": 3918633141 + }, + { + "name": "is_typed_key", + "return_type": "bool", + "is_vararg": false, + "is_const": true, + "is_static": false, + "hash": 3918633141 + }, + { + "name": "is_typed_value", + "return_type": "bool", + "is_vararg": false, + "is_const": true, + "is_static": false, + "hash": 3918633141 + }, + { + "name": "is_same_typed", + "return_type": "bool", + "is_vararg": false, + "is_const": true, + "is_static": false, + "hash": 3471775634, + "arguments": [ + { + "name": "dictionary", + "type": "Dictionary" + } + ] + }, + { + "name": "is_same_typed_key", + "return_type": "bool", + "is_vararg": false, + "is_const": true, + "is_static": false, + "hash": 3471775634, + "arguments": [ + { + "name": "dictionary", + "type": "Dictionary" + } + ] + }, + { + "name": "is_same_typed_value", + "return_type": "bool", + "is_vararg": false, + "is_const": true, + "is_static": false, + "hash": 3471775634, + "arguments": [ + { + "name": "dictionary", + "type": "Dictionary" + } + ] + }, + { + "name": "get_typed_key_builtin", + "return_type": "int", + "is_vararg": false, + "is_const": true, + "is_static": false, + "hash": 3173160232 + }, + { + "name": "get_typed_value_builtin", + "return_type": "int", + "is_vararg": false, + "is_const": true, + "is_static": false, + "hash": 3173160232 + }, + { + "name": "get_typed_key_class_name", + "return_type": "StringName", + "is_vararg": false, + "is_const": true, + "is_static": false, + "hash": 1825232092 + }, + { + "name": "get_typed_value_class_name", + "return_type": "StringName", + "is_vararg": false, + "is_const": true, + "is_static": false, + "hash": 1825232092 + }, + { + "name": "get_typed_key_script", + "return_type": "Variant", + "is_vararg": false, + "is_const": true, + "is_static": false, + "hash": 1460142086 + }, + { + "name": "get_typed_value_script", + "return_type": "Variant", + "is_vararg": false, + "is_const": true, + "is_static": false, + "hash": 1460142086 + }, + { "name": "make_read_only", "is_vararg": false, "is_const": false, @@ -20118,6 +20295,39 @@ "type": "Dictionary" } ] + }, + { + "index": 2, + "arguments": [ + { + "name": "base", + "type": "Dictionary" + }, + { + "name": "key_type", + "type": "int" + }, + { + "name": "key_class_name", + "type": "StringName" + }, + { + "name": "key_script", + "type": "Variant" + }, + { + "name": "value_type", + "type": "int" + }, + { + "name": "value_class_name", + "type": "StringName" + }, + { + "name": "value_script", + "type": "Variant" + } + ] } ], "has_destructor": true @@ -25009,7 +25219,7 @@ "meta": "int64" }, { - "name": "to_id", + "name": "end_id", "type": "int", "meta": "int64" } @@ -25519,7 +25729,7 @@ "meta": "int64" }, { - "name": "to_id", + "name": "end_id", "type": "int", "meta": "int64" } @@ -26104,7 +26314,7 @@ "type": "Vector2i" }, { - "name": "to_id", + "name": "end_id", "type": "Vector2i" } ] @@ -26557,6 +26767,23 @@ ] }, { + "name": "get_point_data_in_region", + "is_const": true, + "is_vararg": false, + "is_static": false, + "is_virtual": false, + "hash": 3893818462, + "return_value": { + "type": "typedarray::Dictionary" + }, + "arguments": [ + { + "name": "region", + "type": "Rect2i" + } + ] + }, + { "name": "get_point_path", "is_const": false, "is_vararg": false, @@ -43798,6 +44025,20 @@ } }, { + "name": "set_playing", + "is_const": false, + "is_vararg": false, + "is_static": false, + "is_virtual": false, + "hash": 2586408642, + "arguments": [ + { + "name": "enable", + "type": "bool" + } + ] + }, + { "name": "set_stream_paused", "is_const": false, "is_vararg": false, @@ -43924,7 +44165,7 @@ { "type": "bool", "name": "playing", - "setter": "_set_playing", + "setter": "set_playing", "getter": "is_playing" }, { @@ -44167,6 +44408,20 @@ } }, { + "name": "set_playing", + "is_const": false, + "is_vararg": false, + "is_static": false, + "is_virtual": false, + "hash": 2586408642, + "arguments": [ + { + "name": "enable", + "type": "bool" + } + ] + }, + { "name": "set_max_distance", "is_const": false, "is_vararg": false, @@ -44401,7 +44656,7 @@ { "type": "bool", "name": "playing", - "setter": "_set_playing", + "setter": "set_playing", "getter": "is_playing" }, { @@ -44758,6 +45013,20 @@ } }, { + "name": "set_playing", + "is_const": false, + "is_vararg": false, + "is_static": false, + "is_virtual": false, + "hash": 2586408642, + "arguments": [ + { + "name": "enable", + "type": "bool" + } + ] + }, + { "name": "set_max_distance", "is_const": false, "is_vararg": false, @@ -45166,7 +45435,7 @@ { "type": "bool", "name": "playing", - "setter": "_set_playing", + "setter": "set_playing", "getter": "is_playing" }, { @@ -50708,6 +50977,17 @@ "api_type": "core", "methods": [ { + "name": "get_skeleton", + "is_const": false, + "is_vararg": false, + "is_static": false, + "is_virtual": false, + "hash": 1814733083, + "return_value": { + "type": "Skeleton3D" + } + }, + { "name": "set_bone_name", "is_const": false, "is_vararg": false, @@ -54343,6 +54623,33 @@ } }, { + "name": "set_emission_ring_cone_angle", + "is_const": false, + "is_vararg": false, + "is_static": false, + "is_virtual": false, + "hash": 373806689, + "arguments": [ + { + "name": "cone_angle", + "type": "float", + "meta": "float" + } + ] + }, + { + "name": "get_emission_ring_cone_angle", + "is_const": true, + "is_vararg": false, + "is_static": false, + "is_virtual": false, + "hash": 1740695150, + "return_value": { + "type": "float", + "meta": "float" + } + }, + { "name": "get_gravity", "is_const": true, "is_vararg": false, @@ -54639,6 +54946,12 @@ "getter": "get_emission_ring_inner_radius" }, { + "type": "float", + "name": "emission_ring_cone_angle", + "setter": "set_emission_ring_cone_angle", + "getter": "get_emission_ring_cone_angle" + }, + { "type": "bool", "name": "particle_flag_align_y", "setter": "set_particle_flag", @@ -56246,6 +56559,28 @@ "return_value": { "type": "Array" } + }, + { + "name": "bake_static_mesh", + "is_const": false, + "is_vararg": false, + "is_static": false, + "is_virtual": false, + "hash": 1605880883, + "return_value": { + "type": "ArrayMesh" + } + }, + { + "name": "bake_collision_shape", + "is_const": false, + "is_vararg": false, + "is_static": false, + "is_virtual": false, + "hash": 36102322, + "return_value": { + "type": "ConcavePolygonShape3D" + } } ], "properties": [ @@ -65086,6 +65421,48 @@ ] }, { + "name": "class_get_property_getter", + "is_const": false, + "is_vararg": false, + "is_static": false, + "is_virtual": false, + "hash": 3770832642, + "return_value": { + "type": "StringName" + }, + "arguments": [ + { + "name": "class", + "type": "StringName" + }, + { + "name": "property", + "type": "StringName" + } + ] + }, + { + "name": "class_get_property_setter", + "is_const": false, + "is_vararg": false, + "is_static": false, + "is_virtual": false, + "hash": 3770832642, + "return_value": { + "type": "StringName" + }, + "arguments": [ + { + "name": "class", + "type": "StringName" + }, + { + "name": "property", + "type": "StringName" + } + ] + }, + { "name": "class_get_property", "is_const": true, "is_vararg": false, @@ -65228,6 +65605,27 @@ ] }, { + "name": "class_call_static_method", + "is_const": false, + "is_vararg": true, + "is_static": false, + "is_virtual": false, + "hash": 3344196419, + "return_value": { + "type": "Variant" + }, + "arguments": [ + { + "name": "class", + "type": "StringName" + }, + { + "name": "method", + "type": "StringName" + } + ] + }, + { "name": "class_get_integer_constant_list", "is_const": true, "is_vararg": false, @@ -83493,6 +83891,74 @@ ] }, { + "name": "EditorContextMenuPlugin", + "is_refcounted": true, + "is_instantiable": true, + "inherits": "RefCounted", + "api_type": "editor", + "methods": [ + { + "name": "_popup_menu", + "is_const": false, + "is_static": false, + "is_vararg": false, + "is_virtual": true, + "arguments": [ + { + "name": "paths", + "type": "PackedStringArray" + } + ] + }, + { + "name": "add_menu_shortcut", + "is_const": false, + "is_vararg": false, + "is_static": false, + "is_virtual": false, + "hash": 851596305, + "arguments": [ + { + "name": "shortcut", + "type": "Shortcut" + }, + { + "name": "callback", + "type": "Callable" + } + ] + }, + { + "name": "add_context_menu_item", + "is_const": false, + "is_vararg": false, + "is_static": false, + "is_virtual": false, + "hash": 1048461161, + "arguments": [ + { + "name": "name", + "type": "String" + }, + { + "name": "callback", + "type": "Callable" + }, + { + "name": "icon", + "type": "Texture2D", + "default_value": "null" + }, + { + "name": "shortcut", + "type": "Shortcut", + "default_value": "null" + } + ] + } + ] + }, + { "name": "EditorDebuggerPlugin", "is_refcounted": true, "is_instantiable": true, @@ -83799,6 +84265,56 @@ "is_instantiable": false, "inherits": "RefCounted", "api_type": "editor", + "enums": [ + { + "name": "ExportMessageType", + "is_bitfield": false, + "values": [ + { + "name": "EXPORT_MESSAGE_NONE", + "value": 0 + }, + { + "name": "EXPORT_MESSAGE_INFO", + "value": 1 + }, + { + "name": "EXPORT_MESSAGE_WARNING", + "value": 2 + }, + { + "name": "EXPORT_MESSAGE_ERROR", + "value": 3 + } + ] + }, + { + "name": "DebugFlags", + "is_bitfield": true, + "values": [ + { + "name": "DEBUG_FLAG_DUMB_CLIENT", + "value": 1 + }, + { + "name": "DEBUG_FLAG_REMOTE_DEBUG", + "value": 2 + }, + { + "name": "DEBUG_FLAG_REMOTE_DEBUG_LOCALHOST", + "value": 4 + }, + { + "name": "DEBUG_FLAG_VIEW_COLLISIONS", + "value": 8 + }, + { + "name": "DEBUG_FLAG_VIEW_NAVIGATION", + "value": 16 + } + ] + } + ], "methods": [ { "name": "get_os_name", @@ -83810,6 +84326,464 @@ "return_value": { "type": "String" } + }, + { + "name": "create_preset", + "is_const": false, + "is_vararg": false, + "is_static": false, + "is_virtual": false, + "hash": 2572397818, + "return_value": { + "type": "EditorExportPreset" + } + }, + { + "name": "find_export_template", + "is_const": true, + "is_vararg": false, + "is_static": false, + "is_virtual": false, + "hash": 2248993622, + "return_value": { + "type": "Dictionary" + }, + "arguments": [ + { + "name": "template_file_name", + "type": "String" + } + ] + }, + { + "name": "get_current_presets", + "is_const": true, + "is_vararg": false, + "is_static": false, + "is_virtual": false, + "hash": 3995934104, + "return_value": { + "type": "Array" + } + }, + { + "name": "save_pack", + "is_const": false, + "is_vararg": false, + "is_static": false, + "is_virtual": false, + "hash": 3420080977, + "return_value": { + "type": "Dictionary" + }, + "arguments": [ + { + "name": "preset", + "type": "EditorExportPreset" + }, + { + "name": "debug", + "type": "bool" + }, + { + "name": "path", + "type": "String" + }, + { + "name": "embed", + "type": "bool", + "default_value": "false" + } + ] + }, + { + "name": "save_zip", + "is_const": false, + "is_vararg": false, + "is_static": false, + "is_virtual": false, + "hash": 1485052307, + "return_value": { + "type": "Dictionary" + }, + "arguments": [ + { + "name": "preset", + "type": "EditorExportPreset" + }, + { + "name": "debug", + "type": "bool" + }, + { + "name": "path", + "type": "String" + } + ] + }, + { + "name": "gen_export_flags", + "is_const": false, + "is_vararg": false, + "is_static": false, + "is_virtual": false, + "hash": 2976483270, + "return_value": { + "type": "PackedStringArray" + }, + "arguments": [ + { + "name": "flags", + "type": "bitfield::EditorExportPlatform.DebugFlags" + } + ] + }, + { + "name": "export_project_files", + "is_const": false, + "is_vararg": false, + "is_static": false, + "is_virtual": false, + "hash": 425454869, + "return_value": { + "type": "enum::Error" + }, + "arguments": [ + { + "name": "preset", + "type": "EditorExportPreset" + }, + { + "name": "debug", + "type": "bool" + }, + { + "name": "save_cb", + "type": "Callable" + }, + { + "name": "shared_cb", + "type": "Callable", + "default_value": "Callable()" + } + ] + }, + { + "name": "export_project", + "is_const": false, + "is_vararg": false, + "is_static": false, + "is_virtual": false, + "hash": 3879521245, + "return_value": { + "type": "enum::Error" + }, + "arguments": [ + { + "name": "preset", + "type": "EditorExportPreset" + }, + { + "name": "debug", + "type": "bool" + }, + { + "name": "path", + "type": "String" + }, + { + "name": "flags", + "type": "bitfield::EditorExportPlatform.DebugFlags", + "default_value": "0" + } + ] + }, + { + "name": "export_pack", + "is_const": false, + "is_vararg": false, + "is_static": false, + "is_virtual": false, + "hash": 3879521245, + "return_value": { + "type": "enum::Error" + }, + "arguments": [ + { + "name": "preset", + "type": "EditorExportPreset" + }, + { + "name": "debug", + "type": "bool" + }, + { + "name": "path", + "type": "String" + }, + { + "name": "flags", + "type": "bitfield::EditorExportPlatform.DebugFlags", + "default_value": "0" + } + ] + }, + { + "name": "export_zip", + "is_const": false, + "is_vararg": false, + "is_static": false, + "is_virtual": false, + "hash": 3879521245, + "return_value": { + "type": "enum::Error" + }, + "arguments": [ + { + "name": "preset", + "type": "EditorExportPreset" + }, + { + "name": "debug", + "type": "bool" + }, + { + "name": "path", + "type": "String" + }, + { + "name": "flags", + "type": "bitfield::EditorExportPlatform.DebugFlags", + "default_value": "0" + } + ] + }, + { + "name": "clear_messages", + "is_const": false, + "is_vararg": false, + "is_static": false, + "is_virtual": false, + "hash": 3218959716 + }, + { + "name": "add_message", + "is_const": false, + "is_vararg": false, + "is_static": false, + "is_virtual": false, + "hash": 782767225, + "arguments": [ + { + "name": "type", + "type": "enum::EditorExportPlatform.ExportMessageType" + }, + { + "name": "category", + "type": "String" + }, + { + "name": "message", + "type": "String" + } + ] + }, + { + "name": "get_message_count", + "is_const": true, + "is_vararg": false, + "is_static": false, + "is_virtual": false, + "hash": 3905245786, + "return_value": { + "type": "int", + "meta": "int32" + } + }, + { + "name": "get_message_type", + "is_const": true, + "is_vararg": false, + "is_static": false, + "is_virtual": false, + "hash": 2667287293, + "return_value": { + "type": "enum::EditorExportPlatform.ExportMessageType" + }, + "arguments": [ + { + "name": "index", + "type": "int", + "meta": "int32" + } + ] + }, + { + "name": "get_message_category", + "is_const": true, + "is_vararg": false, + "is_static": false, + "is_virtual": false, + "hash": 844755477, + "return_value": { + "type": "String" + }, + "arguments": [ + { + "name": "index", + "type": "int", + "meta": "int32" + } + ] + }, + { + "name": "get_message_text", + "is_const": true, + "is_vararg": false, + "is_static": false, + "is_virtual": false, + "hash": 844755477, + "return_value": { + "type": "String" + }, + "arguments": [ + { + "name": "index", + "type": "int", + "meta": "int32" + } + ] + }, + { + "name": "get_worst_message_type", + "is_const": true, + "is_vararg": false, + "is_static": false, + "is_virtual": false, + "hash": 2580557466, + "return_value": { + "type": "enum::EditorExportPlatform.ExportMessageType" + } + }, + { + "name": "ssh_run_on_remote", + "is_const": true, + "is_vararg": false, + "is_static": false, + "is_virtual": false, + "hash": 3163734797, + "return_value": { + "type": "enum::Error" + }, + "arguments": [ + { + "name": "host", + "type": "String" + }, + { + "name": "port", + "type": "String" + }, + { + "name": "ssh_arg", + "type": "PackedStringArray" + }, + { + "name": "cmd_args", + "type": "String" + }, + { + "name": "output", + "type": "Array", + "default_value": "[]" + }, + { + "name": "port_fwd", + "type": "int", + "meta": "int32", + "default_value": "-1" + } + ] + }, + { + "name": "ssh_run_on_remote_no_wait", + "is_const": true, + "is_vararg": false, + "is_static": false, + "is_virtual": false, + "hash": 3606362233, + "return_value": { + "type": "int", + "meta": "int64" + }, + "arguments": [ + { + "name": "host", + "type": "String" + }, + { + "name": "port", + "type": "String" + }, + { + "name": "ssh_args", + "type": "PackedStringArray" + }, + { + "name": "cmd_args", + "type": "String" + }, + { + "name": "port_fwd", + "type": "int", + "meta": "int32", + "default_value": "-1" + } + ] + }, + { + "name": "ssh_push_to_remote", + "is_const": true, + "is_vararg": false, + "is_static": false, + "is_virtual": false, + "hash": 218756989, + "return_value": { + "type": "enum::Error" + }, + "arguments": [ + { + "name": "host", + "type": "String" + }, + { + "name": "port", + "type": "String" + }, + { + "name": "scp_args", + "type": "PackedStringArray" + }, + { + "name": "src_file", + "type": "String" + }, + { + "name": "dst_file", + "type": "String" + } + ] + }, + { + "name": "get_forced_export_files", + "is_const": false, + "is_vararg": false, + "is_static": true, + "is_virtual": false, + "hash": 2981934095, + "return_value": { + "type": "PackedStringArray" + } } ] }, @@ -83821,6 +84795,504 @@ "api_type": "editor" }, { + "name": "EditorExportPlatformExtension", + "is_refcounted": true, + "is_instantiable": true, + "inherits": "EditorExportPlatform", + "api_type": "editor", + "methods": [ + { + "name": "_get_preset_features", + "is_const": true, + "is_static": false, + "is_vararg": false, + "is_virtual": true, + "return_value": { + "type": "PackedStringArray" + }, + "arguments": [ + { + "name": "preset", + "type": "EditorExportPreset" + } + ] + }, + { + "name": "_is_executable", + "is_const": true, + "is_static": false, + "is_vararg": false, + "is_virtual": true, + "return_value": { + "type": "bool" + }, + "arguments": [ + { + "name": "path", + "type": "String" + } + ] + }, + { + "name": "_get_export_options", + "is_const": true, + "is_static": false, + "is_vararg": false, + "is_virtual": true, + "return_value": { + "type": "typedarray::Dictionary" + } + }, + { + "name": "_should_update_export_options", + "is_const": false, + "is_static": false, + "is_vararg": false, + "is_virtual": true, + "return_value": { + "type": "bool" + } + }, + { + "name": "_get_export_option_visibility", + "is_const": true, + "is_static": false, + "is_vararg": false, + "is_virtual": true, + "return_value": { + "type": "bool" + }, + "arguments": [ + { + "name": "preset", + "type": "EditorExportPreset" + }, + { + "name": "option", + "type": "String" + } + ] + }, + { + "name": "_get_export_option_warning", + "is_const": true, + "is_static": false, + "is_vararg": false, + "is_virtual": true, + "return_value": { + "type": "String" + }, + "arguments": [ + { + "name": "preset", + "type": "EditorExportPreset" + }, + { + "name": "option", + "type": "StringName" + } + ] + }, + { + "name": "_get_os_name", + "is_const": true, + "is_static": false, + "is_vararg": false, + "is_virtual": true, + "return_value": { + "type": "String" + } + }, + { + "name": "_get_name", + "is_const": true, + "is_static": false, + "is_vararg": false, + "is_virtual": true, + "return_value": { + "type": "String" + } + }, + { + "name": "_get_logo", + "is_const": true, + "is_static": false, + "is_vararg": false, + "is_virtual": true, + "return_value": { + "type": "Texture2D" + } + }, + { + "name": "_poll_export", + "is_const": false, + "is_static": false, + "is_vararg": false, + "is_virtual": true, + "return_value": { + "type": "bool" + } + }, + { + "name": "_get_options_count", + "is_const": true, + "is_static": false, + "is_vararg": false, + "is_virtual": true, + "return_value": { + "type": "int", + "meta": "int32" + } + }, + { + "name": "_get_options_tooltip", + "is_const": true, + "is_static": false, + "is_vararg": false, + "is_virtual": true, + "return_value": { + "type": "String" + } + }, + { + "name": "_get_option_icon", + "is_const": true, + "is_static": false, + "is_vararg": false, + "is_virtual": true, + "return_value": { + "type": "ImageTexture" + }, + "arguments": [ + { + "name": "device", + "type": "int", + "meta": "int32" + } + ] + }, + { + "name": "_get_option_label", + "is_const": true, + "is_static": false, + "is_vararg": false, + "is_virtual": true, + "return_value": { + "type": "String" + }, + "arguments": [ + { + "name": "device", + "type": "int", + "meta": "int32" + } + ] + }, + { + "name": "_get_option_tooltip", + "is_const": true, + "is_static": false, + "is_vararg": false, + "is_virtual": true, + "return_value": { + "type": "String" + }, + "arguments": [ + { + "name": "device", + "type": "int", + "meta": "int32" + } + ] + }, + { + "name": "_get_device_architecture", + "is_const": true, + "is_static": false, + "is_vararg": false, + "is_virtual": true, + "return_value": { + "type": "String" + }, + "arguments": [ + { + "name": "device", + "type": "int", + "meta": "int32" + } + ] + }, + { + "name": "_cleanup", + "is_const": false, + "is_static": false, + "is_vararg": false, + "is_virtual": true + }, + { + "name": "_run", + "is_const": false, + "is_static": false, + "is_vararg": false, + "is_virtual": true, + "return_value": { + "type": "enum::Error" + }, + "arguments": [ + { + "name": "preset", + "type": "EditorExportPreset" + }, + { + "name": "device", + "type": "int", + "meta": "int32" + }, + { + "name": "debug_flags", + "type": "bitfield::EditorExportPlatform.DebugFlags" + } + ] + }, + { + "name": "_get_run_icon", + "is_const": true, + "is_static": false, + "is_vararg": false, + "is_virtual": true, + "return_value": { + "type": "Texture2D" + } + }, + { + "name": "_can_export", + "is_const": true, + "is_static": false, + "is_vararg": false, + "is_virtual": true, + "return_value": { + "type": "bool" + }, + "arguments": [ + { + "name": "preset", + "type": "EditorExportPreset" + }, + { + "name": "debug", + "type": "bool" + } + ] + }, + { + "name": "_has_valid_export_configuration", + "is_const": true, + "is_static": false, + "is_vararg": false, + "is_virtual": true, + "return_value": { + "type": "bool" + }, + "arguments": [ + { + "name": "preset", + "type": "EditorExportPreset" + }, + { + "name": "debug", + "type": "bool" + } + ] + }, + { + "name": "_has_valid_project_configuration", + "is_const": true, + "is_static": false, + "is_vararg": false, + "is_virtual": true, + "return_value": { + "type": "bool" + }, + "arguments": [ + { + "name": "preset", + "type": "EditorExportPreset" + } + ] + }, + { + "name": "_get_binary_extensions", + "is_const": true, + "is_static": false, + "is_vararg": false, + "is_virtual": true, + "return_value": { + "type": "PackedStringArray" + }, + "arguments": [ + { + "name": "preset", + "type": "EditorExportPreset" + } + ] + }, + { + "name": "_export_project", + "is_const": false, + "is_static": false, + "is_vararg": false, + "is_virtual": true, + "return_value": { + "type": "enum::Error" + }, + "arguments": [ + { + "name": "preset", + "type": "EditorExportPreset" + }, + { + "name": "debug", + "type": "bool" + }, + { + "name": "path", + "type": "String" + }, + { + "name": "flags", + "type": "bitfield::EditorExportPlatform.DebugFlags" + } + ] + }, + { + "name": "_export_pack", + "is_const": false, + "is_static": false, + "is_vararg": false, + "is_virtual": true, + "return_value": { + "type": "enum::Error" + }, + "arguments": [ + { + "name": "preset", + "type": "EditorExportPreset" + }, + { + "name": "debug", + "type": "bool" + }, + { + "name": "path", + "type": "String" + }, + { + "name": "flags", + "type": "bitfield::EditorExportPlatform.DebugFlags" + } + ] + }, + { + "name": "_export_zip", + "is_const": false, + "is_static": false, + "is_vararg": false, + "is_virtual": true, + "return_value": { + "type": "enum::Error" + }, + "arguments": [ + { + "name": "preset", + "type": "EditorExportPreset" + }, + { + "name": "debug", + "type": "bool" + }, + { + "name": "path", + "type": "String" + }, + { + "name": "flags", + "type": "bitfield::EditorExportPlatform.DebugFlags" + } + ] + }, + { + "name": "_get_platform_features", + "is_const": true, + "is_static": false, + "is_vararg": false, + "is_virtual": true, + "return_value": { + "type": "PackedStringArray" + } + }, + { + "name": "_get_debug_protocol", + "is_const": true, + "is_static": false, + "is_vararg": false, + "is_virtual": true, + "return_value": { + "type": "String" + } + }, + { + "name": "set_config_error", + "is_const": true, + "is_vararg": false, + "is_static": false, + "is_virtual": false, + "hash": 3089850668, + "arguments": [ + { + "name": "error_text", + "type": "String" + } + ] + }, + { + "name": "get_config_error", + "is_const": true, + "is_vararg": false, + "is_static": false, + "is_virtual": false, + "hash": 201670096, + "return_value": { + "type": "String" + } + }, + { + "name": "set_config_missing_templates", + "is_const": true, + "is_vararg": false, + "is_static": false, + "is_virtual": false, + "hash": 1695273946, + "arguments": [ + { + "name": "missing_templates", + "type": "bool" + } + ] + }, + { + "name": "get_config_missing_templates", + "is_const": true, + "is_vararg": false, + "is_static": false, + "is_virtual": false, + "hash": 36873697, + "return_value": { + "type": "bool" + } + } + ] + }, + { "name": "EditorExportPlatformIOS", "is_refcounted": true, "is_instantiable": true, @@ -84442,6 +85914,403 @@ "type": "StringName" } ] + }, + { + "name": "get_export_preset", + "is_const": true, + "is_vararg": false, + "is_static": false, + "is_virtual": false, + "hash": 1610607222, + "return_value": { + "type": "EditorExportPreset" + } + }, + { + "name": "get_export_platform", + "is_const": true, + "is_vararg": false, + "is_static": false, + "is_virtual": false, + "hash": 282254641, + "return_value": { + "type": "EditorExportPlatform" + } + } + ] + }, + { + "name": "EditorExportPreset", + "is_refcounted": true, + "is_instantiable": false, + "inherits": "RefCounted", + "api_type": "editor", + "enums": [ + { + "name": "ExportFilter", + "is_bitfield": false, + "values": [ + { + "name": "EXPORT_ALL_RESOURCES", + "value": 0 + }, + { + "name": "EXPORT_SELECTED_SCENES", + "value": 1 + }, + { + "name": "EXPORT_SELECTED_RESOURCES", + "value": 2 + }, + { + "name": "EXCLUDE_SELECTED_RESOURCES", + "value": 3 + }, + { + "name": "EXPORT_CUSTOMIZED", + "value": 4 + } + ] + }, + { + "name": "FileExportMode", + "is_bitfield": false, + "values": [ + { + "name": "MODE_FILE_NOT_CUSTOMIZED", + "value": 0 + }, + { + "name": "MODE_FILE_STRIP", + "value": 1 + }, + { + "name": "MODE_FILE_KEEP", + "value": 2 + }, + { + "name": "MODE_FILE_REMOVE", + "value": 3 + } + ] + }, + { + "name": "ScriptExportMode", + "is_bitfield": false, + "values": [ + { + "name": "MODE_SCRIPT_TEXT", + "value": 0 + }, + { + "name": "MODE_SCRIPT_BINARY_TOKENS", + "value": 1 + }, + { + "name": "MODE_SCRIPT_BINARY_TOKENS_COMPRESSED", + "value": 2 + } + ] + } + ], + "methods": [ + { + "name": "has", + "is_const": true, + "is_vararg": false, + "is_static": false, + "is_virtual": false, + "hash": 2619796661, + "return_value": { + "type": "bool" + }, + "arguments": [ + { + "name": "property", + "type": "StringName" + } + ] + }, + { + "name": "get_files_to_export", + "is_const": true, + "is_vararg": false, + "is_static": false, + "is_virtual": false, + "hash": 1139954409, + "return_value": { + "type": "PackedStringArray" + } + }, + { + "name": "get_customized_files", + "is_const": true, + "is_vararg": false, + "is_static": false, + "is_virtual": false, + "hash": 3102165223, + "return_value": { + "type": "Dictionary" + } + }, + { + "name": "get_customized_files_count", + "is_const": true, + "is_vararg": false, + "is_static": false, + "is_virtual": false, + "hash": 3905245786, + "return_value": { + "type": "int", + "meta": "int32" + } + }, + { + "name": "has_export_file", + "is_const": false, + "is_vararg": false, + "is_static": false, + "is_virtual": false, + "hash": 2323990056, + "return_value": { + "type": "bool" + }, + "arguments": [ + { + "name": "path", + "type": "String" + } + ] + }, + { + "name": "get_file_export_mode", + "is_const": true, + "is_vararg": false, + "is_static": false, + "is_virtual": false, + "hash": 407825436, + "return_value": { + "type": "enum::EditorExportPreset.FileExportMode" + }, + "arguments": [ + { + "name": "path", + "type": "String" + }, + { + "name": "default", + "type": "enum::EditorExportPreset.FileExportMode", + "default_value": "0" + } + ] + }, + { + "name": "get_preset_name", + "is_const": true, + "is_vararg": false, + "is_static": false, + "is_virtual": false, + "hash": 201670096, + "return_value": { + "type": "String" + } + }, + { + "name": "is_runnable", + "is_const": true, + "is_vararg": false, + "is_static": false, + "is_virtual": false, + "hash": 36873697, + "return_value": { + "type": "bool" + } + }, + { + "name": "are_advanced_options_enabled", + "is_const": true, + "is_vararg": false, + "is_static": false, + "is_virtual": false, + "hash": 36873697, + "return_value": { + "type": "bool" + } + }, + { + "name": "is_dedicated_server", + "is_const": true, + "is_vararg": false, + "is_static": false, + "is_virtual": false, + "hash": 36873697, + "return_value": { + "type": "bool" + } + }, + { + "name": "get_export_filter", + "is_const": true, + "is_vararg": false, + "is_static": false, + "is_virtual": false, + "hash": 4227045696, + "return_value": { + "type": "enum::EditorExportPreset.ExportFilter" + } + }, + { + "name": "get_include_filter", + "is_const": true, + "is_vararg": false, + "is_static": false, + "is_virtual": false, + "hash": 201670096, + "return_value": { + "type": "String" + } + }, + { + "name": "get_exclude_filter", + "is_const": true, + "is_vararg": false, + "is_static": false, + "is_virtual": false, + "hash": 201670096, + "return_value": { + "type": "String" + } + }, + { + "name": "get_custom_features", + "is_const": true, + "is_vararg": false, + "is_static": false, + "is_virtual": false, + "hash": 201670096, + "return_value": { + "type": "String" + } + }, + { + "name": "get_export_path", + "is_const": true, + "is_vararg": false, + "is_static": false, + "is_virtual": false, + "hash": 201670096, + "return_value": { + "type": "String" + } + }, + { + "name": "get_encryption_in_filter", + "is_const": true, + "is_vararg": false, + "is_static": false, + "is_virtual": false, + "hash": 201670096, + "return_value": { + "type": "String" + } + }, + { + "name": "get_encryption_ex_filter", + "is_const": true, + "is_vararg": false, + "is_static": false, + "is_virtual": false, + "hash": 201670096, + "return_value": { + "type": "String" + } + }, + { + "name": "get_encrypt_pck", + "is_const": true, + "is_vararg": false, + "is_static": false, + "is_virtual": false, + "hash": 36873697, + "return_value": { + "type": "bool" + } + }, + { + "name": "get_encrypt_directory", + "is_const": true, + "is_vararg": false, + "is_static": false, + "is_virtual": false, + "hash": 36873697, + "return_value": { + "type": "bool" + } + }, + { + "name": "get_encryption_key", + "is_const": true, + "is_vararg": false, + "is_static": false, + "is_virtual": false, + "hash": 201670096, + "return_value": { + "type": "String" + } + }, + { + "name": "get_script_export_mode", + "is_const": true, + "is_vararg": false, + "is_static": false, + "is_virtual": false, + "hash": 3905245786, + "return_value": { + "type": "int", + "meta": "int32" + } + }, + { + "name": "get_or_env", + "is_const": true, + "is_vararg": false, + "is_static": false, + "is_virtual": false, + "hash": 389838787, + "return_value": { + "type": "Variant" + }, + "arguments": [ + { + "name": "name", + "type": "StringName" + }, + { + "name": "env_var", + "type": "String" + } + ] + }, + { + "name": "get_version", + "is_const": true, + "is_vararg": false, + "is_static": false, + "is_virtual": false, + "hash": 1132184663, + "return_value": { + "type": "String" + }, + "arguments": [ + { + "name": "name", + "type": "StringName" + }, + { + "name": "windows_version", + "type": "bool" + } + ] } ] }, @@ -86405,6 +88274,17 @@ } }, { + "name": "get_editor_undo_redo", + "is_const": true, + "is_vararg": false, + "is_static": false, + "is_virtual": false, + "hash": 3819628421, + "return_value": { + "type": "EditorUndoRedoManager" + } + }, + { "name": "make_mesh_previews", "is_const": false, "is_vararg": false, @@ -86723,7 +88603,10 @@ "is_vararg": false, "is_static": false, "is_virtual": false, - "hash": 2271411043, + "hash": 2444591477, + "hash_compatibility": [ + 2271411043 + ], "arguments": [ { "name": "callback", @@ -86733,6 +88616,11 @@ "name": "valid_types", "type": "typedarray::StringName", "default_value": "Array[StringName]([])" + }, + { + "name": "current_value", + "type": "Node", + "default_value": "null" } ] }, @@ -86742,7 +88630,10 @@ "is_vararg": false, "is_static": false, "is_virtual": false, - "hash": 261221679, + "hash": 2955609011, + "hash_compatibility": [ + 261221679 + ], "arguments": [ { "name": "object", @@ -86756,6 +88647,11 @@ "name": "type_filter", "type": "PackedInt32Array", "default_value": "PackedInt32Array()" + }, + { + "name": "current_value", + "type": "String", + "default_value": "\"\"" } ] }, @@ -88296,6 +90192,28 @@ "value": 2 } ] + }, + { + "name": "ContextMenuSlot", + "is_bitfield": false, + "values": [ + { + "name": "CONTEXT_SLOT_SCENE_TREE", + "value": 0 + }, + { + "name": "CONTEXT_SLOT_FILESYSTEM", + "value": 1 + }, + { + "name": "CONTEXT_SLOT_SCRIPT_EDITOR", + "value": 2 + }, + { + "name": "CONTEXT_SUBMENU_SLOT_FILESYSTEM_CREATE", + "value": 3 + } + ] } ], "methods": [ @@ -89087,6 +91005,34 @@ ] }, { + "name": "add_export_platform", + "is_const": false, + "is_vararg": false, + "is_static": false, + "is_virtual": false, + "hash": 3431312373, + "arguments": [ + { + "name": "platform", + "type": "EditorExportPlatform" + } + ] + }, + { + "name": "remove_export_platform", + "is_const": false, + "is_vararg": false, + "is_static": false, + "is_virtual": false, + "hash": 3431312373, + "arguments": [ + { + "name": "platform", + "type": "EditorExportPlatform" + } + ] + }, + { "name": "add_node_3d_gizmo_plugin", "is_const": false, "is_vararg": false, @@ -89187,6 +91133,42 @@ "hash": 3218959716 }, { + "name": "add_context_menu_plugin", + "is_const": false, + "is_vararg": false, + "is_static": false, + "is_virtual": false, + "hash": 2598408232, + "arguments": [ + { + "name": "slot", + "type": "enum::EditorPlugin.ContextMenuSlot" + }, + { + "name": "plugin", + "type": "EditorContextMenuPlugin" + } + ] + }, + { + "name": "remove_context_menu_plugin", + "is_const": false, + "is_vararg": false, + "is_static": false, + "is_virtual": false, + "hash": 2598408232, + "arguments": [ + { + "name": "slot", + "type": "enum::EditorPlugin.ContextMenuSlot" + }, + { + "name": "plugin", + "type": "EditorContextMenuPlugin" + } + ] + }, + { "name": "get_editor_interface", "is_const": false, "is_vararg": false, @@ -91708,6 +93690,27 @@ "meta": "int32" } ] + }, + { + "name": "clear_history", + "is_const": false, + "is_vararg": false, + "is_static": false, + "is_virtual": false, + "hash": 2020603371, + "arguments": [ + { + "name": "id", + "type": "int", + "meta": "int32", + "default_value": "-99" + }, + { + "name": "increase_version", + "type": "bool", + "default_value": "true" + } + ] } ], "signals": [ @@ -103212,6 +105215,24 @@ "signals": [ { "name": "extensions_reloaded" + }, + { + "name": "extension_loaded", + "arguments": [ + { + "name": "extension", + "type": "GDExtension" + } + ] + }, + { + "name": "extension_unloading", + "arguments": [ + { + "name": "extension", + "type": "GDExtension" + } + ] } ] }, @@ -103236,6 +105257,13 @@ ] }, { + "name": "GDScriptSyntaxHighlighter", + "is_refcounted": true, + "is_instantiable": true, + "inherits": "EditorSyntaxHighlighter", + "api_type": "editor" + }, + { "name": "GLTFAccessor", "is_refcounted": true, "is_instantiable": true, @@ -104653,6 +106681,17 @@ "type": "GLTFDocumentExtension" } ] + }, + { + "name": "get_supported_gltf_extensions", + "is_const": false, + "is_vararg": false, + "is_static": true, + "is_virtual": false, + "hash": 2981934095, + "return_value": { + "type": "PackedStringArray" + } } ], "properties": [ @@ -120650,6 +122689,14 @@ "hash": 3218959716 }, { + "name": "linear_to_srgb", + "is_const": false, + "is_vararg": false, + "is_static": false, + "is_virtual": false, + "hash": 3218959716 + }, + { "name": "normal_map_to_xy", "is_const": false, "is_vararg": false, @@ -127623,6 +129670,60 @@ "return_value": { "type": "String" } + }, + { + "name": "to_native", + "is_const": false, + "is_vararg": false, + "is_static": true, + "is_virtual": false, + "hash": 3194344696, + "return_value": { + "type": "Variant" + }, + "arguments": [ + { + "name": "json", + "type": "Variant" + }, + { + "name": "allow_classes", + "type": "bool", + "default_value": "false" + }, + { + "name": "allow_scripts", + "type": "bool", + "default_value": "false" + } + ] + }, + { + "name": "from_native", + "is_const": false, + "is_vararg": false, + "is_static": true, + "is_virtual": false, + "hash": 3194344696, + "return_value": { + "type": "Variant" + }, + "arguments": [ + { + "name": "variant", + "type": "Variant" + }, + { + "name": "allow_classes", + "type": "bool", + "default_value": "false" + }, + { + "name": "allow_scripts", + "type": "bool", + "default_value": "false" + } + ] } ], "properties": [ @@ -127827,7 +129928,42 @@ "is_refcounted": true, "is_instantiable": true, "inherits": "RefCounted", - "api_type": "core" + "api_type": "core", + "methods": [ + { + "name": "get_java_class_name", + "is_const": true, + "is_vararg": false, + "is_static": false, + "is_virtual": false, + "hash": 201670096, + "return_value": { + "type": "String" + } + }, + { + "name": "get_java_method_list", + "is_const": true, + "is_vararg": false, + "is_static": false, + "is_virtual": false, + "hash": 3995934104, + "return_value": { + "type": "typedarray::Dictionary" + } + }, + { + "name": "get_java_parent_class", + "is_const": true, + "is_vararg": false, + "is_static": false, + "is_virtual": false, + "hash": 541536347, + "return_value": { + "type": "JavaClass" + } + } + ] }, { "name": "JavaClassWrapper", @@ -127856,6 +129992,26 @@ ] }, { + "name": "JavaObject", + "is_refcounted": true, + "is_instantiable": true, + "inherits": "RefCounted", + "api_type": "core", + "methods": [ + { + "name": "get_java_class", + "is_const": true, + "is_vararg": false, + "is_static": false, + "is_virtual": false, + "hash": 541536347, + "return_value": { + "type": "JavaClass" + } + } + ] + }, + { "name": "JavaScriptBridge", "is_refcounted": false, "is_instantiable": false, @@ -138430,6 +140586,24 @@ "default_value": "null" } ] + }, + { + "name": "bake_mesh_from_current_skeleton_pose", + "is_const": false, + "is_vararg": false, + "is_static": false, + "is_virtual": false, + "hash": 1457573577, + "return_value": { + "type": "ArrayMesh" + }, + "arguments": [ + { + "name": "existing", + "type": "ArrayMesh", + "default_value": "null" + } + ] } ], "properties": [ @@ -139652,6 +141826,20 @@ "value": 1 } ] + }, + { + "name": "PhysicsInterpolationQuality", + "is_bitfield": false, + "values": [ + { + "name": "INTERP_QUALITY_FAST", + "value": 0 + }, + { + "name": "INTERP_QUALITY_HIGH", + "value": 1 + } + ] } ], "methods": [ @@ -139810,6 +141998,31 @@ } }, { + "name": "set_physics_interpolation_quality", + "is_const": false, + "is_vararg": false, + "is_static": false, + "is_virtual": false, + "hash": 1819488408, + "arguments": [ + { + "name": "quality", + "type": "enum::MultiMesh.PhysicsInterpolationQuality" + } + ] + }, + { + "name": "get_physics_interpolation_quality", + "is_const": true, + "is_vararg": false, + "is_static": false, + "is_virtual": false, + "hash": 1465701882, + "return_value": { + "type": "enum::MultiMesh.PhysicsInterpolationQuality" + } + }, + { "name": "set_instance_transform", "is_const": false, "is_vararg": false, @@ -139958,6 +142171,21 @@ ] }, { + "name": "reset_instance_physics_interpolation", + "is_const": false, + "is_vararg": false, + "is_static": false, + "is_virtual": false, + "hash": 1286410249, + "arguments": [ + { + "name": "instance", + "type": "int", + "meta": "int32" + } + ] + }, + { "name": "set_custom_aabb", "is_const": false, "is_vararg": false, @@ -140017,6 +142245,24 @@ "type": "PackedFloat32Array" } ] + }, + { + "name": "set_buffer_interpolated", + "is_const": false, + "is_vararg": false, + "is_static": false, + "is_virtual": false, + "hash": 3514430332, + "arguments": [ + { + "name": "buffer_curr", + "type": "PackedFloat32Array" + }, + { + "name": "buffer_prev", + "type": "PackedFloat32Array" + } + ] } ], "properties": [ @@ -140091,6 +142337,12 @@ "name": "custom_data_array", "setter": "_set_custom_data_array", "getter": "_get_custom_data_array" + }, + { + "type": "int", + "name": "physics_interpolation_quality", + "setter": "set_physics_interpolation_quality", + "getter": "get_physics_interpolation_quality" } ] }, @@ -145866,6 +148118,31 @@ } }, { + "name": "set_navigation_map", + "is_const": false, + "is_vararg": false, + "is_static": false, + "is_virtual": false, + "hash": 2722037293, + "arguments": [ + { + "name": "navigation_map", + "type": "RID" + } + ] + }, + { + "name": "get_navigation_map", + "is_const": true, + "is_vararg": false, + "is_static": false, + "is_virtual": false, + "hash": 2944877500, + "return_value": { + "type": "RID" + } + }, + { "name": "set_bidirectional", "is_const": false, "is_vararg": false, @@ -146198,6 +148475,31 @@ } }, { + "name": "set_navigation_map", + "is_const": false, + "is_vararg": false, + "is_static": false, + "is_virtual": false, + "hash": 2722037293, + "arguments": [ + { + "name": "navigation_map", + "type": "RID" + } + ] + }, + { + "name": "get_navigation_map", + "is_const": true, + "is_vararg": false, + "is_static": false, + "is_virtual": false, + "hash": 2944877500, + "return_value": { + "type": "RID" + } + }, + { "name": "set_bidirectional", "is_const": false, "is_vararg": false, @@ -147780,6 +150082,17 @@ "return_value": { "type": "Array" } + }, + { + "name": "get_bounds", + "is_const": false, + "is_vararg": false, + "is_static": false, + "is_virtual": false, + "hash": 3248174, + "return_value": { + "type": "Rect2" + } } ], "properties": [ @@ -148025,6 +150338,17 @@ "return_value": { "type": "Array" } + }, + { + "name": "get_bounds", + "is_const": false, + "is_vararg": false, + "is_static": false, + "is_virtual": false, + "hash": 1021181044, + "return_value": { + "type": "AABB" + } } ], "properties": [ @@ -149740,6 +152064,24 @@ "api_type": "core", "enums": [ { + "name": "SamplePartitionType", + "is_bitfield": false, + "values": [ + { + "name": "SAMPLE_PARTITION_CONVEX_PARTITION", + "value": 0 + }, + { + "name": "SAMPLE_PARTITION_TRIANGULATE", + "value": 1 + }, + { + "name": "SAMPLE_PARTITION_MAX", + "value": 2 + } + ] + }, + { "name": "ParsedGeometryType", "is_bitfield": false, "values": [ @@ -150041,6 +152383,31 @@ } }, { + "name": "set_sample_partition_type", + "is_const": false, + "is_vararg": false, + "is_static": false, + "is_virtual": false, + "hash": 2441478482, + "arguments": [ + { + "name": "sample_partition_type", + "type": "enum::NavigationPolygon.SamplePartitionType" + } + ] + }, + { + "name": "get_sample_partition_type", + "is_const": true, + "is_vararg": false, + "is_static": false, + "is_virtual": false, + "hash": 3887422851, + "return_value": { + "type": "enum::NavigationPolygon.SamplePartitionType" + } + }, + { "name": "set_parsed_geometry_type", "is_const": false, "is_vararg": false, @@ -150286,6 +152653,12 @@ }, { "type": "int", + "name": "sample_partition_type", + "setter": "set_sample_partition_type", + "getter": "get_sample_partition_type" + }, + { + "type": "int", "name": "parsed_geometry_type", "setter": "set_parsed_geometry_type", "getter": "get_parsed_geometry_type" @@ -151817,6 +154190,27 @@ ] }, { + "name": "region_get_closest_point", + "is_const": true, + "is_vararg": false, + "is_static": false, + "is_virtual": false, + "hash": 1358334418, + "return_value": { + "type": "Vector2" + }, + "arguments": [ + { + "name": "region", + "type": "RID" + }, + { + "name": "to_point", + "type": "Vector2" + } + ] + }, + { "name": "region_get_random_point", "is_const": true, "is_vararg": false, @@ -153302,6 +155696,10 @@ { "name": "INFO_EDGE_FREE_COUNT", "value": 8 + }, + { + "name": "INFO_OBSTACLE_COUNT", + "value": 9 } ] } @@ -154313,6 +156711,78 @@ ] }, { + "name": "region_get_closest_point_to_segment", + "is_const": true, + "is_vararg": false, + "is_static": false, + "is_virtual": false, + "hash": 3830095642, + "return_value": { + "type": "Vector3" + }, + "arguments": [ + { + "name": "region", + "type": "RID" + }, + { + "name": "start", + "type": "Vector3" + }, + { + "name": "end", + "type": "Vector3" + }, + { + "name": "use_collision", + "type": "bool", + "default_value": "false" + } + ] + }, + { + "name": "region_get_closest_point", + "is_const": true, + "is_vararg": false, + "is_static": false, + "is_virtual": false, + "hash": 2056183332, + "return_value": { + "type": "Vector3" + }, + "arguments": [ + { + "name": "region", + "type": "RID" + }, + { + "name": "to_point", + "type": "Vector3" + } + ] + }, + { + "name": "region_get_closest_point_normal", + "is_const": true, + "is_vararg": false, + "is_static": false, + "is_virtual": false, + "hash": 2056183332, + "return_value": { + "type": "Vector3" + }, + "arguments": [ + { + "name": "region", + "type": "RID" + }, + { + "name": "to_point", + "type": "Vector3" + } + ] + }, + { "name": "region_get_random_point", "is_const": true, "is_vararg": false, @@ -159295,6 +161765,17 @@ } }, { + "name": "get_global_transform_interpolated", + "is_const": false, + "is_vararg": false, + "is_static": false, + "is_virtual": false, + "hash": 4183770049, + "return_value": { + "type": "Transform3D" + } + }, + { "name": "set_global_position", "is_const": false, "is_vararg": false, @@ -161036,6 +163517,10 @@ { "name": "RENDERING_DRIVER_D3D12", "value": 2 + }, + { + "name": "RENDERING_DRIVER_METAL", + "value": 3 } ] }, @@ -161438,7 +163923,10 @@ "is_vararg": false, "is_static": false, "is_virtual": false, - "hash": 3845631403, + "hash": 2851312030, + "hash_compatibility": [ + 3845631403 + ], "return_value": { "type": "Dictionary" }, @@ -161450,6 +163938,11 @@ { "name": "arguments", "type": "PackedStringArray" + }, + { + "name": "blocking", + "type": "bool", + "default_value": "true" } ] }, @@ -163695,6 +166188,66 @@ ] }, { + "name": "set_object_name", + "is_const": false, + "is_vararg": false, + "is_static": false, + "is_virtual": false, + "hash": 2285447957, + "arguments": [ + { + "name": "object_type", + "type": "int", + "meta": "int64" + }, + { + "name": "object_handle", + "type": "int", + "meta": "uint64" + }, + { + "name": "object_name", + "type": "String" + } + ] + }, + { + "name": "begin_debug_label_region", + "is_const": false, + "is_vararg": false, + "is_static": false, + "is_virtual": false, + "hash": 83702148, + "arguments": [ + { + "name": "label_name", + "type": "String" + } + ] + }, + { + "name": "end_debug_label_region", + "is_const": false, + "is_vararg": false, + "is_static": false, + "is_virtual": false, + "hash": 3218959716 + }, + { + "name": "insert_debug_label", + "is_const": false, + "is_vararg": false, + "is_static": false, + "is_virtual": false, + "hash": 83702148, + "arguments": [ + { + "name": "label_name", + "type": "String" + } + ] + }, + { "name": "is_initialized", "is_const": false, "is_vararg": false, @@ -166570,6 +169123,13 @@ ] }, { + "name": "OpenXRVisibilityMask", + "is_refcounted": false, + "is_instantiable": true, + "inherits": "VisualInstance3D", + "api_type": "core" + }, + { "name": "OptimizedTranslation", "is_refcounted": true, "is_instantiable": true, @@ -169742,6 +172302,33 @@ } }, { + "name": "set_emission_ring_cone_angle", + "is_const": false, + "is_vararg": false, + "is_static": false, + "is_virtual": false, + "hash": 373806689, + "arguments": [ + { + "name": "cone_angle", + "type": "float", + "meta": "float" + } + ] + }, + { + "name": "get_emission_ring_cone_angle", + "is_const": true, + "is_vararg": false, + "is_static": false, + "is_virtual": false, + "hash": 1740695150, + "return_value": { + "type": "float", + "meta": "float" + } + }, + { "name": "set_emission_shape_offset", "is_const": false, "is_vararg": false, @@ -170349,6 +172936,12 @@ "getter": "get_emission_ring_inner_radius" }, { + "type": "float", + "name": "emission_ring_cone_angle", + "setter": "set_emission_ring_cone_angle", + "getter": "get_emission_ring_cone_angle" + }, + { "type": "Vector2", "name": "angle", "setter": "set_param", @@ -171790,8 +174383,12 @@ "value": 32 }, { - "name": "MONITOR_MAX", + "name": "NAVIGATION_OBSTACLE_COUNT", "value": 33 + }, + { + "name": "MONITOR_MAX", + "value": 34 } ] } @@ -203402,7 +205999,10 @@ "is_vararg": false, "is_static": true, "is_virtual": false, - "hash": 2150300909, + "hash": 4249111514, + "hash_compatibility": [ + 2150300909 + ], "return_value": { "type": "RegEx" }, @@ -203410,6 +206010,11 @@ { "name": "pattern", "type": "String" + }, + { + "name": "show_error", + "type": "bool", + "default_value": "true" } ] }, @@ -203427,7 +206032,10 @@ "is_vararg": false, "is_static": false, "is_virtual": false, - "hash": 166001499, + "hash": 3565188097, + "hash_compatibility": [ + 166001499 + ], "return_value": { "type": "enum::Error" }, @@ -203435,6 +206043,11 @@ { "name": "pattern", "type": "String" + }, + { + "name": "show_error", + "type": "bool", + "default_value": "true" } ] }, @@ -207445,6 +210058,64 @@ "value": 2 } ] + }, + { + "name": "BreadcrumbMarker", + "is_bitfield": false, + "values": [ + { + "name": "NONE", + "value": 0 + }, + { + "name": "REFLECTION_PROBES", + "value": 65536 + }, + { + "name": "SKY_PASS", + "value": 131072 + }, + { + "name": "LIGHTMAPPER_PASS", + "value": 196608 + }, + { + "name": "SHADOW_PASS_DIRECTIONAL", + "value": 262144 + }, + { + "name": "SHADOW_PASS_CUBE", + "value": 327680 + }, + { + "name": "OPAQUE_PASS", + "value": 393216 + }, + { + "name": "ALPHA_PASS", + "value": 458752 + }, + { + "name": "TRANSPARENT_PASS", + "value": 524288 + }, + { + "name": "POST_PROCESSING_PASS", + "value": 589824 + }, + { + "name": "BLIT_PASS", + "value": 655360 + }, + { + "name": "UI_PASS", + "value": 720896 + }, + { + "name": "DEBUG_PASS", + "value": 786432 + } + ] } ], "methods": [ @@ -208901,9 +211572,10 @@ "is_vararg": false, "is_static": false, "is_virtual": false, - "hash": 2686605154, + "hash": 3140542288, "hash_compatibility": [ 2468082605, + 2686605154, 4252992020 ], "return_value": { @@ -208952,6 +211624,12 @@ "name": "region", "type": "Rect2", "default_value": "Rect2(0, 0, 0, 0)" + }, + { + "name": "breadcrumb", + "type": "int", + "meta": "uint32", + "default_value": "0" } ] }, @@ -209758,6 +212436,182 @@ "meta": "uint64" } ] + }, + { + "name": "get_perf_report", + "is_const": true, + "is_vararg": false, + "is_static": false, + "is_virtual": false, + "hash": 201670096, + "return_value": { + "type": "String" + } + }, + { + "name": "get_driver_and_device_memory_report", + "is_const": true, + "is_vararg": false, + "is_static": false, + "is_virtual": false, + "hash": 201670096, + "return_value": { + "type": "String" + } + }, + { + "name": "get_tracked_object_name", + "is_const": true, + "is_vararg": false, + "is_static": false, + "is_virtual": false, + "hash": 844755477, + "return_value": { + "type": "String" + }, + "arguments": [ + { + "name": "type_index", + "type": "int", + "meta": "uint32" + } + ] + }, + { + "name": "get_tracked_object_type_count", + "is_const": true, + "is_vararg": false, + "is_static": false, + "is_virtual": false, + "hash": 3905245786, + "return_value": { + "type": "int", + "meta": "uint64" + } + }, + { + "name": "get_driver_total_memory", + "is_const": true, + "is_vararg": false, + "is_static": false, + "is_virtual": false, + "hash": 3905245786, + "return_value": { + "type": "int", + "meta": "uint64" + } + }, + { + "name": "get_driver_allocation_count", + "is_const": true, + "is_vararg": false, + "is_static": false, + "is_virtual": false, + "hash": 3905245786, + "return_value": { + "type": "int", + "meta": "uint64" + } + }, + { + "name": "get_driver_memory_by_object_type", + "is_const": true, + "is_vararg": false, + "is_static": false, + "is_virtual": false, + "hash": 923996154, + "return_value": { + "type": "int", + "meta": "uint64" + }, + "arguments": [ + { + "name": "type", + "type": "int", + "meta": "uint32" + } + ] + }, + { + "name": "get_driver_allocs_by_object_type", + "is_const": true, + "is_vararg": false, + "is_static": false, + "is_virtual": false, + "hash": 923996154, + "return_value": { + "type": "int", + "meta": "uint64" + }, + "arguments": [ + { + "name": "type", + "type": "int", + "meta": "uint32" + } + ] + }, + { + "name": "get_device_total_memory", + "is_const": true, + "is_vararg": false, + "is_static": false, + "is_virtual": false, + "hash": 3905245786, + "return_value": { + "type": "int", + "meta": "uint64" + } + }, + { + "name": "get_device_allocation_count", + "is_const": true, + "is_vararg": false, + "is_static": false, + "is_virtual": false, + "hash": 3905245786, + "return_value": { + "type": "int", + "meta": "uint64" + } + }, + { + "name": "get_device_memory_by_object_type", + "is_const": true, + "is_vararg": false, + "is_static": false, + "is_virtual": false, + "hash": 923996154, + "return_value": { + "type": "int", + "meta": "uint64" + }, + "arguments": [ + { + "name": "type", + "type": "int", + "meta": "uint32" + } + ] + }, + { + "name": "get_device_allocs_by_object_type", + "is_const": true, + "is_vararg": false, + "is_static": false, + "is_virtual": false, + "hash": 923996154, + "return_value": { + "type": "int", + "meta": "uint64" + }, + "arguments": [ + { + "name": "type", + "type": "int", + "meta": "uint32" + } + ] } ] }, @@ -210213,6 +213067,20 @@ ] }, { + "name": "MultimeshPhysicsInterpolationQuality", + "is_bitfield": false, + "values": [ + { + "name": "MULTIMESH_INTERP_QUALITY_FAST", + "value": 0 + }, + { + "name": "MULTIMESH_INTERP_QUALITY_HIGH", + "value": 1 + } + ] + }, + { "name": "LightProjectorFilter", "is_bitfield": false, "values": [ @@ -213753,6 +216621,83 @@ ] }, { + "name": "multimesh_set_buffer_interpolated", + "is_const": false, + "is_vararg": false, + "is_static": false, + "is_virtual": false, + "hash": 659844711, + "arguments": [ + { + "name": "multimesh", + "type": "RID" + }, + { + "name": "buffer", + "type": "PackedFloat32Array" + }, + { + "name": "buffer_previous", + "type": "PackedFloat32Array" + } + ] + }, + { + "name": "multimesh_set_physics_interpolated", + "is_const": false, + "is_vararg": false, + "is_static": false, + "is_virtual": false, + "hash": 1265174801, + "arguments": [ + { + "name": "multimesh", + "type": "RID" + }, + { + "name": "interpolated", + "type": "bool" + } + ] + }, + { + "name": "multimesh_set_physics_interpolation_quality", + "is_const": false, + "is_vararg": false, + "is_static": false, + "is_virtual": false, + "hash": 3934808223, + "arguments": [ + { + "name": "multimesh", + "type": "RID" + }, + { + "name": "quality", + "type": "enum::RenderingServer.MultimeshPhysicsInterpolationQuality" + } + ] + }, + { + "name": "multimesh_instance_reset_physics_interpolation", + "is_const": false, + "is_vararg": false, + "is_static": false, + "is_virtual": false, + "hash": 3411492887, + "arguments": [ + { + "name": "multimesh", + "type": "RID" + }, + { + "name": "index", + "type": "int", + "meta": "int32" + } + ] + }, + { "name": "skeleton_create", "is_const": false, "is_vararg": false, @@ -214235,6 +217180,20 @@ ] }, { + "name": "lightmaps_set_bicubic_filter", + "is_const": false, + "is_vararg": false, + "is_static": false, + "is_virtual": false, + "hash": 2586408642, + "arguments": [ + { + "name": "enable", + "type": "bool" + } + ] + }, + { "name": "positional_soft_shadow_filter_set_quality", "is_const": false, "is_vararg": false, @@ -218923,6 +221882,38 @@ ] }, { + "name": "instance_set_interpolated", + "is_const": false, + "is_vararg": false, + "is_static": false, + "is_virtual": false, + "hash": 1265174801, + "arguments": [ + { + "name": "instance", + "type": "RID" + }, + { + "name": "interpolated", + "type": "bool" + } + ] + }, + { + "name": "instance_reset_physics_interpolation", + "is_const": false, + "is_vararg": false, + "is_static": false, + "is_virtual": false, + "hash": 2722037293, + "arguments": [ + { + "name": "instance", + "type": "RID" + } + ] + }, + { "name": "instance_attach_object_instance_id", "is_const": false, "is_vararg": false, @@ -220703,6 +223694,24 @@ ] }, { + "name": "canvas_item_attach_skeleton", + "is_const": false, + "is_vararg": false, + "is_static": false, + "is_virtual": false, + "hash": 395945892, + "arguments": [ + { + "name": "item", + "type": "RID" + }, + { + "name": "skeleton", + "type": "RID" + } + ] + }, + { "name": "canvas_item_clear", "is_const": false, "is_vararg": false, @@ -222046,6 +225055,16 @@ "is_virtual": true }, { + "name": "_get_rid", + "is_const": true, + "is_static": false, + "is_vararg": false, + "is_virtual": true, + "return_value": { + "type": "RID" + } + }, + { "name": "set_path", "is_const": false, "is_vararg": false, @@ -223029,6 +226048,23 @@ ] }, { + "name": "get_cached_ref", + "is_const": false, + "is_vararg": false, + "is_static": false, + "is_virtual": false, + "hash": 1748875256, + "return_value": { + "type": "Resource" + }, + "arguments": [ + { + "name": "path", + "type": "String" + } + ] + }, + { "name": "exists", "is_const": false, "is_vararg": false, @@ -224677,6 +227713,81 @@ } }, { + "name": "set_horizontal_alignment", + "is_const": false, + "is_vararg": false, + "is_static": false, + "is_virtual": false, + "hash": 2312603777, + "arguments": [ + { + "name": "alignment", + "type": "enum::HorizontalAlignment" + } + ] + }, + { + "name": "get_horizontal_alignment", + "is_const": true, + "is_vararg": false, + "is_static": false, + "is_virtual": false, + "hash": 341400642, + "return_value": { + "type": "enum::HorizontalAlignment" + } + }, + { + "name": "set_justification_flags", + "is_const": false, + "is_vararg": false, + "is_static": false, + "is_virtual": false, + "hash": 2877345813, + "arguments": [ + { + "name": "justification_flags", + "type": "bitfield::TextServer.JustificationFlag" + } + ] + }, + { + "name": "get_justification_flags", + "is_const": true, + "is_vararg": false, + "is_static": false, + "is_virtual": false, + "hash": 1583363614, + "return_value": { + "type": "bitfield::TextServer.JustificationFlag" + } + }, + { + "name": "set_tab_stops", + "is_const": false, + "is_vararg": false, + "is_static": false, + "is_virtual": false, + "hash": 2899603908, + "arguments": [ + { + "name": "tab_stops", + "type": "PackedFloat32Array" + } + ] + }, + { + "name": "get_tab_stops", + "is_const": true, + "is_vararg": false, + "is_static": false, + "is_virtual": false, + "hash": 675695659, + "return_value": { + "type": "PackedFloat32Array" + } + }, + { "name": "set_autowrap_mode", "is_const": false, "is_vararg": false, @@ -225129,6 +228240,17 @@ } }, { + "name": "is_finished", + "is_const": true, + "is_vararg": false, + "is_static": false, + "is_virtual": false, + "hash": 36873697, + "return_value": { + "type": "bool" + } + }, + { "name": "set_threaded", "is_const": false, "is_vararg": false, @@ -225626,6 +228748,24 @@ "getter": "is_shortcut_keys_enabled" }, { + "type": "int", + "name": "horizontal_alignment", + "setter": "set_horizontal_alignment", + "getter": "get_horizontal_alignment" + }, + { + "type": "int", + "name": "justification_flags", + "setter": "set_justification_flags", + "getter": "get_justification_flags" + }, + { + "type": "PackedFloat32Array", + "name": "tab_stops", + "setter": "set_tab_stops", + "getter": "get_tab_stops" + }, + { "type": "typedarray::24/17:RichTextEffect", "name": "custom_effects", "setter": "set_effects", @@ -230267,6 +233407,17 @@ } }, { + "name": "get_breakpoints", + "is_const": false, + "is_vararg": false, + "is_static": false, + "is_virtual": false, + "hash": 2981934095, + "return_value": { + "type": "PackedStringArray" + } + }, + { "name": "register_syntax_highlighter", "is_const": false, "is_vararg": false, @@ -231817,6 +234968,23 @@ "is_virtual": true }, { + "name": "_reload_scripts", + "is_const": false, + "is_static": false, + "is_vararg": false, + "is_virtual": true, + "arguments": [ + { + "name": "scripts", + "type": "Array" + }, + { + "name": "soft_reload", + "type": "bool" + } + ] + }, + { "name": "_reload_tool_script", "is_const": false, "is_static": false, @@ -232476,7 +235644,18 @@ "is_vararg": false, "is_static": false, "is_virtual": false, - "hash": 3218959716 + "hash": 1667783136, + "hash_compatibility": [ + 3218959716 + ], + "arguments": [ + { + "name": "count", + "type": "int", + "meta": "int32", + "default_value": "1" + } + ] } ] }, @@ -232714,8 +235893,9 @@ "is_vararg": false, "is_static": false, "is_virtual": false, - "hash": 2750740428, + "hash": 3850209648, "hash_compatibility": [ + 2750740428, 1628453603 ], "arguments": [ @@ -232725,7 +235905,7 @@ }, { "name": "texture", - "type": "Texture2D" + "type": "Texture" }, { "name": "index", @@ -232741,12 +235921,13 @@ "is_vararg": false, "is_static": false, "is_virtual": false, - "hash": 3090538643, + "hash": 4213877425, "hash_compatibility": [ + 3090538643, 3823812009 ], "return_value": { - "type": "Texture2D" + "type": "Texture" }, "arguments": [ { @@ -233676,6 +236857,17 @@ "return_value": { "type": "bool" } + }, + { + "name": "get_collision_result", + "is_const": true, + "is_vararg": false, + "is_static": false, + "is_virtual": false, + "hash": 3995934104, + "return_value": { + "type": "Array" + } } ], "properties": [ @@ -233724,7 +236916,7 @@ { "type": "Array", "name": "collision_result", - "getter": "_get_collision_result" + "getter": "get_collision_result" }, { "type": "bool", @@ -234240,6 +237432,17 @@ } }, { + "name": "get_collision_result", + "is_const": true, + "is_vararg": false, + "is_static": false, + "is_virtual": false, + "hash": 3995934104, + "return_value": { + "type": "Array" + } + }, + { "name": "set_debug_shape_custom_color", "is_const": false, "is_vararg": false, @@ -234311,7 +237514,7 @@ { "type": "Array", "name": "collision_result", - "getter": "_get_collision_result" + "getter": "get_collision_result" }, { "type": "bool", @@ -242232,6 +245435,24 @@ ] }, { + "name": "duplicate_animation", + "is_const": false, + "is_vararg": false, + "is_static": false, + "is_virtual": false, + "hash": 3740211285, + "arguments": [ + { + "name": "anim_from", + "type": "StringName" + }, + { + "name": "anim_to", + "type": "StringName" + } + ] + }, + { "name": "remove_animation", "is_const": false, "is_vararg": false, @@ -251914,6 +255135,31 @@ } }, { + "name": "set_fit_content_width_enabled", + "is_const": false, + "is_vararg": false, + "is_static": false, + "is_virtual": false, + "hash": 2586408642, + "arguments": [ + { + "name": "enabled", + "type": "bool" + } + ] + }, + { + "name": "is_fit_content_width_enabled", + "is_const": true, + "is_vararg": false, + "is_static": false, + "is_virtual": false, + "hash": 36873697, + "return_value": { + "type": "bool" + } + }, + { "name": "get_scroll_pos_for_line", "is_const": true, "is_vararg": false, @@ -253217,6 +256463,12 @@ }, { "type": "bool", + "name": "scroll_fit_content_width", + "setter": "set_fit_content_width_enabled", + "getter": "is_fit_content_width_enabled" + }, + { + "type": "bool", "name": "minimap_draw", "setter": "set_draw_minimap", "getter": "is_drawing_minimap" @@ -258398,6 +261650,23 @@ ] }, { + "name": "font_get_supported_glyphs", + "is_const": true, + "is_vararg": false, + "is_static": false, + "is_virtual": false, + "hash": 788230395, + "return_value": { + "type": "PackedInt32Array" + }, + "arguments": [ + { + "name": "font_rid", + "type": "RID" + } + ] + }, + { "name": "font_render_range", "is_const": false, "is_vararg": false, @@ -262861,6 +266130,22 @@ ] }, { + "name": "_font_get_supported_glyphs", + "is_const": true, + "is_static": false, + "is_vararg": false, + "is_virtual": true, + "return_value": { + "type": "PackedInt32Array" + }, + "arguments": [ + { + "name": "font_rid", + "type": "RID" + } + ] + }, + { "name": "_font_render_range", "is_const": false, "is_static": false, @@ -268876,6 +272161,142 @@ } }, { + "name": "set_occluder_polygons_count", + "is_const": false, + "is_vararg": false, + "is_static": false, + "is_virtual": false, + "hash": 3937882851, + "arguments": [ + { + "name": "layer_id", + "type": "int", + "meta": "int32" + }, + { + "name": "polygons_count", + "type": "int", + "meta": "int32" + } + ] + }, + { + "name": "get_occluder_polygons_count", + "is_const": true, + "is_vararg": false, + "is_static": false, + "is_virtual": false, + "hash": 923996154, + "return_value": { + "type": "int", + "meta": "int32" + }, + "arguments": [ + { + "name": "layer_id", + "type": "int", + "meta": "int32" + } + ] + }, + { + "name": "add_occluder_polygon", + "is_const": false, + "is_vararg": false, + "is_static": false, + "is_virtual": false, + "hash": 1286410249, + "arguments": [ + { + "name": "layer_id", + "type": "int", + "meta": "int32" + } + ] + }, + { + "name": "remove_occluder_polygon", + "is_const": false, + "is_vararg": false, + "is_static": false, + "is_virtual": false, + "hash": 3937882851, + "arguments": [ + { + "name": "layer_id", + "type": "int", + "meta": "int32" + }, + { + "name": "polygon_index", + "type": "int", + "meta": "int32" + } + ] + }, + { + "name": "set_occluder_polygon", + "is_const": false, + "is_vararg": false, + "is_static": false, + "is_virtual": false, + "hash": 164249167, + "arguments": [ + { + "name": "layer_id", + "type": "int", + "meta": "int32" + }, + { + "name": "polygon_index", + "type": "int", + "meta": "int32" + }, + { + "name": "polygon", + "type": "OccluderPolygon2D" + } + ] + }, + { + "name": "get_occluder_polygon", + "is_const": true, + "is_vararg": false, + "is_static": false, + "is_virtual": false, + "hash": 971166743, + "return_value": { + "type": "OccluderPolygon2D" + }, + "arguments": [ + { + "name": "layer_id", + "type": "int", + "meta": "int32" + }, + { + "name": "polygon_index", + "type": "int", + "meta": "int32" + }, + { + "name": "flip_h", + "type": "bool", + "default_value": "false" + }, + { + "name": "flip_v", + "type": "bool", + "default_value": "false" + }, + { + "name": "transpose", + "type": "bool", + "default_value": "false" + } + ] + }, + { "name": "set_occluder", "is_const": false, "is_vararg": false, @@ -270347,6 +273768,87 @@ ] }, { + "name": "is_cell_flipped_h", + "is_const": true, + "is_vararg": false, + "is_static": false, + "is_virtual": false, + "hash": 2908343862, + "return_value": { + "type": "bool" + }, + "arguments": [ + { + "name": "layer", + "type": "int", + "meta": "int32" + }, + { + "name": "coords", + "type": "Vector2i" + }, + { + "name": "use_proxies", + "type": "bool", + "default_value": "false" + } + ] + }, + { + "name": "is_cell_flipped_v", + "is_const": true, + "is_vararg": false, + "is_static": false, + "is_virtual": false, + "hash": 2908343862, + "return_value": { + "type": "bool" + }, + "arguments": [ + { + "name": "layer", + "type": "int", + "meta": "int32" + }, + { + "name": "coords", + "type": "Vector2i" + }, + { + "name": "use_proxies", + "type": "bool", + "default_value": "false" + } + ] + }, + { + "name": "is_cell_transposed", + "is_const": true, + "is_vararg": false, + "is_static": false, + "is_virtual": false, + "hash": 2908343862, + "return_value": { + "type": "bool" + }, + "arguments": [ + { + "name": "layer", + "type": "int", + "meta": "int32" + }, + { + "name": "coords", + "type": "Vector2i" + }, + { + "name": "use_proxies", + "type": "bool", + "default_value": "false" + } + ] + }, + { "name": "get_coords_for_body_rid", "is_const": false, "is_vararg": false, @@ -270953,6 +274455,57 @@ ] }, { + "name": "is_cell_flipped_h", + "is_const": true, + "is_vararg": false, + "is_static": false, + "is_virtual": false, + "hash": 3900751641, + "return_value": { + "type": "bool" + }, + "arguments": [ + { + "name": "coords", + "type": "Vector2i" + } + ] + }, + { + "name": "is_cell_flipped_v", + "is_const": true, + "is_vararg": false, + "is_static": false, + "is_virtual": false, + "hash": 3900751641, + "return_value": { + "type": "bool" + }, + "arguments": [ + { + "name": "coords", + "type": "Vector2i" + } + ] + }, + { + "name": "is_cell_transposed", + "is_const": true, + "is_vararg": false, + "is_static": false, + "is_virtual": false, + "hash": 3900751641, + "return_value": { + "type": "bool" + }, + "arguments": [ + { + "name": "coords", + "type": "Vector2i" + } + ] + }, + { "name": "get_used_cells", "is_const": true, "is_vararg": false, @@ -271474,6 +275027,31 @@ } }, { + "name": "set_occlusion_enabled", + "is_const": false, + "is_vararg": false, + "is_static": false, + "is_virtual": false, + "hash": 2586408642, + "arguments": [ + { + "name": "enabled", + "type": "bool" + } + ] + }, + { + "name": "is_occlusion_enabled", + "is_const": true, + "is_vararg": false, + "is_static": false, + "is_virtual": false, + "hash": 36873697, + "return_value": { + "type": "bool" + } + }, + { "name": "set_navigation_enabled", "is_const": false, "is_vararg": false, @@ -271574,6 +275152,12 @@ "getter": "get_tile_set" }, { + "type": "bool", + "name": "occlusion_enabled", + "setter": "set_occlusion_enabled", + "getter": "is_occlusion_enabled" + }, + { "type": "int", "name": "y_sort_origin", "setter": "set_y_sort_origin", @@ -282330,6 +285914,28 @@ } }, { + "name": "get_contact_point", + "is_const": true, + "is_vararg": false, + "is_static": false, + "is_virtual": false, + "hash": 3360562783, + "return_value": { + "type": "Vector3" + } + }, + { + "name": "get_contact_normal", + "is_const": true, + "is_vararg": false, + "is_static": false, + "is_virtual": false, + "hash": 3360562783, + "return_value": { + "type": "Vector3" + } + }, + { "name": "set_roll_influence", "is_const": false, "is_vararg": false, @@ -284181,6 +287787,14 @@ "hash": 3218959716 }, { + "name": "gui_cancel_drag", + "is_const": false, + "is_vararg": false, + "is_static": false, + "is_virtual": false, + "hash": 3218959716 + }, + { "name": "gui_get_drag_data", "is_const": true, "is_vararg": false, @@ -287690,11 +291304,14 @@ "is_vararg": false, "is_static": false, "is_virtual": false, - "hash": 2219800736, + "hash": 1278366092, + "hash_compatibility": [ + 2219800736 + ], "arguments": [ { "name": "value", - "type": "Cubemap" + "type": "TextureLayered" } ] }, @@ -287704,9 +291321,12 @@ "is_vararg": false, "is_static": false, "is_virtual": false, - "hash": 1772111058, + "hash": 3984243839, + "hash_compatibility": [ + 1772111058 + ], "return_value": { - "type": "Cubemap" + "type": "TextureLayered" } }, { @@ -287743,7 +291363,7 @@ "getter": "get_source" }, { - "type": "Cubemap", + "type": "Cubemap,CompressedCubemap,PlaceholderCubemap,TextureCubemapRD", "name": "cube_map", "setter": "set_cube_map", "getter": "get_cube_map" @@ -289852,8 +293472,12 @@ "value": 2 }, { - "name": "HINT_MAX", + "name": "HINT_ENUM", "value": 3 + }, + { + "name": "HINT_MAX", + "value": 4 } ] } @@ -289966,6 +293590,31 @@ } }, { + "name": "set_enum_names", + "is_const": false, + "is_vararg": false, + "is_static": false, + "is_virtual": false, + "hash": 4015028928, + "arguments": [ + { + "name": "names", + "type": "PackedStringArray" + } + ] + }, + { + "name": "get_enum_names", + "is_const": true, + "is_vararg": false, + "is_static": false, + "is_virtual": false, + "hash": 1139954409, + "return_value": { + "type": "PackedStringArray" + } + }, + { "name": "set_default_value_enabled", "is_const": false, "is_vararg": false, @@ -290044,6 +293693,12 @@ "getter": "get_step" }, { + "type": "PackedStringArray", + "name": "enum_names", + "setter": "set_enum_names", + "getter": "get_enum_names" + }, + { "type": "bool", "name": "default_value_enabled", "setter": "set_default_value_enabled", @@ -291489,11 +295144,14 @@ "is_vararg": false, "is_static": false, "is_virtual": false, - "hash": 2206200446, + "hash": 1278366092, + "hash_compatibility": [ + 2206200446 + ], "arguments": [ { "name": "value", - "type": "Texture2DArray" + "type": "TextureLayered" } ] }, @@ -291503,15 +295161,18 @@ "is_vararg": false, "is_static": false, "is_virtual": false, - "hash": 146117123, + "hash": 3984243839, + "hash_compatibility": [ + 146117123 + ], "return_value": { - "type": "Texture2DArray" + "type": "TextureLayered" } } ], "properties": [ { - "type": "Texture2DArray", + "type": "Texture2DArray,CompressedTexture2DArray,PlaceholderTexture2DArray,Texture2DArrayRD", "name": "texture_array", "setter": "set_texture_array", "getter": "get_texture_array" @@ -301123,8 +304784,12 @@ "value": 2 }, { - "name": "HAND_TRACKING_SOURCE_MAX", + "name": "HAND_TRACKING_SOURCE_NOT_TRACKED", "value": 3 + }, + { + "name": "HAND_TRACKING_SOURCE_MAX", + "value": 4 } ] }, diff --git a/gdextension/gdextension_interface.h b/gdextension/gdextension_interface.h index fce377f..9f5ef72 100644 --- a/gdextension/gdextension_interface.h +++ b/gdextension/gdextension_interface.h @@ -268,6 +268,7 @@ typedef void (*GDExtensionClassReference)(GDExtensionClassInstancePtr p_instance typedef void (*GDExtensionClassUnreference)(GDExtensionClassInstancePtr p_instance); typedef void (*GDExtensionClassCallVirtual)(GDExtensionClassInstancePtr p_instance, const GDExtensionConstTypePtr *p_args, GDExtensionTypePtr r_ret); typedef GDExtensionObjectPtr (*GDExtensionClassCreateInstance)(void *p_class_userdata); +typedef GDExtensionObjectPtr (*GDExtensionClassCreateInstance2)(void *p_class_userdata, GDExtensionBool p_notify_postinitialize); typedef void (*GDExtensionClassFreeInstance)(void *p_class_userdata, GDExtensionClassInstancePtr p_instance); typedef GDExtensionClassInstancePtr (*GDExtensionClassRecreateInstance)(void *p_class_userdata, GDExtensionObjectPtr p_object); typedef GDExtensionClassCallVirtual (*GDExtensionClassGetVirtual)(void *p_class_userdata, GDExtensionConstStringNamePtr p_name); @@ -292,7 +293,7 @@ typedef struct { GDExtensionClassGetVirtual get_virtual_func; // Queries a virtual function by name and returns a callback to invoke the requested virtual function. GDExtensionClassGetRID get_rid_func; void *class_userdata; // Per-class user data, later accessible in instance bindings. -} GDExtensionClassCreationInfo; // Deprecated. Use GDExtensionClassCreationInfo3 instead. +} GDExtensionClassCreationInfo; // Deprecated. Use GDExtensionClassCreationInfo4 instead. typedef struct { GDExtensionBool is_virtual; @@ -325,7 +326,7 @@ typedef struct { GDExtensionClassCallVirtualWithData call_virtual_with_data_func; GDExtensionClassGetRID get_rid_func; void *class_userdata; // Per-class user data, later accessible in instance bindings. -} GDExtensionClassCreationInfo2; // Deprecated. Use GDExtensionClassCreationInfo3 instead. +} GDExtensionClassCreationInfo2; // Deprecated. Use GDExtensionClassCreationInfo4 instead. typedef struct { GDExtensionBool is_virtual; @@ -359,7 +360,40 @@ typedef struct { GDExtensionClassCallVirtualWithData call_virtual_with_data_func; GDExtensionClassGetRID get_rid_func; void *class_userdata; // Per-class user data, later accessible in instance bindings. -} GDExtensionClassCreationInfo3; +} GDExtensionClassCreationInfo3; // Deprecated. Use GDExtensionClassCreationInfo4 instead. + +typedef struct { + GDExtensionBool is_virtual; + GDExtensionBool is_abstract; + GDExtensionBool is_exposed; + GDExtensionBool is_runtime; + GDExtensionClassSet set_func; + GDExtensionClassGet get_func; + GDExtensionClassGetPropertyList get_property_list_func; + GDExtensionClassFreePropertyList2 free_property_list_func; + GDExtensionClassPropertyCanRevert property_can_revert_func; + GDExtensionClassPropertyGetRevert property_get_revert_func; + GDExtensionClassValidateProperty validate_property_func; + GDExtensionClassNotification2 notification_func; + GDExtensionClassToString to_string_func; + GDExtensionClassReference reference_func; + GDExtensionClassUnreference unreference_func; + GDExtensionClassCreateInstance2 create_instance_func; // (Default) constructor; mandatory. If the class is not instantiable, consider making it virtual or abstract. + GDExtensionClassFreeInstance free_instance_func; // Destructor; mandatory. + GDExtensionClassRecreateInstance recreate_instance_func; + // Queries a virtual function by name and returns a callback to invoke the requested virtual function. + GDExtensionClassGetVirtual get_virtual_func; + // 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`. + GDExtensionClassGetVirtualCallData get_virtual_call_data_func; + // Used to call virtual functions when `get_virtual_call_data_func` is not null. + GDExtensionClassCallVirtualWithData call_virtual_with_data_func; + void *class_userdata; // Per-class user data, later accessible in instance bindings. +} GDExtensionClassCreationInfo4; typedef void *GDExtensionClassLibraryPtr; @@ -1272,6 +1306,18 @@ typedef GDExtensionBool (*GDExtensionInterfaceVariantHasMember)(GDExtensionVaria typedef GDExtensionBool (*GDExtensionInterfaceVariantHasKey)(GDExtensionConstVariantPtr p_self, GDExtensionConstVariantPtr p_key, GDExtensionBool *r_valid); /** + * @name variant_get_object_instance_id + * @since 4.4 + * + * Gets the object instance ID from a variant of type GDEXTENSION_VARIANT_TYPE_OBJECT. + * + * @param p_self A pointer to the Variant. + * + * @return The instance ID for the contained object. + */ +typedef GDObjectInstanceID (*GDExtensionInterfaceVariantGetObjectInstanceId)(GDExtensionConstVariantPtr p_self); + +/** * @name variant_get_type_name * @since 4.1 * @@ -2337,6 +2383,22 @@ typedef GDExtensionVariantPtr (*GDExtensionInterfaceDictionaryOperatorIndex)(GDE */ typedef GDExtensionVariantPtr (*GDExtensionInterfaceDictionaryOperatorIndexConst)(GDExtensionConstTypePtr p_self, GDExtensionConstVariantPtr p_key); +/** + * @name dictionary_set_typed + * @since 4.4 + * + * Makes a Dictionary into a typed Dictionary. + * + * @param p_self A pointer to the Dictionary. + * @param p_key_type The type of Variant the Dictionary key will store. + * @param p_key_class_name A pointer to a StringName with the name of the object (if p_key_type is GDEXTENSION_VARIANT_TYPE_OBJECT). + * @param p_key_script A pointer to a Script object (if p_key_type is GDEXTENSION_VARIANT_TYPE_OBJECT and the base class is extended by a script). + * @param p_value_type The type of Variant the Dictionary value will store. + * @param p_value_class_name A pointer to a StringName with the name of the object (if p_value_type is GDEXTENSION_VARIANT_TYPE_OBJECT). + * @param p_value_script A pointer to a Script object (if p_value_type is GDEXTENSION_VARIANT_TYPE_OBJECT and the base class is extended by a script). + */ +typedef void (*GDExtensionInterfaceDictionarySetTyped)(GDExtensionTypePtr p_self, GDExtensionVariantType p_key_type, GDExtensionConstStringNamePtr p_key_class_name, GDExtensionConstVariantPtr p_key_script, GDExtensionVariantType p_value_type, GDExtensionConstStringNamePtr p_value_class_name, GDExtensionConstVariantPtr p_value_script); + /* INTERFACE: Object */ /** @@ -2680,6 +2742,7 @@ typedef void *(*GDExtensionInterfaceCallableCustomGetUserData)(GDExtensionConstT /** * @name classdb_construct_object * @since 4.1 + * @deprecated in Godot 4.4. Use `classdb_construct_object2` instead. * * Constructs an Object of the requested class. * @@ -2692,6 +2755,22 @@ typedef void *(*GDExtensionInterfaceCallableCustomGetUserData)(GDExtensionConstT typedef GDExtensionObjectPtr (*GDExtensionInterfaceClassdbConstructObject)(GDExtensionConstStringNamePtr p_classname); /** + * @name classdb_construct_object2 + * @since 4.4 + * + * 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. + * + * "NOTIFICATION_POSTINITIALIZE" must be sent after construction. + * + * @param p_classname A pointer to a StringName with the class name. + * + * @return A pointer to the newly created Object. + */ +typedef GDExtensionObjectPtr (*GDExtensionInterfaceClassdbConstructObject2)(GDExtensionConstStringNamePtr p_classname); + +/** * @name classdb_get_method_bind * @since 4.1 * @@ -2722,7 +2801,7 @@ typedef void *(*GDExtensionInterfaceClassdbGetClassTag)(GDExtensionConstStringNa /** * @name classdb_register_extension_class * @since 4.1 - * @deprecated in Godot 4.2. Use `classdb_register_extension_class3` instead. + * @deprecated in Godot 4.2. Use `classdb_register_extension_class4` instead. * * Registers an extension class in the ClassDB. * @@ -2738,7 +2817,7 @@ typedef void (*GDExtensionInterfaceClassdbRegisterExtensionClass)(GDExtensionCla /** * @name classdb_register_extension_class2 * @since 4.2 - * @deprecated in Godot 4.3. Use `classdb_register_extension_class3` instead. + * @deprecated in Godot 4.3. Use `classdb_register_extension_class4` instead. * * Registers an extension class in the ClassDB. * @@ -2754,6 +2833,7 @@ typedef void (*GDExtensionInterfaceClassdbRegisterExtensionClass2)(GDExtensionCl /** * @name classdb_register_extension_class3 * @since 4.3 + * @deprecated in Godot 4.4. Use `classdb_register_extension_class4` instead. * * Registers an extension class in the ClassDB. * @@ -2767,6 +2847,21 @@ typedef void (*GDExtensionInterfaceClassdbRegisterExtensionClass2)(GDExtensionCl typedef void (*GDExtensionInterfaceClassdbRegisterExtensionClass3)(GDExtensionClassLibraryPtr p_library, GDExtensionConstStringNamePtr p_class_name, GDExtensionConstStringNamePtr p_parent_class_name, const GDExtensionClassCreationInfo3 *p_extension_funcs); /** + * @name classdb_register_extension_class4 + * @since 4.4 + * + * Registers an extension class in the ClassDB. + * + * Provided struct can be safely freed once the function returns. + * + * @param p_library A pointer the library received by the GDExtension's entry point function. + * @param p_class_name A pointer to a StringName with the class name. + * @param p_parent_class_name A pointer to a StringName with the parent class name. + * @param p_extension_funcs A pointer to a GDExtensionClassCreationInfo2 struct. + */ +typedef void (*GDExtensionInterfaceClassdbRegisterExtensionClass4)(GDExtensionClassLibraryPtr p_library, GDExtensionConstStringNamePtr p_class_name, GDExtensionConstStringNamePtr p_parent_class_name, const GDExtensionClassCreationInfo4 *p_extension_funcs); + +/** * @name classdb_register_extension_class_method * @since 4.1 * diff --git a/include/godot_cpp/classes/wrapped.hpp b/include/godot_cpp/classes/wrapped.hpp index 0ffd783..0c02d15 100644 --- a/include/godot_cpp/classes/wrapped.hpp +++ b/include/godot_cpp/classes/wrapped.hpp @@ -40,6 +40,14 @@ #include <godot_cpp/godot.hpp> +#if defined(MACOS_ENABLED) && defined(HOT_RELOAD_ENABLED) +#include <mutex> +#define _GODOT_CPP_AVOID_THREAD_LOCAL +#define _GODOT_CPP_THREAD_LOCAL +#else +#define _GODOT_CPP_THREAD_LOCAL thread_local +#endif + namespace godot { class ClassDB; @@ -58,8 +66,16 @@ class Wrapped { template <typename T, std::enable_if_t<std::is_base_of<::godot::Wrapped, T>::value, bool>> friend _ALWAYS_INLINE_ void _pre_initialize(); - thread_local static const StringName *_constructing_extension_class_name; - thread_local static const GDExtensionInstanceBindingCallbacks *_constructing_class_binding_callbacks; +#ifdef _GODOT_CPP_AVOID_THREAD_LOCAL + static std::recursive_mutex _constructing_mutex; +#endif + + _GODOT_CPP_THREAD_LOCAL static const StringName *_constructing_extension_class_name; + _GODOT_CPP_THREAD_LOCAL static const GDExtensionInstanceBindingCallbacks *_constructing_class_binding_callbacks; + +#ifdef HOT_RELOAD_ENABLED + _GODOT_CPP_THREAD_LOCAL static GDExtensionObjectPtr _constructing_recreate_owner; +#endif template <typename T> _ALWAYS_INLINE_ static void _set_construct_info() { @@ -71,15 +87,6 @@ protected: virtual bool _is_extension_class() const { return false; } static const StringName *_get_extension_class_name(); // This is needed to retrieve the class name before the godot object has its _extension and _extension_instance members assigned. -#ifdef HOT_RELOAD_ENABLED - struct RecreateInstance { - GDExtensionClassInstancePtr wrapper; - GDExtensionObjectPtr owner; - RecreateInstance *next; - }; - inline static RecreateInstance *recreate_instance = nullptr; -#endif - void _notification(int p_what) {} bool _set(const StringName &p_name, const Variant &p_property) { return false; } bool _get(const StringName &p_name, Variant &r_property) const { return false; } @@ -104,7 +111,6 @@ protected: ::godot::List<::godot::PropertyInfo> plist_owned; void _postinitialize(); - virtual void _notificationv(int32_t p_what, bool p_reversed = false) {} Wrapped(const StringName p_godot_class); Wrapped(GodotObject *p_godot_object); @@ -126,6 +132,9 @@ public: template <typename T, std::enable_if_t<std::is_base_of<::godot::Wrapped, T>::value, bool>> _ALWAYS_INLINE_ void _pre_initialize() { +#ifdef _GODOT_CPP_AVOID_THREAD_LOCAL + Wrapped::_constructing_mutex.lock(); +#endif Wrapped::_set_construct_info<T>(); } @@ -250,7 +259,7 @@ public: } \ \ static const ::godot::StringName &get_class_static() { \ - static const ::godot::StringName string_name = ::godot::StringName(#m_class); \ + static const ::godot::StringName string_name = ::godot::StringName(U## #m_class); \ return string_name; \ } \ \ @@ -398,11 +407,6 @@ public: _gde_binding_reference_callback, \ }; \ \ -protected: \ - virtual void _notificationv(int32_t p_what, bool p_reversed = false) override { \ - m_class::notification_bind(this, p_what, p_reversed); \ - } \ - \ private: // Don't use this for your classes, use GDCLASS() instead. diff --git a/include/godot_cpp/core/class_db.hpp b/include/godot_cpp/core/class_db.hpp index 988277b..6edb324 100644 --- a/include/godot_cpp/core/class_db.hpp +++ b/include/godot_cpp/core/class_db.hpp @@ -116,9 +116,13 @@ private: static void _register_class(bool p_virtual = false, bool p_exposed = true, bool p_runtime = false); template <typename T> - static GDExtensionObjectPtr _create_instance_func(void *data) { + static GDExtensionObjectPtr _create_instance_func(void *data, GDExtensionBool p_notify_postinitialize) { if constexpr (!std::is_abstract_v<T>) { - T *new_object = memnew(T); + Wrapped::_set_construct_info<T>(); + T *new_object = new ("", "") T; + if (p_notify_postinitialize) { + new_object->_postinitialize(); + } return new_object->_owner; } else { return nullptr; @@ -129,9 +133,11 @@ private: static GDExtensionClassInstancePtr _recreate_instance_func(void *data, GDExtensionObjectPtr obj) { if constexpr (!std::is_abstract_v<T>) { #ifdef HOT_RELOAD_ENABLED +#ifdef _GODOT_CPP_AVOID_THREAD_LOCAL + std::lock_guard<std::recursive_mutex> lk(Wrapped::_constructing_mutex); +#endif + Wrapped::_constructing_recreate_owner = obj; T *new_instance = (T *)memalloc(sizeof(T)); - Wrapped::RecreateInstance recreate_data = { new_instance, obj, Wrapped::recreate_instance }; - Wrapped::recreate_instance = &recreate_data; memnew_placement(new_instance, T); return new_instance; #else @@ -239,7 +245,7 @@ void ClassDB::_register_class(bool p_virtual, bool p_exposed, bool p_runtime) { class_register_order.push_back(cl.name); // Register this class with Godot - GDExtensionClassCreationInfo3 class_info = { + GDExtensionClassCreationInfo4 class_info = { p_virtual, // GDExtensionBool is_virtual; is_abstract, // GDExtensionBool is_abstract; p_exposed, // GDExtensionBool is_exposed; @@ -261,11 +267,10 @@ void ClassDB::_register_class(bool p_virtual, bool p_exposed, bool p_runtime) { &ClassDB::get_virtual_func, // GDExtensionClassGetVirtual get_virtual_func; nullptr, // GDExtensionClassGetVirtualCallData get_virtual_call_data_func; nullptr, // GDExtensionClassCallVirtualWithData call_virtual_func; - nullptr, // GDExtensionClassGetRID get_rid; (void *)&T::get_class_static(), // void *class_userdata; }; - internal::gdextension_interface_classdb_register_extension_class3(internal::library, cl.name._native_ptr(), cl.parent_name._native_ptr(), &class_info); + internal::gdextension_interface_classdb_register_extension_class4(internal::library, cl.name._native_ptr(), cl.parent_name._native_ptr(), &class_info); // call bind_methods etc. to register all members of the class T::initialize_class(); diff --git a/include/godot_cpp/core/type_info.hpp b/include/godot_cpp/core/type_info.hpp index b78f7e7..d847598 100644 --- a/include/godot_cpp/core/type_info.hpp +++ b/include/godot_cpp/core/type_info.hpp @@ -33,6 +33,7 @@ #include <godot_cpp/core/object.hpp> #include <godot_cpp/variant/typed_array.hpp> +#include <godot_cpp/variant/typed_dictionary.hpp> #include <godot_cpp/variant/variant.hpp> #include <gdextension_interface.h> @@ -413,6 +414,206 @@ MAKE_TYPED_ARRAY_INFO(IPAddress, Variant::STRING) #undef MAKE_TYPED_ARRAY_INFO +template <typename K, typename V> +struct PtrToArg<TypedDictionary<K, V>> { + _FORCE_INLINE_ static TypedDictionary<K, V> convert(const void *p_ptr) { + return TypedDictionary<K, V>(*reinterpret_cast<const Dictionary *>(p_ptr)); + } + typedef Dictionary EncodeT; + _FORCE_INLINE_ static void encode(TypedDictionary<K, V> p_val, void *p_ptr) { + *(Dictionary *)p_ptr = p_val; + } +}; + +template <typename K, typename V> +struct PtrToArg<const TypedDictionary<K, V> &> { + typedef Dictionary EncodeT; + _FORCE_INLINE_ static TypedDictionary<K, V> + convert(const void *p_ptr) { + return TypedDictionary<K, V>(*reinterpret_cast<const Dictionary *>(p_ptr)); + } +}; + +template <typename K, typename V> +struct GetTypeInfo<TypedDictionary<K, V>> { + static constexpr GDExtensionVariantType VARIANT_TYPE = GDEXTENSION_VARIANT_TYPE_DICTIONARY; + static constexpr GDExtensionClassMethodArgumentMetadata METADATA = GDEXTENSION_METHOD_ARGUMENT_METADATA_NONE; + static inline PropertyInfo get_class_info() { + return PropertyInfo(Variant::Type::DICTIONARY, String(), PROPERTY_HINT_DICTIONARY_TYPE, vformat("%s;%s", K::get_class_static(), V::get_class_static())); + } +}; + +template <typename K, typename V> +struct GetTypeInfo<const TypedDictionary<K, V> &> { + static constexpr GDExtensionVariantType VARIANT_TYPE = GDEXTENSION_VARIANT_TYPE_DICTIONARY; + static constexpr GDExtensionClassMethodArgumentMetadata METADATA = GDEXTENSION_METHOD_ARGUMENT_METADATA_NONE; + static inline PropertyInfo get_class_info() { + return PropertyInfo(Variant::Type::DICTIONARY, String(), PROPERTY_HINT_DICTIONARY_TYPE, vformat("%s;%s", K::get_class_static(), V::get_class_static())); + } +}; + +#define MAKE_TYPED_DICTIONARY_INFO_WITH_OBJECT(m_type, m_variant_type) \ + template <typename T> \ + struct GetTypeInfo<TypedDictionary<T, m_type>> { \ + static constexpr GDExtensionVariantType VARIANT_TYPE = GDEXTENSION_VARIANT_TYPE_DICTIONARY; \ + static constexpr GDExtensionClassMethodArgumentMetadata METADATA = GDEXTENSION_METHOD_ARGUMENT_METADATA_NONE; \ + static inline PropertyInfo get_class_info() { \ + return PropertyInfo(Variant::Type::DICTIONARY, String(), PROPERTY_HINT_DICTIONARY_TYPE, \ + vformat("%s;%s", T::get_class_static(), m_variant_type == Variant::Type::NIL ? "Variant" : Variant::get_type_name(m_variant_type).utf8().get_data())); \ + } \ + }; \ + template <typename T> \ + struct GetTypeInfo<const TypedDictionary<T, m_type> &> { \ + static constexpr GDExtensionVariantType VARIANT_TYPE = GDEXTENSION_VARIANT_TYPE_DICTIONARY; \ + static constexpr GDExtensionClassMethodArgumentMetadata METADATA = GDEXTENSION_METHOD_ARGUMENT_METADATA_NONE; \ + static inline PropertyInfo get_class_info() { \ + return PropertyInfo(Variant::Type::DICTIONARY, String(), PROPERTY_HINT_DICTIONARY_TYPE, \ + vformat("%s;%s", T::get_class_static(), m_variant_type == Variant::Type::NIL ? "Variant" : Variant::get_type_name(m_variant_type).utf8().get_data())); \ + } \ + }; \ + template <typename T> \ + struct GetTypeInfo<TypedDictionary<m_type, T>> { \ + static constexpr GDExtensionVariantType VARIANT_TYPE = GDEXTENSION_VARIANT_TYPE_DICTIONARY; \ + static constexpr GDExtensionClassMethodArgumentMetadata METADATA = GDEXTENSION_METHOD_ARGUMENT_METADATA_NONE; \ + static inline PropertyInfo get_class_info() { \ + return PropertyInfo(Variant::Type::DICTIONARY, String(), PROPERTY_HINT_DICTIONARY_TYPE, \ + vformat("%s;%s", m_variant_type == Variant::Type::NIL ? "Variant" : Variant::get_type_name(m_variant_type).utf8().get_data(), T::get_class_static())); \ + } \ + }; \ + template <typename T> \ + struct GetTypeInfo<const TypedDictionary<m_type, T> &> { \ + static constexpr GDExtensionVariantType VARIANT_TYPE = GDEXTENSION_VARIANT_TYPE_DICTIONARY; \ + static constexpr GDExtensionClassMethodArgumentMetadata METADATA = GDEXTENSION_METHOD_ARGUMENT_METADATA_NONE; \ + static inline PropertyInfo get_class_info() { \ + return PropertyInfo(Variant::Type::DICTIONARY, String(), PROPERTY_HINT_DICTIONARY_TYPE, \ + vformat("%s;%s", m_variant_type == Variant::Type::NIL ? "Variant" : Variant::get_type_name(m_variant_type).utf8().get_data(), T::get_class_static())); \ + } \ + }; + +#define MAKE_TYPED_DICTIONARY_INFO_EXPANDED(m_type_key, m_variant_type_key, m_type_value, m_variant_type_value) \ + template <> \ + struct GetTypeInfo<TypedDictionary<m_type_key, m_type_value>> { \ + static constexpr GDExtensionVariantType VARIANT_TYPE = GDEXTENSION_VARIANT_TYPE_DICTIONARY; \ + static constexpr GDExtensionClassMethodArgumentMetadata METADATA = GDEXTENSION_METHOD_ARGUMENT_METADATA_NONE; \ + static inline PropertyInfo get_class_info() { \ + return PropertyInfo(Variant::Type::DICTIONARY, String(), PROPERTY_HINT_DICTIONARY_TYPE, \ + vformat("%s;%s", m_variant_type_key == Variant::Type::NIL ? "Variant" : Variant::get_type_name(m_variant_type_key).utf8().get_data(), \ + m_variant_type_value == Variant::Type::NIL ? "Variant" : Variant::get_type_name(m_variant_type_value).utf8().get_data())); \ + } \ + }; \ + template <> \ + struct GetTypeInfo<const TypedDictionary<m_type_key, m_type_value> &> { \ + static constexpr GDExtensionVariantType VARIANT_TYPE = GDEXTENSION_VARIANT_TYPE_DICTIONARY; \ + static constexpr GDExtensionClassMethodArgumentMetadata METADATA = GDEXTENSION_METHOD_ARGUMENT_METADATA_NONE; \ + static inline PropertyInfo get_class_info() { \ + return PropertyInfo(Variant::Type::DICTIONARY, String(), PROPERTY_HINT_DICTIONARY_TYPE, \ + vformat("%s;%s", m_variant_type_key == Variant::Type::NIL ? "Variant" : Variant::get_type_name(m_variant_type_key).utf8().get_data(), \ + m_variant_type_value == Variant::Type::NIL ? "Variant" : Variant::get_type_name(m_variant_type_value).utf8().get_data())); \ + } \ + }; + +#define MAKE_TYPED_DICTIONARY_INFO_NIL(m_type, m_variant_type) \ + MAKE_TYPED_DICTIONARY_INFO_WITH_OBJECT(m_type, m_variant_type) \ + MAKE_TYPED_DICTIONARY_INFO_EXPANDED(m_type, m_variant_type, bool, Variant::BOOL) \ + MAKE_TYPED_DICTIONARY_INFO_EXPANDED(m_type, m_variant_type, uint8_t, Variant::INT) \ + MAKE_TYPED_DICTIONARY_INFO_EXPANDED(m_type, m_variant_type, int8_t, Variant::INT) \ + MAKE_TYPED_DICTIONARY_INFO_EXPANDED(m_type, m_variant_type, uint16_t, Variant::INT) \ + MAKE_TYPED_DICTIONARY_INFO_EXPANDED(m_type, m_variant_type, int16_t, Variant::INT) \ + MAKE_TYPED_DICTIONARY_INFO_EXPANDED(m_type, m_variant_type, uint32_t, Variant::INT) \ + MAKE_TYPED_DICTIONARY_INFO_EXPANDED(m_type, m_variant_type, int32_t, Variant::INT) \ + MAKE_TYPED_DICTIONARY_INFO_EXPANDED(m_type, m_variant_type, uint64_t, Variant::INT) \ + MAKE_TYPED_DICTIONARY_INFO_EXPANDED(m_type, m_variant_type, int64_t, Variant::INT) \ + MAKE_TYPED_DICTIONARY_INFO_EXPANDED(m_type, m_variant_type, float, Variant::FLOAT) \ + MAKE_TYPED_DICTIONARY_INFO_EXPANDED(m_type, m_variant_type, double, Variant::FLOAT) \ + MAKE_TYPED_DICTIONARY_INFO_EXPANDED(m_type, m_variant_type, String, Variant::STRING) \ + MAKE_TYPED_DICTIONARY_INFO_EXPANDED(m_type, m_variant_type, Vector2, Variant::VECTOR2) \ + MAKE_TYPED_DICTIONARY_INFO_EXPANDED(m_type, m_variant_type, Vector2i, Variant::VECTOR2I) \ + MAKE_TYPED_DICTIONARY_INFO_EXPANDED(m_type, m_variant_type, Rect2, Variant::RECT2) \ + MAKE_TYPED_DICTIONARY_INFO_EXPANDED(m_type, m_variant_type, Rect2i, Variant::RECT2I) \ + MAKE_TYPED_DICTIONARY_INFO_EXPANDED(m_type, m_variant_type, Vector3, Variant::VECTOR3) \ + MAKE_TYPED_DICTIONARY_INFO_EXPANDED(m_type, m_variant_type, Vector3i, Variant::VECTOR3I) \ + MAKE_TYPED_DICTIONARY_INFO_EXPANDED(m_type, m_variant_type, Transform2D, Variant::TRANSFORM2D) \ + MAKE_TYPED_DICTIONARY_INFO_EXPANDED(m_type, m_variant_type, Plane, Variant::PLANE) \ + MAKE_TYPED_DICTIONARY_INFO_EXPANDED(m_type, m_variant_type, Quaternion, Variant::QUATERNION) \ + MAKE_TYPED_DICTIONARY_INFO_EXPANDED(m_type, m_variant_type, AABB, Variant::AABB) \ + MAKE_TYPED_DICTIONARY_INFO_EXPANDED(m_type, m_variant_type, Basis, Variant::BASIS) \ + MAKE_TYPED_DICTIONARY_INFO_EXPANDED(m_type, m_variant_type, Transform3D, Variant::TRANSFORM3D) \ + MAKE_TYPED_DICTIONARY_INFO_EXPANDED(m_type, m_variant_type, Color, Variant::COLOR) \ + MAKE_TYPED_DICTIONARY_INFO_EXPANDED(m_type, m_variant_type, StringName, Variant::STRING_NAME) \ + MAKE_TYPED_DICTIONARY_INFO_EXPANDED(m_type, m_variant_type, NodePath, Variant::NODE_PATH) \ + MAKE_TYPED_DICTIONARY_INFO_EXPANDED(m_type, m_variant_type, RID, Variant::RID) \ + MAKE_TYPED_DICTIONARY_INFO_EXPANDED(m_type, m_variant_type, Callable, Variant::CALLABLE) \ + MAKE_TYPED_DICTIONARY_INFO_EXPANDED(m_type, m_variant_type, Signal, Variant::SIGNAL) \ + MAKE_TYPED_DICTIONARY_INFO_EXPANDED(m_type, m_variant_type, Dictionary, Variant::DICTIONARY) \ + MAKE_TYPED_DICTIONARY_INFO_EXPANDED(m_type, m_variant_type, Array, Variant::ARRAY) \ + MAKE_TYPED_DICTIONARY_INFO_EXPANDED(m_type, m_variant_type, PackedByteArray, Variant::PACKED_BYTE_ARRAY) \ + MAKE_TYPED_DICTIONARY_INFO_EXPANDED(m_type, m_variant_type, PackedInt32Array, Variant::PACKED_INT32_ARRAY) \ + MAKE_TYPED_DICTIONARY_INFO_EXPANDED(m_type, m_variant_type, PackedInt64Array, Variant::PACKED_INT64_ARRAY) \ + MAKE_TYPED_DICTIONARY_INFO_EXPANDED(m_type, m_variant_type, PackedFloat32Array, Variant::PACKED_FLOAT32_ARRAY) \ + MAKE_TYPED_DICTIONARY_INFO_EXPANDED(m_type, m_variant_type, PackedFloat64Array, Variant::PACKED_FLOAT64_ARRAY) \ + MAKE_TYPED_DICTIONARY_INFO_EXPANDED(m_type, m_variant_type, PackedStringArray, Variant::PACKED_STRING_ARRAY) \ + MAKE_TYPED_DICTIONARY_INFO_EXPANDED(m_type, m_variant_type, PackedVector2Array, Variant::PACKED_VECTOR2_ARRAY) \ + MAKE_TYPED_DICTIONARY_INFO_EXPANDED(m_type, m_variant_type, PackedVector3Array, Variant::PACKED_VECTOR3_ARRAY) \ + MAKE_TYPED_DICTIONARY_INFO_EXPANDED(m_type, m_variant_type, PackedVector4Array, Variant::PACKED_VECTOR4_ARRAY) \ + MAKE_TYPED_DICTIONARY_INFO_EXPANDED(m_type, m_variant_type, PackedColorArray, Variant::PACKED_COLOR_ARRAY) \ + /* MAKE_TYPED_DICTIONARY_INFO_EXPANDED(m_type, m_variant_type, IPAddress, Variant::STRING) */ + +#define MAKE_TYPED_DICTIONARY_INFO(m_type, m_variant_type) \ + MAKE_TYPED_DICTIONARY_INFO_EXPANDED(m_type, m_variant_type, Variant, Variant::NIL) \ + MAKE_TYPED_DICTIONARY_INFO_NIL(m_type, m_variant_type) + +MAKE_TYPED_DICTIONARY_INFO_NIL(Variant, Variant::NIL) +MAKE_TYPED_DICTIONARY_INFO(bool, Variant::BOOL) +MAKE_TYPED_DICTIONARY_INFO(uint8_t, Variant::INT) +MAKE_TYPED_DICTIONARY_INFO(int8_t, Variant::INT) +MAKE_TYPED_DICTIONARY_INFO(uint16_t, Variant::INT) +MAKE_TYPED_DICTIONARY_INFO(int16_t, Variant::INT) +MAKE_TYPED_DICTIONARY_INFO(uint32_t, Variant::INT) +MAKE_TYPED_DICTIONARY_INFO(int32_t, Variant::INT) +MAKE_TYPED_DICTIONARY_INFO(uint64_t, Variant::INT) +MAKE_TYPED_DICTIONARY_INFO(int64_t, Variant::INT) +MAKE_TYPED_DICTIONARY_INFO(float, Variant::FLOAT) +MAKE_TYPED_DICTIONARY_INFO(double, Variant::FLOAT) +MAKE_TYPED_DICTIONARY_INFO(String, Variant::STRING) +MAKE_TYPED_DICTIONARY_INFO(Vector2, Variant::VECTOR2) +MAKE_TYPED_DICTIONARY_INFO(Vector2i, Variant::VECTOR2I) +MAKE_TYPED_DICTIONARY_INFO(Rect2, Variant::RECT2) +MAKE_TYPED_DICTIONARY_INFO(Rect2i, Variant::RECT2I) +MAKE_TYPED_DICTIONARY_INFO(Vector3, Variant::VECTOR3) +MAKE_TYPED_DICTIONARY_INFO(Vector3i, Variant::VECTOR3I) +MAKE_TYPED_DICTIONARY_INFO(Transform2D, Variant::TRANSFORM2D) +MAKE_TYPED_DICTIONARY_INFO(Plane, Variant::PLANE) +MAKE_TYPED_DICTIONARY_INFO(Quaternion, Variant::QUATERNION) +MAKE_TYPED_DICTIONARY_INFO(AABB, Variant::AABB) +MAKE_TYPED_DICTIONARY_INFO(Basis, Variant::BASIS) +MAKE_TYPED_DICTIONARY_INFO(Transform3D, Variant::TRANSFORM3D) +MAKE_TYPED_DICTIONARY_INFO(Color, Variant::COLOR) +MAKE_TYPED_DICTIONARY_INFO(StringName, Variant::STRING_NAME) +MAKE_TYPED_DICTIONARY_INFO(NodePath, Variant::NODE_PATH) +MAKE_TYPED_DICTIONARY_INFO(RID, Variant::RID) +MAKE_TYPED_DICTIONARY_INFO(Callable, Variant::CALLABLE) +MAKE_TYPED_DICTIONARY_INFO(Signal, Variant::SIGNAL) +MAKE_TYPED_DICTIONARY_INFO(Dictionary, Variant::DICTIONARY) +MAKE_TYPED_DICTIONARY_INFO(Array, Variant::ARRAY) +MAKE_TYPED_DICTIONARY_INFO(PackedByteArray, Variant::PACKED_BYTE_ARRAY) +MAKE_TYPED_DICTIONARY_INFO(PackedInt32Array, Variant::PACKED_INT32_ARRAY) +MAKE_TYPED_DICTIONARY_INFO(PackedInt64Array, Variant::PACKED_INT64_ARRAY) +MAKE_TYPED_DICTIONARY_INFO(PackedFloat32Array, Variant::PACKED_FLOAT32_ARRAY) +MAKE_TYPED_DICTIONARY_INFO(PackedFloat64Array, Variant::PACKED_FLOAT64_ARRAY) +MAKE_TYPED_DICTIONARY_INFO(PackedStringArray, Variant::PACKED_STRING_ARRAY) +MAKE_TYPED_DICTIONARY_INFO(PackedVector2Array, Variant::PACKED_VECTOR2_ARRAY) +MAKE_TYPED_DICTIONARY_INFO(PackedVector3Array, Variant::PACKED_VECTOR3_ARRAY) +MAKE_TYPED_DICTIONARY_INFO(PackedVector4Array, Variant::PACKED_VECTOR4_ARRAY) +MAKE_TYPED_DICTIONARY_INFO(PackedColorArray, Variant::PACKED_COLOR_ARRAY) +/* +MAKE_TYPED_DICTIONARY_INFO(IPAddress, Variant::STRING) +*/ + +#undef MAKE_TYPED_DICTIONARY_INFO +#undef MAKE_TYPED_DICTIONARY_INFO_NIL +#undef MAKE_TYPED_DICTIONARY_INFO_EXPANDED +#undef MAKE_TYPED_DICTIONARY_INFO_WITH_OBJECT + #define CLASS_INFO(m_type) (GetTypeInfo<m_type *>::get_class_info()) } // namespace godot diff --git a/include/godot_cpp/godot.hpp b/include/godot_cpp/godot.hpp index 61dbb96..39a5f05 100644 --- a/include/godot_cpp/godot.hpp +++ b/include/godot_cpp/godot.hpp @@ -82,6 +82,7 @@ extern "C" GDExtensionInterfaceVariantGetType gdextension_interface_variant_get_ extern "C" GDExtensionInterfaceVariantHasMethod gdextension_interface_variant_has_method; extern "C" GDExtensionInterfaceVariantHasMember gdextension_interface_variant_has_member; extern "C" GDExtensionInterfaceVariantHasKey gdextension_interface_variant_has_key; +extern "C" GDExtensionInterfaceVariantGetObjectInstanceId gdextension_interface_variant_get_object_instance_id; extern "C" GDExtensionInterfaceVariantGetTypeName gdextension_interface_variant_get_type_name; extern "C" GDExtensionInterfaceVariantCanConvert gdextension_interface_variant_can_convert; extern "C" GDExtensionInterfaceVariantCanConvertStrict gdextension_interface_variant_can_convert_strict; @@ -158,6 +159,7 @@ extern "C" GDExtensionInterfaceArrayRef gdextension_interface_array_ref; extern "C" GDExtensionInterfaceArraySetTyped gdextension_interface_array_set_typed; extern "C" GDExtensionInterfaceDictionaryOperatorIndex gdextension_interface_dictionary_operator_index; extern "C" GDExtensionInterfaceDictionaryOperatorIndexConst gdextension_interface_dictionary_operator_index_const; +extern "C" GDExtensionInterfaceDictionarySetTyped gdextension_interface_dictionary_set_typed; extern "C" GDExtensionInterfaceObjectMethodBindCall gdextension_interface_object_method_bind_call; extern "C" GDExtensionInterfaceObjectMethodBindPtrcall gdextension_interface_object_method_bind_ptrcall; extern "C" GDExtensionInterfaceObjectDestroy gdextension_interface_object_destroy; @@ -179,10 +181,10 @@ extern "C" GDExtensionInterfaceRefSetObject gdextension_interface_ref_set_object extern "C" GDExtensionInterfaceScriptInstanceCreate3 gdextension_interface_script_instance_create3; extern "C" GDExtensionInterfacePlaceHolderScriptInstanceCreate gdextension_interface_placeholder_script_instance_create; extern "C" GDExtensionInterfacePlaceHolderScriptInstanceUpdate gdextension_interface_placeholder_script_instance_update; -extern "C" GDExtensionInterfaceClassdbConstructObject gdextension_interface_classdb_construct_object; +extern "C" GDExtensionInterfaceClassdbConstructObject2 gdextension_interface_classdb_construct_object2; extern "C" GDExtensionInterfaceClassdbGetMethodBind gdextension_interface_classdb_get_method_bind; extern "C" GDExtensionInterfaceClassdbGetClassTag gdextension_interface_classdb_get_class_tag; -extern "C" GDExtensionInterfaceClassdbRegisterExtensionClass3 gdextension_interface_classdb_register_extension_class3; +extern "C" GDExtensionInterfaceClassdbRegisterExtensionClass4 gdextension_interface_classdb_register_extension_class4; extern "C" GDExtensionInterfaceClassdbRegisterExtensionClassMethod gdextension_interface_classdb_register_extension_class_method; extern "C" GDExtensionInterfaceClassdbRegisterExtensionClassVirtualMethod gdextension_interface_classdb_register_extension_class_virtual_method; extern "C" GDExtensionInterfaceClassdbRegisterExtensionClassIntegerConstant gdextension_interface_classdb_register_extension_class_integer_constant; diff --git a/include/godot_cpp/variant/basis.hpp b/include/godot_cpp/variant/basis.hpp index e740a64..f3ebe15 100644 --- a/include/godot_cpp/variant/basis.hpp +++ b/include/godot_cpp/variant/basis.hpp @@ -224,7 +224,7 @@ struct _NO_DISCARD_ Basis { operator Quaternion() const { return get_quaternion(); } - static Basis looking_at(const Vector3 &p_target, const Vector3 &p_up = Vector3(0, 1, 0)); + static Basis looking_at(const Vector3 &p_target, const Vector3 &p_up = Vector3(0, 1, 0), bool p_use_model_front = false); Basis(const Quaternion &p_quaternion) { set_quaternion(p_quaternion); } Basis(const Quaternion &p_quaternion, const Vector3 &p_scale) { set_quaternion_scale(p_quaternion, p_scale); } diff --git a/include/godot_cpp/variant/quaternion.hpp b/include/godot_cpp/variant/quaternion.hpp index 5de91b2..8d0afd7 100644 --- a/include/godot_cpp/variant/quaternion.hpp +++ b/include/godot_cpp/variant/quaternion.hpp @@ -31,6 +31,7 @@ #ifndef GODOT_QUATERNION_HPP #define GODOT_QUATERNION_HPP +#include <godot_cpp/classes/global_constants.hpp> #include <godot_cpp/core/math.hpp> #include <godot_cpp/variant/vector3.hpp> @@ -47,11 +48,11 @@ struct _NO_DISCARD_ Quaternion { real_t components[4] = { 0, 0, 0, 1.0 }; }; - _FORCE_INLINE_ real_t &operator[](int idx) { - return components[idx]; + _FORCE_INLINE_ real_t &operator[](int p_idx) { + return components[p_idx]; } - _FORCE_INLINE_ const real_t &operator[](int idx) const { - return components[idx]; + _FORCE_INLINE_ const real_t &operator[](int p_idx) const { + return components[p_idx]; } _FORCE_INLINE_ real_t length_squared() const; bool is_equal_approx(const Quaternion &p_quaternion) const; @@ -66,14 +67,13 @@ struct _NO_DISCARD_ Quaternion { _FORCE_INLINE_ real_t dot(const Quaternion &p_q) const; real_t angle_to(const Quaternion &p_to) const; - Vector3 get_euler_xyz() const; - Vector3 get_euler_yxz() const; - Vector3 get_euler() const { return get_euler_yxz(); } + Vector3 get_euler(EulerOrder p_order = EulerOrder::EULER_ORDER_YXZ) const; + static Quaternion from_euler(const Vector3 &p_euler); - Quaternion slerp(const Quaternion &p_to, const real_t &p_weight) const; - Quaternion slerpni(const Quaternion &p_to, const real_t &p_weight) const; - Quaternion spherical_cubic_interpolate(const Quaternion &p_b, const Quaternion &p_pre_a, const Quaternion &p_post_b, const real_t &p_weight) const; - Quaternion spherical_cubic_interpolate_in_time(const Quaternion &p_b, const Quaternion &p_pre_a, const Quaternion &p_post_b, const real_t &p_weight, const real_t &p_b_t, const real_t &p_pre_a_t, const real_t &p_post_b_t) const; + Quaternion slerp(const Quaternion &p_to, real_t p_weight) const; + Quaternion slerpni(const Quaternion &p_to, real_t p_weight) const; + Quaternion spherical_cubic_interpolate(const Quaternion &p_b, const Quaternion &p_pre_a, const Quaternion &p_post_b, real_t p_weight) const; + Quaternion spherical_cubic_interpolate_in_time(const Quaternion &p_b, const Quaternion &p_pre_a, const Quaternion &p_post_b, real_t p_weight, real_t p_b_t, real_t p_pre_a_t, real_t p_post_b_t) const; Vector3 get_axis() const; real_t get_angle() const; @@ -89,28 +89,28 @@ struct _NO_DISCARD_ Quaternion { void operator*=(const Quaternion &p_q); Quaternion operator*(const Quaternion &p_q) const; - _FORCE_INLINE_ Vector3 xform(const Vector3 &v) const { + _FORCE_INLINE_ Vector3 xform(const Vector3 &p_v) const { #ifdef MATH_CHECKS - ERR_FAIL_COND_V_MSG(!is_normalized(), v, "The quaternion must be normalized."); + ERR_FAIL_COND_V_MSG(!is_normalized(), p_v, "The quaternion " + operator String() + " must be normalized."); #endif Vector3 u(x, y, z); - Vector3 uv = u.cross(v); - return v + ((uv * w) + u.cross(uv)) * ((real_t)2); + Vector3 uv = u.cross(p_v); + return p_v + ((uv * w) + u.cross(uv)) * ((real_t)2); } - _FORCE_INLINE_ Vector3 xform_inv(const Vector3 &v) const { - return inverse().xform(v); + _FORCE_INLINE_ Vector3 xform_inv(const Vector3 &p_v) const { + return inverse().xform(p_v); } _FORCE_INLINE_ void operator+=(const Quaternion &p_q); _FORCE_INLINE_ void operator-=(const Quaternion &p_q); - _FORCE_INLINE_ void operator*=(const real_t &s); - _FORCE_INLINE_ void operator/=(const real_t &s); - _FORCE_INLINE_ Quaternion operator+(const Quaternion &q2) const; - _FORCE_INLINE_ Quaternion operator-(const Quaternion &q2) const; + _FORCE_INLINE_ void operator*=(real_t p_s); + _FORCE_INLINE_ void operator/=(real_t p_s); + _FORCE_INLINE_ Quaternion operator+(const Quaternion &p_q2) const; + _FORCE_INLINE_ Quaternion operator-(const Quaternion &p_q2) const; _FORCE_INLINE_ Quaternion operator-() const; - _FORCE_INLINE_ Quaternion operator*(const real_t &s) const; - _FORCE_INLINE_ Quaternion operator/(const real_t &s) const; + _FORCE_INLINE_ Quaternion operator*(real_t p_s) const; + _FORCE_INLINE_ Quaternion operator/(real_t p_s) const; _FORCE_INLINE_ bool operator==(const Quaternion &p_quaternion) const; _FORCE_INLINE_ bool operator!=(const Quaternion &p_quaternion) const; @@ -128,8 +128,6 @@ struct _NO_DISCARD_ Quaternion { Quaternion(const Vector3 &p_axis, real_t p_angle); - Quaternion(const Vector3 &p_euler); - Quaternion(const Quaternion &p_q) : x(p_q.x), y(p_q.y), @@ -144,9 +142,9 @@ struct _NO_DISCARD_ Quaternion { w = p_q.w; } - Quaternion(const Vector3 &v0, const Vector3 &v1) { // Shortest arc. - Vector3 c = v0.cross(v1); - real_t d = v0.dot(v1); + Quaternion(const Vector3 &p_v0, const Vector3 &p_v1) { // Shortest arc. + Vector3 c = p_v0.cross(p_v1); + real_t d = p_v0.dot(p_v1); if (d < -1.0f + (real_t)CMP_EPSILON) { x = 0; @@ -187,25 +185,25 @@ void Quaternion::operator-=(const Quaternion &p_q) { w -= p_q.w; } -void Quaternion::operator*=(const real_t &s) { - x *= s; - y *= s; - z *= s; - w *= s; +void Quaternion::operator*=(real_t p_s) { + x *= p_s; + y *= p_s; + z *= p_s; + w *= p_s; } -void Quaternion::operator/=(const real_t &s) { - *this *= 1.0f / s; +void Quaternion::operator/=(real_t p_s) { + *this *= 1.0f / p_s; } -Quaternion Quaternion::operator+(const Quaternion &q2) const { +Quaternion Quaternion::operator+(const Quaternion &p_q2) const { const Quaternion &q1 = *this; - return Quaternion(q1.x + q2.x, q1.y + q2.y, q1.z + q2.z, q1.w + q2.w); + return Quaternion(q1.x + p_q2.x, q1.y + p_q2.y, q1.z + p_q2.z, q1.w + p_q2.w); } -Quaternion Quaternion::operator-(const Quaternion &q2) const { +Quaternion Quaternion::operator-(const Quaternion &p_q2) const { const Quaternion &q1 = *this; - return Quaternion(q1.x - q2.x, q1.y - q2.y, q1.z - q2.z, q1.w - q2.w); + return Quaternion(q1.x - p_q2.x, q1.y - p_q2.y, q1.z - p_q2.z, q1.w - p_q2.w); } Quaternion Quaternion::operator-() const { @@ -213,12 +211,12 @@ Quaternion Quaternion::operator-() const { return Quaternion(-q2.x, -q2.y, -q2.z, -q2.w); } -Quaternion Quaternion::operator*(const real_t &s) const { - return Quaternion(x * s, y * s, z * s, w * s); +Quaternion Quaternion::operator*(real_t p_s) const { + return Quaternion(x * p_s, y * p_s, z * p_s, w * p_s); } -Quaternion Quaternion::operator/(const real_t &s) const { - return *this * (1.0f / s); +Quaternion Quaternion::operator/(real_t p_s) const { + return *this * (1.0f / p_s); } bool Quaternion::operator==(const Quaternion &p_quaternion) const { @@ -229,7 +227,7 @@ bool Quaternion::operator!=(const Quaternion &p_quaternion) const { return x != p_quaternion.x || y != p_quaternion.y || z != p_quaternion.z || w != p_quaternion.w; } -_FORCE_INLINE_ Quaternion operator*(const real_t &p_real, const Quaternion &p_quaternion) { +_FORCE_INLINE_ Quaternion operator*(real_t p_real, const Quaternion &p_quaternion) { return p_quaternion * p_real; } diff --git a/include/godot_cpp/variant/typed_dictionary.hpp b/include/godot_cpp/variant/typed_dictionary.hpp new file mode 100644 index 0000000..e7f3535 --- /dev/null +++ b/include/godot_cpp/variant/typed_dictionary.hpp @@ -0,0 +1,238 @@ +/**************************************************************************/ +/* typed_dictionary.hpp */ +/**************************************************************************/ +/* This file is part of: */ +/* GODOT ENGINE */ +/* https://godotengine.org */ +/**************************************************************************/ +/* Copyright (c) 2014-present Godot Engine contributors (see AUTHORS.md). */ +/* Copyright (c) 2007-2014 Juan Linietsky, Ariel Manzur. */ +/* */ +/* Permission is hereby granted, free of charge, to any person obtaining */ +/* a copy of this software and associated documentation files (the */ +/* "Software"), to deal in the Software without restriction, including */ +/* without limitation the rights to use, copy, modify, merge, publish, */ +/* distribute, sublicense, and/or sell copies of the Software, and to */ +/* permit persons to whom the Software is furnished to do so, subject to */ +/* the following conditions: */ +/* */ +/* The above copyright notice and this permission notice shall be */ +/* included in all copies or substantial portions of the Software. */ +/* */ +/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */ +/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */ +/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. */ +/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */ +/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */ +/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */ +/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ +/**************************************************************************/ + +#ifndef GODOT_TYPED_DICTIONARY_HPP +#define GODOT_TYPED_DICTIONARY_HPP + +#include <godot_cpp/variant/dictionary.hpp> +#include <godot_cpp/variant/variant.hpp> + +namespace godot { + +template <typename K, typename V> +class TypedDictionary : public Dictionary { +public: + _FORCE_INLINE_ void operator=(const Dictionary &p_dictionary) { + ERR_FAIL_COND_MSG(!is_same_typed(p_dictionary), "Cannot assign a dictionary with a different element type."); + Dictionary::operator=(p_dictionary); + } + _FORCE_INLINE_ TypedDictionary(const Variant &p_variant) : + TypedDictionary(Dictionary(p_variant)) { + } + _FORCE_INLINE_ TypedDictionary(const Dictionary &p_dictionary) { + set_typed(Variant::OBJECT, K::get_class_static(), Variant(), Variant::OBJECT, V::get_class_static(), Variant()); + if (is_same_typed(p_dictionary)) { + Dictionary::operator=(p_dictionary); + } else { + assign(p_dictionary); + } + } + _FORCE_INLINE_ TypedDictionary() { + set_typed(Variant::OBJECT, K::get_class_static(), Variant(), Variant::OBJECT, V::get_class_static(), Variant()); + } +}; + +//specialization for the rest of variant types + +#define MAKE_TYPED_DICTIONARY_WITH_OBJECT(m_type, m_variant_type) \ + template <typename T> \ + class TypedDictionary<T, m_type> : public Dictionary { \ + public: \ + _FORCE_INLINE_ void operator=(const Dictionary &p_dictionary) { \ + ERR_FAIL_COND_MSG(!is_same_typed(p_dictionary), "Cannot assign an dictionary with a different element type."); \ + Dictionary::operator=(p_dictionary); \ + } \ + _FORCE_INLINE_ TypedDictionary(const Variant &p_variant) : \ + TypedDictionary(Dictionary(p_variant)) { \ + } \ + _FORCE_INLINE_ TypedDictionary(const Dictionary &p_dictionary) { \ + set_typed(Variant::OBJECT, T::get_class_static(), Variant(), m_variant_type, StringName(), Variant()); \ + if (is_same_typed(p_dictionary)) { \ + Dictionary::operator=(p_dictionary); \ + } else { \ + assign(p_dictionary); \ + } \ + } \ + _FORCE_INLINE_ TypedDictionary() { \ + set_typed(Variant::OBJECT, T::get_class_static(), Variant(), m_variant_type, StringName(), Variant()); \ + } \ + }; \ + template <typename T> \ + class TypedDictionary<m_type, T> : public Dictionary { \ + public: \ + _FORCE_INLINE_ void operator=(const Dictionary &p_dictionary) { \ + ERR_FAIL_COND_MSG(!is_same_typed(p_dictionary), "Cannot assign an dictionary with a different element type."); \ + Dictionary::operator=(p_dictionary); \ + } \ + _FORCE_INLINE_ TypedDictionary(const Variant &p_variant) : \ + TypedDictionary(Dictionary(p_variant)) { \ + } \ + _FORCE_INLINE_ TypedDictionary(const Dictionary &p_dictionary) { \ + set_typed(m_variant_type, StringName(), Variant(), Variant::OBJECT, T::get_class_static(), Variant()); \ + if (is_same_typed(p_dictionary)) { \ + Dictionary::operator=(p_dictionary); \ + } else { \ + assign(p_dictionary); \ + } \ + } \ + _FORCE_INLINE_ TypedDictionary() { \ + set_typed(m_variant_type, StringName(), Variant(), Variant::OBJECT, T::get_class_static(), Variant()); \ + } \ + }; + +#define MAKE_TYPED_DICTIONARY_EXPANDED(m_type_key, m_variant_type_key, m_type_value, m_variant_type_value) \ + template <> \ + class TypedDictionary<m_type_key, m_type_value> : public Dictionary { \ + public: \ + _FORCE_INLINE_ void operator=(const Dictionary &p_dictionary) { \ + ERR_FAIL_COND_MSG(!is_same_typed(p_dictionary), "Cannot assign an dictionary with a different element type."); \ + Dictionary::operator=(p_dictionary); \ + } \ + _FORCE_INLINE_ TypedDictionary(const Variant &p_variant) : \ + TypedDictionary(Dictionary(p_variant)) { \ + } \ + _FORCE_INLINE_ TypedDictionary(const Dictionary &p_dictionary) { \ + set_typed(m_variant_type_key, StringName(), Variant(), m_variant_type_value, StringName(), Variant()); \ + if (is_same_typed(p_dictionary)) { \ + Dictionary::operator=(p_dictionary); \ + } else { \ + assign(p_dictionary); \ + } \ + } \ + _FORCE_INLINE_ TypedDictionary() { \ + set_typed(m_variant_type_key, StringName(), Variant(), m_variant_type_value, StringName(), Variant()); \ + } \ + }; + +#define MAKE_TYPED_DICTIONARY_NIL(m_type, m_variant_type) \ + MAKE_TYPED_DICTIONARY_WITH_OBJECT(m_type, m_variant_type) \ + MAKE_TYPED_DICTIONARY_EXPANDED(m_type, m_variant_type, bool, Variant::BOOL) \ + MAKE_TYPED_DICTIONARY_EXPANDED(m_type, m_variant_type, uint8_t, Variant::INT) \ + MAKE_TYPED_DICTIONARY_EXPANDED(m_type, m_variant_type, int8_t, Variant::INT) \ + MAKE_TYPED_DICTIONARY_EXPANDED(m_type, m_variant_type, uint16_t, Variant::INT) \ + MAKE_TYPED_DICTIONARY_EXPANDED(m_type, m_variant_type, int16_t, Variant::INT) \ + MAKE_TYPED_DICTIONARY_EXPANDED(m_type, m_variant_type, uint32_t, Variant::INT) \ + MAKE_TYPED_DICTIONARY_EXPANDED(m_type, m_variant_type, int32_t, Variant::INT) \ + MAKE_TYPED_DICTIONARY_EXPANDED(m_type, m_variant_type, uint64_t, Variant::INT) \ + MAKE_TYPED_DICTIONARY_EXPANDED(m_type, m_variant_type, int64_t, Variant::INT) \ + MAKE_TYPED_DICTIONARY_EXPANDED(m_type, m_variant_type, float, Variant::FLOAT) \ + MAKE_TYPED_DICTIONARY_EXPANDED(m_type, m_variant_type, double, Variant::FLOAT) \ + MAKE_TYPED_DICTIONARY_EXPANDED(m_type, m_variant_type, String, Variant::STRING) \ + MAKE_TYPED_DICTIONARY_EXPANDED(m_type, m_variant_type, Vector2, Variant::VECTOR2) \ + MAKE_TYPED_DICTIONARY_EXPANDED(m_type, m_variant_type, Vector2i, Variant::VECTOR2I) \ + MAKE_TYPED_DICTIONARY_EXPANDED(m_type, m_variant_type, Rect2, Variant::RECT2) \ + MAKE_TYPED_DICTIONARY_EXPANDED(m_type, m_variant_type, Rect2i, Variant::RECT2I) \ + MAKE_TYPED_DICTIONARY_EXPANDED(m_type, m_variant_type, Vector3, Variant::VECTOR3) \ + MAKE_TYPED_DICTIONARY_EXPANDED(m_type, m_variant_type, Vector3i, Variant::VECTOR3I) \ + MAKE_TYPED_DICTIONARY_EXPANDED(m_type, m_variant_type, Transform2D, Variant::TRANSFORM2D) \ + MAKE_TYPED_DICTIONARY_EXPANDED(m_type, m_variant_type, Plane, Variant::PLANE) \ + MAKE_TYPED_DICTIONARY_EXPANDED(m_type, m_variant_type, Quaternion, Variant::QUATERNION) \ + MAKE_TYPED_DICTIONARY_EXPANDED(m_type, m_variant_type, AABB, Variant::AABB) \ + MAKE_TYPED_DICTIONARY_EXPANDED(m_type, m_variant_type, Basis, Variant::BASIS) \ + MAKE_TYPED_DICTIONARY_EXPANDED(m_type, m_variant_type, Transform3D, Variant::TRANSFORM3D) \ + MAKE_TYPED_DICTIONARY_EXPANDED(m_type, m_variant_type, Color, Variant::COLOR) \ + MAKE_TYPED_DICTIONARY_EXPANDED(m_type, m_variant_type, StringName, Variant::STRING_NAME) \ + MAKE_TYPED_DICTIONARY_EXPANDED(m_type, m_variant_type, NodePath, Variant::NODE_PATH) \ + MAKE_TYPED_DICTIONARY_EXPANDED(m_type, m_variant_type, RID, Variant::RID) \ + MAKE_TYPED_DICTIONARY_EXPANDED(m_type, m_variant_type, Callable, Variant::CALLABLE) \ + MAKE_TYPED_DICTIONARY_EXPANDED(m_type, m_variant_type, Signal, Variant::SIGNAL) \ + MAKE_TYPED_DICTIONARY_EXPANDED(m_type, m_variant_type, Dictionary, Variant::DICTIONARY) \ + MAKE_TYPED_DICTIONARY_EXPANDED(m_type, m_variant_type, Array, Variant::ARRAY) \ + MAKE_TYPED_DICTIONARY_EXPANDED(m_type, m_variant_type, PackedByteArray, Variant::PACKED_BYTE_ARRAY) \ + MAKE_TYPED_DICTIONARY_EXPANDED(m_type, m_variant_type, PackedInt32Array, Variant::PACKED_INT32_ARRAY) \ + MAKE_TYPED_DICTIONARY_EXPANDED(m_type, m_variant_type, PackedInt64Array, Variant::PACKED_INT64_ARRAY) \ + MAKE_TYPED_DICTIONARY_EXPANDED(m_type, m_variant_type, PackedFloat32Array, Variant::PACKED_FLOAT32_ARRAY) \ + MAKE_TYPED_DICTIONARY_EXPANDED(m_type, m_variant_type, PackedFloat64Array, Variant::PACKED_FLOAT64_ARRAY) \ + MAKE_TYPED_DICTIONARY_EXPANDED(m_type, m_variant_type, PackedStringArray, Variant::PACKED_STRING_ARRAY) \ + MAKE_TYPED_DICTIONARY_EXPANDED(m_type, m_variant_type, PackedVector2Array, Variant::PACKED_VECTOR2_ARRAY) \ + MAKE_TYPED_DICTIONARY_EXPANDED(m_type, m_variant_type, PackedVector3Array, Variant::PACKED_VECTOR3_ARRAY) \ + MAKE_TYPED_DICTIONARY_EXPANDED(m_type, m_variant_type, PackedColorArray, Variant::PACKED_COLOR_ARRAY) \ + MAKE_TYPED_DICTIONARY_EXPANDED(m_type, m_variant_type, PackedVector4Array, Variant::PACKED_VECTOR4_ARRAY) \ + /*MAKE_TYPED_DICTIONARY_EXPANDED(m_type, m_variant_type, IPAddress, Variant::STRING)*/ + +#define MAKE_TYPED_DICTIONARY(m_type, m_variant_type) \ + MAKE_TYPED_DICTIONARY_EXPANDED(m_type, m_variant_type, Variant, Variant::NIL) \ + MAKE_TYPED_DICTIONARY_NIL(m_type, m_variant_type) + +MAKE_TYPED_DICTIONARY_NIL(Variant, Variant::NIL) +MAKE_TYPED_DICTIONARY(bool, Variant::BOOL) +MAKE_TYPED_DICTIONARY(uint8_t, Variant::INT) +MAKE_TYPED_DICTIONARY(int8_t, Variant::INT) +MAKE_TYPED_DICTIONARY(uint16_t, Variant::INT) +MAKE_TYPED_DICTIONARY(int16_t, Variant::INT) +MAKE_TYPED_DICTIONARY(uint32_t, Variant::INT) +MAKE_TYPED_DICTIONARY(int32_t, Variant::INT) +MAKE_TYPED_DICTIONARY(uint64_t, Variant::INT) +MAKE_TYPED_DICTIONARY(int64_t, Variant::INT) +MAKE_TYPED_DICTIONARY(float, Variant::FLOAT) +MAKE_TYPED_DICTIONARY(double, Variant::FLOAT) +MAKE_TYPED_DICTIONARY(String, Variant::STRING) +MAKE_TYPED_DICTIONARY(Vector2, Variant::VECTOR2) +MAKE_TYPED_DICTIONARY(Vector2i, Variant::VECTOR2I) +MAKE_TYPED_DICTIONARY(Rect2, Variant::RECT2) +MAKE_TYPED_DICTIONARY(Rect2i, Variant::RECT2I) +MAKE_TYPED_DICTIONARY(Vector3, Variant::VECTOR3) +MAKE_TYPED_DICTIONARY(Vector3i, Variant::VECTOR3I) +MAKE_TYPED_DICTIONARY(Transform2D, Variant::TRANSFORM2D) +MAKE_TYPED_DICTIONARY(Plane, Variant::PLANE) +MAKE_TYPED_DICTIONARY(Quaternion, Variant::QUATERNION) +MAKE_TYPED_DICTIONARY(AABB, Variant::AABB) +MAKE_TYPED_DICTIONARY(Basis, Variant::BASIS) +MAKE_TYPED_DICTIONARY(Transform3D, Variant::TRANSFORM3D) +MAKE_TYPED_DICTIONARY(Color, Variant::COLOR) +MAKE_TYPED_DICTIONARY(StringName, Variant::STRING_NAME) +MAKE_TYPED_DICTIONARY(NodePath, Variant::NODE_PATH) +MAKE_TYPED_DICTIONARY(RID, Variant::RID) +MAKE_TYPED_DICTIONARY(Callable, Variant::CALLABLE) +MAKE_TYPED_DICTIONARY(Signal, Variant::SIGNAL) +MAKE_TYPED_DICTIONARY(Dictionary, Variant::DICTIONARY) +MAKE_TYPED_DICTIONARY(Array, Variant::ARRAY) +MAKE_TYPED_DICTIONARY(PackedByteArray, Variant::PACKED_BYTE_ARRAY) +MAKE_TYPED_DICTIONARY(PackedInt32Array, Variant::PACKED_INT32_ARRAY) +MAKE_TYPED_DICTIONARY(PackedInt64Array, Variant::PACKED_INT64_ARRAY) +MAKE_TYPED_DICTIONARY(PackedFloat32Array, Variant::PACKED_FLOAT32_ARRAY) +MAKE_TYPED_DICTIONARY(PackedFloat64Array, Variant::PACKED_FLOAT64_ARRAY) +MAKE_TYPED_DICTIONARY(PackedStringArray, Variant::PACKED_STRING_ARRAY) +MAKE_TYPED_DICTIONARY(PackedVector2Array, Variant::PACKED_VECTOR2_ARRAY) +MAKE_TYPED_DICTIONARY(PackedVector3Array, Variant::PACKED_VECTOR3_ARRAY) +MAKE_TYPED_DICTIONARY(PackedColorArray, Variant::PACKED_COLOR_ARRAY) +MAKE_TYPED_DICTIONARY(PackedVector4Array, Variant::PACKED_VECTOR4_ARRAY) +/* +MAKE_TYPED_DICTIONARY(IPAddress, Variant::STRING) +*/ + +#undef MAKE_TYPED_DICTIONARY +#undef MAKE_TYPED_DICTIONARY_NIL +#undef MAKE_TYPED_DICTIONARY_EXPANDED +#undef MAKE_TYPED_DICTIONARY_WITH_OBJECT + +} // namespace godot + +#endif // GODOT_TYPED_DICTIONARY_HPP diff --git a/include/godot_cpp/variant/variant.hpp b/include/godot_cpp/variant/variant.hpp index b0d57fb..4c5f206 100644 --- a/include/godot_cpp/variant/variant.hpp +++ b/include/godot_cpp/variant/variant.hpp @@ -264,6 +264,8 @@ public: operator PackedColorArray() const; operator PackedVector4Array() const; + Object *get_validated_object() const; + Variant &operator=(const Variant &other); Variant &operator=(Variant &&other); bool operator==(const Variant &other) const; @@ -327,8 +329,6 @@ public: bool booleanize() const; String stringify() const; Variant duplicate(bool deep = false) const; - static void blend(const Variant &a, const Variant &b, float c, Variant &r_dst); - static void interpolate(const Variant &a, const Variant &b, float c, Variant &r_dst); static String get_type_name(Variant::Type type); static bool can_convert(Variant::Type from, Variant::Type to); diff --git a/include/godot_cpp/variant/vector4.hpp b/include/godot_cpp/variant/vector4.hpp index 866e522..e0e197f 100644 --- a/include/godot_cpp/variant/vector4.hpp +++ b/include/godot_cpp/variant/vector4.hpp @@ -55,16 +55,17 @@ struct _NO_DISCARD_ Vector4 { real_t z; real_t w; }; - real_t components[4] = { 0, 0, 0, 0 }; + [[deprecated("Use coord instead")]] real_t components[4]; + real_t coord[4] = { 0, 0, 0, 0 }; }; _FORCE_INLINE_ real_t &operator[](const int p_axis) { DEV_ASSERT((unsigned int)p_axis < 4); - return components[p_axis]; + return coord[p_axis]; } _FORCE_INLINE_ const real_t &operator[](const int p_axis) const { DEV_ASSERT((unsigned int)p_axis < 4); - return components[p_axis]; + return coord[p_axis]; } Vector4::Axis min_axis_index() const; diff --git a/src/classes/wrapped.cpp b/src/classes/wrapped.cpp index ffca4f9..e729ba0 100644 --- a/src/classes/wrapped.cpp +++ b/src/classes/wrapped.cpp @@ -39,41 +39,43 @@ #include <godot_cpp/core/class_db.hpp> namespace godot { -thread_local const StringName *Wrapped::_constructing_extension_class_name = nullptr; -thread_local const GDExtensionInstanceBindingCallbacks *Wrapped::_constructing_class_binding_callbacks = nullptr; + +#ifdef _GODOT_CPP_AVOID_THREAD_LOCAL +std::recursive_mutex Wrapped::_constructing_mutex; +#endif + +_GODOT_CPP_THREAD_LOCAL const StringName *Wrapped::_constructing_extension_class_name = nullptr; +_GODOT_CPP_THREAD_LOCAL const GDExtensionInstanceBindingCallbacks *Wrapped::_constructing_class_binding_callbacks = nullptr; + +#ifdef HOT_RELOAD_ENABLED +_GODOT_CPP_THREAD_LOCAL GDExtensionObjectPtr Wrapped::_constructing_recreate_owner = nullptr; +#endif const StringName *Wrapped::_get_extension_class_name() { return nullptr; } void Wrapped::_postinitialize() { - // Only send NOTIFICATION_POSTINITIALIZE for extension classes. - if (_is_extension_class()) { - _notificationv(Object::NOTIFICATION_POSTINITIALIZE); +#ifdef _GODOT_CPP_AVOID_THREAD_LOCAL + Wrapped::_constructing_mutex.unlock(); +#endif + + Object *obj = dynamic_cast<Object *>(this); + if (obj) { + obj->notification(Object::NOTIFICATION_POSTINITIALIZE); } } Wrapped::Wrapped(const StringName p_godot_class) { #ifdef HOT_RELOAD_ENABLED - if (unlikely(Wrapped::recreate_instance)) { - RecreateInstance *recreate_data = Wrapped::recreate_instance; - RecreateInstance *previous = nullptr; - while (recreate_data) { - if (recreate_data->wrapper == this) { - _owner = recreate_data->owner; - if (previous) { - previous->next = recreate_data->next; - } else { - Wrapped::recreate_instance = recreate_data->next; - } - return; - } - previous = recreate_data; - recreate_data = recreate_data->next; - } - } + if (unlikely(Wrapped::_constructing_recreate_owner)) { + _owner = Wrapped::_constructing_recreate_owner; + Wrapped::_constructing_recreate_owner = nullptr; + } else #endif - _owner = godot::internal::gdextension_interface_classdb_construct_object(reinterpret_cast<GDExtensionConstStringNamePtr>(p_godot_class._native_ptr())); + { + _owner = godot::internal::gdextension_interface_classdb_construct_object2(reinterpret_cast<GDExtensionConstStringNamePtr>(p_godot_class._native_ptr())); + } if (_constructing_extension_class_name) { godot::internal::gdextension_interface_object_set_instance(_owner, reinterpret_cast<GDExtensionConstStringNamePtr>(_constructing_extension_class_name), this); diff --git a/src/godot.cpp b/src/godot.cpp index f6d0d43..fe75e6e 100644 --- a/src/godot.cpp +++ b/src/godot.cpp @@ -88,6 +88,7 @@ GDExtensionInterfaceVariantGetType gdextension_interface_variant_get_type = null GDExtensionInterfaceVariantHasMethod gdextension_interface_variant_has_method = nullptr; GDExtensionInterfaceVariantHasMember gdextension_interface_variant_has_member = nullptr; GDExtensionInterfaceVariantHasKey gdextension_interface_variant_has_key = nullptr; +GDExtensionInterfaceVariantGetObjectInstanceId gdextension_interface_variant_get_object_instance_id = nullptr; GDExtensionInterfaceVariantGetTypeName gdextension_interface_variant_get_type_name = nullptr; GDExtensionInterfaceVariantCanConvert gdextension_interface_variant_can_convert = nullptr; GDExtensionInterfaceVariantCanConvertStrict gdextension_interface_variant_can_convert_strict = nullptr; @@ -164,6 +165,7 @@ GDExtensionInterfaceArrayRef gdextension_interface_array_ref = nullptr; GDExtensionInterfaceArraySetTyped gdextension_interface_array_set_typed = nullptr; GDExtensionInterfaceDictionaryOperatorIndex gdextension_interface_dictionary_operator_index = nullptr; GDExtensionInterfaceDictionaryOperatorIndexConst gdextension_interface_dictionary_operator_index_const = nullptr; +GDExtensionInterfaceDictionarySetTyped gdextension_interface_dictionary_set_typed = nullptr; GDExtensionInterfaceObjectMethodBindCall gdextension_interface_object_method_bind_call = nullptr; GDExtensionInterfaceObjectMethodBindPtrcall gdextension_interface_object_method_bind_ptrcall = nullptr; GDExtensionInterfaceObjectDestroy gdextension_interface_object_destroy = nullptr; @@ -185,10 +187,10 @@ GDExtensionInterfaceRefSetObject gdextension_interface_ref_set_object = nullptr; GDExtensionInterfaceScriptInstanceCreate3 gdextension_interface_script_instance_create3 = nullptr; GDExtensionInterfacePlaceHolderScriptInstanceCreate gdextension_interface_placeholder_script_instance_create = nullptr; GDExtensionInterfacePlaceHolderScriptInstanceUpdate gdextension_interface_placeholder_script_instance_update = nullptr; -GDExtensionInterfaceClassdbConstructObject gdextension_interface_classdb_construct_object = nullptr; +GDExtensionInterfaceClassdbConstructObject2 gdextension_interface_classdb_construct_object2 = nullptr; GDExtensionInterfaceClassdbGetMethodBind gdextension_interface_classdb_get_method_bind = nullptr; GDExtensionInterfaceClassdbGetClassTag gdextension_interface_classdb_get_class_tag = nullptr; -GDExtensionInterfaceClassdbRegisterExtensionClass3 gdextension_interface_classdb_register_extension_class3 = nullptr; +GDExtensionInterfaceClassdbRegisterExtensionClass4 gdextension_interface_classdb_register_extension_class4 = nullptr; GDExtensionInterfaceClassdbRegisterExtensionClassMethod gdextension_interface_classdb_register_extension_class_method = nullptr; GDExtensionInterfaceClassdbRegisterExtensionClassVirtualMethod gdextension_interface_classdb_register_extension_class_virtual_method = nullptr; GDExtensionInterfaceClassdbRegisterExtensionClassIntegerConstant gdextension_interface_classdb_register_extension_class_integer_constant = nullptr; @@ -367,6 +369,7 @@ GDExtensionBool GDExtensionBinding::init(GDExtensionInterfaceGetProcAddress p_ge LOAD_PROC_ADDRESS(variant_has_method, GDExtensionInterfaceVariantHasMethod); LOAD_PROC_ADDRESS(variant_has_member, GDExtensionInterfaceVariantHasMember); LOAD_PROC_ADDRESS(variant_has_key, GDExtensionInterfaceVariantHasKey); + LOAD_PROC_ADDRESS(variant_get_object_instance_id, GDExtensionInterfaceVariantGetObjectInstanceId); LOAD_PROC_ADDRESS(variant_get_type_name, GDExtensionInterfaceVariantGetTypeName); LOAD_PROC_ADDRESS(variant_can_convert, GDExtensionInterfaceVariantCanConvert); LOAD_PROC_ADDRESS(variant_can_convert_strict, GDExtensionInterfaceVariantCanConvertStrict); @@ -443,6 +446,7 @@ GDExtensionBool GDExtensionBinding::init(GDExtensionInterfaceGetProcAddress p_ge LOAD_PROC_ADDRESS(array_set_typed, GDExtensionInterfaceArraySetTyped); LOAD_PROC_ADDRESS(dictionary_operator_index, GDExtensionInterfaceDictionaryOperatorIndex); LOAD_PROC_ADDRESS(dictionary_operator_index_const, GDExtensionInterfaceDictionaryOperatorIndexConst); + LOAD_PROC_ADDRESS(dictionary_set_typed, GDExtensionInterfaceDictionarySetTyped); LOAD_PROC_ADDRESS(object_method_bind_call, GDExtensionInterfaceObjectMethodBindCall); LOAD_PROC_ADDRESS(object_method_bind_ptrcall, GDExtensionInterfaceObjectMethodBindPtrcall); LOAD_PROC_ADDRESS(object_destroy, GDExtensionInterfaceObjectDestroy); @@ -464,10 +468,10 @@ GDExtensionBool GDExtensionBinding::init(GDExtensionInterfaceGetProcAddress p_ge LOAD_PROC_ADDRESS(script_instance_create3, GDExtensionInterfaceScriptInstanceCreate3); LOAD_PROC_ADDRESS(placeholder_script_instance_create, GDExtensionInterfacePlaceHolderScriptInstanceCreate); LOAD_PROC_ADDRESS(placeholder_script_instance_update, GDExtensionInterfacePlaceHolderScriptInstanceUpdate); - LOAD_PROC_ADDRESS(classdb_construct_object, GDExtensionInterfaceClassdbConstructObject); + LOAD_PROC_ADDRESS(classdb_construct_object2, GDExtensionInterfaceClassdbConstructObject2); LOAD_PROC_ADDRESS(classdb_get_method_bind, GDExtensionInterfaceClassdbGetMethodBind); LOAD_PROC_ADDRESS(classdb_get_class_tag, GDExtensionInterfaceClassdbGetClassTag); - LOAD_PROC_ADDRESS(classdb_register_extension_class3, GDExtensionInterfaceClassdbRegisterExtensionClass3); + LOAD_PROC_ADDRESS(classdb_register_extension_class4, GDExtensionInterfaceClassdbRegisterExtensionClass4); LOAD_PROC_ADDRESS(classdb_register_extension_class_method, GDExtensionInterfaceClassdbRegisterExtensionClassMethod); LOAD_PROC_ADDRESS(classdb_register_extension_class_virtual_method, GDExtensionInterfaceClassdbRegisterExtensionClassVirtualMethod); LOAD_PROC_ADDRESS(classdb_register_extension_class_integer_constant, GDExtensionInterfaceClassdbRegisterExtensionClassIntegerConstant); diff --git a/src/variant/basis.cpp b/src/variant/basis.cpp index 200cd06..d8a9919 100644 --- a/src/variant/basis.cpp +++ b/src/variant/basis.cpp @@ -1037,12 +1037,15 @@ void Basis::rotate_sh(real_t *p_values) { p_values[8] = d4 * s_scale_dst4; } -Basis Basis::looking_at(const Vector3 &p_target, const Vector3 &p_up) { +Basis Basis::looking_at(const Vector3 &p_target, const Vector3 &p_up, bool p_use_model_front) { #ifdef MATH_CHECKS ERR_FAIL_COND_V_MSG(p_target.is_zero_approx(), Basis(), "The target vector can't be zero."); ERR_FAIL_COND_V_MSG(p_up.is_zero_approx(), Basis(), "The up vector can't be zero."); #endif - Vector3 v_z = -p_target.normalized(); + Vector3 v_z = p_target.normalized(); + if (!p_use_model_front) { + v_z = -v_z; + } Vector3 v_x = p_up.cross(v_z); #ifdef MATH_CHECKS ERR_FAIL_COND_V_MSG(v_x.is_zero_approx(), Basis(), "The target vector and up vector can't be parallel to each other."); diff --git a/src/variant/packed_arrays.cpp b/src/variant/packed_arrays.cpp index 4384f7a..8fe8a73 100644 --- a/src/variant/packed_arrays.cpp +++ b/src/variant/packed_arrays.cpp @@ -246,4 +246,10 @@ Variant &Dictionary::operator[](const Variant &p_key) { return *var; } +void Dictionary::set_typed(uint32_t p_key_type, const StringName &p_key_class_name, const Variant &p_key_script, uint32_t p_value_type, const StringName &p_value_class_name, const Variant &p_value_script) { + // p_key_type/p_value_type are not Variant::Type so that header doesn't depend on <variant.hpp>. + internal::gdextension_interface_dictionary_set_typed((GDExtensionTypePtr *)this, (GDExtensionVariantType)p_key_type, (GDExtensionConstStringNamePtr)&p_key_class_name, (GDExtensionConstVariantPtr)&p_key_script, + (GDExtensionVariantType)p_value_type, (GDExtensionConstStringNamePtr)&p_value_class_name, (GDExtensionConstVariantPtr)&p_value_script); +} + } // namespace godot diff --git a/src/variant/quaternion.cpp b/src/variant/quaternion.cpp index c010850..3dd7af5 100644 --- a/src/variant/quaternion.cpp +++ b/src/variant/quaternion.cpp @@ -37,28 +37,15 @@ namespace godot { real_t Quaternion::angle_to(const Quaternion &p_to) const { real_t d = dot(p_to); - return Math::acos(CLAMP(d * d * 2 - 1, -1, 1)); + // acos does clamping. + return Math::acos(d * d * 2 - 1); } -// get_euler_xyz returns a vector containing the Euler angles in the format -// (ax,ay,az), where ax is the angle of rotation around x axis, -// and similar for other axes. -// This implementation uses XYZ convention (Z is the first rotation). -Vector3 Quaternion::get_euler_xyz() const { - Basis m(*this); - return m.get_euler(EULER_ORDER_XYZ); -} - -// get_euler_yxz returns a vector containing the Euler angles in the format -// (ax,ay,az), where ax is the angle of rotation around x axis, -// and similar for other axes. -// This implementation uses YXZ convention (Z is the first rotation). -Vector3 Quaternion::get_euler_yxz() const { +Vector3 Quaternion::get_euler(EulerOrder p_order) const { #ifdef MATH_CHECKS - ERR_FAIL_COND_V_MSG(!is_normalized(), Vector3(0, 0, 0), "The quaternion must be normalized."); + ERR_FAIL_COND_V_MSG(!is_normalized(), Vector3(0, 0, 0), "The quaternion " + operator String() + " must be normalized."); #endif - Basis m(*this); - return m.get_euler(EULER_ORDER_YXZ); + return Basis(*this).get_euler(p_order); } void Quaternion::operator*=(const Quaternion &p_q) { @@ -103,7 +90,7 @@ bool Quaternion::is_normalized() const { Quaternion Quaternion::inverse() const { #ifdef MATH_CHECKS - ERR_FAIL_COND_V_MSG(!is_normalized(), Quaternion(), "The quaternion must be normalized."); + ERR_FAIL_COND_V_MSG(!is_normalized(), Quaternion(), "The quaternion " + operator String() + " must be normalized."); #endif return Quaternion(-x, -y, -z, w); } @@ -125,10 +112,10 @@ Quaternion Quaternion::exp() const { return Quaternion(src_v, theta); } -Quaternion Quaternion::slerp(const Quaternion &p_to, const real_t &p_weight) const { +Quaternion Quaternion::slerp(const Quaternion &p_to, real_t p_weight) const { #ifdef MATH_CHECKS - ERR_FAIL_COND_V_MSG(!is_normalized(), Quaternion(), "The start quaternion must be normalized."); - ERR_FAIL_COND_V_MSG(!p_to.is_normalized(), Quaternion(), "The end quaternion must be normalized."); + ERR_FAIL_COND_V_MSG(!is_normalized(), Quaternion(), "The start quaternion " + operator String() + " must be normalized."); + ERR_FAIL_COND_V_MSG(!p_to.is_normalized(), Quaternion(), "The end quaternion " + p_to.operator String() + " must be normalized."); #endif Quaternion to1; real_t omega, cosom, sinom, scale0, scale1; @@ -166,10 +153,10 @@ Quaternion Quaternion::slerp(const Quaternion &p_to, const real_t &p_weight) con scale0 * w + scale1 * to1.w); } -Quaternion Quaternion::slerpni(const Quaternion &p_to, const real_t &p_weight) const { +Quaternion Quaternion::slerpni(const Quaternion &p_to, real_t p_weight) const { #ifdef MATH_CHECKS - ERR_FAIL_COND_V_MSG(!is_normalized(), Quaternion(), "The start quaternion must be normalized."); - ERR_FAIL_COND_V_MSG(!p_to.is_normalized(), Quaternion(), "The end quaternion must be normalized."); + ERR_FAIL_COND_V_MSG(!is_normalized(), Quaternion(), "The start quaternion " + operator String() + " must be normalized."); + ERR_FAIL_COND_V_MSG(!p_to.is_normalized(), Quaternion(), "The end quaternion " + p_to.operator String() + " must be normalized."); #endif const Quaternion &from = *this; @@ -190,10 +177,10 @@ Quaternion Quaternion::slerpni(const Quaternion &p_to, const real_t &p_weight) c invFactor * from.w + newFactor * p_to.w); } -Quaternion Quaternion::spherical_cubic_interpolate(const Quaternion &p_b, const Quaternion &p_pre_a, const Quaternion &p_post_b, const real_t &p_weight) const { +Quaternion Quaternion::spherical_cubic_interpolate(const Quaternion &p_b, const Quaternion &p_pre_a, const Quaternion &p_post_b, real_t p_weight) const { #ifdef MATH_CHECKS - ERR_FAIL_COND_V_MSG(!is_normalized(), Quaternion(), "The start quaternion must be normalized."); - ERR_FAIL_COND_V_MSG(!p_b.is_normalized(), Quaternion(), "The end quaternion must be normalized."); + ERR_FAIL_COND_V_MSG(!is_normalized(), Quaternion(), "The start quaternion " + operator String() + " must be normalized."); + ERR_FAIL_COND_V_MSG(!p_b.is_normalized(), Quaternion(), "The end quaternion " + p_b.operator String() + " must be normalized."); #endif Quaternion from_q = *this; Quaternion pre_q = p_pre_a; @@ -236,15 +223,15 @@ Quaternion Quaternion::spherical_cubic_interpolate(const Quaternion &p_b, const ln.z = Math::cubic_interpolate(ln_from.z, ln_to.z, ln_pre.z, ln_post.z, p_weight); Quaternion q2 = to_q * ln.exp(); - // To cancel error made by Expmap ambiguity, do blends. + // To cancel error made by Expmap ambiguity, do blending. return q1.slerp(q2, p_weight); } -Quaternion Quaternion::spherical_cubic_interpolate_in_time(const Quaternion &p_b, const Quaternion &p_pre_a, const Quaternion &p_post_b, const real_t &p_weight, - const real_t &p_b_t, const real_t &p_pre_a_t, const real_t &p_post_b_t) const { +Quaternion Quaternion::spherical_cubic_interpolate_in_time(const Quaternion &p_b, const Quaternion &p_pre_a, const Quaternion &p_post_b, real_t p_weight, + real_t p_b_t, real_t p_pre_a_t, real_t p_post_b_t) const { #ifdef MATH_CHECKS - ERR_FAIL_COND_V_MSG(!is_normalized(), Quaternion(), "The start quaternion must be normalized."); - ERR_FAIL_COND_V_MSG(!p_b.is_normalized(), Quaternion(), "The end quaternion must be normalized."); + ERR_FAIL_COND_V_MSG(!is_normalized(), Quaternion(), "The start quaternion " + operator String() + " must be normalized."); + ERR_FAIL_COND_V_MSG(!p_b.is_normalized(), Quaternion(), "The end quaternion " + p_b.operator String() + " must be normalized."); #endif Quaternion from_q = *this; Quaternion pre_q = p_pre_a; @@ -287,7 +274,7 @@ Quaternion Quaternion::spherical_cubic_interpolate_in_time(const Quaternion &p_b ln.z = Math::cubic_interpolate_in_time(ln_from.z, ln_to.z, ln_pre.z, ln_post.z, p_weight, p_b_t, p_pre_a_t, p_post_b_t); Quaternion q2 = to_q * ln.exp(); - // To cancel error made by Expmap ambiguity, do blends. + // To cancel error made by Expmap ambiguity, do blending. return q1.slerp(q2, p_weight); } @@ -309,7 +296,7 @@ real_t Quaternion::get_angle() const { Quaternion::Quaternion(const Vector3 &p_axis, real_t p_angle) { #ifdef MATH_CHECKS - ERR_FAIL_COND_MSG(!p_axis.is_normalized(), "The axis Vector3 must be normalized."); + ERR_FAIL_COND_MSG(!p_axis.is_normalized(), "The axis Vector3 " + p_axis.operator String() + " must be normalized."); #endif real_t d = p_axis.length(); if (d == 0) { @@ -332,7 +319,7 @@ Quaternion::Quaternion(const Vector3 &p_axis, real_t p_angle) { // (ax, ay, az), where ax is the angle of rotation around x axis, // and similar for other axes. // This implementation uses YXZ convention (Z is the first rotation). -Quaternion::Quaternion(const Vector3 &p_euler) { +Quaternion Quaternion::from_euler(const Vector3 &p_euler) { real_t half_a1 = p_euler.y * 0.5f; real_t half_a2 = p_euler.x * 0.5f; real_t half_a3 = p_euler.z * 0.5f; @@ -348,10 +335,11 @@ Quaternion::Quaternion(const Vector3 &p_euler) { real_t cos_a3 = Math::cos(half_a3); real_t sin_a3 = Math::sin(half_a3); - x = sin_a1 * cos_a2 * sin_a3 + cos_a1 * sin_a2 * cos_a3; - y = sin_a1 * cos_a2 * cos_a3 - cos_a1 * sin_a2 * sin_a3; - z = -sin_a1 * sin_a2 * cos_a3 + cos_a1 * cos_a2 * sin_a3; - w = sin_a1 * sin_a2 * sin_a3 + cos_a1 * cos_a2 * cos_a3; + return Quaternion( + sin_a1 * cos_a2 * sin_a3 + cos_a1 * sin_a2 * cos_a3, + sin_a1 * cos_a2 * cos_a3 - cos_a1 * sin_a2 * sin_a3, + -sin_a1 * sin_a2 * cos_a3 + cos_a1 * cos_a2 * sin_a3, + sin_a1 * sin_a2 * sin_a3 + cos_a1 * cos_a2 * cos_a3); } } // namespace godot diff --git a/src/variant/variant.cpp b/src/variant/variant.cpp index 9dcf705..1f57d48 100644 --- a/src/variant/variant.cpp +++ b/src/variant/variant.cpp @@ -448,12 +448,7 @@ Variant::operator ObjectID() const { if (get_type() == Type::INT) { return ObjectID(operator uint64_t()); } else if (get_type() == Type::OBJECT) { - Object *obj = operator Object *(); - if (obj != nullptr) { - return ObjectID(obj->get_instance_id()); - } else { - return ObjectID(); - } + return ObjectID(internal::gdextension_interface_variant_get_object_instance_id(_native_ptr())); } else { return ObjectID(); } @@ -515,6 +510,10 @@ Variant::operator PackedVector4Array() const { return PackedVector4Array(this); } +Object *Variant::get_validated_object() const { + return ObjectDB::get_instance(operator ObjectID()); +} + Variant &Variant::operator=(const Variant &other) { clear(); internal::gdextension_interface_variant_new_copy(_native_ptr(), other._native_ptr()); diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt index 42ea6e0..f1c4c0d 100644 --- a/test/CMakeLists.txt +++ b/test/CMakeLists.txt @@ -38,6 +38,7 @@ if ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "MSVC") # using Visual Studio C++ set(GODOT_COMPILE_FLAGS "${GODOT_COMPILE_FLAGS} /WX") # /GF /MP set(GODOT_COMPILE_FLAGS "${GODOT_COMPILE_FLAGS} /DTYPED_METHOD_BIND") + set(GODOT_COMPILE_FLAGS "${GODOT_COMPILE_FLAGS} /utf-8") if(CMAKE_BUILD_TYPE MATCHES Debug) set(GODOT_COMPILE_FLAGS "${GODOT_COMPILE_FLAGS} /MDd") # /Od /RTC1 /Zi diff --git a/test/SConstruct b/test/SConstruct index 1f1db0f..b949bca 100644 --- a/test/SConstruct +++ b/test/SConstruct @@ -42,4 +42,5 @@ else: source=sources, ) +env.NoCache(library) Default(library) diff --git a/test/project/main.gd b/test/project/main.gd index b2625b9..e5a3b95 100644 --- a/test/project/main.gd +++ b/test/project/main.gd @@ -81,10 +81,13 @@ func _ready(): # Array and Dictionary assert_equal(example.test_array(), [1, 2]) - assert_equal(example.test_tarray(), [ Vector2(1, 2), Vector2(2, 3) ]) - assert_equal(example.test_dictionary(), {"hello": "world", "foo": "bar"}) + assert_equal(example.test_tarray(), [Vector2(1, 2), Vector2(2, 3)]) var array: Array[int] = [1, 2, 3] assert_equal(example.test_tarray_arg(array), 6) + assert_equal(example.test_dictionary(), { "hello": "world", "foo": "bar" }) + assert_equal(example.test_tdictionary(), { Vector2(1, 2): Vector2i(2, 3) }) + var dictionary: Dictionary[String, int] = { "1": 1, "2": 2, "3": 3 } + assert_equal(example.test_tdictionary_arg(dictionary), 6) example.callable_bind() assert_equal(custom_signal_emitted, ["bound", 11]) @@ -206,6 +209,12 @@ func _ready(): assert_equal(example.test_variant_float_conversion(10.0), 10.0) assert_equal(example.test_variant_float_conversion(10), 10.0) + # Test checking if objects are valid. + var object_of_questionable_validity = Object.new() + assert_equal(example.test_object_is_valid(object_of_questionable_validity), true) + object_of_questionable_validity.free() + assert_equal(example.test_object_is_valid(object_of_questionable_validity), false) + # Test that ptrcalls from GDExtension to the engine are correctly encoding Object and RefCounted. var new_node = Node.new() example.test_add_child(new_node) @@ -276,6 +285,10 @@ func _ready(): assert_equal(library_path, ProjectSettings.globalize_path(library_path)) assert_equal(FileAccess.file_exists(library_path), true) + # Test a class with a unicode name. + var przykład = ExamplePrzykład.new() + assert_equal(przykład.get_the_word(), "słowo to przykład") + exit_with_status() func _on_Example_custom_signal(signal_name, value): diff --git a/test/src/example.cpp b/test/src/example.cpp index 8075f55..22739b2 100644 --- a/test/src/example.cpp +++ b/test/src/example.cpp @@ -199,6 +199,8 @@ void Example::_bind_methods() { ClassDB::bind_method(D_METHOD("test_tarray_arg", "array"), &Example::test_tarray_arg); ClassDB::bind_method(D_METHOD("test_tarray"), &Example::test_tarray); ClassDB::bind_method(D_METHOD("test_dictionary"), &Example::test_dictionary); + ClassDB::bind_method(D_METHOD("test_tdictionary_arg", "dictionary"), &Example::test_tdictionary_arg); + ClassDB::bind_method(D_METHOD("test_tdictionary"), &Example::test_tdictionary); ClassDB::bind_method(D_METHOD("test_node_argument"), &Example::test_node_argument); ClassDB::bind_method(D_METHOD("test_string_ops"), &Example::test_string_ops); ClassDB::bind_method(D_METHOD("test_str_utility"), &Example::test_str_utility); @@ -215,6 +217,7 @@ void Example::_bind_methods() { ClassDB::bind_method(D_METHOD("test_variant_vector2i_conversion", "variant"), &Example::test_variant_vector2i_conversion); ClassDB::bind_method(D_METHOD("test_variant_int_conversion", "variant"), &Example::test_variant_int_conversion); ClassDB::bind_method(D_METHOD("test_variant_float_conversion", "variant"), &Example::test_variant_float_conversion); + ClassDB::bind_method(D_METHOD("test_object_is_valid", "variant"), &Example::test_object_is_valid); ClassDB::bind_method(D_METHOD("test_add_child", "node"), &Example::test_add_child); ClassDB::bind_method(D_METHOD("test_set_tileset", "tilemap", "tileset"), &Example::test_set_tileset); @@ -551,6 +554,23 @@ Dictionary Example::test_dictionary() const { return dict; } +int Example::test_tdictionary_arg(const TypedDictionary<String, int64_t> &p_dictionary) { + int sum = 0; + TypedArray<int64_t> values = p_dictionary.values(); + for (int i = 0; i < p_dictionary.size(); i++) { + sum += (int)values[i]; + } + return sum; +} + +TypedDictionary<Vector2, Vector2i> Example::test_tdictionary() const { + TypedDictionary<Vector2, Vector2i> dict; + + dict[Vector2(1, 2)] = Vector2i(2, 3); + + return dict; +} + Example *Example::test_node_argument(Example *p_node) const { return p_node; } @@ -579,6 +599,10 @@ float Example::test_variant_float_conversion(const Variant &p_variant) const { return p_variant; } +bool Example::test_object_is_valid(const Variant &p_variant) const { + return static_cast<bool>(p_variant.get_validated_object()); +} + void Example::test_add_child(Node *p_node) { add_child(p_node); } @@ -736,3 +760,11 @@ ExampleRuntime::ExampleRuntime() { ExampleRuntime::~ExampleRuntime() { } + +void ExamplePrzykład::_bind_methods() { + ClassDB::bind_method(D_METHOD("get_the_word"), &ExamplePrzykład::get_the_word); +} + +String ExamplePrzykład::get_the_word() const { + return U"słowo to przykład"; +} diff --git a/test/src/example.h b/test/src/example.h index 6d88cf1..a7ae54c 100644 --- a/test/src/example.h +++ b/test/src/example.h @@ -129,6 +129,8 @@ public: int test_tarray_arg(const TypedArray<int64_t> &p_array); TypedArray<Vector2> test_tarray() const; Dictionary test_dictionary() const; + int test_tdictionary_arg(const TypedDictionary<String, int64_t> &p_dictionary); + TypedDictionary<Vector2, Vector2i> test_tdictionary() const; Example *test_node_argument(Example *p_node) const; String test_string_ops() const; String test_str_utility() const; @@ -145,6 +147,7 @@ public: Vector2i test_variant_vector2i_conversion(const Variant &p_variant) const; int test_variant_int_conversion(const Variant &p_variant) const; float test_variant_float_conversion(const Variant &p_variant) const; + bool test_object_is_valid(const Variant &p_variant) const; void test_add_child(Node *p_node); void test_set_tileset(TileMap *p_tilemap, const Ref<TileSet> &p_tileset) const; @@ -273,4 +276,14 @@ public: ~ExampleRuntime(); }; +class ExamplePrzykład : public RefCounted { + GDCLASS(ExamplePrzykład, RefCounted); + +protected: + static void _bind_methods(); + +public: + String get_the_word() const; +}; + #endif // EXAMPLE_CLASS_H diff --git a/test/src/register_types.cpp b/test/src/register_types.cpp index 7cfe689..d9290c8 100644 --- a/test/src/register_types.cpp +++ b/test/src/register_types.cpp @@ -30,6 +30,7 @@ void initialize_example_module(ModuleInitializationLevel p_level) { GDREGISTER_CLASS(ExampleBase); GDREGISTER_CLASS(ExampleChild); GDREGISTER_RUNTIME_CLASS(ExampleRuntime); + GDREGISTER_CLASS(ExamplePrzykład); } void uninitialize_example_module(ModuleInitializationLevel p_level) { diff --git a/tools/common_compiler_flags.py b/tools/common_compiler_flags.py index 5bade45..6a1fb69 100644 --- a/tools/common_compiler_flags.py +++ b/tools/common_compiler_flags.py @@ -74,7 +74,7 @@ def generate(env): else: env.Append(CCFLAGS=["-g2"]) else: - if using_clang(env) and not is_vanilla_clang(env): + if using_clang(env) and not is_vanilla_clang(env) and not env["use_mingw"]: # Apple Clang, its linker doesn't like -s. env.Append(LINKFLAGS=["-Wl,-S", "-Wl,-x", "-Wl,-dead_strip"]) else: diff --git a/tools/godotcpp.py b/tools/godotcpp.py index 9ceac02..b2a63dc 100644 --- a/tools/godotcpp.py +++ b/tools/godotcpp.py @@ -552,6 +552,7 @@ def _godot_cpp(env): if env["build_library"]: library = env.StaticLibrary(target=env.File("bin/%s" % library_name), source=sources) + env.NoCache(library) default_args = [library] # Add compiledb if the option is set diff --git a/tools/web.py b/tools/web.py index c8f07c5..e878a78 100644 --- a/tools/web.py +++ b/tools/web.py @@ -42,6 +42,10 @@ def generate(env): env.Append(CCFLAGS=["-sSIDE_MODULE=1"]) env.Append(LINKFLAGS=["-sSIDE_MODULE=1"]) + # Enable WebAssembly BigInt <-> i64 conversion. + # This must match the flag used to build Godot (true in official builds since 4.3) + env.Append(LINKFLAGS=["-sWASM_BIGINT"]) + # Force wasm longjmp mode. env.Append(CCFLAGS=["-sSUPPORT_LONGJMP='wasm'"]) env.Append(LINKFLAGS=["-sSUPPORT_LONGJMP='wasm'"]) diff --git a/tools/windows.py b/tools/windows.py index 9e2672a..2e8d609 100644 --- a/tools/windows.py +++ b/tools/windows.py @@ -1,3 +1,4 @@ +import os import sys import common_compiler_flags @@ -72,10 +73,13 @@ def silence_msvc(env): def options(opts): + mingw = os.getenv("MINGW_PREFIX", "") + opts.Add(BoolVariable("use_mingw", "Use the MinGW compiler instead of MSVC - only effective on Windows", False)) - opts.Add(BoolVariable("use_clang_cl", "Use the clang driver instead of MSVC - only effective on Windows", False)) opts.Add(BoolVariable("use_static_cpp", "Link MinGW/MSVC C++ runtime libraries statically", True)) opts.Add(BoolVariable("silence_msvc", "Silence MSVC's cl/link stdout bloat, redirecting errors to stderr.", True)) + opts.Add(BoolVariable("use_llvm", "Use the LLVM compiler (MVSC or MinGW depending on the use_mingw flag)", False)) + opts.Add("mingw_prefix", "MinGW prefix", mingw) def exists(env): @@ -86,12 +90,22 @@ def generate(env): if not env["use_mingw"] and msvc.exists(env): if env["arch"] == "x86_64": env["TARGET_ARCH"] = "amd64" + elif env["arch"] == "arm64": + env["TARGET_ARCH"] = "arm64" + elif env["arch"] == "arm32": + env["TARGET_ARCH"] = "arm" elif env["arch"] == "x86_32": env["TARGET_ARCH"] = "x86" + + env["MSVC_SETUP_RUN"] = False # Need to set this to re-run the tool + env["MSVS_VERSION"] = None + env["MSVC_VERSION"] = None + env["is_msvc"] = True # MSVC, linker, and archiver. msvc.generate(env) + env.Tool("msvc") env.Tool("mslib") env.Tool("mslink") @@ -99,7 +113,7 @@ def generate(env): env.Append(CCFLAGS=["/utf-8"]) env.Append(LINKFLAGS=["/WX"]) - if env["use_clang_cl"]: + if env["use_llvm"]: env["CC"] = "clang-cl" env["CXX"] = "clang-cl" @@ -111,7 +125,7 @@ def generate(env): if env["silence_msvc"] and not env.GetOption("clean"): silence_msvc(env) - elif sys.platform == "win32" or sys.platform == "msys": + elif (sys.platform == "win32" or sys.platform == "msys") and not env["mingw_prefix"]: env["use_mingw"] = True mingw.generate(env) # Don't want lib prefixes @@ -137,12 +151,32 @@ def generate(env): else: env["use_mingw"] = True # Cross-compilation using MinGW - prefix = "i686" if env["arch"] == "x86_32" else env["arch"] - env["CXX"] = prefix + "-w64-mingw32-g++" - env["CC"] = prefix + "-w64-mingw32-gcc" - env["AR"] = prefix + "-w64-mingw32-ar" - env["RANLIB"] = prefix + "-w64-mingw32-ranlib" - env["LINK"] = prefix + "-w64-mingw32-g++" + prefix = "" + if env["mingw_prefix"]: + prefix = env["mingw_prefix"] + "/bin/" + + if env["arch"] == "x86_64": + prefix += "x86_64" + elif env["arch"] == "arm64": + prefix += "aarch64" + elif env["arch"] == "arm32": + prefix += "armv7" + elif env["arch"] == "x86_32": + prefix += "i686" + + if env["use_llvm"]: + env["CXX"] = prefix + "-w64-mingw32-clang++" + env["CC"] = prefix + "-w64-mingw32-clang" + env["AR"] = prefix + "-w64-mingw32-llvm-ar" + env["RANLIB"] = prefix + "-w64-mingw32-ranlib" + env["LINK"] = prefix + "-w64-mingw32-clang" + else: + env["CXX"] = prefix + "-w64-mingw32-g++" + env["CC"] = prefix + "-w64-mingw32-gcc" + env["AR"] = prefix + "-w64-mingw32-gcc-ar" + env["RANLIB"] = prefix + "-w64-mingw32-ranlib" + env["LINK"] = prefix + "-w64-mingw32-g++" + # Want dll suffix env["SHLIBSUFFIX"] = ".dll" @@ -156,6 +190,11 @@ def generate(env): "-static-libstdc++", ] ) + if env["use_llvm"]: + env.Append(LINKFLAGS=["-lstdc++"]) + + if sys.platform == "win32" or sys.platform == "msys": + my_spawn.configure(env) env.Append(CPPDEFINES=["WINDOWS_ENABLED"]) |