You've already forked godot
mirror of
https://github.com/godotengine/godot.git
synced 2025-11-08 12:40:44 +00:00
Add example of using get_connection_list_from_node
This commit is contained in:
@@ -223,6 +223,25 @@
|
|||||||
keep_alive: bool
|
keep_alive: bool
|
||||||
}
|
}
|
||||||
[/codeblock]
|
[/codeblock]
|
||||||
|
[b]Example:[/b] Get all connections on a specific port:
|
||||||
|
[codeblock]
|
||||||
|
func get_connection_list_from_port(node, port):
|
||||||
|
var connections = get_connection_list_from_node(node)
|
||||||
|
var result = []
|
||||||
|
for connection in connections:
|
||||||
|
var dict = {}
|
||||||
|
if connection["from_node"] == node and connection["from_port"] == port:
|
||||||
|
dict["node"] = connection["to_node"]
|
||||||
|
dict["port"] = connection["to_port"]
|
||||||
|
dict["type"] = "left"
|
||||||
|
result.push_back(dict)
|
||||||
|
elif connection["to_node"] == node and connection["to_port"] == port:
|
||||||
|
dict["node"] = connection["from_node"]
|
||||||
|
dict["port"] = connection["from_port"]
|
||||||
|
dict["type"] = "right"
|
||||||
|
result.push_back(dict)
|
||||||
|
return result
|
||||||
|
[/codeblock]
|
||||||
</description>
|
</description>
|
||||||
</method>
|
</method>
|
||||||
<method name="get_connections_intersecting_with_rect" qualifiers="const">
|
<method name="get_connections_intersecting_with_rect" qualifiers="const">
|
||||||
|
|||||||
Reference in New Issue
Block a user