Skip to content
Shapemetry

@huukhanhnguyen/model / nodeMethods/skeleton

nodeMethods/skeleton

assertInverseBindLength()

assertInverseBindLength(inverseBind, boneCount, label): void

Parameters

inverseBind

number[]

boneCount

number

label

string

Returns

void


boneRestMatrix()

boneRestMatrix(head, tail, roll): number[]

Column-major 4×4 rest matrix of one bone in its parent's space. Origin = head. Y = normalize(tail − head). X/Z from roll about Y.

Parameters

Point

tail

Point

roll

number

Returns

number[]


boneWorldMatrices()

boneWorldMatrices(bones): number[][]

World rest matrices of every bone, parent-before-child via the parent name. Throws if a parent is not in the list.

Parameters

bones

BoneEntity[]

Returns

number[][]


boneWorldSegments()

boneWorldSegments(bones): { head: Point; tail: Point; }[]

World-space head/tail of every bone.

Parameters

bones

BoneEntity[]

Returns

{ head: Point; tail: Point; }[]


evaluateAnimationChain()

evaluateAnimationChain(chain, context?, namespaces?): { clip: AnimationClip; tracks: Track[]; }

Fold every track node in a chain into Track[] plus the AnimationClip that names them (clip name = chain key, membership = the tracks' own keys — by reference, not containment: a track stays independently addressable by key whether or not it is also a clip member).

Parameters

chain

Chain

context?

EvalContext = {}

namespaces?

Record<string, unknown>

Returns

{ clip: AnimationClip; tracks: Track[]; }

clip

clip: AnimationClip

tracks

tracks: Track[]


evaluateTrackNode()

evaluateTrackNode(node, context?, namespaces?): Track | null

Evaluate one track node (formulaTrack or one of the four keyframe methods) into a Track. null for any other method, or a track node missing its own key (unreachable for a validated document — see validate.ts's checkKey).

Parameters

node

Operation | Group

context?

EvalContext = {}

namespaces?

Record<string, unknown>

Returns

Track | null


faceSkeleton()

faceSkeleton(input, key, falloff?, resolveSkeleton?): ObjectData[]

Bind mesh vertices to a skeleton: nearest bone segments, top-4 influences, falloff mm, weights sum to 1. Writes BOTH halves of the bind: each MeshVertex.skin (the 4 influences, which vary per vertex) and the document's MeshData.skin (the skeleton key and the bind pose, which are one fact about the whole mesh). Writing only the per-vertex half leaves a mesh that exports with weights but no skeleton to weigh against — every writer resolves the skeleton by its OBJECT KEY, so an unkeyed bind is a dropped one. A string skeleton is that key; lookup must resolve or this throws. There is no inline form: a skeleton with no key cannot be named by the bind it produces. Non-meshes pass through.

Parameters

input

ObjectData[]

key

string

falloff?

number = 80

resolveSkeleton?

(key) => SkeletonData | undefined

Returns

ObjectData[]


inverseBindOf()

inverseBindOf(bones): number[]

Flat inverse-bind array: 16 × bones.length, invert of each world rest.

Parameters

bones

BoneEntity[]

Returns

number[]


skeleton()

skeleton(bones): SkeletonData

Author one skeleton object. bones is the skin index space — that order is not an implementation detail. The skeleton's identity is the OBJECT KEY, so there is no name inside the data. A parent naming a bone not in the list throws. A zero-length bone throws (no rest basis).

Parameters

bones

unknown

Returns

SkeletonData

Last updated: 📖 3 min readEdit on GitHub