From 2c681794cdaf85045f9687ca1bb857415a12c34e Mon Sep 17 00:00:00 2001 From: David Snopek Date: Thu, 19 Jun 2025 20:30:23 -0500 Subject: [PATCH] GDExtension: Store source of `gdextension_interface.h` in JSON --- .github/workflows/static_checks.yml | 4 - .pre-commit-config.yaml | 7 + core/extension/SCsub | 8 +- core/extension/gdextension.h | 2 +- core/extension/gdextension_interface.cpp | 2 +- core/extension/gdextension_interface.h | 3240 ------ core/extension/gdextension_interface.json | 9359 +++++++++++++++++ .../gdextension_interface.schema.json | 290 + ...gdextension_interface_header_generator.cpp | 309 + .../gdextension_interface_header_generator.h | 55 + core/extension/godot_instance.h | 2 +- core/extension/make_interface_dumper.py | 19 +- core/extension/make_interface_header.py | 306 + core/object/object.h | 2 +- main/main.cpp | 23 +- modules/register_module_types.h | 2 +- 16 files changed, 10371 insertions(+), 3259 deletions(-) delete mode 100644 core/extension/gdextension_interface.h create mode 100644 core/extension/gdextension_interface.json create mode 100644 core/extension/gdextension_interface.schema.json create mode 100644 core/extension/gdextension_interface_header_generator.cpp create mode 100644 core/extension/gdextension_interface_header_generator.h create mode 100644 core/extension/make_interface_header.py diff --git a/.github/workflows/static_checks.yml b/.github/workflows/static_checks.yml index 815375a1ce2..960bd19377b 100644 --- a/.github/workflows/static_checks.yml +++ b/.github/workflows/static_checks.yml @@ -41,7 +41,3 @@ jobs: sudo apt-get update sudo apt-get install libxml2-utils xmllint --quiet --noout --schema doc/class.xsd doc/classes/*.xml modules/*/doc_classes/*.xml platform/*/doc_classes/*.xml - - - name: Run C compiler on `gdextension_interface.h` - run: | - gcc -c core/extension/gdextension_interface.h diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 107dc502fcc..baa11d1f911 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -57,6 +57,13 @@ repos: - id: codespell additional_dependencies: [tomli] + - repo: https://github.com/python-jsonschema/check-jsonschema + rev: 0.34.1 + hooks: + - id: check-jsonschema + files: ^core/extension/gdextension_interface\.json$ + args: ["--schemafile", "core/extension/gdextension_interface.schema.json"] + ### Requires Docker; look into alternative implementation. # - repo: https://github.com/comkieffer/pre-commit-xmllint.git # rev: 1.0.0 diff --git a/core/extension/SCsub b/core/extension/SCsub index 8688ca5b6e7..e40170227a8 100644 --- a/core/extension/SCsub +++ b/core/extension/SCsub @@ -4,14 +4,20 @@ from misc.utility.scons_hints import * Import("env") import make_interface_dumper +import make_interface_header import make_wrappers env.CommandNoCache(["ext_wrappers.gen.inc"], "make_wrappers.py", env.Run(make_wrappers.run)) env.CommandNoCache( "gdextension_interface_dump.gen.h", - ["gdextension_interface.h", "make_interface_dumper.py"], + ["gdextension_interface.json", "make_interface_dumper.py"], env.Run(make_interface_dumper.run), ) +env.CommandNoCache( + "gdextension_interface.gen.h", + ["gdextension_interface.json", "make_interface_header.py"], + env.Run(make_interface_header.run), +) env_extension = env.Clone() diff --git a/core/extension/gdextension.h b/core/extension/gdextension.h index 3800cac7bf9..5019530029d 100644 --- a/core/extension/gdextension.h +++ b/core/extension/gdextension.h @@ -30,7 +30,7 @@ #pragma once -#include "core/extension/gdextension_interface.h" +#include "core/extension/gdextension_interface.gen.h" #include "core/extension/gdextension_loader.h" #include "core/io/config_file.h" #include "core/io/resource_loader.h" diff --git a/core/extension/gdextension_interface.cpp b/core/extension/gdextension_interface.cpp index 1ca98ba0556..539e52efe2e 100644 --- a/core/extension/gdextension_interface.cpp +++ b/core/extension/gdextension_interface.cpp @@ -28,7 +28,7 @@ /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /**************************************************************************/ -#include "gdextension_interface.h" +#include "gdextension_interface.gen.h" #include "core/config/engine.h" #include "core/extension/gdextension.h" diff --git a/core/extension/gdextension_interface.h b/core/extension/gdextension_interface.h deleted file mode 100644 index c917170cffb..00000000000 --- a/core/extension/gdextension_interface.h +++ /dev/null @@ -1,3240 +0,0 @@ -/**************************************************************************/ -/* gdextension_interface.h */ -/**************************************************************************/ -/* This file is part of: */ -/* GODOT ENGINE */ -/* https://godotengine.org */ -/**************************************************************************/ -/* Copyright (c) 2014-present Godot Engine contributors (see AUTHORS.md). */ -/* Copyright (c) 2007-2014 Juan Linietsky, Ariel Manzur. */ -/* */ -/* Permission is hereby granted, free of charge, to any person obtaining */ -/* a copy of this software and associated documentation files (the */ -/* "Software"), to deal in the Software without restriction, including */ -/* without limitation the rights to use, copy, modify, merge, publish, */ -/* distribute, sublicense, and/or sell copies of the Software, and to */ -/* permit persons to whom the Software is furnished to do so, subject to */ -/* the following conditions: */ -/* */ -/* The above copyright notice and this permission notice shall be */ -/* included in all copies or substantial portions of the Software. */ -/* */ -/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */ -/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */ -/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. */ -/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */ -/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */ -/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */ -/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ -/**************************************************************************/ - -#pragma once - -/* This is a C class header, you can copy it and use it directly in your own binders. - * Together with the JSON file, you should be able to generate any binder. - */ - -#ifndef __cplusplus -#include -#include - -typedef uint32_t char32_t; -typedef uint16_t char16_t; -#else -#include -#include - -extern "C" { -#endif - -/* VARIANT TYPES */ - -typedef enum { - GDEXTENSION_VARIANT_TYPE_NIL, - - /* atomic types */ - GDEXTENSION_VARIANT_TYPE_BOOL, - GDEXTENSION_VARIANT_TYPE_INT, - GDEXTENSION_VARIANT_TYPE_FLOAT, - GDEXTENSION_VARIANT_TYPE_STRING, - - /* math types */ - GDEXTENSION_VARIANT_TYPE_VECTOR2, - GDEXTENSION_VARIANT_TYPE_VECTOR2I, - GDEXTENSION_VARIANT_TYPE_RECT2, - GDEXTENSION_VARIANT_TYPE_RECT2I, - GDEXTENSION_VARIANT_TYPE_VECTOR3, - GDEXTENSION_VARIANT_TYPE_VECTOR3I, - GDEXTENSION_VARIANT_TYPE_TRANSFORM2D, - GDEXTENSION_VARIANT_TYPE_VECTOR4, - GDEXTENSION_VARIANT_TYPE_VECTOR4I, - GDEXTENSION_VARIANT_TYPE_PLANE, - GDEXTENSION_VARIANT_TYPE_QUATERNION, - GDEXTENSION_VARIANT_TYPE_AABB, - GDEXTENSION_VARIANT_TYPE_BASIS, - GDEXTENSION_VARIANT_TYPE_TRANSFORM3D, - GDEXTENSION_VARIANT_TYPE_PROJECTION, - - /* misc types */ - GDEXTENSION_VARIANT_TYPE_COLOR, - GDEXTENSION_VARIANT_TYPE_STRING_NAME, - GDEXTENSION_VARIANT_TYPE_NODE_PATH, - GDEXTENSION_VARIANT_TYPE_RID, - GDEXTENSION_VARIANT_TYPE_OBJECT, - GDEXTENSION_VARIANT_TYPE_CALLABLE, - GDEXTENSION_VARIANT_TYPE_SIGNAL, - GDEXTENSION_VARIANT_TYPE_DICTIONARY, - GDEXTENSION_VARIANT_TYPE_ARRAY, - - /* typed arrays */ - GDEXTENSION_VARIANT_TYPE_PACKED_BYTE_ARRAY, - GDEXTENSION_VARIANT_TYPE_PACKED_INT32_ARRAY, - GDEXTENSION_VARIANT_TYPE_PACKED_INT64_ARRAY, - GDEXTENSION_VARIANT_TYPE_PACKED_FLOAT32_ARRAY, - GDEXTENSION_VARIANT_TYPE_PACKED_FLOAT64_ARRAY, - GDEXTENSION_VARIANT_TYPE_PACKED_STRING_ARRAY, - GDEXTENSION_VARIANT_TYPE_PACKED_VECTOR2_ARRAY, - GDEXTENSION_VARIANT_TYPE_PACKED_VECTOR3_ARRAY, - GDEXTENSION_VARIANT_TYPE_PACKED_COLOR_ARRAY, - GDEXTENSION_VARIANT_TYPE_PACKED_VECTOR4_ARRAY, - - GDEXTENSION_VARIANT_TYPE_VARIANT_MAX -} GDExtensionVariantType; - -typedef enum { - /* comparison */ - GDEXTENSION_VARIANT_OP_EQUAL, - GDEXTENSION_VARIANT_OP_NOT_EQUAL, - GDEXTENSION_VARIANT_OP_LESS, - GDEXTENSION_VARIANT_OP_LESS_EQUAL, - GDEXTENSION_VARIANT_OP_GREATER, - GDEXTENSION_VARIANT_OP_GREATER_EQUAL, - - /* mathematic */ - GDEXTENSION_VARIANT_OP_ADD, - GDEXTENSION_VARIANT_OP_SUBTRACT, - GDEXTENSION_VARIANT_OP_MULTIPLY, - GDEXTENSION_VARIANT_OP_DIVIDE, - GDEXTENSION_VARIANT_OP_NEGATE, - GDEXTENSION_VARIANT_OP_POSITIVE, - GDEXTENSION_VARIANT_OP_MODULE, - GDEXTENSION_VARIANT_OP_POWER, - - /* bitwise */ - GDEXTENSION_VARIANT_OP_SHIFT_LEFT, - GDEXTENSION_VARIANT_OP_SHIFT_RIGHT, - GDEXTENSION_VARIANT_OP_BIT_AND, - GDEXTENSION_VARIANT_OP_BIT_OR, - GDEXTENSION_VARIANT_OP_BIT_XOR, - GDEXTENSION_VARIANT_OP_BIT_NEGATE, - - /* logic */ - GDEXTENSION_VARIANT_OP_AND, - GDEXTENSION_VARIANT_OP_OR, - GDEXTENSION_VARIANT_OP_XOR, - GDEXTENSION_VARIANT_OP_NOT, - - /* containment */ - GDEXTENSION_VARIANT_OP_IN, - GDEXTENSION_VARIANT_OP_MAX - -} GDExtensionVariantOperator; - -// In this API there are multiple functions which expect the caller to pass a pointer -// on return value as parameter. -// In order to make it clear if the caller should initialize the return value or not -// we have two flavor of types: -// - `GDExtensionXXXPtr` for pointer on an initialized value -// - `GDExtensionUninitializedXXXPtr` for pointer on uninitialized value -// -// Notes: -// - Not respecting those requirements can seems harmless, but will lead to unexpected -// segfault or memory leak (for instance with a specific compiler/OS, or when two -// native extensions start doing ptrcall on each other). -// - Initialization must be done with the function pointer returned by `variant_get_ptr_constructor`, -// zero-initializing the variable should not be considered a valid initialization method here ! -// - Some types have no destructor (see `extension_api.json`'s `has_destructor` field), for -// them it is always safe to skip the constructor for the return value if you are in a hurry ;-) - -typedef void *GDExtensionVariantPtr; -typedef const void *GDExtensionConstVariantPtr; -typedef void *GDExtensionUninitializedVariantPtr; -typedef void *GDExtensionStringNamePtr; -typedef const void *GDExtensionConstStringNamePtr; -typedef void *GDExtensionUninitializedStringNamePtr; -typedef void *GDExtensionStringPtr; -typedef const void *GDExtensionConstStringPtr; -typedef void *GDExtensionUninitializedStringPtr; -typedef void *GDExtensionObjectPtr; -typedef const void *GDExtensionConstObjectPtr; -typedef void *GDExtensionUninitializedObjectPtr; -typedef void *GDExtensionTypePtr; -typedef const void *GDExtensionConstTypePtr; -typedef void *GDExtensionUninitializedTypePtr; -typedef const void *GDExtensionMethodBindPtr; -typedef int64_t GDExtensionInt; -typedef uint8_t GDExtensionBool; -typedef uint64_t GDObjectInstanceID; -typedef void *GDExtensionRefPtr; -typedef const void *GDExtensionConstRefPtr; - -/* VARIANT DATA I/O */ - -typedef enum { - GDEXTENSION_CALL_OK, - GDEXTENSION_CALL_ERROR_INVALID_METHOD, - GDEXTENSION_CALL_ERROR_INVALID_ARGUMENT, // Expected a different variant type. - GDEXTENSION_CALL_ERROR_TOO_MANY_ARGUMENTS, // Expected lower number of arguments. - GDEXTENSION_CALL_ERROR_TOO_FEW_ARGUMENTS, // Expected higher number of arguments. - GDEXTENSION_CALL_ERROR_INSTANCE_IS_NULL, - GDEXTENSION_CALL_ERROR_METHOD_NOT_CONST, // Used for const call. -} GDExtensionCallErrorType; - -typedef struct { - GDExtensionCallErrorType error; - int32_t argument; - int32_t expected; -} GDExtensionCallError; - -typedef void (*GDExtensionVariantFromTypeConstructorFunc)(GDExtensionUninitializedVariantPtr, GDExtensionTypePtr); -typedef void (*GDExtensionTypeFromVariantConstructorFunc)(GDExtensionUninitializedTypePtr, GDExtensionVariantPtr); -typedef void *(*GDExtensionVariantGetInternalPtrFunc)(GDExtensionVariantPtr); -typedef void (*GDExtensionPtrOperatorEvaluator)(GDExtensionConstTypePtr p_left, GDExtensionConstTypePtr p_right, GDExtensionTypePtr r_result); -typedef void (*GDExtensionPtrBuiltInMethod)(GDExtensionTypePtr p_base, const GDExtensionConstTypePtr *p_args, GDExtensionTypePtr r_return, int p_argument_count); -typedef void (*GDExtensionPtrConstructor)(GDExtensionUninitializedTypePtr p_base, const GDExtensionConstTypePtr *p_args); -typedef void (*GDExtensionPtrDestructor)(GDExtensionTypePtr p_base); -typedef void (*GDExtensionPtrSetter)(GDExtensionTypePtr p_base, GDExtensionConstTypePtr p_value); -typedef void (*GDExtensionPtrGetter)(GDExtensionConstTypePtr p_base, GDExtensionTypePtr r_value); -typedef void (*GDExtensionPtrIndexedSetter)(GDExtensionTypePtr p_base, GDExtensionInt p_index, GDExtensionConstTypePtr p_value); -typedef void (*GDExtensionPtrIndexedGetter)(GDExtensionConstTypePtr p_base, GDExtensionInt p_index, GDExtensionTypePtr r_value); -typedef void (*GDExtensionPtrKeyedSetter)(GDExtensionTypePtr p_base, GDExtensionConstTypePtr p_key, GDExtensionConstTypePtr p_value); -typedef void (*GDExtensionPtrKeyedGetter)(GDExtensionConstTypePtr p_base, GDExtensionConstTypePtr p_key, GDExtensionTypePtr r_value); -typedef uint32_t (*GDExtensionPtrKeyedChecker)(GDExtensionConstVariantPtr p_base, GDExtensionConstVariantPtr p_key); -typedef void (*GDExtensionPtrUtilityFunction)(GDExtensionTypePtr r_return, const GDExtensionConstTypePtr *p_args, int p_argument_count); - -typedef GDExtensionObjectPtr (*GDExtensionClassConstructor)(); - -typedef void *(*GDExtensionInstanceBindingCreateCallback)(void *p_token, void *p_instance); -typedef void (*GDExtensionInstanceBindingFreeCallback)(void *p_token, void *p_instance, void *p_binding); -typedef GDExtensionBool (*GDExtensionInstanceBindingReferenceCallback)(void *p_token, void *p_binding, GDExtensionBool p_reference); - -typedef struct { - GDExtensionInstanceBindingCreateCallback create_callback; - GDExtensionInstanceBindingFreeCallback free_callback; - GDExtensionInstanceBindingReferenceCallback reference_callback; -} GDExtensionInstanceBindingCallbacks; - -/* EXTENSION CLASSES */ - -typedef void *GDExtensionClassInstancePtr; - -typedef GDExtensionBool (*GDExtensionClassSet)(GDExtensionClassInstancePtr p_instance, GDExtensionConstStringNamePtr p_name, GDExtensionConstVariantPtr p_value); -typedef GDExtensionBool (*GDExtensionClassGet)(GDExtensionClassInstancePtr p_instance, GDExtensionConstStringNamePtr p_name, GDExtensionVariantPtr r_ret); -typedef uint64_t (*GDExtensionClassGetRID)(GDExtensionClassInstancePtr p_instance); - -typedef struct { - GDExtensionVariantType type; - GDExtensionStringNamePtr name; - GDExtensionStringNamePtr class_name; - uint32_t hint; // Bitfield of `PropertyHint` (defined in `extension_api.json`). - GDExtensionStringPtr hint_string; - uint32_t usage; // Bitfield of `PropertyUsageFlags` (defined in `extension_api.json`). -} GDExtensionPropertyInfo; - -typedef struct { - GDExtensionStringNamePtr name; - GDExtensionPropertyInfo return_value; - uint32_t flags; // Bitfield of `GDExtensionClassMethodFlags`. - int32_t id; - - /* Arguments: `default_arguments` is an array of size `argument_count`. */ - uint32_t argument_count; - GDExtensionPropertyInfo *arguments; - - /* Default arguments: `default_arguments` is an array of size `default_argument_count`. */ - uint32_t default_argument_count; - GDExtensionVariantPtr *default_arguments; -} GDExtensionMethodInfo; - -typedef const GDExtensionPropertyInfo *(*GDExtensionClassGetPropertyList)(GDExtensionClassInstancePtr p_instance, uint32_t *r_count); -typedef void (*GDExtensionClassFreePropertyList)(GDExtensionClassInstancePtr p_instance, const GDExtensionPropertyInfo *p_list); -typedef void (*GDExtensionClassFreePropertyList2)(GDExtensionClassInstancePtr p_instance, const GDExtensionPropertyInfo *p_list, uint32_t p_count); -typedef GDExtensionBool (*GDExtensionClassPropertyCanRevert)(GDExtensionClassInstancePtr p_instance, GDExtensionConstStringNamePtr p_name); -typedef GDExtensionBool (*GDExtensionClassPropertyGetRevert)(GDExtensionClassInstancePtr p_instance, GDExtensionConstStringNamePtr p_name, GDExtensionVariantPtr r_ret); -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); -typedef void (*GDExtensionClassCallVirtual)(GDExtensionClassInstancePtr p_instance, const GDExtensionConstTypePtr *p_args, GDExtensionTypePtr r_ret); -typedef GDExtensionObjectPtr (*GDExtensionClassCreateInstance)(void *p_class_userdata); -typedef GDExtensionObjectPtr (*GDExtensionClassCreateInstance2)(void *p_class_userdata, GDExtensionBool p_notify_postinitialize); -typedef void (*GDExtensionClassFreeInstance)(void *p_class_userdata, GDExtensionClassInstancePtr p_instance); -typedef GDExtensionClassInstancePtr (*GDExtensionClassRecreateInstance)(void *p_class_userdata, GDExtensionObjectPtr p_object); -typedef GDExtensionClassCallVirtual (*GDExtensionClassGetVirtual)(void *p_class_userdata, GDExtensionConstStringNamePtr p_name); -typedef GDExtensionClassCallVirtual (*GDExtensionClassGetVirtual2)(void *p_class_userdata, GDExtensionConstStringNamePtr p_name, uint32_t p_hash); -typedef void *(*GDExtensionClassGetVirtualCallData)(void *p_class_userdata, GDExtensionConstStringNamePtr p_name); -typedef void *(*GDExtensionClassGetVirtualCallData2)(void *p_class_userdata, GDExtensionConstStringNamePtr p_name, uint32_t p_hash); -typedef void (*GDExtensionClassCallVirtualWithData)(GDExtensionClassInstancePtr p_instance, GDExtensionConstStringNamePtr p_name, void *p_virtual_call_userdata, const GDExtensionConstTypePtr *p_args, GDExtensionTypePtr r_ret); - -typedef struct { - GDExtensionBool is_virtual; - GDExtensionBool is_abstract; - 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; - GDExtensionClassNotification 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. -} GDExtensionClassCreationInfo; // Deprecated. Use GDExtensionClassCreationInfo4 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. - GDExtensionClassRecreateInstance recreate_instance_func; - // Queries a virtual function by name and returns a callback to invoke the requested virtual function. - GDExtensionClassGetVirtual get_virtual_func; - // Paired with `call_virtual_with_data_func`, this is an alternative to `get_virtual_func` for extensions that - // need or benefit from extra data when calling virtual functions. - // Returns user data that will be passed to `call_virtual_with_data_func`. - // Returning `NULL` from this function signals to Godot that the virtual function is not overridden. - // Data returned from this function should be managed by the extension and must be valid until the extension is deinitialized. - // You should supply either `get_virtual_func`, or `get_virtual_call_data_func` with `call_virtual_with_data_func`. - GDExtensionClassGetVirtualCallData get_virtual_call_data_func; - // Used to call virtual functions when `get_virtual_call_data_func` is not null. - GDExtensionClassCallVirtualWithData call_virtual_with_data_func; - GDExtensionClassGetRID get_rid_func; - void *class_userdata; // Per-class user data, later accessible in instance bindings. -} GDExtensionClassCreationInfo2; // Deprecated. Use GDExtensionClassCreationInfo4 instead. - -typedef struct { - GDExtensionBool is_virtual; - GDExtensionBool is_abstract; - GDExtensionBool is_exposed; - GDExtensionBool is_runtime; - GDExtensionClassSet set_func; - GDExtensionClassGet get_func; - GDExtensionClassGetPropertyList get_property_list_func; - GDExtensionClassFreePropertyList2 free_property_list_func; - GDExtensionClassPropertyCanRevert property_can_revert_func; - GDExtensionClassPropertyGetRevert property_get_revert_func; - GDExtensionClassValidateProperty validate_property_func; - GDExtensionClassNotification2 notification_func; - GDExtensionClassToString to_string_func; - GDExtensionClassReference reference_func; - GDExtensionClassUnreference unreference_func; - 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. - GDExtensionClassRecreateInstance recreate_instance_func; - // Queries a virtual function by name and returns a callback to invoke the requested virtual function. - GDExtensionClassGetVirtual get_virtual_func; - // Paired with `call_virtual_with_data_func`, this is an alternative to `get_virtual_func` for extensions that - // need or benefit from extra data when calling virtual functions. - // Returns user data that will be passed to `call_virtual_with_data_func`. - // Returning `NULL` from this function signals to Godot that the virtual function is not overridden. - // Data returned from this function should be managed by the extension and must be valid until the extension is deinitialized. - // You should supply either `get_virtual_func`, or `get_virtual_call_data_func` with `call_virtual_with_data_func`. - GDExtensionClassGetVirtualCallData get_virtual_call_data_func; - // Used to call virtual functions when `get_virtual_call_data_func` is not null. - GDExtensionClassCallVirtualWithData call_virtual_with_data_func; - GDExtensionClassGetRID get_rid_func; - void *class_userdata; // Per-class user data, later accessible in instance bindings. -} GDExtensionClassCreationInfo3; // Deprecated. Use GDExtensionClassCreationInfo4 instead. - -typedef struct { - GDExtensionBool is_virtual; - GDExtensionBool is_abstract; - GDExtensionBool is_exposed; - GDExtensionBool is_runtime; - GDExtensionConstStringPtr icon_path; - GDExtensionClassSet set_func; - GDExtensionClassGet get_func; - GDExtensionClassGetPropertyList get_property_list_func; - GDExtensionClassFreePropertyList2 free_property_list_func; - GDExtensionClassPropertyCanRevert property_can_revert_func; - GDExtensionClassPropertyGetRevert property_get_revert_func; - GDExtensionClassValidateProperty validate_property_func; - GDExtensionClassNotification2 notification_func; - GDExtensionClassToString to_string_func; - GDExtensionClassReference reference_func; - GDExtensionClassUnreference unreference_func; - GDExtensionClassCreateInstance2 create_instance_func; // (Default) constructor; mandatory. If the class is not instantiable, consider making it virtual or abstract. - GDExtensionClassFreeInstance free_instance_func; // Destructor; mandatory. - GDExtensionClassRecreateInstance recreate_instance_func; - // Queries a virtual function by name and returns a callback to invoke the requested virtual function. - GDExtensionClassGetVirtual2 get_virtual_func; - // Paired with `call_virtual_with_data_func`, this is an alternative to `get_virtual_func` for extensions that - // need or benefit from extra data when calling virtual functions. - // Returns user data that will be passed to `call_virtual_with_data_func`. - // Returning `NULL` from this function signals to Godot that the virtual function is not overridden. - // Data returned from this function should be managed by the extension and must be valid until the extension is deinitialized. - // You should supply either `get_virtual_func`, or `get_virtual_call_data_func` with `call_virtual_with_data_func`. - GDExtensionClassGetVirtualCallData2 get_virtual_call_data_func; - // Used to call virtual functions when `get_virtual_call_data_func` is not null. - GDExtensionClassCallVirtualWithData call_virtual_with_data_func; - void *class_userdata; // Per-class user data, later accessible in instance bindings. -} GDExtensionClassCreationInfo4; - -typedef GDExtensionClassCreationInfo4 GDExtensionClassCreationInfo5; - -typedef void *GDExtensionClassLibraryPtr; - -/* Passed a pointer to a PackedStringArray that should be filled with the classes that may be used by the GDExtension. */ -typedef void (*GDExtensionEditorGetClassesUsedCallback)(GDExtensionTypePtr p_packed_string_array); - -/* Method */ - -typedef enum { - GDEXTENSION_METHOD_FLAG_NORMAL = 1, - GDEXTENSION_METHOD_FLAG_EDITOR = 2, - GDEXTENSION_METHOD_FLAG_CONST = 4, - GDEXTENSION_METHOD_FLAG_VIRTUAL = 8, - GDEXTENSION_METHOD_FLAG_VARARG = 16, - GDEXTENSION_METHOD_FLAG_STATIC = 32, - GDEXTENSION_METHOD_FLAG_VIRTUAL_REQUIRED = 128, - GDEXTENSION_METHOD_FLAGS_DEFAULT = GDEXTENSION_METHOD_FLAG_NORMAL, -} GDExtensionClassMethodFlags; - -typedef enum { - GDEXTENSION_METHOD_ARGUMENT_METADATA_NONE, - GDEXTENSION_METHOD_ARGUMENT_METADATA_INT_IS_INT8, - GDEXTENSION_METHOD_ARGUMENT_METADATA_INT_IS_INT16, - GDEXTENSION_METHOD_ARGUMENT_METADATA_INT_IS_INT32, - GDEXTENSION_METHOD_ARGUMENT_METADATA_INT_IS_INT64, - GDEXTENSION_METHOD_ARGUMENT_METADATA_INT_IS_UINT8, - GDEXTENSION_METHOD_ARGUMENT_METADATA_INT_IS_UINT16, - GDEXTENSION_METHOD_ARGUMENT_METADATA_INT_IS_UINT32, - GDEXTENSION_METHOD_ARGUMENT_METADATA_INT_IS_UINT64, - GDEXTENSION_METHOD_ARGUMENT_METADATA_REAL_IS_FLOAT, - GDEXTENSION_METHOD_ARGUMENT_METADATA_REAL_IS_DOUBLE, - GDEXTENSION_METHOD_ARGUMENT_METADATA_INT_IS_CHAR16, - GDEXTENSION_METHOD_ARGUMENT_METADATA_INT_IS_CHAR32, -} GDExtensionClassMethodArgumentMetadata; - -typedef void (*GDExtensionClassMethodCall)(void *method_userdata, GDExtensionClassInstancePtr p_instance, const GDExtensionConstVariantPtr *p_args, GDExtensionInt p_argument_count, GDExtensionVariantPtr r_return, GDExtensionCallError *r_error); -typedef void (*GDExtensionClassMethodValidatedCall)(void *method_userdata, GDExtensionClassInstancePtr p_instance, const GDExtensionConstVariantPtr *p_args, GDExtensionVariantPtr r_return); -typedef void (*GDExtensionClassMethodPtrCall)(void *method_userdata, GDExtensionClassInstancePtr p_instance, const GDExtensionConstTypePtr *p_args, GDExtensionTypePtr r_ret); - -typedef struct { - GDExtensionStringNamePtr name; - void *method_userdata; - GDExtensionClassMethodCall call_func; - GDExtensionClassMethodPtrCall ptrcall_func; - uint32_t method_flags; // Bitfield of `GDExtensionClassMethodFlags`. - - /* If `has_return_value` is false, `return_value_info` and `return_value_metadata` are ignored. - * - * @todo Consider dropping `has_return_value` and making the other two properties match `GDExtensionMethodInfo` and `GDExtensionClassVirtualMethod` for consistency in future version of this struct. - */ - GDExtensionBool has_return_value; - GDExtensionPropertyInfo *return_value_info; - GDExtensionClassMethodArgumentMetadata return_value_metadata; - - /* Arguments: `arguments_info` and `arguments_metadata` are array of size `argument_count`. - * Name and hint information for the argument can be omitted in release builds. Class name should always be present if it applies. - * - * @todo Consider renaming `arguments_info` to `arguments` for consistency in future version of this struct. - */ - uint32_t argument_count; - GDExtensionPropertyInfo *arguments_info; - GDExtensionClassMethodArgumentMetadata *arguments_metadata; - - /* Default arguments: `default_arguments` is an array of size `default_argument_count`. */ - uint32_t default_argument_count; - GDExtensionVariantPtr *default_arguments; -} GDExtensionClassMethodInfo; - -typedef struct { - GDExtensionStringNamePtr name; - uint32_t method_flags; // Bitfield of `GDExtensionClassMethodFlags`. - - GDExtensionPropertyInfo return_value; - GDExtensionClassMethodArgumentMetadata return_value_metadata; - - uint32_t argument_count; - GDExtensionPropertyInfo *arguments; - GDExtensionClassMethodArgumentMetadata *arguments_metadata; -} GDExtensionClassVirtualMethodInfo; - -typedef void (*GDExtensionCallableCustomCall)(void *callable_userdata, const GDExtensionConstVariantPtr *p_args, GDExtensionInt p_argument_count, GDExtensionVariantPtr r_return, GDExtensionCallError *r_error); -typedef GDExtensionBool (*GDExtensionCallableCustomIsValid)(void *callable_userdata); -typedef void (*GDExtensionCallableCustomFree)(void *callable_userdata); - -typedef uint32_t (*GDExtensionCallableCustomHash)(void *callable_userdata); -typedef GDExtensionBool (*GDExtensionCallableCustomEqual)(void *callable_userdata_a, void *callable_userdata_b); -typedef GDExtensionBool (*GDExtensionCallableCustomLessThan)(void *callable_userdata_a, void *callable_userdata_b); - -typedef void (*GDExtensionCallableCustomToString)(void *callable_userdata, GDExtensionBool *r_is_valid, GDExtensionStringPtr r_out); - -typedef GDExtensionInt (*GDExtensionCallableCustomGetArgumentCount)(void *callable_userdata, GDExtensionBool *r_is_valid); - -typedef struct { - /* Only `call_func` and `token` are strictly required, however, `object_id` should be passed if its not a static method. - * - * `token` should point to an address that uniquely identifies the GDExtension (for example, the - * `GDExtensionClassLibraryPtr` passed to the entry symbol function. - * - * `hash_func`, `equal_func`, and `less_than_func` are optional. If not provided both `call_func` and - * `callable_userdata` together are used as the identity of the callable for hashing and comparison purposes. - * - * The hash returned by `hash_func` is cached, `hash_func` will not be called more than once per callable. - * - * `is_valid_func` is necessary if the validity of the callable can change before destruction. - * - * `free_func` is necessary if `callable_userdata` needs to be cleaned up when the callable is freed. - */ - void *callable_userdata; - void *token; - - GDObjectInstanceID object_id; - - GDExtensionCallableCustomCall call_func; - GDExtensionCallableCustomIsValid is_valid_func; - GDExtensionCallableCustomFree free_func; - - GDExtensionCallableCustomHash hash_func; - GDExtensionCallableCustomEqual equal_func; - GDExtensionCallableCustomLessThan less_than_func; - - GDExtensionCallableCustomToString to_string_func; -} GDExtensionCallableCustomInfo; // Deprecated. Use GDExtensionCallableCustomInfo2 instead. - -typedef struct { - /* Only `call_func` and `token` are strictly required, however, `object_id` should be passed if its not a static method. - * - * `token` should point to an address that uniquely identifies the GDExtension (for example, the - * `GDExtensionClassLibraryPtr` passed to the entry symbol function. - * - * `hash_func`, `equal_func`, and `less_than_func` are optional. If not provided both `call_func` and - * `callable_userdata` together are used as the identity of the callable for hashing and comparison purposes. - * - * The hash returned by `hash_func` is cached, `hash_func` will not be called more than once per callable. - * - * `is_valid_func` is necessary if the validity of the callable can change before destruction. - * - * `free_func` is necessary if `callable_userdata` needs to be cleaned up when the callable is freed. - */ - void *callable_userdata; - void *token; - - GDObjectInstanceID object_id; - - GDExtensionCallableCustomCall call_func; - GDExtensionCallableCustomIsValid is_valid_func; - GDExtensionCallableCustomFree free_func; - - GDExtensionCallableCustomHash hash_func; - GDExtensionCallableCustomEqual equal_func; - GDExtensionCallableCustomLessThan less_than_func; - - GDExtensionCallableCustomToString to_string_func; - - GDExtensionCallableCustomGetArgumentCount get_argument_count_func; -} GDExtensionCallableCustomInfo2; - -/* SCRIPT INSTANCE EXTENSION */ - -typedef void *GDExtensionScriptInstanceDataPtr; // Pointer to custom ScriptInstance native implementation. - -typedef GDExtensionBool (*GDExtensionScriptInstanceSet)(GDExtensionScriptInstanceDataPtr p_instance, GDExtensionConstStringNamePtr p_name, GDExtensionConstVariantPtr p_value); -typedef GDExtensionBool (*GDExtensionScriptInstanceGet)(GDExtensionScriptInstanceDataPtr p_instance, GDExtensionConstStringNamePtr p_name, GDExtensionVariantPtr r_ret); -typedef const GDExtensionPropertyInfo *(*GDExtensionScriptInstanceGetPropertyList)(GDExtensionScriptInstanceDataPtr p_instance, uint32_t *r_count); -typedef void (*GDExtensionScriptInstanceFreePropertyList)(GDExtensionScriptInstanceDataPtr p_instance, const GDExtensionPropertyInfo *p_list); // Deprecated. Use GDExtensionScriptInstanceFreePropertyList2 instead. -typedef void (*GDExtensionScriptInstanceFreePropertyList2)(GDExtensionScriptInstanceDataPtr p_instance, const GDExtensionPropertyInfo *p_list, uint32_t p_count); -typedef GDExtensionBool (*GDExtensionScriptInstanceGetClassCategory)(GDExtensionScriptInstanceDataPtr p_instance, GDExtensionPropertyInfo *p_class_category); - -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); - -typedef GDExtensionObjectPtr (*GDExtensionScriptInstanceGetOwner)(GDExtensionScriptInstanceDataPtr p_instance); -typedef void (*GDExtensionScriptInstancePropertyStateAdd)(GDExtensionConstStringNamePtr p_name, GDExtensionConstVariantPtr p_value, void *p_userdata); -typedef void (*GDExtensionScriptInstanceGetPropertyState)(GDExtensionScriptInstanceDataPtr p_instance, GDExtensionScriptInstancePropertyStateAdd p_add_func, void *p_userdata); - -typedef const GDExtensionMethodInfo *(*GDExtensionScriptInstanceGetMethodList)(GDExtensionScriptInstanceDataPtr p_instance, uint32_t *r_count); -typedef void (*GDExtensionScriptInstanceFreeMethodList)(GDExtensionScriptInstanceDataPtr p_instance, const GDExtensionMethodInfo *p_list); // Deprecated. Use GDExtensionScriptInstanceFreeMethodList2 instead. -typedef void (*GDExtensionScriptInstanceFreeMethodList2)(GDExtensionScriptInstanceDataPtr p_instance, const GDExtensionMethodInfo *p_list, uint32_t p_count); - -typedef GDExtensionBool (*GDExtensionScriptInstanceHasMethod)(GDExtensionScriptInstanceDataPtr p_instance, GDExtensionConstStringNamePtr p_name); - -typedef GDExtensionInt (*GDExtensionScriptInstanceGetMethodArgumentCount)(GDExtensionScriptInstanceDataPtr p_instance, GDExtensionConstStringNamePtr p_name, GDExtensionBool *r_is_valid); - -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); // 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); -typedef GDExtensionBool (*GDExtensionScriptInstanceRefCountDecremented)(GDExtensionScriptInstanceDataPtr p_instance); - -typedef GDExtensionObjectPtr (*GDExtensionScriptInstanceGetScript)(GDExtensionScriptInstanceDataPtr p_instance); -typedef GDExtensionBool (*GDExtensionScriptInstanceIsPlaceholder)(GDExtensionScriptInstanceDataPtr p_instance); - -typedef void *GDExtensionScriptLanguagePtr; - -typedef GDExtensionScriptLanguagePtr (*GDExtensionScriptInstanceGetLanguage)(GDExtensionScriptInstanceDataPtr p_instance); - -typedef void (*GDExtensionScriptInstanceFree)(GDExtensionScriptInstanceDataPtr p_instance); - -typedef void *GDExtensionScriptInstancePtr; // Pointer to ScriptInstance. - -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; - - GDExtensionScriptInstanceHasMethod has_method_func; - - GDExtensionScriptInstanceCall call_func; - GDExtensionScriptInstanceNotification 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; - -} GDExtensionScriptInstanceInfo; // Deprecated. Use GDExtensionScriptInstanceInfo3 instead. - -typedef struct { - GDExtensionScriptInstanceSet set_func; - GDExtensionScriptInstanceGet get_func; - GDExtensionScriptInstanceGetPropertyList get_property_list_func; - GDExtensionScriptInstanceFreePropertyList free_property_list_func; - GDExtensionScriptInstanceGetClassCategory get_class_category_func; // Optional. Set to NULL for the default behavior. - - 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; // Deprecated. Use GDExtensionScriptInstanceInfo3 instead. - -typedef struct { - GDExtensionScriptInstanceSet set_func; - GDExtensionScriptInstanceGet get_func; - GDExtensionScriptInstanceGetPropertyList get_property_list_func; - GDExtensionScriptInstanceFreePropertyList2 free_property_list_func; - GDExtensionScriptInstanceGetClassCategory get_class_category_func; // Optional. Set to NULL for the default behavior. - - GDExtensionScriptInstancePropertyCanRevert property_can_revert_func; - GDExtensionScriptInstancePropertyGetRevert property_get_revert_func; - - GDExtensionScriptInstanceGetOwner get_owner_func; - GDExtensionScriptInstanceGetPropertyState get_property_state_func; - - GDExtensionScriptInstanceGetMethodList get_method_list_func; - GDExtensionScriptInstanceFreeMethodList2 free_method_list_func; - GDExtensionScriptInstanceGetPropertyType get_property_type_func; - GDExtensionScriptInstanceValidateProperty validate_property_func; - - GDExtensionScriptInstanceHasMethod has_method_func; - - GDExtensionScriptInstanceGetMethodArgumentCount get_method_argument_count_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; - -} GDExtensionScriptInstanceInfo3; - -typedef void (*GDExtensionWorkerThreadPoolGroupTask)(void *, uint32_t); -typedef void (*GDExtensionWorkerThreadPoolTask)(void *); - -/* INITIALIZATION */ - -typedef enum { - GDEXTENSION_INITIALIZATION_CORE, - GDEXTENSION_INITIALIZATION_SERVERS, - GDEXTENSION_INITIALIZATION_SCENE, - GDEXTENSION_INITIALIZATION_EDITOR, - GDEXTENSION_MAX_INITIALIZATION_LEVEL, -} GDExtensionInitializationLevel; - -typedef void (*GDExtensionInitializeCallback)(void *p_userdata, GDExtensionInitializationLevel p_level); -typedef void (*GDExtensionDeinitializeCallback)(void *p_userdata, GDExtensionInitializationLevel p_level); - -typedef struct { - /* Minimum initialization level required. - * If Core or Servers, the extension needs editor or game restart to take effect */ - GDExtensionInitializationLevel minimum_initialization_level; - /* Up to the user to supply when initializing */ - void *userdata; - /* This function will be called multiple times for each initialization level. */ - GDExtensionInitializeCallback initialize; - GDExtensionDeinitializeCallback deinitialize; -} GDExtensionInitialization; - -typedef void (*GDExtensionInterfaceFunctionPtr)(); -typedef GDExtensionInterfaceFunctionPtr (*GDExtensionInterfaceGetProcAddress)(const char *p_function_name); - -/* - * Each GDExtension should define a C function that matches the signature of GDExtensionInitializationFunction, - * and export it so that it can be loaded via dlopen() or equivalent for the given platform. - * - * For example: - * - * GDExtensionBool my_extension_init(GDExtensionInterfaceGetProcAddress p_get_proc_address, GDExtensionClassLibraryPtr p_library, GDExtensionInitialization *r_initialization); - * - * This function's name must be specified as the 'entry_symbol' in the .gdextension file. - * - * This makes it the entry point of the GDExtension and will be called on initialization. - * - * The GDExtension can then modify the r_initialization structure, setting the minimum initialization level, - * and providing pointers to functions that will be called at various stages of initialization/shutdown. - * - * The rest of the GDExtension's interface to Godot consists of function pointers that can be loaded - * by calling p_get_proc_address("...") with the name of the function. - * - * For example: - * - * GDExtensionInterfaceGetGodotVersion get_godot_version = (GDExtensionInterfaceGetGodotVersion)p_get_proc_address("get_godot_version"); - * - * (Note that snippet may cause "cast between incompatible function types" on some compilers, you can - * silence this by adding an intermediary `void*` cast.) - * - * You can then call it like a normal function: - * - * GDExtensionGodotVersion godot_version; - * get_godot_version(&godot_version); - * printf("Godot v%d.%d.%d\n", godot_version.major, godot_version.minor, godot_version.patch); - * - * All of these interface functions are described below, together with the name that's used to load it, - * and the function pointer typedef that shows its signature. - */ -typedef GDExtensionBool (*GDExtensionInitializationFunction)(GDExtensionInterfaceGetProcAddress p_get_proc_address, GDExtensionClassLibraryPtr p_library, GDExtensionInitialization *r_initialization); - -/* INTERFACE */ - -typedef struct { - uint32_t major; - uint32_t minor; - uint32_t patch; - const char *string; -} GDExtensionGodotVersion; - -typedef struct { - uint32_t major; - uint32_t minor; - uint32_t patch; - uint32_t hex; // Full version encoded as hexadecimal with one byte (2 hex digits) per number (e.g. for "3.1.12" it would be 0x03010C) - const char *status; // (e.g. "stable", "beta", "rc1", "rc2") - const char *build; // (e.g. "custom_build") - const char *hash; // Full Git commit hash. - uint64_t timestamp; // Git commit date UNIX timestamp in seconds, or 0 if unavailable. - const char *string; // (e.g. "Godot v3.1.4.stable.official.mono") -} GDExtensionGodotVersion2; - -/* Called when starting the main loop. */ -typedef void (*GDExtensionMainLoopStartupCallback)(); - -/* Called when shutting down the main loop. */ -typedef void (*GDExtensionMainLoopShutdownCallback)(); - -/* Called for every frame iteration of the main loop. */ -typedef void (*GDExtensionMainLoopFrameCallback)(); - -typedef struct { - // Will be called after Godot is started and is fully initialized. - GDExtensionMainLoopStartupCallback startup_func; - // Will be called before Godot is shutdown when it is still fully initialized. - GDExtensionMainLoopShutdownCallback shutdown_func; - // Will be called for each process frame. This will run after all `_process()` methods on Node, and before `ScriptServer::frame()`. - // This is intended to be the equivalent of `ScriptLanguage::frame()` for GDExtension language bindings that don't use the script API. - GDExtensionMainLoopFrameCallback frame_func; -} GDExtensionMainLoopCallbacks; - -/** - * @name get_godot_version - * @since 4.1 - * @deprecated in Godot 4.5. Use `get_godot_version2` instead. - * - * Gets the Godot version that the GDExtension was loaded into. - * - * @param r_godot_version A pointer to the structure to write the version information into. - */ -typedef void (*GDExtensionInterfaceGetGodotVersion)(GDExtensionGodotVersion *r_godot_version); - -/** - * @name get_godot_version2 - * @since 4.5 - * - * Gets the Godot version that the GDExtension was loaded into. - * - * @param r_godot_version A pointer to the structure to write the version information into. - */ -typedef void (*GDExtensionInterfaceGetGodotVersion2)(GDExtensionGodotVersion2 *r_godot_version); - -/* INTERFACE: Memory */ - -/** - * @name mem_alloc - * @since 4.1 - * @deprecated in Godot 4.6. Use `mem_alloc2` instead. - * - * Allocates memory. - * - * @param p_bytes The amount of memory to allocate in bytes. - * - * @return A pointer to the allocated memory, or NULL if unsuccessful. - */ -typedef void *(*GDExtensionInterfaceMemAlloc)(size_t p_bytes); - -/** - * @name mem_realloc - * @since 4.1 - * @deprecated in Godot 4.6. Use `mem_realloc2` instead. - * - * Reallocates memory. - * - * @param p_ptr A pointer to the previously allocated memory. - * @param p_bytes The number of bytes to resize the memory block to. - * - * @return A pointer to the allocated memory, or NULL if unsuccessful. - */ -typedef void *(*GDExtensionInterfaceMemRealloc)(void *p_ptr, size_t p_bytes); - -/** - * @name mem_free - * @since 4.1 - * @deprecated in Godot 4.6. Use `mem_free2` instead. - * - * Frees memory. - * - * @param p_ptr A pointer to the previously allocated memory. - */ -typedef void (*GDExtensionInterfaceMemFree)(void *p_ptr); - -/** - * @name mem_alloc2 - * @since 4.6 - * - * Allocates memory. - * - * @param p_bytes The amount of memory to allocate in bytes. - * @param p_pad_align If true, the returned memory will have prepadding of at least 8 bytes. - * - * @return A pointer to the allocated memory, or NULL if unsuccessful. - */ -typedef void *(*GDExtensionInterfaceMemAlloc2)(size_t p_bytes, GDExtensionBool p_pad_align); - -/** - * @name mem_realloc2 - * @since 4.6 - * - * Reallocates memory. - * - * @param p_ptr A pointer to the previously allocated memory. - * @param p_bytes The number of bytes to resize the memory block to. - * @param p_pad_align If true, the returned memory will have prepadding of at least 8 bytes. - * - * @return A pointer to the allocated memory, or NULL if unsuccessful. - */ -typedef void *(*GDExtensionInterfaceMemRealloc2)(void *p_ptr, size_t p_bytes, GDExtensionBool p_pad_align); - -/** - * @name mem_free2 - * @since 4.6 - * - * Frees memory. - * - * @param p_ptr A pointer to the previously allocated memory. - * @param p_pad_align If true, the given memory was allocated with prepadding. - */ -typedef void (*GDExtensionInterfaceMemFree2)(void *p_ptr, GDExtensionBool p_pad_align); - -//* INTERFACE: Godot Core */ - -/** - * @name print_error - * @since 4.1 - * - * Logs an error to Godot's built-in debugger and to the OS terminal. - * - * @param p_description The code triggering the error. - * @param p_function The function name where the error occurred. - * @param p_file The file where the error occurred. - * @param p_line The line where the error occurred. - * @param p_editor_notify Whether or not to notify the editor. - */ -typedef void (*GDExtensionInterfacePrintError)(const char *p_description, const char *p_function, const char *p_file, int32_t p_line, GDExtensionBool p_editor_notify); - -/** - * @name print_error_with_message - * @since 4.1 - * - * Logs an error with a message to Godot's built-in debugger and to the OS terminal. - * - * @param p_description The code triggering the error. - * @param p_message The message to show along with the error. - * @param p_function The function name where the error occurred. - * @param p_file The file where the error occurred. - * @param p_line The line where the error occurred. - * @param p_editor_notify Whether or not to notify the editor. - */ -typedef void (*GDExtensionInterfacePrintErrorWithMessage)(const char *p_description, const char *p_message, const char *p_function, const char *p_file, int32_t p_line, GDExtensionBool p_editor_notify); - -/** - * @name print_warning - * @since 4.1 - * - * Logs a warning to Godot's built-in debugger and to the OS terminal. - * - * @param p_description The code triggering the warning. - * @param p_function The function name where the warning occurred. - * @param p_file The file where the warning occurred. - * @param p_line The line where the warning occurred. - * @param p_editor_notify Whether or not to notify the editor. - */ -typedef void (*GDExtensionInterfacePrintWarning)(const char *p_description, const char *p_function, const char *p_file, int32_t p_line, GDExtensionBool p_editor_notify); - -/** - * @name print_warning_with_message - * @since 4.1 - * - * Logs a warning with a message to Godot's built-in debugger and to the OS terminal. - * - * @param p_description The code triggering the warning. - * @param p_message The message to show along with the warning. - * @param p_function The function name where the warning occurred. - * @param p_file The file where the warning occurred. - * @param p_line The line where the warning occurred. - * @param p_editor_notify Whether or not to notify the editor. - */ -typedef void (*GDExtensionInterfacePrintWarningWithMessage)(const char *p_description, const char *p_message, const char *p_function, const char *p_file, int32_t p_line, GDExtensionBool p_editor_notify); - -/** - * @name print_script_error - * @since 4.1 - * - * Logs a script error to Godot's built-in debugger and to the OS terminal. - * - * @param p_description The code triggering the error. - * @param p_function The function name where the error occurred. - * @param p_file The file where the error occurred. - * @param p_line The line where the error occurred. - * @param p_editor_notify Whether or not to notify the editor. - */ -typedef void (*GDExtensionInterfacePrintScriptError)(const char *p_description, const char *p_function, const char *p_file, int32_t p_line, GDExtensionBool p_editor_notify); - -/** - * @name print_script_error_with_message - * @since 4.1 - * - * Logs a script error with a message to Godot's built-in debugger and to the OS terminal. - * - * @param p_description The code triggering the error. - * @param p_message The message to show along with the error. - * @param p_function The function name where the error occurred. - * @param p_file The file where the error occurred. - * @param p_line The line where the error occurred. - * @param p_editor_notify Whether or not to notify the editor. - */ -typedef void (*GDExtensionInterfacePrintScriptErrorWithMessage)(const char *p_description, const char *p_message, const char *p_function, const char *p_file, int32_t p_line, GDExtensionBool p_editor_notify); - -/** - * @name get_native_struct_size - * @since 4.1 - * - * Gets the size of a native struct (ex. ObjectID) in bytes. - * - * @param p_name A pointer to a StringName identifying the struct name. - * - * @return The size in bytes. - */ -typedef uint64_t (*GDExtensionInterfaceGetNativeStructSize)(GDExtensionConstStringNamePtr p_name); - -/* INTERFACE: Variant */ - -/** - * @name variant_new_copy - * @since 4.1 - * - * Copies one Variant into a another. - * - * @param r_dest A pointer to the destination Variant. - * @param p_src A pointer to the source Variant. - */ -typedef void (*GDExtensionInterfaceVariantNewCopy)(GDExtensionUninitializedVariantPtr r_dest, GDExtensionConstVariantPtr p_src); - -/** - * @name variant_new_nil - * @since 4.1 - * - * Creates a new Variant containing nil. - * - * @param r_dest A pointer to the destination Variant. - */ -typedef void (*GDExtensionInterfaceVariantNewNil)(GDExtensionUninitializedVariantPtr r_dest); - -/** - * @name variant_destroy - * @since 4.1 - * - * Destroys a Variant. - * - * @param p_self A pointer to the Variant to destroy. - */ -typedef void (*GDExtensionInterfaceVariantDestroy)(GDExtensionVariantPtr p_self); - -/** - * @name variant_call - * @since 4.1 - * - * Calls a method on a Variant. - * - * @param p_self A pointer to the Variant. - * @param p_method A pointer to a StringName identifying the method. - * @param p_args A pointer to a C array of Variant. - * @param p_argument_count The number of arguments. - * @param r_return A pointer a Variant which will be assigned the return value. - * @param r_error A pointer the structure which will hold error information. - * - * @see Variant::callp() - */ -typedef void (*GDExtensionInterfaceVariantCall)(GDExtensionVariantPtr p_self, GDExtensionConstStringNamePtr p_method, const GDExtensionConstVariantPtr *p_args, GDExtensionInt p_argument_count, GDExtensionUninitializedVariantPtr r_return, GDExtensionCallError *r_error); - -/** - * @name variant_call_static - * @since 4.1 - * - * Calls a static method on a Variant. - * - * @param p_type The variant type. - * @param p_method A pointer to a StringName identifying the method. - * @param p_args A pointer to a C array of Variant. - * @param p_argument_count The number of arguments. - * @param r_return A pointer a Variant which will be assigned the return value. - * @param r_error A pointer the structure which will be updated with error information. - * - * @see Variant::call_static() - */ -typedef void (*GDExtensionInterfaceVariantCallStatic)(GDExtensionVariantType p_type, GDExtensionConstStringNamePtr p_method, const GDExtensionConstVariantPtr *p_args, GDExtensionInt p_argument_count, GDExtensionUninitializedVariantPtr r_return, GDExtensionCallError *r_error); - -/** - * @name variant_evaluate - * @since 4.1 - * - * Evaluate an operator on two Variants. - * - * @param p_op The operator to evaluate. - * @param p_a The first Variant. - * @param p_b The second Variant. - * @param r_return A pointer a Variant which will be assigned the return value. - * @param r_valid A pointer to a boolean which will be set to false if the operation is invalid. - * - * @see Variant::evaluate() - */ -typedef void (*GDExtensionInterfaceVariantEvaluate)(GDExtensionVariantOperator p_op, GDExtensionConstVariantPtr p_a, GDExtensionConstVariantPtr p_b, GDExtensionUninitializedVariantPtr r_return, GDExtensionBool *r_valid); - -/** - * @name variant_set - * @since 4.1 - * - * Sets a key on a Variant to a value. - * - * @param p_self A pointer to the Variant. - * @param p_key A pointer to a Variant representing the key. - * @param p_value A pointer to a Variant representing the value. - * @param r_valid A pointer to a boolean which will be set to false if the operation is invalid. - * - * @see Variant::set() - */ -typedef void (*GDExtensionInterfaceVariantSet)(GDExtensionVariantPtr p_self, GDExtensionConstVariantPtr p_key, GDExtensionConstVariantPtr p_value, GDExtensionBool *r_valid); - -/** - * @name variant_set_named - * @since 4.1 - * - * Sets a named key on a Variant to a value. - * - * @param p_self A pointer to the Variant. - * @param p_key A pointer to a StringName representing the key. - * @param p_value A pointer to a Variant representing the value. - * @param r_valid A pointer to a boolean which will be set to false if the operation is invalid. - * - * @see Variant::set_named() - */ -typedef void (*GDExtensionInterfaceVariantSetNamed)(GDExtensionVariantPtr p_self, GDExtensionConstStringNamePtr p_key, GDExtensionConstVariantPtr p_value, GDExtensionBool *r_valid); - -/** - * @name variant_set_keyed - * @since 4.1 - * - * Sets a keyed property on a Variant to a value. - * - * @param p_self A pointer to the Variant. - * @param p_key A pointer to a Variant representing the key. - * @param p_value A pointer to a Variant representing the value. - * @param r_valid A pointer to a boolean which will be set to false if the operation is invalid. - * - * @see Variant::set_keyed() - */ -typedef void (*GDExtensionInterfaceVariantSetKeyed)(GDExtensionVariantPtr p_self, GDExtensionConstVariantPtr p_key, GDExtensionConstVariantPtr p_value, GDExtensionBool *r_valid); - -/** - * @name variant_set_indexed - * @since 4.1 - * - * Sets an index on a Variant to a value. - * - * @param p_self A pointer to the Variant. - * @param p_index The index. - * @param p_value A pointer to a Variant representing the value. - * @param r_valid A pointer to a boolean which will be set to false if the operation is invalid. - * @param r_oob A pointer to a boolean which will be set to true if the index is out of bounds. - */ -typedef void (*GDExtensionInterfaceVariantSetIndexed)(GDExtensionVariantPtr p_self, GDExtensionInt p_index, GDExtensionConstVariantPtr p_value, GDExtensionBool *r_valid, GDExtensionBool *r_oob); - -/** - * @name variant_get - * @since 4.1 - * - * Gets the value of a key from a Variant. - * - * @param p_self A pointer to the Variant. - * @param p_key A pointer to a Variant representing the key. - * @param r_ret A pointer to a Variant which will be assigned the value. - * @param r_valid A pointer to a boolean which will be set to false if the operation is invalid. - */ -typedef void (*GDExtensionInterfaceVariantGet)(GDExtensionConstVariantPtr p_self, GDExtensionConstVariantPtr p_key, GDExtensionUninitializedVariantPtr r_ret, GDExtensionBool *r_valid); - -/** - * @name variant_get_named - * @since 4.1 - * - * Gets the value of a named key from a Variant. - * - * @param p_self A pointer to the Variant. - * @param p_key A pointer to a StringName representing the key. - * @param r_ret A pointer to a Variant which will be assigned the value. - * @param r_valid A pointer to a boolean which will be set to false if the operation is invalid. - */ -typedef void (*GDExtensionInterfaceVariantGetNamed)(GDExtensionConstVariantPtr p_self, GDExtensionConstStringNamePtr p_key, GDExtensionUninitializedVariantPtr r_ret, GDExtensionBool *r_valid); - -/** - * @name variant_get_keyed - * @since 4.1 - * - * Gets the value of a keyed property from a Variant. - * - * @param p_self A pointer to the Variant. - * @param p_key A pointer to a Variant representing the key. - * @param r_ret A pointer to a Variant which will be assigned the value. - * @param r_valid A pointer to a boolean which will be set to false if the operation is invalid. - */ -typedef void (*GDExtensionInterfaceVariantGetKeyed)(GDExtensionConstVariantPtr p_self, GDExtensionConstVariantPtr p_key, GDExtensionUninitializedVariantPtr r_ret, GDExtensionBool *r_valid); - -/** - * @name variant_get_indexed - * @since 4.1 - * - * Gets the value of an index from a Variant. - * - * @param p_self A pointer to the Variant. - * @param p_index The index. - * @param r_ret A pointer to a Variant which will be assigned the value. - * @param r_valid A pointer to a boolean which will be set to false if the operation is invalid. - * @param r_oob A pointer to a boolean which will be set to true if the index is out of bounds. - */ -typedef void (*GDExtensionInterfaceVariantGetIndexed)(GDExtensionConstVariantPtr p_self, GDExtensionInt p_index, GDExtensionUninitializedVariantPtr r_ret, GDExtensionBool *r_valid, GDExtensionBool *r_oob); - -/** - * @name variant_iter_init - * @since 4.1 - * - * Initializes an iterator over a Variant. - * - * @param p_self A pointer to the Variant. - * @param r_iter A pointer to a Variant which will be assigned the iterator. - * @param r_valid A pointer to a boolean which will be set to false if the operation is invalid. - * - * @return true if the operation is valid; otherwise false. - * - * @see Variant::iter_init() - */ -typedef GDExtensionBool (*GDExtensionInterfaceVariantIterInit)(GDExtensionConstVariantPtr p_self, GDExtensionUninitializedVariantPtr r_iter, GDExtensionBool *r_valid); - -/** - * @name variant_iter_next - * @since 4.1 - * - * Gets the next value for an iterator over a Variant. - * - * @param p_self A pointer to the Variant. - * @param r_iter A pointer to a Variant which will be assigned the iterator. - * @param r_valid A pointer to a boolean which will be set to false if the operation is invalid. - * - * @return true if the operation is valid; otherwise false. - * - * @see Variant::iter_next() - */ -typedef GDExtensionBool (*GDExtensionInterfaceVariantIterNext)(GDExtensionConstVariantPtr p_self, GDExtensionVariantPtr r_iter, GDExtensionBool *r_valid); - -/** - * @name variant_iter_get - * @since 4.1 - * - * Gets the next value for an iterator over a Variant. - * - * @param p_self A pointer to the Variant. - * @param r_iter A pointer to a Variant which will be assigned the iterator. - * @param r_ret A pointer to a Variant which will be assigned false if the operation is invalid. - * @param r_valid A pointer to a boolean which will be set to false if the operation is invalid. - * - * @see Variant::iter_get() - */ -typedef void (*GDExtensionInterfaceVariantIterGet)(GDExtensionConstVariantPtr p_self, GDExtensionVariantPtr r_iter, GDExtensionUninitializedVariantPtr r_ret, GDExtensionBool *r_valid); - -/** - * @name variant_hash - * @since 4.1 - * - * Gets the hash of a Variant. - * - * @param p_self A pointer to the Variant. - * - * @return The hash value. - * - * @see Variant::hash() - */ -typedef GDExtensionInt (*GDExtensionInterfaceVariantHash)(GDExtensionConstVariantPtr p_self); - -/** - * @name variant_recursive_hash - * @since 4.1 - * - * Gets the recursive hash of a Variant. - * - * @param p_self A pointer to the Variant. - * @param p_recursion_count The number of recursive loops so far. - * - * @return The hash value. - * - * @see Variant::recursive_hash() - */ -typedef GDExtensionInt (*GDExtensionInterfaceVariantRecursiveHash)(GDExtensionConstVariantPtr p_self, GDExtensionInt p_recursion_count); - -/** - * @name variant_hash_compare - * @since 4.1 - * - * Compares two Variants by their hash. - * - * @param p_self A pointer to the Variant. - * @param p_other A pointer to the other Variant to compare it to. - * - * @return The hash value. - * - * @see Variant::hash_compare() - */ -typedef GDExtensionBool (*GDExtensionInterfaceVariantHashCompare)(GDExtensionConstVariantPtr p_self, GDExtensionConstVariantPtr p_other); - -/** - * @name variant_booleanize - * @since 4.1 - * - * Converts a Variant to a boolean. - * - * @param p_self A pointer to the Variant. - * - * @return The boolean value of the Variant. - */ -typedef GDExtensionBool (*GDExtensionInterfaceVariantBooleanize)(GDExtensionConstVariantPtr p_self); - -/** - * @name variant_duplicate - * @since 4.1 - * - * Duplicates a Variant. - * - * @param p_self A pointer to the Variant. - * @param r_ret A pointer to a Variant to store the duplicated value. - * @param p_deep Whether or not to duplicate deeply (when supported by the Variant type). - */ -typedef void (*GDExtensionInterfaceVariantDuplicate)(GDExtensionConstVariantPtr p_self, GDExtensionVariantPtr r_ret, GDExtensionBool p_deep); - -/** - * @name variant_stringify - * @since 4.1 - * - * Converts a Variant to a string. - * - * @param p_self A pointer to the Variant. - * @param r_ret A pointer to a String to store the resulting value. - */ -typedef void (*GDExtensionInterfaceVariantStringify)(GDExtensionConstVariantPtr p_self, GDExtensionStringPtr r_ret); - -/** - * @name variant_get_type - * @since 4.1 - * - * Gets the type of a Variant. - * - * @param p_self A pointer to the Variant. - * - * @return The variant type. - */ -typedef GDExtensionVariantType (*GDExtensionInterfaceVariantGetType)(GDExtensionConstVariantPtr p_self); - -/** - * @name variant_has_method - * @since 4.1 - * - * Checks if a Variant has the given method. - * - * @param p_self A pointer to the Variant. - * @param p_method A pointer to a StringName with the method name. - * - * @return true if the variant has the given method; otherwise false. - */ -typedef GDExtensionBool (*GDExtensionInterfaceVariantHasMethod)(GDExtensionConstVariantPtr p_self, GDExtensionConstStringNamePtr p_method); - -/** - * @name variant_has_member - * @since 4.1 - * - * Checks if a type of Variant has the given member. - * - * @param p_type The Variant type. - * @param p_member A pointer to a StringName with the member name. - * - * @return true if the variant has the given method; otherwise false. - */ -typedef GDExtensionBool (*GDExtensionInterfaceVariantHasMember)(GDExtensionVariantType p_type, GDExtensionConstStringNamePtr p_member); - -/** - * @name variant_has_key - * @since 4.1 - * - * Checks if a Variant has a key. - * - * @param p_self A pointer to the Variant. - * @param p_key A pointer to a Variant representing the key. - * @param r_valid A pointer to a boolean which will be set to false if the key doesn't exist. - * - * @return true if the key exists; otherwise false. - */ -typedef GDExtensionBool (*GDExtensionInterfaceVariantHasKey)(GDExtensionConstVariantPtr p_self, GDExtensionConstVariantPtr p_key, GDExtensionBool *r_valid); - -/** - * @name variant_get_object_instance_id - * @since 4.4 - * - * Gets the object instance ID from a variant of type GDEXTENSION_VARIANT_TYPE_OBJECT. - * - * If the variant isn't of type GDEXTENSION_VARIANT_TYPE_OBJECT, then zero will be returned. - * The instance ID will be returned even if the object is no longer valid - use `object_get_instance_by_id()` to check if the object is still valid. - * - * @param p_self A pointer to the Variant. - * - * @return The instance ID for the contained object. - */ -typedef GDObjectInstanceID (*GDExtensionInterfaceVariantGetObjectInstanceId)(GDExtensionConstVariantPtr p_self); - -/** - * @name variant_get_type_name - * @since 4.1 - * - * Gets the name of a Variant type. - * - * @param p_type The Variant type. - * @param r_name A pointer to a String to store the Variant type name. - */ -typedef void (*GDExtensionInterfaceVariantGetTypeName)(GDExtensionVariantType p_type, GDExtensionUninitializedStringPtr r_name); - -/** - * @name variant_can_convert - * @since 4.1 - * - * Checks if Variants can be converted from one type to another. - * - * @param p_from The Variant type to convert from. - * @param p_to The Variant type to convert to. - * - * @return true if the conversion is possible; otherwise false. - */ -typedef GDExtensionBool (*GDExtensionInterfaceVariantCanConvert)(GDExtensionVariantType p_from, GDExtensionVariantType p_to); - -/** - * @name variant_can_convert_strict - * @since 4.1 - * - * Checks if Variant can be converted from one type to another using stricter rules. - * - * @param p_from The Variant type to convert from. - * @param p_to The Variant type to convert to. - * - * @return true if the conversion is possible; otherwise false. - */ -typedef GDExtensionBool (*GDExtensionInterfaceVariantCanConvertStrict)(GDExtensionVariantType p_from, GDExtensionVariantType p_to); - -/** - * @name get_variant_from_type_constructor - * @since 4.1 - * - * Gets a pointer to a function that can create a Variant of the given type from a raw value. - * - * @param p_type The Variant type. - * - * @return A pointer to a function that can create a Variant of the given type from a raw value. - */ -typedef GDExtensionVariantFromTypeConstructorFunc (*GDExtensionInterfaceGetVariantFromTypeConstructor)(GDExtensionVariantType p_type); - -/** - * @name get_variant_to_type_constructor - * @since 4.1 - * - * Gets a pointer to a function that can get the raw value from a Variant of the given type. - * - * @param p_type The Variant type. - * - * @return A pointer to a function that can get the raw value from a Variant of the given type. - */ -typedef GDExtensionTypeFromVariantConstructorFunc (*GDExtensionInterfaceGetVariantToTypeConstructor)(GDExtensionVariantType p_type); - -/** - * @name variant_get_ptr_internal_getter - * @since 4.4 - * - * Provides a function pointer for retrieving a pointer to a variant's internal value. - * Access to a variant's internal value can be used to modify it in-place, or to retrieve its value without the overhead of variant conversion functions. - * It is recommended to cache the getter for all variant types in a function table to avoid retrieval overhead upon use. - * - * @note Each function assumes the variant's type has already been determined and matches the function. - * Invoking the function with a variant of a mismatched type has undefined behavior, and may lead to a segmentation fault. - * - * @param p_type The Variant type. - * - * @return A pointer to a type-specific function that returns a pointer to the internal value of a variant. Check the implementation of this function (gdextension_variant_get_ptr_internal_getter) for pointee type info of each variant type. - */ -typedef GDExtensionVariantGetInternalPtrFunc (*GDExtensionInterfaceGetVariantGetInternalPtrFunc)(GDExtensionVariantType p_type); - -/** - * @name variant_get_ptr_operator_evaluator - * @since 4.1 - * - * Gets a pointer to a function that can evaluate the given Variant operator on the given Variant types. - * - * @param p_operator The variant operator. - * @param p_type_a The type of the first Variant. - * @param p_type_b The type of the second Variant. - * - * @return A pointer to a function that can evaluate the given Variant operator on the given Variant types. - */ -typedef GDExtensionPtrOperatorEvaluator (*GDExtensionInterfaceVariantGetPtrOperatorEvaluator)(GDExtensionVariantOperator p_operator, GDExtensionVariantType p_type_a, GDExtensionVariantType p_type_b); - -/** - * @name variant_get_ptr_builtin_method - * @since 4.1 - * - * Gets a pointer to a function that can call a builtin method on a type of Variant. - * - * @param p_type The Variant type. - * @param p_method A pointer to a StringName with the method name. - * @param p_hash A hash representing the method signature. - * - * @return A pointer to a function that can call a builtin method on a type of Variant. - */ -typedef GDExtensionPtrBuiltInMethod (*GDExtensionInterfaceVariantGetPtrBuiltinMethod)(GDExtensionVariantType p_type, GDExtensionConstStringNamePtr p_method, GDExtensionInt p_hash); - -/** - * @name variant_get_ptr_constructor - * @since 4.1 - * - * Gets a pointer to a function that can call one of the constructors for a type of Variant. - * - * @param p_type The Variant type. - * @param p_constructor The index of the constructor. - * - * @return A pointer to a function that can call one of the constructors for a type of Variant. - */ -typedef GDExtensionPtrConstructor (*GDExtensionInterfaceVariantGetPtrConstructor)(GDExtensionVariantType p_type, int32_t p_constructor); - -/** - * @name variant_get_ptr_destructor - * @since 4.1 - * - * Gets a pointer to a function than can call the destructor for a type of Variant. - * - * @param p_type The Variant type. - * - * @return A pointer to a function than can call the destructor for a type of Variant. - */ -typedef GDExtensionPtrDestructor (*GDExtensionInterfaceVariantGetPtrDestructor)(GDExtensionVariantType p_type); - -/** - * @name variant_construct - * @since 4.1 - * - * Constructs a Variant of the given type, using the first constructor that matches the given arguments. - * - * @param p_type The Variant type. - * @param r_base A pointer to a Variant to store the constructed value. - * @param p_args A pointer to a C array of Variant pointers representing the arguments for the constructor. - * @param p_argument_count The number of arguments to pass to the constructor. - * @param r_error A pointer the structure which will be updated with error information. - */ -typedef void (*GDExtensionInterfaceVariantConstruct)(GDExtensionVariantType p_type, GDExtensionUninitializedVariantPtr r_base, const GDExtensionConstVariantPtr *p_args, int32_t p_argument_count, GDExtensionCallError *r_error); - -/** - * @name variant_get_ptr_setter - * @since 4.1 - * - * Gets a pointer to a function that can call a member's setter on the given Variant type. - * - * @param p_type The Variant type. - * @param p_member A pointer to a StringName with the member name. - * - * @return A pointer to a function that can call a member's setter on the given Variant type. - */ -typedef GDExtensionPtrSetter (*GDExtensionInterfaceVariantGetPtrSetter)(GDExtensionVariantType p_type, GDExtensionConstStringNamePtr p_member); - -/** - * @name variant_get_ptr_getter - * @since 4.1 - * - * Gets a pointer to a function that can call a member's getter on the given Variant type. - * - * @param p_type The Variant type. - * @param p_member A pointer to a StringName with the member name. - * - * @return A pointer to a function that can call a member's getter on the given Variant type. - */ -typedef GDExtensionPtrGetter (*GDExtensionInterfaceVariantGetPtrGetter)(GDExtensionVariantType p_type, GDExtensionConstStringNamePtr p_member); - -/** - * @name variant_get_ptr_indexed_setter - * @since 4.1 - * - * Gets a pointer to a function that can set an index on the given Variant type. - * - * @param p_type The Variant type. - * - * @return A pointer to a function that can set an index on the given Variant type. - */ -typedef GDExtensionPtrIndexedSetter (*GDExtensionInterfaceVariantGetPtrIndexedSetter)(GDExtensionVariantType p_type); - -/** - * @name variant_get_ptr_indexed_getter - * @since 4.1 - * - * Gets a pointer to a function that can get an index on the given Variant type. - * - * @param p_type The Variant type. - * - * @return A pointer to a function that can get an index on the given Variant type. - */ -typedef GDExtensionPtrIndexedGetter (*GDExtensionInterfaceVariantGetPtrIndexedGetter)(GDExtensionVariantType p_type); - -/** - * @name variant_get_ptr_keyed_setter - * @since 4.1 - * - * Gets a pointer to a function that can set a key on the given Variant type. - * - * @param p_type The Variant type. - * - * @return A pointer to a function that can set a key on the given Variant type. - */ -typedef GDExtensionPtrKeyedSetter (*GDExtensionInterfaceVariantGetPtrKeyedSetter)(GDExtensionVariantType p_type); - -/** - * @name variant_get_ptr_keyed_getter - * @since 4.1 - * - * Gets a pointer to a function that can get a key on the given Variant type. - * - * @param p_type The Variant type. - * - * @return A pointer to a function that can get a key on the given Variant type. - */ -typedef GDExtensionPtrKeyedGetter (*GDExtensionInterfaceVariantGetPtrKeyedGetter)(GDExtensionVariantType p_type); - -/** - * @name variant_get_ptr_keyed_checker - * @since 4.1 - * - * Gets a pointer to a function that can check a key on the given Variant type. - * - * @param p_type The Variant type. - * - * @return A pointer to a function that can check a key on the given Variant type. - */ -typedef GDExtensionPtrKeyedChecker (*GDExtensionInterfaceVariantGetPtrKeyedChecker)(GDExtensionVariantType p_type); - -/** - * @name variant_get_constant_value - * @since 4.1 - * - * Gets the value of a constant from the given Variant type. - * - * @param p_type The Variant type. - * @param p_constant A pointer to a StringName with the constant name. - * @param r_ret A pointer to a Variant to store the value. - */ -typedef void (*GDExtensionInterfaceVariantGetConstantValue)(GDExtensionVariantType p_type, GDExtensionConstStringNamePtr p_constant, GDExtensionUninitializedVariantPtr r_ret); - -/** - * @name variant_get_ptr_utility_function - * @since 4.1 - * - * Gets a pointer to a function that can call a Variant utility function. - * - * @param p_function A pointer to a StringName with the function name. - * @param p_hash A hash representing the function signature. - * - * @return A pointer to a function that can call a Variant utility function. - */ -typedef GDExtensionPtrUtilityFunction (*GDExtensionInterfaceVariantGetPtrUtilityFunction)(GDExtensionConstStringNamePtr p_function, GDExtensionInt p_hash); - -/* INTERFACE: String Utilities */ - -/** - * @name string_new_with_latin1_chars - * @since 4.1 - * - * Creates a String from a Latin-1 encoded C string. - * - * @param r_dest A pointer to a Variant to hold the newly created String. - * @param p_contents A pointer to a Latin-1 encoded C string (null terminated). - */ -typedef void (*GDExtensionInterfaceStringNewWithLatin1Chars)(GDExtensionUninitializedStringPtr r_dest, const char *p_contents); - -/** - * @name string_new_with_utf8_chars - * @since 4.1 - * - * Creates a String from a UTF-8 encoded C string. - * - * @param r_dest A pointer to a Variant to hold the newly created String. - * @param p_contents A pointer to a UTF-8 encoded C string (null terminated). - */ -typedef void (*GDExtensionInterfaceStringNewWithUtf8Chars)(GDExtensionUninitializedStringPtr r_dest, const char *p_contents); - -/** - * @name string_new_with_utf16_chars - * @since 4.1 - * - * Creates a String from a UTF-16 encoded C string. - * - * @param r_dest A pointer to a Variant to hold the newly created String. - * @param p_contents A pointer to a UTF-16 encoded C string (null terminated). - */ -typedef void (*GDExtensionInterfaceStringNewWithUtf16Chars)(GDExtensionUninitializedStringPtr r_dest, const char16_t *p_contents); - -/** - * @name string_new_with_utf32_chars - * @since 4.1 - * - * Creates a String from a UTF-32 encoded C string. - * - * @param r_dest A pointer to a Variant to hold the newly created String. - * @param p_contents A pointer to a UTF-32 encoded C string (null terminated). - */ -typedef void (*GDExtensionInterfaceStringNewWithUtf32Chars)(GDExtensionUninitializedStringPtr r_dest, const char32_t *p_contents); - -/** - * @name string_new_with_wide_chars - * @since 4.1 - * - * Creates a String from a wide C string. - * - * @param r_dest A pointer to a Variant to hold the newly created String. - * @param p_contents A pointer to a wide C string (null terminated). - */ -typedef void (*GDExtensionInterfaceStringNewWithWideChars)(GDExtensionUninitializedStringPtr r_dest, const wchar_t *p_contents); - -/** - * @name string_new_with_latin1_chars_and_len - * @since 4.1 - * - * Creates a String from a Latin-1 encoded C string with the given length. - * - * @param r_dest A pointer to a Variant to hold the newly created String. - * @param p_contents A pointer to a Latin-1 encoded C string. - * @param p_size The number of characters (= number of bytes). - */ -typedef void (*GDExtensionInterfaceStringNewWithLatin1CharsAndLen)(GDExtensionUninitializedStringPtr r_dest, const char *p_contents, GDExtensionInt p_size); - -/** - * @name string_new_with_utf8_chars_and_len - * @since 4.1 - * @deprecated in Godot 4.3. Use `string_new_with_utf8_chars_and_len2` instead. - * - * Creates a String from a UTF-8 encoded C string with the given length. - * - * @param r_dest A pointer to a Variant to hold the newly created String. - * @param p_contents A pointer to a UTF-8 encoded C string. - * @param p_size The number of bytes (not code units). - */ -typedef void (*GDExtensionInterfaceStringNewWithUtf8CharsAndLen)(GDExtensionUninitializedStringPtr r_dest, const char *p_contents, GDExtensionInt p_size); - -/** - * @name string_new_with_utf8_chars_and_len2 - * @since 4.3 - * - * Creates a String from a UTF-8 encoded C string with the given length. - * - * @param r_dest A pointer to a Variant to hold the newly created String. - * @param p_contents A pointer to a UTF-8 encoded C string. - * @param p_size The number of bytes (not code units). - * - * @return Error code signifying if the operation successful. - */ -typedef GDExtensionInt (*GDExtensionInterfaceStringNewWithUtf8CharsAndLen2)(GDExtensionUninitializedStringPtr r_dest, const char *p_contents, GDExtensionInt p_size); - -/** - * @name string_new_with_utf16_chars_and_len - * @since 4.1 - * @deprecated in Godot 4.3. Use `string_new_with_utf16_chars_and_len2` instead. - * - * Creates a String from a UTF-16 encoded C string with the given length. - * - * @param r_dest A pointer to a Variant to hold the newly created String. - * @param p_contents A pointer to a UTF-16 encoded C string. - * @param p_char_count The number of characters (not bytes). - */ -typedef void (*GDExtensionInterfaceStringNewWithUtf16CharsAndLen)(GDExtensionUninitializedStringPtr r_dest, const char16_t *p_contents, GDExtensionInt p_char_count); - -/** - * @name string_new_with_utf16_chars_and_len2 - * @since 4.3 - * - * Creates a String from a UTF-16 encoded C string with the given length. - * - * @param r_dest A pointer to a Variant to hold the newly created String. - * @param p_contents A pointer to a UTF-16 encoded C string. - * @param p_char_count The number of characters (not bytes). - * @param p_default_little_endian If true, UTF-16 use little endian. - * - * @return Error code signifying if the operation successful. - */ -typedef GDExtensionInt (*GDExtensionInterfaceStringNewWithUtf16CharsAndLen2)(GDExtensionUninitializedStringPtr r_dest, const char16_t *p_contents, GDExtensionInt p_char_count, GDExtensionBool p_default_little_endian); - -/** - * @name string_new_with_utf32_chars_and_len - * @since 4.1 - * - * Creates a String from a UTF-32 encoded C string with the given length. - * - * @param r_dest A pointer to a Variant to hold the newly created String. - * @param p_contents A pointer to a UTF-32 encoded C string. - * @param p_char_count The number of characters (not bytes). - */ -typedef void (*GDExtensionInterfaceStringNewWithUtf32CharsAndLen)(GDExtensionUninitializedStringPtr r_dest, const char32_t *p_contents, GDExtensionInt p_char_count); - -/** - * @name string_new_with_wide_chars_and_len - * @since 4.1 - * - * Creates a String from a wide C string with the given length. - * - * @param r_dest A pointer to a Variant to hold the newly created String. - * @param p_contents A pointer to a wide C string. - * @param p_char_count The number of characters (not bytes). - */ -typedef void (*GDExtensionInterfaceStringNewWithWideCharsAndLen)(GDExtensionUninitializedStringPtr r_dest, const wchar_t *p_contents, GDExtensionInt p_char_count); - -/** - * @name string_to_latin1_chars - * @since 4.1 - * - * Converts a String to a Latin-1 encoded C string. - * - * It doesn't write a null terminator. - * - * @param p_self A pointer to the String. - * @param r_text A pointer to the buffer to hold the resulting data. If NULL is passed in, only the length will be computed. - * @param p_max_write_length The maximum number of characters that can be written to r_text. It has no affect on the return value. - * - * @return The resulting encoded string length in characters (not bytes), not including a null terminator. - */ -typedef GDExtensionInt (*GDExtensionInterfaceStringToLatin1Chars)(GDExtensionConstStringPtr p_self, char *r_text, GDExtensionInt p_max_write_length); - -/** - * @name string_to_utf8_chars - * @since 4.1 - * - * Converts a String to a UTF-8 encoded C string. - * - * It doesn't write a null terminator. - * - * @param p_self A pointer to the String. - * @param r_text A pointer to the buffer to hold the resulting data. If NULL is passed in, only the length will be computed. - * @param p_max_write_length The maximum number of characters that can be written to r_text. It has no affect on the return value. - * - * @return The resulting encoded string length in characters (not bytes), not including a null terminator. - */ -typedef GDExtensionInt (*GDExtensionInterfaceStringToUtf8Chars)(GDExtensionConstStringPtr p_self, char *r_text, GDExtensionInt p_max_write_length); - -/** - * @name string_to_utf16_chars - * @since 4.1 - * - * Converts a String to a UTF-16 encoded C string. - * - * It doesn't write a null terminator. - * - * @param p_self A pointer to the String. - * @param r_text A pointer to the buffer to hold the resulting data. If NULL is passed in, only the length will be computed. - * @param p_max_write_length The maximum number of characters that can be written to r_text. It has no affect on the return value. - * - * @return The resulting encoded string length in characters (not bytes), not including a null terminator. - */ -typedef GDExtensionInt (*GDExtensionInterfaceStringToUtf16Chars)(GDExtensionConstStringPtr p_self, char16_t *r_text, GDExtensionInt p_max_write_length); - -/** - * @name string_to_utf32_chars - * @since 4.1 - * - * Converts a String to a UTF-32 encoded C string. - * - * It doesn't write a null terminator. - * - * @param p_self A pointer to the String. - * @param r_text A pointer to the buffer to hold the resulting data. If NULL is passed in, only the length will be computed. - * @param p_max_write_length The maximum number of characters that can be written to r_text. It has no affect on the return value. - * - * @return The resulting encoded string length in characters (not bytes), not including a null terminator. - */ -typedef GDExtensionInt (*GDExtensionInterfaceStringToUtf32Chars)(GDExtensionConstStringPtr p_self, char32_t *r_text, GDExtensionInt p_max_write_length); - -/** - * @name string_to_wide_chars - * @since 4.1 - * - * Converts a String to a wide C string. - * - * It doesn't write a null terminator. - * - * @param p_self A pointer to the String. - * @param r_text A pointer to the buffer to hold the resulting data. If NULL is passed in, only the length will be computed. - * @param p_max_write_length The maximum number of characters that can be written to r_text. It has no affect on the return value. - * - * @return The resulting encoded string length in characters (not bytes), not including a null terminator. - */ -typedef GDExtensionInt (*GDExtensionInterfaceStringToWideChars)(GDExtensionConstStringPtr p_self, wchar_t *r_text, GDExtensionInt p_max_write_length); - -/** - * @name string_operator_index - * @since 4.1 - * - * Gets a pointer to the character at the given index from a String. - * - * @param p_self A pointer to the String. - * @param p_index The index. - * - * @return A pointer to the requested character. - */ -typedef char32_t *(*GDExtensionInterfaceStringOperatorIndex)(GDExtensionStringPtr p_self, GDExtensionInt p_index); - -/** - * @name string_operator_index_const - * @since 4.1 - * - * Gets a const pointer to the character at the given index from a String. - * - * @param p_self A pointer to the String. - * @param p_index The index. - * - * @return A const pointer to the requested character. - */ -typedef const char32_t *(*GDExtensionInterfaceStringOperatorIndexConst)(GDExtensionConstStringPtr p_self, GDExtensionInt p_index); - -/** - * @name string_operator_plus_eq_string - * @since 4.1 - * - * Appends another String to a String. - * - * @param p_self A pointer to the String. - * @param p_b A pointer to the other String to append. - */ -typedef void (*GDExtensionInterfaceStringOperatorPlusEqString)(GDExtensionStringPtr p_self, GDExtensionConstStringPtr p_b); - -/** - * @name string_operator_plus_eq_char - * @since 4.1 - * - * Appends a character to a String. - * - * @param p_self A pointer to the String. - * @param p_b A pointer to the character to append. - */ -typedef void (*GDExtensionInterfaceStringOperatorPlusEqChar)(GDExtensionStringPtr p_self, char32_t p_b); - -/** - * @name string_operator_plus_eq_cstr - * @since 4.1 - * - * Appends a Latin-1 encoded C string to a String. - * - * @param p_self A pointer to the String. - * @param p_b A pointer to a Latin-1 encoded C string (null terminated). - */ -typedef void (*GDExtensionInterfaceStringOperatorPlusEqCstr)(GDExtensionStringPtr p_self, const char *p_b); - -/** - * @name string_operator_plus_eq_wcstr - * @since 4.1 - * - * Appends a wide C string to a String. - * - * @param p_self A pointer to the String. - * @param p_b A pointer to a wide C string (null terminated). - */ -typedef void (*GDExtensionInterfaceStringOperatorPlusEqWcstr)(GDExtensionStringPtr p_self, const wchar_t *p_b); - -/** - * @name string_operator_plus_eq_c32str - * @since 4.1 - * - * Appends a UTF-32 encoded C string to a String. - * - * @param p_self A pointer to the String. - * @param p_b A pointer to a UTF-32 encoded C string (null terminated). - */ -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: StringName Utilities */ - -/** - * @name string_name_new_with_latin1_chars - * @since 4.2 - * - * Creates a StringName from a Latin-1 encoded C string. - * - * If `p_is_static` is true, then: - * - The StringName will reuse the `p_contents` buffer instead of copying it. - * You must guarantee that the buffer remains valid for the duration of the application (e.g. string literal). - * - You must not call a destructor for this StringName. Incrementing the initial reference once should achieve this. - * - * `p_is_static` is purely an optimization and can easily introduce undefined behavior if used wrong. In case of doubt, set it to false. - * - * @param r_dest A pointer to uninitialized storage, into which the newly created StringName is constructed. - * @param p_contents A pointer to a C string (null terminated and Latin-1 or ASCII encoded). - * @param p_is_static Whether the StringName reuses the buffer directly (see above). - */ -typedef void (*GDExtensionInterfaceStringNameNewWithLatin1Chars)(GDExtensionUninitializedStringNamePtr r_dest, const char *p_contents, GDExtensionBool p_is_static); - -/** - * @name string_name_new_with_utf8_chars - * @since 4.2 - * - * Creates a StringName from a UTF-8 encoded C string. - * - * @param r_dest A pointer to uninitialized storage, into which the newly created StringName is constructed. - * @param p_contents A pointer to a C string (null terminated and UTF-8 encoded). - */ -typedef void (*GDExtensionInterfaceStringNameNewWithUtf8Chars)(GDExtensionUninitializedStringNamePtr r_dest, const char *p_contents); - -/** - * @name string_name_new_with_utf8_chars_and_len - * @since 4.2 - * - * Creates a StringName from a UTF-8 encoded string with a given number of characters. - * - * @param r_dest A pointer to uninitialized storage, into which the newly created StringName is constructed. - * @param p_contents A pointer to a C string (null terminated and UTF-8 encoded). - * @param p_size The number of bytes (not UTF-8 code points). - */ -typedef void (*GDExtensionInterfaceStringNameNewWithUtf8CharsAndLen)(GDExtensionUninitializedStringNamePtr r_dest, const char *p_contents, GDExtensionInt p_size); - -/* INTERFACE: XMLParser Utilities */ - -/** - * @name xml_parser_open_buffer - * @since 4.1 - * - * Opens a raw XML buffer on an XMLParser instance. - * - * @param p_instance A pointer to an XMLParser object. - * @param p_buffer A pointer to the buffer. - * @param p_size The size of the buffer. - * - * @return A Godot error code (ex. OK, ERR_INVALID_DATA, etc). - * - * @see XMLParser::open_buffer() - */ -typedef GDExtensionInt (*GDExtensionInterfaceXmlParserOpenBuffer)(GDExtensionObjectPtr p_instance, const uint8_t *p_buffer, size_t p_size); - -/* INTERFACE: FileAccess Utilities */ - -/** - * @name file_access_store_buffer - * @since 4.1 - * - * Stores the given buffer using an instance of FileAccess. - * - * @param p_instance A pointer to a FileAccess object. - * @param p_src A pointer to the buffer. - * @param p_length The size of the buffer. - * - * @see FileAccess::store_buffer() - */ -typedef void (*GDExtensionInterfaceFileAccessStoreBuffer)(GDExtensionObjectPtr p_instance, const uint8_t *p_src, uint64_t p_length); - -/** - * @name file_access_get_buffer - * @since 4.1 - * - * Reads the next p_length bytes into the given buffer using an instance of FileAccess. - * - * @param p_instance A pointer to a FileAccess object. - * @param p_dst A pointer to the buffer to store the data. - * @param p_length The requested number of bytes to read. - * - * @return The actual number of bytes read (may be less than requested). - */ -typedef uint64_t (*GDExtensionInterfaceFileAccessGetBuffer)(GDExtensionConstObjectPtr p_instance, uint8_t *p_dst, uint64_t p_length); - -/* INTERFACE: Image Utilities */ - -/** - * @name image_ptrw - * @since 4.3 - * - * Returns writable pointer to internal Image buffer. - * - * @param p_instance A pointer to a Image object. - * - * @return Pointer to internal Image buffer. - * - * @see Image::ptrw() - */ -typedef uint8_t *(*GDExtensionInterfaceImagePtrw)(GDExtensionObjectPtr p_instance); - -/** - * @name image_ptr - * @since 4.3 - * - * Returns read only pointer to internal Image buffer. - * - * @param p_instance A pointer to a Image object. - * - * @return Pointer to internal Image buffer. - * - * @see Image::ptr() - */ -typedef const uint8_t *(*GDExtensionInterfaceImagePtr)(GDExtensionObjectPtr p_instance); - -/* INTERFACE: WorkerThreadPool Utilities */ - -/** - * @name worker_thread_pool_add_native_group_task - * @since 4.1 - * - * Adds a group task to an instance of WorkerThreadPool. - * - * @param p_instance A pointer to a WorkerThreadPool object. - * @param p_func A pointer to a function to run in the thread pool. - * @param p_userdata A pointer to arbitrary data which will be passed to p_func. - * @param p_elements The number of element needed in the group. - * @param p_tasks The number of tasks needed in the group. - * @param p_high_priority Whether or not this is a high priority task. - * @param p_description A pointer to a String with the task description. - * - * @return The task group ID. - * - * @see WorkerThreadPool::add_group_task() - */ -typedef int64_t (*GDExtensionInterfaceWorkerThreadPoolAddNativeGroupTask)(GDExtensionObjectPtr p_instance, GDExtensionWorkerThreadPoolGroupTask p_func, void *p_userdata, int p_elements, int p_tasks, GDExtensionBool p_high_priority, GDExtensionConstStringPtr p_description); - -/** - * @name worker_thread_pool_add_native_task - * @since 4.1 - * - * Adds a task to an instance of WorkerThreadPool. - * - * @param p_instance A pointer to a WorkerThreadPool object. - * @param p_func A pointer to a function to run in the thread pool. - * @param p_userdata A pointer to arbitrary data which will be passed to p_func. - * @param p_high_priority Whether or not this is a high priority task. - * @param p_description A pointer to a String with the task description. - * - * @return The task ID. - */ -typedef int64_t (*GDExtensionInterfaceWorkerThreadPoolAddNativeTask)(GDExtensionObjectPtr p_instance, GDExtensionWorkerThreadPoolTask p_func, void *p_userdata, GDExtensionBool p_high_priority, GDExtensionConstStringPtr p_description); - -/* INTERFACE: Packed Array */ - -/** - * @name packed_byte_array_operator_index - * @since 4.1 - * - * Gets a pointer to a byte in a PackedByteArray. - * - * @param p_self A pointer to a PackedByteArray object. - * @param p_index The index of the byte to get. - * - * @return A pointer to the requested byte. - */ -typedef uint8_t *(*GDExtensionInterfacePackedByteArrayOperatorIndex)(GDExtensionTypePtr p_self, GDExtensionInt p_index); - -/** - * @name packed_byte_array_operator_index_const - * @since 4.1 - * - * Gets a const pointer to a byte in a PackedByteArray. - * - * @param p_self A const pointer to a PackedByteArray object. - * @param p_index The index of the byte to get. - * - * @return A const pointer to the requested byte. - */ -typedef const uint8_t *(*GDExtensionInterfacePackedByteArrayOperatorIndexConst)(GDExtensionConstTypePtr p_self, GDExtensionInt p_index); - -/** - * @name packed_float32_array_operator_index - * @since 4.1 - * - * Gets a pointer to a 32-bit float in a PackedFloat32Array. - * - * @param p_self A pointer to a PackedFloat32Array object. - * @param p_index The index of the float to get. - * - * @return A pointer to the requested 32-bit float. - */ -typedef float *(*GDExtensionInterfacePackedFloat32ArrayOperatorIndex)(GDExtensionTypePtr p_self, GDExtensionInt p_index); - -/** - * @name packed_float32_array_operator_index_const - * @since 4.1 - * - * Gets a const pointer to a 32-bit float in a PackedFloat32Array. - * - * @param p_self A const pointer to a PackedFloat32Array object. - * @param p_index The index of the float to get. - * - * @return A const pointer to the requested 32-bit float. - */ -typedef const float *(*GDExtensionInterfacePackedFloat32ArrayOperatorIndexConst)(GDExtensionConstTypePtr p_self, GDExtensionInt p_index); - -/** - * @name packed_float64_array_operator_index - * @since 4.1 - * - * Gets a pointer to a 64-bit float in a PackedFloat64Array. - * - * @param p_self A pointer to a PackedFloat64Array object. - * @param p_index The index of the float to get. - * - * @return A pointer to the requested 64-bit float. - */ -typedef double *(*GDExtensionInterfacePackedFloat64ArrayOperatorIndex)(GDExtensionTypePtr p_self, GDExtensionInt p_index); - -/** - * @name packed_float64_array_operator_index_const - * @since 4.1 - * - * Gets a const pointer to a 64-bit float in a PackedFloat64Array. - * - * @param p_self A const pointer to a PackedFloat64Array object. - * @param p_index The index of the float to get. - * - * @return A const pointer to the requested 64-bit float. - */ -typedef const double *(*GDExtensionInterfacePackedFloat64ArrayOperatorIndexConst)(GDExtensionConstTypePtr p_self, GDExtensionInt p_index); - -/** - * @name packed_int32_array_operator_index - * @since 4.1 - * - * Gets a pointer to a 32-bit integer in a PackedInt32Array. - * - * @param p_self A pointer to a PackedInt32Array object. - * @param p_index The index of the integer to get. - * - * @return A pointer to the requested 32-bit integer. - */ -typedef int32_t *(*GDExtensionInterfacePackedInt32ArrayOperatorIndex)(GDExtensionTypePtr p_self, GDExtensionInt p_index); - -/** - * @name packed_int32_array_operator_index_const - * @since 4.1 - * - * Gets a const pointer to a 32-bit integer in a PackedInt32Array. - * - * @param p_self A const pointer to a PackedInt32Array object. - * @param p_index The index of the integer to get. - * - * @return A const pointer to the requested 32-bit integer. - */ -typedef const int32_t *(*GDExtensionInterfacePackedInt32ArrayOperatorIndexConst)(GDExtensionConstTypePtr p_self, GDExtensionInt p_index); - -/** - * @name packed_int64_array_operator_index - * @since 4.1 - * - * Gets a pointer to a 64-bit integer in a PackedInt64Array. - * - * @param p_self A pointer to a PackedInt64Array object. - * @param p_index The index of the integer to get. - * - * @return A pointer to the requested 64-bit integer. - */ -typedef int64_t *(*GDExtensionInterfacePackedInt64ArrayOperatorIndex)(GDExtensionTypePtr p_self, GDExtensionInt p_index); - -/** - * @name packed_int64_array_operator_index_const - * @since 4.1 - * - * Gets a const pointer to a 64-bit integer in a PackedInt64Array. - * - * @param p_self A const pointer to a PackedInt64Array object. - * @param p_index The index of the integer to get. - * - * @return A const pointer to the requested 64-bit integer. - */ -typedef const int64_t *(*GDExtensionInterfacePackedInt64ArrayOperatorIndexConst)(GDExtensionConstTypePtr p_self, GDExtensionInt p_index); - -/** - * @name packed_string_array_operator_index - * @since 4.1 - * - * Gets a pointer to a string in a PackedStringArray. - * - * @param p_self A pointer to a PackedStringArray object. - * @param p_index The index of the String to get. - * - * @return A pointer to the requested String. - */ -typedef GDExtensionStringPtr (*GDExtensionInterfacePackedStringArrayOperatorIndex)(GDExtensionTypePtr p_self, GDExtensionInt p_index); - -/** - * @name packed_string_array_operator_index_const - * @since 4.1 - * - * Gets a const pointer to a string in a PackedStringArray. - * - * @param p_self A const pointer to a PackedStringArray object. - * @param p_index The index of the String to get. - * - * @return A const pointer to the requested String. - */ -typedef GDExtensionStringPtr (*GDExtensionInterfacePackedStringArrayOperatorIndexConst)(GDExtensionConstTypePtr p_self, GDExtensionInt p_index); - -/** - * @name packed_vector2_array_operator_index - * @since 4.1 - * - * Gets a pointer to a Vector2 in a PackedVector2Array. - * - * @param p_self A pointer to a PackedVector2Array object. - * @param p_index The index of the Vector2 to get. - * - * @return A pointer to the requested Vector2. - */ -typedef GDExtensionTypePtr (*GDExtensionInterfacePackedVector2ArrayOperatorIndex)(GDExtensionTypePtr p_self, GDExtensionInt p_index); - -/** - * @name packed_vector2_array_operator_index_const - * @since 4.1 - * - * Gets a const pointer to a Vector2 in a PackedVector2Array. - * - * @param p_self A const pointer to a PackedVector2Array object. - * @param p_index The index of the Vector2 to get. - * - * @return A const pointer to the requested Vector2. - */ -typedef GDExtensionTypePtr (*GDExtensionInterfacePackedVector2ArrayOperatorIndexConst)(GDExtensionConstTypePtr p_self, GDExtensionInt p_index); - -/** - * @name packed_vector3_array_operator_index - * @since 4.1 - * - * Gets a pointer to a Vector3 in a PackedVector3Array. - * - * @param p_self A pointer to a PackedVector3Array object. - * @param p_index The index of the Vector3 to get. - * - * @return A pointer to the requested Vector3. - */ -typedef GDExtensionTypePtr (*GDExtensionInterfacePackedVector3ArrayOperatorIndex)(GDExtensionTypePtr p_self, GDExtensionInt p_index); - -/** - * @name packed_vector3_array_operator_index_const - * @since 4.1 - * - * Gets a const pointer to a Vector3 in a PackedVector3Array. - * - * @param p_self A const pointer to a PackedVector3Array object. - * @param p_index The index of the Vector3 to get. - * - * @return A const pointer to the requested Vector3. - */ -typedef GDExtensionTypePtr (*GDExtensionInterfacePackedVector3ArrayOperatorIndexConst)(GDExtensionConstTypePtr p_self, GDExtensionInt p_index); - -/** - * @name packed_vector4_array_operator_index - * @since 4.3 - * - * Gets a pointer to a Vector4 in a PackedVector4Array. - * - * @param p_self A pointer to a PackedVector4Array object. - * @param p_index The index of the Vector4 to get. - * - * @return A pointer to the requested Vector4. - */ -typedef GDExtensionTypePtr (*GDExtensionInterfacePackedVector4ArrayOperatorIndex)(GDExtensionTypePtr p_self, GDExtensionInt p_index); - -/** - * @name packed_vector4_array_operator_index_const - * @since 4.3 - * - * Gets a const pointer to a Vector4 in a PackedVector4Array. - * - * @param p_self A const pointer to a PackedVector4Array object. - * @param p_index The index of the Vector4 to get. - * - * @return A const pointer to the requested Vector4. - */ -typedef GDExtensionTypePtr (*GDExtensionInterfacePackedVector4ArrayOperatorIndexConst)(GDExtensionConstTypePtr p_self, GDExtensionInt p_index); - -/** - * @name packed_color_array_operator_index - * @since 4.1 - * - * Gets a pointer to a color in a PackedColorArray. - * - * @param p_self A pointer to a PackedColorArray object. - * @param p_index The index of the Color to get. - * - * @return A pointer to the requested Color. - */ -typedef GDExtensionTypePtr (*GDExtensionInterfacePackedColorArrayOperatorIndex)(GDExtensionTypePtr p_self, GDExtensionInt p_index); - -/** - * @name packed_color_array_operator_index_const - * @since 4.1 - * - * Gets a const pointer to a color in a PackedColorArray. - * - * @param p_self A const pointer to a PackedColorArray object. - * @param p_index The index of the Color to get. - * - * @return A const pointer to the requested Color. - */ -typedef GDExtensionTypePtr (*GDExtensionInterfacePackedColorArrayOperatorIndexConst)(GDExtensionConstTypePtr p_self, GDExtensionInt p_index); - -/** - * @name array_operator_index - * @since 4.1 - * - * Gets a pointer to a Variant in an Array. - * - * @param p_self A pointer to an Array object. - * @param p_index The index of the Variant to get. - * - * @return A pointer to the requested Variant. - */ -typedef GDExtensionVariantPtr (*GDExtensionInterfaceArrayOperatorIndex)(GDExtensionTypePtr p_self, GDExtensionInt p_index); - -/** - * @name array_operator_index_const - * @since 4.1 - * - * Gets a const pointer to a Variant in an Array. - * - * @param p_self A const pointer to an Array object. - * @param p_index The index of the Variant to get. - * - * @return A const pointer to the requested Variant. - */ -typedef GDExtensionVariantPtr (*GDExtensionInterfaceArrayOperatorIndexConst)(GDExtensionConstTypePtr p_self, GDExtensionInt p_index); - -/** - * @name array_ref - * @since 4.1 - * @deprecated in Godot 4.5. use `Array::operator=` instead. - * - * Sets an Array to be a reference to another Array object. - * - * @param p_self A pointer to the Array object to update. - * @param p_from A pointer to the Array object to reference. - */ -typedef void (*GDExtensionInterfaceArrayRef)(GDExtensionTypePtr p_self, GDExtensionConstTypePtr p_from); - -/** - * @name array_set_typed - * @since 4.1 - * - * Makes an Array into a typed Array. - * - * @param p_self A pointer to the Array. - * @param p_type The type of Variant the Array will store. - * @param p_class_name A pointer to a StringName with the name of the object (if p_type is GDEXTENSION_VARIANT_TYPE_OBJECT). - * @param p_script A pointer to a Script object (if p_type is GDEXTENSION_VARIANT_TYPE_OBJECT and the base class is extended by a script). - */ -typedef void (*GDExtensionInterfaceArraySetTyped)(GDExtensionTypePtr p_self, GDExtensionVariantType p_type, GDExtensionConstStringNamePtr p_class_name, GDExtensionConstVariantPtr p_script); - -/* INTERFACE: Dictionary */ - -/** - * @name dictionary_operator_index - * @since 4.1 - * - * Gets a pointer to a Variant in a Dictionary with the given key. - * - * @param p_self A pointer to a Dictionary object. - * @param p_key A pointer to a Variant representing the key. - * - * @return A pointer to a Variant representing the value at the given key. - */ -typedef GDExtensionVariantPtr (*GDExtensionInterfaceDictionaryOperatorIndex)(GDExtensionTypePtr p_self, GDExtensionConstVariantPtr p_key); - -/** - * @name dictionary_operator_index_const - * @since 4.1 - * - * Gets a const pointer to a Variant in a Dictionary with the given key. - * - * @param p_self A const pointer to a Dictionary object. - * @param p_key A pointer to a Variant representing the key. - * - * @return A const pointer to a Variant representing the value at the given key. - */ -typedef GDExtensionVariantPtr (*GDExtensionInterfaceDictionaryOperatorIndexConst)(GDExtensionConstTypePtr p_self, GDExtensionConstVariantPtr p_key); - -/** - * @name dictionary_set_typed - * @since 4.4 - * - * Makes a Dictionary into a typed Dictionary. - * - * @param p_self A pointer to the Dictionary. - * @param p_key_type The type of Variant the Dictionary key will store. - * @param p_key_class_name A pointer to a StringName with the name of the object (if p_key_type is GDEXTENSION_VARIANT_TYPE_OBJECT). - * @param p_key_script A pointer to a Script object (if p_key_type is GDEXTENSION_VARIANT_TYPE_OBJECT and the base class is extended by a script). - * @param p_value_type The type of Variant the Dictionary value will store. - * @param p_value_class_name A pointer to a StringName with the name of the object (if p_value_type is GDEXTENSION_VARIANT_TYPE_OBJECT). - * @param p_value_script A pointer to a Script object (if p_value_type is GDEXTENSION_VARIANT_TYPE_OBJECT and the base class is extended by a script). - */ -typedef void (*GDExtensionInterfaceDictionarySetTyped)(GDExtensionTypePtr p_self, GDExtensionVariantType p_key_type, GDExtensionConstStringNamePtr p_key_class_name, GDExtensionConstVariantPtr p_key_script, GDExtensionVariantType p_value_type, GDExtensionConstStringNamePtr p_value_class_name, GDExtensionConstVariantPtr p_value_script); - -/* INTERFACE: Object */ - -/** - * @name object_method_bind_call - * @since 4.1 - * - * Calls a method on an Object. - * - * @param p_method_bind A pointer to the MethodBind representing the method on the Object's class. - * @param p_instance A pointer to the Object. - * @param p_args A pointer to a C array of Variants representing the arguments. - * @param p_arg_count The number of arguments. - * @param r_ret A pointer to Variant which will receive the return value. - * @param r_error A pointer to a GDExtensionCallError struct that will receive error information. - */ -typedef void (*GDExtensionInterfaceObjectMethodBindCall)(GDExtensionMethodBindPtr p_method_bind, GDExtensionObjectPtr p_instance, const GDExtensionConstVariantPtr *p_args, GDExtensionInt p_arg_count, GDExtensionUninitializedVariantPtr r_ret, GDExtensionCallError *r_error); - -/** - * @name object_method_bind_ptrcall - * @since 4.1 - * - * Calls a method on an Object (using a "ptrcall"). - * - * @param p_method_bind A pointer to the MethodBind representing the method on the Object's class. - * @param p_instance A pointer to the Object. - * @param p_args A pointer to a C array representing the arguments. - * @param r_ret A pointer to the Object that will receive the return value. - */ -typedef void (*GDExtensionInterfaceObjectMethodBindPtrcall)(GDExtensionMethodBindPtr p_method_bind, GDExtensionObjectPtr p_instance, const GDExtensionConstTypePtr *p_args, GDExtensionTypePtr r_ret); - -/** - * @name object_destroy - * @since 4.1 - * - * Destroys an Object. - * - * @param p_o A pointer to the Object. - */ -typedef void (*GDExtensionInterfaceObjectDestroy)(GDExtensionObjectPtr p_o); - -/** - * @name global_get_singleton - * @since 4.1 - * - * Gets a global singleton by name. - * - * @param p_name A pointer to a StringName with the singleton name. - * - * @return A pointer to the singleton Object. - */ -typedef GDExtensionObjectPtr (*GDExtensionInterfaceGlobalGetSingleton)(GDExtensionConstStringNamePtr p_name); - -/** - * @name object_get_instance_binding - * @since 4.1 - * - * Gets a pointer representing an Object's instance binding. - * - * @param p_o A pointer to the Object. - * @param p_token A token the library received by the GDExtension's entry point function. - * @param p_callbacks A pointer to a GDExtensionInstanceBindingCallbacks struct. - * - * @return A pointer to the instance binding. - */ -typedef void *(*GDExtensionInterfaceObjectGetInstanceBinding)(GDExtensionObjectPtr p_o, void *p_token, const GDExtensionInstanceBindingCallbacks *p_callbacks); - -/** - * @name object_set_instance_binding - * @since 4.1 - * - * Sets an Object's instance binding. - * - * @param p_o A pointer to the Object. - * @param p_token A token the library received by the GDExtension's entry point function. - * @param p_binding A pointer to the instance binding. - * @param p_callbacks A pointer to a GDExtensionInstanceBindingCallbacks struct. - */ -typedef void (*GDExtensionInterfaceObjectSetInstanceBinding)(GDExtensionObjectPtr p_o, void *p_token, void *p_binding, const GDExtensionInstanceBindingCallbacks *p_callbacks); - -/** - * @name object_free_instance_binding - * @since 4.2 - * - * Free an Object's instance binding. - * - * @param p_o A pointer to the Object. - * @param p_token A token the library received by the GDExtension's entry point function. - */ -typedef void (*GDExtensionInterfaceObjectFreeInstanceBinding)(GDExtensionObjectPtr p_o, void *p_token); - -/** - * @name object_set_instance - * @since 4.1 - * - * Sets an extension class instance on a Object. - * - * `p_classname` should be a registered extension class and should extend the `p_o` Object's class. - * - * @param p_o A pointer to the Object. - * @param p_classname A pointer to a StringName with the registered extension class's name. - * @param p_instance A pointer to the extension class instance. - */ -typedef void (*GDExtensionInterfaceObjectSetInstance)(GDExtensionObjectPtr p_o, GDExtensionConstStringNamePtr p_classname, GDExtensionClassInstancePtr p_instance); - -/** - * @name object_get_class_name - * @since 4.1 - * - * Gets the class name of an Object. - * - * If the GDExtension wraps the Godot object in an abstraction specific to its class, this is the - * function that should be used to determine which wrapper to use. - * - * @param p_object A pointer to the Object. - * @param p_library A pointer the library received by the GDExtension's entry point function. - * @param r_class_name A pointer to a String to receive the class name. - * - * @return true if successful in getting the class name; otherwise false. - */ -typedef GDExtensionBool (*GDExtensionInterfaceObjectGetClassName)(GDExtensionConstObjectPtr p_object, GDExtensionClassLibraryPtr p_library, GDExtensionUninitializedStringNamePtr r_class_name); - -/** - * @name object_cast_to - * @since 4.1 - * - * Casts an Object to a different type. - * - * @param p_object A pointer to the Object. - * @param p_class_tag A pointer uniquely identifying a built-in class in the ClassDB. - * - * @return Returns a pointer to the Object, or NULL if it can't be cast to the requested type. - */ -typedef GDExtensionObjectPtr (*GDExtensionInterfaceObjectCastTo)(GDExtensionConstObjectPtr p_object, void *p_class_tag); - -/** - * @name object_get_instance_from_id - * @since 4.1 - * - * Gets an Object by its instance ID. - * - * @param p_instance_id The instance ID. - * - * @return A pointer to the Object. - */ -typedef GDExtensionObjectPtr (*GDExtensionInterfaceObjectGetInstanceFromId)(GDObjectInstanceID p_instance_id); - -/** - * @name object_get_instance_id - * @since 4.1 - * - * Gets the instance ID from an Object. - * - * @param p_object A pointer to the Object. - * - * @return The instance ID. - */ -typedef GDObjectInstanceID (*GDExtensionInterfaceObjectGetInstanceId)(GDExtensionConstObjectPtr p_object); - -/** - * @name object_has_script_method - * @since 4.3 - * - * Checks if this object has a script with the given method. - * - * @param p_object A pointer to the Object. - * @param p_method A pointer to a StringName identifying the method. - * - * @return true if the object has a script and that script has a method with the given name. Returns false if the object has no script. - */ -typedef GDExtensionBool (*GDExtensionInterfaceObjectHasScriptMethod)(GDExtensionConstObjectPtr p_object, GDExtensionConstStringNamePtr p_method); - -/** - * @name object_call_script_method - * @since 4.3 - * - * Call the given script method on this object. - * - * @param p_object A pointer to the Object. - * @param p_method A pointer to a StringName identifying the method. - * @param p_args A pointer to a C array of Variant. - * @param p_argument_count The number of arguments. - * @param r_return A pointer a Variant which will be assigned the return value. - * @param r_error A pointer the structure which will hold error information. - */ -typedef void (*GDExtensionInterfaceObjectCallScriptMethod)(GDExtensionObjectPtr p_object, GDExtensionConstStringNamePtr p_method, const GDExtensionConstVariantPtr *p_args, GDExtensionInt p_argument_count, GDExtensionUninitializedVariantPtr r_return, GDExtensionCallError *r_error); - -/* INTERFACE: Reference */ - -/** - * @name ref_get_object - * @since 4.1 - * - * Gets the Object from a reference. - * - * @param p_ref A pointer to the reference. - * - * @return A pointer to the Object from the reference or NULL. - */ -typedef GDExtensionObjectPtr (*GDExtensionInterfaceRefGetObject)(GDExtensionConstRefPtr p_ref); - -/** - * @name ref_set_object - * @since 4.1 - * - * Sets the Object referred to by a reference. - * - * @param p_ref A pointer to the reference. - * @param p_object A pointer to the Object to refer to. - */ -typedef void (*GDExtensionInterfaceRefSetObject)(GDExtensionRefPtr p_ref, GDExtensionObjectPtr p_object); - -/* INTERFACE: Script Instance */ - -/** - * @name script_instance_create - * @since 4.1 - * @deprecated in Godot 4.2. Use `script_instance_create3` instead. - * - * Creates a script instance that contains the given info and instance data. - * - * @param p_info A pointer to a GDExtensionScriptInstanceInfo 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 (*GDExtensionInterfaceScriptInstanceCreate)(const GDExtensionScriptInstanceInfo *p_info, GDExtensionScriptInstanceDataPtr p_instance_data); - -/** - * @name script_instance_create2 - * @since 4.2 - * @deprecated in Godot 4.3. Use `script_instance_create3` instead. - * - * 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 script_instance_create3 - * @since 4.3 - * - * Creates a script instance that contains the given info and instance data. - * - * @param p_info A pointer to a GDExtensionScriptInstanceInfo3 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 (*GDExtensionInterfaceScriptInstanceCreate3)(const GDExtensionScriptInstanceInfo3 *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); - -/** - * @name object_set_script_instance - * @since 4.5 - * - * Set the script instance data attached to this object. - * - * @param p_object A pointer to the Object. - * @param p_script_instance A pointer to the script instance data to attach to this object. - */ -typedef void (*GDExtensionInterfaceObjectSetScriptInstance)(GDExtensionObjectPtr p_object, GDExtensionScriptInstanceDataPtr p_script_instance); - -/* INTERFACE: Callable */ - -/** - * @name callable_custom_create - * @since 4.2 - * @deprecated in Godot 4.3. Use `callable_custom_create2` instead. - * - * Creates a custom Callable object from a function pointer. - * - * Provided struct can be safely freed once the function returns. - * - * @param r_callable A pointer that will receive the new Callable. - * @param p_callable_custom_info The info required to construct a Callable. - */ -typedef void (*GDExtensionInterfaceCallableCustomCreate)(GDExtensionUninitializedTypePtr r_callable, GDExtensionCallableCustomInfo *p_callable_custom_info); - -/** - * @name callable_custom_create2 - * @since 4.3 - * - * Creates a custom Callable object from a function pointer. - * - * Provided struct can be safely freed once the function returns. - * - * @param r_callable A pointer that will receive the new Callable. - * @param p_callable_custom_info The info required to construct a Callable. - */ -typedef void (*GDExtensionInterfaceCallableCustomCreate2)(GDExtensionUninitializedTypePtr r_callable, GDExtensionCallableCustomInfo2 *p_callable_custom_info); - -/** - * @name callable_custom_get_userdata - * @since 4.2 - * - * Retrieves the userdata pointer from a custom Callable. - * - * If the Callable is not a custom Callable or the token does not match the one provided to callable_custom_create() via GDExtensionCallableCustomInfo then NULL will be returned. - * - * @param p_callable A pointer to a Callable. - * @param p_token A pointer to an address that uniquely identifies the GDExtension. - * - * @return The userdata pointer given when creating this custom Callable. - */ -typedef void *(*GDExtensionInterfaceCallableCustomGetUserData)(GDExtensionConstTypePtr p_callable, void *p_token); - -/* INTERFACE: ClassDB */ - -/** - * @name classdb_construct_object - * @since 4.1 - * @deprecated in Godot 4.4. Use `classdb_construct_object2` instead. - * - * Constructs an Object of the requested class. - * - * The passed class must be a built-in godot class, or an already-registered extension class. In both cases, object_set_instance() should be called to fully initialize the object. - * - * @param p_classname A pointer to a StringName with the class name. - * - * @return A pointer to the newly created Object. - */ -typedef GDExtensionObjectPtr (*GDExtensionInterfaceClassdbConstructObject)(GDExtensionConstStringNamePtr p_classname); - -/** - * @name classdb_construct_object2 - * @since 4.4 - * - * Constructs an Object of the requested class. - * - * The passed class must be a built-in godot class, or an already-registered extension class. In both cases, object_set_instance() should be called to fully initialize the object. - * - * "NOTIFICATION_POSTINITIALIZE" must be sent after construction. - * - * @param p_classname A pointer to a StringName with the class name. - * - * @return A pointer to the newly created Object. - */ -typedef GDExtensionObjectPtr (*GDExtensionInterfaceClassdbConstructObject2)(GDExtensionConstStringNamePtr p_classname); - -/** - * @name classdb_get_method_bind - * @since 4.1 - * - * Gets a pointer to the MethodBind in ClassDB for the given class, method and hash. - * - * @param p_classname A pointer to a StringName with the class name. - * @param p_methodname A pointer to a StringName with the method name. - * @param p_hash A hash representing the function signature. - * - * @return A pointer to the MethodBind from ClassDB. - */ -typedef GDExtensionMethodBindPtr (*GDExtensionInterfaceClassdbGetMethodBind)(GDExtensionConstStringNamePtr p_classname, GDExtensionConstStringNamePtr p_methodname, GDExtensionInt p_hash); - -/** - * @name classdb_get_class_tag - * @since 4.1 - * - * Gets a pointer uniquely identifying the given built-in class in the ClassDB. - * - * @param p_classname A pointer to a StringName with the class name. - * - * @return A pointer uniquely identifying the built-in class in the ClassDB. - */ -typedef void *(*GDExtensionInterfaceClassdbGetClassTag)(GDExtensionConstStringNamePtr p_classname); - -/* INTERFACE: ClassDB Extension */ - -/** - * @name classdb_register_extension_class - * @since 4.1 - * @deprecated in Godot 4.2. Use `classdb_register_extension_class4` instead. - * - * 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 GDExtensionClassCreationInfo struct. - */ -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 - * @deprecated in Godot 4.3. Use `classdb_register_extension_class4` instead. - * - * 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_class3 - * @since 4.3 - * @deprecated in Godot 4.4. Use `classdb_register_extension_class4` instead. - * - * 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 GDExtensionClassCreationInfo3 struct. - */ -typedef void (*GDExtensionInterfaceClassdbRegisterExtensionClass3)(GDExtensionClassLibraryPtr p_library, GDExtensionConstStringNamePtr p_class_name, GDExtensionConstStringNamePtr p_parent_class_name, const GDExtensionClassCreationInfo3 *p_extension_funcs); - -/** - * @name classdb_register_extension_class4 - * @since 4.4 - * @deprecated in Godot 4.5. Use `classdb_register_extension_class5` instead. - * - * 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 GDExtensionClassCreationInfo4 struct. - */ -typedef void (*GDExtensionInterfaceClassdbRegisterExtensionClass4)(GDExtensionClassLibraryPtr p_library, GDExtensionConstStringNamePtr p_class_name, GDExtensionConstStringNamePtr p_parent_class_name, const GDExtensionClassCreationInfo4 *p_extension_funcs); - -/** - * @name classdb_register_extension_class5 - * @since 4.5 - * - * 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 GDExtensionClassCreationInfo5 struct. - */ -typedef void (*GDExtensionInterfaceClassdbRegisterExtensionClass5)(GDExtensionClassLibraryPtr p_library, GDExtensionConstStringNamePtr p_class_name, GDExtensionConstStringNamePtr p_parent_class_name, const GDExtensionClassCreationInfo5 *p_extension_funcs); - -/** - * @name classdb_register_extension_class_method - * @since 4.1 - * - * Registers a method on 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_method_info A pointer to a GDExtensionClassMethodInfo struct. - */ -typedef void (*GDExtensionInterfaceClassdbRegisterExtensionClassMethod)(GDExtensionClassLibraryPtr p_library, GDExtensionConstStringNamePtr p_class_name, const GDExtensionClassMethodInfo *p_method_info); - -/** - * @name classdb_register_extension_class_virtual_method - * @since 4.3 - * - * Registers a virtual method on an extension class in ClassDB, that can be implemented by scripts or other extensions. - * - * 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_method_info A pointer to a GDExtensionClassMethodInfo struct. - */ -typedef void (*GDExtensionInterfaceClassdbRegisterExtensionClassVirtualMethod)(GDExtensionClassLibraryPtr p_library, GDExtensionConstStringNamePtr p_class_name, const GDExtensionClassVirtualMethodInfo *p_method_info); - -/** - * @name classdb_register_extension_class_integer_constant - * @since 4.1 - * - * Registers an integer constant on an extension class in the ClassDB. - * - * Note about registering bitfield values (if p_is_bitfield is true): even though p_constant_value is signed, language bindings are - * advised to treat bitfields as uint64_t, since this is generally clearer and can prevent mistakes like using -1 for setting all bits. - * Language APIs should thus provide an abstraction that registers bitfields (uint64_t) separately from regular constants (int64_t). - * - * @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_enum_name A pointer to a StringName with the enum name. - * @param p_constant_name A pointer to a StringName with the constant name. - * @param p_constant_value The constant value. - * @param p_is_bitfield Whether or not this constant is part of a bitfield. - */ -typedef void (*GDExtensionInterfaceClassdbRegisterExtensionClassIntegerConstant)(GDExtensionClassLibraryPtr p_library, GDExtensionConstStringNamePtr p_class_name, GDExtensionConstStringNamePtr p_enum_name, GDExtensionConstStringNamePtr p_constant_name, GDExtensionInt p_constant_value, GDExtensionBool p_is_bitfield); - -/** - * @name classdb_register_extension_class_property - * @since 4.1 - * - * Registers a property on 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_info A pointer to a GDExtensionPropertyInfo struct. - * @param p_setter A pointer to a StringName with the name of the setter method. - * @param p_getter A pointer to a StringName with the name of the getter method. - */ -typedef void (*GDExtensionInterfaceClassdbRegisterExtensionClassProperty)(GDExtensionClassLibraryPtr p_library, GDExtensionConstStringNamePtr p_class_name, const GDExtensionPropertyInfo *p_info, GDExtensionConstStringNamePtr p_setter, GDExtensionConstStringNamePtr p_getter); - -/** - * @name classdb_register_extension_class_property_indexed - * @since 4.2 - * - * Registers an indexed property on 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_info A pointer to a GDExtensionPropertyInfo struct. - * @param p_setter A pointer to a StringName with the name of the setter method. - * @param p_getter A pointer to a StringName with the name of the getter method. - * @param p_index The index to pass as the first argument to the getter and setter methods. - */ -typedef void (*GDExtensionInterfaceClassdbRegisterExtensionClassPropertyIndexed)(GDExtensionClassLibraryPtr p_library, GDExtensionConstStringNamePtr p_class_name, const GDExtensionPropertyInfo *p_info, GDExtensionConstStringNamePtr p_setter, GDExtensionConstStringNamePtr p_getter, GDExtensionInt p_index); - -/** - * @name classdb_register_extension_class_property_group - * @since 4.1 - * - * Registers a property group on an extension class in the ClassDB. - * - * @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_group_name A pointer to a String with the group name. - * @param p_prefix A pointer to a String with the prefix used by properties in this group. - */ -typedef void (*GDExtensionInterfaceClassdbRegisterExtensionClassPropertyGroup)(GDExtensionClassLibraryPtr p_library, GDExtensionConstStringNamePtr p_class_name, GDExtensionConstStringPtr p_group_name, GDExtensionConstStringPtr p_prefix); - -/** - * @name classdb_register_extension_class_property_subgroup - * @since 4.1 - * - * Registers a property subgroup on an extension class in the ClassDB. - * - * @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_subgroup_name A pointer to a String with the subgroup name. - * @param p_prefix A pointer to a String with the prefix used by properties in this subgroup. - */ -typedef void (*GDExtensionInterfaceClassdbRegisterExtensionClassPropertySubgroup)(GDExtensionClassLibraryPtr p_library, GDExtensionConstStringNamePtr p_class_name, GDExtensionConstStringPtr p_subgroup_name, GDExtensionConstStringPtr p_prefix); - -/** - * @name classdb_register_extension_class_signal - * @since 4.1 - * - * Registers a signal on an extension class in the ClassDB. - * - * Provided structs 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_signal_name A pointer to a StringName with the signal name. - * @param p_argument_info A pointer to a GDExtensionPropertyInfo struct. - * @param p_argument_count The number of arguments the signal receives. - */ -typedef void (*GDExtensionInterfaceClassdbRegisterExtensionClassSignal)(GDExtensionClassLibraryPtr p_library, GDExtensionConstStringNamePtr p_class_name, GDExtensionConstStringNamePtr p_signal_name, const GDExtensionPropertyInfo *p_argument_info, GDExtensionInt p_argument_count); - -/** - * @name classdb_unregister_extension_class - * @since 4.1 - * - * Unregisters an extension class in the ClassDB. - * - * Unregistering a parent class before a class that inherits it will result in failure. Inheritors must be unregistered first. - * - * @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. - */ -typedef void (*GDExtensionInterfaceClassdbUnregisterExtensionClass)(GDExtensionClassLibraryPtr p_library, GDExtensionConstStringNamePtr p_class_name); - -/** - * @name get_library_path - * @since 4.1 - * - * Gets the path to the current GDExtension library. - * - * @param p_library A pointer the library received by the GDExtension's entry point function. - * @param r_path A pointer to a String which will receive the path. - */ -typedef void (*GDExtensionInterfaceGetLibraryPath)(GDExtensionClassLibraryPtr p_library, GDExtensionUninitializedStringPtr r_path); - -/** - * @name editor_add_plugin - * @since 4.1 - * - * Adds an editor plugin. - * - * It's safe to call during initialization. - * - * @param p_class_name A pointer to a StringName with the name of a class (descending from EditorPlugin) which is already registered with ClassDB. - */ -typedef void (*GDExtensionInterfaceEditorAddPlugin)(GDExtensionConstStringNamePtr p_class_name); - -/** - * @name editor_remove_plugin - * @since 4.1 - * - * Removes an editor plugin. - * - * @param p_class_name A pointer to a StringName with the name of a class that was previously added as an editor plugin. - */ -typedef void (*GDExtensionInterfaceEditorRemovePlugin)(GDExtensionConstStringNamePtr p_class_name); - -/** - * @name editor_help_load_xml_from_utf8_chars - * @since 4.3 - * - * Loads new XML-formatted documentation data in the editor. - * - * The provided pointer can be immediately freed once the function returns. - * - * @param p_data A pointer to a UTF-8 encoded C string (null terminated). - */ -typedef void (*GDExtensionsInterfaceEditorHelpLoadXmlFromUtf8Chars)(const char *p_data); - -/** - * @name editor_help_load_xml_from_utf8_chars_and_len - * @since 4.3 - * - * Loads new XML-formatted documentation data in the editor. - * - * The provided pointer can be immediately freed once the function returns. - * - * @param p_data A pointer to a UTF-8 encoded C string. - * @param p_size The number of bytes (not code units). - */ -typedef void (*GDExtensionsInterfaceEditorHelpLoadXmlFromUtf8CharsAndLen)(const char *p_data, GDExtensionInt p_size); - -/** - * @name editor_register_get_classes_used_callback - * @since 4.5 - * - * Registers a callback that Godot can call to get the list of all classes (from ClassDB) that may be used by the calling GDExtension. - * - * This is used by the editor to generate a build profile (in "Tools" > "Engine Compilation Configuration Editor..." > "Detect from project"), - * in order to recompile Godot with only the classes used. - * In the provided callback, the GDExtension should provide the list of classes that _may_ be used statically, thus the time of invocation shouldn't matter. - * If a GDExtension doesn't register a callback, Godot will assume that it could be using any classes. - * - * @param p_library A pointer the library received by the GDExtension's entry point function. - * @param p_callback The callback to retrieve the list of classes used. - */ -typedef void (*GDExtensionInterfaceEditorRegisterGetClassesUsedCallback)(GDExtensionClassLibraryPtr p_library, GDExtensionEditorGetClassesUsedCallback p_callback); - -/** - * @name register_main_loop_callbacks - * @since 4.5 - * - * Registers callbacks to be called at different phases of the main loop. - * - * @param p_library A pointer the library received by the GDExtension's entry point function. - * @param p_callbacks A pointer to the structure that contains the callbacks. - */ -typedef void (*GDExtensionInterfaceRegisterMainLoopCallbacks)(GDExtensionClassLibraryPtr p_library, const GDExtensionMainLoopCallbacks *p_callbacks); - -#ifdef __cplusplus -} -#endif diff --git a/core/extension/gdextension_interface.json b/core/extension/gdextension_interface.json new file mode 100644 index 00000000000..251d8dba789 --- /dev/null +++ b/core/extension/gdextension_interface.json @@ -0,0 +1,9359 @@ +{ + "_copyright": [ + "/**************************************************************************/", + "/* This file is part of: */", + "/* GODOT ENGINE */", + "/* https://godotengine.org */", + "/**************************************************************************/", + "/* Copyright (c) 2014-present Godot Engine contributors (see AUTHORS.md). */", + "/* Copyright (c) 2007-2014 Juan Linietsky, Ariel Manzur. */", + "/* */", + "/* Permission is hereby granted, free of charge, to any person obtaining */", + "/* a copy of this software and associated documentation files (the */", + "/* \"Software\"), to deal in the Software without restriction, including */", + "/* without limitation the rights to use, copy, modify, merge, publish, */", + "/* distribute, sublicense, and/or sell copies of the Software, and to */", + "/* permit persons to whom the Software is furnished to do so, subject to */", + "/* the following conditions: */", + "/* */", + "/* The above copyright notice and this permission notice shall be */", + "/* included in all copies or substantial portions of the Software. */", + "/* */", + "/* THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, */", + "/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */", + "/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. */", + "/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */", + "/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */", + "/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */", + "/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */", + "/**************************************************************************/" + ], + "$schema": "./gdextension_interface.schema.json", + "format_version": 1, + "types": [ + { + "name": "GDExtensionVariantType", + "kind": "enum", + "values": [ + { + "name": "GDEXTENSION_VARIANT_TYPE_NIL", + "value": 0 + }, + { + "name": "GDEXTENSION_VARIANT_TYPE_BOOL", + "value": 1 + }, + { + "name": "GDEXTENSION_VARIANT_TYPE_INT", + "value": 2 + }, + { + "name": "GDEXTENSION_VARIANT_TYPE_FLOAT", + "value": 3 + }, + { + "name": "GDEXTENSION_VARIANT_TYPE_STRING", + "value": 4 + }, + { + "name": "GDEXTENSION_VARIANT_TYPE_VECTOR2", + "value": 5 + }, + { + "name": "GDEXTENSION_VARIANT_TYPE_VECTOR2I", + "value": 6 + }, + { + "name": "GDEXTENSION_VARIANT_TYPE_RECT2", + "value": 7 + }, + { + "name": "GDEXTENSION_VARIANT_TYPE_RECT2I", + "value": 8 + }, + { + "name": "GDEXTENSION_VARIANT_TYPE_VECTOR3", + "value": 9 + }, + { + "name": "GDEXTENSION_VARIANT_TYPE_VECTOR3I", + "value": 10 + }, + { + "name": "GDEXTENSION_VARIANT_TYPE_TRANSFORM2D", + "value": 11 + }, + { + "name": "GDEXTENSION_VARIANT_TYPE_VECTOR4", + "value": 12 + }, + { + "name": "GDEXTENSION_VARIANT_TYPE_VECTOR4I", + "value": 13 + }, + { + "name": "GDEXTENSION_VARIANT_TYPE_PLANE", + "value": 14 + }, + { + "name": "GDEXTENSION_VARIANT_TYPE_QUATERNION", + "value": 15 + }, + { + "name": "GDEXTENSION_VARIANT_TYPE_AABB", + "value": 16 + }, + { + "name": "GDEXTENSION_VARIANT_TYPE_BASIS", + "value": 17 + }, + { + "name": "GDEXTENSION_VARIANT_TYPE_TRANSFORM3D", + "value": 18 + }, + { + "name": "GDEXTENSION_VARIANT_TYPE_PROJECTION", + "value": 19 + }, + { + "name": "GDEXTENSION_VARIANT_TYPE_COLOR", + "value": 20 + }, + { + "name": "GDEXTENSION_VARIANT_TYPE_STRING_NAME", + "value": 21 + }, + { + "name": "GDEXTENSION_VARIANT_TYPE_NODE_PATH", + "value": 22 + }, + { + "name": "GDEXTENSION_VARIANT_TYPE_RID", + "value": 23 + }, + { + "name": "GDEXTENSION_VARIANT_TYPE_OBJECT", + "value": 24 + }, + { + "name": "GDEXTENSION_VARIANT_TYPE_CALLABLE", + "value": 25 + }, + { + "name": "GDEXTENSION_VARIANT_TYPE_SIGNAL", + "value": 26 + }, + { + "name": "GDEXTENSION_VARIANT_TYPE_DICTIONARY", + "value": 27 + }, + { + "name": "GDEXTENSION_VARIANT_TYPE_ARRAY", + "value": 28 + }, + { + "name": "GDEXTENSION_VARIANT_TYPE_PACKED_BYTE_ARRAY", + "value": 29 + }, + { + "name": "GDEXTENSION_VARIANT_TYPE_PACKED_INT32_ARRAY", + "value": 30 + }, + { + "name": "GDEXTENSION_VARIANT_TYPE_PACKED_INT64_ARRAY", + "value": 31 + }, + { + "name": "GDEXTENSION_VARIANT_TYPE_PACKED_FLOAT32_ARRAY", + "value": 32 + }, + { + "name": "GDEXTENSION_VARIANT_TYPE_PACKED_FLOAT64_ARRAY", + "value": 33 + }, + { + "name": "GDEXTENSION_VARIANT_TYPE_PACKED_STRING_ARRAY", + "value": 34 + }, + { + "name": "GDEXTENSION_VARIANT_TYPE_PACKED_VECTOR2_ARRAY", + "value": 35 + }, + { + "name": "GDEXTENSION_VARIANT_TYPE_PACKED_VECTOR3_ARRAY", + "value": 36 + }, + { + "name": "GDEXTENSION_VARIANT_TYPE_PACKED_COLOR_ARRAY", + "value": 37 + }, + { + "name": "GDEXTENSION_VARIANT_TYPE_PACKED_VECTOR4_ARRAY", + "value": 38 + }, + { + "name": "GDEXTENSION_VARIANT_TYPE_VARIANT_MAX", + "value": 39 + } + ] + }, + { + "name": "GDExtensionVariantOperator", + "kind": "enum", + "values": [ + { + "name": "GDEXTENSION_VARIANT_OP_EQUAL", + "value": 0 + }, + { + "name": "GDEXTENSION_VARIANT_OP_NOT_EQUAL", + "value": 1 + }, + { + "name": "GDEXTENSION_VARIANT_OP_LESS", + "value": 2 + }, + { + "name": "GDEXTENSION_VARIANT_OP_LESS_EQUAL", + "value": 3 + }, + { + "name": "GDEXTENSION_VARIANT_OP_GREATER", + "value": 4 + }, + { + "name": "GDEXTENSION_VARIANT_OP_GREATER_EQUAL", + "value": 5 + }, + { + "name": "GDEXTENSION_VARIANT_OP_ADD", + "value": 6 + }, + { + "name": "GDEXTENSION_VARIANT_OP_SUBTRACT", + "value": 7 + }, + { + "name": "GDEXTENSION_VARIANT_OP_MULTIPLY", + "value": 8 + }, + { + "name": "GDEXTENSION_VARIANT_OP_DIVIDE", + "value": 9 + }, + { + "name": "GDEXTENSION_VARIANT_OP_NEGATE", + "value": 10 + }, + { + "name": "GDEXTENSION_VARIANT_OP_POSITIVE", + "value": 11 + }, + { + "name": "GDEXTENSION_VARIANT_OP_MODULE", + "value": 12 + }, + { + "name": "GDEXTENSION_VARIANT_OP_POWER", + "value": 13 + }, + { + "name": "GDEXTENSION_VARIANT_OP_SHIFT_LEFT", + "value": 14 + }, + { + "name": "GDEXTENSION_VARIANT_OP_SHIFT_RIGHT", + "value": 15 + }, + { + "name": "GDEXTENSION_VARIANT_OP_BIT_AND", + "value": 16 + }, + { + "name": "GDEXTENSION_VARIANT_OP_BIT_OR", + "value": 17 + }, + { + "name": "GDEXTENSION_VARIANT_OP_BIT_XOR", + "value": 18 + }, + { + "name": "GDEXTENSION_VARIANT_OP_BIT_NEGATE", + "value": 19 + }, + { + "name": "GDEXTENSION_VARIANT_OP_AND", + "value": 20 + }, + { + "name": "GDEXTENSION_VARIANT_OP_OR", + "value": 21 + }, + { + "name": "GDEXTENSION_VARIANT_OP_XOR", + "value": 22 + }, + { + "name": "GDEXTENSION_VARIANT_OP_NOT", + "value": 23 + }, + { + "name": "GDEXTENSION_VARIANT_OP_IN", + "value": 24 + }, + { + "name": "GDEXTENSION_VARIANT_OP_MAX", + "value": 25 + } + ] + }, + { + "name": "GDExtensionVariantPtr", + "kind": "handle", + "description": [ + "In this API there are multiple functions which expect the caller to pass a pointer", + "on return value as parameter.", + "In order to make it clear if the caller should initialize the return value or not", + "we have two flavor of types:", + "- `GDExtensionXXXPtr` for pointer on an initialized value", + "- `GDExtensionUninitializedXXXPtr` for pointer on uninitialized value", + "", + "Notes:", + "- Not respecting those requirements can seems harmless, but will lead to unexpected", + "segfault or memory leak (for instance with a specific compiler/OS, or when two", + "native extensions start doing ptrcall on each other).", + "- Initialization must be done with the function pointer returned by `variant_get_ptr_constructor`,", + "zero-initializing the variable should not be considered a valid initialization method here !", + "- Some types have no destructor (see `extension_api.json`'s `has_destructor` field), for", + "them it is always safe to skip the constructor for the return value if you are in a hurry ;-)" + ] + }, + { + "name": "GDExtensionConstVariantPtr", + "kind": "handle", + "parent": "GDExtensionVariantPtr", + "const": true + }, + { + "name": "GDExtensionUninitializedVariantPtr", + "kind": "handle" + }, + { + "name": "GDExtensionStringNamePtr", + "kind": "handle" + }, + { + "name": "GDExtensionConstStringNamePtr", + "kind": "handle", + "parent": "GDExtensionStringNamePtr", + "const": true + }, + { + "name": "GDExtensionUninitializedStringNamePtr", + "kind": "handle" + }, + { + "name": "GDExtensionStringPtr", + "kind": "handle" + }, + { + "name": "GDExtensionConstStringPtr", + "kind": "handle", + "parent": "GDExtensionStringPtr", + "const": true + }, + { + "name": "GDExtensionUninitializedStringPtr", + "kind": "handle" + }, + { + "name": "GDExtensionObjectPtr", + "kind": "handle" + }, + { + "name": "GDExtensionConstObjectPtr", + "kind": "handle", + "parent": "GDExtensionObjectPtr", + "const": true + }, + { + "name": "GDExtensionUninitializedObjectPtr", + "parent": "GDExtensionObjectPtr", + "kind": "handle" + }, + { + "name": "GDExtensionTypePtr", + "kind": "handle" + }, + { + "name": "GDExtensionConstTypePtr", + "kind": "handle", + "parent": "GDExtensionTypePtr", + "const": true + }, + { + "name": "GDExtensionUninitializedTypePtr", + "kind": "handle" + }, + { + "name": "GDExtensionMethodBindPtr", + "kind": "handle", + "const": true + }, + { + "name": "GDExtensionInt", + "kind": "alias", + "type": "int64_t" + }, + { + "name": "GDExtensionBool", + "kind": "alias", + "type": "uint8_t" + }, + { + "name": "GDObjectInstanceID", + "kind": "alias", + "type": "uint64_t" + }, + { + "name": "GDExtensionRefPtr", + "kind": "handle" + }, + { + "name": "GDExtensionConstRefPtr", + "kind": "handle", + "parent": "GDExtensionRefPtr", + "const": true + }, + { + "name": "GDExtensionCallErrorType", + "kind": "enum", + "values": [ + { + "name": "GDEXTENSION_CALL_OK", + "value": 0 + }, + { + "name": "GDEXTENSION_CALL_ERROR_INVALID_METHOD", + "value": 1 + }, + { + "name": "GDEXTENSION_CALL_ERROR_INVALID_ARGUMENT", + "value": 2, + "description": [ + "Expected a different variant type." + ] + }, + { + "name": "GDEXTENSION_CALL_ERROR_TOO_MANY_ARGUMENTS", + "value": 3, + "description": [ + "Expected lower number of arguments." + ] + }, + { + "name": "GDEXTENSION_CALL_ERROR_TOO_FEW_ARGUMENTS", + "value": 4, + "description": [ + "Expected higher number of arguments." + ] + }, + { + "name": "GDEXTENSION_CALL_ERROR_INSTANCE_IS_NULL", + "value": 5 + }, + { + "name": "GDEXTENSION_CALL_ERROR_METHOD_NOT_CONST", + "value": 6, + "description": [ + "Used for const call." + ] + } + ] + }, + { + "name": "GDExtensionCallError", + "kind": "struct", + "members": [ + { + "name": "error", + "type": "GDExtensionCallErrorType" + }, + { + "name": "argument", + "type": "int32_t" + }, + { + "name": "expected", + "type": "int32_t" + } + ] + }, + { + "name": "GDExtensionVariantFromTypeConstructorFunc", + "kind": "function", + "return_value": { + "type": "void" + }, + "arguments": [ + { + "type": "GDExtensionUninitializedVariantPtr" + }, + { + "type": "GDExtensionTypePtr" + } + ] + }, + { + "name": "GDExtensionTypeFromVariantConstructorFunc", + "kind": "function", + "return_value": { + "type": "void" + }, + "arguments": [ + { + "type": "GDExtensionUninitializedTypePtr" + }, + { + "type": "GDExtensionVariantPtr" + } + ] + }, + { + "name": "GDExtensionVariantGetInternalPtrFunc", + "kind": "function", + "return_value": { + "type": "void*" + }, + "arguments": [ + { + "type": "GDExtensionVariantPtr" + } + ] + }, + { + "name": "GDExtensionPtrOperatorEvaluator", + "kind": "function", + "return_value": { + "type": "void" + }, + "arguments": [ + { + "name": "p_left", + "type": "GDExtensionConstTypePtr" + }, + { + "name": "p_right", + "type": "GDExtensionConstTypePtr" + }, + { + "name": "r_result", + "type": "GDExtensionTypePtr" + } + ] + }, + { + "name": "GDExtensionPtrBuiltInMethod", + "kind": "function", + "return_value": { + "type": "void" + }, + "arguments": [ + { + "name": "p_base", + "type": "GDExtensionTypePtr" + }, + { + "name": "p_args", + "type": "const GDExtensionConstTypePtr*" + }, + { + "name": "r_return", + "type": "GDExtensionTypePtr" + }, + { + "name": "p_argument_count", + "type": "int" + } + ] + }, + { + "name": "GDExtensionPtrConstructor", + "kind": "function", + "return_value": { + "type": "void" + }, + "arguments": [ + { + "name": "p_base", + "type": "GDExtensionUninitializedTypePtr" + }, + { + "name": "p_args", + "type": "const GDExtensionConstTypePtr*" + } + ] + }, + { + "name": "GDExtensionPtrDestructor", + "kind": "function", + "return_value": { + "type": "void" + }, + "arguments": [ + { + "name": "p_base", + "type": "GDExtensionTypePtr" + } + ] + }, + { + "name": "GDExtensionPtrSetter", + "kind": "function", + "return_value": { + "type": "void" + }, + "arguments": [ + { + "name": "p_base", + "type": "GDExtensionTypePtr" + }, + { + "name": "p_value", + "type": "GDExtensionConstTypePtr" + } + ] + }, + { + "name": "GDExtensionPtrGetter", + "kind": "function", + "return_value": { + "type": "void" + }, + "arguments": [ + { + "name": "p_base", + "type": "GDExtensionConstTypePtr" + }, + { + "name": "r_value", + "type": "GDExtensionTypePtr" + } + ] + }, + { + "name": "GDExtensionPtrIndexedSetter", + "kind": "function", + "return_value": { + "type": "void" + }, + "arguments": [ + { + "name": "p_base", + "type": "GDExtensionTypePtr" + }, + { + "name": "p_index", + "type": "GDExtensionInt" + }, + { + "name": "p_value", + "type": "GDExtensionConstTypePtr" + } + ] + }, + { + "name": "GDExtensionPtrIndexedGetter", + "kind": "function", + "return_value": { + "type": "void" + }, + "arguments": [ + { + "name": "p_base", + "type": "GDExtensionConstTypePtr" + }, + { + "name": "p_index", + "type": "GDExtensionInt" + }, + { + "name": "r_value", + "type": "GDExtensionTypePtr" + } + ] + }, + { + "name": "GDExtensionPtrKeyedSetter", + "kind": "function", + "return_value": { + "type": "void" + }, + "arguments": [ + { + "name": "p_base", + "type": "GDExtensionTypePtr" + }, + { + "name": "p_key", + "type": "GDExtensionConstTypePtr" + }, + { + "name": "p_value", + "type": "GDExtensionConstTypePtr" + } + ] + }, + { + "name": "GDExtensionPtrKeyedGetter", + "kind": "function", + "return_value": { + "type": "void" + }, + "arguments": [ + { + "name": "p_base", + "type": "GDExtensionConstTypePtr" + }, + { + "name": "p_key", + "type": "GDExtensionConstTypePtr" + }, + { + "name": "r_value", + "type": "GDExtensionTypePtr" + } + ] + }, + { + "name": "GDExtensionPtrKeyedChecker", + "kind": "function", + "return_value": { + "type": "uint32_t" + }, + "arguments": [ + { + "name": "p_base", + "type": "GDExtensionConstVariantPtr" + }, + { + "name": "p_key", + "type": "GDExtensionConstVariantPtr" + } + ] + }, + { + "name": "GDExtensionPtrUtilityFunction", + "kind": "function", + "return_value": { + "type": "void" + }, + "arguments": [ + { + "name": "r_return", + "type": "GDExtensionTypePtr" + }, + { + "name": "p_args", + "type": "const GDExtensionConstTypePtr*" + }, + { + "name": "p_argument_count", + "type": "int" + } + ] + }, + { + "name": "GDExtensionClassConstructor", + "kind": "function", + "return_value": { + "type": "GDExtensionObjectPtr" + }, + "arguments": [] + }, + { + "name": "GDExtensionInstanceBindingCreateCallback", + "kind": "function", + "return_value": { + "type": "void*" + }, + "arguments": [ + { + "name": "p_token", + "type": "void*" + }, + { + "name": "p_instance", + "type": "void*" + } + ] + }, + { + "name": "GDExtensionInstanceBindingFreeCallback", + "kind": "function", + "return_value": { + "type": "void" + }, + "arguments": [ + { + "name": "p_token", + "type": "void*" + }, + { + "name": "p_instance", + "type": "void*" + }, + { + "name": "p_binding", + "type": "void*" + } + ] + }, + { + "name": "GDExtensionInstanceBindingReferenceCallback", + "kind": "function", + "return_value": { + "type": "GDExtensionBool" + }, + "arguments": [ + { + "name": "p_token", + "type": "void*" + }, + { + "name": "p_binding", + "type": "void*" + }, + { + "name": "p_reference", + "type": "GDExtensionBool" + } + ] + }, + { + "name": "GDExtensionInstanceBindingCallbacks", + "kind": "struct", + "members": [ + { + "name": "create_callback", + "type": "GDExtensionInstanceBindingCreateCallback" + }, + { + "name": "free_callback", + "type": "GDExtensionInstanceBindingFreeCallback" + }, + { + "name": "reference_callback", + "type": "GDExtensionInstanceBindingReferenceCallback" + } + ] + }, + { + "name": "GDExtensionClassInstancePtr", + "kind": "handle" + }, + { + "name": "GDExtensionClassSet", + "kind": "function", + "return_value": { + "type": "GDExtensionBool" + }, + "arguments": [ + { + "name": "p_instance", + "type": "GDExtensionClassInstancePtr" + }, + { + "name": "p_name", + "type": "GDExtensionConstStringNamePtr" + }, + { + "name": "p_value", + "type": "GDExtensionConstVariantPtr" + } + ] + }, + { + "name": "GDExtensionClassGet", + "kind": "function", + "return_value": { + "type": "GDExtensionBool" + }, + "arguments": [ + { + "name": "p_instance", + "type": "GDExtensionClassInstancePtr" + }, + { + "name": "p_name", + "type": "GDExtensionConstStringNamePtr" + }, + { + "name": "r_ret", + "type": "GDExtensionVariantPtr" + } + ] + }, + { + "name": "GDExtensionClassGetRID", + "kind": "function", + "return_value": { + "type": "uint64_t" + }, + "arguments": [ + { + "name": "p_instance", + "type": "GDExtensionClassInstancePtr" + } + ] + }, + { + "name": "GDExtensionPropertyInfo", + "kind": "struct", + "members": [ + { + "name": "type", + "type": "GDExtensionVariantType" + }, + { + "name": "name", + "type": "GDExtensionStringNamePtr" + }, + { + "name": "class_name", + "type": "GDExtensionStringNamePtr" + }, + { + "name": "hint", + "type": "uint32_t", + "description": [ + "Bitfield of `PropertyHint` (defined in `extension_api.json`)." + ] + }, + { + "name": "hint_string", + "type": "GDExtensionStringPtr" + }, + { + "name": "usage", + "type": "uint32_t", + "description": [ + "Bitfield of `PropertyUsageFlags` (defined in `extension_api.json`)." + ] + } + ] + }, + { + "name": "GDExtensionMethodInfo", + "kind": "struct", + "members": [ + { + "name": "name", + "type": "GDExtensionStringNamePtr" + }, + { + "name": "return_value", + "type": "GDExtensionPropertyInfo" + }, + { + "name": "flags", + "type": "uint32_t", + "description": [ + "Bitfield of `GDExtensionClassMethodFlags`." + ] + }, + { + "name": "id", + "type": "int32_t" + }, + { + "name": "argument_count", + "type": "uint32_t", + "description": [ + "Arguments: `default_arguments` is an array of size `argument_count`." + ] + }, + { + "name": "arguments", + "type": "GDExtensionPropertyInfo*" + }, + { + "name": "default_argument_count", + "type": "uint32_t", + "description": [ + "Default arguments: `default_arguments` is an array of size `default_argument_count`." + ] + }, + { + "name": "default_arguments", + "type": "GDExtensionVariantPtr*" + } + ] + }, + { + "name": "GDExtensionClassGetPropertyList", + "kind": "function", + "return_value": { + "type": "const GDExtensionPropertyInfo*" + }, + "arguments": [ + { + "name": "p_instance", + "type": "GDExtensionClassInstancePtr" + }, + { + "name": "r_count", + "type": "uint32_t*" + } + ] + }, + { + "name": "GDExtensionClassFreePropertyList", + "kind": "function", + "return_value": { + "type": "void" + }, + "arguments": [ + { + "name": "p_instance", + "type": "GDExtensionClassInstancePtr" + }, + { + "name": "p_list", + "type": "const GDExtensionPropertyInfo*" + } + ] + }, + { + "name": "GDExtensionClassFreePropertyList2", + "kind": "function", + "return_value": { + "type": "void" + }, + "arguments": [ + { + "name": "p_instance", + "type": "GDExtensionClassInstancePtr" + }, + { + "name": "p_list", + "type": "const GDExtensionPropertyInfo*" + }, + { + "name": "p_count", + "type": "uint32_t" + } + ] + }, + { + "name": "GDExtensionClassPropertyCanRevert", + "kind": "function", + "return_value": { + "type": "GDExtensionBool" + }, + "arguments": [ + { + "name": "p_instance", + "type": "GDExtensionClassInstancePtr" + }, + { + "name": "p_name", + "type": "GDExtensionConstStringNamePtr" + } + ] + }, + { + "name": "GDExtensionClassPropertyGetRevert", + "kind": "function", + "return_value": { + "type": "GDExtensionBool" + }, + "arguments": [ + { + "name": "p_instance", + "type": "GDExtensionClassInstancePtr" + }, + { + "name": "p_name", + "type": "GDExtensionConstStringNamePtr" + }, + { + "name": "r_ret", + "type": "GDExtensionVariantPtr" + } + ] + }, + { + "name": "GDExtensionClassValidateProperty", + "kind": "function", + "return_value": { + "type": "GDExtensionBool" + }, + "arguments": [ + { + "name": "p_instance", + "type": "GDExtensionClassInstancePtr" + }, + { + "name": "p_property", + "type": "GDExtensionPropertyInfo*" + } + ] + }, + { + "name": "GDExtensionClassNotification", + "kind": "function", + "return_value": { + "type": "void" + }, + "arguments": [ + { + "name": "p_instance", + "type": "GDExtensionClassInstancePtr" + }, + { + "name": "p_what", + "type": "int32_t" + } + ], + "deprecated": "Deprecated. Use GDExtensionClassNotification2 instead." + }, + { + "name": "GDExtensionClassNotification2", + "kind": "function", + "return_value": { + "type": "void" + }, + "arguments": [ + { + "name": "p_instance", + "type": "GDExtensionClassInstancePtr" + }, + { + "name": "p_what", + "type": "int32_t" + }, + { + "name": "p_reversed", + "type": "GDExtensionBool" + } + ] + }, + { + "name": "GDExtensionClassToString", + "kind": "function", + "return_value": { + "type": "void" + }, + "arguments": [ + { + "name": "p_instance", + "type": "GDExtensionClassInstancePtr" + }, + { + "name": "r_is_valid", + "type": "GDExtensionBool*" + }, + { + "name": "p_out", + "type": "GDExtensionStringPtr" + } + ] + }, + { + "name": "GDExtensionClassReference", + "kind": "function", + "return_value": { + "type": "void" + }, + "arguments": [ + { + "name": "p_instance", + "type": "GDExtensionClassInstancePtr" + } + ] + }, + { + "name": "GDExtensionClassUnreference", + "kind": "function", + "return_value": { + "type": "void" + }, + "arguments": [ + { + "name": "p_instance", + "type": "GDExtensionClassInstancePtr" + } + ] + }, + { + "name": "GDExtensionClassCallVirtual", + "kind": "function", + "return_value": { + "type": "void" + }, + "arguments": [ + { + "name": "p_instance", + "type": "GDExtensionClassInstancePtr" + }, + { + "name": "p_args", + "type": "const GDExtensionConstTypePtr*" + }, + { + "name": "r_ret", + "type": "GDExtensionTypePtr" + } + ] + }, + { + "name": "GDExtensionClassCreateInstance", + "kind": "function", + "return_value": { + "type": "GDExtensionObjectPtr" + }, + "arguments": [ + { + "name": "p_class_userdata", + "type": "void*" + } + ] + }, + { + "name": "GDExtensionClassCreateInstance2", + "kind": "function", + "return_value": { + "type": "GDExtensionObjectPtr" + }, + "arguments": [ + { + "name": "p_class_userdata", + "type": "void*" + }, + { + "name": "p_notify_postinitialize", + "type": "GDExtensionBool" + } + ] + }, + { + "name": "GDExtensionClassFreeInstance", + "kind": "function", + "return_value": { + "type": "void" + }, + "arguments": [ + { + "name": "p_class_userdata", + "type": "void*" + }, + { + "name": "p_instance", + "type": "GDExtensionClassInstancePtr" + } + ] + }, + { + "name": "GDExtensionClassRecreateInstance", + "kind": "function", + "return_value": { + "type": "GDExtensionClassInstancePtr" + }, + "arguments": [ + { + "name": "p_class_userdata", + "type": "void*" + }, + { + "name": "p_object", + "type": "GDExtensionObjectPtr" + } + ] + }, + { + "name": "GDExtensionClassGetVirtual", + "kind": "function", + "return_value": { + "type": "GDExtensionClassCallVirtual" + }, + "arguments": [ + { + "name": "p_class_userdata", + "type": "void*" + }, + { + "name": "p_name", + "type": "GDExtensionConstStringNamePtr" + } + ] + }, + { + "name": "GDExtensionClassGetVirtual2", + "kind": "function", + "return_value": { + "type": "GDExtensionClassCallVirtual" + }, + "arguments": [ + { + "name": "p_class_userdata", + "type": "void*" + }, + { + "name": "p_name", + "type": "GDExtensionConstStringNamePtr" + }, + { + "name": "p_hash", + "type": "uint32_t" + } + ] + }, + { + "name": "GDExtensionClassGetVirtualCallData", + "kind": "function", + "return_value": { + "type": "void*" + }, + "arguments": [ + { + "name": "p_class_userdata", + "type": "void*" + }, + { + "name": "p_name", + "type": "GDExtensionConstStringNamePtr" + } + ] + }, + { + "name": "GDExtensionClassGetVirtualCallData2", + "kind": "function", + "return_value": { + "type": "void*" + }, + "arguments": [ + { + "name": "p_class_userdata", + "type": "void*" + }, + { + "name": "p_name", + "type": "GDExtensionConstStringNamePtr" + }, + { + "name": "p_hash", + "type": "uint32_t" + } + ] + }, + { + "name": "GDExtensionClassCallVirtualWithData", + "kind": "function", + "return_value": { + "type": "void" + }, + "arguments": [ + { + "name": "p_instance", + "type": "GDExtensionClassInstancePtr" + }, + { + "name": "p_name", + "type": "GDExtensionConstStringNamePtr" + }, + { + "name": "p_virtual_call_userdata", + "type": "void*" + }, + { + "name": "p_args", + "type": "const GDExtensionConstTypePtr*" + }, + { + "name": "r_ret", + "type": "GDExtensionTypePtr" + } + ] + }, + { + "name": "GDExtensionClassCreationInfo", + "kind": "struct", + "members": [ + { + "name": "is_virtual", + "type": "GDExtensionBool" + }, + { + "name": "is_abstract", + "type": "GDExtensionBool" + }, + { + "name": "set_func", + "type": "GDExtensionClassSet" + }, + { + "name": "get_func", + "type": "GDExtensionClassGet" + }, + { + "name": "get_property_list_func", + "type": "GDExtensionClassGetPropertyList" + }, + { + "name": "free_property_list_func", + "type": "GDExtensionClassFreePropertyList" + }, + { + "name": "property_can_revert_func", + "type": "GDExtensionClassPropertyCanRevert" + }, + { + "name": "property_get_revert_func", + "type": "GDExtensionClassPropertyGetRevert" + }, + { + "name": "notification_func", + "type": "GDExtensionClassNotification" + }, + { + "name": "to_string_func", + "type": "GDExtensionClassToString" + }, + { + "name": "reference_func", + "type": "GDExtensionClassReference" + }, + { + "name": "unreference_func", + "type": "GDExtensionClassUnreference" + }, + { + "name": "create_instance_func", + "type": "GDExtensionClassCreateInstance", + "description": [ + "(Default) constructor; mandatory. If the class is not instantiable, consider making it virtual or abstract." + ] + }, + { + "name": "free_instance_func", + "type": "GDExtensionClassFreeInstance", + "description": [ + "Destructor; mandatory." + ] + }, + { + "name": "get_virtual_func", + "type": "GDExtensionClassGetVirtual", + "description": [ + "Queries a virtual function by name and returns a callback to invoke the requested virtual function." + ] + }, + { + "name": "get_rid_func", + "type": "GDExtensionClassGetRID" + }, + { + "name": "class_userdata", + "type": "void*", + "description": [ + "Per-class user data, later accessible in instance bindings." + ] + } + ], + "deprecated": "Deprecated. Use GDExtensionClassCreationInfo4 instead." + }, + { + "name": "GDExtensionClassCreationInfo2", + "kind": "struct", + "members": [ + { + "name": "is_virtual", + "type": "GDExtensionBool" + }, + { + "name": "is_abstract", + "type": "GDExtensionBool" + }, + { + "name": "is_exposed", + "type": "GDExtensionBool" + }, + { + "name": "set_func", + "type": "GDExtensionClassSet" + }, + { + "name": "get_func", + "type": "GDExtensionClassGet" + }, + { + "name": "get_property_list_func", + "type": "GDExtensionClassGetPropertyList" + }, + { + "name": "free_property_list_func", + "type": "GDExtensionClassFreePropertyList" + }, + { + "name": "property_can_revert_func", + "type": "GDExtensionClassPropertyCanRevert" + }, + { + "name": "property_get_revert_func", + "type": "GDExtensionClassPropertyGetRevert" + }, + { + "name": "validate_property_func", + "type": "GDExtensionClassValidateProperty" + }, + { + "name": "notification_func", + "type": "GDExtensionClassNotification2" + }, + { + "name": "to_string_func", + "type": "GDExtensionClassToString" + }, + { + "name": "reference_func", + "type": "GDExtensionClassReference" + }, + { + "name": "unreference_func", + "type": "GDExtensionClassUnreference" + }, + { + "name": "create_instance_func", + "type": "GDExtensionClassCreateInstance", + "description": [ + "(Default) constructor; mandatory. If the class is not instantiable, consider making it virtual or abstract." + ] + }, + { + "name": "free_instance_func", + "type": "GDExtensionClassFreeInstance", + "description": [ + "Destructor; mandatory." + ] + }, + { + "name": "recreate_instance_func", + "type": "GDExtensionClassRecreateInstance" + }, + { + "name": "get_virtual_func", + "type": "GDExtensionClassGetVirtual", + "description": [ + "Queries a virtual function by name and returns a callback to invoke the requested virtual function." + ] + }, + { + "name": "get_virtual_call_data_func", + "type": "GDExtensionClassGetVirtualCallData", + "description": [ + "Paired with `call_virtual_with_data_func`, this is an alternative to `get_virtual_func` for extensions that", + "need or benefit from extra data when calling virtual functions.", + "Returns user data that will be passed to `call_virtual_with_data_func`.", + "Returning `NULL` from this function signals to Godot that the virtual function is not overridden.", + "Data returned from this function should be managed by the extension and must be valid until the extension is deinitialized.", + "You should supply either `get_virtual_func`, or `get_virtual_call_data_func` with `call_virtual_with_data_func`." + ] + }, + { + "name": "call_virtual_with_data_func", + "type": "GDExtensionClassCallVirtualWithData", + "description": [ + "Used to call virtual functions when `get_virtual_call_data_func` is not null." + ] + }, + { + "name": "get_rid_func", + "type": "GDExtensionClassGetRID" + }, + { + "name": "class_userdata", + "type": "void*", + "description": [ + "Per-class user data, later accessible in instance bindings." + ] + } + ], + "deprecated": "Deprecated. Use GDExtensionClassCreationInfo4 instead." + }, + { + "name": "GDExtensionClassCreationInfo3", + "kind": "struct", + "members": [ + { + "name": "is_virtual", + "type": "GDExtensionBool" + }, + { + "name": "is_abstract", + "type": "GDExtensionBool" + }, + { + "name": "is_exposed", + "type": "GDExtensionBool" + }, + { + "name": "is_runtime", + "type": "GDExtensionBool" + }, + { + "name": "set_func", + "type": "GDExtensionClassSet" + }, + { + "name": "get_func", + "type": "GDExtensionClassGet" + }, + { + "name": "get_property_list_func", + "type": "GDExtensionClassGetPropertyList" + }, + { + "name": "free_property_list_func", + "type": "GDExtensionClassFreePropertyList2" + }, + { + "name": "property_can_revert_func", + "type": "GDExtensionClassPropertyCanRevert" + }, + { + "name": "property_get_revert_func", + "type": "GDExtensionClassPropertyGetRevert" + }, + { + "name": "validate_property_func", + "type": "GDExtensionClassValidateProperty" + }, + { + "name": "notification_func", + "type": "GDExtensionClassNotification2" + }, + { + "name": "to_string_func", + "type": "GDExtensionClassToString" + }, + { + "name": "reference_func", + "type": "GDExtensionClassReference" + }, + { + "name": "unreference_func", + "type": "GDExtensionClassUnreference" + }, + { + "name": "create_instance_func", + "type": "GDExtensionClassCreateInstance", + "description": [ + "(Default) constructor; mandatory. If the class is not instantiable, consider making it virtual or abstract." + ] + }, + { + "name": "free_instance_func", + "type": "GDExtensionClassFreeInstance", + "description": [ + "Destructor; mandatory." + ] + }, + { + "name": "recreate_instance_func", + "type": "GDExtensionClassRecreateInstance" + }, + { + "name": "get_virtual_func", + "type": "GDExtensionClassGetVirtual", + "description": [ + "Queries a virtual function by name and returns a callback to invoke the requested virtual function." + ] + }, + { + "name": "get_virtual_call_data_func", + "type": "GDExtensionClassGetVirtualCallData", + "description": [ + "Paired with `call_virtual_with_data_func`, this is an alternative to `get_virtual_func` for extensions that", + "need or benefit from extra data when calling virtual functions.", + "Returns user data that will be passed to `call_virtual_with_data_func`.", + "Returning `NULL` from this function signals to Godot that the virtual function is not overridden.", + "Data returned from this function should be managed by the extension and must be valid until the extension is deinitialized.", + "You should supply either `get_virtual_func`, or `get_virtual_call_data_func` with `call_virtual_with_data_func`." + ] + }, + { + "name": "call_virtual_with_data_func", + "type": "GDExtensionClassCallVirtualWithData", + "description": [ + "Used to call virtual functions when `get_virtual_call_data_func` is not null." + ] + }, + { + "name": "get_rid_func", + "type": "GDExtensionClassGetRID" + }, + { + "name": "class_userdata", + "type": "void*", + "description": [ + "Per-class user data, later accessible in instance bindings." + ] + } + ], + "deprecated": "Deprecated. Use GDExtensionClassCreationInfo4 instead." + }, + { + "name": "GDExtensionClassCreationInfo4", + "kind": "struct", + "members": [ + { + "name": "is_virtual", + "type": "GDExtensionBool" + }, + { + "name": "is_abstract", + "type": "GDExtensionBool" + }, + { + "name": "is_exposed", + "type": "GDExtensionBool" + }, + { + "name": "is_runtime", + "type": "GDExtensionBool" + }, + { + "name": "icon_path", + "type": "GDExtensionConstStringPtr" + }, + { + "name": "set_func", + "type": "GDExtensionClassSet" + }, + { + "name": "get_func", + "type": "GDExtensionClassGet" + }, + { + "name": "get_property_list_func", + "type": "GDExtensionClassGetPropertyList" + }, + { + "name": "free_property_list_func", + "type": "GDExtensionClassFreePropertyList2" + }, + { + "name": "property_can_revert_func", + "type": "GDExtensionClassPropertyCanRevert" + }, + { + "name": "property_get_revert_func", + "type": "GDExtensionClassPropertyGetRevert" + }, + { + "name": "validate_property_func", + "type": "GDExtensionClassValidateProperty" + }, + { + "name": "notification_func", + "type": "GDExtensionClassNotification2" + }, + { + "name": "to_string_func", + "type": "GDExtensionClassToString" + }, + { + "name": "reference_func", + "type": "GDExtensionClassReference" + }, + { + "name": "unreference_func", + "type": "GDExtensionClassUnreference" + }, + { + "name": "create_instance_func", + "type": "GDExtensionClassCreateInstance2", + "description": [ + "(Default) constructor; mandatory. If the class is not instantiable, consider making it virtual or abstract." + ] + }, + { + "name": "free_instance_func", + "type": "GDExtensionClassFreeInstance", + "description": [ + "Destructor; mandatory." + ] + }, + { + "name": "recreate_instance_func", + "type": "GDExtensionClassRecreateInstance" + }, + { + "name": "get_virtual_func", + "type": "GDExtensionClassGetVirtual2", + "description": [ + "Queries a virtual function by name and returns a callback to invoke the requested virtual function." + ] + }, + { + "name": "get_virtual_call_data_func", + "type": "GDExtensionClassGetVirtualCallData2", + "description": [ + "Paired with `call_virtual_with_data_func`, this is an alternative to `get_virtual_func` for extensions that", + "need or benefit from extra data when calling virtual functions.", + "Returns user data that will be passed to `call_virtual_with_data_func`.", + "Returning `NULL` from this function signals to Godot that the virtual function is not overridden.", + "Data returned from this function should be managed by the extension and must be valid until the extension is deinitialized.", + "You should supply either `get_virtual_func`, or `get_virtual_call_data_func` with `call_virtual_with_data_func`." + ] + }, + { + "name": "call_virtual_with_data_func", + "type": "GDExtensionClassCallVirtualWithData", + "description": [ + "Used to call virtual functions when `get_virtual_call_data_func` is not null." + ] + }, + { + "name": "class_userdata", + "type": "void*", + "description": [ + "Per-class user data, later accessible in instance bindings." + ] + } + ] + }, + { + "name": "GDExtensionClassCreationInfo5", + "kind": "alias", + "type": "GDExtensionClassCreationInfo4" + }, + { + "name": "GDExtensionClassLibraryPtr", + "kind": "handle" + }, + { + "name": "GDExtensionEditorGetClassesUsedCallback", + "kind": "function", + "return_value": { + "type": "void" + }, + "arguments": [ + { + "name": "p_packed_string_array", + "type": "GDExtensionTypePtr" + } + ], + "description": [ + "Passed a pointer to a PackedStringArray that should be filled with the classes that may be used by the GDExtension." + ] + }, + { + "name": "GDExtensionClassMethodFlags", + "kind": "enum", + "values": [ + { + "name": "GDEXTENSION_METHOD_FLAG_NORMAL", + "value": 1 + }, + { + "name": "GDEXTENSION_METHOD_FLAG_EDITOR", + "value": 2 + }, + { + "name": "GDEXTENSION_METHOD_FLAG_CONST", + "value": 4 + }, + { + "name": "GDEXTENSION_METHOD_FLAG_VIRTUAL", + "value": 8 + }, + { + "name": "GDEXTENSION_METHOD_FLAG_VARARG", + "value": 16 + }, + { + "name": "GDEXTENSION_METHOD_FLAG_STATIC", + "value": 32 + }, + { + "name": "GDEXTENSION_METHOD_FLAG_VIRTUAL_REQUIRED", + "value": 128 + }, + { + "name": "GDEXTENSION_METHOD_FLAGS_DEFAULT", + "value": 1 + } + ] + }, + { + "name": "GDExtensionClassMethodArgumentMetadata", + "kind": "enum", + "values": [ + { + "name": "GDEXTENSION_METHOD_ARGUMENT_METADATA_NONE", + "value": 0 + }, + { + "name": "GDEXTENSION_METHOD_ARGUMENT_METADATA_INT_IS_INT8", + "value": 1 + }, + { + "name": "GDEXTENSION_METHOD_ARGUMENT_METADATA_INT_IS_INT16", + "value": 2 + }, + { + "name": "GDEXTENSION_METHOD_ARGUMENT_METADATA_INT_IS_INT32", + "value": 3 + }, + { + "name": "GDEXTENSION_METHOD_ARGUMENT_METADATA_INT_IS_INT64", + "value": 4 + }, + { + "name": "GDEXTENSION_METHOD_ARGUMENT_METADATA_INT_IS_UINT8", + "value": 5 + }, + { + "name": "GDEXTENSION_METHOD_ARGUMENT_METADATA_INT_IS_UINT16", + "value": 6 + }, + { + "name": "GDEXTENSION_METHOD_ARGUMENT_METADATA_INT_IS_UINT32", + "value": 7 + }, + { + "name": "GDEXTENSION_METHOD_ARGUMENT_METADATA_INT_IS_UINT64", + "value": 8 + }, + { + "name": "GDEXTENSION_METHOD_ARGUMENT_METADATA_REAL_IS_FLOAT", + "value": 9 + }, + { + "name": "GDEXTENSION_METHOD_ARGUMENT_METADATA_REAL_IS_DOUBLE", + "value": 10 + }, + { + "name": "GDEXTENSION_METHOD_ARGUMENT_METADATA_INT_IS_CHAR16", + "value": 11 + }, + { + "name": "GDEXTENSION_METHOD_ARGUMENT_METADATA_INT_IS_CHAR32", + "value": 12 + } + ] + }, + { + "name": "GDExtensionClassMethodCall", + "kind": "function", + "return_value": { + "type": "void" + }, + "arguments": [ + { + "name": "method_userdata", + "type": "void*" + }, + { + "name": "p_instance", + "type": "GDExtensionClassInstancePtr" + }, + { + "name": "p_args", + "type": "const GDExtensionConstVariantPtr*" + }, + { + "name": "p_argument_count", + "type": "GDExtensionInt" + }, + { + "name": "r_return", + "type": "GDExtensionVariantPtr" + }, + { + "name": "r_error", + "type": "GDExtensionCallError*" + } + ] + }, + { + "name": "GDExtensionClassMethodValidatedCall", + "kind": "function", + "return_value": { + "type": "void" + }, + "arguments": [ + { + "name": "method_userdata", + "type": "void*" + }, + { + "name": "p_instance", + "type": "GDExtensionClassInstancePtr" + }, + { + "name": "p_args", + "type": "const GDExtensionConstVariantPtr*" + }, + { + "name": "r_return", + "type": "GDExtensionVariantPtr" + } + ] + }, + { + "name": "GDExtensionClassMethodPtrCall", + "kind": "function", + "return_value": { + "type": "void" + }, + "arguments": [ + { + "name": "method_userdata", + "type": "void*" + }, + { + "name": "p_instance", + "type": "GDExtensionClassInstancePtr" + }, + { + "name": "p_args", + "type": "const GDExtensionConstTypePtr*" + }, + { + "name": "r_ret", + "type": "GDExtensionTypePtr" + } + ] + }, + { + "name": "GDExtensionClassMethodInfo", + "kind": "struct", + "members": [ + { + "name": "name", + "type": "GDExtensionStringNamePtr" + }, + { + "name": "method_userdata", + "type": "void*" + }, + { + "name": "call_func", + "type": "GDExtensionClassMethodCall" + }, + { + "name": "ptrcall_func", + "type": "GDExtensionClassMethodPtrCall" + }, + { + "name": "method_flags", + "type": "uint32_t", + "description": [ + "Bitfield of `GDExtensionClassMethodFlags`." + ] + }, + { + "name": "has_return_value", + "type": "GDExtensionBool", + "description": [ + "If `has_return_value` is false, `return_value_info` and `return_value_metadata` are ignored.", + "", + "@todo Consider dropping `has_return_value` and making the other two properties match `GDExtensionMethodInfo` and `GDExtensionClassVirtualMethod` for consistency in future version of this struct." + ] + }, + { + "name": "return_value_info", + "type": "GDExtensionPropertyInfo*" + }, + { + "name": "return_value_metadata", + "type": "GDExtensionClassMethodArgumentMetadata" + }, + { + "name": "argument_count", + "type": "uint32_t", + "description": [ + "Arguments: `arguments_info` and `arguments_metadata` are array of size `argument_count`.", + "Name and hint information for the argument can be omitted in release builds. Class name should always be present if it applies.", + "", + "@todo Consider renaming `arguments_info` to `arguments` for consistency in future version of this struct." + ] + }, + { + "name": "arguments_info", + "type": "GDExtensionPropertyInfo*" + }, + { + "name": "arguments_metadata", + "type": "GDExtensionClassMethodArgumentMetadata*" + }, + { + "name": "default_argument_count", + "type": "uint32_t", + "description": [ + "Default arguments: `default_arguments` is an array of size `default_argument_count`." + ] + }, + { + "name": "default_arguments", + "type": "GDExtensionVariantPtr*" + } + ] + }, + { + "name": "GDExtensionClassVirtualMethodInfo", + "kind": "struct", + "members": [ + { + "name": "name", + "type": "GDExtensionStringNamePtr" + }, + { + "name": "method_flags", + "type": "uint32_t", + "description": [ + "Bitfield of `GDExtensionClassMethodFlags`." + ] + }, + { + "name": "return_value", + "type": "GDExtensionPropertyInfo" + }, + { + "name": "return_value_metadata", + "type": "GDExtensionClassMethodArgumentMetadata" + }, + { + "name": "argument_count", + "type": "uint32_t" + }, + { + "name": "arguments", + "type": "GDExtensionPropertyInfo*" + }, + { + "name": "arguments_metadata", + "type": "GDExtensionClassMethodArgumentMetadata*" + } + ] + }, + { + "name": "GDExtensionCallableCustomCall", + "kind": "function", + "return_value": { + "type": "void" + }, + "arguments": [ + { + "name": "callable_userdata", + "type": "void*" + }, + { + "name": "p_args", + "type": "const GDExtensionConstVariantPtr*" + }, + { + "name": "p_argument_count", + "type": "GDExtensionInt" + }, + { + "name": "r_return", + "type": "GDExtensionVariantPtr" + }, + { + "name": "r_error", + "type": "GDExtensionCallError*" + } + ] + }, + { + "name": "GDExtensionCallableCustomIsValid", + "kind": "function", + "return_value": { + "type": "GDExtensionBool" + }, + "arguments": [ + { + "name": "callable_userdata", + "type": "void*" + } + ] + }, + { + "name": "GDExtensionCallableCustomFree", + "kind": "function", + "return_value": { + "type": "void" + }, + "arguments": [ + { + "name": "callable_userdata", + "type": "void*" + } + ] + }, + { + "name": "GDExtensionCallableCustomHash", + "kind": "function", + "return_value": { + "type": "uint32_t" + }, + "arguments": [ + { + "name": "callable_userdata", + "type": "void*" + } + ] + }, + { + "name": "GDExtensionCallableCustomEqual", + "kind": "function", + "return_value": { + "type": "GDExtensionBool" + }, + "arguments": [ + { + "name": "callable_userdata_a", + "type": "void*" + }, + { + "name": "callable_userdata_b", + "type": "void*" + } + ] + }, + { + "name": "GDExtensionCallableCustomLessThan", + "kind": "function", + "return_value": { + "type": "GDExtensionBool" + }, + "arguments": [ + { + "name": "callable_userdata_a", + "type": "void*" + }, + { + "name": "callable_userdata_b", + "type": "void*" + } + ] + }, + { + "name": "GDExtensionCallableCustomToString", + "kind": "function", + "return_value": { + "type": "void" + }, + "arguments": [ + { + "name": "callable_userdata", + "type": "void*" + }, + { + "name": "r_is_valid", + "type": "GDExtensionBool*" + }, + { + "name": "r_out", + "type": "GDExtensionStringPtr" + } + ] + }, + { + "name": "GDExtensionCallableCustomGetArgumentCount", + "kind": "function", + "return_value": { + "type": "GDExtensionInt" + }, + "arguments": [ + { + "name": "callable_userdata", + "type": "void*" + }, + { + "name": "r_is_valid", + "type": "GDExtensionBool*" + } + ] + }, + { + "name": "GDExtensionCallableCustomInfo", + "kind": "struct", + "members": [ + { + "name": "callable_userdata", + "type": "void*" + }, + { + "name": "token", + "type": "void*" + }, + { + "name": "object_id", + "type": "GDObjectInstanceID" + }, + { + "name": "call_func", + "type": "GDExtensionCallableCustomCall" + }, + { + "name": "is_valid_func", + "type": "GDExtensionCallableCustomIsValid" + }, + { + "name": "free_func", + "type": "GDExtensionCallableCustomFree" + }, + { + "name": "hash_func", + "type": "GDExtensionCallableCustomHash" + }, + { + "name": "equal_func", + "type": "GDExtensionCallableCustomEqual" + }, + { + "name": "less_than_func", + "type": "GDExtensionCallableCustomLessThan" + }, + { + "name": "to_string_func", + "type": "GDExtensionCallableCustomToString" + } + ], + "description": [ + "Only `call_func` and `token` are strictly required, however, `object_id` should be passed if its not a static method.", + "", + "`token` should point to an address that uniquely identifies the GDExtension (for example, the", + "`GDExtensionClassLibraryPtr` passed to the entry symbol function.", + "", + "`hash_func`, `equal_func`, and `less_than_func` are optional. If not provided both `call_func` and", + "`callable_userdata` together are used as the identity of the callable for hashing and comparison purposes.", + "", + "The hash returned by `hash_func` is cached, `hash_func` will not be called more than once per callable.", + "", + "`is_valid_func` is necessary if the validity of the callable can change before destruction.", + "", + "`free_func` is necessary if `callable_userdata` needs to be cleaned up when the callable is freed." + ], + "deprecated": "Deprecated. Use GDExtensionCallableCustomInfo2 instead." + }, + { + "name": "GDExtensionCallableCustomInfo2", + "kind": "struct", + "members": [ + { + "name": "callable_userdata", + "type": "void*" + }, + { + "name": "token", + "type": "void*" + }, + { + "name": "object_id", + "type": "GDObjectInstanceID" + }, + { + "name": "call_func", + "type": "GDExtensionCallableCustomCall" + }, + { + "name": "is_valid_func", + "type": "GDExtensionCallableCustomIsValid" + }, + { + "name": "free_func", + "type": "GDExtensionCallableCustomFree" + }, + { + "name": "hash_func", + "type": "GDExtensionCallableCustomHash" + }, + { + "name": "equal_func", + "type": "GDExtensionCallableCustomEqual" + }, + { + "name": "less_than_func", + "type": "GDExtensionCallableCustomLessThan" + }, + { + "name": "to_string_func", + "type": "GDExtensionCallableCustomToString" + }, + { + "name": "get_argument_count_func", + "type": "GDExtensionCallableCustomGetArgumentCount" + } + ], + "description": [ + "Only `call_func` and `token` are strictly required, however, `object_id` should be passed if its not a static method.", + "", + "`token` should point to an address that uniquely identifies the GDExtension (for example, the", + "`GDExtensionClassLibraryPtr` passed to the entry symbol function.", + "", + "`hash_func`, `equal_func`, and `less_than_func` are optional. If not provided both `call_func` and", + "`callable_userdata` together are used as the identity of the callable for hashing and comparison purposes.", + "", + "The hash returned by `hash_func` is cached, `hash_func` will not be called more than once per callable.", + "", + "`is_valid_func` is necessary if the validity of the callable can change before destruction.", + "", + "`free_func` is necessary if `callable_userdata` needs to be cleaned up when the callable is freed." + ] + }, + { + "name": "GDExtensionScriptInstanceDataPtr", + "kind": "handle", + "description": [ + "Pointer to custom ScriptInstance native implementation." + ] + }, + { + "name": "GDExtensionScriptInstanceSet", + "kind": "function", + "return_value": { + "type": "GDExtensionBool" + }, + "arguments": [ + { + "name": "p_instance", + "type": "GDExtensionScriptInstanceDataPtr" + }, + { + "name": "p_name", + "type": "GDExtensionConstStringNamePtr" + }, + { + "name": "p_value", + "type": "GDExtensionConstVariantPtr" + } + ] + }, + { + "name": "GDExtensionScriptInstanceGet", + "kind": "function", + "return_value": { + "type": "GDExtensionBool" + }, + "arguments": [ + { + "name": "p_instance", + "type": "GDExtensionScriptInstanceDataPtr" + }, + { + "name": "p_name", + "type": "GDExtensionConstStringNamePtr" + }, + { + "name": "r_ret", + "type": "GDExtensionVariantPtr" + } + ] + }, + { + "name": "GDExtensionScriptInstanceGetPropertyList", + "kind": "function", + "return_value": { + "type": "const GDExtensionPropertyInfo*" + }, + "arguments": [ + { + "name": "p_instance", + "type": "GDExtensionScriptInstanceDataPtr" + }, + { + "name": "r_count", + "type": "uint32_t*" + } + ] + }, + { + "name": "GDExtensionScriptInstanceFreePropertyList", + "kind": "function", + "return_value": { + "type": "void" + }, + "arguments": [ + { + "name": "p_instance", + "type": "GDExtensionScriptInstanceDataPtr" + }, + { + "name": "p_list", + "type": "const GDExtensionPropertyInfo*" + } + ], + "deprecated": "Deprecated. Use GDExtensionScriptInstanceFreePropertyList2 instead." + }, + { + "name": "GDExtensionScriptInstanceFreePropertyList2", + "kind": "function", + "return_value": { + "type": "void" + }, + "arguments": [ + { + "name": "p_instance", + "type": "GDExtensionScriptInstanceDataPtr" + }, + { + "name": "p_list", + "type": "const GDExtensionPropertyInfo*" + }, + { + "name": "p_count", + "type": "uint32_t" + } + ] + }, + { + "name": "GDExtensionScriptInstanceGetClassCategory", + "kind": "function", + "return_value": { + "type": "GDExtensionBool" + }, + "arguments": [ + { + "name": "p_instance", + "type": "GDExtensionScriptInstanceDataPtr" + }, + { + "name": "p_class_category", + "type": "GDExtensionPropertyInfo*" + } + ] + }, + { + "name": "GDExtensionScriptInstanceGetPropertyType", + "kind": "function", + "return_value": { + "type": "GDExtensionVariantType" + }, + "arguments": [ + { + "name": "p_instance", + "type": "GDExtensionScriptInstanceDataPtr" + }, + { + "name": "p_name", + "type": "GDExtensionConstStringNamePtr" + }, + { + "name": "r_is_valid", + "type": "GDExtensionBool*" + } + ] + }, + { + "name": "GDExtensionScriptInstanceValidateProperty", + "kind": "function", + "return_value": { + "type": "GDExtensionBool" + }, + "arguments": [ + { + "name": "p_instance", + "type": "GDExtensionScriptInstanceDataPtr" + }, + { + "name": "p_property", + "type": "GDExtensionPropertyInfo*" + } + ] + }, + { + "name": "GDExtensionScriptInstancePropertyCanRevert", + "kind": "function", + "return_value": { + "type": "GDExtensionBool" + }, + "arguments": [ + { + "name": "p_instance", + "type": "GDExtensionScriptInstanceDataPtr" + }, + { + "name": "p_name", + "type": "GDExtensionConstStringNamePtr" + } + ] + }, + { + "name": "GDExtensionScriptInstancePropertyGetRevert", + "kind": "function", + "return_value": { + "type": "GDExtensionBool" + }, + "arguments": [ + { + "name": "p_instance", + "type": "GDExtensionScriptInstanceDataPtr" + }, + { + "name": "p_name", + "type": "GDExtensionConstStringNamePtr" + }, + { + "name": "r_ret", + "type": "GDExtensionVariantPtr" + } + ] + }, + { + "name": "GDExtensionScriptInstanceGetOwner", + "kind": "function", + "return_value": { + "type": "GDExtensionObjectPtr" + }, + "arguments": [ + { + "name": "p_instance", + "type": "GDExtensionScriptInstanceDataPtr" + } + ] + }, + { + "name": "GDExtensionScriptInstancePropertyStateAdd", + "kind": "function", + "return_value": { + "type": "void" + }, + "arguments": [ + { + "name": "p_name", + "type": "GDExtensionConstStringNamePtr" + }, + { + "name": "p_value", + "type": "GDExtensionConstVariantPtr" + }, + { + "name": "p_userdata", + "type": "void*" + } + ] + }, + { + "name": "GDExtensionScriptInstanceGetPropertyState", + "kind": "function", + "return_value": { + "type": "void" + }, + "arguments": [ + { + "name": "p_instance", + "type": "GDExtensionScriptInstanceDataPtr" + }, + { + "name": "p_add_func", + "type": "GDExtensionScriptInstancePropertyStateAdd" + }, + { + "name": "p_userdata", + "type": "void*" + } + ] + }, + { + "name": "GDExtensionScriptInstanceGetMethodList", + "kind": "function", + "return_value": { + "type": "const GDExtensionMethodInfo*" + }, + "arguments": [ + { + "name": "p_instance", + "type": "GDExtensionScriptInstanceDataPtr" + }, + { + "name": "r_count", + "type": "uint32_t*" + } + ] + }, + { + "name": "GDExtensionScriptInstanceFreeMethodList", + "kind": "function", + "return_value": { + "type": "void" + }, + "arguments": [ + { + "name": "p_instance", + "type": "GDExtensionScriptInstanceDataPtr" + }, + { + "name": "p_list", + "type": "const GDExtensionMethodInfo*" + } + ], + "deprecated": "Deprecated. Use GDExtensionScriptInstanceFreeMethodList2 instead." + }, + { + "name": "GDExtensionScriptInstanceFreeMethodList2", + "kind": "function", + "return_value": { + "type": "void" + }, + "arguments": [ + { + "name": "p_instance", + "type": "GDExtensionScriptInstanceDataPtr" + }, + { + "name": "p_list", + "type": "const GDExtensionMethodInfo*" + }, + { + "name": "p_count", + "type": "uint32_t" + } + ] + }, + { + "name": "GDExtensionScriptInstanceHasMethod", + "kind": "function", + "return_value": { + "type": "GDExtensionBool" + }, + "arguments": [ + { + "name": "p_instance", + "type": "GDExtensionScriptInstanceDataPtr" + }, + { + "name": "p_name", + "type": "GDExtensionConstStringNamePtr" + } + ] + }, + { + "name": "GDExtensionScriptInstanceGetMethodArgumentCount", + "kind": "function", + "return_value": { + "type": "GDExtensionInt" + }, + "arguments": [ + { + "name": "p_instance", + "type": "GDExtensionScriptInstanceDataPtr" + }, + { + "name": "p_name", + "type": "GDExtensionConstStringNamePtr" + }, + { + "name": "r_is_valid", + "type": "GDExtensionBool*" + } + ] + }, + { + "name": "GDExtensionScriptInstanceCall", + "kind": "function", + "return_value": { + "type": "void" + }, + "arguments": [ + { + "name": "p_self", + "type": "GDExtensionScriptInstanceDataPtr" + }, + { + "name": "p_method", + "type": "GDExtensionConstStringNamePtr" + }, + { + "name": "p_args", + "type": "const GDExtensionConstVariantPtr*" + }, + { + "name": "p_argument_count", + "type": "GDExtensionInt" + }, + { + "name": "r_return", + "type": "GDExtensionVariantPtr" + }, + { + "name": "r_error", + "type": "GDExtensionCallError*" + } + ] + }, + { + "name": "GDExtensionScriptInstanceNotification", + "kind": "function", + "return_value": { + "type": "void" + }, + "arguments": [ + { + "name": "p_instance", + "type": "GDExtensionScriptInstanceDataPtr" + }, + { + "name": "p_what", + "type": "int32_t" + } + ], + "deprecated": "Deprecated. Use GDExtensionScriptInstanceNotification2 instead." + }, + { + "name": "GDExtensionScriptInstanceNotification2", + "kind": "function", + "return_value": { + "type": "void" + }, + "arguments": [ + { + "name": "p_instance", + "type": "GDExtensionScriptInstanceDataPtr" + }, + { + "name": "p_what", + "type": "int32_t" + }, + { + "name": "p_reversed", + "type": "GDExtensionBool" + } + ] + }, + { + "name": "GDExtensionScriptInstanceToString", + "kind": "function", + "return_value": { + "type": "void" + }, + "arguments": [ + { + "name": "p_instance", + "type": "GDExtensionScriptInstanceDataPtr" + }, + { + "name": "r_is_valid", + "type": "GDExtensionBool*" + }, + { + "name": "r_out", + "type": "GDExtensionStringPtr" + } + ] + }, + { + "name": "GDExtensionScriptInstanceRefCountIncremented", + "kind": "function", + "return_value": { + "type": "void" + }, + "arguments": [ + { + "name": "p_instance", + "type": "GDExtensionScriptInstanceDataPtr" + } + ] + }, + { + "name": "GDExtensionScriptInstanceRefCountDecremented", + "kind": "function", + "return_value": { + "type": "GDExtensionBool" + }, + "arguments": [ + { + "name": "p_instance", + "type": "GDExtensionScriptInstanceDataPtr" + } + ] + }, + { + "name": "GDExtensionScriptInstanceGetScript", + "kind": "function", + "return_value": { + "type": "GDExtensionObjectPtr" + }, + "arguments": [ + { + "name": "p_instance", + "type": "GDExtensionScriptInstanceDataPtr" + } + ] + }, + { + "name": "GDExtensionScriptInstanceIsPlaceholder", + "kind": "function", + "return_value": { + "type": "GDExtensionBool" + }, + "arguments": [ + { + "name": "p_instance", + "type": "GDExtensionScriptInstanceDataPtr" + } + ] + }, + { + "name": "GDExtensionScriptLanguagePtr", + "kind": "handle" + }, + { + "name": "GDExtensionScriptInstanceGetLanguage", + "kind": "function", + "return_value": { + "type": "GDExtensionScriptLanguagePtr" + }, + "arguments": [ + { + "name": "p_instance", + "type": "GDExtensionScriptInstanceDataPtr" + } + ] + }, + { + "name": "GDExtensionScriptInstanceFree", + "kind": "function", + "return_value": { + "type": "void" + }, + "arguments": [ + { + "name": "p_instance", + "type": "GDExtensionScriptInstanceDataPtr" + } + ] + }, + { + "name": "GDExtensionScriptInstancePtr", + "kind": "handle", + "description": [ + "Pointer to ScriptInstance." + ] + }, + { + "name": "GDExtensionScriptInstanceInfo", + "kind": "struct", + "members": [ + { + "name": "set_func", + "type": "GDExtensionScriptInstanceSet" + }, + { + "name": "get_func", + "type": "GDExtensionScriptInstanceGet" + }, + { + "name": "get_property_list_func", + "type": "GDExtensionScriptInstanceGetPropertyList" + }, + { + "name": "free_property_list_func", + "type": "GDExtensionScriptInstanceFreePropertyList" + }, + { + "name": "property_can_revert_func", + "type": "GDExtensionScriptInstancePropertyCanRevert" + }, + { + "name": "property_get_revert_func", + "type": "GDExtensionScriptInstancePropertyGetRevert" + }, + { + "name": "get_owner_func", + "type": "GDExtensionScriptInstanceGetOwner" + }, + { + "name": "get_property_state_func", + "type": "GDExtensionScriptInstanceGetPropertyState" + }, + { + "name": "get_method_list_func", + "type": "GDExtensionScriptInstanceGetMethodList" + }, + { + "name": "free_method_list_func", + "type": "GDExtensionScriptInstanceFreeMethodList" + }, + { + "name": "get_property_type_func", + "type": "GDExtensionScriptInstanceGetPropertyType" + }, + { + "name": "has_method_func", + "type": "GDExtensionScriptInstanceHasMethod" + }, + { + "name": "call_func", + "type": "GDExtensionScriptInstanceCall" + }, + { + "name": "notification_func", + "type": "GDExtensionScriptInstanceNotification" + }, + { + "name": "to_string_func", + "type": "GDExtensionScriptInstanceToString" + }, + { + "name": "refcount_incremented_func", + "type": "GDExtensionScriptInstanceRefCountIncremented" + }, + { + "name": "refcount_decremented_func", + "type": "GDExtensionScriptInstanceRefCountDecremented" + }, + { + "name": "get_script_func", + "type": "GDExtensionScriptInstanceGetScript" + }, + { + "name": "is_placeholder_func", + "type": "GDExtensionScriptInstanceIsPlaceholder" + }, + { + "name": "set_fallback_func", + "type": "GDExtensionScriptInstanceSet" + }, + { + "name": "get_fallback_func", + "type": "GDExtensionScriptInstanceGet" + }, + { + "name": "get_language_func", + "type": "GDExtensionScriptInstanceGetLanguage" + }, + { + "name": "free_func", + "type": "GDExtensionScriptInstanceFree" + } + ], + "deprecated": "Deprecated. Use GDExtensionScriptInstanceInfo3 instead." + }, + { + "name": "GDExtensionScriptInstanceInfo2", + "kind": "struct", + "members": [ + { + "name": "set_func", + "type": "GDExtensionScriptInstanceSet" + }, + { + "name": "get_func", + "type": "GDExtensionScriptInstanceGet" + }, + { + "name": "get_property_list_func", + "type": "GDExtensionScriptInstanceGetPropertyList" + }, + { + "name": "free_property_list_func", + "type": "GDExtensionScriptInstanceFreePropertyList" + }, + { + "name": "get_class_category_func", + "type": "GDExtensionScriptInstanceGetClassCategory", + "description": [ + "Optional. Set to NULL for the default behavior." + ] + }, + { + "name": "property_can_revert_func", + "type": "GDExtensionScriptInstancePropertyCanRevert" + }, + { + "name": "property_get_revert_func", + "type": "GDExtensionScriptInstancePropertyGetRevert" + }, + { + "name": "get_owner_func", + "type": "GDExtensionScriptInstanceGetOwner" + }, + { + "name": "get_property_state_func", + "type": "GDExtensionScriptInstanceGetPropertyState" + }, + { + "name": "get_method_list_func", + "type": "GDExtensionScriptInstanceGetMethodList" + }, + { + "name": "free_method_list_func", + "type": "GDExtensionScriptInstanceFreeMethodList" + }, + { + "name": "get_property_type_func", + "type": "GDExtensionScriptInstanceGetPropertyType" + }, + { + "name": "validate_property_func", + "type": "GDExtensionScriptInstanceValidateProperty" + }, + { + "name": "has_method_func", + "type": "GDExtensionScriptInstanceHasMethod" + }, + { + "name": "call_func", + "type": "GDExtensionScriptInstanceCall" + }, + { + "name": "notification_func", + "type": "GDExtensionScriptInstanceNotification2" + }, + { + "name": "to_string_func", + "type": "GDExtensionScriptInstanceToString" + }, + { + "name": "refcount_incremented_func", + "type": "GDExtensionScriptInstanceRefCountIncremented" + }, + { + "name": "refcount_decremented_func", + "type": "GDExtensionScriptInstanceRefCountDecremented" + }, + { + "name": "get_script_func", + "type": "GDExtensionScriptInstanceGetScript" + }, + { + "name": "is_placeholder_func", + "type": "GDExtensionScriptInstanceIsPlaceholder" + }, + { + "name": "set_fallback_func", + "type": "GDExtensionScriptInstanceSet" + }, + { + "name": "get_fallback_func", + "type": "GDExtensionScriptInstanceGet" + }, + { + "name": "get_language_func", + "type": "GDExtensionScriptInstanceGetLanguage" + }, + { + "name": "free_func", + "type": "GDExtensionScriptInstanceFree" + } + ], + "deprecated": "Deprecated. Use GDExtensionScriptInstanceInfo3 instead." + }, + { + "name": "GDExtensionScriptInstanceInfo3", + "kind": "struct", + "members": [ + { + "name": "set_func", + "type": "GDExtensionScriptInstanceSet" + }, + { + "name": "get_func", + "type": "GDExtensionScriptInstanceGet" + }, + { + "name": "get_property_list_func", + "type": "GDExtensionScriptInstanceGetPropertyList" + }, + { + "name": "free_property_list_func", + "type": "GDExtensionScriptInstanceFreePropertyList2" + }, + { + "name": "get_class_category_func", + "type": "GDExtensionScriptInstanceGetClassCategory", + "description": [ + "Optional. Set to NULL for the default behavior." + ] + }, + { + "name": "property_can_revert_func", + "type": "GDExtensionScriptInstancePropertyCanRevert" + }, + { + "name": "property_get_revert_func", + "type": "GDExtensionScriptInstancePropertyGetRevert" + }, + { + "name": "get_owner_func", + "type": "GDExtensionScriptInstanceGetOwner" + }, + { + "name": "get_property_state_func", + "type": "GDExtensionScriptInstanceGetPropertyState" + }, + { + "name": "get_method_list_func", + "type": "GDExtensionScriptInstanceGetMethodList" + }, + { + "name": "free_method_list_func", + "type": "GDExtensionScriptInstanceFreeMethodList2" + }, + { + "name": "get_property_type_func", + "type": "GDExtensionScriptInstanceGetPropertyType" + }, + { + "name": "validate_property_func", + "type": "GDExtensionScriptInstanceValidateProperty" + }, + { + "name": "has_method_func", + "type": "GDExtensionScriptInstanceHasMethod" + }, + { + "name": "get_method_argument_count_func", + "type": "GDExtensionScriptInstanceGetMethodArgumentCount" + }, + { + "name": "call_func", + "type": "GDExtensionScriptInstanceCall" + }, + { + "name": "notification_func", + "type": "GDExtensionScriptInstanceNotification2" + }, + { + "name": "to_string_func", + "type": "GDExtensionScriptInstanceToString" + }, + { + "name": "refcount_incremented_func", + "type": "GDExtensionScriptInstanceRefCountIncremented" + }, + { + "name": "refcount_decremented_func", + "type": "GDExtensionScriptInstanceRefCountDecremented" + }, + { + "name": "get_script_func", + "type": "GDExtensionScriptInstanceGetScript" + }, + { + "name": "is_placeholder_func", + "type": "GDExtensionScriptInstanceIsPlaceholder" + }, + { + "name": "set_fallback_func", + "type": "GDExtensionScriptInstanceSet" + }, + { + "name": "get_fallback_func", + "type": "GDExtensionScriptInstanceGet" + }, + { + "name": "get_language_func", + "type": "GDExtensionScriptInstanceGetLanguage" + }, + { + "name": "free_func", + "type": "GDExtensionScriptInstanceFree" + } + ] + }, + { + "name": "GDExtensionWorkerThreadPoolGroupTask", + "kind": "function", + "return_value": { + "type": "void" + }, + "arguments": [ + { + "name": "", + "type": "void*" + }, + { + "type": "uint32_t" + } + ] + }, + { + "name": "GDExtensionWorkerThreadPoolTask", + "kind": "function", + "return_value": { + "type": "void" + }, + "arguments": [ + { + "name": "", + "type": "void*" + } + ] + }, + { + "name": "GDExtensionInitializationLevel", + "kind": "enum", + "values": [ + { + "name": "GDEXTENSION_INITIALIZATION_CORE", + "value": 0 + }, + { + "name": "GDEXTENSION_INITIALIZATION_SERVERS", + "value": 1 + }, + { + "name": "GDEXTENSION_INITIALIZATION_SCENE", + "value": 2 + }, + { + "name": "GDEXTENSION_INITIALIZATION_EDITOR", + "value": 3 + }, + { + "name": "GDEXTENSION_MAX_INITIALIZATION_LEVEL", + "value": 4 + } + ] + }, + { + "name": "GDExtensionInitializeCallback", + "kind": "function", + "return_value": { + "type": "void" + }, + "arguments": [ + { + "name": "p_userdata", + "type": "void*" + }, + { + "name": "p_level", + "type": "GDExtensionInitializationLevel" + } + ] + }, + { + "name": "GDExtensionDeinitializeCallback", + "kind": "function", + "return_value": { + "type": "void" + }, + "arguments": [ + { + "name": "p_userdata", + "type": "void*" + }, + { + "name": "p_level", + "type": "GDExtensionInitializationLevel" + } + ] + }, + { + "name": "GDExtensionInitialization", + "kind": "struct", + "members": [ + { + "name": "minimum_initialization_level", + "type": "GDExtensionInitializationLevel", + "description": [ + "Minimum initialization level required.", + "If Core or Servers, the extension needs editor or game restart to take effect" + ] + }, + { + "name": "userdata", + "type": "void*", + "description": [ + "Up to the user to supply when initializing" + ] + }, + { + "name": "initialize", + "type": "GDExtensionInitializeCallback", + "description": [ + "This function will be called multiple times for each initialization level." + ] + }, + { + "name": "deinitialize", + "type": "GDExtensionDeinitializeCallback" + } + ] + }, + { + "name": "GDExtensionInterfaceFunctionPtr", + "kind": "function", + "return_value": { + "type": "void" + }, + "arguments": [] + }, + { + "name": "GDExtensionInterfaceGetProcAddress", + "kind": "function", + "return_value": { + "type": "GDExtensionInterfaceFunctionPtr" + }, + "arguments": [ + { + "name": "p_function_name", + "type": "const char*" + } + ] + }, + { + "name": "GDExtensionInitializationFunction", + "kind": "function", + "return_value": { + "type": "GDExtensionBool" + }, + "arguments": [ + { + "name": "p_get_proc_address", + "type": "GDExtensionInterfaceGetProcAddress" + }, + { + "name": "p_library", + "type": "GDExtensionClassLibraryPtr" + }, + { + "name": "r_initialization", + "type": "GDExtensionInitialization*" + } + ], + "description": [ + "Each GDExtension should define a C function that matches the signature of GDExtensionInitializationFunction,", + "and export it so that it can be loaded via dlopen() or equivalent for the given platform.", + "", + "For example:", + "", + " GDExtensionBool my_extension_init(GDExtensionInterfaceGetProcAddress p_get_proc_address, GDExtensionClassLibraryPtr p_library, GDExtensionInitialization *r_initialization);", + "", + "This function's name must be specified as the 'entry_symbol' in the .gdextension file.", + "", + "This makes it the entry point of the GDExtension and will be called on initialization.", + "", + "The GDExtension can then modify the r_initialization structure, setting the minimum initialization level,", + "and providing pointers to functions that will be called at various stages of initialization/shutdown.", + "", + "The rest of the GDExtension's interface to Godot consists of function pointers that can be loaded", + "by calling p_get_proc_address(\"...\") with the name of the function.", + "", + "For example:", + "", + " GDExtensionInterfaceGetGodotVersion get_godot_version = (GDExtensionInterfaceGetGodotVersion)p_get_proc_address(\"get_godot_version\");", + "", + "(Note that snippet may cause \"cast between incompatible function types\" on some compilers, you can", + "silence this by adding an intermediary `void*` cast.)", + "", + "You can then call it like a normal function:", + "", + " GDExtensionGodotVersion godot_version;", + " get_godot_version(&godot_version);", + " printf(\"Godot v%d.%d.%d\\n\", godot_version.major, godot_version.minor, godot_version.patch);", + "", + "All of these interface functions are described below, together with the name that's used to load it,", + "and the function pointer typedef that shows its signature." + ] + }, + { + "name": "GDExtensionGodotVersion", + "kind": "struct", + "members": [ + { + "name": "major", + "type": "uint32_t" + }, + { + "name": "minor", + "type": "uint32_t" + }, + { + "name": "patch", + "type": "uint32_t" + }, + { + "name": "string", + "type": "const char*" + } + ] + }, + { + "name": "GDExtensionGodotVersion2", + "kind": "struct", + "members": [ + { + "name": "major", + "type": "uint32_t" + }, + { + "name": "minor", + "type": "uint32_t" + }, + { + "name": "patch", + "type": "uint32_t" + }, + { + "name": "hex", + "type": "uint32_t", + "description": [ + "Full version encoded as hexadecimal with one byte (2 hex digits) per number (e.g. for \"3.1.12\" it would be 0x03010C)" + ] + }, + { + "name": "status", + "type": "const char*", + "description": [ + "(e.g. \"stable\", \"beta\", \"rc1\", \"rc2\")" + ] + }, + { + "name": "build", + "type": "const char*", + "description": [ + "(e.g. \"custom_build\")" + ] + }, + { + "name": "hash", + "type": "const char*", + "description": [ + "Full Git commit hash." + ] + }, + { + "name": "timestamp", + "type": "uint64_t", + "description": [ + "Git commit date UNIX timestamp in seconds, or 0 if unavailable." + ] + }, + { + "name": "string", + "type": "const char*", + "description": [ + "(e.g. \"Godot v3.1.4.stable.official.mono\")" + ] + } + ] + }, + { + "name": "GDExtensionMainLoopStartupCallback", + "kind": "function", + "return_value": { + "type": "void" + }, + "arguments": [], + "description": [ + "Called when starting the main loop." + ] + }, + { + "name": "GDExtensionMainLoopShutdownCallback", + "kind": "function", + "return_value": { + "type": "void" + }, + "arguments": [], + "description": [ + "Called when shutting down the main loop." + ] + }, + { + "name": "GDExtensionMainLoopFrameCallback", + "kind": "function", + "return_value": { + "type": "void" + }, + "arguments": [], + "description": [ + "Called for every frame iteration of the main loop." + ] + }, + { + "name": "GDExtensionMainLoopCallbacks", + "kind": "struct", + "members": [ + { + "name": "startup_func", + "type": "GDExtensionMainLoopStartupCallback", + "description": [ + "Will be called after Godot is started and is fully initialized." + ] + }, + { + "name": "shutdown_func", + "type": "GDExtensionMainLoopShutdownCallback", + "description": [ + "Will be called before Godot is shutdown when it is still fully initialized." + ] + }, + { + "name": "frame_func", + "type": "GDExtensionMainLoopFrameCallback", + "description": [ + "Will be called for each process frame. This will run after all `_process()` methods on Node, and before `ScriptServer::frame()`.", + "This is intended to be the equivalent of `ScriptLanguage::frame()` for GDExtension language bindings that don't use the script API." + ] + } + ] + } + ], + "interface": [ + { + "name": "get_godot_version", + "return_value": { + "type": "void" + }, + "arguments": [ + { + "name": "r_godot_version", + "type": "GDExtensionGodotVersion*", + "description": [ + "A pointer to the structure to write the version information into." + ] + } + ], + "description": [ + "Gets the Godot version that the GDExtension was loaded into." + ], + "since": "4.1", + "deprecated": "Deprecated in Godot 4.5. Use `get_godot_version2` instead." + }, + { + "name": "get_godot_version2", + "return_value": { + "type": "void" + }, + "arguments": [ + { + "name": "r_godot_version", + "type": "GDExtensionGodotVersion2*", + "description": [ + "A pointer to the structure to write the version information into." + ] + } + ], + "description": [ + "Gets the Godot version that the GDExtension was loaded into." + ], + "since": "4.5" + }, + { + "name": "mem_alloc", + "return_value": { + "type": "void*", + "description": [ + "A pointer to the allocated memory, or NULL if unsuccessful." + ] + }, + "arguments": [ + { + "name": "p_bytes", + "type": "size_t", + "description": [ + "The amount of memory to allocate in bytes." + ] + } + ], + "description": [ + "Allocates memory." + ], + "since": "4.1", + "deprecated": "Deprecated in Godot 4.6. Use `mem_alloc2` instead." + }, + { + "name": "mem_realloc", + "return_value": { + "type": "void*", + "description": [ + "A pointer to the allocated memory, or NULL if unsuccessful." + ] + }, + "arguments": [ + { + "name": "p_ptr", + "type": "void*", + "description": [ + "A pointer to the previously allocated memory." + ] + }, + { + "name": "p_bytes", + "type": "size_t", + "description": [ + "The number of bytes to resize the memory block to." + ] + } + ], + "description": [ + "Reallocates memory." + ], + "since": "4.1", + "deprecated": "Deprecated in Godot 4.6. Use `mem_realloc2` instead." + }, + { + "name": "mem_free", + "return_value": { + "type": "void" + }, + "arguments": [ + { + "name": "p_ptr", + "type": "void*", + "description": [ + "A pointer to the previously allocated memory." + ] + } + ], + "description": [ + "Frees memory." + ], + "since": "4.1", + "deprecated": "Deprecated in Godot 4.6. Use `mem_free2` instead." + }, + { + "name": "mem_alloc2", + "return_value": { + "type": "void*", + "description": [ + "A pointer to the allocated memory, or NULL if unsuccessful." + ] + }, + "arguments": [ + { + "name": "p_bytes", + "type": "size_t", + "description": [ + "The amount of memory to allocate in bytes." + ] + }, + { + "name": "p_pad_align", + "type": "GDExtensionBool", + "description": [ + "If true, the returned memory will have prepadding of at least 8 bytes." + ] + } + ], + "description": [ + "Allocates memory." + ], + "since": "4.6" + }, + { + "name": "mem_realloc2", + "return_value": { + "type": "void*", + "description": [ + "A pointer to the allocated memory, or NULL if unsuccessful." + ] + }, + "arguments": [ + { + "name": "p_ptr", + "type": "void*", + "description": [ + "A pointer to the previously allocated memory." + ] + }, + { + "name": "p_bytes", + "type": "size_t", + "description": [ + "The number of bytes to resize the memory block to." + ] + }, + { + "name": "p_pad_align", + "type": "GDExtensionBool", + "description": [ + "If true, the returned memory will have prepadding of at least 8 bytes." + ] + } + ], + "description": [ + "Reallocates memory." + ], + "since": "4.6" + }, + { + "name": "mem_free2", + "return_value": { + "type": "void" + }, + "arguments": [ + { + "name": "p_ptr", + "type": "void*", + "description": [ + "A pointer to the previously allocated memory." + ] + }, + { + "name": "p_pad_align", + "type": "GDExtensionBool", + "description": [ + "If true, the given memory was allocated with prepadding." + ] + } + ], + "description": [ + "Frees memory." + ], + "since": "4.6" + }, + { + "name": "print_error", + "return_value": { + "type": "void" + }, + "arguments": [ + { + "name": "p_description", + "type": "const char*", + "description": [ + "The code triggering the error." + ] + }, + { + "name": "p_function", + "type": "const char*", + "description": [ + "The function name where the error occurred." + ] + }, + { + "name": "p_file", + "type": "const char*", + "description": [ + "The file where the error occurred." + ] + }, + { + "name": "p_line", + "type": "int32_t", + "description": [ + "The line where the error occurred." + ] + }, + { + "name": "p_editor_notify", + "type": "GDExtensionBool", + "description": [ + "Whether or not to notify the editor." + ] + } + ], + "description": [ + "Logs an error to Godot's built-in debugger and to the OS terminal." + ], + "since": "4.1" + }, + { + "name": "print_error_with_message", + "return_value": { + "type": "void" + }, + "arguments": [ + { + "name": "p_description", + "type": "const char*", + "description": [ + "The code triggering the error." + ] + }, + { + "name": "p_message", + "type": "const char*", + "description": [ + "The message to show along with the error." + ] + }, + { + "name": "p_function", + "type": "const char*", + "description": [ + "The function name where the error occurred." + ] + }, + { + "name": "p_file", + "type": "const char*", + "description": [ + "The file where the error occurred." + ] + }, + { + "name": "p_line", + "type": "int32_t", + "description": [ + "The line where the error occurred." + ] + }, + { + "name": "p_editor_notify", + "type": "GDExtensionBool", + "description": [ + "Whether or not to notify the editor." + ] + } + ], + "description": [ + "Logs an error with a message to Godot's built-in debugger and to the OS terminal." + ], + "since": "4.1" + }, + { + "name": "print_warning", + "return_value": { + "type": "void" + }, + "arguments": [ + { + "name": "p_description", + "type": "const char*", + "description": [ + "The code triggering the warning." + ] + }, + { + "name": "p_function", + "type": "const char*", + "description": [ + "The function name where the warning occurred." + ] + }, + { + "name": "p_file", + "type": "const char*", + "description": [ + "The file where the warning occurred." + ] + }, + { + "name": "p_line", + "type": "int32_t", + "description": [ + "The line where the warning occurred." + ] + }, + { + "name": "p_editor_notify", + "type": "GDExtensionBool", + "description": [ + "Whether or not to notify the editor." + ] + } + ], + "description": [ + "Logs a warning to Godot's built-in debugger and to the OS terminal." + ], + "since": "4.1" + }, + { + "name": "print_warning_with_message", + "return_value": { + "type": "void" + }, + "arguments": [ + { + "name": "p_description", + "type": "const char*", + "description": [ + "The code triggering the warning." + ] + }, + { + "name": "p_message", + "type": "const char*", + "description": [ + "The message to show along with the warning." + ] + }, + { + "name": "p_function", + "type": "const char*", + "description": [ + "The function name where the warning occurred." + ] + }, + { + "name": "p_file", + "type": "const char*", + "description": [ + "The file where the warning occurred." + ] + }, + { + "name": "p_line", + "type": "int32_t", + "description": [ + "The line where the warning occurred." + ] + }, + { + "name": "p_editor_notify", + "type": "GDExtensionBool", + "description": [ + "Whether or not to notify the editor." + ] + } + ], + "description": [ + "Logs a warning with a message to Godot's built-in debugger and to the OS terminal." + ], + "since": "4.1" + }, + { + "name": "print_script_error", + "return_value": { + "type": "void" + }, + "arguments": [ + { + "name": "p_description", + "type": "const char*", + "description": [ + "The code triggering the error." + ] + }, + { + "name": "p_function", + "type": "const char*", + "description": [ + "The function name where the error occurred." + ] + }, + { + "name": "p_file", + "type": "const char*", + "description": [ + "The file where the error occurred." + ] + }, + { + "name": "p_line", + "type": "int32_t", + "description": [ + "The line where the error occurred." + ] + }, + { + "name": "p_editor_notify", + "type": "GDExtensionBool", + "description": [ + "Whether or not to notify the editor." + ] + } + ], + "description": [ + "Logs a script error to Godot's built-in debugger and to the OS terminal." + ], + "since": "4.1" + }, + { + "name": "print_script_error_with_message", + "return_value": { + "type": "void" + }, + "arguments": [ + { + "name": "p_description", + "type": "const char*", + "description": [ + "The code triggering the error." + ] + }, + { + "name": "p_message", + "type": "const char*", + "description": [ + "The message to show along with the error." + ] + }, + { + "name": "p_function", + "type": "const char*", + "description": [ + "The function name where the error occurred." + ] + }, + { + "name": "p_file", + "type": "const char*", + "description": [ + "The file where the error occurred." + ] + }, + { + "name": "p_line", + "type": "int32_t", + "description": [ + "The line where the error occurred." + ] + }, + { + "name": "p_editor_notify", + "type": "GDExtensionBool", + "description": [ + "Whether or not to notify the editor." + ] + } + ], + "description": [ + "Logs a script error with a message to Godot's built-in debugger and to the OS terminal." + ], + "since": "4.1" + }, + { + "name": "get_native_struct_size", + "return_value": { + "type": "uint64_t", + "description": [ + "The size in bytes." + ] + }, + "arguments": [ + { + "name": "p_name", + "type": "GDExtensionConstStringNamePtr", + "description": [ + "A pointer to a StringName identifying the struct name." + ] + } + ], + "description": [ + "Gets the size of a native struct (ex. ObjectID) in bytes." + ], + "since": "4.1" + }, + { + "name": "variant_new_copy", + "return_value": { + "type": "void" + }, + "arguments": [ + { + "name": "r_dest", + "type": "GDExtensionUninitializedVariantPtr", + "description": [ + "A pointer to the destination Variant." + ] + }, + { + "name": "p_src", + "type": "GDExtensionConstVariantPtr", + "description": [ + "A pointer to the source Variant." + ] + } + ], + "description": [ + "Copies one Variant into a another." + ], + "since": "4.1" + }, + { + "name": "variant_new_nil", + "return_value": { + "type": "void" + }, + "arguments": [ + { + "name": "r_dest", + "type": "GDExtensionUninitializedVariantPtr", + "description": [ + "A pointer to the destination Variant." + ] + } + ], + "description": [ + "Creates a new Variant containing nil." + ], + "since": "4.1" + }, + { + "name": "variant_destroy", + "return_value": { + "type": "void" + }, + "arguments": [ + { + "name": "p_self", + "type": "GDExtensionVariantPtr", + "description": [ + "A pointer to the Variant to destroy." + ] + } + ], + "description": [ + "Destroys a Variant." + ], + "since": "4.1" + }, + { + "name": "variant_call", + "return_value": { + "type": "void" + }, + "arguments": [ + { + "name": "p_self", + "type": "GDExtensionVariantPtr", + "description": [ + "A pointer to the Variant." + ] + }, + { + "name": "p_method", + "type": "GDExtensionConstStringNamePtr", + "description": [ + "A pointer to a StringName identifying the method." + ] + }, + { + "name": "p_args", + "type": "const GDExtensionConstVariantPtr*", + "description": [ + "A pointer to a C array of Variant." + ] + }, + { + "name": "p_argument_count", + "type": "GDExtensionInt", + "description": [ + "The number of arguments." + ] + }, + { + "name": "r_return", + "type": "GDExtensionUninitializedVariantPtr", + "description": [ + "A pointer a Variant which will be assigned the return value." + ] + }, + { + "name": "r_error", + "type": "GDExtensionCallError*", + "description": [ + "A pointer the structure which will hold error information." + ] + } + ], + "description": [ + "Calls a method on a Variant." + ], + "since": "4.1", + "see": [ + "Variant::callp()" + ] + }, + { + "name": "variant_call_static", + "return_value": { + "type": "void" + }, + "arguments": [ + { + "name": "p_type", + "type": "GDExtensionVariantType", + "description": [ + "The variant type." + ] + }, + { + "name": "p_method", + "type": "GDExtensionConstStringNamePtr", + "description": [ + "A pointer to a StringName identifying the method." + ] + }, + { + "name": "p_args", + "type": "const GDExtensionConstVariantPtr*", + "description": [ + "A pointer to a C array of Variant." + ] + }, + { + "name": "p_argument_count", + "type": "GDExtensionInt", + "description": [ + "The number of arguments." + ] + }, + { + "name": "r_return", + "type": "GDExtensionUninitializedVariantPtr", + "description": [ + "A pointer a Variant which will be assigned the return value." + ] + }, + { + "name": "r_error", + "type": "GDExtensionCallError*", + "description": [ + "A pointer the structure which will be updated with error information." + ] + } + ], + "description": [ + "Calls a static method on a Variant." + ], + "since": "4.1", + "see": [ + "Variant::call_static()" + ] + }, + { + "name": "variant_evaluate", + "return_value": { + "type": "void" + }, + "arguments": [ + { + "name": "p_op", + "type": "GDExtensionVariantOperator", + "description": [ + "The operator to evaluate." + ] + }, + { + "name": "p_a", + "type": "GDExtensionConstVariantPtr", + "description": [ + "The first Variant." + ] + }, + { + "name": "p_b", + "type": "GDExtensionConstVariantPtr", + "description": [ + "The second Variant." + ] + }, + { + "name": "r_return", + "type": "GDExtensionUninitializedVariantPtr", + "description": [ + "A pointer a Variant which will be assigned the return value." + ] + }, + { + "name": "r_valid", + "type": "GDExtensionBool*", + "description": [ + "A pointer to a boolean which will be set to false if the operation is invalid." + ] + } + ], + "description": [ + "Evaluate an operator on two Variants." + ], + "since": "4.1", + "see": [ + "Variant::evaluate()" + ] + }, + { + "name": "variant_set", + "return_value": { + "type": "void" + }, + "arguments": [ + { + "name": "p_self", + "type": "GDExtensionVariantPtr", + "description": [ + "A pointer to the Variant." + ] + }, + { + "name": "p_key", + "type": "GDExtensionConstVariantPtr", + "description": [ + "A pointer to a Variant representing the key." + ] + }, + { + "name": "p_value", + "type": "GDExtensionConstVariantPtr", + "description": [ + "A pointer to a Variant representing the value." + ] + }, + { + "name": "r_valid", + "type": "GDExtensionBool*", + "description": [ + "A pointer to a boolean which will be set to false if the operation is invalid." + ] + } + ], + "description": [ + "Sets a key on a Variant to a value." + ], + "since": "4.1", + "see": [ + "Variant::set()" + ] + }, + { + "name": "variant_set_named", + "return_value": { + "type": "void" + }, + "arguments": [ + { + "name": "p_self", + "type": "GDExtensionVariantPtr", + "description": [ + "A pointer to the Variant." + ] + }, + { + "name": "p_key", + "type": "GDExtensionConstStringNamePtr", + "description": [ + "A pointer to a StringName representing the key." + ] + }, + { + "name": "p_value", + "type": "GDExtensionConstVariantPtr", + "description": [ + "A pointer to a Variant representing the value." + ] + }, + { + "name": "r_valid", + "type": "GDExtensionBool*", + "description": [ + "A pointer to a boolean which will be set to false if the operation is invalid." + ] + } + ], + "description": [ + "Sets a named key on a Variant to a value." + ], + "since": "4.1", + "see": [ + "Variant::set_named()" + ] + }, + { + "name": "variant_set_keyed", + "return_value": { + "type": "void" + }, + "arguments": [ + { + "name": "p_self", + "type": "GDExtensionVariantPtr", + "description": [ + "A pointer to the Variant." + ] + }, + { + "name": "p_key", + "type": "GDExtensionConstVariantPtr", + "description": [ + "A pointer to a Variant representing the key." + ] + }, + { + "name": "p_value", + "type": "GDExtensionConstVariantPtr", + "description": [ + "A pointer to a Variant representing the value." + ] + }, + { + "name": "r_valid", + "type": "GDExtensionBool*", + "description": [ + "A pointer to a boolean which will be set to false if the operation is invalid." + ] + } + ], + "description": [ + "Sets a keyed property on a Variant to a value." + ], + "since": "4.1", + "see": [ + "Variant::set_keyed()" + ] + }, + { + "name": "variant_set_indexed", + "return_value": { + "type": "void" + }, + "arguments": [ + { + "name": "p_self", + "type": "GDExtensionVariantPtr", + "description": [ + "A pointer to the Variant." + ] + }, + { + "name": "p_index", + "type": "GDExtensionInt", + "description": [ + "The index." + ] + }, + { + "name": "p_value", + "type": "GDExtensionConstVariantPtr", + "description": [ + "A pointer to a Variant representing the value." + ] + }, + { + "name": "r_valid", + "type": "GDExtensionBool*", + "description": [ + "A pointer to a boolean which will be set to false if the operation is invalid." + ] + }, + { + "name": "r_oob", + "type": "GDExtensionBool*", + "description": [ + "A pointer to a boolean which will be set to true if the index is out of bounds." + ] + } + ], + "description": [ + "Sets an index on a Variant to a value." + ], + "since": "4.1" + }, + { + "name": "variant_get", + "return_value": { + "type": "void" + }, + "arguments": [ + { + "name": "p_self", + "type": "GDExtensionConstVariantPtr", + "description": [ + "A pointer to the Variant." + ] + }, + { + "name": "p_key", + "type": "GDExtensionConstVariantPtr", + "description": [ + "A pointer to a Variant representing the key." + ] + }, + { + "name": "r_ret", + "type": "GDExtensionUninitializedVariantPtr", + "description": [ + "A pointer to a Variant which will be assigned the value." + ] + }, + { + "name": "r_valid", + "type": "GDExtensionBool*", + "description": [ + "A pointer to a boolean which will be set to false if the operation is invalid." + ] + } + ], + "description": [ + "Gets the value of a key from a Variant." + ], + "since": "4.1" + }, + { + "name": "variant_get_named", + "return_value": { + "type": "void" + }, + "arguments": [ + { + "name": "p_self", + "type": "GDExtensionConstVariantPtr", + "description": [ + "A pointer to the Variant." + ] + }, + { + "name": "p_key", + "type": "GDExtensionConstStringNamePtr", + "description": [ + "A pointer to a StringName representing the key." + ] + }, + { + "name": "r_ret", + "type": "GDExtensionUninitializedVariantPtr", + "description": [ + "A pointer to a Variant which will be assigned the value." + ] + }, + { + "name": "r_valid", + "type": "GDExtensionBool*", + "description": [ + "A pointer to a boolean which will be set to false if the operation is invalid." + ] + } + ], + "description": [ + "Gets the value of a named key from a Variant." + ], + "since": "4.1" + }, + { + "name": "variant_get_keyed", + "return_value": { + "type": "void" + }, + "arguments": [ + { + "name": "p_self", + "type": "GDExtensionConstVariantPtr", + "description": [ + "A pointer to the Variant." + ] + }, + { + "name": "p_key", + "type": "GDExtensionConstVariantPtr", + "description": [ + "A pointer to a Variant representing the key." + ] + }, + { + "name": "r_ret", + "type": "GDExtensionUninitializedVariantPtr", + "description": [ + "A pointer to a Variant which will be assigned the value." + ] + }, + { + "name": "r_valid", + "type": "GDExtensionBool*", + "description": [ + "A pointer to a boolean which will be set to false if the operation is invalid." + ] + } + ], + "description": [ + "Gets the value of a keyed property from a Variant." + ], + "since": "4.1" + }, + { + "name": "variant_get_indexed", + "return_value": { + "type": "void" + }, + "arguments": [ + { + "name": "p_self", + "type": "GDExtensionConstVariantPtr", + "description": [ + "A pointer to the Variant." + ] + }, + { + "name": "p_index", + "type": "GDExtensionInt", + "description": [ + "The index." + ] + }, + { + "name": "r_ret", + "type": "GDExtensionUninitializedVariantPtr", + "description": [ + "A pointer to a Variant which will be assigned the value." + ] + }, + { + "name": "r_valid", + "type": "GDExtensionBool*", + "description": [ + "A pointer to a boolean which will be set to false if the operation is invalid." + ] + }, + { + "name": "r_oob", + "type": "GDExtensionBool*", + "description": [ + "A pointer to a boolean which will be set to true if the index is out of bounds." + ] + } + ], + "description": [ + "Gets the value of an index from a Variant." + ], + "since": "4.1" + }, + { + "name": "variant_iter_init", + "return_value": { + "type": "GDExtensionBool", + "description": [ + "true if the operation is valid; otherwise false." + ] + }, + "arguments": [ + { + "name": "p_self", + "type": "GDExtensionConstVariantPtr", + "description": [ + "A pointer to the Variant." + ] + }, + { + "name": "r_iter", + "type": "GDExtensionUninitializedVariantPtr", + "description": [ + "A pointer to a Variant which will be assigned the iterator." + ] + }, + { + "name": "r_valid", + "type": "GDExtensionBool*", + "description": [ + "A pointer to a boolean which will be set to false if the operation is invalid." + ] + } + ], + "description": [ + "Initializes an iterator over a Variant." + ], + "since": "4.1", + "see": [ + "Variant::iter_init()" + ] + }, + { + "name": "variant_iter_next", + "return_value": { + "type": "GDExtensionBool", + "description": [ + "true if the operation is valid; otherwise false." + ] + }, + "arguments": [ + { + "name": "p_self", + "type": "GDExtensionConstVariantPtr", + "description": [ + "A pointer to the Variant." + ] + }, + { + "name": "r_iter", + "type": "GDExtensionVariantPtr", + "description": [ + "A pointer to a Variant which will be assigned the iterator." + ] + }, + { + "name": "r_valid", + "type": "GDExtensionBool*", + "description": [ + "A pointer to a boolean which will be set to false if the operation is invalid." + ] + } + ], + "description": [ + "Gets the next value for an iterator over a Variant." + ], + "since": "4.1", + "see": [ + "Variant::iter_next()" + ] + }, + { + "name": "variant_iter_get", + "return_value": { + "type": "void" + }, + "arguments": [ + { + "name": "p_self", + "type": "GDExtensionConstVariantPtr", + "description": [ + "A pointer to the Variant." + ] + }, + { + "name": "r_iter", + "type": "GDExtensionVariantPtr", + "description": [ + "A pointer to a Variant which will be assigned the iterator." + ] + }, + { + "name": "r_ret", + "type": "GDExtensionUninitializedVariantPtr", + "description": [ + "A pointer to a Variant which will be assigned false if the operation is invalid." + ] + }, + { + "name": "r_valid", + "type": "GDExtensionBool*", + "description": [ + "A pointer to a boolean which will be set to false if the operation is invalid." + ] + } + ], + "description": [ + "Gets the next value for an iterator over a Variant." + ], + "since": "4.1", + "see": [ + "Variant::iter_get()" + ] + }, + { + "name": "variant_hash", + "return_value": { + "type": "GDExtensionInt", + "description": [ + "The hash value." + ] + }, + "arguments": [ + { + "name": "p_self", + "type": "GDExtensionConstVariantPtr", + "description": [ + "A pointer to the Variant." + ] + } + ], + "description": [ + "Gets the hash of a Variant." + ], + "since": "4.1", + "see": [ + "Variant::hash()" + ] + }, + { + "name": "variant_recursive_hash", + "return_value": { + "type": "GDExtensionInt", + "description": [ + "The hash value." + ] + }, + "arguments": [ + { + "name": "p_self", + "type": "GDExtensionConstVariantPtr", + "description": [ + "A pointer to the Variant." + ] + }, + { + "name": "p_recursion_count", + "type": "GDExtensionInt", + "description": [ + "The number of recursive loops so far." + ] + } + ], + "description": [ + "Gets the recursive hash of a Variant." + ], + "since": "4.1", + "see": [ + "Variant::recursive_hash()" + ] + }, + { + "name": "variant_hash_compare", + "return_value": { + "type": "GDExtensionBool", + "description": [ + "The hash value." + ] + }, + "arguments": [ + { + "name": "p_self", + "type": "GDExtensionConstVariantPtr", + "description": [ + "A pointer to the Variant." + ] + }, + { + "name": "p_other", + "type": "GDExtensionConstVariantPtr", + "description": [ + "A pointer to the other Variant to compare it to." + ] + } + ], + "description": [ + "Compares two Variants by their hash." + ], + "since": "4.1", + "see": [ + "Variant::hash_compare()" + ] + }, + { + "name": "variant_booleanize", + "return_value": { + "type": "GDExtensionBool", + "description": [ + "The boolean value of the Variant." + ] + }, + "arguments": [ + { + "name": "p_self", + "type": "GDExtensionConstVariantPtr", + "description": [ + "A pointer to the Variant." + ] + } + ], + "description": [ + "Converts a Variant to a boolean." + ], + "since": "4.1" + }, + { + "name": "variant_duplicate", + "return_value": { + "type": "void" + }, + "arguments": [ + { + "name": "p_self", + "type": "GDExtensionConstVariantPtr", + "description": [ + "A pointer to the Variant." + ] + }, + { + "name": "r_ret", + "type": "GDExtensionVariantPtr", + "description": [ + "A pointer to a Variant to store the duplicated value." + ] + }, + { + "name": "p_deep", + "type": "GDExtensionBool", + "description": [ + "Whether or not to duplicate deeply (when supported by the Variant type)." + ] + } + ], + "description": [ + "Duplicates a Variant." + ], + "since": "4.1" + }, + { + "name": "variant_stringify", + "return_value": { + "type": "void" + }, + "arguments": [ + { + "name": "p_self", + "type": "GDExtensionConstVariantPtr", + "description": [ + "A pointer to the Variant." + ] + }, + { + "name": "r_ret", + "type": "GDExtensionStringPtr", + "description": [ + "A pointer to a String to store the resulting value." + ] + } + ], + "description": [ + "Converts a Variant to a string." + ], + "since": "4.1" + }, + { + "name": "variant_get_type", + "return_value": { + "type": "GDExtensionVariantType", + "description": [ + "The variant type." + ] + }, + "arguments": [ + { + "name": "p_self", + "type": "GDExtensionConstVariantPtr", + "description": [ + "A pointer to the Variant." + ] + } + ], + "description": [ + "Gets the type of a Variant." + ], + "since": "4.1" + }, + { + "name": "variant_has_method", + "return_value": { + "type": "GDExtensionBool", + "description": [ + "true if the variant has the given method; otherwise false." + ] + }, + "arguments": [ + { + "name": "p_self", + "type": "GDExtensionConstVariantPtr", + "description": [ + "A pointer to the Variant." + ] + }, + { + "name": "p_method", + "type": "GDExtensionConstStringNamePtr", + "description": [ + "A pointer to a StringName with the method name." + ] + } + ], + "description": [ + "Checks if a Variant has the given method." + ], + "since": "4.1" + }, + { + "name": "variant_has_member", + "return_value": { + "type": "GDExtensionBool", + "description": [ + "true if the variant has the given method; otherwise false." + ] + }, + "arguments": [ + { + "name": "p_type", + "type": "GDExtensionVariantType", + "description": [ + "The Variant type." + ] + }, + { + "name": "p_member", + "type": "GDExtensionConstStringNamePtr", + "description": [ + "A pointer to a StringName with the member name." + ] + } + ], + "description": [ + "Checks if a type of Variant has the given member." + ], + "since": "4.1" + }, + { + "name": "variant_has_key", + "return_value": { + "type": "GDExtensionBool", + "description": [ + "true if the key exists; otherwise false." + ] + }, + "arguments": [ + { + "name": "p_self", + "type": "GDExtensionConstVariantPtr", + "description": [ + "A pointer to the Variant." + ] + }, + { + "name": "p_key", + "type": "GDExtensionConstVariantPtr", + "description": [ + "A pointer to a Variant representing the key." + ] + }, + { + "name": "r_valid", + "type": "GDExtensionBool*", + "description": [ + "A pointer to a boolean which will be set to false if the key doesn't exist." + ] + } + ], + "description": [ + "Checks if a Variant has a key." + ], + "since": "4.1" + }, + { + "name": "variant_get_object_instance_id", + "return_value": { + "type": "GDObjectInstanceID", + "description": [ + "The instance ID for the contained object." + ] + }, + "arguments": [ + { + "name": "p_self", + "type": "GDExtensionConstVariantPtr", + "description": [ + "A pointer to the Variant." + ] + } + ], + "description": [ + "Gets the object instance ID from a variant of type GDEXTENSION_VARIANT_TYPE_OBJECT.", + "If the variant isn't of type GDEXTENSION_VARIANT_TYPE_OBJECT, then zero will be returned.", + "The instance ID will be returned even if the object is no longer valid - use `object_get_instance_by_id()` to check if the object is still valid." + ], + "since": "4.4" + }, + { + "name": "variant_get_type_name", + "return_value": { + "type": "void" + }, + "arguments": [ + { + "name": "p_type", + "type": "GDExtensionVariantType", + "description": [ + "The Variant type." + ] + }, + { + "name": "r_name", + "type": "GDExtensionUninitializedStringPtr", + "description": [ + "A pointer to a String to store the Variant type name." + ] + } + ], + "description": [ + "Gets the name of a Variant type." + ], + "since": "4.1" + }, + { + "name": "variant_can_convert", + "return_value": { + "type": "GDExtensionBool", + "description": [ + "true if the conversion is possible; otherwise false." + ] + }, + "arguments": [ + { + "name": "p_from", + "type": "GDExtensionVariantType", + "description": [ + "The Variant type to convert from." + ] + }, + { + "name": "p_to", + "type": "GDExtensionVariantType", + "description": [ + "The Variant type to convert to." + ] + } + ], + "description": [ + "Checks if Variants can be converted from one type to another." + ], + "since": "4.1" + }, + { + "name": "variant_can_convert_strict", + "return_value": { + "type": "GDExtensionBool", + "description": [ + "true if the conversion is possible; otherwise false." + ] + }, + "arguments": [ + { + "name": "p_from", + "type": "GDExtensionVariantType", + "description": [ + "The Variant type to convert from." + ] + }, + { + "name": "p_to", + "type": "GDExtensionVariantType", + "description": [ + "The Variant type to convert to." + ] + } + ], + "description": [ + "Checks if Variant can be converted from one type to another using stricter rules." + ], + "since": "4.1" + }, + { + "name": "get_variant_from_type_constructor", + "return_value": { + "type": "GDExtensionVariantFromTypeConstructorFunc", + "description": [ + "A pointer to a function that can create a Variant of the given type from a raw value." + ] + }, + "arguments": [ + { + "name": "p_type", + "type": "GDExtensionVariantType", + "description": [ + "The Variant type." + ] + } + ], + "description": [ + "Gets a pointer to a function that can create a Variant of the given type from a raw value." + ], + "since": "4.1" + }, + { + "name": "get_variant_to_type_constructor", + "return_value": { + "type": "GDExtensionTypeFromVariantConstructorFunc", + "description": [ + "A pointer to a function that can get the raw value from a Variant of the given type." + ] + }, + "arguments": [ + { + "name": "p_type", + "type": "GDExtensionVariantType", + "description": [ + "The Variant type." + ] + } + ], + "description": [ + "Gets a pointer to a function that can get the raw value from a Variant of the given type." + ], + "since": "4.1" + }, + { + "name": "variant_get_ptr_internal_getter", + "return_value": { + "type": "GDExtensionVariantGetInternalPtrFunc", + "description": [ + "A pointer to a type-specific function that returns a pointer to the internal value of a variant. Check the implementation of this function (gdextension_variant_get_ptr_internal_getter) for pointee type info of each variant type." + ] + }, + "arguments": [ + { + "name": "p_type", + "type": "GDExtensionVariantType", + "description": [ + "The Variant type." + ] + } + ], + "description": [ + "Provides a function pointer for retrieving a pointer to a variant's internal value.", + "Access to a variant's internal value can be used to modify it in-place, or to retrieve its value without the overhead of variant conversion functions.", + "It is recommended to cache the getter for all variant types in a function table to avoid retrieval overhead upon use.", + "", + "Each function assumes the variant's type has already been determined and matches the function.", + "Invoking the function with a variant of a mismatched type has undefined behavior, and may lead to a segmentation fault." + ], + "since": "4.4", + "legacy_type_name": "GDExtensionInterfaceGetVariantGetInternalPtrFunc" + }, + { + "name": "variant_get_ptr_operator_evaluator", + "return_value": { + "type": "GDExtensionPtrOperatorEvaluator", + "description": [ + "A pointer to a function that can evaluate the given Variant operator on the given Variant types." + ] + }, + "arguments": [ + { + "name": "p_operator", + "type": "GDExtensionVariantOperator", + "description": [ + "The variant operator." + ] + }, + { + "name": "p_type_a", + "type": "GDExtensionVariantType", + "description": [ + "The type of the first Variant." + ] + }, + { + "name": "p_type_b", + "type": "GDExtensionVariantType", + "description": [ + "The type of the second Variant." + ] + } + ], + "description": [ + "Gets a pointer to a function that can evaluate the given Variant operator on the given Variant types." + ], + "since": "4.1" + }, + { + "name": "variant_get_ptr_builtin_method", + "return_value": { + "type": "GDExtensionPtrBuiltInMethod", + "description": [ + "A pointer to a function that can call a builtin method on a type of Variant." + ] + }, + "arguments": [ + { + "name": "p_type", + "type": "GDExtensionVariantType", + "description": [ + "The Variant type." + ] + }, + { + "name": "p_method", + "type": "GDExtensionConstStringNamePtr", + "description": [ + "A pointer to a StringName with the method name." + ] + }, + { + "name": "p_hash", + "type": "GDExtensionInt", + "description": [ + "A hash representing the method signature." + ] + } + ], + "description": [ + "Gets a pointer to a function that can call a builtin method on a type of Variant." + ], + "since": "4.1" + }, + { + "name": "variant_get_ptr_constructor", + "return_value": { + "type": "GDExtensionPtrConstructor", + "description": [ + "A pointer to a function that can call one of the constructors for a type of Variant." + ] + }, + "arguments": [ + { + "name": "p_type", + "type": "GDExtensionVariantType", + "description": [ + "The Variant type." + ] + }, + { + "name": "p_constructor", + "type": "int32_t", + "description": [ + "The index of the constructor." + ] + } + ], + "description": [ + "Gets a pointer to a function that can call one of the constructors for a type of Variant." + ], + "since": "4.1" + }, + { + "name": "variant_get_ptr_destructor", + "return_value": { + "type": "GDExtensionPtrDestructor", + "description": [ + "A pointer to a function than can call the destructor for a type of Variant." + ] + }, + "arguments": [ + { + "name": "p_type", + "type": "GDExtensionVariantType", + "description": [ + "The Variant type." + ] + } + ], + "description": [ + "Gets a pointer to a function than can call the destructor for a type of Variant." + ], + "since": "4.1" + }, + { + "name": "variant_construct", + "return_value": { + "type": "void" + }, + "arguments": [ + { + "name": "p_type", + "type": "GDExtensionVariantType", + "description": [ + "The Variant type." + ] + }, + { + "name": "r_base", + "type": "GDExtensionUninitializedVariantPtr", + "description": [ + "A pointer to a Variant to store the constructed value." + ] + }, + { + "name": "p_args", + "type": "const GDExtensionConstVariantPtr*", + "description": [ + "A pointer to a C array of Variant pointers representing the arguments for the constructor." + ] + }, + { + "name": "p_argument_count", + "type": "int32_t", + "description": [ + "The number of arguments to pass to the constructor." + ] + }, + { + "name": "r_error", + "type": "GDExtensionCallError*", + "description": [ + "A pointer the structure which will be updated with error information." + ] + } + ], + "description": [ + "Constructs a Variant of the given type, using the first constructor that matches the given arguments." + ], + "since": "4.1" + }, + { + "name": "variant_get_ptr_setter", + "return_value": { + "type": "GDExtensionPtrSetter", + "description": [ + "A pointer to a function that can call a member's setter on the given Variant type." + ] + }, + "arguments": [ + { + "name": "p_type", + "type": "GDExtensionVariantType", + "description": [ + "The Variant type." + ] + }, + { + "name": "p_member", + "type": "GDExtensionConstStringNamePtr", + "description": [ + "A pointer to a StringName with the member name." + ] + } + ], + "description": [ + "Gets a pointer to a function that can call a member's setter on the given Variant type." + ], + "since": "4.1" + }, + { + "name": "variant_get_ptr_getter", + "return_value": { + "type": "GDExtensionPtrGetter", + "description": [ + "A pointer to a function that can call a member's getter on the given Variant type." + ] + }, + "arguments": [ + { + "name": "p_type", + "type": "GDExtensionVariantType", + "description": [ + "The Variant type." + ] + }, + { + "name": "p_member", + "type": "GDExtensionConstStringNamePtr", + "description": [ + "A pointer to a StringName with the member name." + ] + } + ], + "description": [ + "Gets a pointer to a function that can call a member's getter on the given Variant type." + ], + "since": "4.1" + }, + { + "name": "variant_get_ptr_indexed_setter", + "return_value": { + "type": "GDExtensionPtrIndexedSetter", + "description": [ + "A pointer to a function that can set an index on the given Variant type." + ] + }, + "arguments": [ + { + "name": "p_type", + "type": "GDExtensionVariantType", + "description": [ + "The Variant type." + ] + } + ], + "description": [ + "Gets a pointer to a function that can set an index on the given Variant type." + ], + "since": "4.1" + }, + { + "name": "variant_get_ptr_indexed_getter", + "return_value": { + "type": "GDExtensionPtrIndexedGetter", + "description": [ + "A pointer to a function that can get an index on the given Variant type." + ] + }, + "arguments": [ + { + "name": "p_type", + "type": "GDExtensionVariantType", + "description": [ + "The Variant type." + ] + } + ], + "description": [ + "Gets a pointer to a function that can get an index on the given Variant type." + ], + "since": "4.1" + }, + { + "name": "variant_get_ptr_keyed_setter", + "return_value": { + "type": "GDExtensionPtrKeyedSetter", + "description": [ + "A pointer to a function that can set a key on the given Variant type." + ] + }, + "arguments": [ + { + "name": "p_type", + "type": "GDExtensionVariantType", + "description": [ + "The Variant type." + ] + } + ], + "description": [ + "Gets a pointer to a function that can set a key on the given Variant type." + ], + "since": "4.1" + }, + { + "name": "variant_get_ptr_keyed_getter", + "return_value": { + "type": "GDExtensionPtrKeyedGetter", + "description": [ + "A pointer to a function that can get a key on the given Variant type." + ] + }, + "arguments": [ + { + "name": "p_type", + "type": "GDExtensionVariantType", + "description": [ + "The Variant type." + ] + } + ], + "description": [ + "Gets a pointer to a function that can get a key on the given Variant type." + ], + "since": "4.1" + }, + { + "name": "variant_get_ptr_keyed_checker", + "return_value": { + "type": "GDExtensionPtrKeyedChecker", + "description": [ + "A pointer to a function that can check a key on the given Variant type." + ] + }, + "arguments": [ + { + "name": "p_type", + "type": "GDExtensionVariantType", + "description": [ + "The Variant type." + ] + } + ], + "description": [ + "Gets a pointer to a function that can check a key on the given Variant type." + ], + "since": "4.1" + }, + { + "name": "variant_get_constant_value", + "return_value": { + "type": "void" + }, + "arguments": [ + { + "name": "p_type", + "type": "GDExtensionVariantType", + "description": [ + "The Variant type." + ] + }, + { + "name": "p_constant", + "type": "GDExtensionConstStringNamePtr", + "description": [ + "A pointer to a StringName with the constant name." + ] + }, + { + "name": "r_ret", + "type": "GDExtensionUninitializedVariantPtr", + "description": [ + "A pointer to a Variant to store the value." + ] + } + ], + "description": [ + "Gets the value of a constant from the given Variant type." + ], + "since": "4.1" + }, + { + "name": "variant_get_ptr_utility_function", + "return_value": { + "type": "GDExtensionPtrUtilityFunction", + "description": [ + "A pointer to a function that can call a Variant utility function." + ] + }, + "arguments": [ + { + "name": "p_function", + "type": "GDExtensionConstStringNamePtr", + "description": [ + "A pointer to a StringName with the function name." + ] + }, + { + "name": "p_hash", + "type": "GDExtensionInt", + "description": [ + "A hash representing the function signature." + ] + } + ], + "description": [ + "Gets a pointer to a function that can call a Variant utility function." + ], + "since": "4.1" + }, + { + "name": "string_new_with_latin1_chars", + "return_value": { + "type": "void" + }, + "arguments": [ + { + "name": "r_dest", + "type": "GDExtensionUninitializedStringPtr", + "description": [ + "A pointer to a Variant to hold the newly created String." + ] + }, + { + "name": "p_contents", + "type": "const char*", + "description": [ + "A pointer to a Latin-1 encoded C string (null terminated)." + ] + } + ], + "description": [ + "Creates a String from a Latin-1 encoded C string." + ], + "since": "4.1" + }, + { + "name": "string_new_with_utf8_chars", + "return_value": { + "type": "void" + }, + "arguments": [ + { + "name": "r_dest", + "type": "GDExtensionUninitializedStringPtr", + "description": [ + "A pointer to a Variant to hold the newly created String." + ] + }, + { + "name": "p_contents", + "type": "const char*", + "description": [ + "A pointer to a UTF-8 encoded C string (null terminated)." + ] + } + ], + "description": [ + "Creates a String from a UTF-8 encoded C string." + ], + "since": "4.1" + }, + { + "name": "string_new_with_utf16_chars", + "return_value": { + "type": "void" + }, + "arguments": [ + { + "name": "r_dest", + "type": "GDExtensionUninitializedStringPtr", + "description": [ + "A pointer to a Variant to hold the newly created String." + ] + }, + { + "name": "p_contents", + "type": "const char16_t*", + "description": [ + "A pointer to a UTF-16 encoded C string (null terminated)." + ] + } + ], + "description": [ + "Creates a String from a UTF-16 encoded C string." + ], + "since": "4.1" + }, + { + "name": "string_new_with_utf32_chars", + "return_value": { + "type": "void" + }, + "arguments": [ + { + "name": "r_dest", + "type": "GDExtensionUninitializedStringPtr", + "description": [ + "A pointer to a Variant to hold the newly created String." + ] + }, + { + "name": "p_contents", + "type": "const char32_t*", + "description": [ + "A pointer to a UTF-32 encoded C string (null terminated)." + ] + } + ], + "description": [ + "Creates a String from a UTF-32 encoded C string." + ], + "since": "4.1" + }, + { + "name": "string_new_with_wide_chars", + "return_value": { + "type": "void" + }, + "arguments": [ + { + "name": "r_dest", + "type": "GDExtensionUninitializedStringPtr", + "description": [ + "A pointer to a Variant to hold the newly created String." + ] + }, + { + "name": "p_contents", + "type": "const wchar_t*", + "description": [ + "A pointer to a wide C string (null terminated)." + ] + } + ], + "description": [ + "Creates a String from a wide C string." + ], + "since": "4.1" + }, + { + "name": "string_new_with_latin1_chars_and_len", + "return_value": { + "type": "void" + }, + "arguments": [ + { + "name": "r_dest", + "type": "GDExtensionUninitializedStringPtr", + "description": [ + "A pointer to a Variant to hold the newly created String." + ] + }, + { + "name": "p_contents", + "type": "const char*", + "description": [ + "A pointer to a Latin-1 encoded C string." + ] + }, + { + "name": "p_size", + "type": "GDExtensionInt", + "description": [ + "The number of characters (= number of bytes)." + ] + } + ], + "description": [ + "Creates a String from a Latin-1 encoded C string with the given length." + ], + "since": "4.1" + }, + { + "name": "string_new_with_utf8_chars_and_len", + "return_value": { + "type": "void" + }, + "arguments": [ + { + "name": "r_dest", + "type": "GDExtensionUninitializedStringPtr", + "description": [ + "A pointer to a Variant to hold the newly created String." + ] + }, + { + "name": "p_contents", + "type": "const char*", + "description": [ + "A pointer to a UTF-8 encoded C string." + ] + }, + { + "name": "p_size", + "type": "GDExtensionInt", + "description": [ + "The number of bytes (not code units)." + ] + } + ], + "description": [ + "Creates a String from a UTF-8 encoded C string with the given length." + ], + "since": "4.1", + "deprecated": "Deprecated in Godot 4.3. Use `string_new_with_utf8_chars_and_len2` instead." + }, + { + "name": "string_new_with_utf8_chars_and_len2", + "return_value": { + "type": "GDExtensionInt", + "description": [ + "Error code signifying if the operation successful." + ] + }, + "arguments": [ + { + "name": "r_dest", + "type": "GDExtensionUninitializedStringPtr", + "description": [ + "A pointer to a Variant to hold the newly created String." + ] + }, + { + "name": "p_contents", + "type": "const char*", + "description": [ + "A pointer to a UTF-8 encoded C string." + ] + }, + { + "name": "p_size", + "type": "GDExtensionInt", + "description": [ + "The number of bytes (not code units)." + ] + } + ], + "description": [ + "Creates a String from a UTF-8 encoded C string with the given length." + ], + "since": "4.3" + }, + { + "name": "string_new_with_utf16_chars_and_len", + "return_value": { + "type": "void" + }, + "arguments": [ + { + "name": "r_dest", + "type": "GDExtensionUninitializedStringPtr", + "description": [ + "A pointer to a Variant to hold the newly created String." + ] + }, + { + "name": "p_contents", + "type": "const char16_t*", + "description": [ + "A pointer to a UTF-16 encoded C string." + ] + }, + { + "name": "p_char_count", + "type": "GDExtensionInt", + "description": [ + "The number of characters (not bytes)." + ] + } + ], + "description": [ + "Creates a String from a UTF-16 encoded C string with the given length." + ], + "since": "4.1", + "deprecated": "Deprecated in Godot 4.3. Use `string_new_with_utf16_chars_and_len2` instead." + }, + { + "name": "string_new_with_utf16_chars_and_len2", + "return_value": { + "type": "GDExtensionInt", + "description": [ + "Error code signifying if the operation successful." + ] + }, + "arguments": [ + { + "name": "r_dest", + "type": "GDExtensionUninitializedStringPtr", + "description": [ + "A pointer to a Variant to hold the newly created String." + ] + }, + { + "name": "p_contents", + "type": "const char16_t*", + "description": [ + "A pointer to a UTF-16 encoded C string." + ] + }, + { + "name": "p_char_count", + "type": "GDExtensionInt", + "description": [ + "The number of characters (not bytes)." + ] + }, + { + "name": "p_default_little_endian", + "type": "GDExtensionBool", + "description": [ + "If true, UTF-16 use little endian." + ] + } + ], + "description": [ + "Creates a String from a UTF-16 encoded C string with the given length." + ], + "since": "4.3" + }, + { + "name": "string_new_with_utf32_chars_and_len", + "return_value": { + "type": "void" + }, + "arguments": [ + { + "name": "r_dest", + "type": "GDExtensionUninitializedStringPtr", + "description": [ + "A pointer to a Variant to hold the newly created String." + ] + }, + { + "name": "p_contents", + "type": "const char32_t*", + "description": [ + "A pointer to a UTF-32 encoded C string." + ] + }, + { + "name": "p_char_count", + "type": "GDExtensionInt", + "description": [ + "The number of characters (not bytes)." + ] + } + ], + "description": [ + "Creates a String from a UTF-32 encoded C string with the given length." + ], + "since": "4.1" + }, + { + "name": "string_new_with_wide_chars_and_len", + "return_value": { + "type": "void" + }, + "arguments": [ + { + "name": "r_dest", + "type": "GDExtensionUninitializedStringPtr", + "description": [ + "A pointer to a Variant to hold the newly created String." + ] + }, + { + "name": "p_contents", + "type": "const wchar_t*", + "description": [ + "A pointer to a wide C string." + ] + }, + { + "name": "p_char_count", + "type": "GDExtensionInt", + "description": [ + "The number of characters (not bytes)." + ] + } + ], + "description": [ + "Creates a String from a wide C string with the given length." + ], + "since": "4.1" + }, + { + "name": "string_to_latin1_chars", + "return_value": { + "type": "GDExtensionInt", + "description": [ + "The resulting encoded string length in characters (not bytes), not including a null terminator." + ] + }, + "arguments": [ + { + "name": "p_self", + "type": "GDExtensionConstStringPtr", + "description": [ + "A pointer to the String." + ] + }, + { + "name": "r_text", + "type": "char*", + "description": [ + "A pointer to the buffer to hold the resulting data. If NULL is passed in, only the length will be computed." + ] + }, + { + "name": "p_max_write_length", + "type": "GDExtensionInt", + "description": [ + "The maximum number of characters that can be written to r_text. It has no affect on the return value." + ] + } + ], + "description": [ + "Converts a String to a Latin-1 encoded C string.", + "It doesn't write a null terminator." + ], + "since": "4.1" + }, + { + "name": "string_to_utf8_chars", + "return_value": { + "type": "GDExtensionInt", + "description": [ + "The resulting encoded string length in characters (not bytes), not including a null terminator." + ] + }, + "arguments": [ + { + "name": "p_self", + "type": "GDExtensionConstStringPtr", + "description": [ + "A pointer to the String." + ] + }, + { + "name": "r_text", + "type": "char*", + "description": [ + "A pointer to the buffer to hold the resulting data. If NULL is passed in, only the length will be computed." + ] + }, + { + "name": "p_max_write_length", + "type": "GDExtensionInt", + "description": [ + "The maximum number of characters that can be written to r_text. It has no affect on the return value." + ] + } + ], + "description": [ + "Converts a String to a UTF-8 encoded C string.", + "It doesn't write a null terminator." + ], + "since": "4.1" + }, + { + "name": "string_to_utf16_chars", + "return_value": { + "type": "GDExtensionInt", + "description": [ + "The resulting encoded string length in characters (not bytes), not including a null terminator." + ] + }, + "arguments": [ + { + "name": "p_self", + "type": "GDExtensionConstStringPtr", + "description": [ + "A pointer to the String." + ] + }, + { + "name": "r_text", + "type": "char16_t*", + "description": [ + "A pointer to the buffer to hold the resulting data. If NULL is passed in, only the length will be computed." + ] + }, + { + "name": "p_max_write_length", + "type": "GDExtensionInt", + "description": [ + "The maximum number of characters that can be written to r_text. It has no affect on the return value." + ] + } + ], + "description": [ + "Converts a String to a UTF-16 encoded C string.", + "It doesn't write a null terminator." + ], + "since": "4.1" + }, + { + "name": "string_to_utf32_chars", + "return_value": { + "type": "GDExtensionInt", + "description": [ + "The resulting encoded string length in characters (not bytes), not including a null terminator." + ] + }, + "arguments": [ + { + "name": "p_self", + "type": "GDExtensionConstStringPtr", + "description": [ + "A pointer to the String." + ] + }, + { + "name": "r_text", + "type": "char32_t*", + "description": [ + "A pointer to the buffer to hold the resulting data. If NULL is passed in, only the length will be computed." + ] + }, + { + "name": "p_max_write_length", + "type": "GDExtensionInt", + "description": [ + "The maximum number of characters that can be written to r_text. It has no affect on the return value." + ] + } + ], + "description": [ + "Converts a String to a UTF-32 encoded C string.", + "It doesn't write a null terminator." + ], + "since": "4.1" + }, + { + "name": "string_to_wide_chars", + "return_value": { + "type": "GDExtensionInt", + "description": [ + "The resulting encoded string length in characters (not bytes), not including a null terminator." + ] + }, + "arguments": [ + { + "name": "p_self", + "type": "GDExtensionConstStringPtr", + "description": [ + "A pointer to the String." + ] + }, + { + "name": "r_text", + "type": "wchar_t*", + "description": [ + "A pointer to the buffer to hold the resulting data. If NULL is passed in, only the length will be computed." + ] + }, + { + "name": "p_max_write_length", + "type": "GDExtensionInt", + "description": [ + "The maximum number of characters that can be written to r_text. It has no affect on the return value." + ] + } + ], + "description": [ + "Converts a String to a wide C string.", + "It doesn't write a null terminator." + ], + "since": "4.1" + }, + { + "name": "string_operator_index", + "return_value": { + "type": "char32_t*", + "description": [ + "A pointer to the requested character." + ] + }, + "arguments": [ + { + "name": "p_self", + "type": "GDExtensionStringPtr", + "description": [ + "A pointer to the String." + ] + }, + { + "name": "p_index", + "type": "GDExtensionInt", + "description": [ + "The index." + ] + } + ], + "description": [ + "Gets a pointer to the character at the given index from a String." + ], + "since": "4.1" + }, + { + "name": "string_operator_index_const", + "return_value": { + "type": "const char32_t*", + "description": [ + "A const pointer to the requested character." + ] + }, + "arguments": [ + { + "name": "p_self", + "type": "GDExtensionConstStringPtr", + "description": [ + "A pointer to the String." + ] + }, + { + "name": "p_index", + "type": "GDExtensionInt", + "description": [ + "The index." + ] + } + ], + "description": [ + "Gets a const pointer to the character at the given index from a String." + ], + "since": "4.1" + }, + { + "name": "string_operator_plus_eq_string", + "return_value": { + "type": "void" + }, + "arguments": [ + { + "name": "p_self", + "type": "GDExtensionStringPtr", + "description": [ + "A pointer to the String." + ] + }, + { + "name": "p_b", + "type": "GDExtensionConstStringPtr", + "description": [ + "A pointer to the other String to append." + ] + } + ], + "description": [ + "Appends another String to a String." + ], + "since": "4.1" + }, + { + "name": "string_operator_plus_eq_char", + "return_value": { + "type": "void" + }, + "arguments": [ + { + "name": "p_self", + "type": "GDExtensionStringPtr", + "description": [ + "A pointer to the String." + ] + }, + { + "name": "p_b", + "type": "char32_t", + "description": [ + "A pointer to the character to append." + ] + } + ], + "description": [ + "Appends a character to a String." + ], + "since": "4.1" + }, + { + "name": "string_operator_plus_eq_cstr", + "return_value": { + "type": "void" + }, + "arguments": [ + { + "name": "p_self", + "type": "GDExtensionStringPtr", + "description": [ + "A pointer to the String." + ] + }, + { + "name": "p_b", + "type": "const char*", + "description": [ + "A pointer to a Latin-1 encoded C string (null terminated)." + ] + } + ], + "description": [ + "Appends a Latin-1 encoded C string to a String." + ], + "since": "4.1" + }, + { + "name": "string_operator_plus_eq_wcstr", + "return_value": { + "type": "void" + }, + "arguments": [ + { + "name": "p_self", + "type": "GDExtensionStringPtr", + "description": [ + "A pointer to the String." + ] + }, + { + "name": "p_b", + "type": "const wchar_t*", + "description": [ + "A pointer to a wide C string (null terminated)." + ] + } + ], + "description": [ + "Appends a wide C string to a String." + ], + "since": "4.1" + }, + { + "name": "string_operator_plus_eq_c32str", + "return_value": { + "type": "void" + }, + "arguments": [ + { + "name": "p_self", + "type": "GDExtensionStringPtr", + "description": [ + "A pointer to the String." + ] + }, + { + "name": "p_b", + "type": "const char32_t*", + "description": [ + "A pointer to a UTF-32 encoded C string (null terminated)." + ] + } + ], + "description": [ + "Appends a UTF-32 encoded C string to a String." + ], + "since": "4.1" + }, + { + "name": "string_resize", + "return_value": { + "type": "GDExtensionInt", + "description": [ + "Error code signifying if the operation successful." + ] + }, + "arguments": [ + { + "name": "p_self", + "type": "GDExtensionStringPtr", + "description": [ + "A pointer to the String." + ] + }, + { + "name": "p_resize", + "type": "GDExtensionInt", + "description": [ + "The new length for the String." + ] + } + ], + "description": [ + "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." + ], + "since": "4.2" + }, + { + "name": "string_name_new_with_latin1_chars", + "return_value": { + "type": "void" + }, + "arguments": [ + { + "name": "r_dest", + "type": "GDExtensionUninitializedStringNamePtr", + "description": [ + "A pointer to uninitialized storage, into which the newly created StringName is constructed." + ] + }, + { + "name": "p_contents", + "type": "const char*", + "description": [ + "A pointer to a C string (null terminated and Latin-1 or ASCII encoded)." + ] + }, + { + "name": "p_is_static", + "type": "GDExtensionBool", + "description": [ + "Whether the StringName reuses the buffer directly (see above)." + ] + } + ], + "description": [ + "Creates a StringName from a Latin-1 encoded C string.", + "If `p_is_static` is true, then:", + "- The StringName will reuse the `p_contents` buffer instead of copying it.", + "- You must guarantee that the buffer remains valid for the duration of the application (e.g. string literal).", + "- You must not call a destructor for this StringName. Incrementing the initial reference once should achieve this.", + "", + "`p_is_static` is purely an optimization and can easily introduce undefined behavior if used wrong. In case of doubt, set it to false." + ], + "since": "4.2" + }, + { + "name": "string_name_new_with_utf8_chars", + "return_value": { + "type": "void" + }, + "arguments": [ + { + "name": "r_dest", + "type": "GDExtensionUninitializedStringNamePtr", + "description": [ + "A pointer to uninitialized storage, into which the newly created StringName is constructed." + ] + }, + { + "name": "p_contents", + "type": "const char*", + "description": [ + "A pointer to a C string (null terminated and UTF-8 encoded)." + ] + } + ], + "description": [ + "Creates a StringName from a UTF-8 encoded C string." + ], + "since": "4.2" + }, + { + "name": "string_name_new_with_utf8_chars_and_len", + "return_value": { + "type": "void" + }, + "arguments": [ + { + "name": "r_dest", + "type": "GDExtensionUninitializedStringNamePtr", + "description": [ + "A pointer to uninitialized storage, into which the newly created StringName is constructed." + ] + }, + { + "name": "p_contents", + "type": "const char*", + "description": [ + "A pointer to a C string (null terminated and UTF-8 encoded)." + ] + }, + { + "name": "p_size", + "type": "GDExtensionInt", + "description": [ + "The number of bytes (not UTF-8 code points)." + ] + } + ], + "description": [ + "Creates a StringName from a UTF-8 encoded string with a given number of characters." + ], + "since": "4.2" + }, + { + "name": "xml_parser_open_buffer", + "return_value": { + "type": "GDExtensionInt", + "description": [ + "A Godot error code (ex. OK, ERR_INVALID_DATA, etc)." + ] + }, + "arguments": [ + { + "name": "p_instance", + "type": "GDExtensionObjectPtr", + "description": [ + "A pointer to an XMLParser object." + ] + }, + { + "name": "p_buffer", + "type": "const uint8_t*", + "description": [ + "A pointer to the buffer." + ] + }, + { + "name": "p_size", + "type": "size_t", + "description": [ + "The size of the buffer." + ] + } + ], + "description": [ + "Opens a raw XML buffer on an XMLParser instance." + ], + "since": "4.1", + "see": [ + "XMLParser::open_buffer()" + ] + }, + { + "name": "file_access_store_buffer", + "return_value": { + "type": "void" + }, + "arguments": [ + { + "name": "p_instance", + "type": "GDExtensionObjectPtr", + "description": [ + "A pointer to a FileAccess object." + ] + }, + { + "name": "p_src", + "type": "const uint8_t*", + "description": [ + "A pointer to the buffer." + ] + }, + { + "name": "p_length", + "type": "uint64_t", + "description": [ + "The size of the buffer." + ] + } + ], + "description": [ + "Stores the given buffer using an instance of FileAccess." + ], + "since": "4.1", + "see": [ + "FileAccess::store_buffer()" + ] + }, + { + "name": "file_access_get_buffer", + "return_value": { + "type": "uint64_t", + "description": [ + "The actual number of bytes read (may be less than requested)." + ] + }, + "arguments": [ + { + "name": "p_instance", + "type": "GDExtensionConstObjectPtr", + "description": [ + "A pointer to a FileAccess object." + ] + }, + { + "name": "p_dst", + "type": "uint8_t*", + "description": [ + "A pointer to the buffer to store the data." + ] + }, + { + "name": "p_length", + "type": "uint64_t", + "description": [ + "The requested number of bytes to read." + ] + } + ], + "description": [ + "Reads the next p_length bytes into the given buffer using an instance of FileAccess." + ], + "since": "4.1" + }, + { + "name": "image_ptrw", + "return_value": { + "type": "uint8_t*", + "description": [ + "Pointer to internal Image buffer." + ] + }, + "arguments": [ + { + "name": "p_instance", + "type": "GDExtensionObjectPtr", + "description": [ + "A pointer to a Image object." + ] + } + ], + "description": [ + "Returns writable pointer to internal Image buffer." + ], + "since": "4.3", + "see": [ + "Image::ptrw()" + ] + }, + { + "name": "image_ptr", + "return_value": { + "type": "const uint8_t*", + "description": [ + "Pointer to internal Image buffer." + ] + }, + "arguments": [ + { + "name": "p_instance", + "type": "GDExtensionObjectPtr", + "description": [ + "A pointer to a Image object." + ] + } + ], + "description": [ + "Returns read only pointer to internal Image buffer." + ], + "since": "4.3", + "see": [ + "Image::ptr()" + ] + }, + { + "name": "worker_thread_pool_add_native_group_task", + "return_value": { + "type": "int64_t", + "description": [ + "The task group ID." + ] + }, + "arguments": [ + { + "name": "p_instance", + "type": "GDExtensionObjectPtr", + "description": [ + "A pointer to a WorkerThreadPool object." + ] + }, + { + "name": "p_func", + "type": "GDExtensionWorkerThreadPoolGroupTask", + "description": [ + "A pointer to a function to run in the thread pool." + ] + }, + { + "name": "p_userdata", + "type": "void*", + "description": [ + "A pointer to arbitrary data which will be passed to p_func." + ] + }, + { + "name": "p_elements", + "type": "int", + "description": [ + "The number of element needed in the group." + ] + }, + { + "name": "p_tasks", + "type": "int", + "description": [ + "The number of tasks needed in the group." + ] + }, + { + "name": "p_high_priority", + "type": "GDExtensionBool", + "description": [ + "Whether or not this is a high priority task." + ] + }, + { + "name": "p_description", + "type": "GDExtensionConstStringPtr", + "description": [ + "A pointer to a String with the task description." + ] + } + ], + "description": [ + "Adds a group task to an instance of WorkerThreadPool." + ], + "since": "4.1", + "see": [ + "WorkerThreadPool::add_group_task()" + ] + }, + { + "name": "worker_thread_pool_add_native_task", + "return_value": { + "type": "int64_t", + "description": [ + "The task ID." + ] + }, + "arguments": [ + { + "name": "p_instance", + "type": "GDExtensionObjectPtr", + "description": [ + "A pointer to a WorkerThreadPool object." + ] + }, + { + "name": "p_func", + "type": "GDExtensionWorkerThreadPoolTask", + "description": [ + "A pointer to a function to run in the thread pool." + ] + }, + { + "name": "p_userdata", + "type": "void*", + "description": [ + "A pointer to arbitrary data which will be passed to p_func." + ] + }, + { + "name": "p_high_priority", + "type": "GDExtensionBool", + "description": [ + "Whether or not this is a high priority task." + ] + }, + { + "name": "p_description", + "type": "GDExtensionConstStringPtr", + "description": [ + "A pointer to a String with the task description." + ] + } + ], + "description": [ + "Adds a task to an instance of WorkerThreadPool." + ], + "since": "4.1" + }, + { + "name": "packed_byte_array_operator_index", + "return_value": { + "type": "uint8_t*", + "description": [ + "A pointer to the requested byte." + ] + }, + "arguments": [ + { + "name": "p_self", + "type": "GDExtensionTypePtr", + "description": [ + "A pointer to a PackedByteArray object." + ] + }, + { + "name": "p_index", + "type": "GDExtensionInt", + "description": [ + "The index of the byte to get." + ] + } + ], + "description": [ + "Gets a pointer to a byte in a PackedByteArray." + ], + "since": "4.1" + }, + { + "name": "packed_byte_array_operator_index_const", + "return_value": { + "type": "const uint8_t*", + "description": [ + "A const pointer to the requested byte." + ] + }, + "arguments": [ + { + "name": "p_self", + "type": "GDExtensionConstTypePtr", + "description": [ + "A const pointer to a PackedByteArray object." + ] + }, + { + "name": "p_index", + "type": "GDExtensionInt", + "description": [ + "The index of the byte to get." + ] + } + ], + "description": [ + "Gets a const pointer to a byte in a PackedByteArray." + ], + "since": "4.1" + }, + { + "name": "packed_float32_array_operator_index", + "return_value": { + "type": "float*", + "description": [ + "A pointer to the requested 32-bit float." + ] + }, + "arguments": [ + { + "name": "p_self", + "type": "GDExtensionTypePtr", + "description": [ + "A pointer to a PackedFloat32Array object." + ] + }, + { + "name": "p_index", + "type": "GDExtensionInt", + "description": [ + "The index of the float to get." + ] + } + ], + "description": [ + "Gets a pointer to a 32-bit float in a PackedFloat32Array." + ], + "since": "4.1" + }, + { + "name": "packed_float32_array_operator_index_const", + "return_value": { + "type": "const float*", + "description": [ + "A const pointer to the requested 32-bit float." + ] + }, + "arguments": [ + { + "name": "p_self", + "type": "GDExtensionConstTypePtr", + "description": [ + "A const pointer to a PackedFloat32Array object." + ] + }, + { + "name": "p_index", + "type": "GDExtensionInt", + "description": [ + "The index of the float to get." + ] + } + ], + "description": [ + "Gets a const pointer to a 32-bit float in a PackedFloat32Array." + ], + "since": "4.1" + }, + { + "name": "packed_float64_array_operator_index", + "return_value": { + "type": "double*", + "description": [ + "A pointer to the requested 64-bit float." + ] + }, + "arguments": [ + { + "name": "p_self", + "type": "GDExtensionTypePtr", + "description": [ + "A pointer to a PackedFloat64Array object." + ] + }, + { + "name": "p_index", + "type": "GDExtensionInt", + "description": [ + "The index of the float to get." + ] + } + ], + "description": [ + "Gets a pointer to a 64-bit float in a PackedFloat64Array." + ], + "since": "4.1" + }, + { + "name": "packed_float64_array_operator_index_const", + "return_value": { + "type": "const double*", + "description": [ + "A const pointer to the requested 64-bit float." + ] + }, + "arguments": [ + { + "name": "p_self", + "type": "GDExtensionConstTypePtr", + "description": [ + "A const pointer to a PackedFloat64Array object." + ] + }, + { + "name": "p_index", + "type": "GDExtensionInt", + "description": [ + "The index of the float to get." + ] + } + ], + "description": [ + "Gets a const pointer to a 64-bit float in a PackedFloat64Array." + ], + "since": "4.1" + }, + { + "name": "packed_int32_array_operator_index", + "return_value": { + "type": "int32_t*", + "description": [ + "A pointer to the requested 32-bit integer." + ] + }, + "arguments": [ + { + "name": "p_self", + "type": "GDExtensionTypePtr", + "description": [ + "A pointer to a PackedInt32Array object." + ] + }, + { + "name": "p_index", + "type": "GDExtensionInt", + "description": [ + "The index of the integer to get." + ] + } + ], + "description": [ + "Gets a pointer to a 32-bit integer in a PackedInt32Array." + ], + "since": "4.1" + }, + { + "name": "packed_int32_array_operator_index_const", + "return_value": { + "type": "const int32_t*", + "description": [ + "A const pointer to the requested 32-bit integer." + ] + }, + "arguments": [ + { + "name": "p_self", + "type": "GDExtensionConstTypePtr", + "description": [ + "A const pointer to a PackedInt32Array object." + ] + }, + { + "name": "p_index", + "type": "GDExtensionInt", + "description": [ + "The index of the integer to get." + ] + } + ], + "description": [ + "Gets a const pointer to a 32-bit integer in a PackedInt32Array." + ], + "since": "4.1" + }, + { + "name": "packed_int64_array_operator_index", + "return_value": { + "type": "int64_t*", + "description": [ + "A pointer to the requested 64-bit integer." + ] + }, + "arguments": [ + { + "name": "p_self", + "type": "GDExtensionTypePtr", + "description": [ + "A pointer to a PackedInt64Array object." + ] + }, + { + "name": "p_index", + "type": "GDExtensionInt", + "description": [ + "The index of the integer to get." + ] + } + ], + "description": [ + "Gets a pointer to a 64-bit integer in a PackedInt64Array." + ], + "since": "4.1" + }, + { + "name": "packed_int64_array_operator_index_const", + "return_value": { + "type": "const int64_t*", + "description": [ + "A const pointer to the requested 64-bit integer." + ] + }, + "arguments": [ + { + "name": "p_self", + "type": "GDExtensionConstTypePtr", + "description": [ + "A const pointer to a PackedInt64Array object." + ] + }, + { + "name": "p_index", + "type": "GDExtensionInt", + "description": [ + "The index of the integer to get." + ] + } + ], + "description": [ + "Gets a const pointer to a 64-bit integer in a PackedInt64Array." + ], + "since": "4.1" + }, + { + "name": "packed_string_array_operator_index", + "return_value": { + "type": "GDExtensionStringPtr", + "description": [ + "A pointer to the requested String." + ] + }, + "arguments": [ + { + "name": "p_self", + "type": "GDExtensionTypePtr", + "description": [ + "A pointer to a PackedStringArray object." + ] + }, + { + "name": "p_index", + "type": "GDExtensionInt", + "description": [ + "The index of the String to get." + ] + } + ], + "description": [ + "Gets a pointer to a string in a PackedStringArray." + ], + "since": "4.1" + }, + { + "name": "packed_string_array_operator_index_const", + "return_value": { + "type": "GDExtensionStringPtr", + "description": [ + "A const pointer to the requested String." + ] + }, + "arguments": [ + { + "name": "p_self", + "type": "GDExtensionConstTypePtr", + "description": [ + "A const pointer to a PackedStringArray object." + ] + }, + { + "name": "p_index", + "type": "GDExtensionInt", + "description": [ + "The index of the String to get." + ] + } + ], + "description": [ + "Gets a const pointer to a string in a PackedStringArray." + ], + "since": "4.1" + }, + { + "name": "packed_vector2_array_operator_index", + "return_value": { + "type": "GDExtensionTypePtr", + "description": [ + "A pointer to the requested Vector2." + ] + }, + "arguments": [ + { + "name": "p_self", + "type": "GDExtensionTypePtr", + "description": [ + "A pointer to a PackedVector2Array object." + ] + }, + { + "name": "p_index", + "type": "GDExtensionInt", + "description": [ + "The index of the Vector2 to get." + ] + } + ], + "description": [ + "Gets a pointer to a Vector2 in a PackedVector2Array." + ], + "since": "4.1" + }, + { + "name": "packed_vector2_array_operator_index_const", + "return_value": { + "type": "GDExtensionTypePtr", + "description": [ + "A const pointer to the requested Vector2." + ] + }, + "arguments": [ + { + "name": "p_self", + "type": "GDExtensionConstTypePtr", + "description": [ + "A const pointer to a PackedVector2Array object." + ] + }, + { + "name": "p_index", + "type": "GDExtensionInt", + "description": [ + "The index of the Vector2 to get." + ] + } + ], + "description": [ + "Gets a const pointer to a Vector2 in a PackedVector2Array." + ], + "since": "4.1" + }, + { + "name": "packed_vector3_array_operator_index", + "return_value": { + "type": "GDExtensionTypePtr", + "description": [ + "A pointer to the requested Vector3." + ] + }, + "arguments": [ + { + "name": "p_self", + "type": "GDExtensionTypePtr", + "description": [ + "A pointer to a PackedVector3Array object." + ] + }, + { + "name": "p_index", + "type": "GDExtensionInt", + "description": [ + "The index of the Vector3 to get." + ] + } + ], + "description": [ + "Gets a pointer to a Vector3 in a PackedVector3Array." + ], + "since": "4.1" + }, + { + "name": "packed_vector3_array_operator_index_const", + "return_value": { + "type": "GDExtensionTypePtr", + "description": [ + "A const pointer to the requested Vector3." + ] + }, + "arguments": [ + { + "name": "p_self", + "type": "GDExtensionConstTypePtr", + "description": [ + "A const pointer to a PackedVector3Array object." + ] + }, + { + "name": "p_index", + "type": "GDExtensionInt", + "description": [ + "The index of the Vector3 to get." + ] + } + ], + "description": [ + "Gets a const pointer to a Vector3 in a PackedVector3Array." + ], + "since": "4.1" + }, + { + "name": "packed_vector4_array_operator_index", + "return_value": { + "type": "GDExtensionTypePtr", + "description": [ + "A pointer to the requested Vector4." + ] + }, + "arguments": [ + { + "name": "p_self", + "type": "GDExtensionTypePtr", + "description": [ + "A pointer to a PackedVector4Array object." + ] + }, + { + "name": "p_index", + "type": "GDExtensionInt", + "description": [ + "The index of the Vector4 to get." + ] + } + ], + "description": [ + "Gets a pointer to a Vector4 in a PackedVector4Array." + ], + "since": "4.3" + }, + { + "name": "packed_vector4_array_operator_index_const", + "return_value": { + "type": "GDExtensionTypePtr", + "description": [ + "A const pointer to the requested Vector4." + ] + }, + "arguments": [ + { + "name": "p_self", + "type": "GDExtensionConstTypePtr", + "description": [ + "A const pointer to a PackedVector4Array object." + ] + }, + { + "name": "p_index", + "type": "GDExtensionInt", + "description": [ + "The index of the Vector4 to get." + ] + } + ], + "description": [ + "Gets a const pointer to a Vector4 in a PackedVector4Array." + ], + "since": "4.3" + }, + { + "name": "packed_color_array_operator_index", + "return_value": { + "type": "GDExtensionTypePtr", + "description": [ + "A pointer to the requested Color." + ] + }, + "arguments": [ + { + "name": "p_self", + "type": "GDExtensionTypePtr", + "description": [ + "A pointer to a PackedColorArray object." + ] + }, + { + "name": "p_index", + "type": "GDExtensionInt", + "description": [ + "The index of the Color to get." + ] + } + ], + "description": [ + "Gets a pointer to a color in a PackedColorArray." + ], + "since": "4.1" + }, + { + "name": "packed_color_array_operator_index_const", + "return_value": { + "type": "GDExtensionTypePtr", + "description": [ + "A const pointer to the requested Color." + ] + }, + "arguments": [ + { + "name": "p_self", + "type": "GDExtensionConstTypePtr", + "description": [ + "A const pointer to a PackedColorArray object." + ] + }, + { + "name": "p_index", + "type": "GDExtensionInt", + "description": [ + "The index of the Color to get." + ] + } + ], + "description": [ + "Gets a const pointer to a color in a PackedColorArray." + ], + "since": "4.1" + }, + { + "name": "array_operator_index", + "return_value": { + "type": "GDExtensionVariantPtr", + "description": [ + "A pointer to the requested Variant." + ] + }, + "arguments": [ + { + "name": "p_self", + "type": "GDExtensionTypePtr", + "description": [ + "A pointer to an Array object." + ] + }, + { + "name": "p_index", + "type": "GDExtensionInt", + "description": [ + "The index of the Variant to get." + ] + } + ], + "description": [ + "Gets a pointer to a Variant in an Array." + ], + "since": "4.1" + }, + { + "name": "array_operator_index_const", + "return_value": { + "type": "GDExtensionVariantPtr", + "description": [ + "A const pointer to the requested Variant." + ] + }, + "arguments": [ + { + "name": "p_self", + "type": "GDExtensionConstTypePtr", + "description": [ + "A const pointer to an Array object." + ] + }, + { + "name": "p_index", + "type": "GDExtensionInt", + "description": [ + "The index of the Variant to get." + ] + } + ], + "description": [ + "Gets a const pointer to a Variant in an Array." + ], + "since": "4.1" + }, + { + "name": "array_ref", + "return_value": { + "type": "void" + }, + "arguments": [ + { + "name": "p_self", + "type": "GDExtensionTypePtr", + "description": [ + "A pointer to the Array object to update." + ] + }, + { + "name": "p_from", + "type": "GDExtensionConstTypePtr", + "description": [ + "A pointer to the Array object to reference." + ] + } + ], + "description": [ + "Sets an Array to be a reference to another Array object." + ], + "since": "4.1", + "deprecated": "Deprecated in Godot 4.5. use `Array::operator=` instead." + }, + { + "name": "array_set_typed", + "return_value": { + "type": "void" + }, + "arguments": [ + { + "name": "p_self", + "type": "GDExtensionTypePtr", + "description": [ + "A pointer to the Array." + ] + }, + { + "name": "p_type", + "type": "GDExtensionVariantType", + "description": [ + "The type of Variant the Array will store." + ] + }, + { + "name": "p_class_name", + "type": "GDExtensionConstStringNamePtr", + "description": [ + "A pointer to a StringName with the name of the object (if p_type is GDEXTENSION_VARIANT_TYPE_OBJECT)." + ] + }, + { + "name": "p_script", + "type": "GDExtensionConstVariantPtr", + "description": [ + "A pointer to a Script object (if p_type is GDEXTENSION_VARIANT_TYPE_OBJECT and the base class is extended by a script)." + ] + } + ], + "description": [ + "Makes an Array into a typed Array." + ], + "since": "4.1" + }, + { + "name": "dictionary_operator_index", + "return_value": { + "type": "GDExtensionVariantPtr", + "description": [ + "A pointer to a Variant representing the value at the given key." + ] + }, + "arguments": [ + { + "name": "p_self", + "type": "GDExtensionTypePtr", + "description": [ + "A pointer to a Dictionary object." + ] + }, + { + "name": "p_key", + "type": "GDExtensionConstVariantPtr", + "description": [ + "A pointer to a Variant representing the key." + ] + } + ], + "description": [ + "Gets a pointer to a Variant in a Dictionary with the given key." + ], + "since": "4.1" + }, + { + "name": "dictionary_operator_index_const", + "return_value": { + "type": "GDExtensionVariantPtr", + "description": [ + "A const pointer to a Variant representing the value at the given key." + ] + }, + "arguments": [ + { + "name": "p_self", + "type": "GDExtensionConstTypePtr", + "description": [ + "A const pointer to a Dictionary object." + ] + }, + { + "name": "p_key", + "type": "GDExtensionConstVariantPtr", + "description": [ + "A pointer to a Variant representing the key." + ] + } + ], + "description": [ + "Gets a const pointer to a Variant in a Dictionary with the given key." + ], + "since": "4.1" + }, + { + "name": "dictionary_set_typed", + "return_value": { + "type": "void" + }, + "arguments": [ + { + "name": "p_self", + "type": "GDExtensionTypePtr", + "description": [ + "A pointer to the Dictionary." + ] + }, + { + "name": "p_key_type", + "type": "GDExtensionVariantType", + "description": [ + "The type of Variant the Dictionary key will store." + ] + }, + { + "name": "p_key_class_name", + "type": "GDExtensionConstStringNamePtr", + "description": [ + "A pointer to a StringName with the name of the object (if p_key_type is GDEXTENSION_VARIANT_TYPE_OBJECT)." + ] + }, + { + "name": "p_key_script", + "type": "GDExtensionConstVariantPtr", + "description": [ + "A pointer to a Script object (if p_key_type is GDEXTENSION_VARIANT_TYPE_OBJECT and the base class is extended by a script)." + ] + }, + { + "name": "p_value_type", + "type": "GDExtensionVariantType", + "description": [ + "The type of Variant the Dictionary value will store." + ] + }, + { + "name": "p_value_class_name", + "type": "GDExtensionConstStringNamePtr", + "description": [ + "A pointer to a StringName with the name of the object (if p_value_type is GDEXTENSION_VARIANT_TYPE_OBJECT)." + ] + }, + { + "name": "p_value_script", + "type": "GDExtensionConstVariantPtr", + "description": [ + "A pointer to a Script object (if p_value_type is GDEXTENSION_VARIANT_TYPE_OBJECT and the base class is extended by a script)." + ] + } + ], + "description": [ + "Makes a Dictionary into a typed Dictionary." + ], + "since": "4.4" + }, + { + "name": "object_method_bind_call", + "return_value": { + "type": "void" + }, + "arguments": [ + { + "name": "p_method_bind", + "type": "GDExtensionMethodBindPtr", + "description": [ + "A pointer to the MethodBind representing the method on the Object's class." + ] + }, + { + "name": "p_instance", + "type": "GDExtensionObjectPtr", + "description": [ + "A pointer to the Object." + ] + }, + { + "name": "p_args", + "type": "const GDExtensionConstVariantPtr*", + "description": [ + "A pointer to a C array of Variants representing the arguments." + ] + }, + { + "name": "p_arg_count", + "type": "GDExtensionInt", + "description": [ + "The number of arguments." + ] + }, + { + "name": "r_ret", + "type": "GDExtensionUninitializedVariantPtr", + "description": [ + "A pointer to Variant which will receive the return value." + ] + }, + { + "name": "r_error", + "type": "GDExtensionCallError*", + "description": [ + "A pointer to a GDExtensionCallError struct that will receive error information." + ] + } + ], + "description": [ + "Calls a method on an Object." + ], + "since": "4.1" + }, + { + "name": "object_method_bind_ptrcall", + "return_value": { + "type": "void" + }, + "arguments": [ + { + "name": "p_method_bind", + "type": "GDExtensionMethodBindPtr", + "description": [ + "A pointer to the MethodBind representing the method on the Object's class." + ] + }, + { + "name": "p_instance", + "type": "GDExtensionObjectPtr", + "description": [ + "A pointer to the Object." + ] + }, + { + "name": "p_args", + "type": "const GDExtensionConstTypePtr*", + "description": [ + "A pointer to a C array representing the arguments." + ] + }, + { + "name": "r_ret", + "type": "GDExtensionTypePtr", + "description": [ + "A pointer to the Object that will receive the return value." + ] + } + ], + "description": [ + "Calls a method on an Object (using a \"ptrcall\")." + ], + "since": "4.1" + }, + { + "name": "object_destroy", + "return_value": { + "type": "void" + }, + "arguments": [ + { + "name": "p_o", + "type": "GDExtensionObjectPtr", + "description": [ + "A pointer to the Object." + ] + } + ], + "description": [ + "Destroys an Object." + ], + "since": "4.1" + }, + { + "name": "global_get_singleton", + "return_value": { + "type": "GDExtensionObjectPtr", + "description": [ + "A pointer to the singleton Object." + ] + }, + "arguments": [ + { + "name": "p_name", + "type": "GDExtensionConstStringNamePtr", + "description": [ + "A pointer to a StringName with the singleton name." + ] + } + ], + "description": [ + "Gets a global singleton by name." + ], + "since": "4.1" + }, + { + "name": "object_get_instance_binding", + "return_value": { + "type": "void*", + "description": [ + "A pointer to the instance binding." + ] + }, + "arguments": [ + { + "name": "p_o", + "type": "GDExtensionObjectPtr", + "description": [ + "A pointer to the Object." + ] + }, + { + "name": "p_token", + "type": "void*", + "description": [ + "A token the library received by the GDExtension's entry point function." + ] + }, + { + "name": "p_callbacks", + "type": "const GDExtensionInstanceBindingCallbacks*", + "description": [ + "A pointer to a GDExtensionInstanceBindingCallbacks struct." + ] + } + ], + "description": [ + "Gets a pointer representing an Object's instance binding." + ], + "since": "4.1" + }, + { + "name": "object_set_instance_binding", + "return_value": { + "type": "void" + }, + "arguments": [ + { + "name": "p_o", + "type": "GDExtensionObjectPtr", + "description": [ + "A pointer to the Object." + ] + }, + { + "name": "p_token", + "type": "void*", + "description": [ + "A token the library received by the GDExtension's entry point function." + ] + }, + { + "name": "p_binding", + "type": "void*", + "description": [ + "A pointer to the instance binding." + ] + }, + { + "name": "p_callbacks", + "type": "const GDExtensionInstanceBindingCallbacks*", + "description": [ + "A pointer to a GDExtensionInstanceBindingCallbacks struct." + ] + } + ], + "description": [ + "Sets an Object's instance binding." + ], + "since": "4.1" + }, + { + "name": "object_free_instance_binding", + "return_value": { + "type": "void" + }, + "arguments": [ + { + "name": "p_o", + "type": "GDExtensionObjectPtr", + "description": [ + "A pointer to the Object." + ] + }, + { + "name": "p_token", + "type": "void*", + "description": [ + "A token the library received by the GDExtension's entry point function." + ] + } + ], + "description": [ + "Free an Object's instance binding." + ], + "since": "4.2" + }, + { + "name": "object_set_instance", + "return_value": { + "type": "void" + }, + "arguments": [ + { + "name": "p_o", + "type": "GDExtensionObjectPtr", + "description": [ + "A pointer to the Object." + ] + }, + { + "name": "p_classname", + "type": "GDExtensionConstStringNamePtr", + "description": [ + "A pointer to a StringName with the registered extension class's name." + ] + }, + { + "name": "p_instance", + "type": "GDExtensionClassInstancePtr", + "description": [ + "A pointer to the extension class instance." + ] + } + ], + "description": [ + "Sets an extension class instance on a Object.", + "`p_classname` should be a registered extension class and should extend the `p_o` Object's class." + ], + "since": "4.1" + }, + { + "name": "object_get_class_name", + "return_value": { + "type": "GDExtensionBool", + "description": [ + "true if successful in getting the class name; otherwise false." + ] + }, + "arguments": [ + { + "name": "p_object", + "type": "GDExtensionConstObjectPtr", + "description": [ + "A pointer to the Object." + ] + }, + { + "name": "p_library", + "type": "GDExtensionClassLibraryPtr", + "description": [ + "A pointer the library received by the GDExtension's entry point function." + ] + }, + { + "name": "r_class_name", + "type": "GDExtensionUninitializedStringNamePtr", + "description": [ + "A pointer to a String to receive the class name." + ] + } + ], + "description": [ + "Gets the class name of an Object.", + "If the GDExtension wraps the Godot object in an abstraction specific to its class, this is the", + "function that should be used to determine which wrapper to use." + ], + "since": "4.1" + }, + { + "name": "object_cast_to", + "return_value": { + "type": "GDExtensionObjectPtr", + "description": [ + "Returns a pointer to the Object, or NULL if it can't be cast to the requested type." + ] + }, + "arguments": [ + { + "name": "p_object", + "type": "GDExtensionConstObjectPtr", + "description": [ + "A pointer to the Object." + ] + }, + { + "name": "p_class_tag", + "type": "void*", + "description": [ + "A pointer uniquely identifying a built-in class in the ClassDB." + ] + } + ], + "description": [ + "Casts an Object to a different type." + ], + "since": "4.1" + }, + { + "name": "object_get_instance_from_id", + "return_value": { + "type": "GDExtensionObjectPtr", + "description": [ + "A pointer to the Object." + ] + }, + "arguments": [ + { + "name": "p_instance_id", + "type": "GDObjectInstanceID", + "description": [ + "The instance ID." + ] + } + ], + "description": [ + "Gets an Object by its instance ID." + ], + "since": "4.1" + }, + { + "name": "object_get_instance_id", + "return_value": { + "type": "GDObjectInstanceID", + "description": [ + "The instance ID." + ] + }, + "arguments": [ + { + "name": "p_object", + "type": "GDExtensionConstObjectPtr", + "description": [ + "A pointer to the Object." + ] + } + ], + "description": [ + "Gets the instance ID from an Object." + ], + "since": "4.1" + }, + { + "name": "object_has_script_method", + "return_value": { + "type": "GDExtensionBool", + "description": [ + "true if the object has a script and that script has a method with the given name. Returns false if the object has no script." + ] + }, + "arguments": [ + { + "name": "p_object", + "type": "GDExtensionConstObjectPtr", + "description": [ + "A pointer to the Object." + ] + }, + { + "name": "p_method", + "type": "GDExtensionConstStringNamePtr", + "description": [ + "A pointer to a StringName identifying the method." + ] + } + ], + "description": [ + "Checks if this object has a script with the given method." + ], + "since": "4.3" + }, + { + "name": "object_call_script_method", + "return_value": { + "type": "void" + }, + "arguments": [ + { + "name": "p_object", + "type": "GDExtensionObjectPtr", + "description": [ + "A pointer to the Object." + ] + }, + { + "name": "p_method", + "type": "GDExtensionConstStringNamePtr", + "description": [ + "A pointer to a StringName identifying the method." + ] + }, + { + "name": "p_args", + "type": "const GDExtensionConstVariantPtr*", + "description": [ + "A pointer to a C array of Variant." + ] + }, + { + "name": "p_argument_count", + "type": "GDExtensionInt", + "description": [ + "The number of arguments." + ] + }, + { + "name": "r_return", + "type": "GDExtensionUninitializedVariantPtr", + "description": [ + "A pointer a Variant which will be assigned the return value." + ] + }, + { + "name": "r_error", + "type": "GDExtensionCallError*", + "description": [ + "A pointer the structure which will hold error information." + ] + } + ], + "description": [ + "Call the given script method on this object." + ], + "since": "4.3" + }, + { + "name": "ref_get_object", + "return_value": { + "type": "GDExtensionObjectPtr", + "description": [ + "A pointer to the Object from the reference or NULL." + ] + }, + "arguments": [ + { + "name": "p_ref", + "type": "GDExtensionConstRefPtr", + "description": [ + "A pointer to the reference." + ] + } + ], + "description": [ + "Gets the Object from a reference." + ], + "since": "4.1" + }, + { + "name": "ref_set_object", + "return_value": { + "type": "void" + }, + "arguments": [ + { + "name": "p_ref", + "type": "GDExtensionRefPtr", + "description": [ + "A pointer to the reference." + ] + }, + { + "name": "p_object", + "type": "GDExtensionObjectPtr", + "description": [ + "A pointer to the Object to refer to." + ] + } + ], + "description": [ + "Sets the Object referred to by a reference." + ], + "since": "4.1" + }, + { + "name": "script_instance_create", + "return_value": { + "type": "GDExtensionScriptInstancePtr", + "description": [ + "A pointer to a ScriptInstanceExtension object." + ] + }, + "arguments": [ + { + "name": "p_info", + "type": "const GDExtensionScriptInstanceInfo*", + "description": [ + "A pointer to a GDExtensionScriptInstanceInfo struct." + ] + }, + { + "name": "p_instance_data", + "type": "GDExtensionScriptInstanceDataPtr", + "description": [ + "A pointer to a data representing the script instance in the GDExtension. This will be passed to all the function pointers on p_info." + ] + } + ], + "description": [ + "Creates a script instance that contains the given info and instance data." + ], + "since": "4.1", + "deprecated": "Deprecated in Godot 4.2. Use `script_instance_create3` instead." + }, + { + "name": "script_instance_create2", + "return_value": { + "type": "GDExtensionScriptInstancePtr", + "description": [ + "A pointer to a ScriptInstanceExtension object." + ] + }, + "arguments": [ + { + "name": "p_info", + "type": "const GDExtensionScriptInstanceInfo2*", + "description": [ + "A pointer to a GDExtensionScriptInstanceInfo2 struct." + ] + }, + { + "name": "p_instance_data", + "type": "GDExtensionScriptInstanceDataPtr", + "description": [ + "A pointer to a data representing the script instance in the GDExtension. This will be passed to all the function pointers on p_info." + ] + } + ], + "description": [ + "Creates a script instance that contains the given info and instance data." + ], + "since": "4.2", + "deprecated": "Deprecated in Godot 4.3. Use `script_instance_create3` instead." + }, + { + "name": "script_instance_create3", + "return_value": { + "type": "GDExtensionScriptInstancePtr", + "description": [ + "A pointer to a ScriptInstanceExtension object." + ] + }, + "arguments": [ + { + "name": "p_info", + "type": "const GDExtensionScriptInstanceInfo3*", + "description": [ + "A pointer to a GDExtensionScriptInstanceInfo3 struct." + ] + }, + { + "name": "p_instance_data", + "type": "GDExtensionScriptInstanceDataPtr", + "description": [ + "A pointer to a data representing the script instance in the GDExtension. This will be passed to all the function pointers on p_info." + ] + } + ], + "description": [ + "Creates a script instance that contains the given info and instance data." + ], + "since": "4.3" + }, + { + "name": "placeholder_script_instance_create", + "return_value": { + "type": "GDExtensionScriptInstancePtr", + "description": [ + "A pointer to a PlaceHolderScriptInstance object." + ] + }, + "arguments": [ + { + "name": "p_language", + "type": "GDExtensionObjectPtr", + "description": [ + "A pointer to a ScriptLanguage." + ] + }, + { + "name": "p_script", + "type": "GDExtensionObjectPtr", + "description": [ + "A pointer to a Script." + ] + }, + { + "name": "p_owner", + "type": "GDExtensionObjectPtr", + "description": [ + "A pointer to an Object." + ] + } + ], + "description": [ + "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()." + ], + "since": "4.2", + "legacy_type_name": "GDExtensionInterfacePlaceHolderScriptInstanceCreate" + }, + { + "name": "placeholder_script_instance_update", + "return_value": { + "type": "void" + }, + "arguments": [ + { + "name": "p_placeholder", + "type": "GDExtensionScriptInstancePtr", + "description": [ + "A pointer to a PlaceHolderScriptInstance." + ] + }, + { + "name": "p_properties", + "type": "GDExtensionConstTypePtr", + "description": [ + "A pointer to an Array of Dictionary representing PropertyInfo." + ] + }, + { + "name": "p_values", + "type": "GDExtensionConstTypePtr", + "description": [ + "A pointer to a Dictionary mapping StringName to Variant values." + ] + } + ], + "description": [ + "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()." + ], + "since": "4.2", + "legacy_type_name": "GDExtensionInterfacePlaceHolderScriptInstanceUpdate" + }, + { + "name": "object_get_script_instance", + "return_value": { + "type": "GDExtensionScriptInstanceDataPtr", + "description": [ + "A GDExtensionScriptInstanceDataPtr that was attached to this object as part of script_instance_create." + ] + }, + "arguments": [ + { + "name": "p_object", + "type": "GDExtensionConstObjectPtr", + "description": [ + "A pointer to the Object." + ] + }, + { + "name": "p_language", + "type": "GDExtensionObjectPtr", + "description": [ + "A pointer to the language expected for this script instance." + ] + } + ], + "description": [ + "Get the script instance data attached to this object." + ], + "since": "4.2" + }, + { + "name": "object_set_script_instance", + "return_value": { + "type": "void" + }, + "arguments": [ + { + "name": "p_object", + "type": "GDExtensionObjectPtr", + "description": [ + "A pointer to the Object." + ] + }, + { + "name": "p_script_instance", + "type": "GDExtensionScriptInstanceDataPtr", + "description": [ + "A pointer to the script instance data to attach to this object." + ] + } + ], + "description": [ + "Set the script instance data attached to this object." + ], + "since": "4.5" + }, + { + "name": "callable_custom_create", + "return_value": { + "type": "void" + }, + "arguments": [ + { + "name": "r_callable", + "type": "GDExtensionUninitializedTypePtr", + "description": [ + "A pointer that will receive the new Callable." + ] + }, + { + "name": "p_callable_custom_info", + "type": "GDExtensionCallableCustomInfo*", + "description": [ + "The info required to construct a Callable." + ] + } + ], + "description": [ + "Creates a custom Callable object from a function pointer.", + "Provided struct can be safely freed once the function returns." + ], + "since": "4.2", + "deprecated": "Deprecated in Godot 4.3. Use `callable_custom_create2` instead." + }, + { + "name": "callable_custom_create2", + "return_value": { + "type": "void" + }, + "arguments": [ + { + "name": "r_callable", + "type": "GDExtensionUninitializedTypePtr", + "description": [ + "A pointer that will receive the new Callable." + ] + }, + { + "name": "p_callable_custom_info", + "type": "GDExtensionCallableCustomInfo2*", + "description": [ + "The info required to construct a Callable." + ] + } + ], + "description": [ + "Creates a custom Callable object from a function pointer.", + "Provided struct can be safely freed once the function returns." + ], + "since": "4.3" + }, + { + "name": "callable_custom_get_userdata", + "return_value": { + "type": "void*", + "description": [ + "The userdata pointer given when creating this custom Callable." + ] + }, + "arguments": [ + { + "name": "p_callable", + "type": "GDExtensionConstTypePtr", + "description": [ + "A pointer to a Callable." + ] + }, + { + "name": "p_token", + "type": "void*", + "description": [ + "A pointer to an address that uniquely identifies the GDExtension." + ] + } + ], + "description": [ + "Retrieves the userdata pointer from a custom Callable.", + "If the Callable is not a custom Callable or the token does not match the one provided to callable_custom_create() via GDExtensionCallableCustomInfo then NULL will be returned." + ], + "since": "4.2", + "legacy_type_name": "GDExtensionInterfaceCallableCustomGetUserData" + }, + { + "name": "classdb_construct_object", + "return_value": { + "type": "GDExtensionObjectPtr", + "description": [ + "A pointer to the newly created Object." + ] + }, + "arguments": [ + { + "name": "p_classname", + "type": "GDExtensionConstStringNamePtr", + "description": [ + "A pointer to a StringName with the class name." + ] + } + ], + "description": [ + "Constructs an Object of the requested class.", + "The passed class must be a built-in godot class, or an already-registered extension class. In both cases, object_set_instance() should be called to fully initialize the object." + ], + "since": "4.1", + "deprecated": "Deprecated in Godot 4.4. Use `classdb_construct_object2` instead." + }, + { + "name": "classdb_construct_object2", + "return_value": { + "type": "GDExtensionObjectPtr", + "description": [ + "A pointer to the newly created Object." + ] + }, + "arguments": [ + { + "name": "p_classname", + "type": "GDExtensionConstStringNamePtr", + "description": [ + "A pointer to a StringName with the class name." + ] + } + ], + "description": [ + "Constructs an Object of the requested class.", + "The passed class must be a built-in godot class, or an already-registered extension class. In both cases, object_set_instance() should be called to fully initialize the object.", + "", + "\"NOTIFICATION_POSTINITIALIZE\" must be sent after construction." + ], + "since": "4.4" + }, + { + "name": "classdb_get_method_bind", + "return_value": { + "type": "GDExtensionMethodBindPtr", + "description": [ + "A pointer to the MethodBind from ClassDB." + ] + }, + "arguments": [ + { + "name": "p_classname", + "type": "GDExtensionConstStringNamePtr", + "description": [ + "A pointer to a StringName with the class name." + ] + }, + { + "name": "p_methodname", + "type": "GDExtensionConstStringNamePtr", + "description": [ + "A pointer to a StringName with the method name." + ] + }, + { + "name": "p_hash", + "type": "GDExtensionInt", + "description": [ + "A hash representing the function signature." + ] + } + ], + "description": [ + "Gets a pointer to the MethodBind in ClassDB for the given class, method and hash." + ], + "since": "4.1" + }, + { + "name": "classdb_get_class_tag", + "return_value": { + "type": "void*", + "description": [ + "A pointer uniquely identifying the built-in class in the ClassDB." + ] + }, + "arguments": [ + { + "name": "p_classname", + "type": "GDExtensionConstStringNamePtr", + "description": [ + "A pointer to a StringName with the class name." + ] + } + ], + "description": [ + "Gets a pointer uniquely identifying the given built-in class in the ClassDB." + ], + "since": "4.1" + }, + { + "name": "classdb_register_extension_class", + "return_value": { + "type": "void" + }, + "arguments": [ + { + "name": "p_library", + "type": "GDExtensionClassLibraryPtr", + "description": [ + "A pointer the library received by the GDExtension's entry point function." + ] + }, + { + "name": "p_class_name", + "type": "GDExtensionConstStringNamePtr", + "description": [ + "A pointer to a StringName with the class name." + ] + }, + { + "name": "p_parent_class_name", + "type": "GDExtensionConstStringNamePtr", + "description": [ + "A pointer to a StringName with the parent class name." + ] + }, + { + "name": "p_extension_funcs", + "type": "const GDExtensionClassCreationInfo*", + "description": [ + "A pointer to a GDExtensionClassCreationInfo struct." + ] + } + ], + "description": [ + "Registers an extension class in the ClassDB.", + "Provided struct can be safely freed once the function returns." + ], + "since": "4.1", + "deprecated": "Deprecated in Godot 4.2. Use `classdb_register_extension_class4` instead." + }, + { + "name": "classdb_register_extension_class2", + "return_value": { + "type": "void" + }, + "arguments": [ + { + "name": "p_library", + "type": "GDExtensionClassLibraryPtr", + "description": [ + "A pointer the library received by the GDExtension's entry point function." + ] + }, + { + "name": "p_class_name", + "type": "GDExtensionConstStringNamePtr", + "description": [ + "A pointer to a StringName with the class name." + ] + }, + { + "name": "p_parent_class_name", + "type": "GDExtensionConstStringNamePtr", + "description": [ + "A pointer to a StringName with the parent class name." + ] + }, + { + "name": "p_extension_funcs", + "type": "const GDExtensionClassCreationInfo2*", + "description": [ + "A pointer to a GDExtensionClassCreationInfo2 struct." + ] + } + ], + "description": [ + "Registers an extension class in the ClassDB.", + "Provided struct can be safely freed once the function returns." + ], + "since": "4.2", + "deprecated": "Deprecated in Godot 4.3. Use `classdb_register_extension_class4` instead." + }, + { + "name": "classdb_register_extension_class3", + "return_value": { + "type": "void" + }, + "arguments": [ + { + "name": "p_library", + "type": "GDExtensionClassLibraryPtr", + "description": [ + "A pointer the library received by the GDExtension's entry point function." + ] + }, + { + "name": "p_class_name", + "type": "GDExtensionConstStringNamePtr", + "description": [ + "A pointer to a StringName with the class name." + ] + }, + { + "name": "p_parent_class_name", + "type": "GDExtensionConstStringNamePtr", + "description": [ + "A pointer to a StringName with the parent class name." + ] + }, + { + "name": "p_extension_funcs", + "type": "const GDExtensionClassCreationInfo3*", + "description": [ + "A pointer to a GDExtensionClassCreationInfo3 struct." + ] + } + ], + "description": [ + "Registers an extension class in the ClassDB.", + "Provided struct can be safely freed once the function returns." + ], + "since": "4.3", + "deprecated": "Deprecated in Godot 4.4. Use `classdb_register_extension_class4` instead." + }, + { + "name": "classdb_register_extension_class4", + "return_value": { + "type": "void" + }, + "arguments": [ + { + "name": "p_library", + "type": "GDExtensionClassLibraryPtr", + "description": [ + "A pointer the library received by the GDExtension's entry point function." + ] + }, + { + "name": "p_class_name", + "type": "GDExtensionConstStringNamePtr", + "description": [ + "A pointer to a StringName with the class name." + ] + }, + { + "name": "p_parent_class_name", + "type": "GDExtensionConstStringNamePtr", + "description": [ + "A pointer to a StringName with the parent class name." + ] + }, + { + "name": "p_extension_funcs", + "type": "const GDExtensionClassCreationInfo4*", + "description": [ + "A pointer to a GDExtensionClassCreationInfo4 struct." + ] + } + ], + "description": [ + "Registers an extension class in the ClassDB.", + "Provided struct can be safely freed once the function returns." + ], + "since": "4.4", + "deprecated": "Deprecated in Godot 4.5. Use `classdb_register_extension_class5` instead." + }, + { + "name": "classdb_register_extension_class5", + "return_value": { + "type": "void" + }, + "arguments": [ + { + "name": "p_library", + "type": "GDExtensionClassLibraryPtr", + "description": [ + "A pointer the library received by the GDExtension's entry point function." + ] + }, + { + "name": "p_class_name", + "type": "GDExtensionConstStringNamePtr", + "description": [ + "A pointer to a StringName with the class name." + ] + }, + { + "name": "p_parent_class_name", + "type": "GDExtensionConstStringNamePtr", + "description": [ + "A pointer to a StringName with the parent class name." + ] + }, + { + "name": "p_extension_funcs", + "type": "const GDExtensionClassCreationInfo5*", + "description": [ + "A pointer to a GDExtensionClassCreationInfo5 struct." + ] + } + ], + "description": [ + "Registers an extension class in the ClassDB.", + "Provided struct can be safely freed once the function returns." + ], + "since": "4.5" + }, + { + "name": "classdb_register_extension_class_method", + "return_value": { + "type": "void" + }, + "arguments": [ + { + "name": "p_library", + "type": "GDExtensionClassLibraryPtr", + "description": [ + "A pointer the library received by the GDExtension's entry point function." + ] + }, + { + "name": "p_class_name", + "type": "GDExtensionConstStringNamePtr", + "description": [ + "A pointer to a StringName with the class name." + ] + }, + { + "name": "p_method_info", + "type": "const GDExtensionClassMethodInfo*", + "description": [ + "A pointer to a GDExtensionClassMethodInfo struct." + ] + } + ], + "description": [ + "Registers a method on an extension class in the ClassDB.", + "Provided struct can be safely freed once the function returns." + ], + "since": "4.1" + }, + { + "name": "classdb_register_extension_class_virtual_method", + "return_value": { + "type": "void" + }, + "arguments": [ + { + "name": "p_library", + "type": "GDExtensionClassLibraryPtr", + "description": [ + "A pointer the library received by the GDExtension's entry point function." + ] + }, + { + "name": "p_class_name", + "type": "GDExtensionConstStringNamePtr", + "description": [ + "A pointer to a StringName with the class name." + ] + }, + { + "name": "p_method_info", + "type": "const GDExtensionClassVirtualMethodInfo*", + "description": [ + "A pointer to a GDExtensionClassMethodInfo struct." + ] + } + ], + "description": [ + "Registers a virtual method on an extension class in ClassDB, that can be implemented by scripts or other extensions.", + "Provided struct can be safely freed once the function returns." + ], + "since": "4.3" + }, + { + "name": "classdb_register_extension_class_integer_constant", + "return_value": { + "type": "void" + }, + "arguments": [ + { + "name": "p_library", + "type": "GDExtensionClassLibraryPtr", + "description": [ + "A pointer the library received by the GDExtension's entry point function." + ] + }, + { + "name": "p_class_name", + "type": "GDExtensionConstStringNamePtr", + "description": [ + "A pointer to a StringName with the class name." + ] + }, + { + "name": "p_enum_name", + "type": "GDExtensionConstStringNamePtr", + "description": [ + "A pointer to a StringName with the enum name." + ] + }, + { + "name": "p_constant_name", + "type": "GDExtensionConstStringNamePtr", + "description": [ + "A pointer to a StringName with the constant name." + ] + }, + { + "name": "p_constant_value", + "type": "GDExtensionInt", + "description": [ + "The constant value." + ] + }, + { + "name": "p_is_bitfield", + "type": "GDExtensionBool", + "description": [ + "Whether or not this constant is part of a bitfield." + ] + } + ], + "description": [ + "Registers an integer constant on an extension class in the ClassDB.", + "Note about registering bitfield values (if p_is_bitfield is true): even though p_constant_value is signed, language bindings are", + "advised to treat bitfields as uint64_t, since this is generally clearer and can prevent mistakes like using -1 for setting all bits.", + "Language APIs should thus provide an abstraction that registers bitfields (uint64_t) separately from regular constants (int64_t)." + ], + "since": "4.1" + }, + { + "name": "classdb_register_extension_class_property", + "return_value": { + "type": "void" + }, + "arguments": [ + { + "name": "p_library", + "type": "GDExtensionClassLibraryPtr", + "description": [ + "A pointer the library received by the GDExtension's entry point function." + ] + }, + { + "name": "p_class_name", + "type": "GDExtensionConstStringNamePtr", + "description": [ + "A pointer to a StringName with the class name." + ] + }, + { + "name": "p_info", + "type": "const GDExtensionPropertyInfo*", + "description": [ + "A pointer to a GDExtensionPropertyInfo struct." + ] + }, + { + "name": "p_setter", + "type": "GDExtensionConstStringNamePtr", + "description": [ + "A pointer to a StringName with the name of the setter method." + ] + }, + { + "name": "p_getter", + "type": "GDExtensionConstStringNamePtr", + "description": [ + "A pointer to a StringName with the name of the getter method." + ] + } + ], + "description": [ + "Registers a property on an extension class in the ClassDB.", + "Provided struct can be safely freed once the function returns." + ], + "since": "4.1" + }, + { + "name": "classdb_register_extension_class_property_indexed", + "return_value": { + "type": "void" + }, + "arguments": [ + { + "name": "p_library", + "type": "GDExtensionClassLibraryPtr", + "description": [ + "A pointer the library received by the GDExtension's entry point function." + ] + }, + { + "name": "p_class_name", + "type": "GDExtensionConstStringNamePtr", + "description": [ + "A pointer to a StringName with the class name." + ] + }, + { + "name": "p_info", + "type": "const GDExtensionPropertyInfo*", + "description": [ + "A pointer to a GDExtensionPropertyInfo struct." + ] + }, + { + "name": "p_setter", + "type": "GDExtensionConstStringNamePtr", + "description": [ + "A pointer to a StringName with the name of the setter method." + ] + }, + { + "name": "p_getter", + "type": "GDExtensionConstStringNamePtr", + "description": [ + "A pointer to a StringName with the name of the getter method." + ] + }, + { + "name": "p_index", + "type": "GDExtensionInt", + "description": [ + "The index to pass as the first argument to the getter and setter methods." + ] + } + ], + "description": [ + "Registers an indexed property on an extension class in the ClassDB.", + "Provided struct can be safely freed once the function returns." + ], + "since": "4.2" + }, + { + "name": "classdb_register_extension_class_property_group", + "return_value": { + "type": "void" + }, + "arguments": [ + { + "name": "p_library", + "type": "GDExtensionClassLibraryPtr", + "description": [ + "A pointer the library received by the GDExtension's entry point function." + ] + }, + { + "name": "p_class_name", + "type": "GDExtensionConstStringNamePtr", + "description": [ + "A pointer to a StringName with the class name." + ] + }, + { + "name": "p_group_name", + "type": "GDExtensionConstStringPtr", + "description": [ + "A pointer to a String with the group name." + ] + }, + { + "name": "p_prefix", + "type": "GDExtensionConstStringPtr", + "description": [ + "A pointer to a String with the prefix used by properties in this group." + ] + } + ], + "description": [ + "Registers a property group on an extension class in the ClassDB." + ], + "since": "4.1" + }, + { + "name": "classdb_register_extension_class_property_subgroup", + "return_value": { + "type": "void" + }, + "arguments": [ + { + "name": "p_library", + "type": "GDExtensionClassLibraryPtr", + "description": [ + "A pointer the library received by the GDExtension's entry point function." + ] + }, + { + "name": "p_class_name", + "type": "GDExtensionConstStringNamePtr", + "description": [ + "A pointer to a StringName with the class name." + ] + }, + { + "name": "p_subgroup_name", + "type": "GDExtensionConstStringPtr", + "description": [ + "A pointer to a String with the subgroup name." + ] + }, + { + "name": "p_prefix", + "type": "GDExtensionConstStringPtr", + "description": [ + "A pointer to a String with the prefix used by properties in this subgroup." + ] + } + ], + "description": [ + "Registers a property subgroup on an extension class in the ClassDB." + ], + "since": "4.1" + }, + { + "name": "classdb_register_extension_class_signal", + "return_value": { + "type": "void" + }, + "arguments": [ + { + "name": "p_library", + "type": "GDExtensionClassLibraryPtr", + "description": [ + "A pointer the library received by the GDExtension's entry point function." + ] + }, + { + "name": "p_class_name", + "type": "GDExtensionConstStringNamePtr", + "description": [ + "A pointer to a StringName with the class name." + ] + }, + { + "name": "p_signal_name", + "type": "GDExtensionConstStringNamePtr", + "description": [ + "A pointer to a StringName with the signal name." + ] + }, + { + "name": "p_argument_info", + "type": "const GDExtensionPropertyInfo*", + "description": [ + "A pointer to a GDExtensionPropertyInfo struct." + ] + }, + { + "name": "p_argument_count", + "type": "GDExtensionInt", + "description": [ + "The number of arguments the signal receives." + ] + } + ], + "description": [ + "Registers a signal on an extension class in the ClassDB.", + "Provided structs can be safely freed once the function returns." + ], + "since": "4.1" + }, + { + "name": "classdb_unregister_extension_class", + "return_value": { + "type": "void" + }, + "arguments": [ + { + "name": "p_library", + "type": "GDExtensionClassLibraryPtr", + "description": [ + "A pointer the library received by the GDExtension's entry point function." + ] + }, + { + "name": "p_class_name", + "type": "GDExtensionConstStringNamePtr", + "description": [ + "A pointer to a StringName with the class name." + ] + } + ], + "description": [ + "Unregisters an extension class in the ClassDB.", + "Unregistering a parent class before a class that inherits it will result in failure. Inheritors must be unregistered first." + ], + "since": "4.1" + }, + { + "name": "get_library_path", + "return_value": { + "type": "void" + }, + "arguments": [ + { + "name": "p_library", + "type": "GDExtensionClassLibraryPtr", + "description": [ + "A pointer the library received by the GDExtension's entry point function." + ] + }, + { + "name": "r_path", + "type": "GDExtensionUninitializedStringPtr", + "description": [ + "A pointer to a String which will receive the path." + ] + } + ], + "description": [ + "Gets the path to the current GDExtension library." + ], + "since": "4.1" + }, + { + "name": "editor_add_plugin", + "return_value": { + "type": "void" + }, + "arguments": [ + { + "name": "p_class_name", + "type": "GDExtensionConstStringNamePtr", + "description": [ + "A pointer to a StringName with the name of a class (descending from EditorPlugin) which is already registered with ClassDB." + ] + } + ], + "description": [ + "Adds an editor plugin.", + "It's safe to call during initialization." + ], + "since": "4.1" + }, + { + "name": "editor_remove_plugin", + "return_value": { + "type": "void" + }, + "arguments": [ + { + "name": "p_class_name", + "type": "GDExtensionConstStringNamePtr", + "description": [ + "A pointer to a StringName with the name of a class that was previously added as an editor plugin." + ] + } + ], + "description": [ + "Removes an editor plugin." + ], + "since": "4.1" + }, + { + "name": "editor_help_load_xml_from_utf8_chars", + "return_value": { + "type": "void" + }, + "arguments": [ + { + "name": "p_data", + "type": "const char*", + "description": [ + "A pointer to a UTF-8 encoded C string (null terminated)." + ] + } + ], + "description": [ + "Loads new XML-formatted documentation data in the editor.", + "The provided pointer can be immediately freed once the function returns." + ], + "since": "4.3", + "legacy_type_name": "GDExtensionsInterfaceEditorHelpLoadXmlFromUtf8Chars" + }, + { + "name": "editor_help_load_xml_from_utf8_chars_and_len", + "return_value": { + "type": "void" + }, + "arguments": [ + { + "name": "p_data", + "type": "const char*", + "description": [ + "A pointer to a UTF-8 encoded C string." + ] + }, + { + "name": "p_size", + "type": "GDExtensionInt", + "description": [ + "The number of bytes (not code units)." + ] + } + ], + "description": [ + "Loads new XML-formatted documentation data in the editor.", + "The provided pointer can be immediately freed once the function returns." + ], + "since": "4.3", + "legacy_type_name": "GDExtensionsInterfaceEditorHelpLoadXmlFromUtf8CharsAndLen" + }, + { + "name": "editor_register_get_classes_used_callback", + "return_value": { + "type": "void" + }, + "arguments": [ + { + "name": "p_library", + "type": "GDExtensionClassLibraryPtr", + "description": [ + "A pointer the library received by the GDExtension's entry point function." + ] + }, + { + "name": "p_callback", + "type": "GDExtensionEditorGetClassesUsedCallback", + "description": [ + "The callback to retrieve the list of classes used." + ] + } + ], + "description": [ + "Registers a callback that Godot can call to get the list of all classes (from ClassDB) that may be used by the calling GDExtension.", + "This is used by the editor to generate a build profile (in \"Tools\" > \"Engine Compilation Configuration Editor...\" > \"Detect from project\"),", + "in order to recompile Godot with only the classes used.", + "In the provided callback, the GDExtension should provide the list of classes that _may_ be used statically, thus the time of invocation shouldn't matter.", + "If a GDExtension doesn't register a callback, Godot will assume that it could be using any classes." + ], + "since": "4.5" + }, + { + "name": "register_main_loop_callbacks", + "return_value": { + "type": "void" + }, + "arguments": [ + { + "name": "p_library", + "type": "GDExtensionClassLibraryPtr", + "description": [ + "A pointer the library received by the GDExtension's entry point function." + ] + }, + { + "name": "p_callbacks", + "type": "const GDExtensionMainLoopCallbacks*", + "description": [ + "A pointer to the structure that contains the callbacks." + ] + } + ], + "description": [ + "Registers callbacks to be called at different phases of the main loop." + ], + "since": "4.5" + } + ] +} diff --git a/core/extension/gdextension_interface.schema.json b/core/extension/gdextension_interface.schema.json new file mode 100644 index 00000000000..e3b764d0a10 --- /dev/null +++ b/core/extension/gdextension_interface.schema.json @@ -0,0 +1,290 @@ +{ + "$schema": "https://json-schema.org/draft/2020-12/schema", + "$id": "https://godotengine.org/gdextension_interface.schema.json", + "title": "GDExtension Interface", + "type": "object", + "properties": { + "_copyright": { + "type": "array", + "items": { + "type": "string" + } + }, + "format_version": { + "type": "number", + "const": 1 + }, + "$schema": { + "type": "string", + "const": "./gdextension_interface.schema.json" + }, + "types": { + "type": "array", + "items": { + "type": "object", + "properties": { + "name": { + "type": "string" + }, + "kind": { + "type": "string", + "enum": ["enum", "handle", "alias", "struct", "function"] + }, + "description": { + "type": "array", + "items": { + "type": "string" + } + }, + "deprecated": { + "type": "string" + } + }, + "required": [ + "name", + "kind" + ], + "unevaluatedProperties": false, + "allOf": [ + { + "if": { + "properties": { + "kind": { "const": "enum" } + } + }, + "then": { + "properties": { + "values": { + "type": "array", + "items": { + "type": "object", + "properties": { + "name": { + "type": "string" + }, + "value": { + "type": "number" + }, + "description": { + "type": "array", + "items": { + "type": "string" + } + } + }, + "required": [ "name", "value" ], + "additionalProperties": false + } + } + }, + "required": ["name", "kind", "values"] + } + }, + { + "if": { + "properties": { + "kind": { "const": "handle" } + } + }, + "then": { + "properties": { + "parent": { + "type": "string" + }, + "const": { + "type": "boolean" + } + } + } + }, + { + "if": { + "properties": { + "kind": { "const": "alias" } + } + }, + "then": { + "properties": { + "type": { + "type": "string" + } + }, + "required": ["name", "kind", "type"] + } + }, + { + "if": { + "properties": { + "kind": { "const": "struct" } + } + }, + "then": { + "properties": { + "members": { + "type": "array", + "items": { + "type": "object", + "properties": { + "name": { + "type": "string" + }, + "type": { + "type": "string" + }, + "description": { + "type": "array", + "items": { + "type": "string" + } + } + }, + "required": ["name", "type"], + "additionalProperties": false + } + } + }, + "required": ["name", "kind", "members"] + } + }, + { + "if": { + "properties": { + "kind": { "const": "function" } + } + }, + "then": { + "properties": { + "return_value": { + "type": "object", + "properties": { + "type": { + "type": "string" + }, + "description": { + "type": "array", + "items": { + "type": "string" + } + } + }, + "required": ["type"], + "additionalProperties": false + }, + "arguments": { + "type": "array", + "items": { + "type": "object", + "properties": { + "type": { + "type": "string" + }, + "name": { + "type": "string" + }, + "description": { + "type": "array", + "items": { + "type": "string" + } + } + }, + "required": ["type"], + "additionalProperties": false + } + } + }, + "required": ["name", "kind", "return_value", "arguments"] + } + } + ] + } + }, + "interface": { + "type": "array", + "items": { + "type": "object", + "properties": { + "name": { + "type": "string" + }, + "return_value": { + "type": "object", + "properties": { + "type": { + "type": "string" + }, + "description": { + "type": "array", + "items": { + "type": "string" + } + } + }, + "required": ["type"], + "additionalProperties": false + }, + "arguments": { + "type": "array", + "items": { + "type": "object", + "properties": { + "type": { + "type": "string" + }, + "name": { + "type": "string" + }, + "description": { + "type": "array", + "items": { + "type": "string" + } + } + }, + "required": ["type"], + "additionalProperties": false + } + }, + "description": { + "type": "array", + "items": { + "type": "string" + } + }, + "since": { + "type": "string", + "pattern": "4\\.[0-9]+" + }, + "deprecated": { + "type": "string" + }, + "see": { + "type": "array", + "items": { + "type": "string" + } + }, + "legacy_type_name": { + "type": "string" + } + }, + "required": [ + "name", + "return_value", + "arguments", + "description", + "since" + ], + "additionalProperties": false + } + } + }, + "required": [ + "_copyright", + "$schema", + "format_version", + "types", + "interface" + ], + "additionalProperties": false +} diff --git a/core/extension/gdextension_interface_header_generator.cpp b/core/extension/gdextension_interface_header_generator.cpp new file mode 100644 index 00000000000..b409c33002d --- /dev/null +++ b/core/extension/gdextension_interface_header_generator.cpp @@ -0,0 +1,309 @@ +/**************************************************************************/ +/* gdextension_interface_header_generator.cpp */ +/**************************************************************************/ +/* This file is part of: */ +/* GODOT ENGINE */ +/* https://godotengine.org */ +/**************************************************************************/ +/* Copyright (c) 2014-present Godot Engine contributors (see AUTHORS.md). */ +/* Copyright (c) 2007-2014 Juan Linietsky, Ariel Manzur. */ +/* */ +/* Permission is hereby granted, free of charge, to any person obtaining */ +/* a copy of this software and associated documentation files (the */ +/* "Software"), to deal in the Software without restriction, including */ +/* without limitation the rights to use, copy, modify, merge, publish, */ +/* distribute, sublicense, and/or sell copies of the Software, and to */ +/* permit persons to whom the Software is furnished to do so, subject to */ +/* the following conditions: */ +/* */ +/* The above copyright notice and this permission notice shall be */ +/* included in all copies or substantial portions of the Software. */ +/* */ +/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */ +/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */ +/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. */ +/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */ +/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */ +/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */ +/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ +/**************************************************************************/ + +#ifdef TOOLS_ENABLED + +#include "gdextension_interface_header_generator.h" + +#include "core/io/json.h" +#include "gdextension_interface_dump.gen.h" + +static const char *FILE_HEADER = + "/**************************************************************************/\n" + "/* gdextension_interface.h */\n"; + +static const char *INTRO = + "\n" + "#pragma once\n" + "\n" + "/* This is a C class header, you can copy it and use it directly in your own binders.\n" + " * Together with the `extension_api.json` file, you should be able to generate any binder.\n" + " */\n" + "\n" + "#ifndef __cplusplus\n" + "#include \n" + "#include \n" + "\n" + "typedef uint32_t char32_t;\n" + "typedef uint16_t char16_t;\n" + "#else\n" + "#include \n" + "#include \n" + "\n" + "extern \"C\" {\n" + "#endif\n" + "\n"; + +static const char *OUTRO = + "#ifdef __cplusplus\n" + "}\n" + "#endif\n"; + +void GDExtensionInterfaceHeaderGenerator::generate_gdextension_interface_header(const String &p_path) { + Ref fa = FileAccess::open(p_path, FileAccess::WRITE); + ERR_FAIL_COND_MSG(fa.is_null(), vformat("Cannot open file '%s' for writing.", p_path)); + + Vector bytes = GDExtensionInterfaceDump::load_gdextension_interface_file(); + String json_string = String::utf8(Span((char *)bytes.ptr(), bytes.size())); + + Ref json; + json.instantiate(); + Error err = json->parse(json_string); + ERR_FAIL_COND(err); + + Dictionary data = json->get_data(); + ERR_FAIL_COND(data.is_empty()); + + fa->store_string(FILE_HEADER); + + Array copyright = data["_copyright"]; + for (const Variant &line : copyright) { + fa->store_line(line); + } + + fa->store_string(INTRO); + + Array types = data["types"]; + for (Dictionary type_dict : types) { + if (type_dict.has("description")) { + write_doc(fa, type_dict["description"]); + } + String kind = type_dict["kind"]; + if (kind == "handle") { + type_dict["type"] = type_dict.get("const", false) ? "const void*" : "void*"; + write_simple_type(fa, type_dict); + } else if (kind == "alias") { + write_simple_type(fa, type_dict); + } else if (kind == "enum") { + write_enum_type(fa, type_dict); + } else if (kind == "function") { + write_function_type(fa, type_dict); + } else if (kind == "struct") { + write_struct_type(fa, type_dict); + } + } + + Array interfaces = data["interface"]; + for (const Variant &interface : interfaces) { + write_interface(fa, interface); + } + + fa->store_string(OUTRO); +} + +void GDExtensionInterfaceHeaderGenerator::write_doc(const Ref &p_fa, const Array &p_doc, const String &p_indent) { + if (p_doc.size() == 1) { + p_fa->store_string(vformat("%s/* %s */\n", p_indent, p_doc[0])); + return; + } + + bool first = true; + for (const Variant &line : p_doc) { + if (first) { + p_fa->store_string(p_indent + "/*"); + first = false; + } else { + p_fa->store_string(p_indent + " *"); + } + + if (line == "") { + p_fa->store_string("\n"); + } else { + p_fa->store_line(String(" ") + (String)line); + } + } + + p_fa->store_string(p_indent + " */\n"); +} + +void GDExtensionInterfaceHeaderGenerator::write_simple_type(const Ref &p_fa, const Dictionary &p_type) { + String type_and_name = format_type_and_name(p_type["type"], p_type["name"]); + p_fa->store_string(vformat("typedef %s;%s\n", type_and_name, make_deprecated_note(p_type))); +} + +void GDExtensionInterfaceHeaderGenerator::write_enum_type(const Ref &p_fa, const Dictionary &p_enum) { + p_fa->store_string("typedef enum {\n"); + Array values = p_enum["values"]; + for (Dictionary value_dict : values) { + if (value_dict.has("description")) { + write_doc(p_fa, value_dict["description"], "\t"); + } + p_fa->store_string(vformat("\t%s = %s,\n", value_dict["name"], (int)value_dict["value"])); + } + p_fa->store_string(vformat("} %s;%s\n\n", p_enum["name"], make_deprecated_note(p_enum))); +} + +void GDExtensionInterfaceHeaderGenerator::write_function_type(const Ref &p_fa, const Dictionary &p_func) { + String args_text = p_func.has("arguments") ? make_args_text(p_func["arguments"]) : ""; + String name_and_args = vformat("(*%s)(%s)", p_func["name"], args_text); + Dictionary ret = p_func["return_value"]; + p_fa->store_string(vformat("typedef %s;%s\n", format_type_and_name(ret["type"], name_and_args), make_deprecated_note(p_func))); +} + +void GDExtensionInterfaceHeaderGenerator::write_struct_type(const Ref &p_fa, const Dictionary &p_struct) { + p_fa->store_string("typedef struct {\n"); + Array members = p_struct["members"]; + for (Dictionary member_dict : members) { + if (member_dict.has("description")) { + write_doc(p_fa, member_dict["description"], "\t"); + } + p_fa->store_string(vformat("\t%s;\n", format_type_and_name(member_dict["type"], member_dict["name"]))); + } + p_fa->store_string(vformat("} %s;%s\n\n", p_struct["name"], make_deprecated_note(p_struct))); +} + +String GDExtensionInterfaceHeaderGenerator::format_type_and_name(const String &p_type, const String &p_name) { + String ret = p_type; + bool is_pointer = false; + if (ret.ends_with("*")) { + ret = ret.substr(0, ret.size() - 2) + " *"; + is_pointer = true; + } + if (!p_name.is_empty()) { + if (is_pointer) { + ret = ret + p_name; + } else { + ret = ret + " " + p_name; + } + } + return ret; +} + +String GDExtensionInterfaceHeaderGenerator::make_deprecated_note(const Dictionary &p_type) { + if (!p_type.has("deprecated")) { + return ""; + } + return vformat(" /* %s */", p_type["deprecated"]); +} + +String GDExtensionInterfaceHeaderGenerator::make_args_text(const Array &p_args) { + Vector combined; + for (Dictionary arg_dict : p_args) { + combined.push_back(format_type_and_name(arg_dict["type"], arg_dict.get("name", String()))); + } + return String(", ").join(combined); +} + +void GDExtensionInterfaceHeaderGenerator::write_interface(const Ref &p_fa, const Dictionary &p_interface) { + Vector doc; + + doc.push_back(String("@name ") + (String)p_interface["name"]); + doc.push_back(String("@since ") + (String)p_interface["since"]); + + if (p_interface.has("deprecated")) { + String deprecated = p_interface["deprecated"]; + if (deprecated.to_lower().begins_with("deprecated")) { + Vector parts = deprecated.split_spaces(1); + deprecated = parts[1]; + } + doc.push_back(String("@deprecated ") + deprecated); + } + + Array orig_doc = p_interface["description"]; + for (int i = 0; i < orig_doc.size(); i++) { + // Put an empty line before the 1st and 2nd lines. + if (i <= 1) { + doc.push_back(""); + } + doc.push_back(orig_doc[i]); + } + + if (p_interface.has("arguments")) { + Array args = p_interface["arguments"]; + if (args.size() > 0) { + doc.push_back(""); + for (Dictionary arg_dict : args) { + String arg_string = String("@param ") + (String)arg_dict["name"]; + if (arg_dict.has("description")) { + Array arg_doc = arg_dict["description"]; + for (const Variant &d : arg_doc) { + arg_string += String(" ") + (String)d; + } + } + doc.push_back(arg_string); + } + } + } + + if (p_interface.has("return_value")) { + Dictionary ret = p_interface["return_value"]; + if (ret["type"] != "void") { + String ret_string = String("@return"); + if (ret.has("description")) { + Array arg_doc = ret["description"]; + for (const Variant &d : arg_doc) { + ret_string += String(" ") + (String)d; + } + } + doc.push_back(""); + doc.push_back(ret_string); + } + } + + if (p_interface.has("see")) { + Array see_array = p_interface["see"]; + if (see_array.size() > 0) { + doc.push_back(""); + for (const Variant &see : see_array) { + doc.push_back(String("@see ") + (String)see); + } + } + } + + p_fa->store_string("/**\n"); + for (const String &d : doc) { + if (d == "") { + p_fa->store_string(" *\n"); + } else { + p_fa->store_string(vformat(" * %s\n", d)); + } + } + p_fa->store_string(" */\n"); + + Dictionary func = p_interface.duplicate(); + func.erase("deprecated"); + if (p_interface.has("legacy_type_name")) { + // @todo When we can break compat, remove this! This maintains legacy type-o's in some type names. + func["name"] = p_interface["legacy_type_name"]; + } else { + // Cannot use `to_pascal_case()` because it'll capitalize after numbers. + Vector words = ((String)p_interface["name"]).split("_"); + for (String &word : words) { + // Cannot use `capitalize()` on the whole string, because it'll separate numbers with a space. + word[0] = String::char_uppercase(word[0]); + } + func["name"] = String("GDExtensionInterface") + String().join(words); + } + write_function_type(p_fa, func); + + p_fa->store_string("\n"); +} + +#endif // TOOLS_ENABLED diff --git a/core/extension/gdextension_interface_header_generator.h b/core/extension/gdextension_interface_header_generator.h new file mode 100644 index 00000000000..ebc07e64618 --- /dev/null +++ b/core/extension/gdextension_interface_header_generator.h @@ -0,0 +1,55 @@ +/**************************************************************************/ +/* gdextension_interface_header_generator.h */ +/**************************************************************************/ +/* This file is part of: */ +/* GODOT ENGINE */ +/* https://godotengine.org */ +/**************************************************************************/ +/* Copyright (c) 2014-present Godot Engine contributors (see AUTHORS.md). */ +/* Copyright (c) 2007-2014 Juan Linietsky, Ariel Manzur. */ +/* */ +/* Permission is hereby granted, free of charge, to any person obtaining */ +/* a copy of this software and associated documentation files (the */ +/* "Software"), to deal in the Software without restriction, including */ +/* without limitation the rights to use, copy, modify, merge, publish, */ +/* distribute, sublicense, and/or sell copies of the Software, and to */ +/* permit persons to whom the Software is furnished to do so, subject to */ +/* the following conditions: */ +/* */ +/* The above copyright notice and this permission notice shall be */ +/* included in all copies or substantial portions of the Software. */ +/* */ +/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */ +/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */ +/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. */ +/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */ +/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */ +/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */ +/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ +/**************************************************************************/ + +#pragma once + +#ifdef TOOLS_ENABLED + +#include "core/io/file_access.h" + +class GDExtensionInterfaceHeaderGenerator { +public: + static void generate_gdextension_interface_header(const String &p_path); + +private: + static void write_doc(const Ref &p_fa, const Array &p_doc, const String &p_indent = ""); + static void write_simple_type(const Ref &p_fa, const Dictionary &p_type); + static void write_enum_type(const Ref &p_fa, const Dictionary &p_enum); + static void write_function_type(const Ref &p_fa, const Dictionary &p_func); + static void write_struct_type(const Ref &p_fa, const Dictionary &p_struct); + + static String format_type_and_name(const String &p_type, const String &p_name); + static String make_deprecated_note(const Dictionary &p_type); + static String make_args_text(const Array &p_args); + + static void write_interface(const Ref &p_fa, const Dictionary &p_interface); +}; + +#endif // TOOLS_ENABLED diff --git a/core/extension/godot_instance.h b/core/extension/godot_instance.h index 08d44d15d0f..8d1ecf453d9 100644 --- a/core/extension/godot_instance.h +++ b/core/extension/godot_instance.h @@ -30,7 +30,7 @@ #pragma once -#include "core/extension/gdextension_interface.h" +#include "core/extension/gdextension_interface.gen.h" #include "core/object/class_db.h" class GodotInstance : public Object { diff --git a/core/extension/make_interface_dumper.py b/core/extension/make_interface_dumper.py index 45f257a331a..024ac712ef1 100644 --- a/core/extension/make_interface_dumper.py +++ b/core/extension/make_interface_dumper.py @@ -22,15 +22,22 @@ inline constexpr unsigned char _gdextension_interface_data_compressed[] = {{ class GDExtensionInterfaceDump {{ public: - static void generate_gdextension_interface_file(const String &p_path) {{ - Ref fa = FileAccess::open(p_path, FileAccess::WRITE); - ERR_FAIL_COND_MSG(fa.is_null(), vformat("Cannot open file '%s' for writing.", p_path)); + static Vector load_gdextension_interface_file() {{ Vector data; data.resize(_gdextension_interface_data_uncompressed_size); int ret = Compression::decompress(data.ptrw(), _gdextension_interface_data_uncompressed_size, _gdextension_interface_data_compressed, _gdextension_interface_data_compressed_size, Compression::MODE_DEFLATE); - ERR_FAIL_COND_MSG(ret == -1, "Compressed file is corrupt."); - fa->store_buffer(data.ptr(), data.size()); - }}; + ERR_FAIL_COND_V_MSG(ret == -1, Vector(), "Compressed file is corrupt."); + return data; + }} + + static void generate_gdextension_interface_file(const String &p_path) {{ + Ref fa = FileAccess::open(p_path, FileAccess::WRITE); + ERR_FAIL_COND_MSG(fa.is_null(), vformat("Cannot open file '%s' for writing.", p_path)); + Vector data = load_gdextension_interface_file(); + if (data.size() > 0) {{ + fa->store_buffer(data.ptr(), data.size()); + }} + }} }}; #endif // TOOLS_ENABLED diff --git a/core/extension/make_interface_header.py b/core/extension/make_interface_header.py new file mode 100644 index 00000000000..496dfc6e513 --- /dev/null +++ b/core/extension/make_interface_header.py @@ -0,0 +1,306 @@ +import difflib +import json +from collections import OrderedDict + +import methods + +BASE_TYPES = [ + "void", + "int", + "int8_t", + "uint8_t", + "int16_t", + "uint16_t", + "int32_t", + "uint32_t", + "int64_t", + "uint64_t", + "size_t", + "char", + "char16_t", + "char32_t", + "wchar_t", + "float", + "double", +] + + +def run(target, source, env): + filename = str(source[0]) + buffer = methods.get_buffer(filename) + data = json.loads(buffer, object_pairs_hook=OrderedDict) + check_formatting(buffer.decode("utf-8"), data, filename) + check_allowed_keys(data, ["_copyright", "$schema", "format_version", "types", "interface"]) + + valid_data_types = {} + for type in BASE_TYPES: + valid_data_types[type] = True + + with methods.generated_wrapper(str(target[0])) as file: + file.write("""\ +#ifndef __cplusplus +#include +#include + +typedef uint32_t char32_t; +typedef uint16_t char16_t; +#else +#include +#include + +extern "C" { +#endif + +""") + + handles = [] + for type in data["types"]: + kind = type["kind"] + + check_type(kind, type, valid_data_types) + valid_data_types[type["name"]] = True + + if "description" in type: + write_doc(file, type["description"]) + + if kind == "handle": + check_allowed_keys(type, ["name", "kind"], ["const", "parent", "description", "deprecated"]) + if "parent" in type and type["parent"] not in handles: + raise UnknownTypeError(type["parent"], type["name"]) + # @todo In the future, let's write these as `struct *` so the compiler can help us with type checking. + type["type"] = "void*" if not type.get("const", False) else "const void*" + write_simple_type(file, type) + handles.append(type["name"]) + elif kind == "alias": + check_allowed_keys(type, ["name", "kind", "type"], ["description", "deprecated"]) + write_simple_type(file, type) + elif kind == "enum": + check_allowed_keys(type, ["name", "kind", "values"], ["description", "deprecated"]) + write_enum_type(file, type) + elif kind == "function": + check_allowed_keys(type, ["name", "kind", "return_value", "arguments"], ["description", "deprecated"]) + write_function_type(file, type) + elif kind == "struct": + check_allowed_keys(type, ["name", "kind", "members"], ["description", "deprecated"]) + write_struct_type(file, type) + else: + raise Exception(f"Unknown kind of type: {kind}") + + for interface in data["interface"]: + check_type("function", interface, valid_data_types) + check_allowed_keys( + interface, + ["name", "return_value", "arguments", "since", "description"], + ["see", "legacy_type_name", "deprecated"], + ) + write_interface(file, interface) + + file.write("""\ +#ifdef __cplusplus +} +#endif +""") + + +# Serialize back into JSON in order to see if the formatting remains the same. +def check_formatting(buffer, data, filename): + buffer2 = json.dumps(data, indent=4) + + lines1 = buffer.splitlines() + lines2 = buffer2.splitlines() + + diff = difflib.unified_diff( + lines1, + lines2, + fromfile="a/" + filename, + tofile="b/" + filename, + lineterm="", + ) + + diff = list(diff) + if len(diff) > 0: + print(" *** Apply this patch to fix: ***\n") + print("\n".join(diff)) + raise Exception(f"Formatting issues in {filename}") + + +def check_allowed_keys(data, required, optional=[]): + keys = data.keys() + allowed = required + optional + for k in keys: + if k not in allowed: + raise Exception(f"Found unknown key '{k}'") + for r in required: + if r not in keys: + raise Exception(f"Missing required key '{r}'") + + +class UnknownTypeError(Exception): + def __init__(self, unknown, parent, item=None): + self.unknown = unknown + self.parent = parent + if item: + msg = f"Unknown type '{unknown}' for '{item}' used in '{parent}'" + else: + msg = f"Unknown type '{unknown}' used in '{parent}'" + super().__init__(msg) + + +def base_type_name(type_name): + if type_name.startswith("const "): + type_name = type_name[6:] + if type_name.endswith("*"): + type_name = type_name[:-1] + return type_name + + +def format_type_and_name(type, name=None): + ret = type + if ret[-1] == "*": + ret = ret[:-1] + " *" + if name: + if ret[-1] == "*": + ret = ret + name + else: + ret = ret + " " + name + return ret + + +def check_type(kind, type, valid_data_types): + if kind == "alias": + if base_type_name(type["type"]) not in valid_data_types: + raise UnknownTypeError(type["type"], type["name"]) + elif kind == "struct": + for member in type["members"]: + if base_type_name(member["type"]) not in valid_data_types: + raise UnknownTypeError(member["type"], type["name"], member["name"]) + elif kind == "function": + for arg in type["arguments"]: + if base_type_name(arg["type"]) not in valid_data_types: + raise UnknownTypeError(arg["type"], type["name"], arg.get("name")) + if "return_value" in type: + if base_type_name(type["return_value"]["type"]) not in valid_data_types: + raise UnknownTypeError(type["return_value"]["type"], type["name"]) + + +def write_doc(file, doc, indent=""): + if len(doc) == 1: + file.write(f"{indent}/* {doc[0]} */\n") + return + + first = True + for line in doc: + if first: + file.write(indent + "/*") + first = False + else: + file.write(indent + " *") + + if line != "": + file.write(" " + line) + file.write("\n") + file.write(indent + " */\n") + + +def make_deprecated_note(type): + if "deprecated" not in type: + return "" + return f" /* {type['deprecated']} */" + + +def write_simple_type(file, type): + file.write(f"typedef {format_type_and_name(type['type'], type['name'])};{make_deprecated_note(type)}\n") + + +def write_enum_type(file, enum): + file.write("typedef enum {\n") + for value in enum["values"]: + check_allowed_keys(value, ["name", "value"], ["description", "deprecated"]) + if "description" in value: + write_doc(file, value["description"], "\t") + file.write(f"\t{value['name']} = {value['value']},\n") + file.write(f"}} {enum['name']};{make_deprecated_note(enum)}\n\n") + + +def make_args_text(args): + combined = [] + for arg in args: + check_allowed_keys(arg, ["type"], ["name", "description"]) + combined.append(format_type_and_name(arg["type"], arg.get("name"))) + return ", ".join(combined) + + +def write_function_type(file, fn): + args_text = make_args_text(fn["arguments"]) if ("arguments" in fn) else "" + name_and_args = f"(*{fn['name']})({args_text})" + file.write( + f"typedef {format_type_and_name(fn['return_value']['type'], name_and_args)};{make_deprecated_note(fn)}\n" + ) + + +def write_struct_type(file, struct): + file.write("typedef struct {\n") + for member in struct["members"]: + check_allowed_keys(member, ["name", "type"], ["description"]) + if "description" in member: + write_doc(file, member["description"], "\t") + file.write(f"\t{format_type_and_name(member['type'], member['name'])};\n") + file.write(f"}} {struct['name']};{make_deprecated_note(struct)}\n\n") + + +def write_interface(file, interface): + doc = [ + f"@name {interface['name']}", + f"@since {interface['since']}", + ] + + if "deprecated" in interface: + if interface["deprecated"].lower().startswith("deprecated "): + parts = interface["deprecated"].split(" ", 1) + interface["deprecated"] = parts[1] + doc.append(f"@deprecated {interface['deprecated']}") + + doc += [ + "", + interface["description"][0], + ] + + if len(interface["description"]) > 1: + doc.append("") + doc += interface["description"][1:] + + if "arguments" in interface: + doc.append("") + for arg in interface["arguments"]: + if "description" not in arg: + raise Exception(f"Interface function {interface['name']} is missing docs for {arg['name']} argument") + arg_doc = " ".join(arg["description"]) + doc.append(f"@param {arg['name']} {arg_doc}") + + if "return_value" in interface and interface["return_value"]["type"] != "void": + if "description" not in interface["return_value"]: + raise Exception(f"Interface function {interface['name']} is missing docs for return value") + ret_doc = " ".join(interface["return_value"]["description"]) + doc.append("") + doc.append(f"@return {ret_doc}") + + if "see" in interface: + doc.append("") + for see in interface["see"]: + doc.append(f"@see {see}") + + file.write("/**\n") + for d in doc: + if d != "": + file.write(f" * {d}\n") + else: + file.write(" *\n") + file.write(" */\n") + + fn = interface.copy() + if "deprecated" in fn: + del fn["deprecated"] + fn["name"] = "GDExtensionInterface" + "".join(word.capitalize() for word in interface["name"].split("_")) + write_function_type(file, fn) + + file.write("\n") diff --git a/core/object/object.h b/core/object/object.h index a026d277011..aeb8c752a06 100644 --- a/core/object/object.h +++ b/core/object/object.h @@ -30,7 +30,7 @@ #pragma once -#include "core/extension/gdextension_interface.h" +#include "core/extension/gdextension_interface.gen.h" #include "core/object/gdtype.h" #include "core/object/message_queue.h" #include "core/object/object_id.h" diff --git a/main/main.cpp b/main/main.cpp index 1d417905362..482da8f685c 100644 --- a/main/main.cpp +++ b/main/main.cpp @@ -36,6 +36,7 @@ #include "core/debugger/engine_debugger.h" #include "core/extension/extension_api_dump.h" #include "core/extension/gdextension_interface_dump.gen.h" +#include "core/extension/gdextension_interface_header_generator.h" #include "core/extension/gdextension_manager.h" #include "core/input/input.h" #include "core/input/input_map.h" @@ -278,6 +279,7 @@ static bool print_fps = false; #ifdef TOOLS_ENABLED static bool editor_pseudolocalization = false; static bool dump_gdextension_interface = false; +static bool dump_gdextension_interface_header = false; static bool dump_extension_api = false; static bool include_docs_in_extension_api_dump = false; static bool validate_extension_api = false; @@ -697,6 +699,7 @@ void Main::print_help(const char *p_binary) { #endif print_help_option("--build-solutions", "Build the scripting solutions (e.g. for C# projects). Implies --editor and requires a valid project to edit.\n", CLI_OPTION_AVAILABILITY_EDITOR); print_help_option("--dump-gdextension-interface", "Generate a GDExtension header file \"gdextension_interface.h\" in the current folder. This file is the base file required to implement a GDExtension.\n", CLI_OPTION_AVAILABILITY_EDITOR); + print_help_option("--dump-gdextension-interface-json", "Generate a JSON dump of the GDExtension interface named \"gdextension_interface.json\" in the current folder.\n", CLI_OPTION_AVAILABILITY_EDITOR); print_help_option("--dump-extension-api", "Generate a JSON dump of the Godot API for GDExtension bindings named \"extension_api.json\" in the current folder.\n", CLI_OPTION_AVAILABILITY_EDITOR); print_help_option("--dump-extension-api-with-docs", "Generate JSON dump of the Godot API like the previous option, but including documentation.\n", CLI_OPTION_AVAILABILITY_EDITOR); print_help_option("--validate-extension-api ", "Validate an extension API file dumped (with one of the two previous options) from a previous version of the engine to ensure API compatibility.\n", CLI_OPTION_AVAILABILITY_EDITOR); @@ -1525,12 +1528,22 @@ Error Main::setup(const char *execpath, int argc, char *argv[], bool p_second_ph // Register as an editor instance to use low-end fallback if relevant. editor = true; cmdline_tool = true; - dump_gdextension_interface = true; + dump_gdextension_interface_header = true; print_line("Dumping GDExtension interface header file"); // Hack. Not needed but otherwise we end up detecting that this should // run the project instead of a cmdline tool. // Needs full refactoring to fix properly. main_args.push_back(arg); + } else if (arg == "--dump-gdextension-interface-json") { + // Register as an editor instance to use low-end fallback if relevant. + editor = true; + cmdline_tool = true; + dump_gdextension_interface = true; + print_line("Dumping GDExtension interface json file"); + // Hack. Not needed but otherwise we end up detecting that this should + // run the project instead of a cmdline tool. + // Needs full refactoring to fix properly. + main_args.push_back(arg); } else if (arg == "--dump-extension-api") { // Register as an editor instance to use low-end fallback if relevant. editor = true; @@ -4041,7 +4054,11 @@ int Main::start() { // GDExtension API and interface. { if (dump_gdextension_interface) { - GDExtensionInterfaceDump::generate_gdextension_interface_file("gdextension_interface.h"); + GDExtensionInterfaceDump::generate_gdextension_interface_file("gdextension_interface.json"); + } + + if (dump_gdextension_interface_header) { + GDExtensionInterfaceHeaderGenerator::generate_gdextension_interface_header("gdextension_interface.h"); } if (dump_extension_api) { @@ -4049,7 +4066,7 @@ int Main::start() { GDExtensionAPIDump::generate_extension_json_file("extension_api.json", include_docs_in_extension_api_dump); } - if (dump_gdextension_interface || dump_extension_api) { + if (dump_gdextension_interface || dump_gdextension_interface_header || dump_extension_api) { return EXIT_SUCCESS; } diff --git a/modules/register_module_types.h b/modules/register_module_types.h index 08ba2b9cf4e..82b64a68c9f 100644 --- a/modules/register_module_types.h +++ b/modules/register_module_types.h @@ -30,7 +30,7 @@ #pragma once -#include "core/extension/gdextension_interface.h" +#include "core/extension/gdextension_interface.gen.h" enum ModuleInitializationLevel { MODULE_INITIALIZATION_LEVEL_CORE = GDEXTENSION_INITIALIZATION_CORE,