Layer helpers
| Function | Returns | Description |
|---|---|---|
GetLayerForScene(scene: Scene, name: string) |
Layer |
Returns the named layer within the given scene, or null if the layer does not exist. |
GetLayerByName(sceneName: string, layerName: string) |
Layer |
Looks up a layer by scene name and layer name. Returns null if the scene or layer is missing. |
LayerHasInputNamed(layer: Layer, sourceName: string) |
bool |
Returns true if the layer's current input has the given name. |
GetLayerTransformByName(sceneName: string, layerName: string) |
LayerTransform |
Returns the LayerTransform of the named layer in the named scene, or null if either lookup fails. |
GetLayerOperatorByName(sceneName: string, layerName: string, operatorName: string) |
AbstractOperator or null |
Returns the named operator within the named layer of the named scene, or null if any lookup fails. |
GetOcrText(sceneName: string, layerName: string, operatorName: string) |
string |
The most recently recognized text from an OCR operator, addressed by scene / layer / operator name. Returns an empty string when the operator can't be found. Two OCR operators reading two synchronized inputs' burned-in frame counters report the same value when the inputs are frame-aligned. |
SetLayerSource(layer: Layer, sourceName: string) |
bool |
Assigns a named input as the source of the given layer. Returns false if the layer is null, the source name is empty, or no input matches the name. |
GetLayerTransformByName(scene: Scene, name: string) |
LayerTransform |
Returns the LayerTransform of the named layer within the given scene, or null if the layer is missing. |
ShowLayerByName(sceneName: string, layerName: string) |
bool |
Sets IsVisible to true on the named layer. Returns false if the scene or layer is missing. |
HideLayerByName(sceneName: string, layerName: string) |
bool |
Sets IsVisible to false on the named layer. Returns false if the scene or layer is missing. |
SetLayerOpacityByName(sceneName: string, layerName: string, opacity: int) |
bool |
Sets the opacity of the named layer's LayerTransform. Returns false if the scene or layer is missing. |
SetLayerRotationByName(sceneName: string, layerName: string, rotation: float) |
bool |
Sets the rotation of the named layer's LayerTransform. Returns false if the scene or layer is missing. |
SetLayerPositionXByName(sceneName: string, layerName: string, positionX: float) |
bool |
Sets the X position of the named layer's LayerTransform. Returns false if the scene or layer is missing. |
SetLayerPositionYByName(sceneName: string, layerName: string, positionY: float) |
bool |
Sets the Y position of the named layer's LayerTransform. Returns false if the scene or layer is missing. |
ExecuteOperatorCommand(operatorObject: object, commandPropertyName: string) |
bool |
Executes a Command button on an operator, equivalent to clicking the button in the property panel. operatorObject is the operator instance to act on, typically obtained via GetLayerOperatorByName. commandPropertyName is the case-sensitive property name of the command, as listed on the operator's page under Script Engine Objects — the property name, not the label shown on the button. Returns true if the command was found and executed; otherwise false, including when the object is not an operator, no command with that name exists, or the command is currently disabled. |
ExecuteInteractiveCommand(layer: Layer) |
bool |
Invokes the JS OnClick function configured on the layer's Button input. Returns false (and logs an error) if the layer's input is not a button. |
SetLayerAudioLevelByName(sceneName: string, layerName: string, volume: int) |
bool |
Sets the linear audio gain (left, right, and stereo) on the named layer. Returns false if the scene or layer is missing. |
SetLayerAudioLeveldBByName(sceneName: string, layerName: string, volume: float) |
bool |
Sets the stereo audio gain (in dB) on the named layer. Returns false if the scene or layer is missing. |
SwitchLayerSource(sceneName: string, layerName: string, sourceName: string) |
bool |
Replaces the input of the named layer with the named input. Scene, layer, and input names are all matched case-insensitively. Returns false if the layer or input is missing. |
GetOperatorObject(sceneName: string, layerName: string, operatorName: string) |
AbstractOperator or null or false |
Returns the named operator object on the named layer of the named scene. Returns false (boxed) if the scene or layer is missing; otherwise the operator object, or null if the operator does not exist. |
For multiple changes at once, prefer holding a LayerTransform reference and assigning fields directly:
var t = Project.GetLayerTransformByName("Scene", "Logo");
if (t != null) {
t.PositionX = 0;
t.PositionY = 0;
t.Opacity = 100;
t.Rotation = 0;
}