@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_nameis changed.
description_changed(prefab: YggdrasilPrefab)
Emitted when
descriptionis changed.
icon_changed(prefab: YggdrasilPrefab)
Emitted when
iconis 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
nodeto the prefab node list.
void remove_node(node: YggdrasilNodeButton)
Removes
nodefrom the prefab node list.
void set_node_name(new_name: String)
Sets
node_name, updatesidusingnew_name.to_snake_case(), and emitsname_changed.
void set_description(new_description: String)
Sets
descriptionand emitsdescription_changed.
void set_icon(new_icon: Texture2D)
Sets
iconand emitsicon_changed.
void set_border_normal(new_border: Texture2D)
Sets
border_normaland emitsborder_changed.
void set_border_intermediate(new_border: Texture2D)
Sets
border_intermediateand emitsborder_changed.
void set_border_active(new_border: Texture2D)
Sets
border_activeand emitsborder_changed.
void set_attribute(attribute_id: String, values: Array)
Sets the value array for
attribute_idand emitsattribute_changed.
void remove_attribute(attribute_id: String)
Removes
attribute_idfromattributesand emitsattribute_changedwithremovedset totrue.
void set_attribute_value(attribute_id: String, index: int, value: Variant)
Updates a value at
indexin the attribute array forattribute_idand emitsattribute_changedif the attribute and index are valid.valuemust be of typeintorfloat.