## Duik.Controller

Controller related tools.

View Source DuAEF_Duik_api.jsxinc, line 36781

# Members

Type: `Boolean`

#### # static draft

When set to true, controllers will be displayed in draft mode

View Source DuAEF_Duik_api.jsxinc, line 36850

Type: `File`

#### # static readonly PseudoEffect

The pre-rigged pseudo effects

##### Properties:

Name | Type | Description
--- | --- | ---
`EYES` | `File` |
`FINGERS` | `File` |
`HAND` | `File` |
`HEAD` | `File` |

View Source DuAEF_Duik_api.jsxinc, line 36838

Type: `int`

#### # static readonly Type

The shapes/type/icon of the controllers

##### Properties:

Name | Type | Description
--- | --- | ---
`ROTATION` | `int` |
`X_POSITION` | `int` |
`Y_POSITION` | `int` |
`POSITION` | `int` |
`TRANSFORM` | `int` |
`SLIDER` | `int` |
`DOUBLE_SLIDER` | `int` |
`ANGLE` | `int` |
`CAMERA` | `int` |
`HEAD` | `int` |
`HAND` | `int` |
`FOOT` | `int` |
`CLAWS` | `int` |
`HOOF` | `int` |
`EYE` | `int` |
`EYES` | `int` |
`FACE` | `int` |
`SQUARE` | `int` |
`HIPS` | `int` |
`BODY` | `int` |
`SHOULDERS` | `int` |
`TAIL` | `int` |
`PENIS` | `int` |
`VULVA` | `int` |
`WALK_CYCLE` | `int` |
`BLENDER` | `int` |
`NULL` | `int` |
`CONNECTOR` | `int` |
`EXPOSE_TRANSFORM` | `int` |
`EAR` | `int` |
`HAIR` | `int` |
`MOUTH` | `int` |
`NOSE` | `int` |
`EYEBROW` | `int` |
`PONEYTAIL` | `int` |
`PINCER` | `int` |
`WING` | `int` |
`FIN` | `int` |
`AUDIO` | `int` |
`VERTEBRAE` | `int` |
`TORSO` | `int` |

View Source DuAEF_Duik_api.jsxinc, line 36788

# Methods

#### # static bake(layersopt)

Bakes the appearance of the selected controllers to improve performance by removing appearance-only expressions and effects.

##### Parameters:

Name | Type | Attributes | Description
--- | --- | --- | ---
`layers` | `Array.<Layer>` | `DuList.<Layer>` | `Layer` | <optional> | The layers to bake; will use selected layers from the current comp if omitted.

View Source DuAEF_Duik_api.jsxinc, line 38838

#### # static color(layeropt) → {DuColor}

Checks the color of the controller layer

##### Parameters:

Name | Type | Attributes | Default | Description
--- | --- | --- | --- | ---
`layer` | `Layer` | <optional> | DuAEComp.getActiveLayer | The layer. If omitted, will check the first selected bone of the current comp

View Source DuAEF_Duik_api.jsxinc, line 39154

Returns:
Type: `DuColor`

#### # static controlledComp(layeropt) → {int}

Gets the îd of the comp controlled by this extracted controller layer.

##### Parameters:

Name | Type | Attributes | Default | Description
--- | --- | --- | --- | ---
`layer` | `Layer` | <optional> | DuAEComp.getActiveLayer | The layer. If omitted, will check the first selected bone of the current comp

View Source DuAEF_Duik_api.jsxinc, line 39396

Returns:
Type: `int`

#### # static create(compopt, typeopt, layeropt, parentopt) → {ShapeLayer|null}

Creates a new controller

##### Parameters:

Name | Type | Attributes | Default | Description
--- | --- | --- | --- | ---
`comp` | `CompItem` | <optional> |  | The composition
`type` | `Duik.Controller.Type` | <optional> | Duik.Controller.Type.TRANSFORM | The type of Controller.
`layer` | `Layer` | `Array.<Layer>` | `LayerCollection` | <optional> |  | The layer(s) where to create the controller. If several layers are provided, will create the controller at the average center of their world positions.
`parent` | `boolean` | <optional> | false | True to automatically parent the layer(s) to the controller

View Source DuAEF_Duik_api.jsxinc, line 36943

Returns:
The controller or null if it couldn't be created.
Type: `ShapeLayer` | `null`

#### # static extract(preComposition, useEssentialPropertiesopt, bakeopt) → {int}

Extracts the controllers from the precomposition,< br/> and copies them to the composition, linking all precomposed controllers
to the new ones.
WARNING This method uses the native copy and paste commands of After Effects,
DO NOT enclose it in an undoGroup.
Undo groups will be handled by this method itself.

##### Parameters:

Name | Type | Attributes | Default | Description
--- | --- | --- | --- | ---
`preComposition` | `AVLayer` |  |  | The precomposition layer
`useEssentialProperties` | `boolean` | <optional> | true | Only in Ae v15.1 (CC2018) and up, true to use Master Properties instead of expressions to link the controllers. Ignored on previous versions of After Effects.
`bake` | `boolean` | <optional> | true | Bakes the appearances of the controllers before extracting them. Note: this fixes some issues when extracting controllers between compositions of different sizes.

View Source DuAEF_Duik_api.jsxinc, line 38910

Returns:
Error code:
-3: No controllers found in the precomp
-2: The layer is not a precomposition
-1: Some controllers can not be extracted
0: Unknown error
1: OK
Type: `int`

#### # static fromLayers(typeopt, parentopt, singleopt) → {Array.<ShapeLayer>}

Creates an controller in the current comp on selected layers.

##### Parameters:

Name | Type | Attributes | Default | Description
--- | --- | --- | --- | ---
`type` | `Duik.Controller.Type` | <optional> | Duik.Controller.Type.TRANSFORM | The type of the controller.
`parent` | `boolean` | <optional> | false | Whether to parent the selected layers to the controllers or not.
`single` | `boolean` | <optional> | false | Whether to create a single controller for all the layers or not.

View Source DuAEF_Duik_api.jsxinc, line 36885

Returns:
The new controllers.
Type: `Array.<ShapeLayer>`

#### # static get(selectedOnlyopt, compopt) → {Array.<ShapeLayer>}

Gets the controllers in the comp

##### Parameters:

Name | Type | Attributes | Default | Description
--- | --- | --- | --- | ---
`selectedOnly` | `Boolean` | <optional> | true | Whether to get only the selected layers or all of them
`comp` | `CompItem` | <optional> | DuAEProject.getActiveComp() | The comp

View Source DuAEF_Duik_api.jsxinc, line 36929

Returns:
The controllers
Type: `Array.<ShapeLayer>`

#### # static getCreate(layer, typeopt, controllersopt) → {Layer}

Gets an existing controller if there is one at the correct location, or creates a new one.

##### Parameters:

Name | Type | Attributes | Default | Description
--- | --- | --- | --- | ---
`layer` | `Layer` |  |  | The layer where to create the controller.
`type` | `Duik.Controller.Type` | <optional> | Duik.Controller.Type.TRANSFORM | The type of Controller.
`controllers` | `Array.<Layer>` | `DuList.<Layer>` | <optional> |  | A list of existing controllers. If omitted, will get all the controllers of the comp.

View Source DuAEF_Duik_api.jsxinc, line 38778

Returns:
The controller
Type: `Layer`

#### # static id(layeropt) → {int}

Gets the unique ID of the controller layer.

##### Parameters:

Name | Type | Attributes | Default | Description
--- | --- | --- | --- | ---
`layer` | `Layer` | <optional> | DuAEComp.getActiveLayer | The layer. If omitted, will check the first selected bone of the current comp

View Source DuAEF_Duik_api.jsxinc, line 39384

Returns:
Type: `int`

#### # static opacity(layeropt) → {DuColor}

Checks the opacity of the controller layer

##### Parameters:

Name | Type | Attributes | Default | Description
--- | --- | --- | --- | ---
`layer` | `Layer` | <optional> | DuAEComp.getActiveLayer | The layer. If omitted, will check the first selected bone of the current comp

View Source DuAEF_Duik_api.jsxinc, line 39243

Returns:
Type: `DuColor`

#### # static pseudoEffect(preset)

Applies a pre-rigged pseudo effect to the layer

##### Parameters:

Name | Type | Description
--- | --- | ---
`preset` | `Duik.Controller.PseudoEffect` | The preset

View Source DuAEF_Duik_api.jsxinc, line 39310

#### # static select(compopt)

Selects all the controllers in the comp (and deselects any other layer)

##### Parameters:

Name | Type | Attributes | Default | Description
--- | --- | --- | --- | ---
`comp` | `CompItem` | <optional> | DuAEProject.getActiveComp() | The comp

View Source DuAEF_Duik_api.jsxinc, line 39285

#### # static setCharacterName(characterName, layeropt)

Sets the character name of the controller layer

##### Parameters:

Name | Type | Attributes | Default | Description
--- | --- | --- | --- | ---
`characterName` | `string` |  |  | The character name.
`layer` | `Layer` | <optional> | DuAEComp.getSelectedLayers() | The layers. If omitted, will use all selected layers in the comp

View Source DuAEF_Duik_api.jsxinc, line 39340

#### # static setColor(coloropt, layersopt) → {DuColor}

Sets the color of the controller layers

##### Parameters:

Name | Type | Attributes | Default | Description
--- | --- | --- | --- | ---
`color` | `DuColor` | `null` | <optional> |  | The color. If omitted or null, will assign a random color for each bone.
`layers` | `Layer` | `LayerCollection` | `Array.<Layer>` | `DuList.<Layer>` | <optional> | DuAEComp.getSelectedLayers() | The layer(s). If omitted, will use all selected layers in the comp

View Source DuAEF_Duik_api.jsxinc, line 39173

Returns:
Type: `DuColor`

#### # static setLimbName(limbName, layeropt)

Sets the limb name of the controller layer

##### Parameters:

Name | Type | Attributes | Default | Description
--- | --- | --- | --- | ---
`limbName` | `string` |  |  | The limb name.
`layer` | `Layer` | <optional> | DuAEComp.getSelectedLayers() | The layers. If omitted, will use all selected layers in the comp

View Source DuAEF_Duik_api.jsxinc, line 39351

#### # static setLocation(side, layersopt)

Sets the location of the layer

##### Parameters:

Name | Type | Attributes | Default | Description
--- | --- | --- | --- | ---
`side` | `DuOCO.Side` |  |  | The side
`layers` | `Array.<Layer>` | <optional> | DuAEComp.getSelectedLayers() | The layers. If omitted, will use all selected layers in the comp

View Source DuAEF_Duik_api.jsxinc, line 39373

#### # static setOpacity(opacity, layersopt) → {DuColor}

Sets the opacity of the controller layers

##### Parameters:

Name | Type | Attributes | Default | Description
--- | --- | --- | --- | ---
`opacity` | `float` |  |  | The size
`layers` | `Layer` | `LayerCollection` | `Array.<Layer>` | `DuList.<Layer>` | <optional> | DuAEComp.getSelectedLayers() | The layer(s). If omitted, will use all selected layers in the comp

View Source DuAEF_Duik_api.jsxinc, line 39262

Returns:
Type: `DuColor`

#### # static setSide(side, layersopt)

Sets the side of the layer

##### Parameters:

Name | Type | Attributes | Default | Description
--- | --- | --- | --- | ---
`side` | `DuOCO.Side` |  |  | The side
`layers` | `Array.<Layer>` | <optional> | DuAEComp.getSelectedLayers() | The layer. If omitted, will use all selected layers in the comp

View Source DuAEF_Duik_api.jsxinc, line 39362

#### # static setSize(size, layersopt) → {DuColor}

Sets the size of the controller layers

##### Parameters:

Name | Type | Attributes | Default | Description
--- | --- | --- | --- | ---
`size` | `float` |  |  | The size
`layers` | `Layer` | `LayerCollection` | `Array.<Layer>` | `DuList.<Layer>` | <optional> | DuAEComp.getSelectedLayers() | The layer(s). If omitted, will use all selected layers in the comp

View Source DuAEF_Duik_api.jsxinc, line 39220

Returns:
Type: `DuColor`

#### # static size(layeropt) → {DuColor}

Checks the size of the controller layer

##### Parameters:

Name | Type | Attributes | Default | Description
--- | --- | --- | --- | ---
`layer` | `Layer` | <optional> | DuAEComp.getActiveLayer | The layer. If omitted, will check the first selected bone of the current comp

View Source DuAEF_Duik_api.jsxinc, line 39199

Returns:
Type: `DuColor`

#### # static tag(layersopt)

Sets the type of the layers to Controller

##### Parameters:

Name | Type | Attributes | Description
--- | --- | --- | ---
`layers` | `Array.<Layer>` | `LayerCollection` | `DuList.<Layer>` | `Layer` | <optional> | The layer. If omitted, will use all selected layers in the active comp

View Source DuAEF_Duik_api.jsxinc, line 39330

#### # static toggleVisibility(compopt, notSelectedOnlyopt)

Show/hides all the controllers

##### Parameters:

Name | Type | Attributes | Default | Description
--- | --- | --- | --- | ---
`comp` | `CompItem` | <optional> | DuAEProject.getActiveComp() | The comp
`notSelectedOnly` | `bool` | <optional> | false | Hides only the controllers which are not selected

View Source DuAEF_Duik_api.jsxinc, line 39296