Storyboard Pro
Scripting Interface Documentation
LayerManager Class Reference

The LayerManager JavaScript class. Access the layers of a given panel. More...

Panel Layer Manipulation

int numberOfLayers (String &panelId)
 Return the number of layers in a panel. More...
 
bool addVectorLayer (String &panelId, int targetLayerIdx, bool before, String &suggestedName)
 Add a vector layer. More...
 
bool addBitmapLayer (String &panelId, int targetLayerIdx, bool before, String &suggestedName)
 Add a bitmap layer. More...
 
bool isVectorLayer (String &panelId, int index)
 Return true if a layer is a vector layer. More...
 
bool is3DLayer (String &panelId, int index)
 Return true if a layer is a 3D layer. More...
 
bool isBitmapLayer (String &panelId, int index)
 Return true if a layer is a bitmap. More...
 
bool deleteLayer (String &panelId, int index)
 Delete a given layer. More...
 
bool renameLayer (String &panelId, int index, String &suggestedName)
 Rename a given layer. More...
 
String layerName (String &panelId, int index)
 Return the name of a layer. More...
 
bool importImageAsLayer (String &panelId, String &fullPathAndFileName)
 Import image and creates a new layer at index 0, returns if successful. More...
 
bool setLayerVisible (String &panelId, int index, bool visible)
 Set the visibility flag of the layers of a panel. More...
 
bool layerVisibility (String &panelId, int index)
 Get the visibility flag of the layers of a panel. More...
 
bool setLayerOpacity (String &panelId, int index, double opacity)
 Set a layer's opacity. More...
 
double layerOpacity (String &panelId, int index)
 Get layers opacity value. More...
 
bool setLayerAlignment (String &panelId, int index, String &alignment)
 Set a layer's alignment value. More...
 
String layerAlignment (String &panelId, int index)
 Get a layer's alignment value. More...
 
String getLayerDrawingName (String &panelId, int index, bool fullPath)
 Get the path to a layer's drawing. More...
 
int getLayerElementId (String &panelId, int index)
 Return the element id of the layer. May be useful when using the element and Drawing global objects. More...
 
bool generateMatteLayer (String &panelId, int index, double radius, bool copyStrokes, bool replace)
 Generate a matte layer from the given layer. The matte will be of the current color. More...
 
bool generateMatteLayer (String &panelId, int index, double radius, bool copyStrokes, bool replace, unsigned int red, unsigned int green, unsigned int blue)
 Generate a matte layer of the given layer. The matte will be of the given color. More...
 
bool isShared (QScriptValue layer)
 Look at the the given Layer and return if it is shared. More...
 
QScriptValue mergeLayers (QScriptValue layers, String &newLayerName)
 Merge the given Layers into a single panel. More...
 
bool isEmpty (QScriptValue layer)
 Look at the given layer and return if it is empty or not. A layer is empty if it has no drawing. More...
 

Detailed Description

The LayerManager JavaScript class. Access the layers of a given panel.

var lm = new LayerManager();
var sb = new StoryboardManager();
// get the first panel in the project.
var panelId = sb.panelInProject(0);
// Add 2 blank vector layers and 1 blank bitmap layer. Set the last one to invisible
lm.addVectorLayer( panelId, 0, false, "V-A");
lm.addVectorLayer( panelId, 1, false, "V-B");
lm.addBitmapLayer( panelId, 2, false, "B-A");
lm.setLayerVisible( panelId, 2, false);
// prepend a new layer by importing an image.
lm.importImageAsLayer(panelId, "/fullPath/Image.tga");

Member Function Documentation

◆ addBitmapLayer

bool LayerManager::addBitmapLayer ( String &  panelId,
int  targetLayerIdx,
bool  before,
String &  suggestedName 
)
slot

Add a bitmap layer.

Parameters
panelId- unique id of the panel
targetLayerIdx- index of sibling layer
before- whether new layer is before or after sibling layer
suggestedName- suggested Name

◆ addVectorLayer

bool LayerManager::addVectorLayer ( String &  panelId,
int  targetLayerIdx,
bool  before,
String &  suggestedName 
)
slot

Add a vector layer.

Parameters
panelId- unique id of the panel
targetLayerIdx- index of sibling layer
before- whether new layer is before or after sibling layer
suggestedName- suggested Name

◆ deleteLayer

bool LayerManager::deleteLayer ( String &  panelId,
int  index 
)
slot

Delete a given layer.

Parameters
panelId- uniqueId of the panel
index- index of the layer

◆ generateMatteLayer [1/2]

bool LayerManager::generateMatteLayer ( String &  panelId,
int  index,
double  radius,
bool  copyStrokes,
bool  replace 
)
slot

Generate a matte layer from the given layer. The matte will be of the current color.

Parameters
panelId- unique id of the panel
index- index of the layer
radius- matte radius
copyStrokes- boolean if the strokes should be copied
replace- true to replace the existing layer by one of the same name, false to keep both

◆ generateMatteLayer [2/2]

bool LayerManager::generateMatteLayer ( String &  panelId,
int  index,
double  radius,
bool  copyStrokes,
bool  replace,
unsigned int  red,
unsigned int  green,
unsigned int  blue 
)
slot

Generate a matte layer of the given layer. The matte will be of the given color.

Parameters
panelId- unique id of the panel
index- index of the layer
radius- matte radius
copyStrokes- boolean if strokes should be copied
replace- true to replace the existing layer by one of the same name, false to keep both
red- unsigned int red value (0..255) for custom color, value bigger than 255 will be clamped
green- unsigned int green value (0..255) for custom color, value bigger than 255 will be clamped
blue- unsigned int blue value (0..255) for custom color, value bigger than 255 will be clamped

◆ getLayerDrawingName

String LayerManager::getLayerDrawingName ( String &  panelId,
int  index,
bool  fullPath 
)
slot

Get the path to a layer's drawing.

Parameters
panelId- unique id of the panel
index- index of the layer
fullPath- boolean to determine if the returned path is the full path or the file name

◆ getLayerElementId

int LayerManager::getLayerElementId ( String &  panelId,
int  index 
)
slot

Return the element id of the layer. May be useful when using the element and Drawing global objects.

Parameters
panelId- unique id of the panel
index- index of the layer

◆ importImageAsLayer

bool LayerManager::importImageAsLayer ( String &  panelId,
String &  fullPathAndFileName 
)
slot

Import image and creates a new layer at index 0, returns if successful.

Parameters
panelId- unique id of the panel
fullPathAndFileName- absolute path to image file

◆ is3DLayer

bool LayerManager::is3DLayer ( String &  panelId,
int  index 
)
slot

Return true if a layer is a 3D layer.

Parameters
panelId- unique id of the panel
index- index of the layer

◆ isBitmapLayer

bool LayerManager::isBitmapLayer ( String &  panelId,
int  index 
)
slot

Return true if a layer is a bitmap.

Parameters
panelId- unique id of the panel
index- index of the layer

◆ isEmpty

bool LayerManager::isEmpty ( QScriptValue  layer)
slot

Look at the given layer and return if it is empty or not. A layer is empty if it has no drawing.

Parameters
layer- an object with the name [String] and panelId properties [String].
Returns
True if the layer is empty, false if it isn't.

◆ isShared

bool LayerManager::isShared ( QScriptValue  layer)
slot

Look at the the given Layer and return if it is shared.

Parameters
layera layer is defined by those properties: frame, panelId, name.
Returns
True if the given layer is shared.

◆ isVectorLayer

bool LayerManager::isVectorLayer ( String &  panelId,
int  index 
)
slot

Return true if a layer is a vector layer.

Parameters
panelId- unique id of the panel
index- index of the layer

◆ layerAlignment

String LayerManager::layerAlignment ( String &  panelId,
int  index 
)
slot

Get a layer's alignment value.

Parameters
panelId- unique id of the panel
index- index of the layer

◆ layerName

String LayerManager::layerName ( String &  panelId,
int  index 
)
slot

Return the name of a layer.

Parameters
panelId- unique id of the panel
index- index of the layer

◆ layerOpacity

double LayerManager::layerOpacity ( String &  panelId,
int  index 
)
slot

Get layers opacity value.

Parameters
panelId- unique id of the panel
index- index of the layer

◆ layerVisibility

bool LayerManager::layerVisibility ( String &  panelId,
int  index 
)
slot

Get the visibility flag of the layers of a panel.

Parameters
panelId- unique id of the panel
index- index of the layer

◆ mergeLayers

QScriptValue LayerManager::mergeLayers ( QScriptValue  layers,
String &  newLayerName 
)
slot

Merge the given Layers into a single panel.

Parameters
layers- an array of objects with the name [String] and panelId properties [String].
newLayerName- new name of the layer created from the merge.
Returns
A single layer from the merge.

◆ numberOfLayers

int LayerManager::numberOfLayers ( String &  panelId)
slot

Return the number of layers in a panel.

Parameters
panelId- unique id of the panel

◆ renameLayer

bool LayerManager::renameLayer ( String &  panelId,
int  index,
String &  suggestedName 
)
slot

Rename a given layer.

Parameters
panelId- unique id of the panel
index- index of the layer
suggestedName- suggested name

◆ setLayerAlignment

bool LayerManager::setLayerAlignment ( String &  panelId,
int  index,
String &  alignment 
)
slot

Set a layer's alignment value.

Parameters
panelId- unique id of the panel
index- index of the layer
alignment- value between 0 and 100

◆ setLayerOpacity

bool LayerManager::setLayerOpacity ( String &  panelId,
int  index,
double  opacity 
)
slot

Set a layer's opacity.

Parameters
panelId- unique id of the panel
index- index of the layer
opacity- value between 0 and 100

◆ setLayerVisible

bool LayerManager::setLayerVisible ( String &  panelId,
int  index,
bool  visible 
)
slot

Set the visibility flag of the layers of a panel.

Parameters
panelId- unique id of the panel
index- index of the layer
visible- boolean flag