After Effects composition methods
Members
# static RendererNames
Associative array to get Comp Renderer names from their matchNames
Methods
# static addAdjustmentLayer(compopt) → {ShapeLayer}
Creates a new "Adjustment Shape Layer" in the comp.
Parameters:
Name | Type | Attributes | Default | Description |
---|---|---|---|---|
comp |
CompItem
|
<optional> |
DuAEProject.getActiveComp | The comp where to create the layer |
The adjustment layer
ShapeLayer
# static addNull(compopt, sizeopt, layeropt) → {ShapeLayer}
Creates a new "Null Shape" in the comp.
Parameters:
Name | Type | Attributes | Default | Description |
---|---|---|---|---|
comp |
CompItem
|
<optional> |
DuAEProject.getActiveComp | The comp where to create the layer |
size |
float
|
<optional> |
100 | The size of the null |
layer |
Layer
|
<optional> |
A layer for the location of the null |
The null layer
ShapeLayer
# static addShape(shapeopt, coloropt, compopt) → {ShapeLayer}
Creates a new Shape Layer in the comp.
Parameters:
Name | Type | Attributes | Default | Description |
---|---|---|---|---|
shape |
DuAEShapeLayer.Primitive
|
<optional> |
DuAEShapeLayer.Primitive.NONE | The shape |
color |
DuColor
|
<optional> |
DuColor.Color.RAINBOX_RED | The color of the shape |
comp |
CompItem
|
<optional> |
DuAEProject.getActiveComp | The comp where to create the layer |
The adjustment layer
ShapeLayer
# static addSolid(coloropt, compopt) → {ShapeLayer}
Creates a new "Solid Shape Layer" in the comp.
Parameters:
Name | Type | Attributes | Default | Description |
---|---|---|---|---|
color |
DuColor
|
<optional> |
DuColor.Color.RAINBOX_RED | The color of the solid |
comp |
CompItem
|
<optional> |
DuAEProject.getActiveComp | The comp where to create the layer |
The adjustment layer
ShapeLayer
# static bake(modeopt, frameStepopt, compopt)
Bakes the expressions to keyframes and removes all non-renderable layers.
Parameters:
Name | Type | Attributes | Default | Description |
---|---|---|---|---|
mode |
DuAEExpression.BakeAlgorithm
|
<optional> |
DuAEExpression.BakeAlgorithm.SMART | The algorithm to use for baking the expressions. |
frameStep |
float
|
<optional> |
1.0 | By default, checks one value per keyframe. A lower value increases the precision and allows for sub-frame sampling. A higher value is faster but less precise. |
comp |
CompItem
|
<optional> |
The composition. The active composition by default. |
# static bakeExpressions(modeopt, frameStepopt, compopt)
Bakes the expressions to keyframes.
Parameters:
Name | Type | Attributes | Default | Description |
---|---|---|---|---|
mode |
DuAEExpression.BakeAlgorithm
|
<optional> |
DuAEExpression.BakeAlgorithm.SMART | The algorithm to use for baking the expressions. |
frameStep |
float
|
<optional> |
1.0 | By default, checks one value per keyframe. A lower value increases the precision and allows for sub-frame sampling. A higher value is faster but less precise. |
comp |
CompItem
|
<optional> |
The composition. The active composition by default. |
# static camera(layersopt) → {CameraLayer|null}
Gets the camera in the comp, in the given layers if possible.
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
layers |
Array.<Layer>
|
DuList.<Layer>
|
<optional> |
Some layers to find the camera first. Selected layers if omitted. |
The camera if it was found.
CameraLayer
|
null
# static checkLayerNames(compopt) → {Object}
Checks if all layers have a different name.
Parameters:
Name | Type | Attributes | Default | Description |
---|---|---|---|---|
comp |
CompItem
|
<optional> |
DuAEProject.getActiveComp | The comp to check |
The list of names used several times. Check the length attribute to know how many duplicates were found, loop through the keys to get the names. Eech key is an array containing the list of layers with that name.
Object
Example
var dupes = DuAEComp.checkLayerNames();
if (dupes.length != 0) {
for (name in dupes)
{
if (dupes.hasOwnProperty(name)) alert(dupes[name]); //dupes[name] is an array of Layer
}
}
# static crop(bounds, compopt)
Crops a composition
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
bounds |
Array.<float>
|
The bounds [top, left, width, height] | |
comp |
CompItem
|
<optional> |
The composition. The active composition by default. |
# static doLayers(method, compopt, reverseopt)
Runs a function on all the layers
Parameters:
Name | Type | Attributes | Default | Description |
---|---|---|---|---|
method |
function
|
The function to run on the layers, which takes a layer as its only argument. | ||
comp |
CompItem
|
<optional> |
The comp containing the layers. Will use the current comp if not provided. | |
reverse |
Bool
|
<optional> |
false | Set this to true to iterate from the end. |
# static framesToTime(frames, compopt) → {float}
Converts the number of frames to the time in seconds
Parameters:
Name | Type | Attributes | Default | Description |
---|---|---|---|---|
frames |
int
|
The frames | ||
comp |
CompItem
|
<optional> |
DuAEProject.getActiveComp | The comp |
The time, in seconds
float
# static getActiveLayer() → {Layer|null}
Gets the first selected layer in the After Effects current composition
The layer or null if there's no current comp / no selected layer
Layer
|
null
# static getAnimatedProps(filteropt, strictopt, caseSensitiveopt, selectedLayersOnlyopt, compopt) → {Array.<DuAEProperty>}
Gets the After Effects animated (with keyframes) properties in the current comp
Parameters:
Name | Type | Attributes | Default | Description |
---|---|---|---|---|
filter |
PropertyType
|
PropertyValueType
|
string
|
function
|
<optional> |
A filter to get only a certain type, or value type, or property name or matchName. A function which take one PropertyBase as argument can be used to filter the properties: the Property will be returned if the function returns true. |
|
strict |
boolean
|
<optional> |
false | If a string filter is provided, whether to search for the exact name/matchName or if it contains the filter. |
caseSensitive |
boolean
|
<optional> |
true | If a string filter is provided, and not strict is false, does the search have to be case sensitive? |
selectedLayersOnly |
boolean
|
<optional> |
false | True to get the properties on the selected layers only |
comp |
CompItem
|
<optional> |
DuAEProject.getActiveComp | The composition |
The selected properties, an empty Array if nothing active or selected
Array.<DuAEProperty>
# static getAudioLayers(comp, audioActiveOnlyopt) → {Array.<AVLayer>}
Gets all the layers with audio in the composition
Parameters:
Name | Type | Attributes | Default | Description |
---|---|---|---|---|
comp |
CompItem
|
The composition where the audio will be searched | ||
audioActiveOnly |
bool
|
<optional> |
false | If true, does not get muted layers. |
An array of AVLayer containing the audio layers
Array.<AVLayer>
# static getParentComps(item) → {Array.<CompItem>}
Recursively gets all compositions where this item is used
Parameters:
Name | Type | Description |
---|---|---|
item |
AVItem
|
The item |
The compositions
Array.<CompItem>
# static getPrecomps(compopt, recursiveopt) → {DuList.<CompItem>}
Gets all the precomposition found in the comp.
Parameters:
Name | Type | Attributes | Default | Description |
---|---|---|---|---|
comp |
CompItem
|
<optional> |
The composition. The active composition if ommitted. | |
recursive |
bool
|
<optional> |
false | True to get nested compositions |
The precompositions
DuList.<CompItem>
# static getRelatives(compopt, recursiveopt) → {Array.<CompItem>}
Gets all precomps and parent comps of the composition
Parameters:
Name | Type | Attributes | Default | Description |
---|---|---|---|---|
comp |
CompItem
|
<optional> |
DuAEProject.getActiveComp() | The composition |
recursive |
bool
|
<optional> |
false | True to search to more than one level of precomposition |
The related compositons
Array.<CompItem>
# static getSelectedLayers() → {Array.<Layer>}
Gets the selected layers in the current comp
The selected layers
Array.<Layer>
# static getSelectedProperty(compopt) → {DuAEProperty|null}
Gets the first selected property (which is not a group)
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
comp |
CompItem
|
<optional> |
The comnposition. The active composition by default. |
The selected property.
DuAEProperty
|
null
# static getSelectedProps(filteropt, strictopt, caseSensitiveopt) → {Array.<DuAEProperty>}
Gets the After Effects selected properties in the current comp
Parameters:
Name | Type | Attributes | Default | Description |
---|---|---|---|---|
filter |
PropertyType
|
PropertyValueType
|
string
|
function
|
<optional> |
A filter to get only a certain type, or value type, or property name or matchName. A function which take one PropertyBase as argument can be used to filter the properties: the Property will be returned if the function returns true. |
|
strict |
boolean
|
<optional> |
false | If a string filter is provided, whether to search for the exact name/matchName or if it contains the filter. |
caseSensitive |
boolean
|
<optional> |
true | If a string filter is provided, and not strict is false, does the search have to be case sensitive? |
The selected properties, an empty Array if nothing active or selected
Array.<DuAEProperty>
# static newUniqueLayerName(newName, compopt, incrementopt) → {string}
Generates a new unique name for a layer
Parameters:
Name | Type | Attributes | Default | Description |
---|---|---|---|---|
newName |
string
|
The wanted new name | ||
comp |
CompItem
|
<optional> |
The comp | |
increment |
boolean
|
<optional> |
true | true to automatically increment the new name if it already ends with a digit |
The unique name, with a new number at the end if needed.
string
# static newUniqueMarkerName(newName, comp, incrementopt) → {string}
Generates a new unique name for a marker for this comp
Parameters:
Name | Type | Attributes | Default | Description |
---|---|---|---|---|
newName |
string
|
The wanted new name | ||
comp |
CompItem
|
The comp | ||
increment |
boolean
|
<optional> |
true | true to automatically increment the new name if it already ends with a digit |
The unique name, with a new number at the end if needed.
string
# static numMasterProperties(compopt) → {int}
Gets the total number of master properties used on precompositions in the comp.
Parameters:
Name | Type | Attributes | Default | Description |
---|---|---|---|---|
comp |
CompItem
|
<optional> |
DuAEProject.getActiveComp | The composition to check |
The number of master properties
int
# static parentAllOrphans(layer, includeLockedLayersopt)
Links all orphan layers in the comp to a layer
Parameters:
Name | Type | Attributes | Default | Description |
---|---|---|---|---|
layer |
Layer
|
The parent layer | ||
includeLockedLayers |
bool
|
<optional> |
false | True to parent layers even if they are locked |
# static removeCompInExpressions(selectionModeopt)
Replace all
comp("name")
occurences by thisComp
.
Parameters:
Name | Type | Attributes | Default | Description |
---|---|---|---|---|
selectionMode |
DuAE.SelectionMode
|
<optional> |
DuAE.ACTIVE_COMPOSITION | The comp(s)/layers/properties to use. |
# static removeLayerInExpressions(selectionModeopt)
Replace all
comp("name")
occurences by thisComp
.
Parameters:
Name | Type | Attributes | Default | Description |
---|---|---|---|---|
selectionMode |
DuAE.SelectionMode
|
<optional> |
DuAE.ACTIVE_COMPOSITION | The comp(s)/layers/properties to use. |
# static removeThisCompInExpressions(selectionModeopt)
Replace all
thisComp
occurences by comp("name")
.
Parameters:
Name | Type | Attributes | Default | Description |
---|---|---|---|---|
selectionMode |
DuAE.SelectionMode
|
<optional> |
DuAE.ACTIVE_COMPOSITION | The comp(s)/layers/properties to use. |
# static removeThisLayerInExpressions(selectionModeopt)
Replace all
thisLayer
occurences by layer("name")
.
Parameters:
Name | Type | Attributes | Default | Description |
---|---|---|---|---|
selectionMode |
DuAE.SelectionMode
|
<optional> |
DuAE.ACTIVE_COMPOSITION | The comp(s)/layers/properties to use. |
# static replaceInExpressions(oldString, newString, caseSensitiveopt, selectedLayersopt, compopt)
Replaces text in Expressions
Parameters:
Name | Type | Attributes | Default | Description |
---|---|---|---|---|
oldString |
string
|
The string to replace | ||
newString |
string
|
The new string | ||
caseSensitive |
boolean
|
<optional> |
true | Whether the search has to be case sensitive |
selectedLayers |
boolean
|
<optional> |
false | Set to true to cache only selected layers. |
comp |
CompItem
|
<optional> |
DuAEProject.getActiveComp() | The comp with expressions to cache. |
# static selectLayers(layers)
Selects the layers
Parameters:
Name | Type | Description |
---|---|---|
layers |
Array.<Layer>
|
DuList.<Layer>
|
The layers |
# static setUniqueCompName(comp) → {string}
Makes sure the composition has a unique name, renaming it if needed.
Parameters:
Name | Type | Description |
---|---|---|
comp |
CompItem
|
The composition |
The new name.
string
# static setUniqueLayerNames(layersopt, compopt)
Makes sure all layers in the comp have unique names, renaming them if needed.
Parameters:
Name | Type | Attributes | Default | Description |
---|---|---|---|---|
layers |
Array
|
LayerCollection
|
<optional> |
comp.layers | The layers |
comp |
CompItem
|
<optional> |
DuAEProject.getActiveComp | The composition |
# static thumbnail(file, maxResopt, timeopt, compopt) → {Boolean}
Saves a thumbnail of the comp to a PNG file
Parameters:
Name | Type | Attributes | Default | Description |
---|---|---|---|---|
file |
File
|
The file to save the thumbnail | ||
maxRes |
Array.<int>
|
<optional> |
[500,500] | The maximum resolution of the thumbnail, which will be smaller than that, but not exactly this size. |
time |
float
|
<optional> |
The time at which to grab the picture. If omitted, will use the current time. | |
comp |
CompItem
|
<optional> |
DuAEProject.getActiveComp() | The composition |
True on success, false otherwise.
Boolean
# static timeToFrames(timeopt, compopt) → {int}
Converts the time in seconds to the number of frames
Parameters:
Name | Type | Attributes | Default | Description |
---|---|---|---|---|
time |
float
|
<optional> |
comp.time | The time in seconds |
comp |
CompItem
|
<optional> |
DuAEProject.getActiveComp | The comp |
The number of frames, rounded
int
# static unselectLayers(compopt) → {Array.<Layer>}
Deselects all layers in a composition
Parameters:
Name | Type | Attributes | Default | Description |
---|---|---|---|---|
comp |
CompItem
|
<optional> |
app.project.activeItem | The composition |
The previously selected layers.
A custom attribute, Layer.props is added on each layer object which is an array of all previously selected properties as DuAEProperty objects
A custom attribute, Layer.props is added on each layer object which is an array of all previously selected properties as DuAEProperty objects
Array.<Layer>
# static unselectProperties()
Deselects all properties in the current composition
# static updateSettings(settings, updatePrecompsopt, compsopt)
Updates the composition settings
Parameters:
Name | Type | Attributes | Default | Description |
---|---|---|---|---|
settings |
Object
|
The settings to update. | ||
updatePrecomps |
bool
|
<optional> |
true | Set to false to update only the selected/current comp |
comps |
Array.<CompItem>
|
<optional> |
The compositions to update. If omitted, will update either the selected items in the project or the current composition |