From 14ecc1087aff3c02af087ef77a27c74552973346 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lera=20Elvo=C3=A9?= Date: Mon, 27 Nov 2023 00:39:53 +0300 Subject: [PATCH] patch deck renderer, https://github.com/godotengine/godot/pull/85009 is merged --- graph_node_renderer/deck_renderer_graph_edit.gd | 16 +++++++--------- 1 file changed, 7 insertions(+), 9 deletions(-) diff --git a/graph_node_renderer/deck_renderer_graph_edit.gd b/graph_node_renderer/deck_renderer_graph_edit.gd index d24332e..1b900b8 100644 --- a/graph_node_renderer/deck_renderer_graph_edit.gd +++ b/graph_node_renderer/deck_renderer_graph_edit.gd @@ -80,7 +80,7 @@ func attempt_disconnect(from_node_name: StringName, from_port: int, to_node_name ## Returns the associated [DeckNodeRendererGraphNode] for the supplied [DeckNode]. ## Or [code]null[/code] if none is found. func get_node_renderer(node: DeckNode) -> DeckNodeRendererGraphNode: - for i: DeckNodeRendererGraphNode in get_children().slice(1): + for i: DeckNodeRendererGraphNode in get_children(): if i.node == node: return i @@ -92,9 +92,7 @@ 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: - # TODO: wait for https://github.com/godotengine/godot/issues/85005 to get merged - # until it is, all calls to GraphEdit#get_children will need to slice off the first element - for i in get_children().slice(1): + for i in get_children(): i.queue_free() scroll_offset = deck.get_meta("offset", Vector2()) @@ -107,7 +105,7 @@ func initialize_from_deck() -> void: for node_id in deck.nodes: var node: DeckNode = deck.nodes[node_id] - var from_node = get_children().slice(1).filter( + var from_node = get_children().filter( func(c: DeckNodeRendererGraphNode): return c.node._id == node_id )[0] @@ -119,7 +117,7 @@ func initialize_from_deck() -> void: func refresh_connections() -> void: for node_id in deck.nodes: var node: DeckNode = deck.nodes[node_id] - var from_node: DeckNodeRendererGraphNode = get_children().slice(1).filter( + var from_node: DeckNodeRendererGraphNode = get_children().filter( func(c: DeckNodeRendererGraphNode): return c.node._id == node_id )[0] @@ -128,7 +126,7 @@ func refresh_connections() -> void: for connection in node.outgoing_connections[from_port]: var to_node_id = connection.keys()[0] var to_node_port = connection.values()[0] - var to_node: DeckNodeRendererGraphNode = get_children().slice(1).filter( + var to_node: DeckNodeRendererGraphNode = get_children().filter( func(c: DeckNodeRendererGraphNode): return c.node._id == to_node_id )[0] @@ -157,7 +155,7 @@ func _on_deck_node_added(node: DeckNode) -> void: ## Connected to [signal Deck.node_added], used to remove the specified ## [DeckNodeRendererGraphNode] and queue_free it. func _on_deck_node_removed(node: DeckNode) -> void: - for renderer: DeckNodeRendererGraphNode in get_children().slice(1): + for renderer: DeckNodeRendererGraphNode in get_children(): if renderer.node != node: continue @@ -167,7 +165,7 @@ func _on_deck_node_removed(node: DeckNode) -> void: ## Utility function that gets all [DeckNodeRenderGraphNode]s that are selected ## See [member GraphNode.selected] func get_selected_nodes() -> Array: - return get_children().slice(1).filter( + return get_children().filter( func(x: DeckNodeRendererGraphNode): return x.selected )