Skip to content

FxNode ​

This module provides functions for creating and working with Nodes.

Load ​

lua
FxNode = require "FxNode";

Functions ​

FunctionDescription
Create (NodeType)Creates a new node.
Delete (NodeID)Deletes a node.
Duplicate (NodeID)Duplicates a node.
Get1b (NodeID, NodeProperty)
Get1c (NodeID, NodeProperty)
Get1f (NodeID, NodeProperty)
Get1i (NodeID, NodeProperty)
Get1s (NodeID, NodeProperty)
Get2f (NodeID, NodeProperty)
Get2i (NodeID, NodeProperty)
Get3f (NodeID, NodeProperty)
Get3i (NodeID, NodeProperty)
Return node property values.
GetAncestors (NodeID)Returns the ancestors of a node.
GetChildren (NodeID)Returns the children of a node.
GetDescendants (NodeID)Returns the descendants of a node.
GetParent (NodeID)Returns the parent of a node.
GetSiblings (NodeID)Returns the siblings of a node.
IsSelected (NodeID)Returns the selection state of a node.
IsSelectedAbsolute (NodeID)Returns the absolute selection state of a node.
IsVisible (NodeID)Returns the visible state of a node.
IsVisibleAbsolute (NodeID)Returns the absolute visible state of a node.
Rename (NodeID, NewNodeID)Renames a node.
Select (NodeID, Value)Sets the selection state of a node.
SelectEx (NodeID)Exclusively selects a node.
Set1b (NodeID, NodeProperty, Value)
Set1c (NodeID, NodeProperty, Value)
Set1f (NodeID, NodeProperty, Value)
Set1i (NodeID, NodeProperty, Value)
Set1s (NodeID, NodeProperty, Value)
Set2f (NodeID, NodeProperty, X, Y)
Set2i (NodeID, NodeProperty, X, Y)
Set3f (NodeID, NodeProperty, X, Y, Z)
Set3i (NodeID, NodeProperty, X, Y, Z)
Set node property values.

Create NodeType) ​

This function creates a node of the specified type and returns its ID. The new node is parented to root node of the active asset.

Parameters ​

Returns ​

The NodeID of the new node.

Errors ​

Possible errors include FX_REQUIRED_ASSET_UNAVAILABLE, FX_TYPE_INVALID

Since ​

Version 1.0

Example ​

lua
-- Create a voxel layer
layer = FxNode.Create(11);

Delete (NodeID) ​

This function deletes a node and all of its child nodes.

Parameters ​

  • NodeID: The NodeID to identify the nodes to be deleted

Errors ​

Possible errors include FX_REQUIRED_ASSET_UNAVAILABLE, FX_NODE_NOT_FOUND

Since ​

Version 1.0

Example ​

lua
-- Delete selected nodes
FxNode.Delete("/s");

Duplicate (NodeID) ​

This function duplicates a node and all of its child nodes.

Parameters ​

  • NodeID: The NodeID to identify the nodes to be duplicated

Returns ​

The NodeID of the duplicates

Errors ​

Possible errors include FX_REQUIRED_ASSET_UNAVAILABLE, FX_NODE_NOT_FOUND

Since ​

Version 1.0

Example ​

lua
-- Duplicate layer1
double = FxNode.Duplicate("layer1");

Get1b (NodeID, NodeProperty)
Get1c (NodeID, NodeProperty)
Get1f (NodeID, NodeProperty)
Get1i (NodeID, NodeProperty)
Get1s (NodeID, NodeProperty)
Get2i (NodeID, NodeProperty)
Get2f (NodeID, NodeProperty)
Get3f (NodeID, NodeProperty)
Get3i (NodeID, NodeProperty) ​

These functions return the values of node properties. The value type of a queried property must match the selected get function. For example, if the property is of type int use Get1i.

Parameters ​

Returns ​

Get1b returns 1 value
Get1c returns 1 Color value
Get1s returns 1 value
Getxi returns x values
Getxf returns x values

Errors ​

Possible errors include FX_REQUIRED_ASSET_UNAVAILABLE, FX_NODE_NOT_FOUND, FX_PROPERTY_INVALID

Since ​

Version 1.0

Example ​

lua
x y z = FxNode.Get3i("layer1", "gridsize");

GetAncestors (NodeID) ​

This function returns a list of all ancestors of the given node.

Parameters ​

  • NodeID: The NodeID of the node to query

Returns ​

A NodeID list that contains all ancestors of the given node

Errors ​

Possible errors include FX_REQUIRED_ASSET_UNAVAILABLE, FX_NODE_NOT_FOUND

Since ​

Version 1.0

Example ​

lua
-- get list of layer1's ancestors
list = FxNode.GetAncestors("layer1");

GetChildren (NodeID) ​

This function returns a list of all children of the given node.

Parameters ​

  • NodeID: The NodeID of the node to query

Returns ​

A NodeID list that contains all children of the given node

Errors ​

Possible errors include FX_REQUIRED_ASSET_UNAVAILABLE, FX_NODE_NOT_FOUND

Since ​

Version 1.0

Example ​

lua
-- get list of layer1's children
list = FxNode.GetChildren("layer1");

GetDescendants (NodeID) ​

This function returns a list of all descendants of the given node.

Parameters ​

  • NodeID: The NodeID of the node to query

Returns ​

A NodeID list that contains all descendants of the given node

Errors ​

Possible errors include FX_REQUIRED_ASSET_UNAVAILABLE, FX_NODE_NOT_FOUND

Since ​

Version 1.0

Example ​

lua
-- get list of layer1's descendants
list = FxNode.GetDescendants("layer1");

GetParent (NodeID) ​

This function returns the parent of the specified node.

Parameters ​

  • NodeID: The NodeID of the node to query

Returns ​

The NodeID of the parent of the given node

Errors ​

Possible errors include FX_REQUIRED_ASSET_UNAVAILABLE, FX_NODE_NOT_FOUND

Since ​

Version 1.0

Example ​

lua
-- get parent of layer1
list = FxNode.GetParent("layer1");

GetSiblings (NodeID) ​

This function returns a list of all siblings of the given node.

Parameters ​

  • NodeID: The NodeID of the node to query

Returns ​

A NodeID list that contains all siblings of the given node

Errors ​

Possible errors include FX_REQUIRED_ASSET_UNAVAILABLE, FX_NODE_NOT_FOUND

Since ​

Version 1.0

Example ​

lua
-- get list of layer1's siblings
list = FxNode.GetSiblings("layer1");

IsSelected (NodeID) ​

This function returns the selection state of the specified node.

Parameters ​

  • NodeID: The NodeID of the node to query

Returns ​

The selection state of the given node

Errors ​

Possible errors include FX_REQUIRED_ASSET_UNAVAILABLE, FX_NODE_NOT_FOUND

Since ​

Version 1.0

Example ​

lua
selected = FxNode.IsSelected("layer1");

-- shortcut for:
selected = FxNode.Get1b("layer1", "selected");

IsSelectedAbsolute (NodeID) ​

This function returns whether the specified node or one of its ancestors is selected.

Parameters ​

  • NodeID: The NodeID of the node to query

Returns ​

The absolute selection state of the given node

Errors ​

Possible errors include FX_REQUIRED_ASSET_UNAVAILABLE, FX_NODE_NOT_FOUND

Since ​

Version 1.0

Example ​

lua
-- is the active node absolute selected
selected = FxNode.IsSelectedAbsolute("*");

IsVisible (NodeID) ​

This function returns the visibility state of the specified node.

Parameters ​

  • NodeID: The NodeID of the node to query

Returns ​

The visibility state of the given node

Errors ​

Possible errors include FX_REQUIRED_ASSET_UNAVAILABLE, FX_NODE_NOT_FOUND

Since ​

Version 1.0

Example ​

lua
visible = FxNode.IsVisible("layer1");

-- shortcut for:
visible = FxNode.Get1b("layer1", "visible");

IsVisibleAbsoluteAbsolute (NodeID) ​

This function returns whether the specified node and all of its ancestors are visible.

Parameters ​

  • NodeID: The NodeID of the node to query

Returns ​

The absolute visibility state of the given node

Errors ​

Possible errors include FX_REQUIRED_ASSET_UNAVAILABLE, FX_NODE_NOT_FOUND

Since ​

Version 1.0

Example ​

lua
-- test whether active node is rendered to the viewport
visible = FxNode.IsVisibleAbsolute("layer1");

Rename (NodeID, NewNodeID) ​

This function changes the ID of the specified node and returns the new ID. The new ID may be different from the requested one if that ID was already in use. If the requested ID contains invalid characters or is empty, a default ID is used.

Parameters ​

  • NodeID: The NodeID to identify the nodes to be renamed
  • NewNodeID: The new NodeID, can't be a wildcard, filter or list

Returns ​

The actual new NodeID

Errors ​

Possible errors include FX_REQUIRED_ASSET_UNAVAILABLE, FX_NODE_NOT_FOUND, FX_VALUE_INVALID

Since ​

Version 1.0

Example ​

lua
// rename all nodes to fox1, fox2, fox3 etc.
val = FxNode.Rename("*", "fox1");

Select (NodeID, Value) ​

This function sets the selection state of the given node.

Parameters ​

  • NodeID: The NodeID to identify the nodes to be selected or deselected
  • Value: The new selection state

Errors ​

Possible errors include FX_REQUIRED_ASSET_UNAVAILABLE, FX_NODE_NOT_FOUND

Since ​

Version 1.0

Example ​

lua
-- deselect all nodes
FxNode.Select("*", false);
-- select layer1
FxNode.Select("layer1", true);

SelectEx (NodeID) ​

This function selects the specified node and deselects all other nodes.

Parameters ​

  • NodeID: The NodeID to identify the nodes to be selected exclusively

Errors ​

Possible errors include FX_REQUIRED_ASSET_UNAVAILABLE, FX_NODE_NOT_FOUND

Since ​

Version 1.0

Example ​

lua
FxNode.SelectEx("*"); -- select all nodes
FxNode.SelectEx("layer1"); -- > only layer1 is selected

Set1b (NodeID, NodeProperty, Value)
Set1c (NodeID, NodeProperty, Value)
Set1f (NodeID, NodeProperty, Value)
Set1i (NodeID, NodeProperty, Value)
Set1s (NodeID, NodeProperty, Value)
Set2i (NodeID, NodeProperty, X, Y)
Set2f (NodeID, NodeProperty, X, Y)
Set3f (NodeID, NodeProperty, X, Y, Z)
Set3i (NodeID, NodeProperty, X, Y, Z) ​

These functions set the values of the specified node properties. The value type of a property must match the selected set function. For example, if the property is of type int use Set1i.

Parameters ​

  • NodeID: The NodeID to identify the nodes to edited
  • NodeProperty: The NodeProperty to change

Value, X, Y, Z : Value(s) to set, type depends on function called

Errors ​

Possible errors include FX_REQUIRED_ASSET_UNAVAILABLE, FX_NODE_NOT_FOUND, FX_PROPERTY_INVALID, FX_VALUE_INVALID

Since ​

Version 1.0

Example ​

lua
FxNode.Set3f("layer1", "scale", 1.0, 0.5, 1.0);