mirror of
https://codeberg.org/StreamGraph/StreamGraph.git
synced 2024-11-13 19:49:55 +01:00
make sure node renderers exist when trying to disconnect
This commit is contained in:
parent
0a564722f2
commit
f760cd227d
1 changed files with 14 additions and 10 deletions
|
@ -124,12 +124,18 @@ func attempt_disconnect(from_node_name: StringName, from_port: int, to_node_name
|
|||
dirty = true
|
||||
|
||||
|
||||
## Returns the associated [DeckNodeRendererGraphNode] for the supplied [DeckNode].
|
||||
## Or [code]null[/code] if none is found.
|
||||
## Returns the associated [DeckNodeRendererGraphNode] for the supplied [DeckNode],
|
||||
## or [code]null[/code] if none is found.
|
||||
func get_node_renderer(node: DeckNode) -> DeckNodeRendererGraphNode:
|
||||
return get_node_or_null(NodePath(node._id))
|
||||
|
||||
|
||||
## Returns the associated [DeckNodeRendererGraphNode] for the supplied [DeckNode] [member DeckNode._id],
|
||||
## or [code]null[/code] if none is found.
|
||||
func get_node_id_renderer(id: String) -> DeckNodeRendererGraphNode:
|
||||
return get_node_or_null(NodePath(id))
|
||||
|
||||
|
||||
func focus_node(node: DeckNodeRendererGraphNode) -> void:
|
||||
set_selected(node)
|
||||
var t := create_tween()
|
||||
|
@ -349,14 +355,12 @@ func _on_add_node_menu_node_selected(type: String) -> void:
|
|||
|
||||
|
||||
func _on_deck_nodes_disconnected(from_node_id: String, to_node_id: String, from_output_port: int, to_input_port: int) -> void:
|
||||
var from_node: DeckNodeRendererGraphNode = get_children().filter(
|
||||
func(x: DeckNodeRendererGraphNode):
|
||||
return x.node._id == from_node_id
|
||||
)[0]
|
||||
var to_node: DeckNodeRendererGraphNode = get_children().filter(
|
||||
func(x: DeckNodeRendererGraphNode):
|
||||
return x.node._id == to_node_id
|
||||
)[0]
|
||||
var from_node := get_node_id_renderer(from_node_id)
|
||||
if from_node == null:
|
||||
return
|
||||
var to_node := get_node_id_renderer(to_node_id)
|
||||
if to_node == null:
|
||||
return
|
||||
|
||||
disconnect_node(from_node.name, from_output_port, to_node.name, to_input_port)
|
||||
|
||||
|
|
Loading…
Reference in a new issue