You've already forked godot
mirror of
https://github.com/godotengine/godot.git
synced 2025-11-05 12:10:55 +00:00
Added has_signal method for Object
This commit is contained in:
@@ -1324,6 +1324,25 @@ Array Object::_get_incoming_connections() const {
|
||||
return ret;
|
||||
}
|
||||
|
||||
bool Object::has_signal(const StringName &p_name) const {
|
||||
if (!script.is_null()) {
|
||||
Ref<Script> scr = script;
|
||||
if (scr.is_valid() && scr->has_script_signal(p_name)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
if (ClassDB::has_signal(get_class_name(), p_name)) {
|
||||
return true;
|
||||
}
|
||||
|
||||
if (_has_user_signal(p_name)) {
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
void Object::get_signal_list(List<MethodInfo> *p_signals) const {
|
||||
|
||||
if (!script.is_null()) {
|
||||
@@ -1696,6 +1715,7 @@ void Object::_bind_methods() {
|
||||
|
||||
ClassDB::bind_method(D_METHOD("has_method", "method"), &Object::has_method);
|
||||
|
||||
ClassDB::bind_method(D_METHOD("has_signal", "signal"), &Object::has_signal);
|
||||
ClassDB::bind_method(D_METHOD("get_signal_list"), &Object::_get_signal_list);
|
||||
ClassDB::bind_method(D_METHOD("get_signal_connection_list", "signal"), &Object::_get_signal_connection_list);
|
||||
ClassDB::bind_method(D_METHOD("get_incoming_connections"), &Object::_get_incoming_connections);
|
||||
|
||||
Reference in New Issue
Block a user