mirror of
https://codeberg.org/StreamGraph/StreamGraph.git
synced 2024-11-13 19:49:55 +01:00
disallow grouping and removing group i/o nodes
This commit is contained in:
parent
16c6cfb4f9
commit
73422418ba
4 changed files with 17 additions and 2 deletions
|
@ -143,11 +143,14 @@ func is_empty() -> bool:
|
|||
|
||||
|
||||
## Remove a node from this deck.
|
||||
func remove_node(uuid: String, remove_connections: bool = false, keep_group_instances: bool = false) -> void:
|
||||
func remove_node(uuid: String, remove_connections: bool = false, force: bool = false, keep_group_instances: bool = false) -> void:
|
||||
var node := get_node(uuid)
|
||||
if node == null:
|
||||
return
|
||||
|
||||
if !node.user_can_delete && !force:
|
||||
return
|
||||
|
||||
if node.node_type == "group_node" && !keep_group_instances:
|
||||
DeckHolder.close_group_instance(node.group_id, node.group_instance_id)
|
||||
|
||||
|
@ -180,6 +183,12 @@ func group_nodes(nodes_to_group: Array) -> Deck:
|
|||
if nodes_to_group.is_empty():
|
||||
return null
|
||||
|
||||
# don't include nodes that can't be grouped/deleted
|
||||
nodes_to_group = nodes_to_group.filter(
|
||||
func(x: DeckNode):
|
||||
return x.user_can_delete
|
||||
)
|
||||
|
||||
var node_ids_to_keep := nodes_to_group.map(
|
||||
func(x: DeckNode):
|
||||
return x._id
|
||||
|
|
|
@ -41,6 +41,10 @@ var props_to_serialize: Array[StringName]
|
|||
## Only used by renderers.
|
||||
var position: Dictionary = {"x": 0.0, "y": 0.0}
|
||||
|
||||
## If [code]true[/code], the user can delete this node by normal means.
|
||||
## The parent [Deck] can still delete the node by other means.
|
||||
var user_can_delete: bool = true
|
||||
|
||||
enum PortType{
|
||||
INPUT, ## Input port type (slot on the left).
|
||||
OUTPUT, ## Output port type (slot on the right).
|
||||
|
|
|
@ -12,6 +12,7 @@ func _init() -> void:
|
|||
node_type = "group_input"
|
||||
props_to_serialize = [&"output_count"]
|
||||
appears_in_search = false
|
||||
user_can_delete = false
|
||||
|
||||
add_output_port(
|
||||
DeckType.Types.ANY,
|
||||
|
|
|
@ -12,6 +12,7 @@ func _init() -> void:
|
|||
node_type = "group_output"
|
||||
props_to_serialize = [&"input_count"]
|
||||
appears_in_search = false
|
||||
user_can_delete = false
|
||||
|
||||
add_input_port(
|
||||
DeckType.Types.ANY,
|
||||
|
|
Loading…
Reference in a new issue