Class AnimationPlayer
Namespace: ValveResourceFormat.Renderer
Assembly: Renderer.dll
Plays animations on a single skeleton: advances clip time, mixes the weighted clips into a frame and writes that frame's world-space pose. An owns one player per skeleton its model can be animated from.
public class AnimationPlayerInheritance
Constructors
AnimationPlayer(Skeleton, FlexController[], Matrix4x4[], Matrix4x4[])
Initializes a new for the given skeleton and flex controllers. The bind pose and pose buffers are supplied by the owner and may be shared with it.
public AnimationPlayer(Skeleton skeleton, FlexController[] flexControllers, Matrix4x4[] bindPose, Matrix4x4[] pose)Parameters
skeleton Skeleton
The skeleton whose bones define the rig.
flexControllers FlexController[]
The flex controllers used for facial/morph animation.
bindPose Matrix4x4[]
The skeleton's world-space bind pose, one entry per bone.
pose Matrix4x4[]
The pose buffer to write into, one entry per bone.
Properties
ActiveAnimation
Gets the currently active animation, or null if none is set.
public Animation? ActiveAnimation { get; }Property Value
ActiveClipFinished
Gets whether the active animation clip has finished playing (is not looping and has reached the end).
public bool ActiveClipFinished { get; }Property Value
AnimationFrame
Gets the decoded animation frame data for the current tick, or null when no animation is active.
public Frame? AnimationFrame { get; }Property Value
BindPose
Gets the skeleton's world-space bind pose.
public Matrix4x4[] BindPose { get; }Property Value
BoneMaskDefinitions
Bone masks are used by clips to weigh transforms on a per-bone basis.
public Dictionary<string, Half[]> BoneMaskDefinitions { get; }Property Value
Dictionary<string, Half[]>
Clips
Gets the current clips.
public Dictionary<string, AnimationPlayer.Clip> Clips { get; }Property Value
Dictionary<string, AnimationPlayer.Clip>
Frame
Gets or sets the current frame index of the active animation.
public int Frame { get; set; }Property Value
FrameCache
Gets the frame cache used to retrieve and interpolate animation frames.
public AnimationFrameCache FrameCache { get; }Property Value
IsPaused
Gets or sets whether animation playback is paused. Changing the value forces a pose update.
public bool IsPaused { get; set; }Property Value
IsUsingMixer
Gets whether the current animation frame is the result of blending multiple clips together.
public bool IsUsingMixer { get; }Property Value
Pose
Gets the world-space transform of each bone for the current animation frame.
public Matrix4x4[] Pose { get; }Property Value
Skeleton
Gets the skeleton this player animates.
public Skeleton Skeleton { get; }Property Value
Time
Gets or sets the current playback time in seconds.
public float Time { get; set; }Property Value
Methods
ClearClips()
Clears all clips and blend state so a later transition starts from a clean state.
public void ClearClips()GetFrame()
Returns the animation frame for the current time, using exact frame lookup when paused or interpolation during playback.
public Frame? GetFrame()Returns
The current animation frame, or null if no animation is active.
RegisterBoneMask(string, Dictionary<string, float>)
Registers a bone mask for per-bone transform weighting.
public void RegisterBoneMask(string name, Dictionary<string, float> boneWeights)Parameters
name string
The name of the bone mask.
boneWeights Dictionary<string, float>
Dictionary mapping bone names to weight values (0.0 to 1.0).
SetAnimation(Animation?, float, bool)
Sets the active animation with a blend-in time for smooth transitions.
public void SetAnimation(Animation? animation, float blendTime, bool looping)Parameters
animation Animation?
The animation to activate, or null to clear.
blendTime float
The time in seconds to blend from previous animations to the new animation.
looping bool
Whether the clip should loop when reaching the end.
SetAnimationProperties(string, float?, bool?, string?)
Sets properties for a clip with the specified animation name.
public void SetAnimationProperties(string name, float? time = null, bool? looping = null, string? boneMask = null)Parameters
name string
The name of the animation.
time float?
Optional playback time to set.
looping bool?
Optional looping flag to set.
boneMask string?
Optional bone mask name to set.
SetAnimationWeight(string, float, bool)
Sets the blend weight for a clip with the specified animation name.
public void SetAnimationWeight(string name, float weight, bool restartIfNew = false)Parameters
name string
The name of the animation.
weight float
The weight value (0.0 to 1.0).
restartIfNew bool
Whether to restart the animation if it's just now fading in.
Update(float, Matrix4x4)
Advances the animation by timeStep seconds and writes the skeleton's world-space pose under rootTransform.
public bool Update(float timeStep, Matrix4x4 rootTransform)Parameters
timeStep float
Elapsed time in seconds since the last update.
rootTransform Matrix4x4
The transform applied to the skeleton roots.

