SelectionManager Class Reference

The SelectionManager JavaScript class. Access and select the Storyboard visual panel, scene, sequence or layers. More...

Public Slots

Getters
StringList getSequenceSelection ()
 Return a list of selected sequences. More...
 
StringList getSceneSelection ()
 Return a list of selected scenes. More...
 
StringList getPanelSelection ()
 Return a list of selected panels. More...
 
QScriptValue getLayerSelection ()
 Get all the selected Layer and return the indexes in order. More...
 
Setters
bool clearSelection ()
 Clear the selection. More...
 
bool selectAll ()
 Select every panels. More...
 
bool setPanelSelection (StringList &panelIds)
 Set Selected Panels. More...
 
bool setSceneSelection (StringList &sceneIds)
 Set Selected Scenes. More...
 
bool setSequenceSelection (StringList &sequenceIds)
 Set Selected Sequences. More...
 
bool setCurrentPanel (String &panelId)
 Set the current panel and moves the play head. More...
 
bool setLayerSelection (QScriptValue selection)
 Select layer(s) on the currently selected Panel. More...
 
bool isSelected (QScriptValue layer)
 Check if the requested Layers are selected. More...
 
bool setVideoTrackSelection (String &trackName)
 Set the currently selected video track. More...
 

Detailed Description

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 selection = new SelectionManager();
var storybd = new StoryboardManager();
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.

// Add a new layer after the first selected layer
var selection = new SelectionManager();
var panelIds = selection.getPanelSelection();
if(panelIds.length < 0)
return;
var layerManager = new LayerManager();
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);

Member Function Documentation

◆ clearSelection

bool SelectionManager::clearSelection ( )
slot

Clear the selection.

◆ getLayerSelection

QScriptValue SelectionManager::getLayerSelection ( )
slot

Get all the selected Layer and return the indexes in order.

Returns
Array of layer objects. A layer object has the following properties: index [int], layerIndex [int] name [String], panelId [String].

◆ getPanelSelection

StringList SelectionManager::getPanelSelection ( )
slot

Return a list of selected panels.

◆ getSceneSelection

StringList SelectionManager::getSceneSelection ( )
slot

Return a list of selected scenes.

◆ getSequenceSelection

StringList SelectionManager::getSequenceSelection ( )
slot

Return a list of selected sequences.

◆ isSelected

bool SelectionManager::isSelected ( QScriptValue  layer)
slot

Check if the requested Layers are selected.

Parameters
layer- Layer object.
Returns
true if the layer object is currently selected.

◆ selectAll

bool SelectionManager::selectAll ( )
slot

Select every panels.

◆ setCurrentPanel

bool SelectionManager::setCurrentPanel ( String &  panelId)
slot

Set the current panel and moves the play head.

Parameters
panelId- Unique id of Panel
Returns
true if the panel is set correctly.

◆ setLayerSelection

bool SelectionManager::setLayerSelection ( QScriptValue  selection)
slot

Select layer(s) on the currently selected Panel.

var selectionManager = new SelectionManager;
var panelSelection = selectionManager.getPanelSelection();
if (panelSelection.length <= 0)
return;
// Select individually each selected layer and set it to the front
var originallySelectedLayers = selectionManager.getLayerSelection();
for (var i = 0; i < originallySelectedLayers.length; i++)
{
selectionManager.clearSelection();
var temporarilySelectedLayers = [];
temporarilySelectedLayers.push(originallySelectedLayers[i]);
selectionManager.setLayerSelection(temporarilySelectedLayers);
// onActionMoveTabToTop() only works when only one layer is selected
Action.perform("onActionMoveTabToTop()");
}
selectionManager.setLayerSelection(originallySelectedLayers);
Parameters
selection- An Array of Layer objects. A Layer object has name [String] and panelId [String] properties
Returns
True if all the layer objects in the selection were selected.

◆ setPanelSelection

bool SelectionManager::setPanelSelection ( StringList &  panelIds)
slot

Set Selected Panels.

Parameters
panelIds- Array of panel Ids.

◆ setSceneSelection

bool SelectionManager::setSceneSelection ( StringList &  sceneIds)
slot

Set Selected Scenes.

Parameters
sceneIds- Array of scene Ids.

◆ setSequenceSelection

bool SelectionManager::setSequenceSelection ( StringList &  sequenceIds)
slot

Set Selected Sequences.

Parameters
sequenceIds- Array of sequence Ids.

◆ setVideoTrackSelection

bool SelectionManager::setVideoTrackSelection ( String &  trackName)
slot

Set the currently selected video track.

Parameters
trackName- The name of the video track to select.
Note
The Panel track name is "TopLayer"
Returns
true if the video track was successfully selected.