mirror of
https://codeberg.org/StreamGraph/StreamGraph.git
synced 2024-11-13 19:49:55 +01:00
fix recursive grouping
This commit is contained in:
parent
802749704f
commit
330906460e
1 changed files with 5 additions and 4 deletions
|
@ -140,12 +140,12 @@ func is_empty() -> bool:
|
||||||
|
|
||||||
|
|
||||||
## Remove a node from this deck.
|
## Remove a node from this deck.
|
||||||
func remove_node(uuid: String, remove_connections: bool = false) -> void:
|
func remove_node(uuid: String, remove_connections: bool = false, keep_group_instances: bool = false) -> void:
|
||||||
var node := get_node(uuid)
|
var node := get_node(uuid)
|
||||||
if node == null:
|
if node == null:
|
||||||
return
|
return
|
||||||
|
|
||||||
if node.node_type == "group_node":
|
if node.node_type == "group_node" && !keep_group_instances:
|
||||||
DeckHolder.close_group_instance(node.group_id, node.group_instance_id)
|
DeckHolder.close_group_instance(node.group_id, node.group_instance_id)
|
||||||
|
|
||||||
if remove_connections:
|
if remove_connections:
|
||||||
|
@ -185,8 +185,9 @@ func group_nodes(nodes_to_group: Array) -> Deck:
|
||||||
var group := DeckHolder.add_empty_group()
|
var group := DeckHolder.add_empty_group()
|
||||||
|
|
||||||
var midpoint := Vector2()
|
var midpoint := Vector2()
|
||||||
|
var temp := []
|
||||||
for node: DeckNode in nodes_to_group:
|
for node: DeckNode in nodes_to_group:
|
||||||
#if node.node_type == "group_node": # for recursive grouping
|
#if node.node_type == "group_node":
|
||||||
#var _group_id: String = node.group_id
|
#var _group_id: String = node.group_id
|
||||||
#var _group: Deck = groups[_group_id]
|
#var _group: Deck = groups[_group_id]
|
||||||
#groups.erase(_group)
|
#groups.erase(_group)
|
||||||
|
@ -209,7 +210,7 @@ func group_nodes(nodes_to_group: Array) -> Deck:
|
||||||
disconnect_nodes(from_node, node._id, incoming_connections[to_port][from_node], to_port)
|
disconnect_nodes(from_node, node._id, incoming_connections[to_port][from_node], to_port)
|
||||||
|
|
||||||
midpoint += node.position_as_vector2()
|
midpoint += node.position_as_vector2()
|
||||||
remove_node(node._id)
|
remove_node(node._id, false, true)
|
||||||
group.add_node_inst(node, node._id)
|
group.add_node_inst(node, node._id)
|
||||||
|
|
||||||
midpoint /= nodes_to_group.size()
|
midpoint /= nodes_to_group.size()
|
||||||
|
|
Loading…
Reference in a new issue