refresh visual connections in deck renderer when duplicating nodes

This commit is contained in:
Lera Elvoé 2023-12-02 01:14:19 +03:00
parent 440ec5bb2e
commit c243d24028
No known key found for this signature in database

View file

@ -151,8 +151,7 @@ func _on_deck_node_added(node: DeckNode) -> void:
inst.node = node inst.node = node
add_child(inst) add_child(inst)
inst.position_offset = inst.node.position_as_vector2() inst.position_offset = inst.node.position_as_vector2()
clear_connections()
refresh_connections()
## Connected to [signal Deck.node_added], used to remove the specified ## Connected to [signal Deck.node_added], used to remove the specified
## [DeckNodeRendererGraphNode] and queue_free it. ## [DeckNodeRendererGraphNode] and queue_free it.
@ -258,8 +257,12 @@ func _on_paste_nodes_request() -> void:
if snapping_enabled: if snapping_enabled:
node_pos = node_pos.snapped(Vector2(snapping_distance, snapping_distance)) node_pos = node_pos.snapped(Vector2(snapping_distance, snapping_distance))
clear_connections()
deck.paste_nodes_from_json(clip, node_pos) deck.paste_nodes_from_json(clip, node_pos)
refresh_connections()
func _on_duplicate_nodes_request() -> void: func _on_duplicate_nodes_request() -> void:
var selected := get_selected_nodes() var selected := get_selected_nodes()
@ -272,4 +275,8 @@ func _on_duplicate_nodes_request() -> void:
return x.node._id return x.node._id
)) ))
clear_connections()
deck.duplicate_nodes(selected_ids) deck.duplicate_nodes(selected_ids)
refresh_connections()