Compare commits
3 Commits
f7674a16b6
...
98ebc784c5
Author | SHA1 | Date |
---|---|---|
A Thousand Ships | 98ebc784c5 | |
A Thousand Ships | e449b14c68 | |
A Thousand Ships | a507d535f9 |
|
@ -215564,14 +215564,13 @@
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "_get_method_argument_count",
|
"name": "_get_script_method_argument_count",
|
||||||
"is_const": true,
|
"is_const": true,
|
||||||
"is_static": false,
|
"is_static": false,
|
||||||
"is_vararg": false,
|
"is_vararg": false,
|
||||||
"is_virtual": true,
|
"is_virtual": true,
|
||||||
"return_value": {
|
"return_value": {
|
||||||
"type": "int",
|
"type": "Variant"
|
||||||
"meta": "int32"
|
|
||||||
},
|
},
|
||||||
"arguments": [
|
"arguments": [
|
||||||
{
|
{
|
||||||
|
|
|
@ -391,7 +391,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 GDExtensionInt (*GDExtensionCallableCustomGetArgumentCount)(void *callable_userdata);
|
typedef GDExtensionInt (*GDExtensionCallableCustomGetArgumentCount)(void *callable_userdata, GDExtensionBool *r_is_valid);
|
||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
/* Only `call_func` and `token` are strictly required, however, `object_id` 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.
|
||||||
|
@ -482,7 +482,7 @@ typedef void (*GDExtensionScriptInstanceFreeMethodList)(GDExtensionScriptInstanc
|
||||||
|
|
||||||
typedef GDExtensionBool (*GDExtensionScriptInstanceHasMethod)(GDExtensionScriptInstanceDataPtr p_instance, GDExtensionConstStringNamePtr p_name);
|
typedef GDExtensionBool (*GDExtensionScriptInstanceHasMethod)(GDExtensionScriptInstanceDataPtr p_instance, GDExtensionConstStringNamePtr p_name);
|
||||||
|
|
||||||
typedef GDExtensionInt (*GDExtensionScriptInstanceGetMethodArgumentCount)(GDExtensionScriptInstanceDataPtr p_instance, GDExtensionConstStringNamePtr p_name);
|
typedef GDExtensionInt (*GDExtensionScriptInstanceGetMethodArgumentCount)(GDExtensionScriptInstanceDataPtr p_instance, GDExtensionConstStringNamePtr p_name, GDExtensionBool *r_is_valid);
|
||||||
|
|
||||||
typedef void (*GDExtensionScriptInstanceCall)(GDExtensionScriptInstanceDataPtr p_self, GDExtensionConstStringNamePtr p_method, const GDExtensionConstVariantPtr *p_args, GDExtensionInt p_argument_count, GDExtensionVariantPtr r_return, GDExtensionCallError *r_error);
|
typedef void (*GDExtensionScriptInstanceCall)(GDExtensionScriptInstanceDataPtr p_self, GDExtensionConstStringNamePtr p_method, const GDExtensionConstVariantPtr *p_args, GDExtensionInt p_argument_count, GDExtensionVariantPtr r_return, GDExtensionCallError *r_error);
|
||||||
typedef void (*GDExtensionScriptInstanceNotification)(GDExtensionScriptInstanceDataPtr p_instance, int32_t p_what); // Deprecated. Use GDExtensionScriptInstanceNotification2 instead.
|
typedef void (*GDExtensionScriptInstanceNotification)(GDExtensionScriptInstanceDataPtr p_instance, int32_t p_what); // Deprecated. Use GDExtensionScriptInstanceNotification2 instead.
|
||||||
|
|
|
@ -41,7 +41,7 @@ class Object;
|
||||||
class CallableCustomBase {
|
class CallableCustomBase {
|
||||||
public:
|
public:
|
||||||
virtual ObjectID get_object() const = 0;
|
virtual ObjectID get_object() const = 0;
|
||||||
virtual int get_argument_count() const;
|
virtual int get_argument_count(bool &r_is_valid) const;
|
||||||
virtual void call(const Variant **p_arguments, int p_argcount, Variant &r_return_value, GDExtensionCallError &r_call_error) const = 0;
|
virtual void call(const Variant **p_arguments, int p_argcount, Variant &r_return_value, GDExtensionCallError &r_call_error) const = 0;
|
||||||
virtual ~CallableCustomBase() {}
|
virtual ~CallableCustomBase() {}
|
||||||
};
|
};
|
||||||
|
|
|
@ -73,7 +73,8 @@ public:
|
||||||
return ObjectID(data.instance->get_instance_id());
|
return ObjectID(data.instance->get_instance_id());
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual int get_argument_count() const override {
|
virtual int get_argument_count(bool &r_is_valid) const override {
|
||||||
|
r_is_valid = true;
|
||||||
return sizeof...(P);
|
return sizeof...(P);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -114,7 +115,8 @@ public:
|
||||||
return ObjectID(data.instance->get_instance_id());
|
return ObjectID(data.instance->get_instance_id());
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual int get_argument_count() const override {
|
virtual int get_argument_count(bool &r_is_valid) const override {
|
||||||
|
r_is_valid = true;
|
||||||
return sizeof...(P);
|
return sizeof...(P);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -155,7 +157,8 @@ public:
|
||||||
return ObjectID(data.instance->get_instance_id());
|
return ObjectID(data.instance->get_instance_id());
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual int get_argument_count() const override {
|
virtual int get_argument_count(bool &r_is_valid) const override {
|
||||||
|
r_is_valid = true;
|
||||||
return sizeof...(P);
|
return sizeof...(P);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -194,7 +197,8 @@ public:
|
||||||
return ObjectID();
|
return ObjectID();
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual int get_argument_count() const override {
|
virtual int get_argument_count(bool &r_is_valid) const override {
|
||||||
|
r_is_valid = true;
|
||||||
return sizeof...(P);
|
return sizeof...(P);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -234,7 +238,8 @@ public:
|
||||||
return ObjectID();
|
return ObjectID();
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual int get_argument_count() const override {
|
virtual int get_argument_count(bool &r_is_valid) const override {
|
||||||
|
r_is_valid = true;
|
||||||
return sizeof...(P);
|
return sizeof...(P);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -35,7 +35,8 @@
|
||||||
|
|
||||||
namespace godot {
|
namespace godot {
|
||||||
|
|
||||||
int CallableCustomBase::get_argument_count() const {
|
int CallableCustomBase::get_argument_count(bool &r_is_valid) const {
|
||||||
|
r_is_valid = false;
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -88,9 +89,12 @@ static GDExtensionBool callable_custom_less_than_func(void *p_a, void *p_b) {
|
||||||
return func_a(a, b);
|
return func_a(a, b);
|
||||||
}
|
}
|
||||||
|
|
||||||
static GDExtensionInt custom_callable_get_argument_count_func(void *p_userdata) {
|
static GDExtensionInt custom_callable_get_argument_count_func(void *p_userdata, GDExtensionBool *r_is_valid) {
|
||||||
CallableCustom *callable_custom = (CallableCustom *)p_userdata;
|
CallableCustom *callable_custom = (CallableCustom *)p_userdata;
|
||||||
return callable_custom->get_argument_count();
|
bool valid = false;
|
||||||
|
int ret = callable_custom->get_argument_count(valid);
|
||||||
|
*r_is_valid = valid;
|
||||||
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool CallableCustom::is_valid() const {
|
bool CallableCustom::is_valid() const {
|
||||||
|
|
|
@ -77,9 +77,12 @@ static GDExtensionBool custom_callable_mp_less_than_func(void *p_a, void *p_b) {
|
||||||
return memcmp(a->get_comp_ptr(), b->get_comp_ptr(), a->get_comp_size() * 4) < 0;
|
return memcmp(a->get_comp_ptr(), b->get_comp_ptr(), a->get_comp_size() * 4) < 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static GDExtensionInt custom_callable_mp_get_argument_count_func(void *p_userdata) {
|
static GDExtensionInt custom_callable_mp_get_argument_count_func(void *p_userdata, GDExtensionBool *r_is_valid) {
|
||||||
CallableCustomMethodPointerBase *callable_method_pointer = (CallableCustomMethodPointerBase *)p_userdata;
|
CallableCustomMethodPointerBase *callable_method_pointer = (CallableCustomMethodPointerBase *)p_userdata;
|
||||||
return callable_method_pointer->get_argument_count();
|
bool valid = false;
|
||||||
|
int ret = callable_method_pointer->get_argument_count(valid);
|
||||||
|
*r_is_valid = valid;
|
||||||
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
void CallableCustomMethodPointerBase::_setup(uint32_t *p_base_ptr, uint32_t p_ptr_size) {
|
void CallableCustomMethodPointerBase::_setup(uint32_t *p_base_ptr, uint32_t p_ptr_size) {
|
||||||
|
|
|
@ -49,7 +49,8 @@ public:
|
||||||
return ObjectID();
|
return ObjectID();
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual int get_argument_count() const {
|
virtual int get_argument_count(bool &r_is_valid) const {
|
||||||
|
r_is_valid = true;
|
||||||
return 2;
|
return 2;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue