mirror of
https://github.com/godotengine/godot.git
synced 2026-01-06 10:11:57 +03:00
Add methods to get argument count of methods
Added to: * `Callable`s * `Object`s * `ClassDB` * `Script(Instance)`s
This commit is contained in:
@@ -163,6 +163,20 @@ StringName Callable::get_method() const {
|
||||
return method;
|
||||
}
|
||||
|
||||
int Callable::get_argument_count(bool *r_is_valid) const {
|
||||
if (is_custom()) {
|
||||
bool valid = false;
|
||||
return custom->get_argument_count(r_is_valid ? *r_is_valid : valid);
|
||||
} else if (!is_null()) {
|
||||
return get_object()->get_method_argument_count(method, r_is_valid);
|
||||
} else {
|
||||
if (r_is_valid) {
|
||||
*r_is_valid = false;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
int Callable::get_bound_arguments_count() const {
|
||||
if (!is_null() && is_custom()) {
|
||||
return custom->get_bound_arguments_count();
|
||||
@@ -417,6 +431,11 @@ const Callable *CallableCustom::get_base_comparator() const {
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
int CallableCustom::get_argument_count(bool &r_is_valid) const {
|
||||
r_is_valid = false;
|
||||
return 0;
|
||||
}
|
||||
|
||||
int CallableCustom::get_bound_arguments_count() const {
|
||||
return 0;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user