Constructor
# new OCOBone(name)
Creates a new OCO Bone.
Parameters:
Name | Type | Description |
---|---|---|
name |
string
|
The name |
Members
Object
# 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.
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.
Methods
# static fromObject(data) → {OCOBone}
Creates a bone from a js object.
Parameters:
Name | Type | Description |
---|---|---|
data |
Object
|
The js object representing the bone |
The new bone
# static zBounds() → {Array.<int>}
Finds the maximum and minimum Z index from all bones
The [min, max] Z indices
Array.<int>
# getBones() → {Array.<OCOBone>}
Gets all the bones sorted by z index
The list of bones
Array.<OCOBone>
# getLimbs() → {Array.<OCOLimb>}
Recursively gets all the children limbs of this bone
The array of all limbs
Array.<OCOLimb>
# 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 |
The new limb
# 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 |
The highest index
int
# toObject() → {Object}
Creates a js object containing this bone data.
This object could then be exported to JSON for example.
This object could then be exported to JSON for example.
the JS Object
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 |
# 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 |