Skip to main content

Module clip

Module clip 

Source
Expand description

Unity AnimationClips: the curves of a Mecanim clip (m_MuscleClip) decoded to keys with tangents.

A clip stores its curves in three blocks, numbered in this order: the streamed curves (m_StreamedClip), the dense curves (m_DenseClip, one sample per frame at a fixed rate) and the constant curves (m_ConstantClip, one value each). m_ClipBindingConstant.genericBindings lists what the curves drive, in curve order: a binding takes one curve (a float property), or for a Transform the curves of its attribute, 1 position (3), 2 rotation, a quaternion (4), 3 scale (3), 4 Euler angles (3). A binding names its target by path, the CRC-32 of the path of GameObject names below the Animator’s own (the Animator’s GameObject itself is the empty path, hash 0).

The streamed block is a sequence of frames, each time: f32, count: i32 and count keys of index: i32 and four f32 coefficients; a key opens a cubic segment of its curve that lasts until the curve’s next key: value(dt) = ((c0 dt + c1) dt + c2) dt + c3 for dt seconds after the key, so c3 is the key’s value and c2 its outgoing slope; the incoming slope of the next key is the derivative at the segment’s end. The first frame is at -f32::MAX and gives every curve’s initial value; the last is at +inf with no keys. A segment whose coefficients are not finite is a step.

Structs§

ClipData
An AnimationClip’s curves as stored.
Curve
One scalar curve: keys in increasing time, evaluated as a cubic Hermite spline between them (a dense curve’s slopes are its secants, so it is piecewise linear).
GenericBinding
One curve binding of a clip (genericBindings).
Key
A key of a curve: its time (seconds), value and the slopes (per second) into and out of it. An infinite outgoing slope is a step to the next key.
Track
A binding with the curves it takes, in the order of its attribute’s components.

Enums§

Storage
Where a curve was stored.

Functions§

controller_clips
The clips an AnimatorController lists (m_AnimationClips), in order, null entries left out.
path_hash
The hash a clip’s binding names a path by: the CRC-32 (the zlib one) of the path of GameObject names below the Animator’s GameObject, empty for the GameObject itself.