AnimationController
State machine for managing animation transitions and blending Designed to work with AnimatorComponent and AnimationBlender
- Module
- Animation
- Header
#include "Animation/AnimationController.h"- Namespace
Mowo
Constructors
| Signature | Name | Description |
|---|---|---|
AnimationController() = default | AnimationController |
Public functions
| Returns | Name | Description |
|---|---|---|
void | AddState | |
AnimationState* | GetState | |
const AnimationState* | GetState | |
void | SetDefaultState | |
const std::string& | GetDefaultState | |
void | SetBool | |
void | SetFloat | |
void | SetInt | |
void | SetTrigger | |
void | SetTriggerValue | Declare a trigger without firing it (editor/serializer: a trigger the asset lists must survive a round-trip even while unfired). |
bool | GetBool | |
float | GetFloat | |
int | GetInt | |
void | ForceTransition | Force transition to a specific state (ignoring conditions) |
void | AddAnyStateTransition | Any-State transitions (UE/Unity's Any State node): evaluated every frame BEFORE the current state's own transitions, from whatever state is active — hit reacts and deaths authored once instead of on every source state. |
const std::vector<AnimationTransition>& | GetAnyStateTransitions | |
std::vector<AnimationTransition>& | GetAnyStateTransitions | |
UpdateResult | Update | externalSync (optional): a shared group→phase map published by LEADER states of other controllers (one per world, owned by the AnimationSystem, one frame of latency). |
void | SetParameterOwner | A nested machine reads its OWNER's parameters instead of its own — one animator, one set of parameters, and a trigger the parent clears cannot be consumed twice. |
bool | HasSyncGroupMarker | |
AnimMarkerSegment | GetSyncGroupMarker | |
void | ResolveClips | Bind every state's / blend sample's clipName to an index into clips. |
const std::string& | GetCurrentStateName | |
bool | IsBlending | |
float | GetSyncGroupPhase | |
bool | HasSyncGroupPhase | |
void | CopyStateFrom | Copy all state/parameters from another controller (since RefCounted is non-copyable) |
void | Reset | |
const std::vector<AnimationState>& | GetStates | |
std::vector<AnimationState>& | GetStates | |
const std::unordered_map<std::string, bool>& | GetBoolParams | Parameter access for editor/serialization |
const std::unordered_map<std::string, float>& | GetFloatParams | |
const std::unordered_map<std::string, int>& | GetIntParams | |
const std::unordered_map<std::string, bool>& | GetTriggers | |
void | RemoveBool | |
void | RemoveFloat | |
void | RemoveInt | |
void | RemoveTrigger | |
bool | EvaluateCondition | Evaluate a single condition against current parameters |
FAnimGraph& | GetGraph | The pose-composition graph layered over this state machine (empty = the historical state-machine-only path). |
const FAnimGraph& | GetGraph | |
std::unordered_map<std::string, FMirrorTable>& | GetMirrorTables | Mirror tables addressable by the graph's Mirror nodes. |
const std::unordered_map<std::string, FMirrorTable>& | GetMirrorTables | |
std::unordered_map<std::string, FBlendProfile>& | GetBlendProfiles | Blend profiles addressable by name from a transition (per-bone blend windows) and from the graph's LayeredBlend / BlendByFloat / BlendByBool nodes (per-bone weight scaling). |
const std::unordered_map<std::string, FBlendProfile>& | GetBlendProfiles |
Function details
AnimationController
AnimationController() = defaultAddState
void AddState(const AnimationState& state)GetState
AnimationState* GetState(const std::string& name)GetState
const AnimationState* GetState(const std::string& name) constSetDefaultState
void SetDefaultState(const std::string& name)GetDefaultState
const std::string& GetDefaultState() constSetBool
void SetBool(const std::string& name, bool value)SetFloat
void SetFloat(const std::string& name, float value)SetInt
void SetInt(const std::string& name, int value)SetTrigger
void SetTrigger(const std::string& name)SetTriggerValue
void SetTriggerValue(const std::string& name, bool value)Declare a trigger without firing it (editor/serializer: a trigger the asset lists must survive a round-trip even while unfired).
GetBool
bool GetBool(const std::string& name) constGetFloat
float GetFloat(const std::string& name) constGetInt
int GetInt(const std::string& name) constForceTransition
void ForceTransition(const std::string& stateName, float blendDuration = 0.25f)Force transition to a specific state (ignoring conditions)
AddAnyStateTransition
void AddAnyStateTransition(const AnimationTransition& transition)Any-State transitions (UE/Unity's Any State node): evaluated every frame BEFORE the current state's own transitions, from whatever state is active — hit reacts and deaths authored once instead of on every source state. Exit time is ignored (there is no meaningful source clip); conditions and the interruption-priority gate apply unchanged. A transition targeting the already-current state is skipped so it cannot re-fire forever.
GetAnyStateTransitions
const std::vector<AnimationTransition>& GetAnyStateTransitions() constGetAnyStateTransitions
std::vector<AnimationTransition>& GetAnyStateTransitions()Update
UpdateResult Update(float deltaTime, const std::vector<Ref<AnimationClip>>& clips, const std::unordered_map<std::string, float>* externalSync = nullptr, const std::unordered_map<std::string, AnimMarkerSegment>* externalMarkers = nullptr)externalSync (optional): a shared group→phase map published by LEADER states of other controllers (one per world, owned by the AnimationSystem, one frame of latency). A Follower state pins its playback phase to it every frame — crowd members stay foot-synced to the leader instead of drifting after the entry sync. Leader states report their phase back through UpdateResult for the system to publish. Null keeps the historical per-controller entry-sync. externalMarkers (optional): the same shared publication for MARKER sync. When both the leader and the follower carry the named pair the follower pins to the marker; otherwise it falls back to the phase map, which is what every clip without markers keeps doing.
SetParameterOwner
void SetParameterOwner(const AnimationController* owner)A nested machine reads its OWNER's parameters instead of its own — one animator, one set of parameters, and a trigger the parent clears cannot be consumed twice. Set by the parent when it delegates.
HasSyncGroupMarker
bool HasSyncGroupMarker(const std::string& group) constGetSyncGroupMarker
AnimMarkerSegment GetSyncGroupMarker(const std::string& group) constResolveClips
void ResolveClips(const std::vector<Ref<AnimationClip>>& clips)Bind every state's / blend sample's clipName to an index into clips. Names that don't resolve keep their existing (serialized) clipIndex, so legacy index-only assets are unaffected. Also back-fills clipName from a resolved index when the name was empty, so a controller loaded from an old asset carries proper names forward once bound. Update() calls this the first time it sees a non-empty clip list.
GetCurrentStateName
const std::string& GetCurrentStateName() constIsBlending
bool IsBlending() constGetSyncGroupPhase
float GetSyncGroupPhase(const std::string& group) constHasSyncGroupPhase
bool HasSyncGroupPhase(const std::string& group) constCopyStateFrom
void CopyStateFrom(const AnimationController& other)Copy all state/parameters from another controller (since RefCounted is non-copyable)
Reset
void Reset()GetStates
const std::vector<AnimationState>& GetStates() constGetStates
std::vector<AnimationState>& GetStates()GetBoolParams
const std::unordered_map<std::string, bool>& GetBoolParams() constParameter access for editor/serialization
GetFloatParams
const std::unordered_map<std::string, float>& GetFloatParams() constGetIntParams
const std::unordered_map<std::string, int>& GetIntParams() constGetTriggers
const std::unordered_map<std::string, bool>& GetTriggers() constRemoveBool
void RemoveBool(const std::string& name)RemoveFloat
void RemoveFloat(const std::string& name)RemoveInt
void RemoveInt(const std::string& name)RemoveTrigger
void RemoveTrigger(const std::string& name)EvaluateCondition
bool EvaluateCondition(const TransitionCondition& cond) constEvaluate a single condition against current parameters
GetGraph
FAnimGraph& GetGraph()The pose-composition graph layered over this state machine (empty = the historical state-machine-only path). Lives here so it serializes inside the same .animgraph asset and shares the parameter namespace.
GetGraph
const FAnimGraph& GetGraph() constGetMirrorTables
std::unordered_map<std::string, FMirrorTable>& GetMirrorTables()Mirror tables addressable by the graph's Mirror nodes. They live on the controller (and serialize into the same .animgraph) for the same reason the blend spaces do: one asset carries everything the graph needs to evaluate, so nothing else has to be resolved before a pose can be built. FMirrorTable::LoadFromFile fills one from a standalone .mirror.
GetMirrorTables
const std::unordered_map<std::string, FMirrorTable>& GetMirrorTables() constGetBlendProfiles
std::unordered_map<std::string, FBlendProfile>& GetBlendProfiles()Blend profiles addressable by name from a transition (per-bone blend windows) and from the graph's LayeredBlend / BlendByFloat / BlendByBool nodes (per-bone weight scaling). Same reasoning as the mirror tables: one asset carries everything the controller needs to produce a pose.
GetBlendProfiles
const std::unordered_map<std::string, FBlendProfile>& GetBlendProfiles() const