Skip to content

@tool YggdrasilTreeView API

Control for displaying and interacting with a Yggdrasil tree.


Signals

Name
decoration_created(decoration: YggdrasilNode)
node_created(node: YggdrasilNode)
node_allocated(node: YggdrasilNode)
node_deallocated(node: YggdrasilNode)
prefab_created(prefab: YggdrasilPrefab)
line_created(line: YggdrasilConnection, from_node_id: int, to_node_id: int)
tree_version_mismatch(tree: YggdrasilTree, saved_version: int)

Properties

Type Name Default
Control main_container null
Control background_container null
Control decorations_container null
Control lines_container null
Control nodes_container null
YggdrasilCamera camera null
YggdrasilDecorationsService decorations_service null
YggdrasilNodesService nodes_service null
YggdrasilConnectionsService connections_service null
YggdrasilPrefabsService prefabs_service null
YggdrasilAllocationService allocation_service null
PackedScene _tooltip_scene null
YggdrasilTooltip _tooltip null
YggdrasilTree _tree_data null

Methods

Type Name
void load_tree(tree_data: YggdrasilTree, decoration_scene: PackedScene, node_scene: PackedScene, line_scene: PackedScene, tooltip_scene: PackedScene)
Transform2D get_local_space()
Vector2 translate_node_position(node: Control)
Vector2 translate_position(pos: Vector2)
Vector2 get_mouse_position_in_tree()

Signal Descriptions

decoration_created(decoration: YggdrasilNode)

Emitted when a decoration node is created.

node_created(node: YggdrasilNode)

Emitted when a node is created.

node_allocated(node: YggdrasilNode)

Emitted when a node is allocated.

node_deallocated(node: YggdrasilNode)

Emitted when a node is deallocated.

prefab_created(prefab: YggdrasilPrefab)

Emitted when a prefab is created.

line_created(line: YggdrasilConnection, from_node_id: int, to_node_id: int)

Emitted when a connection line is created.

tree_version_mismatch(tree: YggdrasilTree, saved_version: int)

Emitted when the loaded tree state version does not match the tree version.

Property Descriptions

Control main_container = null

Main container for the whole tree view content.

Control background_container = null

Container for background visuals.

Control decorations_container = null

Container for decoration nodes.

Control lines_container = null

Container for connection lines.

Control nodes_container = null

Container for regular nodes.

YggdrasilCamera camera = null

Camera used to navigate the tree view.

YggdrasilDecorationsService decorations_service = null

Service responsible for loading and creating decorations.

YggdrasilNodesService nodes_service = null

Service responsible for loading and creating nodes.

YggdrasilConnectionsService connections_service = null

Service responsible for loading and updating connections.

YggdrasilPrefabsService prefabs_service = null

Service responsible for loading and creating prefabs.

YggdrasilAllocationService allocation_service = null

Service responsible for allocation and refund behavior.

PackedScene _tooltip_scene = null

Scene used to instantiate the tooltip.

YggdrasilTooltip _tooltip = null

Tooltip instance used to inspect hovered nodes.

YggdrasilTree _tree_data = null

Loaded tree data used by this view.

Method Descriptions

void load_tree(tree_data: YggdrasilTree, decoration_scene: PackedScene, node_scene: PackedScene, line_scene: PackedScene, tooltip_scene: PackedScene)

Loads tree_data, stores tooltip_scene, creates internal containers, background, camera, and services, and emits tree_version_mismatch if the saved tree state version differs from the tree version.

Transform2D get_local_space()

Returns the transform that converts from this control space to the tree local space.

Vector2 translate_node_position(node: Control)

Converts a node control position into tree-space coordinates centered on the tree.

Vector2 translate_position(pos: Vector2)

Converts a position into tree-space coordinates centered on the tree.

Vector2 get_mouse_position_in_tree()

Returns the current mouse position in tree-space coordinates.