You've already forked godot
mirror of
https://github.com/godotengine/godot.git
synced 2025-11-11 13:10:58 +00:00
GDExtension: Add system for builtin method compatibility
This commit is contained in:
@@ -817,13 +817,11 @@ static GDExtensionPtrOperatorEvaluator gdextension_variant_get_ptr_operator_eval
|
||||
}
|
||||
static GDExtensionPtrBuiltInMethod gdextension_variant_get_ptr_builtin_method(GDExtensionVariantType p_type, GDExtensionConstStringNamePtr p_method, GDExtensionInt p_hash) {
|
||||
const StringName method = *reinterpret_cast<const StringName *>(p_method);
|
||||
uint32_t hash = Variant::get_builtin_method_hash(Variant::Type(p_type), method);
|
||||
if (hash != p_hash) {
|
||||
ERR_PRINT_ONCE("Error getting method " + method + ", hash mismatch.");
|
||||
return nullptr;
|
||||
GDExtensionPtrBuiltInMethod ptr = (GDExtensionPtrBuiltInMethod)Variant::get_ptr_builtin_method_with_compatibility(Variant::Type(p_type), method, p_hash);
|
||||
if (!ptr) {
|
||||
ERR_PRINT("Error getting method " + method + ", missing or hash mismatch.");
|
||||
}
|
||||
|
||||
return (GDExtensionPtrBuiltInMethod)Variant::get_ptr_builtin_method(Variant::Type(p_type), method);
|
||||
return ptr;
|
||||
}
|
||||
static GDExtensionPtrConstructor gdextension_variant_get_ptr_constructor(GDExtensionVariantType p_type, int32_t p_constructor) {
|
||||
return (GDExtensionPtrConstructor)Variant::get_ptr_constructor(Variant::Type(p_type), p_constructor);
|
||||
|
||||
Reference in New Issue
Block a user