Skip to content

@tool YggdrasilPrefab API

Resource that stores shared prefab data for nodes.


Signals

Name
name_changed(prefab: YggdrasilPrefab)
description_changed(prefab: YggdrasilPrefab)
icon_changed(prefab: YggdrasilPrefab)
border_changed(prefab: YggdrasilPrefab)
attribute_changed(prefab: YggdrasilPrefab, attribute_id: String, removed: bool)

Properties

Type Name Default
String reference_id ""
String id ""
String node_name ""
String description ""
NodeType type
Texture2D icon null
Texture2D border_normal null
Texture2D border_intermediate null
Texture2D border_active null
Dictionary[String, Array] attributes {}
Array[YggdrasilNodeButton] nodes []

Methods

Type Name
void add_node(node: YggdrasilNodeButton)
void remove_node(node: YggdrasilNodeButton)
void set_node_name(new_name: String)
void set_description(new_description: String)
void set_icon(new_icon: Texture2D)
void set_border_normal(new_border: Texture2D)
void set_border_intermediate(new_border: Texture2D)
void set_border_active(new_border: Texture2D)
void set_attribute(attribute_id: String, values: Array)
void remove_attribute(attribute_id: String)
void set_attribute_value(attribute_id: String, index: int, value: Variant)

Signal Descriptions

name_changed(prefab: YggdrasilPrefab)

Emitted when node_name is changed.

description_changed(prefab: YggdrasilPrefab)

Emitted when description is changed.

icon_changed(prefab: YggdrasilPrefab)

Emitted when icon is changed.

border_changed(prefab: YggdrasilPrefab)

Emitted when a border texture is changed.

attribute_changed(prefab: YggdrasilPrefab, attribute_id: String, removed: bool)

Emitted when an attribute is added, updated, or removed.

Property Descriptions

String reference_id = ""

If empty then this is a copy, otherwise it is a prefab that shares data with referenced nodes.

String id = ""

TODO

String node_name = ""

TODO

String description = ""

TODO

NodeType type

TODO

Texture2D icon = null

TODO

Texture2D border_normal = null

TODO

Texture2D border_intermediate = null

TODO

Texture2D border_active = null

TODO

Dictionary[String, Array] attributes = {}

Maps attribute ids to arrays of values.

Array[YggdrasilNodeButton] nodes = []

Stores nodes associated with this prefab.

Method Descriptions

void add_node(node: YggdrasilNodeButton)

Adds node to the prefab node list.

void remove_node(node: YggdrasilNodeButton)

Removes node from the prefab node list.

void set_node_name(new_name: String)

Sets node_name, updates id using new_name.to_snake_case(), and emits name_changed.

void set_description(new_description: String)

Sets description and emits description_changed.

void set_icon(new_icon: Texture2D)

Sets icon and emits icon_changed.

void set_border_normal(new_border: Texture2D)

Sets border_normal and emits border_changed.

void set_border_intermediate(new_border: Texture2D)

Sets border_intermediate and emits border_changed.

void set_border_active(new_border: Texture2D)

Sets border_active and emits border_changed.

void set_attribute(attribute_id: String, values: Array)

Sets the value array for attribute_id and emits attribute_changed.

void remove_attribute(attribute_id: String)

Removes attribute_id from attributes and emits attribute_changed with removed set to true.

void set_attribute_value(attribute_id: String, index: int, value: Variant)

Updates a value at index in the attribute array for attribute_id and emits attribute_changed if the attribute and index are valid. value must be of type int or float.