mirror of
https://codeberg.org/StreamGraph/StreamGraph.git
synced 2024-11-13 19:49:55 +01:00
fix connections
This commit is contained in:
parent
6b43e807d6
commit
badd1e2450
2 changed files with 4 additions and 5 deletions
|
@ -22,7 +22,6 @@ static var type_assoc: Dictionary = {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
func add_node(node: GDScript, meta: Dictionary = {}) -> DeckNode:
|
func add_node(node: GDScript, meta: Dictionary = {}) -> DeckNode:
|
||||||
# TODO: accept instances of DeckNode instead of instancing here?
|
# TODO: accept instances of DeckNode instead of instancing here?
|
||||||
var uuid := UUID.v4()
|
var uuid := UUID.v4()
|
||||||
|
@ -44,9 +43,9 @@ func get_node(uuid: String) -> DeckNode:
|
||||||
|
|
||||||
func connect_nodes(from_node: DeckNode, to_node: DeckNode, from_port: int, to_port: int) -> bool:
|
func connect_nodes(from_node: DeckNode, to_node: DeckNode, from_port: int, to_port: int) -> bool:
|
||||||
# first, check that we can do the type conversion.
|
# first, check that we can do the type conversion.
|
||||||
var type_a: Types = from_node.input_ports[from_port].type
|
var type_a: Types = from_node.output_ports[from_port].type
|
||||||
var type_b: Types = to_node.output_ports[to_port].type
|
var type_b: Types = to_node.input_ports[to_port].type
|
||||||
var err: DeckType = (type_assoc[type_b] as GDScript).from(type_assoc[type_a])
|
var err: DeckType = (type_assoc[type_b]).from(type_assoc[type_a].new())
|
||||||
if err is DeckType.DeckTypeError:
|
if err is DeckType.DeckTypeError:
|
||||||
print(err.error_message)
|
print(err.error_message)
|
||||||
return false
|
return false
|
||||||
|
|
|
@ -20,7 +20,7 @@ func add_output_port(type: Deck.Types, label: String, descriptor: String = "") -
|
||||||
|
|
||||||
|
|
||||||
func send(from_port: int, data: DeckType, extra_data: Array = []) -> void:
|
func send(from_port: int, data: DeckType, extra_data: Array = []) -> void:
|
||||||
if !(outgoing_connections.get(from_port)):
|
if outgoing_connections.get(from_port) == null:
|
||||||
return
|
return
|
||||||
|
|
||||||
for connection in outgoing_connections[from_port]:
|
for connection in outgoing_connections[from_port]:
|
||||||
|
|
Loading…
Reference in a new issue