@tool YggdrasilConnectionsService API
Service for loading, creating, updating, and refreshing connections between nodes in YggdrasilTreeView.
Signals
| Name |
|---|
| line_created(line: YggdrasilConnection, from_node_id: int, to_node_id: int) |
| line_disconnected(from_node: YggdrasilNodeButton, to_node: YggdrasilNodeButton) |
| node_connected(from_node: YggdrasilNodeButton, to_node_id: int) |
| node_disconnected(from_node: YggdrasilNodeButton, to_node_id: int) |
Methods
| Type | Name |
|---|---|
| void | load_tree(tree_data: YggdrasilTree) |
| void | create_connection(from_node: YggdrasilNodeButton, to_node: YggdrasilNodeButton) |
| PackedVector2Array | _bezier_points(segments: int, p0: Vector2, p1: Vector2, p2: Vector2) |
| PackedVector2Array | _arc_points(segments: int, center: Vector2, reversed: bool) |
| void | update_connected_lines(node: YggdrasilNodeButton) |
| Vector2 | _get_center_position(node: Control) |
| void | on_node_allocation_changed(node: YggdrasilNodeButton) |
Signal Descriptions
line_created(line: YggdrasilConnection, from_node_id: int, to_node_id: int)
Emitted when a connection line is created.
line_disconnected(from_node: YggdrasilNodeButton, to_node: YggdrasilNodeButton)
Emitted when an existing connection between two nodes is removed.
node_connected(from_node: YggdrasilNodeButton, to_node_id: int)
Emitted when a node is connected to another node.
node_disconnected(from_node: YggdrasilNodeButton, to_node_id: int)
Emitted when a node is disconnected from another node.
Method Descriptions
void load_tree(tree_data: YggdrasilTree)
Loads all stored node connections from
tree_data, instantiates their line nodes, applies line data, adds them to the lines container, updates visibility based on tree reveal state, and emits connection signals.
void create_connection(from_node: YggdrasilNodeButton, to_node: YggdrasilNodeButton)
Creates a connection between
from_nodeandto_node. If the connection already exists, removes it instead and emits disconnection signals.
PackedVector2Array _bezier_points(segments: int, p0: Vector2, p1: Vector2, p2: Vector2)
Returns a sampled quadratic Bézier curve point array between
p0andp2usingp1as the control point.
PackedVector2Array _arc_points(segments: int, center: Vector2, reversed: bool)
Returns a sampled arc point array around
centerusing the specified segment count and direction.
void update_connected_lines(node: YggdrasilNodeButton)
Rebuilds the geometry of all incoming and outgoing lines connected to
node.
Vector2 _get_center_position(node: Control)
Returns the center position of
nodebased on its position and size.
void on_node_allocation_changed(node: YggdrasilNodeButton)
Refreshes the visual state of lines connected to
nodeafter its allocation state changes.