Merge pull request #952 from groud/rename_gdnative_to_gdextension
Rename GDNative to GDExtensionpull/958/head
commit
c21705982e
|
@ -145,7 +145,7 @@ jobs:
|
|||
cmake -DCMAKE_BUILD_TYPE=Release .
|
||||
make -j $(nproc) VERBOSE=1
|
||||
|
||||
- name: Build test GDNative library
|
||||
- name: Build test GDExtension library
|
||||
run: |
|
||||
cd test && cmake -DCMAKE_BUILD_TYPE=Release -DGODOT_HEADERS_PATH="../godot-headers" -DCPP_BINDINGS_PATH=".." .
|
||||
make -j $(nproc) VERBOSE=1
|
||||
|
@ -169,7 +169,7 @@ jobs:
|
|||
cmake -DCMAKE_BUILD_TYPE=Release -GNinja .
|
||||
cmake --build . -j $(nproc) --verbose
|
||||
|
||||
- name: Build test GDNative library
|
||||
- name: Build test GDExtension library
|
||||
run: |
|
||||
cd test && cmake -DCMAKE_BUILD_TYPE=Release -DGODOT_HEADERS_PATH="../godot-headers" -DCPP_BINDINGS_PATH=".." -GNinja .
|
||||
cmake --build . -j $(nproc) --verbose
|
||||
|
@ -188,7 +188,7 @@ jobs:
|
|||
cmake -DCMAKE_BUILD_TYPE=Release -G"Visual Studio 16 2019" .
|
||||
cmake --build . --verbose
|
||||
|
||||
- name: Build test GDNative library
|
||||
- name: Build test GDExtension library
|
||||
run: |
|
||||
cd test && cmake -DCMAKE_BUILD_TYPE=Release -DGODOT_HEADERS_PATH="../godot-headers" -DCPP_BINDINGS_PATH=".." -G"Visual Studio 16 2019" .
|
||||
cmake --build . --verbose
|
||||
|
|
|
@ -2,8 +2,8 @@
|
|||
# CMAKE_BUILD_TYPE: Compilation target (Debug or Release defaults to Debug)
|
||||
#
|
||||
# godot-cpp cmake arguments
|
||||
# GODOT_HEADERS_DIR: This is where the gdnative include folder is (godot_source/modules/gdnative/include)
|
||||
# GODOT_CUSTOM_API_FILE: This is if you have another path for the godot_api.json
|
||||
# GODOT_HEADERS_DIR: Custom include path for the GDExtension. It should include interface header at this subpath: godot/gdextension_interface.h
|
||||
# GODOT_CUSTOM_API_FILE: Custom path for extension_api.json
|
||||
# FLOAT_TYPE Floating-point precision (32, 64)
|
||||
#
|
||||
# Android cmake arguments
|
||||
|
|
|
@ -76,7 +76,7 @@ extern "C" {
|
|||
|
||||
// Initialization.
|
||||
|
||||
GDNativeBool GDN_EXPORT example_library_init(const GDNativeInterface *p_interface, GDNativeExtensionClassLibraryPtr p_library, GDNativeInitialization *r_initialization) {
|
||||
GDExtensionBool GDE_EXPORT example_library_init(const GDExtensionInterface *p_interface, GDExtensionClassLibraryPtr p_library, GDExtensionInitialization *r_initialization) {
|
||||
godot::GDExtensionBinding::InitObject init_obj(p_interface, p_library, r_initialization);
|
||||
|
||||
init_obj.register_initializer(initialize_example_module);
|
||||
|
|
|
@ -183,7 +183,7 @@ else:
|
|||
|
||||
bindings = env.GenerateBindings(
|
||||
env.Dir("."),
|
||||
[json_api_file, os.path.join(env["headers_dir"], "godot", "gdnative_interface.h"), "binding_generator.py"],
|
||||
[json_api_file, os.path.join(env["headers_dir"], "godot", "gdextension_interface.h"), "binding_generator.py"],
|
||||
)
|
||||
|
||||
scons_cache_path = os.environ.get("SCONS_CACHE")
|
||||
|
|
|
@ -377,7 +377,7 @@ def generate_builtin_class_header(builtin_api, size, used_classes, fully_used_cl
|
|||
if len(fully_used_classes) > 0:
|
||||
result.append("")
|
||||
|
||||
result.append(f"#include <godot/gdnative_interface.h>")
|
||||
result.append(f"#include <godot/gdextension_interface.h>")
|
||||
result.append("")
|
||||
result.append("namespace godot {")
|
||||
result.append("")
|
||||
|
@ -405,37 +405,37 @@ def generate_builtin_class_header(builtin_api, size, used_classes, fully_used_cl
|
|||
|
||||
if "constructors" in builtin_api:
|
||||
for constructor in builtin_api["constructors"]:
|
||||
result.append(f'\t\tGDNativePtrConstructor constructor_{constructor["index"]};')
|
||||
result.append(f'\t\tGDExtensionPtrConstructor constructor_{constructor["index"]};')
|
||||
|
||||
if builtin_api["has_destructor"]:
|
||||
result.append("\t\tGDNativePtrDestructor destructor;")
|
||||
result.append("\t\tGDExtensionPtrDestructor destructor;")
|
||||
|
||||
if "methods" in builtin_api:
|
||||
for method in builtin_api["methods"]:
|
||||
result.append(f'\t\tGDNativePtrBuiltInMethod method_{method["name"]};')
|
||||
result.append(f'\t\tGDExtensionPtrBuiltInMethod method_{method["name"]};')
|
||||
|
||||
if "members" in builtin_api:
|
||||
for member in builtin_api["members"]:
|
||||
result.append(f'\t\tGDNativePtrSetter member_{member["name"]}_setter;')
|
||||
result.append(f'\t\tGDNativePtrGetter member_{member["name"]}_getter;')
|
||||
result.append(f'\t\tGDExtensionPtrSetter member_{member["name"]}_setter;')
|
||||
result.append(f'\t\tGDExtensionPtrGetter member_{member["name"]}_getter;')
|
||||
|
||||
if "indexing_return_type" in builtin_api:
|
||||
result.append(f"\t\tGDNativePtrIndexedSetter indexed_setter;")
|
||||
result.append(f"\t\tGDNativePtrIndexedGetter indexed_getter;")
|
||||
result.append(f"\t\tGDExtensionPtrIndexedSetter indexed_setter;")
|
||||
result.append(f"\t\tGDExtensionPtrIndexedGetter indexed_getter;")
|
||||
|
||||
if "is_keyed" in builtin_api and builtin_api["is_keyed"]:
|
||||
result.append(f"\t\tGDNativePtrKeyedSetter keyed_setter;")
|
||||
result.append(f"\t\tGDNativePtrKeyedGetter keyed_getter;")
|
||||
result.append(f"\t\tGDNativePtrKeyedChecker keyed_checker;")
|
||||
result.append(f"\t\tGDExtensionPtrKeyedSetter keyed_setter;")
|
||||
result.append(f"\t\tGDExtensionPtrKeyedGetter keyed_getter;")
|
||||
result.append(f"\t\tGDExtensionPtrKeyedChecker keyed_checker;")
|
||||
|
||||
if "operators" in builtin_api:
|
||||
for operator in builtin_api["operators"]:
|
||||
if "right_type" in operator:
|
||||
result.append(
|
||||
f'\t\tGDNativePtrOperatorEvaluator operator_{get_operator_id_name(operator["name"])}_{operator["right_type"]};'
|
||||
f'\t\tGDExtensionPtrOperatorEvaluator operator_{get_operator_id_name(operator["name"])}_{operator["right_type"]};'
|
||||
)
|
||||
else:
|
||||
result.append(f'\t\tGDNativePtrOperatorEvaluator operator_{get_operator_id_name(operator["name"])};')
|
||||
result.append(f'\t\tGDExtensionPtrOperatorEvaluator operator_{get_operator_id_name(operator["name"])};')
|
||||
|
||||
result.append("\t} _method_bindings;")
|
||||
|
||||
|
@ -447,7 +447,7 @@ def generate_builtin_class_header(builtin_api, size, used_classes, fully_used_cl
|
|||
result.append("public:")
|
||||
|
||||
result.append(
|
||||
f"\t_FORCE_INLINE_ GDNativeTypePtr _native_ptr() const {{ return const_cast<uint8_t (*)[{snake_class_name}_SIZE]>(&opaque); }}"
|
||||
f"\t_FORCE_INLINE_ GDExtensionTypePtr _native_ptr() const {{ return const_cast<uint8_t (*)[{snake_class_name}_SIZE]>(&opaque); }}"
|
||||
)
|
||||
|
||||
copy_constructor_index = -1
|
||||
|
@ -653,7 +653,7 @@ def generate_builtin_class_source(builtin_api, size, used_classes, fully_used_cl
|
|||
|
||||
class_name = builtin_api["name"]
|
||||
snake_class_name = camel_to_snake(class_name)
|
||||
enum_type_name = f"GDNATIVE_VARIANT_TYPE_{snake_class_name.upper()}"
|
||||
enum_type_name = f"GDEXTENSION_VARIANT_TYPE_{snake_class_name.upper()}"
|
||||
|
||||
add_header(f"{snake_class_name}.cpp", result)
|
||||
|
||||
|
@ -687,12 +687,12 @@ def generate_builtin_class_source(builtin_api, size, used_classes, fully_used_cl
|
|||
if "constructors" in builtin_api:
|
||||
for constructor in builtin_api["constructors"]:
|
||||
result.append(
|
||||
f'\t_method_bindings.constructor_{constructor["index"]} = internal::gdn_interface->variant_get_ptr_constructor({enum_type_name}, {constructor["index"]});'
|
||||
f'\t_method_bindings.constructor_{constructor["index"]} = internal::gde_interface->variant_get_ptr_constructor({enum_type_name}, {constructor["index"]});'
|
||||
)
|
||||
|
||||
if builtin_api["has_destructor"]:
|
||||
result.append(
|
||||
f"\t_method_bindings.destructor = internal::gdn_interface->variant_get_ptr_destructor({enum_type_name});"
|
||||
f"\t_method_bindings.destructor = internal::gde_interface->variant_get_ptr_destructor({enum_type_name});"
|
||||
)
|
||||
|
||||
result.append("}")
|
||||
|
@ -711,51 +711,53 @@ def generate_builtin_class_source(builtin_api, size, used_classes, fully_used_cl
|
|||
# TODO: Add error check for hash mismatch.
|
||||
result.append(f'\t__name = StringName("{method["name"]}");')
|
||||
result.append(
|
||||
f'\t_method_bindings.method_{method["name"]} = internal::gdn_interface->variant_get_ptr_builtin_method({enum_type_name}, __name._native_ptr(), {method["hash"]});'
|
||||
f'\t_method_bindings.method_{method["name"]} = internal::gde_interface->variant_get_ptr_builtin_method({enum_type_name}, __name._native_ptr(), {method["hash"]});'
|
||||
)
|
||||
|
||||
if "members" in builtin_api:
|
||||
for member in builtin_api["members"]:
|
||||
result.append(f'\t__name = StringName("{member["name"]}");')
|
||||
result.append(
|
||||
f'\t_method_bindings.member_{member["name"]}_setter = internal::gdn_interface->variant_get_ptr_setter({enum_type_name}, __name._native_ptr());'
|
||||
f'\t_method_bindings.member_{member["name"]}_setter = internal::gde_interface->variant_get_ptr_setter({enum_type_name}, __name._native_ptr());'
|
||||
)
|
||||
result.append(
|
||||
f'\t_method_bindings.member_{member["name"]}_getter = internal::gdn_interface->variant_get_ptr_getter({enum_type_name}, __name._native_ptr());'
|
||||
f'\t_method_bindings.member_{member["name"]}_getter = internal::gde_interface->variant_get_ptr_getter({enum_type_name}, __name._native_ptr());'
|
||||
)
|
||||
|
||||
if "indexing_return_type" in builtin_api:
|
||||
result.append(
|
||||
f"\t_method_bindings.indexed_setter = internal::gdn_interface->variant_get_ptr_indexed_setter({enum_type_name});"
|
||||
f"\t_method_bindings.indexed_setter = internal::gde_interface->variant_get_ptr_indexed_setter({enum_type_name});"
|
||||
)
|
||||
result.append(
|
||||
f"\t_method_bindings.indexed_getter = internal::gdn_interface->variant_get_ptr_indexed_getter({enum_type_name});"
|
||||
f"\t_method_bindings.indexed_getter = internal::gde_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::gdn_interface->variant_get_ptr_keyed_setter({enum_type_name});"
|
||||
f"\t_method_bindings.keyed_setter = internal::gde_interface->variant_get_ptr_keyed_setter({enum_type_name});"
|
||||
)
|
||||
result.append(
|
||||
f"\t_method_bindings.keyed_getter = internal::gdn_interface->variant_get_ptr_keyed_getter({enum_type_name});"
|
||||
f"\t_method_bindings.keyed_getter = internal::gde_interface->variant_get_ptr_keyed_getter({enum_type_name});"
|
||||
)
|
||||
result.append(
|
||||
f"\t_method_bindings.keyed_checker = internal::gdn_interface->variant_get_ptr_keyed_checker({enum_type_name});"
|
||||
f"\t_method_bindings.keyed_checker = internal::gde_interface->variant_get_ptr_keyed_checker({enum_type_name});"
|
||||
)
|
||||
|
||||
if "operators" in builtin_api:
|
||||
for operator in builtin_api["operators"]:
|
||||
if "right_type" in operator:
|
||||
if operator["right_type"] == "Variant":
|
||||
right_type_variant_type = "GDNATIVE_VARIANT_TYPE_NIL"
|
||||
right_type_variant_type = "GDEXTENSION_VARIANT_TYPE_NIL"
|
||||
else:
|
||||
right_type_variant_type = f"GDNATIVE_VARIANT_TYPE_{camel_to_snake(operator['right_type']).upper()}"
|
||||
right_type_variant_type = (
|
||||
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::gdn_interface->variant_get_ptr_operator_evaluator(GDNATIVE_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"]} = internal::gde_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::gdn_interface->variant_get_ptr_operator_evaluator(GDNATIVE_VARIANT_OP_{get_operator_id_name(operator["name"]).upper()}, {enum_type_name}, GDNATIVE_VARIANT_TYPE_NIL);'
|
||||
f'\t_method_bindings.operator_{get_operator_id_name(operator["name"])} = internal::gde_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("}")
|
||||
|
@ -836,7 +838,7 @@ def generate_builtin_class_source(builtin_api, size, used_classes, fully_used_cl
|
|||
if "is_static" in method and method["is_static"]:
|
||||
method_call += "nullptr"
|
||||
else:
|
||||
method_call += "(GDNativeTypePtr)&opaque"
|
||||
method_call += "(GDExtensionTypePtr)&opaque"
|
||||
|
||||
if "arguments" in method:
|
||||
arguments = []
|
||||
|
@ -861,7 +863,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, (GDNativeConstTypePtr)&opaque);'
|
||||
f'\treturn internal::_call_builtin_ptr_getter<{correct_type(member["type"])}>(_method_bindings.member_{member["name"]}_getter, (GDExtensionConstTypePtr)&opaque);'
|
||||
)
|
||||
result.append("}")
|
||||
|
||||
|
@ -870,7 +872,7 @@ def generate_builtin_class_source(builtin_api, size, used_classes, fully_used_cl
|
|||
(encode, arg_name) = get_encoded_arg("value", member["type"], None)
|
||||
result += encode
|
||||
result.append(
|
||||
f'\t_method_bindings.member_{member["name"]}_setter((GDNativeConstTypePtr)&opaque, (GDNativeConstTypePtr){arg_name});'
|
||||
f'\t_method_bindings.member_{member["name"]}_setter((GDExtensionConstTypePtr)&opaque, (GDExtensionConstTypePtr){arg_name});'
|
||||
)
|
||||
|
||||
result.append("}")
|
||||
|
@ -886,7 +888,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_gdnative_type(correct_type(operator["return_type"]))}>(_method_bindings.operator_{get_operator_id_name(operator["name"])}_{operator["right_type"]}, (GDNativeConstTypePtr)&opaque, (GDNativeConstTypePtr){arg_name});'
|
||||
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});'
|
||||
)
|
||||
result.append("}")
|
||||
else:
|
||||
|
@ -894,7 +896,7 @@ def generate_builtin_class_source(builtin_api, size, used_classes, fully_used_cl
|
|||
f'{correct_type(operator["return_type"])} {class_name}::operator{operator["name"].replace("unary", "")}() const {{'
|
||||
)
|
||||
result.append(
|
||||
f'\treturn internal::_call_builtin_operator_ptr<{get_gdnative_type(correct_type(operator["return_type"]))}>(_method_bindings.operator_{get_operator_id_name(operator["name"])}, (GDNativeConstTypePtr)&opaque, (GDNativeConstTypePtr)nullptr);'
|
||||
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);'
|
||||
)
|
||||
result.append("}")
|
||||
result.append("")
|
||||
|
@ -1166,7 +1168,7 @@ def generate_engine_class_header(class_api, used_classes, fully_used_classes, us
|
|||
inherits = class_api["inherits"] if "inherits" in class_api else "Wrapped"
|
||||
result.append(f"class {class_name} : public {inherits} {{")
|
||||
|
||||
result.append(f"\tGDNATIVE_CLASS({class_name}, {inherits})")
|
||||
result.append(f"\tGDEXTENSION_CLASS({class_name}, {inherits})")
|
||||
result.append("")
|
||||
|
||||
result.append("public:")
|
||||
|
@ -1315,13 +1317,13 @@ def generate_engine_class_source(class_api, used_classes, fully_used_classes, us
|
|||
result.append(f"{class_name} *{class_name}::get_singleton() {{")
|
||||
result.append(f"\tconst StringName __class_name = {class_name}::get_class_static();")
|
||||
result.append(
|
||||
f"\tstatic GDNativeObjectPtr singleton_obj = internal::gdn_interface->global_get_singleton(__class_name._native_ptr());"
|
||||
f"\tstatic GDExtensionObjectPtr singleton_obj = internal::gde_interface->global_get_singleton(__class_name._native_ptr());"
|
||||
)
|
||||
result.append("#ifdef DEBUG_ENABLED")
|
||||
result.append("\tERR_FAIL_COND_V(singleton_obj == nullptr, nullptr);")
|
||||
result.append("#endif // DEBUG_ENABLED")
|
||||
result.append(
|
||||
f"\tstatic {class_name} *singleton = reinterpret_cast<{class_name} *>(internal::gdn_interface->object_get_instance_binding(singleton_obj, internal::token, &{class_name}::___binding_callbacks));"
|
||||
f"\tstatic {class_name} *singleton = reinterpret_cast<{class_name} *>(internal::gde_interface->object_get_instance_binding(singleton_obj, internal::token, &{class_name}::___binding_callbacks));"
|
||||
)
|
||||
result.append("\treturn singleton;")
|
||||
result.append("}")
|
||||
|
@ -1343,7 +1345,7 @@ def generate_engine_class_source(class_api, used_classes, fully_used_classes, us
|
|||
result.append(f"\tconst StringName __class_name = {class_name}::get_class_static();")
|
||||
result.append(f'\tconst StringName __method_name = "{method["name"]}";')
|
||||
result.append(
|
||||
f'\tstatic GDNativeMethodBindPtr ___method_bind = internal::gdn_interface->classdb_get_method_bind(__class_name._native_ptr(), __method_name._native_ptr(), {method["hash"]});'
|
||||
f'\tstatic GDExtensionMethodBindPtr ___method_bind = internal::gde_interface->classdb_get_method_bind(__class_name._native_ptr(), __method_name._native_ptr(), {method["hash"]});'
|
||||
)
|
||||
method_call = "\t"
|
||||
has_return = "return_value" in method and method["return_value"]["type"] != "void"
|
||||
|
@ -1362,9 +1364,9 @@ 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_pod_type(return_type) or is_variant(return_type) or is_enum(return_type):
|
||||
if method["is_static"]:
|
||||
method_call += f"return internal::_call_native_mb_ret<{get_gdnative_type(correct_type(return_type, meta_type))}>(___method_bind, nullptr"
|
||||
method_call += f"return internal::_call_native_mb_ret<{get_gdextension_type(correct_type(return_type, meta_type))}>(___method_bind, nullptr"
|
||||
else:
|
||||
method_call += f"return internal::_call_native_mb_ret<{get_gdnative_type(correct_type(return_type, meta_type))}>(___method_bind, _owner"
|
||||
method_call += f"return internal::_call_native_mb_ret<{get_gdextension_type(correct_type(return_type, meta_type))}>(___method_bind, _owner"
|
||||
elif is_refcounted(return_type):
|
||||
if method["is_static"]:
|
||||
method_call += f"return Ref<{return_type}>::___internal_constructor(internal::_call_native_mb_ret_obj<{return_type}>(___method_bind, nullptr"
|
||||
|
@ -1399,9 +1401,9 @@ def generate_engine_class_source(class_api, used_classes, fully_used_classes, us
|
|||
arguments.append(arg_name)
|
||||
method_call += ", ".join(arguments)
|
||||
else: # vararg.
|
||||
result.append("\tGDNativeCallError error;")
|
||||
result.append("\tGDExtensionCallError error;")
|
||||
result.append("\tVariant ret;")
|
||||
method_call += "internal::gdn_interface->object_method_bind_call(___method_bind, _owner, reinterpret_cast<GDNativeConstVariantPtr *>(args), arg_count, &ret, &error"
|
||||
method_call += "internal::gde_interface->object_method_bind_call(___method_bind, _owner, reinterpret_cast<GDExtensionConstVariantPtr *>(args), arg_count, &ret, &error"
|
||||
|
||||
if is_ref:
|
||||
method_call += ")" # Close Ref<> constructor.
|
||||
|
@ -1592,7 +1594,7 @@ def generate_utility_functions(api, output_dir):
|
|||
|
||||
source.append(f'\tconst StringName __function_name = "{function["name"]}";')
|
||||
source.append(
|
||||
f'\tstatic GDNativePtrUtilityFunction ___function = internal::gdn_interface->variant_get_ptr_utility_function(__function_name._native_ptr(), {function["hash"]});'
|
||||
f'\tstatic GDExtensionPtrUtilityFunction ___function = internal::gde_interface->variant_get_ptr_utility_function(__function_name._native_ptr(), {function["hash"]});'
|
||||
)
|
||||
has_return = "return_type" in function and function["return_type"] != "void"
|
||||
if has_return:
|
||||
|
@ -1609,7 +1611,7 @@ def generate_utility_functions(api, output_dir):
|
|||
if function["return_type"] == "Object":
|
||||
function_call += "internal::_call_utility_ret_obj(___function"
|
||||
else:
|
||||
function_call += f'internal::_call_utility_ret<{get_gdnative_type(correct_type(function["return_type"]))}>(___function'
|
||||
function_call += f'internal::_call_utility_ret<{get_gdextension_type(correct_type(function["return_type"]))}>(___function'
|
||||
else:
|
||||
function_call += "internal::_call_utility_no_ret(___function"
|
||||
|
||||
|
@ -1627,7 +1629,7 @@ def generate_utility_functions(api, output_dir):
|
|||
function_call += ", ".join(arguments)
|
||||
else:
|
||||
source.append("\tVariant ret;")
|
||||
function_call += "___function(&ret, reinterpret_cast<GDNativeConstVariantPtr *>(args), arg_count"
|
||||
function_call += "___function(&ret, reinterpret_cast<GDExtensionConstVariantPtr *>(args), arg_count"
|
||||
|
||||
function_call += ");"
|
||||
source.append(function_call)
|
||||
|
@ -1708,7 +1710,7 @@ def get_encoded_arg(arg_name, type_name, type_meta):
|
|||
name = escape_identifier(arg_name)
|
||||
arg_type = correct_type(type_name)
|
||||
if is_pod_type(arg_type):
|
||||
result.append(f"\t{get_gdnative_type(arg_type)} {name}_encoded;")
|
||||
result.append(f"\t{get_gdextension_type(arg_type)} {name}_encoded;")
|
||||
result.append(f"\tPtrToArg<{correct_type(type_name)}>::encode({name}, &{name}_encoded);")
|
||||
name = f"&{name}_encoded"
|
||||
elif is_engine_class(type_name):
|
||||
|
@ -1771,7 +1773,7 @@ def make_signature(
|
|||
if not is_vararg:
|
||||
function_signature += make_function_parameters(arguments, for_header, for_builtin, is_vararg)
|
||||
else:
|
||||
function_signature += "const Variant **args, GDNativeInt arg_count"
|
||||
function_signature += "const Variant **args, GDExtensionInt arg_count"
|
||||
|
||||
function_signature += ")"
|
||||
|
||||
|
@ -2060,7 +2062,7 @@ def correct_type(type_name, meta=None):
|
|||
return type_name
|
||||
|
||||
|
||||
def get_gdnative_type(type_name):
|
||||
def get_gdextension_type(type_name):
|
||||
type_conversion_map = {
|
||||
"bool": "int8_t",
|
||||
"uint8_t": "int64_t",
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
# godot-headers
|
||||
|
||||
This repository contains C headers for
|
||||
[**Godot Engine**](https://github.com/godotengine/godot)'s *GDNative Extensions* API.
|
||||
[**Godot Engine**](https://github.com/godotengine/godot)'s *GDExtensions* API.
|
||||
|
||||
## Updating Headers
|
||||
|
||||
|
@ -13,4 +13,4 @@ procedure used to sync this repository with upstream releases:
|
|||
version/commit which you are using.
|
||||
- Use the compiled executable to generate the `extension_api.json` file with:
|
||||
`godot --dump-extension-api extension_api.json`
|
||||
- Copy the file `core/extension/gdnative_interface.h` to `godot`
|
||||
- Copy the file `core/extension/gdextension_interface.h` to `godot`
|
||||
|
|
|
@ -125344,7 +125344,7 @@
|
|||
]
|
||||
},
|
||||
{
|
||||
"name": "NativeExtension",
|
||||
"name": "GDExtension",
|
||||
"is_refcounted": true,
|
||||
"is_instantiable": true,
|
||||
"inherits": "Resource",
|
||||
|
@ -125422,7 +125422,7 @@
|
|||
"is_virtual": false,
|
||||
"hash": 3541246554,
|
||||
"return_value": {
|
||||
"type": "enum::NativeExtension.InitializationLevel"
|
||||
"type": "enum::GDExtension.InitializationLevel"
|
||||
}
|
||||
},
|
||||
{
|
||||
|
@ -125435,14 +125435,14 @@
|
|||
"arguments": [
|
||||
{
|
||||
"name": "level",
|
||||
"type": "enum::NativeExtension.InitializationLevel"
|
||||
"type": "enum::GDExtension.InitializationLevel"
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"name": "NativeExtensionManager",
|
||||
"name": "GDExtensionManager",
|
||||
"is_refcounted": false,
|
||||
"is_instantiable": false,
|
||||
"inherits": "Object",
|
||||
|
@ -125484,7 +125484,7 @@
|
|||
"is_virtual": false,
|
||||
"hash": 3900395898,
|
||||
"return_value": {
|
||||
"type": "enum::NativeExtensionManager.LoadStatus"
|
||||
"type": "enum::GDExtensionManager.LoadStatus"
|
||||
},
|
||||
"arguments": [
|
||||
{
|
||||
|
@ -125501,7 +125501,7 @@
|
|||
"is_virtual": false,
|
||||
"hash": 3900395898,
|
||||
"return_value": {
|
||||
"type": "enum::NativeExtensionManager.LoadStatus"
|
||||
"type": "enum::GDExtensionManager.LoadStatus"
|
||||
},
|
||||
"arguments": [
|
||||
{
|
||||
|
@ -125518,7 +125518,7 @@
|
|||
"is_virtual": false,
|
||||
"hash": 3900395898,
|
||||
"return_value": {
|
||||
"type": "enum::NativeExtensionManager.LoadStatus"
|
||||
"type": "enum::GDExtensionManager.LoadStatus"
|
||||
},
|
||||
"arguments": [
|
||||
{
|
||||
|
@ -125563,7 +125563,7 @@
|
|||
"is_virtual": false,
|
||||
"hash": 3065478200,
|
||||
"return_value": {
|
||||
"type": "NativeExtension"
|
||||
"type": "GDExtension"
|
||||
},
|
||||
"arguments": [
|
||||
{
|
||||
|
@ -263197,8 +263197,8 @@
|
|||
"type": "Time"
|
||||
},
|
||||
{
|
||||
"name": "NativeExtensionManager",
|
||||
"type": "NativeExtensionManager"
|
||||
"name": "GDExtensionManager",
|
||||
"type": "GDExtensionManager"
|
||||
},
|
||||
{
|
||||
"name": "ResourceUID",
|
||||
|
|
|
@ -0,0 +1,612 @@
|
|||
/*************************************************************************/
|
||||
/* gdextension_interface.h */
|
||||
/*************************************************************************/
|
||||
/* This file is part of: */
|
||||
/* GODOT ENGINE */
|
||||
/* https://godotengine.org */
|
||||
/*************************************************************************/
|
||||
/* Copyright (c) 2007-2022 Juan Linietsky, Ariel Manzur. */
|
||||
/* Copyright (c) 2014-2022 Godot Engine contributors (cf. AUTHORS.md). */
|
||||
/* */
|
||||
/* Permission is hereby granted, free of charge, to any person obtaining */
|
||||
/* a copy of this software and associated documentation files (the */
|
||||
/* "Software"), to deal in the Software without restriction, including */
|
||||
/* without limitation the rights to use, copy, modify, merge, publish, */
|
||||
/* distribute, sublicense, and/or sell copies of the Software, and to */
|
||||
/* permit persons to whom the Software is furnished to do so, subject to */
|
||||
/* the following conditions: */
|
||||
/* */
|
||||
/* The above copyright notice and this permission notice shall be */
|
||||
/* included in all copies or substantial portions of the Software. */
|
||||
/* */
|
||||
/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */
|
||||
/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */
|
||||
/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.*/
|
||||
/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */
|
||||
/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */
|
||||
/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */
|
||||
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
|
||||
/*************************************************************************/
|
||||
|
||||
#ifndef GDEXTENSION_INTERFACE_H
|
||||
#define GDEXTENSION_INTERFACE_H
|
||||
|
||||
/* 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.
|
||||
*/
|
||||
|
||||
#include <stddef.h>
|
||||
#include <stdint.h>
|
||||
#include <stdio.h>
|
||||
|
||||
#ifndef __cplusplus
|
||||
typedef uint32_t char32_t;
|
||||
typedef uint16_t char16_t;
|
||||
#endif
|
||||
|
||||
#ifdef __cplusplus
|
||||
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_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;
|
||||
|
||||
typedef void *GDExtensionVariantPtr;
|
||||
typedef const void *GDExtensionConstVariantPtr;
|
||||
typedef void *GDExtensionStringNamePtr;
|
||||
typedef const void *GDExtensionConstStringNamePtr;
|
||||
typedef void *GDExtensionStringPtr;
|
||||
typedef const void *GDExtensionConstStringPtr;
|
||||
typedef void *GDExtensionObjectPtr;
|
||||
typedef const void *GDExtensionConstObjectPtr;
|
||||
typedef void *GDExtensionTypePtr;
|
||||
typedef const void *GDExtensionConstTypePtr;
|
||||
typedef const void *GDExtensionMethodBindPtr;
|
||||
typedef int64_t GDExtensionInt;
|
||||
typedef uint8_t GDExtensionBool;
|
||||
typedef uint64_t GDObjectInstanceID;
|
||||
|
||||
/* 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)(GDExtensionVariantPtr, GDExtensionTypePtr);
|
||||
typedef void (*GDExtensionTypeFromVariantConstructorFunc)(GDExtensionTypePtr, GDExtensionVariantPtr);
|
||||
typedef void (*GDExtensionPtrOperatorEvaluator)(GDExtensionConstTypePtr p_left, GDExtensionConstTypePtr p_right, GDExtensionTypePtr r_result);
|
||||
typedef void (*GDExtensionPtrBuiltInMethod)(GDExtensionTypePtr p_base, GDExtensionConstTypePtr *p_args, GDExtensionTypePtr r_return, int p_argument_count);
|
||||
typedef void (*GDExtensionPtrConstructor)(GDExtensionTypePtr p_base, 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, GDExtensionConstTypePtr *p_arguments, 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 GDExtensionBool (*GDExtensionClassPropertyCanRevert)(GDExtensionClassInstancePtr p_instance, GDExtensionConstStringNamePtr p_name);
|
||||
typedef GDExtensionBool (*GDExtensionClassPropertyGetRevert)(GDExtensionClassInstancePtr p_instance, GDExtensionConstStringNamePtr p_name, GDExtensionVariantPtr r_ret);
|
||||
typedef void (*GDExtensionClassNotification)(GDExtensionClassInstancePtr p_instance, int32_t p_what);
|
||||
typedef 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, GDExtensionConstTypePtr *p_args, GDExtensionTypePtr r_ret);
|
||||
typedef GDExtensionObjectPtr (*GDExtensionClassCreateInstance)(void *p_userdata);
|
||||
typedef void (*GDExtensionClassFreeInstance)(void *p_userdata, GDExtensionClassInstancePtr p_instance);
|
||||
typedef GDExtensionClassCallVirtual (*GDExtensionClassGetVirtual)(void *p_userdata, GDExtensionConstStringNamePtr p_name);
|
||||
|
||||
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;
|
||||
|
||||
typedef void *GDExtensionClassLibraryPtr;
|
||||
|
||||
/* 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
|
||||
} GDExtensionClassMethodArgumentMetadata;
|
||||
|
||||
typedef void (*GDExtensionClassMethodCall)(void *method_userdata, GDExtensionClassInstancePtr p_instance, GDExtensionConstVariantPtr *p_args, GDExtensionInt p_argument_count, GDExtensionVariantPtr r_return, GDExtensionCallError *r_error);
|
||||
typedef void (*GDExtensionClassMethodPtrCall)(void *method_userdata, GDExtensionClassInstancePtr p_instance, 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. */
|
||||
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.
|
||||
*/
|
||||
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;
|
||||
|
||||
/* 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);
|
||||
typedef GDExtensionVariantType (*GDExtensionScriptInstanceGetPropertyType)(GDExtensionScriptInstanceDataPtr p_instance, GDExtensionConstStringNamePtr p_name, GDExtensionBool *r_is_valid);
|
||||
|
||||
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);
|
||||
|
||||
typedef GDExtensionBool (*GDExtensionScriptInstanceHasMethod)(GDExtensionScriptInstanceDataPtr p_instance, GDExtensionConstStringNamePtr p_name);
|
||||
|
||||
typedef void (*GDExtensionScriptInstanceCall)(GDExtensionScriptInstanceDataPtr p_self, GDExtensionConstStringNamePtr p_method, GDExtensionConstVariantPtr *p_args, GDExtensionInt p_argument_count, GDExtensionVariantPtr r_return, GDExtensionCallError *r_error);
|
||||
typedef void (*GDExtensionScriptInstanceNotification)(GDExtensionScriptInstanceDataPtr p_instance, int32_t p_what);
|
||||
typedef void (*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;
|
||||
|
||||
/* INTERFACE */
|
||||
|
||||
typedef struct {
|
||||
uint32_t version_major;
|
||||
uint32_t version_minor;
|
||||
uint32_t version_patch;
|
||||
const char *version_string;
|
||||
|
||||
/* GODOT CORE */
|
||||
|
||||
void *(*mem_alloc)(size_t p_bytes);
|
||||
void *(*mem_realloc)(void *p_ptr, size_t p_bytes);
|
||||
void (*mem_free)(void *p_ptr);
|
||||
|
||||
void (*print_error)(const char *p_description, const char *p_function, const char *p_file, int32_t p_line);
|
||||
void (*print_warning)(const char *p_description, const char *p_function, const char *p_file, int32_t p_line);
|
||||
void (*print_script_error)(const char *p_description, const char *p_function, const char *p_file, int32_t p_line);
|
||||
|
||||
uint64_t (*get_native_struct_size)(GDExtensionConstStringNamePtr p_name);
|
||||
|
||||
/* GODOT VARIANT */
|
||||
|
||||
/* variant general */
|
||||
void (*variant_new_copy)(GDExtensionVariantPtr r_dest, GDExtensionConstVariantPtr p_src);
|
||||
void (*variant_new_nil)(GDExtensionVariantPtr r_dest);
|
||||
void (*variant_destroy)(GDExtensionVariantPtr p_self);
|
||||
|
||||
/* variant type */
|
||||
void (*variant_call)(GDExtensionVariantPtr p_self, GDExtensionConstStringNamePtr p_method, GDExtensionConstVariantPtr *p_args, GDExtensionInt p_argument_count, GDExtensionVariantPtr r_return, GDExtensionCallError *r_error);
|
||||
void (*variant_call_static)(GDExtensionVariantType p_type, GDExtensionConstStringNamePtr p_method, GDExtensionConstVariantPtr *p_args, GDExtensionInt p_argument_count, GDExtensionVariantPtr r_return, GDExtensionCallError *r_error);
|
||||
void (*variant_evaluate)(GDExtensionVariantOperator p_op, GDExtensionConstVariantPtr p_a, GDExtensionConstVariantPtr p_b, GDExtensionVariantPtr r_return, GDExtensionBool *r_valid);
|
||||
void (*variant_set)(GDExtensionVariantPtr p_self, GDExtensionConstVariantPtr p_key, GDExtensionConstVariantPtr p_value, GDExtensionBool *r_valid);
|
||||
void (*variant_set_named)(GDExtensionVariantPtr p_self, GDExtensionConstStringNamePtr p_key, GDExtensionConstVariantPtr p_value, GDExtensionBool *r_valid);
|
||||
void (*variant_set_keyed)(GDExtensionVariantPtr p_self, GDExtensionConstVariantPtr p_key, GDExtensionConstVariantPtr p_value, GDExtensionBool *r_valid);
|
||||
void (*variant_set_indexed)(GDExtensionVariantPtr p_self, GDExtensionInt p_index, GDExtensionConstVariantPtr p_value, GDExtensionBool *r_valid, GDExtensionBool *r_oob);
|
||||
void (*variant_get)(GDExtensionConstVariantPtr p_self, GDExtensionConstVariantPtr p_key, GDExtensionVariantPtr r_ret, GDExtensionBool *r_valid);
|
||||
void (*variant_get_named)(GDExtensionConstVariantPtr p_self, GDExtensionConstStringNamePtr p_key, GDExtensionVariantPtr r_ret, GDExtensionBool *r_valid);
|
||||
void (*variant_get_keyed)(GDExtensionConstVariantPtr p_self, GDExtensionConstVariantPtr p_key, GDExtensionVariantPtr r_ret, GDExtensionBool *r_valid);
|
||||
void (*variant_get_indexed)(GDExtensionConstVariantPtr p_self, GDExtensionInt p_index, GDExtensionVariantPtr r_ret, GDExtensionBool *r_valid, GDExtensionBool *r_oob);
|
||||
GDExtensionBool (*variant_iter_init)(GDExtensionConstVariantPtr p_self, GDExtensionVariantPtr r_iter, GDExtensionBool *r_valid);
|
||||
GDExtensionBool (*variant_iter_next)(GDExtensionConstVariantPtr p_self, GDExtensionVariantPtr r_iter, GDExtensionBool *r_valid);
|
||||
void (*variant_iter_get)(GDExtensionConstVariantPtr p_self, GDExtensionVariantPtr r_iter, GDExtensionVariantPtr r_ret, GDExtensionBool *r_valid);
|
||||
GDExtensionInt (*variant_hash)(GDExtensionConstVariantPtr p_self);
|
||||
GDExtensionInt (*variant_recursive_hash)(GDExtensionConstVariantPtr p_self, GDExtensionInt p_recursion_count);
|
||||
GDExtensionBool (*variant_hash_compare)(GDExtensionConstVariantPtr p_self, GDExtensionConstVariantPtr p_other);
|
||||
GDExtensionBool (*variant_booleanize)(GDExtensionConstVariantPtr p_self);
|
||||
void (*variant_duplicate)(GDExtensionConstVariantPtr p_self, GDExtensionVariantPtr r_ret, GDExtensionBool p_deep);
|
||||
void (*variant_stringify)(GDExtensionConstVariantPtr p_self, GDExtensionStringPtr r_ret);
|
||||
|
||||
GDExtensionVariantType (*variant_get_type)(GDExtensionConstVariantPtr p_self);
|
||||
GDExtensionBool (*variant_has_method)(GDExtensionConstVariantPtr p_self, GDExtensionConstStringNamePtr p_method);
|
||||
GDExtensionBool (*variant_has_member)(GDExtensionVariantType p_type, GDExtensionConstStringNamePtr p_member);
|
||||
GDExtensionBool (*variant_has_key)(GDExtensionConstVariantPtr p_self, GDExtensionConstVariantPtr p_key, GDExtensionBool *r_valid);
|
||||
void (*variant_get_type_name)(GDExtensionVariantType p_type, GDExtensionStringPtr r_name);
|
||||
GDExtensionBool (*variant_can_convert)(GDExtensionVariantType p_from, GDExtensionVariantType p_to);
|
||||
GDExtensionBool (*variant_can_convert_strict)(GDExtensionVariantType p_from, GDExtensionVariantType p_to);
|
||||
|
||||
/* ptrcalls */
|
||||
GDExtensionVariantFromTypeConstructorFunc (*get_variant_from_type_constructor)(GDExtensionVariantType p_type);
|
||||
GDExtensionTypeFromVariantConstructorFunc (*get_variant_to_type_constructor)(GDExtensionVariantType p_type);
|
||||
GDExtensionPtrOperatorEvaluator (*variant_get_ptr_operator_evaluator)(GDExtensionVariantOperator p_operator, GDExtensionVariantType p_type_a, GDExtensionVariantType p_type_b);
|
||||
GDExtensionPtrBuiltInMethod (*variant_get_ptr_builtin_method)(GDExtensionVariantType p_type, GDExtensionConstStringNamePtr p_method, GDExtensionInt p_hash);
|
||||
GDExtensionPtrConstructor (*variant_get_ptr_constructor)(GDExtensionVariantType p_type, int32_t p_constructor);
|
||||
GDExtensionPtrDestructor (*variant_get_ptr_destructor)(GDExtensionVariantType p_type);
|
||||
void (*variant_construct)(GDExtensionVariantType p_type, GDExtensionVariantPtr p_base, GDExtensionConstVariantPtr *p_args, int32_t p_argument_count, GDExtensionCallError *r_error);
|
||||
GDExtensionPtrSetter (*variant_get_ptr_setter)(GDExtensionVariantType p_type, GDExtensionConstStringNamePtr p_member);
|
||||
GDExtensionPtrGetter (*variant_get_ptr_getter)(GDExtensionVariantType p_type, GDExtensionConstStringNamePtr p_member);
|
||||
GDExtensionPtrIndexedSetter (*variant_get_ptr_indexed_setter)(GDExtensionVariantType p_type);
|
||||
GDExtensionPtrIndexedGetter (*variant_get_ptr_indexed_getter)(GDExtensionVariantType p_type);
|
||||
GDExtensionPtrKeyedSetter (*variant_get_ptr_keyed_setter)(GDExtensionVariantType p_type);
|
||||
GDExtensionPtrKeyedGetter (*variant_get_ptr_keyed_getter)(GDExtensionVariantType p_type);
|
||||
GDExtensionPtrKeyedChecker (*variant_get_ptr_keyed_checker)(GDExtensionVariantType p_type);
|
||||
void (*variant_get_constant_value)(GDExtensionVariantType p_type, GDExtensionConstStringNamePtr p_constant, GDExtensionVariantPtr r_ret);
|
||||
GDExtensionPtrUtilityFunction (*variant_get_ptr_utility_function)(GDExtensionConstStringNamePtr p_function, GDExtensionInt p_hash);
|
||||
|
||||
/* extra utilities */
|
||||
void (*string_new_with_latin1_chars)(GDExtensionStringPtr r_dest, const char *p_contents);
|
||||
void (*string_new_with_utf8_chars)(GDExtensionStringPtr r_dest, const char *p_contents);
|
||||
void (*string_new_with_utf16_chars)(GDExtensionStringPtr r_dest, const char16_t *p_contents);
|
||||
void (*string_new_with_utf32_chars)(GDExtensionStringPtr r_dest, const char32_t *p_contents);
|
||||
void (*string_new_with_wide_chars)(GDExtensionStringPtr r_dest, const wchar_t *p_contents);
|
||||
void (*string_new_with_latin1_chars_and_len)(GDExtensionStringPtr r_dest, const char *p_contents, GDExtensionInt p_size);
|
||||
void (*string_new_with_utf8_chars_and_len)(GDExtensionStringPtr r_dest, const char *p_contents, GDExtensionInt p_size);
|
||||
void (*string_new_with_utf16_chars_and_len)(GDExtensionStringPtr r_dest, const char16_t *p_contents, GDExtensionInt p_size);
|
||||
void (*string_new_with_utf32_chars_and_len)(GDExtensionStringPtr r_dest, const char32_t *p_contents, GDExtensionInt p_size);
|
||||
void (*string_new_with_wide_chars_and_len)(GDExtensionStringPtr r_dest, const wchar_t *p_contents, GDExtensionInt p_size);
|
||||
/* Information about the following functions:
|
||||
* - The return value is the resulting encoded string length.
|
||||
* - The length returned is in characters, not in bytes. It also does not include a trailing zero.
|
||||
* - These functions also do not write trailing zero, If you need it, write it yourself at the position indicated by the length (and make sure to allocate it).
|
||||
* - Passing NULL in r_text means only the length is computed (again, without including trailing zero).
|
||||
* - p_max_write_length argument is in characters, not bytes. It will be ignored if r_text is NULL.
|
||||
* - p_max_write_length argument does not affect the return value, it's only to cap write length.
|
||||
*/
|
||||
GDExtensionInt (*string_to_latin1_chars)(GDExtensionConstStringPtr p_self, char *r_text, GDExtensionInt p_max_write_length);
|
||||
GDExtensionInt (*string_to_utf8_chars)(GDExtensionConstStringPtr p_self, char *r_text, GDExtensionInt p_max_write_length);
|
||||
GDExtensionInt (*string_to_utf16_chars)(GDExtensionConstStringPtr p_self, char16_t *r_text, GDExtensionInt p_max_write_length);
|
||||
GDExtensionInt (*string_to_utf32_chars)(GDExtensionConstStringPtr p_self, char32_t *r_text, GDExtensionInt p_max_write_length);
|
||||
GDExtensionInt (*string_to_wide_chars)(GDExtensionConstStringPtr p_self, wchar_t *r_text, GDExtensionInt p_max_write_length);
|
||||
char32_t *(*string_operator_index)(GDExtensionStringPtr p_self, GDExtensionInt p_index);
|
||||
const char32_t *(*string_operator_index_const)(GDExtensionConstStringPtr p_self, GDExtensionInt p_index);
|
||||
|
||||
/* Packed array functions */
|
||||
|
||||
uint8_t *(*packed_byte_array_operator_index)(GDExtensionTypePtr p_self, GDExtensionInt p_index); // p_self should be a PackedByteArray
|
||||
const uint8_t *(*packed_byte_array_operator_index_const)(GDExtensionConstTypePtr p_self, GDExtensionInt p_index); // p_self should be a PackedByteArray
|
||||
|
||||
GDExtensionTypePtr (*packed_color_array_operator_index)(GDExtensionTypePtr p_self, GDExtensionInt p_index); // p_self should be a PackedColorArray, returns Color ptr
|
||||
GDExtensionTypePtr (*packed_color_array_operator_index_const)(GDExtensionConstTypePtr p_self, GDExtensionInt p_index); // p_self should be a PackedColorArray, returns Color ptr
|
||||
|
||||
float *(*packed_float32_array_operator_index)(GDExtensionTypePtr p_self, GDExtensionInt p_index); // p_self should be a PackedFloat32Array
|
||||
const float *(*packed_float32_array_operator_index_const)(GDExtensionConstTypePtr p_self, GDExtensionInt p_index); // p_self should be a PackedFloat32Array
|
||||
double *(*packed_float64_array_operator_index)(GDExtensionTypePtr p_self, GDExtensionInt p_index); // p_self should be a PackedFloat64Array
|
||||
const double *(*packed_float64_array_operator_index_const)(GDExtensionConstTypePtr p_self, GDExtensionInt p_index); // p_self should be a PackedFloat64Array
|
||||
|
||||
int32_t *(*packed_int32_array_operator_index)(GDExtensionTypePtr p_self, GDExtensionInt p_index); // p_self should be a PackedInt32Array
|
||||
const int32_t *(*packed_int32_array_operator_index_const)(GDExtensionConstTypePtr p_self, GDExtensionInt p_index); // p_self should be a PackedInt32Array
|
||||
int64_t *(*packed_int64_array_operator_index)(GDExtensionTypePtr p_self, GDExtensionInt p_index); // p_self should be a PackedInt32Array
|
||||
const int64_t *(*packed_int64_array_operator_index_const)(GDExtensionConstTypePtr p_self, GDExtensionInt p_index); // p_self should be a PackedInt32Array
|
||||
|
||||
GDExtensionStringPtr (*packed_string_array_operator_index)(GDExtensionTypePtr p_self, GDExtensionInt p_index); // p_self should be a PackedStringArray
|
||||
GDExtensionStringPtr (*packed_string_array_operator_index_const)(GDExtensionConstTypePtr p_self, GDExtensionInt p_index); // p_self should be a PackedStringArray
|
||||
|
||||
GDExtensionTypePtr (*packed_vector2_array_operator_index)(GDExtensionTypePtr p_self, GDExtensionInt p_index); // p_self should be a PackedVector2Array, returns Vector2 ptr
|
||||
GDExtensionTypePtr (*packed_vector2_array_operator_index_const)(GDExtensionConstTypePtr p_self, GDExtensionInt p_index); // p_self should be a PackedVector2Array, returns Vector2 ptr
|
||||
GDExtensionTypePtr (*packed_vector3_array_operator_index)(GDExtensionTypePtr p_self, GDExtensionInt p_index); // p_self should be a PackedVector3Array, returns Vector3 ptr
|
||||
GDExtensionTypePtr (*packed_vector3_array_operator_index_const)(GDExtensionConstTypePtr p_self, GDExtensionInt p_index); // p_self should be a PackedVector3Array, returns Vector3 ptr
|
||||
|
||||
GDExtensionVariantPtr (*array_operator_index)(GDExtensionTypePtr p_self, GDExtensionInt p_index); // p_self should be an Array ptr
|
||||
GDExtensionVariantPtr (*array_operator_index_const)(GDExtensionConstTypePtr p_self, GDExtensionInt p_index); // p_self should be an Array ptr
|
||||
|
||||
/* Dictionary functions */
|
||||
|
||||
GDExtensionVariantPtr (*dictionary_operator_index)(GDExtensionTypePtr p_self, GDExtensionConstVariantPtr p_key); // p_self should be an Dictionary ptr
|
||||
GDExtensionVariantPtr (*dictionary_operator_index_const)(GDExtensionConstTypePtr p_self, GDExtensionConstVariantPtr p_key); // p_self should be an Dictionary ptr
|
||||
|
||||
/* OBJECT */
|
||||
|
||||
void (*object_method_bind_call)(GDExtensionMethodBindPtr p_method_bind, GDExtensionObjectPtr p_instance, GDExtensionConstVariantPtr *p_args, GDExtensionInt p_arg_count, GDExtensionVariantPtr r_ret, GDExtensionCallError *r_error);
|
||||
void (*object_method_bind_ptrcall)(GDExtensionMethodBindPtr p_method_bind, GDExtensionObjectPtr p_instance, GDExtensionConstTypePtr *p_args, GDExtensionTypePtr r_ret);
|
||||
void (*object_destroy)(GDExtensionObjectPtr p_o);
|
||||
GDExtensionObjectPtr (*global_get_singleton)(GDExtensionConstStringNamePtr p_name);
|
||||
|
||||
void *(*object_get_instance_binding)(GDExtensionObjectPtr p_o, void *p_token, const GDExtensionInstanceBindingCallbacks *p_callbacks);
|
||||
void (*object_set_instance_binding)(GDExtensionObjectPtr p_o, void *p_token, void *p_binding, const GDExtensionInstanceBindingCallbacks *p_callbacks);
|
||||
|
||||
void (*object_set_instance)(GDExtensionObjectPtr p_o, GDExtensionConstStringNamePtr p_classname, GDExtensionClassInstancePtr p_instance); /* p_classname should be a registered extension class and should extend the p_o object's class. */
|
||||
|
||||
GDExtensionObjectPtr (*object_cast_to)(GDExtensionConstObjectPtr p_object, void *p_class_tag);
|
||||
GDExtensionObjectPtr (*object_get_instance_from_id)(GDObjectInstanceID p_instance_id);
|
||||
GDObjectInstanceID (*object_get_instance_id)(GDExtensionConstObjectPtr p_object);
|
||||
|
||||
/* SCRIPT INSTANCE */
|
||||
|
||||
GDExtensionScriptInstancePtr (*script_instance_create)(const GDExtensionScriptInstanceInfo *p_info, GDExtensionScriptInstanceDataPtr p_instance_data);
|
||||
|
||||
/* CLASSDB */
|
||||
|
||||
GDExtensionObjectPtr (*classdb_construct_object)(GDExtensionConstStringNamePtr p_classname); /* The passed class must be a built-in godot class, or an already-registered extension class. In both case, object_set_instance should be called to fully initialize the object. */
|
||||
GDExtensionMethodBindPtr (*classdb_get_method_bind)(GDExtensionConstStringNamePtr p_classname, GDExtensionConstStringNamePtr p_methodname, GDExtensionInt p_hash);
|
||||
void *(*classdb_get_class_tag)(GDExtensionConstStringNamePtr p_classname);
|
||||
|
||||
/* CLASSDB EXTENSION */
|
||||
|
||||
/* Provided parameters for `classdb_register_extension_*` can be safely freed once the function returns. */
|
||||
void (*classdb_register_extension_class)(GDExtensionClassLibraryPtr p_library, GDExtensionConstStringNamePtr p_class_name, GDExtensionConstStringNamePtr p_parent_class_name, const GDExtensionClassCreationInfo *p_extension_funcs);
|
||||
void (*classdb_register_extension_class_method)(GDExtensionClassLibraryPtr p_library, GDExtensionConstStringNamePtr p_class_name, const GDExtensionClassMethodInfo *p_method_info);
|
||||
void (*classdb_register_extension_class_integer_constant)(GDExtensionClassLibraryPtr p_library, GDExtensionConstStringNamePtr p_class_name, GDExtensionConstStringNamePtr p_enum_name, GDExtensionConstStringNamePtr p_constant_name, GDExtensionInt p_constant_value, GDExtensionBool p_is_bitfield);
|
||||
void (*classdb_register_extension_class_property)(GDExtensionClassLibraryPtr p_library, GDExtensionConstStringNamePtr p_class_name, const GDExtensionPropertyInfo *p_info, GDExtensionConstStringNamePtr p_setter, GDExtensionConstStringNamePtr p_getter);
|
||||
void (*classdb_register_extension_class_property_group)(GDExtensionClassLibraryPtr p_library, GDExtensionConstStringNamePtr p_class_name, GDExtensionConstStringPtr p_group_name, GDExtensionConstStringPtr p_prefix);
|
||||
void (*classdb_register_extension_class_property_subgroup)(GDExtensionClassLibraryPtr p_library, GDExtensionConstStringNamePtr p_class_name, GDExtensionConstStringPtr p_subgroup_name, GDExtensionConstStringPtr p_prefix);
|
||||
void (*classdb_register_extension_class_signal)(GDExtensionClassLibraryPtr p_library, GDExtensionConstStringNamePtr p_class_name, GDExtensionConstStringNamePtr p_signal_name, const GDExtensionPropertyInfo *p_argument_info, GDExtensionInt p_argument_count);
|
||||
void (*classdb_unregister_extension_class)(GDExtensionClassLibraryPtr p_library, GDExtensionConstStringNamePtr p_class_name); /* Unregistering a parent class before a class that inherits it will result in failure. Inheritors must be unregistered first. */
|
||||
|
||||
void (*get_library_path)(GDExtensionClassLibraryPtr p_library, GDExtensionStringPtr r_path);
|
||||
|
||||
} GDExtensionInterface;
|
||||
|
||||
/* INITIALIZATION */
|
||||
|
||||
typedef enum {
|
||||
GDEXTENSION_INITIALIZATION_CORE,
|
||||
GDEXTENSION_INITIALIZATION_SERVERS,
|
||||
GDEXTENSION_INITIALIZATION_SCENE,
|
||||
GDEXTENSION_INITIALIZATION_EDITOR,
|
||||
GDEXTENSION_MAX_INITIALIZATION_LEVEL,
|
||||
} GDExtensionInitializationLevel;
|
||||
|
||||
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. */
|
||||
void (*initialize)(void *userdata, GDExtensionInitializationLevel p_level);
|
||||
void (*deinitialize)(void *userdata, GDExtensionInitializationLevel p_level);
|
||||
} GDExtensionInitialization;
|
||||
|
||||
/* Define a C function prototype that implements the function below and expose it to dlopen() (or similar).
|
||||
* This is the entry point of the GDExtension library and will be called on initialization.
|
||||
* It can be used to set up different init levels, which are called during various stages of initialization/shutdown.
|
||||
* The function name must be a unique one specified in the .gdextension config file.
|
||||
*/
|
||||
typedef GDExtensionBool (*GDExtensionInitializationFunction)(const GDExtensionInterface *p_interface, GDExtensionClassLibraryPtr p_library, GDExtensionInitialization *r_initialization);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif // GDEXTENSION_INTERFACE_H
|
|
@ -1,612 +0,0 @@
|
|||
/*************************************************************************/
|
||||
/* gdnative_interface.h */
|
||||
/*************************************************************************/
|
||||
/* This file is part of: */
|
||||
/* GODOT ENGINE */
|
||||
/* https://godotengine.org */
|
||||
/*************************************************************************/
|
||||
/* Copyright (c) 2007-2022 Juan Linietsky, Ariel Manzur. */
|
||||
/* Copyright (c) 2014-2022 Godot Engine contributors (cf. AUTHORS.md). */
|
||||
/* */
|
||||
/* Permission is hereby granted, free of charge, to any person obtaining */
|
||||
/* a copy of this software and associated documentation files (the */
|
||||
/* "Software"), to deal in the Software without restriction, including */
|
||||
/* without limitation the rights to use, copy, modify, merge, publish, */
|
||||
/* distribute, sublicense, and/or sell copies of the Software, and to */
|
||||
/* permit persons to whom the Software is furnished to do so, subject to */
|
||||
/* the following conditions: */
|
||||
/* */
|
||||
/* The above copyright notice and this permission notice shall be */
|
||||
/* included in all copies or substantial portions of the Software. */
|
||||
/* */
|
||||
/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */
|
||||
/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */
|
||||
/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.*/
|
||||
/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */
|
||||
/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */
|
||||
/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */
|
||||
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
|
||||
/*************************************************************************/
|
||||
|
||||
#ifndef GDNATIVE_INTERFACE_H
|
||||
#define GDNATIVE_INTERFACE_H
|
||||
|
||||
/* 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.
|
||||
*/
|
||||
|
||||
#include <stddef.h>
|
||||
#include <stdint.h>
|
||||
#include <stdio.h>
|
||||
|
||||
#ifndef __cplusplus
|
||||
typedef uint32_t char32_t;
|
||||
typedef uint16_t char16_t;
|
||||
#endif
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/* VARIANT TYPES */
|
||||
|
||||
typedef enum {
|
||||
GDNATIVE_VARIANT_TYPE_NIL,
|
||||
|
||||
/* atomic types */
|
||||
GDNATIVE_VARIANT_TYPE_BOOL,
|
||||
GDNATIVE_VARIANT_TYPE_INT,
|
||||
GDNATIVE_VARIANT_TYPE_FLOAT,
|
||||
GDNATIVE_VARIANT_TYPE_STRING,
|
||||
|
||||
/* math types */
|
||||
GDNATIVE_VARIANT_TYPE_VECTOR2,
|
||||
GDNATIVE_VARIANT_TYPE_VECTOR2I,
|
||||
GDNATIVE_VARIANT_TYPE_RECT2,
|
||||
GDNATIVE_VARIANT_TYPE_RECT2I,
|
||||
GDNATIVE_VARIANT_TYPE_VECTOR3,
|
||||
GDNATIVE_VARIANT_TYPE_VECTOR3I,
|
||||
GDNATIVE_VARIANT_TYPE_TRANSFORM2D,
|
||||
GDNATIVE_VARIANT_TYPE_VECTOR4,
|
||||
GDNATIVE_VARIANT_TYPE_VECTOR4I,
|
||||
GDNATIVE_VARIANT_TYPE_PLANE,
|
||||
GDNATIVE_VARIANT_TYPE_QUATERNION,
|
||||
GDNATIVE_VARIANT_TYPE_AABB,
|
||||
GDNATIVE_VARIANT_TYPE_BASIS,
|
||||
GDNATIVE_VARIANT_TYPE_TRANSFORM3D,
|
||||
GDNATIVE_VARIANT_TYPE_PROJECTION,
|
||||
|
||||
/* misc types */
|
||||
GDNATIVE_VARIANT_TYPE_COLOR,
|
||||
GDNATIVE_VARIANT_TYPE_STRING_NAME,
|
||||
GDNATIVE_VARIANT_TYPE_NODE_PATH,
|
||||
GDNATIVE_VARIANT_TYPE_RID,
|
||||
GDNATIVE_VARIANT_TYPE_OBJECT,
|
||||
GDNATIVE_VARIANT_TYPE_CALLABLE,
|
||||
GDNATIVE_VARIANT_TYPE_SIGNAL,
|
||||
GDNATIVE_VARIANT_TYPE_DICTIONARY,
|
||||
GDNATIVE_VARIANT_TYPE_ARRAY,
|
||||
|
||||
/* typed arrays */
|
||||
GDNATIVE_VARIANT_TYPE_PACKED_BYTE_ARRAY,
|
||||
GDNATIVE_VARIANT_TYPE_PACKED_INT32_ARRAY,
|
||||
GDNATIVE_VARIANT_TYPE_PACKED_INT64_ARRAY,
|
||||
GDNATIVE_VARIANT_TYPE_PACKED_FLOAT32_ARRAY,
|
||||
GDNATIVE_VARIANT_TYPE_PACKED_FLOAT64_ARRAY,
|
||||
GDNATIVE_VARIANT_TYPE_PACKED_STRING_ARRAY,
|
||||
GDNATIVE_VARIANT_TYPE_PACKED_VECTOR2_ARRAY,
|
||||
GDNATIVE_VARIANT_TYPE_PACKED_VECTOR3_ARRAY,
|
||||
GDNATIVE_VARIANT_TYPE_PACKED_COLOR_ARRAY,
|
||||
|
||||
GDNATIVE_VARIANT_TYPE_VARIANT_MAX
|
||||
} GDNativeVariantType;
|
||||
|
||||
typedef enum {
|
||||
/* comparison */
|
||||
GDNATIVE_VARIANT_OP_EQUAL,
|
||||
GDNATIVE_VARIANT_OP_NOT_EQUAL,
|
||||
GDNATIVE_VARIANT_OP_LESS,
|
||||
GDNATIVE_VARIANT_OP_LESS_EQUAL,
|
||||
GDNATIVE_VARIANT_OP_GREATER,
|
||||
GDNATIVE_VARIANT_OP_GREATER_EQUAL,
|
||||
|
||||
/* mathematic */
|
||||
GDNATIVE_VARIANT_OP_ADD,
|
||||
GDNATIVE_VARIANT_OP_SUBTRACT,
|
||||
GDNATIVE_VARIANT_OP_MULTIPLY,
|
||||
GDNATIVE_VARIANT_OP_DIVIDE,
|
||||
GDNATIVE_VARIANT_OP_NEGATE,
|
||||
GDNATIVE_VARIANT_OP_POSITIVE,
|
||||
GDNATIVE_VARIANT_OP_MODULE,
|
||||
GDNATIVE_VARIANT_OP_POWER,
|
||||
|
||||
/* bitwise */
|
||||
GDNATIVE_VARIANT_OP_SHIFT_LEFT,
|
||||
GDNATIVE_VARIANT_OP_SHIFT_RIGHT,
|
||||
GDNATIVE_VARIANT_OP_BIT_AND,
|
||||
GDNATIVE_VARIANT_OP_BIT_OR,
|
||||
GDNATIVE_VARIANT_OP_BIT_XOR,
|
||||
GDNATIVE_VARIANT_OP_BIT_NEGATE,
|
||||
|
||||
/* logic */
|
||||
GDNATIVE_VARIANT_OP_AND,
|
||||
GDNATIVE_VARIANT_OP_OR,
|
||||
GDNATIVE_VARIANT_OP_XOR,
|
||||
GDNATIVE_VARIANT_OP_NOT,
|
||||
|
||||
/* containment */
|
||||
GDNATIVE_VARIANT_OP_IN,
|
||||
GDNATIVE_VARIANT_OP_MAX
|
||||
|
||||
} GDNativeVariantOperator;
|
||||
|
||||
typedef void *GDNativeVariantPtr;
|
||||
typedef const void *GDNativeConstVariantPtr;
|
||||
typedef void *GDNativeStringNamePtr;
|
||||
typedef const void *GDNativeConstStringNamePtr;
|
||||
typedef void *GDNativeStringPtr;
|
||||
typedef const void *GDNativeConstStringPtr;
|
||||
typedef void *GDNativeObjectPtr;
|
||||
typedef const void *GDNativeConstObjectPtr;
|
||||
typedef void *GDNativeTypePtr;
|
||||
typedef const void *GDNativeConstTypePtr;
|
||||
typedef const void *GDNativeMethodBindPtr;
|
||||
typedef int64_t GDNativeInt;
|
||||
typedef uint8_t GDNativeBool;
|
||||
typedef uint64_t GDObjectInstanceID;
|
||||
|
||||
/* VARIANT DATA I/O */
|
||||
|
||||
typedef enum {
|
||||
GDNATIVE_CALL_OK,
|
||||
GDNATIVE_CALL_ERROR_INVALID_METHOD,
|
||||
GDNATIVE_CALL_ERROR_INVALID_ARGUMENT, // Expected a different variant type.
|
||||
GDNATIVE_CALL_ERROR_TOO_MANY_ARGUMENTS, // Expected lower number of arguments.
|
||||
GDNATIVE_CALL_ERROR_TOO_FEW_ARGUMENTS, // Expected higher number of arguments.
|
||||
GDNATIVE_CALL_ERROR_INSTANCE_IS_NULL,
|
||||
GDNATIVE_CALL_ERROR_METHOD_NOT_CONST, // Used for const call.
|
||||
} GDNativeCallErrorType;
|
||||
|
||||
typedef struct {
|
||||
GDNativeCallErrorType error;
|
||||
int32_t argument;
|
||||
int32_t expected;
|
||||
} GDNativeCallError;
|
||||
|
||||
typedef void (*GDNativeVariantFromTypeConstructorFunc)(GDNativeVariantPtr, GDNativeTypePtr);
|
||||
typedef void (*GDNativeTypeFromVariantConstructorFunc)(GDNativeTypePtr, GDNativeVariantPtr);
|
||||
typedef void (*GDNativePtrOperatorEvaluator)(GDNativeConstTypePtr p_left, GDNativeConstTypePtr p_right, GDNativeTypePtr r_result);
|
||||
typedef void (*GDNativePtrBuiltInMethod)(GDNativeTypePtr p_base, GDNativeConstTypePtr *p_args, GDNativeTypePtr r_return, int p_argument_count);
|
||||
typedef void (*GDNativePtrConstructor)(GDNativeTypePtr p_base, GDNativeConstTypePtr *p_args);
|
||||
typedef void (*GDNativePtrDestructor)(GDNativeTypePtr p_base);
|
||||
typedef void (*GDNativePtrSetter)(GDNativeTypePtr p_base, GDNativeConstTypePtr p_value);
|
||||
typedef void (*GDNativePtrGetter)(GDNativeConstTypePtr p_base, GDNativeTypePtr r_value);
|
||||
typedef void (*GDNativePtrIndexedSetter)(GDNativeTypePtr p_base, GDNativeInt p_index, GDNativeConstTypePtr p_value);
|
||||
typedef void (*GDNativePtrIndexedGetter)(GDNativeConstTypePtr p_base, GDNativeInt p_index, GDNativeTypePtr r_value);
|
||||
typedef void (*GDNativePtrKeyedSetter)(GDNativeTypePtr p_base, GDNativeConstTypePtr p_key, GDNativeConstTypePtr p_value);
|
||||
typedef void (*GDNativePtrKeyedGetter)(GDNativeConstTypePtr p_base, GDNativeConstTypePtr p_key, GDNativeTypePtr r_value);
|
||||
typedef uint32_t (*GDNativePtrKeyedChecker)(GDNativeConstVariantPtr p_base, GDNativeConstVariantPtr p_key);
|
||||
typedef void (*GDNativePtrUtilityFunction)(GDNativeTypePtr r_return, GDNativeConstTypePtr *p_arguments, int p_argument_count);
|
||||
|
||||
typedef GDNativeObjectPtr (*GDNativeClassConstructor)();
|
||||
|
||||
typedef void *(*GDNativeInstanceBindingCreateCallback)(void *p_token, void *p_instance);
|
||||
typedef void (*GDNativeInstanceBindingFreeCallback)(void *p_token, void *p_instance, void *p_binding);
|
||||
typedef GDNativeBool (*GDNativeInstanceBindingReferenceCallback)(void *p_token, void *p_binding, GDNativeBool p_reference);
|
||||
|
||||
typedef struct {
|
||||
GDNativeInstanceBindingCreateCallback create_callback;
|
||||
GDNativeInstanceBindingFreeCallback free_callback;
|
||||
GDNativeInstanceBindingReferenceCallback reference_callback;
|
||||
} GDNativeInstanceBindingCallbacks;
|
||||
|
||||
/* EXTENSION CLASSES */
|
||||
|
||||
typedef void *GDExtensionClassInstancePtr;
|
||||
|
||||
typedef GDNativeBool (*GDNativeExtensionClassSet)(GDExtensionClassInstancePtr p_instance, GDNativeConstStringNamePtr p_name, GDNativeConstVariantPtr p_value);
|
||||
typedef GDNativeBool (*GDNativeExtensionClassGet)(GDExtensionClassInstancePtr p_instance, GDNativeConstStringNamePtr p_name, GDNativeVariantPtr r_ret);
|
||||
typedef uint64_t (*GDNativeExtensionClassGetRID)(GDExtensionClassInstancePtr p_instance);
|
||||
|
||||
typedef struct {
|
||||
GDNativeVariantType type;
|
||||
GDNativeStringNamePtr name;
|
||||
GDNativeStringNamePtr class_name;
|
||||
uint32_t hint; // Bitfield of `PropertyHint` (defined in `extension_api.json`).
|
||||
GDNativeStringPtr hint_string;
|
||||
uint32_t usage; // Bitfield of `PropertyUsageFlags` (defined in `extension_api.json`).
|
||||
} GDNativePropertyInfo;
|
||||
|
||||
typedef struct {
|
||||
GDNativeStringNamePtr name;
|
||||
GDNativePropertyInfo return_value;
|
||||
uint32_t flags; // Bitfield of `GDNativeExtensionClassMethodFlags`.
|
||||
int32_t id;
|
||||
|
||||
/* Arguments: `default_arguments` is an array of size `argument_count`. */
|
||||
uint32_t argument_count;
|
||||
GDNativePropertyInfo *arguments;
|
||||
|
||||
/* Default arguments: `default_arguments` is an array of size `default_argument_count`. */
|
||||
uint32_t default_argument_count;
|
||||
GDNativeVariantPtr *default_arguments;
|
||||
} GDNativeMethodInfo;
|
||||
|
||||
typedef const GDNativePropertyInfo *(*GDNativeExtensionClassGetPropertyList)(GDExtensionClassInstancePtr p_instance, uint32_t *r_count);
|
||||
typedef void (*GDNativeExtensionClassFreePropertyList)(GDExtensionClassInstancePtr p_instance, const GDNativePropertyInfo *p_list);
|
||||
typedef GDNativeBool (*GDNativeExtensionClassPropertyCanRevert)(GDExtensionClassInstancePtr p_instance, GDNativeConstStringNamePtr p_name);
|
||||
typedef GDNativeBool (*GDNativeExtensionClassPropertyGetRevert)(GDExtensionClassInstancePtr p_instance, GDNativeConstStringNamePtr p_name, GDNativeVariantPtr r_ret);
|
||||
typedef void (*GDNativeExtensionClassNotification)(GDExtensionClassInstancePtr p_instance, int32_t p_what);
|
||||
typedef void (*GDNativeExtensionClassToString)(GDExtensionClassInstancePtr p_instance, GDNativeBool *r_is_valid, GDNativeStringPtr p_out);
|
||||
typedef void (*GDNativeExtensionClassReference)(GDExtensionClassInstancePtr p_instance);
|
||||
typedef void (*GDNativeExtensionClassUnreference)(GDExtensionClassInstancePtr p_instance);
|
||||
typedef void (*GDNativeExtensionClassCallVirtual)(GDExtensionClassInstancePtr p_instance, GDNativeConstTypePtr *p_args, GDNativeTypePtr r_ret);
|
||||
typedef GDNativeObjectPtr (*GDNativeExtensionClassCreateInstance)(void *p_userdata);
|
||||
typedef void (*GDNativeExtensionClassFreeInstance)(void *p_userdata, GDExtensionClassInstancePtr p_instance);
|
||||
typedef GDNativeExtensionClassCallVirtual (*GDNativeExtensionClassGetVirtual)(void *p_userdata, GDNativeConstStringNamePtr p_name);
|
||||
|
||||
typedef struct {
|
||||
GDNativeBool is_virtual;
|
||||
GDNativeBool is_abstract;
|
||||
GDNativeExtensionClassSet set_func;
|
||||
GDNativeExtensionClassGet get_func;
|
||||
GDNativeExtensionClassGetPropertyList get_property_list_func;
|
||||
GDNativeExtensionClassFreePropertyList free_property_list_func;
|
||||
GDNativeExtensionClassPropertyCanRevert property_can_revert_func;
|
||||
GDNativeExtensionClassPropertyGetRevert property_get_revert_func;
|
||||
GDNativeExtensionClassNotification notification_func;
|
||||
GDNativeExtensionClassToString to_string_func;
|
||||
GDNativeExtensionClassReference reference_func;
|
||||
GDNativeExtensionClassUnreference unreference_func;
|
||||
GDNativeExtensionClassCreateInstance create_instance_func; // (Default) constructor; mandatory. If the class is not instantiable, consider making it virtual or abstract.
|
||||
GDNativeExtensionClassFreeInstance free_instance_func; // Destructor; mandatory.
|
||||
GDNativeExtensionClassGetVirtual get_virtual_func; // Queries a virtual function by name and returns a callback to invoke the requested virtual function.
|
||||
GDNativeExtensionClassGetRID get_rid_func;
|
||||
void *class_userdata; // Per-class user data, later accessible in instance bindings.
|
||||
} GDNativeExtensionClassCreationInfo;
|
||||
|
||||
typedef void *GDNativeExtensionClassLibraryPtr;
|
||||
|
||||
/* Method */
|
||||
|
||||
typedef enum {
|
||||
GDNATIVE_EXTENSION_METHOD_FLAG_NORMAL = 1,
|
||||
GDNATIVE_EXTENSION_METHOD_FLAG_EDITOR = 2,
|
||||
GDNATIVE_EXTENSION_METHOD_FLAG_CONST = 4,
|
||||
GDNATIVE_EXTENSION_METHOD_FLAG_VIRTUAL = 8,
|
||||
GDNATIVE_EXTENSION_METHOD_FLAG_VARARG = 16,
|
||||
GDNATIVE_EXTENSION_METHOD_FLAG_STATIC = 32,
|
||||
GDNATIVE_EXTENSION_METHOD_FLAGS_DEFAULT = GDNATIVE_EXTENSION_METHOD_FLAG_NORMAL,
|
||||
} GDNativeExtensionClassMethodFlags;
|
||||
|
||||
typedef enum {
|
||||
GDNATIVE_EXTENSION_METHOD_ARGUMENT_METADATA_NONE,
|
||||
GDNATIVE_EXTENSION_METHOD_ARGUMENT_METADATA_INT_IS_INT8,
|
||||
GDNATIVE_EXTENSION_METHOD_ARGUMENT_METADATA_INT_IS_INT16,
|
||||
GDNATIVE_EXTENSION_METHOD_ARGUMENT_METADATA_INT_IS_INT32,
|
||||
GDNATIVE_EXTENSION_METHOD_ARGUMENT_METADATA_INT_IS_INT64,
|
||||
GDNATIVE_EXTENSION_METHOD_ARGUMENT_METADATA_INT_IS_UINT8,
|
||||
GDNATIVE_EXTENSION_METHOD_ARGUMENT_METADATA_INT_IS_UINT16,
|
||||
GDNATIVE_EXTENSION_METHOD_ARGUMENT_METADATA_INT_IS_UINT32,
|
||||
GDNATIVE_EXTENSION_METHOD_ARGUMENT_METADATA_INT_IS_UINT64,
|
||||
GDNATIVE_EXTENSION_METHOD_ARGUMENT_METADATA_REAL_IS_FLOAT,
|
||||
GDNATIVE_EXTENSION_METHOD_ARGUMENT_METADATA_REAL_IS_DOUBLE
|
||||
} GDNativeExtensionClassMethodArgumentMetadata;
|
||||
|
||||
typedef void (*GDNativeExtensionClassMethodCall)(void *method_userdata, GDExtensionClassInstancePtr p_instance, GDNativeConstVariantPtr *p_args, GDNativeInt p_argument_count, GDNativeVariantPtr r_return, GDNativeCallError *r_error);
|
||||
typedef void (*GDNativeExtensionClassMethodPtrCall)(void *method_userdata, GDExtensionClassInstancePtr p_instance, GDNativeConstTypePtr *p_args, GDNativeTypePtr r_ret);
|
||||
|
||||
typedef struct {
|
||||
GDNativeStringNamePtr name;
|
||||
void *method_userdata;
|
||||
GDNativeExtensionClassMethodCall call_func;
|
||||
GDNativeExtensionClassMethodPtrCall ptrcall_func;
|
||||
uint32_t method_flags; // Bitfield of `GDNativeExtensionClassMethodFlags`.
|
||||
|
||||
/* If `has_return_value` is false, `return_value_info` and `return_value_metadata` are ignored. */
|
||||
GDNativeBool has_return_value;
|
||||
GDNativePropertyInfo *return_value_info;
|
||||
GDNativeExtensionClassMethodArgumentMetadata 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.
|
||||
*/
|
||||
uint32_t argument_count;
|
||||
GDNativePropertyInfo *arguments_info;
|
||||
GDNativeExtensionClassMethodArgumentMetadata *arguments_metadata;
|
||||
|
||||
/* Default arguments: `default_arguments` is an array of size `default_argument_count`. */
|
||||
uint32_t default_argument_count;
|
||||
GDNativeVariantPtr *default_arguments;
|
||||
} GDNativeExtensionClassMethodInfo;
|
||||
|
||||
/* SCRIPT INSTANCE EXTENSION */
|
||||
|
||||
typedef void *GDNativeExtensionScriptInstanceDataPtr; // Pointer to custom ScriptInstance native implementation.
|
||||
|
||||
typedef GDNativeBool (*GDNativeExtensionScriptInstanceSet)(GDNativeExtensionScriptInstanceDataPtr p_instance, GDNativeConstStringNamePtr p_name, GDNativeConstVariantPtr p_value);
|
||||
typedef GDNativeBool (*GDNativeExtensionScriptInstanceGet)(GDNativeExtensionScriptInstanceDataPtr p_instance, GDNativeConstStringNamePtr p_name, GDNativeVariantPtr r_ret);
|
||||
typedef const GDNativePropertyInfo *(*GDNativeExtensionScriptInstanceGetPropertyList)(GDNativeExtensionScriptInstanceDataPtr p_instance, uint32_t *r_count);
|
||||
typedef void (*GDNativeExtensionScriptInstanceFreePropertyList)(GDNativeExtensionScriptInstanceDataPtr p_instance, const GDNativePropertyInfo *p_list);
|
||||
typedef GDNativeVariantType (*GDNativeExtensionScriptInstanceGetPropertyType)(GDNativeExtensionScriptInstanceDataPtr p_instance, GDNativeConstStringNamePtr p_name, GDNativeBool *r_is_valid);
|
||||
|
||||
typedef GDNativeBool (*GDNativeExtensionScriptInstancePropertyCanRevert)(GDNativeExtensionScriptInstanceDataPtr p_instance, GDNativeConstStringNamePtr p_name);
|
||||
typedef GDNativeBool (*GDNativeExtensionScriptInstancePropertyGetRevert)(GDNativeExtensionScriptInstanceDataPtr p_instance, GDNativeConstStringNamePtr p_name, GDNativeVariantPtr r_ret);
|
||||
|
||||
typedef GDNativeObjectPtr (*GDNativeExtensionScriptInstanceGetOwner)(GDNativeExtensionScriptInstanceDataPtr p_instance);
|
||||
typedef void (*GDNativeExtensionScriptInstancePropertyStateAdd)(GDNativeConstStringNamePtr p_name, GDNativeConstVariantPtr p_value, void *p_userdata);
|
||||
typedef void (*GDNativeExtensionScriptInstanceGetPropertyState)(GDNativeExtensionScriptInstanceDataPtr p_instance, GDNativeExtensionScriptInstancePropertyStateAdd p_add_func, void *p_userdata);
|
||||
|
||||
typedef const GDNativeMethodInfo *(*GDNativeExtensionScriptInstanceGetMethodList)(GDNativeExtensionScriptInstanceDataPtr p_instance, uint32_t *r_count);
|
||||
typedef void (*GDNativeExtensionScriptInstanceFreeMethodList)(GDNativeExtensionScriptInstanceDataPtr p_instance, const GDNativeMethodInfo *p_list);
|
||||
|
||||
typedef GDNativeBool (*GDNativeExtensionScriptInstanceHasMethod)(GDNativeExtensionScriptInstanceDataPtr p_instance, GDNativeConstStringNamePtr p_name);
|
||||
|
||||
typedef void (*GDNativeExtensionScriptInstanceCall)(GDNativeExtensionScriptInstanceDataPtr p_self, GDNativeConstStringNamePtr p_method, GDNativeConstVariantPtr *p_args, GDNativeInt p_argument_count, GDNativeVariantPtr r_return, GDNativeCallError *r_error);
|
||||
typedef void (*GDNativeExtensionScriptInstanceNotification)(GDNativeExtensionScriptInstanceDataPtr p_instance, int32_t p_what);
|
||||
typedef void (*GDNativeExtensionScriptInstanceToString)(GDNativeExtensionScriptInstanceDataPtr p_instance, GDNativeBool *r_is_valid, GDNativeStringPtr r_out);
|
||||
|
||||
typedef void (*GDNativeExtensionScriptInstanceRefCountIncremented)(GDNativeExtensionScriptInstanceDataPtr p_instance);
|
||||
typedef GDNativeBool (*GDNativeExtensionScriptInstanceRefCountDecremented)(GDNativeExtensionScriptInstanceDataPtr p_instance);
|
||||
|
||||
typedef GDNativeObjectPtr (*GDNativeExtensionScriptInstanceGetScript)(GDNativeExtensionScriptInstanceDataPtr p_instance);
|
||||
typedef GDNativeBool (*GDNativeExtensionScriptInstanceIsPlaceholder)(GDNativeExtensionScriptInstanceDataPtr p_instance);
|
||||
|
||||
typedef void *GDNativeExtensionScriptLanguagePtr;
|
||||
|
||||
typedef GDNativeExtensionScriptLanguagePtr (*GDNativeExtensionScriptInstanceGetLanguage)(GDNativeExtensionScriptInstanceDataPtr p_instance);
|
||||
|
||||
typedef void (*GDNativeExtensionScriptInstanceFree)(GDNativeExtensionScriptInstanceDataPtr p_instance);
|
||||
|
||||
typedef void *GDNativeScriptInstancePtr; // Pointer to ScriptInstance.
|
||||
|
||||
typedef struct {
|
||||
GDNativeExtensionScriptInstanceSet set_func;
|
||||
GDNativeExtensionScriptInstanceGet get_func;
|
||||
GDNativeExtensionScriptInstanceGetPropertyList get_property_list_func;
|
||||
GDNativeExtensionScriptInstanceFreePropertyList free_property_list_func;
|
||||
|
||||
GDNativeExtensionScriptInstancePropertyCanRevert property_can_revert_func;
|
||||
GDNativeExtensionScriptInstancePropertyGetRevert property_get_revert_func;
|
||||
|
||||
GDNativeExtensionScriptInstanceGetOwner get_owner_func;
|
||||
GDNativeExtensionScriptInstanceGetPropertyState get_property_state_func;
|
||||
|
||||
GDNativeExtensionScriptInstanceGetMethodList get_method_list_func;
|
||||
GDNativeExtensionScriptInstanceFreeMethodList free_method_list_func;
|
||||
GDNativeExtensionScriptInstanceGetPropertyType get_property_type_func;
|
||||
|
||||
GDNativeExtensionScriptInstanceHasMethod has_method_func;
|
||||
|
||||
GDNativeExtensionScriptInstanceCall call_func;
|
||||
GDNativeExtensionScriptInstanceNotification notification_func;
|
||||
|
||||
GDNativeExtensionScriptInstanceToString to_string_func;
|
||||
|
||||
GDNativeExtensionScriptInstanceRefCountIncremented refcount_incremented_func;
|
||||
GDNativeExtensionScriptInstanceRefCountDecremented refcount_decremented_func;
|
||||
|
||||
GDNativeExtensionScriptInstanceGetScript get_script_func;
|
||||
|
||||
GDNativeExtensionScriptInstanceIsPlaceholder is_placeholder_func;
|
||||
|
||||
GDNativeExtensionScriptInstanceSet set_fallback_func;
|
||||
GDNativeExtensionScriptInstanceGet get_fallback_func;
|
||||
|
||||
GDNativeExtensionScriptInstanceGetLanguage get_language_func;
|
||||
|
||||
GDNativeExtensionScriptInstanceFree free_func;
|
||||
|
||||
} GDNativeExtensionScriptInstanceInfo;
|
||||
|
||||
/* INTERFACE */
|
||||
|
||||
typedef struct {
|
||||
uint32_t version_major;
|
||||
uint32_t version_minor;
|
||||
uint32_t version_patch;
|
||||
const char *version_string;
|
||||
|
||||
/* GODOT CORE */
|
||||
|
||||
void *(*mem_alloc)(size_t p_bytes);
|
||||
void *(*mem_realloc)(void *p_ptr, size_t p_bytes);
|
||||
void (*mem_free)(void *p_ptr);
|
||||
|
||||
void (*print_error)(const char *p_description, const char *p_function, const char *p_file, int32_t p_line);
|
||||
void (*print_warning)(const char *p_description, const char *p_function, const char *p_file, int32_t p_line);
|
||||
void (*print_script_error)(const char *p_description, const char *p_function, const char *p_file, int32_t p_line);
|
||||
|
||||
uint64_t (*get_native_struct_size)(GDNativeConstStringNamePtr p_name);
|
||||
|
||||
/* GODOT VARIANT */
|
||||
|
||||
/* variant general */
|
||||
void (*variant_new_copy)(GDNativeVariantPtr r_dest, GDNativeConstVariantPtr p_src);
|
||||
void (*variant_new_nil)(GDNativeVariantPtr r_dest);
|
||||
void (*variant_destroy)(GDNativeVariantPtr p_self);
|
||||
|
||||
/* variant type */
|
||||
void (*variant_call)(GDNativeVariantPtr p_self, GDNativeConstStringNamePtr p_method, GDNativeConstVariantPtr *p_args, GDNativeInt p_argument_count, GDNativeVariantPtr r_return, GDNativeCallError *r_error);
|
||||
void (*variant_call_static)(GDNativeVariantType p_type, GDNativeConstStringNamePtr p_method, GDNativeConstVariantPtr *p_args, GDNativeInt p_argument_count, GDNativeVariantPtr r_return, GDNativeCallError *r_error);
|
||||
void (*variant_evaluate)(GDNativeVariantOperator p_op, GDNativeConstVariantPtr p_a, GDNativeConstVariantPtr p_b, GDNativeVariantPtr r_return, GDNativeBool *r_valid);
|
||||
void (*variant_set)(GDNativeVariantPtr p_self, GDNativeConstVariantPtr p_key, GDNativeConstVariantPtr p_value, GDNativeBool *r_valid);
|
||||
void (*variant_set_named)(GDNativeVariantPtr p_self, GDNativeConstStringNamePtr p_key, GDNativeConstVariantPtr p_value, GDNativeBool *r_valid);
|
||||
void (*variant_set_keyed)(GDNativeVariantPtr p_self, GDNativeConstVariantPtr p_key, GDNativeConstVariantPtr p_value, GDNativeBool *r_valid);
|
||||
void (*variant_set_indexed)(GDNativeVariantPtr p_self, GDNativeInt p_index, GDNativeConstVariantPtr p_value, GDNativeBool *r_valid, GDNativeBool *r_oob);
|
||||
void (*variant_get)(GDNativeConstVariantPtr p_self, GDNativeConstVariantPtr p_key, GDNativeVariantPtr r_ret, GDNativeBool *r_valid);
|
||||
void (*variant_get_named)(GDNativeConstVariantPtr p_self, GDNativeConstStringNamePtr p_key, GDNativeVariantPtr r_ret, GDNativeBool *r_valid);
|
||||
void (*variant_get_keyed)(GDNativeConstVariantPtr p_self, GDNativeConstVariantPtr p_key, GDNativeVariantPtr r_ret, GDNativeBool *r_valid);
|
||||
void (*variant_get_indexed)(GDNativeConstVariantPtr p_self, GDNativeInt p_index, GDNativeVariantPtr r_ret, GDNativeBool *r_valid, GDNativeBool *r_oob);
|
||||
GDNativeBool (*variant_iter_init)(GDNativeConstVariantPtr p_self, GDNativeVariantPtr r_iter, GDNativeBool *r_valid);
|
||||
GDNativeBool (*variant_iter_next)(GDNativeConstVariantPtr p_self, GDNativeVariantPtr r_iter, GDNativeBool *r_valid);
|
||||
void (*variant_iter_get)(GDNativeConstVariantPtr p_self, GDNativeVariantPtr r_iter, GDNativeVariantPtr r_ret, GDNativeBool *r_valid);
|
||||
GDNativeInt (*variant_hash)(GDNativeConstVariantPtr p_self);
|
||||
GDNativeInt (*variant_recursive_hash)(GDNativeConstVariantPtr p_self, GDNativeInt p_recursion_count);
|
||||
GDNativeBool (*variant_hash_compare)(GDNativeConstVariantPtr p_self, GDNativeConstVariantPtr p_other);
|
||||
GDNativeBool (*variant_booleanize)(GDNativeConstVariantPtr p_self);
|
||||
void (*variant_duplicate)(GDNativeConstVariantPtr p_self, GDNativeVariantPtr r_ret, GDNativeBool p_deep);
|
||||
void (*variant_stringify)(GDNativeConstVariantPtr p_self, GDNativeStringPtr r_ret);
|
||||
|
||||
GDNativeVariantType (*variant_get_type)(GDNativeConstVariantPtr p_self);
|
||||
GDNativeBool (*variant_has_method)(GDNativeConstVariantPtr p_self, GDNativeConstStringNamePtr p_method);
|
||||
GDNativeBool (*variant_has_member)(GDNativeVariantType p_type, GDNativeConstStringNamePtr p_member);
|
||||
GDNativeBool (*variant_has_key)(GDNativeConstVariantPtr p_self, GDNativeConstVariantPtr p_key, GDNativeBool *r_valid);
|
||||
void (*variant_get_type_name)(GDNativeVariantType p_type, GDNativeStringPtr r_name);
|
||||
GDNativeBool (*variant_can_convert)(GDNativeVariantType p_from, GDNativeVariantType p_to);
|
||||
GDNativeBool (*variant_can_convert_strict)(GDNativeVariantType p_from, GDNativeVariantType p_to);
|
||||
|
||||
/* ptrcalls */
|
||||
GDNativeVariantFromTypeConstructorFunc (*get_variant_from_type_constructor)(GDNativeVariantType p_type);
|
||||
GDNativeTypeFromVariantConstructorFunc (*get_variant_to_type_constructor)(GDNativeVariantType p_type);
|
||||
GDNativePtrOperatorEvaluator (*variant_get_ptr_operator_evaluator)(GDNativeVariantOperator p_operator, GDNativeVariantType p_type_a, GDNativeVariantType p_type_b);
|
||||
GDNativePtrBuiltInMethod (*variant_get_ptr_builtin_method)(GDNativeVariantType p_type, GDNativeConstStringNamePtr p_method, GDNativeInt p_hash);
|
||||
GDNativePtrConstructor (*variant_get_ptr_constructor)(GDNativeVariantType p_type, int32_t p_constructor);
|
||||
GDNativePtrDestructor (*variant_get_ptr_destructor)(GDNativeVariantType p_type);
|
||||
void (*variant_construct)(GDNativeVariantType p_type, GDNativeVariantPtr p_base, GDNativeConstVariantPtr *p_args, int32_t p_argument_count, GDNativeCallError *r_error);
|
||||
GDNativePtrSetter (*variant_get_ptr_setter)(GDNativeVariantType p_type, GDNativeConstStringNamePtr p_member);
|
||||
GDNativePtrGetter (*variant_get_ptr_getter)(GDNativeVariantType p_type, GDNativeConstStringNamePtr p_member);
|
||||
GDNativePtrIndexedSetter (*variant_get_ptr_indexed_setter)(GDNativeVariantType p_type);
|
||||
GDNativePtrIndexedGetter (*variant_get_ptr_indexed_getter)(GDNativeVariantType p_type);
|
||||
GDNativePtrKeyedSetter (*variant_get_ptr_keyed_setter)(GDNativeVariantType p_type);
|
||||
GDNativePtrKeyedGetter (*variant_get_ptr_keyed_getter)(GDNativeVariantType p_type);
|
||||
GDNativePtrKeyedChecker (*variant_get_ptr_keyed_checker)(GDNativeVariantType p_type);
|
||||
void (*variant_get_constant_value)(GDNativeVariantType p_type, GDNativeConstStringNamePtr p_constant, GDNativeVariantPtr r_ret);
|
||||
GDNativePtrUtilityFunction (*variant_get_ptr_utility_function)(GDNativeConstStringNamePtr p_function, GDNativeInt p_hash);
|
||||
|
||||
/* extra utilities */
|
||||
void (*string_new_with_latin1_chars)(GDNativeStringPtr r_dest, const char *p_contents);
|
||||
void (*string_new_with_utf8_chars)(GDNativeStringPtr r_dest, const char *p_contents);
|
||||
void (*string_new_with_utf16_chars)(GDNativeStringPtr r_dest, const char16_t *p_contents);
|
||||
void (*string_new_with_utf32_chars)(GDNativeStringPtr r_dest, const char32_t *p_contents);
|
||||
void (*string_new_with_wide_chars)(GDNativeStringPtr r_dest, const wchar_t *p_contents);
|
||||
void (*string_new_with_latin1_chars_and_len)(GDNativeStringPtr r_dest, const char *p_contents, GDNativeInt p_size);
|
||||
void (*string_new_with_utf8_chars_and_len)(GDNativeStringPtr r_dest, const char *p_contents, GDNativeInt p_size);
|
||||
void (*string_new_with_utf16_chars_and_len)(GDNativeStringPtr r_dest, const char16_t *p_contents, GDNativeInt p_size);
|
||||
void (*string_new_with_utf32_chars_and_len)(GDNativeStringPtr r_dest, const char32_t *p_contents, GDNativeInt p_size);
|
||||
void (*string_new_with_wide_chars_and_len)(GDNativeStringPtr r_dest, const wchar_t *p_contents, GDNativeInt p_size);
|
||||
/* Information about the following functions:
|
||||
* - The return value is the resulting encoded string length.
|
||||
* - The length returned is in characters, not in bytes. It also does not include a trailing zero.
|
||||
* - These functions also do not write trailing zero, If you need it, write it yourself at the position indicated by the length (and make sure to allocate it).
|
||||
* - Passing NULL in r_text means only the length is computed (again, without including trailing zero).
|
||||
* - p_max_write_length argument is in characters, not bytes. It will be ignored if r_text is NULL.
|
||||
* - p_max_write_length argument does not affect the return value, it's only to cap write length.
|
||||
*/
|
||||
GDNativeInt (*string_to_latin1_chars)(GDNativeConstStringPtr p_self, char *r_text, GDNativeInt p_max_write_length);
|
||||
GDNativeInt (*string_to_utf8_chars)(GDNativeConstStringPtr p_self, char *r_text, GDNativeInt p_max_write_length);
|
||||
GDNativeInt (*string_to_utf16_chars)(GDNativeConstStringPtr p_self, char16_t *r_text, GDNativeInt p_max_write_length);
|
||||
GDNativeInt (*string_to_utf32_chars)(GDNativeConstStringPtr p_self, char32_t *r_text, GDNativeInt p_max_write_length);
|
||||
GDNativeInt (*string_to_wide_chars)(GDNativeConstStringPtr p_self, wchar_t *r_text, GDNativeInt p_max_write_length);
|
||||
char32_t *(*string_operator_index)(GDNativeStringPtr p_self, GDNativeInt p_index);
|
||||
const char32_t *(*string_operator_index_const)(GDNativeConstStringPtr p_self, GDNativeInt p_index);
|
||||
|
||||
/* Packed array functions */
|
||||
|
||||
uint8_t *(*packed_byte_array_operator_index)(GDNativeTypePtr p_self, GDNativeInt p_index); // p_self should be a PackedByteArray
|
||||
const uint8_t *(*packed_byte_array_operator_index_const)(GDNativeConstTypePtr p_self, GDNativeInt p_index); // p_self should be a PackedByteArray
|
||||
|
||||
GDNativeTypePtr (*packed_color_array_operator_index)(GDNativeTypePtr p_self, GDNativeInt p_index); // p_self should be a PackedColorArray, returns Color ptr
|
||||
GDNativeTypePtr (*packed_color_array_operator_index_const)(GDNativeConstTypePtr p_self, GDNativeInt p_index); // p_self should be a PackedColorArray, returns Color ptr
|
||||
|
||||
float *(*packed_float32_array_operator_index)(GDNativeTypePtr p_self, GDNativeInt p_index); // p_self should be a PackedFloat32Array
|
||||
const float *(*packed_float32_array_operator_index_const)(GDNativeConstTypePtr p_self, GDNativeInt p_index); // p_self should be a PackedFloat32Array
|
||||
double *(*packed_float64_array_operator_index)(GDNativeTypePtr p_self, GDNativeInt p_index); // p_self should be a PackedFloat64Array
|
||||
const double *(*packed_float64_array_operator_index_const)(GDNativeConstTypePtr p_self, GDNativeInt p_index); // p_self should be a PackedFloat64Array
|
||||
|
||||
int32_t *(*packed_int32_array_operator_index)(GDNativeTypePtr p_self, GDNativeInt p_index); // p_self should be a PackedInt32Array
|
||||
const int32_t *(*packed_int32_array_operator_index_const)(GDNativeConstTypePtr p_self, GDNativeInt p_index); // p_self should be a PackedInt32Array
|
||||
int64_t *(*packed_int64_array_operator_index)(GDNativeTypePtr p_self, GDNativeInt p_index); // p_self should be a PackedInt32Array
|
||||
const int64_t *(*packed_int64_array_operator_index_const)(GDNativeConstTypePtr p_self, GDNativeInt p_index); // p_self should be a PackedInt32Array
|
||||
|
||||
GDNativeStringPtr (*packed_string_array_operator_index)(GDNativeTypePtr p_self, GDNativeInt p_index); // p_self should be a PackedStringArray
|
||||
GDNativeStringPtr (*packed_string_array_operator_index_const)(GDNativeConstTypePtr p_self, GDNativeInt p_index); // p_self should be a PackedStringArray
|
||||
|
||||
GDNativeTypePtr (*packed_vector2_array_operator_index)(GDNativeTypePtr p_self, GDNativeInt p_index); // p_self should be a PackedVector2Array, returns Vector2 ptr
|
||||
GDNativeTypePtr (*packed_vector2_array_operator_index_const)(GDNativeConstTypePtr p_self, GDNativeInt p_index); // p_self should be a PackedVector2Array, returns Vector2 ptr
|
||||
GDNativeTypePtr (*packed_vector3_array_operator_index)(GDNativeTypePtr p_self, GDNativeInt p_index); // p_self should be a PackedVector3Array, returns Vector3 ptr
|
||||
GDNativeTypePtr (*packed_vector3_array_operator_index_const)(GDNativeConstTypePtr p_self, GDNativeInt p_index); // p_self should be a PackedVector3Array, returns Vector3 ptr
|
||||
|
||||
GDNativeVariantPtr (*array_operator_index)(GDNativeTypePtr p_self, GDNativeInt p_index); // p_self should be an Array ptr
|
||||
GDNativeVariantPtr (*array_operator_index_const)(GDNativeConstTypePtr p_self, GDNativeInt p_index); // p_self should be an Array ptr
|
||||
|
||||
/* Dictionary functions */
|
||||
|
||||
GDNativeVariantPtr (*dictionary_operator_index)(GDNativeTypePtr p_self, GDNativeConstVariantPtr p_key); // p_self should be an Dictionary ptr
|
||||
GDNativeVariantPtr (*dictionary_operator_index_const)(GDNativeConstTypePtr p_self, GDNativeConstVariantPtr p_key); // p_self should be an Dictionary ptr
|
||||
|
||||
/* OBJECT */
|
||||
|
||||
void (*object_method_bind_call)(GDNativeMethodBindPtr p_method_bind, GDNativeObjectPtr p_instance, GDNativeConstVariantPtr *p_args, GDNativeInt p_arg_count, GDNativeVariantPtr r_ret, GDNativeCallError *r_error);
|
||||
void (*object_method_bind_ptrcall)(GDNativeMethodBindPtr p_method_bind, GDNativeObjectPtr p_instance, GDNativeConstTypePtr *p_args, GDNativeTypePtr r_ret);
|
||||
void (*object_destroy)(GDNativeObjectPtr p_o);
|
||||
GDNativeObjectPtr (*global_get_singleton)(GDNativeConstStringNamePtr p_name);
|
||||
|
||||
void *(*object_get_instance_binding)(GDNativeObjectPtr p_o, void *p_token, const GDNativeInstanceBindingCallbacks *p_callbacks);
|
||||
void (*object_set_instance_binding)(GDNativeObjectPtr p_o, void *p_token, void *p_binding, const GDNativeInstanceBindingCallbacks *p_callbacks);
|
||||
|
||||
void (*object_set_instance)(GDNativeObjectPtr p_o, GDNativeConstStringNamePtr p_classname, GDExtensionClassInstancePtr p_instance); /* p_classname should be a registered extension class and should extend the p_o object's class. */
|
||||
|
||||
GDNativeObjectPtr (*object_cast_to)(GDNativeConstObjectPtr p_object, void *p_class_tag);
|
||||
GDNativeObjectPtr (*object_get_instance_from_id)(GDObjectInstanceID p_instance_id);
|
||||
GDObjectInstanceID (*object_get_instance_id)(GDNativeConstObjectPtr p_object);
|
||||
|
||||
/* SCRIPT INSTANCE */
|
||||
|
||||
GDNativeScriptInstancePtr (*script_instance_create)(const GDNativeExtensionScriptInstanceInfo *p_info, GDNativeExtensionScriptInstanceDataPtr p_instance_data);
|
||||
|
||||
/* CLASSDB */
|
||||
|
||||
GDNativeObjectPtr (*classdb_construct_object)(GDNativeConstStringNamePtr p_classname); /* The passed class must be a built-in godot class, or an already-registered extension class. In both case, object_set_instance should be called to fully initialize the object. */
|
||||
GDNativeMethodBindPtr (*classdb_get_method_bind)(GDNativeConstStringNamePtr p_classname, GDNativeConstStringNamePtr p_methodname, GDNativeInt p_hash);
|
||||
void *(*classdb_get_class_tag)(GDNativeConstStringNamePtr p_classname);
|
||||
|
||||
/* CLASSDB EXTENSION */
|
||||
|
||||
/* Provided parameters for `classdb_register_extension_*` can be safely freed once the function returns. */
|
||||
void (*classdb_register_extension_class)(GDNativeExtensionClassLibraryPtr p_library, GDNativeConstStringNamePtr p_class_name, GDNativeConstStringNamePtr p_parent_class_name, const GDNativeExtensionClassCreationInfo *p_extension_funcs);
|
||||
void (*classdb_register_extension_class_method)(GDNativeExtensionClassLibraryPtr p_library, GDNativeConstStringNamePtr p_class_name, const GDNativeExtensionClassMethodInfo *p_method_info);
|
||||
void (*classdb_register_extension_class_integer_constant)(GDNativeExtensionClassLibraryPtr p_library, GDNativeConstStringNamePtr p_class_name, GDNativeConstStringNamePtr p_enum_name, GDNativeConstStringNamePtr p_constant_name, GDNativeInt p_constant_value, GDNativeBool p_is_bitfield);
|
||||
void (*classdb_register_extension_class_property)(GDNativeExtensionClassLibraryPtr p_library, GDNativeConstStringNamePtr p_class_name, const GDNativePropertyInfo *p_info, GDNativeConstStringNamePtr p_setter, GDNativeConstStringNamePtr p_getter);
|
||||
void (*classdb_register_extension_class_property_group)(GDNativeExtensionClassLibraryPtr p_library, GDNativeConstStringNamePtr p_class_name, GDNativeConstStringPtr p_group_name, GDNativeConstStringPtr p_prefix);
|
||||
void (*classdb_register_extension_class_property_subgroup)(GDNativeExtensionClassLibraryPtr p_library, GDNativeConstStringNamePtr p_class_name, GDNativeConstStringPtr p_subgroup_name, GDNativeConstStringPtr p_prefix);
|
||||
void (*classdb_register_extension_class_signal)(GDNativeExtensionClassLibraryPtr p_library, GDNativeConstStringNamePtr p_class_name, GDNativeConstStringNamePtr p_signal_name, const GDNativePropertyInfo *p_argument_info, GDNativeInt p_argument_count);
|
||||
void (*classdb_unregister_extension_class)(GDNativeExtensionClassLibraryPtr p_library, GDNativeConstStringNamePtr p_class_name); /* Unregistering a parent class before a class that inherits it will result in failure. Inheritors must be unregistered first. */
|
||||
|
||||
void (*get_library_path)(GDNativeExtensionClassLibraryPtr p_library, GDNativeStringPtr r_path);
|
||||
|
||||
} GDNativeInterface;
|
||||
|
||||
/* INITIALIZATION */
|
||||
|
||||
typedef enum {
|
||||
GDNATIVE_INITIALIZATION_CORE,
|
||||
GDNATIVE_INITIALIZATION_SERVERS,
|
||||
GDNATIVE_INITIALIZATION_SCENE,
|
||||
GDNATIVE_INITIALIZATION_EDITOR,
|
||||
GDNATIVE_MAX_INITIALIZATION_LEVEL,
|
||||
} GDNativeInitializationLevel;
|
||||
|
||||
typedef struct {
|
||||
/* Minimum initialization level required.
|
||||
* If Core or Servers, the extension needs editor or game restart to take effect */
|
||||
GDNativeInitializationLevel minimum_initialization_level;
|
||||
/* Up to the user to supply when initializing */
|
||||
void *userdata;
|
||||
/* This function will be called multiple times for each initialization level. */
|
||||
void (*initialize)(void *userdata, GDNativeInitializationLevel p_level);
|
||||
void (*deinitialize)(void *userdata, GDNativeInitializationLevel p_level);
|
||||
} GDNativeInitialization;
|
||||
|
||||
/* Define a C function prototype that implements the function below and expose it to dlopen() (or similar).
|
||||
* This is the entry point of the GDExtension library and will be called on initialization.
|
||||
* It can be used to set up different init levels, which are called during various stages of initialization/shutdown.
|
||||
* The function name must be a unique one specified in the .gdextension config file.
|
||||
*/
|
||||
typedef GDNativeBool (*GDNativeInitializationFunction)(const GDNativeInterface *p_interface, GDNativeExtensionClassLibraryPtr p_library, GDNativeInitialization *r_initialization);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif // GDNATIVE_INTERFACE_H
|
|
@ -240,7 +240,7 @@ public:
|
|||
template <class T>
|
||||
struct PtrToArg<Ref<T>> {
|
||||
_FORCE_INLINE_ static Ref<T> convert(const void *p_ptr) {
|
||||
return Ref<T>(reinterpret_cast<T *>(godot::internal::gdn_interface->object_get_instance_binding(*reinterpret_cast<GDNativeObjectPtr *>(const_cast<void *>(p_ptr)), godot::internal::token, &T::___binding_callbacks)));
|
||||
return Ref<T>(reinterpret_cast<T *>(godot::internal::gde_interface->object_get_instance_binding(*reinterpret_cast<GDExtensionObjectPtr *>(const_cast<void *>(p_ptr)), godot::internal::token, &T::___binding_callbacks)));
|
||||
}
|
||||
|
||||
typedef Ref<T> EncodeT;
|
||||
|
@ -255,14 +255,14 @@ struct PtrToArg<const Ref<T> &> {
|
|||
typedef Ref<T> EncodeT;
|
||||
|
||||
_FORCE_INLINE_ static Ref<T> convert(const void *p_ptr) {
|
||||
return Ref<T>(reinterpret_cast<T *>(godot::internal::gdn_interface->object_get_instance_binding(*reinterpret_cast<GDNativeObjectPtr *>(const_cast<void *>(p_ptr)), godot::internal::token, &T::___binding_callbacks)));
|
||||
return Ref<T>(reinterpret_cast<T *>(godot::internal::gde_interface->object_get_instance_binding(*reinterpret_cast<GDExtensionObjectPtr *>(const_cast<void *>(p_ptr)), godot::internal::token, &T::___binding_callbacks)));
|
||||
}
|
||||
};
|
||||
|
||||
template <class T>
|
||||
struct GetTypeInfo<Ref<T>, typename EnableIf<TypeInherits<RefCounted, T>::value>::type> {
|
||||
static const GDNativeVariantType VARIANT_TYPE = GDNATIVE_VARIANT_TYPE_OBJECT;
|
||||
static const GDNativeExtensionClassMethodArgumentMetadata METADATA = GDNATIVE_EXTENSION_METHOD_ARGUMENT_METADATA_NONE;
|
||||
static const GDExtensionVariantType VARIANT_TYPE = GDEXTENSION_VARIANT_TYPE_OBJECT;
|
||||
static const GDExtensionClassMethodArgumentMetadata METADATA = GDEXTENSION_METHOD_ARGUMENT_METADATA_NONE;
|
||||
|
||||
static inline PropertyInfo get_class_info() {
|
||||
return make_property_info(Variant::Type::OBJECT, T::get_class_static());
|
||||
|
@ -271,8 +271,8 @@ struct GetTypeInfo<Ref<T>, typename EnableIf<TypeInherits<RefCounted, T>::value>
|
|||
|
||||
template <class T>
|
||||
struct GetTypeInfo<const Ref<T> &, typename EnableIf<TypeInherits<RefCounted, T>::value>::type> {
|
||||
static const GDNativeVariantType VARIANT_TYPE = GDNATIVE_VARIANT_TYPE_OBJECT;
|
||||
static const GDNativeExtensionClassMethodArgumentMetadata METADATA = GDNATIVE_EXTENSION_METHOD_ARGUMENT_METADATA_NONE;
|
||||
static const GDExtensionVariantType VARIANT_TYPE = GDEXTENSION_VARIANT_TYPE_OBJECT;
|
||||
static const GDExtensionClassMethodArgumentMetadata METADATA = GDEXTENSION_METHOD_ARGUMENT_METADATA_NONE;
|
||||
|
||||
static inline PropertyInfo get_class_info() {
|
||||
return make_property_info(Variant::Type::OBJECT, T::get_class_static());
|
||||
|
|
|
@ -50,7 +50,7 @@ class Wrapped {
|
|||
|
||||
protected:
|
||||
virtual const StringName *_get_extension_class_name() const; // This is needed to retrieve the class name before the godot object has its _extension and _extension_instance members assigned.
|
||||
virtual const GDNativeInstanceBindingCallbacks *_get_bindings_callbacks() const = 0;
|
||||
virtual const GDExtensionInstanceBindingCallbacks *_get_bindings_callbacks() const = 0;
|
||||
|
||||
void _notification(int p_what) {}
|
||||
bool _set(const StringName &p_name, const Variant &p_property) { return false; }
|
||||
|
@ -61,16 +61,16 @@ protected:
|
|||
String _to_string() const { return "[" + String(get_class_static()) + ":" + itos(get_instance_id()) + "]"; }
|
||||
|
||||
static void notification_bind(GDExtensionClassInstancePtr p_instance, int32_t p_what) {}
|
||||
static GDNativeBool set_bind(GDExtensionClassInstancePtr p_instance, GDNativeConstStringNamePtr p_name, GDNativeConstVariantPtr p_value) { return false; }
|
||||
static GDNativeBool get_bind(GDExtensionClassInstancePtr p_instance, GDNativeConstStringNamePtr p_name, GDNativeVariantPtr r_ret) { return false; }
|
||||
static const GDNativePropertyInfo *get_property_list_bind(GDExtensionClassInstancePtr p_instance, uint32_t *r_count) { return nullptr; }
|
||||
static void free_property_list_bind(GDExtensionClassInstancePtr p_instance, const GDNativePropertyInfo *p_list) {}
|
||||
static GDNativeBool property_can_revert_bind(GDExtensionClassInstancePtr p_instance, GDNativeConstStringNamePtr p_name) { return false; }
|
||||
static GDNativeBool property_get_revert_bind(GDExtensionClassInstancePtr p_instance, GDNativeConstStringNamePtr p_name, GDNativeVariantPtr r_ret) { return false; }
|
||||
static void to_string_bind(GDExtensionClassInstancePtr p_instance, GDNativeBool *r_is_valid, GDNativeStringPtr r_out) {}
|
||||
static GDExtensionBool set_bind(GDExtensionClassInstancePtr p_instance, GDExtensionConstStringNamePtr p_name, GDExtensionConstVariantPtr p_value) { return false; }
|
||||
static GDExtensionBool get_bind(GDExtensionClassInstancePtr p_instance, GDExtensionConstStringNamePtr p_name, GDExtensionVariantPtr r_ret) { return false; }
|
||||
static const GDExtensionPropertyInfo *get_property_list_bind(GDExtensionClassInstancePtr p_instance, uint32_t *r_count) { return nullptr; }
|
||||
static void free_property_list_bind(GDExtensionClassInstancePtr p_instance, const GDExtensionPropertyInfo *p_list) {}
|
||||
static GDExtensionBool property_can_revert_bind(GDExtensionClassInstancePtr p_instance, GDExtensionConstStringNamePtr p_name) { return false; }
|
||||
static GDExtensionBool property_get_revert_bind(GDExtensionClassInstancePtr p_instance, GDExtensionConstStringNamePtr p_name, GDExtensionVariantPtr r_ret) { return false; }
|
||||
static void to_string_bind(GDExtensionClassInstancePtr p_instance, GDExtensionBool *r_is_valid, GDExtensionStringPtr r_out) {}
|
||||
|
||||
::godot::List<::godot::PropertyInfo> plist_owned;
|
||||
GDNativePropertyInfo *plist = nullptr;
|
||||
GDExtensionPropertyInfo *plist = nullptr;
|
||||
uint32_t plist_size = 0;
|
||||
|
||||
void _postinitialize();
|
||||
|
@ -105,7 +105,7 @@ protected:
|
|||
return &string_name; \
|
||||
} \
|
||||
\
|
||||
virtual const GDNativeInstanceBindingCallbacks *_get_bindings_callbacks() const override { \
|
||||
virtual const GDExtensionInstanceBindingCallbacks *_get_bindings_callbacks() const override { \
|
||||
return &___binding_callbacks; \
|
||||
} \
|
||||
\
|
||||
|
@ -169,7 +169,7 @@ public:
|
|||
return m_inherits::get_class_static(); \
|
||||
} \
|
||||
\
|
||||
static GDNativeObjectPtr create(void *data) { \
|
||||
static GDExtensionObjectPtr create(void *data) { \
|
||||
m_class *new_object = memnew(m_class); \
|
||||
return new_object->_owner; \
|
||||
} \
|
||||
|
@ -184,7 +184,7 @@ public:
|
|||
} \
|
||||
} \
|
||||
\
|
||||
static GDNativeBool set_bind(GDExtensionClassInstancePtr p_instance, GDNativeConstStringNamePtr p_name, GDNativeConstVariantPtr p_value) { \
|
||||
static GDExtensionBool set_bind(GDExtensionClassInstancePtr p_instance, GDExtensionConstStringNamePtr p_name, GDExtensionConstVariantPtr p_value) { \
|
||||
if (p_instance && m_class::_get_set()) { \
|
||||
if (m_class::_get_set() != m_inherits::_get_set()) { \
|
||||
m_class *cls = reinterpret_cast<m_class *>(p_instance); \
|
||||
|
@ -195,7 +195,7 @@ public:
|
|||
return false; \
|
||||
} \
|
||||
\
|
||||
static GDNativeBool get_bind(GDExtensionClassInstancePtr p_instance, GDNativeConstStringNamePtr p_name, GDNativeVariantPtr r_ret) { \
|
||||
static GDExtensionBool get_bind(GDExtensionClassInstancePtr p_instance, GDExtensionConstStringNamePtr p_name, GDExtensionVariantPtr r_ret) { \
|
||||
if (p_instance && m_class::_get_get()) { \
|
||||
if (m_class::_get_get() != m_inherits::_get_get()) { \
|
||||
m_class *cls = reinterpret_cast<m_class *>(p_instance); \
|
||||
|
@ -206,16 +206,16 @@ public:
|
|||
return false; \
|
||||
} \
|
||||
\
|
||||
static const GDNativePropertyInfo *get_property_list_bind(GDExtensionClassInstancePtr p_instance, uint32_t *r_count) { \
|
||||
static const GDExtensionPropertyInfo *get_property_list_bind(GDExtensionClassInstancePtr p_instance, uint32_t *r_count) { \
|
||||
if (p_instance && m_class::_get_get_property_list()) { \
|
||||
if (m_class::_get_get_property_list() != m_inherits::_get_get_property_list()) { \
|
||||
m_class *cls = reinterpret_cast<m_class *>(p_instance); \
|
||||
ERR_FAIL_COND_V_MSG(!cls->plist_owned.is_empty() || cls->plist != nullptr || cls->plist_size != 0, nullptr, "Internal error, property list was not freed by engine!"); \
|
||||
cls->_get_property_list(&cls->plist_owned); \
|
||||
cls->plist = reinterpret_cast<GDNativePropertyInfo *>(memalloc(sizeof(GDNativePropertyInfo) * cls->plist_owned.size())); \
|
||||
cls->plist = reinterpret_cast<GDExtensionPropertyInfo *>(memalloc(sizeof(GDExtensionPropertyInfo) * cls->plist_owned.size())); \
|
||||
cls->plist_size = 0; \
|
||||
for (const ::godot::PropertyInfo &E : cls->plist_owned) { \
|
||||
cls->plist[cls->plist_size].type = static_cast<GDNativeVariantType>(E.type); \
|
||||
cls->plist[cls->plist_size].type = static_cast<GDExtensionVariantType>(E.type); \
|
||||
cls->plist[cls->plist_size].name = E.name._native_ptr(); \
|
||||
cls->plist[cls->plist_size].hint = E.hint; \
|
||||
cls->plist[cls->plist_size].hint_string = E.hint_string._native_ptr(); \
|
||||
|
@ -232,7 +232,7 @@ public:
|
|||
return nullptr; \
|
||||
} \
|
||||
\
|
||||
static void free_property_list_bind(GDExtensionClassInstancePtr p_instance, const GDNativePropertyInfo *p_list) { \
|
||||
static void free_property_list_bind(GDExtensionClassInstancePtr p_instance, const GDExtensionPropertyInfo *p_list) { \
|
||||
if (p_instance) { \
|
||||
m_class *cls = reinterpret_cast<m_class *>(p_instance); \
|
||||
ERR_FAIL_COND_MSG(cls->plist == nullptr, "Internal error, property list double free!"); \
|
||||
|
@ -243,7 +243,7 @@ public:
|
|||
} \
|
||||
} \
|
||||
\
|
||||
static GDNativeBool property_can_revert_bind(GDExtensionClassInstancePtr p_instance, GDNativeConstStringNamePtr p_name) { \
|
||||
static GDExtensionBool property_can_revert_bind(GDExtensionClassInstancePtr p_instance, GDExtensionConstStringNamePtr p_name) { \
|
||||
if (p_instance && m_class::_get_property_can_revert()) { \
|
||||
if (m_class::_get_property_can_revert() != m_inherits::_get_property_can_revert()) { \
|
||||
m_class *cls = reinterpret_cast<m_class *>(p_instance); \
|
||||
|
@ -254,7 +254,7 @@ public:
|
|||
return false; \
|
||||
} \
|
||||
\
|
||||
static GDNativeBool property_get_revert_bind(GDExtensionClassInstancePtr p_instance, GDNativeConstStringNamePtr p_name, GDNativeVariantPtr r_ret) { \
|
||||
static GDExtensionBool property_get_revert_bind(GDExtensionClassInstancePtr p_instance, GDExtensionConstStringNamePtr p_name, GDExtensionVariantPtr r_ret) { \
|
||||
if (p_instance && m_class::_get_property_get_revert()) { \
|
||||
if (m_class::_get_property_get_revert() != m_inherits::_get_property_get_revert()) { \
|
||||
m_class *cls = reinterpret_cast<m_class *>(p_instance); \
|
||||
|
@ -265,7 +265,7 @@ public:
|
|||
return false; \
|
||||
} \
|
||||
\
|
||||
static void to_string_bind(GDExtensionClassInstancePtr p_instance, GDNativeBool *r_is_valid, GDNativeStringPtr r_out) { \
|
||||
static void to_string_bind(GDExtensionClassInstancePtr p_instance, GDExtensionBool *r_is_valid, GDExtensionStringPtr r_out) { \
|
||||
if (p_instance && m_class::_get_to_string()) { \
|
||||
if (m_class::_get_to_string() != m_inherits::_get_to_string()) { \
|
||||
m_class *cls = reinterpret_cast<m_class *>(p_instance); \
|
||||
|
@ -292,23 +292,23 @@ public:
|
|||
static void ___binding_free_callback(void *p_token, void *p_instance, void *p_binding) { \
|
||||
} \
|
||||
\
|
||||
static GDNativeBool ___binding_reference_callback(void *p_token, void *p_instance, GDNativeBool p_reference) { \
|
||||
static GDExtensionBool ___binding_reference_callback(void *p_token, void *p_instance, GDExtensionBool p_reference) { \
|
||||
return true; \
|
||||
} \
|
||||
\
|
||||
static constexpr GDNativeInstanceBindingCallbacks ___binding_callbacks = { \
|
||||
static constexpr GDExtensionInstanceBindingCallbacks ___binding_callbacks = { \
|
||||
___binding_create_callback, \
|
||||
___binding_free_callback, \
|
||||
___binding_reference_callback, \
|
||||
};
|
||||
|
||||
// Don't use this for your classes, use GDCLASS() instead.
|
||||
#define GDNATIVE_CLASS(m_class, m_inherits) \
|
||||
#define GDEXTENSION_CLASS(m_class, m_inherits) \
|
||||
private: \
|
||||
void operator=(const m_class &p_rval) {} \
|
||||
\
|
||||
protected: \
|
||||
virtual const GDNativeInstanceBindingCallbacks *_get_bindings_callbacks() const override { \
|
||||
virtual const GDExtensionInstanceBindingCallbacks *_get_bindings_callbacks() const override { \
|
||||
return &___binding_callbacks; \
|
||||
} \
|
||||
\
|
||||
|
@ -368,10 +368,10 @@ public:
|
|||
reinterpret_cast<m_class *>(p_binding)->~m_class(); \
|
||||
Memory::free_static(reinterpret_cast<m_class *>(p_binding)); \
|
||||
} \
|
||||
static GDNativeBool ___binding_reference_callback(void *p_token, void *p_instance, GDNativeBool p_reference) { \
|
||||
static GDExtensionBool ___binding_reference_callback(void *p_token, void *p_instance, GDExtensionBool p_reference) { \
|
||||
return true; \
|
||||
} \
|
||||
static constexpr GDNativeInstanceBindingCallbacks ___binding_callbacks = { \
|
||||
static constexpr GDExtensionInstanceBindingCallbacks ___binding_callbacks = { \
|
||||
___binding_create_callback, \
|
||||
___binding_free_callback, \
|
||||
___binding_reference_callback, \
|
||||
|
|
|
@ -31,7 +31,7 @@
|
|||
#ifndef GODOT_BINDER_COMMON_HPP
|
||||
#define GODOT_BINDER_COMMON_HPP
|
||||
|
||||
#include <godot/gdnative_interface.h>
|
||||
#include <godot/gdextension_interface.h>
|
||||
|
||||
#include <godot_cpp/core/method_ptrcall.hpp>
|
||||
#include <godot_cpp/core/type_info.hpp>
|
||||
|
@ -125,11 +125,11 @@ struct VariantObjectClassChecker<const Ref<T> &> {
|
|||
|
||||
template <class T>
|
||||
struct VariantCasterAndValidate {
|
||||
static _FORCE_INLINE_ T cast(const Variant **p_args, uint32_t p_arg_idx, GDNativeCallError &r_error) {
|
||||
GDNativeVariantType argtype = GDNativeVariantType(GetTypeInfo<T>::VARIANT_TYPE);
|
||||
if (!internal::gdn_interface->variant_can_convert_strict(static_cast<GDNativeVariantType>(p_args[p_arg_idx]->get_type()), argtype) ||
|
||||
static _FORCE_INLINE_ T cast(const Variant **p_args, uint32_t p_arg_idx, GDExtensionCallError &r_error) {
|
||||
GDExtensionVariantType argtype = GDExtensionVariantType(GetTypeInfo<T>::VARIANT_TYPE);
|
||||
if (!internal::gde_interface->variant_can_convert_strict(static_cast<GDExtensionVariantType>(p_args[p_arg_idx]->get_type()), argtype) ||
|
||||
!VariantObjectClassChecker<T>::check(p_args[p_arg_idx])) {
|
||||
r_error.error = GDNATIVE_CALL_ERROR_INVALID_ARGUMENT;
|
||||
r_error.error = GDEXTENSION_CALL_ERROR_INVALID_ARGUMENT;
|
||||
r_error.argument = p_arg_idx;
|
||||
r_error.expected = argtype;
|
||||
}
|
||||
|
@ -140,11 +140,11 @@ struct VariantCasterAndValidate {
|
|||
|
||||
template <class T>
|
||||
struct VariantCasterAndValidate<T &> {
|
||||
static _FORCE_INLINE_ T cast(const Variant **p_args, uint32_t p_arg_idx, GDNativeCallError &r_error) {
|
||||
GDNativeVariantType argtype = GDNativeVariantType(GetTypeInfo<T>::VARIANT_TYPE);
|
||||
if (!internal::gdn_interface->variant_can_convert_strict(static_cast<GDNativeVariantType>(p_args[p_arg_idx]->get_type()), argtype) ||
|
||||
static _FORCE_INLINE_ T cast(const Variant **p_args, uint32_t p_arg_idx, GDExtensionCallError &r_error) {
|
||||
GDExtensionVariantType argtype = GDExtensionVariantType(GetTypeInfo<T>::VARIANT_TYPE);
|
||||
if (!internal::gde_interface->variant_can_convert_strict(static_cast<GDExtensionVariantType>(p_args[p_arg_idx]->get_type()), argtype) ||
|
||||
!VariantObjectClassChecker<T>::check(p_args[p_arg_idx])) {
|
||||
r_error.error = GDNATIVE_CALL_ERROR_INVALID_ARGUMENT;
|
||||
r_error.error = GDEXTENSION_CALL_ERROR_INVALID_ARGUMENT;
|
||||
r_error.argument = p_arg_idx;
|
||||
r_error.expected = argtype;
|
||||
}
|
||||
|
@ -155,11 +155,11 @@ struct VariantCasterAndValidate<T &> {
|
|||
|
||||
template <class T>
|
||||
struct VariantCasterAndValidate<const T &> {
|
||||
static _FORCE_INLINE_ T cast(const Variant **p_args, uint32_t p_arg_idx, GDNativeCallError &r_error) {
|
||||
GDNativeVariantType argtype = GDNativeVariantType(GetTypeInfo<T>::VARIANT_TYPE);
|
||||
if (!internal::gdn_interface->variant_can_convert_strict(static_cast<GDNativeVariantType>(p_args[p_arg_idx]->get_type()), argtype) ||
|
||||
static _FORCE_INLINE_ T cast(const Variant **p_args, uint32_t p_arg_idx, GDExtensionCallError &r_error) {
|
||||
GDExtensionVariantType argtype = GDExtensionVariantType(GetTypeInfo<T>::VARIANT_TYPE);
|
||||
if (!internal::gde_interface->variant_can_convert_strict(static_cast<GDExtensionVariantType>(p_args[p_arg_idx]->get_type()), argtype) ||
|
||||
!VariantObjectClassChecker<T>::check(p_args[p_arg_idx])) {
|
||||
r_error.error = GDNATIVE_CALL_ERROR_INVALID_ARGUMENT;
|
||||
r_error.error = GDEXTENSION_CALL_ERROR_INVALID_ARGUMENT;
|
||||
r_error.argument = p_arg_idx;
|
||||
r_error.expected = argtype;
|
||||
}
|
||||
|
@ -169,48 +169,48 @@ struct VariantCasterAndValidate<const T &> {
|
|||
};
|
||||
|
||||
template <class T, class... P, size_t... Is>
|
||||
void call_with_ptr_args_helper(T *p_instance, void (T::*p_method)(P...), GDNativeConstTypePtr *p_args, IndexSequence<Is...>) {
|
||||
void call_with_ptr_args_helper(T *p_instance, void (T::*p_method)(P...), GDExtensionConstTypePtr *p_args, IndexSequence<Is...>) {
|
||||
(p_instance->*p_method)(PtrToArg<P>::convert(p_args[Is])...);
|
||||
}
|
||||
|
||||
template <class T, class... P, size_t... Is>
|
||||
void call_with_ptr_argsc_helper(T *p_instance, void (T::*p_method)(P...) const, GDNativeConstTypePtr *p_args, IndexSequence<Is...>) {
|
||||
void call_with_ptr_argsc_helper(T *p_instance, void (T::*p_method)(P...) const, GDExtensionConstTypePtr *p_args, IndexSequence<Is...>) {
|
||||
(p_instance->*p_method)(PtrToArg<P>::convert(p_args[Is])...);
|
||||
}
|
||||
|
||||
template <class T, class R, class... P, size_t... Is>
|
||||
void call_with_ptr_args_ret_helper(T *p_instance, R (T::*p_method)(P...), GDNativeConstTypePtr *p_args, void *r_ret, IndexSequence<Is...>) {
|
||||
void call_with_ptr_args_ret_helper(T *p_instance, R (T::*p_method)(P...), GDExtensionConstTypePtr *p_args, void *r_ret, IndexSequence<Is...>) {
|
||||
PtrToArg<R>::encode((p_instance->*p_method)(PtrToArg<P>::convert(p_args[Is])...), r_ret);
|
||||
}
|
||||
|
||||
template <class T, class R, class... P, size_t... Is>
|
||||
void call_with_ptr_args_retc_helper(T *p_instance, R (T::*p_method)(P...) const, GDNativeConstTypePtr *p_args, void *r_ret, IndexSequence<Is...>) {
|
||||
void call_with_ptr_args_retc_helper(T *p_instance, R (T::*p_method)(P...) const, GDExtensionConstTypePtr *p_args, void *r_ret, IndexSequence<Is...>) {
|
||||
PtrToArg<R>::encode((p_instance->*p_method)(PtrToArg<P>::convert(p_args[Is])...), r_ret);
|
||||
}
|
||||
|
||||
template <class T, class... P>
|
||||
void call_with_ptr_args(T *p_instance, void (T::*p_method)(P...), GDNativeConstTypePtr *p_args, void * /*ret*/) {
|
||||
void call_with_ptr_args(T *p_instance, void (T::*p_method)(P...), GDExtensionConstTypePtr *p_args, void * /*ret*/) {
|
||||
call_with_ptr_args_helper<T, P...>(p_instance, p_method, p_args, BuildIndexSequence<sizeof...(P)>{});
|
||||
}
|
||||
|
||||
template <class T, class... P>
|
||||
void call_with_ptr_args(T *p_instance, void (T::*p_method)(P...) const, GDNativeConstTypePtr *p_args, void * /*ret*/) {
|
||||
void call_with_ptr_args(T *p_instance, void (T::*p_method)(P...) const, GDExtensionConstTypePtr *p_args, void * /*ret*/) {
|
||||
call_with_ptr_argsc_helper<T, P...>(p_instance, p_method, p_args, BuildIndexSequence<sizeof...(P)>{});
|
||||
}
|
||||
|
||||
template <class T, class R, class... P>
|
||||
void call_with_ptr_args(T *p_instance, R (T::*p_method)(P...), GDNativeConstTypePtr *p_args, void *r_ret) {
|
||||
void call_with_ptr_args(T *p_instance, R (T::*p_method)(P...), GDExtensionConstTypePtr *p_args, void *r_ret) {
|
||||
call_with_ptr_args_ret_helper<T, R, P...>(p_instance, p_method, p_args, r_ret, BuildIndexSequence<sizeof...(P)>{});
|
||||
}
|
||||
|
||||
template <class T, class R, class... P>
|
||||
void call_with_ptr_args(T *p_instance, R (T::*p_method)(P...) const, GDNativeConstTypePtr *p_args, void *r_ret) {
|
||||
void call_with_ptr_args(T *p_instance, R (T::*p_method)(P...) const, GDExtensionConstTypePtr *p_args, void *r_ret) {
|
||||
call_with_ptr_args_retc_helper<T, R, P...>(p_instance, p_method, p_args, r_ret, BuildIndexSequence<sizeof...(P)>{});
|
||||
}
|
||||
|
||||
template <class T, class... P, size_t... Is>
|
||||
void call_with_variant_args_helper(T *p_instance, void (T::*p_method)(P...), const Variant **p_args, GDNativeCallError &r_error, IndexSequence<Is...>) {
|
||||
r_error.error = GDNATIVE_CALL_OK;
|
||||
void call_with_variant_args_helper(T *p_instance, void (T::*p_method)(P...), const Variant **p_args, GDExtensionCallError &r_error, IndexSequence<Is...>) {
|
||||
r_error.error = GDEXTENSION_CALL_OK;
|
||||
|
||||
#ifdef DEBUG_METHODS_ENABLED
|
||||
(p_instance->*p_method)(VariantCasterAndValidate<P>::cast(p_args, Is, r_error)...);
|
||||
|
@ -221,8 +221,8 @@ void call_with_variant_args_helper(T *p_instance, void (T::*p_method)(P...), con
|
|||
}
|
||||
|
||||
template <class T, class... P, size_t... Is>
|
||||
void call_with_variant_argsc_helper(T *p_instance, void (T::*p_method)(P...) const, const Variant **p_args, GDNativeCallError &r_error, IndexSequence<Is...>) {
|
||||
r_error.error = GDNATIVE_CALL_OK;
|
||||
void call_with_variant_argsc_helper(T *p_instance, void (T::*p_method)(P...) const, const Variant **p_args, GDExtensionCallError &r_error, IndexSequence<Is...>) {
|
||||
r_error.error = GDEXTENSION_CALL_OK;
|
||||
|
||||
#ifdef DEBUG_METHODS_ENABLED
|
||||
(p_instance->*p_method)(VariantCasterAndValidate<P>::cast(p_args, Is, r_error)...);
|
||||
|
@ -233,8 +233,8 @@ void call_with_variant_argsc_helper(T *p_instance, void (T::*p_method)(P...) con
|
|||
}
|
||||
|
||||
template <class T, class R, class... P, size_t... Is>
|
||||
void call_with_variant_args_ret_helper(T *p_instance, R (T::*p_method)(P...), const Variant **p_args, Variant &r_ret, GDNativeCallError &r_error, IndexSequence<Is...>) {
|
||||
r_error.error = GDNATIVE_CALL_OK;
|
||||
void call_with_variant_args_ret_helper(T *p_instance, R (T::*p_method)(P...), const Variant **p_args, Variant &r_ret, GDExtensionCallError &r_error, IndexSequence<Is...>) {
|
||||
r_error.error = GDEXTENSION_CALL_OK;
|
||||
|
||||
#ifdef DEBUG_METHODS_ENABLED
|
||||
r_ret = (p_instance->*p_method)(VariantCasterAndValidate<P>::cast(p_args, Is, r_error)...);
|
||||
|
@ -244,8 +244,8 @@ void call_with_variant_args_ret_helper(T *p_instance, R (T::*p_method)(P...), co
|
|||
}
|
||||
|
||||
template <class T, class R, class... P, size_t... Is>
|
||||
void call_with_variant_args_retc_helper(T *p_instance, R (T::*p_method)(P...) const, const Variant **p_args, Variant &r_ret, GDNativeCallError &r_error, IndexSequence<Is...>) {
|
||||
r_error.error = GDNATIVE_CALL_OK;
|
||||
void call_with_variant_args_retc_helper(T *p_instance, R (T::*p_method)(P...) const, const Variant **p_args, Variant &r_ret, GDExtensionCallError &r_error, IndexSequence<Is...>) {
|
||||
r_error.error = GDEXTENSION_CALL_OK;
|
||||
|
||||
#ifdef DEBUG_METHODS_ENABLED
|
||||
r_ret = (p_instance->*p_method)(VariantCasterAndValidate<P>::cast(p_args, Is, r_error)...);
|
||||
|
@ -256,10 +256,10 @@ void call_with_variant_args_retc_helper(T *p_instance, R (T::*p_method)(P...) co
|
|||
}
|
||||
|
||||
template <class T, class... P>
|
||||
void call_with_variant_args_dv(T *p_instance, void (T::*p_method)(P...), GDNativeConstVariantPtr *p_args, int p_argcount, GDNativeCallError &r_error, const std::vector<Variant> &default_values) {
|
||||
void call_with_variant_args_dv(T *p_instance, void (T::*p_method)(P...), GDExtensionConstVariantPtr *p_args, int p_argcount, GDExtensionCallError &r_error, const std::vector<Variant> &default_values) {
|
||||
#ifdef DEBUG_ENABLED
|
||||
if ((size_t)p_argcount > sizeof...(P)) {
|
||||
r_error.error = GDNATIVE_CALL_ERROR_TOO_MANY_ARGUMENTS;
|
||||
r_error.error = GDEXTENSION_CALL_ERROR_TOO_MANY_ARGUMENTS;
|
||||
r_error.argument = (int32_t)sizeof...(P);
|
||||
return;
|
||||
}
|
||||
|
@ -270,7 +270,7 @@ void call_with_variant_args_dv(T *p_instance, void (T::*p_method)(P...), GDNativ
|
|||
int32_t dvs = (int32_t)default_values.size();
|
||||
#ifdef DEBUG_ENABLED
|
||||
if (missing > dvs) {
|
||||
r_error.error = GDNATIVE_CALL_ERROR_TOO_FEW_ARGUMENTS;
|
||||
r_error.error = GDEXTENSION_CALL_ERROR_TOO_FEW_ARGUMENTS;
|
||||
r_error.argument = (int32_t)sizeof...(P);
|
||||
return;
|
||||
}
|
||||
|
@ -291,10 +291,10 @@ void call_with_variant_args_dv(T *p_instance, void (T::*p_method)(P...), GDNativ
|
|||
}
|
||||
|
||||
template <class T, class... P>
|
||||
void call_with_variant_argsc_dv(T *p_instance, void (T::*p_method)(P...) const, GDNativeConstVariantPtr *p_args, int p_argcount, GDNativeCallError &r_error, const std::vector<Variant> &default_values) {
|
||||
void call_with_variant_argsc_dv(T *p_instance, void (T::*p_method)(P...) const, GDExtensionConstVariantPtr *p_args, int p_argcount, GDExtensionCallError &r_error, const std::vector<Variant> &default_values) {
|
||||
#ifdef DEBUG_ENABLED
|
||||
if ((size_t)p_argcount > sizeof...(P)) {
|
||||
r_error.error = GDNATIVE_CALL_ERROR_TOO_MANY_ARGUMENTS;
|
||||
r_error.error = GDEXTENSION_CALL_ERROR_TOO_MANY_ARGUMENTS;
|
||||
r_error.argument = (int32_t)sizeof...(P);
|
||||
return;
|
||||
}
|
||||
|
@ -305,7 +305,7 @@ void call_with_variant_argsc_dv(T *p_instance, void (T::*p_method)(P...) const,
|
|||
int32_t dvs = (int32_t)default_values.size();
|
||||
#ifdef DEBUG_ENABLED
|
||||
if (missing > dvs) {
|
||||
r_error.error = GDNATIVE_CALL_ERROR_TOO_FEW_ARGUMENTS;
|
||||
r_error.error = GDEXTENSION_CALL_ERROR_TOO_FEW_ARGUMENTS;
|
||||
r_error.argument = (int32_t)sizeof...(P);
|
||||
return;
|
||||
}
|
||||
|
@ -326,10 +326,10 @@ void call_with_variant_argsc_dv(T *p_instance, void (T::*p_method)(P...) const,
|
|||
}
|
||||
|
||||
template <class T, class R, class... P>
|
||||
void call_with_variant_args_ret_dv(T *p_instance, R (T::*p_method)(P...), GDNativeConstVariantPtr *p_args, int p_argcount, Variant &r_ret, GDNativeCallError &r_error, const std::vector<Variant> &default_values) {
|
||||
void call_with_variant_args_ret_dv(T *p_instance, R (T::*p_method)(P...), GDExtensionConstVariantPtr *p_args, int p_argcount, Variant &r_ret, GDExtensionCallError &r_error, const std::vector<Variant> &default_values) {
|
||||
#ifdef DEBUG_ENABLED
|
||||
if ((size_t)p_argcount > sizeof...(P)) {
|
||||
r_error.error = GDNATIVE_CALL_ERROR_TOO_MANY_ARGUMENTS;
|
||||
r_error.error = GDEXTENSION_CALL_ERROR_TOO_MANY_ARGUMENTS;
|
||||
r_error.argument = (int32_t)sizeof...(P);
|
||||
return;
|
||||
}
|
||||
|
@ -340,7 +340,7 @@ void call_with_variant_args_ret_dv(T *p_instance, R (T::*p_method)(P...), GDNati
|
|||
int32_t dvs = (int32_t)default_values.size();
|
||||
#ifdef DEBUG_ENABLED
|
||||
if (missing > dvs) {
|
||||
r_error.error = GDNATIVE_CALL_ERROR_TOO_FEW_ARGUMENTS;
|
||||
r_error.error = GDEXTENSION_CALL_ERROR_TOO_FEW_ARGUMENTS;
|
||||
r_error.argument = (int32_t)sizeof...(P);
|
||||
return;
|
||||
}
|
||||
|
@ -361,10 +361,10 @@ void call_with_variant_args_ret_dv(T *p_instance, R (T::*p_method)(P...), GDNati
|
|||
}
|
||||
|
||||
template <class T, class R, class... P>
|
||||
void call_with_variant_args_retc_dv(T *p_instance, R (T::*p_method)(P...) const, GDNativeConstVariantPtr *p_args, int p_argcount, Variant &r_ret, GDNativeCallError &r_error, const std::vector<Variant> &default_values) {
|
||||
void call_with_variant_args_retc_dv(T *p_instance, R (T::*p_method)(P...) const, GDExtensionConstVariantPtr *p_args, int p_argcount, Variant &r_ret, GDExtensionCallError &r_error, const std::vector<Variant> &default_values) {
|
||||
#ifdef DEBUG_ENABLED
|
||||
if ((size_t)p_argcount > sizeof...(P)) {
|
||||
r_error.error = GDNATIVE_CALL_ERROR_TOO_MANY_ARGUMENTS;
|
||||
r_error.error = GDEXTENSION_CALL_ERROR_TOO_MANY_ARGUMENTS;
|
||||
r_error.argument = (int32_t)sizeof...(P);
|
||||
return;
|
||||
}
|
||||
|
@ -375,7 +375,7 @@ void call_with_variant_args_retc_dv(T *p_instance, R (T::*p_method)(P...) const,
|
|||
int32_t dvs = (int32_t)default_values.size();
|
||||
#ifdef DEBUG_ENABLED
|
||||
if (missing > dvs) {
|
||||
r_error.error = GDNATIVE_CALL_ERROR_TOO_FEW_ARGUMENTS;
|
||||
r_error.error = GDEXTENSION_CALL_ERROR_TOO_FEW_ARGUMENTS;
|
||||
r_error.argument = (int32_t)sizeof...(P);
|
||||
return;
|
||||
}
|
||||
|
@ -403,16 +403,16 @@ void call_with_variant_args_retc_dv(T *p_instance, R (T::*p_method)(P...) const,
|
|||
#endif
|
||||
|
||||
template <class Q>
|
||||
void call_get_argument_type_helper(int p_arg, int &index, GDNativeVariantType &type) {
|
||||
void call_get_argument_type_helper(int p_arg, int &index, GDExtensionVariantType &type) {
|
||||
if (p_arg == index) {
|
||||
type = GDNativeVariantType(GetTypeInfo<Q>::VARIANT_TYPE);
|
||||
type = GDExtensionVariantType(GetTypeInfo<Q>::VARIANT_TYPE);
|
||||
}
|
||||
index++;
|
||||
}
|
||||
|
||||
template <class... P>
|
||||
GDNativeVariantType call_get_argument_type(int p_arg) {
|
||||
GDNativeVariantType type = GDNATIVE_VARIANT_TYPE_NIL;
|
||||
GDExtensionVariantType call_get_argument_type(int p_arg) {
|
||||
GDExtensionVariantType type = GDEXTENSION_VARIANT_TYPE_NIL;
|
||||
int index = 0;
|
||||
// I think rocket science is simpler than modern C++.
|
||||
using expand_type = int[];
|
||||
|
@ -441,7 +441,7 @@ void call_get_argument_type_info(int p_arg, PropertyInfo &info) {
|
|||
}
|
||||
|
||||
template <class Q>
|
||||
void call_get_argument_metadata_helper(int p_arg, int &index, GDNativeExtensionClassMethodArgumentMetadata &md) {
|
||||
void call_get_argument_metadata_helper(int p_arg, int &index, GDExtensionClassMethodArgumentMetadata &md) {
|
||||
if (p_arg == index) {
|
||||
md = GetTypeInfo<Q>::METADATA;
|
||||
}
|
||||
|
@ -449,8 +449,8 @@ void call_get_argument_metadata_helper(int p_arg, int &index, GDNativeExtensionC
|
|||
}
|
||||
|
||||
template <class... P>
|
||||
GDNativeExtensionClassMethodArgumentMetadata call_get_argument_metadata(int p_arg) {
|
||||
GDNativeExtensionClassMethodArgumentMetadata md = GDNATIVE_EXTENSION_METHOD_ARGUMENT_METADATA_NONE;
|
||||
GDExtensionClassMethodArgumentMetadata call_get_argument_metadata(int p_arg) {
|
||||
GDExtensionClassMethodArgumentMetadata md = GDEXTENSION_METHOD_ARGUMENT_METADATA_NONE;
|
||||
|
||||
int index = 0;
|
||||
// I think rocket science is simpler than modern C++.
|
||||
|
@ -462,8 +462,8 @@ GDNativeExtensionClassMethodArgumentMetadata call_get_argument_metadata(int p_ar
|
|||
}
|
||||
|
||||
template <class... P, size_t... Is>
|
||||
void call_with_variant_args_static(void (*p_method)(P...), const Variant **p_args, GDNativeCallError &r_error, IndexSequence<Is...>) {
|
||||
r_error.error = GDNATIVE_CALL_OK;
|
||||
void call_with_variant_args_static(void (*p_method)(P...), const Variant **p_args, GDExtensionCallError &r_error, IndexSequence<Is...>) {
|
||||
r_error.error = GDEXTENSION_CALL_OK;
|
||||
|
||||
#ifdef DEBUG_METHODS_ENABLED
|
||||
(p_method)(VariantCasterAndValidate<P>::cast(p_args, Is, r_error)...);
|
||||
|
@ -473,10 +473,10 @@ void call_with_variant_args_static(void (*p_method)(P...), const Variant **p_arg
|
|||
}
|
||||
|
||||
template <class... P>
|
||||
void call_with_variant_args_static_dv(void (*p_method)(P...), GDNativeConstVariantPtr *p_args, int p_argcount, GDNativeCallError &r_error, const std::vector<Variant> &default_values) {
|
||||
void call_with_variant_args_static_dv(void (*p_method)(P...), GDExtensionConstVariantPtr *p_args, int p_argcount, GDExtensionCallError &r_error, const std::vector<Variant> &default_values) {
|
||||
#ifdef DEBUG_ENABLED
|
||||
if ((size_t)p_argcount > sizeof...(P)) {
|
||||
r_error.error = GDNATIVE_CALL_ERROR_TOO_MANY_ARGUMENTS;
|
||||
r_error.error = GDEXTENSION_CALL_ERROR_TOO_MANY_ARGUMENTS;
|
||||
r_error.argument = sizeof...(P);
|
||||
return;
|
||||
}
|
||||
|
@ -487,7 +487,7 @@ void call_with_variant_args_static_dv(void (*p_method)(P...), GDNativeConstVaria
|
|||
int32_t dvs = default_values.size();
|
||||
#ifdef DEBUG_ENABLED
|
||||
if (missing > dvs) {
|
||||
r_error.error = GDNATIVE_CALL_ERROR_TOO_FEW_ARGUMENTS;
|
||||
r_error.error = GDEXTENSION_CALL_ERROR_TOO_FEW_ARGUMENTS;
|
||||
r_error.argument = sizeof...(P);
|
||||
return;
|
||||
}
|
||||
|
@ -508,18 +508,18 @@ void call_with_variant_args_static_dv(void (*p_method)(P...), GDNativeConstVaria
|
|||
}
|
||||
|
||||
template <class... P, size_t... Is>
|
||||
void call_with_ptr_args_static_method_helper(void (*p_method)(P...), GDNativeConstTypePtr *p_args, IndexSequence<Is...>) {
|
||||
void call_with_ptr_args_static_method_helper(void (*p_method)(P...), GDExtensionConstTypePtr *p_args, IndexSequence<Is...>) {
|
||||
p_method(PtrToArg<P>::convert(p_args[Is])...);
|
||||
}
|
||||
|
||||
template <class... P>
|
||||
void call_with_ptr_args_static_method(void (*p_method)(P...), GDNativeConstTypePtr *p_args) {
|
||||
void call_with_ptr_args_static_method(void (*p_method)(P...), GDExtensionConstTypePtr *p_args) {
|
||||
call_with_ptr_args_static_method_helper<P...>(p_method, p_args, BuildIndexSequence<sizeof...(P)>{});
|
||||
}
|
||||
|
||||
template <class R, class... P, size_t... Is>
|
||||
void call_with_variant_args_static_ret(R (*p_method)(P...), const Variant **p_args, Variant &r_ret, GDNativeCallError &r_error, IndexSequence<Is...>) {
|
||||
r_error.error = GDNATIVE_CALL_OK;
|
||||
void call_with_variant_args_static_ret(R (*p_method)(P...), const Variant **p_args, Variant &r_ret, GDExtensionCallError &r_error, IndexSequence<Is...>) {
|
||||
r_error.error = GDEXTENSION_CALL_OK;
|
||||
|
||||
#ifdef DEBUG_METHODS_ENABLED
|
||||
r_ret = (p_method)(VariantCasterAndValidate<P>::cast(p_args, Is, r_error)...);
|
||||
|
@ -529,10 +529,10 @@ void call_with_variant_args_static_ret(R (*p_method)(P...), const Variant **p_ar
|
|||
}
|
||||
|
||||
template <class R, class... P>
|
||||
void call_with_variant_args_static_ret_dv(R (*p_method)(P...), GDNativeConstVariantPtr *p_args, int p_argcount, Variant &r_ret, GDNativeCallError &r_error, const std::vector<Variant> &default_values) {
|
||||
void call_with_variant_args_static_ret_dv(R (*p_method)(P...), GDExtensionConstVariantPtr *p_args, int p_argcount, Variant &r_ret, GDExtensionCallError &r_error, const std::vector<Variant> &default_values) {
|
||||
#ifdef DEBUG_ENABLED
|
||||
if ((size_t)p_argcount > sizeof...(P)) {
|
||||
r_error.error = GDNATIVE_CALL_ERROR_TOO_MANY_ARGUMENTS;
|
||||
r_error.error = GDEXTENSION_CALL_ERROR_TOO_MANY_ARGUMENTS;
|
||||
r_error.argument = sizeof...(P);
|
||||
return;
|
||||
}
|
||||
|
@ -543,7 +543,7 @@ void call_with_variant_args_static_ret_dv(R (*p_method)(P...), GDNativeConstVari
|
|||
int32_t dvs = default_values.size();
|
||||
#ifdef DEBUG_ENABLED
|
||||
if (missing > dvs) {
|
||||
r_error.error = GDNATIVE_CALL_ERROR_TOO_FEW_ARGUMENTS;
|
||||
r_error.error = GDEXTENSION_CALL_ERROR_TOO_FEW_ARGUMENTS;
|
||||
r_error.argument = sizeof...(P);
|
||||
return;
|
||||
}
|
||||
|
@ -564,12 +564,12 @@ void call_with_variant_args_static_ret_dv(R (*p_method)(P...), GDNativeConstVari
|
|||
}
|
||||
|
||||
template <class R, class... P, size_t... Is>
|
||||
void call_with_ptr_args_static_method_ret_helper(R (*p_method)(P...), GDNativeConstTypePtr *p_args, void *r_ret, IndexSequence<Is...>) {
|
||||
void call_with_ptr_args_static_method_ret_helper(R (*p_method)(P...), GDExtensionConstTypePtr *p_args, void *r_ret, IndexSequence<Is...>) {
|
||||
PtrToArg<R>::encode(p_method(PtrToArg<P>::convert(p_args[Is])...), r_ret);
|
||||
}
|
||||
|
||||
template <class R, class... P>
|
||||
void call_with_ptr_args_static_method_ret(R (*p_method)(P...), GDNativeConstTypePtr *p_args, void *r_ret) {
|
||||
void call_with_ptr_args_static_method_ret(R (*p_method)(P...), GDExtensionConstTypePtr *p_args, void *r_ret) {
|
||||
call_with_ptr_args_static_method_ret_helper<R, P...>(p_method, p_args, r_ret, BuildIndexSequence<sizeof...(P)>{});
|
||||
}
|
||||
|
||||
|
|
|
@ -31,7 +31,7 @@
|
|||
#ifndef GODOT_BUILTIN_PTRCALL_HPP
|
||||
#define GODOT_BUILTIN_PTRCALL_HPP
|
||||
|
||||
#include <godot/gdnative_interface.h>
|
||||
#include <godot/gdextension_interface.h>
|
||||
|
||||
#include <array>
|
||||
|
||||
|
@ -40,34 +40,34 @@ namespace godot {
|
|||
namespace internal {
|
||||
|
||||
template <class... Args>
|
||||
void _call_builtin_constructor(const GDNativePtrConstructor constructor, GDNativeTypePtr base, Args... args) {
|
||||
std::array<GDNativeConstTypePtr, sizeof...(Args)> call_args = { { (GDNativeConstTypePtr)args... } };
|
||||
void _call_builtin_constructor(const GDExtensionPtrConstructor constructor, GDExtensionTypePtr base, Args... args) {
|
||||
std::array<GDExtensionConstTypePtr, sizeof...(Args)> call_args = { { (GDExtensionConstTypePtr)args... } };
|
||||
constructor(base, call_args.data());
|
||||
}
|
||||
|
||||
template <class T, class... Args>
|
||||
T _call_builtin_method_ptr_ret(const GDNativePtrBuiltInMethod method, GDNativeTypePtr base, Args... args) {
|
||||
T _call_builtin_method_ptr_ret(const GDExtensionPtrBuiltInMethod method, GDExtensionTypePtr base, Args... args) {
|
||||
T ret;
|
||||
std::array<GDNativeConstTypePtr, sizeof...(Args)> call_args = { { (GDNativeConstTypePtr)args... } };
|
||||
std::array<GDExtensionConstTypePtr, sizeof...(Args)> call_args = { { (GDExtensionConstTypePtr)args... } };
|
||||
method(base, call_args.data(), &ret, sizeof...(Args));
|
||||
return ret;
|
||||
}
|
||||
|
||||
template <class... Args>
|
||||
void _call_builtin_method_ptr_no_ret(const GDNativePtrBuiltInMethod method, GDNativeTypePtr base, Args... args) {
|
||||
std::array<GDNativeConstTypePtr, sizeof...(Args)> call_args = { { (GDNativeConstTypePtr)args... } };
|
||||
void _call_builtin_method_ptr_no_ret(const GDExtensionPtrBuiltInMethod method, GDExtensionTypePtr base, Args... args) {
|
||||
std::array<GDExtensionConstTypePtr, sizeof...(Args)> call_args = { { (GDExtensionConstTypePtr)args... } };
|
||||
method(base, call_args.data(), nullptr, sizeof...(Args));
|
||||
}
|
||||
|
||||
template <class T>
|
||||
T _call_builtin_operator_ptr(const GDNativePtrOperatorEvaluator op, GDNativeConstTypePtr left, GDNativeConstTypePtr right) {
|
||||
T _call_builtin_operator_ptr(const GDExtensionPtrOperatorEvaluator op, GDExtensionConstTypePtr left, GDExtensionConstTypePtr right) {
|
||||
T ret;
|
||||
op(left, right, &ret);
|
||||
return ret;
|
||||
}
|
||||
|
||||
template <class T>
|
||||
T _call_builtin_ptr_getter(const GDNativePtrGetter getter, GDNativeConstTypePtr base) {
|
||||
T _call_builtin_ptr_getter(const GDExtensionPtrGetter getter, GDExtensionConstTypePtr base) {
|
||||
T ret;
|
||||
getter(base, &ret);
|
||||
return ret;
|
||||
|
|
|
@ -31,7 +31,7 @@
|
|||
#ifndef GODOT_CLASS_DB_HPP
|
||||
#define GODOT_CLASS_DB_HPP
|
||||
|
||||
#include <godot/gdnative_interface.h>
|
||||
#include <godot/gdextension_interface.h>
|
||||
|
||||
#include <godot_cpp/core/defs.hpp>
|
||||
#include <godot_cpp/core/error_macros.hpp>
|
||||
|
@ -74,7 +74,7 @@ MethodDefinition D_METHOD(StringName p_name, StringName p_arg1, Args... args) {
|
|||
}
|
||||
|
||||
class ClassDB {
|
||||
static GDNativeInitializationLevel current_level;
|
||||
static GDExtensionInitializationLevel current_level;
|
||||
|
||||
friend class godot::GDExtensionBinding;
|
||||
|
||||
|
@ -91,10 +91,10 @@ public:
|
|||
struct ClassInfo {
|
||||
StringName name;
|
||||
StringName parent_name;
|
||||
GDNativeInitializationLevel level = GDNATIVE_INITIALIZATION_SCENE;
|
||||
GDExtensionInitializationLevel level = GDEXTENSION_INITIALIZATION_SCENE;
|
||||
std::unordered_map<StringName, MethodBind *> method_map;
|
||||
std::set<StringName> signal_names;
|
||||
std::unordered_map<StringName, GDNativeExtensionClassCallVirtual> virtual_methods;
|
||||
std::unordered_map<StringName, GDExtensionClassCallVirtual> virtual_methods;
|
||||
std::set<StringName> property_names;
|
||||
std::set<StringName> constant_names;
|
||||
// Pointer to the parent custom class, if any. Will be null if the parent class is a Godot class.
|
||||
|
@ -131,15 +131,15 @@ public:
|
|||
static void add_property_subgroup(const StringName &p_class, const String &p_name, const String &p_prefix);
|
||||
static void add_property(const StringName &p_class, const PropertyInfo &p_pinfo, const StringName &p_setter, const StringName &p_getter, int p_index = -1);
|
||||
static void add_signal(const StringName &p_class, const MethodInfo &p_signal);
|
||||
static void bind_integer_constant(const StringName &p_class_name, const StringName &p_enum_name, const StringName &p_constant_name, GDNativeInt p_constant_value, bool p_is_bitfield = false);
|
||||
static void bind_virtual_method(const StringName &p_class, const StringName &p_method, GDNativeExtensionClassCallVirtual p_call);
|
||||
static void 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 = false);
|
||||
static void bind_virtual_method(const StringName &p_class, const StringName &p_method, GDExtensionClassCallVirtual p_call);
|
||||
|
||||
static MethodBind *get_method(const StringName &p_class, const StringName &p_method);
|
||||
|
||||
static GDNativeExtensionClassCallVirtual get_virtual_func(void *p_userdata, GDNativeConstStringNamePtr p_name);
|
||||
static GDExtensionClassCallVirtual get_virtual_func(void *p_userdata, GDExtensionConstStringNamePtr p_name);
|
||||
|
||||
static void initialize(GDNativeInitializationLevel p_level);
|
||||
static void deinitialize(GDNativeInitializationLevel p_level);
|
||||
static void initialize(GDExtensionInitializationLevel p_level);
|
||||
static void deinitialize(GDExtensionInitializationLevel p_level);
|
||||
};
|
||||
|
||||
#define BIND_CONSTANT(m_constant) \
|
||||
|
@ -153,7 +153,7 @@ public:
|
|||
|
||||
#define BIND_VIRTUAL_METHOD(m_class, m_method) \
|
||||
{ \
|
||||
auto ___call##m_method = [](GDNativeObjectPtr p_instance, GDNativeConstTypePtr *p_args, GDNativeTypePtr p_ret) -> void { \
|
||||
auto ___call##m_method = [](GDExtensionObjectPtr p_instance, GDExtensionConstTypePtr *p_args, GDExtensionTypePtr p_ret) -> void { \
|
||||
call_with_ptr_args(reinterpret_cast<m_class *>(p_instance), &m_class::m_method, p_args, p_ret); \
|
||||
}; \
|
||||
godot::ClassDB::bind_virtual_method(m_class::get_class_static(), #m_method, ___call##m_method); \
|
||||
|
@ -174,27 +174,27 @@ void ClassDB::_register_class(bool p_virtual) {
|
|||
classes[cl.name] = cl;
|
||||
|
||||
// Register this class with Godot
|
||||
GDNativeExtensionClassCreationInfo class_info = {
|
||||
p_virtual, // GDNativeBool is_virtual;
|
||||
is_abstract, // GDNativeBool is_abstract;
|
||||
T::set_bind, // GDNativeExtensionClassSet set_func;
|
||||
T::get_bind, // GDNativeExtensionClassGet get_func;
|
||||
T::get_property_list_bind, // GDNativeExtensionClassGetPropertyList get_property_list_func;
|
||||
T::free_property_list_bind, // GDNativeExtensionClassFreePropertyList free_property_list_func;
|
||||
T::property_can_revert_bind, // GDNativeExtensionClassPropertyCanRevert property_can_revert_func;
|
||||
T::property_get_revert_bind, // GDNativeExtensionClassPropertyGetRevert property_get_revert_func;
|
||||
T::notification_bind, // GDNativeExtensionClassNotification notification_func;
|
||||
T::to_string_bind, // GDNativeExtensionClassToString to_string_func;
|
||||
nullptr, // GDNativeExtensionClassReference reference_func;
|
||||
nullptr, // GDNativeExtensionClassUnreference unreference_func;
|
||||
T::create, // GDNativeExtensionClassCreateInstance create_instance_func; /* this one is mandatory */
|
||||
T::free, // GDNativeExtensionClassFreeInstance free_instance_func; /* this one is mandatory */
|
||||
&ClassDB::get_virtual_func, // GDNativeExtensionClassGetVirtual get_virtual_func;
|
||||
nullptr, // GDNativeExtensionClassGetRID get_rid;
|
||||
GDExtensionClassCreationInfo class_info = {
|
||||
p_virtual, // GDExtensionBool is_virtual;
|
||||
is_abstract, // GDExtensionBool is_abstract;
|
||||
T::set_bind, // GDExtensionClassSet set_func;
|
||||
T::get_bind, // GDExtensionClassGet get_func;
|
||||
T::get_property_list_bind, // GDExtensionClassGetPropertyList get_property_list_func;
|
||||
T::free_property_list_bind, // GDExtensionClassFreePropertyList free_property_list_func;
|
||||
T::property_can_revert_bind, // GDExtensionClassPropertyCanRevert property_can_revert_func;
|
||||
T::property_get_revert_bind, // GDExtensionClassPropertyGetRevert property_get_revert_func;
|
||||
T::notification_bind, // GDExtensionClassNotification notification_func;
|
||||
T::to_string_bind, // GDExtensionClassToString to_string_func;
|
||||
nullptr, // GDExtensionClassReference reference_func;
|
||||
nullptr, // GDExtensionClassUnreference unreference_func;
|
||||
T::create, // GDExtensionClassCreateInstance create_instance_func; /* this one is mandatory */
|
||||
T::free, // GDExtensionClassFreeInstance free_instance_func; /* this one is mandatory */
|
||||
&ClassDB::get_virtual_func, // GDExtensionClassGetVirtual get_virtual_func;
|
||||
nullptr, // GDExtensionClassGetRID get_rid;
|
||||
(void *)&T::get_class_static(), // void *class_userdata;
|
||||
};
|
||||
|
||||
internal::gdn_interface->classdb_register_extension_class(internal::library, cl.name._native_ptr(), cl.parent_name._native_ptr(), &class_info);
|
||||
internal::gde_interface->classdb_register_extension_class(internal::library, cl.name._native_ptr(), cl.parent_name._native_ptr(), &class_info);
|
||||
|
||||
// call bind_methods etc. to register all members of the class
|
||||
T::initialize_class();
|
||||
|
|
|
@ -35,13 +35,13 @@
|
|||
#include <cstdint>
|
||||
#include <cstring>
|
||||
|
||||
#if !defined(GDN_EXPORT)
|
||||
#if !defined(GDE_EXPORT)
|
||||
#if defined(_WIN32)
|
||||
#define GDN_EXPORT __declspec(dllexport)
|
||||
#define GDE_EXPORT __declspec(dllexport)
|
||||
#elif defined(__GNUC__)
|
||||
#define GDN_EXPORT __attribute__((visibility("default")))
|
||||
#define GDE_EXPORT __attribute__((visibility("default")))
|
||||
#else
|
||||
#define GDN_EXPORT
|
||||
#define GDE_EXPORT
|
||||
#endif
|
||||
#endif
|
||||
|
||||
|
|
|
@ -31,7 +31,7 @@
|
|||
#ifndef GODOT_ENGINE_PTRCALL_HPP
|
||||
#define GODOT_ENGINE_PTRCALL_HPP
|
||||
|
||||
#include <godot/gdnative_interface.h>
|
||||
#include <godot/gdextension_interface.h>
|
||||
|
||||
#include <godot_cpp/core/binder_common.hpp>
|
||||
#include <godot_cpp/core/object.hpp>
|
||||
|
@ -44,49 +44,49 @@ namespace godot {
|
|||
namespace internal {
|
||||
|
||||
template <class O, class... Args>
|
||||
O *_call_native_mb_ret_obj(const GDNativeMethodBindPtr mb, void *instance, const Args &...args) {
|
||||
O *_call_native_mb_ret_obj(const GDExtensionMethodBindPtr mb, void *instance, const Args &...args) {
|
||||
GodotObject *ret = nullptr;
|
||||
std::array<GDNativeConstTypePtr, sizeof...(Args)> mb_args = { { (GDNativeConstTypePtr)args... } };
|
||||
internal::gdn_interface->object_method_bind_ptrcall(mb, instance, mb_args.data(), &ret);
|
||||
std::array<GDExtensionConstTypePtr, sizeof...(Args)> mb_args = { { (GDExtensionConstTypePtr)args... } };
|
||||
internal::gde_interface->object_method_bind_ptrcall(mb, instance, mb_args.data(), &ret);
|
||||
if (ret == nullptr) {
|
||||
return nullptr;
|
||||
}
|
||||
return reinterpret_cast<O *>(internal::gdn_interface->object_get_instance_binding(ret, internal::token, &O::___binding_callbacks));
|
||||
return reinterpret_cast<O *>(internal::gde_interface->object_get_instance_binding(ret, internal::token, &O::___binding_callbacks));
|
||||
}
|
||||
|
||||
template <class R, class... Args>
|
||||
R _call_native_mb_ret(const GDNativeMethodBindPtr mb, void *instance, const Args &...args) {
|
||||
R _call_native_mb_ret(const GDExtensionMethodBindPtr mb, void *instance, const Args &...args) {
|
||||
R ret;
|
||||
std::array<GDNativeConstTypePtr, sizeof...(Args)> mb_args = { { (GDNativeConstTypePtr)args... } };
|
||||
internal::gdn_interface->object_method_bind_ptrcall(mb, instance, mb_args.data(), &ret);
|
||||
std::array<GDExtensionConstTypePtr, sizeof...(Args)> mb_args = { { (GDExtensionConstTypePtr)args... } };
|
||||
internal::gde_interface->object_method_bind_ptrcall(mb, instance, mb_args.data(), &ret);
|
||||
return ret;
|
||||
}
|
||||
|
||||
template <class... Args>
|
||||
void _call_native_mb_no_ret(const GDNativeMethodBindPtr mb, void *instance, const Args &...args) {
|
||||
std::array<GDNativeConstTypePtr, sizeof...(Args)> mb_args = { { (GDNativeConstTypePtr)args... } };
|
||||
internal::gdn_interface->object_method_bind_ptrcall(mb, instance, mb_args.data(), nullptr);
|
||||
void _call_native_mb_no_ret(const GDExtensionMethodBindPtr mb, void *instance, const Args &...args) {
|
||||
std::array<GDExtensionConstTypePtr, sizeof...(Args)> mb_args = { { (GDExtensionConstTypePtr)args... } };
|
||||
internal::gde_interface->object_method_bind_ptrcall(mb, instance, mb_args.data(), nullptr);
|
||||
}
|
||||
|
||||
template <class R, class... Args>
|
||||
R _call_utility_ret(GDNativePtrUtilityFunction func, const Args &...args) {
|
||||
R _call_utility_ret(GDExtensionPtrUtilityFunction func, const Args &...args) {
|
||||
R ret;
|
||||
std::array<GDNativeConstTypePtr, sizeof...(Args)> mb_args = { { (GDNativeConstTypePtr)args... } };
|
||||
std::array<GDExtensionConstTypePtr, sizeof...(Args)> mb_args = { { (GDExtensionConstTypePtr)args... } };
|
||||
func(&ret, mb_args.data(), mb_args.size());
|
||||
return ret;
|
||||
}
|
||||
|
||||
template <class... Args>
|
||||
Object *_call_utility_ret_obj(const GDNativePtrUtilityFunction func, void *instance, const Args &...args) {
|
||||
Object *_call_utility_ret_obj(const GDExtensionPtrUtilityFunction func, void *instance, const Args &...args) {
|
||||
GodotObject *ret = nullptr;
|
||||
std::array<GDNativeConstTypePtr, sizeof...(Args)> mb_args = { { (GDNativeConstTypePtr)args... } };
|
||||
std::array<GDExtensionConstTypePtr, sizeof...(Args)> mb_args = { { (GDExtensionConstTypePtr)args... } };
|
||||
func(&ret, mb_args.data(), mb_args.size());
|
||||
return (Object *)internal::gdn_interface->object_get_instance_binding(ret, internal::token, &Object::___binding_callbacks);
|
||||
return (Object *)internal::gde_interface->object_get_instance_binding(ret, internal::token, &Object::___binding_callbacks);
|
||||
}
|
||||
|
||||
template <class... Args>
|
||||
void _call_utility_no_ret(const GDNativePtrUtilityFunction func, const Args &...args) {
|
||||
std::array<GDNativeConstTypePtr, sizeof...(Args)> mb_args = { { (GDNativeConstTypePtr)args... } };
|
||||
void _call_utility_no_ret(const GDExtensionPtrUtilityFunction func, const Args &...args) {
|
||||
std::array<GDExtensionConstTypePtr, sizeof...(Args)> mb_args = { { (GDExtensionConstTypePtr)args... } };
|
||||
func(nullptr, mb_args.data(), mb_args.size());
|
||||
}
|
||||
|
||||
|
|
|
@ -33,7 +33,7 @@
|
|||
|
||||
#include <godot_cpp/core/defs.hpp>
|
||||
|
||||
#include <godot/gdnative_interface.h>
|
||||
#include <godot/gdextension_interface.h>
|
||||
|
||||
#include <cmath>
|
||||
|
||||
|
|
|
@ -117,7 +117,7 @@ void memdelete(T *p_class, typename std::enable_if<!std::is_base_of_v<godot::Wra
|
|||
|
||||
template <class T, std::enable_if_t<std::is_base_of_v<godot::Wrapped, T>, bool> = true>
|
||||
void memdelete(T *p_class) {
|
||||
godot::internal::gdn_interface->object_destroy(p_class->_owner);
|
||||
godot::internal::gde_interface->object_destroy(p_class->_owner);
|
||||
}
|
||||
|
||||
template <class T, class A>
|
||||
|
|
|
@ -36,7 +36,7 @@
|
|||
|
||||
#include <godot_cpp/core/memory.hpp>
|
||||
|
||||
#include <godot/gdnative_interface.h>
|
||||
#include <godot/gdextension_interface.h>
|
||||
|
||||
#include <godot_cpp/classes/global_constants.hpp>
|
||||
|
||||
|
@ -59,11 +59,11 @@ class MethodBind {
|
|||
bool _vararg = false;
|
||||
|
||||
std::vector<StringName> argument_names;
|
||||
GDNativeVariantType *argument_types = nullptr;
|
||||
GDExtensionVariantType *argument_types = nullptr;
|
||||
std::vector<Variant> default_arguments;
|
||||
|
||||
protected:
|
||||
virtual GDNativeVariantType gen_argument_type(int p_arg) const = 0;
|
||||
virtual GDExtensionVariantType gen_argument_type(int p_arg) const = 0;
|
||||
virtual PropertyInfo gen_argument_type_info(int p_arg) const = 0;
|
||||
void generate_argument_types(int p_count);
|
||||
void set_const(bool p_const);
|
||||
|
@ -103,19 +103,19 @@ public:
|
|||
_FORCE_INLINE_ bool is_static() const { return _static; }
|
||||
_FORCE_INLINE_ bool is_vararg() const { return _vararg; }
|
||||
_FORCE_INLINE_ bool has_return() const { return _has_return; }
|
||||
_FORCE_INLINE_ uint32_t get_hint_flags() const { return hint_flags | (is_const() ? GDNATIVE_EXTENSION_METHOD_FLAG_CONST : 0) | (is_vararg() ? GDNATIVE_EXTENSION_METHOD_FLAG_VARARG : 0) | (is_static() ? GDNATIVE_EXTENSION_METHOD_FLAG_STATIC : 0); }
|
||||
_FORCE_INLINE_ uint32_t get_hint_flags() const { return hint_flags | (is_const() ? GDEXTENSION_METHOD_FLAG_CONST : 0) | (is_vararg() ? GDEXTENSION_METHOD_FLAG_VARARG : 0) | (is_static() ? GDEXTENSION_METHOD_FLAG_STATIC : 0); }
|
||||
_FORCE_INLINE_ void set_hint_flags(uint32_t p_hint_flags) { hint_flags = p_hint_flags; }
|
||||
void set_argument_names(const std::vector<StringName> &p_names);
|
||||
std::vector<StringName> get_argument_names() const;
|
||||
void set_default_arguments(const std::vector<Variant> &p_default_arguments) { default_arguments = p_default_arguments; }
|
||||
|
||||
_FORCE_INLINE_ GDNativeVariantType get_argument_type(int p_argument) const {
|
||||
ERR_FAIL_COND_V(p_argument < -1 || p_argument > argument_count, GDNATIVE_VARIANT_TYPE_NIL);
|
||||
_FORCE_INLINE_ GDExtensionVariantType get_argument_type(int p_argument) const {
|
||||
ERR_FAIL_COND_V(p_argument < -1 || p_argument > argument_count, GDEXTENSION_VARIANT_TYPE_NIL);
|
||||
return argument_types[p_argument + 1];
|
||||
}
|
||||
|
||||
PropertyInfo get_argument_info(int p_argument) const;
|
||||
virtual GDNativeExtensionClassMethodArgumentMetadata get_argument_metadata(int p_argument) const = 0;
|
||||
virtual GDExtensionClassMethodArgumentMetadata get_argument_metadata(int p_argument) const = 0;
|
||||
|
||||
std::vector<PropertyInfo> get_arguments_info_list() const {
|
||||
std::vector<PropertyInfo> vec;
|
||||
|
@ -126,8 +126,8 @@ public:
|
|||
}
|
||||
return vec;
|
||||
}
|
||||
std::vector<GDNativeExtensionClassMethodArgumentMetadata> get_arguments_metadata_list() const {
|
||||
std::vector<GDNativeExtensionClassMethodArgumentMetadata> vec;
|
||||
std::vector<GDExtensionClassMethodArgumentMetadata> get_arguments_metadata_list() const {
|
||||
std::vector<GDExtensionClassMethodArgumentMetadata> vec;
|
||||
// First element is return value
|
||||
vec.reserve(argument_count + 1);
|
||||
for (int i = 0; i < argument_count; i++) {
|
||||
|
@ -136,11 +136,11 @@ public:
|
|||
return vec;
|
||||
}
|
||||
|
||||
virtual Variant call(GDExtensionClassInstancePtr p_instance, GDNativeConstVariantPtr *p_args, GDNativeInt p_argument_count, GDNativeCallError &r_error) const = 0;
|
||||
virtual void ptrcall(GDExtensionClassInstancePtr p_instance, GDNativeConstTypePtr *p_args, GDNativeTypePtr r_return) const = 0;
|
||||
virtual Variant call(GDExtensionClassInstancePtr p_instance, GDExtensionConstVariantPtr *p_args, GDExtensionInt p_argument_count, GDExtensionCallError &r_error) const = 0;
|
||||
virtual void ptrcall(GDExtensionClassInstancePtr p_instance, GDExtensionConstTypePtr *p_args, GDExtensionTypePtr r_return) const = 0;
|
||||
|
||||
static void bind_call(void *p_method_userdata, GDExtensionClassInstancePtr p_instance, GDNativeConstVariantPtr *p_args, GDNativeInt p_argument_count, GDNativeVariantPtr r_return, GDNativeCallError *r_error);
|
||||
static void bind_ptrcall(void *p_method_userdata, GDExtensionClassInstancePtr p_instance, GDNativeConstTypePtr *p_args, GDNativeTypePtr r_return);
|
||||
static void bind_call(void *p_method_userdata, GDExtensionClassInstancePtr p_instance, GDExtensionConstVariantPtr *p_args, GDExtensionInt p_argument_count, GDExtensionVariantPtr r_return, GDExtensionCallError *r_error);
|
||||
static void bind_ptrcall(void *p_method_userdata, GDExtensionClassInstancePtr p_instance, GDExtensionConstTypePtr *p_args, GDExtensionTypePtr r_return);
|
||||
|
||||
virtual ~MethodBind();
|
||||
};
|
||||
|
@ -149,7 +149,7 @@ template <class Derived, class T, class R, bool should_returns>
|
|||
class MethodBindVarArgBase : public MethodBind {
|
||||
protected:
|
||||
R(T::*method)
|
||||
(const Variant **, GDNativeInt, GDNativeCallError &);
|
||||
(const Variant **, GDExtensionInt, GDExtensionCallError &);
|
||||
std::vector<PropertyInfo> arguments;
|
||||
|
||||
public:
|
||||
|
@ -163,20 +163,20 @@ public:
|
|||
}
|
||||
}
|
||||
|
||||
virtual GDNativeVariantType gen_argument_type(int p_arg) const {
|
||||
return static_cast<GDNativeVariantType>(gen_argument_type_info(p_arg).type);
|
||||
virtual GDExtensionVariantType gen_argument_type(int p_arg) const {
|
||||
return static_cast<GDExtensionVariantType>(gen_argument_type_info(p_arg).type);
|
||||
}
|
||||
|
||||
virtual GDNativeExtensionClassMethodArgumentMetadata get_argument_metadata(int) const {
|
||||
return GDNATIVE_EXTENSION_METHOD_ARGUMENT_METADATA_NONE;
|
||||
virtual GDExtensionClassMethodArgumentMetadata get_argument_metadata(int) const {
|
||||
return GDEXTENSION_METHOD_ARGUMENT_METADATA_NONE;
|
||||
}
|
||||
|
||||
virtual void ptrcall(GDExtensionClassInstancePtr p_instance, GDNativeConstTypePtr *p_args, GDNativeTypePtr r_return) const {
|
||||
virtual void ptrcall(GDExtensionClassInstancePtr p_instance, GDExtensionConstTypePtr *p_args, GDExtensionTypePtr r_return) const {
|
||||
ERR_FAIL(); // Can't call.
|
||||
}
|
||||
|
||||
MethodBindVarArgBase(
|
||||
R (T::*p_method)(const Variant **, GDNativeInt, GDNativeCallError &),
|
||||
R (T::*p_method)(const Variant **, GDExtensionInt, GDExtensionCallError &),
|
||||
const MethodInfo &p_method_info,
|
||||
bool p_return_nil_is_variant) :
|
||||
method(p_method) {
|
||||
|
@ -211,13 +211,13 @@ class MethodBindVarArgT : public MethodBindVarArgBase<MethodBindVarArgT<T>, T, v
|
|||
friend class MethodBindVarArgBase<MethodBindVarArgT<T>, T, void, false>;
|
||||
|
||||
public:
|
||||
virtual Variant call(GDExtensionClassInstancePtr p_instance, GDNativeConstVariantPtr *p_args, GDNativeInt p_argument_count, GDNativeCallError &r_error) const {
|
||||
virtual Variant call(GDExtensionClassInstancePtr p_instance, GDExtensionConstVariantPtr *p_args, GDExtensionInt p_argument_count, GDExtensionCallError &r_error) const {
|
||||
(static_cast<T *>(p_instance)->*MethodBindVarArgBase<MethodBindVarArgT<T>, T, void, false>::method)((const Variant **)p_args, p_argument_count, r_error);
|
||||
return {};
|
||||
}
|
||||
|
||||
MethodBindVarArgT(
|
||||
void (T::*p_method)(const Variant **, GDNativeInt, GDNativeCallError &),
|
||||
void (T::*p_method)(const Variant **, GDExtensionInt, GDExtensionCallError &),
|
||||
const MethodInfo &p_method_info,
|
||||
bool p_return_nil_is_variant) :
|
||||
MethodBindVarArgBase<MethodBindVarArgT<T>, T, void, false>(p_method, p_method_info, p_return_nil_is_variant) {
|
||||
|
@ -230,7 +230,7 @@ private:
|
|||
};
|
||||
|
||||
template <class T>
|
||||
MethodBind *create_vararg_method_bind(void (T::*p_method)(const Variant **, GDNativeInt, GDNativeCallError &), const MethodInfo &p_info, bool p_return_nil_is_variant) {
|
||||
MethodBind *create_vararg_method_bind(void (T::*p_method)(const Variant **, GDExtensionInt, GDExtensionCallError &), const MethodInfo &p_info, bool p_return_nil_is_variant) {
|
||||
MethodBind *a = memnew((MethodBindVarArgT<T>)(p_method, p_info, p_return_nil_is_variant));
|
||||
a->set_instance_class(T::get_class_static());
|
||||
return a;
|
||||
|
@ -241,12 +241,12 @@ class MethodBindVarArgTR : public MethodBindVarArgBase<MethodBindVarArgTR<T, R>,
|
|||
friend class MethodBindVarArgBase<MethodBindVarArgTR<T, R>, T, R, true>;
|
||||
|
||||
public:
|
||||
virtual Variant call(GDExtensionClassInstancePtr p_instance, GDNativeConstVariantPtr *p_args, GDNativeInt p_argument_count, GDNativeCallError &r_error) const {
|
||||
virtual Variant call(GDExtensionClassInstancePtr p_instance, GDExtensionConstVariantPtr *p_args, GDExtensionInt p_argument_count, GDExtensionCallError &r_error) const {
|
||||
return (static_cast<T *>(p_instance)->*MethodBindVarArgBase<MethodBindVarArgTR<T, R>, T, R, true>::method)((const Variant **)p_args, p_argument_count, r_error);
|
||||
}
|
||||
|
||||
MethodBindVarArgTR(
|
||||
R (T::*p_method)(const Variant **, GDNativeInt, GDNativeCallError &),
|
||||
R (T::*p_method)(const Variant **, GDExtensionInt, GDExtensionCallError &),
|
||||
const MethodInfo &p_info,
|
||||
bool p_return_nil_is_variant) :
|
||||
MethodBindVarArgBase<MethodBindVarArgTR<T, R>, T, R, true>(p_method, p_info, p_return_nil_is_variant) {
|
||||
|
@ -259,7 +259,7 @@ private:
|
|||
};
|
||||
|
||||
template <class T, class R>
|
||||
MethodBind *create_vararg_method_bind(R (T::*p_method)(const Variant **, GDNativeInt, GDNativeCallError &), const MethodInfo &p_info, bool p_return_nil_is_variant) {
|
||||
MethodBind *create_vararg_method_bind(R (T::*p_method)(const Variant **, GDExtensionInt, GDExtensionCallError &), const MethodInfo &p_info, bool p_return_nil_is_variant) {
|
||||
MethodBind *a = memnew((MethodBindVarArgTR<T, R>)(p_method, p_info, p_return_nil_is_variant));
|
||||
a->set_instance_class(T::get_class_static());
|
||||
return a;
|
||||
|
@ -288,11 +288,11 @@ protected:
|
|||
#pragma GCC diagnostic push
|
||||
#pragma GCC diagnostic ignored "-Wlogical-op"
|
||||
#endif
|
||||
virtual GDNativeVariantType gen_argument_type(int p_arg) const {
|
||||
virtual GDExtensionVariantType gen_argument_type(int p_arg) const {
|
||||
if (p_arg >= 0 && p_arg < (int)sizeof...(P)) {
|
||||
return call_get_argument_type<P...>(p_arg);
|
||||
} else {
|
||||
return GDNATIVE_VARIANT_TYPE_NIL;
|
||||
return GDEXTENSION_VARIANT_TYPE_NIL;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -310,11 +310,11 @@ protected:
|
|||
#endif
|
||||
|
||||
public:
|
||||
virtual GDNativeExtensionClassMethodArgumentMetadata get_argument_metadata(int p_argument) const {
|
||||
virtual GDExtensionClassMethodArgumentMetadata get_argument_metadata(int p_argument) const {
|
||||
return call_get_argument_metadata<P...>(p_argument);
|
||||
}
|
||||
|
||||
virtual Variant call(GDExtensionClassInstancePtr p_instance, GDNativeConstVariantPtr *p_args, GDNativeInt p_argument_count, GDNativeCallError &r_error) const {
|
||||
virtual Variant call(GDExtensionClassInstancePtr p_instance, GDExtensionConstVariantPtr *p_args, GDExtensionInt p_argument_count, GDExtensionCallError &r_error) const {
|
||||
#ifdef TYPED_METHOD_BIND
|
||||
call_with_variant_args_dv(static_cast<T *>(p_instance), method, p_args, (int)p_argument_count, r_error, get_default_arguments());
|
||||
#else
|
||||
|
@ -322,7 +322,7 @@ public:
|
|||
#endif
|
||||
return Variant();
|
||||
}
|
||||
virtual void ptrcall(GDExtensionClassInstancePtr p_instance, GDNativeConstTypePtr *p_args, GDNativeTypePtr r_ret) const {
|
||||
virtual void ptrcall(GDExtensionClassInstancePtr p_instance, GDExtensionConstTypePtr *p_args, GDExtensionTypePtr r_ret) const {
|
||||
#ifdef TYPED_METHOD_BIND
|
||||
call_with_ptr_args<T, P...>(static_cast<T *>(p_instance), method, p_args, nullptr);
|
||||
#else
|
||||
|
@ -364,11 +364,11 @@ protected:
|
|||
#pragma GCC diagnostic push
|
||||
#pragma GCC diagnostic ignored "-Wlogical-op"
|
||||
#endif
|
||||
virtual GDNativeVariantType gen_argument_type(int p_arg) const {
|
||||
virtual GDExtensionVariantType gen_argument_type(int p_arg) const {
|
||||
if (p_arg >= 0 && p_arg < (int)sizeof...(P)) {
|
||||
return call_get_argument_type<P...>(p_arg);
|
||||
} else {
|
||||
return GDNATIVE_VARIANT_TYPE_NIL;
|
||||
return GDEXTENSION_VARIANT_TYPE_NIL;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -386,11 +386,11 @@ protected:
|
|||
#endif
|
||||
|
||||
public:
|
||||
virtual GDNativeExtensionClassMethodArgumentMetadata get_argument_metadata(int p_argument) const {
|
||||
virtual GDExtensionClassMethodArgumentMetadata get_argument_metadata(int p_argument) const {
|
||||
return call_get_argument_metadata<P...>(p_argument);
|
||||
}
|
||||
|
||||
virtual Variant call(GDExtensionClassInstancePtr p_instance, GDNativeConstVariantPtr *p_args, GDNativeInt p_argument_count, GDNativeCallError &r_error) const {
|
||||
virtual Variant call(GDExtensionClassInstancePtr p_instance, GDExtensionConstVariantPtr *p_args, GDExtensionInt p_argument_count, GDExtensionCallError &r_error) const {
|
||||
#ifdef TYPED_METHOD_BIND
|
||||
call_with_variant_argsc_dv(static_cast<T *>(p_instance), method, p_args, (int)p_argument_count, r_error, get_default_arguments());
|
||||
#else
|
||||
|
@ -398,7 +398,7 @@ public:
|
|||
#endif
|
||||
return Variant();
|
||||
}
|
||||
virtual void ptrcall(GDExtensionClassInstancePtr p_instance, GDNativeConstTypePtr *p_args, GDNativeTypePtr r_ret) const {
|
||||
virtual void ptrcall(GDExtensionClassInstancePtr p_instance, GDExtensionConstTypePtr *p_args, GDExtensionTypePtr r_ret) const {
|
||||
#ifdef TYPED_METHOD_BIND
|
||||
call_with_ptr_args<T, P...>(static_cast<T *>(p_instance), method, p_args, nullptr);
|
||||
#else
|
||||
|
@ -441,11 +441,11 @@ protected:
|
|||
#pragma GCC diagnostic push
|
||||
#pragma GCC diagnostic ignored "-Wlogical-op"
|
||||
#endif
|
||||
virtual GDNativeVariantType gen_argument_type(int p_arg) const {
|
||||
virtual GDExtensionVariantType gen_argument_type(int p_arg) const {
|
||||
if (p_arg >= 0 && p_arg < (int)sizeof...(P)) {
|
||||
return call_get_argument_type<P...>(p_arg);
|
||||
} else {
|
||||
return GDNativeVariantType(GetTypeInfo<R>::VARIANT_TYPE);
|
||||
return GDExtensionVariantType(GetTypeInfo<R>::VARIANT_TYPE);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -463,7 +463,7 @@ protected:
|
|||
#endif
|
||||
|
||||
public:
|
||||
virtual GDNativeExtensionClassMethodArgumentMetadata get_argument_metadata(int p_argument) const {
|
||||
virtual GDExtensionClassMethodArgumentMetadata get_argument_metadata(int p_argument) const {
|
||||
if (p_argument >= 0) {
|
||||
return call_get_argument_metadata<P...>(p_argument);
|
||||
} else {
|
||||
|
@ -471,7 +471,7 @@ public:
|
|||
}
|
||||
}
|
||||
|
||||
virtual Variant call(GDExtensionClassInstancePtr p_instance, GDNativeConstVariantPtr *p_args, GDNativeInt p_argument_count, GDNativeCallError &r_error) const {
|
||||
virtual Variant call(GDExtensionClassInstancePtr p_instance, GDExtensionConstVariantPtr *p_args, GDExtensionInt p_argument_count, GDExtensionCallError &r_error) const {
|
||||
Variant ret;
|
||||
#ifdef TYPED_METHOD_BIND
|
||||
call_with_variant_args_ret_dv(static_cast<T *>(p_instance), method, p_args, (int)p_argument_count, ret, r_error, get_default_arguments());
|
||||
|
@ -480,7 +480,7 @@ public:
|
|||
#endif
|
||||
return ret;
|
||||
}
|
||||
virtual void ptrcall(GDExtensionClassInstancePtr p_instance, GDNativeConstTypePtr *p_args, GDNativeTypePtr r_ret) const {
|
||||
virtual void ptrcall(GDExtensionClassInstancePtr p_instance, GDExtensionConstTypePtr *p_args, GDExtensionTypePtr r_ret) const {
|
||||
#ifdef TYPED_METHOD_BIND
|
||||
call_with_ptr_args<T, R, P...>(static_cast<T *>(p_instance), method, p_args, r_ret);
|
||||
#else
|
||||
|
@ -524,11 +524,11 @@ protected:
|
|||
#pragma GCC diagnostic push
|
||||
#pragma GCC diagnostic ignored "-Wlogical-op"
|
||||
#endif
|
||||
virtual GDNativeVariantType gen_argument_type(int p_arg) const {
|
||||
virtual GDExtensionVariantType gen_argument_type(int p_arg) const {
|
||||
if (p_arg >= 0 && p_arg < (int)sizeof...(P)) {
|
||||
return call_get_argument_type<P...>(p_arg);
|
||||
} else {
|
||||
return GDNativeVariantType(GetTypeInfo<R>::VARIANT_TYPE);
|
||||
return GDExtensionVariantType(GetTypeInfo<R>::VARIANT_TYPE);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -546,7 +546,7 @@ protected:
|
|||
#endif
|
||||
|
||||
public:
|
||||
virtual GDNativeExtensionClassMethodArgumentMetadata get_argument_metadata(int p_argument) const {
|
||||
virtual GDExtensionClassMethodArgumentMetadata get_argument_metadata(int p_argument) const {
|
||||
if (p_argument >= 0) {
|
||||
return call_get_argument_metadata<P...>(p_argument);
|
||||
} else {
|
||||
|
@ -554,7 +554,7 @@ public:
|
|||
}
|
||||
}
|
||||
|
||||
virtual Variant call(GDExtensionClassInstancePtr p_instance, GDNativeConstVariantPtr *p_args, GDNativeInt p_argument_count, GDNativeCallError &r_error) const {
|
||||
virtual Variant call(GDExtensionClassInstancePtr p_instance, GDExtensionConstVariantPtr *p_args, GDExtensionInt p_argument_count, GDExtensionCallError &r_error) const {
|
||||
Variant ret;
|
||||
#ifdef TYPED_METHOD_BIND
|
||||
call_with_variant_args_retc_dv(static_cast<T *>(p_instance), method, p_args, (int)p_argument_count, ret, r_error, get_default_arguments());
|
||||
|
@ -563,7 +563,7 @@ public:
|
|||
#endif
|
||||
return ret;
|
||||
}
|
||||
virtual void ptrcall(GDExtensionClassInstancePtr p_instance, GDNativeConstTypePtr *p_args, GDNativeTypePtr r_ret) const {
|
||||
virtual void ptrcall(GDExtensionClassInstancePtr p_instance, GDExtensionConstTypePtr *p_args, GDExtensionTypePtr r_ret) const {
|
||||
#ifdef TYPED_METHOD_BIND
|
||||
call_with_ptr_args<T, R, P...>(static_cast<T *>(p_instance), method, p_args, r_ret);
|
||||
#else
|
||||
|
@ -604,11 +604,11 @@ protected:
|
|||
#pragma GCC diagnostic push
|
||||
#pragma GCC diagnostic ignored "-Wlogical-op"
|
||||
#endif
|
||||
virtual GDNativeVariantType gen_argument_type(int p_arg) const {
|
||||
virtual GDExtensionVariantType gen_argument_type(int p_arg) const {
|
||||
if (p_arg >= 0 && p_arg < (int)sizeof...(P)) {
|
||||
return call_get_argument_type<P...>(p_arg);
|
||||
} else {
|
||||
return GDNATIVE_VARIANT_TYPE_NIL;
|
||||
return GDEXTENSION_VARIANT_TYPE_NIL;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -626,17 +626,17 @@ protected:
|
|||
#endif
|
||||
|
||||
public:
|
||||
virtual GDNativeExtensionClassMethodArgumentMetadata get_argument_metadata(int p_arg) const {
|
||||
virtual GDExtensionClassMethodArgumentMetadata get_argument_metadata(int p_arg) const {
|
||||
return call_get_argument_metadata<P...>(p_arg);
|
||||
}
|
||||
|
||||
virtual Variant call(GDExtensionClassInstancePtr p_object, GDNativeConstVariantPtr *p_args, GDNativeInt p_arg_count, GDNativeCallError &r_error) const {
|
||||
virtual Variant call(GDExtensionClassInstancePtr p_object, GDExtensionConstVariantPtr *p_args, GDExtensionInt p_arg_count, GDExtensionCallError &r_error) const {
|
||||
(void)p_object; // unused
|
||||
call_with_variant_args_static_dv(function, p_args, p_arg_count, r_error, get_default_arguments());
|
||||
return Variant();
|
||||
}
|
||||
|
||||
virtual void ptrcall(GDExtensionClassInstancePtr p_object, GDNativeConstTypePtr *p_args, GDNativeTypePtr r_ret) const {
|
||||
virtual void ptrcall(GDExtensionClassInstancePtr p_object, GDExtensionConstTypePtr *p_args, GDExtensionTypePtr r_ret) const {
|
||||
(void)p_object;
|
||||
(void)r_ret;
|
||||
call_with_ptr_args_static_method(function, p_args);
|
||||
|
@ -669,11 +669,11 @@ protected:
|
|||
#pragma GCC diagnostic push
|
||||
#pragma GCC diagnostic ignored "-Wlogical-op"
|
||||
#endif
|
||||
virtual GDNativeVariantType gen_argument_type(int p_arg) const {
|
||||
virtual GDExtensionVariantType gen_argument_type(int p_arg) const {
|
||||
if (p_arg >= 0 && p_arg < (int)sizeof...(P)) {
|
||||
return call_get_argument_type<P...>(p_arg);
|
||||
} else {
|
||||
return GDNativeVariantType(GetTypeInfo<R>::VARIANT_TYPE);
|
||||
return GDExtensionVariantType(GetTypeInfo<R>::VARIANT_TYPE);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -692,7 +692,7 @@ protected:
|
|||
#endif
|
||||
|
||||
public:
|
||||
virtual GDNativeExtensionClassMethodArgumentMetadata get_argument_metadata(int p_arg) const {
|
||||
virtual GDExtensionClassMethodArgumentMetadata get_argument_metadata(int p_arg) const {
|
||||
if (p_arg >= 0) {
|
||||
return call_get_argument_metadata<P...>(p_arg);
|
||||
} else {
|
||||
|
@ -700,13 +700,13 @@ public:
|
|||
}
|
||||
}
|
||||
|
||||
virtual Variant call(GDExtensionClassInstancePtr p_object, GDNativeConstVariantPtr *p_args, GDNativeInt p_arg_count, GDNativeCallError &r_error) const {
|
||||
virtual Variant call(GDExtensionClassInstancePtr p_object, GDExtensionConstVariantPtr *p_args, GDExtensionInt p_arg_count, GDExtensionCallError &r_error) const {
|
||||
Variant ret;
|
||||
call_with_variant_args_static_ret_dv(function, p_args, p_arg_count, ret, r_error, get_default_arguments());
|
||||
return ret;
|
||||
}
|
||||
|
||||
virtual void ptrcall(GDExtensionClassInstancePtr p_object, GDNativeConstTypePtr *p_args, GDNativeTypePtr r_ret) const {
|
||||
virtual void ptrcall(GDExtensionClassInstancePtr p_object, GDExtensionConstTypePtr *p_args, GDExtensionTypePtr r_ret) const {
|
||||
(void)p_object;
|
||||
call_with_ptr_args_static_method_ret(function, p_args, r_ret);
|
||||
}
|
||||
|
|
|
@ -168,7 +168,7 @@ MAKE_PTRARG_BY_REFERENCE(Variant);
|
|||
template <class T>
|
||||
struct PtrToArg<T *> {
|
||||
_FORCE_INLINE_ static T *convert(const void *p_ptr) {
|
||||
return reinterpret_cast<T *>(godot::internal::gdn_interface->object_get_instance_binding(*reinterpret_cast<GDNativeObjectPtr *>(const_cast<void *>(p_ptr)), godot::internal::token, &T::___binding_callbacks));
|
||||
return reinterpret_cast<T *>(godot::internal::gde_interface->object_get_instance_binding(*reinterpret_cast<GDExtensionObjectPtr *>(const_cast<void *>(p_ptr)), godot::internal::token, &T::___binding_callbacks));
|
||||
}
|
||||
typedef Object *EncodeT;
|
||||
_FORCE_INLINE_ static void encode(T *p_var, void *p_ptr) {
|
||||
|
@ -179,7 +179,7 @@ struct PtrToArg<T *> {
|
|||
template <class T>
|
||||
struct PtrToArg<const T *> {
|
||||
_FORCE_INLINE_ static const T *convert(const void *p_ptr) {
|
||||
return reinterpret_cast<const T *>(godot::internal::gdn_interface->object_get_instance_binding(*reinterpret_cast<GDNativeObjectPtr *>(const_cast<void *>(p_ptr)), godot::internal::token, &T::___binding_callbacks));
|
||||
return reinterpret_cast<const T *>(godot::internal::gde_interface->object_get_instance_binding(*reinterpret_cast<GDExtensionObjectPtr *>(const_cast<void *>(p_ptr)), godot::internal::token, &T::___binding_callbacks));
|
||||
}
|
||||
typedef const Object *EncodeT;
|
||||
_FORCE_INLINE_ static void encode(T *p_var, void *p_ptr) {
|
||||
|
|
|
@ -41,7 +41,7 @@
|
|||
|
||||
#include <godot_cpp/godot.hpp>
|
||||
|
||||
#include <godot/gdnative_interface.h>
|
||||
#include <godot/gdextension_interface.h>
|
||||
|
||||
#include <vector>
|
||||
|
||||
|
@ -82,20 +82,20 @@ struct MethodInfo {
|
|||
|
||||
template <class... Args>
|
||||
MethodInfo::MethodInfo(StringName p_name, const Args &...args) :
|
||||
name(p_name), flags(GDNATIVE_EXTENSION_METHOD_FLAG_NORMAL) {
|
||||
name(p_name), flags(GDEXTENSION_METHOD_FLAG_NORMAL) {
|
||||
arguments = { args... };
|
||||
}
|
||||
|
||||
template <class... Args>
|
||||
MethodInfo::MethodInfo(Variant::Type ret, StringName p_name, const Args &...args) :
|
||||
name(p_name), flags(GDNATIVE_EXTENSION_METHOD_FLAG_NORMAL) {
|
||||
name(p_name), flags(GDEXTENSION_METHOD_FLAG_NORMAL) {
|
||||
return_val.type = ret;
|
||||
arguments = { args... };
|
||||
}
|
||||
|
||||
template <class... Args>
|
||||
MethodInfo::MethodInfo(const PropertyInfo &p_ret, StringName p_name, const Args &...args) :
|
||||
name(p_name), return_val(p_ret), flags(GDNATIVE_EXTENSION_METHOD_FLAG_NORMAL) {
|
||||
name(p_name), return_val(p_ret), flags(GDEXTENSION_METHOD_FLAG_NORMAL) {
|
||||
arguments = { args... };
|
||||
}
|
||||
|
||||
|
@ -124,11 +124,11 @@ public:
|
|||
class ObjectDB {
|
||||
public:
|
||||
static Object *get_instance(uint64_t p_object_id) {
|
||||
GDNativeObjectPtr obj = internal::gdn_interface->object_get_instance_from_id(p_object_id);
|
||||
GDExtensionObjectPtr obj = internal::gde_interface->object_get_instance_from_id(p_object_id);
|
||||
if (obj == nullptr) {
|
||||
return nullptr;
|
||||
}
|
||||
return reinterpret_cast<Object *>(internal::gdn_interface->object_get_instance_binding(obj, internal::token, &Object::___binding_callbacks));
|
||||
return reinterpret_cast<Object *>(internal::gde_interface->object_get_instance_binding(obj, internal::token, &Object::___binding_callbacks));
|
||||
}
|
||||
};
|
||||
|
||||
|
@ -138,11 +138,11 @@ T *Object::cast_to(Object *p_object) {
|
|||
return nullptr;
|
||||
}
|
||||
StringName class_name = T::get_class_static();
|
||||
GDNativeObjectPtr casted = internal::gdn_interface->object_cast_to(p_object->_owner, internal::gdn_interface->classdb_get_class_tag(class_name._native_ptr()));
|
||||
GDExtensionObjectPtr casted = internal::gde_interface->object_cast_to(p_object->_owner, internal::gde_interface->classdb_get_class_tag(class_name._native_ptr()));
|
||||
if (casted == nullptr) {
|
||||
return nullptr;
|
||||
}
|
||||
return reinterpret_cast<T *>(internal::gdn_interface->object_get_instance_binding(casted, internal::token, &T::___binding_callbacks));
|
||||
return reinterpret_cast<T *>(internal::gde_interface->object_get_instance_binding(casted, internal::token, &T::___binding_callbacks));
|
||||
}
|
||||
|
||||
template <class T>
|
||||
|
@ -151,11 +151,11 @@ const T *Object::cast_to(const Object *p_object) {
|
|||
return nullptr;
|
||||
}
|
||||
StringName class_name = T::get_class_static();
|
||||
GDNativeObjectPtr casted = internal::gdn_interface->object_cast_to(p_object->_owner, internal::gdn_interface->classdb_get_class_tag(class_name._native_ptr()));
|
||||
GDExtensionObjectPtr casted = internal::gde_interface->object_cast_to(p_object->_owner, internal::gde_interface->classdb_get_class_tag(class_name._native_ptr()));
|
||||
if (casted == nullptr) {
|
||||
return nullptr;
|
||||
}
|
||||
return reinterpret_cast<const T *>(internal::gdn_interface->object_get_instance_binding(casted, internal::token, &T::___binding_callbacks));
|
||||
return reinterpret_cast<const T *>(internal::gde_interface->object_get_instance_binding(casted, internal::token, &T::___binding_callbacks));
|
||||
}
|
||||
|
||||
} // namespace godot
|
||||
|
|
|
@ -39,7 +39,7 @@
|
|||
|
||||
#include <godot_cpp/godot.hpp>
|
||||
|
||||
#include <godot/gdnative_interface.h>
|
||||
#include <godot/gdextension_interface.h>
|
||||
|
||||
namespace godot {
|
||||
|
||||
|
@ -66,7 +66,7 @@ struct PropertyInfo {
|
|||
}
|
||||
}
|
||||
|
||||
PropertyInfo(GDNativeVariantType p_type, const StringName &p_name, PropertyHint p_hint = PROPERTY_HINT_NONE, const String &p_hint_string = "", uint32_t p_usage = PROPERTY_USAGE_DEFAULT, const StringName &p_class_name = "") :
|
||||
PropertyInfo(GDExtensionVariantType p_type, const StringName &p_name, PropertyHint p_hint = PROPERTY_HINT_NONE, const String &p_hint_string = "", uint32_t p_usage = PROPERTY_USAGE_DEFAULT, const StringName &p_class_name = "") :
|
||||
PropertyInfo((Variant::Type)p_type, p_name, p_hint, p_hint_string, p_usage, p_class_name) {}
|
||||
};
|
||||
|
||||
|
|
|
@ -35,7 +35,7 @@
|
|||
#include <godot_cpp/variant/typed_array.hpp>
|
||||
#include <godot_cpp/variant/variant.hpp>
|
||||
|
||||
#include <godot/gdnative_interface.h>
|
||||
#include <godot/gdextension_interface.h>
|
||||
|
||||
namespace godot {
|
||||
|
||||
|
@ -96,16 +96,16 @@ struct GetTypeInfo;
|
|||
#define MAKE_TYPE_INFO(m_type, m_var_type) \
|
||||
template <> \
|
||||
struct GetTypeInfo<m_type> { \
|
||||
static constexpr GDNativeVariantType VARIANT_TYPE = m_var_type; \
|
||||
static constexpr GDNativeExtensionClassMethodArgumentMetadata METADATA = GDNATIVE_EXTENSION_METHOD_ARGUMENT_METADATA_NONE; \
|
||||
static constexpr GDExtensionVariantType VARIANT_TYPE = m_var_type; \
|
||||
static constexpr GDExtensionClassMethodArgumentMetadata METADATA = GDEXTENSION_METHOD_ARGUMENT_METADATA_NONE; \
|
||||
static inline PropertyInfo get_class_info() { \
|
||||
return make_property_info((Variant::Type)VARIANT_TYPE, ""); \
|
||||
} \
|
||||
}; \
|
||||
template <> \
|
||||
struct GetTypeInfo<const m_type &> { \
|
||||
static constexpr GDNativeVariantType VARIANT_TYPE = m_var_type; \
|
||||
static constexpr GDNativeExtensionClassMethodArgumentMetadata METADATA = GDNATIVE_EXTENSION_METHOD_ARGUMENT_METADATA_NONE; \
|
||||
static constexpr GDExtensionVariantType VARIANT_TYPE = m_var_type; \
|
||||
static constexpr GDExtensionClassMethodArgumentMetadata METADATA = GDEXTENSION_METHOD_ARGUMENT_METADATA_NONE; \
|
||||
static inline PropertyInfo get_class_info() { \
|
||||
return make_property_info((Variant::Type)VARIANT_TYPE, ""); \
|
||||
} \
|
||||
|
@ -114,74 +114,74 @@ struct GetTypeInfo;
|
|||
#define MAKE_TYPE_INFO_WITH_META(m_type, m_var_type, m_metadata) \
|
||||
template <> \
|
||||
struct GetTypeInfo<m_type> { \
|
||||
static constexpr GDNativeVariantType VARIANT_TYPE = m_var_type; \
|
||||
static constexpr GDNativeExtensionClassMethodArgumentMetadata METADATA = m_metadata; \
|
||||
static constexpr GDExtensionVariantType VARIANT_TYPE = m_var_type; \
|
||||
static constexpr GDExtensionClassMethodArgumentMetadata METADATA = m_metadata; \
|
||||
static inline PropertyInfo get_class_info() { \
|
||||
return make_property_info((Variant::Type)VARIANT_TYPE, ""); \
|
||||
} \
|
||||
}; \
|
||||
template <> \
|
||||
struct GetTypeInfo<const m_type &> { \
|
||||
static constexpr GDNativeVariantType VARIANT_TYPE = m_var_type; \
|
||||
static constexpr GDNativeExtensionClassMethodArgumentMetadata METADATA = m_metadata; \
|
||||
static constexpr GDExtensionVariantType VARIANT_TYPE = m_var_type; \
|
||||
static constexpr GDExtensionClassMethodArgumentMetadata METADATA = m_metadata; \
|
||||
static inline PropertyInfo get_class_info() { \
|
||||
return make_property_info((Variant::Type)VARIANT_TYPE, ""); \
|
||||
} \
|
||||
};
|
||||
|
||||
MAKE_TYPE_INFO(bool, GDNATIVE_VARIANT_TYPE_BOOL)
|
||||
MAKE_TYPE_INFO_WITH_META(uint8_t, GDNATIVE_VARIANT_TYPE_INT, GDNATIVE_EXTENSION_METHOD_ARGUMENT_METADATA_INT_IS_UINT8)
|
||||
MAKE_TYPE_INFO_WITH_META(int8_t, GDNATIVE_VARIANT_TYPE_INT, GDNATIVE_EXTENSION_METHOD_ARGUMENT_METADATA_INT_IS_INT8)
|
||||
MAKE_TYPE_INFO_WITH_META(uint16_t, GDNATIVE_VARIANT_TYPE_INT, GDNATIVE_EXTENSION_METHOD_ARGUMENT_METADATA_INT_IS_UINT16)
|
||||
MAKE_TYPE_INFO_WITH_META(int16_t, GDNATIVE_VARIANT_TYPE_INT, GDNATIVE_EXTENSION_METHOD_ARGUMENT_METADATA_INT_IS_INT16)
|
||||
MAKE_TYPE_INFO_WITH_META(uint32_t, GDNATIVE_VARIANT_TYPE_INT, GDNATIVE_EXTENSION_METHOD_ARGUMENT_METADATA_INT_IS_UINT32)
|
||||
MAKE_TYPE_INFO_WITH_META(int32_t, GDNATIVE_VARIANT_TYPE_INT, GDNATIVE_EXTENSION_METHOD_ARGUMENT_METADATA_INT_IS_INT32)
|
||||
MAKE_TYPE_INFO_WITH_META(uint64_t, GDNATIVE_VARIANT_TYPE_INT, GDNATIVE_EXTENSION_METHOD_ARGUMENT_METADATA_INT_IS_UINT64)
|
||||
MAKE_TYPE_INFO_WITH_META(int64_t, GDNATIVE_VARIANT_TYPE_INT, GDNATIVE_EXTENSION_METHOD_ARGUMENT_METADATA_INT_IS_INT64)
|
||||
MAKE_TYPE_INFO(char16_t, GDNATIVE_VARIANT_TYPE_INT)
|
||||
MAKE_TYPE_INFO(char32_t, GDNATIVE_VARIANT_TYPE_INT)
|
||||
MAKE_TYPE_INFO_WITH_META(float, GDNATIVE_VARIANT_TYPE_FLOAT, GDNATIVE_EXTENSION_METHOD_ARGUMENT_METADATA_REAL_IS_FLOAT)
|
||||
MAKE_TYPE_INFO_WITH_META(double, GDNATIVE_VARIANT_TYPE_FLOAT, GDNATIVE_EXTENSION_METHOD_ARGUMENT_METADATA_REAL_IS_DOUBLE)
|
||||
MAKE_TYPE_INFO(bool, GDEXTENSION_VARIANT_TYPE_BOOL)
|
||||
MAKE_TYPE_INFO_WITH_META(uint8_t, GDEXTENSION_VARIANT_TYPE_INT, GDEXTENSION_METHOD_ARGUMENT_METADATA_INT_IS_UINT8)
|
||||
MAKE_TYPE_INFO_WITH_META(int8_t, GDEXTENSION_VARIANT_TYPE_INT, GDEXTENSION_METHOD_ARGUMENT_METADATA_INT_IS_INT8)
|
||||
MAKE_TYPE_INFO_WITH_META(uint16_t, GDEXTENSION_VARIANT_TYPE_INT, GDEXTENSION_METHOD_ARGUMENT_METADATA_INT_IS_UINT16)
|
||||
MAKE_TYPE_INFO_WITH_META(int16_t, GDEXTENSION_VARIANT_TYPE_INT, GDEXTENSION_METHOD_ARGUMENT_METADATA_INT_IS_INT16)
|
||||
MAKE_TYPE_INFO_WITH_META(uint32_t, GDEXTENSION_VARIANT_TYPE_INT, GDEXTENSION_METHOD_ARGUMENT_METADATA_INT_IS_UINT32)
|
||||
MAKE_TYPE_INFO_WITH_META(int32_t, GDEXTENSION_VARIANT_TYPE_INT, GDEXTENSION_METHOD_ARGUMENT_METADATA_INT_IS_INT32)
|
||||
MAKE_TYPE_INFO_WITH_META(uint64_t, GDEXTENSION_VARIANT_TYPE_INT, GDEXTENSION_METHOD_ARGUMENT_METADATA_INT_IS_UINT64)
|
||||
MAKE_TYPE_INFO_WITH_META(int64_t, GDEXTENSION_VARIANT_TYPE_INT, GDEXTENSION_METHOD_ARGUMENT_METADATA_INT_IS_INT64)
|
||||
MAKE_TYPE_INFO(char16_t, GDEXTENSION_VARIANT_TYPE_INT)
|
||||
MAKE_TYPE_INFO(char32_t, GDEXTENSION_VARIANT_TYPE_INT)
|
||||
MAKE_TYPE_INFO_WITH_META(float, GDEXTENSION_VARIANT_TYPE_FLOAT, GDEXTENSION_METHOD_ARGUMENT_METADATA_REAL_IS_FLOAT)
|
||||
MAKE_TYPE_INFO_WITH_META(double, GDEXTENSION_VARIANT_TYPE_FLOAT, GDEXTENSION_METHOD_ARGUMENT_METADATA_REAL_IS_DOUBLE)
|
||||
|
||||
MAKE_TYPE_INFO(String, GDNATIVE_VARIANT_TYPE_STRING)
|
||||
MAKE_TYPE_INFO(Vector2, GDNATIVE_VARIANT_TYPE_VECTOR2)
|
||||
MAKE_TYPE_INFO(Vector2i, GDNATIVE_VARIANT_TYPE_VECTOR2I)
|
||||
MAKE_TYPE_INFO(Rect2, GDNATIVE_VARIANT_TYPE_RECT2)
|
||||
MAKE_TYPE_INFO(Rect2i, GDNATIVE_VARIANT_TYPE_RECT2I)
|
||||
MAKE_TYPE_INFO(Vector3, GDNATIVE_VARIANT_TYPE_VECTOR3)
|
||||
MAKE_TYPE_INFO(Vector3i, GDNATIVE_VARIANT_TYPE_VECTOR3I)
|
||||
MAKE_TYPE_INFO(Transform2D, GDNATIVE_VARIANT_TYPE_TRANSFORM2D)
|
||||
MAKE_TYPE_INFO(Vector4, GDNATIVE_VARIANT_TYPE_VECTOR4)
|
||||
MAKE_TYPE_INFO(Vector4i, GDNATIVE_VARIANT_TYPE_VECTOR4I)
|
||||
MAKE_TYPE_INFO(Plane, GDNATIVE_VARIANT_TYPE_PLANE)
|
||||
MAKE_TYPE_INFO(Quaternion, GDNATIVE_VARIANT_TYPE_QUATERNION)
|
||||
MAKE_TYPE_INFO(AABB, GDNATIVE_VARIANT_TYPE_AABB)
|
||||
MAKE_TYPE_INFO(Basis, GDNATIVE_VARIANT_TYPE_BASIS)
|
||||
MAKE_TYPE_INFO(Transform3D, GDNATIVE_VARIANT_TYPE_TRANSFORM3D)
|
||||
MAKE_TYPE_INFO(Projection, GDNATIVE_VARIANT_TYPE_PROJECTION)
|
||||
MAKE_TYPE_INFO(Color, GDNATIVE_VARIANT_TYPE_COLOR)
|
||||
MAKE_TYPE_INFO(StringName, GDNATIVE_VARIANT_TYPE_STRING_NAME)
|
||||
MAKE_TYPE_INFO(NodePath, GDNATIVE_VARIANT_TYPE_NODE_PATH)
|
||||
MAKE_TYPE_INFO(RID, GDNATIVE_VARIANT_TYPE_RID)
|
||||
MAKE_TYPE_INFO(Callable, GDNATIVE_VARIANT_TYPE_CALLABLE)
|
||||
MAKE_TYPE_INFO(Signal, GDNATIVE_VARIANT_TYPE_SIGNAL)
|
||||
MAKE_TYPE_INFO(Dictionary, GDNATIVE_VARIANT_TYPE_DICTIONARY)
|
||||
MAKE_TYPE_INFO(Array, GDNATIVE_VARIANT_TYPE_ARRAY)
|
||||
MAKE_TYPE_INFO(PackedByteArray, GDNATIVE_VARIANT_TYPE_PACKED_BYTE_ARRAY)
|
||||
MAKE_TYPE_INFO(PackedInt32Array, GDNATIVE_VARIANT_TYPE_PACKED_INT32_ARRAY)
|
||||
MAKE_TYPE_INFO(PackedInt64Array, GDNATIVE_VARIANT_TYPE_PACKED_INT64_ARRAY)
|
||||
MAKE_TYPE_INFO(PackedFloat32Array, GDNATIVE_VARIANT_TYPE_PACKED_FLOAT32_ARRAY)
|
||||
MAKE_TYPE_INFO(PackedFloat64Array, GDNATIVE_VARIANT_TYPE_PACKED_FLOAT64_ARRAY)
|
||||
MAKE_TYPE_INFO(PackedStringArray, GDNATIVE_VARIANT_TYPE_PACKED_STRING_ARRAY)
|
||||
MAKE_TYPE_INFO(PackedVector2Array, GDNATIVE_VARIANT_TYPE_PACKED_VECTOR2_ARRAY)
|
||||
MAKE_TYPE_INFO(PackedVector3Array, GDNATIVE_VARIANT_TYPE_PACKED_VECTOR3_ARRAY)
|
||||
MAKE_TYPE_INFO(PackedColorArray, GDNATIVE_VARIANT_TYPE_PACKED_COLOR_ARRAY)
|
||||
MAKE_TYPE_INFO(String, GDEXTENSION_VARIANT_TYPE_STRING)
|
||||
MAKE_TYPE_INFO(Vector2, GDEXTENSION_VARIANT_TYPE_VECTOR2)
|
||||
MAKE_TYPE_INFO(Vector2i, GDEXTENSION_VARIANT_TYPE_VECTOR2I)
|
||||
MAKE_TYPE_INFO(Rect2, GDEXTENSION_VARIANT_TYPE_RECT2)
|
||||
MAKE_TYPE_INFO(Rect2i, GDEXTENSION_VARIANT_TYPE_RECT2I)
|
||||
MAKE_TYPE_INFO(Vector3, GDEXTENSION_VARIANT_TYPE_VECTOR3)
|
||||
MAKE_TYPE_INFO(Vector3i, GDEXTENSION_VARIANT_TYPE_VECTOR3I)
|
||||
MAKE_TYPE_INFO(Transform2D, GDEXTENSION_VARIANT_TYPE_TRANSFORM2D)
|
||||
MAKE_TYPE_INFO(Vector4, GDEXTENSION_VARIANT_TYPE_VECTOR4)
|
||||
MAKE_TYPE_INFO(Vector4i, GDEXTENSION_VARIANT_TYPE_VECTOR4I)
|
||||
MAKE_TYPE_INFO(Plane, GDEXTENSION_VARIANT_TYPE_PLANE)
|
||||
MAKE_TYPE_INFO(Quaternion, GDEXTENSION_VARIANT_TYPE_QUATERNION)
|
||||
MAKE_TYPE_INFO(AABB, GDEXTENSION_VARIANT_TYPE_AABB)
|
||||
MAKE_TYPE_INFO(Basis, GDEXTENSION_VARIANT_TYPE_BASIS)
|
||||
MAKE_TYPE_INFO(Transform3D, GDEXTENSION_VARIANT_TYPE_TRANSFORM3D)
|
||||
MAKE_TYPE_INFO(Projection, GDEXTENSION_VARIANT_TYPE_PROJECTION)
|
||||
MAKE_TYPE_INFO(Color, GDEXTENSION_VARIANT_TYPE_COLOR)
|
||||
MAKE_TYPE_INFO(StringName, GDEXTENSION_VARIANT_TYPE_STRING_NAME)
|
||||
MAKE_TYPE_INFO(NodePath, GDEXTENSION_VARIANT_TYPE_NODE_PATH)
|
||||
MAKE_TYPE_INFO(RID, GDEXTENSION_VARIANT_TYPE_RID)
|
||||
MAKE_TYPE_INFO(Callable, GDEXTENSION_VARIANT_TYPE_CALLABLE)
|
||||
MAKE_TYPE_INFO(Signal, GDEXTENSION_VARIANT_TYPE_SIGNAL)
|
||||
MAKE_TYPE_INFO(Dictionary, GDEXTENSION_VARIANT_TYPE_DICTIONARY)
|
||||
MAKE_TYPE_INFO(Array, GDEXTENSION_VARIANT_TYPE_ARRAY)
|
||||
MAKE_TYPE_INFO(PackedByteArray, GDEXTENSION_VARIANT_TYPE_PACKED_BYTE_ARRAY)
|
||||
MAKE_TYPE_INFO(PackedInt32Array, GDEXTENSION_VARIANT_TYPE_PACKED_INT32_ARRAY)
|
||||
MAKE_TYPE_INFO(PackedInt64Array, GDEXTENSION_VARIANT_TYPE_PACKED_INT64_ARRAY)
|
||||
MAKE_TYPE_INFO(PackedFloat32Array, GDEXTENSION_VARIANT_TYPE_PACKED_FLOAT32_ARRAY)
|
||||
MAKE_TYPE_INFO(PackedFloat64Array, GDEXTENSION_VARIANT_TYPE_PACKED_FLOAT64_ARRAY)
|
||||
MAKE_TYPE_INFO(PackedStringArray, GDEXTENSION_VARIANT_TYPE_PACKED_STRING_ARRAY)
|
||||
MAKE_TYPE_INFO(PackedVector2Array, GDEXTENSION_VARIANT_TYPE_PACKED_VECTOR2_ARRAY)
|
||||
MAKE_TYPE_INFO(PackedVector3Array, GDEXTENSION_VARIANT_TYPE_PACKED_VECTOR3_ARRAY)
|
||||
MAKE_TYPE_INFO(PackedColorArray, GDEXTENSION_VARIANT_TYPE_PACKED_COLOR_ARRAY)
|
||||
|
||||
// For variant.
|
||||
template <>
|
||||
struct GetTypeInfo<Variant> {
|
||||
static constexpr GDNativeVariantType VARIANT_TYPE = GDNATIVE_VARIANT_TYPE_NIL;
|
||||
static constexpr GDNativeExtensionClassMethodArgumentMetadata METADATA = GDNATIVE_EXTENSION_METHOD_ARGUMENT_METADATA_NONE;
|
||||
static constexpr GDExtensionVariantType VARIANT_TYPE = GDEXTENSION_VARIANT_TYPE_NIL;
|
||||
static constexpr GDExtensionClassMethodArgumentMetadata METADATA = GDEXTENSION_METHOD_ARGUMENT_METADATA_NONE;
|
||||
static inline PropertyInfo get_class_info() {
|
||||
return make_property_info(Variant::Type::NIL, "", PROPERTY_HINT_NONE, "", PROPERTY_USAGE_DEFAULT | PROPERTY_USAGE_NIL_IS_VARIANT);
|
||||
}
|
||||
|
@ -189,8 +189,8 @@ struct GetTypeInfo<Variant> {
|
|||
|
||||
template <>
|
||||
struct GetTypeInfo<const Variant &> {
|
||||
static constexpr GDNativeVariantType VARIANT_TYPE = GDNATIVE_VARIANT_TYPE_NIL;
|
||||
static constexpr GDNativeExtensionClassMethodArgumentMetadata METADATA = GDNATIVE_EXTENSION_METHOD_ARGUMENT_METADATA_NONE;
|
||||
static constexpr GDExtensionVariantType VARIANT_TYPE = GDEXTENSION_VARIANT_TYPE_NIL;
|
||||
static constexpr GDExtensionClassMethodArgumentMetadata METADATA = GDEXTENSION_METHOD_ARGUMENT_METADATA_NONE;
|
||||
static inline PropertyInfo get_class_info() {
|
||||
return make_property_info(Variant::Type::NIL, "", PROPERTY_HINT_NONE, "", PROPERTY_USAGE_DEFAULT | PROPERTY_USAGE_NIL_IS_VARIANT);
|
||||
}
|
||||
|
@ -198,8 +198,8 @@ struct GetTypeInfo<const Variant &> {
|
|||
|
||||
template <typename T>
|
||||
struct GetTypeInfo<T *, typename EnableIf<TypeInherits<Object, T>::value>::type> {
|
||||
static const GDNativeVariantType VARIANT_TYPE = GDNATIVE_VARIANT_TYPE_OBJECT;
|
||||
static const GDNativeExtensionClassMethodArgumentMetadata METADATA = GDNATIVE_EXTENSION_METHOD_ARGUMENT_METADATA_NONE;
|
||||
static const GDExtensionVariantType VARIANT_TYPE = GDEXTENSION_VARIANT_TYPE_OBJECT;
|
||||
static const GDExtensionClassMethodArgumentMetadata METADATA = GDEXTENSION_METHOD_ARGUMENT_METADATA_NONE;
|
||||
static inline PropertyInfo get_class_info() {
|
||||
return make_property_info(Variant::Type::OBJECT, T::get_class_static());
|
||||
}
|
||||
|
@ -207,8 +207,8 @@ struct GetTypeInfo<T *, typename EnableIf<TypeInherits<Object, T>::value>::type>
|
|||
|
||||
template <typename T>
|
||||
struct GetTypeInfo<const T *, typename EnableIf<TypeInherits<Object, T>::value>::type> {
|
||||
static const GDNativeVariantType VARIANT_TYPE = GDNATIVE_VARIANT_TYPE_OBJECT;
|
||||
static const GDNativeExtensionClassMethodArgumentMetadata METADATA = GDNATIVE_EXTENSION_METHOD_ARGUMENT_METADATA_NONE;
|
||||
static const GDExtensionVariantType VARIANT_TYPE = GDEXTENSION_VARIANT_TYPE_OBJECT;
|
||||
static const GDExtensionClassMethodArgumentMetadata METADATA = GDEXTENSION_METHOD_ARGUMENT_METADATA_NONE;
|
||||
static inline PropertyInfo get_class_info() {
|
||||
return make_property_info(Variant::Type::OBJECT, T::get_class_static());
|
||||
}
|
||||
|
@ -218,7 +218,7 @@ struct GetTypeInfo<const T *, typename EnableIf<TypeInherits<Object, T>::value>:
|
|||
template <> \
|
||||
struct GetTypeInfo<m_impl> { \
|
||||
static const Variant::Type VARIANT_TYPE = Variant::INT; \
|
||||
static const GDNativeExtensionClassMethodArgumentMetadata METADATA = GDNATIVE_EXTENSION_METHOD_ARGUMENT_METADATA_NONE; \
|
||||
static const GDExtensionClassMethodArgumentMetadata METADATA = GDEXTENSION_METHOD_ARGUMENT_METADATA_NONE; \
|
||||
static inline PropertyInfo get_class_info() { \
|
||||
return make_property_info(Variant::Type::INT, "", PROPERTY_HINT_NONE, "", PROPERTY_USAGE_DEFAULT | PROPERTY_USAGE_CLASS_IS_ENUM, #m_class "." #m_enum); \
|
||||
} \
|
||||
|
@ -255,7 +255,7 @@ public:
|
|||
template <> \
|
||||
struct GetTypeInfo<m_impl> { \
|
||||
static const Variant::Type VARIANT_TYPE = Variant::INT; \
|
||||
static const GDNativeExtensionClassMethodArgumentMetadata METADATA = GDNATIVE_EXTENSION_METHOD_ARGUMENT_METADATA_NONE; \
|
||||
static const GDExtensionClassMethodArgumentMetadata METADATA = GDEXTENSION_METHOD_ARGUMENT_METADATA_NONE; \
|
||||
static inline PropertyInfo get_class_info() { \
|
||||
return make_property_info(Variant::Type::INT, "", PROPERTY_HINT_NONE, "", PROPERTY_USAGE_DEFAULT | PROPERTY_USAGE_CLASS_IS_BITFIELD, \
|
||||
#m_class "." #m_enum); \
|
||||
|
@ -264,7 +264,7 @@ public:
|
|||
template <> \
|
||||
struct GetTypeInfo<BitField<m_impl>> { \
|
||||
static const Variant::Type VARIANT_TYPE = Variant::INT; \
|
||||
static const GDNativeExtensionClassMethodArgumentMetadata METADATA = GDNATIVE_EXTENSION_METHOD_ARGUMENT_METADATA_NONE; \
|
||||
static const GDExtensionClassMethodArgumentMetadata METADATA = GDEXTENSION_METHOD_ARGUMENT_METADATA_NONE; \
|
||||
static inline PropertyInfo get_class_info() { \
|
||||
return make_property_info(Variant::Type::INT, "", PROPERTY_HINT_NONE, "", PROPERTY_USAGE_DEFAULT | PROPERTY_USAGE_CLASS_IS_BITFIELD, \
|
||||
#m_class "." #m_enum); \
|
||||
|
@ -307,8 +307,8 @@ struct PtrToArg<const TypedArray<T> &> {
|
|||
|
||||
template <typename T>
|
||||
struct GetTypeInfo<TypedArray<T>> {
|
||||
static constexpr GDNativeVariantType VARIANT_TYPE = GDNATIVE_VARIANT_TYPE_ARRAY;
|
||||
static constexpr GDNativeExtensionClassMethodArgumentMetadata METADATA = GDNATIVE_EXTENSION_METHOD_ARGUMENT_METADATA_NONE;
|
||||
static constexpr GDExtensionVariantType VARIANT_TYPE = GDEXTENSION_VARIANT_TYPE_ARRAY;
|
||||
static constexpr GDExtensionClassMethodArgumentMetadata METADATA = GDEXTENSION_METHOD_ARGUMENT_METADATA_NONE;
|
||||
static inline PropertyInfo get_class_info() {
|
||||
return make_property_info(Variant::Type::ARRAY, "", PROPERTY_HINT_ARRAY_TYPE, T::get_class_static());
|
||||
}
|
||||
|
@ -316,8 +316,8 @@ struct GetTypeInfo<TypedArray<T>> {
|
|||
|
||||
template <typename T>
|
||||
struct GetTypeInfo<const TypedArray<T> &> {
|
||||
static constexpr GDNativeVariantType VARIANT_TYPE = GDNATIVE_VARIANT_TYPE_ARRAY;
|
||||
static constexpr GDNativeExtensionClassMethodArgumentMetadata METADATA = GDNATIVE_EXTENSION_METHOD_ARGUMENT_METADATA_NONE;
|
||||
static constexpr GDExtensionVariantType VARIANT_TYPE = GDEXTENSION_VARIANT_TYPE_ARRAY;
|
||||
static constexpr GDExtensionClassMethodArgumentMetadata METADATA = GDEXTENSION_METHOD_ARGUMENT_METADATA_NONE;
|
||||
static inline PropertyInfo get_class_info() {
|
||||
return make_property_info(Variant::Type::ARRAY, "", PROPERTY_HINT_ARRAY_TYPE, T::get_class_static());
|
||||
}
|
||||
|
@ -326,16 +326,16 @@ struct GetTypeInfo<const TypedArray<T> &> {
|
|||
#define MAKE_TYPED_ARRAY_INFO(m_type, m_variant_type) \
|
||||
template <> \
|
||||
struct GetTypeInfo<TypedArray<m_type>> { \
|
||||
static constexpr GDNativeVariantType VARIANT_TYPE = GDNATIVE_VARIANT_TYPE_ARRAY; \
|
||||
static constexpr GDNativeExtensionClassMethodArgumentMetadata METADATA = GDNATIVE_EXTENSION_METHOD_ARGUMENT_METADATA_NONE; \
|
||||
static constexpr GDExtensionVariantType VARIANT_TYPE = GDEXTENSION_VARIANT_TYPE_ARRAY; \
|
||||
static constexpr GDExtensionClassMethodArgumentMetadata METADATA = GDEXTENSION_METHOD_ARGUMENT_METADATA_NONE; \
|
||||
static inline PropertyInfo get_class_info() { \
|
||||
return make_property_info(Variant::Type::ARRAY, "", PROPERTY_HINT_ARRAY_TYPE, Variant::get_type_name(m_variant_type).utf8().get_data()); \
|
||||
} \
|
||||
}; \
|
||||
template <> \
|
||||
struct GetTypeInfo<const TypedArray<m_type> &> { \
|
||||
static constexpr GDNativeVariantType VARIANT_TYPE = GDNATIVE_VARIANT_TYPE_ARRAY; \
|
||||
static constexpr GDNativeExtensionClassMethodArgumentMetadata METADATA = GDNATIVE_EXTENSION_METHOD_ARGUMENT_METADATA_NONE; \
|
||||
static constexpr GDExtensionVariantType VARIANT_TYPE = GDEXTENSION_VARIANT_TYPE_ARRAY; \
|
||||
static constexpr GDExtensionClassMethodArgumentMetadata METADATA = GDEXTENSION_METHOD_ARGUMENT_METADATA_NONE; \
|
||||
static inline PropertyInfo get_class_info() { \
|
||||
return make_property_info(Variant::Type::ARRAY, "", PROPERTY_HINT_ARRAY_TYPE, Variant::get_type_name(m_variant_type).utf8().get_data()); \
|
||||
} \
|
||||
|
|
|
@ -31,23 +31,23 @@
|
|||
#ifndef GODOT_GODOT_HPP
|
||||
#define GODOT_GODOT_HPP
|
||||
|
||||
#include <godot/gdnative_interface.h>
|
||||
#include <godot/gdextension_interface.h>
|
||||
|
||||
namespace godot {
|
||||
|
||||
namespace internal {
|
||||
|
||||
extern "C" const GDNativeInterface *gdn_interface;
|
||||
extern "C" GDNativeExtensionClassLibraryPtr library;
|
||||
extern "C" const GDExtensionInterface *gde_interface;
|
||||
extern "C" GDExtensionClassLibraryPtr library;
|
||||
extern "C" void *token;
|
||||
|
||||
} // namespace internal
|
||||
|
||||
enum ModuleInitializationLevel {
|
||||
MODULE_INITIALIZATION_LEVEL_CORE = GDNATIVE_INITIALIZATION_CORE,
|
||||
MODULE_INITIALIZATION_LEVEL_SERVERS = GDNATIVE_INITIALIZATION_SERVERS,
|
||||
MODULE_INITIALIZATION_LEVEL_SCENE = GDNATIVE_INITIALIZATION_SCENE,
|
||||
MODULE_INITIALIZATION_LEVEL_EDITOR = GDNATIVE_INITIALIZATION_EDITOR
|
||||
MODULE_INITIALIZATION_LEVEL_CORE = GDEXTENSION_INITIALIZATION_CORE,
|
||||
MODULE_INITIALIZATION_LEVEL_SERVERS = GDEXTENSION_INITIALIZATION_SERVERS,
|
||||
MODULE_INITIALIZATION_LEVEL_SCENE = GDEXTENSION_INITIALIZATION_SCENE,
|
||||
MODULE_INITIALIZATION_LEVEL_EDITOR = GDEXTENSION_INITIALIZATION_EDITOR
|
||||
};
|
||||
|
||||
class GDExtensionBinding {
|
||||
|
@ -56,21 +56,21 @@ public:
|
|||
|
||||
static Callback init_callback;
|
||||
static Callback terminate_callback;
|
||||
static GDNativeInitializationLevel minimum_initialization_level;
|
||||
static GDNativeBool init(const GDNativeInterface *p_interface, GDNativeExtensionClassLibraryPtr p_library, GDNativeInitialization *r_initialization);
|
||||
static GDExtensionInitializationLevel minimum_initialization_level;
|
||||
static GDExtensionBool init(const GDExtensionInterface *p_interface, GDExtensionClassLibraryPtr p_library, GDExtensionInitialization *r_initialization);
|
||||
|
||||
public:
|
||||
static void initialize_level(void *userdata, GDNativeInitializationLevel p_level);
|
||||
static void deinitialize_level(void *userdata, GDNativeInitializationLevel p_level);
|
||||
static void initialize_level(void *userdata, GDExtensionInitializationLevel p_level);
|
||||
static void deinitialize_level(void *userdata, GDExtensionInitializationLevel p_level);
|
||||
|
||||
class InitObject {
|
||||
const GDNativeInterface *gdn_interface;
|
||||
GDNativeExtensionClassLibraryPtr library;
|
||||
GDNativeInitialization *initialization;
|
||||
const GDExtensionInterface *gde_interface;
|
||||
GDExtensionClassLibraryPtr library;
|
||||
GDExtensionInitialization *initialization;
|
||||
|
||||
public:
|
||||
InitObject(const GDNativeInterface *p_interface, GDNativeExtensionClassLibraryPtr p_library, GDNativeInitialization *r_initialization) :
|
||||
gdn_interface(p_interface),
|
||||
InitObject(const GDExtensionInterface *p_interface, GDExtensionClassLibraryPtr p_library, GDExtensionInitialization *r_initialization) :
|
||||
gde_interface(p_interface),
|
||||
library(p_library),
|
||||
initialization(r_initialization) {}
|
||||
|
||||
|
@ -78,7 +78,7 @@ public:
|
|||
void register_terminator(Callback p_init) const;
|
||||
void set_minimum_library_initialization_level(ModuleInitializationLevel p_level) const;
|
||||
|
||||
GDNativeBool init() const;
|
||||
GDExtensionBool init() const;
|
||||
};
|
||||
};
|
||||
|
||||
|
|
|
@ -36,7 +36,7 @@
|
|||
#include <godot_cpp/variant/builtin_types.hpp>
|
||||
#include <godot_cpp/variant/variant_size.hpp>
|
||||
|
||||
#include <godot/gdnative_interface.h>
|
||||
#include <godot/gdextension_interface.h>
|
||||
|
||||
#include <array>
|
||||
|
||||
|
@ -45,7 +45,7 @@ namespace godot {
|
|||
class Variant {
|
||||
uint8_t opaque[GODOT_CPP_VARIANT_SIZE]{ 0 };
|
||||
|
||||
_FORCE_INLINE_ GDNativeVariantPtr _native_ptr() const { return const_cast<uint8_t(*)[GODOT_CPP_VARIANT_SIZE]>(&opaque); }
|
||||
_FORCE_INLINE_ GDExtensionVariantPtr _native_ptr() const { return const_cast<uint8_t(*)[GODOT_CPP_VARIANT_SIZE]>(&opaque); }
|
||||
|
||||
friend class GDExtensionBinding;
|
||||
friend class MethodBind;
|
||||
|
@ -138,14 +138,14 @@ public:
|
|||
};
|
||||
|
||||
private:
|
||||
static GDNativeVariantFromTypeConstructorFunc from_type_constructor[VARIANT_MAX];
|
||||
static GDNativeTypeFromVariantConstructorFunc to_type_constructor[VARIANT_MAX];
|
||||
static GDExtensionVariantFromTypeConstructorFunc from_type_constructor[VARIANT_MAX];
|
||||
static GDExtensionTypeFromVariantConstructorFunc to_type_constructor[VARIANT_MAX];
|
||||
|
||||
public:
|
||||
Variant();
|
||||
Variant(std::nullptr_t n) :
|
||||
Variant() {}
|
||||
explicit Variant(GDNativeConstVariantPtr native_ptr);
|
||||
explicit Variant(GDExtensionConstVariantPtr native_ptr);
|
||||
Variant(const Variant &other);
|
||||
Variant(Variant &&other);
|
||||
Variant(bool v);
|
||||
|
@ -251,24 +251,24 @@ public:
|
|||
bool operator!=(const Variant &other) const;
|
||||
bool operator<(const Variant &other) const;
|
||||
|
||||
void call(const StringName &method, const Variant **args, int argcount, Variant &r_ret, GDNativeCallError &r_error);
|
||||
void call(const StringName &method, const Variant **args, int argcount, Variant &r_ret, GDExtensionCallError &r_error);
|
||||
|
||||
template <class... Args>
|
||||
Variant call(const StringName &method, Args... args) {
|
||||
Variant result;
|
||||
GDNativeCallError error;
|
||||
std::array<GDNativeConstVariantPtr, sizeof...(Args)> call_args = { Variant(args)... };
|
||||
GDExtensionCallError error;
|
||||
std::array<GDExtensionConstVariantPtr, sizeof...(Args)> call_args = { Variant(args)... };
|
||||
call(method, call_args.data(), call_args.size(), result, error);
|
||||
return result;
|
||||
}
|
||||
|
||||
static void call_static(Variant::Type type, const StringName &method, const Variant **args, int argcount, Variant &r_ret, GDNativeCallError &r_error);
|
||||
static void call_static(Variant::Type type, const StringName &method, const Variant **args, int argcount, Variant &r_ret, GDExtensionCallError &r_error);
|
||||
|
||||
template <class... Args>
|
||||
static Variant call_static(Variant::Type type, const StringName &method, Args... args) {
|
||||
Variant result;
|
||||
GDNativeCallError error;
|
||||
std::array<GDNativeConstVariantPtr, sizeof...(Args)> call_args = { Variant(args)... };
|
||||
GDExtensionCallError error;
|
||||
std::array<GDExtensionConstVariantPtr, sizeof...(Args)> call_args = { Variant(args)... };
|
||||
call_static(type, method, call_args.data(), call_args.size(), result, error);
|
||||
return result;
|
||||
}
|
||||
|
|
|
@ -43,13 +43,13 @@ const StringName *Wrapped::_get_extension_class_name() const {
|
|||
void Wrapped::_postinitialize() {
|
||||
const StringName *extension_class = _get_extension_class_name();
|
||||
if (extension_class) {
|
||||
godot::internal::gdn_interface->object_set_instance(_owner, reinterpret_cast<GDNativeConstStringNamePtr>(extension_class), this);
|
||||
godot::internal::gde_interface->object_set_instance(_owner, reinterpret_cast<GDExtensionConstStringNamePtr>(extension_class), this);
|
||||
}
|
||||
godot::internal::gdn_interface->object_set_instance_binding(_owner, godot::internal::token, this, _get_bindings_callbacks());
|
||||
godot::internal::gde_interface->object_set_instance_binding(_owner, godot::internal::token, this, _get_bindings_callbacks());
|
||||
}
|
||||
|
||||
Wrapped::Wrapped(const StringName p_godot_class) {
|
||||
_owner = godot::internal::gdn_interface->classdb_construct_object(reinterpret_cast<GDNativeConstStringNamePtr>(p_godot_class._native_ptr()));
|
||||
_owner = godot::internal::gde_interface->classdb_construct_object(reinterpret_cast<GDExtensionConstStringNamePtr>(p_godot_class._native_ptr()));
|
||||
}
|
||||
|
||||
Wrapped::Wrapped(GodotObject *p_godot_object) {
|
||||
|
|
|
@ -40,7 +40,7 @@
|
|||
namespace godot {
|
||||
|
||||
std::unordered_map<StringName, ClassDB::ClassInfo> ClassDB::classes;
|
||||
GDNativeInitializationLevel ClassDB::current_level = GDNATIVE_INITIALIZATION_CORE;
|
||||
GDExtensionInitializationLevel ClassDB::current_level = GDEXTENSION_INITIALIZATION_CORE;
|
||||
|
||||
MethodDefinition D_METHOD(StringName p_name) {
|
||||
return MethodDefinition(p_name);
|
||||
|
@ -55,13 +55,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::gdn_interface->classdb_register_extension_class_property_group(internal::library, p_class._native_ptr(), p_name._native_ptr(), p_prefix._native_ptr());
|
||||
internal::gde_interface->classdb_register_extension_class_property_group(internal::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::gdn_interface->classdb_register_extension_class_property_subgroup(internal::library, p_class._native_ptr(), p_name._native_ptr(), p_prefix._native_ptr());
|
||||
internal::gde_interface->classdb_register_extension_class_property_subgroup(internal::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) {
|
||||
|
@ -94,12 +94,12 @@ void ClassDB::add_property(const StringName &p_class, const PropertyInfo &p_pinf
|
|||
info.property_names.insert(p_pinfo.name);
|
||||
|
||||
// register with Godot
|
||||
GDNativePropertyInfo prop_info = {
|
||||
static_cast<GDNativeVariantType>(p_pinfo.type), // GDNativeVariantType type;
|
||||
p_pinfo.name._native_ptr(), // GDNativeStringNamePtr name;
|
||||
p_pinfo.class_name._native_ptr(), // GDNativeStringNamePtr class_name;
|
||||
GDExtensionPropertyInfo prop_info = {
|
||||
static_cast<GDExtensionVariantType>(p_pinfo.type), // GDExtensionVariantType type;
|
||||
p_pinfo.name._native_ptr(), // GDExtensionStringNamePtr name;
|
||||
p_pinfo.class_name._native_ptr(), // GDExtensionStringNamePtr class_name;
|
||||
p_pinfo.hint, // NONE //uint32_t hint;
|
||||
p_pinfo.hint_string._native_ptr(), // GDNativeStringPtr hint_string;
|
||||
p_pinfo.hint_string._native_ptr(), // GDExtensionStringPtr hint_string;
|
||||
p_pinfo.usage, // DEFAULT //uint32_t usage;
|
||||
};
|
||||
|
||||
|
@ -111,7 +111,7 @@ void ClassDB::add_property(const StringName &p_class, const PropertyInfo &p_pinf
|
|||
setget.index = p_index;
|
||||
setget.type = p_pinfo.type;
|
||||
|
||||
internal::gdn_interface->classdb_register_extension_class_property(internal::library, info.name._native_ptr(), &prop_info, setget.setter._native_ptr(), setget.getter._native_ptr());
|
||||
internal::gde_interface->classdb_register_extension_class_property(internal::library, info.name._native_ptr(), &prop_info, setget.setter._native_ptr(), setget.getter._native_ptr());
|
||||
}
|
||||
|
||||
MethodBind *ClassDB::get_method(const StringName &p_class, const StringName &p_method) {
|
||||
|
@ -189,52 +189,52 @@ MethodBind *ClassDB::bind_methodfi(uint32_t p_flags, MethodBind *p_bind, const M
|
|||
}
|
||||
|
||||
void ClassDB::bind_method_godot(const StringName &p_class_name, MethodBind *p_method) {
|
||||
std::vector<GDNativeVariantPtr> def_args;
|
||||
std::vector<GDExtensionVariantPtr> def_args;
|
||||
const std::vector<Variant> &def_args_val = p_method->get_default_arguments();
|
||||
def_args.resize(def_args_val.size());
|
||||
for (int i = 0; i < def_args_val.size(); i++) {
|
||||
def_args[i] = (GDNativeVariantPtr)&def_args_val[i];
|
||||
def_args[i] = (GDExtensionVariantPtr)&def_args_val[i];
|
||||
}
|
||||
|
||||
std::vector<PropertyInfo> return_value_and_arguments_info = p_method->get_arguments_info_list();
|
||||
std::vector<GDNativeExtensionClassMethodArgumentMetadata> return_value_and_arguments_metadata = p_method->get_arguments_metadata_list();
|
||||
std::vector<GDExtensionClassMethodArgumentMetadata> return_value_and_arguments_metadata = p_method->get_arguments_metadata_list();
|
||||
|
||||
std::vector<GDNativePropertyInfo> return_value_and_arguments_gdnative_info;
|
||||
return_value_and_arguments_gdnative_info.reserve(return_value_and_arguments_info.size());
|
||||
std::vector<GDExtensionPropertyInfo> return_value_and_arguments_gdextension_info;
|
||||
return_value_and_arguments_gdextension_info.reserve(return_value_and_arguments_info.size());
|
||||
for (std::vector<PropertyInfo>::iterator it = return_value_and_arguments_info.begin(); it != return_value_and_arguments_info.end(); it++) {
|
||||
return_value_and_arguments_gdnative_info.push_back(
|
||||
GDNativePropertyInfo{
|
||||
static_cast<GDNativeVariantType>(it->type), // GDNativeVariantType type;
|
||||
it->name._native_ptr(), // GDNativeStringNamePtr name;
|
||||
it->class_name._native_ptr(), // GDNativeStringNamePtr class_name;
|
||||
return_value_and_arguments_gdextension_info.push_back(
|
||||
GDExtensionPropertyInfo{
|
||||
static_cast<GDExtensionVariantType>(it->type), // GDExtensionVariantType type;
|
||||
it->name._native_ptr(), // GDExtensionStringNamePtr name;
|
||||
it->class_name._native_ptr(), // GDExtensionStringNamePtr class_name;
|
||||
it->hint, // uint32_t hint;
|
||||
it->hint_string._native_ptr(), // GDNativeStringPtr hint_string;
|
||||
it->hint_string._native_ptr(), // GDExtensionStringPtr hint_string;
|
||||
it->usage, // uint32_t usage;
|
||||
});
|
||||
}
|
||||
|
||||
GDNativePropertyInfo *return_value_info = return_value_and_arguments_gdnative_info.data();
|
||||
GDNativeExtensionClassMethodArgumentMetadata *return_value_metadata = return_value_and_arguments_metadata.data();
|
||||
GDNativePropertyInfo *arguments_info = return_value_and_arguments_gdnative_info.data() + 1;
|
||||
GDNativeExtensionClassMethodArgumentMetadata *arguments_metadata = return_value_and_arguments_metadata.data() + 1;
|
||||
GDExtensionPropertyInfo *return_value_info = return_value_and_arguments_gdextension_info.data();
|
||||
GDExtensionClassMethodArgumentMetadata *return_value_metadata = return_value_and_arguments_metadata.data();
|
||||
GDExtensionPropertyInfo *arguments_info = return_value_and_arguments_gdextension_info.data() + 1;
|
||||
GDExtensionClassMethodArgumentMetadata *arguments_metadata = return_value_and_arguments_metadata.data() + 1;
|
||||
|
||||
StringName name = p_method->get_name();
|
||||
GDNativeExtensionClassMethodInfo method_info = {
|
||||
name._native_ptr(), // GDNativeStringNamePtr;
|
||||
GDExtensionClassMethodInfo method_info = {
|
||||
name._native_ptr(), // GDExtensionStringNamePtr;
|
||||
p_method, // void *method_userdata;
|
||||
MethodBind::bind_call, // GDNativeExtensionClassMethodCall call_func;
|
||||
MethodBind::bind_ptrcall, // GDNativeExtensionClassMethodPtrCall ptrcall_func;
|
||||
p_method->get_hint_flags(), // uint32_t method_flags; /* GDNativeExtensionClassMethodFlags */
|
||||
(GDNativeBool)p_method->has_return(), // GDNativeBool has_return_value;
|
||||
return_value_info, // GDNativePropertyInfo *
|
||||
*return_value_metadata, // GDNativeExtensionClassMethodArgumentMetadata *
|
||||
MethodBind::bind_call, // GDExtensionClassMethodCall call_func;
|
||||
MethodBind::bind_ptrcall, // GDExtensionClassMethodPtrCall ptrcall_func;
|
||||
p_method->get_hint_flags(), // uint32_t method_flags; /* GDExtensionClassMethodFlags */
|
||||
(GDExtensionBool)p_method->has_return(), // GDExtensionBool has_return_value;
|
||||
return_value_info, // GDExtensionPropertyInfo *
|
||||
*return_value_metadata, // GDExtensionClassMethodArgumentMetadata *
|
||||
(uint32_t)p_method->get_argument_count(), // uint32_t argument_count;
|
||||
arguments_info, // GDNativePropertyInfo *
|
||||
arguments_metadata, // GDNativeExtensionClassMethodArgumentMetadata *
|
||||
arguments_info, // GDExtensionPropertyInfo *
|
||||
arguments_metadata, // GDExtensionClassMethodArgumentMetadata *
|
||||
(uint32_t)p_method->get_default_argument_count(), // uint32_t default_argument_count;
|
||||
def_args.data(), // GDNativeVariantPtr *default_arguments;
|
||||
def_args.data(), // GDExtensionVariantPtr *default_arguments;
|
||||
};
|
||||
internal::gdn_interface->classdb_register_extension_class_method(internal::library, p_class_name._native_ptr(), &method_info);
|
||||
internal::gde_interface->classdb_register_extension_class_method(internal::library, p_class_name._native_ptr(), &method_info);
|
||||
}
|
||||
|
||||
void ClassDB::add_signal(const StringName &p_class, const MethodInfo &p_signal) {
|
||||
|
@ -255,24 +255,24 @@ void ClassDB::add_signal(const StringName &p_class, const MethodInfo &p_signal)
|
|||
cl.signal_names.insert(p_signal.name);
|
||||
|
||||
// register our signal in godot
|
||||
std::vector<GDNativePropertyInfo> parameters;
|
||||
std::vector<GDExtensionPropertyInfo> parameters;
|
||||
parameters.reserve(p_signal.arguments.size());
|
||||
|
||||
for (const PropertyInfo &par : p_signal.arguments) {
|
||||
parameters.push_back(GDNativePropertyInfo{
|
||||
static_cast<GDNativeVariantType>(par.type), // GDNativeVariantType type;
|
||||
par.name._native_ptr(), // GDNativeStringNamePtr name;
|
||||
par.class_name._native_ptr(), // GDNativeStringNamePtr class_name;
|
||||
parameters.push_back(GDExtensionPropertyInfo{
|
||||
static_cast<GDExtensionVariantType>(par.type), // GDExtensionVariantType type;
|
||||
par.name._native_ptr(), // GDExtensionStringNamePtr name;
|
||||
par.class_name._native_ptr(), // GDExtensionStringNamePtr class_name;
|
||||
par.hint, // NONE //uint32_t hint;
|
||||
par.hint_string._native_ptr(), // GDNativeStringPtr hint_string;
|
||||
par.hint_string._native_ptr(), // GDExtensionStringPtr hint_string;
|
||||
par.usage, // DEFAULT //uint32_t usage;
|
||||
});
|
||||
}
|
||||
|
||||
internal::gdn_interface->classdb_register_extension_class_signal(internal::library, cl.name._native_ptr(), p_signal.name._native_ptr(), parameters.data(), parameters.size());
|
||||
internal::gde_interface->classdb_register_extension_class_signal(internal::library, cl.name._native_ptr(), p_signal.name._native_ptr(), parameters.data(), parameters.size());
|
||||
}
|
||||
|
||||
void ClassDB::bind_integer_constant(const StringName &p_class_name, const StringName &p_enum_name, const StringName &p_constant_name, GDNativeInt p_constant_value, bool p_is_bitfield) {
|
||||
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) {
|
||||
std::unordered_map<StringName, ClassInfo>::iterator type_it = classes.find(p_class_name);
|
||||
|
||||
ERR_FAIL_COND_MSG(type_it == classes.end(), String("Class '{0}' doesn't exist.").format(Array::make(p_class_name)));
|
||||
|
@ -286,9 +286,9 @@ void ClassDB::bind_integer_constant(const StringName &p_class_name, const String
|
|||
type.constant_names.insert(p_constant_name);
|
||||
|
||||
// Register it with Godot
|
||||
internal::gdn_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);
|
||||
internal::gde_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);
|
||||
}
|
||||
GDNativeExtensionClassCallVirtual ClassDB::get_virtual_func(void *p_userdata, GDNativeConstStringNamePtr p_name) {
|
||||
GDExtensionClassCallVirtual ClassDB::get_virtual_func(void *p_userdata, GDExtensionConstStringNamePtr p_name) {
|
||||
// This is called by Godot the first time it calls a virtual function, and it caches the result, per object instance.
|
||||
// Because of this, it can happen from different threads at once.
|
||||
// It should be ok not using any mutex as long as we only READ data.
|
||||
|
@ -302,7 +302,7 @@ GDNativeExtensionClassCallVirtual ClassDB::get_virtual_func(void *p_userdata, GD
|
|||
|
||||
// Find method in current class, or any of its parent classes (Godot classes not included)
|
||||
while (type != nullptr) {
|
||||
std::unordered_map<StringName, GDNativeExtensionClassCallVirtual>::const_iterator method_it = type->virtual_methods.find(*name);
|
||||
std::unordered_map<StringName, GDExtensionClassCallVirtual>::const_iterator method_it = type->virtual_methods.find(*name);
|
||||
|
||||
if (method_it != type->virtual_methods.end()) {
|
||||
return method_it->second;
|
||||
|
@ -314,7 +314,7 @@ GDNativeExtensionClassCallVirtual ClassDB::get_virtual_func(void *p_userdata, GD
|
|||
return nullptr;
|
||||
}
|
||||
|
||||
void ClassDB::bind_virtual_method(const StringName &p_class, const StringName &p_method, GDNativeExtensionClassCallVirtual p_call) {
|
||||
void ClassDB::bind_virtual_method(const StringName &p_class, const StringName &p_method, GDExtensionClassCallVirtual p_call) {
|
||||
std::unordered_map<StringName, ClassInfo>::iterator type_it = classes.find(p_class);
|
||||
ERR_FAIL_COND_MSG(type_it == classes.end(), String("Class '{0}' doesn't exist.").format(Array::make(p_class)));
|
||||
|
||||
|
@ -329,7 +329,7 @@ void ClassDB::bind_virtual_method(const StringName &p_class, const StringName &p
|
|||
void ClassDB::initialize_class(const ClassInfo &p_cl) {
|
||||
}
|
||||
|
||||
void ClassDB::initialize(GDNativeInitializationLevel p_level) {
|
||||
void ClassDB::initialize(GDExtensionInitializationLevel p_level) {
|
||||
for (const std::pair<StringName, ClassInfo> pair : classes) {
|
||||
const ClassInfo &cl = pair.second;
|
||||
if (cl.level != p_level) {
|
||||
|
@ -340,14 +340,14 @@ void ClassDB::initialize(GDNativeInitializationLevel p_level) {
|
|||
}
|
||||
}
|
||||
|
||||
void ClassDB::deinitialize(GDNativeInitializationLevel p_level) {
|
||||
void ClassDB::deinitialize(GDExtensionInitializationLevel p_level) {
|
||||
for (const std::pair<StringName, ClassInfo> pair : classes) {
|
||||
const ClassInfo &cl = pair.second;
|
||||
if (cl.level != p_level) {
|
||||
continue;
|
||||
}
|
||||
|
||||
internal::gdn_interface->classdb_unregister_extension_class(internal::library, cl.name._native_ptr());
|
||||
internal::gde_interface->classdb_unregister_extension_class(internal::library, cl.name._native_ptr());
|
||||
|
||||
for (auto method : cl.method_map) {
|
||||
memdelete(method.second);
|
||||
|
|
|
@ -38,33 +38,33 @@ namespace godot {
|
|||
|
||||
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_is_warning) {
|
||||
if (p_is_warning) {
|
||||
internal::gdn_interface->print_warning(p_message, p_function, p_file, p_line);
|
||||
internal::gde_interface->print_warning(p_message, p_function, p_file, p_line);
|
||||
} else {
|
||||
internal::gdn_interface->print_error(p_message, p_function, p_file, p_line);
|
||||
internal::gde_interface->print_error(p_message, p_function, p_file, p_line);
|
||||
}
|
||||
}
|
||||
|
||||
void _err_print_error(const char *p_function, const char *p_file, int p_line, const String &p_error, const char *p_message, bool p_is_warning) {
|
||||
if (p_is_warning) {
|
||||
internal::gdn_interface->print_warning(p_message, p_function, p_file, p_line);
|
||||
internal::gde_interface->print_warning(p_message, p_function, p_file, p_line);
|
||||
} else {
|
||||
internal::gdn_interface->print_error(p_message, p_function, p_file, p_line);
|
||||
internal::gde_interface->print_error(p_message, p_function, p_file, p_line);
|
||||
}
|
||||
}
|
||||
|
||||
void _err_print_error(const char *p_function, const char *p_file, int p_line, const char *p_error, const String &p_message, bool p_is_warning) {
|
||||
if (p_is_warning) {
|
||||
internal::gdn_interface->print_warning(p_message.utf8().get_data(), p_function, p_file, p_line);
|
||||
internal::gde_interface->print_warning(p_message.utf8().get_data(), p_function, p_file, p_line);
|
||||
} else {
|
||||
internal::gdn_interface->print_error(p_message.utf8().get_data(), p_function, p_file, p_line);
|
||||
internal::gde_interface->print_error(p_message.utf8().get_data(), p_function, p_file, p_line);
|
||||
}
|
||||
}
|
||||
|
||||
void _err_print_error(const char *p_function, const char *p_file, int p_line, const String &p_error, const String &p_message, bool p_is_warning) {
|
||||
if (p_is_warning) {
|
||||
internal::gdn_interface->print_warning(p_message.utf8().get_data(), p_function, p_file, p_line);
|
||||
internal::gde_interface->print_warning(p_message.utf8().get_data(), p_function, p_file, p_line);
|
||||
} else {
|
||||
internal::gdn_interface->print_error(p_message.utf8().get_data(), p_function, p_file, p_line);
|
||||
internal::gde_interface->print_error(p_message.utf8().get_data(), p_function, p_file, p_line);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -35,15 +35,15 @@
|
|||
namespace godot {
|
||||
|
||||
void *Memory::alloc_static(size_t p_bytes) {
|
||||
return internal::gdn_interface->mem_alloc(p_bytes);
|
||||
return internal::gde_interface->mem_alloc(p_bytes);
|
||||
}
|
||||
|
||||
void *Memory::realloc_static(void *p_memory, size_t p_bytes) {
|
||||
return internal::gdn_interface->mem_realloc(p_memory, p_bytes);
|
||||
return internal::gde_interface->mem_realloc(p_memory, p_bytes);
|
||||
}
|
||||
|
||||
void Memory::free_static(void *p_ptr) {
|
||||
internal::gdn_interface->mem_free(p_ptr);
|
||||
internal::gde_interface->mem_free(p_ptr);
|
||||
}
|
||||
|
||||
_GlobalNil::_GlobalNil() {
|
||||
|
|
|
@ -75,7 +75,7 @@ void MethodBind::generate_argument_types(int p_count) {
|
|||
memdelete_arr(argument_types);
|
||||
}
|
||||
|
||||
argument_types = memnew_arr(GDNativeVariantType, p_count + 1);
|
||||
argument_types = memnew_arr(GDExtensionVariantType, p_count + 1);
|
||||
|
||||
// -1 means return type.
|
||||
for (int i = -1; i < p_count; i++) {
|
||||
|
@ -91,15 +91,15 @@ PropertyInfo MethodBind::get_argument_info(int p_argument) const {
|
|||
return info;
|
||||
}
|
||||
|
||||
void MethodBind::bind_call(void *p_method_userdata, GDExtensionClassInstancePtr p_instance, GDNativeConstVariantPtr *p_args, GDNativeInt p_argument_count, GDNativeVariantPtr r_return, GDNativeCallError *r_error) {
|
||||
void MethodBind::bind_call(void *p_method_userdata, GDExtensionClassInstancePtr p_instance, GDExtensionConstVariantPtr *p_args, GDExtensionInt p_argument_count, GDExtensionVariantPtr r_return, GDExtensionCallError *r_error) {
|
||||
const MethodBind *bind = reinterpret_cast<const MethodBind *>(p_method_userdata);
|
||||
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 NativeExtensionMethodBind calls this from the Godot side, it should always be the case.
|
||||
internal::gdn_interface->variant_new_copy(r_return, ret._native_ptr());
|
||||
// Since only GDExtensionMethodBind calls this from the Godot side, it should always be the case.
|
||||
internal::gde_interface->variant_new_copy(r_return, ret._native_ptr());
|
||||
}
|
||||
|
||||
void MethodBind::bind_ptrcall(void *p_method_userdata, GDExtensionClassInstancePtr p_instance, GDNativeConstTypePtr *p_args, GDNativeTypePtr r_return) {
|
||||
void MethodBind::bind_ptrcall(void *p_method_userdata, GDExtensionClassInstancePtr p_instance, GDExtensionConstTypePtr *p_args, GDExtensionTypePtr r_return) {
|
||||
const MethodBind *bind = reinterpret_cast<const MethodBind *>(p_method_userdata);
|
||||
bind->ptrcall(p_instance, p_args, r_return);
|
||||
}
|
||||
|
|
|
@ -33,22 +33,22 @@
|
|||
namespace godot {
|
||||
|
||||
MethodInfo::MethodInfo() :
|
||||
flags(GDNATIVE_EXTENSION_METHOD_FLAG_NORMAL) {}
|
||||
flags(GDEXTENSION_METHOD_FLAG_NORMAL) {}
|
||||
|
||||
MethodInfo::MethodInfo(StringName p_name) :
|
||||
name(p_name), flags(GDNATIVE_EXTENSION_METHOD_FLAG_NORMAL) {}
|
||||
name(p_name), flags(GDEXTENSION_METHOD_FLAG_NORMAL) {}
|
||||
|
||||
MethodInfo::MethodInfo(Variant::Type ret) :
|
||||
flags(GDNATIVE_EXTENSION_METHOD_FLAG_NORMAL) {
|
||||
flags(GDEXTENSION_METHOD_FLAG_NORMAL) {
|
||||
return_val.type = ret;
|
||||
}
|
||||
|
||||
MethodInfo::MethodInfo(Variant::Type ret, StringName p_name) :
|
||||
name(p_name), flags(GDNATIVE_EXTENSION_METHOD_FLAG_NORMAL) {
|
||||
name(p_name), flags(GDEXTENSION_METHOD_FLAG_NORMAL) {
|
||||
return_val.type = ret;
|
||||
}
|
||||
|
||||
MethodInfo::MethodInfo(const PropertyInfo &p_ret, StringName p_name) :
|
||||
name(p_name), return_val(p_ret), flags(GDNATIVE_EXTENSION_METHOD_FLAG_NORMAL) {}
|
||||
name(p_name), return_val(p_ret), flags(GDEXTENSION_METHOD_FLAG_NORMAL) {}
|
||||
|
||||
} // namespace godot
|
||||
|
|
|
@ -41,18 +41,18 @@ namespace godot {
|
|||
|
||||
namespace internal {
|
||||
|
||||
const GDNativeInterface *gdn_interface = nullptr;
|
||||
GDNativeExtensionClassLibraryPtr library = nullptr;
|
||||
const GDExtensionInterface *gde_interface = nullptr;
|
||||
GDExtensionClassLibraryPtr library = nullptr;
|
||||
void *token = nullptr;
|
||||
|
||||
} // namespace internal
|
||||
|
||||
GDExtensionBinding::Callback GDExtensionBinding::init_callback = nullptr;
|
||||
GDExtensionBinding::Callback GDExtensionBinding::terminate_callback = nullptr;
|
||||
GDNativeInitializationLevel GDExtensionBinding::minimum_initialization_level = GDNATIVE_INITIALIZATION_CORE;
|
||||
GDExtensionInitializationLevel GDExtensionBinding::minimum_initialization_level = GDEXTENSION_INITIALIZATION_CORE;
|
||||
|
||||
GDNativeBool GDExtensionBinding::init(const GDNativeInterface *p_interface, GDNativeExtensionClassLibraryPtr p_library, GDNativeInitialization *r_initialization) {
|
||||
internal::gdn_interface = p_interface;
|
||||
GDExtensionBool GDExtensionBinding::init(const GDExtensionInterface *p_interface, GDExtensionClassLibraryPtr p_library, GDExtensionInitialization *r_initialization) {
|
||||
internal::gde_interface = p_interface;
|
||||
internal::library = p_library;
|
||||
internal::token = p_library;
|
||||
|
||||
|
@ -67,7 +67,7 @@ GDNativeBool GDExtensionBinding::init(const GDNativeInterface *p_interface, GDNa
|
|||
return true;
|
||||
}
|
||||
|
||||
void GDExtensionBinding::initialize_level(void *userdata, GDNativeInitializationLevel p_level) {
|
||||
void GDExtensionBinding::initialize_level(void *userdata, GDExtensionInitializationLevel p_level) {
|
||||
ClassDB::current_level = p_level;
|
||||
|
||||
if (init_callback) {
|
||||
|
@ -77,7 +77,7 @@ void GDExtensionBinding::initialize_level(void *userdata, GDNativeInitialization
|
|||
ClassDB::initialize(p_level);
|
||||
}
|
||||
|
||||
void GDExtensionBinding::deinitialize_level(void *userdata, GDNativeInitializationLevel p_level) {
|
||||
void GDExtensionBinding::deinitialize_level(void *userdata, GDExtensionInitializationLevel p_level) {
|
||||
ClassDB::current_level = p_level;
|
||||
|
||||
if (terminate_callback) {
|
||||
|
@ -96,22 +96,22 @@ void GDExtensionBinding::InitObject::register_terminator(Callback p_terminate) c
|
|||
}
|
||||
|
||||
void GDExtensionBinding::InitObject::set_minimum_library_initialization_level(ModuleInitializationLevel p_level) const {
|
||||
GDExtensionBinding::minimum_initialization_level = static_cast<GDNativeInitializationLevel>(p_level);
|
||||
GDExtensionBinding::minimum_initialization_level = static_cast<GDExtensionInitializationLevel>(p_level);
|
||||
}
|
||||
|
||||
GDNativeBool GDExtensionBinding::InitObject::init() const {
|
||||
return GDExtensionBinding::init(gdn_interface, library, initialization);
|
||||
GDExtensionBool GDExtensionBinding::InitObject::init() const {
|
||||
return GDExtensionBinding::init(gde_interface, library, initialization);
|
||||
}
|
||||
|
||||
} // namespace godot
|
||||
|
||||
extern "C" {
|
||||
|
||||
void GDN_EXPORT initialize_level(void *userdata, GDNativeInitializationLevel p_level) {
|
||||
void GDE_EXPORT initialize_level(void *userdata, GDExtensionInitializationLevel p_level) {
|
||||
godot::GDExtensionBinding::initialize_level(userdata, p_level);
|
||||
}
|
||||
|
||||
void GDN_EXPORT deinitialize_level(void *userdata, GDNativeInitializationLevel p_level) {
|
||||
void GDE_EXPORT deinitialize_level(void *userdata, GDExtensionInitializationLevel p_level) {
|
||||
godot::GDExtensionBinding::deinitialize_level(userdata, p_level);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -153,19 +153,19 @@ CharWideString::~CharWideString() {
|
|||
// It's easier to have them written in C++ directly than in a Python script that generates them.
|
||||
|
||||
String::String(const char *from) {
|
||||
internal::gdn_interface->string_new_with_latin1_chars(_native_ptr(), from);
|
||||
internal::gde_interface->string_new_with_latin1_chars(_native_ptr(), from);
|
||||
}
|
||||
|
||||
String::String(const wchar_t *from) {
|
||||
internal::gdn_interface->string_new_with_wide_chars(_native_ptr(), from);
|
||||
internal::gde_interface->string_new_with_wide_chars(_native_ptr(), from);
|
||||
}
|
||||
|
||||
String::String(const char16_t *from) {
|
||||
internal::gdn_interface->string_new_with_utf16_chars(_native_ptr(), from);
|
||||
internal::gde_interface->string_new_with_utf16_chars(_native_ptr(), from);
|
||||
}
|
||||
|
||||
String::String(const char32_t *from) {
|
||||
internal::gdn_interface->string_new_with_utf32_chars(_native_ptr(), from);
|
||||
internal::gde_interface->string_new_with_utf32_chars(_native_ptr(), from);
|
||||
}
|
||||
|
||||
String String::utf8(const char *from, int len) {
|
||||
|
@ -175,7 +175,7 @@ String String::utf8(const char *from, int len) {
|
|||
}
|
||||
|
||||
void String::parse_utf8(const char *from, int len) {
|
||||
internal::gdn_interface->string_new_with_utf8_chars_and_len(_native_ptr(), from, len);
|
||||
internal::gde_interface->string_new_with_utf8_chars_and_len(_native_ptr(), from, len);
|
||||
}
|
||||
|
||||
String String::utf16(const char16_t *from, int len) {
|
||||
|
@ -185,7 +185,7 @@ String String::utf16(const char16_t *from, int len) {
|
|||
}
|
||||
|
||||
void String::parse_utf16(const char16_t *from, int len) {
|
||||
internal::gdn_interface->string_new_with_utf16_chars_and_len(_native_ptr(), from, len);
|
||||
internal::gde_interface->string_new_with_utf16_chars_and_len(_native_ptr(), from, len);
|
||||
}
|
||||
|
||||
String String::num_real(double p_num, bool p_trailing) {
|
||||
|
@ -226,9 +226,9 @@ String rtoss(double p_val) {
|
|||
}
|
||||
|
||||
CharString String::utf8() const {
|
||||
int size = internal::gdn_interface->string_to_utf8_chars(_native_ptr(), nullptr, 0);
|
||||
int size = internal::gde_interface->string_to_utf8_chars(_native_ptr(), nullptr, 0);
|
||||
char *cstr = memnew_arr(char, size + 1);
|
||||
internal::gdn_interface->string_to_utf8_chars(_native_ptr(), cstr, size + 1);
|
||||
internal::gde_interface->string_to_utf8_chars(_native_ptr(), cstr, size + 1);
|
||||
|
||||
cstr[size] = '\0';
|
||||
|
||||
|
@ -236,9 +236,9 @@ CharString String::utf8() const {
|
|||
}
|
||||
|
||||
CharString String::ascii() const {
|
||||
int size = internal::gdn_interface->string_to_latin1_chars(_native_ptr(), nullptr, 0);
|
||||
int size = internal::gde_interface->string_to_latin1_chars(_native_ptr(), nullptr, 0);
|
||||
char *cstr = memnew_arr(char, size + 1);
|
||||
internal::gdn_interface->string_to_latin1_chars(_native_ptr(), cstr, size + 1);
|
||||
internal::gde_interface->string_to_latin1_chars(_native_ptr(), cstr, size + 1);
|
||||
|
||||
cstr[size] = '\0';
|
||||
|
||||
|
@ -246,9 +246,9 @@ CharString String::ascii() const {
|
|||
}
|
||||
|
||||
Char16String String::utf16() const {
|
||||
int size = internal::gdn_interface->string_to_utf16_chars(_native_ptr(), nullptr, 0);
|
||||
int size = internal::gde_interface->string_to_utf16_chars(_native_ptr(), nullptr, 0);
|
||||
char16_t *cstr = memnew_arr(char16_t, size + 1);
|
||||
internal::gdn_interface->string_to_utf16_chars(_native_ptr(), cstr, size + 1);
|
||||
internal::gde_interface->string_to_utf16_chars(_native_ptr(), cstr, size + 1);
|
||||
|
||||
cstr[size] = '\0';
|
||||
|
||||
|
@ -256,9 +256,9 @@ Char16String String::utf16() const {
|
|||
}
|
||||
|
||||
Char32String String::utf32() const {
|
||||
int size = internal::gdn_interface->string_to_utf32_chars(_native_ptr(), nullptr, 0);
|
||||
int size = internal::gde_interface->string_to_utf32_chars(_native_ptr(), nullptr, 0);
|
||||
char32_t *cstr = memnew_arr(char32_t, size + 1);
|
||||
internal::gdn_interface->string_to_utf32_chars(_native_ptr(), cstr, size + 1);
|
||||
internal::gde_interface->string_to_utf32_chars(_native_ptr(), cstr, size + 1);
|
||||
|
||||
cstr[size] = '\0';
|
||||
|
||||
|
@ -266,9 +266,9 @@ Char32String String::utf32() const {
|
|||
}
|
||||
|
||||
CharWideString String::wide_string() const {
|
||||
int size = internal::gdn_interface->string_to_wide_chars(_native_ptr(), nullptr, 0);
|
||||
int size = internal::gde_interface->string_to_wide_chars(_native_ptr(), nullptr, 0);
|
||||
wchar_t *cstr = memnew_arr(wchar_t, size + 1);
|
||||
internal::gdn_interface->string_to_wide_chars(_native_ptr(), cstr, size + 1);
|
||||
internal::gde_interface->string_to_wide_chars(_native_ptr(), cstr, size + 1);
|
||||
|
||||
cstr[size] = '\0';
|
||||
|
||||
|
@ -344,19 +344,19 @@ String String::operator+(const char32_t *p_chr) {
|
|||
}
|
||||
|
||||
const char32_t &String::operator[](int p_index) const {
|
||||
return *internal::gdn_interface->string_operator_index_const((GDNativeStringPtr)this, p_index);
|
||||
return *internal::gde_interface->string_operator_index_const((GDExtensionStringPtr)this, p_index);
|
||||
}
|
||||
|
||||
char32_t &String::operator[](int p_index) {
|
||||
return *internal::gdn_interface->string_operator_index((GDNativeStringPtr)this, p_index);
|
||||
return *internal::gde_interface->string_operator_index((GDExtensionStringPtr)this, p_index);
|
||||
}
|
||||
|
||||
const char32_t *String::ptr() const {
|
||||
return internal::gdn_interface->string_operator_index_const((GDNativeStringPtr)this, 0);
|
||||
return internal::gde_interface->string_operator_index_const((GDExtensionStringPtr)this, 0);
|
||||
}
|
||||
|
||||
char32_t *String::ptrw() {
|
||||
return internal::gdn_interface->string_operator_index((GDNativeStringPtr)this, 0);
|
||||
return internal::gde_interface->string_operator_index((GDExtensionStringPtr)this, 0);
|
||||
}
|
||||
|
||||
bool operator==(const char *p_chr, const String &p_str) {
|
||||
|
|
|
@ -47,174 +47,174 @@
|
|||
namespace godot {
|
||||
|
||||
const uint8_t &PackedByteArray::operator[](int p_index) const {
|
||||
return *internal::gdn_interface->packed_byte_array_operator_index_const((GDNativeTypePtr *)this, p_index);
|
||||
return *internal::gde_interface->packed_byte_array_operator_index_const((GDExtensionTypePtr *)this, p_index);
|
||||
}
|
||||
|
||||
uint8_t &PackedByteArray::operator[](int p_index) {
|
||||
return *internal::gdn_interface->packed_byte_array_operator_index((GDNativeTypePtr *)this, p_index);
|
||||
return *internal::gde_interface->packed_byte_array_operator_index((GDExtensionTypePtr *)this, p_index);
|
||||
}
|
||||
|
||||
const uint8_t *PackedByteArray::ptr() const {
|
||||
return internal::gdn_interface->packed_byte_array_operator_index_const((GDNativeTypePtr *)this, 0);
|
||||
return internal::gde_interface->packed_byte_array_operator_index_const((GDExtensionTypePtr *)this, 0);
|
||||
}
|
||||
|
||||
uint8_t *PackedByteArray::ptrw() {
|
||||
return internal::gdn_interface->packed_byte_array_operator_index((GDNativeTypePtr *)this, 0);
|
||||
return internal::gde_interface->packed_byte_array_operator_index((GDExtensionTypePtr *)this, 0);
|
||||
}
|
||||
|
||||
const Color &PackedColorArray::operator[](int p_index) const {
|
||||
const Color *color = (const Color *)internal::gdn_interface->packed_color_array_operator_index_const((GDNativeTypePtr *)this, p_index);
|
||||
const Color *color = (const Color *)internal::gde_interface->packed_color_array_operator_index_const((GDExtensionTypePtr *)this, p_index);
|
||||
return *color;
|
||||
}
|
||||
|
||||
Color &PackedColorArray::operator[](int p_index) {
|
||||
Color *color = (Color *)internal::gdn_interface->packed_color_array_operator_index((GDNativeTypePtr *)this, p_index);
|
||||
Color *color = (Color *)internal::gde_interface->packed_color_array_operator_index((GDExtensionTypePtr *)this, p_index);
|
||||
return *color;
|
||||
}
|
||||
|
||||
const Color *PackedColorArray::ptr() const {
|
||||
return (const Color *)internal::gdn_interface->packed_color_array_operator_index_const((GDNativeTypePtr *)this, 0);
|
||||
return (const Color *)internal::gde_interface->packed_color_array_operator_index_const((GDExtensionTypePtr *)this, 0);
|
||||
}
|
||||
|
||||
Color *PackedColorArray::ptrw() {
|
||||
return (Color *)internal::gdn_interface->packed_color_array_operator_index((GDNativeTypePtr *)this, 0);
|
||||
return (Color *)internal::gde_interface->packed_color_array_operator_index((GDExtensionTypePtr *)this, 0);
|
||||
}
|
||||
|
||||
const float &PackedFloat32Array::operator[](int p_index) const {
|
||||
return *internal::gdn_interface->packed_float32_array_operator_index_const((GDNativeTypePtr *)this, p_index);
|
||||
return *internal::gde_interface->packed_float32_array_operator_index_const((GDExtensionTypePtr *)this, p_index);
|
||||
}
|
||||
|
||||
float &PackedFloat32Array::operator[](int p_index) {
|
||||
return *internal::gdn_interface->packed_float32_array_operator_index((GDNativeTypePtr *)this, p_index);
|
||||
return *internal::gde_interface->packed_float32_array_operator_index((GDExtensionTypePtr *)this, p_index);
|
||||
}
|
||||
|
||||
const float *PackedFloat32Array::ptr() const {
|
||||
return internal::gdn_interface->packed_float32_array_operator_index_const((GDNativeTypePtr *)this, 0);
|
||||
return internal::gde_interface->packed_float32_array_operator_index_const((GDExtensionTypePtr *)this, 0);
|
||||
}
|
||||
|
||||
float *PackedFloat32Array::ptrw() {
|
||||
return internal::gdn_interface->packed_float32_array_operator_index((GDNativeTypePtr *)this, 0);
|
||||
return internal::gde_interface->packed_float32_array_operator_index((GDExtensionTypePtr *)this, 0);
|
||||
}
|
||||
|
||||
const double &PackedFloat64Array::operator[](int p_index) const {
|
||||
return *internal::gdn_interface->packed_float64_array_operator_index_const((GDNativeTypePtr *)this, p_index);
|
||||
return *internal::gde_interface->packed_float64_array_operator_index_const((GDExtensionTypePtr *)this, p_index);
|
||||
}
|
||||
|
||||
double &PackedFloat64Array::operator[](int p_index) {
|
||||
return *internal::gdn_interface->packed_float64_array_operator_index((GDNativeTypePtr *)this, p_index);
|
||||
return *internal::gde_interface->packed_float64_array_operator_index((GDExtensionTypePtr *)this, p_index);
|
||||
}
|
||||
|
||||
const double *PackedFloat64Array::ptr() const {
|
||||
return internal::gdn_interface->packed_float64_array_operator_index_const((GDNativeTypePtr *)this, 0);
|
||||
return internal::gde_interface->packed_float64_array_operator_index_const((GDExtensionTypePtr *)this, 0);
|
||||
}
|
||||
|
||||
double *PackedFloat64Array::ptrw() {
|
||||
return internal::gdn_interface->packed_float64_array_operator_index((GDNativeTypePtr *)this, 0);
|
||||
return internal::gde_interface->packed_float64_array_operator_index((GDExtensionTypePtr *)this, 0);
|
||||
}
|
||||
|
||||
const int32_t &PackedInt32Array::operator[](int p_index) const {
|
||||
return *internal::gdn_interface->packed_int32_array_operator_index_const((GDNativeTypePtr *)this, p_index);
|
||||
return *internal::gde_interface->packed_int32_array_operator_index_const((GDExtensionTypePtr *)this, p_index);
|
||||
}
|
||||
|
||||
int32_t &PackedInt32Array::operator[](int p_index) {
|
||||
return *internal::gdn_interface->packed_int32_array_operator_index((GDNativeTypePtr *)this, p_index);
|
||||
return *internal::gde_interface->packed_int32_array_operator_index((GDExtensionTypePtr *)this, p_index);
|
||||
}
|
||||
|
||||
const int32_t *PackedInt32Array::ptr() const {
|
||||
return internal::gdn_interface->packed_int32_array_operator_index_const((GDNativeTypePtr *)this, 0);
|
||||
return internal::gde_interface->packed_int32_array_operator_index_const((GDExtensionTypePtr *)this, 0);
|
||||
}
|
||||
|
||||
int32_t *PackedInt32Array::ptrw() {
|
||||
return internal::gdn_interface->packed_int32_array_operator_index((GDNativeTypePtr *)this, 0);
|
||||
return internal::gde_interface->packed_int32_array_operator_index((GDExtensionTypePtr *)this, 0);
|
||||
}
|
||||
|
||||
const int64_t &PackedInt64Array::operator[](int p_index) const {
|
||||
return *internal::gdn_interface->packed_int64_array_operator_index_const((GDNativeTypePtr *)this, p_index);
|
||||
return *internal::gde_interface->packed_int64_array_operator_index_const((GDExtensionTypePtr *)this, p_index);
|
||||
}
|
||||
|
||||
int64_t &PackedInt64Array::operator[](int p_index) {
|
||||
return *internal::gdn_interface->packed_int64_array_operator_index((GDNativeTypePtr *)this, p_index);
|
||||
return *internal::gde_interface->packed_int64_array_operator_index((GDExtensionTypePtr *)this, p_index);
|
||||
}
|
||||
|
||||
const int64_t *PackedInt64Array::ptr() const {
|
||||
return internal::gdn_interface->packed_int64_array_operator_index_const((GDNativeTypePtr *)this, 0);
|
||||
return internal::gde_interface->packed_int64_array_operator_index_const((GDExtensionTypePtr *)this, 0);
|
||||
}
|
||||
|
||||
int64_t *PackedInt64Array::ptrw() {
|
||||
return internal::gdn_interface->packed_int64_array_operator_index((GDNativeTypePtr *)this, 0);
|
||||
return internal::gde_interface->packed_int64_array_operator_index((GDExtensionTypePtr *)this, 0);
|
||||
}
|
||||
|
||||
const String &PackedStringArray::operator[](int p_index) const {
|
||||
const String *string = (const String *)internal::gdn_interface->packed_string_array_operator_index_const((GDNativeTypePtr *)this, p_index);
|
||||
const String *string = (const String *)internal::gde_interface->packed_string_array_operator_index_const((GDExtensionTypePtr *)this, p_index);
|
||||
return *string;
|
||||
}
|
||||
|
||||
String &PackedStringArray::operator[](int p_index) {
|
||||
String *string = (String *)internal::gdn_interface->packed_string_array_operator_index((GDNativeTypePtr *)this, p_index);
|
||||
String *string = (String *)internal::gde_interface->packed_string_array_operator_index((GDExtensionTypePtr *)this, p_index);
|
||||
return *string;
|
||||
}
|
||||
|
||||
const String *PackedStringArray::ptr() const {
|
||||
return (const String *)internal::gdn_interface->packed_string_array_operator_index_const((GDNativeTypePtr *)this, 0);
|
||||
return (const String *)internal::gde_interface->packed_string_array_operator_index_const((GDExtensionTypePtr *)this, 0);
|
||||
}
|
||||
|
||||
String *PackedStringArray::ptrw() {
|
||||
return (String *)internal::gdn_interface->packed_string_array_operator_index((GDNativeTypePtr *)this, 0);
|
||||
return (String *)internal::gde_interface->packed_string_array_operator_index((GDExtensionTypePtr *)this, 0);
|
||||
}
|
||||
|
||||
const Vector2 &PackedVector2Array::operator[](int p_index) const {
|
||||
const Vector2 *vec = (const Vector2 *)internal::gdn_interface->packed_vector2_array_operator_index_const((GDNativeTypePtr *)this, p_index);
|
||||
const Vector2 *vec = (const Vector2 *)internal::gde_interface->packed_vector2_array_operator_index_const((GDExtensionTypePtr *)this, p_index);
|
||||
return *vec;
|
||||
}
|
||||
|
||||
Vector2 &PackedVector2Array::operator[](int p_index) {
|
||||
Vector2 *vec = (Vector2 *)internal::gdn_interface->packed_vector2_array_operator_index((GDNativeTypePtr *)this, p_index);
|
||||
Vector2 *vec = (Vector2 *)internal::gde_interface->packed_vector2_array_operator_index((GDExtensionTypePtr *)this, p_index);
|
||||
return *vec;
|
||||
}
|
||||
|
||||
const Vector2 *PackedVector2Array::ptr() const {
|
||||
return (const Vector2 *)internal::gdn_interface->packed_vector2_array_operator_index_const((GDNativeTypePtr *)this, 0);
|
||||
return (const Vector2 *)internal::gde_interface->packed_vector2_array_operator_index_const((GDExtensionTypePtr *)this, 0);
|
||||
}
|
||||
|
||||
Vector2 *PackedVector2Array::ptrw() {
|
||||
return (Vector2 *)internal::gdn_interface->packed_vector2_array_operator_index((GDNativeTypePtr *)this, 0);
|
||||
return (Vector2 *)internal::gde_interface->packed_vector2_array_operator_index((GDExtensionTypePtr *)this, 0);
|
||||
}
|
||||
|
||||
const Vector3 &PackedVector3Array::operator[](int p_index) const {
|
||||
const Vector3 *vec = (const Vector3 *)internal::gdn_interface->packed_vector3_array_operator_index_const((GDNativeTypePtr *)this, p_index);
|
||||
const Vector3 *vec = (const Vector3 *)internal::gde_interface->packed_vector3_array_operator_index_const((GDExtensionTypePtr *)this, p_index);
|
||||
return *vec;
|
||||
}
|
||||
|
||||
Vector3 &PackedVector3Array::operator[](int p_index) {
|
||||
Vector3 *vec = (Vector3 *)internal::gdn_interface->packed_vector3_array_operator_index((GDNativeTypePtr *)this, p_index);
|
||||
Vector3 *vec = (Vector3 *)internal::gde_interface->packed_vector3_array_operator_index((GDExtensionTypePtr *)this, p_index);
|
||||
return *vec;
|
||||
}
|
||||
|
||||
const Vector3 *PackedVector3Array::ptr() const {
|
||||
return (const Vector3 *)internal::gdn_interface->packed_vector3_array_operator_index_const((GDNativeTypePtr *)this, 0);
|
||||
return (const Vector3 *)internal::gde_interface->packed_vector3_array_operator_index_const((GDExtensionTypePtr *)this, 0);
|
||||
}
|
||||
|
||||
Vector3 *PackedVector3Array::ptrw() {
|
||||
return (Vector3 *)internal::gdn_interface->packed_vector3_array_operator_index((GDNativeTypePtr *)this, 0);
|
||||
return (Vector3 *)internal::gde_interface->packed_vector3_array_operator_index((GDExtensionTypePtr *)this, 0);
|
||||
}
|
||||
|
||||
const Variant &Array::operator[](int p_index) const {
|
||||
const Variant *var = (const Variant *)internal::gdn_interface->array_operator_index_const((GDNativeTypePtr *)this, p_index);
|
||||
const Variant *var = (const Variant *)internal::gde_interface->array_operator_index_const((GDExtensionTypePtr *)this, p_index);
|
||||
return *var;
|
||||
}
|
||||
|
||||
Variant &Array::operator[](int p_index) {
|
||||
Variant *var = (Variant *)internal::gdn_interface->array_operator_index((GDNativeTypePtr *)this, p_index);
|
||||
Variant *var = (Variant *)internal::gde_interface->array_operator_index((GDExtensionTypePtr *)this, p_index);
|
||||
return *var;
|
||||
}
|
||||
|
||||
const Variant &Dictionary::operator[](const Variant &p_key) const {
|
||||
const Variant *var = (const Variant *)internal::gdn_interface->dictionary_operator_index_const((GDNativeTypePtr *)this, (GDNativeVariantPtr)&p_key);
|
||||
const Variant *var = (const Variant *)internal::gde_interface->dictionary_operator_index_const((GDExtensionTypePtr *)this, (GDExtensionVariantPtr)&p_key);
|
||||
return *var;
|
||||
}
|
||||
|
||||
Variant &Dictionary::operator[](const Variant &p_key) {
|
||||
Variant *var = (Variant *)internal::gdn_interface->dictionary_operator_index((GDNativeTypePtr *)this, (GDNativeVariantPtr)&p_key);
|
||||
Variant *var = (Variant *)internal::gde_interface->dictionary_operator_index((GDExtensionTypePtr *)this, (GDExtensionVariantPtr)&p_key);
|
||||
return *var;
|
||||
}
|
||||
|
||||
|
|
|
@ -39,14 +39,14 @@
|
|||
|
||||
namespace godot {
|
||||
|
||||
GDNativeVariantFromTypeConstructorFunc Variant::from_type_constructor[Variant::VARIANT_MAX]{};
|
||||
GDNativeTypeFromVariantConstructorFunc Variant::to_type_constructor[Variant::VARIANT_MAX]{};
|
||||
GDExtensionVariantFromTypeConstructorFunc Variant::from_type_constructor[Variant::VARIANT_MAX]{};
|
||||
GDExtensionTypeFromVariantConstructorFunc Variant::to_type_constructor[Variant::VARIANT_MAX]{};
|
||||
|
||||
void Variant::init_bindings() {
|
||||
// Start from 1 to skip NIL.
|
||||
for (int i = 1; i < VARIANT_MAX; i++) {
|
||||
from_type_constructor[i] = internal::gdn_interface->get_variant_from_type_constructor((GDNativeVariantType)i);
|
||||
to_type_constructor[i] = internal::gdn_interface->get_variant_to_type_constructor((GDNativeVariantType)i);
|
||||
from_type_constructor[i] = internal::gde_interface->get_variant_from_type_constructor((GDExtensionVariantType)i);
|
||||
to_type_constructor[i] = internal::gde_interface->get_variant_to_type_constructor((GDExtensionVariantType)i);
|
||||
}
|
||||
|
||||
StringName::init_bindings();
|
||||
|
@ -69,15 +69,15 @@ void Variant::init_bindings() {
|
|||
}
|
||||
|
||||
Variant::Variant() {
|
||||
internal::gdn_interface->variant_new_nil(_native_ptr());
|
||||
internal::gde_interface->variant_new_nil(_native_ptr());
|
||||
}
|
||||
|
||||
Variant::Variant(GDNativeConstVariantPtr native_ptr) {
|
||||
internal::gdn_interface->variant_new_copy(_native_ptr(), native_ptr);
|
||||
Variant::Variant(GDExtensionConstVariantPtr native_ptr) {
|
||||
internal::gde_interface->variant_new_copy(_native_ptr(), native_ptr);
|
||||
}
|
||||
|
||||
Variant::Variant(const Variant &other) {
|
||||
internal::gdn_interface->variant_new_copy(_native_ptr(), other._native_ptr());
|
||||
internal::gde_interface->variant_new_copy(_native_ptr(), other._native_ptr());
|
||||
}
|
||||
|
||||
Variant::Variant(Variant &&other) {
|
||||
|
@ -85,13 +85,13 @@ Variant::Variant(Variant &&other) {
|
|||
}
|
||||
|
||||
Variant::Variant(bool v) {
|
||||
GDNativeBool encoded;
|
||||
GDExtensionBool encoded;
|
||||
PtrToArg<bool>::encode(v, &encoded);
|
||||
from_type_constructor[BOOL](_native_ptr(), &encoded);
|
||||
}
|
||||
|
||||
Variant::Variant(int64_t v) {
|
||||
GDNativeInt encoded;
|
||||
GDExtensionInt encoded;
|
||||
PtrToArg<int64_t>::encode(v, &encoded);
|
||||
from_type_constructor[INT](_native_ptr(), &encoded);
|
||||
}
|
||||
|
@ -107,67 +107,67 @@ Variant::Variant(const String &v) {
|
|||
}
|
||||
|
||||
Variant::Variant(const Vector2 &v) {
|
||||
from_type_constructor[VECTOR2](_native_ptr(), (GDNativeTypePtr)&v);
|
||||
from_type_constructor[VECTOR2](_native_ptr(), (GDExtensionTypePtr)&v);
|
||||
}
|
||||
|
||||
Variant::Variant(const Vector2i &v) {
|
||||
from_type_constructor[VECTOR2I](_native_ptr(), (GDNativeTypePtr)&v);
|
||||
from_type_constructor[VECTOR2I](_native_ptr(), (GDExtensionTypePtr)&v);
|
||||
}
|
||||
|
||||
Variant::Variant(const Rect2 &v) {
|
||||
from_type_constructor[RECT2](_native_ptr(), (GDNativeTypePtr)&v);
|
||||
from_type_constructor[RECT2](_native_ptr(), (GDExtensionTypePtr)&v);
|
||||
}
|
||||
|
||||
Variant::Variant(const Rect2i &v) {
|
||||
from_type_constructor[RECT2I](_native_ptr(), (GDNativeTypePtr)&v);
|
||||
from_type_constructor[RECT2I](_native_ptr(), (GDExtensionTypePtr)&v);
|
||||
}
|
||||
|
||||
Variant::Variant(const Vector3 &v) {
|
||||
from_type_constructor[VECTOR3](_native_ptr(), (GDNativeTypePtr)&v);
|
||||
from_type_constructor[VECTOR3](_native_ptr(), (GDExtensionTypePtr)&v);
|
||||
}
|
||||
|
||||
Variant::Variant(const Vector3i &v) {
|
||||
from_type_constructor[VECTOR3I](_native_ptr(), (GDNativeTypePtr)&v);
|
||||
from_type_constructor[VECTOR3I](_native_ptr(), (GDExtensionTypePtr)&v);
|
||||
}
|
||||
|
||||
Variant::Variant(const Transform2D &v) {
|
||||
from_type_constructor[TRANSFORM2D](_native_ptr(), (GDNativeTypePtr)&v);
|
||||
from_type_constructor[TRANSFORM2D](_native_ptr(), (GDExtensionTypePtr)&v);
|
||||
}
|
||||
|
||||
Variant::Variant(const Vector4 &v) {
|
||||
from_type_constructor[VECTOR4](_native_ptr(), (GDNativeTypePtr)&v);
|
||||
from_type_constructor[VECTOR4](_native_ptr(), (GDExtensionTypePtr)&v);
|
||||
}
|
||||
|
||||
Variant::Variant(const Vector4i &v) {
|
||||
from_type_constructor[VECTOR4I](_native_ptr(), (GDNativeTypePtr)&v);
|
||||
from_type_constructor[VECTOR4I](_native_ptr(), (GDExtensionTypePtr)&v);
|
||||
}
|
||||
|
||||
Variant::Variant(const Plane &v) {
|
||||
from_type_constructor[PLANE](_native_ptr(), (GDNativeTypePtr)&v);
|
||||
from_type_constructor[PLANE](_native_ptr(), (GDExtensionTypePtr)&v);
|
||||
}
|
||||
|
||||
Variant::Variant(const Quaternion &v) {
|
||||
from_type_constructor[QUATERNION](_native_ptr(), (GDNativeTypePtr)&v);
|
||||
from_type_constructor[QUATERNION](_native_ptr(), (GDExtensionTypePtr)&v);
|
||||
}
|
||||
|
||||
Variant::Variant(const godot::AABB &v) {
|
||||
from_type_constructor[AABB](_native_ptr(), (GDNativeTypePtr)&v);
|
||||
from_type_constructor[AABB](_native_ptr(), (GDExtensionTypePtr)&v);
|
||||
}
|
||||
|
||||
Variant::Variant(const Basis &v) {
|
||||
from_type_constructor[BASIS](_native_ptr(), (GDNativeTypePtr)&v);
|
||||
from_type_constructor[BASIS](_native_ptr(), (GDExtensionTypePtr)&v);
|
||||
}
|
||||
|
||||
Variant::Variant(const Transform3D &v) {
|
||||
from_type_constructor[TRANSFORM3D](_native_ptr(), (GDNativeTypePtr)&v);
|
||||
from_type_constructor[TRANSFORM3D](_native_ptr(), (GDExtensionTypePtr)&v);
|
||||
}
|
||||
|
||||
Variant::Variant(const Projection &v) {
|
||||
from_type_constructor[PROJECTION](_native_ptr(), (GDNativeTypePtr)&v);
|
||||
from_type_constructor[PROJECTION](_native_ptr(), (GDExtensionTypePtr)&v);
|
||||
}
|
||||
|
||||
Variant::Variant(const Color &v) {
|
||||
from_type_constructor[COLOR](_native_ptr(), (GDNativeTypePtr)&v);
|
||||
from_type_constructor[COLOR](_native_ptr(), (GDExtensionTypePtr)&v);
|
||||
}
|
||||
|
||||
Variant::Variant(const StringName &v) {
|
||||
|
@ -244,17 +244,17 @@ Variant::Variant(const PackedColorArray &v) {
|
|||
}
|
||||
|
||||
Variant::~Variant() {
|
||||
internal::gdn_interface->variant_destroy(_native_ptr());
|
||||
internal::gde_interface->variant_destroy(_native_ptr());
|
||||
}
|
||||
|
||||
Variant::operator bool() const {
|
||||
GDNativeBool result;
|
||||
GDExtensionBool result;
|
||||
to_type_constructor[BOOL](&result, _native_ptr());
|
||||
return PtrToArg<bool>::convert(&result);
|
||||
}
|
||||
|
||||
Variant::operator int64_t() const {
|
||||
GDNativeInt result;
|
||||
GDExtensionInt result;
|
||||
to_type_constructor[INT](&result, _native_ptr());
|
||||
return PtrToArg<int64_t>::convert(&result);
|
||||
}
|
||||
|
@ -289,97 +289,97 @@ Variant::operator String() const {
|
|||
|
||||
Variant::operator Vector2() const {
|
||||
Vector2 result;
|
||||
to_type_constructor[VECTOR2]((GDNativeTypePtr)&result, _native_ptr());
|
||||
to_type_constructor[VECTOR2]((GDExtensionTypePtr)&result, _native_ptr());
|
||||
return result;
|
||||
}
|
||||
|
||||
Variant::operator Vector2i() const {
|
||||
Vector2i result;
|
||||
to_type_constructor[VECTOR2I]((GDNativeTypePtr)&result, _native_ptr());
|
||||
to_type_constructor[VECTOR2I]((GDExtensionTypePtr)&result, _native_ptr());
|
||||
return result;
|
||||
}
|
||||
|
||||
Variant::operator Rect2() const {
|
||||
Rect2 result;
|
||||
to_type_constructor[RECT2]((GDNativeTypePtr)&result, _native_ptr());
|
||||
to_type_constructor[RECT2]((GDExtensionTypePtr)&result, _native_ptr());
|
||||
return result;
|
||||
}
|
||||
|
||||
Variant::operator Rect2i() const {
|
||||
Rect2i result;
|
||||
to_type_constructor[RECT2I]((GDNativeTypePtr)&result, _native_ptr());
|
||||
to_type_constructor[RECT2I]((GDExtensionTypePtr)&result, _native_ptr());
|
||||
return result;
|
||||
}
|
||||
|
||||
Variant::operator Vector3() const {
|
||||
Vector3 result;
|
||||
to_type_constructor[VECTOR3]((GDNativeTypePtr)&result, _native_ptr());
|
||||
to_type_constructor[VECTOR3]((GDExtensionTypePtr)&result, _native_ptr());
|
||||
return result;
|
||||
}
|
||||
|
||||
Variant::operator Vector3i() const {
|
||||
Vector3i result;
|
||||
to_type_constructor[VECTOR3I]((GDNativeTypePtr)&result, _native_ptr());
|
||||
to_type_constructor[VECTOR3I]((GDExtensionTypePtr)&result, _native_ptr());
|
||||
return result;
|
||||
}
|
||||
|
||||
Variant::operator Transform2D() const {
|
||||
Transform2D result;
|
||||
to_type_constructor[TRANSFORM2D]((GDNativeTypePtr)&result, _native_ptr());
|
||||
to_type_constructor[TRANSFORM2D]((GDExtensionTypePtr)&result, _native_ptr());
|
||||
return result;
|
||||
}
|
||||
|
||||
Variant::operator Vector4() const {
|
||||
Vector4 result;
|
||||
to_type_constructor[VECTOR4]((GDNativeTypePtr)&result, _native_ptr());
|
||||
to_type_constructor[VECTOR4]((GDExtensionTypePtr)&result, _native_ptr());
|
||||
return result;
|
||||
}
|
||||
|
||||
Variant::operator Vector4i() const {
|
||||
Vector4i result;
|
||||
to_type_constructor[VECTOR4I]((GDNativeTypePtr)&result, _native_ptr());
|
||||
to_type_constructor[VECTOR4I]((GDExtensionTypePtr)&result, _native_ptr());
|
||||
return result;
|
||||
}
|
||||
|
||||
Variant::operator Plane() const {
|
||||
Plane result;
|
||||
to_type_constructor[PLANE]((GDNativeTypePtr)&result, _native_ptr());
|
||||
to_type_constructor[PLANE]((GDExtensionTypePtr)&result, _native_ptr());
|
||||
return result;
|
||||
}
|
||||
|
||||
Variant::operator Quaternion() const {
|
||||
Quaternion result;
|
||||
to_type_constructor[QUATERNION]((GDNativeTypePtr)&result, _native_ptr());
|
||||
to_type_constructor[QUATERNION]((GDExtensionTypePtr)&result, _native_ptr());
|
||||
return result;
|
||||
}
|
||||
|
||||
Variant::operator godot::AABB() const {
|
||||
godot::AABB result;
|
||||
to_type_constructor[AABB]((GDNativeTypePtr)&result, _native_ptr());
|
||||
to_type_constructor[AABB]((GDExtensionTypePtr)&result, _native_ptr());
|
||||
return result;
|
||||
}
|
||||
|
||||
Variant::operator Basis() const {
|
||||
Basis result;
|
||||
to_type_constructor[BASIS]((GDNativeTypePtr)&result, _native_ptr());
|
||||
to_type_constructor[BASIS]((GDExtensionTypePtr)&result, _native_ptr());
|
||||
return result;
|
||||
}
|
||||
|
||||
Variant::operator Transform3D() const {
|
||||
Transform3D result;
|
||||
to_type_constructor[TRANSFORM3D]((GDNativeTypePtr)&result, _native_ptr());
|
||||
to_type_constructor[TRANSFORM3D]((GDExtensionTypePtr)&result, _native_ptr());
|
||||
return result;
|
||||
}
|
||||
|
||||
Variant::operator Projection() const {
|
||||
Projection result;
|
||||
to_type_constructor[PROJECTION]((GDNativeTypePtr)&result, _native_ptr());
|
||||
to_type_constructor[PROJECTION]((GDExtensionTypePtr)&result, _native_ptr());
|
||||
return result;
|
||||
}
|
||||
|
||||
Variant::operator Color() const {
|
||||
Color result;
|
||||
to_type_constructor[COLOR]((GDNativeTypePtr)&result, _native_ptr());
|
||||
to_type_constructor[COLOR]((GDExtensionTypePtr)&result, _native_ptr());
|
||||
return result;
|
||||
}
|
||||
|
||||
|
@ -407,7 +407,7 @@ Variant::operator Object *() const {
|
|||
if (obj == nullptr) {
|
||||
return nullptr;
|
||||
}
|
||||
return reinterpret_cast<Object *>(internal::gdn_interface->object_get_instance_binding(obj, internal::token, &Object::___binding_callbacks));
|
||||
return reinterpret_cast<Object *>(internal::gde_interface->object_get_instance_binding(obj, internal::token, &Object::___binding_callbacks));
|
||||
}
|
||||
|
||||
Variant::operator Callable() const {
|
||||
|
@ -490,7 +490,7 @@ Variant::operator PackedColorArray() const {
|
|||
|
||||
Variant &Variant::operator=(const Variant &other) {
|
||||
clear();
|
||||
internal::gdn_interface->variant_new_copy(_native_ptr(), other._native_ptr());
|
||||
internal::gde_interface->variant_new_copy(_native_ptr(), other._native_ptr());
|
||||
return *this;
|
||||
}
|
||||
|
||||
|
@ -529,51 +529,51 @@ bool Variant::operator<(const Variant &other) const {
|
|||
return result.operator bool();
|
||||
}
|
||||
|
||||
void Variant::call(const StringName &method, const Variant **args, int argcount, Variant &r_ret, GDNativeCallError &r_error) {
|
||||
internal::gdn_interface->variant_call(_native_ptr(), method._native_ptr(), reinterpret_cast<GDNativeConstVariantPtr *>(args), argcount, r_ret._native_ptr(), &r_error);
|
||||
void Variant::call(const StringName &method, const Variant **args, int argcount, Variant &r_ret, GDExtensionCallError &r_error) {
|
||||
internal::gde_interface->variant_call(_native_ptr(), method._native_ptr(), reinterpret_cast<GDExtensionConstVariantPtr *>(args), argcount, r_ret._native_ptr(), &r_error);
|
||||
}
|
||||
|
||||
void Variant::call_static(Variant::Type type, const StringName &method, const Variant **args, int argcount, Variant &r_ret, GDNativeCallError &r_error) {
|
||||
internal::gdn_interface->variant_call_static(static_cast<GDNativeVariantType>(type), method._native_ptr(), reinterpret_cast<GDNativeConstVariantPtr *>(args), argcount, r_ret._native_ptr(), &r_error);
|
||||
void Variant::call_static(Variant::Type type, const StringName &method, const Variant **args, int argcount, Variant &r_ret, GDExtensionCallError &r_error) {
|
||||
internal::gde_interface->variant_call_static(static_cast<GDExtensionVariantType>(type), method._native_ptr(), reinterpret_cast<GDExtensionConstVariantPtr *>(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) {
|
||||
GDNativeBool valid;
|
||||
internal::gdn_interface->variant_evaluate(static_cast<GDNativeVariantOperator>(op), a._native_ptr(), b._native_ptr(), r_ret._native_ptr(), &valid);
|
||||
GDExtensionBool valid;
|
||||
internal::gde_interface->variant_evaluate(static_cast<GDExtensionVariantOperator>(op), a._native_ptr(), b._native_ptr(), r_ret._native_ptr(), &valid);
|
||||
r_valid = PtrToArg<bool>::convert(&valid);
|
||||
}
|
||||
|
||||
void Variant::set(const Variant &key, const Variant &value, bool *r_valid) {
|
||||
GDNativeBool valid;
|
||||
internal::gdn_interface->variant_set(_native_ptr(), key._native_ptr(), value._native_ptr(), &valid);
|
||||
GDExtensionBool valid;
|
||||
internal::gde_interface->variant_set(_native_ptr(), key._native_ptr(), value._native_ptr(), &valid);
|
||||
if (r_valid) {
|
||||
*r_valid = PtrToArg<bool>::convert(&valid);
|
||||
}
|
||||
}
|
||||
|
||||
void Variant::set_named(const StringName &name, const Variant &value, bool &r_valid) {
|
||||
GDNativeBool valid;
|
||||
internal::gdn_interface->variant_set_named(_native_ptr(), name._native_ptr(), value._native_ptr(), &valid);
|
||||
GDExtensionBool valid;
|
||||
internal::gde_interface->variant_set_named(_native_ptr(), name._native_ptr(), value._native_ptr(), &valid);
|
||||
r_valid = PtrToArg<bool>::convert(&valid);
|
||||
}
|
||||
|
||||
void Variant::set_indexed(int64_t index, const Variant &value, bool &r_valid, bool &r_oob) {
|
||||
GDNativeBool valid, oob;
|
||||
internal::gdn_interface->variant_set_indexed(_native_ptr(), index, value._native_ptr(), &valid, &oob);
|
||||
GDExtensionBool valid, oob;
|
||||
internal::gde_interface->variant_set_indexed(_native_ptr(), index, value._native_ptr(), &valid, &oob);
|
||||
r_valid = PtrToArg<bool>::convert(&valid);
|
||||
r_oob = PtrToArg<bool>::convert(&oob);
|
||||
}
|
||||
|
||||
void Variant::set_keyed(const Variant &key, const Variant &value, bool &r_valid) {
|
||||
GDNativeBool valid;
|
||||
internal::gdn_interface->variant_set_keyed(_native_ptr(), key._native_ptr(), value._native_ptr(), &valid);
|
||||
GDExtensionBool valid;
|
||||
internal::gde_interface->variant_set_keyed(_native_ptr(), key._native_ptr(), value._native_ptr(), &valid);
|
||||
r_valid = PtrToArg<bool>::convert(&valid);
|
||||
}
|
||||
|
||||
Variant Variant::get(const Variant &key, bool *r_valid) const {
|
||||
Variant result;
|
||||
GDNativeBool valid;
|
||||
internal::gdn_interface->variant_get(_native_ptr(), key._native_ptr(), result._native_ptr(), &valid);
|
||||
GDExtensionBool valid;
|
||||
internal::gde_interface->variant_get(_native_ptr(), key._native_ptr(), result._native_ptr(), &valid);
|
||||
if (r_valid) {
|
||||
*r_valid = PtrToArg<bool>::convert(&valid);
|
||||
}
|
||||
|
@ -582,17 +582,17 @@ Variant Variant::get(const Variant &key, bool *r_valid) const {
|
|||
|
||||
Variant Variant::get_named(const StringName &name, bool &r_valid) const {
|
||||
Variant result;
|
||||
GDNativeBool valid;
|
||||
internal::gdn_interface->variant_get_named(_native_ptr(), name._native_ptr(), result._native_ptr(), &valid);
|
||||
GDExtensionBool valid;
|
||||
internal::gde_interface->variant_get_named(_native_ptr(), name._native_ptr(), result._native_ptr(), &valid);
|
||||
r_valid = PtrToArg<bool>::convert(&valid);
|
||||
return result;
|
||||
}
|
||||
|
||||
Variant Variant::get_indexed(int64_t index, bool &r_valid, bool &r_oob) const {
|
||||
Variant result;
|
||||
GDNativeBool valid;
|
||||
GDNativeBool oob;
|
||||
internal::gdn_interface->variant_get_indexed(_native_ptr(), index, result._native_ptr(), &valid, &oob);
|
||||
GDExtensionBool valid;
|
||||
GDExtensionBool oob;
|
||||
internal::gde_interface->variant_get_indexed(_native_ptr(), index, result._native_ptr(), &valid, &oob);
|
||||
r_valid = PtrToArg<bool>::convert(&valid);
|
||||
r_oob = PtrToArg<bool>::convert(&oob);
|
||||
return result;
|
||||
|
@ -600,8 +600,8 @@ 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;
|
||||
GDNativeBool valid;
|
||||
internal::gdn_interface->variant_get_keyed(_native_ptr(), key._native_ptr(), result._native_ptr(), &valid);
|
||||
GDExtensionBool valid;
|
||||
internal::gde_interface->variant_get_keyed(_native_ptr(), key._native_ptr(), result._native_ptr(), &valid);
|
||||
r_valid = PtrToArg<bool>::convert(&valid);
|
||||
return result;
|
||||
}
|
||||
|
@ -617,37 +617,37 @@ bool Variant::in(const Variant &index, bool *r_valid) const {
|
|||
}
|
||||
|
||||
bool Variant::iter_init(Variant &r_iter, bool &r_valid) const {
|
||||
GDNativeBool valid;
|
||||
internal::gdn_interface->variant_iter_init(_native_ptr(), r_iter._native_ptr(), &valid);
|
||||
GDExtensionBool valid;
|
||||
internal::gde_interface->variant_iter_init(_native_ptr(), r_iter._native_ptr(), &valid);
|
||||
return PtrToArg<bool>::convert(&valid);
|
||||
}
|
||||
|
||||
bool Variant::iter_next(Variant &r_iter, bool &r_valid) const {
|
||||
GDNativeBool valid;
|
||||
internal::gdn_interface->variant_iter_next(_native_ptr(), r_iter._native_ptr(), &valid);
|
||||
GDExtensionBool valid;
|
||||
internal::gde_interface->variant_iter_next(_native_ptr(), r_iter._native_ptr(), &valid);
|
||||
return PtrToArg<bool>::convert(&valid);
|
||||
}
|
||||
|
||||
Variant Variant::iter_get(const Variant &r_iter, bool &r_valid) const {
|
||||
Variant result;
|
||||
GDNativeBool valid;
|
||||
internal::gdn_interface->variant_iter_get(_native_ptr(), r_iter._native_ptr(), result._native_ptr(), &valid);
|
||||
GDExtensionBool valid;
|
||||
internal::gde_interface->variant_iter_get(_native_ptr(), r_iter._native_ptr(), result._native_ptr(), &valid);
|
||||
r_valid = PtrToArg<bool>::convert(&valid);
|
||||
return result;
|
||||
}
|
||||
|
||||
Variant::Type Variant::get_type() const {
|
||||
return static_cast<Variant::Type>(internal::gdn_interface->variant_get_type(_native_ptr()));
|
||||
return static_cast<Variant::Type>(internal::gde_interface->variant_get_type(_native_ptr()));
|
||||
}
|
||||
|
||||
bool Variant::has_method(const StringName &method) const {
|
||||
GDNativeBool has = internal::gdn_interface->variant_has_method(_native_ptr(), method._native_ptr());
|
||||
GDExtensionBool has = internal::gde_interface->variant_has_method(_native_ptr(), method._native_ptr());
|
||||
return PtrToArg<bool>::convert(&has);
|
||||
}
|
||||
|
||||
bool Variant::has_key(const Variant &key, bool *r_valid) const {
|
||||
GDNativeBool valid;
|
||||
GDNativeBool has = internal::gdn_interface->variant_has_key(_native_ptr(), key._native_ptr(), &valid);
|
||||
GDExtensionBool valid;
|
||||
GDExtensionBool has = internal::gde_interface->variant_has_key(_native_ptr(), key._native_ptr(), &valid);
|
||||
if (r_valid) {
|
||||
*r_valid = PtrToArg<bool>::convert(&valid);
|
||||
}
|
||||
|
@ -655,59 +655,59 @@ bool Variant::has_key(const Variant &key, bool *r_valid) const {
|
|||
}
|
||||
|
||||
bool Variant::has_member(Variant::Type type, const StringName &member) {
|
||||
GDNativeBool has = internal::gdn_interface->variant_has_member(static_cast<GDNativeVariantType>(type), member._native_ptr());
|
||||
GDExtensionBool has = internal::gde_interface->variant_has_member(static_cast<GDExtensionVariantType>(type), member._native_ptr());
|
||||
return PtrToArg<bool>::convert(&has);
|
||||
}
|
||||
|
||||
uint32_t Variant::hash() const {
|
||||
GDNativeInt hash = internal::gdn_interface->variant_hash(_native_ptr());
|
||||
GDExtensionInt hash = internal::gde_interface->variant_hash(_native_ptr());
|
||||
return PtrToArg<uint32_t>::convert(&hash);
|
||||
}
|
||||
|
||||
uint32_t Variant::recursive_hash(int recursion_count) const {
|
||||
GDNativeInt hash = internal::gdn_interface->variant_recursive_hash(_native_ptr(), recursion_count);
|
||||
GDExtensionInt hash = internal::gde_interface->variant_recursive_hash(_native_ptr(), recursion_count);
|
||||
return PtrToArg<uint32_t>::convert(&hash);
|
||||
}
|
||||
|
||||
bool Variant::hash_compare(const Variant &variant) const {
|
||||
GDNativeBool compare = internal::gdn_interface->variant_hash_compare(_native_ptr(), variant._native_ptr());
|
||||
GDExtensionBool compare = internal::gde_interface->variant_hash_compare(_native_ptr(), variant._native_ptr());
|
||||
return PtrToArg<bool>::convert(&compare);
|
||||
}
|
||||
|
||||
bool Variant::booleanize() const {
|
||||
GDNativeBool booleanized = internal::gdn_interface->variant_booleanize(_native_ptr());
|
||||
GDExtensionBool booleanized = internal::gde_interface->variant_booleanize(_native_ptr());
|
||||
return PtrToArg<bool>::convert(&booleanized);
|
||||
}
|
||||
|
||||
String Variant::stringify() const {
|
||||
String result;
|
||||
internal::gdn_interface->variant_stringify(_native_ptr(), result._native_ptr());
|
||||
internal::gde_interface->variant_stringify(_native_ptr(), result._native_ptr());
|
||||
return result;
|
||||
}
|
||||
|
||||
Variant Variant::duplicate(bool deep) const {
|
||||
Variant result;
|
||||
GDNativeBool _deep;
|
||||
GDExtensionBool _deep;
|
||||
PtrToArg<bool>::encode(deep, &_deep);
|
||||
internal::gdn_interface->variant_duplicate(_native_ptr(), result._native_ptr(), _deep);
|
||||
internal::gde_interface->variant_duplicate(_native_ptr(), result._native_ptr(), _deep);
|
||||
return result;
|
||||
}
|
||||
|
||||
String Variant::get_type_name(Variant::Type type) {
|
||||
String result;
|
||||
internal::gdn_interface->variant_get_type_name(static_cast<GDNativeVariantType>(type), result._native_ptr());
|
||||
internal::gde_interface->variant_get_type_name(static_cast<GDExtensionVariantType>(type), result._native_ptr());
|
||||
return result;
|
||||
}
|
||||
|
||||
bool Variant::can_convert(Variant::Type from, Variant::Type to) {
|
||||
GDNativeBool can;
|
||||
internal::gdn_interface->variant_can_convert(static_cast<GDNativeVariantType>(from), static_cast<GDNativeVariantType>(to));
|
||||
GDExtensionBool can;
|
||||
internal::gde_interface->variant_can_convert(static_cast<GDExtensionVariantType>(from), static_cast<GDExtensionVariantType>(to));
|
||||
return PtrToArg<bool>::convert(&can);
|
||||
}
|
||||
|
||||
bool Variant::can_convert_strict(Variant::Type from, Variant::Type to) {
|
||||
GDNativeBool can;
|
||||
internal::gdn_interface->variant_can_convert_strict(static_cast<GDNativeVariantType>(from), static_cast<GDNativeVariantType>(to));
|
||||
GDExtensionBool can;
|
||||
internal::gde_interface->variant_can_convert_strict(static_cast<GDExtensionVariantType>(from), static_cast<GDExtensionVariantType>(to));
|
||||
return PtrToArg<bool>::convert(&can);
|
||||
}
|
||||
|
||||
|
@ -758,9 +758,9 @@ void Variant::clear() {
|
|||
};
|
||||
|
||||
if (unlikely(needs_deinit[get_type()])) { // Make it fast for types that don't need deinit.
|
||||
internal::gdn_interface->variant_destroy(_native_ptr());
|
||||
internal::gde_interface->variant_destroy(_native_ptr());
|
||||
}
|
||||
internal::gdn_interface->variant_new_nil(_native_ptr());
|
||||
internal::gde_interface->variant_new_nil(_native_ptr());
|
||||
}
|
||||
|
||||
} // namespace godot
|
||||
|
|
|
@ -197,17 +197,17 @@ Ref<ExampleRef> Example::extended_ref_checks(Ref<ExampleRef> p_ref) const {
|
|||
return ref;
|
||||
}
|
||||
|
||||
Variant Example::varargs_func(const Variant **args, GDNativeInt arg_count, GDNativeCallError &error) {
|
||||
Variant Example::varargs_func(const Variant **args, GDExtensionInt arg_count, GDExtensionCallError &error) {
|
||||
UtilityFunctions::print(" Varargs (Variant return) called with ", String::num((double)arg_count), " arguments");
|
||||
return arg_count;
|
||||
}
|
||||
|
||||
int Example::varargs_func_nv(const Variant **args, GDNativeInt arg_count, GDNativeCallError &error) {
|
||||
int Example::varargs_func_nv(const Variant **args, GDExtensionInt arg_count, GDExtensionCallError &error) {
|
||||
UtilityFunctions::print(" Varargs (int return) called with ", String::num((double)arg_count), " arguments");
|
||||
return 42;
|
||||
}
|
||||
|
||||
void Example::varargs_func_void(const Variant **args, GDNativeInt arg_count, GDNativeCallError &error) {
|
||||
void Example::varargs_func_void(const Variant **args, GDExtensionInt arg_count, GDExtensionCallError &error) {
|
||||
UtilityFunctions::print(" Varargs (no return) called with ", String::num((double)arg_count), " arguments");
|
||||
}
|
||||
|
||||
|
|
|
@ -81,9 +81,9 @@ public:
|
|||
Viewport *return_something_const() const;
|
||||
ExampleRef *return_extended_ref() const;
|
||||
Ref<ExampleRef> extended_ref_checks(Ref<ExampleRef> p_ref) const;
|
||||
Variant varargs_func(const Variant **args, GDNativeInt arg_count, GDNativeCallError &error);
|
||||
int varargs_func_nv(const Variant **args, GDNativeInt arg_count, GDNativeCallError &error);
|
||||
void varargs_func_void(const Variant **args, GDNativeInt arg_count, GDNativeCallError &error);
|
||||
Variant varargs_func(const Variant **args, GDExtensionInt arg_count, GDExtensionCallError &error);
|
||||
int varargs_func_nv(const Variant **args, GDExtensionInt arg_count, GDExtensionCallError &error);
|
||||
void varargs_func_void(const Variant **args, GDExtensionInt arg_count, GDExtensionCallError &error);
|
||||
void emit_custom_signal(const String &name, int value);
|
||||
int def_args(int p_a = 100, int p_b = 200);
|
||||
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
|
||||
#include "register_types.h"
|
||||
|
||||
#include <godot/gdnative_interface.h>
|
||||
#include <godot/gdextension_interface.h>
|
||||
|
||||
#include <godot_cpp/core/class_db.hpp>
|
||||
#include <godot_cpp/core/defs.hpp>
|
||||
|
@ -36,7 +36,7 @@ void uninitialize_example_module(ModuleInitializationLevel p_level) {
|
|||
|
||||
extern "C" {
|
||||
// Initialization.
|
||||
GDNativeBool GDN_EXPORT example_library_init(const GDNativeInterface *p_interface, GDNativeExtensionClassLibraryPtr p_library, GDNativeInitialization *r_initialization) {
|
||||
GDExtensionBool GDE_EXPORT example_library_init(const GDExtensionInterface *p_interface, GDExtensionClassLibraryPtr p_library, GDExtensionInitialization *r_initialization) {
|
||||
godot::GDExtensionBinding::InitObject init_obj(p_interface, p_library, r_initialization);
|
||||
|
||||
init_obj.register_initializer(initialize_example_module);
|
||||
|
|
Loading…
Reference in New Issue