2020-02-22 21:59:09 +08:00
<?xml version="1.0" encoding="UTF-8" ?>
2022-02-14 21:18:53 +08:00
<class name= "Signal" version= "4.0" xmlns:xsi= "http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation= "../class.xsd" >
2020-02-22 21:59:09 +08:00
<brief_description >
2020-03-04 02:21:21 +08:00
Class representing a signal defined in an object.
2020-02-22 21:59:09 +08:00
</brief_description>
<description >
</description>
<tutorials >
2022-04-08 22:25:45 +08:00
<link title= "Using Signals" > $DOCS_URL/getting_started/step_by_step/signals.html</link>
<link title= "GDScript Basics" > $DOCS_URL/tutorials/scripting/gdscript/gdscript_basics.html#signals</link>
2020-02-22 21:59:09 +08:00
</tutorials>
2021-09-21 10:49:02 +08:00
<constructors >
<constructor name= "Signal" >
2021-07-30 21:28:05 +08:00
<return type= "Signal" />
2020-11-10 00:46:03 +08:00
<description >
Constructs a null [Signal] with no object nor signal name bound.
</description>
2021-09-21 10:49:02 +08:00
</constructor>
<constructor name= "Signal" >
2021-07-30 21:28:05 +08:00
<return type= "Signal" />
2022-08-07 02:11:48 +08:00
<param index= "0" name= "from" type= "Signal" />
2020-11-10 00:46:03 +08:00
<description >
Constructs a [Signal] as a copy of the given [Signal].
</description>
2021-09-21 10:49:02 +08:00
</constructor>
<constructor name= "Signal" >
2021-07-30 21:28:05 +08:00
<return type= "Signal" />
2022-08-07 02:11:48 +08:00
<param index= "0" name= "object" type= "Object" />
<param index= "1" name= "signal" type= "StringName" />
2020-02-22 21:59:09 +08:00
<description >
2022-08-10 10:00:19 +08:00
Creates a new [Signal] with the name [param signal] in the specified [param object].
2020-02-22 21:59:09 +08:00
</description>
2021-09-21 10:49:02 +08:00
</constructor>
</constructors>
<methods >
2020-02-22 21:59:09 +08:00
<method name= "connect" >
2021-07-30 21:28:05 +08:00
<return type= "int" />
2022-08-07 02:11:48 +08:00
<param index= "0" name= "callable" type= "Callable" />
<param index= "1" name= "flags" type= "int" default= "0" />
2020-02-22 21:59:09 +08:00
<description >
2021-09-20 00:55:23 +08:00
Connects this signal to the specified [Callable], optionally providing connection flags. You can provide additional arguments to the connected method call by using [method Callable.bind].
[codeblock]
for button in $Buttons.get_children():
button.pressed.connect(on_pressed.bind(button))
func on_pressed(button):
print(button.name, " was pressed")
[/codeblock]
2020-02-22 21:59:09 +08:00
</description>
</method>
<method name= "disconnect" >
2021-07-30 21:28:05 +08:00
<return type= "void" />
2022-08-07 02:11:48 +08:00
<param index= "0" name= "callable" type= "Callable" />
2020-02-22 21:59:09 +08:00
<description >
2020-03-04 02:21:21 +08:00
Disconnects this signal from the specified [Callable].
2020-02-22 21:59:09 +08:00
</description>
</method>
2021-03-18 21:44:42 +08:00
<method name= "emit" qualifiers= "vararg const" >
2021-07-30 21:28:05 +08:00
<return type= "void" />
2020-02-22 21:59:09 +08:00
<description >
2020-03-04 02:21:21 +08:00
Emits this signal to all connected objects.
2020-02-22 21:59:09 +08:00
</description>
</method>
2021-03-18 21:44:42 +08:00
<method name= "get_connections" qualifiers= "const" >
2021-07-30 21:28:05 +08:00
<return type= "Array" />
2020-02-22 21:59:09 +08:00
<description >
2020-03-04 02:21:21 +08:00
Returns the list of [Callable]s connected to this signal.
2020-02-22 21:59:09 +08:00
</description>
</method>
2021-03-18 21:44:42 +08:00
<method name= "get_name" qualifiers= "const" >
2021-07-30 21:28:05 +08:00
<return type= "StringName" />
2020-02-22 21:59:09 +08:00
<description >
2020-03-04 02:21:21 +08:00
Returns the name of this signal.
2020-02-22 21:59:09 +08:00
</description>
</method>
2021-03-18 21:44:42 +08:00
<method name= "get_object" qualifiers= "const" >
2021-07-30 21:28:05 +08:00
<return type= "Object" />
2020-02-22 21:59:09 +08:00
<description >
2020-03-04 02:21:21 +08:00
Returns the object emitting this signal.
2020-02-22 21:59:09 +08:00
</description>
</method>
2021-03-18 21:44:42 +08:00
<method name= "get_object_id" qualifiers= "const" >
2021-07-30 21:28:05 +08:00
<return type= "int" />
2020-02-22 21:59:09 +08:00
<description >
2020-03-04 02:21:21 +08:00
Returns the ID of the object emitting this signal (see [method Object.get_instance_id]).
2020-02-22 21:59:09 +08:00
</description>
</method>
2021-03-18 21:44:42 +08:00
<method name= "is_connected" qualifiers= "const" >
2021-07-30 21:28:05 +08:00
<return type= "bool" />
2022-08-07 02:11:48 +08:00
<param index= "0" name= "callable" type= "Callable" />
2020-02-22 21:59:09 +08:00
<description >
2020-03-04 02:21:21 +08:00
Returns [code]true[/code] if the specified [Callable] is connected to this signal.
2020-02-22 21:59:09 +08:00
</description>
</method>
2021-03-18 21:44:42 +08:00
<method name= "is_null" qualifiers= "const" >
2021-07-30 21:28:05 +08:00
<return type= "bool" />
2020-02-22 21:59:09 +08:00
<description >
</description>
</method>
2021-09-21 10:49:02 +08:00
</methods>
<operators >
<operator name= "operator !=" >
2021-07-30 21:28:05 +08:00
<return type= "bool" />
2022-08-07 02:11:48 +08:00
<param index= "0" name= "right" type= "Signal" />
2020-11-10 21:16:20 +08:00
<description >
</description>
2021-09-21 10:49:02 +08:00
</operator>
<operator name= "operator ==" >
2021-07-30 21:28:05 +08:00
<return type= "bool" />
2022-08-07 02:11:48 +08:00
<param index= "0" name= "right" type= "Signal" />
2020-11-10 21:16:20 +08:00
<description >
</description>
2021-09-21 10:49:02 +08:00
</operator>
</operators>
2020-02-22 21:59:09 +08:00
</class>