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);