Class AnimationController
Namespace: ValveResourceFormat.Renderer
Assembly: Renderer.dll
Manages skeletal animation playback and computes animated bone poses.
public class AnimationController : BaseAnimationControllerInheritance
object ← BaseAnimationController ← AnimationController
Inherited Members
BaseAnimationController.Skeleton, BaseAnimationController.BindPose, BaseAnimationController.InverseBindPose, BaseAnimationController.Pose, BaseAnimationController.Update(float), BaseAnimationController.GetBoneMatricesRecursive(Bone, Matrix4x4, Frame?, Span<Matrix4x4>), BaseAnimationController.GetInverseBindPoseRecursive(Bone, Matrix4x4, Span<Matrix4x4>), BaseAnimationController.GetSkinningMatrices(Span<Matrix4x4>)
Constructors
AnimationController(Skeleton, FlexController[])
Initializes a new for the given skeleton and flex controllers, computing the bind pose and inverse bind pose matrices.
public AnimationController(Skeleton skeleton, FlexController[] flexControllers)Parameters
skeleton Skeleton
The skeleton whose bones define the rig.
flexControllers FlexController[]
The flex controllers used for facial/morph animation.
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
BoneMaskDefinitions
Bone masks be used by clips to weigh transforms on a per-bone basis.
public Dictionary<string, Half[]> BoneMaskDefinitions { get; }Property Value
Dictionary<string, Half[]>
CurrentSubController
The current sub animation controller that is driving animation updates.
public AnimationController.SubController? CurrentSubController { get; }Property Value
AnimationController.SubController?
ExternalSkeletons
Gets the collection of external skeletons registered for sub-animation control, indexed by skeleton name.
public Dictionary<string, AnimationController.SubController> ExternalSkeletons { get; }Property Value
Dictionary<string, AnimationController.SubController>
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
FrametimeMultiplier
Gets or sets the playback speed multiplier applied to the animation timestep.
public float FrametimeMultiplier { get; set; }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
Looping
Gets or sets whether animations should loop when reaching the end.
public bool Looping { get; set; }Property Value
Time
Gets or sets the current playback time in seconds.
public float Time { get; set; }Property Value
Transform
The parent animating transform.
public Matrix4x4 Transform { get; set; }Property Value
TwistConstraints
Gets or sets the tilt-twist skeleton constraints that are applied after animation.
public TiltTwistConstraint[] TwistConstraints { get; set; }Property Value
Methods
ApplyConstraints()
Applies tilt-twist constraints configured in the controller to the current pose.
public void ApplyConstraints()ApplyFirstpersonLegs()
Hides bones from pelvis and up.
public void ApplyFirstpersonLegs()ApplyInverseKinematics()
Applies inverse kinematics to the current pose.
public void ApplyInverseKinematics()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.
PauseLastFrame()
Pauses playback and seeks to the last frame of the active animation.
public void PauseLastFrame()RegisterBoneMask(string, Dictionary<string, float>, string?)
Registers a bone mask for per-bone transform weighting.
public void RegisterBoneMask(string name, Dictionary<string, float> boneWeights, string? skeletonName = null)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).
skeletonName string?
Optional skeleton name to pass to subcontroller.
RegisterExternalSkeleton(string, Skeleton)
Registers an external skeleton for sub-animation control, creating a bone remapping table.
public void RegisterExternalSkeleton(string skeletonName, Skeleton skeleton)Parameters
skeletonName string
The name identifying the external skeleton.
skeleton Skeleton
The external skeleton to register.
RegisterUpdateHandler(Action<Animation?, int>)
Registers a callback invoked each time the animation frame changes, receiving the active animation and frame index.
public void RegisterUpdateHandler(Action<Animation?, int> handler)Parameters
handler Action<Animation?, int>
The callback to invoke on each animation update.
SetAnimation(Animation?)
Sets the active animation, resets playback to frame zero, and clears the frame cache.
public void SetAnimation(Animation? animation)Parameters
animation Animation?
The animation to activate, or null to clear.
SetAnimation(Animation?, float)
Sets the active animation with a blend-in time for smooth transitions.
public void SetAnimation(Animation? animation, float blendTime)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.
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 its just now fading in.
Update(float)
Advances the animation by timeStep seconds and recomputes bone poses.
public override bool Update(float timeStep)Parameters
timeStep float
Elapsed time in seconds since the last update.

