## OCOBone(name)

A bone contained in an OCO Limb.
Constructor

#### # new OCOBone(name)

Creates a new OCO Bone.

##### Parameters:

Name | Type | Description
--- | --- | ---
`name` | `string` | The name

View Source Duik_api_fordoc.jsxinc, line 18309

# Members

Type: `Boolean`

#### # static attached

true if this bone is attached to its parent.

View Source Duik_api_fordoc.jsxinc, line 18339

Type: `Array.<OCOBone>`

#### # static children

The child bones.

View Source Duik_api_fordoc.jsxinc, line 18346

Type: `Array.<OCOLimb>`

#### # static limbs

The child limbs.

View Source Duik_api_fordoc.jsxinc, line 18353

Type: `string`

#### # static name

The name of the bone

View Source Duik_api_fordoc.jsxinc, line 18311

Type: `OCO.Bone`

#### # static type

The type of bone.

View Source Duik_api_fordoc.jsxinc, line 18360

Type: `float`

#### # static x

The x coordinate of the bone

View Source Duik_api_fordoc.jsxinc, line 18318

Type: `float`

#### # static y

The y coordinate of the bone

View Source Duik_api_fordoc.jsxinc, line 18325

Type: `int`

#### # static zIndex

An arbitrary Z-index. Higher is under, lower is above

View Source Duik_api_fordoc.jsxinc, line 18332

#### # envelop

The envelop of the bone,
In a meta rig, this is a silhouette which will contain the design, and can be used to help locate the joint, link the design to the bone, etc.
In a rigged character, this should be a simple silhouette close to the artwork silhouette.

View Source Duik_api_fordoc.jsxinc, line 18373

# Methods

#### # static fromComp(layer, doc) → {OCOBone}

Creates a bone using a layer from a comp

##### Parameters:

Name | Type | Description
--- | --- | ---
`layer` | `Layer` | the layer
`doc` | `OCODoc` | the doc which will be containing the bone. Needed for coordinates.

View Source Duik_api_fordoc.jsxinc, line 38816

Returns:
the bone
Type: `OCOBone`

#### # static fromObject(data) → {OCOBone}

Creates a bone from a js object.

##### Parameters:

Name | Type | Description
--- | --- | ---
`data` | `Object` | The js object representing the bone

View Source Duik_api_fordoc.jsxinc, line 18615

Returns:
The new bone
Type: `OCOBone`

#### # static getBoneId(name, fuzzyopt) → {OCO.Bone}

Gets the internal bone id according to the (localized) given name, using the synonyms dictionnary

##### Parameters:

Name | Type | Attributes | Default | Description
--- | --- | --- | --- | ---
`name` | `string` |  |  | The name to look for
`fuzzy` | `boolean` | <optional> | true | Performs a fuzzy search

View Source Duik_api_fordoc.jsxinc, line 38895

Returns:
The bone id
Type: `OCO.Bone`

#### # static getNameSynonyms(name, fuzzyopt) → {Array.<string>}

Gets the (localized) synonyms of this name

##### Parameters:

Name | Type | Attributes | Default | Description
--- | --- | --- | --- | ---
`name` | `string` |  |  | The name to look for
`fuzzy` | `boolean` | <optional> | true | Performs a fuzzy search

View Source Duik_api_fordoc.jsxinc, line 38847

Returns:
The synonyms. A 'score' property is added to the object to be used in case of fuzzy search.
Type: `Array.<string>`

#### # static zBounds() → {Array.<int>}

Finds the maximum and minimum Z index from all bones

View Source Duik_api_fordoc.jsxinc, line 18588

Returns:
The [min, max] Z indices
Type: `Array.<int>`

#### # getBones() → {Array.<OCOBone>}

Gets all the bones sorted by z index

View Source Duik_api_fordoc.jsxinc, line 18566

Returns:
The list of bones
Type: `Array.<OCOBone>`

#### # getLayers() → {Array.<Layer>}

Gets the After Effects child layers of this bone (including it)

View Source Duik_api_fordoc.jsxinc, line 38798

Returns:
May be an empty array if this bone has not been created in After Effects yet
Type: `Array.<Layer>`

#### # getLimbs() → {Array.<OCOLimb>}

Recursively gets all the children limbs of this bone

View Source Duik_api_fordoc.jsxinc, line 18453

Returns:
The array of all limbs
Type: `Array.<OCOLimb>`

#### # length() → {int}

The length of the bone (this distance with its first child)

View Source Duik_api_fordoc.jsxinc, line 18393

Returns:
The length
Type: `int`

#### # newLimb(limbopt, sideopt, locationopt, typeopt) → {OCOLimb}

Creates a new limb and adds it to the bone

##### Parameters:

Name | Type | Attributes | Default | Description
--- | --- | --- | --- | ---
`limb` | `OCO.Limb` | <optional> | OCO.Limb.CUSTOM | A Predefined limb
`side` | `OCO.Side` | <optional> | OCO.Side.NONE | The side of the limb
`location` | `OCO.Location` | <optional> | OCO.Location.NONE | The location of the limb
`type` | `OCO.LimbType` | <optional> | OCO.LimbType.CUSTOM | The type of the limb

View Source Duik_api_fordoc.jsxinc, line 18408

Returns:
The new limb
Type: `OCOLimb`

#### # normalizeZIndices(offsetopt) → {int}

Normalizes the Z indices of all bones so they're positive (including 0) and continuous integers

##### Parameters:

Name | Type | Attributes | Default | Description
--- | --- | --- | --- | ---
`offset` | `int` | <optional> | 0 | An offset/start number

View Source Duik_api_fordoc.jsxinc, line 18549

Returns:
The highest index
Type: `int`

#### # numBones() → {int}

Counts the total number of child bones

View Source Duik_api_fordoc.jsxinc, line 18419

Returns:
Type: `int`

#### # numLimbs() → {int}

Counts the total number of child limbs

View Source Duik_api_fordoc.jsxinc, line 18437

Returns:
Type: `int`

#### # toComp(doc, limb, compopt, parentLayeropt, limbIdopt, boneIndexopt) → {Array.<Layer>}

Creates the limbs and armatures in the comp

##### Parameters:

Name | Type | Attributes | Default | Description
--- | --- | --- | --- | ---
`doc` | `OCODoc` |  |  | The doc containing the bone.
`limb` | `OCOLimb` |  |  | The limb containing the bone.
`comp` | `CompItem` | <optional> | DuAEProject.getActiveComp() | The composition to use.
`parentLayer` | `Layer` | <optional> | null | The parent layer of the bone.
`limbId` | `int` | <optional> |  | A Unique identifier for this armature. If omitted, a new one will be assigned.
`boneIndex` | `int` | <optional> | 0 | The index of the bone in the chain.

View Source Duik_api_fordoc.jsxinc, line 38675

Returns:
The new layers
Type: `Array.<Layer>`

#### # toObject() → {Object}

Creates a js object containing this bone data.
This object could then be exported to JSON for example.

View Source Duik_api_fordoc.jsxinc, line 18513

Returns:
the JS Object
Type: `Object`

#### # translate(xopt, yopt, translateChildrenopt)

Translates the bone by [x, y] pixels

##### Parameters:

Name | Type | Attributes | Default | Description
--- | --- | --- | --- | ---
`x` | `int` | <optional> | 0 | The horizontal offset
`y` | `int` | <optional> | 0 | The vertical offset
`translateChildren` | `bool` | <optional> | true | If false, the children stay at their current location

View Source Duik_api_fordoc.jsxinc, line 18469

#### # translateTo(xopt, yopt, translateChildrenopt)

Translates the bone to the new coordinates

##### Parameters:

Name | Type | Attributes | Default | Description
--- | --- | --- | --- | ---
`x` | `int` | <optional> |  | The new X value. If omitted, moves the layer vertically
`y` | `int` | <optional> |  | The new Y value. If omitted, moves the layer horizontally
`translateChildren` | `bool` | <optional> | true | If false, the children stay at their current location

View Source Duik_api_fordoc.jsxinc, line 18490