diff --git a/classes/deck/nodes/group/group_input_node.gd b/classes/deck/nodes/group/group_input_node.gd index 61b3be3..0ad5b6c 100644 --- a/classes/deck/nodes/group/group_input_node.gd +++ b/classes/deck/nodes/group/group_input_node.gd @@ -87,7 +87,7 @@ func _post_deck_load() -> void: var gp := _belonging_to.group_descriptors.get_input_port(port.index_of_type) if gp.is_empty(): continue - port.label = gp.label + port.label = gp.label if not gp.label.is_empty() else "Input %s" % port.index port.descriptor = gp.descriptor port.type = gp.type port.usage_type = gp.usage_type diff --git a/classes/deck/nodes/group/group_node.gd b/classes/deck/nodes/group/group_node.gd index 86ada0d..95fafd5 100644 --- a/classes/deck/nodes/group/group_node.gd +++ b/classes/deck/nodes/group/group_node.gd @@ -14,12 +14,26 @@ var input_node_id: String var output_node_id: String var extra_ports: Array +var extra_port_values: Array: + get: + if extra_port_values.is_empty(): + return get_all_ports().map(func(x: Port): return x.value) + else: + return extra_port_values func _init() -> void: name = "Group" node_type = "group_node" - props_to_serialize = [&"group_id", &"group_instance_id", &"extra_ports", &"input_node_id", &"output_node_id", &"is_library"] + props_to_serialize = [ + &"group_id", + &"group_instance_id", + &"extra_ports", + &"input_node_id", + &"output_node_id", + &"is_library", + &"extra_port_values", + ] appears_in_search = false @@ -60,25 +74,35 @@ func setup_connections() -> void: func recalculate_ports() -> void: + var _values := extra_port_values.duplicate() ports.clear() for output_port: Port in output_node.get_input_ports(): - add_output_port( + var port := add_output_port( output_port.type, output_port.label, output_port.descriptor, output_port.usage_type, ) + if _values.size() - 1 < port.index: + continue + + port.set_value(_values[port.index]) for input_port: Port in input_node.get_output_ports(): - add_input_port( + var port := add_input_port( input_port.type, input_port.label, input_port.descriptor, input_port.usage_type, ) + if _values.size() - 1 < port.index: + continue + + port.set_value(_values[port.index]) extra_ports.clear() + extra_port_values.clear() for port in ports: extra_ports.append(port.port_type) diff --git a/classes/deck/nodes/group/group_output_node.gd b/classes/deck/nodes/group/group_output_node.gd index 7514191..70a019f 100644 --- a/classes/deck/nodes/group/group_output_node.gd +++ b/classes/deck/nodes/group/group_output_node.gd @@ -85,7 +85,7 @@ func _post_deck_load() -> void: var gp := _belonging_to.group_descriptors.get_output_port(port.index_of_type) if gp.is_empty(): continue - port.label = gp.label + port.label = gp.label if not gp.label.is_empty() else "Output %s" % port.index port.descriptor = gp.descriptor port.type = gp.type port.usage_type = gp.usage_type diff --git a/graph_node_renderer/descriptors/descriptor_container.gd b/graph_node_renderer/descriptors/descriptor_container.gd index 8bba55d..67689e7 100644 --- a/graph_node_renderer/descriptors/descriptor_container.gd +++ b/graph_node_renderer/descriptors/descriptor_container.gd @@ -25,7 +25,8 @@ func set_up_from_port(port: Port, node: DeckNode, in_node: bool = true) -> void: func(new_value: Variant): if ignore_signal: return - set_value(new_value) + if new_value != null: + set_value(new_value) ) _setup(port, node) if (port.port_type == DeckNode.PortType.VIRTUAL or port.type == DeckType.Types.ANY) or not in_node: