summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--.github/workflows/ci.yml8
-rw-r--r--.github/workflows/static_checks.yml2
-rw-r--r--README.md43
-rw-r--r--SConstruct256
-rw-r--r--binding_generator.py137
-rw-r--r--gdextension/extension_api.json3413
-rw-r--r--gdextension/gdextension_interface.h167
-rw-r--r--include/godot_cpp/classes/wrapped.hpp49
-rw-r--r--include/godot_cpp/core/class_db.hpp20
-rw-r--r--include/godot_cpp/core/method_ptrcall.hpp2
-rw-r--r--include/godot_cpp/core/property_info.hpp12
-rw-r--r--include/godot_cpp/godot.hpp7
-rw-r--r--include/godot_cpp/templates/cowdata.hpp11
-rw-r--r--include/godot_cpp/variant/variant.hpp2
-rw-r--r--include/godot_cpp/variant/vector3.hpp8
-rw-r--r--include/godot_cpp/variant/vector3i.hpp8
-rw-r--r--include/godot_cpp/variant/vector4.hpp8
-rw-r--r--include/godot_cpp/variant/vector4i.hpp8
-rw-r--r--src/godot.cpp69
-rw-r--r--src/variant/char_string.cpp4
-rw-r--r--test/project/example.gdextension2
-rw-r--r--test/project/main.gd50
-rw-r--r--test/project/project.godot2
-rw-r--r--test/src/example.cpp62
-rw-r--r--test/src/example.h15
-rw-r--r--tools/android.py4
-rw-r--r--tools/godotcpp.py310
-rw-r--r--tools/ios.py37
-rw-r--r--tools/ios_osxcross.py26
-rw-r--r--tools/javascript.py4
-rw-r--r--tools/linux.py2
-rw-r--r--tools/macos.py34
-rw-r--r--tools/macos_osxcross.py28
-rw-r--r--tools/targets.py82
-rw-r--r--tools/windows.py40
35 files changed, 4353 insertions, 579 deletions
diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml
index 30c7668..7e61692 100644
--- a/.github/workflows/ci.yml
+++ b/.github/workflows/ci.yml
@@ -83,7 +83,7 @@ jobs:
steps:
- name: Checkout
- uses: actions/checkout@v3
+ uses: actions/checkout@v4
with:
submodules: recursive
@@ -168,7 +168,7 @@ jobs:
runs-on: ubuntu-20.04
steps:
- name: Checkout
- uses: actions/checkout@v3
+ uses: actions/checkout@v4
with:
submodules: recursive
@@ -192,7 +192,7 @@ jobs:
runs-on: ubuntu-20.04
steps:
- name: Checkout
- uses: actions/checkout@v3
+ uses: actions/checkout@v4
with:
submodules: recursive
@@ -216,7 +216,7 @@ jobs:
runs-on: windows-2019
steps:
- name: Checkout
- uses: actions/checkout@v3
+ uses: actions/checkout@v4
with:
submodules: recursive
diff --git a/.github/workflows/static_checks.yml b/.github/workflows/static_checks.yml
index 16cbb8b..f3c588a 100644
--- a/.github/workflows/static_checks.yml
+++ b/.github/workflows/static_checks.yml
@@ -11,7 +11,7 @@ jobs:
runs-on: ubuntu-20.04
steps:
- name: Checkout
- uses: actions/checkout@v3
+ uses: actions/checkout@v4
# Azure repositories are not reliable, we need to prevent Azure giving us packages.
- name: Make apt sources.list use the default Ubuntu repositories
diff --git a/README.md b/README.md
index 4a0dcea..c36e892 100644
--- a/README.md
+++ b/README.md
@@ -2,11 +2,15 @@
> **Warning**
>
-> This repository's `master` branch is only usable with the latest version of
-> Godot's ([GDExtension](https://godotengine.org/article/introducing-gd-extensions))
-> API (Godot 4.1 and later).
+> This repository's `master` branch is only usable with
+> [GDExtension](https://godotengine.org/article/introducing-gd-extensions)
+> from Godot's `master` branch.
>
-> For users of Godot 4.0.x, switch to the [`4.0`](https://github.com/godotengine/godot-cpp/tree/4.0) branch.
+> For users of stable branches, switch to the branch matching your target Godot version:
+> - [`4.0`](https://github.com/godotengine/godot-cpp/tree/4.0)
+> - [`4.1`](https://github.com/godotengine/godot-cpp/tree/4.1)
+>
+> Or check out the Git tag matching your Godot version (e.g. `godot-4.1.1-stable`).
>
> For GDNative users (Godot 3.x), switch to the [`3.x`](https://github.com/godotengine/godot-cpp/tree/3.x)
> or the [`3.5`](https://github.com/godotengine/godot-cpp/tree/3.5) branch.
@@ -52,9 +56,10 @@ first-party `godot-cpp` extension.
Some compatibility breakage is to be expected as GDExtension and `godot-cpp`
get more used, documented, and critical issues get resolved. See the
-[issue tracker](https://github.com/godotengine/godot/issues) for a list of known
-issues, and be sure to provide feedback on issues and PRs which affect your use
-of this extension.
+[Godot issue tracker](https://github.com/godotengine/godot/issues?q=is%3Aissue+is%3Aopen+label%3Atopic%3Agdextension)
+and the [godot-cpp issue tracker](https://github.com/godotengine/godot/issues)
+for a list of known issues, and be sure to provide feedback on issues and PRs
+which affect your use of this extension.
## Contributing
@@ -76,22 +81,22 @@ just like before.
To use the shared lib in your Godot project you'll need a `.gdextension`
file, which replaces what was the `.gdnlib` before.
-Follow [the example](test/demo/example.gdextension):
+See [example.gdextension](test/project/example.gdextension) used in the test project:
```ini
[configuration]
entry_symbol = "example_library_init"
-compatibility_minimum = 4.1
+compatibility_minimum = "4.1"
[libraries]
-macos.debug = "bin/libgdexample.macos.debug.framework"
-macos.release = "bin/libgdexample.macos.release.framework"
-windows.debug.x86_64 = "bin/libgdexample.windows.debug.x86_64.dll"
-windows.release.x86_64 = "bin/libgdexample.windows.release.x86_64.dll"
-linux.debug.x86_64 = "bin/libgdexample.linux.debug.x86_64.so"
-linux.release.x86_64 = "bin/libgdexample.linux.release.x86_64.so"
+macos.debug = "res://bin/libgdexample.macos.debug.framework"
+macos.release = "res://bin/libgdexample.macos.release.framework"
+windows.debug.x86_64 = "res://bin/libgdexample.windows.debug.x86_64.dll"
+windows.release.x86_64 = "res://bin/libgdexample.windows.release.x86_64.dll"
+linux.debug.x86_64 = "res://bin/libgdexample.linux.debug.x86_64.so"
+linux.release.x86_64 = "res://bin/libgdexample.linux.release.x86_64.so"
# Repeat for other architectures to support arm64, rv64, etc.
```
@@ -129,6 +134,10 @@ void initialize_example_module(ModuleInitializationLevel p_level) {
Any node and resource you register will be available in the corresponding `Create...` dialog. Any class will be available to scripting as well.
-## Included example
+## Examples and templates
+
+See the [godot-cpp-template](https://github.com/godotengine/godot-cpp-template) project for a
+generic reusable template.
-Check the project in the `test` folder for an example on how to use and register different things.
+Or checkout the code for the [Summator example](https://github.com/paddy-exe/GDExtensionSummator)
+as shown in the [official documentation](https://docs.godotengine.org/en/latest/tutorials/scripting/gdextension/gdextension_cpp_example.html).
diff --git a/SConstruct b/SConstruct
index 11ec4cf..e8817b0 100644
--- a/SConstruct
+++ b/SConstruct
@@ -5,51 +5,10 @@ import platform
import sys
import subprocess
from binding_generator import scons_generate_bindings, scons_emit_files
-from SCons.Errors import UserError
-
-EnsureSConsVersion(4, 0)
-
-
-def add_sources(sources, dir, extension):
- for f in os.listdir(dir):
- if f.endswith("." + extension):
- sources.append(dir + "/" + f)
-
-
-def normalize_path(val):
- return val if os.path.isabs(val) else os.path.join(env.Dir("#").abspath, val)
-
-
-def validate_api_file(key, val, env):
- if not os.path.isfile(normalize_path(val)):
- raise UserError("GDExtension API file ('%s') does not exist: %s" % (key, val))
-
-
-def validate_gdextension_dir(key, val, env):
- if not os.path.isdir(normalize_path(val)):
- raise UserError("GDExtension directory ('%s') does not exist: %s" % (key, val))
-def get_gdextension_dir(env):
- return normalize_path(env.get("gdextension_dir", env.Dir("gdextension").abspath))
-
-
-def get_api_file(env):
- return normalize_path(env.get("custom_api_file", os.path.join(get_gdextension_dir(env), "extension_api.json")))
-
+EnsureSConsVersion(4, 0)
-# Try to detect the host platform automatically.
-# This is used if no `platform` argument is passed
-if sys.platform.startswith("linux"):
- default_platform = "linux"
-elif sys.platform == "darwin":
- default_platform = "macos"
-elif sys.platform == "win32" or sys.platform == "msys":
- default_platform = "windows"
-elif ARGUMENTS.get("platform", ""):
- default_platform = ARGUMENTS.get("platform")
-else:
- raise ValueError("Could not detect platform automatically, please specify with platform=<platform>")
try:
Import("env")
@@ -60,24 +19,6 @@ except:
env.PrependENVPath("PATH", os.getenv("PATH"))
-# Default num_jobs to local cpu count if not user specified.
-# SCons has a peculiarity where user-specified options won't be overridden
-# by SetOption, so we can rely on this to know if we should use our default.
-initial_num_jobs = env.GetOption("num_jobs")
-altered_num_jobs = initial_num_jobs + 1
-env.SetOption("num_jobs", altered_num_jobs)
-if env.GetOption("num_jobs") == altered_num_jobs:
- cpu_count = os.cpu_count()
- if cpu_count is None:
- print("Couldn't auto-detect CPU count to configure build parallelism. Specify it with the -j argument.")
- else:
- safer_cpu_count = cpu_count if cpu_count <= 4 else cpu_count - 1
- print(
- "Auto-detected %d CPU cores available for build parallelism. Using %d cores by default. You can override it with the -j argument."
- % (cpu_count, safer_cpu_count)
- )
- env.SetOption("num_jobs", safer_cpu_count)
-
# Custom options and profile flags.
customs = ["custom.py"]
profile = ARGUMENTS.get("profile", "")
@@ -87,142 +28,11 @@ if profile:
elif os.path.isfile(profile + ".py"):
customs.append(profile + ".py")
opts = Variables(customs, ARGUMENTS)
-
-platforms = ("linux", "macos", "windows", "android", "ios", "javascript")
-opts.Add(
- EnumVariable(
- key="platform",
- help="Target platform",
- default=env.get("platform", default_platform),
- allowed_values=platforms,
- ignorecase=2,
- )
-)
-
-# Editor and template_debug are compatible (i.e. you can use the same binary for Godot editor builds and Godot debug templates).
-# Godot release templates are only compatible with "template_release" builds.
-# For this reason, we default to template_debug builds, unlike Godot which defaults to editor builds.
-opts.Add(
- EnumVariable(
- key="target",
- help="Compilation target",
- default=env.get("target", "template_debug"),
- allowed_values=("editor", "template_release", "template_debug"),
- )
-)
-opts.Add(
- PathVariable(
- key="gdextension_dir",
- help="Path to a custom directory containing GDExtension interface header and API JSON file",
- default=env.get("gdextension_dir", None),
- validator=validate_gdextension_dir,
- )
-)
-opts.Add(
- PathVariable(
- key="custom_api_file",
- help="Path to a custom GDExtension API JSON file (takes precedence over `gdextension_dir`)",
- default=env.get("custom_api_file", None),
- validator=validate_api_file,
- )
-)
-opts.Add(
- BoolVariable(
- key="generate_bindings",
- help="Force GDExtension API bindings generation. Auto-detected by default.",
- default=env.get("generate_bindings", False),
- )
-)
-opts.Add(
- BoolVariable(
- key="generate_template_get_node",
- help="Generate a template version of the Node class's get_node.",
- default=env.get("generate_template_get_node", True),
- )
-)
-
-opts.Add(BoolVariable(key="build_library", help="Build the godot-cpp library.", default=env.get("build_library", True)))
-opts.Add(
- EnumVariable(
- key="precision",
- help="Set the floating-point precision level",
- default=env.get("precision", "single"),
- allowed_values=("single", "double"),
- )
-)
-
-# Add platform options
-tools = {}
-for pl in platforms:
- tool = Tool(pl, toolpath=["tools"])
- if hasattr(tool, "options"):
- tool.options(opts)
- tools[pl] = tool
-
-# CPU architecture options.
-architecture_array = ["", "universal", "x86_32", "x86_64", "arm32", "arm64", "rv64", "ppc32", "ppc64", "wasm32"]
-architecture_aliases = {
- "x64": "x86_64",
- "amd64": "x86_64",
- "armv7": "arm32",
- "armv8": "arm64",
- "arm64v8": "arm64",
- "aarch64": "arm64",
- "rv": "rv64",
- "riscv": "rv64",
- "riscv64": "rv64",
- "ppcle": "ppc32",
- "ppc": "ppc32",
- "ppc64le": "ppc64",
-}
-opts.Add(
- EnumVariable(
- key="arch",
- help="CPU architecture",
- default=env.get("arch", ""),
- allowed_values=architecture_array,
- map=architecture_aliases,
- )
-)
-
-# Targets flags tool (optimizations, debug symbols)
-target_tool = Tool("targets", toolpath=["tools"])
-target_tool.options(opts)
-
+cpp_tool = Tool("godotcpp", toolpath=["tools"])
+cpp_tool.options(opts, env)
opts.Update(env)
-Help(opts.GenerateHelpText(env))
-
-# Process CPU architecture argument.
-if env["arch"] == "":
- # No architecture specified. Default to arm64 if building for Android,
- # universal if building for macOS or iOS, wasm32 if building for web,
- # otherwise default to the host architecture.
- if env["platform"] in ["macos", "ios"]:
- env["arch"] = "universal"
- elif env["platform"] == "android":
- env["arch"] = "arm64"
- elif env["platform"] == "javascript":
- env["arch"] = "wasm32"
- else:
- host_machine = platform.machine().lower()
- if host_machine in architecture_array:
- env["arch"] = host_machine
- elif host_machine in architecture_aliases.keys():
- env["arch"] = architecture_aliases[host_machine]
- elif "86" in host_machine:
- # Catches x86, i386, i486, i586, i686, etc.
- env["arch"] = "x86_32"
- else:
- print("Unsupported CPU architecture: " + host_machine)
- Exit()
-tool = Tool(env["platform"], toolpath=["tools"])
-
-if tool is None or not tool.exists(env):
- raise ValueError("Required toolchain not found for platform " + env["platform"])
-
-tool.generate(env)
-target_tool.generate(env)
+Help(opts.GenerateHelpText(env))
# Detect and print a warning listing unknown SCons variables to ease troubleshooting.
unknown = opts.UnknownVariables()
@@ -231,66 +41,12 @@ if unknown:
for item in unknown.items():
print(" " + item[0] + "=" + item[1])
-print("Building for architecture " + env["arch"] + " on platform " + env["platform"])
-
-# Require C++17
-if env.get("is_msvc", False):
- env.Append(CXXFLAGS=["/std:c++17"])
-else:
- env.Append(CXXFLAGS=["-std=c++17"])
-
-if env["precision"] == "double":
- env.Append(CPPDEFINES=["REAL_T_IS_DOUBLE"])
-
-# Generate bindings
-env.Append(BUILDERS={"GenerateBindings": Builder(action=scons_generate_bindings, emitter=scons_emit_files)})
-
-bindings = env.GenerateBindings(
- env.Dir("."),
- [get_api_file(env), os.path.join(get_gdextension_dir(env), "gdextension_interface.h"), "binding_generator.py"],
-)
-
scons_cache_path = os.environ.get("SCONS_CACHE")
if scons_cache_path is not None:
CacheDir(scons_cache_path)
Decider("MD5")
-# Forces bindings regeneration.
-if env["generate_bindings"]:
- AlwaysBuild(bindings)
- NoCache(bindings)
-
-# Includes
-env.Append(CPPPATH=[[env.Dir(d) for d in [get_gdextension_dir(env), "include", os.path.join("gen", "include")]]])
-
-# Sources to compile
-sources = []
-add_sources(sources, "src", "cpp")
-add_sources(sources, "src/classes", "cpp")
-add_sources(sources, "src/core", "cpp")
-add_sources(sources, "src/variant", "cpp")
-sources.extend([f for f in bindings if str(f).endswith(".cpp")])
-
-suffix = ".{}.{}".format(env["platform"], env["target"])
-if env.dev_build:
- suffix += ".dev"
-if env["precision"] == "double":
- suffix += ".double"
-suffix += "." + env["arch"]
-if env["ios_simulator"]:
- suffix += ".simulator"
-
-# Expose it when included from another project
-env["suffix"] = suffix
-
-library = None
-env["OBJSUFFIX"] = suffix + env["OBJSUFFIX"]
-library_name = "libgodot-cpp{}{}".format(suffix, env["LIBSUFFIX"])
-
-if env["build_library"]:
- library = env.StaticLibrary(target=env.File("bin/%s" % library_name), source=sources)
- Default(library)
+cpp_tool.generate(env)
+library = env.GodotCPP()
-env.Append(LIBPATH=[env.Dir("bin")])
-env.Append(LIBS=library_name)
Return("env")
diff --git a/binding_generator.py b/binding_generator.py
index 44c8fe7..e680784 100644
--- a/binding_generator.py
+++ b/binding_generator.py
@@ -122,8 +122,10 @@ def get_file_list(api_filepath, output_dir, headers=False, sources=False):
include_gen_folder / "variant" / "builtin_binds.hpp",
include_gen_folder / "variant" / "utility_functions.hpp",
include_gen_folder / "variant" / "variant_size.hpp",
+ include_gen_folder / "variant" / "builtin_vararg_methods.hpp",
include_gen_folder / "classes" / "global_constants.hpp",
include_gen_folder / "classes" / "global_constants_binds.hpp",
+ include_gen_folder / "core" / "version.hpp",
]:
files.append(str(path.as_posix()))
if sources:
@@ -174,6 +176,7 @@ def generate_bindings(api_filepath, use_template_get_node, bits="64", precision=
print("Built-in type config: " + real_t + "_" + bits)
generate_global_constants(api, target_dir)
+ generate_version_header(api, target_dir)
generate_global_constant_binds(api, target_dir)
generate_builtin_bindings(api, target_dir, real_t + "_" + bits)
generate_engine_classes_bindings(api, target_dir, use_template_get_node)
@@ -345,6 +348,40 @@ def generate_builtin_bindings(api, output_dir, build_config):
builtin_binds_file.write("\n".join(builtin_binds))
+ # Create a header to implement all builtin class vararg methods and be included in "variant.hpp".
+ builtin_vararg_methods_header = include_gen_folder / "builtin_vararg_methods.hpp"
+ builtin_vararg_methods_header.open("w+").write(
+ generate_builtin_class_vararg_method_implements_header(api["builtin_classes"])
+ )
+
+
+def generate_builtin_class_vararg_method_implements_header(builtin_classes):
+ result = []
+
+ add_header("builtin_vararg_methods.hpp", result)
+
+ header_guard = "GODOT_CPP_BUILTIN_VARARG_METHODS_HPP"
+ result.append(f"#ifndef {header_guard}")
+ result.append(f"#define {header_guard}")
+ result.append("")
+ for builtin_api in builtin_classes:
+ if not "methods" in builtin_api:
+ continue
+ class_name = builtin_api["name"]
+ for method in builtin_api["methods"]:
+ if not method["is_vararg"]:
+ continue
+
+ result += make_varargs_template(
+ method, "is_static" in method and method["is_static"], class_name, False, False, True
+ )
+ result.append("")
+
+ result.append("")
+ result.append(f"#endif // ! {header_guard}")
+
+ return "\n".join(result)
+
def generate_builtin_class_header(builtin_api, size, used_classes, fully_used_classes):
result = []
@@ -367,6 +404,7 @@ def generate_builtin_class_header(builtin_api, size, used_classes, fully_used_cl
if class_name == "String":
result.append("#include <godot_cpp/variant/char_string.hpp>")
result.append("#include <godot_cpp/variant/char_utils.hpp>")
+ result.append("#include <godot_cpp/classes/global_constants.hpp>")
if class_name == "PackedStringArray":
result.append("#include <godot_cpp/variant/string.hpp>")
@@ -553,6 +591,7 @@ def generate_builtin_class_header(builtin_api, size, used_classes, fully_used_cl
result.append("\tChar32String utf32() const;")
result.append("\tCharWideString wide_string() const;")
result.append("\tstatic String num_real(double p_num, bool p_trailing = true);")
+ result.append("\tError resize(int p_size);")
if "members" in builtin_api:
for member in builtin_api["members"]:
@@ -1143,6 +1182,12 @@ def generate_engine_classes_bindings(api, output_dir, use_template_get_node):
else:
fully_used_classes.add("Wrapped")
+ # In order to ensure that PtrToArg specializations for native structs are
+ # always used, let's move any of them into 'fully_used_classes'.
+ for type_name in used_classes:
+ if is_struct_type(type_name) and not is_included_struct_type(type_name):
+ fully_used_classes.add(type_name)
+
for type_name in fully_used_classes:
if type_name in used_classes:
used_classes.remove(type_name)
@@ -1717,6 +1762,35 @@ def generate_global_constants(api, output_dir):
header_file.write("\n".join(header))
+def generate_version_header(api, output_dir):
+ header = []
+ header_filename = "version.hpp"
+ add_header(header_filename, header)
+
+ include_gen_folder = Path(output_dir) / "include" / "godot_cpp" / "core"
+ include_gen_folder.mkdir(parents=True, exist_ok=True)
+
+ header_file_path = include_gen_folder / header_filename
+
+ header_guard = "GODOT_CPP_VERSION_HPP"
+ header.append(f"#ifndef {header_guard}")
+ header.append(f"#define {header_guard}")
+ header.append("")
+
+ header.append(f"#define GODOT_VERSION_MAJOR {api['header']['version_major']}")
+ header.append(f"#define GODOT_VERSION_MINOR {api['header']['version_minor']}")
+ header.append(f"#define GODOT_VERSION_PATCH {api['header']['version_patch']}")
+ header.append(f"#define GODOT_VERSION_STATUS \"{api['header']['version_status']}\"")
+ header.append(f"#define GODOT_VERSION_BUILD \"{api['header']['version_build']}\"")
+
+ header.append("")
+ header.append(f"#endif // {header_guard}")
+ header.append("")
+
+ with header_file_path.open("w+", encoding="utf-8") as header_file:
+ header_file.write("\n".join(header))
+
+
def generate_global_constant_binds(api, output_dir):
include_gen_folder = Path(output_dir) / "include" / "godot_cpp" / "classes"
source_gen_folder = Path(output_dir) / "src" / "classes"
@@ -2023,10 +2097,22 @@ def make_signature(
return function_signature
-def make_varargs_template(function_data, static=False):
+def make_varargs_template(
+ function_data,
+ static=False,
+ class_befor_signature="",
+ with_public_declare=True,
+ with_indent=True,
+ for_builtin_classes=False,
+):
result = []
- function_signature = "\tpublic: template<class... Args> "
+ function_signature = ""
+
+ if with_public_declare:
+ function_signature = "public: "
+
+ function_signature += "template<class... Args> "
if static:
function_signature += "static "
@@ -2047,6 +2133,8 @@ def make_varargs_template(function_data, static=False):
if not function_signature.endswith("*"):
function_signature += " "
+ if len(class_befor_signature) > 0:
+ function_signature += class_befor_signature + "::"
function_signature += f'{escape_identifier(function_data["name"])}'
method_arguments = []
@@ -2067,7 +2155,7 @@ def make_varargs_template(function_data, static=False):
function_signature += " {"
result.append(function_signature)
- args_array = f"\t\tstd::array<Variant, {len(method_arguments)} + sizeof...(Args)> variant_args {{ "
+ args_array = f"\tstd::array<Variant, {len(method_arguments)} + sizeof...(Args)> variant_args {{ "
for argument in method_arguments:
if argument["type"] == "Variant":
args_array += argument["name"]
@@ -2077,19 +2165,42 @@ def make_varargs_template(function_data, static=False):
args_array += "Variant(args)... };"
result.append(args_array)
- result.append(f"\t\tstd::array<const Variant *, {len(method_arguments)} + sizeof...(Args)> call_args;")
- result.append("\t\tfor(size_t i = 0; i < variant_args.size(); i++) {")
- result.append("\t\t\tcall_args[i] = &variant_args[i];")
- result.append("\t\t}")
+ result.append(f"\tstd::array<const Variant *, {len(method_arguments)} + sizeof...(Args)> call_args;")
+ result.append("\tfor(size_t i = 0; i < variant_args.size(); i++) {")
+ result.append("\t\tcall_args[i] = &variant_args[i];")
+ result.append("\t}")
- call_line = "\t\t"
+ call_line = "\t"
- if return_type != "void":
- call_line += "return "
+ if not for_builtin_classes:
+ if return_type != "void":
+ call_line += "return "
- call_line += f'{escape_identifier(function_data["name"])}_internal(call_args.data(), variant_args.size());'
- result.append(call_line)
- result.append("\t}")
+ call_line += f'{escape_identifier(function_data["name"])}_internal(call_args.data(), variant_args.size());'
+ result.append(call_line)
+ else:
+ base = "(GDExtensionTypePtr)&opaque"
+ if static:
+ base = "nullptr"
+
+ ret = "nullptr"
+ if return_type != "void":
+ ret = "&ret"
+ result.append(f'\t{correct_type(function_data["return_type"])} ret;')
+
+ function_name = function_data["name"]
+ result.append(
+ f"\t_method_bindings.method_{function_name}({base}, reinterpret_cast<GDExtensionConstTypePtr *>(call_args.data()), {ret}, {len(method_arguments)} + sizeof...(Args));"
+ )
+
+ if return_type != "void":
+ result.append("\treturn ret;")
+
+ result.append("}")
+
+ if with_indent:
+ for i in range(len(result)):
+ result[i] = "\t" + result[i]
return result
diff --git a/gdextension/extension_api.json b/gdextension/extension_api.json
index 40481ed..1eaa18f 100644
--- a/gdextension/extension_api.json
+++ b/gdextension/extension_api.json
@@ -1,11 +1,11 @@
{
"header": {
"version_major": 4,
- "version_minor": 1,
- "version_patch": 1,
- "version_status": "stable",
+ "version_minor": 2,
+ "version_patch": 0,
+ "version_status": "dev3",
"version_build": "official",
- "version_full_name": "Godot Engine v4.1.1.stable.official"
+ "version_full_name": "Godot Engine v4.2.dev3.official"
},
"builtin_class_sizes": [
{
@@ -24963,6 +24963,44 @@
]
},
{
+ "name": "fill_solid_region",
+ "is_const": false,
+ "is_vararg": false,
+ "is_static": false,
+ "is_virtual": false,
+ "hash": 1152863744,
+ "arguments": [
+ {
+ "name": "region",
+ "type": "Rect2i"
+ },
+ {
+ "name": "solid",
+ "type": "bool",
+ "default_value": "true"
+ }
+ ]
+ },
+ {
+ "name": "fill_weight_scale_region",
+ "is_const": false,
+ "is_vararg": false,
+ "is_static": false,
+ "is_virtual": false,
+ "hash": 2793244083,
+ "arguments": [
+ {
+ "name": "region",
+ "type": "Rect2i"
+ },
+ {
+ "name": "weight_scale",
+ "type": "float",
+ "meta": "float"
+ }
+ ]
+ },
+ {
"name": "clear",
"is_const": false,
"is_vararg": false,
@@ -39786,6 +39824,40 @@
"api_type": "core",
"methods": [
{
+ "name": "load_from_buffer",
+ "is_const": false,
+ "is_vararg": false,
+ "is_static": true,
+ "is_virtual": false,
+ "hash": 354904730,
+ "return_value": {
+ "type": "AudioStreamOggVorbis"
+ },
+ "arguments": [
+ {
+ "name": "buffer",
+ "type": "PackedByteArray"
+ }
+ ]
+ },
+ {
+ "name": "load_from_file",
+ "is_const": false,
+ "is_vararg": false,
+ "is_static": true,
+ "is_virtual": false,
+ "hash": 797568536,
+ "return_value": {
+ "type": "AudioStreamOggVorbis"
+ },
+ "arguments": [
+ {
+ "name": "path",
+ "type": "String"
+ }
+ ]
+ },
+ {
"name": "set_packet_sequence",
"is_const": false,
"is_vararg": false,
@@ -42667,7 +42739,7 @@
"is_virtual": true,
"arguments": [
{
- "name": "button_pressed",
+ "name": "toggled_on",
"type": "bool"
}
]
@@ -42973,7 +43045,7 @@
"name": "toggled",
"arguments": [
{
- "name": "button_pressed",
+ "name": "toggled_on",
"type": "bool"
}
]
@@ -48609,6 +48681,11 @@
]
}
],
+ "signals": [
+ {
+ "name": "finished"
+ }
+ ],
"properties": [
{
"type": "bool",
@@ -50253,6 +50330,11 @@
]
}
],
+ "signals": [
+ {
+ "name": "finished"
+ }
+ ],
"properties": [
{
"type": "bool",
@@ -62392,16 +62474,42 @@
},
{
"name": "get_text_for_symbol_lookup",
- "is_const": false,
+ "is_const": true,
"is_vararg": false,
"is_static": false,
"is_virtual": false,
- "hash": 2841200299,
+ "hash": 201670096,
+ "hash_compatibility": [
+ 2841200299
+ ],
"return_value": {
"type": "String"
}
},
{
+ "name": "get_text_with_cursor_char",
+ "is_const": true,
+ "is_vararg": false,
+ "is_static": false,
+ "is_virtual": false,
+ "hash": 1391810591,
+ "return_value": {
+ "type": "String"
+ },
+ "arguments": [
+ {
+ "name": "line",
+ "type": "int",
+ "meta": "int32"
+ },
+ {
+ "name": "column",
+ "type": "int",
+ "meta": "int32"
+ }
+ ]
+ },
+ {
"name": "set_symbol_lookup_word_as_valid",
"is_const": false,
"is_vararg": false,
@@ -73363,6 +73471,32 @@
]
},
{
+ "name": "FileDialogMode",
+ "is_bitfield": false,
+ "values": [
+ {
+ "name": "FILE_DIALOG_MODE_OPEN_FILE",
+ "value": 0
+ },
+ {
+ "name": "FILE_DIALOG_MODE_OPEN_FILES",
+ "value": 1
+ },
+ {
+ "name": "FILE_DIALOG_MODE_OPEN_DIR",
+ "value": 2
+ },
+ {
+ "name": "FILE_DIALOG_MODE_OPEN_ANY",
+ "value": 3
+ },
+ {
+ "name": "FILE_DIALOG_MODE_SAVE_FILE",
+ "value": 4
+ }
+ ]
+ },
+ {
"name": "WindowMode",
"is_bitfield": false,
"values": [
@@ -75013,6 +75147,17 @@
}
},
{
+ "name": "clipboard_get_image",
+ "is_const": true,
+ "is_vararg": false,
+ "is_static": false,
+ "is_virtual": false,
+ "hash": 4190603485,
+ "return_value": {
+ "type": "Image"
+ }
+ },
+ {
"name": "clipboard_has",
"is_const": true,
"is_vararg": false,
@@ -75024,6 +75169,17 @@
}
},
{
+ "name": "clipboard_has_image",
+ "is_const": true,
+ "is_vararg": false,
+ "is_static": false,
+ "is_virtual": false,
+ "hash": 36873697,
+ "return_value": {
+ "type": "bool"
+ }
+ },
+ {
"name": "clipboard_set_primary",
"is_const": false,
"is_vararg": false,
@@ -76433,6 +76589,47 @@
]
},
{
+ "name": "file_dialog_show",
+ "is_const": false,
+ "is_vararg": false,
+ "is_static": false,
+ "is_virtual": false,
+ "hash": 1531299078,
+ "return_value": {
+ "type": "enum::Error"
+ },
+ "arguments": [
+ {
+ "name": "title",
+ "type": "String"
+ },
+ {
+ "name": "current_directory",
+ "type": "String"
+ },
+ {
+ "name": "filename",
+ "type": "String"
+ },
+ {
+ "name": "show_hidden",
+ "type": "bool"
+ },
+ {
+ "name": "mode",
+ "type": "enum::DisplayServer.FileDialogMode"
+ },
+ {
+ "name": "filters",
+ "type": "PackedStringArray"
+ },
+ {
+ "name": "callback",
+ "type": "Callable"
+ }
+ ]
+ },
+ {
"name": "keyboard_get_layout_count",
"is_const": true,
"is_vararg": false,
@@ -76525,6 +76722,23 @@
]
},
{
+ "name": "keyboard_get_label_from_physical",
+ "is_const": true,
+ "is_vararg": false,
+ "is_static": false,
+ "is_virtual": false,
+ "hash": 3447613187,
+ "return_value": {
+ "type": "enum::Key"
+ },
+ "arguments": [
+ {
+ "name": "keycode",
+ "type": "enum::Key"
+ }
+ ]
+ },
+ {
"name": "process_events",
"is_const": false,
"is_vararg": false,
@@ -78155,6 +78369,26 @@
]
},
{
+ "name": "_get_export_option_warning",
+ "is_const": true,
+ "is_static": false,
+ "is_vararg": false,
+ "is_virtual": true,
+ "return_value": {
+ "type": "String"
+ },
+ "arguments": [
+ {
+ "name": "platform",
+ "type": "EditorExportPlatform"
+ },
+ {
+ "name": "option",
+ "type": "String"
+ }
+ ]
+ },
+ {
"name": "_get_export_features",
"is_const": true,
"is_static": false,
@@ -78185,6 +78419,142 @@
}
},
{
+ "name": "_supports_platform",
+ "is_const": true,
+ "is_static": false,
+ "is_vararg": false,
+ "is_virtual": true,
+ "return_value": {
+ "type": "bool"
+ },
+ "arguments": [
+ {
+ "name": "platform",
+ "type": "EditorExportPlatform"
+ }
+ ]
+ },
+ {
+ "name": "_get_android_dependencies",
+ "is_const": true,
+ "is_static": false,
+ "is_vararg": false,
+ "is_virtual": true,
+ "return_value": {
+ "type": "PackedStringArray"
+ },
+ "arguments": [
+ {
+ "name": "platform",
+ "type": "EditorExportPlatform"
+ },
+ {
+ "name": "debug",
+ "type": "bool"
+ }
+ ]
+ },
+ {
+ "name": "_get_android_dependencies_maven_repos",
+ "is_const": true,
+ "is_static": false,
+ "is_vararg": false,
+ "is_virtual": true,
+ "return_value": {
+ "type": "PackedStringArray"
+ },
+ "arguments": [
+ {
+ "name": "platform",
+ "type": "EditorExportPlatform"
+ },
+ {
+ "name": "debug",
+ "type": "bool"
+ }
+ ]
+ },
+ {
+ "name": "_get_android_libraries",
+ "is_const": true,
+ "is_static": false,
+ "is_vararg": false,
+ "is_virtual": true,
+ "return_value": {
+ "type": "PackedStringArray"
+ },
+ "arguments": [
+ {
+ "name": "platform",
+ "type": "EditorExportPlatform"
+ },
+ {
+ "name": "debug",
+ "type": "bool"
+ }
+ ]
+ },
+ {
+ "name": "_get_android_manifest_activity_element_contents",
+ "is_const": true,
+ "is_static": false,
+ "is_vararg": false,
+ "is_virtual": true,
+ "return_value": {
+ "type": "String"
+ },
+ "arguments": [
+ {
+ "name": "platform",
+ "type": "EditorExportPlatform"
+ },
+ {
+ "name": "debug",
+ "type": "bool"
+ }
+ ]
+ },
+ {
+ "name": "_get_android_manifest_application_element_contents",
+ "is_const": true,
+ "is_static": false,
+ "is_vararg": false,
+ "is_virtual": true,
+ "return_value": {
+ "type": "String"
+ },
+ "arguments": [
+ {
+ "name": "platform",
+ "type": "EditorExportPlatform"
+ },
+ {
+ "name": "debug",
+ "type": "bool"
+ }
+ ]
+ },
+ {
+ "name": "_get_android_manifest_element_contents",
+ "is_const": true,
+ "is_static": false,
+ "is_vararg": false,
+ "is_virtual": true,
+ "return_value": {
+ "type": "String"
+ },
+ "arguments": [
+ {
+ "name": "platform",
+ "type": "EditorExportPlatform"
+ },
+ {
+ "name": "debug",
+ "type": "bool"
+ }
+ ]
+ },
+ {
"name": "add_shared_object",
"is_const": false,
"is_vararg": false,
@@ -80300,6 +80670,31 @@
]
},
{
+ "name": "get_current_feature_profile",
+ "is_const": true,
+ "is_vararg": false,
+ "is_static": false,
+ "is_virtual": false,
+ "hash": 201670096,
+ "return_value": {
+ "type": "String"
+ }
+ },
+ {
+ "name": "set_current_feature_profile",
+ "is_const": false,
+ "is_vararg": false,
+ "is_static": false,
+ "is_virtual": false,
+ "hash": 83702148,
+ "arguments": [
+ {
+ "name": "profile_name",
+ "type": "String"
+ }
+ ]
+ },
+ {
"name": "get_file_system_dock",
"is_const": true,
"is_vararg": false,
@@ -80532,6 +80927,14 @@
]
},
{
+ "name": "save_all_scenes",
+ "is_const": false,
+ "is_vararg": false,
+ "is_static": false,
+ "is_virtual": false,
+ "hash": 3218959716
+ },
+ {
"name": "mark_scene_as_unsaved",
"is_const": false,
"is_vararg": false,
@@ -81959,6 +82362,22 @@
"is_virtual": true
},
{
+ "name": "_get_unsaved_status",
+ "is_const": true,
+ "is_static": false,
+ "is_vararg": false,
+ "is_virtual": true,
+ "return_value": {
+ "type": "String"
+ },
+ "arguments": [
+ {
+ "name": "for_scene",
+ "type": "String"
+ }
+ ]
+ },
+ {
"name": "_save_external_data",
"is_const": false,
"is_static": false,
@@ -82653,6 +83072,17 @@
"type": "EditorDebuggerPlugin"
}
]
+ },
+ {
+ "name": "get_plugin_version",
+ "is_const": true,
+ "is_vararg": false,
+ "is_static": false,
+ "is_virtual": false,
+ "hash": 201670096,
+ "return_value": {
+ "type": "String"
+ }
}
],
"signals": [
@@ -90500,6 +90930,60 @@
"value": 4
}
]
+ },
+ {
+ "name": "UnixPermissionFlags",
+ "is_bitfield": true,
+ "values": [
+ {
+ "name": "UNIX_READ_OWNER",
+ "value": 256
+ },
+ {
+ "name": "UNIX_WRITE_OWNER",
+ "value": 128
+ },
+ {
+ "name": "UNIX_EXECUTE_OWNER",
+ "value": 64
+ },
+ {
+ "name": "UNIX_READ_GROUP",
+ "value": 32
+ },
+ {
+ "name": "UNIX_WRITE_GROUP",
+ "value": 16
+ },
+ {
+ "name": "UNIX_EXECUTE_GROUP",
+ "value": 8
+ },
+ {
+ "name": "UNIX_READ_OTHER",
+ "value": 4
+ },
+ {
+ "name": "UNIX_WRITE_OTHER",
+ "value": 2
+ },
+ {
+ "name": "UNIX_EXECUTE_OTHER",
+ "value": 1
+ },
+ {
+ "name": "UNIX_SET_USER_ID",
+ "value": 2048
+ },
+ {
+ "name": "UNIX_SET_GROUP_ID",
+ "value": 1024
+ },
+ {
+ "name": "UNIX_RESTRICTED_DELETE",
+ "value": 512
+ }
+ ]
}
],
"methods": [
@@ -91241,6 +91725,120 @@
"type": "String"
}
]
+ },
+ {
+ "name": "get_unix_permissions",
+ "is_const": false,
+ "is_vararg": false,
+ "is_static": true,
+ "is_virtual": false,
+ "hash": 524341837,
+ "return_value": {
+ "type": "bitfield::FileAccess.UnixPermissionFlags"
+ },
+ "arguments": [
+ {
+ "name": "file",
+ "type": "String"
+ }
+ ]
+ },
+ {
+ "name": "set_unix_permissions",
+ "is_const": false,
+ "is_vararg": false,
+ "is_static": true,
+ "is_virtual": false,
+ "hash": 846038644,
+ "return_value": {
+ "type": "enum::Error"
+ },
+ "arguments": [
+ {
+ "name": "file",
+ "type": "String"
+ },
+ {
+ "name": "permissions",
+ "type": "bitfield::FileAccess.UnixPermissionFlags"
+ }
+ ]
+ },
+ {
+ "name": "get_hidden_attribute",
+ "is_const": false,
+ "is_vararg": false,
+ "is_static": true,
+ "is_virtual": false,
+ "hash": 2323990056,
+ "return_value": {
+ "type": "bool"
+ },
+ "arguments": [
+ {
+ "name": "file",
+ "type": "String"
+ }
+ ]
+ },
+ {
+ "name": "set_hidden_attribute",
+ "is_const": false,
+ "is_vararg": false,
+ "is_static": true,
+ "is_virtual": false,
+ "hash": 2892558115,
+ "return_value": {
+ "type": "enum::Error"
+ },
+ "arguments": [
+ {
+ "name": "file",
+ "type": "String"
+ },
+ {
+ "name": "hidden",
+ "type": "bool"
+ }
+ ]
+ },
+ {
+ "name": "set_read_only_attribute",
+ "is_const": false,
+ "is_vararg": false,
+ "is_static": true,
+ "is_virtual": false,
+ "hash": 2892558115,
+ "return_value": {
+ "type": "enum::Error"
+ },
+ "arguments": [
+ {
+ "name": "file",
+ "type": "String"
+ },
+ {
+ "name": "ro",
+ "type": "bool"
+ }
+ ]
+ },
+ {
+ "name": "get_read_only_attribute",
+ "is_const": false,
+ "is_vararg": false,
+ "is_static": true,
+ "is_virtual": false,
+ "hash": 2323990056,
+ "return_value": {
+ "type": "bool"
+ },
+ "arguments": [
+ {
+ "name": "file",
+ "type": "String"
+ }
+ ]
}
],
"properties": [
@@ -91580,6 +92178,31 @@
}
},
{
+ "name": "set_use_native_dialog",
+ "is_const": false,
+ "is_vararg": false,
+ "is_static": false,
+ "is_virtual": false,
+ "hash": 2586408642,
+ "arguments": [
+ {
+ "name": "native",
+ "type": "bool"
+ }
+ ]
+ },
+ {
+ "name": "get_use_native_dialog",
+ "is_const": true,
+ "is_vararg": false,
+ "is_static": false,
+ "is_virtual": false,
+ "hash": 36873697,
+ "return_value": {
+ "type": "bool"
+ }
+ },
+ {
"name": "deselect_all",
"is_const": false,
"is_vararg": false,
@@ -91663,6 +92286,12 @@
"getter": "is_showing_hidden_files"
},
{
+ "type": "bool",
+ "name": "use_native_dialog",
+ "setter": "set_use_native_dialog",
+ "getter": "get_use_native_dialog"
+ },
+ {
"type": "String",
"name": "current_dir",
"setter": "set_current_dir",
@@ -93090,6 +93719,14 @@
"meta": "int64"
}
}
+ ],
+ "properties": [
+ {
+ "type": "typedarray::24/17:Font",
+ "name": "fallbacks",
+ "setter": "set_fallbacks",
+ "getter": "get_fallbacks"
+ }
]
},
{
@@ -94994,12 +95631,6 @@
"name": "opentype_feature_overrides",
"setter": "set_opentype_feature_overrides",
"getter": "get_opentype_feature_overrides"
- },
- {
- "type": "typedarray::24/17:Font",
- "name": "fallbacks",
- "setter": "set_fallbacks",
- "getter": "get_fallbacks"
}
]
},
@@ -95181,12 +95812,6 @@
"getter": "get_base_font"
},
{
- "type": "typedarray::24/17:Font",
- "name": "fallbacks",
- "setter": "set_fallbacks",
- "getter": "get_fallbacks"
- },
- {
"type": "Dictionary",
"name": "variation_opentype",
"setter": "set_variation_opentype",
@@ -95247,13 +95872,6 @@
]
},
{
- "name": "FramebufferCacheRD",
- "is_refcounted": false,
- "is_instantiable": false,
- "inherits": "Object",
- "api_type": "core"
- },
- {
"name": "GDExtension",
"is_refcounted": true,
"is_instantiable": true,
@@ -96737,6 +97355,16 @@
]
},
{
+ "name": "_get_image_file_extension",
+ "is_const": false,
+ "is_static": false,
+ "is_vararg": false,
+ "is_virtual": true,
+ "return_value": {
+ "type": "String"
+ }
+ },
+ {
"name": "_parse_texture_json",
"is_const": false,
"is_static": false,
@@ -96890,6 +97518,22 @@
]
},
{
+ "name": "_export_preserialize",
+ "is_const": false,
+ "is_static": false,
+ "is_vararg": false,
+ "is_virtual": true,
+ "return_value": {
+ "type": "enum::Error"
+ },
+ "arguments": [
+ {
+ "name": "state",
+ "type": "GLTFState"
+ }
+ ]
+ },
+ {
"name": "_export_node",
"is_const": false,
"is_static": false,
@@ -99066,6 +99710,31 @@
]
},
{
+ "name": "get_copyright",
+ "is_const": true,
+ "is_vararg": false,
+ "is_static": false,
+ "is_virtual": false,
+ "hash": 201670096,
+ "return_value": {
+ "type": "String"
+ }
+ },
+ {
+ "name": "set_copyright",
+ "is_const": false,
+ "is_vararg": false,
+ "is_static": false,
+ "is_virtual": false,
+ "hash": 83702148,
+ "arguments": [
+ {
+ "name": "copyright",
+ "type": "String"
+ }
+ ]
+ },
+ {
"name": "get_glb_data",
"is_const": false,
"is_vararg": false,
@@ -99353,6 +100022,31 @@
]
},
{
+ "name": "get_filename",
+ "is_const": true,
+ "is_vararg": false,
+ "is_static": false,
+ "is_virtual": false,
+ "hash": 201670096,
+ "return_value": {
+ "type": "String"
+ }
+ },
+ {
+ "name": "set_filename",
+ "is_const": false,
+ "is_vararg": false,
+ "is_static": false,
+ "is_virtual": false,
+ "hash": 83702148,
+ "arguments": [
+ {
+ "name": "filename",
+ "type": "String"
+ }
+ ]
+ },
+ {
"name": "get_root_nodes",
"is_const": false,
"is_vararg": false,
@@ -99771,6 +100465,12 @@
"getter": "get_minor_version"
},
{
+ "type": "String",
+ "name": "copyright",
+ "setter": "set_copyright",
+ "getter": "get_copyright"
+ },
+ {
"type": "PackedByteArray",
"name": "glb_data",
"setter": "set_glb_data",
@@ -99831,6 +100531,12 @@
"getter": "get_base_path"
},
{
+ "type": "String",
+ "name": "filename",
+ "setter": "set_filename",
+ "getter": "get_filename"
+ },
+ {
"type": "PackedInt32Array",
"name": "root_nodes",
"setter": "set_root_nodes",
@@ -100806,6 +101512,11 @@
}
}
],
+ "signals": [
+ {
+ "name": "finished"
+ }
+ ],
"properties": [
{
"type": "bool",
@@ -101684,6 +102395,11 @@
}
}
],
+ "signals": [
+ {
+ "name": "finished"
+ }
+ ],
"properties": [
{
"type": "bool",
@@ -103849,6 +104565,35 @@
]
},
{
+ "name": "get_triangle_barycentric_coords",
+ "is_const": false,
+ "is_vararg": false,
+ "is_static": false,
+ "is_virtual": false,
+ "hash": 1362048029,
+ "return_value": {
+ "type": "Vector3"
+ },
+ "arguments": [
+ {
+ "name": "point",
+ "type": "Vector3"
+ },
+ {
+ "name": "a",
+ "type": "Vector3"
+ },
+ {
+ "name": "b",
+ "type": "Vector3"
+ },
+ {
+ "name": "c",
+ "type": "Vector3"
+ }
+ ]
+ },
+ {
"name": "ray_intersects_triangle",
"is_const": false,
"is_vararg": false,
@@ -105614,7 +106359,7 @@
"hash": 3218959716
},
{
- "name": "get_scroll_ofs",
+ "name": "get_scroll_offset",
"is_const": true,
"is_vararg": false,
"is_static": false,
@@ -105625,7 +106370,7 @@
}
},
{
- "name": "set_scroll_ofs",
+ "name": "set_scroll_offset",
"is_const": false,
"is_vararg": false,
"is_static": false,
@@ -105941,34 +106686,32 @@
}
},
{
- "name": "set_snap",
+ "name": "set_show_grid",
"is_const": false,
"is_vararg": false,
"is_static": false,
"is_virtual": false,
- "hash": 1286410249,
+ "hash": 2586408642,
"arguments": [
{
- "name": "pixels",
- "type": "int",
- "meta": "int32"
+ "name": "enable",
+ "type": "bool"
}
]
},
{
- "name": "get_snap",
+ "name": "is_showing_grid",
"is_const": true,
"is_vararg": false,
"is_static": false,
"is_virtual": false,
- "hash": 3905245786,
+ "hash": 36873697,
"return_value": {
- "type": "int",
- "meta": "int32"
+ "type": "bool"
}
},
{
- "name": "set_use_snap",
+ "name": "set_snapping_enabled",
"is_const": false,
"is_vararg": false,
"is_static": false,
@@ -105982,7 +106725,7 @@
]
},
{
- "name": "is_using_snap",
+ "name": "is_snapping_enabled",
"is_const": true,
"is_vararg": false,
"is_static": false,
@@ -105993,6 +106736,33 @@
}
},
{
+ "name": "set_snapping_distance",
+ "is_const": false,
+ "is_vararg": false,
+ "is_static": false,
+ "is_virtual": false,
+ "hash": 1286410249,
+ "arguments": [
+ {
+ "name": "pixels",
+ "type": "int",
+ "meta": "int32"
+ }
+ ]
+ },
+ {
+ "name": "get_snapping_distance",
+ "is_const": true,
+ "is_vararg": false,
+ "is_static": false,
+ "is_virtual": false,
+ "hash": 3905245786,
+ "return_value": {
+ "type": "int",
+ "meta": "int32"
+ }
+ },
+ {
"name": "set_connection_lines_curvature",
"is_const": false,
"is_vararg": false,
@@ -106199,7 +106969,7 @@
}
},
{
- "name": "get_zoom_hbox",
+ "name": "get_menu_hbox",
"is_const": false,
"is_vararg": false,
"is_static": false,
@@ -106400,20 +107170,26 @@
{
"type": "Vector2",
"name": "scroll_offset",
- "setter": "set_scroll_ofs",
- "getter": "get_scroll_ofs"
+ "setter": "set_scroll_offset",
+ "getter": "get_scroll_offset"
},
{
- "type": "int",
- "name": "snap_distance",
- "setter": "set_snap",
- "getter": "get_snap"
+ "type": "bool",
+ "name": "show_grid",
+ "setter": "set_show_grid",
+ "getter": "is_showing_grid"
},
{
"type": "bool",
- "name": "use_snap",
- "setter": "set_use_snap",
- "getter": "is_using_snap"
+ "name": "snapping_enabled",
+ "setter": "set_snapping_enabled",
+ "getter": "is_snapping_enabled"
+ },
+ {
+ "type": "int",
+ "name": "snapping_distance",
+ "setter": "set_snapping_distance",
+ "getter": "get_snapping_distance"
},
{
"type": "int",
@@ -106965,31 +107741,6 @@
}
},
{
- "name": "set_comment",
- "is_const": false,
- "is_vararg": false,
- "is_static": false,
- "is_virtual": false,
- "hash": 2586408642,
- "arguments": [
- {
- "name": "comment",
- "type": "bool"
- }
- ]
- },
- {
- "name": "is_comment",
- "is_const": true,
- "is_vararg": false,
- "is_static": false,
- "is_virtual": false,
- "hash": 36873697,
- "return_value": {
- "type": "bool"
- }
- },
- {
"name": "set_resizable",
"is_const": false,
"is_vararg": false,
@@ -107442,12 +108193,6 @@
"getter": "is_selected"
},
{
- "type": "bool",
- "name": "comment",
- "setter": "set_comment",
- "getter": "is_comment"
- },
- {
"type": "int",
"name": "overlay",
"setter": "set_overlay",
@@ -111638,6 +112383,69 @@
"type": "PackedByteArray"
}
]
+ },
+ {
+ "name": "load_dds_from_buffer",
+ "is_const": false,
+ "is_vararg": false,
+ "is_static": false,
+ "is_virtual": false,
+ "hash": 680677267,
+ "return_value": {
+ "type": "enum::Error"
+ },
+ "arguments": [
+ {
+ "name": "buffer",
+ "type": "PackedByteArray"
+ }
+ ]
+ },
+ {
+ "name": "load_svg_from_buffer",
+ "is_const": false,
+ "is_vararg": false,
+ "is_static": false,
+ "is_virtual": false,
+ "hash": 1822513750,
+ "return_value": {
+ "type": "enum::Error"
+ },
+ "arguments": [
+ {
+ "name": "buffer",
+ "type": "PackedByteArray"
+ },
+ {
+ "name": "scale",
+ "type": "float",
+ "meta": "float",
+ "default_value": "1.0"
+ }
+ ]
+ },
+ {
+ "name": "load_svg_from_string",
+ "is_const": false,
+ "is_vararg": false,
+ "is_static": false,
+ "is_virtual": false,
+ "hash": 1461766635,
+ "return_value": {
+ "type": "enum::Error"
+ },
+ "arguments": [
+ {
+ "name": "svg_str",
+ "type": "String"
+ },
+ {
+ "name": "scale",
+ "type": "float",
+ "meta": "float",
+ "default_value": "1.0"
+ }
+ ]
}
],
"properties": [
@@ -113090,6 +113898,47 @@
]
},
{
+ "name": "get_joy_info",
+ "is_const": true,
+ "is_vararg": false,
+ "is_static": false,
+ "is_virtual": false,
+ "hash": 3485342025,
+ "return_value": {
+ "type": "Dictionary"
+ },
+ "arguments": [
+ {
+ "name": "device",
+ "type": "int",
+ "meta": "int32"
+ }
+ ]
+ },
+ {
+ "name": "should_ignore_device",
+ "is_const": true,
+ "is_vararg": false,
+ "is_static": false,
+ "is_virtual": false,
+ "hash": 2522259332,
+ "return_value": {
+ "type": "bool"
+ },
+ "arguments": [
+ {
+ "name": "vendor_id",
+ "type": "int",
+ "meta": "int32"
+ },
+ {
+ "name": "product_id",
+ "type": "int",
+ "meta": "int32"
+ }
+ ]
+ },
+ {
"name": "get_connected_joypads",
"is_const": false,
"is_vararg": false,
@@ -124245,6 +125094,31 @@
}
},
{
+ "name": "set_drag_and_drop_selection_enabled",
+ "is_const": false,
+ "is_vararg": false,
+ "is_static": false,
+ "is_virtual": false,
+ "hash": 2586408642,
+ "arguments": [
+ {
+ "name": "enable",
+ "type": "bool"
+ }
+ ]
+ },
+ {
+ "name": "is_drag_and_drop_selection_enabled",
+ "is_const": true,
+ "is_vararg": false,
+ "is_static": false,
+ "is_virtual": false,
+ "hash": 36873697,
+ "return_value": {
+ "type": "bool"
+ }
+ },
+ {
"name": "set_right_icon",
"is_const": false,
"is_vararg": false,
@@ -124447,6 +125321,12 @@
"getter": "is_deselect_on_focus_loss_enabled"
},
{
+ "type": "bool",
+ "name": "drag_and_drop_selection_enabled",
+ "setter": "set_drag_and_drop_selection_enabled",
+ "getter": "is_drag_and_drop_selection_enabled"
+ },
+ {
"type": "Texture",
"name": "right_icon",
"setter": "set_right_icon",
@@ -134817,6 +135697,14 @@
"type": "Mesh"
}
]
+ },
+ {
+ "name": "clear",
+ "is_const": false,
+ "is_vararg": false,
+ "is_static": false,
+ "is_virtual": false,
+ "hash": 3218959716
}
],
"properties": [
@@ -136875,6 +137763,14 @@
"type": "float",
"meta": "float"
}
+ },
+ {
+ "name": "clear",
+ "is_const": false,
+ "is_vararg": false,
+ "is_static": false,
+ "is_virtual": false,
+ "hash": 3218959716
}
],
"properties": [
@@ -136962,6 +137858,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_use_edge_connections",
"is_const": false,
"is_vararg": false,
@@ -137314,6 +138235,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_use_edge_connections",
"is_const": false,
"is_vararg": false,
@@ -137929,6 +138875,41 @@
}
},
{
+ "name": "region_set_enabled",
+ "is_const": false,
+ "is_vararg": false,
+ "is_static": false,
+ "is_virtual": false,
+ "hash": 1265174801,
+ "arguments": [
+ {
+ "name": "region",
+ "type": "RID"
+ },
+ {
+ "name": "enabled",
+ "type": "bool"
+ }
+ ]
+ },
+ {
+ "name": "region_get_enabled",
+ "is_const": true,
+ "is_vararg": false,
+ "is_static": false,
+ "is_virtual": false,
+ "hash": 4155700596,
+ "return_value": {
+ "type": "bool"
+ },
+ "arguments": [
+ {
+ "name": "region",
+ "type": "RID"
+ }
+ ]
+ },
+ {
"name": "region_set_use_edge_connections",
"is_const": false,
"is_vararg": false,
@@ -138312,6 +139293,41 @@
]
},
{
+ "name": "link_set_enabled",
+ "is_const": false,
+ "is_vararg": false,
+ "is_static": false,
+ "is_virtual": false,
+ "hash": 1265174801,
+ "arguments": [
+ {
+ "name": "link",
+ "type": "RID"
+ },
+ {
+ "name": "enabled",
+ "type": "bool"
+ }
+ ]
+ },
+ {
+ "name": "link_get_enabled",
+ "is_const": true,
+ "is_vararg": false,
+ "is_static": false,
+ "is_virtual": false,
+ "hash": 4155700596,
+ "return_value": {
+ "type": "bool"
+ },
+ "arguments": [
+ {
+ "name": "link",
+ "type": "RID"
+ }
+ ]
+ },
+ {
"name": "link_set_bidirectional",
"is_const": false,
"is_vararg": false,
@@ -139769,6 +140785,41 @@
}
},
{
+ "name": "region_set_enabled",
+ "is_const": false,
+ "is_vararg": false,
+ "is_static": false,
+ "is_virtual": false,
+ "hash": 1265174801,
+ "arguments": [
+ {
+ "name": "region",
+ "type": "RID"
+ },
+ {
+ "name": "enabled",
+ "type": "bool"
+ }
+ ]
+ },
+ {
+ "name": "region_get_enabled",
+ "is_const": true,
+ "is_vararg": false,
+ "is_static": false,
+ "is_virtual": false,
+ "hash": 4155700596,
+ "return_value": {
+ "type": "bool"
+ },
+ "arguments": [
+ {
+ "name": "region",
+ "type": "RID"
+ }
+ ]
+ },
+ {
"name": "region_set_use_edge_connections",
"is_const": false,
"is_vararg": false,
@@ -140170,6 +141221,41 @@
]
},
{
+ "name": "link_set_enabled",
+ "is_const": false,
+ "is_vararg": false,
+ "is_static": false,
+ "is_virtual": false,
+ "hash": 1265174801,
+ "arguments": [
+ {
+ "name": "link",
+ "type": "RID"
+ },
+ {
+ "name": "enabled",
+ "type": "bool"
+ }
+ ]
+ },
+ {
+ "name": "link_get_enabled",
+ "is_const": true,
+ "is_vararg": false,
+ "is_static": false,
+ "is_virtual": false,
+ "hash": 4155700596,
+ "return_value": {
+ "type": "bool"
+ },
+ "arguments": [
+ {
+ "name": "link",
+ "type": "RID"
+ }
+ ]
+ },
+ {
"name": "link_set_bidirectional",
"is_const": false,
"is_vararg": false,
@@ -147065,6 +148151,17 @@
]
},
{
+ "name": "is_sandboxed",
+ "is_const": true,
+ "is_vararg": false,
+ "is_static": false,
+ "is_virtual": false,
+ "hash": 36873697,
+ "return_value": {
+ "type": "bool"
+ }
+ },
+ {
"name": "request_permission",
"is_const": false,
"is_vararg": false,
@@ -147102,6 +148199,14 @@
"return_value": {
"type": "PackedStringArray"
}
+ },
+ {
+ "name": "revoke_granted_permissions",
+ "is_const": false,
+ "is_vararg": false,
+ "is_static": false,
+ "is_virtual": false,
+ "hash": 3218959716
}
],
"properties": [
@@ -148379,6 +149484,222 @@
]
},
{
+ "name": "OpenXRAPIExtension",
+ "is_refcounted": true,
+ "is_instantiable": true,
+ "inherits": "RefCounted",
+ "api_type": "core",
+ "methods": [
+ {
+ "name": "get_instance",
+ "is_const": false,
+ "is_vararg": false,
+ "is_static": false,
+ "is_virtual": false,
+ "hash": 2455072627,
+ "return_value": {
+ "type": "int",
+ "meta": "uint64"
+ }
+ },
+ {
+ "name": "get_system_id",
+ "is_const": false,
+ "is_vararg": false,
+ "is_static": false,
+ "is_virtual": false,
+ "hash": 2455072627,
+ "return_value": {
+ "type": "int",
+ "meta": "uint64"
+ }
+ },
+ {
+ "name": "get_session",
+ "is_const": false,
+ "is_vararg": false,
+ "is_static": false,
+ "is_virtual": false,
+ "hash": 2455072627,
+ "return_value": {
+ "type": "int",
+ "meta": "uint64"
+ }
+ },
+ {
+ "name": "transform_from_pose",
+ "is_const": false,
+ "is_vararg": false,
+ "is_static": false,
+ "is_virtual": false,
+ "hash": 3255299855,
+ "return_value": {
+ "type": "Transform3D"
+ },
+ "arguments": [
+ {
+ "name": "pose",
+ "type": "const void*"
+ }
+ ]
+ },
+ {
+ "name": "xr_result",
+ "is_const": false,
+ "is_vararg": false,
+ "is_static": false,
+ "is_virtual": false,
+ "hash": 3886436197,
+ "return_value": {
+ "type": "bool"
+ },
+ "arguments": [
+ {
+ "name": "result",
+ "type": "int",
+ "meta": "uint64"
+ },
+ {
+ "name": "format",
+ "type": "String"
+ },
+ {
+ "name": "args",
+ "type": "Array"
+ }
+ ]
+ },
+ {
+ "name": "openxr_is_enabled",
+ "is_const": false,
+ "is_vararg": false,
+ "is_static": true,
+ "is_virtual": false,
+ "hash": 2703660260,
+ "return_value": {
+ "type": "bool"
+ },
+ "arguments": [
+ {
+ "name": "check_run_in_editor",
+ "type": "bool"
+ }
+ ]
+ },
+ {
+ "name": "get_instance_proc_addr",
+ "is_const": false,
+ "is_vararg": false,
+ "is_static": false,
+ "is_virtual": false,
+ "hash": 1597066294,
+ "return_value": {
+ "type": "int",
+ "meta": "uint64"
+ },
+ "arguments": [
+ {
+ "name": "name",
+ "type": "String"
+ }
+ ]
+ },
+ {
+ "name": "get_error_string",
+ "is_const": false,
+ "is_vararg": false,
+ "is_static": false,
+ "is_virtual": false,
+ "hash": 990163283,
+ "return_value": {
+ "type": "String"
+ },
+ "arguments": [
+ {
+ "name": "result",
+ "type": "int",
+ "meta": "uint64"
+ }
+ ]
+ },
+ {
+ "name": "get_swapchain_format_name",
+ "is_const": false,
+ "is_vararg": false,
+ "is_static": false,
+ "is_virtual": false,
+ "hash": 990163283,
+ "return_value": {
+ "type": "String"
+ },
+ "arguments": [
+ {
+ "name": "swapchain_format",
+ "type": "int",
+ "meta": "int64"
+ }
+ ]
+ },
+ {
+ "name": "is_initialized",
+ "is_const": false,
+ "is_vararg": false,
+ "is_static": false,
+ "is_virtual": false,
+ "hash": 2240911060,
+ "return_value": {
+ "type": "bool"
+ }
+ },
+ {
+ "name": "is_running",
+ "is_const": false,
+ "is_vararg": false,
+ "is_static": false,
+ "is_virtual": false,
+ "hash": 2240911060,
+ "return_value": {
+ "type": "bool"
+ }
+ },
+ {
+ "name": "get_play_space",
+ "is_const": false,
+ "is_vararg": false,
+ "is_static": false,
+ "is_virtual": false,
+ "hash": 2455072627,
+ "return_value": {
+ "type": "int",
+ "meta": "uint64"
+ }
+ },
+ {
+ "name": "get_next_frame_time",
+ "is_const": false,
+ "is_vararg": false,
+ "is_static": false,
+ "is_virtual": false,
+ "hash": 2455072627,
+ "return_value": {
+ "type": "int",
+ "meta": "int64"
+ }
+ },
+ {
+ "name": "can_render",
+ "is_const": false,
+ "is_vararg": false,
+ "is_static": false,
+ "is_virtual": false,
+ "hash": 2240911060,
+ "return_value": {
+ "type": "bool"
+ }
+ }
+ ]
+ },
+ {
"name": "OpenXRAction",
"is_refcounted": true,
"is_instantiable": true,
@@ -148884,6 +150205,254 @@
]
},
{
+ "name": "OpenXRExtensionWrapperExtension",
+ "is_refcounted": false,
+ "is_instantiable": true,
+ "inherits": "Object",
+ "api_type": "core",
+ "methods": [
+ {
+ "name": "_get_requested_extensions",
+ "is_const": false,
+ "is_static": false,
+ "is_vararg": false,
+ "is_virtual": true,
+ "return_value": {
+ "type": "Dictionary"
+ }
+ },
+ {
+ "name": "_set_system_properties_and_get_next_pointer",
+ "is_const": false,
+ "is_static": false,
+ "is_vararg": false,
+ "is_virtual": true,
+ "return_value": {
+ "type": "int",
+ "meta": "uint64"
+ },
+ "arguments": [
+ {
+ "name": "next_pointer",
+ "type": "void*"
+ }
+ ]
+ },
+ {
+ "name": "_set_instance_create_info_and_get_next_pointer",
+ "is_const": false,
+ "is_static": false,
+ "is_vararg": false,
+ "is_virtual": true,
+ "return_value": {
+ "type": "int",
+ "meta": "uint64"
+ },
+ "arguments": [
+ {
+ "name": "next_pointer",
+ "type": "void*"
+ }
+ ]
+ },
+ {
+ "name": "_set_session_create_and_get_next_pointer",
+ "is_const": false,
+ "is_static": false,
+ "is_vararg": false,
+ "is_virtual": true,
+ "return_value": {
+ "type": "int",
+ "meta": "uint64"
+ },
+ "arguments": [
+ {
+ "name": "next_pointer",
+ "type": "void*"
+ }
+ ]
+ },
+ {
+ "name": "_set_swapchain_create_info_and_get_next_pointer",
+ "is_const": false,
+ "is_static": false,
+ "is_vararg": false,
+ "is_virtual": true,
+ "return_value": {
+ "type": "int",
+ "meta": "uint64"
+ },
+ "arguments": [
+ {
+ "name": "next_pointer",
+ "type": "void*"
+ }
+ ]
+ },
+ {
+ "name": "_on_register_metadata",
+ "is_const": false,
+ "is_static": false,
+ "is_vararg": false,
+ "is_virtual": true
+ },
+ {
+ "name": "_on_before_instance_created",
+ "is_const": false,
+ "is_static": false,
+ "is_vararg": false,
+ "is_virtual": true
+ },
+ {
+ "name": "_on_instance_created",
+ "is_const": false,
+ "is_static": false,
+ "is_vararg": false,
+ "is_virtual": true,
+ "arguments": [
+ {
+ "name": "instance",
+ "type": "int",
+ "meta": "uint64"
+ }
+ ]
+ },
+ {
+ "name": "_on_instance_destroyed",
+ "is_const": false,
+ "is_static": false,
+ "is_vararg": false,
+ "is_virtual": true
+ },
+ {
+ "name": "_on_session_created",
+ "is_const": false,
+ "is_static": false,
+ "is_vararg": false,
+ "is_virtual": true,
+ "arguments": [
+ {
+ "name": "session",
+ "type": "int",
+ "meta": "uint64"
+ }
+ ]
+ },
+ {
+ "name": "_on_process",
+ "is_const": false,
+ "is_static": false,
+ "is_vararg": false,
+ "is_virtual": true
+ },
+ {
+ "name": "_on_pre_render",
+ "is_const": false,
+ "is_static": false,
+ "is_vararg": false,
+ "is_virtual": true
+ },
+ {
+ "name": "_on_session_destroyed",
+ "is_const": false,
+ "is_static": false,
+ "is_vararg": false,
+ "is_virtual": true
+ },
+ {
+ "name": "_on_state_idle",
+ "is_const": false,
+ "is_static": false,
+ "is_vararg": false,
+ "is_virtual": true
+ },
+ {
+ "name": "_on_state_ready",
+ "is_const": false,
+ "is_static": false,
+ "is_vararg": false,
+ "is_virtual": true
+ },
+ {
+ "name": "_on_state_synchronized",
+ "is_const": false,
+ "is_static": false,
+ "is_vararg": false,
+ "is_virtual": true
+ },
+ {
+ "name": "_on_state_visible",
+ "is_const": false,
+ "is_static": false,
+ "is_vararg": false,
+ "is_virtual": true
+ },
+ {
+ "name": "_on_state_focused",
+ "is_const": false,
+ "is_static": false,
+ "is_vararg": false,
+ "is_virtual": true
+ },
+ {
+ "name": "_on_state_stopping",
+ "is_const": false,
+ "is_static": false,
+ "is_vararg": false,
+ "is_virtual": true
+ },
+ {
+ "name": "_on_state_loss_pending",
+ "is_const": false,
+ "is_static": false,
+ "is_vararg": false,
+ "is_virtual": true
+ },
+ {
+ "name": "_on_state_exiting",
+ "is_const": false,
+ "is_static": false,
+ "is_vararg": false,
+ "is_virtual": true
+ },
+ {
+ "name": "_on_event_polled",
+ "is_const": false,
+ "is_static": false,
+ "is_vararg": false,
+ "is_virtual": true,
+ "return_value": {
+ "type": "bool"
+ },
+ "arguments": [
+ {
+ "name": "event",
+ "type": "const void*"
+ }
+ ]
+ },
+ {
+ "name": "get_openxr_api",
+ "is_const": false,
+ "is_vararg": false,
+ "is_static": false,
+ "is_virtual": false,
+ "hash": 1637791613,
+ "return_value": {
+ "type": "OpenXRAPIExtension"
+ }
+ },
+ {
+ "name": "register_extension_wrapper",
+ "is_const": false,
+ "is_vararg": false,
+ "is_static": false,
+ "is_virtual": false,
+ "hash": 3218959716
+ }
+ ]
+ },
+ {
"name": "OpenXRHand",
"is_refcounted": false,
"is_instantiable": true,
@@ -182647,6 +184216,18 @@
}
},
{
+ "name": "get_collision_face_index",
+ "is_const": true,
+ "is_vararg": false,
+ "is_static": false,
+ "is_virtual": false,
+ "hash": 3905245786,
+ "return_value": {
+ "type": "int",
+ "meta": "int32"
+ }
+ },
+ {
"name": "add_exception_rid",
"is_const": false,
"is_vararg": false,
@@ -182875,6 +184456,31 @@
}
},
{
+ "name": "set_hit_back_faces",
+ "is_const": false,
+ "is_vararg": false,
+ "is_static": false,
+ "is_virtual": false,
+ "hash": 2586408642,
+ "arguments": [
+ {
+ "name": "enable",
+ "type": "bool"
+ }
+ ]
+ },
+ {
+ "name": "is_hit_back_faces_enabled",
+ "is_const": true,
+ "is_vararg": false,
+ "is_static": false,
+ "is_virtual": false,
+ "hash": 36873697,
+ "return_value": {
+ "type": "bool"
+ }
+ },
+ {
"name": "set_debug_shape_custom_color",
"is_const": false,
"is_vararg": false,
@@ -182960,6 +184566,12 @@
},
{
"type": "bool",
+ "name": "hit_back_faces",
+ "setter": "set_hit_back_faces",
+ "getter": "is_hit_back_faces_enabled"
+ },
+ {
+ "type": "bool",
"name": "collide_with_areas",
"setter": "set_collide_with_areas",
"getter": "is_collide_with_areas_enabled"
@@ -184312,6 +185924,787 @@
]
},
{
+ "name": "RenderSceneBuffers",
+ "is_refcounted": true,
+ "is_instantiable": false,
+ "inherits": "RefCounted",
+ "api_type": "core",
+ "methods": [
+ {
+ "name": "configure",
+ "is_const": false,
+ "is_vararg": false,
+ "is_static": false,
+ "is_virtual": false,
+ "hash": 3072623270,
+ "arguments": [
+ {
+ "name": "config",
+ "type": "RenderSceneBuffersConfiguration"
+ }
+ ]
+ }
+ ]
+ },
+ {
+ "name": "RenderSceneBuffersConfiguration",
+ "is_refcounted": true,
+ "is_instantiable": true,
+ "inherits": "RefCounted",
+ "api_type": "core",
+ "methods": [
+ {
+ "name": "get_render_target",
+ "is_const": true,
+ "is_vararg": false,
+ "is_static": false,
+ "is_virtual": false,
+ "hash": 2944877500,
+ "return_value": {
+ "type": "RID"
+ }
+ },
+ {
+ "name": "set_render_target",
+ "is_const": false,
+ "is_vararg": false,
+ "is_static": false,
+ "is_virtual": false,
+ "hash": 2722037293,
+ "arguments": [
+ {
+ "name": "render_target",
+ "type": "RID"
+ }
+ ]
+ },
+ {
+ "name": "get_internal_size",
+ "is_const": true,
+ "is_vararg": false,
+ "is_static": false,
+ "is_virtual": false,
+ "hash": 3690982128,
+ "return_value": {
+ "type": "Vector2i"
+ }
+ },
+ {
+ "name": "set_internal_size",
+ "is_const": false,
+ "is_vararg": false,
+ "is_static": false,
+ "is_virtual": false,
+ "hash": 1130785943,
+ "arguments": [
+ {
+ "name": "internal_size",
+ "type": "Vector2i"
+ }
+ ]
+ },
+ {
+ "name": "get_target_size",
+ "is_const": true,
+ "is_vararg": false,
+ "is_static": false,
+ "is_virtual": false,
+ "hash": 3690982128,
+ "return_value": {
+ "type": "Vector2i"
+ }
+ },
+ {
+ "name": "set_target_size",
+ "is_const": false,
+ "is_vararg": false,
+ "is_static": false,
+ "is_virtual": false,
+ "hash": 1130785943,
+ "arguments": [
+ {
+ "name": "target_size",
+ "type": "Vector2i"
+ }
+ ]
+ },
+ {
+ "name": "get_view_count",
+ "is_const": true,
+ "is_vararg": false,
+ "is_static": false,
+ "is_virtual": false,
+ "hash": 3905245786,
+ "return_value": {
+ "type": "int",
+ "meta": "uint32"
+ }
+ },
+ {
+ "name": "set_view_count",
+ "is_const": false,
+ "is_vararg": false,
+ "is_static": false,
+ "is_virtual": false,
+ "hash": 1286410249,
+ "arguments": [
+ {
+ "name": "view_count",
+ "type": "int",
+ "meta": "uint32"
+ }
+ ]
+ },
+ {
+ "name": "get_scaling_3d_mode",
+ "is_const": true,
+ "is_vararg": false,
+ "is_static": false,
+ "is_virtual": false,
+ "hash": 976778074,
+ "return_value": {
+ "type": "enum::RenderingServer.ViewportScaling3DMode"
+ }
+ },
+ {
+ "name": "set_scaling_3d_mode",
+ "is_const": false,
+ "is_vararg": false,
+ "is_static": false,
+ "is_virtual": false,
+ "hash": 447477857,
+ "arguments": [
+ {
+ "name": "scaling_3d_mode",
+ "type": "enum::RenderingServer.ViewportScaling3DMode"
+ }
+ ]
+ },
+ {
+ "name": "get_msaa_3d",
+ "is_const": true,
+ "is_vararg": false,
+ "is_static": false,
+ "is_virtual": false,
+ "hash": 3109158617,
+ "return_value": {
+ "type": "enum::RenderingServer.ViewportMSAA"
+ }
+ },
+ {
+ "name": "set_msaa_3d",
+ "is_const": false,
+ "is_vararg": false,
+ "is_static": false,
+ "is_virtual": false,
+ "hash": 3952630748,
+ "arguments": [
+ {
+ "name": "msaa_3d",
+ "type": "enum::RenderingServer.ViewportMSAA"
+ }
+ ]
+ },
+ {
+ "name": "get_screen_space_aa",
+ "is_const": true,
+ "is_vararg": false,
+ "is_static": false,
+ "is_virtual": false,
+ "hash": 641513172,
+ "return_value": {
+ "type": "enum::RenderingServer.ViewportScreenSpaceAA"
+ }
+ },
+ {
+ "name": "set_screen_space_aa",
+ "is_const": false,
+ "is_vararg": false,
+ "is_static": false,
+ "is_virtual": false,
+ "hash": 139543108,
+ "arguments": [
+ {
+ "name": "screen_space_aa",
+ "type": "enum::RenderingServer.ViewportScreenSpaceAA"
+ }
+ ]
+ },
+ {
+ "name": "get_fsr_sharpness",
+ "is_const": true,
+ "is_vararg": false,
+ "is_static": false,
+ "is_virtual": false,
+ "hash": 1740695150,
+ "return_value": {
+ "type": "float",
+ "meta": "float"
+ }
+ },
+ {
+ "name": "set_fsr_sharpness",
+ "is_const": false,
+ "is_vararg": false,
+ "is_static": false,
+ "is_virtual": false,
+ "hash": 373806689,
+ "arguments": [
+ {
+ "name": "fsr_sharpness",
+ "type": "float",
+ "meta": "float"
+ }
+ ]
+ },
+ {
+ "name": "get_texture_mipmap_bias",
+ "is_const": true,
+ "is_vararg": false,
+ "is_static": false,
+ "is_virtual": false,
+ "hash": 1740695150,
+ "return_value": {
+ "type": "float",
+ "meta": "float"
+ }
+ },
+ {
+ "name": "set_texture_mipmap_bias",
+ "is_const": false,
+ "is_vararg": false,
+ "is_static": false,
+ "is_virtual": false,
+ "hash": 373806689,
+ "arguments": [
+ {
+ "name": "texture_mipmap_bias",
+ "type": "float",
+ "meta": "float"
+ }
+ ]
+ }
+ ],
+ "properties": [
+ {
+ "type": "RID",
+ "name": "render_target",
+ "setter": "set_render_target",
+ "getter": "get_render_target"
+ },
+ {
+ "type": "Vector2i",
+ "name": "internal_size",
+ "setter": "set_internal_size",
+ "getter": "get_internal_size"
+ },
+ {
+ "type": "Vector2i",
+ "name": "target_size",
+ "setter": "set_target_size",
+ "getter": "get_target_size"
+ },
+ {
+ "type": "int",
+ "name": "view_count",
+ "setter": "set_view_count",
+ "getter": "get_view_count"
+ },
+ {
+ "type": "int",
+ "name": "scaling_3d_mode",
+ "setter": "set_scaling_3d_mode",
+ "getter": "get_scaling_3d_mode"
+ },
+ {
+ "type": "int",
+ "name": "msaa_3d",
+ "setter": "set_msaa_3d",
+ "getter": "get_msaa_3d"
+ },
+ {
+ "type": "int",
+ "name": "screen_space_aa",
+ "setter": "set_screen_space_aa",
+ "getter": "get_screen_space_aa"
+ },
+ {
+ "type": "bool",
+ "name": "fsr_sharpness",
+ "setter": "set_fsr_sharpness",
+ "getter": "get_fsr_sharpness"
+ },
+ {
+ "type": "bool",
+ "name": "texture_mipmap_bias",
+ "setter": "set_texture_mipmap_bias",
+ "getter": "get_texture_mipmap_bias"
+ }
+ ]
+ },
+ {
+ "name": "RenderSceneBuffersExtension",
+ "is_refcounted": true,
+ "is_instantiable": true,
+ "inherits": "RenderSceneBuffers",
+ "api_type": "core",
+ "methods": [
+ {
+ "name": "_configure",
+ "is_const": false,
+ "is_static": false,
+ "is_vararg": false,
+ "is_virtual": true,
+ "arguments": [
+ {
+ "name": "config",
+ "type": "RenderSceneBuffersConfiguration"
+ }
+ ]
+ },
+ {
+ "name": "_set_fsr_sharpness",
+ "is_const": false,
+ "is_static": false,
+ "is_vararg": false,
+ "is_virtual": true,
+ "arguments": [
+ {
+ "name": "fsr_sharpness",
+ "type": "float",
+ "meta": "float"
+ }
+ ]
+ },
+ {
+ "name": "_set_texture_mipmap_bias",
+ "is_const": false,
+ "is_static": false,
+ "is_vararg": false,
+ "is_virtual": true,
+ "arguments": [
+ {
+ "name": "texture_mipmap_bias",
+ "type": "float",
+ "meta": "float"
+ }
+ ]
+ },
+ {
+ "name": "_set_use_debanding",
+ "is_const": false,
+ "is_static": false,
+ "is_vararg": false,
+ "is_virtual": true,
+ "arguments": [
+ {
+ "name": "use_debanding",
+ "type": "bool"
+ }
+ ]
+ }
+ ]
+ },
+ {
+ "name": "RenderSceneBuffersRD",
+ "is_refcounted": true,
+ "is_instantiable": false,
+ "inherits": "RenderSceneBuffers",
+ "api_type": "core",
+ "methods": [
+ {
+ "name": "has_texture",
+ "is_const": true,
+ "is_vararg": false,
+ "is_static": false,
+ "is_virtual": false,
+ "hash": 471820014,
+ "return_value": {
+ "type": "bool"
+ },
+ "arguments": [
+ {
+ "name": "context",
+ "type": "StringName"
+ },
+ {
+ "name": "name",
+ "type": "StringName"
+ }
+ ]
+ },
+ {
+ "name": "create_texture",
+ "is_const": false,
+ "is_vararg": false,
+ "is_static": false,
+ "is_virtual": false,
+ "hash": 3559915770,
+ "return_value": {
+ "type": "RID"
+ },
+ "arguments": [
+ {
+ "name": "context",
+ "type": "StringName"
+ },
+ {
+ "name": "name",
+ "type": "StringName"
+ },
+ {
+ "name": "data_format",
+ "type": "enum::RenderingDevice.DataFormat"
+ },
+ {
+ "name": "usage_bits",
+ "type": "int",
+ "meta": "uint32"
+ },
+ {
+ "name": "texture_samples",
+ "type": "enum::RenderingDevice.TextureSamples"
+ },
+ {
+ "name": "size",
+ "type": "Vector2i"
+ },
+ {
+ "name": "layers",
+ "type": "int",
+ "meta": "uint32"
+ },
+ {
+ "name": "mipmaps",
+ "type": "int",
+ "meta": "uint32"
+ },
+ {
+ "name": "unique",
+ "type": "bool"
+ }
+ ]
+ },
+ {
+ "name": "create_texture_from_format",
+ "is_const": false,
+ "is_vararg": false,
+ "is_static": false,
+ "is_virtual": false,
+ "hash": 3344669382,
+ "return_value": {
+ "type": "RID"
+ },
+ "arguments": [
+ {
+ "name": "context",
+ "type": "StringName"
+ },
+ {
+ "name": "name",
+ "type": "StringName"
+ },
+ {
+ "name": "format",
+ "type": "RDTextureFormat"
+ },
+ {
+ "name": "view",
+ "type": "RDTextureView"
+ },
+ {
+ "name": "unique",
+ "type": "bool"
+ }
+ ]
+ },
+ {
+ "name": "create_texture_view",
+ "is_const": false,
+ "is_vararg": false,
+ "is_static": false,
+ "is_virtual": false,
+ "hash": 283055834,
+ "return_value": {
+ "type": "RID"
+ },
+ "arguments": [
+ {
+ "name": "context",
+ "type": "StringName"
+ },
+ {
+ "name": "name",
+ "type": "StringName"
+ },
+ {
+ "name": "view_name",
+ "type": "StringName"
+ },
+ {
+ "name": "view",
+ "type": "RDTextureView"
+ }
+ ]
+ },
+ {
+ "name": "get_texture",
+ "is_const": true,
+ "is_vararg": false,
+ "is_static": false,
+ "is_virtual": false,
+ "hash": 750006389,
+ "return_value": {
+ "type": "RID"
+ },
+ "arguments": [
+ {
+ "name": "context",
+ "type": "StringName"
+ },
+ {
+ "name": "name",
+ "type": "StringName"
+ }
+ ]
+ },
+ {
+ "name": "get_texture_format",
+ "is_const": true,
+ "is_vararg": false,
+ "is_static": false,
+ "is_virtual": false,
+ "hash": 371461758,
+ "return_value": {
+ "type": "RDTextureFormat"
+ },
+ "arguments": [
+ {
+ "name": "context",
+ "type": "StringName"
+ },
+ {
+ "name": "name",
+ "type": "StringName"
+ }
+ ]
+ },
+ {
+ "name": "get_texture_slice",
+ "is_const": false,
+ "is_vararg": false,
+ "is_static": false,
+ "is_virtual": false,
+ "hash": 588440706,
+ "return_value": {
+ "type": "RID"
+ },
+ "arguments": [
+ {
+ "name": "context",
+ "type": "StringName"
+ },
+ {
+ "name": "name",
+ "type": "StringName"
+ },
+ {
+ "name": "layer",
+ "type": "int",
+ "meta": "uint32"
+ },
+ {
+ "name": "mipmap",
+ "type": "int",
+ "meta": "uint32"
+ },
+ {
+ "name": "layers",
+ "type": "int",
+ "meta": "uint32"
+ },
+ {
+ "name": "mipmaps",
+ "type": "int",
+ "meta": "uint32"
+ }
+ ]
+ },
+ {
+ "name": "get_texture_slice_size",
+ "is_const": false,
+ "is_vararg": false,
+ "is_static": false,
+ "is_virtual": false,
+ "hash": 2617625368,
+ "return_value": {
+ "type": "Vector2i"
+ },
+ "arguments": [
+ {
+ "name": "context",
+ "type": "StringName"
+ },
+ {
+ "name": "name",
+ "type": "StringName"
+ },
+ {
+ "name": "mipmap",
+ "type": "int",
+ "meta": "uint32"
+ }
+ ]
+ },
+ {
+ "name": "clear_context",
+ "is_const": false,
+ "is_vararg": false,
+ "is_static": false,
+ "is_virtual": false,
+ "hash": 3304788590,
+ "arguments": [
+ {
+ "name": "context",
+ "type": "StringName"
+ }
+ ]
+ },
+ {
+ "name": "get_color_texture",
+ "is_const": false,
+ "is_vararg": false,
+ "is_static": false,
+ "is_virtual": false,
+ "hash": 529393457,
+ "return_value": {
+ "type": "RID"
+ }
+ },
+ {
+ "name": "get_color_layer",
+ "is_const": false,
+ "is_vararg": false,
+ "is_static": false,
+ "is_virtual": false,
+ "hash": 937000113,
+ "return_value": {
+ "type": "RID"
+ },
+ "arguments": [
+ {
+ "name": "layer",
+ "type": "int",
+ "meta": "uint32"
+ }
+ ]
+ },
+ {
+ "name": "get_depth_texture",
+ "is_const": false,
+ "is_vararg": false,
+ "is_static": false,
+ "is_virtual": false,
+ "hash": 529393457,
+ "return_value": {
+ "type": "RID"
+ }
+ },
+ {
+ "name": "get_depth_layer",
+ "is_const": false,
+ "is_vararg": false,
+ "is_static": false,
+ "is_virtual": false,
+ "hash": 937000113,
+ "return_value": {
+ "type": "RID"
+ },
+ "arguments": [
+ {
+ "name": "layer",
+ "type": "int",
+ "meta": "uint32"
+ }
+ ]
+ },
+ {
+ "name": "get_velocity_texture",
+ "is_const": false,
+ "is_vararg": false,
+ "is_static": false,
+ "is_virtual": false,
+ "hash": 529393457,
+ "return_value": {
+ "type": "RID"
+ }
+ },
+ {
+ "name": "get_velocity_layer",
+ "is_const": false,
+ "is_vararg": false,
+ "is_static": false,
+ "is_virtual": false,
+ "hash": 937000113,
+ "return_value": {
+ "type": "RID"
+ },
+ "arguments": [
+ {
+ "name": "layer",
+ "type": "int",
+ "meta": "uint32"
+ }
+ ]
+ },
+ {
+ "name": "get_render_target",
+ "is_const": true,
+ "is_vararg": false,
+ "is_static": false,
+ "is_virtual": false,
+ "hash": 2944877500,
+ "return_value": {
+ "type": "RID"
+ }
+ },
+ {
+ "name": "get_view_count",
+ "is_const": true,
+ "is_vararg": false,
+ "is_static": false,
+ "is_virtual": false,
+ "hash": 3905245786,
+ "return_value": {
+ "type": "int",
+ "meta": "uint32"
+ }
+ },
+ {
+ "name": "get_internal_size",
+ "is_const": true,
+ "is_vararg": false,
+ "is_static": false,
+ "is_virtual": false,
+ "hash": 3690982128,
+ "return_value": {
+ "type": "Vector2i"
+ }
+ },
+ {
+ "name": "get_use_taa",
+ "is_const": true,
+ "is_vararg": false,
+ "is_static": false,
+ "is_virtual": false,
+ "hash": 36873697,
+ "return_value": {
+ "type": "bool"
+ }
+ }
+ ]
+ },
+ {
"name": "RenderingDevice",
"is_refcounted": false,
"is_instantiable": false,
@@ -185303,10 +187696,14 @@
"is_bitfield": true,
"values": [
{
- "name": "BARRIER_MASK_RASTER",
+ "name": "BARRIER_MASK_VERTEX",
"value": 1
},
{
+ "name": "BARRIER_MASK_FRAGMENT",
+ "value": 8
+ },
+ {
"name": "BARRIER_MASK_COMPUTE",
"value": 2
},
@@ -185315,12 +187712,16 @@
"value": 4
},
{
+ "name": "BARRIER_MASK_RASTER",
+ "value": 9
+ },
+ {
"name": "BARRIER_MASK_ALL_BARRIERS",
- "value": 7
+ "value": 32767
},
{
"name": "BARRIER_MASK_NO_BARRIER",
- "value": 8
+ "value": 32768
}
]
},
@@ -186490,7 +188891,7 @@
{
"name": "post_barrier",
"type": "bitfield::RenderingDevice.BarrierMask",
- "default_value": "7"
+ "default_value": "32767"
}
]
},
@@ -186625,7 +189026,7 @@
{
"name": "post_barrier",
"type": "bitfield::RenderingDevice.BarrierMask",
- "default_value": "7"
+ "default_value": "32767"
}
]
},
@@ -186671,7 +189072,7 @@
{
"name": "post_barrier",
"type": "bitfield::RenderingDevice.BarrierMask",
- "default_value": "7"
+ "default_value": "32767"
}
]
},
@@ -186697,7 +189098,24 @@
{
"name": "post_barrier",
"type": "bitfield::RenderingDevice.BarrierMask",
- "default_value": "7"
+ "default_value": "32767"
+ }
+ ]
+ },
+ {
+ "name": "texture_get_format",
+ "is_const": false,
+ "is_vararg": false,
+ "is_static": false,
+ "is_virtual": false,
+ "hash": 1374471690,
+ "return_value": {
+ "type": "RDTextureFormat"
+ },
+ "arguments": [
+ {
+ "name": "texture",
+ "type": "RID"
}
]
},
@@ -187186,7 +189604,10 @@
"is_vararg": false,
"is_static": false,
"is_virtual": false,
- "hash": 3049171473,
+ "hash": 2078349841,
+ "hash_compatibility": [
+ 3049171473
+ ],
"return_value": {
"type": "RID"
},
@@ -187194,10 +189615,26 @@
{
"name": "binary_data",
"type": "PackedByteArray"
+ },
+ {
+ "name": "placeholder_rid",
+ "type": "RID",
+ "default_value": "RID()"
}
]
},
{
+ "name": "shader_create_placeholder",
+ "is_const": false,
+ "is_vararg": false,
+ "is_static": false,
+ "is_virtual": false,
+ "hash": 529393457,
+ "return_value": {
+ "type": "RID"
+ }
+ },
+ {
"name": "shader_get_vertex_input_attribute_mask",
"is_const": false,
"is_vararg": false,
@@ -187368,7 +189805,7 @@
{
"name": "post_barrier",
"type": "bitfield::RenderingDevice.BarrierMask",
- "default_value": "7"
+ "default_value": "32767"
}
]
},
@@ -187400,7 +189837,7 @@
{
"name": "post_barrier",
"type": "bitfield::RenderingDevice.BarrierMask",
- "default_value": "7"
+ "default_value": "32767"
}
]
},
@@ -187980,12 +190417,12 @@
"is_vararg": false,
"is_static": false,
"is_virtual": false,
- "hash": 422991495,
+ "hash": 3920951950,
"arguments": [
{
"name": "post_barrier",
"type": "bitfield::RenderingDevice.BarrierMask",
- "default_value": "7"
+ "default_value": "32767"
}
]
},
@@ -188126,12 +190563,12 @@
"is_vararg": false,
"is_static": false,
"is_virtual": false,
- "hash": 422991495,
+ "hash": 3920951950,
"arguments": [
{
"name": "post_barrier",
"type": "bitfield::RenderingDevice.BarrierMask",
- "default_value": "7"
+ "default_value": "32767"
}
]
},
@@ -188295,17 +190732,17 @@
"is_vararg": false,
"is_static": false,
"is_virtual": false,
- "hash": 266666049,
+ "hash": 3718155691,
"arguments": [
{
"name": "from",
"type": "bitfield::RenderingDevice.BarrierMask",
- "default_value": "7"
+ "default_value": "32767"
},
{
"name": "to",
"type": "bitfield::RenderingDevice.BarrierMask",
- "default_value": "7"
+ "default_value": "32767"
}
]
},
@@ -191000,6 +193437,23 @@
]
},
{
+ "name": "texture_get_format",
+ "is_const": true,
+ "is_vararg": false,
+ "is_static": false,
+ "is_virtual": false,
+ "hash": 1932918979,
+ "return_value": {
+ "type": "enum::Image.Format"
+ },
+ "arguments": [
+ {
+ "name": "texture",
+ "type": "RID"
+ }
+ ]
+ },
+ {
"name": "texture_set_force_redraw_if_visible",
"is_const": false,
"is_vararg": false,
@@ -191018,6 +193472,28 @@
]
},
{
+ "name": "texture_rd_create",
+ "is_const": false,
+ "is_vararg": false,
+ "is_static": false,
+ "is_virtual": false,
+ "hash": 3291180269,
+ "return_value": {
+ "type": "RID"
+ },
+ "arguments": [
+ {
+ "name": "rd_texture",
+ "type": "RID"
+ },
+ {
+ "name": "layer_type",
+ "type": "enum::RenderingServer.TextureLayeredType",
+ "default_value": "0"
+ }
+ ]
+ },
+ {
"name": "texture_get_rd_texture",
"is_const": true,
"is_vararg": false,
@@ -195553,6 +198029,24 @@
]
},
{
+ "name": "viewport_set_use_hdr_2d",
+ "is_const": false,
+ "is_vararg": false,
+ "is_static": false,
+ "is_virtual": false,
+ "hash": 1265174801,
+ "arguments": [
+ {
+ "name": "viewport",
+ "type": "RID"
+ },
+ {
+ "name": "enabled",
+ "type": "bool"
+ }
+ ]
+ },
+ {
"name": "viewport_set_screen_space_aa",
"is_const": false,
"is_vararg": false,
@@ -199902,6 +202396,20 @@
"return_value": {
"type": "RenderingDevice"
}
+ },
+ {
+ "name": "call_on_render_thread",
+ "is_const": false,
+ "is_vararg": false,
+ "is_static": false,
+ "is_virtual": false,
+ "hash": 1611583062,
+ "arguments": [
+ {
+ "name": "callable",
+ "type": "Callable"
+ }
+ ]
}
],
"signals": [
@@ -200466,6 +202974,147 @@
]
},
{
+ "name": "ResourceImporterBMFont",
+ "is_refcounted": true,
+ "is_instantiable": false,
+ "inherits": "ResourceImporter",
+ "api_type": "editor"
+ },
+ {
+ "name": "ResourceImporterBitMap",
+ "is_refcounted": true,
+ "is_instantiable": false,
+ "inherits": "ResourceImporter",
+ "api_type": "editor"
+ },
+ {
+ "name": "ResourceImporterCSVTranslation",
+ "is_refcounted": true,
+ "is_instantiable": false,
+ "inherits": "ResourceImporter",
+ "api_type": "editor"
+ },
+ {
+ "name": "ResourceImporterDynamicFont",
+ "is_refcounted": true,
+ "is_instantiable": false,
+ "inherits": "ResourceImporter",
+ "api_type": "editor"
+ },
+ {
+ "name": "ResourceImporterImage",
+ "is_refcounted": true,
+ "is_instantiable": false,
+ "inherits": "ResourceImporter",
+ "api_type": "editor"
+ },
+ {
+ "name": "ResourceImporterImageFont",
+ "is_refcounted": true,
+ "is_instantiable": false,
+ "inherits": "ResourceImporter",
+ "api_type": "editor"
+ },
+ {
+ "name": "ResourceImporterLayeredTexture",
+ "is_refcounted": true,
+ "is_instantiable": false,
+ "inherits": "ResourceImporter",
+ "api_type": "editor"
+ },
+ {
+ "name": "ResourceImporterMP3",
+ "is_refcounted": true,
+ "is_instantiable": true,
+ "inherits": "ResourceImporter",
+ "api_type": "core"
+ },
+ {
+ "name": "ResourceImporterOBJ",
+ "is_refcounted": true,
+ "is_instantiable": false,
+ "inherits": "ResourceImporter",
+ "api_type": "editor"
+ },
+ {
+ "name": "ResourceImporterOggVorbis",
+ "is_refcounted": true,
+ "is_instantiable": true,
+ "inherits": "ResourceImporter",
+ "api_type": "core",
+ "methods": [
+ {
+ "name": "load_from_buffer",
+ "is_const": false,
+ "is_vararg": false,
+ "is_static": true,
+ "is_virtual": false,
+ "hash": 354904730,
+ "return_value": {
+ "type": "AudioStreamOggVorbis"
+ },
+ "arguments": [
+ {
+ "name": "buffer",
+ "type": "PackedByteArray"
+ }
+ ]
+ },
+ {
+ "name": "load_from_file",
+ "is_const": false,
+ "is_vararg": false,
+ "is_static": true,
+ "is_virtual": false,
+ "hash": 797568536,
+ "return_value": {
+ "type": "AudioStreamOggVorbis"
+ },
+ "arguments": [
+ {
+ "name": "path",
+ "type": "String"
+ }
+ ]
+ }
+ ]
+ },
+ {
+ "name": "ResourceImporterScene",
+ "is_refcounted": true,
+ "is_instantiable": false,
+ "inherits": "ResourceImporter",
+ "api_type": "editor"
+ },
+ {
+ "name": "ResourceImporterShaderFile",
+ "is_refcounted": true,
+ "is_instantiable": false,
+ "inherits": "ResourceImporter",
+ "api_type": "editor"
+ },
+ {
+ "name": "ResourceImporterTexture",
+ "is_refcounted": true,
+ "is_instantiable": false,
+ "inherits": "ResourceImporter",
+ "api_type": "editor"
+ },
+ {
+ "name": "ResourceImporterTextureAtlas",
+ "is_refcounted": true,
+ "is_instantiable": false,
+ "inherits": "ResourceImporter",
+ "api_type": "editor"
+ },
+ {
+ "name": "ResourceImporterWAV",
+ "is_refcounted": true,
+ "is_instantiable": false,
+ "inherits": "ResourceImporter",
+ "api_type": "editor"
+ },
+ {
"name": "ResourceLoader",
"is_refcounted": false,
"is_instantiable": true,
@@ -201549,7 +204198,10 @@
"is_vararg": false,
"is_static": false,
"is_virtual": false,
- "hash": 3014009009,
+ "hash": 814287596,
+ "hash_compatibility": [
+ 3014009009
+ ],
"arguments": [
{
"name": "font",
@@ -201558,7 +204210,8 @@
{
"name": "font_size",
"type": "int",
- "meta": "int32"
+ "meta": "int32",
+ "default_value": "0"
}
]
},
@@ -201862,7 +204515,10 @@
"is_vararg": false,
"is_static": false,
"is_virtual": false,
- "hash": 4258957458,
+ "hash": 4132157579,
+ "hash_compatibility": [
+ 4258957458
+ ],
"arguments": [
{
"name": "column",
@@ -201876,7 +204532,8 @@
{
"name": "ratio",
"type": "int",
- "meta": "int32"
+ "meta": "int32",
+ "default_value": "1"
}
]
},
@@ -201999,6 +204656,22 @@
]
},
{
+ "name": "push_context",
+ "is_const": false,
+ "is_vararg": false,
+ "is_static": false,
+ "is_virtual": false,
+ "hash": 3218959716
+ },
+ {
+ "name": "pop_context",
+ "is_const": false,
+ "is_vararg": false,
+ "is_static": false,
+ "is_virtual": false,
+ "hash": 3218959716
+ },
+ {
"name": "pop",
"is_const": false,
"is_vararg": false,
@@ -202007,6 +204680,14 @@
"hash": 3218959716
},
{
+ "name": "pop_all",
+ "is_const": false,
+ "is_vararg": false,
+ "is_static": false,
+ "is_virtual": false,
+ "hash": 3218959716
+ },
+ {
"name": "clear",
"is_const": false,
"is_vararg": false,
@@ -202441,6 +205122,31 @@
}
},
{
+ "name": "set_drag_and_drop_selection_enabled",
+ "is_const": false,
+ "is_vararg": false,
+ "is_static": false,
+ "is_virtual": false,
+ "hash": 2586408642,
+ "arguments": [
+ {
+ "name": "enable",
+ "type": "bool"
+ }
+ ]
+ },
+ {
+ "name": "is_drag_and_drop_selection_enabled",
+ "is_const": true,
+ "is_vararg": false,
+ "is_static": false,
+ "is_virtual": false,
+ "hash": 36873697,
+ "return_value": {
+ "type": "bool"
+ }
+ },
+ {
"name": "get_selection_from",
"is_const": true,
"is_vararg": false,
@@ -203081,6 +205787,12 @@
"getter": "is_deselect_on_focus_loss_enabled"
},
{
+ "type": "bool",
+ "name": "drag_and_drop_selection_enabled",
+ "setter": "set_drag_and_drop_selection_enabled",
+ "getter": "is_drag_and_drop_selection_enabled"
+ },
+ {
"type": "int",
"name": "visible_characters",
"setter": "set_visible_characters",
@@ -223439,12 +226151,6 @@
"name": "oversampling",
"setter": "set_oversampling",
"getter": "get_oversampling"
- },
- {
- "type": "typedarray::24/17:Font",
- "name": "fallbacks",
- "setter": "set_fallbacks",
- "getter": "get_fallbacks"
}
]
},
@@ -240243,6 +242949,55 @@
]
},
{
+ "name": "Texture2DArrayRD",
+ "is_refcounted": true,
+ "is_instantiable": true,
+ "inherits": "TextureLayeredRD",
+ "api_type": "core"
+ },
+ {
+ "name": "Texture2DRD",
+ "is_refcounted": true,
+ "is_instantiable": true,
+ "inherits": "Texture2D",
+ "api_type": "core",
+ "methods": [
+ {
+ "name": "set_texture_rd_rid",
+ "is_const": false,
+ "is_vararg": false,
+ "is_static": false,
+ "is_virtual": false,
+ "hash": 2722037293,
+ "arguments": [
+ {
+ "name": "texture_rd_rid",
+ "type": "RID"
+ }
+ ]
+ },
+ {
+ "name": "get_texture_rd_rid",
+ "is_const": true,
+ "is_vararg": false,
+ "is_static": false,
+ "is_virtual": false,
+ "hash": 2944877500,
+ "return_value": {
+ "type": "RID"
+ }
+ }
+ ],
+ "properties": [
+ {
+ "type": "RID",
+ "name": "texture_rd_rid",
+ "setter": "set_texture_rd_rid",
+ "getter": "get_texture_rd_rid"
+ }
+ ]
+ },
+ {
"name": "Texture3D",
"is_refcounted": true,
"is_instantiable": true,
@@ -240395,6 +243150,48 @@
]
},
{
+ "name": "Texture3DRD",
+ "is_refcounted": true,
+ "is_instantiable": true,
+ "inherits": "Texture3D",
+ "api_type": "core",
+ "methods": [
+ {
+ "name": "set_texture_rd_rid",
+ "is_const": false,
+ "is_vararg": false,
+ "is_static": false,
+ "is_virtual": false,
+ "hash": 2722037293,
+ "arguments": [
+ {
+ "name": "texture_rd_rid",
+ "type": "RID"
+ }
+ ]
+ },
+ {
+ "name": "get_texture_rd_rid",
+ "is_const": true,
+ "is_vararg": false,
+ "is_static": false,
+ "is_virtual": false,
+ "hash": 2944877500,
+ "return_value": {
+ "type": "RID"
+ }
+ }
+ ],
+ "properties": [
+ {
+ "type": "RID",
+ "name": "texture_rd_rid",
+ "setter": "set_texture_rd_rid",
+ "getter": "get_texture_rd_rid"
+ }
+ ]
+ },
+ {
"name": "TextureButton",
"is_refcounted": false,
"is_instantiable": true,
@@ -240752,6 +243549,20 @@
]
},
{
+ "name": "TextureCubemapArrayRD",
+ "is_refcounted": true,
+ "is_instantiable": true,
+ "inherits": "TextureLayeredRD",
+ "api_type": "core"
+ },
+ {
+ "name": "TextureCubemapRD",
+ "is_refcounted": true,
+ "is_instantiable": true,
+ "inherits": "TextureLayeredRD",
+ "api_type": "core"
+ },
+ {
"name": "TextureLayered",
"is_refcounted": true,
"is_instantiable": true,
@@ -240949,6 +243760,48 @@
]
},
{
+ "name": "TextureLayeredRD",
+ "is_refcounted": true,
+ "is_instantiable": false,
+ "inherits": "TextureLayered",
+ "api_type": "core",
+ "methods": [
+ {
+ "name": "set_texture_rd_rid",
+ "is_const": false,
+ "is_vararg": false,
+ "is_static": false,
+ "is_virtual": false,
+ "hash": 2722037293,
+ "arguments": [
+ {
+ "name": "texture_rd_rid",
+ "type": "RID"
+ }
+ ]
+ },
+ {
+ "name": "get_texture_rd_rid",
+ "is_const": true,
+ "is_vararg": false,
+ "is_static": false,
+ "is_virtual": false,
+ "hash": 2944877500,
+ "return_value": {
+ "type": "RID"
+ }
+ }
+ ],
+ "properties": [
+ {
+ "type": "RID",
+ "name": "texture_rd_rid",
+ "setter": "set_texture_rd_rid",
+ "getter": "get_texture_rd_rid"
+ }
+ ]
+ },
+ {
"name": "TextureProgressBar",
"is_refcounted": false,
"is_instantiable": true,
@@ -244521,6 +247374,80 @@
]
},
{
+ "name": "set_layer_navigation_map",
+ "is_const": false,
+ "is_vararg": false,
+ "is_static": false,
+ "is_virtual": false,
+ "hash": 4040184819,
+ "arguments": [
+ {
+ "name": "layer",
+ "type": "int",
+ "meta": "int32"
+ },
+ {
+ "name": "map",
+ "type": "RID"
+ }
+ ]
+ },
+ {
+ "name": "get_layer_navigation_map",
+ "is_const": true,
+ "is_vararg": false,
+ "is_static": false,
+ "is_virtual": false,
+ "hash": 495598643,
+ "return_value": {
+ "type": "RID"
+ },
+ "arguments": [
+ {
+ "name": "layer",
+ "type": "int",
+ "meta": "int32"
+ }
+ ]
+ },
+ {
+ "name": "set_navigation_map",
+ "is_const": false,
+ "is_vararg": false,
+ "is_static": false,
+ "is_virtual": false,
+ "hash": 4040184819,
+ "arguments": [
+ {
+ "name": "layer",
+ "type": "int",
+ "meta": "int32"
+ },
+ {
+ "name": "map",
+ "type": "RID"
+ }
+ ]
+ },
+ {
+ "name": "get_navigation_map",
+ "is_const": true,
+ "is_vararg": false,
+ "is_static": false,
+ "is_virtual": false,
+ "hash": 495598643,
+ "return_value": {
+ "type": "RID"
+ },
+ "arguments": [
+ {
+ "name": "layer",
+ "type": "int",
+ "meta": "int32"
+ }
+ ]
+ },
+ {
"name": "set_collision_animatable",
"is_const": false,
"is_vararg": false,
@@ -244596,43 +247523,6 @@
}
},
{
- "name": "set_navigation_map",
- "is_const": false,
- "is_vararg": false,
- "is_static": false,
- "is_virtual": false,
- "hash": 4040184819,
- "arguments": [
- {
- "name": "layer",
- "type": "int",
- "meta": "int32"
- },
- {
- "name": "map",
- "type": "RID"
- }
- ]
- },
- {
- "name": "get_navigation_map",
- "is_const": true,
- "is_vararg": false,
- "is_static": false,
- "is_virtual": false,
- "hash": 495598643,
- "return_value": {
- "type": "RID"
- },
- "arguments": [
- {
- "name": "layer",
- "type": "int",
- "meta": "int32"
- }
- ]
- },
- {
"name": "set_cell",
"is_const": false,
"is_vararg": false,
@@ -245089,11 +247979,14 @@
},
{
"name": "get_used_rect",
- "is_const": false,
+ "is_const": true,
"is_vararg": false,
"is_static": false,
"is_virtual": false,
- "hash": 2024035737,
+ "hash": 410525958,
+ "hash_compatibility": [
+ 2024035737
+ ],
"return_value": {
"type": "Rect2i"
}
@@ -247125,6 +250018,26 @@
"is_instantiable": true,
"inherits": "TileSetSource",
"api_type": "core",
+ "enums": [
+ {
+ "name": "TileAnimationMode",
+ "is_bitfield": false,
+ "values": [
+ {
+ "name": "TILE_ANIMATION_MODE_DEFAULT",
+ "value": 0
+ },
+ {
+ "name": "TILE_ANIMATION_MODE_RANDOM_START_TIMES",
+ "value": 1
+ },
+ {
+ "name": "TILE_ANIMATION_MODE_MAX",
+ "value": 2
+ }
+ ]
+ }
+ ],
"methods": [
{
"name": "set_texture",
@@ -247521,6 +250434,41 @@
]
},
{
+ "name": "set_tile_animation_mode",
+ "is_const": false,
+ "is_vararg": false,
+ "is_static": false,
+ "is_virtual": false,
+ "hash": 3192753483,
+ "arguments": [
+ {
+ "name": "atlas_coords",
+ "type": "Vector2i"
+ },
+ {
+ "name": "mode",
+ "type": "enum::TileSetAtlasSource.TileAnimationMode"
+ }
+ ]
+ },
+ {
+ "name": "get_tile_animation_mode",
+ "is_const": true,
+ "is_vararg": false,
+ "is_static": false,
+ "is_virtual": false,
+ "hash": 4025349959,
+ "return_value": {
+ "type": "enum::TileSetAtlasSource.TileAnimationMode"
+ },
+ "arguments": [
+ {
+ "name": "atlas_coords",
+ "type": "Vector2i"
+ }
+ ]
+ },
+ {
"name": "set_tile_animation_frames_count",
"is_const": false,
"is_vararg": false,
@@ -252486,6 +255434,30 @@
]
},
{
+ "name": "set_button_tooltip_text",
+ "is_const": false,
+ "is_vararg": false,
+ "is_static": false,
+ "is_virtual": false,
+ "hash": 2285447957,
+ "arguments": [
+ {
+ "name": "column",
+ "type": "int",
+ "meta": "int32"
+ },
+ {
+ "name": "button_index",
+ "type": "int",
+ "meta": "int32"
+ },
+ {
+ "name": "tooltip",
+ "type": "String"
+ }
+ ]
+ },
+ {
"name": "set_button",
"is_const": false,
"is_vararg": false,
@@ -255077,13 +258049,6 @@
]
},
{
- "name": "UniformSetCacheRD",
- "is_refcounted": false,
- "is_instantiable": false,
- "inherits": "Object",
- "api_type": "core"
- },
- {
"name": "VBoxContainer",
"is_refcounted": false,
"is_instantiable": true,
@@ -256069,6 +259034,31 @@
}
},
{
+ "name": "set_loop",
+ "is_const": false,
+ "is_vararg": false,
+ "is_static": false,
+ "is_virtual": false,
+ "hash": 2586408642,
+ "arguments": [
+ {
+ "name": "loop",
+ "type": "bool"
+ }
+ ]
+ },
+ {
+ "name": "has_loop",
+ "is_const": true,
+ "is_vararg": false,
+ "is_static": false,
+ "is_virtual": false,
+ "hash": 36873697,
+ "return_value": {
+ "type": "bool"
+ }
+ },
+ {
"name": "set_volume",
"is_const": false,
"is_vararg": false,
@@ -256161,6 +259151,18 @@
}
},
{
+ "name": "get_stream_length",
+ "is_const": true,
+ "is_vararg": false,
+ "is_static": false,
+ "is_virtual": false,
+ "hash": 1740695150,
+ "return_value": {
+ "type": "float",
+ "meta": "double"
+ }
+ },
+ {
"name": "set_stream_position",
"is_const": false,
"is_vararg": false,
@@ -256350,6 +259352,12 @@
"getter": "has_expand"
},
{
+ "type": "bool",
+ "name": "loop",
+ "setter": "set_loop",
+ "getter": "has_loop"
+ },
+ {
"type": "int",
"name": "buffering_msec",
"setter": "set_buffering_msec",
@@ -256898,6 +259906,31 @@
}
},
{
+ "name": "set_use_hdr_2d",
+ "is_const": false,
+ "is_vararg": false,
+ "is_static": false,
+ "is_virtual": false,
+ "hash": 2586408642,
+ "arguments": [
+ {
+ "name": "enable",
+ "type": "bool"
+ }
+ ]
+ },
+ {
+ "name": "is_using_hdr_2d",
+ "is_const": true,
+ "is_vararg": false,
+ "is_static": false,
+ "is_virtual": false,
+ "hash": 36873697,
+ "return_value": {
+ "type": "bool"
+ }
+ },
+ {
"name": "set_msaa_2d",
"is_const": false,
"is_vararg": false,
@@ -258210,6 +261243,12 @@
"getter": "get_debug_draw"
},
{
+ "type": "bool",
+ "name": "use_hdr_2d",
+ "setter": "set_use_hdr_2d",
+ "getter": "is_using_hdr_2d"
+ },
+ {
"type": "int",
"name": "scaling_3d_mode",
"setter": "set_scaling_3d_mode",
@@ -259566,6 +262605,24 @@
],
"methods": [
{
+ "name": "get_default_input_port",
+ "is_const": true,
+ "is_vararg": false,
+ "is_static": false,
+ "is_virtual": false,
+ "hash": 1894493699,
+ "return_value": {
+ "type": "int",
+ "meta": "int32"
+ },
+ "arguments": [
+ {
+ "name": "type",
+ "type": "enum::VisualShaderNode.PortType"
+ }
+ ]
+ },
+ {
"name": "set_output_port_for_preview",
"is_const": false,
"is_vararg": false,
@@ -260883,6 +263940,23 @@
]
},
{
+ "name": "_get_default_input_port",
+ "is_const": true,
+ "is_static": false,
+ "is_vararg": false,
+ "is_virtual": true,
+ "return_value": {
+ "type": "int",
+ "meta": "int32"
+ },
+ "arguments": [
+ {
+ "name": "type",
+ "type": "enum::VisualShaderNode.PortType"
+ }
+ ]
+ },
+ {
"name": "_get_output_port_count",
"is_const": true,
"is_static": false,
@@ -263557,6 +266631,13 @@
]
},
{
+ "name": "VisualShaderNodeRotationByAxis",
+ "is_refcounted": true,
+ "is_instantiable": true,
+ "inherits": "VisualShaderNode",
+ "api_type": "core"
+ },
+ {
"name": "VisualShaderNodeSDFRaymarch",
"is_refcounted": true,
"is_instantiable": true,
@@ -263633,6 +266714,13 @@
]
},
{
+ "name": "VisualShaderNodeScreenNormalWorldSpace",
+ "is_refcounted": true,
+ "is_instantiable": true,
+ "inherits": "VisualShaderNode",
+ "api_type": "core"
+ },
+ {
"name": "VisualShaderNodeScreenUVToSDF",
"is_refcounted": true,
"is_instantiable": true,
@@ -266012,6 +269100,13 @@
"api_type": "core"
},
{
+ "name": "VisualShaderNodeWorldPositionFromDepth",
+ "is_refcounted": true,
+ "is_instantiable": true,
+ "inherits": "VisualShaderNode",
+ "api_type": "core"
+ },
+ {
"name": "VoxelGI",
"is_refcounted": false,
"is_instantiable": true,
@@ -268955,6 +272050,16 @@
],
"methods": [
{
+ "name": "_get_contents_minimum_size",
+ "is_const": true,
+ "is_static": false,
+ "is_vararg": false,
+ "is_virtual": true,
+ "return_value": {
+ "type": "Vector2"
+ }
+ },
+ {
"name": "set_title",
"is_const": false,
"is_vararg": false,
diff --git a/gdextension/gdextension_interface.h b/gdextension/gdextension_interface.h
index 43931cc..9d9ae20 100644
--- a/gdextension/gdextension_interface.h
+++ b/gdextension/gdextension_interface.h
@@ -258,7 +258,9 @@ typedef const GDExtensionPropertyInfo *(*GDExtensionClassGetPropertyList)(GDExte
typedef void (*GDExtensionClassFreePropertyList)(GDExtensionClassInstancePtr p_instance, const GDExtensionPropertyInfo *p_list);
typedef GDExtensionBool (*GDExtensionClassPropertyCanRevert)(GDExtensionClassInstancePtr p_instance, GDExtensionConstStringNamePtr p_name);
typedef GDExtensionBool (*GDExtensionClassPropertyGetRevert)(GDExtensionClassInstancePtr p_instance, GDExtensionConstStringNamePtr p_name, GDExtensionVariantPtr r_ret);
-typedef void (*GDExtensionClassNotification)(GDExtensionClassInstancePtr p_instance, int32_t p_what);
+typedef GDExtensionBool (*GDExtensionClassValidateProperty)(GDExtensionClassInstancePtr p_instance, GDExtensionPropertyInfo *p_property);
+typedef void (*GDExtensionClassNotification)(GDExtensionClassInstancePtr p_instance, int32_t p_what); // Deprecated. Use GDExtensionClassNotification2 instead.
+typedef void (*GDExtensionClassNotification2)(GDExtensionClassInstancePtr p_instance, int32_t p_what, GDExtensionBool p_reversed);
typedef void (*GDExtensionClassToString)(GDExtensionClassInstancePtr p_instance, GDExtensionBool *r_is_valid, GDExtensionStringPtr p_out);
typedef void (*GDExtensionClassReference)(GDExtensionClassInstancePtr p_instance);
typedef void (*GDExtensionClassUnreference)(GDExtensionClassInstancePtr p_instance);
@@ -285,7 +287,29 @@ 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;
+} GDExtensionClassCreationInfo; // Deprecated. Use GDExtensionClassCreationInfo2 instead.
+
+typedef struct {
+ GDExtensionBool is_virtual;
+ GDExtensionBool is_abstract;
+ GDExtensionBool is_exposed;
+ GDExtensionClassSet set_func;
+ GDExtensionClassGet get_func;
+ GDExtensionClassGetPropertyList get_property_list_func;
+ GDExtensionClassFreePropertyList 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;
+ GDExtensionClassCreateInstance create_instance_func; // (Default) constructor; mandatory. If the class is not instantiable, consider making it virtual or abstract.
+ GDExtensionClassFreeInstance free_instance_func; // Destructor; mandatory.
+ 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.
+} GDExtensionClassCreationInfo2;
typedef void *GDExtensionClassLibraryPtr;
@@ -352,6 +376,7 @@ typedef GDExtensionBool (*GDExtensionScriptInstanceGet)(GDExtensionScriptInstanc
typedef const GDExtensionPropertyInfo *(*GDExtensionScriptInstanceGetPropertyList)(GDExtensionScriptInstanceDataPtr p_instance, uint32_t *r_count);
typedef void (*GDExtensionScriptInstanceFreePropertyList)(GDExtensionScriptInstanceDataPtr p_instance, const GDExtensionPropertyInfo *p_list);
typedef GDExtensionVariantType (*GDExtensionScriptInstanceGetPropertyType)(GDExtensionScriptInstanceDataPtr p_instance, GDExtensionConstStringNamePtr p_name, GDExtensionBool *r_is_valid);
+typedef GDExtensionBool (*GDExtensionScriptInstanceValidateProperty)(GDExtensionScriptInstanceDataPtr p_instance, GDExtensionPropertyInfo *p_property);
typedef GDExtensionBool (*GDExtensionScriptInstancePropertyCanRevert)(GDExtensionScriptInstanceDataPtr p_instance, GDExtensionConstStringNamePtr p_name);
typedef GDExtensionBool (*GDExtensionScriptInstancePropertyGetRevert)(GDExtensionScriptInstanceDataPtr p_instance, GDExtensionConstStringNamePtr p_name, GDExtensionVariantPtr r_ret);
@@ -366,7 +391,8 @@ typedef void (*GDExtensionScriptInstanceFreeMethodList)(GDExtensionScriptInstanc
typedef GDExtensionBool (*GDExtensionScriptInstanceHasMethod)(GDExtensionScriptInstanceDataPtr p_instance, GDExtensionConstStringNamePtr p_name);
typedef void (*GDExtensionScriptInstanceCall)(GDExtensionScriptInstanceDataPtr p_self, GDExtensionConstStringNamePtr p_method, const GDExtensionConstVariantPtr *p_args, GDExtensionInt p_argument_count, GDExtensionVariantPtr r_return, GDExtensionCallError *r_error);
-typedef void (*GDExtensionScriptInstanceNotification)(GDExtensionScriptInstanceDataPtr p_instance, int32_t p_what);
+typedef void (*GDExtensionScriptInstanceNotification)(GDExtensionScriptInstanceDataPtr p_instance, int32_t p_what); // Deprecated. Use GDExtensionScriptInstanceNotification2 instead.
+typedef void (*GDExtensionScriptInstanceNotification2)(GDExtensionScriptInstanceDataPtr p_instance, int32_t p_what, GDExtensionBool p_reversed);
typedef void (*GDExtensionScriptInstanceToString)(GDExtensionScriptInstanceDataPtr p_instance, GDExtensionBool *r_is_valid, GDExtensionStringPtr r_out);
typedef void (*GDExtensionScriptInstanceRefCountIncremented)(GDExtensionScriptInstanceDataPtr p_instance);
@@ -420,7 +446,47 @@ typedef struct {
GDExtensionScriptInstanceFree free_func;
-} GDExtensionScriptInstanceInfo;
+} GDExtensionScriptInstanceInfo; // Deprecated. Use GDExtensionScriptInstanceInfo2 instead.
+
+typedef struct {
+ GDExtensionScriptInstanceSet set_func;
+ GDExtensionScriptInstanceGet get_func;
+ GDExtensionScriptInstanceGetPropertyList get_property_list_func;
+ GDExtensionScriptInstanceFreePropertyList free_property_list_func;
+
+ GDExtensionScriptInstancePropertyCanRevert property_can_revert_func;
+ GDExtensionScriptInstancePropertyGetRevert property_get_revert_func;
+
+ GDExtensionScriptInstanceGetOwner get_owner_func;
+ GDExtensionScriptInstanceGetPropertyState get_property_state_func;
+
+ GDExtensionScriptInstanceGetMethodList get_method_list_func;
+ GDExtensionScriptInstanceFreeMethodList free_method_list_func;
+ GDExtensionScriptInstanceGetPropertyType get_property_type_func;
+ GDExtensionScriptInstanceValidateProperty validate_property_func;
+
+ GDExtensionScriptInstanceHasMethod has_method_func;
+
+ GDExtensionScriptInstanceCall call_func;
+ GDExtensionScriptInstanceNotification2 notification_func;
+
+ GDExtensionScriptInstanceToString to_string_func;
+
+ GDExtensionScriptInstanceRefCountIncremented refcount_incremented_func;
+ GDExtensionScriptInstanceRefCountDecremented refcount_decremented_func;
+
+ GDExtensionScriptInstanceGetScript get_script_func;
+
+ GDExtensionScriptInstanceIsPlaceholder is_placeholder_func;
+
+ GDExtensionScriptInstanceSet set_fallback_func;
+ GDExtensionScriptInstanceGet get_fallback_func;
+
+ GDExtensionScriptInstanceGetLanguage get_language_func;
+
+ GDExtensionScriptInstanceFree free_func;
+
+} GDExtensionScriptInstanceInfo2;
/* INITIALIZATION */
@@ -1526,6 +1592,25 @@ typedef void (*GDExtensionInterfaceStringOperatorPlusEqWcstr)(GDExtensionStringP
*/
typedef void (*GDExtensionInterfaceStringOperatorPlusEqC32str)(GDExtensionStringPtr p_self, const char32_t *p_b);
+/**
+ * @name string_resize
+ * @since 4.2
+ *
+ * Resizes the underlying string data to the given number of characters.
+ *
+ * Space needs to be allocated for the null terminating character ('\0') which
+ * also must be added manually, in order for all string functions to work correctly.
+ *
+ * Warning: This is an error-prone operation - only use it if there's no other
+ * efficient way to accomplish your goal.
+ *
+ * @param p_self A pointer to the String.
+ * @param p_resize The new length for the String.
+ *
+ * @return Error code signifying if the operation successful.
+ */
+typedef GDExtensionInt (*GDExtensionInterfaceStringResize)(GDExtensionStringPtr p_self, GDExtensionInt p_resize);
+
/* INTERFACE: XMLParser Utilities */
/**
@@ -2097,6 +2182,7 @@ typedef void (*GDExtensionInterfaceRefSetObject)(GDExtensionRefPtr p_ref, GDExte
/**
* @name script_instance_create
* @since 4.1
+ * @deprecated in Godot 4.2. Use `script_instance_create2` instead.
*
* Creates a script instance that contains the given info and instance data.
*
@@ -2107,6 +2193,63 @@ typedef void (*GDExtensionInterfaceRefSetObject)(GDExtensionRefPtr p_ref, GDExte
*/
typedef GDExtensionScriptInstancePtr (*GDExtensionInterfaceScriptInstanceCreate)(const GDExtensionScriptInstanceInfo *p_info, GDExtensionScriptInstanceDataPtr p_instance_data);
+/**
+ * @name script_instance_create2
+ * @since 4.2
+ *
+ * Creates a script instance that contains the given info and instance data.
+ *
+ * @param p_info A pointer to a GDExtensionScriptInstanceInfo2 struct.
+ * @param p_instance_data A pointer to a data representing the script instance in the GDExtension. This will be passed to all the function pointers on p_info.
+ *
+ * @return A pointer to a ScriptInstanceExtension object.
+ */
+typedef GDExtensionScriptInstancePtr (*GDExtensionInterfaceScriptInstanceCreate2)(const GDExtensionScriptInstanceInfo2 *p_info, GDExtensionScriptInstanceDataPtr p_instance_data);
+
+/**
+ * @name placeholder_script_instance_create
+ * @since 4.2
+ *
+ * Creates a placeholder script instance for a given script and instance.
+ *
+ * This interface is optional as a custom placeholder could also be created with script_instance_create().
+ *
+ * @param p_language A pointer to a ScriptLanguage.
+ * @param p_script A pointer to a Script.
+ * @param p_owner A pointer to an Object.
+ *
+ * @return A pointer to a PlaceHolderScriptInstance object.
+ */
+typedef GDExtensionScriptInstancePtr (*GDExtensionInterfacePlaceHolderScriptInstanceCreate)(GDExtensionObjectPtr p_language, GDExtensionObjectPtr p_script, GDExtensionObjectPtr p_owner);
+
+/**
+ * @name placeholder_script_instance_update
+ * @since 4.2
+ *
+ * Updates a placeholder script instance with the given properties and values.
+ *
+ * The passed in placeholder must be an instance of PlaceHolderScriptInstance
+ * such as the one returned by placeholder_script_instance_create().
+ *
+ * @param p_placeholder A pointer to a PlaceHolderScriptInstance.
+ * @param p_properties A pointer to an Array of Dictionary representing PropertyInfo.
+ * @param p_values A pointer to a Dictionary mapping StringName to Variant values.
+ */
+typedef void (*GDExtensionInterfacePlaceHolderScriptInstanceUpdate)(GDExtensionScriptInstancePtr p_placeholder, GDExtensionConstTypePtr p_properties, GDExtensionConstTypePtr p_values);
+
+/**
+ * @name object_get_script_instance
+ * @since 4.2
+ *
+ * Get the script instance data attached to this object.
+ *
+ * @param p_object A pointer to the Object.
+ * @param p_language A pointer to the language expected for this script instance.
+ *
+ * @return A GDExtensionScriptInstanceDataPtr that was attached to this object as part of script_instance_create.
+ */
+typedef GDExtensionScriptInstanceDataPtr (*GDExtensionInterfaceObjectGetScriptInstance)(GDExtensionConstObjectPtr p_object, GDExtensionObjectPtr p_language);
+
/* INTERFACE: ClassDB */
/**
@@ -2154,6 +2297,7 @@ typedef void *(*GDExtensionInterfaceClassdbGetClassTag)(GDExtensionConstStringNa
/**
* @name classdb_register_extension_class
* @since 4.1
+ * @deprecated in Godot 4.2. Use `classdb_register_extension_class2` instead.
*
* Registers an extension class in the ClassDB.
*
@@ -2167,6 +2311,21 @@ typedef void *(*GDExtensionInterfaceClassdbGetClassTag)(GDExtensionConstStringNa
typedef void (*GDExtensionInterfaceClassdbRegisterExtensionClass)(GDExtensionClassLibraryPtr p_library, GDExtensionConstStringNamePtr p_class_name, GDExtensionConstStringNamePtr p_parent_class_name, const GDExtensionClassCreationInfo *p_extension_funcs);
/**
+ * @name classdb_register_extension_class2
+ * @since 4.2
+ *
+ * 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 (*GDExtensionInterfaceClassdbRegisterExtensionClass2)(GDExtensionClassLibraryPtr p_library, GDExtensionConstStringNamePtr p_class_name, GDExtensionConstStringNamePtr p_parent_class_name, const GDExtensionClassCreationInfo2 *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 d297945..91e29eb 100644
--- a/include/godot_cpp/classes/wrapped.hpp
+++ b/include/godot_cpp/classes/wrapped.hpp
@@ -60,15 +60,17 @@ protected:
void _get_property_list(List<PropertyInfo> *p_list) const {}
bool _property_can_revert(const StringName &p_name) const { return false; }
bool _property_get_revert(const StringName &p_name, Variant &r_property) const { return false; }
+ void _validate_property(PropertyInfo &p_property) const {}
String _to_string() const { return "[" + String(get_class_static()) + ":" + itos(get_instance_id()) + "]"; }
- static void notification_bind(GDExtensionClassInstancePtr p_instance, int32_t p_what) {}
+ static void notification_bind(GDExtensionClassInstancePtr p_instance, int32_t p_what, GDExtensionBool p_reversed) {}
static GDExtensionBool set_bind(GDExtensionClassInstancePtr p_instance, GDExtensionConstStringNamePtr p_name, GDExtensionConstVariantPtr p_value) { return false; }
static GDExtensionBool get_bind(GDExtensionClassInstancePtr p_instance, GDExtensionConstStringNamePtr p_name, GDExtensionVariantPtr r_ret) { return false; }
static const GDExtensionPropertyInfo *get_property_list_bind(GDExtensionClassInstancePtr p_instance, uint32_t *r_count) { return nullptr; }
static void free_property_list_bind(GDExtensionClassInstancePtr p_instance, const GDExtensionPropertyInfo *p_list) {}
static GDExtensionBool property_can_revert_bind(GDExtensionClassInstancePtr p_instance, GDExtensionConstStringNamePtr p_name) { return false; }
static GDExtensionBool property_get_revert_bind(GDExtensionClassInstancePtr p_instance, GDExtensionConstStringNamePtr p_name, GDExtensionVariantPtr r_ret) { return false; }
+ static GDExtensionBool validate_property_bind(GDExtensionClassInstancePtr p_instance, GDExtensionPropertyInfo *p_property) { return false; }
static void to_string_bind(GDExtensionClassInstancePtr p_instance, GDExtensionBool *r_is_valid, GDExtensionStringPtr r_out) {}
// The only reason this has to be held here, is when we return results of `_get_property_list` to Godot, we pass
@@ -142,16 +144,20 @@ protected:
return (void(::godot::Wrapped::*)(::godot::List<::godot::PropertyInfo> * p_list) const) & m_class::_get_property_list; \
} \
\
- static bool (::godot::Wrapped::*_get_property_can_revert())(const ::godot::StringName &p_name) { \
- return (bool(::godot::Wrapped::*)(const ::godot::StringName &p_name)) & m_class::_property_can_revert; \
+ static bool (::godot::Wrapped::*_get_property_can_revert())(const ::godot::StringName &p_name) const { \
+ return (bool(::godot::Wrapped::*)(const ::godot::StringName &p_name) const) & m_class::_property_can_revert; \
} \
\
- static bool (::godot::Wrapped::*_get_property_get_revert())(const ::godot::StringName &p_name, ::godot::Variant &) { \
- return (bool(::godot::Wrapped::*)(const ::godot::StringName &p_name, ::godot::Variant &)) & m_class::_property_get_revert; \
+ static bool (::godot::Wrapped::*_get_property_get_revert())(const ::godot::StringName &p_name, ::godot::Variant &) const { \
+ return (bool(::godot::Wrapped::*)(const ::godot::StringName &p_name, ::godot::Variant &) const) & m_class::_property_get_revert; \
} \
\
- static ::godot::String (::godot::Wrapped::*_get_to_string())() { \
- return (::godot::String(::godot::Wrapped::*)()) & m_class::_to_string; \
+ static void (::godot::Wrapped::*_get_validate_property())(::godot::PropertyInfo & p_property) const { \
+ return (void(::godot::Wrapped::*)(::godot::PropertyInfo & p_property) const) & m_class::_validate_property; \
+ } \
+ \
+ static ::godot::String (::godot::Wrapped::*_get_to_string())() const { \
+ return (::godot::String(::godot::Wrapped::*)() const) & m_class::_to_string; \
} \
\
template <class T, class B> \
@@ -187,13 +193,13 @@ public:
return new_object->_owner; \
} \
\
- static void notification_bind(GDExtensionClassInstancePtr p_instance, int32_t p_what) { \
+ static void notification_bind(GDExtensionClassInstancePtr p_instance, int32_t p_what, GDExtensionBool p_reversed) { \
if (p_instance && m_class::_get_notification()) { \
if (m_class::_get_notification() != m_inherits::_get_notification()) { \
m_class *cls = reinterpret_cast<m_class *>(p_instance); \
return cls->_notification(p_what); \
} \
- m_inherits::notification_bind(p_instance, p_what); \
+ m_inherits::notification_bind(p_instance, p_what, p_reversed); \
} \
} \
\
@@ -267,6 +273,21 @@ public:
return false; \
} \
\
+ static GDExtensionBool validate_property_bind(GDExtensionClassInstancePtr p_instance, GDExtensionPropertyInfo *p_property) { \
+ bool ret = false; \
+ if (p_instance && m_class::_get_validate_property()) { \
+ ret = m_inherits::validate_property_bind(p_instance, p_property); \
+ if (m_class::_get_validate_property() != m_inherits::_get_validate_property()) { \
+ m_class *cls = reinterpret_cast<m_class *>(p_instance); \
+ ::godot::PropertyInfo info(p_property); \
+ cls->_validate_property(info); \
+ info._update(p_property); \
+ return true; \
+ } \
+ } \
+ return ret; \
+ } \
+ \
static void to_string_bind(GDExtensionClassInstancePtr p_instance, GDExtensionBool *r_is_valid, GDExtensionStringPtr r_out) { \
if (p_instance && m_class::_get_to_string()) { \
if (m_class::_get_to_string() != m_inherits::_get_to_string()) { \
@@ -337,15 +358,19 @@ protected:
return nullptr; \
} \
\
- static bool (Wrapped::*_get_property_can_revert())(const ::godot::StringName &p_name) { \
+ static bool (Wrapped::*_get_property_can_revert())(const ::godot::StringName &p_name) const { \
+ return nullptr; \
+ } \
+ \
+ static bool (Wrapped::*_get_property_get_revert())(const ::godot::StringName &p_name, Variant &) const { \
return nullptr; \
} \
\
- static bool (Wrapped::*_get_property_get_revert())(const ::godot::StringName &p_name, Variant &) { \
+ static void (Wrapped::*_get_validate_property())(::godot::PropertyInfo & p_property) const { \
return nullptr; \
} \
\
- static String (Wrapped::*_get_to_string())() { \
+ static String (Wrapped::*_get_to_string())() const { \
return nullptr; \
} \
\
diff --git a/include/godot_cpp/core/class_db.hpp b/include/godot_cpp/core/class_db.hpp
index 35fb053..f23df06 100644
--- a/include/godot_cpp/core/class_db.hpp
+++ b/include/godot_cpp/core/class_db.hpp
@@ -106,7 +106,7 @@ private:
static void bind_method_godot(const StringName &p_class_name, MethodBind *p_method);
template <class T, bool is_abstract>
- static void _register_class(bool p_virtual = false);
+ static void _register_class(bool p_virtual = false, bool p_exposed = true);
public:
template <class T>
@@ -114,6 +114,8 @@ public:
template <class T>
static void register_abstract_class();
template <class T>
+ static void register_internal_class();
+ template <class T>
static void register_engine_class();
template <class N, class M, typename... VarArgs>
@@ -161,7 +163,7 @@ public:
}
template <class T, bool is_abstract>
-void ClassDB::_register_class(bool p_virtual) {
+void ClassDB::_register_class(bool p_virtual, bool p_exposed) {
instance_binding_callbacks[T::get_class_static()] = &T::_gde_binding_callbacks;
// Register this class within our plugin
@@ -178,16 +180,18 @@ void ClassDB::_register_class(bool p_virtual) {
class_register_order.push_back(cl.name);
// Register this class with Godot
- GDExtensionClassCreationInfo class_info = {
+ GDExtensionClassCreationInfo2 class_info = {
p_virtual, // GDExtensionBool is_virtual;
is_abstract, // GDExtensionBool is_abstract;
+ p_exposed, // GDExtensionBool is_exposed;
T::set_bind, // GDExtensionClassSet set_func;
T::get_bind, // GDExtensionClassGet get_func;
T::has_get_property_list() ? T::get_property_list_bind : nullptr, // GDExtensionClassGetPropertyList get_property_list_func;
T::free_property_list_bind, // GDExtensionClassFreePropertyList free_property_list_func;
T::property_can_revert_bind, // GDExtensionClassPropertyCanRevert property_can_revert_func;
T::property_get_revert_bind, // GDExtensionClassPropertyGetRevert property_get_revert_func;
- T::notification_bind, // GDExtensionClassNotification notification_func;
+ T::validate_property_bind, // GDExtensionClassValidateProperty validate_property_func;
+ T::notification_bind, // GDExtensionClassNotification2 notification_func;
T::to_string_bind, // GDExtensionClassToString to_string_func;
nullptr, // GDExtensionClassReference reference_func;
nullptr, // GDExtensionClassUnreference unreference_func;
@@ -198,7 +202,7 @@ void ClassDB::_register_class(bool p_virtual) {
(void *)&T::get_class_static(), // void *class_userdata;
};
- internal::gdextension_interface_classdb_register_extension_class(internal::library, cl.name._native_ptr(), cl.parent_name._native_ptr(), &class_info);
+ internal::gdextension_interface_classdb_register_extension_class2(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();
@@ -218,6 +222,11 @@ void ClassDB::register_abstract_class() {
}
template <class T>
+void ClassDB::register_internal_class() {
+ ClassDB::_register_class<T, false>(false, false);
+}
+
+template <class T>
void ClassDB::register_engine_class() {
instance_binding_callbacks[T::get_class_static()] = &T::_gde_binding_callbacks;
}
@@ -280,6 +289,7 @@ MethodBind *ClassDB::bind_vararg_method(uint32_t p_flags, StringName p_name, M p
#define GDREGISTER_CLASS(m_class) ClassDB::register_class<m_class>();
#define GDREGISTER_VIRTUAL_CLASS(m_class) ClassDB::register_class<m_class>(true);
#define GDREGISTER_ABSTRACT_CLASS(m_class) ClassDB::register_abstract_class<m_class>();
+#define GDREGISTER_INTERNAL_CLASS(m_class) ClassDB::register_internal_class<m_class>();
} // namespace godot
diff --git a/include/godot_cpp/core/method_ptrcall.hpp b/include/godot_cpp/core/method_ptrcall.hpp
index a85cbc9..32f3f45 100644
--- a/include/godot_cpp/core/method_ptrcall.hpp
+++ b/include/godot_cpp/core/method_ptrcall.hpp
@@ -168,6 +168,7 @@ MAKE_PTRARG_BY_REFERENCE(Variant);
template <class T>
struct PtrToArg<T *> {
+ static_assert(std::is_base_of<Object, T>::value, "Cannot encode non-Object value as an Object");
_FORCE_INLINE_ static T *convert(const void *p_ptr) {
return reinterpret_cast<T *>(godot::internal::get_object_instance_binding(*reinterpret_cast<GDExtensionObjectPtr *>(const_cast<void *>(p_ptr))));
}
@@ -179,6 +180,7 @@ struct PtrToArg<T *> {
template <class T>
struct PtrToArg<const T *> {
+ static_assert(std::is_base_of<Object, T>::value, "Cannot encode non-Object value as an Object");
_FORCE_INLINE_ static const T *convert(const void *p_ptr) {
return reinterpret_cast<const T *>(godot::internal::get_object_instance_binding(*reinterpret_cast<GDExtensionObjectPtr *>(const_cast<void *>(p_ptr))));
}
diff --git a/include/godot_cpp/core/property_info.hpp b/include/godot_cpp/core/property_info.hpp
index 8146859..0ecfa32 100644
--- a/include/godot_cpp/core/property_info.hpp
+++ b/include/godot_cpp/core/property_info.hpp
@@ -68,6 +68,18 @@ struct PropertyInfo {
PropertyInfo(GDExtensionVariantType p_type, const StringName &p_name, PropertyHint p_hint = PROPERTY_HINT_NONE, const String &p_hint_string = "", uint32_t p_usage = PROPERTY_USAGE_DEFAULT, const StringName &p_class_name = "") :
PropertyInfo((Variant::Type)p_type, p_name, p_hint, p_hint_string, p_usage, p_class_name) {}
+
+ PropertyInfo(const GDExtensionPropertyInfo *p_info) :
+ PropertyInfo(p_info->type, *reinterpret_cast<StringName *>(p_info->name), (PropertyHint)p_info->hint, *reinterpret_cast<String *>(p_info->hint_string), p_info->usage, *reinterpret_cast<StringName *>(p_info->class_name)) {}
+
+ void _update(GDExtensionPropertyInfo *p_info) {
+ p_info->type = (GDExtensionVariantType)type;
+ *(reinterpret_cast<StringName *>(p_info->name)) = name;
+ p_info->hint = hint;
+ *(reinterpret_cast<String *>(p_info->hint_string)) = hint_string;
+ p_info->usage = usage;
+ *(reinterpret_cast<StringName *>(p_info->class_name)) = class_name;
+ }
};
} // namespace godot
diff --git a/include/godot_cpp/godot.hpp b/include/godot_cpp/godot.hpp
index 59aa150..a3fae75 100644
--- a/include/godot_cpp/godot.hpp
+++ b/include/godot_cpp/godot.hpp
@@ -123,6 +123,7 @@ extern "C" GDExtensionInterfaceStringOperatorPlusEqChar gdextension_interface_st
extern "C" GDExtensionInterfaceStringOperatorPlusEqCstr gdextension_interface_string_operator_plus_eq_cstr;
extern "C" GDExtensionInterfaceStringOperatorPlusEqWcstr gdextension_interface_string_operator_plus_eq_wcstr;
extern "C" GDExtensionInterfaceStringOperatorPlusEqC32str gdextension_interface_string_operator_plus_eq_c32str;
+extern "C" GDExtensionInterfaceStringResize gdextension_interface_string_resize;
extern "C" GDExtensionInterfaceXmlParserOpenBuffer gdextension_interface_xml_parser_open_buffer;
extern "C" GDExtensionInterfaceFileAccessStoreBuffer gdextension_interface_file_access_store_buffer;
extern "C" GDExtensionInterfaceFileAccessGetBuffer gdextension_interface_file_access_get_buffer;
@@ -165,11 +166,13 @@ extern "C" GDExtensionInterfaceObjectGetInstanceFromId gdextension_interface_obj
extern "C" GDExtensionInterfaceObjectGetInstanceId gdextension_interface_object_get_instance_id;
extern "C" GDExtensionInterfaceRefGetObject gdextension_interface_ref_get_object;
extern "C" GDExtensionInterfaceRefSetObject gdextension_interface_ref_set_object;
-extern "C" GDExtensionInterfaceScriptInstanceCreate gdextension_interface_script_instance_create;
+extern "C" GDExtensionInterfaceScriptInstanceCreate2 gdextension_interface_script_instance_create2;
+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" GDExtensionInterfaceClassdbGetMethodBind gdextension_interface_classdb_get_method_bind;
extern "C" GDExtensionInterfaceClassdbGetClassTag gdextension_interface_classdb_get_class_tag;
-extern "C" GDExtensionInterfaceClassdbRegisterExtensionClass gdextension_interface_classdb_register_extension_class;
+extern "C" GDExtensionInterfaceClassdbRegisterExtensionClass2 gdextension_interface_classdb_register_extension_class2;
extern "C" GDExtensionInterfaceClassdbRegisterExtensionClassMethod gdextension_interface_classdb_register_extension_class_method;
extern "C" GDExtensionInterfaceClassdbRegisterExtensionClassIntegerConstant gdextension_interface_classdb_register_extension_class_integer_constant;
extern "C" GDExtensionInterfaceClassdbRegisterExtensionClassProperty gdextension_interface_classdb_register_extension_class_property;
diff --git a/include/godot_cpp/templates/cowdata.hpp b/include/godot_cpp/templates/cowdata.hpp
index 18320d8..d3ea982 100644
--- a/include/godot_cpp/templates/cowdata.hpp
+++ b/include/godot_cpp/templates/cowdata.hpp
@@ -39,6 +39,7 @@
#include <cstring>
#include <new>
+#include <type_traits>
namespace godot {
@@ -210,9 +211,9 @@ void CowData<T>::_unref(void *p_data) {
if (refc->decrement() > 0) {
return; // still in use
}
- // clean up
- if (!__has_trivial_destructor(T)) {
+ // clean up
+ if (!std::is_trivially_destructible<T>::value) {
uint32_t *count = _get_size();
T *data = (T *)(count + 1);
@@ -247,7 +248,7 @@ uint32_t CowData<T>::_copy_on_write() {
T *_data = (T *)(mem_new);
// initialize new elements
- if (__has_trivial_copy(T)) {
+ if (std::is_trivially_copyable<T>::value) {
memcpy(mem_new, _ptr, current_size * sizeof(T));
} else {
@@ -310,7 +311,7 @@ Error CowData<T>::resize(int p_size) {
// construct the newly created elements
- if (!__has_trivial_constructor(T)) {
+ if (!std::is_trivially_constructible<T>::value) {
T *elems = _get_data();
for (int i = *_get_size(); i < p_size; i++) {
@@ -321,7 +322,7 @@ Error CowData<T>::resize(int p_size) {
*_get_size() = p_size;
} else if (p_size < current_size) {
- if (!__has_trivial_destructor(T)) {
+ if (!std::is_trivially_destructible<T>::value) {
// deinitialize no longer needed elements
for (uint32_t i = p_size; i < *_get_size(); i++) {
T *t = &_get_data()[i];
diff --git a/include/godot_cpp/variant/variant.hpp b/include/godot_cpp/variant/variant.hpp
index 06ba75f..3b5ca56 100644
--- a/include/godot_cpp/variant/variant.hpp
+++ b/include/godot_cpp/variant/variant.hpp
@@ -334,6 +334,8 @@ String vformat(const String &p_text, const VarArgs... p_args) {
return p_text % args_array;
}
+#include <godot_cpp/variant/builtin_vararg_methods.hpp>
+
} // namespace godot
#endif // GODOT_VARIANT_HPP
diff --git a/include/godot_cpp/variant/vector3.hpp b/include/godot_cpp/variant/vector3.hpp
index 2ccd6cf..a8d96ed 100644
--- a/include/godot_cpp/variant/vector3.hpp
+++ b/include/godot_cpp/variant/vector3.hpp
@@ -78,6 +78,14 @@ struct _NO_DISCARD_ Vector3 {
return x < y ? (y < z ? Vector3::AXIS_Z : Vector3::AXIS_Y) : (x < z ? Vector3::AXIS_Z : Vector3::AXIS_X);
}
+ Vector3 min(const Vector3 &p_vector3) const {
+ return Vector3(MIN(x, p_vector3.x), MIN(y, p_vector3.y), MIN(z, p_vector3.z));
+ }
+
+ Vector3 max(const Vector3 &p_vector3) const {
+ return Vector3(MAX(x, p_vector3.x), MAX(y, p_vector3.y), MAX(z, p_vector3.z));
+ }
+
_FORCE_INLINE_ real_t length() const;
_FORCE_INLINE_ real_t length_squared() const;
diff --git a/include/godot_cpp/variant/vector3i.hpp b/include/godot_cpp/variant/vector3i.hpp
index c8f1fe5..c13bd08 100644
--- a/include/godot_cpp/variant/vector3i.hpp
+++ b/include/godot_cpp/variant/vector3i.hpp
@@ -71,6 +71,14 @@ struct _NO_DISCARD_ Vector3i {
Vector3i::Axis min_axis_index() const;
Vector3i::Axis max_axis_index() const;
+ Vector3i min(const Vector3i &p_vector3i) const {
+ return Vector3i(MIN(x, p_vector3i.x), MIN(y, p_vector3i.y), MIN(z, p_vector3i.z));
+ }
+
+ Vector3i max(const Vector3i &p_vector3i) const {
+ return Vector3i(MAX(x, p_vector3i.x), MAX(y, p_vector3i.y), MAX(z, p_vector3i.z));
+ }
+
_FORCE_INLINE_ int64_t length_squared() const;
_FORCE_INLINE_ double length() const;
diff --git a/include/godot_cpp/variant/vector4.hpp b/include/godot_cpp/variant/vector4.hpp
index ba3da68..26c57c3 100644
--- a/include/godot_cpp/variant/vector4.hpp
+++ b/include/godot_cpp/variant/vector4.hpp
@@ -70,6 +70,14 @@ struct _NO_DISCARD_ Vector4 {
Vector4::Axis min_axis_index() const;
Vector4::Axis max_axis_index() const;
+ Vector4 min(const Vector4 &p_vector4) const {
+ return Vector4(MIN(x, p_vector4.x), MIN(y, p_vector4.y), MIN(z, p_vector4.z), MIN(w, p_vector4.w));
+ }
+
+ Vector4 max(const Vector4 &p_vector4) const {
+ return Vector4(MAX(x, p_vector4.x), MAX(y, p_vector4.y), MAX(z, p_vector4.z), MAX(w, p_vector4.w));
+ }
+
_FORCE_INLINE_ real_t length_squared() const;
bool is_equal_approx(const Vector4 &p_vec4) const;
bool is_zero_approx() const;
diff --git a/include/godot_cpp/variant/vector4i.hpp b/include/godot_cpp/variant/vector4i.hpp
index 9d70fb7..ccfcf6d 100644
--- a/include/godot_cpp/variant/vector4i.hpp
+++ b/include/godot_cpp/variant/vector4i.hpp
@@ -73,6 +73,14 @@ struct _NO_DISCARD_ Vector4i {
Vector4i::Axis min_axis_index() const;
Vector4i::Axis max_axis_index() const;
+ Vector4i min(const Vector4i &p_vector4i) const {
+ return Vector4i(MIN(x, p_vector4i.x), MIN(y, p_vector4i.y), MIN(z, p_vector4i.z), MIN(w, p_vector4i.w));
+ }
+
+ Vector4i max(const Vector4i &p_vector4i) const {
+ return Vector4i(MAX(x, p_vector4i.x), MAX(y, p_vector4i.y), MAX(z, p_vector4i.z), MAX(w, p_vector4i.w));
+ }
+
_FORCE_INLINE_ int64_t length_squared() const;
_FORCE_INLINE_ double length() const;
diff --git a/src/godot.cpp b/src/godot.cpp
index c85667f..69d471b 100644
--- a/src/godot.cpp
+++ b/src/godot.cpp
@@ -34,6 +34,7 @@
#include <godot_cpp/classes/wrapped.hpp>
#include <godot_cpp/core/class_db.hpp>
#include <godot_cpp/core/memory.hpp>
+#include <godot_cpp/core/version.hpp>
#include <godot_cpp/variant/variant.hpp>
#include <godot_cpp/core/error_macros.hpp>
@@ -128,6 +129,7 @@ GDExtensionInterfaceStringOperatorPlusEqChar gdextension_interface_string_operat
GDExtensionInterfaceStringOperatorPlusEqCstr gdextension_interface_string_operator_plus_eq_cstr = nullptr;
GDExtensionInterfaceStringOperatorPlusEqWcstr gdextension_interface_string_operator_plus_eq_wcstr = nullptr;
GDExtensionInterfaceStringOperatorPlusEqC32str gdextension_interface_string_operator_plus_eq_c32str = nullptr;
+GDExtensionInterfaceStringResize gdextension_interface_string_resize = nullptr;
GDExtensionInterfaceXmlParserOpenBuffer gdextension_interface_xml_parser_open_buffer = nullptr;
GDExtensionInterfaceFileAccessStoreBuffer gdextension_interface_file_access_store_buffer = nullptr;
GDExtensionInterfaceFileAccessGetBuffer gdextension_interface_file_access_get_buffer = nullptr;
@@ -170,11 +172,13 @@ GDExtensionInterfaceObjectGetInstanceFromId gdextension_interface_object_get_ins
GDExtensionInterfaceObjectGetInstanceId gdextension_interface_object_get_instance_id = nullptr;
GDExtensionInterfaceRefGetObject gdextension_interface_ref_get_object = nullptr;
GDExtensionInterfaceRefSetObject gdextension_interface_ref_set_object = nullptr;
-GDExtensionInterfaceScriptInstanceCreate gdextension_interface_script_instance_create = nullptr;
+GDExtensionInterfaceScriptInstanceCreate2 gdextension_interface_script_instance_create2 = nullptr;
+GDExtensionInterfacePlaceHolderScriptInstanceCreate gdextension_interface_placeholder_script_instance_create = nullptr;
+GDExtensionInterfacePlaceHolderScriptInstanceUpdate gdextension_interface_placeholder_script_instance_update = nullptr;
GDExtensionInterfaceClassdbConstructObject gdextension_interface_classdb_construct_object = nullptr;
GDExtensionInterfaceClassdbGetMethodBind gdextension_interface_classdb_get_method_bind = nullptr;
GDExtensionInterfaceClassdbGetClassTag gdextension_interface_classdb_get_class_tag = nullptr;
-GDExtensionInterfaceClassdbRegisterExtensionClass gdextension_interface_classdb_register_extension_class = nullptr;
+GDExtensionInterfaceClassdbRegisterExtensionClass2 gdextension_interface_classdb_register_extension_class2 = nullptr;
GDExtensionInterfaceClassdbRegisterExtensionClassMethod gdextension_interface_classdb_register_extension_class_method = nullptr;
GDExtensionInterfaceClassdbRegisterExtensionClassIntegerConstant gdextension_interface_classdb_register_extension_class_integer_constant = nullptr;
GDExtensionInterfaceClassdbRegisterExtensionClassProperty gdextension_interface_classdb_register_extension_class_property = nullptr;
@@ -193,9 +197,15 @@ GDExtensionBinding::Callback GDExtensionBinding::init_callback = nullptr;
GDExtensionBinding::Callback GDExtensionBinding::terminate_callback = nullptr;
GDExtensionInitializationLevel GDExtensionBinding::minimum_initialization_level = GDEXTENSION_INITIALIZATION_CORE;
-#define LOAD_PROC_ADDRESS(m_name, m_type) \
- internal::gdextension_interface_##m_name = (m_type)p_get_proc_address(#m_name); \
- ERR_FAIL_NULL_V_MSG(internal::gdextension_interface_##m_name, false, "Unable to load GDExtension interface function " #m_name "()")
+#define ERR_PRINT_EARLY(m_msg) \
+ internal::gdextension_interface_print_error(m_msg, FUNCTION_STR, __FILE__, __LINE__, false)
+
+#define LOAD_PROC_ADDRESS(m_name, m_type) \
+ internal::gdextension_interface_##m_name = (m_type)p_get_proc_address(#m_name); \
+ if (!internal::gdextension_interface_##m_name) { \
+ ERR_PRINT_EARLY("Unable to load GDExtension interface function " #m_name "()"); \
+ return false; \
+ }
// Partial definition of the legacy interface so we can detect it and show an error.
typedef struct {
@@ -218,14 +228,15 @@ GDExtensionBool GDExtensionBinding::init(GDExtensionInterfaceGetProcAddress p_ge
if (raw_interface[0] == 4 && raw_interface[1] == 0) {
// Use the legacy interface only to give a nice error.
LegacyGDExtensionInterface *legacy_interface = (LegacyGDExtensionInterface *)p_get_proc_address;
- internal::gdextension_interface_print_error_with_message = (GDExtensionInterfacePrintErrorWithMessage)legacy_interface->print_error_with_message;
- ERR_FAIL_V_MSG(false, "Cannot load a GDExtension built for Godot 4.1+ in Godot 4.0.");
+ internal::gdextension_interface_print_error = (GDExtensionInterfacePrintError)legacy_interface->print_error;
+ ERR_PRINT_EARLY("Cannot load a GDExtension built for Godot 4.1+ in Godot 4.0.");
+ return false;
}
- // Load the "print_error_with_message" function first (needed by the ERR_FAIL_NULL_V_MSG() macro).
- internal::gdextension_interface_print_error_with_message = (GDExtensionInterfacePrintErrorWithMessage)p_get_proc_address("print_error_with_message");
- if (!internal::gdextension_interface_print_error_with_message) {
- printf("ERROR: Unable to load GDExtension interface function print_error_with_message().\n");
+ // Load the "print_error" function first (needed by the ERR_PRINT_EARLY() macro).
+ internal::gdextension_interface_print_error = (GDExtensionInterfacePrintError)p_get_proc_address("print_error");
+ if (!internal::gdextension_interface_print_error) {
+ printf("ERROR: Unable to load GDExtension interface function print_error().\n");
return false;
}
@@ -234,10 +245,33 @@ GDExtensionBool GDExtensionBinding::init(GDExtensionInterfaceGetProcAddress p_ge
internal::token = p_library;
LOAD_PROC_ADDRESS(get_godot_version, GDExtensionInterfaceGetGodotVersion);
+ internal::gdextension_interface_get_godot_version(&internal::godot_version);
+
+ // Check that godot-cpp was compiled using an extension_api.json older or at the
+ // same version as the Godot that is loading it.
+ bool compatible;
+ if (internal::godot_version.major != GODOT_VERSION_MAJOR) {
+ compatible = internal::godot_version.major > GODOT_VERSION_MAJOR;
+ } else if (internal::godot_version.minor != GODOT_VERSION_MINOR) {
+ compatible = internal::godot_version.minor > GODOT_VERSION_MINOR;
+ } else {
+ compatible = internal::godot_version.patch >= GODOT_VERSION_PATCH;
+ }
+ if (!compatible) {
+ // We need to use snprintf() here because vformat() uses Variant, and we haven't loaded
+ // the GDExtension interface far enough to use Variants yet.
+ char msg[128];
+ snprintf(msg, 128, "Cannot load a GDExtension built for Godot %d.%d.%d using an older version of Godot (%d.%d.%d).",
+ GODOT_VERSION_MAJOR, GODOT_VERSION_MINOR, GODOT_VERSION_PATCH,
+ internal::godot_version.major, internal::godot_version.minor, internal::godot_version.patch);
+ ERR_PRINT_EARLY(msg);
+ return false;
+ }
+
LOAD_PROC_ADDRESS(mem_alloc, GDExtensionInterfaceMemAlloc);
LOAD_PROC_ADDRESS(mem_realloc, GDExtensionInterfaceMemRealloc);
LOAD_PROC_ADDRESS(mem_free, GDExtensionInterfaceMemFree);
- LOAD_PROC_ADDRESS(print_error, GDExtensionInterfacePrintError);
+ LOAD_PROC_ADDRESS(print_error_with_message, GDExtensionInterfacePrintErrorWithMessage);
LOAD_PROC_ADDRESS(print_warning, GDExtensionInterfacePrintWarning);
LOAD_PROC_ADDRESS(print_warning_with_message, GDExtensionInterfacePrintWarningWithMessage);
LOAD_PROC_ADDRESS(print_script_error, GDExtensionInterfacePrintScriptError);
@@ -311,6 +345,7 @@ GDExtensionBool GDExtensionBinding::init(GDExtensionInterfaceGetProcAddress p_ge
LOAD_PROC_ADDRESS(string_operator_plus_eq_cstr, GDExtensionInterfaceStringOperatorPlusEqCstr);
LOAD_PROC_ADDRESS(string_operator_plus_eq_wcstr, GDExtensionInterfaceStringOperatorPlusEqWcstr);
LOAD_PROC_ADDRESS(string_operator_plus_eq_c32str, GDExtensionInterfaceStringOperatorPlusEqC32str);
+ LOAD_PROC_ADDRESS(string_resize, GDExtensionInterfaceStringResize);
LOAD_PROC_ADDRESS(xml_parser_open_buffer, GDExtensionInterfaceXmlParserOpenBuffer);
LOAD_PROC_ADDRESS(file_access_store_buffer, GDExtensionInterfaceFileAccessStoreBuffer);
LOAD_PROC_ADDRESS(file_access_get_buffer, GDExtensionInterfaceFileAccessGetBuffer);
@@ -353,11 +388,13 @@ GDExtensionBool GDExtensionBinding::init(GDExtensionInterfaceGetProcAddress p_ge
LOAD_PROC_ADDRESS(object_get_instance_id, GDExtensionInterfaceObjectGetInstanceId);
LOAD_PROC_ADDRESS(ref_get_object, GDExtensionInterfaceRefGetObject);
LOAD_PROC_ADDRESS(ref_set_object, GDExtensionInterfaceRefSetObject);
- LOAD_PROC_ADDRESS(script_instance_create, GDExtensionInterfaceScriptInstanceCreate);
+ LOAD_PROC_ADDRESS(script_instance_create2, GDExtensionInterfaceScriptInstanceCreate2);
+ 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_get_method_bind, GDExtensionInterfaceClassdbGetMethodBind);
LOAD_PROC_ADDRESS(classdb_get_class_tag, GDExtensionInterfaceClassdbGetClassTag);
- LOAD_PROC_ADDRESS(classdb_register_extension_class, GDExtensionInterfaceClassdbRegisterExtensionClass);
+ LOAD_PROC_ADDRESS(classdb_register_extension_class2, GDExtensionInterfaceClassdbRegisterExtensionClass2);
LOAD_PROC_ADDRESS(classdb_register_extension_class_method, GDExtensionInterfaceClassdbRegisterExtensionClassMethod);
LOAD_PROC_ADDRESS(classdb_register_extension_class_integer_constant, GDExtensionInterfaceClassdbRegisterExtensionClassIntegerConstant);
LOAD_PROC_ADDRESS(classdb_register_extension_class_property, GDExtensionInterfaceClassdbRegisterExtensionClassProperty);
@@ -370,9 +407,6 @@ GDExtensionBool GDExtensionBinding::init(GDExtensionInterfaceGetProcAddress p_ge
LOAD_PROC_ADDRESS(editor_add_plugin, GDExtensionInterfaceEditorAddPlugin);
LOAD_PROC_ADDRESS(editor_remove_plugin, GDExtensionInterfaceEditorRemovePlugin);
- // Load the Godot version.
- internal::gdextension_interface_get_godot_version(&internal::godot_version);
-
r_initialization->initialize = initialize_level;
r_initialization->deinitialize = deinitialize_level;
r_initialization->minimum_initialization_level = minimum_initialization_level;
@@ -386,6 +420,7 @@ GDExtensionBool GDExtensionBinding::init(GDExtensionInterfaceGetProcAddress p_ge
}
#undef LOAD_PROC_ADDRESS
+#undef ERR_PRINT_EARLY
void GDExtensionBinding::initialize_level(void *userdata, GDExtensionInitializationLevel p_level) {
ClassDB::current_level = p_level;
diff --git a/src/variant/char_string.cpp b/src/variant/char_string.cpp
index 856037c..fc8845e 100644
--- a/src/variant/char_string.cpp
+++ b/src/variant/char_string.cpp
@@ -289,6 +289,10 @@ CharWideString String::wide_string() const {
return str;
}
+Error String::resize(int p_size) {
+ return (Error)internal::gdextension_interface_string_resize(_native_ptr(), p_size);
+}
+
String &String::operator=(const char *p_str) {
*this = String(p_str);
return *this;
diff --git a/test/project/example.gdextension b/test/project/example.gdextension
index 90fd53a..99c1746 100644
--- a/test/project/example.gdextension
+++ b/test/project/example.gdextension
@@ -1,7 +1,7 @@
[configuration]
entry_symbol = "example_library_init"
-compatibility_minimum = 4.1
+compatibility_minimum = "4.1"
[libraries]
diff --git a/test/project/main.gd b/test/project/main.gd
index cedd512..715b13e 100644
--- a/test/project/main.gd
+++ b/test/project/main.gd
@@ -23,6 +23,10 @@ func _ready():
# Property list.
example.property_from_list = Vector3(100, 200, 300)
assert_equal(example.property_from_list, Vector3(100, 200, 300))
+ var prop_list = example.get_property_list()
+ for prop_info in prop_list:
+ if prop_info['name'] == 'mouse_filter':
+ assert_equal(prop_info['usage'], PROPERTY_USAGE_NO_EDITOR)
# Call simple methods.
example.simple_func()
@@ -86,6 +90,9 @@ func _ready():
assert_equal(example.test_string_is_fourty_two("blah"), false)
assert_equal(example.test_string_is_fourty_two("fourty two"), true)
+ # String::resize().
+ assert_equal(example.test_string_resize("What"), "What!?")
+
# PackedArray iterators
assert_equal(example.test_vector_ops(), 105)
@@ -94,6 +101,49 @@ func _ready():
example.group_subgroup_custom_position = Vector2(50, 50)
assert_equal(example.group_subgroup_custom_position, Vector2(50, 50))
+ # Test Object::cast_to<>() and that correct wrappers are being used.
+ var control = Control.new()
+ var sprite = Sprite2D.new()
+ var example_ref = ExampleRef.new()
+
+ assert_equal(example.test_object_cast_to_node(control), true)
+ assert_equal(example.test_object_cast_to_control(control), true)
+ assert_equal(example.test_object_cast_to_example(control), false)
+
+ assert_equal(example.test_object_cast_to_node(example), true)
+ assert_equal(example.test_object_cast_to_control(example), true)
+ assert_equal(example.test_object_cast_to_example(example), true)
+
+ assert_equal(example.test_object_cast_to_node(sprite), true)
+ assert_equal(example.test_object_cast_to_control(sprite), false)
+ assert_equal(example.test_object_cast_to_example(sprite), false)
+
+ assert_equal(example.test_object_cast_to_node(example_ref), false)
+ assert_equal(example.test_object_cast_to_control(example_ref), false)
+ assert_equal(example.test_object_cast_to_example(example_ref), false)
+
+ control.queue_free()
+ sprite.queue_free()
+
+ # Test conversions to and from Variant.
+ assert_equal(example.test_variant_vector2i_conversion(Vector2i(1, 1)), Vector2i(1, 1))
+ assert_equal(example.test_variant_vector2i_conversion(Vector2(1.0, 1.0)), Vector2i(1, 1))
+ assert_equal(example.test_variant_int_conversion(10), 10)
+ assert_equal(example.test_variant_int_conversion(10.0), 10)
+ assert_equal(example.test_variant_float_conversion(10.0), 10.0)
+ assert_equal(example.test_variant_float_conversion(10), 10.0)
+
+ # 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)
+ assert_equal(new_node.get_parent(), example)
+
+ var new_tileset = TileSet.new()
+ var new_tilemap = TileMap.new()
+ example.test_set_tileset(new_tilemap, new_tileset)
+ assert_equal(new_tilemap.tile_set, new_tileset)
+ new_tilemap.queue_free()
+
# Constants.
assert_equal(Example.FIRST, 0)
assert_equal(Example.ANSWER_TO_EVERYTHING, 42)
diff --git a/test/project/project.godot b/test/project/project.godot
index eafcad3..3ed679b 100644
--- a/test/project/project.godot
+++ b/test/project/project.godot
@@ -12,7 +12,7 @@ config_version=5
config/name="GDExtension Test Project"
run/main_scene="res://main.tscn"
-config/features=PackedStringArray("4.1")
+config/features=PackedStringArray("4.2")
config/icon="res://icon.png"
[native_extensions]
diff --git a/test/src/example.cpp b/test/src/example.cpp
index fb47dd8..dc471dd 100644
--- a/test/src/example.cpp
+++ b/test/src/example.cpp
@@ -117,6 +117,14 @@ bool Example::_property_get_revert(const StringName &p_name, Variant &r_property
}
};
+void Example::_validate_property(PropertyInfo &p_property) const {
+ String name = p_property.name;
+ // Test hiding the "mouse_filter" property from the editor.
+ if (name == "mouse_filter") {
+ p_property.usage = PROPERTY_USAGE_NO_EDITOR;
+ }
+}
+
void Example::_bind_methods() {
// Methods.
ClassDB::bind_method(D_METHOD("simple_func"), &Example::simple_func);
@@ -139,8 +147,20 @@ void Example::_bind_methods() {
ClassDB::bind_method(D_METHOD("test_string_ops"), &Example::test_string_ops);
ClassDB::bind_method(D_METHOD("test_str_utility"), &Example::test_str_utility);
ClassDB::bind_method(D_METHOD("test_string_is_fourty_two"), &Example::test_string_is_fourty_two);
+ ClassDB::bind_method(D_METHOD("test_string_resize"), &Example::test_string_resize);
ClassDB::bind_method(D_METHOD("test_vector_ops"), &Example::test_vector_ops);
+ ClassDB::bind_method(D_METHOD("test_object_cast_to_node", "object"), &Example::test_object_cast_to_node);
+ ClassDB::bind_method(D_METHOD("test_object_cast_to_control", "object"), &Example::test_object_cast_to_control);
+ ClassDB::bind_method(D_METHOD("test_object_cast_to_example", "object"), &Example::test_object_cast_to_example);
+
+ 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_add_child", "node"), &Example::test_add_child);
+ ClassDB::bind_method(D_METHOD("test_set_tileset", "tilemap", "tileset"), &Example::test_set_tileset);
+
ClassDB::bind_method(D_METHOD("test_bitfield", "flags"), &Example::test_bitfield);
ClassDB::bind_method(D_METHOD("test_rpc", "value"), &Example::test_rpc);
@@ -304,6 +324,16 @@ bool Example::test_string_is_fourty_two(const String &p_string) const {
return strcmp(p_string.utf8().ptr(), "fourty two") == 0;
}
+String Example::test_string_resize(String p_string) const {
+ int orig_len = p_string.length();
+ p_string.resize(orig_len + 3);
+ char32_t *data = p_string.ptrw();
+ data[orig_len + 0] = '!';
+ data[orig_len + 1] = '?';
+ data[orig_len + 2] = '\0';
+ return p_string;
+}
+
int Example::test_vector_ops() const {
PackedInt32Array arr;
arr.push_back(10);
@@ -348,6 +378,38 @@ Example *Example::test_node_argument(Example *p_node) const {
return p_node;
}
+bool Example::test_object_cast_to_node(Object *p_object) const {
+ return Object::cast_to<Node>(p_object) != nullptr;
+}
+
+bool Example::test_object_cast_to_control(Object *p_object) const {
+ return Object::cast_to<Control>(p_object) != nullptr;
+}
+
+bool Example::test_object_cast_to_example(Object *p_object) const {
+ return Object::cast_to<Example>(p_object) != nullptr;
+}
+
+Vector2i Example::test_variant_vector2i_conversion(const Variant &p_variant) const {
+ return p_variant;
+}
+
+int Example::test_variant_int_conversion(const Variant &p_variant) const {
+ return p_variant;
+}
+
+float Example::test_variant_float_conversion(const Variant &p_variant) const {
+ return p_variant;
+}
+
+void Example::test_add_child(Node *p_node) {
+ add_child(p_node);
+}
+
+void Example::test_set_tileset(TileMap *p_tilemap, const Ref<TileSet> &p_tileset) const {
+ p_tilemap->set_tileset(p_tileset);
+}
+
BitField<Example::Flags> Example::test_bitfield(BitField<Flags> flags) {
return flags;
}
diff --git a/test/src/example.h b/test/src/example.h
index a84efed..49d103e 100644
--- a/test/src/example.h
+++ b/test/src/example.h
@@ -18,6 +18,8 @@
#include <godot_cpp/classes/global_constants.hpp>
#include <godot_cpp/classes/image.hpp>
#include <godot_cpp/classes/input_event_key.hpp>
+#include <godot_cpp/classes/tile_map.hpp>
+#include <godot_cpp/classes/tile_set.hpp>
#include <godot_cpp/classes/viewport.hpp>
#include <godot_cpp/core/binder_common.hpp>
@@ -63,6 +65,7 @@ protected:
void _get_property_list(List<PropertyInfo> *p_list) const;
bool _property_can_revert(const StringName &p_name) const;
bool _property_get_revert(const StringName &p_name, Variant &r_property) const;
+ void _validate_property(PropertyInfo &p_property) const;
String _to_string() const;
@@ -118,8 +121,20 @@ public:
String test_string_ops() const;
String test_str_utility() const;
bool test_string_is_fourty_two(const String &p_str) const;
+ String test_string_resize(String p_original) const;
int test_vector_ops() const;
+ bool test_object_cast_to_node(Object *p_object) const;
+ bool test_object_cast_to_control(Object *p_object) const;
+ bool test_object_cast_to_example(Object *p_object) const;
+
+ 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;
+
+ void test_add_child(Node *p_node);
+ void test_set_tileset(TileMap *p_tilemap, const Ref<TileSet> &p_tileset) const;
+
BitField<Flags> test_bitfield(BitField<Flags> flags);
// RPC
diff --git a/tools/android.py b/tools/android.py
index b9077f5..0e68855 100644
--- a/tools/android.py
+++ b/tools/android.py
@@ -29,7 +29,7 @@ def generate(env):
if env["arch"] not in ("arm64", "x86_64", "arm32", "x86_32"):
print("Only arm64, x86_64, arm32, and x86_32 are supported on Android. Exiting.")
- Exit()
+ env.Exit(1)
if sys.platform == "win32" or sys.platform == "msys":
my_spawn.configure(env)
@@ -100,3 +100,5 @@ def generate(env):
)
env.Append(CCFLAGS=arch_info["ccflags"])
env.Append(LINKFLAGS=["--target=" + arch_info["target"] + env["android_api_level"], "-march=" + arch_info["march"]])
+
+ env.Append(CPPDEFINES=["ANDROID_ENABLED", "UNIX_ENABLED"])
diff --git a/tools/godotcpp.py b/tools/godotcpp.py
new file mode 100644
index 0000000..969f8c4
--- /dev/null
+++ b/tools/godotcpp.py
@@ -0,0 +1,310 @@
+import os, sys, platform
+
+from SCons.Variables import EnumVariable, PathVariable, BoolVariable
+from SCons.Tool import Tool
+from SCons.Builder import Builder
+from SCons.Errors import UserError
+
+from binding_generator import scons_generate_bindings, scons_emit_files
+
+
+def add_sources(sources, dir, extension):
+ for f in os.listdir(dir):
+ if f.endswith("." + extension):
+ sources.append(dir + "/" + f)
+
+
+def normalize_path(val, env):
+ return val if os.path.isabs(val) else os.path.join(env.Dir("#").abspath, val)
+
+
+def validate_file(key, val, env):
+ if not os.path.isfile(normalize_path(val, env)):
+ raise UserError("'%s' is not a file: %s" % (key, val))
+
+
+def validate_dir(key, val, env):
+ if not os.path.isdir(normalize_path(val, env)):
+ raise UserError("'%s' is not a directory: %s" % (key, val))
+
+
+def validate_parent_dir(key, val, env):
+ if not os.path.isdir(normalize_path(os.path.dirname(val), env)):
+ raise UserError("'%s' is not a directory: %s" % (key, os.path.dirname(val)))
+
+
+platforms = ("linux", "macos", "windows", "android", "ios", "javascript")
+
+# CPU architecture options.
+architecture_array = [
+ "",
+ "universal",
+ "x86_32",
+ "x86_64",
+ "arm32",
+ "arm64",
+ "rv64",
+ "ppc32",
+ "ppc64",
+ "wasm32",
+]
+architecture_aliases = {
+ "x64": "x86_64",
+ "amd64": "x86_64",
+ "armv7": "arm32",
+ "armv8": "arm64",
+ "arm64v8": "arm64",
+ "aarch64": "arm64",
+ "rv": "rv64",
+ "riscv": "rv64",
+ "riscv64": "rv64",
+ "ppcle": "ppc32",
+ "ppc": "ppc32",
+ "ppc64le": "ppc64",
+}
+
+
+def exists(env):
+ return True
+
+
+def options(opts, env):
+ # Try to detect the host platform automatically.
+ # This is used if no `platform` argument is passed
+ if sys.platform.startswith("linux"):
+ default_platform = "linux"
+ elif sys.platform == "darwin":
+ default_platform = "macos"
+ elif sys.platform == "win32" or sys.platform == "msys":
+ default_platform = "windows"
+ elif ARGUMENTS.get("platform", ""):
+ default_platform = ARGUMENTS.get("platform")
+ else:
+ raise ValueError("Could not detect platform automatically, please specify with platform=<platform>")
+
+ opts.Add(
+ EnumVariable(
+ key="platform",
+ help="Target platform",
+ default=env.get("platform", default_platform),
+ allowed_values=platforms,
+ ignorecase=2,
+ )
+ )
+
+ # Editor and template_debug are compatible (i.e. you can use the same binary for Godot editor builds and Godot debug templates).
+ # Godot release templates are only compatible with "template_release" builds.
+ # For this reason, we default to template_debug builds, unlike Godot which defaults to editor builds.
+ opts.Add(
+ EnumVariable(
+ key="target",
+ help="Compilation target",
+ default=env.get("target", "template_debug"),
+ allowed_values=("editor", "template_release", "template_debug"),
+ )
+ )
+ opts.Add(
+ PathVariable(
+ key="gdextension_dir",
+ help="Path to a custom directory containing GDExtension interface header and API JSON file",
+ default=env.get("gdextension_dir", None),
+ validator=validate_dir,
+ )
+ )
+ opts.Add(
+ PathVariable(
+ key="custom_api_file",
+ help="Path to a custom GDExtension API JSON file (takes precedence over `gdextension_dir`)",
+ default=env.get("custom_api_file", None),
+ validator=validate_file,
+ )
+ )
+ opts.Add(
+ BoolVariable(
+ key="generate_bindings",
+ help="Force GDExtension API bindings generation. Auto-detected by default.",
+ default=env.get("generate_bindings", False),
+ )
+ )
+ opts.Add(
+ BoolVariable(
+ key="generate_template_get_node",
+ help="Generate a template version of the Node class's get_node.",
+ default=env.get("generate_template_get_node", True),
+ )
+ )
+ opts.Add(
+ BoolVariable(
+ key="build_library",
+ help="Build the godot-cpp library.",
+ default=env.get("build_library", True),
+ )
+ )
+ opts.Add(
+ EnumVariable(
+ key="precision",
+ help="Set the floating-point precision level",
+ default=env.get("precision", "single"),
+ allowed_values=("single", "double"),
+ )
+ )
+ opts.Add(
+ EnumVariable(
+ key="arch",
+ help="CPU architecture",
+ default=env.get("arch", ""),
+ allowed_values=architecture_array,
+ map=architecture_aliases,
+ )
+ )
+
+ # compiledb
+ opts.Add(
+ BoolVariable(
+ key="compiledb",
+ help="Generate compilation DB (`compile_commands.json`) for external tools",
+ default=env.get("compiledb", False),
+ )
+ )
+ opts.Add(
+ PathVariable(
+ key="compiledb_file",
+ help="Path to a custom `compile_commands.json` file",
+ default=env.get("compiledb_file", "compile_commands.json"),
+ validator=validate_parent_dir,
+ )
+ )
+
+ # Add platform options
+ for pl in platforms:
+ tool = Tool(pl, toolpath=["tools"])
+ if hasattr(tool, "options"):
+ tool.options(opts)
+
+ # Targets flags tool (optimizations, debug symbols)
+ target_tool = Tool("targets", toolpath=["tools"])
+ target_tool.options(opts)
+
+
+def generate(env):
+ # Default num_jobs to local cpu count if not user specified.
+ # SCons has a peculiarity where user-specified options won't be overridden
+ # by SetOption, so we can rely on this to know if we should use our default.
+ initial_num_jobs = env.GetOption("num_jobs")
+ altered_num_jobs = initial_num_jobs + 1
+ env.SetOption("num_jobs", altered_num_jobs)
+ if env.GetOption("num_jobs") == altered_num_jobs:
+ cpu_count = os.cpu_count()
+ if cpu_count is None:
+ print("Couldn't auto-detect CPU count to configure build parallelism. Specify it with the -j argument.")
+ else:
+ safer_cpu_count = cpu_count if cpu_count <= 4 else cpu_count - 1
+ print(
+ "Auto-detected %d CPU cores available for build parallelism. Using %d cores by default. You can override it with the -j argument."
+ % (cpu_count, safer_cpu_count)
+ )
+ env.SetOption("num_jobs", safer_cpu_count)
+
+ # Process CPU architecture argument.
+ if env["arch"] == "":
+ # No architecture specified. Default to arm64 if building for Android,
+ # universal if building for macOS or iOS, wasm32 if building for web,
+ # otherwise default to the host architecture.
+ if env["platform"] in ["macos", "ios"]:
+ env["arch"] = "universal"
+ elif env["platform"] == "android":
+ env["arch"] = "arm64"
+ elif env["platform"] == "javascript":
+ env["arch"] = "wasm32"
+ else:
+ host_machine = platform.machine().lower()
+ if host_machine in architecture_array:
+ env["arch"] = host_machine
+ elif host_machine in architecture_aliases.keys():
+ env["arch"] = architecture_aliases[host_machine]
+ elif "86" in host_machine:
+ # Catches x86, i386, i486, i586, i686, etc.
+ env["arch"] = "x86_32"
+ else:
+ print("Unsupported CPU architecture: " + host_machine)
+ env.Exit(1)
+
+ print("Building for architecture " + env["arch"] + " on platform " + env["platform"])
+
+ tool = Tool(env["platform"], toolpath=["tools"])
+
+ if tool is None or not tool.exists(env):
+ raise ValueError("Required toolchain not found for platform " + env["platform"])
+
+ tool.generate(env)
+ target_tool = Tool("targets", toolpath=["tools"])
+ target_tool.generate(env)
+
+ # Require C++17
+ if env.get("is_msvc", False):
+ env.Append(CXXFLAGS=["/std:c++17"])
+ else:
+ env.Append(CXXFLAGS=["-std=c++17"])
+
+ if env["precision"] == "double":
+ env.Append(CPPDEFINES=["REAL_T_IS_DOUBLE"])
+
+ # Suffix
+ suffix = ".{}.{}".format(env["platform"], env["target"])
+ if env.dev_build:
+ suffix += ".dev"
+ if env["precision"] == "double":
+ suffix += ".double"
+ suffix += "." + env["arch"]
+ if env["ios_simulator"]:
+ suffix += ".simulator"
+
+ env["suffix"] = suffix # Exposed when included from another project
+ env["OBJSUFFIX"] = suffix + env["OBJSUFFIX"]
+
+ # compile_commands.json
+ if env.get("compiledb", False):
+ env.Tool("compilation_db")
+ env.Alias("compiledb", env.CompilationDatabase(normalize_path(env["compiledb_file"], env)))
+
+ # Builders
+ env.Append(BUILDERS={"GodotCPPBindings": Builder(action=scons_generate_bindings, emitter=scons_emit_files)})
+ env.AddMethod(_godot_cpp, "GodotCPP")
+
+
+def _godot_cpp(env):
+ api_file = normalize_path(env.get("custom_api_file", env.File("gdextension/extension_api.json").abspath), env)
+ extension_dir = normalize_path(env.get("gdextension_dir", env.Dir("gdextension").abspath), env)
+ bindings = env.GodotCPPBindings(
+ env.Dir("."),
+ [
+ api_file,
+ os.path.join(extension_dir, "gdextension_interface.h"),
+ "binding_generator.py",
+ ],
+ )
+ # Forces bindings regeneration.
+ if env["generate_bindings"]:
+ env.AlwaysBuild(bindings)
+ env.NoCache(bindings)
+
+ # Sources to compile
+ sources = []
+ add_sources(sources, "src", "cpp")
+ add_sources(sources, "src/classes", "cpp")
+ add_sources(sources, "src/core", "cpp")
+ add_sources(sources, "src/variant", "cpp")
+ sources.extend([f for f in bindings if str(f).endswith(".cpp")])
+
+ # Includes
+ env.AppendUnique(CPPPATH=[env.Dir(d) for d in [extension_dir, "include", "gen/include"]])
+
+ library = None
+ library_name = "libgodot-cpp" + env["suffix"] + env["LIBSUFFIX"]
+
+ if env["build_library"]:
+ library = env.StaticLibrary(target=env.File("bin/%s" % library_name), source=sources)
+ env.Default(library)
+
+ env.AppendUnique(LIBS=[env.File("bin/%s" % library_name)])
+ return library
diff --git a/tools/ios.py b/tools/ios.py
index 11d606b..e387f42 100644
--- a/tools/ios.py
+++ b/tools/ios.py
@@ -1,7 +1,6 @@
import os
import sys
import subprocess
-import ios_osxcross
from SCons.Variables import *
if sys.version_info < (3,):
@@ -16,6 +15,10 @@ else:
return codecs.utf_8_decode(x)[0]
+def has_ios_osxcross():
+ return "OSXCROSS_IOS" in os.environ
+
+
def options(opts):
opts.Add(BoolVariable("ios_simulator", "Target iOS Simulator", False))
opts.Add("ios_min_version", "Target minimum iphoneos/iphonesimulator version", "10.0")
@@ -25,17 +28,18 @@ def options(opts):
"/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain",
)
opts.Add("IOS_SDK_PATH", "Path to the iOS SDK", "")
- ios_osxcross.options(opts)
+
+ if has_ios_osxcross():
+ opts.Add("ios_triple", "Triple for ios toolchain", "")
def exists(env):
- return sys.platform == "darwin" or ios_osxcross.exists(env)
+ return sys.platform == "darwin" or has_ios_osxcross()
def generate(env):
if env["arch"] not in ("universal", "arm64", "x86_64"):
- print("Only universal, arm64, and x86_64 are supported on iOS. Exiting.")
- Exit()
+ raise ValueError("Only universal, arm64, and x86_64 are supported on iOS. Exiting.")
if env["ios_simulator"]:
sdk_name = "iphonesimulator"
@@ -64,7 +68,26 @@ def generate(env):
env["ENV"]["PATH"] = env["IOS_TOOLCHAIN_PATH"] + "/Developer/usr/bin/:" + env["ENV"]["PATH"]
else:
- ios_osxcross.generate(env)
+ # OSXCross
+ compiler_path = "$IOS_TOOLCHAIN_PATH/usr/bin/${ios_triple}"
+ env["CC"] = compiler_path + "clang"
+ env["CXX"] = compiler_path + "clang++"
+ env["AR"] = compiler_path + "ar"
+ env["RANLIB"] = compiler_path + "ranlib"
+ env["SHLIBSUFFIX"] = ".dylib"
+
+ env.Prepend(
+ CPPPATH=[
+ "$IOS_SDK_PATH/usr/include",
+ "$IOS_SDK_PATH/System/Library/Frameworks/AudioUnit.framework/Headers",
+ ]
+ )
+
+ env.Append(CCFLAGS=["-stdlib=libc++"])
+
+ binpath = os.path.join(env["IOS_TOOLCHAIN_PATH"], "usr", "bin")
+ if binpath not in env["ENV"]["PATH"]:
+ env.PrependENVPath("PATH", binpath)
if env["arch"] == "universal":
if env["ios_simulator"]:
@@ -79,3 +102,5 @@ def generate(env):
env.Append(CCFLAGS=["-isysroot", env["IOS_SDK_PATH"]])
env.Append(LINKFLAGS=["-isysroot", env["IOS_SDK_PATH"], "-F" + env["IOS_SDK_PATH"]])
+
+ env.Append(CPPDEFINES=["IOS_ENABLED", "UNIX_ENABLED"])
diff --git a/tools/ios_osxcross.py b/tools/ios_osxcross.py
deleted file mode 100644
index 21a3f5e..0000000
--- a/tools/ios_osxcross.py
+++ /dev/null
@@ -1,26 +0,0 @@
-import os
-
-
-def options(opts):
- opts.Add("ios_triple", "Triple for ios toolchain", "")
-
-
-def exists(env):
- return "OSXCROSS_IOS" in os.environ
-
-
-def generate(env):
- compiler_path = "$IOS_TOOLCHAIN_PATH/usr/bin/${ios_triple}"
- env["CC"] = compiler_path + "clang"
- env["CXX"] = compiler_path + "clang++"
- env["AR"] = compiler_path + "ar"
- env["RANLIB"] = compiler_path + "ranlib"
- env["SHLIBSUFFIX"] = ".dylib"
-
- env.Prepend(
- CPPPATH=[
- "$IOS_SDK_PATH/usr/include",
- "$IOS_SDK_PATH/System/Library/Frameworks/AudioUnit.framework/Headers",
- ]
- )
- env.Append(CCFLAGS=["-stdlib=libc++"])
diff --git a/tools/javascript.py b/tools/javascript.py
index 5a93584..1d8009e 100644
--- a/tools/javascript.py
+++ b/tools/javascript.py
@@ -8,7 +8,7 @@ def exists(env):
def generate(env):
if env["arch"] not in ("wasm32"):
print("Only wasm32 supported on web. Exiting.")
- Exit()
+ env.Exit(1)
if "EM_CONFIG" in os.environ:
env["ENV"] = os.environ
@@ -43,3 +43,5 @@ def generate(env):
env.Append(CCFLAGS=["-O0", "-g"])
elif env["target"] == "release":
env.Append(CCFLAGS=["-O3"])
+
+ env.Append(CPPDEFINES=["WEB_ENABLED", "UNIX_ENABLED"])
diff --git a/tools/linux.py b/tools/linux.py
index 099a048..cb48ae5 100644
--- a/tools/linux.py
+++ b/tools/linux.py
@@ -32,3 +32,5 @@ def generate(env):
elif env["arch"] == "rv64":
env.Append(CCFLAGS=["-march=rv64gc"])
env.Append(LINKFLAGS=["-march=rv64gc"])
+
+ env.Append(CPPDEFINES=["LINUX_ENABLED", "UNIX_ENABLED"])
diff --git a/tools/macos.py b/tools/macos.py
index 2e4bfc6..0c75e4a 100644
--- a/tools/macos.py
+++ b/tools/macos.py
@@ -1,31 +1,51 @@
import os
import sys
-import macos_osxcross
+
+
+def has_osxcross():
+ return "OSXCROSS_ROOT" in os.environ
def options(opts):
opts.Add("macos_deployment_target", "macOS deployment target", "default")
opts.Add("macos_sdk_path", "macOS SDK path", "")
- macos_osxcross.options(opts)
+ if has_osxcross():
+ opts.Add("osxcross_sdk", "OSXCross SDK version", "darwin16")
def exists(env):
- return sys.platform == "darwin" or macos_osxcross.exists(env)
+ return sys.platform == "darwin" or has_osxcross()
def generate(env):
if env["arch"] not in ("universal", "arm64", "x86_64"):
print("Only universal, arm64, and x86_64 are supported on macOS. Exiting.")
- Exit()
+ env.Exit(1)
if sys.platform == "darwin":
# Use clang on macOS by default
env["CXX"] = "clang++"
env["CC"] = "clang"
else:
- # Use osxcross
- macos_osxcross.generate(env)
+ # OSXCross
+ root = os.environ.get("OSXCROSS_ROOT", "")
+ if env["arch"] == "arm64":
+ basecmd = root + "/target/bin/arm64-apple-" + env["osxcross_sdk"] + "-"
+ else:
+ basecmd = root + "/target/bin/x86_64-apple-" + env["osxcross_sdk"] + "-"
+
+ env["CC"] = basecmd + "clang"
+ env["CXX"] = basecmd + "clang++"
+ env["AR"] = basecmd + "ar"
+ env["RANLIB"] = basecmd + "ranlib"
+ env["AS"] = basecmd + "as"
+ binpath = os.path.join(root, "target", "bin")
+ if binpath not in env["ENV"]["PATH"]:
+ # Add OSXCROSS bin folder to PATH (required for linking).
+ env.PrependENVPath("PATH", binpath)
+
+ # Common flags
if env["arch"] == "universal":
env.Append(LINKFLAGS=["-arch", "x86_64", "-arch", "arm64"])
env.Append(CCFLAGS=["-arch", "x86_64", "-arch", "arm64"])
@@ -48,3 +68,5 @@ def generate(env):
"-Wl,-undefined,dynamic_lookup",
]
)
+
+ env.Append(CPPDEFINES=["MACOS_ENABLED", "UNIX_ENABLED"])
diff --git a/tools/macos_osxcross.py b/tools/macos_osxcross.py
deleted file mode 100644
index f11166d..0000000
--- a/tools/macos_osxcross.py
+++ /dev/null
@@ -1,28 +0,0 @@
-import os
-
-
-def options(opts):
- opts.Add("osxcross_sdk", "OSXCross SDK version", "darwin16")
-
-
-def exists(env):
- return "OSXCROSS_ROOT" in os.environ
-
-
-def generate(env):
- root = os.environ.get("OSXCROSS_ROOT", "")
- if env["arch"] == "arm64":
- basecmd = root + "/target/bin/arm64-apple-" + env["osxcross_sdk"] + "-"
- else:
- basecmd = root + "/target/bin/x86_64-apple-" + env["osxcross_sdk"] + "-"
-
- env["CC"] = basecmd + "clang"
- env["CXX"] = basecmd + "clang++"
- env["AR"] = basecmd + "ar"
- env["RANLIB"] = basecmd + "ranlib"
- env["AS"] = basecmd + "as"
-
- binpath = os.path.join(root, "target", "bin")
- if binpath not in env["ENV"]["PATH"]:
- # Add OSXCROSS bin folder to PATH (required for linking).
- env["ENV"]["PATH"] = "%s:%s" % (binpath, env["ENV"]["PATH"])
diff --git a/tools/targets.py b/tools/targets.py
index e9857dd..2161134 100644
--- a/tools/targets.py
+++ b/tools/targets.py
@@ -1,10 +1,14 @@
import os
+import subprocess
import sys
from SCons.Script import ARGUMENTS
from SCons.Variables import *
from SCons.Variables.BoolVariable import _text2bool
+# Helper methods
+
+
def get_cmdline_bool(option, default):
"""We use `ARGUMENTS.get()` to check if options were manually overridden on the command line,
and SCons' _text2bool helper to convert them to booleans, otherwise they're handled as strings.
@@ -16,6 +20,24 @@ def get_cmdline_bool(option, default):
return default
+def using_clang(env):
+ return "clang" in os.path.basename(env["CC"])
+
+
+def is_vanilla_clang(env):
+ if not using_clang(env):
+ return False
+ try:
+ version = subprocess.check_output([env.subst(env["CXX"]), "--version"]).strip().decode("utf-8")
+ except (subprocess.CalledProcessError, OSError):
+ print("Couldn't parse CXX environment variable to infer compiler version.")
+ return False
+ return not version.startswith("Apple")
+
+
+# Main tool definition
+
+
def options(opts):
opts.Add(
EnumVariable(
@@ -34,19 +56,21 @@ def exists(env):
def generate(env):
- env.dev_build = env["dev_build"]
- env.debug_features = env["target"] in ["editor", "template_debug"]
- env.editor_build = env["target"] == "editor"
+ # Configuration of build targets:
+ # - Editor or template
+ # - Debug features (DEBUG_ENABLED code)
+ # - Dev only code (DEV_ENABLED code)
+ # - Optimization level
+ # - Debug symbols for crash traces / debuggers
- if env.editor_build:
- env.AppendUnique(CPPDEFINES=["TOOLS_ENABLED"])
+ # Keep this configuration in sync with SConstruct in upstream Godot.
- if env.debug_features:
- env.AppendUnique(CPPDEFINES=["DEBUG_ENABLED", "DEBUG_METHODS_ENABLED"])
+ env.editor_build = env["target"] == "editor"
+ env.dev_build = env["dev_build"]
+ env.debug_features = env["target"] in ["editor", "template_debug"]
if env.dev_build:
opt_level = "none"
- env.AppendUnique(CPPDEFINES=["DEV_ENABLED"])
elif env.debug_features:
opt_level = "speed_trace"
else: # Release
@@ -55,29 +79,57 @@ def generate(env):
env["optimize"] = ARGUMENTS.get("optimize", opt_level)
env["debug_symbols"] = get_cmdline_bool("debug_symbols", env.dev_build)
+ if env.editor_build:
+ env.Append(CPPDEFINES=["TOOLS_ENABLED"])
+
+ if env.debug_features:
+ # DEBUG_ENABLED enables debugging *features* and debug-only code, which is intended
+ # to give *users* extra debugging information for their game development.
+ env.Append(CPPDEFINES=["DEBUG_ENABLED"])
+ # In upstream Godot this is added in typedefs.h when DEBUG_ENABLED is set.
+ env.Append(CPPDEFINES=["DEBUG_METHODS_ENABLED"])
+
+ if env.dev_build:
+ # DEV_ENABLED enables *engine developer* code which should only be compiled for those
+ # working on the engine itself.
+ env.Append(CPPDEFINES=["DEV_ENABLED"])
+ else:
+ # Disable assert() for production targets (only used in thirdparty code).
+ env.Append(CPPDEFINES=["NDEBUG"])
+
+ # Set optimize and debug_symbols flags.
+ # "custom" means do nothing and let users set their own optimization flags.
if env.get("is_msvc", False):
if env["debug_symbols"]:
env.Append(CCFLAGS=["/Zi", "/FS"])
env.Append(LINKFLAGS=["/DEBUG:FULL"])
- if env["optimize"] == "speed" or env["optimize"] == "speed_trace":
+ if env["optimize"] == "speed":
env.Append(CCFLAGS=["/O2"])
env.Append(LINKFLAGS=["/OPT:REF"])
+ elif env["optimize"] == "speed_trace":
+ env.Append(CCFLAGS=["/O2"])
+ env.Append(LINKFLAGS=["/OPT:REF", "/OPT:NOICF"])
elif env["optimize"] == "size":
env.Append(CCFLAGS=["/O1"])
env.Append(LINKFLAGS=["/OPT:REF"])
-
- if env["optimize"] == "debug" or env["optimize"] == "none":
- env.Append(CCFLAGS=["/MDd", "/Od"])
- else:
- env.Append(CCFLAGS=["/MD"])
-
+ elif env["optimize"] == "debug" or env["optimize"] == "none":
+ env.Append(CCFLAGS=["/Od"])
else:
if env["debug_symbols"]:
+ # Adding dwarf-4 explicitly makes stacktraces work with clang builds,
+ # otherwise addr2line doesn't understand them.
+ env.Append(CCFLAGS=["-gdwarf-4"])
if env.dev_build:
env.Append(CCFLAGS=["-g3"])
else:
env.Append(CCFLAGS=["-g2"])
+ else:
+ if using_clang(env) and not is_vanilla_clang(env):
+ # Apple Clang, its linker doesn't like -s.
+ env.Append(LINKFLAGS=["-Wl,-S", "-Wl,-x", "-Wl,-dead_strip"])
+ else:
+ env.Append(LINKFLAGS=["-s"])
if env["optimize"] == "speed":
env.Append(CCFLAGS=["-O3"])
diff --git a/tools/windows.py b/tools/windows.py
index b8690c5..e156aef 100644
--- a/tools/windows.py
+++ b/tools/windows.py
@@ -9,6 +9,7 @@ from SCons.Variables import *
def options(opts):
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))
def exists(env):
@@ -37,6 +38,11 @@ def generate(env):
env["CC"] = "clang-cl"
env["CXX"] = "clang-cl"
+ if env["use_static_cpp"]:
+ env.Append(CCFLAGS=["/MT"])
+ else:
+ env.Append(CCFLAGS=["/MD"])
+
elif sys.platform == "win32" or sys.platform == "msys":
env["use_mingw"] = True
mingw.generate(env)
@@ -45,6 +51,18 @@ def generate(env):
env["SHLIBPREFIX"] = ""
# Want dll suffix
env["SHLIBSUFFIX"] = ".dll"
+
+ env.Append(CCFLAGS=["-Wwrite-strings"])
+ env.Append(LINKFLAGS=["-Wl,--no-undefined"])
+ if env["use_static_cpp"]:
+ env.Append(
+ LINKFLAGS=[
+ "-static",
+ "-static-libgcc",
+ "-static-libstdc++",
+ ]
+ )
+
# Long line hack. Use custom spawn, quick AR append (to avoid files with the same names to override each other).
my_spawn.configure(env)
@@ -60,13 +78,15 @@ def generate(env):
# Want dll suffix
env["SHLIBSUFFIX"] = ".dll"
- # These options are for a release build even using target=debug
- env.Append(CCFLAGS=["-O3", "-Wwrite-strings"])
- env.Append(
- LINKFLAGS=[
- "--static",
- "-Wl,--no-undefined",
- "-static-libgcc",
- "-static-libstdc++",
- ]
- )
+ env.Append(CCFLAGS=["-Wwrite-strings"])
+ env.Append(LINKFLAGS=["-Wl,--no-undefined"])
+ if env["use_static_cpp"]:
+ env.Append(
+ LINKFLAGS=[
+ "-static",
+ "-static-libgcc",
+ "-static-libstdc++",
+ ]
+ )
+
+ env.Append(CPPDEFINES=["WINDOWS_ENABLED"])