mirror of
https://codeberg.org/StreamGraph/StreamGraph.git
synced 2024-11-13 19:49:55 +01:00
patch deck renderer, https://github.com/godotengine/godot/pull/85009 is merged
This commit is contained in:
parent
a3ac776907
commit
14ecc1087a
1 changed files with 7 additions and 9 deletions
|
@ -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
|
||||
)
|
||||
|
|
Loading…
Reference in a new issue