Added has_signal method for Object
This commit is contained in:
parent
63f77efdc6
commit
258d91f883
|
@ -1324,6 +1324,25 @@ Array Object::_get_incoming_connections() const {
|
||||||
return ret;
|
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 {
|
void Object::get_signal_list(List<MethodInfo> *p_signals) const {
|
||||||
|
|
||||||
if (!script.is_null()) {
|
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_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_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_signal_connection_list", "signal"), &Object::_get_signal_connection_list);
|
||||||
ClassDB::bind_method(D_METHOD("get_incoming_connections"), &Object::_get_incoming_connections);
|
ClassDB::bind_method(D_METHOD("get_incoming_connections"), &Object::_get_incoming_connections);
|
||||||
|
|
|
@ -694,6 +694,7 @@ public:
|
||||||
void add_user_signal(const MethodInfo &p_signal);
|
void add_user_signal(const MethodInfo &p_signal);
|
||||||
Error emit_signal(const StringName &p_name, VARIANT_ARG_LIST);
|
Error emit_signal(const StringName &p_name, VARIANT_ARG_LIST);
|
||||||
Error emit_signal(const StringName &p_name, const Variant **p_args, int p_argcount);
|
Error emit_signal(const StringName &p_name, const Variant **p_args, int p_argcount);
|
||||||
|
bool has_signal(const StringName &p_name) const;
|
||||||
void get_signal_list(List<MethodInfo> *p_signals) const;
|
void get_signal_list(List<MethodInfo> *p_signals) const;
|
||||||
void get_signal_connection_list(const StringName &p_signal, List<Connection> *p_connections) const;
|
void get_signal_connection_list(const StringName &p_signal, List<Connection> *p_connections) const;
|
||||||
void get_all_signal_connections(List<Connection> *p_connections) const;
|
void get_all_signal_connections(List<Connection> *p_connections) const;
|
||||||
|
|
|
@ -311,13 +311,22 @@
|
||||||
Returns [code]true[/code] if the object contains the given [code]method[/code].
|
Returns [code]true[/code] if the object contains the given [code]method[/code].
|
||||||
</description>
|
</description>
|
||||||
</method>
|
</method>
|
||||||
|
<method name="has_signal" qualifiers="const">
|
||||||
|
<return type="bool">
|
||||||
|
</return>
|
||||||
|
<argument index="0" name="signal" type="String">
|
||||||
|
</argument>
|
||||||
|
<description>
|
||||||
|
Returns [code]true[/code] if the given [code]signal[/code] exists.
|
||||||
|
</description>
|
||||||
|
</method>
|
||||||
<method name="has_user_signal" qualifiers="const">
|
<method name="has_user_signal" qualifiers="const">
|
||||||
<return type="bool">
|
<return type="bool">
|
||||||
</return>
|
</return>
|
||||||
<argument index="0" name="signal" type="StringName">
|
<argument index="0" name="signal" type="StringName">
|
||||||
</argument>
|
</argument>
|
||||||
<description>
|
<description>
|
||||||
Returns [code]true[/code] if the given user-defined [code]signal[/code] exists.
|
Returns [code]true[/code] if the given user-defined [code]signal[/code] exists. Only signals added using [method add_user_signal] are taken into account.
|
||||||
</description>
|
</description>
|
||||||
</method>
|
</method>
|
||||||
<method name="is_blocking_signals" qualifiers="const">
|
<method name="is_blocking_signals" qualifiers="const">
|
||||||
|
|
Loading…
Reference in New Issue