From 4f40e91726fe18aea1f2988ba74b64098182541c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lera=20Elvo=C3=A9?= Date: Wed, 13 Dec 2023 19:59:25 +0300 Subject: [PATCH] fix setting dirty multiple times when initializing from deck --- graph_node_renderer/deck_renderer_graph_edit.gd | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/graph_node_renderer/deck_renderer_graph_edit.gd b/graph_node_renderer/deck_renderer_graph_edit.gd index 0c37915..90ba370 100644 --- a/graph_node_renderer/deck_renderer_graph_edit.gd +++ b/graph_node_renderer/deck_renderer_graph_edit.gd @@ -32,10 +32,13 @@ signal group_enter_requested(group_id: String) var dirty: bool = false: set(v): - dirty = v - dirty_state_changed.emit() + if change_dirty: + dirty = v + dirty_state_changed.emit() var is_group: bool = false +var change_dirty: bool = true + signal dirty_state_changed ## Sets up the [member search_popup_panel] with an instance of [member ADD_NODE_SCENE] @@ -114,18 +117,20 @@ func _on_scroll_offset_changed(offset: Vector2) -> void: ## Setups all the data from the set [member deck] in this [DeckRendererGraphEdit] func initialize_from_deck() -> void: + change_dirty = false for i in get_children(): i.queue_free() scroll_offset = deck.get_meta("offset", Vector2()) is_group = deck.is_group - dirty = false for node_id in deck.nodes: var node_renderer: DeckNodeRendererGraphNode = NODE_SCENE.instantiate() node_renderer.node = deck.nodes[node_id] add_child(node_renderer) node_renderer.position_offset = node_renderer.node.position_as_vector2() + change_dirty = true + dirty = false refresh_connections()