Merge pull request #83800 from dsnopek/gdextension-callable-custom-object-id

GDExtension: Use `ObjectID` when creating custom callable
This commit is contained in:
Rémi Verschelde 2023-10-25 10:29:58 +02:00
commit f7c43a8a19
No known key found for this signature in database
GPG Key ID: C3336907360768E1
2 changed files with 3 additions and 5 deletions

View File

@ -159,9 +159,7 @@ public:
userdata = p_info->callable_userdata; userdata = p_info->callable_userdata;
token = p_info->token; token = p_info->token;
if (p_info->object != nullptr) { object = p_info->object_id;
object = ((Object *)p_info->object)->get_instance_id();
}
call_func = p_info->call_func; call_func = p_info->call_func;
is_valid_func = p_info->is_valid_func; is_valid_func = p_info->is_valid_func;

View File

@ -392,7 +392,7 @@ typedef GDExtensionBool (*GDExtensionCallableCustomLessThan)(void *callable_user
typedef void (*GDExtensionCallableCustomToString)(void *callable_userdata, GDExtensionBool *r_is_valid, GDExtensionStringPtr r_out); typedef void (*GDExtensionCallableCustomToString)(void *callable_userdata, GDExtensionBool *r_is_valid, GDExtensionStringPtr r_out);
typedef struct { typedef struct {
/* Only `call_func` and `token` are strictly required, however, `object` should be passed if its not a static method. /* Only `call_func` and `token` are strictly required, however, `object_id` should be passed if its not a static method.
* *
* `token` should point to an address that uniquely identifies the GDExtension (for example, the * `token` should point to an address that uniquely identifies the GDExtension (for example, the
* `GDExtensionClassLibraryPtr` passed to the entry symbol function. * `GDExtensionClassLibraryPtr` passed to the entry symbol function.
@ -409,7 +409,7 @@ typedef struct {
void *callable_userdata; void *callable_userdata;
void *token; void *token;
GDExtensionObjectPtr object; GDObjectInstanceID object_id;
GDExtensionCallableCustomCall call_func; GDExtensionCallableCustomCall call_func;
GDExtensionCallableCustomIsValid is_valid_func; GDExtensionCallableCustomIsValid is_valid_func;