## DuAEComp

After Effects composition methods

View Source DuAEF_Duik_api.jsxinc, line 25836

# Members

#### # static RendererNames

Associative array to get Comp Renderer names from their matchNames

View Source DuAEF_Duik_api.jsxinc, line 25841

# Methods

#### # static addAdjustmentLayer(compopt) → {ShapeLayer}

Creates a new "Shape Adjustment Layer" in the comp.

##### Parameters:

Name | Type | Attributes | Default | Description
--- | --- | --- | --- | ---
`comp` | `CompItem` | <optional> | DuAEProject.getActiveComp | The comp where to create the layer

View Source DuAEF_Duik_api.jsxinc, line 26463

Returns:
The adjustment layer
Type: `ShapeLayer`

#### # static addNull(compopt, sizeopt, layeropt) → {ShapeLayer}

Creates a new "Shape Null" 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

View Source DuAEF_Duik_api.jsxinc, line 26411

Returns:
The null layer
Type: `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

View Source DuAEF_Duik_api.jsxinc, line 26518

Returns:
The adjustment layer
Type: `ShapeLayer`

#### # static addSolid(coloropt, compopt) → {ShapeLayer}

Creates a new "Solid Adjustment 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

View Source DuAEF_Duik_api.jsxinc, line 26489

Returns:
The adjustment layer
Type: `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.

View Source DuAEF_Duik_api.jsxinc, line 26674

#### # 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.

View Source DuAEF_Duik_api.jsxinc, line 26661

#### # 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.

View Source DuAEF_Duik_api.jsxinc, line 26608

Returns:
The camera if it was found.
Type: `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

View Source DuAEF_Duik_api.jsxinc, line 26378

Returns:
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.
Type: `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.

View Source DuAEF_Duik_api.jsxinc, line 26638

#### # 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.

View Source DuAEF_Duik_api.jsxinc, line 26077

#### # 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

View Source DuAEF_Duik_api.jsxinc, line 25853

Returns:
The time, in seconds
Type: `float`

#### # static getActiveLayer() → {Layer|null}

Gets the first selected layer in the After Effects current composition

View Source DuAEF_Duik_api.jsxinc, line 26066

Returns:
The layer or null if there's no current comp / no selected layer
Type: `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

View Source DuAEF_Duik_api.jsxinc, line 26096

Returns:
The selected properties, an empty Array if nothing active or selected
Type: `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.

View Source DuAEF_Duik_api.jsxinc, line 26329

Returns:
An array of AVLayer containing the audio layers
Type: `Array.<AVLayer>`

#### # static getParentComps(item) → {Array.<CompItem>}

Recursively gets all compositions where this item is used

##### Parameters:

Name | Type | Description
--- | --- | ---
`item` | `AVItem` | The item

View Source DuAEF_Duik_api.jsxinc, line 26313

Returns:
The compositions
Type: `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

View Source DuAEF_Duik_api.jsxinc, line 26290

Returns:
The precompositions
Type: `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

View Source DuAEF_Duik_api.jsxinc, line 26267

Returns:
The related compositons
Type: `Array.<CompItem>`

#### # static getSelectedLayers() → {Array.<Layer>}

Gets the selected layers in the current comp

View Source DuAEF_Duik_api.jsxinc, line 26056

Returns:
The selected layers
Type: `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.

View Source DuAEF_Duik_api.jsxinc, line 26035

Returns:
The selected property.
Type: `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?

View Source DuAEF_Duik_api.jsxinc, line 26006

Returns:
The selected properties, an empty Array if nothing active or selected
Type: `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

View Source DuAEF_Duik_api.jsxinc, line 26175

Returns:
The unique name, with a new number at the end if needed.
Type: `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

View Source DuAEF_Duik_api.jsxinc, line 26221

Returns:
The unique name, with a new number at the end if needed.
Type: `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

View Source DuAEF_Duik_api.jsxinc, line 26350

Returns:
The number of master properties
Type: `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

View Source DuAEF_Duik_api.jsxinc, line 26247

#### # 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.

View Source DuAEF_Duik_api.jsxinc, line 25920

#### # 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.

View Source DuAEF_Duik_api.jsxinc, line 25950

#### # 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.

View Source DuAEF_Duik_api.jsxinc, line 25905

#### # 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.

View Source DuAEF_Duik_api.jsxinc, line 25935

#### # 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.

View Source DuAEF_Duik_api.jsxinc, line 25882

#### # static selectLayers(layers)

Selects the layers

##### Parameters:

Name | Type | Description
--- | --- | ---
`layers` | `Array.<Layer>` | `DuList.<Layer>` | The layers

View Source DuAEF_Duik_api.jsxinc, line 26160

#### # static setUniqueCompName(comp) → {string}

Makes sure the composition has a unique name, renaming it if needed.

##### Parameters:

Name | Type | Description
--- | --- | ---
`comp` | `CompItem` | The composition

View Source DuAEF_Duik_api.jsxinc, line 25966

Returns:
The new name.
Type: `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

View Source DuAEF_Duik_api.jsxinc, line 25981

#### # 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

View Source DuAEF_Duik_api.jsxinc, line 26579

Returns:
True on success, false otherwise.
Type: `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

View Source DuAEF_Duik_api.jsxinc, line 25866

Returns:
The number of frames, rounded
Type: `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

View Source DuAEF_Duik_api.jsxinc, line 26135

Returns:
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
Type: `Array.<Layer>`

#### # static unselectProperties()

Deselects all properties in the current composition

View Source DuAEF_Duik_api.jsxinc, line 26120

#### # 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

View Source DuAEF_Duik_api.jsxinc, line 26697