Skip to content

FxLayer ​

This module provides functions for the Layers of the active Asset. Layers help manage visibility, selection, and editing of objects.

Load ​

lua
FxLayer = require "FxLayer";

Functions ​

FunctionDescription
GetColor (LayerID)Returns the color of a layer.
GetName (LayerID)Returns the name of a layer.
GetVisible (LayerID)Returns the visibilty of a layer.
SetColor (LayerID, Value)Sets the color of a layer.
SetName (LayerID, Value)Sets the name of a layer.
SetVisible (LayerID, Value)Sets the visibilty of a layer.

GetColor (LayerID) ​

This function returns the color of the specified layer of the active asset.

Parameters ​

  • LayerID: The ID of the Layer.

Returns ​

Errors ​

Possible errors include FX_REQUIRED_FILE_UNAVAILABLE, FX_VALUE_INVALID

Since ​

Version 1.0

Example ​

lua
-- get color of layer0
color = FxLayer.GetColor(0);

GetName (LayerID) ​

This function returns the name of the specified layer of the active asset.

Parameters ​

  • LayerID: The ID of the Layer.

Returns ​

  • Name

Errors ​

Possible errors include FX_REQUIRED_FILE_UNAVAILABLE, FX_VALUE_INVALID

Since ​

Version 1.0

Example ​

lua
-- get name of layer0
name = FxLayer.GetName(0);

GetVisible (LayerID) ​

This function returns the visible state of the specified layer of the active asset.

Parameters ​

  • LayerID: The ID of the Layer.

Returns ​

  • Visible

Errors ​

Possible errors include FX_REQUIRED_FILE_UNAVAILABLE, FX_VALUE_INVALID

Since ​

Version 1.0

Example ​

lua
-- get visibility of layer0
visible = FxLayer.GetVisible(0);

SetColor (LayerID, Value) ​

This function sets the color of the specified layer of the active asset.

Parameters ​

  • LayerID: The ID of the Layer.

  • Value: The new Color.

Errors ​

Possible errors include FX_REQUIRED_FILE_UNAVAILABLE, FX_VALUE_INVALID

Since ​

Version 1.0

Example ​

lua
-- set color of layer0 to fuchsia
color = FxColor.CreateFromHex("ff00ff");
FxLayer.SetColor(0, color);

SetName (LayerID, Value) ​

This function sets the name of the specified layer of the active asset.

Parameters ​

  • LayerID: The ID of the Layer.

  • Value: The new name.

Errors ​

Possible errors include FX_REQUIRED_FILE_UNAVAILABLE, FX_VALUE_INVALID

Since ​

Version 1.0

Example ​

lua
-- set name of layer0 to "furniture"
FxLayer.SetName(0, "furniture");

SetVisible (LayerID, Value) ​

This function sets the visibility of the specified layer of the active asset.

Parameters ​

  • LayerID: The ID of the Layer.

  • Value: The new visibility.

Errors ​

Possible errors include FX_REQUIRED_FILE_UNAVAILABLE, FX_VALUE_INVALID

Since ​

Version 1.0

Example ​

lua
-- hide layer0
FxLayer.SetVisible(0, false);