The SelectionManager JavaScript class. Access and select the Storyboard visual panel, scene, sequence or layers.
- Note
- In batch mode, the methods of an object of this class are doing nothing.
The following example shows how to print the sequence, scene and panel information.
var selIds = new Array(0);
selIds = selection.getSequenceSelection();
for ( var i = 0; i < selIds.length; ++ i )
System.
println(
" seq " + selIds[i] +
" : " + storybd.nameOfSequence( selIds[i] ) )
selIds = selection.getSceneSelection();
for ( var i = 0; i < selIds.length; ++ i )
System.
println(
" scene " + selIds[i] +
" : " + storybd.nameOfScene( selIds[i] ) );
selIds = selection.getPanelSelection();
for ( var i = 0; i < selIds.length; ++ i )
System.
println(
" panel " + selIds[i] +
" : " + storybd.nameOfPanel( selIds[i] ) );
The following example shows how to use the Layer Selection to get the selected layer's index.
var panelIds = selection.getPanelSelection();
if(panelIds.length < 0)
return;
var currentPanelId = panelIds[0];
var currentLayerIdx = 0;
var selectionLayerIds = selection.getLayerSelection();
if(selectionLayerIds.length > 0)
{
var selectedLayer = selectionLayerIds[0];
var selectedLayerName = selectedLayer.name;
for (var i = 0; i < layerManager.numberOfLayers(currentPanelId); i++)
{
if(layerManager.layerName(currentPanelId, i) == selectedLayerName)
{
currentLayerIdx=i;
break;
}
}
}
var newLayerName = "My_New_Layer";
layerManager.addVectorLayer(currentPanelId, currentLayerIdx, 1, newLayerName);