diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index e370058f4..df6efb37c 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -4,7 +4,7 @@ default_language_version: exclude: | (?x)^( gdextension/extension_api\.json| - gdextension/gdextension_interface\.h + gdextension/gdextension_interface\.json )$ repos: diff --git a/binding_generator.py b/binding_generator.py index 4da069967..34bee6081 100644 --- a/binding_generator.py +++ b/binding_generator.py @@ -5,6 +5,8 @@ import shutil from pathlib import Path +from make_interface_header import generate_gdextension_interface_header + def generate_mod_version(argcount, const=False, returns=False): s = """ @@ -68,11 +70,11 @@ def generate_virtual_version(argcount, const=False, returns=False, required=Fals s = """#define GDVIRTUAL$VER($RET m_name $ARG)\\ ::godot::StringName _gdvirtual_##m_name##_sn = #m_name;\\ _FORCE_INLINE_ bool _gdvirtual_##m_name##_call($CALLARGS) $CONST {\\ - if (::godot::internal::gdextension_interface_object_has_script_method(_owner, &_gdvirtual_##m_name##_sn)) { \\ + if (::godot::gdextension_interface::object_has_script_method(_owner, &_gdvirtual_##m_name##_sn)) { \\ GDExtensionCallError ce;\\ $CALLSIARGS\\ ::godot::Variant ret;\\ - ::godot::internal::gdextension_interface_object_call_script_method(_owner, &_gdvirtual_##m_name##_sn, $CALLSIARGPASS, &ret, &ce);\\ + ::godot::gdextension_interface::object_call_script_method(_owner, &_gdvirtual_##m_name##_sn, $CALLSIARGPASS, &ret, &ce);\\ if (ce.error == GDEXTENSION_CALL_OK) {\\ $CALLSIRET\\ return true;\\ @@ -83,7 +85,7 @@ def generate_virtual_version(argcount, const=False, returns=False, required=Fals return false;\\ }\\ _FORCE_INLINE_ bool _gdvirtual_##m_name##_overridden() const {\\ - return ::godot::internal::gdextension_interface_object_has_script_method(_owner, &_gdvirtual_##m_name##_sn); \\ + return ::godot::gdextension_interface::object_has_script_method(_owner, &_gdvirtual_##m_name##_sn); \\ }\\ _FORCE_INLINE_ static ::godot::MethodInfo _gdvirtual_##m_name##_get_method_info() {\\ ::godot::MethodInfo method_info;\\ @@ -211,10 +213,14 @@ def get_file_list(api_filepath, output_dir, headers=False, sources=False): def _get_file_list(api, output_dir, headers=False, sources=False): files = [] + gdextension_gen_folder = Path(output_dir) / "gen" / "include" core_gen_folder = Path(output_dir) / "gen" / "include" / "godot_cpp" / "core" include_gen_folder = Path(output_dir) / "gen" / "include" / "godot_cpp" source_gen_folder = Path(output_dir) / "gen" / "src" + files.append(str((gdextension_gen_folder / "gdextension_interface.h").as_posix())) + files.append(str((core_gen_folder / "gdextension_interface_loader.hpp").as_posix())) + files.append(str((source_gen_folder / "gdextension_interface_loader.cpp").as_posix())) files.append(str((core_gen_folder / "ext_wrappers.gen.inc").as_posix())) files.append(str((core_gen_folder / "gdvirtual.gen.inc").as_posix())) @@ -277,14 +283,18 @@ def print_file_list(api_filepath, output_dir, headers=False, sources=False): print(*get_file_list(api_filepath, output_dir, headers, sources), sep=";", end=None) -def generate_bindings(api_filepath, use_template_get_node, bits="64", precision="single", output_dir="."): +def generate_bindings( + api_filepath, interface_filepath, use_template_get_node, bits="64", precision="single", output_dir="." +): api = {} with open(api_filepath, encoding="utf-8") as api_file: api = json.load(api_file) - _generate_bindings(api, api_filepath, use_template_get_node, bits, precision, output_dir) + _generate_bindings(api, api_filepath, interface_filepath, use_template_get_node, bits, precision, output_dir) -def _generate_bindings(api, api_filepath, use_template_get_node, bits="64", precision="single", output_dir="."): +def _generate_bindings( + api, api_filepath, interface_filepath, use_template_get_node, bits="64", precision="single", output_dir="." +): if "precision" in api["header"] and precision != api["header"]["precision"]: raise Exception( f"Cannot do a precision={precision} build using '{api_filepath}' which was generated by Godot built with precision={api['header']['precision']}" @@ -298,6 +308,16 @@ def _generate_bindings(api, api_filepath, use_template_get_node, bits="64", prec real_t = "double" if precision == "double" else "float" print("Built-in type config: " + real_t + "_" + bits) + header_lines = [] + add_header("gdextension_interface.h", header_lines) + gdextension_gen_folder = Path(output_dir) / "gen" / "include" + gdextension_gen_folder.mkdir(parents=True, exist_ok=True) + generate_gdextension_interface_header( + str((gdextension_gen_folder / "gdextension_interface.h").as_posix()), interface_filepath, header_lines + ) + + generate_gdextension_interface_loader(interface_filepath, target_dir) + generate_global_constants(api, target_dir) generate_version_header(api, target_dir) generate_global_constant_binds(api, target_dir) @@ -306,6 +326,164 @@ def _generate_bindings(api, api_filepath, use_template_get_node, bits="64", prec generate_utility_functions(api, target_dir) +def generate_gdextension_interface_loader(interface_filepath, output_dir): + include_gen_folder = Path(output_dir) / "include" / "godot_cpp" / "core" + source_gen_folder = Path(output_dir) / "src" + + include_gen_folder.mkdir(parents=True, exist_ok=True) + source_gen_folder.mkdir(parents=True, exist_ok=True) + + header_filename = include_gen_folder / "gdextension_interface_loader.hpp" + source_filename = source_gen_folder / "gdextension_interface_loader.cpp" + + with open(interface_filepath, "rt") as file: + data = json.load(file) + + functions_by_version = {} + for func in data["interface"]: + since = func["since"] + if since not in functions_by_version: + functions_by_version[since] = [] + functions_by_version[since].append(func) + + with header_filename.open("wt", encoding="utf-8") as header_file: + header_file.write(generate_gdextension_interface_loader_header(functions_by_version)) + + with source_filename.open("wt", encoding="utf-8") as source_file: + source_file.write(generate_gdextension_interface_loader_source(functions_by_version)) + + +def gdextension_interface_type_name(name): + return "GDExtensionInterface" + "".join(word.capitalize() for word in name.split("_")) + + +def generate_gdextension_interface_loader_header(data): + result = [] + add_header("gdextension_interface_loader.hpp", result) + + result.append("#pragma once") + result.append("") + + result.append("#include ") + result.append("#include ") + result.append("") + + result.append("namespace godot {") + result.append("") + result.append("namespace gdextension_interface {") + result.append("") + + versions = sorted(data.keys()) + for version in versions: + (major, minor) = version.split(".") + result.append(f"// Godot 4.{minor} or newer.") + result.append(f"#if GODOT_VERSION_MINOR >= {minor}") + + for func in data[version]: + name = func["name"] + fn = gdextension_interface_type_name(name) + + if "deprecated" in func: + (deprecated_major, deprecated_minor) = func["deprecated"]["since"].split(".") + result.append(f"#if !defined(DISABLE_DEPRECATED) || GODOT_VERSION_MINOR < {deprecated_minor}") + + result.append(f'extern "C" {fn} {name};') + + if "deprecated" in func: + result.append("#endif") + + result.append(f"#endif // GODOT_VERSION_MINOR >= {minor}") + result.append("") + + result.append("} // namespace gdextension_interface") + result.append("") + result.append("namespace internal {") + result.append("") + result.append("bool load_gdextension_interface(GDExtensionInterfaceGetProcAddress p_get_proc_address);") + result.append("") + result.append("} // namespace internal") + result.append("") + result.append("} // namespace godot") + + return "\n".join(result) + + +def generate_gdextension_interface_loader_source(data): + result = [] + add_header("gdextension_interface_loader.cpp", result) + + result.append("#include ") + result.append("#include ") + result.append("#include ") + result.append("") + + result.append("namespace godot {") + result.append("") + result.append("namespace gdextension_interface {") + result.append("") + + versions = sorted(data.keys()) + + for version in versions: + (major, minor) = version.split(".") + result.append(f"// Godot 4.{minor} or newer.") + result.append(f"#if GODOT_VERSION_MINOR >= {minor}") + + for func in data[version]: + name = func["name"] + fn = gdextension_interface_type_name(name) + + if "deprecated" in func: + (deprecated_major, deprecated_minor) = func["deprecated"]["since"].split(".") + result.append(f"#if !defined(DISABLE_DEPRECATED) || GODOT_VERSION_MINOR < {deprecated_minor}") + + result.append(f"{fn} {name} = nullptr;") + + if "deprecated" in func: + result.append("#endif") + + result.append(f"#endif // GODOT_VERSION_MINOR >= {minor}") + result.append("") + + result.append("} // namespace gdextension_interface") + result.append("") + result.append("namespace internal {") + result.append("") + + result.append("bool load_gdextension_interface(GDExtensionInterfaceGetProcAddress p_get_proc_address) {") + + for version in versions: + (major, minor) = version.split(".") + result.append(f"\t// Godot 4.{minor} or newer.") + result.append(f"#if GODOT_VERSION_MINOR >= {minor}") + + for func in data[version]: + name = func["name"] + fn = gdextension_interface_type_name(name) + + if "deprecated" in func: + (deprecated_major, deprecated_minor) = func["deprecated"]["since"].split(".") + result.append(f"#if !defined(DISABLE_DEPRECATED) || GODOT_VERSION_MINOR < {deprecated_minor}") + + result.append(f"\tLOAD_PROC_ADDRESS({name}, {fn});") + + if "deprecated" in func: + result.append("#endif") + + result.append(f"#endif // GODOT_VERSION_MINOR >= {minor}") + result.append("") + + result.append("\treturn true;") + result.append("}") + result.append("") + + result.append("} // namespace internal") + result.append("") + result.append("} // namespace godot") + + return "\n".join(result) + + CLASS_ALIASES = { "ClassDB": "ClassDBSingleton", } @@ -1034,18 +1212,18 @@ def generate_builtin_class_source(builtin_api, size, used_classes, fully_used_cl result.append(f"void {class_name}::_init_bindings_constructors_destructor() {{") result.append( - f"\t_method_bindings.from_variant_constructor = internal::gdextension_interface_get_variant_to_type_constructor({enum_type_name});" + f"\t_method_bindings.from_variant_constructor = ::godot::gdextension_interface::get_variant_to_type_constructor({enum_type_name});" ) if "constructors" in builtin_api: for constructor in builtin_api["constructors"]: result.append( - f"\t_method_bindings.constructor_{constructor['index']} = internal::gdextension_interface_variant_get_ptr_constructor({enum_type_name}, {constructor['index']});" + f"\t_method_bindings.constructor_{constructor['index']} = ::godot::gdextension_interface::variant_get_ptr_constructor({enum_type_name}, {constructor['index']});" ) if builtin_api["has_destructor"]: result.append( - f"\t_method_bindings.destructor = internal::gdextension_interface_variant_get_ptr_destructor({enum_type_name});" + f"\t_method_bindings.destructor = ::godot::gdextension_interface::variant_get_ptr_destructor({enum_type_name});" ) result.append("}") @@ -1064,36 +1242,36 @@ def generate_builtin_class_source(builtin_api, size, used_classes, fully_used_cl # TODO: Add error check for hash mismatch. result.append(f'\t_gde_name = StringName("{method["name"]}");') result.append( - f"\t_method_bindings.method_{method['name']} = internal::gdextension_interface_variant_get_ptr_builtin_method({enum_type_name}, _gde_name._native_ptr(), {method['hash']});" + f"\t_method_bindings.method_{method['name']} = ::godot::gdextension_interface::variant_get_ptr_builtin_method({enum_type_name}, _gde_name._native_ptr(), {method['hash']});" ) if "members" in builtin_api: for member in builtin_api["members"]: result.append(f'\t_gde_name = StringName("{member["name"]}");') result.append( - f"\t_method_bindings.member_{member['name']}_setter = internal::gdextension_interface_variant_get_ptr_setter({enum_type_name}, _gde_name._native_ptr());" + f"\t_method_bindings.member_{member['name']}_setter = ::godot::gdextension_interface::variant_get_ptr_setter({enum_type_name}, _gde_name._native_ptr());" ) result.append( - f"\t_method_bindings.member_{member['name']}_getter = internal::gdextension_interface_variant_get_ptr_getter({enum_type_name}, _gde_name._native_ptr());" + f"\t_method_bindings.member_{member['name']}_getter = ::godot::gdextension_interface::variant_get_ptr_getter({enum_type_name}, _gde_name._native_ptr());" ) if "indexing_return_type" in builtin_api: result.append( - f"\t_method_bindings.indexed_setter = internal::gdextension_interface_variant_get_ptr_indexed_setter({enum_type_name});" + f"\t_method_bindings.indexed_setter = ::godot::gdextension_interface::variant_get_ptr_indexed_setter({enum_type_name});" ) result.append( - f"\t_method_bindings.indexed_getter = internal::gdextension_interface_variant_get_ptr_indexed_getter({enum_type_name});" + f"\t_method_bindings.indexed_getter = ::godot::gdextension_interface::variant_get_ptr_indexed_getter({enum_type_name});" ) if "is_keyed" in builtin_api and builtin_api["is_keyed"]: result.append( - f"\t_method_bindings.keyed_setter = internal::gdextension_interface_variant_get_ptr_keyed_setter({enum_type_name});" + f"\t_method_bindings.keyed_setter = ::godot::gdextension_interface::variant_get_ptr_keyed_setter({enum_type_name});" ) result.append( - f"\t_method_bindings.keyed_getter = internal::gdextension_interface_variant_get_ptr_keyed_getter({enum_type_name});" + f"\t_method_bindings.keyed_getter = ::godot::gdextension_interface::variant_get_ptr_keyed_getter({enum_type_name});" ) result.append( - f"\t_method_bindings.keyed_checker = internal::gdextension_interface_variant_get_ptr_keyed_checker({enum_type_name});" + f"\t_method_bindings.keyed_checker = ::godot::gdextension_interface::variant_get_ptr_keyed_checker({enum_type_name});" ) if "operators" in builtin_api: @@ -1106,11 +1284,11 @@ def generate_builtin_class_source(builtin_api, size, used_classes, fully_used_cl f"GDEXTENSION_VARIANT_TYPE_{camel_to_snake(operator['right_type']).upper()}" ) result.append( - f"\t_method_bindings.operator_{get_operator_id_name(operator['name'])}_{operator['right_type']} = internal::gdextension_interface_variant_get_ptr_operator_evaluator(GDEXTENSION_VARIANT_OP_{get_operator_id_name(operator['name']).upper()}, {enum_type_name}, {right_type_variant_type});" + f"\t_method_bindings.operator_{get_operator_id_name(operator['name'])}_{operator['right_type']} = ::godot::gdextension_interface::variant_get_ptr_operator_evaluator(GDEXTENSION_VARIANT_OP_{get_operator_id_name(operator['name']).upper()}, {enum_type_name}, {right_type_variant_type});" ) else: result.append( - f"\t_method_bindings.operator_{get_operator_id_name(operator['name'])} = internal::gdextension_interface_variant_get_ptr_operator_evaluator(GDEXTENSION_VARIANT_OP_{get_operator_id_name(operator['name']).upper()}, {enum_type_name}, GDEXTENSION_VARIANT_TYPE_NIL);" + f"\t_method_bindings.operator_{get_operator_id_name(operator['name'])} = ::godot::gdextension_interface::variant_get_ptr_operator_evaluator(GDEXTENSION_VARIANT_OP_{get_operator_id_name(operator['name']).upper()}, {enum_type_name}, GDEXTENSION_VARIANT_TYPE_NIL);" ) result.append("}") @@ -1134,9 +1312,7 @@ def generate_builtin_class_source(builtin_api, size, used_classes, fully_used_cl result.append(method_signature) - method_call = ( - f"\tinternal::_call_builtin_constructor(_method_bindings.constructor_{constructor['index']}, &opaque" - ) + method_call = f"\t::godot::internal::_call_builtin_constructor(_method_bindings.constructor_{constructor['index']}, &opaque" if "arguments" in constructor: if len(constructor["arguments"]) == 1 and constructor["arguments"][0]["type"] == class_name: copy_constructor_index = constructor["index"] @@ -1161,7 +1337,7 @@ def generate_builtin_class_source(builtin_api, size, used_classes, fully_used_cl result.append(f"{class_name}::{class_name}({class_name} &&p_other) {{") if needs_copy_instead_of_move(class_name) and copy_constructor_index >= 0: result.append( - f"\tinternal::_call_builtin_constructor(_method_bindings.constructor_{copy_constructor_index}, &opaque, &p_other);" + f"\t::godot::internal::_call_builtin_constructor(_method_bindings.constructor_{copy_constructor_index}, &opaque, &p_other);" ) else: result.append("\tstd::swap(opaque, p_other.opaque);") @@ -1193,16 +1369,16 @@ def generate_builtin_class_source(builtin_api, size, used_classes, fully_used_cl if "return_type" in method: return_type = method["return_type"] if is_enum(return_type): - method_call += f"return ({get_gdextension_type(correct_type(return_type))})internal::_call_builtin_method_ptr_ret(" + method_call += f"return ({get_gdextension_type(correct_type(return_type))})::godot::internal::_call_builtin_method_ptr_ret(" elif is_pod_type(return_type) or is_variant(return_type): - method_call += f"return internal::_call_builtin_method_ptr_ret<{get_gdextension_type(correct_type(return_type))}>(" + method_call += f"return ::godot::internal::_call_builtin_method_ptr_ret<{get_gdextension_type(correct_type(return_type))}>(" elif is_refcounted(return_type): - method_call += f"return Ref<{return_type}>::_gde_internal_constructor(internal::_call_builtin_method_ptr_ret_obj<{return_type}>(" + method_call += f"return Ref<{return_type}>::_gde_internal_constructor(::godot::internal::_call_builtin_method_ptr_ret_obj<{return_type}>(" is_ref = True else: - method_call += f"return internal::_call_builtin_method_ptr_ret_obj<{return_type}>(" + method_call += f"return ::godot::internal::_call_builtin_method_ptr_ret_obj<{return_type}>(" else: - method_call += "internal::_call_builtin_method_ptr_no_ret(" + method_call += "::godot::internal::_call_builtin_method_ptr_no_ret(" method_call += f"_method_bindings.method_{method['name']}, " if "is_static" in method and method["is_static"]: method_call += "nullptr" @@ -1235,7 +1411,7 @@ def generate_builtin_class_source(builtin_api, size, used_classes, fully_used_cl if f"get_{member['name']}" not in method_list: result.append(f"{correct_type(member['type'])} {class_name}::get_{member['name']}() const {{") result.append( - f"\treturn internal::_call_builtin_ptr_getter<{correct_type(member['type'])}>(_method_bindings.member_{member['name']}_getter, (GDExtensionConstTypePtr)&opaque);" + f"\treturn ::godot::internal::_call_builtin_ptr_getter<{correct_type(member['type'])}>(_method_bindings.member_{member['name']}_getter, (GDExtensionConstTypePtr)&opaque);" ) result.append("}") @@ -1260,7 +1436,7 @@ def generate_builtin_class_source(builtin_api, size, used_classes, fully_used_cl (encode, arg_name) = get_encoded_arg("other", operator["right_type"], None) result += encode result.append( - f"\treturn internal::_call_builtin_operator_ptr<{get_gdextension_type(correct_type(operator['return_type']))}>(_method_bindings.operator_{get_operator_id_name(operator['name'])}_{operator['right_type']}, (GDExtensionConstTypePtr)&opaque, (GDExtensionConstTypePtr){arg_name});" + f"\treturn ::godot::internal::_call_builtin_operator_ptr<{get_gdextension_type(correct_type(operator['return_type']))}>(_method_bindings.operator_{get_operator_id_name(operator['name'])}_{operator['right_type']}, (GDExtensionConstTypePtr)&opaque, (GDExtensionConstTypePtr){arg_name});" ) result.append("}") else: @@ -1268,7 +1444,7 @@ def generate_builtin_class_source(builtin_api, size, used_classes, fully_used_cl f"{correct_type(operator['return_type'])} {class_name}::operator{get_operator_cpp_name(operator['name'])}() const {{" ) result.append( - f"\treturn internal::_call_builtin_operator_ptr<{get_gdextension_type(correct_type(operator['return_type']))}>(_method_bindings.operator_{get_operator_id_name(operator['name'])}, (GDExtensionConstTypePtr)&opaque, (GDExtensionConstTypePtr) nullptr);" + f"\treturn ::godot::internal::_call_builtin_operator_ptr<{get_gdextension_type(correct_type(operator['return_type']))}>(_method_bindings.operator_{get_operator_id_name(operator['name'])}, (GDExtensionConstTypePtr)&opaque, (GDExtensionConstTypePtr) nullptr);" ) result.append("}") result.append("") @@ -1285,7 +1461,7 @@ def generate_builtin_class_source(builtin_api, size, used_classes, fully_used_cl ) result += encode result.append( - f"\tinternal::_call_builtin_constructor(_method_bindings.constructor_{copy_constructor_index}, &opaque, {arg_name});" + f"\t::godot::internal::_call_builtin_constructor(_method_bindings.constructor_{copy_constructor_index}, &opaque, {arg_name});" ) result.append("\treturn *this;") result.append("}") @@ -1295,7 +1471,7 @@ def generate_builtin_class_source(builtin_api, size, used_classes, fully_used_cl result.append(f"{class_name} &{class_name}::operator=({class_name} &&p_other) {{") if needs_copy_instead_of_move(class_name) and copy_constructor_index >= 0: result.append( - f"\tinternal::_call_builtin_constructor(_method_bindings.constructor_{copy_constructor_index}, &opaque, &p_other);" + f"\t::godot::internal::_call_builtin_constructor(_method_bindings.constructor_{copy_constructor_index}, &opaque, &p_other);" ) else: result.append("\tstd::swap(opaque, p_other.opaque);") @@ -1916,13 +2092,13 @@ def generate_engine_class_source(class_api, used_classes, fully_used_classes, us # We assume multi-threaded access is OK because each assignment will assign the same value every time result.append("\tif (unlikely(singleton == nullptr)) {") result.append( - f"\t\tGDExtensionObjectPtr singleton_obj = internal::gdextension_interface_global_get_singleton({class_name}::get_class_static()._native_ptr());" + f"\t\tGDExtensionObjectPtr singleton_obj = ::godot::gdextension_interface::global_get_singleton({class_name}::get_class_static()._native_ptr());" ) result.append("#ifdef DEBUG_ENABLED") result.append("\t\tERR_FAIL_NULL_V(singleton_obj, nullptr);") result.append("#endif // DEBUG_ENABLED") result.append( - f"\t\tsingleton = reinterpret_cast<{class_name} *>(internal::gdextension_interface_object_get_instance_binding(singleton_obj, internal::token, &{class_name}::_gde_binding_callbacks));" + f"\t\tsingleton = reinterpret_cast<{class_name} *>(::godot::gdextension_interface::object_get_instance_binding(singleton_obj, ::godot::gdextension_interface::token, &{class_name}::_gde_binding_callbacks));" ) result.append("#ifdef DEBUG_ENABLED") result.append("\t\tERR_FAIL_NULL_V(singleton, nullptr);") @@ -1957,7 +2133,7 @@ def generate_engine_class_source(class_api, used_classes, fully_used_classes, us # Method body. result.append( - f'\tstatic GDExtensionMethodBindPtr _gde_method_bind = internal::gdextension_interface_classdb_get_method_bind({class_name}::get_class_static()._native_ptr(), StringName("{method["name"]}")._native_ptr(), {method["hash"]});' + f'\tstatic GDExtensionMethodBindPtr _gde_method_bind = ::godot::gdextension_interface::classdb_get_method_bind({class_name}::get_class_static()._native_ptr(), StringName("{method["name"]}")._native_ptr(), {method["hash"]});' ) method_call = "\t" has_return = "return_value" in method and method["return_value"]["type"] != "void" @@ -1976,34 +2152,30 @@ def generate_engine_class_source(class_api, used_classes, fully_used_classes, us meta_type = method["return_value"]["meta"] if "meta" in method["return_value"] else None if is_enum(return_type): if method["is_static"]: - method_call += f"return ({get_gdextension_type(correct_type(return_type, meta_type))})internal::_call_native_mb_ret(_gde_method_bind, nullptr" + method_call += f"return ({get_gdextension_type(correct_type(return_type, meta_type))})::godot::internal::_call_native_mb_ret(_gde_method_bind, nullptr" else: - method_call += f"return ({get_gdextension_type(correct_type(return_type, meta_type))})internal::_call_native_mb_ret(_gde_method_bind, _owner" + method_call += f"return ({get_gdextension_type(correct_type(return_type, meta_type))})::godot::internal::_call_native_mb_ret(_gde_method_bind, _owner" elif is_pod_type(return_type) or is_variant(return_type): if method["is_static"]: - method_call += f"return internal::_call_native_mb_ret<{get_gdextension_type(correct_type(return_type, meta_type))}>(_gde_method_bind, nullptr" + method_call += f"return ::godot::internal::_call_native_mb_ret<{get_gdextension_type(correct_type(return_type, meta_type))}>(_gde_method_bind, nullptr" else: - method_call += f"return internal::_call_native_mb_ret<{get_gdextension_type(correct_type(return_type, meta_type))}>(_gde_method_bind, _owner" + method_call += f"return ::godot::internal::_call_native_mb_ret<{get_gdextension_type(correct_type(return_type, meta_type))}>(_gde_method_bind, _owner" elif is_refcounted(return_type): if method["is_static"]: - method_call += f"return Ref<{return_type}>::_gde_internal_constructor(internal::_call_native_mb_ret_obj<{return_type}>(_gde_method_bind, nullptr" + method_call += f"return Ref<{return_type}>::_gde_internal_constructor(::godot::internal::_call_native_mb_ret_obj<{return_type}>(_gde_method_bind, nullptr" else: - method_call += f"return Ref<{return_type}>::_gde_internal_constructor(internal::_call_native_mb_ret_obj<{return_type}>(_gde_method_bind, _owner" + method_call += f"return Ref<{return_type}>::_gde_internal_constructor(::godot::internal::_call_native_mb_ret_obj<{return_type}>(_gde_method_bind, _owner" is_ref = True else: if method["is_static"]: - method_call += ( - f"return internal::_call_native_mb_ret_obj<{return_type}>(_gde_method_bind, nullptr" - ) + method_call += f"return ::godot::internal::_call_native_mb_ret_obj<{return_type}>(_gde_method_bind, nullptr" else: - method_call += ( - f"return internal::_call_native_mb_ret_obj<{return_type}>(_gde_method_bind, _owner" - ) + method_call += f"return ::godot::internal::_call_native_mb_ret_obj<{return_type}>(_gde_method_bind, _owner" else: if method["is_static"]: - method_call += "internal::_call_native_mb_no_ret(_gde_method_bind, nullptr" + method_call += "::godot::internal::_call_native_mb_no_ret(_gde_method_bind, nullptr" else: - method_call += "internal::_call_native_mb_no_ret(_gde_method_bind, _owner" + method_call += "::godot::internal::_call_native_mb_no_ret(_gde_method_bind, _owner" if "arguments" in method: method_call += ", " @@ -2020,7 +2192,7 @@ def generate_engine_class_source(class_api, used_classes, fully_used_classes, us else: # vararg. result.append("\tGDExtensionCallError error;") result.append("\tVariant ret;") - method_call += "internal::gdextension_interface_object_method_bind_call(_gde_method_bind, _owner, reinterpret_cast(p_args), p_arg_count, &ret, &error" + method_call += "::godot::gdextension_interface::object_method_bind_call(_gde_method_bind, _owner, reinterpret_cast(p_args), p_arg_count, &ret, &error" if is_ref: method_call += ")" # Close Ref<> constructor. @@ -2253,7 +2425,7 @@ def generate_utility_functions(api, output_dir): # Function body. source.append( - f'\tstatic GDExtensionPtrUtilityFunction _gde_function = internal::gdextension_interface_variant_get_ptr_utility_function(StringName("{function["name"]}")._native_ptr(), {function["hash"]});' + f'\tstatic GDExtensionPtrUtilityFunction _gde_function = ::godot::gdextension_interface::variant_get_ptr_utility_function(StringName("{function["name"]}")._native_ptr(), {function["hash"]});' ) has_return = "return_type" in function and function["return_type"] != "void" if has_return: @@ -2268,11 +2440,11 @@ def generate_utility_functions(api, output_dir): if has_return: function_call += "return " if function["return_type"] == "Object": - function_call += "internal::_call_utility_ret_obj(_gde_function" + function_call += "::godot::internal::_call_utility_ret_obj(_gde_function" else: - function_call += f"internal::_call_utility_ret<{get_gdextension_type(correct_type(function['return_type']))}>(_gde_function" + function_call += f"::godot::internal::_call_utility_ret<{get_gdextension_type(correct_type(function['return_type']))}>(_gde_function" else: - function_call += "internal::_call_utility_no_ret(_gde_function" + function_call += "::godot::internal::_call_utility_no_ret(_gde_function" if "arguments" in function: function_call += ", " diff --git a/cmake/GodotCPPModule.cmake b/cmake/GodotCPPModule.cmake index 67fc4dcee..4dce5dadd 100644 --- a/cmake/GodotCPPModule.cmake +++ b/cmake/GodotCPPModule.cmake @@ -86,6 +86,7 @@ missing. ]] function( binding_generator_generate_bindings API_FILE + INTERFACE_FILE USE_TEMPLATE_GET_NODE BITS PRECISION @@ -96,6 +97,7 @@ function( "from binding_generator import generate_bindings" "generate_bindings( api_filepath='${API_FILE}', + interface_filepath='${INTERFACE_FILE}', use_template_get_node='${USE_TEMPLATE_GET_NODE}', bits='${BITS}', precision='${PRECISION}', diff --git a/cmake/common_compiler_flags.cmake b/cmake/common_compiler_flags.cmake index 50bccb9d8..631dd9cb9 100644 --- a/cmake/common_compiler_flags.cmake +++ b/cmake/common_compiler_flags.cmake @@ -170,6 +170,8 @@ function(common_compiler_flags) $<${IS_MSVC}:$<${DISABLE_EXCEPTIONS}:_HAS_EXCEPTIONS=0>> $<${THREADS_ENABLED}:THREADS_ENABLED> + + $<$>:DISABLE_DEPRECATED> ) target_link_options( diff --git a/cmake/godotcpp.cmake b/cmake/godotcpp.cmake index 7c4ea686b..5e30afc97 100644 --- a/cmake/godotcpp.cmake +++ b/cmake/godotcpp.cmake @@ -155,6 +155,7 @@ function(godotcpp_options) #TODO optimize + option(GODOTCPP_DEPRECATED "Enable compatibility code for deprecated and removed features" ON) option(GODOTCPP_DEV_BUILD "Developer build with dev-only debugging code (DEV_ENABLED)" OFF) #[[ debug_symbols @@ -248,6 +249,9 @@ function(godotcpp_generate) set(GODOTCPP_GDEXTENSION_API_FILE "${GODOTCPP_CUSTOM_API_FILE}") endif() + # Interface json file. + set(GODOTCPP_GDEXTENSION_INTERFACE_FILE "${GODOTCPP_GDEXTENSION_DIR}/gdextension_interface.json") + # Build Profile if(GODOTCPP_BUILD_PROFILE) message(STATUS "Using build profile to trim api file") @@ -262,6 +266,7 @@ function(godotcpp_generate) endif() message(STATUS "GODOTCPP_GDEXTENSION_API_FILE = '${GODOTCPP_GDEXTENSION_API_FILE}'") + message(STATUS "GODOTCPP_GDEXTENSION_INTERFACE_FILE = '${GODOTCPP_GDEXTENSION_INTERFACE_FILE}'") # generate the file list to use binding_generator_get_file_list( GENERATED_FILES_LIST @@ -271,6 +276,7 @@ function(godotcpp_generate) binding_generator_generate_bindings( "${GODOTCPP_GDEXTENSION_API_FILE}" + "${GODOTCPP_GDEXTENSION_INTERFACE_FILE}" "${USE_TEMPLATE_GET_NODE}" "${BITS}" "${GODOTCPP_PRECISION}" @@ -351,7 +357,7 @@ function(godotcpp_generate) target_include_directories( godot-cpp ${GODOTCPP_SYSTEM_HEADERS_ATTRIBUTE} - PUBLIC include ${CMAKE_CURRENT_BINARY_DIR}/gen/include ${GODOTCPP_GDEXTENSION_DIR} + PUBLIC include ${CMAKE_CURRENT_BINARY_DIR}/gen/include ) # gersemi: off diff --git a/doc_source_generator.py b/doc_source_generator.py index 4f6efb1f3..cb31cfd69 100644 --- a/doc_source_generator.py +++ b/doc_source_generator.py @@ -40,7 +40,7 @@ def generate_doc_source(dst, source): g.write("\n") g.write( - "static godot::internal::DocDataRegistration _doc_data_registration(_doc_data_hash, _doc_data_uncompressed_size, _doc_data_compressed_size, _doc_data_compressed);\n" + "static ::godot::internal::DocDataRegistration _doc_data_registration(_doc_data_hash, _doc_data_uncompressed_size, _doc_data_compressed_size, _doc_data_compressed);\n" ) g.write("\n") diff --git a/gdextension/gdextension_interface.h b/gdextension/gdextension_interface.h deleted file mode 100644 index 8b52c5e5e..000000000 --- a/gdextension/gdextension_interface.h +++ /dev/null @@ -1,3239 +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_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/gdextension/gdextension_interface.json b/gdextension/gdextension_interface.json new file mode 100644 index 000000000..d920a6580 --- /dev/null +++ b/gdextension/gdextension_interface.json @@ -0,0 +1,9451 @@ +{ + "_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", + "is_const": true + }, + { + "name": "GDExtensionUninitializedVariantPtr", + "kind": "handle", + "parent": "GDExtensionVariantPtr", + "is_uninitialized": true + }, + { + "name": "GDExtensionStringNamePtr", + "kind": "handle" + }, + { + "name": "GDExtensionConstStringNamePtr", + "kind": "handle", + "parent": "GDExtensionStringNamePtr", + "is_const": true + }, + { + "name": "GDExtensionUninitializedStringNamePtr", + "kind": "handle", + "parent": "GDExtensionStringNamePtr", + "is_uninitialized": true + }, + { + "name": "GDExtensionStringPtr", + "kind": "handle" + }, + { + "name": "GDExtensionConstStringPtr", + "kind": "handle", + "parent": "GDExtensionStringPtr", + "is_const": true + }, + { + "name": "GDExtensionUninitializedStringPtr", + "kind": "handle", + "parent": "GDExtensionStringPtr", + "is_uninitialized": true + }, + { + "name": "GDExtensionObjectPtr", + "kind": "handle" + }, + { + "name": "GDExtensionConstObjectPtr", + "kind": "handle", + "parent": "GDExtensionObjectPtr", + "is_const": true + }, + { + "name": "GDExtensionUninitializedObjectPtr", + "kind": "handle", + "parent": "GDExtensionObjectPtr", + "is_uninitialized": true + }, + { + "name": "GDExtensionTypePtr", + "kind": "handle" + }, + { + "name": "GDExtensionConstTypePtr", + "kind": "handle", + "parent": "GDExtensionTypePtr", + "is_const": true + }, + { + "name": "GDExtensionUninitializedTypePtr", + "kind": "handle", + "parent": "GDExtensionTypePtr", + "is_uninitialized": true + }, + { + "name": "GDExtensionMethodBindPtr", + "kind": "handle", + "is_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", + "is_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": "int32_t" + } + ] + }, + { + "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": "int32_t" + } + ] + }, + { + "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": { + "since": "4.2", + "replace_with": "GDExtensionClassNotification2" + } + }, + { + "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": { + "since": "4.2", + "replace_with": "GDExtensionClassCreationInfo4" + } + }, + { + "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": { + "since": "4.3", + "replace_with": "GDExtensionClassCreationInfo4" + } + }, + { + "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": { + "since": "4.4", + "replace_with": "GDExtensionClassCreationInfo4" + } + }, + { + "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", + "is_bitfield": true, + "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": "GDEXTENSION_METHOD_ARGUMENT_METADATA_OBJECT_IS_REQUIRED", + "value": 13 + } + ] + }, + { + "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": { + "since": "4.3", + "replace_with": "GDExtensionCallableCustomInfo2" + } + }, + { + "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": { + "since": "4.3", + "replace_with": "GDExtensionScriptInstanceFreePropertyList2" + } + }, + { + "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": { + "since": "4.3", + "replace_with": "GDExtensionScriptInstanceFreeMethodList2" + } + }, + { + "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": { + "since": "4.2", + "replace_with": "GDExtensionScriptInstanceNotification2" + } + }, + { + "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": { + "since": "4.2", + "replace_with": "GDExtensionScriptInstanceInfo3" + } + }, + { + "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": { + "since": "4.3", + "replace_with": "GDExtensionScriptInstanceInfo3" + } + }, + { + "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": { + "since": "4.5", + "replace_with": "get_godot_version2" + } + }, + { + "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": { + "since": "4.6", + "message": "Does not allow explicitly requesting padding.", + "replace_with": "mem_alloc2" + } + }, + { + "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": { + "since": "4.6", + "message": "Does not allow explicitly requesting padding.", + "replace_with": "mem_realloc2" + } + }, + { + "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": { + "since": "4.6", + "message": "Does not allow explicitly requesting padding.", + "replace_with": "mem_free2" + } + }, + { + "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": { + "since": "4.3", + "replace_with": "string_new_with_utf8_chars_and_len2" + } + }, + { + "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": { + "since": "4.3", + "replace_with": "string_new_with_utf16_chars_and_len2" + } + }, + { + "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": "int32_t", + "description": [ + "The number of element needed in the group." + ] + }, + { + "name": "p_tasks", + "type": "int32_t", + "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": { + "since": "4.5", + "message": "Removed from interface. Use copy constructor 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": { + "since": "4.2", + "replace_with": "script_instance_create3" + } + }, + { + "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": { + "since": "4.3", + "replace_with": "script_instance_create3" + } + }, + { + "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": { + "since": "4.3", + "replace_with": "callable_custom_create2" + } + }, + { + "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": { + "since": "4.4", + "replace_with": "classdb_construct_object2" + } + }, + { + "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": { + "since": "4.2", + "replace_with": "classdb_register_extension_class5" + } + }, + { + "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": { + "since": "4.3", + "replace_with": "classdb_register_extension_class5" + } + }, + { + "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": { + "since": "4.4", + "replace_with": "classdb_register_extension_class5" + } + }, + { + "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": { + "since": "4.5", + "replace_with": "classdb_register_extension_class5" + } + }, + { + "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/include/godot_cpp/classes/ref.hpp b/include/godot_cpp/classes/ref.hpp index 541c5ce31..a0e5d0fb9 100644 --- a/include/godot_cpp/classes/ref.hpp +++ b/include/godot_cpp/classes/ref.hpp @@ -236,7 +236,7 @@ struct PtrToArg> { if (unlikely(!p_ptr)) { return Ref(); } - return Ref(reinterpret_cast(godot::internal::get_object_instance_binding(godot::internal::gdextension_interface_ref_get_object(ref)))); + return Ref(reinterpret_cast(::godot::internal::get_object_instance_binding(::godot::gdextension_interface::ref_get_object(ref)))); } typedef Ref EncodeT; @@ -248,7 +248,7 @@ struct PtrToArg> { // This code assumes that p_ptr points to an unset Ref variable on the Godot side // so we only set it if we have an object to set. if (p_val.is_valid()) { - godot::internal::gdextension_interface_ref_set_object(ref, p_val->_owner); + ::godot::gdextension_interface::ref_set_object(ref, p_val->_owner); } } }; @@ -262,7 +262,7 @@ struct PtrToArg &> { if (unlikely(!p_ptr)) { return Ref(); } - return Ref(reinterpret_cast(godot::internal::get_object_instance_binding(godot::internal::gdextension_interface_ref_get_object(ref)))); + return Ref(reinterpret_cast(::godot::internal::get_object_instance_binding(::godot::gdextension_interface::ref_get_object(ref)))); } }; diff --git a/include/godot_cpp/core/binder_common.hpp b/include/godot_cpp/core/binder_common.hpp index 61eb6a04d..4051a868c 100644 --- a/include/godot_cpp/core/binder_common.hpp +++ b/include/godot_cpp/core/binder_common.hpp @@ -147,7 +147,7 @@ template struct VariantCasterAndValidate { static _FORCE_INLINE_ T cast(const Variant **p_args, uint32_t p_arg_idx, GDExtensionCallError &r_error) { GDExtensionVariantType argtype = GDExtensionVariantType(GetTypeInfo::VARIANT_TYPE); - if (!internal::gdextension_interface_variant_can_convert_strict(static_cast(p_args[p_arg_idx]->get_type()), argtype) || + if (!::godot::gdextension_interface::variant_can_convert_strict(static_cast(p_args[p_arg_idx]->get_type()), argtype) || !VariantObjectClassChecker::check(p_args[p_arg_idx])) { r_error.error = GDEXTENSION_CALL_ERROR_INVALID_ARGUMENT; r_error.argument = p_arg_idx; @@ -162,7 +162,7 @@ template struct VariantCasterAndValidate { static _FORCE_INLINE_ T cast(const Variant **p_args, uint32_t p_arg_idx, GDExtensionCallError &r_error) { GDExtensionVariantType argtype = GDExtensionVariantType(GetTypeInfo::VARIANT_TYPE); - if (!internal::gdextension_interface_variant_can_convert_strict(static_cast(p_args[p_arg_idx]->get_type()), argtype) || + if (!::godot::gdextension_interface::variant_can_convert_strict(static_cast(p_args[p_arg_idx]->get_type()), argtype) || !VariantObjectClassChecker::check(p_args[p_arg_idx])) { r_error.error = GDEXTENSION_CALL_ERROR_INVALID_ARGUMENT; r_error.argument = p_arg_idx; @@ -177,7 +177,7 @@ template struct VariantCasterAndValidate { static _FORCE_INLINE_ T cast(const Variant **p_args, uint32_t p_arg_idx, GDExtensionCallError &r_error) { GDExtensionVariantType argtype = GDExtensionVariantType(GetTypeInfo::VARIANT_TYPE); - if (!internal::gdextension_interface_variant_can_convert_strict(static_cast(p_args[p_arg_idx]->get_type()), argtype) || + if (!::godot::gdextension_interface::variant_can_convert_strict(static_cast(p_args[p_arg_idx]->get_type()), argtype) || !VariantObjectClassChecker::check(p_args[p_arg_idx])) { r_error.error = GDEXTENSION_CALL_ERROR_INVALID_ARGUMENT; r_error.argument = p_arg_idx; diff --git a/include/godot_cpp/core/builtin_ptrcall.hpp b/include/godot_cpp/core/builtin_ptrcall.hpp index cf5310e2d..f51ae321e 100644 --- a/include/godot_cpp/core/builtin_ptrcall.hpp +++ b/include/godot_cpp/core/builtin_ptrcall.hpp @@ -47,7 +47,7 @@ O *_call_builtin_method_ptr_ret_obj(const GDExtensionPtrBuiltInMethod method, GD if (ret == nullptr) { return nullptr; } - return reinterpret_cast(internal::get_object_instance_binding(ret)); + return reinterpret_cast(::godot::internal::get_object_instance_binding(ret)); } template diff --git a/include/godot_cpp/core/class_db.hpp b/include/godot_cpp/core/class_db.hpp index 96025b903..34640949c 100644 --- a/include/godot_cpp/core/class_db.hpp +++ b/include/godot_cpp/core/class_db.hpp @@ -268,7 +268,7 @@ void ClassDB::_register_class(bool p_virtual, bool p_exposed, bool p_runtime) { (void *)&T::get_class_static(), // void *class_userdata; }; - internal::gdextension_interface_classdb_register_extension_class5(internal::library, cl.name._native_ptr(), cl.parent_name._native_ptr(), &class_info); + ::godot::gdextension_interface::classdb_register_extension_class5(::godot::gdextension_interface::library, cl.name._native_ptr(), cl.parent_name._native_ptr(), &class_info); // call bind_methods etc. to register all members of the class T::initialize_class(); diff --git a/include/godot_cpp/core/engine_ptrcall.hpp b/include/godot_cpp/core/engine_ptrcall.hpp index 3e4db0621..cb9525a4f 100644 --- a/include/godot_cpp/core/engine_ptrcall.hpp +++ b/include/godot_cpp/core/engine_ptrcall.hpp @@ -46,25 +46,25 @@ template O *_call_native_mb_ret_obj(const GDExtensionMethodBindPtr mb, void *instance, const Args &...args) { GodotObject *ret = nullptr; std::array mb_args = { { (GDExtensionConstTypePtr)args... } }; - internal::gdextension_interface_object_method_bind_ptrcall(mb, instance, mb_args.data(), &ret); + ::godot::gdextension_interface::object_method_bind_ptrcall(mb, instance, mb_args.data(), &ret); if (ret == nullptr) { return nullptr; } - return reinterpret_cast(internal::get_object_instance_binding(ret)); + return reinterpret_cast(::godot::internal::get_object_instance_binding(ret)); } template R _call_native_mb_ret(const GDExtensionMethodBindPtr mb, void *instance, const Args &...args) { typename PtrToArg::EncodeT ret; std::array mb_args = { { (GDExtensionConstTypePtr)args... } }; - internal::gdextension_interface_object_method_bind_ptrcall(mb, instance, mb_args.data(), &ret); + ::godot::gdextension_interface::object_method_bind_ptrcall(mb, instance, mb_args.data(), &ret); return static_cast(ret); } template void _call_native_mb_no_ret(const GDExtensionMethodBindPtr mb, void *instance, const Args &...args) { std::array mb_args = { { (GDExtensionConstTypePtr)args... } }; - internal::gdextension_interface_object_method_bind_ptrcall(mb, instance, mb_args.data(), nullptr); + ::godot::gdextension_interface::object_method_bind_ptrcall(mb, instance, mb_args.data(), nullptr); } template @@ -80,7 +80,7 @@ Object *_call_utility_ret_obj(const GDExtensionPtrUtilityFunction func, const Ar GodotObject *ret = nullptr; std::array mb_args = { { (GDExtensionConstTypePtr)args... } }; func(&ret, mb_args.data(), mb_args.size()); - return (Object *)internal::get_object_instance_binding(ret); + return (Object *)::godot::internal::get_object_instance_binding(ret); } template diff --git a/include/godot_cpp/core/load_proc_address.inc b/include/godot_cpp/core/load_proc_address.inc new file mode 100644 index 000000000..ae51b73de --- /dev/null +++ b/include/godot_cpp/core/load_proc_address.inc @@ -0,0 +1,41 @@ +/**************************************************************************/ +/* load_proc_address.inc */ +/**************************************************************************/ +/* 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 + +#define ERR_PRINT_EARLY(m_msg) \ + ::godot::gdextension_interface::print_error(m_msg, FUNCTION_STR, __FILE__, __LINE__, false) + +#define LOAD_PROC_ADDRESS(m_name, m_type) \ + ::godot::gdextension_interface::m_name = (m_type)p_get_proc_address(#m_name); \ + if (!::godot::gdextension_interface::m_name) { \ + ERR_PRINT_EARLY("Unable to load GDExtension interface function " #m_name "()"); \ + return false; \ + } diff --git a/include/godot_cpp/core/memory.hpp b/include/godot_cpp/core/memory.hpp index 917ccdede..dd987378c 100644 --- a/include/godot_cpp/core/memory.hpp +++ b/include/godot_cpp/core/memory.hpp @@ -112,7 +112,7 @@ void memdelete(T *p_class, typename std::enable_if, bool> = true> void memdelete(T *p_class) { - godot::internal::gdextension_interface_object_destroy(p_class->_owner); + ::godot::gdextension_interface::object_destroy(p_class->_owner); } template diff --git a/include/godot_cpp/core/method_ptrcall.hpp b/include/godot_cpp/core/method_ptrcall.hpp index 820e59e9b..85d77833a 100644 --- a/include/godot_cpp/core/method_ptrcall.hpp +++ b/include/godot_cpp/core/method_ptrcall.hpp @@ -173,7 +173,7 @@ template struct PtrToArg { static_assert(std::is_base_of::value, "Cannot encode non-Object value as an Object"); _FORCE_INLINE_ static T *convert(const void *p_ptr) { - return likely(p_ptr) ? reinterpret_cast(godot::internal::get_object_instance_binding(*reinterpret_cast(const_cast(p_ptr)))) : nullptr; + return likely(p_ptr) ? reinterpret_cast(::godot::internal::get_object_instance_binding(*reinterpret_cast(const_cast(p_ptr)))) : nullptr; } typedef Object *EncodeT; _FORCE_INLINE_ static void encode(T *p_var, void *p_ptr) { @@ -185,7 +185,7 @@ template struct PtrToArg { static_assert(std::is_base_of::value, "Cannot encode non-Object value as an Object"); _FORCE_INLINE_ static const T *convert(const void *p_ptr) { - return likely(p_ptr) ? reinterpret_cast(godot::internal::get_object_instance_binding(*reinterpret_cast(const_cast(p_ptr)))) : nullptr; + return likely(p_ptr) ? reinterpret_cast(::godot::internal::get_object_instance_binding(*reinterpret_cast(const_cast(p_ptr)))) : nullptr; } typedef const Object *EncodeT; _FORCE_INLINE_ static void encode(T *p_var, void *p_ptr) { diff --git a/include/godot_cpp/core/object.hpp b/include/godot_cpp/core/object.hpp index f3e028d43..daefd237a 100644 --- a/include/godot_cpp/core/object.hpp +++ b/include/godot_cpp/core/object.hpp @@ -108,11 +108,11 @@ MethodInfo::MethodInfo(const PropertyInfo &p_ret, StringName p_name, const Args class ObjectDB { public: static Object *get_instance(uint64_t p_object_id) { - GDExtensionObjectPtr obj = internal::gdextension_interface_object_get_instance_from_id(p_object_id); + GDExtensionObjectPtr obj = ::godot::gdextension_interface::object_get_instance_from_id(p_object_id); if (obj == nullptr) { return nullptr; } - return internal::get_object_instance_binding(obj); + return ::godot::internal::get_object_instance_binding(obj); } }; @@ -122,11 +122,11 @@ T *Object::cast_to(Object *p_object) { return nullptr; } StringName class_name = T::get_class_static(); - GDExtensionObjectPtr casted = internal::gdextension_interface_object_cast_to(p_object->_owner, internal::gdextension_interface_classdb_get_class_tag(class_name._native_ptr())); + GDExtensionObjectPtr casted = ::godot::gdextension_interface::object_cast_to(p_object->_owner, ::godot::gdextension_interface::classdb_get_class_tag(class_name._native_ptr())); if (casted == nullptr) { return nullptr; } - return dynamic_cast(internal::get_object_instance_binding(casted)); + return dynamic_cast(::godot::internal::get_object_instance_binding(casted)); } template @@ -135,11 +135,11 @@ const T *Object::cast_to(const Object *p_object) { return nullptr; } StringName class_name = T::get_class_static(); - GDExtensionObjectPtr casted = internal::gdextension_interface_object_cast_to(p_object->_owner, internal::gdextension_interface_classdb_get_class_tag(class_name._native_ptr())); + GDExtensionObjectPtr casted = ::godot::gdextension_interface::object_cast_to(p_object->_owner, ::godot::gdextension_interface::classdb_get_class_tag(class_name._native_ptr())); if (casted == nullptr) { return nullptr; } - return dynamic_cast(internal::get_object_instance_binding(casted)); + return dynamic_cast(::godot::internal::get_object_instance_binding(casted)); } } // namespace godot diff --git a/include/godot_cpp/godot.hpp b/include/godot_cpp/godot.hpp index b4cb59a14..4f3f319be 100644 --- a/include/godot_cpp/godot.hpp +++ b/include/godot_cpp/godot.hpp @@ -30,180 +30,21 @@ #pragma once -#include +#include namespace godot { -namespace internal { +namespace gdextension_interface { -extern "C" GDExtensionInterfaceGetProcAddress gdextension_interface_get_proc_address; +extern "C" GDExtensionInterfaceGetProcAddress get_proc_address; extern "C" GDExtensionClassLibraryPtr library; extern "C" void *token; extern "C" GDExtensionGodotVersion2 godot_version; -// All of the GDExtension interface functions. -extern "C" GDExtensionInterfaceGetGodotVersion2 gdextension_interface_get_godot_version2; -extern "C" GDExtensionInterfaceMemAlloc2 gdextension_interface_mem_alloc2; -extern "C" GDExtensionInterfaceMemRealloc2 gdextension_interface_mem_realloc2; -extern "C" GDExtensionInterfaceMemFree2 gdextension_interface_mem_free2; -extern "C" GDExtensionInterfacePrintError gdextension_interface_print_error; -extern "C" GDExtensionInterfacePrintErrorWithMessage gdextension_interface_print_error_with_message; -extern "C" GDExtensionInterfacePrintWarning gdextension_interface_print_warning; -extern "C" GDExtensionInterfacePrintWarningWithMessage gdextension_interface_print_warning_with_message; -extern "C" GDExtensionInterfacePrintScriptError gdextension_interface_print_script_error; -extern "C" GDExtensionInterfacePrintScriptErrorWithMessage gdextension_interface_print_script_error_with_message; -extern "C" GDExtensionInterfaceGetNativeStructSize gdextension_interface_get_native_struct_size; -extern "C" GDExtensionInterfaceVariantNewCopy gdextension_interface_variant_new_copy; -extern "C" GDExtensionInterfaceVariantNewNil gdextension_interface_variant_new_nil; -extern "C" GDExtensionInterfaceVariantDestroy gdextension_interface_variant_destroy; -extern "C" GDExtensionInterfaceVariantCall gdextension_interface_variant_call; -extern "C" GDExtensionInterfaceVariantCallStatic gdextension_interface_variant_call_static; -extern "C" GDExtensionInterfaceVariantEvaluate gdextension_interface_variant_evaluate; -extern "C" GDExtensionInterfaceVariantSet gdextension_interface_variant_set; -extern "C" GDExtensionInterfaceVariantSetNamed gdextension_interface_variant_set_named; -extern "C" GDExtensionInterfaceVariantSetKeyed gdextension_interface_variant_set_keyed; -extern "C" GDExtensionInterfaceVariantSetIndexed gdextension_interface_variant_set_indexed; -extern "C" GDExtensionInterfaceVariantGet gdextension_interface_variant_get; -extern "C" GDExtensionInterfaceVariantGetNamed gdextension_interface_variant_get_named; -extern "C" GDExtensionInterfaceVariantGetKeyed gdextension_interface_variant_get_keyed; -extern "C" GDExtensionInterfaceVariantGetIndexed gdextension_interface_variant_get_indexed; -extern "C" GDExtensionInterfaceVariantIterInit gdextension_interface_variant_iter_init; -extern "C" GDExtensionInterfaceVariantIterNext gdextension_interface_variant_iter_next; -extern "C" GDExtensionInterfaceVariantIterGet gdextension_interface_variant_iter_get; -extern "C" GDExtensionInterfaceVariantHash gdextension_interface_variant_hash; -extern "C" GDExtensionInterfaceVariantRecursiveHash gdextension_interface_variant_recursive_hash; -extern "C" GDExtensionInterfaceVariantHashCompare gdextension_interface_variant_hash_compare; -extern "C" GDExtensionInterfaceVariantBooleanize gdextension_interface_variant_booleanize; -extern "C" GDExtensionInterfaceVariantDuplicate gdextension_interface_variant_duplicate; -extern "C" GDExtensionInterfaceVariantStringify gdextension_interface_variant_stringify; -extern "C" GDExtensionInterfaceVariantGetType gdextension_interface_variant_get_type; -extern "C" GDExtensionInterfaceVariantHasMethod gdextension_interface_variant_has_method; -extern "C" GDExtensionInterfaceVariantHasMember gdextension_interface_variant_has_member; -extern "C" GDExtensionInterfaceVariantHasKey gdextension_interface_variant_has_key; -extern "C" GDExtensionInterfaceVariantGetObjectInstanceId gdextension_interface_variant_get_object_instance_id; -extern "C" GDExtensionInterfaceVariantGetTypeName gdextension_interface_variant_get_type_name; -extern "C" GDExtensionInterfaceVariantCanConvert gdextension_interface_variant_can_convert; -extern "C" GDExtensionInterfaceVariantCanConvertStrict gdextension_interface_variant_can_convert_strict; -extern "C" GDExtensionInterfaceGetVariantFromTypeConstructor gdextension_interface_get_variant_from_type_constructor; -extern "C" GDExtensionInterfaceGetVariantToTypeConstructor gdextension_interface_get_variant_to_type_constructor; -extern "C" GDExtensionInterfaceGetVariantGetInternalPtrFunc gdextension_interface_variant_get_ptr_internal_getter; -extern "C" GDExtensionInterfaceVariantGetPtrOperatorEvaluator gdextension_interface_variant_get_ptr_operator_evaluator; -extern "C" GDExtensionInterfaceVariantGetPtrBuiltinMethod gdextension_interface_variant_get_ptr_builtin_method; -extern "C" GDExtensionInterfaceVariantGetPtrConstructor gdextension_interface_variant_get_ptr_constructor; -extern "C" GDExtensionInterfaceVariantGetPtrDestructor gdextension_interface_variant_get_ptr_destructor; -extern "C" GDExtensionInterfaceVariantConstruct gdextension_interface_variant_construct; -extern "C" GDExtensionInterfaceVariantGetPtrSetter gdextension_interface_variant_get_ptr_setter; -extern "C" GDExtensionInterfaceVariantGetPtrGetter gdextension_interface_variant_get_ptr_getter; -extern "C" GDExtensionInterfaceVariantGetPtrIndexedSetter gdextension_interface_variant_get_ptr_indexed_setter; -extern "C" GDExtensionInterfaceVariantGetPtrIndexedGetter gdextension_interface_variant_get_ptr_indexed_getter; -extern "C" GDExtensionInterfaceVariantGetPtrKeyedSetter gdextension_interface_variant_get_ptr_keyed_setter; -extern "C" GDExtensionInterfaceVariantGetPtrKeyedGetter gdextension_interface_variant_get_ptr_keyed_getter; -extern "C" GDExtensionInterfaceVariantGetPtrKeyedChecker gdextension_interface_variant_get_ptr_keyed_checker; -extern "C" GDExtensionInterfaceVariantGetConstantValue gdextension_interface_variant_get_constant_value; -extern "C" GDExtensionInterfaceVariantGetPtrUtilityFunction gdextension_interface_variant_get_ptr_utility_function; -extern "C" GDExtensionInterfaceStringNewWithLatin1Chars gdextension_interface_string_new_with_latin1_chars; -extern "C" GDExtensionInterfaceStringNewWithUtf8Chars gdextension_interface_string_new_with_utf8_chars; -extern "C" GDExtensionInterfaceStringNewWithUtf16Chars gdextension_interface_string_new_with_utf16_chars; -extern "C" GDExtensionInterfaceStringNewWithUtf32Chars gdextension_interface_string_new_with_utf32_chars; -extern "C" GDExtensionInterfaceStringNewWithWideChars gdextension_interface_string_new_with_wide_chars; -extern "C" GDExtensionInterfaceStringNewWithLatin1CharsAndLen gdextension_interface_string_new_with_latin1_chars_and_len; -extern "C" GDExtensionInterfaceStringNewWithUtf8CharsAndLen gdextension_interface_string_new_with_utf8_chars_and_len; -extern "C" GDExtensionInterfaceStringNewWithUtf8CharsAndLen2 gdextension_interface_string_new_with_utf8_chars_and_len2; -extern "C" GDExtensionInterfaceStringNewWithUtf16CharsAndLen gdextension_interface_string_new_with_utf16_chars_and_len; -extern "C" GDExtensionInterfaceStringNewWithUtf16CharsAndLen2 gdextension_interface_string_new_with_utf16_chars_and_len2; -extern "C" GDExtensionInterfaceStringNewWithUtf32CharsAndLen gdextension_interface_string_new_with_utf32_chars_and_len; -extern "C" GDExtensionInterfaceStringNewWithWideCharsAndLen gdextension_interface_string_new_with_wide_chars_and_len; -extern "C" GDExtensionInterfaceStringToLatin1Chars gdextension_interface_string_to_latin1_chars; -extern "C" GDExtensionInterfaceStringToUtf8Chars gdextension_interface_string_to_utf8_chars; -extern "C" GDExtensionInterfaceStringToUtf16Chars gdextension_interface_string_to_utf16_chars; -extern "C" GDExtensionInterfaceStringToUtf32Chars gdextension_interface_string_to_utf32_chars; -extern "C" GDExtensionInterfaceStringToWideChars gdextension_interface_string_to_wide_chars; -extern "C" GDExtensionInterfaceStringOperatorIndex gdextension_interface_string_operator_index; -extern "C" GDExtensionInterfaceStringOperatorIndexConst gdextension_interface_string_operator_index_const; -extern "C" GDExtensionInterfaceStringOperatorPlusEqString gdextension_interface_string_operator_plus_eq_string; -extern "C" GDExtensionInterfaceStringOperatorPlusEqChar gdextension_interface_string_operator_plus_eq_char; -extern "C" GDExtensionInterfaceStringOperatorPlusEqCstr gdextension_interface_string_operator_plus_eq_cstr; -extern "C" GDExtensionInterfaceStringOperatorPlusEqWcstr gdextension_interface_string_operator_plus_eq_wcstr; -extern "C" GDExtensionInterfaceStringOperatorPlusEqC32str gdextension_interface_string_operator_plus_eq_c32str; -extern "C" GDExtensionInterfaceStringResize gdextension_interface_string_resize; -extern "C" GDExtensionInterfaceStringNameNewWithLatin1Chars gdextension_interface_string_name_new_with_latin1_chars; -extern "C" GDExtensionInterfaceXmlParserOpenBuffer gdextension_interface_xml_parser_open_buffer; -extern "C" GDExtensionInterfaceFileAccessStoreBuffer gdextension_interface_file_access_store_buffer; -extern "C" GDExtensionInterfaceFileAccessGetBuffer gdextension_interface_file_access_get_buffer; -extern "C" GDExtensionInterfaceWorkerThreadPoolAddNativeGroupTask gdextension_interface_worker_thread_pool_add_native_group_task; -extern "C" GDExtensionInterfaceWorkerThreadPoolAddNativeTask gdextension_interface_worker_thread_pool_add_native_task; -extern "C" GDExtensionInterfacePackedByteArrayOperatorIndex gdextension_interface_packed_byte_array_operator_index; -extern "C" GDExtensionInterfacePackedByteArrayOperatorIndexConst gdextension_interface_packed_byte_array_operator_index_const; -extern "C" GDExtensionInterfacePackedColorArrayOperatorIndex gdextension_interface_packed_color_array_operator_index; -extern "C" GDExtensionInterfacePackedColorArrayOperatorIndexConst gdextension_interface_packed_color_array_operator_index_const; -extern "C" GDExtensionInterfacePackedFloat32ArrayOperatorIndex gdextension_interface_packed_float32_array_operator_index; -extern "C" GDExtensionInterfacePackedFloat32ArrayOperatorIndexConst gdextension_interface_packed_float32_array_operator_index_const; -extern "C" GDExtensionInterfacePackedFloat64ArrayOperatorIndex gdextension_interface_packed_float64_array_operator_index; -extern "C" GDExtensionInterfacePackedFloat64ArrayOperatorIndexConst gdextension_interface_packed_float64_array_operator_index_const; -extern "C" GDExtensionInterfacePackedInt32ArrayOperatorIndex gdextension_interface_packed_int32_array_operator_index; -extern "C" GDExtensionInterfacePackedInt32ArrayOperatorIndexConst gdextension_interface_packed_int32_array_operator_index_const; -extern "C" GDExtensionInterfacePackedInt64ArrayOperatorIndex gdextension_interface_packed_int64_array_operator_index; -extern "C" GDExtensionInterfacePackedInt64ArrayOperatorIndexConst gdextension_interface_packed_int64_array_operator_index_const; -extern "C" GDExtensionInterfacePackedStringArrayOperatorIndex gdextension_interface_packed_string_array_operator_index; -extern "C" GDExtensionInterfacePackedStringArrayOperatorIndexConst gdextension_interface_packed_string_array_operator_index_const; -extern "C" GDExtensionInterfacePackedVector2ArrayOperatorIndex gdextension_interface_packed_vector2_array_operator_index; -extern "C" GDExtensionInterfacePackedVector2ArrayOperatorIndexConst gdextension_interface_packed_vector2_array_operator_index_const; -extern "C" GDExtensionInterfacePackedVector3ArrayOperatorIndex gdextension_interface_packed_vector3_array_operator_index; -extern "C" GDExtensionInterfacePackedVector3ArrayOperatorIndexConst gdextension_interface_packed_vector3_array_operator_index_const; -extern "C" GDExtensionInterfacePackedVector4ArrayOperatorIndex gdextension_interface_packed_vector4_array_operator_index; -extern "C" GDExtensionInterfacePackedVector4ArrayOperatorIndexConst gdextension_interface_packed_vector4_array_operator_index_const; -extern "C" GDExtensionInterfaceArrayOperatorIndex gdextension_interface_array_operator_index; -extern "C" GDExtensionInterfaceArrayOperatorIndexConst gdextension_interface_array_operator_index_const; -extern "C" GDExtensionInterfaceArraySetTyped gdextension_interface_array_set_typed; -extern "C" GDExtensionInterfaceDictionaryOperatorIndex gdextension_interface_dictionary_operator_index; -extern "C" GDExtensionInterfaceDictionaryOperatorIndexConst gdextension_interface_dictionary_operator_index_const; -extern "C" GDExtensionInterfaceDictionarySetTyped gdextension_interface_dictionary_set_typed; -extern "C" GDExtensionInterfaceObjectMethodBindCall gdextension_interface_object_method_bind_call; -extern "C" GDExtensionInterfaceObjectMethodBindPtrcall gdextension_interface_object_method_bind_ptrcall; -extern "C" GDExtensionInterfaceObjectDestroy gdextension_interface_object_destroy; -extern "C" GDExtensionInterfaceGlobalGetSingleton gdextension_interface_global_get_singleton; -extern "C" GDExtensionInterfaceObjectGetInstanceBinding gdextension_interface_object_get_instance_binding; -extern "C" GDExtensionInterfaceObjectSetInstanceBinding gdextension_interface_object_set_instance_binding; -extern "C" GDExtensionInterfaceObjectFreeInstanceBinding gdextension_interface_object_free_instance_binding; -extern "C" GDExtensionInterfaceObjectSetInstance gdextension_interface_object_set_instance; -extern "C" GDExtensionInterfaceObjectGetClassName gdextension_interface_object_get_class_name; -extern "C" GDExtensionInterfaceObjectCastTo gdextension_interface_object_cast_to; -extern "C" GDExtensionInterfaceObjectGetInstanceFromId gdextension_interface_object_get_instance_from_id; -extern "C" GDExtensionInterfaceObjectGetInstanceId gdextension_interface_object_get_instance_id; -extern "C" GDExtensionInterfaceObjectHasScriptMethod gdextension_interface_object_has_script_method; -extern "C" GDExtensionInterfaceObjectCallScriptMethod gdextension_interface_object_call_script_method; -extern "C" GDExtensionInterfaceCallableCustomCreate2 gdextension_interface_callable_custom_create2; -extern "C" GDExtensionInterfaceCallableCustomGetUserData gdextension_interface_callable_custom_get_userdata; -extern "C" GDExtensionInterfaceRefGetObject gdextension_interface_ref_get_object; -extern "C" GDExtensionInterfaceRefSetObject gdextension_interface_ref_set_object; -extern "C" GDExtensionInterfaceScriptInstanceCreate3 gdextension_interface_script_instance_create3; -extern "C" GDExtensionInterfacePlaceHolderScriptInstanceCreate gdextension_interface_placeholder_script_instance_create; -extern "C" GDExtensionInterfacePlaceHolderScriptInstanceUpdate gdextension_interface_placeholder_script_instance_update; -extern "C" GDExtensionInterfaceObjectGetScriptInstance gdextension_interface_object_get_script_instance; -extern "C" GDExtensionInterfaceObjectSetScriptInstance gdextension_interface_object_set_script_instance; -extern "C" GDExtensionInterfaceClassdbConstructObject2 gdextension_interface_classdb_construct_object2; -extern "C" GDExtensionInterfaceClassdbGetMethodBind gdextension_interface_classdb_get_method_bind; -extern "C" GDExtensionInterfaceClassdbGetClassTag gdextension_interface_classdb_get_class_tag; -extern "C" GDExtensionInterfaceClassdbRegisterExtensionClass5 gdextension_interface_classdb_register_extension_class5; -extern "C" GDExtensionInterfaceClassdbRegisterExtensionClassMethod gdextension_interface_classdb_register_extension_class_method; -extern "C" GDExtensionInterfaceClassdbRegisterExtensionClassVirtualMethod gdextension_interface_classdb_register_extension_class_virtual_method; -extern "C" GDExtensionInterfaceClassdbRegisterExtensionClassIntegerConstant gdextension_interface_classdb_register_extension_class_integer_constant; -extern "C" GDExtensionInterfaceClassdbRegisterExtensionClassProperty gdextension_interface_classdb_register_extension_class_property; -extern "C" GDExtensionInterfaceClassdbRegisterExtensionClassPropertyIndexed gdextension_interface_classdb_register_extension_class_property_indexed; -extern "C" GDExtensionInterfaceClassdbRegisterExtensionClassPropertyGroup gdextension_interface_classdb_register_extension_class_property_group; -extern "C" GDExtensionInterfaceClassdbRegisterExtensionClassPropertySubgroup gdextension_interface_classdb_register_extension_class_property_subgroup; -extern "C" GDExtensionInterfaceClassdbRegisterExtensionClassSignal gdextension_interface_classdb_register_extension_class_signal; -extern "C" GDExtensionInterfaceClassdbUnregisterExtensionClass gdextension_interface_classdb_unregister_extension_class; -extern "C" GDExtensionInterfaceGetLibraryPath gdextension_interface_get_library_path; -extern "C" GDExtensionInterfaceEditorAddPlugin gdextension_interface_editor_add_plugin; -extern "C" GDExtensionInterfaceEditorRemovePlugin gdextension_interface_editor_remove_plugin; -extern "C" GDExtensionInterfaceEditorRegisterGetClassesUsedCallback gdextension_interface_editor_register_get_classes_used_callback; -extern "C" GDExtensionsInterfaceEditorHelpLoadXmlFromUtf8Chars gdextension_interface_editor_help_load_xml_from_utf8_chars; -extern "C" GDExtensionsInterfaceEditorHelpLoadXmlFromUtf8CharsAndLen gdextension_interface_editor_help_load_xml_from_utf8_chars_and_len; -extern "C" GDExtensionInterfaceImagePtrw gdextension_interface_image_ptrw; -extern "C" GDExtensionInterfaceImagePtr gdextension_interface_image_ptr; -extern "C" GDExtensionInterfaceRegisterMainLoopCallbacks gdextension_interface_register_main_loop_callbacks; +} // namespace gdextension_interface + +namespace internal { class DocDataRegistration { public: diff --git a/include/godot_cpp/variant/variant_internal.hpp b/include/godot_cpp/variant/variant_internal.hpp index 637e12dd7..4837c64a1 100644 --- a/include/godot_cpp/variant/variant_internal.hpp +++ b/include/godot_cpp/variant/variant_internal.hpp @@ -205,12 +205,12 @@ class VariantInternal { public: template _FORCE_INLINE_ static T *get_internal_value(Variant *v) { - return static_cast(get_internal_func[internal::VariantInternalType::type](v)); + return static_cast(get_internal_func[::godot::internal::VariantInternalType::type](v)); } template _FORCE_INLINE_ static const T *get_internal_value(const Variant *v) { - return static_cast(get_internal_func[internal::VariantInternalType::type](const_cast(v))); + return static_cast(get_internal_func[::godot::internal::VariantInternalType::type](const_cast(v))); } // Atomic types. @@ -473,8 +473,8 @@ class VariantInternal { template struct VariantGetInternalPtr { - static internal::VariantInternalType *get_ptr(Variant *v) { return VariantInternal::get_internal_value(v); } - static const internal::VariantInternalType *get_ptr(const Variant *v) { return VariantInternal::get_internal_value(v); } + static ::godot::internal::VariantInternalType *get_ptr(Variant *v) { return VariantInternal::get_internal_value(v); } + static const ::godot::internal::VariantInternalType *get_ptr(const Variant *v) { return VariantInternal::get_internal_value(v); } }; template @@ -493,7 +493,7 @@ struct VariantInternalAccessor { // Enable set() only for those types where we can set (all but Object *). template ::value>> - static _FORCE_INLINE_ void set(Variant *v, const internal::VariantInternalType &p_value) { + static _FORCE_INLINE_ void set(Variant *v, const ::godot::internal::VariantInternalType &p_value) { *VariantInternal::get_internal_value(v) = p_value; } }; diff --git a/make_interface_header.py b/make_interface_header.py new file mode 100644 index 000000000..66fc95088 --- /dev/null +++ b/make_interface_header.py @@ -0,0 +1,364 @@ +import difflib +import json +from collections import OrderedDict + +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 _get_buffer(path): + with open(path, "rb") as file: + return file.read() + + +def _generated_wrapper(path, header_lines): + f = open(path, "wt", encoding="utf-8") + for line in header_lines: + f.write(line + "\n") + f.write("#pragma once\n\n") + return f + + +def scons_run(target, source, env): + target_path = str(target[0]) + source_path = str(source[0]) + generate_gdextension_interface_header(target_path, source_path) + + +def generate_gdextension_interface_header(target, source, header_lines=[]): + buffer = _get_buffer(source) + data = json.loads(buffer, object_pairs_hook=OrderedDict) + check_formatting(buffer.decode("utf-8"), data, source) + check_allowed_keys(data, ["_copyright", "$schema", "format_version", "types", "interface"]) + + valid_data_types = {} + for type in BASE_TYPES: + valid_data_types[type] = True + + with _generated_wrapper(target, header_lines) 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 = [] + type_replacements = [] + for type in data["types"]: + kind = type["kind"] + + check_type(kind, type, valid_data_types) + valid_data_types[type["name"]] = type + + if "deprecated" in type: + check_allowed_keys(type["deprecated"], ["since"], ["message", "replace_with"]) + if "replace_with" in type["deprecated"]: + type_replacements.append((type["name"], type["deprecated"]["replace_with"])) + + if "description" in type: + write_doc(file, type["description"]) + + if kind == "handle": + check_allowed_keys( + type, ["name", "kind"], ["is_const", "is_uninitialized", "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("is_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"], ["is_bitfield", "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 type_name, replace_with in type_replacements: + if replace_with not in valid_data_types: + raise Exception(f"Unknown type '{replace_with}' used as replacement for '{type_name}'") + replacement = valid_data_types[replace_with] + if isinstance(replacement, dict) and "deprecated" in replacement: + raise Exception( + f"Cannot use '{replace_with}' as replacement for '{type_name}' because it's deprecated too" + ) + + interface_replacements = [] + valid_interfaces = {} + 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"], + ) + valid_interfaces[interface["name"]] = interface + if "deprecated" in interface: + check_allowed_keys(interface["deprecated"], ["since"], ["message", "replace_with"]) + if "replace_with" in interface["deprecated"]: + interface_replacements.append((interface["name"], interface["deprecated"]["replace_with"])) + write_interface(file, interface) + + for function_name, replace_with in interface_replacements: + if replace_with not in valid_interfaces: + raise Exception( + f"Unknown interface function '{replace_with}' used as replacement for '{function_name}'" + ) + replacement = valid_interfaces[replace_with] + if "deprecated" in replacement: + raise Exception( + f"Cannot use '{replace_with}' as replacement for '{function_name}' because it's deprecated too" + ) + + 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_message(data): + parts = [ + f"Deprecated in Godot {data['since']}.", + data["message"] if "message" in data else "", + f"Use `{data['replace_with']}` instead." if "replace_with" in data else "", + ] + return " ".join([x for x in parts if x.strip() != ""]) + + +def make_deprecated_comment_for_type(type): + if "deprecated" not in type: + return "" + message = make_deprecated_message(type["deprecated"]) + return f" /* {message} */" + + +def write_simple_type(file, type): + file.write(f"typedef {format_type_and_name(type['type'], type['name'])};{make_deprecated_comment_for_type(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_comment_for_type(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_comment_for_type(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_comment_for_type(struct)}\n\n") + + +def write_interface(file, interface): + doc = [ + f"@name {interface['name']}", + f"@since {interface['since']}", + ] + + if "deprecated" in interface: + doc.append(f"@deprecated {make_deprecated_message(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/misc/scripts/check_get_file_list.py b/misc/scripts/check_get_file_list.py index 6ea5d6f73..3264b0968 100755 --- a/misc/scripts/check_get_file_list.py +++ b/misc/scripts/check_get_file_list.py @@ -10,6 +10,7 @@ from build_profile import generate_trimmed_api api_filepath = "gdextension/extension_api.json" +interface_filepath = "gdextension/gdextension_interface.json" bits = "64" precision = "single" output_dir = "self_test" @@ -20,6 +21,7 @@ def test(profile_filepath=""): _generate_bindings( api, api_filepath, + interface_filepath, use_template_get_node=False, bits=bits, precision=precision, diff --git a/src/classes/editor_plugin_registration.cpp b/src/classes/editor_plugin_registration.cpp index 99819bee8..428b09bd6 100644 --- a/src/classes/editor_plugin_registration.cpp +++ b/src/classes/editor_plugin_registration.cpp @@ -39,20 +39,20 @@ Vector EditorPlugins::plugin_classes; void EditorPlugins::add_plugin_class(const StringName &p_class_name) { ERR_FAIL_COND_MSG(plugin_classes.find(p_class_name) != -1, vformat("Editor plugin already registered: %s", p_class_name)); plugin_classes.push_back(p_class_name); - internal::gdextension_interface_editor_add_plugin(p_class_name._native_ptr()); + ::godot::gdextension_interface::editor_add_plugin(p_class_name._native_ptr()); } void EditorPlugins::remove_plugin_class(const StringName &p_class_name) { int index = plugin_classes.find(p_class_name); ERR_FAIL_COND_MSG(index == -1, vformat("Editor plugin is not registered: %s", p_class_name)); plugin_classes.remove_at(index); - internal::gdextension_interface_editor_remove_plugin(p_class_name._native_ptr()); + ::godot::gdextension_interface::editor_remove_plugin(p_class_name._native_ptr()); } void EditorPlugins::deinitialize(GDExtensionInitializationLevel p_level) { if (p_level == GDEXTENSION_INITIALIZATION_EDITOR) { for (const StringName &class_name : plugin_classes) { - internal::gdextension_interface_editor_remove_plugin(class_name._native_ptr()); + ::godot::gdextension_interface::editor_remove_plugin(class_name._native_ptr()); } plugin_classes.clear(); } diff --git a/src/classes/low_level.cpp b/src/classes/low_level.cpp index 3b6b16135..a1e625e29 100644 --- a/src/classes/low_level.cpp +++ b/src/classes/low_level.cpp @@ -37,31 +37,31 @@ namespace godot { Error XMLParser::_open_buffer(const uint8_t *p_buffer, size_t p_size) { - return (Error)internal::gdextension_interface_xml_parser_open_buffer(_owner, p_buffer, p_size); + return (Error)::godot::gdextension_interface::xml_parser_open_buffer(_owner, p_buffer, p_size); } uint64_t FileAccess::get_buffer(uint8_t *p_dst, uint64_t p_length) const { - return internal::gdextension_interface_file_access_get_buffer(_owner, p_dst, p_length); + return ::godot::gdextension_interface::file_access_get_buffer(_owner, p_dst, p_length); } void FileAccess::store_buffer(const uint8_t *p_src, uint64_t p_length) { - internal::gdextension_interface_file_access_store_buffer(_owner, p_src, p_length); + ::godot::gdextension_interface::file_access_store_buffer(_owner, p_src, p_length); } WorkerThreadPool::TaskID WorkerThreadPool::add_native_task(void (*p_func)(void *), void *p_userdata, bool p_high_priority, const String &p_description) { - return (TaskID)internal::gdextension_interface_worker_thread_pool_add_native_task(_owner, p_func, p_userdata, p_high_priority, (GDExtensionConstStringPtr)&p_description); + return (TaskID)::godot::gdextension_interface::worker_thread_pool_add_native_task(_owner, p_func, p_userdata, p_high_priority, (GDExtensionConstStringPtr)&p_description); } WorkerThreadPool::GroupID WorkerThreadPool::add_native_group_task(void (*p_func)(void *, uint32_t), void *p_userdata, int p_elements, int p_tasks, bool p_high_priority, const String &p_description) { - return (GroupID)internal::gdextension_interface_worker_thread_pool_add_native_group_task(_owner, p_func, p_userdata, p_elements, p_tasks, p_high_priority, (GDExtensionConstStringPtr)&p_description); + return (GroupID)::godot::gdextension_interface::worker_thread_pool_add_native_group_task(_owner, p_func, p_userdata, p_elements, p_tasks, p_high_priority, (GDExtensionConstStringPtr)&p_description); } uint8_t *Image::ptrw() { - return internal::gdextension_interface_image_ptrw(_owner); + return ::godot::gdextension_interface::image_ptrw(_owner); } const uint8_t *Image::ptr() { - return internal::gdextension_interface_image_ptr(_owner); + return ::godot::gdextension_interface::image_ptr(_owner); } } // namespace godot diff --git a/src/classes/wrapped.cpp b/src/classes/wrapped.cpp index c5a8cc9fd..1ef68c17f 100644 --- a/src/classes/wrapped.cpp +++ b/src/classes/wrapped.cpp @@ -74,16 +74,16 @@ Wrapped::Wrapped(const StringName &p_godot_class) { } else #endif { - _owner = godot::internal::gdextension_interface_classdb_construct_object2(reinterpret_cast(p_godot_class._native_ptr())); + _owner = ::godot::gdextension_interface::classdb_construct_object2(reinterpret_cast(p_godot_class._native_ptr())); } if (_constructing_extension_class_name) { - godot::internal::gdextension_interface_object_set_instance(_owner, reinterpret_cast(_constructing_extension_class_name), this); + ::godot::gdextension_interface::object_set_instance(_owner, reinterpret_cast(_constructing_extension_class_name), this); _constructing_extension_class_name = nullptr; } if (likely(_constructing_class_binding_callbacks)) { - godot::internal::gdextension_interface_object_set_instance_binding(_owner, godot::internal::token, this, _constructing_class_binding_callbacks); + ::godot::gdextension_interface::object_set_instance_binding(_owner, ::godot::gdextension_interface::token, this, _constructing_class_binding_callbacks); _constructing_class_binding_callbacks = nullptr; } else { CRASH_NOW_MSG("BUG: Godot Object created without binding callbacks. Did you forget to use memnew()?"); diff --git a/src/core/class_db.cpp b/src/core/class_db.cpp index b03e9f477..f8cdcdb06 100644 --- a/src/core/class_db.cpp +++ b/src/core/class_db.cpp @@ -58,13 +58,13 @@ MethodDefinition D_METHOD(StringName p_name, StringName p_arg1) { void ClassDB::add_property_group(const StringName &p_class, const String &p_name, const String &p_prefix) { ERR_FAIL_COND_MSG(classes.find(p_class) == classes.end(), String("Trying to add property '{0}{1}' to non-existing class '{2}'.").format(Array::make(p_prefix, p_name, p_class))); - internal::gdextension_interface_classdb_register_extension_class_property_group(internal::library, p_class._native_ptr(), p_name._native_ptr(), p_prefix._native_ptr()); + ::godot::gdextension_interface::classdb_register_extension_class_property_group(::godot::gdextension_interface::library, p_class._native_ptr(), p_name._native_ptr(), p_prefix._native_ptr()); } void ClassDB::add_property_subgroup(const StringName &p_class, const String &p_name, const String &p_prefix) { ERR_FAIL_COND_MSG(classes.find(p_class) == classes.end(), String("Trying to add property '{0}{1}' to non-existing class '{2}'.").format(Array::make(p_prefix, p_name, p_class))); - internal::gdextension_interface_classdb_register_extension_class_property_subgroup(internal::library, p_class._native_ptr(), p_name._native_ptr(), p_prefix._native_ptr()); + ::godot::gdextension_interface::classdb_register_extension_class_property_subgroup(::godot::gdextension_interface::library, p_class._native_ptr(), p_name._native_ptr(), p_prefix._native_ptr()); } void ClassDB::add_property(const StringName &p_class, const PropertyInfo &p_pinfo, const StringName &p_setter, const StringName &p_getter, int p_index) { @@ -106,7 +106,7 @@ void ClassDB::add_property(const StringName &p_class, const PropertyInfo &p_pinf p_pinfo.usage, // DEFAULT //uint32_t usage; }; - internal::gdextension_interface_classdb_register_extension_class_property_indexed(internal::library, info.name._native_ptr(), &prop_info, p_setter._native_ptr(), p_getter._native_ptr(), p_index); + ::godot::gdextension_interface::classdb_register_extension_class_property_indexed(::godot::gdextension_interface::library, info.name._native_ptr(), &prop_info, p_setter._native_ptr(), p_getter._native_ptr(), p_index); } MethodBind *ClassDB::get_method(const StringName &p_class, const StringName &p_method) { @@ -229,7 +229,7 @@ void ClassDB::bind_method_godot(const StringName &p_class_name, MethodBind *p_me (uint32_t)p_method->get_default_argument_count(), // uint32_t default_argument_count; def_args.ptr(), // GDExtensionVariantPtr *default_arguments; }; - internal::gdextension_interface_classdb_register_extension_class_method(internal::library, p_class_name._native_ptr(), &method_info); + ::godot::gdextension_interface::classdb_register_extension_class_method(::godot::gdextension_interface::library, p_class_name._native_ptr(), &method_info); } void ClassDB::add_signal(const StringName &p_class, const MethodInfo &p_signal) { @@ -264,7 +264,7 @@ void ClassDB::add_signal(const StringName &p_class, const MethodInfo &p_signal) }); } - internal::gdextension_interface_classdb_register_extension_class_signal(internal::library, cl.name._native_ptr(), p_signal.name._native_ptr(), parameters.ptr(), parameters.size()); + ::godot::gdextension_interface::classdb_register_extension_class_signal(::godot::gdextension_interface::library, cl.name._native_ptr(), p_signal.name._native_ptr(), parameters.ptr(), parameters.size()); } void ClassDB::bind_integer_constant(const StringName &p_class_name, const StringName &p_enum_name, const StringName &p_constant_name, GDExtensionInt p_constant_value, bool p_is_bitfield) { @@ -281,7 +281,7 @@ void ClassDB::bind_integer_constant(const StringName &p_class_name, const String type.constant_names.insert(p_constant_name); // Register it with Godot - internal::gdextension_interface_classdb_register_extension_class_integer_constant(internal::library, p_class_name._native_ptr(), p_enum_name._native_ptr(), p_constant_name._native_ptr(), p_constant_value, p_is_bitfield); + ::godot::gdextension_interface::classdb_register_extension_class_integer_constant(::godot::gdextension_interface::library, p_class_name._native_ptr(), p_enum_name._native_ptr(), p_constant_name._native_ptr(), p_constant_value, p_is_bitfield); } GDExtensionClassCallVirtual ClassDB::get_virtual_func(void *p_userdata, GDExtensionConstStringNamePtr p_name, uint32_t p_hash) { // This is called by Godot the first time it calls a virtual function, and it caches the result, per object instance. @@ -376,7 +376,7 @@ void ClassDB::add_virtual_method(const StringName &p_class, const MethodInfo &p_ } } - internal::gdextension_interface_classdb_register_extension_class_virtual_method(internal::library, &p_class, &mi); + ::godot::gdextension_interface::classdb_register_extension_class_virtual_method(::godot::gdextension_interface::library, &p_class, &mi); if (mi.arguments) { memfree(mi.arguments); @@ -419,7 +419,7 @@ void ClassDB::deinitialize(GDExtensionInitializationLevel p_level) { continue; } - internal::gdextension_interface_classdb_unregister_extension_class(internal::library, name._native_ptr()); + ::godot::gdextension_interface::classdb_unregister_extension_class(::godot::gdextension_interface::library, name._native_ptr()); for (const KeyValue &method : cl.method_map) { memdelete(method.value); @@ -447,7 +447,7 @@ void ClassDB::deinitialize(GDExtensionInitializationLevel p_level) { } } for (const Object *i : singleton_objects) { - internal::gdextension_interface_object_free_instance_binding((*i)._owner, internal::token); + ::godot::gdextension_interface::object_free_instance_binding((*i)._owner, ::godot::gdextension_interface::token); } } } diff --git a/src/core/error_macros.cpp b/src/core/error_macros.cpp index 685f70de9..a2c256de2 100644 --- a/src/core/error_macros.cpp +++ b/src/core/error_macros.cpp @@ -39,9 +39,9 @@ namespace godot { void _err_print_error(const char *p_function, const char *p_file, int p_line, const char *p_error, bool p_editor_notify, bool p_is_warning) { if (p_is_warning) { - internal::gdextension_interface_print_warning(p_error, p_function, p_file, p_line, p_editor_notify); + ::godot::gdextension_interface::print_warning(p_error, p_function, p_file, p_line, p_editor_notify); } else { - internal::gdextension_interface_print_error(p_error, p_function, p_file, p_line, p_editor_notify); + ::godot::gdextension_interface::print_error(p_error, p_function, p_file, p_line, p_editor_notify); } } @@ -51,9 +51,9 @@ void _err_print_error(const char *p_function, const char *p_file, int p_line, co void _err_print_error(const char *p_function, const char *p_file, int p_line, const char *p_error, const char *p_message, bool p_editor_notify, bool p_is_warning) { if (p_is_warning) { - internal::gdextension_interface_print_warning_with_message(p_error, p_message, p_function, p_file, p_line, p_editor_notify); + ::godot::gdextension_interface::print_warning_with_message(p_error, p_message, p_function, p_file, p_line, p_editor_notify); } else { - internal::gdextension_interface_print_error_with_message(p_error, p_message, p_function, p_file, p_line, p_editor_notify); + ::godot::gdextension_interface::print_error_with_message(p_error, p_message, p_function, p_file, p_line, p_editor_notify); } } diff --git a/src/core/memory.cpp b/src/core/memory.cpp index 169c5a80e..2b1f42dbb 100644 --- a/src/core/memory.cpp +++ b/src/core/memory.cpp @@ -35,7 +35,19 @@ namespace godot { void *Memory::alloc_static(size_t p_bytes, bool p_pad_align) { - return internal::gdextension_interface_mem_alloc2(p_bytes, p_pad_align); +#if GODOT_MINOR_VERSION >= 6 + return ::godot::gdextension_interface::mem_alloc2(p_bytes, p_pad_align); +#else + void *mem = ::godot::gdextension_interface::mem_alloc(p_bytes + (p_pad_align ? DATA_OFFSET : 0)); + ERR_FAIL_NULL_V(mem, nullptr); + + if (p_pad_align) { + uint8_t *s8 = (uint8_t *)mem; + return s8 + DATA_OFFSET; + } else { + return mem; + } +#endif } void *Memory::realloc_static(void *p_memory, size_t p_bytes, bool p_pad_align) { @@ -46,11 +58,31 @@ void *Memory::realloc_static(void *p_memory, size_t p_bytes, bool p_pad_align) { return nullptr; } - return internal::gdextension_interface_mem_realloc2(p_memory, p_bytes, p_pad_align); +#if GODOT_MINOR_VERSION >= 6 + return ::godot::gdextension_interface::mem_realloc2(p_memory, p_bytes, p_pad_align); +#else + uint8_t *mem = (uint8_t *)p_memory; + if (p_pad_align) { + mem -= DATA_OFFSET; + mem = (uint8_t *)::godot::gdextension_interface::mem_realloc(mem, p_bytes + DATA_OFFSET); + ERR_FAIL_NULL_V(mem, nullptr); + return mem + DATA_OFFSET; + } else { + return (uint8_t *)::godot::gdextension_interface::mem_realloc(mem, p_bytes); + } +#endif } void Memory::free_static(void *p_ptr, bool p_pad_align) { - internal::gdextension_interface_mem_free2(p_ptr, p_pad_align); +#if GODOT_MINOR_VERSION >= 6 + ::godot::gdextension_interface::mem_free2(p_ptr, p_pad_align); +#else + uint8_t *mem = (uint8_t *)p_ptr; + if (p_pad_align) { + mem -= DATA_OFFSET; + } + ::godot::gdextension_interface::mem_free(mem); +#endif } _GlobalNil::_GlobalNil() { diff --git a/src/core/method_bind.cpp b/src/core/method_bind.cpp index 9eba6854b..95c702698 100644 --- a/src/core/method_bind.cpp +++ b/src/core/method_bind.cpp @@ -92,7 +92,7 @@ void MethodBind::bind_call(void *p_method_userdata, GDExtensionClassInstancePtr Variant ret = bind->call(p_instance, p_args, p_argument_count, *r_error); // This assumes the return value is an empty Variant, so it doesn't need to call the destructor first. // Since only GDExtensionMethodBind calls this from the Godot side, it should always be the case. - internal::gdextension_interface_variant_new_copy(r_return, ret._native_ptr()); + ::godot::gdextension_interface::variant_new_copy(r_return, ret._native_ptr()); } void MethodBind::bind_ptrcall(void *p_method_userdata, GDExtensionClassInstancePtr p_instance, const GDExtensionConstTypePtr *p_args, GDExtensionTypePtr r_return) { diff --git a/src/core/object.cpp b/src/core/object.cpp index d30f6cd0c..976ecfc0b 100644 --- a/src/core/object.cpp +++ b/src/core/object.cpp @@ -42,7 +42,7 @@ Object *get_object_instance_binding(GodotObject *p_engine_object) { } // Get existing instance binding, if one already exists. - GDExtensionObjectPtr instance = gdextension_interface_object_get_instance_binding(p_engine_object, token, nullptr); + GDExtensionObjectPtr instance = ::godot::gdextension_interface::object_get_instance_binding(p_engine_object, ::godot::gdextension_interface::token, nullptr); if (instance != nullptr) { return reinterpret_cast(instance); } @@ -50,14 +50,14 @@ Object *get_object_instance_binding(GodotObject *p_engine_object) { // Otherwise, try to look up the correct binding callbacks. const GDExtensionInstanceBindingCallbacks *binding_callbacks = nullptr; StringName class_name; - if (gdextension_interface_object_get_class_name(p_engine_object, library, reinterpret_cast(class_name._native_ptr()))) { + if (::godot::gdextension_interface::object_get_class_name(p_engine_object, ::godot::gdextension_interface::library, reinterpret_cast(class_name._native_ptr()))) { binding_callbacks = ClassDB::get_instance_binding_callbacks(class_name); } if (binding_callbacks == nullptr) { binding_callbacks = &Object::_gde_binding_callbacks; } - return reinterpret_cast(gdextension_interface_object_get_instance_binding(p_engine_object, token, binding_callbacks)); + return reinterpret_cast(::godot::gdextension_interface::object_get_instance_binding(p_engine_object, ::godot::gdextension_interface::token, binding_callbacks)); } TypedArray convert_property_list(const LocalVector &p_list) { @@ -73,7 +73,7 @@ TypedArray convert_property_list(const LocalVector &p_ MethodInfo::operator Dictionary() const { Dictionary dict; dict["name"] = name; - dict["args"] = internal::convert_property_list(arguments); + dict["args"] = ::godot::internal::convert_property_list(arguments); Array da; for (size_t i = 0; i < default_arguments.size(); i++) { da.push_back(default_arguments[i]); diff --git a/src/godot.cpp b/src/godot.cpp index bdd971574..6a93628c5 100644 --- a/src/godot.cpp +++ b/src/godot.cpp @@ -33,6 +33,7 @@ #include #include #include +#include #include #include #include @@ -43,176 +44,17 @@ namespace godot { -namespace internal { +namespace gdextension_interface { -GDExtensionInterfaceGetProcAddress gdextension_interface_get_proc_address = nullptr; +GDExtensionInterfaceGetProcAddress get_proc_address = nullptr; GDExtensionClassLibraryPtr library = nullptr; void *token = nullptr; GDExtensionGodotVersion2 godot_version = {}; -// All of the GDExtension interface functions. -GDExtensionInterfaceGetGodotVersion2 gdextension_interface_get_godot_version2 = nullptr; -GDExtensionInterfaceMemAlloc2 gdextension_interface_mem_alloc2 = nullptr; -GDExtensionInterfaceMemRealloc2 gdextension_interface_mem_realloc2 = nullptr; -GDExtensionInterfaceMemFree2 gdextension_interface_mem_free2 = nullptr; -GDExtensionInterfacePrintError gdextension_interface_print_error = nullptr; -GDExtensionInterfacePrintErrorWithMessage gdextension_interface_print_error_with_message = nullptr; -GDExtensionInterfacePrintWarning gdextension_interface_print_warning = nullptr; -GDExtensionInterfacePrintWarningWithMessage gdextension_interface_print_warning_with_message = nullptr; -GDExtensionInterfacePrintScriptError gdextension_interface_print_script_error = nullptr; -GDExtensionInterfacePrintScriptErrorWithMessage gdextension_interface_print_script_error_with_message = nullptr; -GDExtensionInterfaceGetNativeStructSize gdextension_interface_get_native_struct_size = nullptr; -GDExtensionInterfaceVariantNewCopy gdextension_interface_variant_new_copy = nullptr; -GDExtensionInterfaceVariantNewNil gdextension_interface_variant_new_nil = nullptr; -GDExtensionInterfaceVariantDestroy gdextension_interface_variant_destroy = nullptr; -GDExtensionInterfaceVariantCall gdextension_interface_variant_call = nullptr; -GDExtensionInterfaceVariantCallStatic gdextension_interface_variant_call_static = nullptr; -GDExtensionInterfaceVariantEvaluate gdextension_interface_variant_evaluate = nullptr; -GDExtensionInterfaceVariantSet gdextension_interface_variant_set = nullptr; -GDExtensionInterfaceVariantSetNamed gdextension_interface_variant_set_named = nullptr; -GDExtensionInterfaceVariantSetKeyed gdextension_interface_variant_set_keyed = nullptr; -GDExtensionInterfaceVariantSetIndexed gdextension_interface_variant_set_indexed = nullptr; -GDExtensionInterfaceVariantGet gdextension_interface_variant_get = nullptr; -GDExtensionInterfaceVariantGetNamed gdextension_interface_variant_get_named = nullptr; -GDExtensionInterfaceVariantGetKeyed gdextension_interface_variant_get_keyed = nullptr; -GDExtensionInterfaceVariantGetIndexed gdextension_interface_variant_get_indexed = nullptr; -GDExtensionInterfaceVariantIterInit gdextension_interface_variant_iter_init = nullptr; -GDExtensionInterfaceVariantIterNext gdextension_interface_variant_iter_next = nullptr; -GDExtensionInterfaceVariantIterGet gdextension_interface_variant_iter_get = nullptr; -GDExtensionInterfaceVariantHash gdextension_interface_variant_hash = nullptr; -GDExtensionInterfaceVariantRecursiveHash gdextension_interface_variant_recursive_hash = nullptr; -GDExtensionInterfaceVariantHashCompare gdextension_interface_variant_hash_compare = nullptr; -GDExtensionInterfaceVariantBooleanize gdextension_interface_variant_booleanize = nullptr; -GDExtensionInterfaceVariantDuplicate gdextension_interface_variant_duplicate = nullptr; -GDExtensionInterfaceVariantStringify gdextension_interface_variant_stringify = nullptr; -GDExtensionInterfaceVariantGetType gdextension_interface_variant_get_type = nullptr; -GDExtensionInterfaceVariantHasMethod gdextension_interface_variant_has_method = nullptr; -GDExtensionInterfaceVariantHasMember gdextension_interface_variant_has_member = nullptr; -GDExtensionInterfaceVariantHasKey gdextension_interface_variant_has_key = nullptr; -GDExtensionInterfaceVariantGetObjectInstanceId gdextension_interface_variant_get_object_instance_id = nullptr; -GDExtensionInterfaceVariantGetTypeName gdextension_interface_variant_get_type_name = nullptr; -GDExtensionInterfaceVariantCanConvert gdextension_interface_variant_can_convert = nullptr; -GDExtensionInterfaceVariantCanConvertStrict gdextension_interface_variant_can_convert_strict = nullptr; -GDExtensionInterfaceGetVariantFromTypeConstructor gdextension_interface_get_variant_from_type_constructor = nullptr; -GDExtensionInterfaceGetVariantToTypeConstructor gdextension_interface_get_variant_to_type_constructor = nullptr; -GDExtensionInterfaceGetVariantGetInternalPtrFunc gdextension_interface_variant_get_ptr_internal_getter = nullptr; -GDExtensionInterfaceVariantGetPtrOperatorEvaluator gdextension_interface_variant_get_ptr_operator_evaluator = nullptr; -GDExtensionInterfaceVariantGetPtrBuiltinMethod gdextension_interface_variant_get_ptr_builtin_method = nullptr; -GDExtensionInterfaceVariantGetPtrConstructor gdextension_interface_variant_get_ptr_constructor = nullptr; -GDExtensionInterfaceVariantGetPtrDestructor gdextension_interface_variant_get_ptr_destructor = nullptr; -GDExtensionInterfaceVariantConstruct gdextension_interface_variant_construct = nullptr; -GDExtensionInterfaceVariantGetPtrSetter gdextension_interface_variant_get_ptr_setter = nullptr; -GDExtensionInterfaceVariantGetPtrGetter gdextension_interface_variant_get_ptr_getter = nullptr; -GDExtensionInterfaceVariantGetPtrIndexedSetter gdextension_interface_variant_get_ptr_indexed_setter = nullptr; -GDExtensionInterfaceVariantGetPtrIndexedGetter gdextension_interface_variant_get_ptr_indexed_getter = nullptr; -GDExtensionInterfaceVariantGetPtrKeyedSetter gdextension_interface_variant_get_ptr_keyed_setter = nullptr; -GDExtensionInterfaceVariantGetPtrKeyedGetter gdextension_interface_variant_get_ptr_keyed_getter = nullptr; -GDExtensionInterfaceVariantGetPtrKeyedChecker gdextension_interface_variant_get_ptr_keyed_checker = nullptr; -GDExtensionInterfaceVariantGetConstantValue gdextension_interface_variant_get_constant_value = nullptr; -GDExtensionInterfaceVariantGetPtrUtilityFunction gdextension_interface_variant_get_ptr_utility_function = nullptr; -GDExtensionInterfaceStringNewWithLatin1Chars gdextension_interface_string_new_with_latin1_chars = nullptr; -GDExtensionInterfaceStringNewWithUtf8Chars gdextension_interface_string_new_with_utf8_chars = nullptr; -GDExtensionInterfaceStringNewWithUtf16Chars gdextension_interface_string_new_with_utf16_chars = nullptr; -GDExtensionInterfaceStringNewWithUtf32Chars gdextension_interface_string_new_with_utf32_chars = nullptr; -GDExtensionInterfaceStringNewWithWideChars gdextension_interface_string_new_with_wide_chars = nullptr; -GDExtensionInterfaceStringNewWithLatin1CharsAndLen gdextension_interface_string_new_with_latin1_chars_and_len = nullptr; -GDExtensionInterfaceStringNewWithUtf8CharsAndLen gdextension_interface_string_new_with_utf8_chars_and_len = nullptr; -GDExtensionInterfaceStringNewWithUtf8CharsAndLen2 gdextension_interface_string_new_with_utf8_chars_and_len2 = nullptr; -GDExtensionInterfaceStringNewWithUtf16CharsAndLen gdextension_interface_string_new_with_utf16_chars_and_len = nullptr; -GDExtensionInterfaceStringNewWithUtf16CharsAndLen2 gdextension_interface_string_new_with_utf16_chars_and_len2 = nullptr; -GDExtensionInterfaceStringNewWithUtf32CharsAndLen gdextension_interface_string_new_with_utf32_chars_and_len = nullptr; -GDExtensionInterfaceStringNewWithWideCharsAndLen gdextension_interface_string_new_with_wide_chars_and_len = nullptr; -GDExtensionInterfaceStringToLatin1Chars gdextension_interface_string_to_latin1_chars = nullptr; -GDExtensionInterfaceStringToUtf8Chars gdextension_interface_string_to_utf8_chars = nullptr; -GDExtensionInterfaceStringToUtf16Chars gdextension_interface_string_to_utf16_chars = nullptr; -GDExtensionInterfaceStringToUtf32Chars gdextension_interface_string_to_utf32_chars = nullptr; -GDExtensionInterfaceStringToWideChars gdextension_interface_string_to_wide_chars = nullptr; -GDExtensionInterfaceStringOperatorIndex gdextension_interface_string_operator_index = nullptr; -GDExtensionInterfaceStringOperatorIndexConst gdextension_interface_string_operator_index_const = nullptr; -GDExtensionInterfaceStringOperatorPlusEqString gdextension_interface_string_operator_plus_eq_string = nullptr; -GDExtensionInterfaceStringOperatorPlusEqChar gdextension_interface_string_operator_plus_eq_char = nullptr; -GDExtensionInterfaceStringOperatorPlusEqCstr gdextension_interface_string_operator_plus_eq_cstr = nullptr; -GDExtensionInterfaceStringOperatorPlusEqWcstr gdextension_interface_string_operator_plus_eq_wcstr = nullptr; -GDExtensionInterfaceStringOperatorPlusEqC32str gdextension_interface_string_operator_plus_eq_c32str = nullptr; -GDExtensionInterfaceStringResize gdextension_interface_string_resize = nullptr; -GDExtensionInterfaceStringNameNewWithLatin1Chars gdextension_interface_string_name_new_with_latin1_chars = nullptr; -GDExtensionInterfaceXmlParserOpenBuffer gdextension_interface_xml_parser_open_buffer = nullptr; -GDExtensionInterfaceFileAccessStoreBuffer gdextension_interface_file_access_store_buffer = nullptr; -GDExtensionInterfaceFileAccessGetBuffer gdextension_interface_file_access_get_buffer = nullptr; -GDExtensionInterfaceWorkerThreadPoolAddNativeGroupTask gdextension_interface_worker_thread_pool_add_native_group_task = nullptr; -GDExtensionInterfaceWorkerThreadPoolAddNativeTask gdextension_interface_worker_thread_pool_add_native_task = nullptr; -GDExtensionInterfacePackedByteArrayOperatorIndex gdextension_interface_packed_byte_array_operator_index = nullptr; -GDExtensionInterfacePackedByteArrayOperatorIndexConst gdextension_interface_packed_byte_array_operator_index_const = nullptr; -GDExtensionInterfacePackedColorArrayOperatorIndex gdextension_interface_packed_color_array_operator_index = nullptr; -GDExtensionInterfacePackedColorArrayOperatorIndexConst gdextension_interface_packed_color_array_operator_index_const = nullptr; -GDExtensionInterfacePackedFloat32ArrayOperatorIndex gdextension_interface_packed_float32_array_operator_index = nullptr; -GDExtensionInterfacePackedFloat32ArrayOperatorIndexConst gdextension_interface_packed_float32_array_operator_index_const = nullptr; -GDExtensionInterfacePackedFloat64ArrayOperatorIndex gdextension_interface_packed_float64_array_operator_index = nullptr; -GDExtensionInterfacePackedFloat64ArrayOperatorIndexConst gdextension_interface_packed_float64_array_operator_index_const = nullptr; -GDExtensionInterfacePackedInt32ArrayOperatorIndex gdextension_interface_packed_int32_array_operator_index = nullptr; -GDExtensionInterfacePackedInt32ArrayOperatorIndexConst gdextension_interface_packed_int32_array_operator_index_const = nullptr; -GDExtensionInterfacePackedInt64ArrayOperatorIndex gdextension_interface_packed_int64_array_operator_index = nullptr; -GDExtensionInterfacePackedInt64ArrayOperatorIndexConst gdextension_interface_packed_int64_array_operator_index_const = nullptr; -GDExtensionInterfacePackedStringArrayOperatorIndex gdextension_interface_packed_string_array_operator_index = nullptr; -GDExtensionInterfacePackedStringArrayOperatorIndexConst gdextension_interface_packed_string_array_operator_index_const = nullptr; -GDExtensionInterfacePackedVector2ArrayOperatorIndex gdextension_interface_packed_vector2_array_operator_index = nullptr; -GDExtensionInterfacePackedVector2ArrayOperatorIndexConst gdextension_interface_packed_vector2_array_operator_index_const = nullptr; -GDExtensionInterfacePackedVector3ArrayOperatorIndex gdextension_interface_packed_vector3_array_operator_index = nullptr; -GDExtensionInterfacePackedVector3ArrayOperatorIndexConst gdextension_interface_packed_vector3_array_operator_index_const = nullptr; -GDExtensionInterfacePackedVector4ArrayOperatorIndex gdextension_interface_packed_vector4_array_operator_index = nullptr; -GDExtensionInterfacePackedVector4ArrayOperatorIndexConst gdextension_interface_packed_vector4_array_operator_index_const = nullptr; -GDExtensionInterfaceArrayOperatorIndex gdextension_interface_array_operator_index = nullptr; -GDExtensionInterfaceArrayOperatorIndexConst gdextension_interface_array_operator_index_const = nullptr; -GDExtensionInterfaceArraySetTyped gdextension_interface_array_set_typed = nullptr; -GDExtensionInterfaceDictionaryOperatorIndex gdextension_interface_dictionary_operator_index = nullptr; -GDExtensionInterfaceDictionaryOperatorIndexConst gdextension_interface_dictionary_operator_index_const = nullptr; -GDExtensionInterfaceDictionarySetTyped gdextension_interface_dictionary_set_typed = nullptr; -GDExtensionInterfaceObjectMethodBindCall gdextension_interface_object_method_bind_call = nullptr; -GDExtensionInterfaceObjectMethodBindPtrcall gdextension_interface_object_method_bind_ptrcall = nullptr; -GDExtensionInterfaceObjectDestroy gdextension_interface_object_destroy = nullptr; -GDExtensionInterfaceGlobalGetSingleton gdextension_interface_global_get_singleton = nullptr; -GDExtensionInterfaceObjectGetInstanceBinding gdextension_interface_object_get_instance_binding = nullptr; -GDExtensionInterfaceObjectSetInstanceBinding gdextension_interface_object_set_instance_binding = nullptr; -GDExtensionInterfaceObjectFreeInstanceBinding gdextension_interface_object_free_instance_binding = nullptr; -GDExtensionInterfaceObjectSetInstance gdextension_interface_object_set_instance = nullptr; -GDExtensionInterfaceObjectGetClassName gdextension_interface_object_get_class_name = nullptr; -GDExtensionInterfaceObjectCastTo gdextension_interface_object_cast_to = nullptr; -GDExtensionInterfaceObjectGetInstanceFromId gdextension_interface_object_get_instance_from_id = nullptr; -GDExtensionInterfaceObjectGetInstanceId gdextension_interface_object_get_instance_id = nullptr; -GDExtensionInterfaceObjectHasScriptMethod gdextension_interface_object_has_script_method = nullptr; -GDExtensionInterfaceObjectCallScriptMethod gdextension_interface_object_call_script_method = nullptr; -GDExtensionInterfaceCallableCustomCreate2 gdextension_interface_callable_custom_create2 = nullptr; -GDExtensionInterfaceCallableCustomGetUserData gdextension_interface_callable_custom_get_userdata = nullptr; -GDExtensionInterfaceRefGetObject gdextension_interface_ref_get_object = nullptr; -GDExtensionInterfaceRefSetObject gdextension_interface_ref_set_object = nullptr; -GDExtensionInterfaceScriptInstanceCreate3 gdextension_interface_script_instance_create3 = nullptr; -GDExtensionInterfacePlaceHolderScriptInstanceCreate gdextension_interface_placeholder_script_instance_create = nullptr; -GDExtensionInterfacePlaceHolderScriptInstanceUpdate gdextension_interface_placeholder_script_instance_update = nullptr; -GDExtensionInterfaceObjectGetScriptInstance gdextension_interface_object_get_script_instance = nullptr; -GDExtensionInterfaceObjectSetScriptInstance gdextension_interface_object_set_script_instance = nullptr; -GDExtensionInterfaceClassdbConstructObject2 gdextension_interface_classdb_construct_object2 = nullptr; -GDExtensionInterfaceClassdbGetMethodBind gdextension_interface_classdb_get_method_bind = nullptr; -GDExtensionInterfaceClassdbGetClassTag gdextension_interface_classdb_get_class_tag = nullptr; -GDExtensionInterfaceClassdbRegisterExtensionClass5 gdextension_interface_classdb_register_extension_class5 = nullptr; -GDExtensionInterfaceClassdbRegisterExtensionClassMethod gdextension_interface_classdb_register_extension_class_method = nullptr; -GDExtensionInterfaceClassdbRegisterExtensionClassVirtualMethod gdextension_interface_classdb_register_extension_class_virtual_method = nullptr; -GDExtensionInterfaceClassdbRegisterExtensionClassIntegerConstant gdextension_interface_classdb_register_extension_class_integer_constant = nullptr; -GDExtensionInterfaceClassdbRegisterExtensionClassProperty gdextension_interface_classdb_register_extension_class_property = nullptr; -GDExtensionInterfaceClassdbRegisterExtensionClassPropertyIndexed gdextension_interface_classdb_register_extension_class_property_indexed = nullptr; -GDExtensionInterfaceClassdbRegisterExtensionClassPropertyGroup gdextension_interface_classdb_register_extension_class_property_group = nullptr; -GDExtensionInterfaceClassdbRegisterExtensionClassPropertySubgroup gdextension_interface_classdb_register_extension_class_property_subgroup = nullptr; -GDExtensionInterfaceClassdbRegisterExtensionClassSignal gdextension_interface_classdb_register_extension_class_signal = nullptr; -GDExtensionInterfaceClassdbUnregisterExtensionClass gdextension_interface_classdb_unregister_extension_class = nullptr; -GDExtensionInterfaceGetLibraryPath gdextension_interface_get_library_path = nullptr; -GDExtensionInterfaceEditorAddPlugin gdextension_interface_editor_add_plugin = nullptr; -GDExtensionInterfaceEditorRemovePlugin gdextension_interface_editor_remove_plugin = nullptr; -GDExtensionInterfaceEditorRegisterGetClassesUsedCallback gdextension_interface_editor_register_get_classes_used_callback = nullptr; -GDExtensionsInterfaceEditorHelpLoadXmlFromUtf8Chars gdextension_interface_editor_help_load_xml_from_utf8_chars = nullptr; -GDExtensionsInterfaceEditorHelpLoadXmlFromUtf8CharsAndLen gdextension_interface_editor_help_load_xml_from_utf8_chars_and_len = nullptr; -GDExtensionInterfaceImagePtrw gdextension_interface_image_ptrw = nullptr; -GDExtensionInterfaceImagePtr gdextension_interface_image_ptr = nullptr; -GDExtensionInterfaceRegisterMainLoopCallbacks gdextension_interface_register_main_loop_callbacks = nullptr; +} // namespace gdextension_interface + +namespace internal { struct DocData { const char *hash = nullptr; @@ -250,16 +92,6 @@ bool GDExtensionBinding::api_initialized = false; int GDExtensionBinding::level_initialized[MODULE_INITIALIZATION_LEVEL_MAX] = { 0 }; GDExtensionBinding::InitDataList GDExtensionBinding::initdata; -#define ERR_PRINT_EARLY(m_msg) \ - internal::gdextension_interface_print_error(m_msg, FUNCTION_STR, __FILE__, __LINE__, false) - -#define LOAD_PROC_ADDRESS(m_name, m_type) \ - internal::gdextension_interface_##m_name = (m_type)p_get_proc_address(#m_name); \ - if (!internal::gdextension_interface_##m_name) { \ - ERR_PRINT_EARLY("Unable to load GDExtension interface function " #m_name "()"); \ - return false; \ - } - // Partial definition of the legacy interface so we can detect it and show an error. typedef struct { uint32_t version_major; @@ -294,35 +126,35 @@ GDExtensionBool GDExtensionBinding::init(GDExtensionInterfaceGetProcAddress p_ge if (uintptr_t(p_get_proc_address) % alignof(LegacyGDExtensionInterface) == 0 && raw_interface[0] == 4 && raw_interface[1] == 0) { // Use the legacy interface only to give a nice error. LegacyGDExtensionInterface *legacy_interface = (LegacyGDExtensionInterface *)p_get_proc_address; - internal::gdextension_interface_print_error = (GDExtensionInterfacePrintError)legacy_interface->print_error; + ::godot::gdextension_interface::print_error = (GDExtensionInterfacePrintError)legacy_interface->print_error; ERR_PRINT_EARLY("Cannot load a GDExtension built for Godot 4.1+ in Godot 4.0."); return false; } // Load the "print_error" function first (needed by the ERR_PRINT_EARLY() macro). - internal::gdextension_interface_print_error = (GDExtensionInterfacePrintError)p_get_proc_address("print_error"); - if (!internal::gdextension_interface_print_error) { + ::godot::gdextension_interface::print_error = (GDExtensionInterfacePrintError)p_get_proc_address("print_error"); + if (!::godot::gdextension_interface::print_error) { printf("ERROR: Unable to load GDExtension interface function print_error().\n"); return false; } - internal::gdextension_interface_get_proc_address = p_get_proc_address; - internal::library = p_library; - internal::token = p_library; + ::godot::gdextension_interface::get_proc_address = p_get_proc_address; + ::godot::gdextension_interface::library = p_library; + ::godot::gdextension_interface::token = p_library; LOAD_PROC_ADDRESS(get_godot_version2, GDExtensionInterfaceGetGodotVersion2); - internal::gdextension_interface_get_godot_version2(&internal::godot_version); + ::godot::gdextension_interface::get_godot_version2(&::godot::gdextension_interface::godot_version); // Check that godot-cpp was compiled using an extension_api.json older or at the // same version as the Godot that is loading it. bool compatible; - if (internal::godot_version.major != GODOT_VERSION_MAJOR) { - compatible = internal::godot_version.major > GODOT_VERSION_MAJOR; - } else if (internal::godot_version.minor != GODOT_VERSION_MINOR) { - compatible = internal::godot_version.minor > GODOT_VERSION_MINOR; + if (::godot::gdextension_interface::godot_version.major != GODOT_VERSION_MAJOR) { + compatible = ::godot::gdextension_interface::godot_version.major > GODOT_VERSION_MAJOR; + } else if (::godot::gdextension_interface::godot_version.minor != GODOT_VERSION_MINOR) { + compatible = ::godot::gdextension_interface::godot_version.minor > GODOT_VERSION_MINOR; } else { #if GODOT_VERSION_PATCH > 0 - compatible = internal::godot_version.patch >= GODOT_VERSION_PATCH; + compatible = ::godot::gdextension_interface::godot_version.patch >= GODOT_VERSION_PATCH; #else // Prevent -Wtype-limits warning due to unsigned comparison. compatible = true; @@ -334,170 +166,14 @@ GDExtensionBool GDExtensionBinding::init(GDExtensionInterfaceGetProcAddress p_ge char msg[128]; snprintf(msg, 128, "Cannot load a GDExtension built for Godot %d.%d.%d using an older version of Godot (%d.%d.%d).", GODOT_VERSION_MAJOR, GODOT_VERSION_MINOR, GODOT_VERSION_PATCH, - internal::godot_version.major, internal::godot_version.minor, internal::godot_version.patch); + ::godot::gdextension_interface::godot_version.major, ::godot::gdextension_interface::godot_version.minor, ::godot::gdextension_interface::godot_version.patch); ERR_PRINT_EARLY(msg); return false; } - LOAD_PROC_ADDRESS(mem_alloc2, GDExtensionInterfaceMemAlloc2); - LOAD_PROC_ADDRESS(mem_realloc2, GDExtensionInterfaceMemRealloc2); - LOAD_PROC_ADDRESS(mem_free2, GDExtensionInterfaceMemFree2); - LOAD_PROC_ADDRESS(print_error_with_message, GDExtensionInterfacePrintErrorWithMessage); - LOAD_PROC_ADDRESS(print_warning, GDExtensionInterfacePrintWarning); - LOAD_PROC_ADDRESS(print_warning_with_message, GDExtensionInterfacePrintWarningWithMessage); - LOAD_PROC_ADDRESS(print_script_error, GDExtensionInterfacePrintScriptError); - LOAD_PROC_ADDRESS(print_script_error_with_message, GDExtensionInterfacePrintScriptErrorWithMessage); - LOAD_PROC_ADDRESS(get_native_struct_size, GDExtensionInterfaceGetNativeStructSize); - LOAD_PROC_ADDRESS(variant_new_copy, GDExtensionInterfaceVariantNewCopy); - LOAD_PROC_ADDRESS(variant_new_nil, GDExtensionInterfaceVariantNewNil); - LOAD_PROC_ADDRESS(variant_destroy, GDExtensionInterfaceVariantDestroy); - LOAD_PROC_ADDRESS(variant_call, GDExtensionInterfaceVariantCall); - LOAD_PROC_ADDRESS(variant_call_static, GDExtensionInterfaceVariantCallStatic); - LOAD_PROC_ADDRESS(variant_evaluate, GDExtensionInterfaceVariantEvaluate); - LOAD_PROC_ADDRESS(variant_set, GDExtensionInterfaceVariantSet); - LOAD_PROC_ADDRESS(variant_set_named, GDExtensionInterfaceVariantSetNamed); - LOAD_PROC_ADDRESS(variant_set_keyed, GDExtensionInterfaceVariantSetKeyed); - LOAD_PROC_ADDRESS(variant_set_indexed, GDExtensionInterfaceVariantSetIndexed); - LOAD_PROC_ADDRESS(variant_get, GDExtensionInterfaceVariantGet); - LOAD_PROC_ADDRESS(variant_get_named, GDExtensionInterfaceVariantGetNamed); - LOAD_PROC_ADDRESS(variant_get_keyed, GDExtensionInterfaceVariantGetKeyed); - LOAD_PROC_ADDRESS(variant_get_indexed, GDExtensionInterfaceVariantGetIndexed); - LOAD_PROC_ADDRESS(variant_iter_init, GDExtensionInterfaceVariantIterInit); - LOAD_PROC_ADDRESS(variant_iter_next, GDExtensionInterfaceVariantIterNext); - LOAD_PROC_ADDRESS(variant_iter_get, GDExtensionInterfaceVariantIterGet); - LOAD_PROC_ADDRESS(variant_hash, GDExtensionInterfaceVariantHash); - LOAD_PROC_ADDRESS(variant_recursive_hash, GDExtensionInterfaceVariantRecursiveHash); - LOAD_PROC_ADDRESS(variant_hash_compare, GDExtensionInterfaceVariantHashCompare); - LOAD_PROC_ADDRESS(variant_booleanize, GDExtensionInterfaceVariantBooleanize); - LOAD_PROC_ADDRESS(variant_duplicate, GDExtensionInterfaceVariantDuplicate); - LOAD_PROC_ADDRESS(variant_stringify, GDExtensionInterfaceVariantStringify); - LOAD_PROC_ADDRESS(variant_get_type, GDExtensionInterfaceVariantGetType); - LOAD_PROC_ADDRESS(variant_has_method, GDExtensionInterfaceVariantHasMethod); - LOAD_PROC_ADDRESS(variant_has_member, GDExtensionInterfaceVariantHasMember); - LOAD_PROC_ADDRESS(variant_has_key, GDExtensionInterfaceVariantHasKey); - LOAD_PROC_ADDRESS(variant_get_object_instance_id, GDExtensionInterfaceVariantGetObjectInstanceId); - LOAD_PROC_ADDRESS(variant_get_type_name, GDExtensionInterfaceVariantGetTypeName); - LOAD_PROC_ADDRESS(variant_can_convert, GDExtensionInterfaceVariantCanConvert); - LOAD_PROC_ADDRESS(variant_can_convert_strict, GDExtensionInterfaceVariantCanConvertStrict); - LOAD_PROC_ADDRESS(get_variant_from_type_constructor, GDExtensionInterfaceGetVariantFromTypeConstructor); - LOAD_PROC_ADDRESS(get_variant_to_type_constructor, GDExtensionInterfaceGetVariantToTypeConstructor); - LOAD_PROC_ADDRESS(variant_get_ptr_internal_getter, GDExtensionInterfaceGetVariantGetInternalPtrFunc); - LOAD_PROC_ADDRESS(variant_get_ptr_operator_evaluator, GDExtensionInterfaceVariantGetPtrOperatorEvaluator); - LOAD_PROC_ADDRESS(variant_get_ptr_builtin_method, GDExtensionInterfaceVariantGetPtrBuiltinMethod); - LOAD_PROC_ADDRESS(variant_get_ptr_constructor, GDExtensionInterfaceVariantGetPtrConstructor); - LOAD_PROC_ADDRESS(variant_get_ptr_destructor, GDExtensionInterfaceVariantGetPtrDestructor); - LOAD_PROC_ADDRESS(variant_construct, GDExtensionInterfaceVariantConstruct); - LOAD_PROC_ADDRESS(variant_get_ptr_setter, GDExtensionInterfaceVariantGetPtrSetter); - LOAD_PROC_ADDRESS(variant_get_ptr_getter, GDExtensionInterfaceVariantGetPtrGetter); - LOAD_PROC_ADDRESS(variant_get_ptr_indexed_setter, GDExtensionInterfaceVariantGetPtrIndexedSetter); - LOAD_PROC_ADDRESS(variant_get_ptr_indexed_getter, GDExtensionInterfaceVariantGetPtrIndexedGetter); - LOAD_PROC_ADDRESS(variant_get_ptr_keyed_setter, GDExtensionInterfaceVariantGetPtrKeyedSetter); - LOAD_PROC_ADDRESS(variant_get_ptr_keyed_getter, GDExtensionInterfaceVariantGetPtrKeyedGetter); - LOAD_PROC_ADDRESS(variant_get_ptr_keyed_checker, GDExtensionInterfaceVariantGetPtrKeyedChecker); - LOAD_PROC_ADDRESS(variant_get_constant_value, GDExtensionInterfaceVariantGetConstantValue); - LOAD_PROC_ADDRESS(variant_get_ptr_utility_function, GDExtensionInterfaceVariantGetPtrUtilityFunction); - LOAD_PROC_ADDRESS(string_new_with_latin1_chars, GDExtensionInterfaceStringNewWithLatin1Chars); - LOAD_PROC_ADDRESS(string_new_with_utf8_chars, GDExtensionInterfaceStringNewWithUtf8Chars); - LOAD_PROC_ADDRESS(string_new_with_utf16_chars, GDExtensionInterfaceStringNewWithUtf16Chars); - LOAD_PROC_ADDRESS(string_new_with_utf32_chars, GDExtensionInterfaceStringNewWithUtf32Chars); - LOAD_PROC_ADDRESS(string_new_with_wide_chars, GDExtensionInterfaceStringNewWithWideChars); - LOAD_PROC_ADDRESS(string_new_with_latin1_chars_and_len, GDExtensionInterfaceStringNewWithLatin1CharsAndLen); - LOAD_PROC_ADDRESS(string_new_with_utf8_chars_and_len, GDExtensionInterfaceStringNewWithUtf8CharsAndLen); - LOAD_PROC_ADDRESS(string_new_with_utf8_chars_and_len2, GDExtensionInterfaceStringNewWithUtf8CharsAndLen2); - LOAD_PROC_ADDRESS(string_new_with_utf16_chars_and_len, GDExtensionInterfaceStringNewWithUtf16CharsAndLen); - LOAD_PROC_ADDRESS(string_new_with_utf16_chars_and_len2, GDExtensionInterfaceStringNewWithUtf16CharsAndLen2); - LOAD_PROC_ADDRESS(string_new_with_utf32_chars_and_len, GDExtensionInterfaceStringNewWithUtf32CharsAndLen); - LOAD_PROC_ADDRESS(string_new_with_wide_chars_and_len, GDExtensionInterfaceStringNewWithWideCharsAndLen); - LOAD_PROC_ADDRESS(string_to_latin1_chars, GDExtensionInterfaceStringToLatin1Chars); - LOAD_PROC_ADDRESS(string_to_utf8_chars, GDExtensionInterfaceStringToUtf8Chars); - LOAD_PROC_ADDRESS(string_to_utf16_chars, GDExtensionInterfaceStringToUtf16Chars); - LOAD_PROC_ADDRESS(string_to_utf32_chars, GDExtensionInterfaceStringToUtf32Chars); - LOAD_PROC_ADDRESS(string_to_wide_chars, GDExtensionInterfaceStringToWideChars); - LOAD_PROC_ADDRESS(string_operator_index, GDExtensionInterfaceStringOperatorIndex); - LOAD_PROC_ADDRESS(string_operator_index_const, GDExtensionInterfaceStringOperatorIndexConst); - LOAD_PROC_ADDRESS(string_operator_plus_eq_string, GDExtensionInterfaceStringOperatorPlusEqString); - LOAD_PROC_ADDRESS(string_operator_plus_eq_char, GDExtensionInterfaceStringOperatorPlusEqChar); - LOAD_PROC_ADDRESS(string_operator_plus_eq_cstr, GDExtensionInterfaceStringOperatorPlusEqCstr); - LOAD_PROC_ADDRESS(string_operator_plus_eq_wcstr, GDExtensionInterfaceStringOperatorPlusEqWcstr); - LOAD_PROC_ADDRESS(string_operator_plus_eq_c32str, GDExtensionInterfaceStringOperatorPlusEqC32str); - LOAD_PROC_ADDRESS(string_resize, GDExtensionInterfaceStringResize); - LOAD_PROC_ADDRESS(string_name_new_with_latin1_chars, GDExtensionInterfaceStringNameNewWithLatin1Chars); - LOAD_PROC_ADDRESS(xml_parser_open_buffer, GDExtensionInterfaceXmlParserOpenBuffer); - LOAD_PROC_ADDRESS(file_access_store_buffer, GDExtensionInterfaceFileAccessStoreBuffer); - LOAD_PROC_ADDRESS(file_access_get_buffer, GDExtensionInterfaceFileAccessGetBuffer); - LOAD_PROC_ADDRESS(worker_thread_pool_add_native_group_task, GDExtensionInterfaceWorkerThreadPoolAddNativeGroupTask); - LOAD_PROC_ADDRESS(worker_thread_pool_add_native_task, GDExtensionInterfaceWorkerThreadPoolAddNativeTask); - LOAD_PROC_ADDRESS(packed_byte_array_operator_index, GDExtensionInterfacePackedByteArrayOperatorIndex); - LOAD_PROC_ADDRESS(packed_byte_array_operator_index_const, GDExtensionInterfacePackedByteArrayOperatorIndexConst); - LOAD_PROC_ADDRESS(packed_color_array_operator_index, GDExtensionInterfacePackedColorArrayOperatorIndex); - LOAD_PROC_ADDRESS(packed_color_array_operator_index_const, GDExtensionInterfacePackedColorArrayOperatorIndexConst); - LOAD_PROC_ADDRESS(packed_float32_array_operator_index, GDExtensionInterfacePackedFloat32ArrayOperatorIndex); - LOAD_PROC_ADDRESS(packed_float32_array_operator_index_const, GDExtensionInterfacePackedFloat32ArrayOperatorIndexConst); - LOAD_PROC_ADDRESS(packed_float64_array_operator_index, GDExtensionInterfacePackedFloat64ArrayOperatorIndex); - LOAD_PROC_ADDRESS(packed_float64_array_operator_index_const, GDExtensionInterfacePackedFloat64ArrayOperatorIndexConst); - LOAD_PROC_ADDRESS(packed_int32_array_operator_index, GDExtensionInterfacePackedInt32ArrayOperatorIndex); - LOAD_PROC_ADDRESS(packed_int32_array_operator_index_const, GDExtensionInterfacePackedInt32ArrayOperatorIndexConst); - LOAD_PROC_ADDRESS(packed_int64_array_operator_index, GDExtensionInterfacePackedInt64ArrayOperatorIndex); - LOAD_PROC_ADDRESS(packed_int64_array_operator_index_const, GDExtensionInterfacePackedInt64ArrayOperatorIndexConst); - LOAD_PROC_ADDRESS(packed_string_array_operator_index, GDExtensionInterfacePackedStringArrayOperatorIndex); - LOAD_PROC_ADDRESS(packed_string_array_operator_index_const, GDExtensionInterfacePackedStringArrayOperatorIndexConst); - LOAD_PROC_ADDRESS(packed_vector2_array_operator_index, GDExtensionInterfacePackedVector2ArrayOperatorIndex); - LOAD_PROC_ADDRESS(packed_vector2_array_operator_index_const, GDExtensionInterfacePackedVector2ArrayOperatorIndexConst); - LOAD_PROC_ADDRESS(packed_vector3_array_operator_index, GDExtensionInterfacePackedVector3ArrayOperatorIndex); - LOAD_PROC_ADDRESS(packed_vector3_array_operator_index_const, GDExtensionInterfacePackedVector3ArrayOperatorIndexConst); - LOAD_PROC_ADDRESS(packed_vector4_array_operator_index, GDExtensionInterfacePackedVector4ArrayOperatorIndex); - LOAD_PROC_ADDRESS(packed_vector4_array_operator_index_const, GDExtensionInterfacePackedVector4ArrayOperatorIndexConst); - LOAD_PROC_ADDRESS(array_operator_index, GDExtensionInterfaceArrayOperatorIndex); - LOAD_PROC_ADDRESS(array_operator_index_const, GDExtensionInterfaceArrayOperatorIndexConst); - LOAD_PROC_ADDRESS(array_set_typed, GDExtensionInterfaceArraySetTyped); - LOAD_PROC_ADDRESS(dictionary_operator_index, GDExtensionInterfaceDictionaryOperatorIndex); - LOAD_PROC_ADDRESS(dictionary_operator_index_const, GDExtensionInterfaceDictionaryOperatorIndexConst); - LOAD_PROC_ADDRESS(dictionary_set_typed, GDExtensionInterfaceDictionarySetTyped); - LOAD_PROC_ADDRESS(object_method_bind_call, GDExtensionInterfaceObjectMethodBindCall); - LOAD_PROC_ADDRESS(object_method_bind_ptrcall, GDExtensionInterfaceObjectMethodBindPtrcall); - LOAD_PROC_ADDRESS(object_destroy, GDExtensionInterfaceObjectDestroy); - LOAD_PROC_ADDRESS(global_get_singleton, GDExtensionInterfaceGlobalGetSingleton); - LOAD_PROC_ADDRESS(object_get_instance_binding, GDExtensionInterfaceObjectGetInstanceBinding); - LOAD_PROC_ADDRESS(object_set_instance_binding, GDExtensionInterfaceObjectSetInstanceBinding); - LOAD_PROC_ADDRESS(object_free_instance_binding, GDExtensionInterfaceObjectFreeInstanceBinding); - LOAD_PROC_ADDRESS(object_set_instance, GDExtensionInterfaceObjectSetInstance); - LOAD_PROC_ADDRESS(object_get_class_name, GDExtensionInterfaceObjectGetClassName); - LOAD_PROC_ADDRESS(object_cast_to, GDExtensionInterfaceObjectCastTo); - LOAD_PROC_ADDRESS(object_get_instance_from_id, GDExtensionInterfaceObjectGetInstanceFromId); - LOAD_PROC_ADDRESS(object_get_instance_id, GDExtensionInterfaceObjectGetInstanceId); - LOAD_PROC_ADDRESS(object_has_script_method, GDExtensionInterfaceObjectHasScriptMethod); - LOAD_PROC_ADDRESS(object_call_script_method, GDExtensionInterfaceObjectCallScriptMethod); - LOAD_PROC_ADDRESS(callable_custom_create2, GDExtensionInterfaceCallableCustomCreate2); - LOAD_PROC_ADDRESS(callable_custom_get_userdata, GDExtensionInterfaceCallableCustomGetUserData); - LOAD_PROC_ADDRESS(ref_get_object, GDExtensionInterfaceRefGetObject); - LOAD_PROC_ADDRESS(ref_set_object, GDExtensionInterfaceRefSetObject); - LOAD_PROC_ADDRESS(script_instance_create3, GDExtensionInterfaceScriptInstanceCreate3); - LOAD_PROC_ADDRESS(placeholder_script_instance_create, GDExtensionInterfacePlaceHolderScriptInstanceCreate); - LOAD_PROC_ADDRESS(placeholder_script_instance_update, GDExtensionInterfacePlaceHolderScriptInstanceUpdate); - LOAD_PROC_ADDRESS(object_get_script_instance, GDExtensionInterfaceObjectGetScriptInstance); - LOAD_PROC_ADDRESS(object_set_script_instance, GDExtensionInterfaceObjectSetScriptInstance); - LOAD_PROC_ADDRESS(classdb_construct_object2, GDExtensionInterfaceClassdbConstructObject2); - LOAD_PROC_ADDRESS(classdb_get_method_bind, GDExtensionInterfaceClassdbGetMethodBind); - LOAD_PROC_ADDRESS(classdb_get_class_tag, GDExtensionInterfaceClassdbGetClassTag); - LOAD_PROC_ADDRESS(classdb_register_extension_class5, GDExtensionInterfaceClassdbRegisterExtensionClass5); - LOAD_PROC_ADDRESS(classdb_register_extension_class_method, GDExtensionInterfaceClassdbRegisterExtensionClassMethod); - LOAD_PROC_ADDRESS(classdb_register_extension_class_virtual_method, GDExtensionInterfaceClassdbRegisterExtensionClassVirtualMethod); - LOAD_PROC_ADDRESS(classdb_register_extension_class_integer_constant, GDExtensionInterfaceClassdbRegisterExtensionClassIntegerConstant); - LOAD_PROC_ADDRESS(classdb_register_extension_class_property, GDExtensionInterfaceClassdbRegisterExtensionClassProperty); - LOAD_PROC_ADDRESS(classdb_register_extension_class_property_indexed, GDExtensionInterfaceClassdbRegisterExtensionClassPropertyIndexed); - LOAD_PROC_ADDRESS(classdb_register_extension_class_property_group, GDExtensionInterfaceClassdbRegisterExtensionClassPropertyGroup); - LOAD_PROC_ADDRESS(classdb_register_extension_class_property_subgroup, GDExtensionInterfaceClassdbRegisterExtensionClassPropertySubgroup); - LOAD_PROC_ADDRESS(classdb_register_extension_class_signal, GDExtensionInterfaceClassdbRegisterExtensionClassSignal); - LOAD_PROC_ADDRESS(classdb_unregister_extension_class, GDExtensionInterfaceClassdbUnregisterExtensionClass); - LOAD_PROC_ADDRESS(get_library_path, GDExtensionInterfaceGetLibraryPath); - LOAD_PROC_ADDRESS(editor_add_plugin, GDExtensionInterfaceEditorAddPlugin); - LOAD_PROC_ADDRESS(editor_remove_plugin, GDExtensionInterfaceEditorRemovePlugin); - LOAD_PROC_ADDRESS(editor_register_get_classes_used_callback, GDExtensionInterfaceEditorRegisterGetClassesUsedCallback); - LOAD_PROC_ADDRESS(editor_help_load_xml_from_utf8_chars, GDExtensionsInterfaceEditorHelpLoadXmlFromUtf8Chars); - LOAD_PROC_ADDRESS(editor_help_load_xml_from_utf8_chars_and_len, GDExtensionsInterfaceEditorHelpLoadXmlFromUtf8CharsAndLen); - LOAD_PROC_ADDRESS(image_ptrw, GDExtensionInterfaceImagePtrw); - LOAD_PROC_ADDRESS(image_ptr, GDExtensionInterfaceImagePtr); - LOAD_PROC_ADDRESS(register_main_loop_callbacks, GDExtensionInterfaceRegisterMainLoopCallbacks); + if (!::godot::internal::load_gdextension_interface(p_get_proc_address)) { + return false; + } r_initialization->initialize = initialize_level; r_initialization->deinitialize = deinitialize_level; @@ -505,7 +181,7 @@ GDExtensionBool GDExtensionBinding::init(GDExtensionInterfaceGetProcAddress p_ge r_initialization->minimum_initialization_level = p_init_data->minimum_initialization_level; Variant::init_bindings(); - godot::internal::register_engine_classes(); + ::godot::internal::register_engine_classes(); api_initialized = true; return true; @@ -529,13 +205,13 @@ void GDExtensionBinding::initialize_level(void *p_userdata, GDExtensionInitializ level_initialized[p_level]++; if ((ModuleInitializationLevel)p_level == MODULE_INITIALIZATION_LEVEL_CORE && init_data && init_data->has_main_loop_callbacks()) { - internal::gdextension_interface_register_main_loop_callbacks(internal::library, &init_data->main_loop_callbacks); + ::godot::gdextension_interface::register_main_loop_callbacks(::godot::gdextension_interface::library, &init_data->main_loop_callbacks); } if ((ModuleInitializationLevel)p_level == MODULE_INITIALIZATION_LEVEL_EDITOR) { - internal::gdextension_interface_editor_register_get_classes_used_callback(internal::library, &ClassDB::_editor_get_classes_used_callback); + ::godot::gdextension_interface::editor_register_get_classes_used_callback(::godot::gdextension_interface::library, &ClassDB::_editor_get_classes_used_callback); - const internal::DocData &doc_data = internal::get_doc_data(); + const ::godot::internal::DocData &doc_data = ::godot::internal::get_doc_data(); if (doc_data.is_valid()) { doc_data.load_data(); } @@ -618,7 +294,7 @@ GDExtensionBool GDExtensionBinding::InitObject::init() const { return GDExtensionBinding::init(get_proc_address, library, init_data, initialization); } -void internal::DocData::load_data() const { +void ::godot::internal::DocData::load_data() const { PackedByteArray compressed; compressed.resize(compressed_size); memcpy(compressed.ptrw(), data, compressed_size); @@ -626,7 +302,7 @@ void internal::DocData::load_data() const { // FileAccess::COMPRESSION_DEFLATE = 1 PackedByteArray decompressed = compressed.decompress(uncompressed_size, 1); - internal::gdextension_interface_editor_help_load_xml_from_utf8_chars_and_len(reinterpret_cast(decompressed.ptr()), uncompressed_size); + ::godot::gdextension_interface::editor_help_load_xml_from_utf8_chars_and_len(reinterpret_cast(decompressed.ptr()), uncompressed_size); } } // namespace godot diff --git a/src/variant/callable_custom.cpp b/src/variant/callable_custom.cpp index ae8cc4856..2330af9e3 100644 --- a/src/variant/callable_custom.cpp +++ b/src/variant/callable_custom.cpp @@ -105,7 +105,7 @@ bool CallableCustom::is_valid() const { Callable::Callable(CallableCustom *p_callable_custom) { GDExtensionCallableCustomInfo2 info = {}; info.callable_userdata = p_callable_custom; - info.token = internal::token; + info.token = ::godot::gdextension_interface::token; info.object_id = p_callable_custom->get_object(); info.call_func = &callable_custom_call; info.is_valid_func = &callable_custom_is_valid; @@ -116,11 +116,11 @@ Callable::Callable(CallableCustom *p_callable_custom) { info.to_string_func = &callable_custom_to_string; info.get_argument_count_func = &custom_callable_get_argument_count_func; - ::godot::internal::gdextension_interface_callable_custom_create2(_native_ptr(), &info); + ::godot::gdextension_interface::callable_custom_create2(_native_ptr(), &info); } CallableCustom *Callable::get_custom() const { - CallableCustomBase *callable_custom = (CallableCustomBase *)::godot::internal::gdextension_interface_callable_custom_get_userdata(_native_ptr(), internal::token); + CallableCustomBase *callable_custom = (CallableCustomBase *)::godot::gdextension_interface::callable_custom_get_userdata(_native_ptr(), ::godot::gdextension_interface::token); return dynamic_cast(callable_custom); } diff --git a/src/variant/callable_method_pointer.cpp b/src/variant/callable_method_pointer.cpp index 23b7ef50c..606bdb88e 100644 --- a/src/variant/callable_method_pointer.cpp +++ b/src/variant/callable_method_pointer.cpp @@ -103,7 +103,7 @@ namespace internal { Callable create_callable_from_ccmp(CallableCustomMethodPointerBase *p_callable_method_pointer) { GDExtensionCallableCustomInfo2 info = {}; info.callable_userdata = p_callable_method_pointer; - info.token = internal::token; + info.token = ::godot::gdextension_interface::token; info.object_id = p_callable_method_pointer->get_object(); info.call_func = &custom_callable_mp_call; info.is_valid_func = &custom_callable_mp_is_valid; @@ -114,7 +114,7 @@ Callable create_callable_from_ccmp(CallableCustomMethodPointerBase *p_callable_m info.get_argument_count_func = &custom_callable_mp_get_argument_count_func; Callable callable; - ::godot::internal::gdextension_interface_callable_custom_create2(callable._native_ptr(), &info); + ::godot::gdextension_interface::callable_custom_create2(callable._native_ptr(), &info); return callable; } diff --git a/src/variant/char_string.cpp b/src/variant/char_string.cpp index 83a36c510..42fe0bab4 100644 --- a/src/variant/char_string.cpp +++ b/src/variant/char_string.cpp @@ -157,19 +157,19 @@ template class CharStringT; // It's easier to have them written in C++ directly than in a Python script that generates them. String::String(const char *from) { - internal::gdextension_interface_string_new_with_latin1_chars(_native_ptr(), from); + ::godot::gdextension_interface::string_new_with_latin1_chars(_native_ptr(), from); } String::String(const wchar_t *from) { - internal::gdextension_interface_string_new_with_wide_chars(_native_ptr(), from); + ::godot::gdextension_interface::string_new_with_wide_chars(_native_ptr(), from); } String::String(const char16_t *from) { - internal::gdextension_interface_string_new_with_utf16_chars(_native_ptr(), from); + ::godot::gdextension_interface::string_new_with_utf16_chars(_native_ptr(), from); } String::String(const char32_t *from) { - internal::gdextension_interface_string_new_with_utf32_chars(_native_ptr(), from); + ::godot::gdextension_interface::string_new_with_utf32_chars(_native_ptr(), from); } String String::utf8(const char *from, int64_t len) { @@ -179,7 +179,7 @@ String String::utf8(const char *from, int64_t len) { } Error String::parse_utf8(const char *from, int64_t len) { - return (Error)internal::gdextension_interface_string_new_with_utf8_chars_and_len2(_native_ptr(), from, len); + return (Error)::godot::gdextension_interface::string_new_with_utf8_chars_and_len2(_native_ptr(), from, len); } String String::utf16(const char16_t *from, int64_t len) { @@ -189,7 +189,7 @@ String String::utf16(const char16_t *from, int64_t len) { } Error String::parse_utf16(const char16_t *from, int64_t len, bool default_little_endian) { - return (Error)internal::gdextension_interface_string_new_with_utf16_chars_and_len2(_native_ptr(), from, len, default_little_endian); + return (Error)::godot::gdextension_interface::string_new_with_utf16_chars_and_len2(_native_ptr(), from, len, default_little_endian); } String String::num_real(double p_num, bool p_trailing) { @@ -230,11 +230,11 @@ String rtoss(double p_val) { } CharString String::utf8() const { - int64_t length = internal::gdextension_interface_string_to_utf8_chars(_native_ptr(), nullptr, 0); + int64_t length = ::godot::gdextension_interface::string_to_utf8_chars(_native_ptr(), nullptr, 0); int64_t size = length + 1; CharString str; str.resize(size); - internal::gdextension_interface_string_to_utf8_chars(_native_ptr(), str.ptrw(), length); + ::godot::gdextension_interface::string_to_utf8_chars(_native_ptr(), str.ptrw(), length); str[length] = '\0'; @@ -242,11 +242,11 @@ CharString String::utf8() const { } CharString String::ascii() const { - int64_t length = internal::gdextension_interface_string_to_latin1_chars(_native_ptr(), nullptr, 0); + int64_t length = ::godot::gdextension_interface::string_to_latin1_chars(_native_ptr(), nullptr, 0); int64_t size = length + 1; CharString str; str.resize(size); - internal::gdextension_interface_string_to_latin1_chars(_native_ptr(), str.ptrw(), length); + ::godot::gdextension_interface::string_to_latin1_chars(_native_ptr(), str.ptrw(), length); str[length] = '\0'; @@ -254,11 +254,11 @@ CharString String::ascii() const { } Char16String String::utf16() const { - int64_t length = internal::gdextension_interface_string_to_utf16_chars(_native_ptr(), nullptr, 0); + int64_t length = ::godot::gdextension_interface::string_to_utf16_chars(_native_ptr(), nullptr, 0); int64_t size = length + 1; Char16String str; str.resize(size); - internal::gdextension_interface_string_to_utf16_chars(_native_ptr(), str.ptrw(), length); + ::godot::gdextension_interface::string_to_utf16_chars(_native_ptr(), str.ptrw(), length); str[length] = '\0'; @@ -266,11 +266,11 @@ Char16String String::utf16() const { } Char32String String::utf32() const { - int64_t length = internal::gdextension_interface_string_to_utf32_chars(_native_ptr(), nullptr, 0); + int64_t length = ::godot::gdextension_interface::string_to_utf32_chars(_native_ptr(), nullptr, 0); int64_t size = length + 1; Char32String str; str.resize(size); - internal::gdextension_interface_string_to_utf32_chars(_native_ptr(), str.ptrw(), length); + ::godot::gdextension_interface::string_to_utf32_chars(_native_ptr(), str.ptrw(), length); str[length] = '\0'; @@ -278,11 +278,11 @@ Char32String String::utf32() const { } CharWideString String::wide_string() const { - int64_t length = internal::gdextension_interface_string_to_wide_chars(_native_ptr(), nullptr, 0); + int64_t length = ::godot::gdextension_interface::string_to_wide_chars(_native_ptr(), nullptr, 0); int64_t size = length + 1; CharWideString str; str.resize(size); - internal::gdextension_interface_string_to_wide_chars(_native_ptr(), str.ptrw(), length); + ::godot::gdextension_interface::string_to_wide_chars(_native_ptr(), str.ptrw(), length); str[length] = '\0'; @@ -290,7 +290,7 @@ CharWideString String::wide_string() const { } Error String::resize(int64_t p_size) { - return (Error)internal::gdextension_interface_string_resize(_native_ptr(), p_size); + return (Error)::godot::gdextension_interface::string_resize(_native_ptr(), p_size); } String &String::operator=(const char *p_str) { @@ -366,44 +366,44 @@ String String::operator+(const char32_t p_char) { } String &String::operator+=(const String &p_str) { - internal::gdextension_interface_string_operator_plus_eq_string((GDExtensionStringPtr)this, (GDExtensionConstStringPtr)&p_str); + ::godot::gdextension_interface::string_operator_plus_eq_string((GDExtensionStringPtr)this, (GDExtensionConstStringPtr)&p_str); return *this; } String &String::operator+=(char32_t p_char) { - internal::gdextension_interface_string_operator_plus_eq_char((GDExtensionStringPtr)this, p_char); + ::godot::gdextension_interface::string_operator_plus_eq_char((GDExtensionStringPtr)this, p_char); return *this; } String &String::operator+=(const char *p_str) { - internal::gdextension_interface_string_operator_plus_eq_cstr((GDExtensionStringPtr)this, p_str); + ::godot::gdextension_interface::string_operator_plus_eq_cstr((GDExtensionStringPtr)this, p_str); return *this; } String &String::operator+=(const wchar_t *p_str) { - internal::gdextension_interface_string_operator_plus_eq_wcstr((GDExtensionStringPtr)this, p_str); + ::godot::gdextension_interface::string_operator_plus_eq_wcstr((GDExtensionStringPtr)this, p_str); return *this; } String &String::operator+=(const char32_t *p_str) { - internal::gdextension_interface_string_operator_plus_eq_c32str((GDExtensionStringPtr)this, p_str); + ::godot::gdextension_interface::string_operator_plus_eq_c32str((GDExtensionStringPtr)this, p_str); return *this; } const char32_t &String::operator[](int64_t p_index) const { - return *internal::gdextension_interface_string_operator_index_const((GDExtensionStringPtr)this, p_index); + return *::godot::gdextension_interface::string_operator_index_const((GDExtensionStringPtr)this, p_index); } char32_t &String::operator[](int64_t p_index) { - return *internal::gdextension_interface_string_operator_index((GDExtensionStringPtr)this, p_index); + return *::godot::gdextension_interface::string_operator_index((GDExtensionStringPtr)this, p_index); } const char32_t *String::ptr() const { - return internal::gdextension_interface_string_operator_index_const((GDExtensionStringPtr)this, 0); + return ::godot::gdextension_interface::string_operator_index_const((GDExtensionStringPtr)this, 0); } char32_t *String::ptrw() { - return internal::gdextension_interface_string_operator_index((GDExtensionStringPtr)this, 0); + return ::godot::gdextension_interface::string_operator_index((GDExtensionStringPtr)this, 0); } bool operator==(const char *p_chr, const String &p_str) { @@ -459,7 +459,7 @@ String operator+(char32_t p_char, const String &p_str) { } StringName::StringName(const char *from, bool p_static) { - internal::gdextension_interface_string_name_new_with_latin1_chars(&opaque, from, p_static); + ::godot::gdextension_interface::string_name_new_with_latin1_chars(&opaque, from, p_static); } StringName::StringName(const wchar_t *from) : diff --git a/src/variant/packed_arrays.cpp b/src/variant/packed_arrays.cpp index 76fd90cd9..ab057b98f 100644 --- a/src/variant/packed_arrays.cpp +++ b/src/variant/packed_arrays.cpp @@ -48,211 +48,211 @@ namespace godot { const uint8_t &PackedByteArray::operator[](int64_t p_index) const { - return *internal::gdextension_interface_packed_byte_array_operator_index_const((GDExtensionTypePtr *)this, p_index); + return *::godot::gdextension_interface::packed_byte_array_operator_index_const((GDExtensionTypePtr *)this, p_index); } uint8_t &PackedByteArray::operator[](int64_t p_index) { - return *internal::gdextension_interface_packed_byte_array_operator_index((GDExtensionTypePtr *)this, p_index); + return *::godot::gdextension_interface::packed_byte_array_operator_index((GDExtensionTypePtr *)this, p_index); } const uint8_t *PackedByteArray::ptr() const { - return internal::gdextension_interface_packed_byte_array_operator_index_const((GDExtensionTypePtr *)this, 0); + return ::godot::gdextension_interface::packed_byte_array_operator_index_const((GDExtensionTypePtr *)this, 0); } uint8_t *PackedByteArray::ptrw() { - return internal::gdextension_interface_packed_byte_array_operator_index((GDExtensionTypePtr *)this, 0); + return ::godot::gdextension_interface::packed_byte_array_operator_index((GDExtensionTypePtr *)this, 0); } const Color &PackedColorArray::operator[](int64_t p_index) const { - const Color *color = (const Color *)internal::gdextension_interface_packed_color_array_operator_index_const((GDExtensionTypePtr *)this, p_index); + const Color *color = (const Color *)::godot::gdextension_interface::packed_color_array_operator_index_const((GDExtensionTypePtr *)this, p_index); return *color; } Color &PackedColorArray::operator[](int64_t p_index) { - Color *color = (Color *)internal::gdextension_interface_packed_color_array_operator_index((GDExtensionTypePtr *)this, p_index); + Color *color = (Color *)::godot::gdextension_interface::packed_color_array_operator_index((GDExtensionTypePtr *)this, p_index); return *color; } const Color *PackedColorArray::ptr() const { - return (const Color *)internal::gdextension_interface_packed_color_array_operator_index_const((GDExtensionTypePtr *)this, 0); + return (const Color *)::godot::gdextension_interface::packed_color_array_operator_index_const((GDExtensionTypePtr *)this, 0); } Color *PackedColorArray::ptrw() { - return (Color *)internal::gdextension_interface_packed_color_array_operator_index((GDExtensionTypePtr *)this, 0); + return (Color *)::godot::gdextension_interface::packed_color_array_operator_index((GDExtensionTypePtr *)this, 0); } const float &PackedFloat32Array::operator[](int64_t p_index) const { - return *internal::gdextension_interface_packed_float32_array_operator_index_const((GDExtensionTypePtr *)this, p_index); + return *::godot::gdextension_interface::packed_float32_array_operator_index_const((GDExtensionTypePtr *)this, p_index); } float &PackedFloat32Array::operator[](int64_t p_index) { - return *internal::gdextension_interface_packed_float32_array_operator_index((GDExtensionTypePtr *)this, p_index); + return *::godot::gdextension_interface::packed_float32_array_operator_index((GDExtensionTypePtr *)this, p_index); } const float *PackedFloat32Array::ptr() const { - return internal::gdextension_interface_packed_float32_array_operator_index_const((GDExtensionTypePtr *)this, 0); + return ::godot::gdextension_interface::packed_float32_array_operator_index_const((GDExtensionTypePtr *)this, 0); } float *PackedFloat32Array::ptrw() { - return internal::gdextension_interface_packed_float32_array_operator_index((GDExtensionTypePtr *)this, 0); + return ::godot::gdextension_interface::packed_float32_array_operator_index((GDExtensionTypePtr *)this, 0); } const double &PackedFloat64Array::operator[](int64_t p_index) const { - return *internal::gdextension_interface_packed_float64_array_operator_index_const((GDExtensionTypePtr *)this, p_index); + return *::godot::gdextension_interface::packed_float64_array_operator_index_const((GDExtensionTypePtr *)this, p_index); } double &PackedFloat64Array::operator[](int64_t p_index) { - return *internal::gdextension_interface_packed_float64_array_operator_index((GDExtensionTypePtr *)this, p_index); + return *::godot::gdextension_interface::packed_float64_array_operator_index((GDExtensionTypePtr *)this, p_index); } const double *PackedFloat64Array::ptr() const { - return internal::gdextension_interface_packed_float64_array_operator_index_const((GDExtensionTypePtr *)this, 0); + return ::godot::gdextension_interface::packed_float64_array_operator_index_const((GDExtensionTypePtr *)this, 0); } double *PackedFloat64Array::ptrw() { - return internal::gdextension_interface_packed_float64_array_operator_index((GDExtensionTypePtr *)this, 0); + return ::godot::gdextension_interface::packed_float64_array_operator_index((GDExtensionTypePtr *)this, 0); } const int32_t &PackedInt32Array::operator[](int64_t p_index) const { - return *internal::gdextension_interface_packed_int32_array_operator_index_const((GDExtensionTypePtr *)this, p_index); + return *::godot::gdextension_interface::packed_int32_array_operator_index_const((GDExtensionTypePtr *)this, p_index); } int32_t &PackedInt32Array::operator[](int64_t p_index) { - return *internal::gdextension_interface_packed_int32_array_operator_index((GDExtensionTypePtr *)this, p_index); + return *::godot::gdextension_interface::packed_int32_array_operator_index((GDExtensionTypePtr *)this, p_index); } const int32_t *PackedInt32Array::ptr() const { - return internal::gdextension_interface_packed_int32_array_operator_index_const((GDExtensionTypePtr *)this, 0); + return ::godot::gdextension_interface::packed_int32_array_operator_index_const((GDExtensionTypePtr *)this, 0); } int32_t *PackedInt32Array::ptrw() { - return internal::gdextension_interface_packed_int32_array_operator_index((GDExtensionTypePtr *)this, 0); + return ::godot::gdextension_interface::packed_int32_array_operator_index((GDExtensionTypePtr *)this, 0); } const int64_t &PackedInt64Array::operator[](int64_t p_index) const { - return *internal::gdextension_interface_packed_int64_array_operator_index_const((GDExtensionTypePtr *)this, p_index); + return *::godot::gdextension_interface::packed_int64_array_operator_index_const((GDExtensionTypePtr *)this, p_index); } int64_t &PackedInt64Array::operator[](int64_t p_index) { - return *internal::gdextension_interface_packed_int64_array_operator_index((GDExtensionTypePtr *)this, p_index); + return *::godot::gdextension_interface::packed_int64_array_operator_index((GDExtensionTypePtr *)this, p_index); } const int64_t *PackedInt64Array::ptr() const { - return internal::gdextension_interface_packed_int64_array_operator_index_const((GDExtensionTypePtr *)this, 0); + return ::godot::gdextension_interface::packed_int64_array_operator_index_const((GDExtensionTypePtr *)this, 0); } int64_t *PackedInt64Array::ptrw() { - return internal::gdextension_interface_packed_int64_array_operator_index((GDExtensionTypePtr *)this, 0); + return ::godot::gdextension_interface::packed_int64_array_operator_index((GDExtensionTypePtr *)this, 0); } const String &PackedStringArray::operator[](int64_t p_index) const { - const String *string = (const String *)internal::gdextension_interface_packed_string_array_operator_index_const((GDExtensionTypePtr *)this, p_index); + const String *string = (const String *)::godot::gdextension_interface::packed_string_array_operator_index_const((GDExtensionTypePtr *)this, p_index); return *string; } String &PackedStringArray::operator[](int64_t p_index) { - String *string = (String *)internal::gdextension_interface_packed_string_array_operator_index((GDExtensionTypePtr *)this, p_index); + String *string = (String *)::godot::gdextension_interface::packed_string_array_operator_index((GDExtensionTypePtr *)this, p_index); return *string; } const String *PackedStringArray::ptr() const { - return (const String *)internal::gdextension_interface_packed_string_array_operator_index_const((GDExtensionTypePtr *)this, 0); + return (const String *)::godot::gdextension_interface::packed_string_array_operator_index_const((GDExtensionTypePtr *)this, 0); } String *PackedStringArray::ptrw() { - return (String *)internal::gdextension_interface_packed_string_array_operator_index((GDExtensionTypePtr *)this, 0); + return (String *)::godot::gdextension_interface::packed_string_array_operator_index((GDExtensionTypePtr *)this, 0); } const Vector2 &PackedVector2Array::operator[](int64_t p_index) const { - const Vector2 *vec = (const Vector2 *)internal::gdextension_interface_packed_vector2_array_operator_index_const((GDExtensionTypePtr *)this, p_index); + const Vector2 *vec = (const Vector2 *)::godot::gdextension_interface::packed_vector2_array_operator_index_const((GDExtensionTypePtr *)this, p_index); return *vec; } Vector2 &PackedVector2Array::operator[](int64_t p_index) { - Vector2 *vec = (Vector2 *)internal::gdextension_interface_packed_vector2_array_operator_index((GDExtensionTypePtr *)this, p_index); + Vector2 *vec = (Vector2 *)::godot::gdextension_interface::packed_vector2_array_operator_index((GDExtensionTypePtr *)this, p_index); return *vec; } const Vector2 *PackedVector2Array::ptr() const { - return (const Vector2 *)internal::gdextension_interface_packed_vector2_array_operator_index_const((GDExtensionTypePtr *)this, 0); + return (const Vector2 *)::godot::gdextension_interface::packed_vector2_array_operator_index_const((GDExtensionTypePtr *)this, 0); } Vector2 *PackedVector2Array::ptrw() { - return (Vector2 *)internal::gdextension_interface_packed_vector2_array_operator_index((GDExtensionTypePtr *)this, 0); + return (Vector2 *)::godot::gdextension_interface::packed_vector2_array_operator_index((GDExtensionTypePtr *)this, 0); } const Vector3 &PackedVector3Array::operator[](int64_t p_index) const { - const Vector3 *vec = (const Vector3 *)internal::gdextension_interface_packed_vector3_array_operator_index_const((GDExtensionTypePtr *)this, p_index); + const Vector3 *vec = (const Vector3 *)::godot::gdextension_interface::packed_vector3_array_operator_index_const((GDExtensionTypePtr *)this, p_index); return *vec; } Vector3 &PackedVector3Array::operator[](int64_t p_index) { - Vector3 *vec = (Vector3 *)internal::gdextension_interface_packed_vector3_array_operator_index((GDExtensionTypePtr *)this, p_index); + Vector3 *vec = (Vector3 *)::godot::gdextension_interface::packed_vector3_array_operator_index((GDExtensionTypePtr *)this, p_index); return *vec; } const Vector3 *PackedVector3Array::ptr() const { - return (const Vector3 *)internal::gdextension_interface_packed_vector3_array_operator_index_const((GDExtensionTypePtr *)this, 0); + return (const Vector3 *)::godot::gdextension_interface::packed_vector3_array_operator_index_const((GDExtensionTypePtr *)this, 0); } Vector3 *PackedVector3Array::ptrw() { - return (Vector3 *)internal::gdextension_interface_packed_vector3_array_operator_index((GDExtensionTypePtr *)this, 0); + return (Vector3 *)::godot::gdextension_interface::packed_vector3_array_operator_index((GDExtensionTypePtr *)this, 0); } const Vector4 &PackedVector4Array::operator[](int64_t p_index) const { - const Vector4 *vec = (const Vector4 *)internal::gdextension_interface_packed_vector4_array_operator_index_const((GDExtensionTypePtr *)this, p_index); + const Vector4 *vec = (const Vector4 *)::godot::gdextension_interface::packed_vector4_array_operator_index_const((GDExtensionTypePtr *)this, p_index); return *vec; } Vector4 &PackedVector4Array::operator[](int64_t p_index) { - Vector4 *vec = (Vector4 *)internal::gdextension_interface_packed_vector4_array_operator_index((GDExtensionTypePtr *)this, p_index); + Vector4 *vec = (Vector4 *)::godot::gdextension_interface::packed_vector4_array_operator_index((GDExtensionTypePtr *)this, p_index); return *vec; } const Vector4 *PackedVector4Array::ptr() const { - return (const Vector4 *)internal::gdextension_interface_packed_vector4_array_operator_index_const((GDExtensionTypePtr *)this, 0); + return (const Vector4 *)::godot::gdextension_interface::packed_vector4_array_operator_index_const((GDExtensionTypePtr *)this, 0); } Vector4 *PackedVector4Array::ptrw() { - return (Vector4 *)internal::gdextension_interface_packed_vector4_array_operator_index((GDExtensionTypePtr *)this, 0); + return (Vector4 *)::godot::gdextension_interface::packed_vector4_array_operator_index((GDExtensionTypePtr *)this, 0); } const Variant &Array::operator[](int64_t p_index) const { - const Variant *var = (const Variant *)internal::gdextension_interface_array_operator_index_const((GDExtensionTypePtr *)this, p_index); + const Variant *var = (const Variant *)::godot::gdextension_interface::array_operator_index_const((GDExtensionTypePtr *)this, p_index); return *var; } Variant &Array::operator[](int64_t p_index) { - Variant *var = (Variant *)internal::gdextension_interface_array_operator_index((GDExtensionTypePtr *)this, p_index); + Variant *var = (Variant *)::godot::gdextension_interface::array_operator_index((GDExtensionTypePtr *)this, p_index); return *var; } void Array::set_typed(uint32_t p_type, const StringName &p_class_name, const Variant &p_script) { // p_type is not Variant::Type so that header doesn't depend on . - internal::gdextension_interface_array_set_typed((GDExtensionTypePtr *)this, (GDExtensionVariantType)p_type, (GDExtensionConstStringNamePtr)&p_class_name, (GDExtensionConstVariantPtr)&p_script); + ::godot::gdextension_interface::array_set_typed((GDExtensionTypePtr *)this, (GDExtensionVariantType)p_type, (GDExtensionConstStringNamePtr)&p_class_name, (GDExtensionConstVariantPtr)&p_script); } const Variant *Array::ptr() const { - return (const Variant *)internal::gdextension_interface_array_operator_index_const((GDExtensionTypePtr *)this, 0); + return (const Variant *)::godot::gdextension_interface::array_operator_index_const((GDExtensionTypePtr *)this, 0); } Variant *Array::ptrw() { - return (Variant *)internal::gdextension_interface_array_operator_index((GDExtensionTypePtr *)this, 0); + return (Variant *)::godot::gdextension_interface::array_operator_index((GDExtensionTypePtr *)this, 0); } const Variant &Dictionary::operator[](const Variant &p_key) const { - const Variant *var = (const Variant *)internal::gdextension_interface_dictionary_operator_index_const((GDExtensionTypePtr *)this, (GDExtensionVariantPtr)&p_key); + const Variant *var = (const Variant *)::godot::gdextension_interface::dictionary_operator_index_const((GDExtensionTypePtr *)this, (GDExtensionVariantPtr)&p_key); return *var; } Variant &Dictionary::operator[](const Variant &p_key) { - Variant *var = (Variant *)internal::gdextension_interface_dictionary_operator_index((GDExtensionTypePtr *)this, (GDExtensionVariantPtr)&p_key); + Variant *var = (Variant *)::godot::gdextension_interface::dictionary_operator_index((GDExtensionTypePtr *)this, (GDExtensionVariantPtr)&p_key); return *var; } void Dictionary::set_typed(uint32_t p_key_type, const StringName &p_key_class_name, const Variant &p_key_script, uint32_t p_value_type, const StringName &p_value_class_name, const Variant &p_value_script) { // p_key_type/p_value_type are not Variant::Type so that header doesn't depend on . - internal::gdextension_interface_dictionary_set_typed((GDExtensionTypePtr *)this, (GDExtensionVariantType)p_key_type, (GDExtensionConstStringNamePtr)&p_key_class_name, (GDExtensionConstVariantPtr)&p_key_script, + ::godot::gdextension_interface::dictionary_set_typed((GDExtensionTypePtr *)this, (GDExtensionVariantType)p_key_type, (GDExtensionConstStringNamePtr)&p_key_class_name, (GDExtensionConstVariantPtr)&p_key_script, (GDExtensionVariantType)p_value_type, (GDExtensionConstStringNamePtr)&p_value_class_name, (GDExtensionConstVariantPtr)&p_value_script); } diff --git a/src/variant/variant.cpp b/src/variant/variant.cpp index cf8323abb..1da1baaaa 100644 --- a/src/variant/variant.cpp +++ b/src/variant/variant.cpp @@ -47,8 +47,8 @@ GDExtensionTypeFromVariantConstructorFunc Variant::to_type_constructor[Variant:: void Variant::init_bindings() { // Start from 1 to skip NIL. for (int i = 1; i < VARIANT_MAX; i++) { - from_type_constructor[i] = internal::gdextension_interface_get_variant_from_type_constructor((GDExtensionVariantType)i); - to_type_constructor[i] = internal::gdextension_interface_get_variant_to_type_constructor((GDExtensionVariantType)i); + from_type_constructor[i] = ::godot::gdextension_interface::get_variant_from_type_constructor((GDExtensionVariantType)i); + to_type_constructor[i] = ::godot::gdextension_interface::get_variant_to_type_constructor((GDExtensionVariantType)i); } VariantInternal::init_bindings(); @@ -73,15 +73,15 @@ void Variant::init_bindings() { } Variant::Variant() { - internal::gdextension_interface_variant_new_nil(_native_ptr()); + ::godot::gdextension_interface::variant_new_nil(_native_ptr()); } Variant::Variant(GDExtensionConstVariantPtr native_ptr) { - internal::gdextension_interface_variant_new_copy(_native_ptr(), native_ptr); + ::godot::gdextension_interface::variant_new_copy(_native_ptr(), native_ptr); } Variant::Variant(const Variant &other) { - internal::gdextension_interface_variant_new_copy(_native_ptr(), other._native_ptr()); + ::godot::gdextension_interface::variant_new_copy(_native_ptr(), other._native_ptr()); } Variant::Variant(Variant &&other) { @@ -256,7 +256,7 @@ Variant::Variant(const PackedVector4Array &v) { } Variant::~Variant() { - internal::gdextension_interface_variant_destroy(_native_ptr()); + ::godot::gdextension_interface::variant_destroy(_native_ptr()); } Variant::operator bool() const { @@ -443,14 +443,14 @@ Variant::operator Object *() const { if (obj == nullptr) { return nullptr; } - return internal::get_object_instance_binding(obj); + return ::godot::internal::get_object_instance_binding(obj); } Variant::operator ObjectID() const { if (get_type() == Type::INT) { return ObjectID(operator uint64_t()); } else if (get_type() == Type::OBJECT) { - return ObjectID(internal::gdextension_interface_variant_get_object_instance_id(_native_ptr())); + return ObjectID(::godot::gdextension_interface::variant_get_object_instance_id(_native_ptr())); } else { return ObjectID(); } @@ -518,7 +518,7 @@ Object *Variant::get_validated_object() const { Variant &Variant::operator=(const Variant &other) { clear(); - internal::gdextension_interface_variant_new_copy(_native_ptr(), other._native_ptr()); + ::godot::gdextension_interface::variant_new_copy(_native_ptr(), other._native_ptr()); return *this; } @@ -558,22 +558,22 @@ bool Variant::operator<(const Variant &other) const { } void Variant::callp(const StringName &method, const Variant **args, int argcount, Variant &r_ret, GDExtensionCallError &r_error) { - internal::gdextension_interface_variant_call(_native_ptr(), method._native_ptr(), reinterpret_cast(args), argcount, r_ret._native_ptr(), &r_error); + ::godot::gdextension_interface::variant_call(_native_ptr(), method._native_ptr(), reinterpret_cast(args), argcount, r_ret._native_ptr(), &r_error); } void Variant::callp_static(Variant::Type type, const StringName &method, const Variant **args, int argcount, Variant &r_ret, GDExtensionCallError &r_error) { - internal::gdextension_interface_variant_call_static(static_cast(type), method._native_ptr(), reinterpret_cast(args), argcount, r_ret._native_ptr(), &r_error); + ::godot::gdextension_interface::variant_call_static(static_cast(type), method._native_ptr(), reinterpret_cast(args), argcount, r_ret._native_ptr(), &r_error); } void Variant::evaluate(const Operator &op, const Variant &a, const Variant &b, Variant &r_ret, bool &r_valid) { GDExtensionBool valid; - internal::gdextension_interface_variant_evaluate(static_cast(op), a._native_ptr(), b._native_ptr(), r_ret._native_ptr(), &valid); + ::godot::gdextension_interface::variant_evaluate(static_cast(op), a._native_ptr(), b._native_ptr(), r_ret._native_ptr(), &valid); r_valid = PtrToArg::convert(&valid); } void Variant::set(const Variant &key, const Variant &value, bool *r_valid) { GDExtensionBool valid; - internal::gdextension_interface_variant_set(_native_ptr(), key._native_ptr(), value._native_ptr(), &valid); + ::godot::gdextension_interface::variant_set(_native_ptr(), key._native_ptr(), value._native_ptr(), &valid); if (r_valid) { *r_valid = PtrToArg::convert(&valid); } @@ -581,27 +581,27 @@ void Variant::set(const Variant &key, const Variant &value, bool *r_valid) { void Variant::set_named(const StringName &name, const Variant &value, bool &r_valid) { GDExtensionBool valid; - internal::gdextension_interface_variant_set_named(_native_ptr(), name._native_ptr(), value._native_ptr(), &valid); + ::godot::gdextension_interface::variant_set_named(_native_ptr(), name._native_ptr(), value._native_ptr(), &valid); r_valid = PtrToArg::convert(&valid); } void Variant::set_indexed(int64_t index, const Variant &value, bool &r_valid, bool &r_oob) { GDExtensionBool valid, oob; - internal::gdextension_interface_variant_set_indexed(_native_ptr(), index, value._native_ptr(), &valid, &oob); + ::godot::gdextension_interface::variant_set_indexed(_native_ptr(), index, value._native_ptr(), &valid, &oob); r_valid = PtrToArg::convert(&valid); r_oob = PtrToArg::convert(&oob); } void Variant::set_keyed(const Variant &key, const Variant &value, bool &r_valid) { GDExtensionBool valid; - internal::gdextension_interface_variant_set_keyed(_native_ptr(), key._native_ptr(), value._native_ptr(), &valid); + ::godot::gdextension_interface::variant_set_keyed(_native_ptr(), key._native_ptr(), value._native_ptr(), &valid); r_valid = PtrToArg::convert(&valid); } Variant Variant::get(const Variant &key, bool *r_valid) const { Variant result; GDExtensionBool valid; - internal::gdextension_interface_variant_get(_native_ptr(), key._native_ptr(), result._native_ptr(), &valid); + ::godot::gdextension_interface::variant_get(_native_ptr(), key._native_ptr(), result._native_ptr(), &valid); if (r_valid) { *r_valid = PtrToArg::convert(&valid); } @@ -611,7 +611,7 @@ Variant Variant::get(const Variant &key, bool *r_valid) const { Variant Variant::get_named(const StringName &name, bool &r_valid) const { Variant result; GDExtensionBool valid; - internal::gdextension_interface_variant_get_named(_native_ptr(), name._native_ptr(), result._native_ptr(), &valid); + ::godot::gdextension_interface::variant_get_named(_native_ptr(), name._native_ptr(), result._native_ptr(), &valid); r_valid = PtrToArg::convert(&valid); return result; } @@ -620,7 +620,7 @@ Variant Variant::get_indexed(int64_t index, bool &r_valid, bool &r_oob) const { Variant result; GDExtensionBool valid; GDExtensionBool oob; - internal::gdextension_interface_variant_get_indexed(_native_ptr(), index, result._native_ptr(), &valid, &oob); + ::godot::gdextension_interface::variant_get_indexed(_native_ptr(), index, result._native_ptr(), &valid, &oob); r_valid = PtrToArg::convert(&valid); r_oob = PtrToArg::convert(&oob); return result; @@ -629,7 +629,7 @@ Variant Variant::get_indexed(int64_t index, bool &r_valid, bool &r_oob) const { Variant Variant::get_keyed(const Variant &key, bool &r_valid) const { Variant result; GDExtensionBool valid; - internal::gdextension_interface_variant_get_keyed(_native_ptr(), key._native_ptr(), result._native_ptr(), &valid); + ::godot::gdextension_interface::variant_get_keyed(_native_ptr(), key._native_ptr(), result._native_ptr(), &valid); r_valid = PtrToArg::convert(&valid); return result; } @@ -646,14 +646,14 @@ bool Variant::in(const Variant &index, bool *r_valid) const { bool Variant::iter_init(Variant &r_iter, bool &r_valid) const { GDExtensionBool valid; - GDExtensionBool result = internal::gdextension_interface_variant_iter_init(_native_ptr(), r_iter._native_ptr(), &valid); + GDExtensionBool result = ::godot::gdextension_interface::variant_iter_init(_native_ptr(), r_iter._native_ptr(), &valid); r_valid = PtrToArg::convert(&valid); return PtrToArg::convert(&result); } bool Variant::iter_next(Variant &r_iter, bool &r_valid) const { GDExtensionBool valid; - GDExtensionBool result = internal::gdextension_interface_variant_iter_next(_native_ptr(), r_iter._native_ptr(), &valid); + GDExtensionBool result = ::godot::gdextension_interface::variant_iter_next(_native_ptr(), r_iter._native_ptr(), &valid); r_valid = PtrToArg::convert(&valid); return PtrToArg::convert(&result); } @@ -661,23 +661,23 @@ bool Variant::iter_next(Variant &r_iter, bool &r_valid) const { Variant Variant::iter_get(const Variant &r_iter, bool &r_valid) const { Variant result; GDExtensionBool valid; - internal::gdextension_interface_variant_iter_get(_native_ptr(), r_iter._native_ptr(), result._native_ptr(), &valid); + ::godot::gdextension_interface::variant_iter_get(_native_ptr(), r_iter._native_ptr(), result._native_ptr(), &valid); r_valid = PtrToArg::convert(&valid); return result; } Variant::Type Variant::get_type() const { - return static_cast(internal::gdextension_interface_variant_get_type(_native_ptr())); + return static_cast(::godot::gdextension_interface::variant_get_type(_native_ptr())); } bool Variant::has_method(const StringName &method) const { - GDExtensionBool has = internal::gdextension_interface_variant_has_method(_native_ptr(), method._native_ptr()); + GDExtensionBool has = ::godot::gdextension_interface::variant_has_method(_native_ptr(), method._native_ptr()); return PtrToArg::convert(&has); } bool Variant::has_key(const Variant &key, bool *r_valid) const { GDExtensionBool valid; - GDExtensionBool has = internal::gdextension_interface_variant_has_key(_native_ptr(), key._native_ptr(), &valid); + GDExtensionBool has = ::godot::gdextension_interface::variant_has_key(_native_ptr(), key._native_ptr(), &valid); if (r_valid) { *r_valid = PtrToArg::convert(&valid); } @@ -685,33 +685,33 @@ bool Variant::has_key(const Variant &key, bool *r_valid) const { } bool Variant::has_member(Variant::Type type, const StringName &member) { - GDExtensionBool has = internal::gdextension_interface_variant_has_member(static_cast(type), member._native_ptr()); + GDExtensionBool has = ::godot::gdextension_interface::variant_has_member(static_cast(type), member._native_ptr()); return PtrToArg::convert(&has); } uint32_t Variant::hash() const { - GDExtensionInt hash = internal::gdextension_interface_variant_hash(_native_ptr()); + GDExtensionInt hash = ::godot::gdextension_interface::variant_hash(_native_ptr()); return PtrToArg::convert(&hash); } uint32_t Variant::recursive_hash(int recursion_count) const { - GDExtensionInt hash = internal::gdextension_interface_variant_recursive_hash(_native_ptr(), recursion_count); + GDExtensionInt hash = ::godot::gdextension_interface::variant_recursive_hash(_native_ptr(), recursion_count); return PtrToArg::convert(&hash); } bool Variant::hash_compare(const Variant &variant) const { - GDExtensionBool compare = internal::gdextension_interface_variant_hash_compare(_native_ptr(), variant._native_ptr()); + GDExtensionBool compare = ::godot::gdextension_interface::variant_hash_compare(_native_ptr(), variant._native_ptr()); return PtrToArg::convert(&compare); } bool Variant::booleanize() const { - GDExtensionBool booleanized = internal::gdextension_interface_variant_booleanize(_native_ptr()); + GDExtensionBool booleanized = ::godot::gdextension_interface::variant_booleanize(_native_ptr()); return PtrToArg::convert(&booleanized); } String Variant::stringify() const { String result; - internal::gdextension_interface_variant_stringify(_native_ptr(), result._native_ptr()); + ::godot::gdextension_interface::variant_stringify(_native_ptr(), result._native_ptr()); return result; } @@ -719,23 +719,23 @@ Variant Variant::duplicate(bool deep) const { Variant result; GDExtensionBool _deep; PtrToArg::encode(deep, &_deep); - internal::gdextension_interface_variant_duplicate(_native_ptr(), result._native_ptr(), _deep); + ::godot::gdextension_interface::variant_duplicate(_native_ptr(), result._native_ptr(), _deep); return result; } String Variant::get_type_name(Variant::Type type) { String result; - internal::gdextension_interface_variant_get_type_name(static_cast(type), result._native_ptr()); + ::godot::gdextension_interface::variant_get_type_name(static_cast(type), result._native_ptr()); return result; } bool Variant::can_convert(Variant::Type from, Variant::Type to) { - GDExtensionBool can = internal::gdextension_interface_variant_can_convert(static_cast(from), static_cast(to)); + GDExtensionBool can = ::godot::gdextension_interface::variant_can_convert(static_cast(from), static_cast(to)); return PtrToArg::convert(&can); } bool Variant::can_convert_strict(Variant::Type from, Variant::Type to) { - GDExtensionBool can = internal::gdextension_interface_variant_can_convert_strict(static_cast(from), static_cast(to)); + GDExtensionBool can = ::godot::gdextension_interface::variant_can_convert_strict(static_cast(from), static_cast(to)); return PtrToArg::convert(&can); } @@ -786,9 +786,9 @@ void Variant::clear() { }; if (unlikely(needs_deinit[get_type()])) { // Make it fast for types that don't need deinit. - internal::gdextension_interface_variant_destroy(_native_ptr()); + ::godot::gdextension_interface::variant_destroy(_native_ptr()); } - internal::gdextension_interface_variant_new_nil(_native_ptr()); + ::godot::gdextension_interface::variant_new_nil(_native_ptr()); } } // namespace godot diff --git a/src/variant/variant_internal.cpp b/src/variant/variant_internal.cpp index fbfd1cfbb..632ae2aed 100644 --- a/src/variant/variant_internal.cpp +++ b/src/variant/variant_internal.cpp @@ -36,7 +36,7 @@ GDExtensionVariantGetInternalPtrFunc VariantInternal::get_internal_func[Variant: void VariantInternal::init_bindings() { for (int i = 1; i < Variant::VARIANT_MAX; i++) { - get_internal_func[i] = internal::gdextension_interface_variant_get_ptr_internal_getter((GDExtensionVariantType)i); + get_internal_func[i] = ::godot::gdextension_interface::variant_get_ptr_internal_getter((GDExtensionVariantType)i); } } diff --git a/test/src/example.cpp b/test/src/example.cpp index f32203c1f..90ae55854 100644 --- a/test/src/example.cpp +++ b/test/src/example.cpp @@ -306,7 +306,7 @@ void Example::_bind_methods() { } bool Example::has_object_instance_binding() const { - return internal::gdextension_interface_object_get_instance_binding(_owner, internal::token, nullptr); + return ::godot::gdextension_interface::object_get_instance_binding(_owner, ::godot::gdextension_interface::token, nullptr); } Example::Example() : @@ -748,7 +748,7 @@ String Example::test_use_engine_singleton() const { String Example::test_library_path() { String library_path; - internal::gdextension_interface_get_library_path(internal::library, library_path._native_ptr()); + ::godot::gdextension_interface::get_library_path(::godot::gdextension_interface::library, library_path._native_ptr()); return library_path; } diff --git a/tools/godotcpp.py b/tools/godotcpp.py index dd7b9eed8..9d296d885 100644 --- a/tools/godotcpp.py +++ b/tools/godotcpp.py @@ -149,6 +149,11 @@ def scons_emit_files(target, source, env): env.Depends(file, profile_filepath) files.append(file) env["godot_cpp_gen_dir"] = target[0].abspath + + # gdextension_interface.h shouldn't depend on extension_api.json or the build_profile.json. + gdextension_interface_header = os.path.join(str(target[0]), "gen", "include", "gdextension_interface.h") + env.Ignore(gdextension_interface_header, [source[0], profile_filepath]) + return files, source @@ -162,6 +167,7 @@ def scons_generate_bindings(target, source, env): _generate_bindings( api, str(source[0]), + str(source[1]), env["generate_template_get_node"], "32" if "32" in env["arch"] else "64", env["precision"], @@ -376,6 +382,7 @@ def options(opts, env): ) ) opts.Add(BoolVariable("debug_symbols", "Build with debugging symbols", True)) + opts.Add(BoolVariable("deprecated", "Enable compatibility code for deprecated and removed features", True)) opts.Add(BoolVariable("dev_build", "Developer build with dev-only debugging code (DEV_ENABLED)", False)) opts.Add(BoolVariable("verbose", "Enable verbose output for the compilation", False)) @@ -488,6 +495,9 @@ def generate(env): if env["precision"] == "double": env.Append(CPPDEFINES=["REAL_T_IS_DOUBLE"]) + if not env["deprecated"]: + env.Append(CPPDEFINES=["DISABLE_DEPRECATED"]) + # Allow detecting when building as a GDExtension. env.Append(CPPDEFINES=["GDEXTENSION"]) @@ -538,8 +548,9 @@ def _godot_cpp(env): env.Dir("."), [ api_file, - os.path.join(extension_dir, "gdextension_interface.h"), + os.path.join(extension_dir, "gdextension_interface.json"), "binding_generator.py", + "make_interface_header.py", ], ) # Forces bindings regeneration. @@ -559,7 +570,6 @@ def _godot_cpp(env): # Includes env.AppendUnique( CPPPATH=[ - env.Dir(extension_dir), env.Dir("include").srcnode(), env.Dir("gen/include"), ]