## Duik.Layer

Layers related tools.

View Source DuAEF_Duik_api.jsxinc, line 32230

# Members

Type: `string`

#### # static Type

The types of layers used by Duik

##### Properties:

Name | Type | Description
--- | --- | ---
`NONE` | `string` |
`BONE` | `string` |
`PIN` | `string` |
`CONTROLLER` | `string` |
`CONTROLLER_BG` | `string` |
`ZERO` | `string` |
`IK` | `string` |
`NULL` | `string` |
`LOCATOR` | `string` |
`EFFECTOR` | `string` |
`AUDIO` | `string` |
`MOTION_TRAIL` | `string` |
`CEL` | `string` |
`X_SHEET` | `string` |
`ART` | `string` |

View Source DuAEF_Duik_api.jsxinc, line 32236

# Methods

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

Checks the character name this layer belongs to

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

Returns:
Type: `DuColor`

#### # static copyAttributes(to, from, type)

Copies the attributes from a layer to another layer.

##### Parameters:

Name | Type | Description
--- | --- | ---
`to` | `Layer` | `Array.<Layer>` | `LayerCollection` | `DuList.<Layer>` | The layer to set up
`from` | `Layer` | The source layer
`type` | `Duik.Layer.Type` | The type of the layer to set up

View Source DuAEF_Duik_api.jsxinc, line 32711

#### # static get(type, selectedOnlyopt, compopt, notSelectedOnlyopt) → {Array.<Layer>}

Gets all layers of the specified type

##### Parameters:

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

View Source DuAEF_Duik_api.jsxinc, line 32377

Returns:
The layers of the specified type.
Type: `Array.<Layer>`

#### # static isType(layer, layerType) → {Boolean}

Checks if the layer is one of the types created by duik.

##### Parameters:

Name | Type | Description
--- | --- | ---
`layer` | `Layer` | The layer to check
`layerType` | `Duik.Layer.Type` | The type of layer

View Source DuAEF_Duik_api.jsxinc, line 32272

Returns:
Type: `Boolean`

#### # static isTypePrefix(prefix) → {bool}

Checks if a string is one of the prefixes used to identify layer types in their names

##### Parameters:

Name | Type | Description
--- | --- | ---
`prefix` | `string` | The string to check

View Source DuAEF_Duik_api.jsxinc, line 32259

Returns:
True if the string is one of the predefined prefixes.
Type: `bool`

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

Checks the limb name this layer belongs to

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

Returns:
Type: `DuColor`

#### # static location(layeropt) → {DuOCO.Location}

Checks the location of the 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 32523

Returns:
Type: `DuOCO.Location`

#### # static rename(layer, name, newPrefixopt) → {string}

Renames a layer.

##### Parameters:

Name | Type | Attributes | Description
--- | --- | --- | ---
`layer` | `Layer` |  | The layer to rename
`name` | `string` |  | The new name
`newPrefix` | `string` | <optional> | If provided, will replace the prefix in the new name (or add it if there's no prefix yet)

View Source DuAEF_Duik_api.jsxinc, line 32676

Returns:
The actual new name (a number may be added).
Type: `string`

#### # static sanitizeName(layeropt) → {string}

Sets default name to a layer so it can be correctly managed by Duik, and checks the groups/tags.

##### Parameters:

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

View Source DuAEF_Duik_api.jsxinc, line 32760

Returns:
The new name of the layer
Type: `string`

#### # static select(type, compopt)

Selects all the layers of the given type (and deselects others)

##### Parameters:

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

View Source DuAEF_Duik_api.jsxinc, line 32405

#### # static setAttributes(layer, type, limbNameopt, sideopt, locationopt, characterNameopt)

Sets all the attributes of the layer at once; use this method to prepare a layer which doesn't have a proper Duik name yet.

##### Parameters:

Name | Type | Attributes | Default | Description
--- | --- | --- | --- | ---
`layer` | `Layer` | `Array.<Layer>` | `LayerCollection` | `DuList.<Layer>` |  |  | The layer to set up
`type` | `Duik.Layer.Type` |  |  | The type
`limbName` | `string` | <optional> |  | The name of the limb/layer
`side` | `DuOCO.Side` | <optional> | DuOCO.Side.NONE | The side
`location` | `DuOCO.Location` | <optional> | DuOCO.Location.NONE | The location
`characterName` | `string` | <optional> | "-" | The name of the character

View Source DuAEF_Duik_api.jsxinc, line 32735

#### # static setCharacterName(characterName, layersopt)

Sets the character name of the bone layer

##### Parameters:

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

View Source DuAEF_Duik_api.jsxinc, line 32612

#### # static setLimbName(limbName, layersopt)

Sets the limb name of the bone layer

##### Parameters:

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

View Source DuAEF_Duik_api.jsxinc, line 32652

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

Sets the location of the layer

##### Parameters:

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

View Source DuAEF_Duik_api.jsxinc, line 32541

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

Sets the side of the layer

##### Parameters:

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

View Source DuAEF_Duik_api.jsxinc, line 32485

#### # static setType(type, layersopt)

Sets the type of the layer

##### Parameters:

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

View Source DuAEF_Duik_api.jsxinc, line 32294

#### # static side(layeropt) → {DuOCO.Side}

Checks the side of the layer

##### Parameters:

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

View Source DuAEF_Duik_api.jsxinc, line 32471

Returns:
Type: `DuOCO.Side`

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

Show/hides all the layers of the given type

##### Parameters:

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

View Source DuAEF_Duik_api.jsxinc, line 32422

#### # static type(layeropt) → {Duik.Layer.Type}

Gets the type of the layer

##### Parameters:

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

View Source DuAEF_Duik_api.jsxinc, line 32281

Returns:
The type
Type: `Duik.Layer.Type`

#### # static unlink(layersopt)

Toggles the edit mode on selected layers

##### Parameters:

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

View Source DuAEF_Duik_api.jsxinc, line 32828