diff --git a/graph_node_renderer/deck_node_renderer_graph_node.gd b/graph_node_renderer/deck_node_renderer_graph_node.gd index 49ddd69..f985006 100644 --- a/graph_node_renderer/deck_node_renderer_graph_node.gd +++ b/graph_node_renderer/deck_node_renderer_graph_node.gd @@ -10,11 +10,13 @@ class_name DeckNodeRendererGraphNode ## are based off. var node: DeckNode + ## Setups up all the properties based off [member node]. Including looping through ## [method DeckNode.get_all_ports()] and setting up all the descriptors. func _ready() -> void: title = node.name node.position_updated.connect(_on_node_position_updated) + resize_request.connect(_on_resize_request) #node.port_added.connect(_on_node_port_added) #node.port_removed.connect(_on_node_port_removed) node.ports_updated.connect(_on_node_ports_updated) @@ -24,6 +26,9 @@ func _ready() -> void: node.renamed.connect(_on_node_renamed) if node.node_type == "group_node": get_titlebar_hbox().tooltip_text = "Group %s" % node.group_id.left(8) + + size = node.get_meta("size", Vector2()) + ## Connected to [signal GraphElement.position_offset_updated] and updates the ## [member node]s properties @@ -33,6 +38,7 @@ func _on_position_offset_changed() -> void: node.position_updated.emit(node.position) (get_parent() as DeckRendererGraphEdit).dirty = true + ## Connected to [member node]s [signal position_updated] to keep parity with the ## data position. func _on_node_position_updated(new_position: Dictionary) -> void: @@ -43,6 +49,11 @@ func _on_node_position_updated(new_position: Dictionary) -> void: (get_parent() as DeckRendererGraphEdit).dirty = true +func _on_resize_request(new_minsize: Vector2) -> void: + node.set_meta(&"size", new_minsize) + (get_parent() as DeckRendererGraphEdit).dirty = true + + ## Connected to [member node]s [signal port_added] handles setting up the specified ## [member Port.descriptor] with it's required nodes/signals etc. + adding the port ## using [method GraphNode.set_slot] @@ -66,6 +77,7 @@ func _on_node_port_removed(port_idx: int) -> void: get_child(port_idx).queue_free() + ## Connected to [member node]s [signal ports_updated]. Remakes all of the ports ## + their descriptors whenever this is received to allow keeping the Renderers ports up to date. func _on_node_ports_updated() -> void: