Model - Skeleton
API reference for src/nodeMethods/skeleton on @huukhanhnguyen/model, reachable from ./compute.
See the Guide for the ModelJSON / evaluate pipeline.
API reference
Signatures are generated from the live package .d.ts - not hand-written.
evaluateAnimationChain
function
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).
evaluateAnimationChain(chain: Chain, context?: EvalContext, namespaces?: Record<string, unknown>): { clip: AnimationClip; tracks: Track[]; }evaluateSkeletonChain
function
Fold a skeleton chain's nested joint tree into flat Skeleton (DFS pre-order). Joint name = node key; parent is implied by nesting. Resolved name on the skeleton = the chain's key (single identity).
evaluateSkeletonChain(chain: Chain, context?: EvalContext, namespaces?: Record<string, unknown>): SkeletonevaluateTrackNode
function
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).
evaluateTrackNode(node: (Operation | Container), context?: EvalContext, namespaces?: Record<string, unknown>): Track | nullfaceSkeleton
function
Bind face vertices to a skeleton: nearest bone segments, top-4 influences, falloff mm, weights sum to 1. Deterministic. Applies to every face in the stream (rewrites skin when present). Non-faces pass through.
skeleton is the resolved Skeleton (name = lane key).
faceSkeleton(input: Entity[], skeleton: Skeleton | string, falloff?: number, resolveSkeleton?: (key: string) => Skeleton | undefined): Entity[]jointsToNestedNodes
function
Reconstruct a nested joint-node tree from a flat SkeletonJoint list (parent names). Used by offline migration and GLB import.
jointsToNestedNodes(joints: SkeletonJoint[]): (Operation | Container)[]jointWorldPoses
function
One joint's world-space rest pose, composed down the parent chain: world(J) = world(parent) · rest(J), with rest composed T·R·S.
ponytail: the accumulated pose is kept as a position/rotation/scale triple rather than a 4x4. Composing a non-uniform parent scale through a rotated child produces SHEAR, which a triple cannot hold — the same ceiling every TRS scene graph has (three.js, Unity). Every consumer here reads position only (bone segments for auto-weighting), so the shear never reaches an output; switch to matrices if one ever reads the axes.
jointWorldPoses(skeleton: Skeleton): JointPose[]