Function to add a layer in the specified destination layer. The layer to be added and the destination layer are both determined by their Layer objects. You can use getLayer or findLayers to determine the layer to be added. For example,
this.parent defines the parent layer of the script module as destination layer. The layer to be added is determined by its Layer object. The new layer will be added behind the existing layers. To insert a layer at a specific position in a containerthe destination layer, use insertLayer or insertLayerAsync instead.
An Element object can only have one parent. It cannot be child of multiple parents. Therefore, an Element object that you retrieved from the running plug-in instance must be removed before it can be inserted again. The Element objects you retrieve through loadPreset or loadPresetAsync can be inserted freely, because these functions create a copy of the Element objects when reading them.
Available in: Controller.
|layer||The Layer object of the layer that you want to append.||Layer|
To explore the following script:
- Download Program.vstpreset.
- Drag the preset on the MediaBay to import it to the user folder for VST presets.
- Create an empty program and add a script module.
- Paste the script into the text editor of the script module and execute the script.
-- append layer from Program.vstpreset into the current program
-- get the file path for user VST presets
path = getUserPresetPath()
-- load VST preset
loadedProgram = loadPreset(path.."/Program/Program.vstpreset")
-- get the first layer from the loaded program
layer = loadedProgram:getLayer ()
-- append layer
if layer then