## DuAEComp

After Effects composition methods

View Source Duik_api_fordoc.jsxinc, line 29146

# Members

#### # static RendererNames

Associative array to get Comp Renderer names from their matchNames

View Source Duik_api_fordoc.jsxinc, line 29151

# 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

View Source Duik_api_fordoc.jsxinc, line 29753

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

View Source Duik_api_fordoc.jsxinc, line 29721

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 Duik_api_fordoc.jsxinc, line 29812

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

View Source Duik_api_fordoc.jsxinc, line 29781

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 Duik_api_fordoc.jsxinc, line 29968

#### # 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 Duik_api_fordoc.jsxinc, line 29955

#### # 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 Duik_api_fordoc.jsxinc, line 29902

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 Duik_api_fordoc.jsxinc, line 29688

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 Duik_api_fordoc.jsxinc, line 29932

#### # 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 Duik_api_fordoc.jsxinc, line 29387

#### # 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 Duik_api_fordoc.jsxinc, line 29163

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

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

Gets the first selected layer in the After Effects current composition

View Source Duik_api_fordoc.jsxinc, line 29376

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 Duik_api_fordoc.jsxinc, line 29406

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 Duik_api_fordoc.jsxinc, line 29639

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 Duik_api_fordoc.jsxinc, line 29623

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 Duik_api_fordoc.jsxinc, line 29600

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 Duik_api_fordoc.jsxinc, line 29577

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

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

Gets the selected layers in the current comp

View Source Duik_api_fordoc.jsxinc, line 29366

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 Duik_api_fordoc.jsxinc, line 29345

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 Duik_api_fordoc.jsxinc, line 29316

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 Duik_api_fordoc.jsxinc, line 29485

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 Duik_api_fordoc.jsxinc, line 29531

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 Duik_api_fordoc.jsxinc, line 29660

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 Duik_api_fordoc.jsxinc, line 29557

#### # 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 Duik_api_fordoc.jsxinc, line 29230

#### # 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 Duik_api_fordoc.jsxinc, line 29260

#### # 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 Duik_api_fordoc.jsxinc, line 29215

#### # 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 Duik_api_fordoc.jsxinc, line 29245

#### # 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 Duik_api_fordoc.jsxinc, line 29192

#### # static selectLayers(layers)

Selects the layers

##### Parameters:

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

View Source Duik_api_fordoc.jsxinc, line 29470

#### # 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 Duik_api_fordoc.jsxinc, line 29276

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 Duik_api_fordoc.jsxinc, line 29291

#### # 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 Duik_api_fordoc.jsxinc, line 29873

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 Duik_api_fordoc.jsxinc, line 29176

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 Duik_api_fordoc.jsxinc, line 29445

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 Duik_api_fordoc.jsxinc, line 29430

#### # 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 Duik_api_fordoc.jsxinc, line 29991